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
Write an .erb from source to destination, catching and reporting errors along the way
def write_erb(source, destination) begin @task.shell.mute do @task.create_file(destination) do @project.parse_erb(source) end end rescue Exception => e @task.say "Error while building #{File.basename(source)}:" @task.say e.message + "\n", Thor::Shell::Color::RED exit end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def erbFileHandler(src)\n # try to copy file to the project directory\n dest = getFileDest(src)\n raise \"File \" + src + \"does not belong to the template\" if dest == nil\n\n if dest =~ /.erb$/ then dest = dest[0..dest.length-5] end\n\n cmdline = ''\n\n # set environment variables if possible\n @templateSubst.each do |subst|\n if subst[0].class == 'String' && subst[0] =~ /[A-Za-z_]/ &&\n subst[1] =~ /[^']/\n cmdline += subst[0] + '=\\'' + subst[1] + '\\' '\n end\n end\n\n cmdline += 'eruby -Mf \\'' + src + '\\' >\\'' + substString(dest) + '\\''\n\n puts '-- ERuby'\n puts 'Source: ' + src\n puts 'Command: ' + cmdline\n exec(cmdline) if fork() == nil\n\n # return true to stop further processing\n return true\n end", "def render_template(source_path, destination_path = nil)\n return unless source_path.end_with?('.erb')\n\n destination_path = source_path.chomp('.erb') if destination_path.nil?\n\n File.open(source_path) do |file|\n erb = ERB.new(file.read)\n File.open(destination_path, 'w') do |out|\n out.write(erb.result(binding))\n end\n\n remove_file(source_path)\n end\n end", "def create_source(name, destination)\n template = File.read(\"#{template_path(name)}/easy_type/templates/#{name}\")\n content = ERB.new(template, nil, '-').result(binding)\n write_file(destination, content)\n rescue SyntaxError\n fail \"Error in erb template #{name}\"\n end", "def formatted_source_file(result, source_file)\n template(\"source_file\").result(binding)\n rescue Encoding::CompatibilityError => e\n puts \"Encoding error file:#{source_file.filename} Coverband/ERB error #{e.message}.\"\n end", "def my_render_erb erb, opts = {}\n if (path = erb_path_for(erb)).nil?\n log_error \"If you use #my_render_erb within a dynamically defined dep, you have to give the full path to the erb template.\"\n elsif !File.exists?(path) && !opts[:optional]\n log_error \"Couldn't find erb to render at #{path}.\"\n elsif File.exists?(path)\n # require 'erb'\n debug ERB.new(IO.read(path)).result(binding)\n shell(\"cat > #{opts[:to]}\",\n :input => ERB.new(IO.read(path)).result(binding),\n :sudo => opts[:sudo]\n ) do |result|\n if result\n log \"Rendered #{opts[:to]}.\"\n sudo \"chmod #{opts[:perms]} '#{opts[:to]}'\" unless opts[:perms].nil?\n else\n log_error \"Couldn't render #{opts[:to]}.\"\n end\n end\n end\nend", "def call(src, dest)\n content = File.open(src, \"rb\", &:read)\n template = ERB.new(content, nil, \"-\").result(binding)\n File.open(dest, \"w\") { |f| f.write(template) }\n end", "def render(source, destination)\n File.open source, 'r:utf-8' do |f|\n document = Spirit::Document.new(f)\n html = document.render\n self.problems += document.solutions\n Actions.write_file destination + source.basename.sub_ext(EXT), html, 'w+', PERMISSIONS[:public_file]\n end\n end", "def template(from, to)\n erb = File.read(from)\n put ERB.new(erb).result(binding), to\nend", "def write()\n template = ERB.new(File.read(File.join(@@support_location, \"template.erb\")))\n file_contents = template.result(self.binding())\n File.write(output_name, file_contents)\n end", "def erb(template) render template end", "def convert\n erb = ERB.new(File.readlines(template_file).join)\n File.open(File.basename(content_file, File.extname(content_file)) + '.html', 'w') do |f|\n f << erb.result(get_binding)\n end\n end", "def erb(file, options)\n # https://www.rubyguides.com/2015/05/working-with-files-ruby/\n result = File.read(\"views/layout.erb\")\n template = File.read(\"views/#{file}.erb\")\n # https://www.rubyguides.com/2019/07/ruby-gsub-method/\n result.gsub! \"<%= yield %>\", template\n result\n end", "def render_erb\n require 'erb'\n\n renderer = ERB.new(template_content, trim_mode: '-')\n renderer.filename = @template_file\n renderer.result(binding)\n end", "def erb(file_name, template_name)\n template = ERB.new(File.open(template_name, \"r:UTF-8\", &:read), nil, \"-\")\n File.open(file_name, \"w:UTF-8\") { |file| file.write(template.result(binding)) }\nend", "def rescue_action_locally(exception)\n @exception = exception\n @rescues_path = File.dirname(__FILE__) + \"/templates/rescues/\"\n add_variables_to_assigns\n @contents = @template.render_file(template_path_for_local_rescue(exception), false)\n \n @headers[\"Content-Type\"] = \"text/html\"\n render_file(rescues_path(\"layout\"), \"500 Internal Error\")\n end", "def rescue_action_locally(exception)\n @exception = exception\n @rescues_path = File.dirname(__FILE__) + \"/templates/rescues/\"\n add_variables_to_assigns\n @contents = @template.render_file(template_path_for_local_rescue(exception), false)\n \n @headers[\"Content-Type\"] = \"text/html\"\n render_file(rescues_path(\"layout\"), \"500 Internal Error\")\n end", "def process_template(source_file)\n rfile = ERB.new(File.read(source_file))\n @cookbook = @metadata.name\n\n rfile.result(binding)\n end", "def process_template(template)\n @dlogger.debug \"Processing template #{template} for file #{@file}\"\n # The '-' arg allows folks to use <% -%> or <%- -%> to instruct ERB to\n # not insert a newline for that line, which helps avoid a bunch of blank\n # lines in the processed file where there was code in the template.\n erb = ERB.new(IO.read(template), nil, '-')\n # The binding arg ties the template's namespace to this point in the\n # code, thus ensuring that all of the variables above (@file, etc.)\n # are visible to the template code.\n begin\n erb.result(binding)\n rescue Exception => e\n # Help the user figure out where the exception occurred, otherwise they\n # just get told it happened here, which isn't very helpful.\n raise Etch.wrap_exception(e, \"Exception while processing template #{template} for file #{@file}:\\n\" + e.message)\n ensure\n restore_globals\n end\n end", "def render_erb(fname)\n ERB.new(\n File.read(\"src/#{fname}.erb\")\n ).result(binding)\nend", "def rescue_action_locally(exception)\n @template.instance_variable_set(\"@exception\", exception)\n @template.instance_variable_set(\"@rescues_path\", RESCUES_TEMPLATE_PATH)\n @template.instance_variable_set(\"@contents\",\n @template.render(:file => template_path_for_local_rescue(exception)))\n\n response.content_type = Mime::HTML\n render_for_file(rescues_path(\"layout\"),\n response_code_for_rescue(exception))\n end", "def render_template template_file, out_file = nil # :yield: io\n io_output = out_file && !@dry_run && @file_output\n erb_klass = io_output ? RDoc::ERBIO : ERB\n\n template = template_for template_file, true, erb_klass\n\n if io_output then\n debug_msg \"Outputting to %s\" % [out_file.expand_path]\n\n out_file.dirname.mkpath\n out_file.open 'w', 0644 do |io|\n io.set_encoding @options.encoding\n\n @context = yield io\n\n template_result template, @context, template_file\n end\n else\n @context = yield nil\n\n output = template_result template, @context, template_file\n\n debug_msg \" would have written %d characters to %s\" % [\n output.length, out_file.expand_path\n ] if @dry_run\n\n output\n end\n end", "def renderFile(templateFile, targetFile)\n puts \"Render file: #{targetFile}\" \n erb=ERB.new(File.read(templateFile))\n File.new(targetFile,'w+').write(erb.result(binding))\n end", "def view_template(source, *args, &block)\n config = args.last.is_a?(Hash) ? args.pop : {}\n destination = args.first || source.sub(/\\.tt$/, '')\n \n source = File.expand_path(source.to_s)\n context = instance_eval('binding')\n \n create_file destination, nil, config do\n content = ERB.new(::File.binread(source), nil, '-', '@output_buffer').result(context)\n content = block.call(content) if block\n content\n end\n end", "def formatted_source_file_loader(result, source_file)\n template(\"source_file_loader\").result(binding)\n rescue Encoding::CompatibilityError => e\n puts \"Encoding error file:#{source_file.filename} Coverband/ERB error #{e.message}.\"\n end", "def erb_file(erbfile, outfile = nil, remove_orig = false, opts = { :binding => binding })\n outfile ||= File.join(Dir.mktmpdir, File.basename(erbfile).sub(File.extname(erbfile), \"\"))\n output = erb_string(erbfile, opts[:binding])\n File.open(outfile, 'w') { |f| f.write output }\n VanagonLogger.info \"Generated: #{outfile}\"\n FileUtils.rm_rf erbfile if remove_orig\n outfile\n end", "def rescue_action_locally(exception)\n add_variables_to_assigns\n @template.instance_variable_set(\"@exception\", exception)\n @template.instance_variable_set(\"@rescues_path\", File.dirname(rescues_path(\"stub\")))\n @template.send!(:assign_variables_from_controller)\n\n @template.instance_variable_set(\"@contents\", @template.render(:file => template_path_for_local_rescue(exception)))\n\n response.content_type = Mime::HTML\n render_for_file(rescues_path(\"layout\"), response_code_for_rescue(exception))\n end", "def template(source, *args, &block)\n config = args.last.is_a?(Hash) ? args.pop : {}\n destination = args.first || source.sub(/#{TEMPLATE_EXTNAME}$/, \"\")\n\n source = File.expand_path(find_in_source_paths(source.to_s))\n context = config.delete(:context) || instance_eval(\"binding\")\n\n create_file destination, nil, config do\n content = CapturableERB.new(::File.binread(source), nil, \"-\", \"@output_buffer\").result(context)\n content = yield(content) if block\n content\n end\n end", "def template(relative_source, relative_destination, template_options = {})\n create_file(relative_source, relative_destination, template_options) do |file|\n # Evaluate any assignments in a temporary, throwaway binding.\n vars = template_options[:assigns] || {}\n b = template_options[:binding] || binding\n vars.each { |k,v| eval \"#{k} = vars[:#{k}] || vars['#{k}']\", b }\n\n # Render the source file with the temporary binding.\n ERB.new(file.read, nil, '-').result(b)\n end\n end", "def render (from, to, as: user, on: hosts, quiet: false, once: nil)\n self.once once, quiet: quiet do\n Dir.chdir File.dirname(file) do\n Find.find(from).each do |path|\n if File.directory?(path)\n to_path = to + path[from.length..-1]\n sh \"mkdir -p #{to_path.shellescape}\"\n elsif path =~ /\\.erb$/\n template = ERB.new(File.read(path))\n to_path = to + path[from.length..-5]\n log.info \"render: #{path} -> #{to_path}\", quiet: quiet do\n hash_map(hosts) do |host|\n host.cp StringIO.new(template.result(binding)), to_path, as: as, quiet: quiet\n end\n end\n else\n to_path = to + path[from.length..-1]\n log.info \"copy: #{path} -> #{to_path}\", quiet: quiet do\n hash_map(hosts) do |host|\n host.cp File.open(path), to_path, as: as, quiet: quiet\n end\n end\n end\n end\n end\n end\n end", "def output_html_errors\n require 'erubis'\n template =\n @options['template'] ?\n File.read(File.expand_path(@options['template'])) :\n File.read(File.join(File.dirname(__FILE__), '..', '..', 'assets', 'result.html.erb'))\n\n if @options['with-github']\n last_commit_id = @options['last-commit-id'] || `cd #{@runner.class.base_path} && git rev-parse HEAD`.chomp\n unless @options['github-name'].start_with?('https')\n @options['github-name'] = GITHUB_URL + @options['github-name']\n end\n end\n File.open(@options['output-file'], 'w+') do |file|\n eruby = Erubis::Eruby.new(template)\n file.puts eruby.evaluate(\n errors: errors,\n error_types: error_types,\n atom: @options['with-atom'],\n textmate: @options['with-textmate'],\n vscode: @options['with-vscode'],\n sublime: @options['with-sublime'],\n mvim: @options['with-mvim'],\n github: @options['with-github'],\n github_name: @options['github-name'],\n last_commit_id: last_commit_id,\n git: @options['with-git'],\n hg: @options['with-hg']\n )\n end\n end", "def write(top_line,\n bottom_line, out_file = STDOUT)\n \n\n template = ERB.new(File.read(template_file))\n out_file.puts(template.result(binding))\n end", "def load_erb(erb)\n # @tmpl = ERB.new(erb)\n @tmpl = ERB.new(erb,0,\"<>\")\n end", "def write_template(template, target, config)\n\n File.write(\n\n target,\n ERB.new(File.read(template)).result(binding)\n )\nend", "def parse(filename, context, output: nil, force: false)\n erb = ERB.new(File.read(filename))\n if(!output)\n output = filename[0..-6]\n end\n \n if(File.exists?(output) and !force)\n raise \"The output #{output} file already exists.\"\n end\n\n File.open(output, 'w') do | file |\n file.write(erb.result(context.get_binding()))\n end\nend", "def parse_file_as_erb(source_file, locals={})\n helpers = locals.delete(:helpers)\n erb_struct = Class.new(OpenStruct) do\n include ERB::Util\n include helpers if helpers\n end\n\n contents = File.read(source_file)\n b = erb_struct.new(locals).instance_eval { binding }\n ERB.new(contents).result(b)\nend", "def render_to_remote template, remote_file, *param_array\n perm = if param_array.first.is_a? Fixnum\n param_array.shift \n else\n 0600\n end\n \n locals = param_array.pop || {}\n \n # remote_dir = File.dirname remote_file\n # begin\n # @host.sftp.dir.entries remote_dir\n # rescue Exception => e\n # puts \"Directory #{remote_dir} does not exist, creating it (#{e})\"\n # mkdir_p remote_dir\n # end\n \n content = render(template, locals) \n \n @host.sftp.file.open(remote_file, 'w', perm) do |f|\n f.puts content\n end\n end", "def evaluate_erb; end", "def template(from, to)\n erb = File.read(File.expand_path(\"../templates/#{from}\", __FILE__))\n put ERB.new(erb).result(binding), to\nend", "def template(from, to)\n erb = File.read(File.expand_path(\"../templates/#{from}\", __FILE__))\n put ERB.new(erb).result(binding), to\nend", "def fill_template\n @log.debug(\"Reading erb template from file: '#{@template}'.\")\n erb = ERB.new(File.read(@template), nil, '-')\n erb.filename = @template\n erb.result(binding)\n end", "def render_erb_files(files, binding: nil, remove_extension: true)\n files.each do |file|\n rendered_file = remove_extension ? file.sub_ext(\"\") : file\n template = file.read\n rendered = ERB.new(template, trim_mode: \"-\").result(binding)\n file.rename rendered_file # keep same file permissions\n rendered_file.write(rendered)\n end\n end", "def render_file!(f, target)\n done = 'keep'.white\n # unless newer?(target, f)\n tilt = Tilt::ERBTemplate.new(f)\n oh = File.open(target, 'wb')\n oh.write tilt.render(OpenStruct.new(@attrs.deep_merge(@config['attrs'])))\n oh.close\n\n # update template timestamp\n FileUtils.touch(f)\n done = 'rendered'.bold.green\n # end\n # done\n end", "def erb(path, layout: nil, status: 200)\n content = \"\"\n\n unless path.nil?\n templates = [read_template(path)]\n templates << read_template(layout) unless layout.nil?\n\n content = templates.inject(nil) do |prev, temp|\n _render_erb(temp) { prev }\n end\n end\n\n Rack::Response.new(content, status, {\n \"Content-Type\" => \"text/html\",\n })\n end", "def formatted_source_file(source_file)\n template(\"source_file\").result(binding)\n rescue Encoding::CompatibilityError => e\n puts \"Encoding problems with file #{filename(source_file)}. Simplecov/ERB can't handle non ASCII characters in filenames. Error: #{e.message}.\"\n end", "def render\n # puts 'rendering'\n # puts @@env\n if File.exist? @temp_view\n res = \n [ \n Erubis::Eruby.new(\n File.read(File.join(@@app, \"views\", \"template\", \"tem.html.erb\")) +\n File.read(@temp_view) +\n File.read(File.join(@@app, \"views\", \"template\", \"plate.html.erb\"))\n ).result( binding )\n ]\n [200, {'Content-Type' => 'text/html'}, res]\n else\n res = \n [ \n Erubis::Eruby.new(\n File.read(File.join(@@app, \"views\", \"template\", \"tem.html.erb\")) +\n File.read(File.join(@@app, \"views\", \"404.html.erb\")) +\n File.read(File.join(@@app, \"views\", \"template\", \"plate.html.erb\"))\n ).result( binding )\n ]\n [404, {'Content-Type' => 'text/html'}, res]\n end\n end", "def process_erb_templates(cartridge_name)\n logger.info \"Processing ERB templates for #{cartridge_name}\"\n env = Utils::Environ.for_gear(@user.homedir)\n render_erbs(env, File.join(@user.homedir, cartridge_name, '**'))\n end", "def render(source)\n ERB.new(source, nil, '-').result(binding)\n end", "def erb_file(erb_path, context = {})\n erb(IO.read(erb_path))\n end", "def upload_template(src,dst,options = {})\n raise Capistrano::Error, \"put_template requires Source and Destination\" if src.nil? or dst.nil?\n put ERB.new(File.read(src)).result(binding), dst, options\n end", "def render_erb\n end", "def render(context = Erubis::Context.new)\n # Read template data\n template_filename = \"#{@template}.rhtml\"\n begin\n template = File.read(template_filename)\n rescue Errno::ENOENT\n raise ScriptError.new(\"Template #{template_filename} does not exist!\")\n end\n\n # Prepare template and variables\n eruby = Erubis::Eruby.new template\n \n # Perform templating\n begin\n result = eruby.evaluate context\n rescue\n raise TemplateError.new(\"Encountered error processing template #{template_filename}.\", $!)\n end\n\n # Output result\n output result \n end", "def interpolate(*paths)\n paths = paths.flatten\n mappings = {}\n paths.each do |path|\n if path.is_a? Hash\n mappings.merge! path\n else\n mappings[path] = path.sub(/\\.erb\\z/, '')\n end\n end\n\n mappings.each do |src, dest|\n begin\n @current_template_src = src\n @current_template_dest = dest\n template = ERB.new(File.read(src_path(src)), nil, '-')\n result = template.result(binding)\n ensure_folder @current_template_dest\n File.write File.expand_path(dest_path(@current_template_dest)), result\n rescue CancelInterpolation\n end\n @to_copy.delete src\n end\n end", "def render_template( templatefile, context, outfile )\n\t\ttemplate_src = templatefile.read\n\t\ttemplate = ERB.new( template_src, nil, '<>' )\n\t\ttemplate.filename = templatefile.to_s\n\n\t\toutput = begin\n\t\t\ttemplate.result( context )\n\t\trescue NoMethodError => err\n\t\t\traise \"Error while evaluating %s: %s (at %p)\" % [\n\t\t\t\ttemplatefile.to_s,\n\t\t\t\terr.message,\n\t\t\t\teval( \"_erbout[-50,50]\", context )\n\t\t\t]\n\t\tend\n\n\t\tunless $dryrun\n\t\t\toutfile.dirname.mkpath\n\t\t\toutfile.open( 'w', 0644 ) do |ofh|\n\t\t\t\tofh.print( output )\n\t\t\tend\n\t\telse\n\t\t\tdebug_msg \" would have written %d bytes to %s\" %\n\t\t\t[ output.length, outfile ]\n\t\tend\n\tend", "def render_template( templatefile, context, outfile )\n\t\ttemplate_src = templatefile.read\n\t\ttemplate = ERB.new( template_src, nil, '<>' )\n\t\ttemplate.filename = templatefile.to_s\n\n\t\toutput = begin\n\t\t\ttemplate.result( context )\n\t\trescue NoMethodError => err\n\t\t\traise \"Error while evaluating %s: %s (at %p)\" % [\n\t\t\t\ttemplatefile.to_s,\n\t\t\t\terr.message,\n\t\t\t\teval( \"_erbout[-50,50]\", context )\n\t\t\t]\n\t\tend\n\n\t\tunless $dryrun\n\t\t\toutfile.dirname.mkpath\n\t\t\toutfile.open( 'w', 0644 ) do |ofh|\n\t\t\t\tofh.print( output )\n\t\t\tend\n\t\telse\n\t\t\tdebug_msg \" would have written %d bytes to %s\" %\n\t\t\t[ output.length, outfile ]\n\t\tend\n\tend", "def execute!\n config[:print_only] = true\n file = load_template_file\n\n output_content = parameter_scrub!(template_content(file))\n if config[:yaml]\n require \"yaml\"\n output_content = YAML.dump(output_content)\n else\n output_content = format_json(output_content)\n end\n\n if config[:write_to_file]\n unless File.directory?(File.dirname(config[:write_to_file]))\n run_action \"Creating parent directory\" do\n FileUtils.mkdir_p(File.dirname(config[:write_to_file]))\n nil\n end\n end\n run_action \"Writing template to file - #{config[:write_to_file]}\" do\n File.write(config[:write_to_file], output_content)\n nil\n end\n else\n ui.puts output_content\n end\n end", "def _erb(templ, _binding)\n return ERB.new(templ, nil, \"<>\").result(_binding)\n end", "def parse(template, output, b = binding())\n # Generate the requested page\n template = File.read(template)\n erb = Erubis::Eruby.new(template)\n @content = erb.result(b)\n \n # Generate the layout\n layout = File.read(\"templates/layout.html.erb\")\n erb_layout = Erubis::Eruby.new(layout)\n \n FileUtils.mkdir_p(File.dirname(output))\n File.open(output, \"w+\") do |f|\n f.puts erb_layout.result(b)\n end\n end", "def render_exception(e)\n @message = e.message\n @backtrace = e.backtrace\n\n response_erb = ERB.new(File.read(\"../lib/templates/rescue.html.erb\"))\n response_text = response_erb.result(binding)\n response = ['500', {'Content-type' => 'text/html'}, [response_text]]\n end", "def erb(t)\n ERB.new( File.open(t).read, 0, '<>' ).result\nend", "def write( destination=nil )\n\t\tstart = Time.now\n\t\t\n\t\tsource = @bundle.source\n\t\t@html_path = destination || File.dirname(source)/\"#{File.basename source}_html\"\n\t\tFileUtils.rm_rf(@html_path) if File.exists?(@html_path)\n\t\tFileUtils.mkdir(@html_path)\n\t\t\n\t\tmaster_templates = DocuBot::TEMPLATE_DIR\n\t\tsource_templates = source/'_templates'\n\t\tmaster_root = master_templates/'_root'\n\t\tsource_root = source_templates/'_root'\n\t\t\n\t\t# Copy any files found in the source directory that weren't made into pages\n\t\t@bundle.extras.each do |file|\n\t\t\tFileUtils.mkdir_p( @html_path / File.dirname( file ) )\n\t\t\tFileUtils.cp( source / file, @html_path / file )\n\t\tend\n\t\t\n\t\t# Copy files from template to root of destination\n\t\t# Record these as extras so that the CHMWriter can access them\n\t\tDir.chdir @html_path do\n\t\t\texisting_files = Dir[ '*' ]\n\t\t\tFileUtils.copy( Dir[ master_templates/'_root'/'*' ], '.' )\n\t\t\tFileUtils.copy( Dir[ source_templates/'_root'/'*' ], '.' )\n\t\t\tnew_files = Dir[ '*' ] - existing_files\n\t\t\t@bundle.extras.concat( new_files )\n\t\tend\n\t\t\n\t\tDir.chdir @html_path do\n\t\t\to = Object.new\n\t\t\t\n\t\t\t# Write out every page\n\t\t\ttop = File.exists?( source_templates/'top.haml' ) ? source_templates/'top.haml' : master_templates/'top.haml'\n\t\t\ttop = Haml::Engine.new( IO.read( top, encoding:'utf-8' ), HAML_OPTIONS )\n\t\t\t@bundle.toc.descendants.each do |node|\n\t\t\t\tnext if node.anchor\n\t\t\t\t\n\t\t\t\tcontents = node.page.to_html\n\t\t\t\ttemplate = node.page.template # Call page.to_html first to ensure page.template is set\n\n\t\t\t\tcustom_js = \"#{template}.js\"\n\t\t\t\tcustom_js = nil unless File.exists?( source_root/custom_js ) || File.exists?( master_root/custom_js )\n\t\t\t\t\n\t\t\t\tcustom_css = \"#{template}.css\"\n\t\t\t\tcustom_css = nil unless File.exists?( source_root/custom_css ) || File.exists?( master_root/custom_css )\n\t\t\t\t\n\t\t\t\tvariables = {\n\t\t\t\t\t:page => node.page,\n\t\t\t\t\t:contents => contents,\n\t\t\t\t\t:global => @bundle.global,\n\t\t\t\t\t:root => node.page.root,\n\t\t\t\t\t:breadcrumb => node.ancestors,\n\t\t\t\t\t:custom_js => custom_js,\n\t\t\t\t\t:custom_css => custom_css\n\t\t\t\t}\t\t\t\t\n\t\t\t\thtml = top.render( o, variables )\n\t\t\t\tFileUtils.mkdir_p( File.dirname( node.file ) )\n\t\t\t\tFile.open( node.file, 'w' ){ |f| f << html }\n\t\t\tend\n\n\t\t\tFile.open( 'glossary-terms.js', 'w' ){ |f| f << @bundle.glossary.to_js }\n\t\tend\n\t\t\n\t\tputs \"...%.2fs to write the HTML\" % (Time.now - start)\n\tend", "def render_template(template_file, binding, outfile)\n\n debug_msg \" rendering #{outfile}\"\n\n @rel_prefix = @output_dir.relative_path_from(outfile.dirname)\n @stylesheet_url = @babel_options[:stylesheet_url] || (@rel_prefix + 'rdoc.css').to_s\n\n template_src = template_file.read\n template = ERB.new(template_src, trim_mode: '<>')\n template.filename = template_file.to_s\n\n output = nil\n begin\n output = template.result(binding)\n rescue => e\n raise RDoc::Error, \"Error while evaluating %s: %s (%s at %p)\" % [\n template_file.to_s,\n e.message, e.class.name,\n eval(\"_erbout[-50,50]\", binding)\n ], e.backtrace\n end\n\n return if @options.dry_run\n\n outfile.dirname.mkpath\n outfile.open('w', 0644) do |ofh|\n ofh.print(output)\n end\n\n end", "def process_dockerfile(fdocker_erb, fdocker_dest, vals = {})\n vals = @properties.merge(vals)\n erb = ERB.new(File.read(fdocker_erb))\n erb.def_method(ErbData, 'render', fdocker_erb)\n begin\n File.open(fdocker_dest, 'w') do |fw|\n fw.write ErbData.new(vals).render\n fw.close\n end\n rescue StandardError => e\n PrcLib.error('failed to process dockerfile for %s : %s',\n vals[:node], e.message)\n end\n end", "def invalid_erb_file(erb_file, error_message)\n file_relative_path = erb_file[/^#{Regexp.escape(cookbook_path + File::Separator)}(.*)/, 1]\n Chef::Log.fatal(\"Erb template #{file_relative_path} has a syntax error:\")\n error_message.each_line { |l| Chef::Log.fatal(l.chomp) }\n nil\n end", "def compile(template_source)\n # if RUBY_VERSION >= '1.9'\n # template_source=template_source.sub(/\\A#coding:.*\\n/, '') \n # end\n # ::ERB.new(\"<% __in_erb_template=true %>#{template_source}\", nil, \"-\", '@output_buffer')\n\n Erubis::Eruby.new(template_source.utf_or_die!)\n \n end", "def dump(obj, io)\n template_path = env.class_path(dir, obj, path) do |file|\n File.file?(file)\n end\n \n unless template_path\n raise \"no template for: #{obj.class}\"\n end\n \n io.puts render(template_path, :locals => {:obj => obj})\n end", "def emit data\n target_output = template_map.map do |template,target|\n begin\n logger.info \"Expanding template #{template}\"\n input = File.read(template)\n erb = Erubis::Eruby.new(input)\n output = erb.result({ :data => data })\n [target,output]\n rescue => e\n logger.error \"Error expanding template #{template}: #{e.message}\"\n raise e\n end\n end\n target_output = Hash[target_output]\n\n static_output = static_map.map do |input,target|\n begin\n logger.info \"Reading static file #{input}\"\n output = File.read(input)\n [target,output]\n rescue => e\n logger.error \"Error reading static file #{input}: #{e.message}\"\n raise e\n end\n end\n target_output = target_output.merge(Hash[static_output])\n # target_output is a map of relative paths to new contents\n\n changes_detected = target_output.any? do |target,output|\n _contents_changed(Pathname.new(target).expand_path(destination), output)\n end\n\n if !changes_detected\n logger.info \"No changes detected; skipping check and commit\"\n return false\n end\n\n # write targets and statics to tmp, run check, and possibly rollback\n tmp = Dir.mktmpdir(\".merlin-#{@name}-\",@custom_tmp)\n logger.debug \"Created tmp directory #{tmp}\"\n begin\n target_output.each {|target,output| _write_to(target,tmp,output) }\n success = run_command(:check, {\n :dest => tmp,\n :files => target_output.keys.map {|p| File.join(tmp,p)},\n })\n unless success\n # rollback! just nuke the tmp directory :)\n logger.warn \"Cleaning up #{tmp} after failed check\"\n FileUtils.remove_entry_secure(tmp)\n else\n # perform commit\n if @atomic\n logger.info \"Performing atomic deploy of #{tmp} to #{destination}\"\n # copy tmp to destination.$(date +%s)\n timestamped_destination = File.join(File.dirname(destination),File.basename(destination) + \".\" + Time.now.to_i.to_s)\n if File.directory? timestamped_destination\n # TODO maybe just tack on some suffix until it doesnt exist instead of erroring?\n logger.error \"Unable to copy #{tmp} to #{timestamped_destination}; already exists\"\n raise Errno::EISDIR, timestamped_directory\n end\n logger.debug \"Copying #{tmp} to #{timestamped_destination}\"\n FileUtils.cp_r(tmp,timestamped_destination)\n logger.debug \"Atomically linking #{destination} -> #{timestamped_destination}\"\n Pathname.new(destination).atomic_ln_sfn(timestamped_destination)\n #TODO we should probably clean up directories (some # of changes? timewindow?)\n else\n logger.info \"Moving outputs from #{tmp} to #{destination}\"\n target_output.keys.each do |rel_target|\n _move_to(Pathname.new(tmp).join(rel_target), Pathname.new(destination).join(rel_target))\n end\n end\n success = run_command(:commit, {\n :dest => destination,\n :files => target_output.keys.map {|p| File.join(destination,p)},\n })\n end\n success\n ensure\n if Dir.exists? tmp\n logger.debug \"Cleaning up #{tmp}\"\n FileUtils.remove_entry_secure(tmp)\n end\n end\n end", "def render_template(path)\n render(path)\n exit\n end", "def template_result template, context, template_file\n template.filename = template_file.to_s\n template.result context\n rescue NoMethodError => e\n raise RDoc::Error, \"Error while evaluating %s: %s\" % [\n template_file.expand_path,\n e.message,\n ], e.backtrace\n end", "def erb(filename, locals={}, layout=nil)\n b = binding\n use_template = template(filename, locals)\n locals = locals\n if layout\n layout = File.expand_path(\"../views/#{layout}.erb\",__FILE__)\n content = File.read(layout)\n ERB.new(content).result(b)\n else\n use_template\n end\n end", "def redirect # :yields: redirected_erbout\n current = @_erbout\n @_erbout = \"\"\n result = yield(@_erbout)\n @_erbout = current\n concat(result)\n end", "def template(src, dst, **context)\n rendered = TemplateRenderer.render(File.read(src), context)\n File.write(dst, rendered)\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 call(env)\n # Grab the request\n request = Rack::Request.new(env) \n \n # Create a new template for the given path\n # and compile it\n \n template = Template.new(Template.template_for_request(request))\n template.request = request\n output = template.compile\n\n # Build a rack response\n # Rack::Response.new.finish do |response|\n # response.write output\n # end \n [200, { 'Content-Type' => 'text/html'}, output]\n end", "def erb(file, b=binding)\n require 'erb'\n erb = ERB.new(File.read(file))\n erb.result b\n end", "def execute _binding = get_binding\n foo = 'local_erbout'\n erb = ERB.new compile, nil, nil, 'local_erbout'\n erb.result _binding\n end", "def apply_file(file, output_dir)\n # TODO: this should refer to the project_config_file variable from\n # Templar::Setup.\n return if File.basename(file) == 'templar.yaml'\n\n if file.match(/\\.erb$/)\n out = File.join(output_dir, File.basename(file, '.erb').gsub(@template, @project))\n erb = ERB.new(File.read(file))\n File.open(out, 'w') do |f|\n begin\n f.write erb.result(binding)\n rescue\n puts \"Unable to process file: #{file}\"\n exit\n end\n end\n else\n out = File.join(output_dir, File.basename(file).gsub(@template, @project))\n File.open(out, 'w') do |f|\n f.write File.read(file)\n end\n end\n end", "def render_slim(src, dest, **data)\n File.open(dest, \"w\") do |dest_file|\n rendered_html = partial(src, **data)\n dest_file.write(rendered_html)\n end\n end", "def render_output(html_title, html_body, erb_template)\n # assign i_vars referenced in template file\n @title = html_title\n @body = html_body\n\n erb = ERB.new(erb_template)\n erb.result(binding)\n end", "def copy_doc(loc, src, dest, opts)\n tmp = File.join(loc, src)\n #ext = File.extname(src)\n #case ext\n #when '.erb'\n if opts['verbatim']\n how = (File.exist?(dest) ? 'update' : 'create')\n #file = tmp_file.chomp('.stub')\n cp(tmp, dest)\n else\n #file = tname.chomp('.erb') # old way\n text = erb(tmp) \n how = (File.exist?(dest) ? 'update' : 'create')\n write(dest, text)\n end\n if opts['chmod']\n chmod(opts['chmod'], dest)\n end\n return how, dest\n end", "def render_to_file(output_path, context, properties = T.unsafe(nil)); end", "def create(dest_dir, props)\n # Check properties for the new chrb\n properties.each do |prop|\n if not props.has_key? prop.name\n raise MissingPropertyError.new(\"Missing property #{prop.name}\", prop, props)\n end\n end\n\n # Unpack the chrb template to the target dir\n create_chrb_from(File.join(chrb_repo_dir, base_filename),\n dest_dir)\n\n # Process the ERB templates, if any\n require 'erb'\n erb_templates.each do |tpl|\n base_path = File.join(dest_dir, tpl)\n template = \"#{base_path}.erb\"\n if File.readable? template\n File.open(template) do |file|\n File.open(base_path, \"w\") do |out_file|\n out_file.puts(ERB.new(file.read).result(get_chrb_binding(props)))\n end\n end\n # Delete the source file, only leave there the result\n File.unlink template\n else\n raise BadChrbError, \"Non-existent ERB template '#{template}'\"\n end\n end\n end", "def render_to_tmp(source)\n basename = File.basename(source)\n output_path = \"tmp/#{basename}\"\n FileUtils.mkdir_p(\"tmp\")\n File.open(output_path, 'w') { |file| file.write(render_tmpl(source, **$vars)) }\n output_path\nend", "def run\n print_line\n print_status 'Creating HTML report...'\n\n plugins = format_plugin_results( auditstore.plugins )\n @base_path = File.dirname( options['tpl'] ) + '/' +\n File.basename( options['tpl'], '.erb' ) + '/'\n\n title_url = auditstore.options['url']\n begin\n title_url = uri_parse( auditstore.options['url'] ).host\n rescue\n end\n\n params = prepare_data.merge(\n title_url: escapeHTML( title_url ),\n audit_store: auditstore,\n plugins: plugins,\n base_path: @base_path\n )\n\n File.open( outfile, 'w' ) { |f| f.write( erb( options['tpl'], params ) ) }\n\n print_status \"Saved in '#{outfile}'.\"\n end", "def parse_template_files(file_paths)\n require \"tempfile\"\n\n file_paths.each do |file_path|\n remote_path = File.join(latest_release, file_path)\n\n remote_template_paths = []\n\n # If a file was given, see if a template file exists.\n begin\n remote_template_paths += capture(\"ls -1 #{remote_path}.erb\").to_s.split\n rescue Capistrano::CommandError\n end\n\n # If a path was given, see recursively check for any templates.\n begin\n remote_template_paths += capture(\"find #{remote_path} -name '*.erb'\").to_s.split\n rescue Capistrano::CommandError\n end\n\n remote_template_paths.each do |remote_template_path|\n # Download the template path from the server. We want to grab the copy from\n # the server, and not the local copy, since they may differ (If I'm doing\n # a deploy and I haven't done an svn update or I'm deploying a specific\n # branch while sitting in another branch locally).\n Tempfile.open(\"capistrano-template\") do |temp_file|\n get(remote_template_path, temp_file.path)\n\n # Parse the template file as a Ruby file so we can evaluate\n # variables.\n content = File.read(temp_file.path)\n parsed_content = Erubis::Eruby.new(content).result(binding)\n\n logger.info(\"Parsed template file:\\n\\n\")\n puts parsed_content\n logger.info(\"\\n\")\n\n install_remote_path = remote_template_path.gsub(/\\.erb$/, \"\")\n\n # Write the evaluated configuration file to the server as the real\n # configuration file.\n put(parsed_content, install_remote_path)\n end\n end\n end\nend", "def export_to_template template, file\n renderer = ERB.new(File.read(template))\n output = renderer.result binding\n output_file = File.open file, 'w'\n output_file << output\n output_file.close\n end", "def render(template_name)\n if already_built_response? \n raise \"DoubleRenderError\"\n else \n controller_name = self.class.to_s.underscore \n dir = File.join(\"views\",controller_name, \"#{template_name}.html.erb\")\n # debugger\n content = File.read(dir).split(\"\\n\")\n content.map! do | statement | \n start_point = /<%/ =~ statement\n # debugger\n if start_point.nil? \n statement\n else \n front_part = statement[0...start_point]\n # returning = \n # start_point += statement[start_point+2] == \"=\" ? 2 : 1\n end_point = /%>/ =~ statement \n end_point += 1\n rear_part = statement[end_point+2..-1]\n front_part.to_s + ERB.new(statement[start_point..end_point]).result(binding) + rear_part.to_s\n end \n end \n render_content(content)\n end \n end", "def capture_erb(*args, &block) \n erb_with_output_buffer { block_given? && block.call(*args) }\n end", "def assemble_template body_file\n body = body_file.read\n return body if body =~ /<html/\n\n head_file = @template_dir + '_head.rhtml'\n footer_file = @template_dir + '_footer.rhtml'\n\n <<-TEMPLATE\n<!DOCTYPE html>\n\n<html>\n<head>\n#{head_file.read}\n\n#{body}\n\n#{footer_file.read}\n TEMPLATE\n end", "def render(template_name)\n #Use controller and template names to construct paths to template files.\n\n\n #Use File.read to read the template file.\n\n #Create a new ERB template from the contents.\n \n #Evaluate the ERB template, using binding to capture the controller's instance variables.\n\n #Pass the result to #render_content with a content_type of text/html.\n\n \n end", "def render\n ERB.new(File.read(TEMPLATE), 0, \">\").result(binding)\n end", "def render_template_to_file(template, file, context)\n t = File.read(File.join(template))\n File.open(file, \"w\") do |f|\n f << ERB.new(t, nil, \"-\").result(context)\n end\n end", "def build template\n erb = File.read(File.join(VIEWS_DIR, template + \".erb\"))\n content = ERB.new(erb).result(binding)\n File.open(template, 'w') do |f|\n f.write content.gsub(/\\n\\n\\n+/, \"\\n\\n\")\n end\n end", "def render()\n # WARNING! NO NEED TO UNDERSTAND THIS\n self.action = calling_method = caller[0].split(\"`\").pop.gsub(\"'\", \"\")\n template = File.read(view_filename)\n eruby = Erubis::Eruby.new(template)\n eruby.result(binding())\n end", "def error exception, req, res\n backtrace = exception.backtrace.join \"\\n\"\n\n res.content_type = 'text/html'\n res.status = 500\n res.body = <<-BODY\n<!DOCTYPE html>\n<html>\n<head>\n<meta content=\"text/html; charset=UTF-8\" http-equiv=\"Content-Type\">\n\n<title>Error - #{ERB::Util.html_escape exception.class}</title>\n\n<link type=\"text/css\" media=\"screen\" href=\"#{@mount_path}/css/rdoc.css\" rel=\"stylesheet\">\n</head>\n<body>\n<h1>Error</h1>\n\n<p>While processing <code>#{ERB::Util.html_escape req.request_uri}</code> the\nRDoc (#{ERB::Util.html_escape RDoc::VERSION}) server has encountered a\n<code>#{ERB::Util.html_escape exception.class}</code>\nexception:\n\n<pre>#{ERB::Util.html_escape exception.message}</pre>\n\n<p>Please report this to the\n<a href=\"https://github.com/ruby/rdoc/issues\">RDoc issues tracker</a>. Please\ninclude the RDoc version, the URI above and exception class, message and\nbacktrace. If you're viewing a gem's documentation, include the gem name and\nversion. If you're viewing Ruby's documentation, include the version of ruby.\n\n<p>Backtrace:\n\n<pre>#{ERB::Util.html_escape backtrace}</pre>\n\n</body>\n</html>\n BODY\n end", "def copy_template\n FileUtils.mkdir_p(self.source) unless File.exists?(self.source)\n File.open(File.join(self.source, 'template.erb'), 'w') do |file|\n erb = File.read(File.join(generator_path, 'template.erb'))\n erb.gsub!('{{query}}', self.query) if self.query\n file.write(erb)\n end\n FileUtils.cp_r File.join(generator_path, '_assets'), self.source\n end", "def render\n begin\n template = IO.read(get_template_path)\n rescue Exception => e\n raise PhantomError, e.message\n end\n # with all the fields\n @fields.each do |field|\n template = template.gsub(Regexp.new(\"\\\\[\\\\[#{field.field}\\\\]\\\\]\"), field.field_value.to_s)\n end\n template = template.gsub(Regexp.new(\"\\\\[\\\\[ENTRY_POINT\\\\]\\\\]\"), @config['entry_point'])\n # write\n path = ''\n begin\n Tempfile.open(['phantom','.coffee'], \"#{Rails.root}/tmp\") do |f|\n f.print template\n path = f.path\n end\n rescue\n return false\n end\n path\n end", "def render_erb_template(template_path, options)\n require 'tilt'\n Tilt::ERBTemplate.new(template_path).render(nil, options)\n end", "def render compiler, opt=@options\n template = File.read(opt[:template])\n renderer = ERB.new(template)\n output = renderer.result(binding)\nFile.write(opt[:ofile], output)\n FileUtils.chmod('+x', opt[:ofile])\nend", "def execute\n Services::Slog.debug({:message => \"File write for #{@template[:identifier]}\", :module => \"FileTemplate\", :task => \"execute\", :extra => {:template => @template[:identifier], :payload => @template[:payload]}})\n case @template[:payload][:method]\n when 'create'\n begin\n\n @template.users.each do |user|\n File.open(\"data/users/#{user.id}/#{@template[:payload][:uri]}\", \"w+\") { |file| file.write(\"\\n\") }\n response = { :status => \"200\", :message => \"File created.\", :id => @template[:payload][:uri]}\n\n unless @template[:payload][:content].nil? then\n File.open(\"data/users/#{user.id}/#{@template[:payload][:uri]}\", \"w+\") { |file| file.write(@template[:payload][:content]) }\n end\n end\n rescue Exception => e\n Services::Slog.exception e\n response = { :status => \"400\", :message => \"Method not is unsupported, #{e}\" }\n end\n when 'append'\n begin\n @template.users.each do |user|\n unless @template[:payload][:content].nil? then\n File.open(Dir.pwd + \"/data/users/#{user.id}/#{@template[:payload][:uri]}\", \"a+\") { |file| file.write(@template[:payload][:content]) }\n end\n end\n response = { :status => \"200\", :message => \"Content appended to file\", :id => @template[:payload][:uri]}\n rescue Exception => e\n response = { :status => \"403\", :message => \"Error processing file, #{e}\" }\n Services::Slog.exception e\n end\n end\n\n response\n end", "def generate_file_from_template(template_path, file_path, options)\n write_content_to_file(file_path, render_erb_template(template_path, options))\n end" ]
[ "0.6553724", "0.6489394", "0.63403064", "0.6284842", "0.6217545", "0.61641157", "0.6161068", "0.61047214", "0.6074828", "0.6002059", "0.59314746", "0.5918138", "0.59011805", "0.5898837", "0.5839922", "0.5839922", "0.58382523", "0.58367664", "0.58190125", "0.5808264", "0.5795463", "0.5791413", "0.57774144", "0.5760662", "0.57472134", "0.5742078", "0.5706969", "0.5693069", "0.5661921", "0.563305", "0.5630363", "0.5629482", "0.56227237", "0.5577771", "0.5554081", "0.5540167", "0.55302", "0.54912317", "0.54912317", "0.5471946", "0.5438632", "0.5435264", "0.54301405", "0.54009056", "0.54005504", "0.54004997", "0.54001033", "0.5397677", "0.5387844", "0.5387665", "0.5383099", "0.5374699", "0.5369846", "0.5369846", "0.53655577", "0.5354316", "0.53542995", "0.5353832", "0.534845", "0.53430235", "0.5333425", "0.5323999", "0.53044784", "0.5292459", "0.5281155", "0.52789193", "0.5274586", "0.52718186", "0.5264601", "0.52631545", "0.52574766", "0.52500963", "0.5236515", "0.52172303", "0.5208398", "0.5203235", "0.5197798", "0.5195421", "0.51833785", "0.51793796", "0.5178642", "0.51747996", "0.5157051", "0.515188", "0.515001", "0.514165", "0.5140136", "0.5137107", "0.51361734", "0.5135285", "0.51317745", "0.5125471", "0.5112604", "0.51010996", "0.5097151", "0.5095289", "0.5092331", "0.50896865", "0.508893", "0.50889146" ]
0.78918356
0
USING ARGUMENTS say_hello returns 'hello'
def say_hello 'hello' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def say_hello name1=\"oscar\", name2=\"shane\"\n\t\"hello, #{name1} and #{name2}\"\nend", "def say_hello\n me = \"Chris P. Bacon\"\n puts \"hello from #{me}\"\nend", "def say_hello\n 'hello'\n end", "def say_hello name\n \"Hello, #{name}!\"\nend", "def say_hello(name)\n \"Hello, #{name}.\"\n end", "def say(something)\n \"Say #{something}\"\n end", "def say_hello\n \"Hello #{@name}\"\n end", "def say_hello\n return \"hello I am #{@name}\"\n end", "def say_hello name\n return \"Hello, #{name}!\"\nend", "def say_hello name1=\"Oscar\", name2=\"Shane\"\n \"hello, #{name1} and #{name2}\"\nend", "def say_hello thing_to_say\n puts \"Hello \"+thing_to_say\nend", "def say_hello(name)\n puts \"Good afternoon, #{name}. How are you?\"\nend", "def say_hello(thing_to_say)\n puts thing_to_say \nend", "def say_hello(name)\n puts \"Hello, #{name}!\"\n end", "def say_hello (thing_to_say)\n puts thing_to_say\nend", "def say_hello3(name1=\"oscar\", name2=\"shane\")\n \"hello, #{name1} and #{name2}\"\nend", "def say_hello(name)\n \"Hi #{name}!\"\nend", "def say_hello\n \"Quack! I'm a duck called #{ @name }\"\n end", "def say_hello2(name1=\"oscar\", name2=\"shane\")\n puts \"hello, #{name1} and #{name2}\"\nend", "def say_hello(arg)\n puts arg\nend", "def say_hello(thing_to_say)\n puts thing_to_say\nend", "def say_hello name1, name2 #pass parameters just like any other language. If you have lots of parameters, use Parentheses for readability (keep the code clean)\n puts \"Hello, #{name1} and #{name2}\"\nend", "def say_hello(thing_to_say)\n puts thing_to_say\nend", "def say_hello(thing_to_say)\n puts thing_to_say\nend", "def say_hello(name)\n return \"Hello, \" + name\nend", "def say_hello(arg)\n puts arg\nend", "def say_hello_3 name1=\"Bill\", name2=\"Ted\"\n \"hello, #{name1} and #{name2}\"\nend", "def say_hello(statement)\n 'We have important information! ' + statement.to_s\nend", "def say_hello(name)\n \"Hello, \" + name\nend", "def say_hello(name)\n puts \"Hello #{name}!\"\nend", "def say_hello_wih_argument (name)\n puts name\nend", "def say_hello(name)\n return \"Hi, #{name}. Have a good day.\"\nend", "def say_hello(name)\n\t\"Ich bin #{name}.\"\nend", "def sayHello(name)\n result = \"Hello, \" + name + \"!\"\n return result\nend", "def say_hello(name, city, state)\n return 'Hello,' + name.join(' ') + '! Welcome to ' + city + ', ' + state + '!'\nend", "def say_hello(thing_to_say)\n puts thing_to_say\nend", "def say_hello\n 'hello'\nend", "def say_hello\n 'hello'\nend", "def say_hello\n 'hello'\nend", "def say_hello(name, city, state)\r\n # Your Code Here\r\n \"Hello, #{name.join(\" \")}! Welcome to #{city}, #{state}!\"\r\nend", "def say_hello(name, city, state)\n \"Hello, %s! Welcome to %s, %s!\" % [name.join(\" \"), city, state]\nend", "def sayHello(name)\n puts \"Hello, #{name}\"\nend", "def sayHello( name=\"Stranger\", adjective=\"stinky\" )\n puts \"Hello #{ adjective } #{ name }\"\n \"hotdogs hotdogs hotdogs\"\nend", "def say_hello\n \"hello\"\nend", "def hello(who)\n puts \"Hello, #{who}\"\nend", "def say_hello(name)\n var = \"Hello, \" + name\n return var\nend", "def say_hello name # name is the parameter\n puts \"Hello, #{name}!\" # the data contained here is the argument\nend", "def say_hello(name, num)\n\t\tputs \"Greetings, #{name}.\"\n\t\tputs \"you are number #{num}.\"\n\tend", "def say_hi(name)\n result = \"Hey Hi, #{name}\"\n return result\nend", "def say_hello(name,health=0)\n\t\"Ich bin #{name} und mir geht es zu #{health}% gut.\"\nend", "def greet(who)\n\t\"Hello, #{who}!\"\nend", "def greet(who)\n\t\"Hello, #{who}!\"\nend", "def greet(who)\n\t\"Hello, #{who}!\"\nend", "def say_hello(name, city, state)\n \"Hello, #{name.join(\" \")}! Welcome to #{city}, #{state}!\"\nend", "def say_hello(name)\r\n\tputs \"Hello #{name}!\"\r\n\t#don't need #{name.to_s}!\" because it knows it needs to convert it to a string\r\nend", "def say words='hello fella'\n puts words\nend", "def say_hello(name=\"Ruby Programmer\")\n puts \"Hello #{name}!\"\nend", "def say_hello name # starts with a definition\n puts \"hello #{name}, nice to meet you\"\nend", "def hello(name) \n\t\"hello #{name}\"\nend", "def say_hello_to_chloe\n # a variable holds the string\n # BTW single quote is a static string - meaning it doesn't change\n hello_message_variable = 'Hello Chloe!'\n # print out the message to the console\n puts hello_message_variable\n # then return it so it can be used\n return hello_message_variable\n end", "def say_hello(name, city, state)\r\n \"Hello, #{name.join(\" \")}! Welcome to #{city}, #{state}!\"\r\n end", "def sayHello(str)\n puts 'Hey, good to see you ' + str\nend", "def say_hello (name= \"Ruby Programmer\")\n\n\tputs \"Hello #{name}!\"\nend", "def sayhello(name, last_name='Rojas')#al hacer parametro=______ es un parametro por defecto, si no se especifica luego linea 6, me lo auto completa\n horoscope = 'capricornio'\n \"Hola #{name.capitalize} #{last_name.capitalize}. Pura Vida! #{horoscope}\" #notar que las interpolaciones estan separadas!!\nend", "def say_hello(name=\"Ruby Programmer\")\n puts \"Hello #{name}!\"\nend", "def sayhi(name, age)\n puts (\"Hello \" + name + \", you are\" + age.to_s)\nend", "def say(text)\n `say #{text}`\n end", "def say_hello_personal(name)\n\tputs \"Hello \" + name\nend", "def hello(name)\n output = []\n output << \"from #{options[:from]}\" if options[:from]\n output << \"Hello #{name}\"\n output = output.join(\"\\n\")\n puts options[:yell] ? output.upcase : output\n puts \"> done saying hello\" if options[:verbose]\n end", "def say_hello\n\t\"Ich bin #{@name} mit einem Wert von #{@health}.\"\n\tend", "def greeter(name)\n puts \"Hello #{name}! How are you today?\"\nend", "def say2(words=\"hello2\")\n puts words \nend", "def say_hello (name)\n\tputs \"Ich bin #{name}.\"\nend", "def say_hello_to(name)\n puts \"Hello, #{name}. It's good to see you.\"\n puts \" \"\n end", "def sayhi(name, age)\n puts (\"Hello\" + name + \", you are \" + age.to_s)\nend", "def hello (name)\n\tputs \"Hi \" + name\nend", "def greet name, name2\n puts \"Hello, #{name} and #{name2} how are you all doing today?\"\nend", "def hello(name)\n\t\"Hello, \" + name\nend", "def hello(name, age)\n\tputs \"Welcome #{name}, #{age} is definitely not too old to learn how to code\" \nend", "def say_hello_world_to(first_name)\n\n # hello_world is a variable. But this time we are going to create a custom message\n # Notice what's going on in side the double quotation marks. We use the \"\" to\n # tell Ruby to create a string message using the contents of the 'first_name' variable.\n # In fact, the special sequence '#{first_name}' tells Ruby to stick the contents of\n # 'first_name' into the string\n hello_world_variable = \"Hello #{first_name}!\"\n\n # print it out just like last time\n puts hello_world_variable\n\n # return it to the calling code just like last time.\n return hello_world_variable\n end", "def say_hello\n puts \"HELLOOOOO!\"\nend", "def saygoodbye(name=\"John\", surname=\"Doe\")\n puts (\"Good Bye \" + name + \" \" + surname)\nend", "def sayHi\n\t\tputs(greet)\n\tend", "def say(words='hello')\n\tputs words + '.'\nend", "def say_hello\n # LOCAL VARIABLE - only avaialble to this\n _hello_string = \"Hello\"\n # INSTEAD OF CALLING THE INSTANCE VARIABLE, WE CAN CALL THE GETTER SINCE WE HAVE GETTERS AND SETTERS (IE film_name below)\n puts \"#{_hello_string} #{film_name}\"\n end", "def say_hello (name)\n\tputs \"Ich bin #{name}\"\nend", "def greet (name)\n\treturn \"Hello, #{name}\"\nend", "def sayHi\n\t\tputs \"hello, my name is #{@name}\"\n\tend", "def say_hi\n \"Hi!\"\n end", "def greet(name)\n print \"Hello, #{name} how are you doing today?\"\nend", "def hello (name)\n return \"Hello, \" + name\nend", "def greet(name)\n\t\"Hello, #{name}!\"\nend", "def hello(name)\n\tputs \"Hello \" + name\nend", "def greet(name)\n puts \"hello \" + name\nend", "def greet(greeting=\"Hello\")\n\tputs greeting\nend", "def say\n send_text \"You just said: #{params}\"\n end", "def hello(name)\n return 'Hello, ' + name\nend", "def say_hello\n\tputs \"Bonjour!\"\nend", "def hello1 (name)\n 'Hello ' + name\nend", "def hello(name)\n return \"Hello, \"+name\nend" ]
[ "0.8066508", "0.80409735", "0.786744", "0.7859391", "0.7854179", "0.7823369", "0.7822087", "0.78177315", "0.7813887", "0.780884", "0.7763005", "0.7730942", "0.7717409", "0.7711996", "0.7702983", "0.76957244", "0.76934516", "0.76778334", "0.7673846", "0.7671188", "0.76706964", "0.7670486", "0.766693", "0.766693", "0.7658303", "0.7655257", "0.7652102", "0.764478", "0.76421213", "0.76357675", "0.75893146", "0.7588531", "0.7586068", "0.7570339", "0.75681007", "0.75665736", "0.7522003", "0.7522003", "0.7522003", "0.7520837", "0.7508582", "0.7494311", "0.7484745", "0.7482686", "0.7475427", "0.7467879", "0.7453132", "0.7447924", "0.7444356", "0.7441648", "0.7435876", "0.7435876", "0.7435876", "0.74332017", "0.74236685", "0.74210805", "0.7417281", "0.7407992", "0.73973644", "0.7395963", "0.73882955", "0.7385942", "0.73811084", "0.73767644", "0.73606884", "0.7352032", "0.7350211", "0.7342796", "0.7340012", "0.73332113", "0.7331734", "0.73241025", "0.730542", "0.73035", "0.73011523", "0.72942686", "0.72937596", "0.72818106", "0.7274451", "0.7269709", "0.725797", "0.72465295", "0.7244512", "0.7224325", "0.72199464", "0.7217563", "0.7215456", "0.720527", "0.72012705", "0.71998477", "0.7192169", "0.71860063", "0.7181586", "0.718128", "0.71806276", "0.7179279", "0.717042", "0.71676147", "0.71631265", "0.71608365" ]
0.79700834
2
echo returns the input string i.e., if the passed input string is "hello", returns "hello"
def echo(str) str end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def echo(string)\n string\n end", "def echo(str)\n str\n end", "def echo (input)\n input\n end", "def echo(string)\n string\nend", "def echo(input)\n input\nend", "def echo(input)\n \"#{input}\"\nend", "def echo(s)\n s\nend", "def echo(str)\n str\nend", "def echo(input)\n return input\nend", "def echo(word)\n\treturn word\nend", "def echo(str)\n puts str\nend", "def echo( word )\n word\nend", "def echo(phrase)\n\treturn \"#{phrase}\"\nend", "def echo(word)\n return word\nend", "def echo(word)\n word\nend", "def echo(str)\n p str\nend", "def echo(text)\n text\nend", "def echo(what)\n \"#{what}\"\nend", "def echo(text)\n\ttext \nend", "def echo(word)\n\nend", "def echo(value); end", "def echo(value); end", "def shout(str)\n puts str\n end", "def say_hello\n puts \"What's you're name?\"\n name = gets.strip\n \n#The 'gets' prompts the user, and the 'strip' takes away the line break that comes when you use 'puts'\n \n puts \"Hello #{name}!\" #This is called interpolation \nend", "def echo(string)\n @commands << \"echo #{string}\"\n end", "def echo(a)\n\ta\nend", "def say(output)\n puts \"===> #{output} <===\"\nend", "def say(input)\n puts \"=> #{input}\"\nend", "def echo(e)\n return \"#{e}\"\nend", "def echo _args\n \"echo _args;\" \n end", "def echo_cmd(str)\n if verbose_mode?\n \"echo #{(\"$ \" + str).inspect} &&\\n#{str}\"\n else\n str\n end\n end", "def echo(s)\n\n instructions = 'echo ' + s\n r = @ssh ? @ssh.exec!(instructions) : `#{instructions}`\n puts 'r: ' + r.inspect if @debug\n @results[:echo] = r.chomp\n\n end", "def get_input(*msg)\n print *msg\n return gets.strip\n end", "def echo(message)\n puts message\n end", "def echo greeting\n greeting\nend", "def ask(string)\r\n log '', string\r\n STDIN.gets.strip\r\n end", "def HelloString(str)\n puts \"Hello #{ str } !\"\nend", "def echo message\r\n command 'echo', message\r\n end", "def greet\n print 'Enter your name : '\n name = gets.to_s.chomp\n puts \"Hello #{name}\"\nend", "def echo msg\n $stdout.puts msg\nend", "def say_hello\n p \"What is your name?\"\n name = gets.chomp\n p \"Hello, #{name}, nice to meet you!\"\nend", "def message(string)\n puts\n puts \"--> #{ string }\"\nend", "def message(string)\n puts\n puts \"--> #{ string }\"\nend", "def message(string)\n puts\n puts \"--> #{ string }\"\nend", "def puts str\n %s(puts (callm str __get_raw))\n end", "def echo(message)\n run 'echo', message\n end", "def show(str)\n\t\t@pipe.puts \"show #{str}\"\n\tend", "def hello\n print \"Lovely to meet you! What is your name? \\n\"\n user_name = gets.chomp\n return \"#{user_name}, it's lovely to meet you!\"\nend", "def sayHello(str)\n puts 'Hey, good to see you ' + str\nend", "def say(str)\n \"=> #{str}\"\nend", "def say_hello\nputs \"Whats your name?\"\n name = gets.strip #gets info from the user. Strip just takes away the line break\n puts \"Hello #{name}!\" #this is called INTERPOLATION\n end", "def prompt(string)\n puts \">> #{string}\"\nend", "def prompt(string)\n puts \">> #{string}\"\nend", "def prompt(string)\n puts \">> #{string}\"\nend", "def prompt(string)\n puts \">> #{string}\"\nend", "def prompt(string)\n puts \">> #{string}\"\nend", "def prompt(string)\n puts \">> #{string}\"\nend", "def say(text)\n `say #{text}`\n end", "def print\n puts string\n end", "def echo(value)\n puts \"#{ApiSettings::API_ECHO_PREFIX}#{value.to_s}#{ApiSettings::API_CMD_SUFFIX}\"\nend", "def say text\n @output.say text\n end", "def get_user_input(message)\n puts message\n gets.chomp\n end", "def show(msg)\n puts 'EXAMPLE<basic> ' + msg\nend", "def puts(string)\n print \"#{string}\\n\"\nend", "def narrate(string)\n puts\n puts string\n puts\n STDIN.getch\n end", "def say_hello \r\n\tputs \"what is your name?\"\r\n\tanswer =gets.chomp\r\n\tputs \"what is your last name?\" \r\n\tanswer2= gets.chomp\r\n\tputs \"hello #{answer} #{answer2}\"\r\n\tputs 'hello #{answer} #{answer2}'\r\nend", "def say_hi \n expression = \"I am a genius\"\n puts expression\n end", "def message(string)\n puts \"==> #{string}\"\nend", "def puts(str)\nend", "def echo n\n n\nend", "def echo(value)\n send_command([:echo, value])\n end", "def say text\n @output.say text\n end", "def only(string) # function only takes string argument\n\tputs \"The best pizza is #{string}\" # prints to the screen \"The best pizza...\" and takes the string argument\nend", "def printing_quotes\n puts \"What is the quote?\"\n quote = gets.chomp\n puts \"Who said the quote?\"\n name = gets.chomp\n puts name + \" says, \" + \"\\\"\" + quote + \"\\\"\"\n # puts name + \" says, \" + \"\\\"#{quote}\\\"\"\nend", "def say_hello_to_chloe\n # a variable holds the string\n # BTW single quote is a static string - meaning it doesn't change\n hello_message_variable = 'Hello Chloe!'\n # print out the message to the console\n puts hello_message_variable\n # then return it so it can be used\n return hello_message_variable\n end", "def prompt(str)\n puts \"=> #{str}\"\nend", "def sce1_opt1\n # sce1_opt = gets.chomp.to_s.downcase\n puts \"\\nLooks like you will never solve the mystery\"\n puts \"Game Over\"\n `say -vFred Game Over`\nend", "def show(arg)\n print (\"Result = #{arg.s}\\n\")\nend", "def string_me(char1,char2)\n puts \"I was a very nice day out #{x} could not believe the tales that #{y} told \"\nend", "def puts(str='')\n output(str)\n end", "def echoa(as); as.each { |a| print a.is_a?(String) ? a : a.inspect }; end", "def shout_name\n puts \"What is your name?\"\n name = gets.chomp\n\n message = \"Hello #{name}\"\n\n if name[-1] == '!'\n puts \"#{message} Why are we screaming?\".upcase\n else\n puts message + \".\"\n end\nend", "def echo(words)\n\twords\nend", "def test_with_string1; show(\"Hello!\") end", "def prompt(string)\n puts \"==> #{string}\"\nend", "def get_word(word_needed)\n print \"#{word_needed} \"\n gets.chomp\nend", "def ask_for_(thing)\n puts \"What's the #{thing}?\"\n gets.chomp\n end", "def get_input message\n\n puts message\n input = gets.chomp.downcase\n\nend", "def print_string_message_gdi\n puts %q{Double-quoted strings can include escaped characters such as \\n and \\\\\\\\\nas well as interpolated Ruby expressions like #{Time.now}.}\nend", "def get_user_input\n gets.strip\nend", "def basic_feature(str)\n\tputs str + \" \" + str\n\tputs str * 3\n\tputs \"1\" + \"2\"\n\tputs \"1\" * 2\n\tputs str.size\n\tputs str.length\n\tputs str.capitalize\n\tputs str.reverse\n\tputs str.upcase\n\tputs str.downcase\n\tputs str.swapcase\nend", "def sysout(string)\n\tputs (\"[SYSTEM]: \" + string) \nend", "def sysout(string)\n\tputs (\"[SYSTEM]: \" + string) \nend", "def echo e\n e\nend", "def say_hello(name)\r\n\tputs \"Hello #{name}!\"\r\n\t#don't need #{name.to_s}!\" because it knows it needs to convert it to a string\r\nend", "def greeting (name)\n puts \"What is your name?\"\n name = gets.chomp\n puts \"Hello #{@name}!\"\n end", "def prompt(string)\n puts \"=> #{string}\"\n gets.chomp\nend", "def get_input(question)\n\t\tputs \"What's your #{question}?\"\n\t\tgets.chomp\nend", "def greet1\n print 'Enter your name : '\n name = gets.to_s.chomp\n if name == 'Alice' || name == 'Bob'\n puts 'Hello #{name}'\n else\n puts 'Hello'\n end\nend" ]
[ "0.8112701", "0.79045033", "0.7831075", "0.7693906", "0.7547855", "0.7517844", "0.7515068", "0.74899113", "0.7470483", "0.73577803", "0.73492455", "0.7309006", "0.7291037", "0.72585726", "0.72428817", "0.7235455", "0.70557386", "0.69892406", "0.6900244", "0.6863362", "0.6756366", "0.6756366", "0.67374456", "0.66635936", "0.6637997", "0.6487608", "0.6473935", "0.64404804", "0.64202255", "0.6407784", "0.6405509", "0.63797796", "0.6337455", "0.63325757", "0.63297105", "0.6274215", "0.62412167", "0.62352777", "0.6172281", "0.6160558", "0.61575866", "0.61571366", "0.61571366", "0.61571366", "0.6155175", "0.6144479", "0.61418146", "0.61357504", "0.61356676", "0.61022365", "0.60945827", "0.60905844", "0.60905844", "0.60905844", "0.60905844", "0.60905844", "0.60905844", "0.60660297", "0.6042901", "0.6022342", "0.5972515", "0.59583986", "0.59487534", "0.594189", "0.5931335", "0.5908022", "0.5894422", "0.5884907", "0.58812064", "0.58765376", "0.5871428", "0.58655876", "0.5865342", "0.5862965", "0.5862439", "0.5859317", "0.5851429", "0.5849287", "0.5846237", "0.5844938", "0.5841999", "0.58317846", "0.58099556", "0.5802974", "0.57990754", "0.5789974", "0.57879674", "0.5781768", "0.57639796", "0.57562834", "0.5742885", "0.5734728", "0.5734728", "0.5725035", "0.57227683", "0.57171255", "0.5714043", "0.5703618", "0.5700458" ]
0.7532258
6
eddie_izzards_height calculates and returns Eddie Izzard's height takes in the height of heels he's wearing (default value: 0) and adds heel height to his base 67 inches for the result
def eddie_izzards_height(heel_height = 0) 67 + heel_height end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eddie_izzards_height (heel_height=0)\n 67 + heel_height\n end", "def eddie_izzards_height(height_of_heels=0)\n new_height = height_of_heels + 67\n return new_height\n end", "def eddie_izzards_height(heelHeight=0)\n heelHeight + 67\nend", "def eddie_izzards_height(heels_height=0)\n heels_height+67\nend", "def eddie_izzards_height(heel_height = 0)\n heel_height + 67\nend", "def eddie_izzards_height (heels=0)\n 67 + heels\nend", "def height(_hash)\n raise Sibit::NotSupportedError, 'Earn API doesn\\'t provide height()'\n end", "def compute_height(pad = 2, factor = 13)\n (max_actions + pad) * factor\n end", "def height\n @alive ? @height.round(1) : \"A dead tree is not very tall. :(\"\n end", "def height\n return 0 if @root.nil?\n return hegiht_helper(@root)\n end", "def height(_hash)\n raise Sibit::NotSupportedError, 'Blockchair API doesn\\'t provide height()'\n end", "def height(accessoryHeight)\n return if accessoryHeight.nil?\n @dimensions[:height] = [accessoryHeight.to_f, MIN_HEIGHT, MAX_HEIGHT].sort[1]\n end", "def height(y = @y)\n height = [y]\n return height unless @page\n @page.size[2].times { |i| height << y - (i + 1) }\n @page.size[3].times { |i| height << y + (i + 1) }\n return height\n end", "def formatted_height\n '000'\n end", "def height(input)\n process(:height, input)\n end", "def height\n @y1 - @y0\n end", "def height()\n 0\n end", "def updateHeight(height)\n height_array = height.split(\"-\")\n feet = height_array[0]\n inches = height_array[1]\n return \"#{feet}' #{inches}\\\"\"\nend", "def height\n heights = [left_height, right_height].sort\n\n heights.last\n end", "def height!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 36 )\n\n type = HEIGHT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 366:9: 'height'\n match( \"height\" )\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__, 36 )\n\n end", "def height\n @height = @height + 1\n end", "def height\n @dimensions.y\n end", "def highest_height\n i = acc.reverse.find_index{|i|!i.nil?}\n i ||= 0\n acc.length - i\n end", "def height\n barcode.two_dimensional? ? (ydim * encoding.length) : (@height || 100)\n end", "def height\n barcode.two_dimensional? ? (ydim * encoding.length) : (@height || 100)\n end", "def height\r\n return (@y2-@y1).abs\r\n end", "def height\r\n assert_exists\r\n return @o.invoke(\"height\").to_s\r\n end", "def height\n @height || 100\n end", "def height\n @bottom_edge - @top_edge\n end", "def height\n (self.width.to_f * (9.to_f/16.to_f)).to_i\n end", "def height\n defined?(@ht) ? @ht : nil\n end", "def height\n top + bottom\n end", "def height\n end", "def height\n end", "def height(hash)\n best_of('height') do |api|\n api.height(hash)\n end\n end", "def get_height\n return get_keyword_value(\"FLOOR-HEIGHT\").to_f\n end", "def height\n memoized_info[:height]\n end", "def height\n max_height = 0\n each do |child|\n if child.kind_of? Tree\n max_height = [max_height, 1].max\n else\n max_height = [max_height, child.height].max\n end\n end\n max_height.succ\n end", "def height(other)\n a = distance_to_chord(other)\n Math.sqrt(r ** 2 - a ** 2)\n end", "def height\n puts \"Height: #{@tHeight} meter(s).\"\n # puts \"Fruits: #{@fruits} Fruit(s).\"\n oneYearPasses\n end", "def height\n return @shadow_point.y - self.y\n end", "def height\n return @shadow_point.y - self.y\n end", "def height\n dimensions()[:y]\n end", "def height(value)\n @ole.Height = value\n nil\n end", "def height(value)\n @ole.Height = value\n nil\n end", "def item_height(*args, &block)\n total_height = height - (standard_padding * 2)\n if total_height > 96\n total_height / (total_height / 96)\n else\n super(*args, &block)\n end\n end", "def height\n return height_helper(@root, 0, 1)\n end", "def height\n return height_helper(@root, 0, 1)\n end", "def height; end", "def height; end", "def height\n return @height\n end", "def height=(value)\n @height = value\n end", "def height\n\t\tfloors.size\n\tend", "def base_height; 24; end", "def base_height; 24; end", "def height\n return height_helper(@root)\n end", "def height\n return height_helper(@root, 0)\n end", "def height\n return height_helper(@root, 0)\n end", "def full_height\n height + (margin * 2)\n end", "def full_height\n height + (margin * 2)\n end", "def full_height\n height + (margin * 2)\n end", "def height\n return 0 if @root.nil?\n return height_helper(@root, 0, 1)\n end", "def height\n return 0 if @root == nil\n\n current = @root\n\n return height_helper(current, 1, 1)\n end", "def height(value)\n fail InvalidHeight if y_out_of_bounds?(value)\n\n attributes[:geometry][:height] = value\n end", "def height\n @ole.Height\n end", "def height\n @ole.Height\n end", "def height\n current_node = @root\n\n return height_helper(current_node)\n end", "def height=(value)\n\t\t\t@height = value\n\t\tend", "def height=(value)\n\t\t\t@height = value\n\t\tend", "def height\n size_a[1]\n end", "def height\n height_helper(@root, 0)\n end", "def height\n\t\treturn @height\n\tend", "def screenshot_height_for(game)\n return 0 if game.nil? || game.image_height.nil?\n return game.image_height\n end", "def jump_height\r\r\n (@jump_peak * @jump_peak - (@jump_count * CXJ::FREE_MOVEMENT::JUMP_SPEED - @jump_peak).abs ** 2) / 2\r\r\n end", "def evenize(number)\n number = number.ceil.even? ? number.ceil : number.floor\n number.odd? ? number += 1 : number # needed if new_height ended up with no decimals in the first place\n end", "def height(style_name=nil)\n style_name ||= reflection.default_style\n if style_name.equal?(:original)\n from_examination :@original_height\n else\n dimensions(style_name).at(1)\n end\n end", "def height\n top - bottom\n end", "def height_calc\n lines = [@data.length, page_row_max].min rescue page_row_max\n return lines * line_height + standard_padding * 2\n end", "def height_calc\n lines = [@data.length, page_row_max].min rescue page_row_max\n return lines * line_height + standard_padding * 2\n end", "def height_multiplier\n @height_multiplier || 1\n end", "def get_height(dta)\n get_dimension('height', dta)\n end", "def calculate_h\n # Get all black and red cells and calculate the distance from the last cell or the first cell\n h = 0\n @state.each_with_index do |cell, index|\n if cell != 'F'\n h += (cell == 'B') ? @state.length - index : index\n end\n end\n return h\n end", "def height\n # raise NotImplementedError\n # return 0 if @root.nil?\n return height_helper(@root, 0, 1)\n end", "def calc_height; padding * 2 + base_height; end", "def calc_height; padding * 2 + base_height; end", "def height\n @height\n end", "def display_height\n (display_width.to_f / width.to_f) * height\n end", "def display_height\n (display_width.to_f / width.to_f) * height\n end", "def display_height\n (display_width.to_f / width.to_f) * height\n end", "def height=(_); end", "def height=(_); end", "def height\n return nil unless @height\n if @height < 0\n return ((FFI::NCurses.LINES + @height) - self.row) + 1\n #return (FFI::NCurses.LINES + @height) \n end\n @height\n end", "def height\n depths = []\n recursive_yield_leaf_heights(current_node: @root, depth: 0) { |depth| depths << depth }\n return depths.max || 0 # The depth of an empty tree is zero.\n end", "def height\n bounds[:bottom] - bounds[:top]\n end", "def height\n bounds[:bottom] - bounds[:top]\n end", "def get_adjusted_height (width, height)\n return width == 0 ? 0 : (height.to_f * FACEBOOK_MAX_WIDTH.to_f / width.to_f).to_i\n end", "def height(unit: :metric)\n case unit\n when :imperial\n inches = rand_in_range(57, 86)\n \"#{inches / 12} ft, #{inches % 12} in\"\n when :metric\n rand_in_range(1.45, 2.13).round(2).to_s\n end\n end", "def height\n a = self.orientation\n return 0.inch if not a\n a[0].z\nend", "def height\n return 0 if @root.nil?\n current = @root\n height_recursive(current)\n end", "def board_foot(board_length, board_width)\n # Calculates the height for a board foot\n 144 / (board_length * board_width)\nend" ]
[ "0.83160186", "0.8266309", "0.77419645", "0.7681273", "0.7660618", "0.7577849", "0.6069454", "0.5926648", "0.59022003", "0.58091474", "0.5788478", "0.5776449", "0.57301855", "0.5667775", "0.5646424", "0.56252474", "0.5625165", "0.5614428", "0.5554383", "0.55524814", "0.55416644", "0.54992706", "0.5480915", "0.5429156", "0.5429156", "0.542533", "0.5402489", "0.5401976", "0.53930825", "0.5390501", "0.53787786", "0.53720045", "0.53641814", "0.53641814", "0.5356362", "0.5356175", "0.5330305", "0.531387", "0.5307199", "0.5299677", "0.5286891", "0.5286891", "0.52761185", "0.5255296", "0.5255296", "0.5239373", "0.5236664", "0.5236664", "0.5235464", "0.5235464", "0.5232132", "0.5223826", "0.5222781", "0.5210415", "0.5210415", "0.51968646", "0.5181089", "0.5181089", "0.5178186", "0.5178186", "0.5178186", "0.5168935", "0.5154044", "0.5146999", "0.51439947", "0.51439947", "0.51409405", "0.5128057", "0.5128057", "0.5125011", "0.51231563", "0.51205516", "0.51134104", "0.5112986", "0.5105676", "0.5104859", "0.5103318", "0.51006883", "0.51006883", "0.50990194", "0.5097864", "0.50850064", "0.508457", "0.50818276", "0.50818276", "0.50722593", "0.5054421", "0.5054421", "0.5054421", "0.50443435", "0.50443435", "0.5033779", "0.5032002", "0.5030977", "0.5030977", "0.50240135", "0.5012116", "0.50109416", "0.50051063", "0.50011206" ]
0.80258375
2
how_many_args accepts any number of arguments without complaint returns the total number of arguments passed to the function Hint: google ruby args
def how_many_args(*args) args.length end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 how_many_args(*args)\n args.count\nend", "def how_many_args(*args)\n args.count\n end", "def how_many_args *args\n args.count\nend", "def how_many_args(*args)\n args.length\nend", "def how_many_args *args\n args.length\nend", "def how_many_args(*arg)\n arg.length\nend", "def how_many_args (*input)\n input.count\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 sizeOf _args\n \"sizeOf _args;\" \n end", "def length; @args.length end", "def arg_size; end", "def length\n @args.length\n end", "def size(*args); end", "def count(*_args)\n to_a.size\n end", "def size _args\n \"size _args;\" \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 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 func *args\n puts \"Argument's length is #{args.length}\"\n for arg in args\n puts \"arg: #{arg}\"\n end\nend", "def variable_length( *args )\n return args\nend", "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 count(*rest) end", "def size\n @args.size + 1\n end", "def size=(_arg0); end", "def size=(_arg0); end", "def third_method(*my_args)\n puts \"I have benn passed #{my_args.length} arguments in #{my_args}\"\n for arg in my_args\n puts \"Argument: #{arg}\"\n end\nend", "def q1 *rest\n puts \"The number of parameters is #{rest.length}.\"\n puts rest\nend", "def method_name_with_different_number_of_arguments(*arguments)\n puts(arguments)\nend", "def arity\n parameters.size\n end", "def length=(_arg0); end", "def count=(_arg0); end", "def countFriendly _obj, _args\n \"_obj countFriendly _args;\" \n end", "def numerical_arg_size?\n !has_splat_args? && arg_size\n end", "def required_arguments(args, n)\n n = (n..n) if Fixnum === n\n unless n.include? args.size\n STDERR.puts usage_text()\n exit!\n end\n args\n end", "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 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 _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 arity\n method(:call).arity\n end", "def max_args\n @max_args || -1\n end", "def lnbSize _args\n \"lnbSize _args;\" \n end", "def my_count(args = nil)\n count = 0\n my_each do |item|\n if block_given?\n count += 1 if yield(item)\n elsif args\n count += 1 if item == args\n else\n count = length\n end\n end\n count\n end", "def captiveNum _args\n \"captiveNum _args;\" \n end", "def tvCount _args\n \"tvCount _args;\" \n end", "def sample_func(*arguments)\n\tprint(\"number of arguments passed #{arguments.length}\")\n\tputs()\n\targuments.each {|x| puts(x)}\n\treturn *arguments\nend", "def run(args)\n verbose_ary, count_ary = args[1..-1].partition {|item| item =~ /full/i}\n verbose = !verbose_ary.empty?\n\n if count_ary.size > 1\n errmsg \"Expecting only at most one parameter other than 'full'\"\n return\n end\n \n if 1 == count_ary.size\n begin\n count = Integer(count_ary[0])\n rescue\n errmsg \"Expecting count to be an integer; got #{count_ary[0]}\"\n return\n end\n elsif 0 == count_ary.size\n count = proc.stack_size\n else\n errmsg \"Wrong number of parameters. Expecting at most 2.\"\n return\n end\n\n @proc.print_stack_trace(@proc.top_frame, \n {:verbose => verbose, :count => count})\n end", "def countUnknown _obj, _args\n \"_obj countUnknown _args;\" \n end", "def third_method(*my_args)\n\tputs \"I have been passed #{my_args.length} arguments in #{my_args}.\"\n\tfor arg in my_args\n\t\tputs \"Argument: #{arg}\"\n\tend\nend", "def wrong_args_message(size, min, max)\n e = min == max ? min : \"#{min}..#{max}\"\n \"Wrong number of arguments. Received #{size} instead of #{e}.\"\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 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 arguments; end", "def arguments; end", "def arguments; end", "def multipleArgs(*args)\n args.each do | argument |\n puts argument\n end\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 args(*) end", "def varargs(arg1,*rest)\n puts \"Got #{arg1} and #{rest.join(',')}\"\nend", "def num_parameters\n @parameters.size\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 varios_args(*args)\n puts \"Tamanho de args: #{args.size}\"\n args.each { |x| p x}\n end", "def count(opts={})\n all(opts).size\n end", "def size\n C.LLVMCountParams(@fun)\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 size\n 1 + params_size\n end", "def size(input); end", "def cnt; xparam(6); end", "def number_of_args_expected_by_named_route_helper(helper_name)\n ActionController::Routing::Routes.named_routes.routes[helper_name.to_sym].segment_keys.size\n end", "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 arity; 2; end", "def test_check_num_args_string3\n args = CheckNumArgs.new\n assert_equal false, args.check_args(['HELLO', 'THERE', 'KENOBI'])\n end", "def arity() end", "def arity() 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 arity; end", "def different_args(one, two, three, four, five, six)\n puts \"#{one}, #{two}, #{three}, #{four}, #{five}, #{six}\"\nend", "def varargs(arg1, *rest)\n puts \"Got #{arg1} and #{rest.join(', ')}\"\nend", "def arguments(required, *optional)\n puts \"required: #{required}\"\n puts \"optional: #{optional}\"\nend", "def count(*args)\n emails(*args).length\n end", "def my_count(*args)\n count = 0\n if args[0]\n my_each do |x|\n count += 1 if x == args[0]\n end\n elsif !block_given?\n count = size\n elsif !args[0]\n my_each do |x|\n count += 1 if yield x\n end\n end\n count\n end", "def countSide _obj, _args\n \"_obj countSide _args;\" \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 countType _obj, _args\n \"_obj countType _args;\" \n end", "def count(*args)\n truethy_count = 0\n args.each { |el| truethy_count += 1 if yield(el) }\n truethy_count\nend", "def args() return @args end", "def arity(*) end", "def some_method(some_arr)\n some_arr.size\nend", "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 arg_check_length(arg_l)\n if arg_l < 3\n puts 'Usage:\\n'\n puts 'ruby ruby_rush.rb <seed> <num_prospectors> <num_turns>\\n'\n puts '<seed> should be an integer\\n'\n puts '<num_prospectors> should be a non-negative integer\\n'\n puts '<num_turns> should be a non-negative integer\\n\\n'\n exit(1)\n return -1\n end\n 0\nend", "def invalid_arguments?(arguments, count)\n\t\targuments.length != count\n\tend", "def args()\n #This is a stub, used for indexing\n end", "def echo_at_least_two( first_arg, *middle_args, last_arg)\r\n pp \"The first argument is #{first_arg}\"\r\n middle_args.each { |arg| pp \"A middle argument is #{arg}\" }\r\n pp \"The last argument is #{last_arg}\"\r\nend", "def arg_val_list(args_count)\n return \"void\" if (args_count == 0)\n arguments = []\n args_count.times { |i| arguments << \"ARG#{i}_TYPE arg#{i}\" }\n arguments.join(\", \")\nend", "def test_check_num_args_invalid3\n args = CheckNumArgs.new\n assert_equal false, args.check_args([1, 2])\n end", "def heels_and_flats(heels_count, flats_count)\n# prints function with arguments listed within sentance\n puts \"#{heels_count} pairs of heeled shoes and #{flats_count} pairs of flat shoes.\"\n# ends function\nend", "def test_three_ints\n args = Arguments.new\n assert_equal true, args.check_args([1, 2, 3])\n end", "def inflamed _args\n \"inflamed _args;\" \n end", "def arguments_method(*arguments)\n arguments.each do |argument|\n puts argument\n end\nend", "def method (*args)\n\t\tif args.length > 2\n\t\t\tputs \"More than two\"\n\t\tend\n\tend", "def wrong_num_parameters?\n (ARGV.size != 1)\n end", "def count(*args)\n emails(*args).size\n end" ]
[ "0.93475616", "0.90360755", "0.8963783", "0.89469504", "0.89217275", "0.8807136", "0.8724325", "0.8698214", "0.7953533", "0.7679422", "0.7660943", "0.75519186", "0.7302221", "0.7185443", "0.71772563", "0.70158845", "0.7005771", "0.6981783", "0.69494593", "0.6881684", "0.6799105", "0.67778105", "0.6764208", "0.66837984", "0.66837984", "0.6654486", "0.6585652", "0.6550711", "0.64390326", "0.6416482", "0.63625777", "0.6361834", "0.6361713", "0.63568646", "0.63360345", "0.63201785", "0.63056606", "0.6288119", "0.6254752", "0.6251466", "0.6220436", "0.621394", "0.62013596", "0.6194338", "0.61420465", "0.6125784", "0.6122575", "0.61134785", "0.6073119", "0.6069791", "0.6066908", "0.6066908", "0.6066908", "0.6052699", "0.6027512", "0.6021668", "0.60175997", "0.60055876", "0.6003912", "0.5996624", "0.59892035", "0.5968685", "0.59642434", "0.5946479", "0.5946017", "0.59407425", "0.59375894", "0.59373885", "0.59346944", "0.59147096", "0.5912831", "0.5912831", "0.5912797", "0.5909789", "0.5908553", "0.5888636", "0.5888113", "0.5886514", "0.5873086", "0.5869249", "0.5865294", "0.5862442", "0.5857661", "0.58467406", "0.58329844", "0.58194923", "0.5800835", "0.5792023", "0.5791162", "0.5789579", "0.57880884", "0.5781444", "0.5775428", "0.57547694", "0.57539725", "0.5751891", "0.5748548", "0.57466435", "0.57383806", "0.5725751" ]
0.8882939
5
find_answer returns the value associated with the 'answer' keyword argument returns nil if it cannot find the 'answer' keyword argument complains when given nonkeyword arguments Hint: google ruby keyword arguments
def find_answer(options={}) options[:answer] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_answer(answer: nil, **opts)\n answer\n end", "def find_answer(kwargs={})\n kwargs[:answer]\nend", "def find_answer(*args)\n args.each do |arg|\n \targ.each_key { |key| if key === :answer then return arg[key] end }\n end\n return nil\n end", "def find_answer keyword={}\n keyword[:answer]\nend", "def find_answer(foo={})\n foo[:answer]\n end", "def find_answer(hash={})\n hash[:answer]\nend", "def find_answer\nend", "def find_answer(h={})\n h[:answer]\nend", "def find_answer_value(given_questionnaire = nil)\n if answer.present?\n answer.find_value\n else\n \"\"\n end\n end", "def answer_for(options, q, default = nil)\n options[:answers][q] ? options[:answers][q] : default\n end", "def get_correct_answer(question_prompt, answers)\n question_prompt = question_prompt.downcase\n answer = nil\n case question_prompt\n when /which number goes with your street on/\n answer = answers[answers.index('3612') || answers.index('5555') || answers.index('None of the above')]\n when /which street have you lived on/\n answer = answers[answers.index('BEACH') || answers.index('None of the above') || 0]\n when /in which city is/\n answer = answers[answers.index('ATLANTA') || answers.index('None of the above')]\n when /in which county was your/\n answer = answers[answers.index('FULTON') || answers.index('None of the above')]\n when /what year is your/\n answer = answers[answers.index('2005')]\n when /which of the following people do you know/\n answer = answers[answers.index('ANTHONY BROWN') || answers.index('None of the above')]\n when /in wich year were you born/\n answer = answers[answers.index('1975')]\n when /what type of residence is/\n answer = answers[answers.index('Single Family Residence')]\n when /in which month month were you born/\n answer = answers[answers.index('FEBRUARY')]\n when /in which county have you lived/\n answer = answers[answers.index('FULTON') || answers.index('None of the above')]\n when /what are the last two digits of your social security number/\n answer = answers[answers.index('33')]\n when /at which of the following addresses have you lived/\n answer = answers[answers.index('None of the above')]\n when /which person is not a relative or someone that you know/\n answer = answers.grep(/SMITH/).first\n when /with which name are you associated/\n answer = answers[answers.index('None of the above')]\n when /what are the first two digits of your social security number/\n answer = answers[answers.index('11') || answers.index('None of the above')]\n when /which of the following phone numbers is related to you/\n answer = answers[answers.index('None of the above')]\n when /from whom did you purchase the property at/\n answer = answers[answers.index('JOE ANDERSON') || answers.index('None of the above')]\n when /how long have you been associated with the property at/\n answer = answers[answers.index('Over 5 years')]\n when /what is the approximate square footage of the property at/\n answer = answers[answers.index('Over 2,500')]\n when /when did you purchase the property at/\n answer = answers[answers.index('August 1999') || answers.index('None of the above')]\n when /between/ && /in which state did you live/\n answer = answers[answers.index('NEW YORK')]\n when /when did you purchase or lease your/\n answer = answers[answers.index('December 2006')]\n when /with which name are you associated/\n answer = answers[answers.index('None of the above')]\n end\n answer\n end", "def handle_answer(answer)\n return nil if answer.nil?\n answer = convert(answer)\n field = opts[:field]\n if field\n answer = answer[field]\n end\n answer\n end", "def get_question(answer)\n answer.is_a?(Answer) ? answer.question : answer\n end", "def correct_answer\n answers.find_by_correctness(true)\n end", "def get_answer(answer)\n # In case the Chair did not answer this question.\n return 'No response provided.' if answer.nil?\n\n case answer.answer_type\n when 'Multiple Choice' # If multiple choice, show selected answer.\n answer.multiple_choice\n when 'True/False' # If true false, show either true or false.\n answer.true_false ? 'True' : 'False'\n when 'Numeric' # If numeric, show selected number.\n answer.numeric\n else # If short answer, show response.\n answer.short_answer\n end\n end", "def find_response(answer_id)\n self.responses.find_by_answer_id(answer_id)\n end", "def solution() \n case @answer.type\n when String\n solution= @answer.downcase \n default \n solution= @answer\n end\n solution\n end", "def check_answer(answer)\n # if answer == self.select(:answer)\n if answer == self.answer\n return true\n else\n return false\n end\n end", "def answer(params={})\n matching_answer_class.new(params.merge(question: self))\n end", "def get_question\n if self.key.to_s =~ /(an_)([0-9])/\n q_id = QUESTION_MAP[\"qs_#{$+}\".to_sym][:id]\n q = ProfileQuestion.find_by_profile_id_and_question_id(self.profile_id, q_id)\n q.answer\n else\n nil\n end\n end", "def method_missing(method_name, *args)\n match = method_name.to_s.match(/dynamic_answer_(\\d+)(=?)/)\n if match\n match[2] == \"=\" ? set_answer(match[1], args.first) : get_answer(match[1])\n else\n super\n end\n end", "def questionAnswer(question)\n answer = questionAnswerRaw(question)\n \n answer = \"No Answer\" if answer == nil\n return answer\nend", "def evaluate_answer(key,answer,options)\n correct = false\n if options['q_struct'][key].eval != \"no\"\n new_value = options['q_struct'][key].eval\n if new_value.match(/^get|^set/)\n if new_value.match(/^get/)\n new_value = eval\"[#{new_value}]\"\n answer = new_value.join\n options['q_struct'][key].value = answer\n else\n options['q_struct'][key].value = answer\n eval\"[#{new_value}]\"\n end\n correct = true\n else\n correct = eval\"[#{new_value}]\"\n if correct == true\n options['q_struct'][key].value = answer\n end\n end\n else\n correct = true\n end\n answer = answer.to_s\n if options['verbose'] == true\n handle_output(options,\"Information:\\tSetting parameter #{key} to #{answer}\")\n end\n return correct\nend", "def getAnswerId(answer_name, question_id)\n\tquery_params = {:answer => answer_name, :questionId => question_id}\n\tquery_hash = {:where => query_params.to_json}\n\n\turi = URI(@ANSWER_URL)\n\turi.query = URI.encode_www_form(query_hash)\n\tputs uri.query\n\n\thttps = Net::HTTP.new(uri.host, uri.port)\n\thttps.use_ssl = true\n\n\theader = {\n\t\t'X-Parse-Application-Id' => @PARSE_APP_ID,\n \t\t'X-Parse-REST-API-Key' => @PARSE_REST_KEY\n\t}\n\n\trequest = Net::HTTP::Get.new(uri.path << \"?\" << uri.query, header)\n\n\tresponse = https.request(request)\n\n\tresponse_data = JSON.parse(response.body)\n\tresponse_data[\"results\"]\nend", "def answer_params\n params[:answer]\n end", "def answer_params\n params[:answer]\n end", "def get_example_answer(org_id)\n \t\texample_answer = self.annotations.where(org_id: org_id).where(type: Annotation.types[:example_answer]).order(:created_at)\n \t\treturn example_answer.first\n \tend", "def validate_answer(answer)\n end", "def method_missing(m, *args, &block)\n match_data = m.match /(strong|weak)_(skills|attitudes)/\n if match_data && match_data.length >= 3\n get_answers(match_data[1], match_data[2])\n else\n super\n end\n end", "def answer_or_default( answer_string )\n if answer_string.length == 0 and not @default.nil?\n @default\n else\n answer_string\n end\n end", "def retrieve_answer\n return self if self.correct?\n Answer.find_by(correct: true, trivia_question_id: self.trivia_question_id)\n end", "def evaluate_answer(answer)\n question = answer.question.actable\n answer_text_array = answer.normalized_answer_text.downcase.gsub(/([^a-z ])/, ' ').split(' ')\n answer_text_lemma_array = []\n answer_text_array.each { |a| answer_text_lemma_array.push(WordNet::Synset.morphy_all(a).first || a) }\n\n hash_lifted_word_points = hash_compre_lifted_word(question)\n hash_keyword_solutions = hash_compre_keyword(question)\n\n lifted_word_status = find_compre_lifted_word_in_answer(answer_text_lemma_array, hash_lifted_word_points)\n keyword_status = find_compre_keyword_in_answer(answer_text_lemma_array, lifted_word_status, hash_keyword_solutions)\n\n answer_text_lemma_status = {\n 'compre_lifted_word': lifted_word_status,\n 'compre_keyword': keyword_status\n }\n\n answer_grade = grade_for(question, answer_text_lemma_status)\n\n [\n correctness_for(question, answer_grade),\n answer_grade,\n explanations_for(question, answer_grade, answer_text_array, answer_text_lemma_status)\n ]\n end", "def set_answer\n @answer = Discovery::Answer.find(params[:id])\n end", "def find_answer\n # FIXME\n Message.find_by_topic_id(id, :conditions => 'staff=true')\n end", "def answer_by_id(question, id)\n\t\t\t\tbegin\n\t\t\t\t\tanswer = question.answers.find(id)\n\t\t\t\trescue ActiveRecord::RecordNotFound\n\t\t\t\t\thalt 404\n\t\t\t\tend\n\t\t\tend", "def question\n answer.question\n end", "def answer\n if answered?\n answers.last.answer\n else\n [{:answer => \"not answered\"}]\n end\n end", "def get_answer\n #converts the contents of the :answer key to an integer and assins it to an instance variable\n @answer = cookies[:answer].to_i\n end", "def correct_answer\n @correct_answer ||= question.correct\n end", "def answer_id answer\n answer.id || \"V#{answer.answer.id}\"\n end", "def coach_answer(your_message)\n # TODO: return coach answer to your_message\n if your_message[-1] == \"?\" then puts \"Silly question, get dressed and go to work !\"\n else puts \"I don't care son, get dressed and go to work !\"\n end\nend", "def name\n question = Question.find_by_name(\"sitName\")\n answer = self.answer_to question\n if answer.nil?\n a = question.default_answer_for self\n else\n a = answer.answer\n end\n return a\n end", "def answer\n survey = Survey.find(find_params)\n sa = SurveyAnswerer.new(survey)\n\n if sa.answer(answer_params)\n head :ok\n else\n render json: sa.errors, status: :unprocessable_entity\n end\n end", "def get_answer\n\tprint \"please enter the keyword to 'exit': \"\n\tprint \"hint: it is one of the letters in the word 'exit' \"\n\tanswer = gets.chomp.downcase\n\treturn answer\nend", "def solution\n return self.answers.select {|x| x.correct}[0] if solved?\n nil\n end", "def get_answer_to(question)\n puts question\n answer = gets.chomp\nend", "def query_ask\n # NOTE: This trailing space at the end of the String obliquely instructs\n # Highline to keep the prompt on the same line as the question. If the\n # String did not end with a space or tab, Highline would move the input\n # prompt to the next line (which, for our purposes, looks confusing)\n value = ask( \"<%= color('#{@key}', WHITE, BOLD) %>: \",\n highline_question_type ) do |q|\n q.default = default_value unless default_value.to_s.empty?\n\n # validate input via the validate() method\n q.validate = lambda{ |x| validate( x )}\n\n # if the answer is not valid, construct a reply:\n q.responses[:not_valid] = \"<%= color( %q{Invalid answer!}, RED ) %>\\n\"\n q.responses[:not_valid] += \"<%= color( %q{#{ (not_valid_message || description) }}, YELLOW) %>\\n\"\n q.responses[:not_valid] += \"#{q.question} |#{q.default}|\"\n\n query_extras q\n end\n value\n end", "def get_answer_to(question)\n puts question\n answer = gets.chomp\n return answer\nend", "def answer\n @question = params[:question]\n if @question == 'I am going to work' then @answer = 'Great!'\n elsif @question.include? '?'\n then @answer = 'Silly question, get dressed and go to work'\n else @answer = \"I don't care, get dressed and go to work!\"\n end\n end", "def find_by_name type_name, option\n begin\n found = eval type_name.to_s, binding, __FILE__, __LINE__\n finish_and_make_successful_result [found], option\n rescue NameError \n make_failed_result type_name\n end\n end", "def set_given_answer\n @given_answer = GivenAnswer.find(params[:id])\n end", "def set_given_answer\n @given_answer = GivenAnswer.find(params[:id])\n end", "def find(input)\n end", "def answer_question(data, mode)\n country = data[\"name\"]\n capital = data[\"capitalCity\"]\n unless capital == \"\"\n if mode == \"xmode\"\n puts \"#{capital} is the capital of what country?\\n\"\n else\n puts \"What is the capital of #{country}?\\n\"\n end\n guess = gets.chomp\n\n # abort program if \"EXIT\"\n if guess == \"EXIT\"\n abort(\"Bye!\")\n end\n\n # handle blank answers\n if guess == \"\"\n puts \"Incorrect! The capital of #{country} is #{capital}\\n\"\n return false\n end\n\n # allows up to 2 incorrect letters in answer\n # lower each string, and remove non-alphanumerics\n if mode == \"xmode\"\n leven_distance = Levenshtein.distance(guess.downcase.gsub(/[^A-Za-z0-9\\s]/i,''), country.downcase.gsub(/[^A-Za-z0-9\\s]/i,''))\n else\n\t\t\t leven_distance = Levenshtein.distance(guess.downcase.gsub(/[^A-Za-z0-9\\s]/i,''), capital.downcase.gsub(/[^A-Za-z0-9\\s]/i,''))\n end\n if leven_distance < 3 && leven_distance > 0\n if mode == \"xmode\"\n puts \"Your answer was off but we'll accept it! #{capital} is the capital of #{country}\\n\"\n else\n\t\t\t\t puts \"Your answer was off but we'll accept it! The capital of #{country} is #{capital}\\n\"\n end\n return true\n\t\t\telsif leven_distance == 0\n\t\t\t\t puts \"Correct!\\n\"\n\t\t\t\t\treturn true\n else\n if mode == \"xmode\"\n puts \"Incorrect! #{capital} is the capital of #{country}\\n\"\n else\n puts \"Incorrect! The capital of #{country} is #{capital}\\n\"\n end\n return false\n end\n else\n # do nothing\n end\nend", "def get_answer(offering_question_id, offering_question_option_id=nil)\n question = offering.questions.find(offering_question_id)\n if offering_question_option_id.nil? && !question.display_as.include?(\"checkbox_options\")\n answer = answers.find_or_create_by_offering_question_id(offering_question_id).answer\n self.class.send :define_method, \"dynamic_answer_#{offering_question_id.to_s}=\", Proc.new {|argv| set_answer(offering_question_id, argv)}\n else\n option_answer = answers.find_by_offering_question_option_id(offering_question_option_id)\n answer = option_answer.nil? ? \"false\" : option_answer.answer\n self.class.send :define_method, \"dynamic_answer_#{offering_question_id.to_s}_#{offering_question_option_id.to_s}=\",\n Proc.new {|argv| set_answer(offering_question_id, argv, offering_question_option_id)}\n end \n type_cast_dynamic_answer(answer)\n end", "def find_word_in_project(project_id, keyword_id, optional = false)\n keyword = PreferedSynonym.where(\"project_id = ? AND keyword_id = ?\", project_id, keyword_id).first\n if keyword != nil\n if !optional\n return true\n else\n return true, Keyword.find_by_id(keyword.keyword_id)\n end \n else\n if !optional\n return false\n else\n return false, nil\n end\n end \n end", "def answer?\n return @answer\n end", "def update!(**args)\n @answer = args[:answer] if args.key?(:answer)\n end", "def update!(**args)\n @answer = args[:answer] if args.key?(:answer)\n end", "def update!(**args)\n @answer = args[:answer] if args.key?(:answer)\n end", "def update!(**args)\n @answer = args[:answer] if args.key?(:answer)\n end", "def question\n puts <<EOT\nEnter search, like : #{@defaultsearch} or just hit enter to start player! \nt search -> track search\nu search -> user search\nq -> exit! :)\nEOT\n search = STDIN.gets.strip\n if search.empty?\n @defaultsearch\n else\n search\n end\n end", "def set_possible_answer\n @possible_answer = PossibleAnswer.find(params[:id])\n end", "def text\n self[:text].present? ? self[:text] : self.answer\n end", "def get_suggestion(query) \n oauth = OAuth.new(:consumer_key => self.consumer_key, \n :consumer_secret => self.consumer_secret) \n signed_url = oauth.sign build_query(query)\n\n response = http_client.get(signed_url)\n response_hash = MultiJson.decode(response.body)\n \n suggestion = get_suggestion_from_response(response_hash)\n\n return nil unless suggestion\n return nil if suggestion.downcase == query.downcase\n\n return suggestion\n rescue ::YBossSpell::Error, ::HTTPClient::TimeoutError, ::MultiJson::LoadError => e\n Rails.logger.error(\"YBossSpell: #{e.inspect}\") \n return false\n end", "def guess(text, meta)\n nil\n end", "def evaluate_answer(answer)\n question = answer.question.actable\n question.max_time_limit = answer.submission.assessment.course.programming_max_time_limit\n assessment = answer.submission.assessment\n evaluation_result = evaluate_package(assessment.course.title, question, answer)\n build_result(question, evaluation_result,\n graded_test_case_types: assessment.graded_test_case_types)\n end", "def get_answer\n answer = gets.chomp.downcase.strip\n raise InvalidInputError, \"Please enter 'a' or 'b' to answer, or '-q' or '--quit' to exit\".red unless self.validate_answer(answer)\n answer\n end", "def answer_lookup_field\n :inverse_answer_id\nend", "def ask_hint text, deflt=nil\n f = nil\n \n #ch = get_char\n ch = get_single text\n if ch == \"ENTER\" \n return deflt\n end\n ix = get_index(ch, $viewport.size)\n f = $viewport[ix] if ix\n return f\nend", "def answer\n @question = params[:questions]\n # we need to get the value from params in order to store the question.\n if @question.eql? 'I am going to work'\n @answer = 'Great!'\n elsif @question.end_with?('?')\n @answer = 'Silly question, get dressed and go to work!'\n else\n @answer = \"I don't care, get dressed and go to work!\"\n # we create @ = instance variable in order to use outside of the method.\n end\n end", "def answer question\n\n # find the value that should be entered\n data = request[question[:reference_identifier]]\n\n response_set.responses.where(question_id: question).delete_all\n\n case question.type\n\n when :none\n answer = question.answers.first\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => data\n })\n\n when :one\n # the value is the reference identifier of the target answer\n answer = question.answers.where(reference_identifier: data).first\n\n unless answer.nil?\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :any\n # the value is an array of the chosen answers\n answers = question.answers.where(reference_identifier: data)\n answers.each do |answer|\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :repeater\n # the value is an array of answers\n answer = question.answers.first\n i = 0\n data.each do |value|\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => value,\n response_group: i\n })\n i += 1\n end\n\n else\n throw \"not handled> #{question.inspect}\"\n end\n\n end", "def answer question\n\n # find the value that should be entered\n data = request[question[:reference_identifier]]\n\n response_set.responses.where(question_id: question).delete_all\n\n case question.type\n\n when :none\n answer = question.answers.first\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => data\n })\n\n when :one\n # the value is the reference identifier of the target answer\n answer = question.answers.where(reference_identifier: data).first\n\n unless answer.nil?\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :any\n # the value is an array of the chosen answers\n answers = question.answers.where(reference_identifier: data)\n answers.each do |answer|\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :repeater\n # the value is an array of answers\n answer = question.answers.first\n i = 0\n data.each do |value|\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => value,\n response_group: i\n })\n i += 1\n end\n\n else\n throw \"not handled> #{question.inspect}\"\n end\n\n end", "def test_ask_returns_an_answer\n magic_ball = Predictor.new\n assert_includes Predictor::ANSWERS, magic_ball.ask(\"Meow?\")\n end", "def results(answer)\n query_method = case user\n when answer.author then :corrections_for_author\n when nil then :corrections_for_everyone\n else :corrections_for_rest_users\n end\n __send__(query_method, corrections_scope(answer))\n end", "def correct_answer(text)\n answer = Answer.new(text, true)\n @errorReporter.register answer\n @test.last_question.add_answer answer\nend", "def get_place(query)\n url = URI(\"https://rapidapi.p.rapidapi.com/apiservices/autosuggest/v1.0/US/USD/en-US/?query=#{query}\")\n\n response_hash = access_api(url)\n if response_hash == nil || response_hash[\"Places\"] == nil || response_hash[\"Places\"][0] == nil\n return nil\n end\n response_hash[\"Places\"][0][\"PlaceId\"]\nend", "def result(answer)\n puts answer\nend", "def result(answer)\n puts answer\nend", "def correct_answer\n self.answers.where(correct: true).first\n end", "def find(sess, what, *args) #:nodoc:\r\n get(sess, *args)\r\n end", "def ask_answer\n @sender_detail = SenderDetail.where(:unique_key => params[:link]).first\n if @sender_detail.nil?\n flash[:notice] = \"Invalid Token\"\n redirect_to sorry_path\n else\n @sender = EmailSender.find(@sender_detail.user_id).email\n \n @email = Email.find(@sender_detail.email_id)\n @listener = EmailSender.find(@email.listener_id)\n @question = @email.question\n end\n end", "def check_answer(user_answer)\n self.answers.each do |answer|\n if answer.answer == user_answer\n return true\n end\n end\n return false\n end", "def get_answer\n @user_answer = gets.chomp.to_i\n end", "def keyword_find(user)\n pastel = Pastel.new\n puts \" \"\n puts pastel.white.inverse.bold(\"Please enter a keyword to search by.\")\n keyword = gets.chomp \n Joke.find_by_keyword(keyword)\n self.return_to_menu(user) \n end", "def answer\n\t\tget_data\n\n\t\t@summary = @data[$randId]['news_summary']\n\t\t@c_answer = @data[$randId]['c_answer']\n\t\t@alt1 = @data[$randId]['alt1']\n\t\t@alt2 = @data[$randId]['alt2']\n\t\t@alt3 = @data[$randId]['alt3']\n\t\t@cat = @data[$randId]['category_id']\n\t\t@ans = params[:param1]\n\t\t@id = params[:param2]\n\t\t@url = @data[$randId]['news_url']\n\t\t@hex = @data[$randId]['category_hex_code']\n\n\t\tget_descriptions(@url)\n\n\t\t@title = @desc_data['title']\n\t\t@summary = @desc_data['desc']\n\t\t@image = @desc_data['image']\n\n\t\ttagstring = @data[$randId]['tag']\n\t\tunless tagstring.nil? || tagstring.empty?\n\t\t\t@tags = tagstring.split(\",\")\n\t\t\t@taglength = @tags.length\n\t\tend\n\tend", "def search(games, search_term)\n search_index = games.find_index(search_term)\n search_result = if search_index\n \"Game #{search_term} found: #{games[search_index]} at index #{search_index}.\"\n else\n \"Game #{search_term} not found.\"\n end\n return search_result\nend", "def search_index(games, search_term)\n search_index = games.find_index(search_term)\n search_index || \"Not Found\"\nend", "def answer\n @answer ||= self.result[\"Ares_odpovedi\"][\"Odpoved\"][\"Zaznam\"]\n end", "def find(name, default: T.unsafe(nil), **options); end", "def process_answer(params)\n channel_id = params[:channel_id]\n return process_final(params) if $redis.exists(\"final_category:#{channel_id}\")\n user_id = params[:user_id]\n user_nick = params[\"user_name\"]\n key = \"current_question:#{channel_id}\"\n current_question = $redis.get(key)\n reply = \"\"\n if current_question.nil?\n reply = trebek_me if !$redis.exists(\"shush:answer:#{channel_id}\")\n else\n current_question = JSON.parse(current_question)\n current_answer = current_question[\"answer\"]\n user_answer = params[:text]\n answered_key = \"user_answer:#{channel_id}:#{current_question[\"id\"]}:#{user_id}\"\n if $redis.exists(answered_key)\n reply = \"@#{user_nick}, you had your chance. Let someone else answer.\"\n elsif params[\"timestamp\"].to_f > current_question[\"expiration\"]\n if is_correct_answer?(current_answer, user_answer)\n reply = \"@#{user_nick}: That is correct, but time's up! Remember, you only have #{ENV[\"SECONDS_TO_ANSWER\"]} seconds to answer.\"\n else\n reply = \"@#{user_nick}: Time's up! Remember, you have #{ENV[\"SECONDS_TO_ANSWER\"]} seconds to answer. The correct answer is `#{current_question[\"answer\"]}`.\"\n end\n mark_question_as_answered(channel_id)\n elsif is_question_format?(user_answer) && is_correct_answer?(current_answer, user_answer)\n score = update_score(user_id, current_question[\"value\"])\n reply = \"@#{user_nick}: That is correct. #{trebek_right_score} #{currency_format(score)}.\"\n check_final_jeopardy_valid(channel_id)\n mark_question_as_answered(channel_id)\n elsif is_correct_answer?(current_answer, user_answer)\n score = update_score(user_id, (current_question[\"value\"] * -1))\n reply = \"@#{user_nick}: That is correct, but responses have to be in the form of a question. Your total score is #{currency_format(score)}.\"\n $redis.setex(answered_key, ENV[\"SECONDS_TO_ANSWER\"], \"true\")\n check_final_jeopardy_valid(channel_id)\n else\n score = update_score(user_id, (current_question[\"value\"] * -1))\n reply = \"@#{user_nick}: #{trebek_wrong} #{trebek_wrong_score} #{currency_format(score)}.\"\n $redis.setex(answered_key, ENV[\"SECONDS_TO_ANSWER\"], \"true\")\n end\n end\n reply\nend", "def result\n @result || :no_answer\n end", "def result\n @result || :no_answer\n end", "def get_answer(link)\n # splitting the link into the seperate parts to extract the question id\n @question_id = link.to_s.split('/')[4]\n # making sure the question id is a number and not text\n if @question_id.to_i != 0\n # Running the question id through the stack overflow API\n # will fetch the answers to the question\n uri = URI.parse(\"https://api.stackexchange.com/2.2/questions/#{@question_id}/answers?order=desc&sort=activity&site=stackoverflow&filter=withbody\")\n request = Net::HTTP::Get.new(uri)\n req_options = {\n use_ssl: uri.scheme == \"https\",\n }\n response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|\n http.request(request)\n end\n\n # answersHash holds all the data returned by Stack Overflow\n answersHash = JSON.parse(response.body)\n # checking to make sure that there are answers (items) that are returned\n if !answersHash[\"items\"].nil?\n # @answerInfo will host the link to the answer and if it's \"got a check mark by stack overflow\"\n # note: the check mark means the answer works and is approved by stack overflow\n @answerInfo = Array.new\n answersHash[\"items\"].each do |item|\n # converting the true/false on whether or not the answer is accepted into a number\n # it's turned into a number so that it can be sorted so the best answers are on top\n if item[\"is_accepted\"].to_s == \"true\"\n @accepted = 1\n else\n @accepted = 0\n end\n @codeBody = item[\"body\"]\n # push the data into the @answerInfo\n @answerInfo.push([@accepted, link + \"#\" + \"#{item['answer_id'].to_s}\", @codeBody])\n # sort so the approved answers are on top\n @answerInfo = @answerInfo.sort_by{|b| -b[0]}\n end\n return @answerInfo\n end\n end\n end", "def set_answer\n @answer = Answer.find(params[:id])\n end", "def set_answer\n @answer = Answer.find(params[:id])\n end", "def set_answer\n @answer = Answer.find(params[:id])\n end", "def set_answer\n @answer = Answer.find(params[:id])\n end", "def set_answer\n @answer = Answer.find(params[:id])\n end", "def find_acct(label)\n results = exact_find(label)\n\n return results if results.any?\n\n info(\"No account found with label: #{label}, attempt to fuzzy find...\")\n fuzzy_results = exact_find(\"%#{label}%\")\n\n return fuzzy_results if fuzzy_results.length <= 1\n\n info(\"Found similar account with label: #{fuzzy_results[0]['label']}, list all similar results ? (Y/N)\")\n\n decision = gets.chomp\n return fuzzy_results[0..0] if decision =~ /^[nN]/\n fuzzy_results\n end" ]
[ "0.8547098", "0.8412626", "0.8380612", "0.81502473", "0.7820159", "0.76628065", "0.76056933", "0.74467707", "0.69745433", "0.6676515", "0.649953", "0.6195417", "0.61814696", "0.6079669", "0.60666686", "0.59778345", "0.5946412", "0.5942646", "0.5920448", "0.5875732", "0.5866222", "0.57967824", "0.5790499", "0.5780094", "0.57792205", "0.57792205", "0.57557255", "0.5754668", "0.56893516", "0.5664326", "0.5620638", "0.56146616", "0.56129915", "0.55981886", "0.556888", "0.555404", "0.5537505", "0.5533895", "0.552005", "0.5517073", "0.5515511", "0.550928", "0.5507292", "0.5496007", "0.5473802", "0.54658103", "0.54635745", "0.54569554", "0.5451955", "0.5438853", "0.54324967", "0.54324967", "0.5426911", "0.542519", "0.5420478", "0.5419715", "0.541662", "0.54065394", "0.54065394", "0.54065394", "0.54065394", "0.54040265", "0.538706", "0.5384586", "0.53757113", "0.5366461", "0.535236", "0.534595", "0.5335067", "0.53294414", "0.5327402", "0.53119594", "0.53119594", "0.5308229", "0.53011507", "0.5297596", "0.52946174", "0.5282823", "0.5282823", "0.5277592", "0.5275627", "0.52728426", "0.52587014", "0.5256242", "0.5251166", "0.52425563", "0.5240812", "0.523579", "0.52300674", "0.5229104", "0.52247727", "0.5223958", "0.5223958", "0.52202374", "0.521728", "0.521728", "0.521728", "0.521728", "0.521728", "0.52144504" ]
0.83914286
2
Return your answer as a number.
def sum_mix(arr) arr.map! { |x| x.to_i } arr.sum end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def result(answer)\n @answer == answer.to_i \n end", "def interpret\r\n return @number.to_i\r\n end", "def get_number(result)\n # This is not mathematical correct, because we cant subtract\n puts \"Well done, #{result} == 24\" if 1 / 3 + 4 * 6 == result\n # But, if we can, here is solution: 6.0 / (1.0 - 3.0 / 4.0)\nend", "def user_answer_to_i\n gets.to_i - 1\n end", "def return_num(res)\n if res then res.to_i else res end\n end", "def get_answer\n @user_answer = gets.chomp.to_i\n end", "def look_pretty(answer)\n if answer == answer.to_i\n return answer.to_i\n else\n return answer\n end\nend", "def input_to_num\n @input = @input.to_i\n end", "def score\n @result.to_i\n end", "def result\n value.sub(/^integer-/, '').to_i\n end", "def global_answer\n 6 * 9\nend", "def to_i\n @num\n end", "def to_integer(input); end", "def return_number(a)\n ((a / 2)**2) * (65 - (a / 2))\nend", "def numerology(num1)\n\t# Calculate answer \n\t(((((num1 + 5) * 2) - 4) / 2) - num1)\nend", "def number\n result = normalize(@input_number)\nend", "def return_number(a)\n ((a / 2)**2) * (65 - (a / 2))\nend", "def add(num_1, num_2)\nsolution=num_1.to_f + num_2\nputs solution\nend", "def num()\n @num\n end", "def convert_to_number\n @roman_util.compute_number\n end", "def to_i\n @numer / @denom\n end", "def fetch_number(prompt)\n\tprint prompt\n\tgets.to_f #allow decimal input\nend", "def to_int() end", "def to_int() end", "def number_joy(n)\na = n.to_s.chars.map(&:to_i).reduce(:+)\nb = a.to_s.reverse.to_i\n(a * b) == n\nend", "def interpret\n return @number\n end", "def mathy(num)\n return (num*10) + 30\nend", "def difficulty\n 1-correct.to_f/(correct+incorrect)\n end", "def to_i\n return self.score\n end", "def num(*args)\n return Knj::Locales.number_out(*args)\n end", "def sqr(number)\n number.to_i\n return number**2\nend", "def number_solution(value)\n value.round(2)\nend", "def temp_converter(temp)\n\ttemp = temp*1.8 + 32\n\treturn temp.to_i\nend", "def to_i\n @value.round\n end", "def to_i\n @value.round\n end", "def to_i\n @value.round\n end", "def result(answer)\n puts answer\nend", "def result(answer)\n puts answer\nend", "def problem16(number, power)\n x = number**power\n x = x.to_s.split(\"\")\n answer = 0\n x.length.times do |i|\n answer += x[i].to_i\n end\n return answer\nend", "def get_num(a)\n 100*a[0] + 10*a[1] + a[2]\nend", "def to_i\n @amount.to_i\n end", "def to_i() end", "def to_i() end", "def to_i() end", "def to_i() end", "def to_i() end", "def to_int\n end", "def get_value\n @value.to_i\n end", "def answer(a, b)\n\tif a == 1\n\t\treturn 1 \n\telsif a > b\n\t\treturn 0\n\telsif a % 2 == 0\n\t\treturn 1 + answer(a/2, b)\n\telse\n\t\treturn 1 + answer((3 * a) + 1, b)\n\tend\nend", "def number_s\n return @number_s\n end", "def to_number(exception = nil)\n res = super(context,self,exception)\n return res\n end", "def num\n @num\n end", "def to_num(fxn)\n if (@verbose)\n puts(\"#{fxn}\")\n end\n fxn.length.times do |index|\n term = fxn[index].split('+')\n term.length.times do |index|\n if (term[index].include?('~'))\n term[index] = '1'\n else\n term[index] = '0'\n end # if else\n end # each do \n fxn[index] = term.join('').to_i(2)\n end # times do\n if (@verbose)\n puts(\"MAXTERMS: #{fxn}\")\n end\n return fxn\n end", "def is_number?(answer)\r\n answer.to_i != 0 || answer == '0'\r\n end", "def display_result(num1, num2, operator)\n # say \"num1: #{num1}, num2: #{num2}, operator #{operator}\"\n case operator\n when '1'\n result = num1.to_i + num2.to_i\n say \"#{num1} + #{num2} = #{result}\"\n when '2'\n result = num1.to_i - num2.to_i\n say \"#{num1} - #{num2} = #{result}\"\n when '3'\n begin\n result = num1.to_f / num2.to_f\n say \"#{num1} / #{num2} = #{result}\"\n rescue\n say(\"Div by 0\")\n end\n else\n result = num1.to_i * num2.to_i\n say \"#{num1} * #{num2} = #{result}\"\n end\n result.to_s\nend", "def always_threes\n puts \"Give me a number\"\n number = gets.to_i\n puts \"Always \" + (((number + 5) * 2 - 4) / 2 - number).to_s + \"!\"\nend", "def to_i; end", "def to_i; end", "def to_i; end", "def to_i; end", "def to_i; end", "def to_i; end", "def solution(value)\n # enter your solution here\n value.round(2)\nend", "def get_answer\n print 'Enter your answer:'\n user_input = gets.chomp.to_i\nend", "def to_int(*) end", "def evaluate_answer\n print \"Your answer please: \"\n ans = $stdin.gets.chomp\n if ans.to_i == @current_ans.to_i\n return true\n puts 'True'\n else\n return false\n puts 'False'\n end\n end", "def get_goldMineReturnAmount()\n return @goldMineReturnAmount.to_i\n end", "def to_numeric(anything)\n\n num = BigDecimal.new(anything.to_s)\n if num.frac == 0\n num.to_i\n else\n num.to_r\n end\n end", "def num\r\n @num\r\n end", "def square(term1)\n return term1.to_i ** 2\nend", "def lucas(number)\n golden_ratio = (1 + 5**0.5) / 2\n (golden_ratio**number).round.to_i\nrescue StandardError\n 'Error: Provide number only!'\nend", "def Potencia\n print \"Ingrese El numero: \"\n numero1 = gets.chomp.to_f\n print \"Ingrese la Potencia: \"\n numero2 = gets.chomp.to_f\n\n puts \"\\nPotencia: #{numero1 ** numero2}\"\n end", "def ask_question(question, kind=\"String\")\n print question + \" \"\n answer = gets.chomp\n answer.to_i if kind == \"number\"\n return answer\nend", "def to_i\n @value.to_i\n end", "def solve(meal_cost, tip_percent, tax_percent)\n\n result = meal_cost * (1 + tip_percent.to_f / 100 + tax_percent.to_f / 100)\n puts result.round()\n \nend", "def to_i\n to_f.to_i\n end", "def get_number()\n print \"what number would you like to test? \\n\"\n return gets.chomp.to_i\nend", "def num()\n\t\treturn @num\n\tend", "def to_int\n @value.to_i\n end", "def to_i\n n = to_var.to_i\n positive? ? n : -n\n end", "def num()\n @numerador\n end", "def number_f\n return @number_f\n end", "def to_int\n return @val\n end", "def to_int\n return @val\n end", "def result\n @result || :no_answer\n end", "def result\n @result || :no_answer\n end", "def get_results_number\n @number ||= calculate_results_number\n end", "def to_i\n @total\n end", "def to_i\n @total\n end", "def reciprocal\n\t\tresult = 1/@input\n\n\t render json: result, status: 200\n\trescue\n\t\trender json: {\"message\": 'Use the format: {\"input\": num}'}, status: 400\n\tend", "def to_i\n end", "def solution(value)\n value.round(2)\nend", "def to_i(base=10) end", "def to_number\n acc = ''\n mult = 1\n gnumber.split.each do |gdigit| # each gnumber is splitted into tokens (a single digit )\n val = @@galactic_digit[gdigit] # get the corrispondent Roman digit\n if val.nil?\n mult *= @@galactic_coin[gdigit]\n else # the digit has an equivalent roman digit\n acc << val # so it is accumulated in a string to produce a roman number\n end\n end\n mult * RomanNumber.new(acc).to_i\n end", "def type_cast_dynamic_answer(answer)\n if answer.nil?\n nil\n elsif answer == \"true\"\n true\n elsif answer == \"false\"\n false\n elsif answer.match /^\\d+$/\n answer.to_i\n elsif answer.match /^\\d+.\\d+$/\n answer.to_f\n else\n answer\n end\n end", "def square(number)\n output = number **2\n return output\nend", "def get_integer_value\n\t\tend", "def calculate number\n @left_operand = number\n\n return result()\n end", "def yay(number)\n return (number * 10) + 30\nend", "def get_num\n value = 0\n\n return expected(\"Integer\") unless is_digit($lookahead)\n\n while is_digit($lookahead)\n value = 10 * value + $lookahead.to_i\n lookahead\n end\n\n value\nend", "def inputed_value\n Inventory.in_check(self.id).remote_s.sum(\"result_value\").to_f\n end" ]
[ "0.7119772", "0.6852891", "0.68319476", "0.6814671", "0.6566181", "0.65174234", "0.6394186", "0.6365025", "0.6356861", "0.626956", "0.6269481", "0.62608427", "0.6230521", "0.6229525", "0.62115216", "0.61778605", "0.61743855", "0.615501", "0.6153499", "0.61258113", "0.60973376", "0.609353", "0.60866606", "0.60866606", "0.60860425", "0.60820085", "0.60649216", "0.60559994", "0.6019618", "0.5986426", "0.59718585", "0.5963699", "0.5955234", "0.5948854", "0.5948854", "0.5948854", "0.594827", "0.594827", "0.5938487", "0.59292233", "0.5926641", "0.59228987", "0.59228987", "0.59228987", "0.59228987", "0.59228987", "0.5918396", "0.5917839", "0.59137815", "0.59112567", "0.5904765", "0.5894731", "0.58856004", "0.5867753", "0.58608276", "0.58596194", "0.58429843", "0.58429843", "0.58429843", "0.58429843", "0.58429843", "0.58429843", "0.58383024", "0.5835978", "0.5830744", "0.5830057", "0.5828153", "0.582561", "0.5820221", "0.58115953", "0.578582", "0.5772853", "0.57586014", "0.574559", "0.5738051", "0.5733119", "0.5722574", "0.57193816", "0.5716058", "0.5714412", "0.5705645", "0.5701739", "0.5687811", "0.5687811", "0.56835896", "0.56835896", "0.5682944", "0.5680898", "0.5680898", "0.5678783", "0.5678337", "0.5678332", "0.56777984", "0.5673309", "0.56725854", "0.5663456", "0.565894", "0.56529474", "0.5650697", "0.5638514", "0.5630318" ]
0.0
-1
Join the underlying thread. This is a blocking call.
def join @thread.join end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def join\n @thread.join\n end", "def join\n return if not running?\n @thread.join\n end", "def join\n thread && thread.join\n end", "def join\n @thread.join\n unset_thread_task\n end", "def join_thread\n @thread&.join\n end", "def join\n @cond.wait if not finished?\n end", "def join\n require \"thwait\"\n ThreadsWait.new(@event_loop).join\n end", "def join()\r\n @watchThread.join() if @watchThread\r\n end", "def wait\n @thread.join\n end", "def join()\n @watchThread.join() if @watchThread\n end", "def join\n @listen_thread.join if @listen_thread\n sleep 0.5\n raise @thread_error if @thread_error\n end", "def join(timeout)\n @thread.join timeout\n end", "def join\n @threads.each { |aThread| aThread.join }\n end", "def join\n @server_thread.join if @server_thread\n end", "def join\n @worker.join(SHUTDOWN_TIMEOUT)\n end", "def join\n @threads.each { |t| t.join }\n @threads.clear\n end", "def join\n @server_thread.join if @server_thread\n end", "def join_reading_thread\n @reading_thread.join \n end", "def join\n complete\n @threads.size.times { @inqueue.push(nil) }\n @threads.each { |thr| thr.join }\n end", "def join\n threads=@threads.dup\n # Taking a copy here is really important!\n self.decrement @thread_count\n # Stop the threads or else suffer a deadlock.\n threads.each do |t|\n debug \"joining thread #{t}\" if @debug\n t.join\n end\n end", "def join\n\n @scheduler_thread.join\n end", "def await\n @thread.join\n @object\n end", "def finish!\n @queue.push nil\n @thread.join\n end", "def join(limit = INFINITE)\n limit = limit * 1000 unless limit == INFINITE\n WaitForSingleObject(@thread, limit)\n ReleaseMutex(@@mutex) \n end", "def join\n\t thread.join if thread\n\n\trescue Interrupt\n\t Roby.synchronize do\n\t\treturn unless thread\n\n\t\tExecutionEngine.logger.level = Logger::INFO\n\t\tExecutionEngine.warn \"received interruption request\"\n if quitting?\n force_quit\n thread.raise Interrupt, \"interrupting control thread at user request\"\n else\n quit\n end\n\t end\n\n\t retry\n\tend", "def join\n #@pool_lock.synchronize { @worker_threads.each { |t| t.join unless @terminate } }\n # TODO protect w/ pool_lock? (causes deadlock)\n @manager_thread.join if @manager_thread\n end", "def join\n @worker.join(10)\n end", "def join\n debug \"Joining listen-thread.\\n\" if @debug\n @thr_listen.join if @thr_listen\n raise @listen_err if @listen_err\n\n debug \"Joining error-thread.\\n\" if @debug\n @thr_err.join if @thr_join\n raise @listen_err_err if @listen_err_err\n end", "def join\n start if !@listener.running?\n @listener.join\n end", "def wait_for_shutdown\n @rufus.join\n end", "def wait\n @timer_thread.join\n end", "def join\n wait_for_completion\n update_nodes\n end", "def wait\n @t.each{|t| t.join}\n end", "def join\n @running_processes.each { |x| x.wait }\n end", "def join()\n @scheduler.join\n end", "def join\n @mutex.synchronize do\n logger.debug { \"spawned process #{@pid}\" }\n @exit_cond.wait_until { @status }\n end\n @status.success?\n end", "def join\n raise \"No http-server or http-server not running.\" if !@httpserv or !@httpserv.thread_accept\n \n begin\n @httpserv.thread_accept.join\n @httpserv.thread_restart.join if @httpserv and @httpserv.thread_restart\n rescue Interrupt => e\n self.stop\n end\n \n if @should_restart\n loop do\n if @should_restart_done\n STDOUT.print \"Ending join because the restart is done.\\n\"\n break\n end\n \n sleep 1\n end\n end\n end", "def join(timeout: nil)\n if timeout\n if !@server_thread.join(timeout)\n raise Timeout, \"timed out while waiting for the server to stop\"\n end\n else\n @server_thread.join\n end\n end", "def run\n @threads.each(&:join)\n end", "def join\n @manager_thread.join if @manager_thread\n self\n end", "def join\n attached? ? sleep : (running! and ::Process.waitpid2 pid rescue nil)\n end", "def wait_for_thread_pool!\n @thread_pool.join_pool_threads!\n end", "def join_async_world\n ap4r_helper.wait_all_done\n end", "def join_threads\n @worker_threads.each do |name, t|\n puts \"Joining thread: #{name}\"\n t.join\n end\n @worker_threads = {}\n end", "def flush!\n finish!\n @thread = Thread.new { work }\n true\n end", "def join\n @rufus_scheduler.join\n end", "def join\n @server.stop! if @server and @server.running?\n super\n end", "def finish\n @threads.each { |t| t.join }\n call_events(:finish, @command)\n @threads.clear\n end", "def join(sleep_seconds_before_join = 1)\n # check already started server\n if @tcpServerThread\n begin\n # wait a second\n sleep sleep_seconds_before_join\n # join\n @tcpServerThread.join\n\n # catch ctrl-c to stop service\n rescue Interrupt\n end\n end\n end", "def start!\n start\n blocking_thread.join\n end", "def join\n @poller.join if @poller\n end", "def flush()\n return if @loop.nil?\n @waiting_thread = Thread.current\n begin\n @loop.wakeup()\n rescue\n # ignore\n end\n while busy?\n sleep(2.0)\n end\n @waiting_thread = nil\n end", "def join\n @acceptor.join if @acceptor\n end", "def finish\n @executor.shutdown\n @executor.wait_for_termination(0.25)\n end", "def terminate\n @done = true\n if @thread\n t = @thread\n @thread = nil\n t.value\n end\n end", "def join_hegemon_auto_thread\n @_hegemon_auto_thread.join if @_hegemon_auto_thread\n end", "def block\n # beware of deadlocks, we can't join our own thread\n ::EM.reactor_thread.join if ::EM.reactor_thread && !::EM::reactor_thread?\n end", "def wakeup\n ::Kernel.raise ThreadError, \"dead em_thread\" unless status\n wake_resume()\n self\n end", "def continue\n if @thread.alive?\n @mutex.synchronize do\n unless @thread_status.running\n @thread_status.running = true\n @thread.wakeup\n end\n end\n wait 20\n else\n 'done'\n end\n end", "def terminate\n @thread.terminate if @thread\n end", "def join; end", "def stop\n unless @thread.nil? then\n @daemon.stop!\n \n begin\n @thread.join\n rescue => e\n @logger.error(\"#{@host}: #{get_full_exception_msg(e)}\")\n end\n\n @thread = nil\n end\n end", "def finish_wait\n if @thread\n unless @thread.alive?\n breakpoints = @thread[:breakpoints] || []\n breakpoints_reached = @thread[:breakpoints_reached] || []\n missed_breakpoints = breakpoints - breakpoints_reached\n if missed_breakpoints.any?\n raise \"Breakpoint(s) #{missed_breakpoints.to_a.join(', ')}\" +\n \"not reached!\"\n end\n end\n @thread.wakeup\n ::Thread.stop\n else\n run_until(nil)\n end\n end", "def shutdown\n lock do\n @keep_running = false\n @condition.signal\n end\n\n @thread.join\n force_flush\n @exporter.shutdown\n end", "def join(*) end", "def shutdown\n thread_pool.shutdown\n wait\n end", "def wait\n # Here we use a loop-sleep combination instead of using\n # ThreadPoolExecutor's `wait_for_termination`. See issue #21 for more\n # information.\n loop do\n break if @executor.shutdown?\n sleep 0.1\n end\n end", "def run!\n @thread && @thread.alive? ? @thread : start!\n end", "def join_until_no_more_jobs\n\n @exit_when_no_more_jobs = true\n join\n end", "def __run__()\n begin\n begin\n @lock.send nil\n @result = @block.call(*@args)\n ensure\n @lock.receive\n unlock_locks\n @joins.each { |join| join.send self }\n end\n rescue Die\n @exception = nil\n rescue Exception => e\n # I don't really get this, but this is MRI's behavior. If we're dying\n # by request, ignore any raised exception.\n @exception = e # unless @dying\n ensure\n @alive = false\n @lock.send nil\n end\n\n if @exception\n if abort_on_exception or Thread.abort_on_exception\n Thread.main.raise @exception\n elsif $DEBUG\n STDERR.puts \"Exception in thread: #{@exception.message} (#{@exception.class})\"\n end\n end\n end", "def exit\n ExitThread(0)\n end", "def thread()\n #This is a stub, used for indexing\n end", "def wait_until_finished()\n\t\t\t@threads.each do |t| \n\t\t\t\tif (t.status==\"run\")\n\t\t\t\t\tt.join; # wait to finish\n\n\t\t\t\t\t# log\n\t\t\t\t\tif @logger!=nil\n\t\t\t\t\t\t@logger.debug \"action=stop|name=thread\"\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# log\n\t\t\tif @logger!=nil\n\t\t\t\t@logger.debug \"transactions=#{@transactions}|threads=#{@num_threads}|failures=#{@failures}|duration=#{Time.now - @start_time}\"\n\t\t\tend\n\t\tend", "def join\n end", "def sync\n @ws_thread.join\n end", "def sync\n @ws_thread.join\n end", "def terminate!\n @terminated = true\n @thread.kill if @thread\n ensure\n safe_release!\n end", "def await_instruction\n # Sleep this thread. The main thread will wake us up when there is an instruction\n # to perform.\n @waiting = true\n Thread.stop\n\n # Main thread has woken us up, so execute the current instruction.\n if @instruction\n @instruction.call\n @instruction = nil\n end\n\n # Continue execution of the thread until a socket callback fires, which will\n # trigger then method again and send us back to sleep.\n end", "def example2\n puts 'Outside: 1'\n t = Thread.new do\n puts 'Inside: 1'\n sleep 1\n puts 'Inside: 2'\n end\n puts 'Outside: 2'\n t.join\n end", "def wait\n # it might be awaken by some other futures!\n mutex.synchronize{ condv.wait(mutex) until done? } unless done?\n end", "def stop\n @stop_requested = true\n @consumer_thread.join\n end", "def drain_queue\n @queue_threads.each do |item|\n item.join unless item.nil? || !item.alive?\n end\n nil\n end", "def join_threads\n Threaded.new map { |x| x.join.value }\n end", "def join(sleep_seconds_before_join: 1)\n # check already existing TCPServers\n return if @tcp_servers.empty?\n # wait some seconds before joininig the upcoming threads\n # and check that all TCPServers gots one thread\n while (@tcp_server_threads.length < @tcp_servers.length) && sleep_seconds_before_join.positive?\n sleep_seconds_before_join -= 1\n sleep 1\n end\n # try to join any thread\n begin\n @tcp_server_threads.each(&:join)\n\n # catch ctrl-c to stop service\n rescue Interrupt\n end\n end", "def stop\n return unless @state == :started\n enqueue { @stop_requested = true }\n unless @thread.join(5)\n # TODO: use Platform to test for this\n unless defined?(JRuby)\n Thread.new { @thread.kill; @thread.join(0) }\n end\n end\n\n @thread = nil\n @state = :stopped\n end", "def start\n self.join if @running\n @running=true\n @thread = Thread.new do\n while @running\n block=self.pop\n @processing=true\n block.call\n @processing=false\n end\n end\n end", "def wait_until_finished\n @active_requests.dup.each do |n|\n n.join\n end\n end", "def wait_and_proceed\n Thread.new do\n sleep TIMEOUT\n proceed\n end\n end", "def join()\n raise \"Missing implementation 'join'\"\n end", "def joinall\n @connections.each do |k,v|\n\tv[:thread].join\n end\n end", "def wakeup() end", "def wait_end()\n begin\n loop do\n sleep(TICK/1000.0) while (self.connected?() rescue nil)\n break\n end\n rescue Exception => e\n end\n end", "def wait_until_terminated(sec=10)\n unless terminated?\n wait_until_after(:terminate, sec)\n @chain_threads.list.each {|thread| thread.join}\n end\n end", "def shutdown\n @executor.shutdown\n wait\n end", "def example4\n t = Thread.new do\n puts '[Starting thread]'\n puts \"[what's my status]: #{Thread.current.status}\"\n Thread.stop\n puts '[Resuming thread]'\n end\n puts \"Status of thread: #{t.status}\"\n puts \"Is the thread stopped?: #{t.stop?}\"\n puts \"Is the thread alive?: #{t.alive?}\"\n puts \"Status of thread: #{t.status}\"\n puts\n puts 'Waking up thread and joining it...'\n t.wakeup\n t.join\n end", "def thread; end", "def thread; end", "def thread; end", "def stop\n @stopping = true\n thread.join\n end", "def complete\n @stdin.close\n @stderr.close\n @stdout.close\n Process.kill('KILL', @wait_thr.pid)\n end" ]
[ "0.8089089", "0.8054324", "0.79739195", "0.79482424", "0.79436535", "0.7605656", "0.75707054", "0.750054", "0.73913306", "0.7377309", "0.73613846", "0.72548044", "0.7228799", "0.7213692", "0.7213456", "0.7183658", "0.70915383", "0.7078526", "0.70576555", "0.70228267", "0.69196796", "0.6914043", "0.6843345", "0.67714125", "0.6703955", "0.6703338", "0.668277", "0.6647992", "0.6566717", "0.64879864", "0.6312763", "0.6304036", "0.6160412", "0.6157735", "0.6149759", "0.6115093", "0.6112602", "0.608586", "0.60795546", "0.60308695", "0.5986198", "0.5983193", "0.59482926", "0.59471273", "0.59428215", "0.590324", "0.5861548", "0.5851376", "0.583559", "0.58139825", "0.5803234", "0.5794584", "0.5790124", "0.5776124", "0.57511723", "0.57411355", "0.57396984", "0.5693015", "0.5675541", "0.5665695", "0.56314206", "0.5623832", "0.5609346", "0.56034905", "0.5591274", "0.5561508", "0.5555609", "0.55476826", "0.5513206", "0.5506632", "0.54962105", "0.5494303", "0.5487136", "0.5466281", "0.54643446", "0.54643446", "0.54280424", "0.5402463", "0.53819823", "0.53761935", "0.5370687", "0.5367487", "0.5365533", "0.5360733", "0.535778", "0.5320729", "0.5309218", "0.5306864", "0.53009844", "0.529113", "0.5276867", "0.52708054", "0.52689636", "0.5267135", "0.5248544", "0.52441996", "0.52441996", "0.52441996", "0.5231787", "0.52237624" ]
0.8172442
0
Handle the message. This needs to be overwritten by concrete implementations.
def handle(_request) fail NotImplementedError end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle(msg)\n raise \"The handle() method must be implemented in #{self.class.to_s}\"\n end", "def handle_msg msg\n throw Exception(\"handle_msg must be implemented\")\n end", "def handle_message(request, message)\n #\n end", "def process_message(message)\n end", "def handle_message\n self[:type] = HandledMessage.name\n self.save!\n self.reload\n end", "def handle(message)\n type, return_to, params = parse(message[:payload])\n begin\n m = handle_message(type, params)\n success(return_to, m)\n rescue Exception => e\n error(return_to, e)\n end\n end", "def handle_message(data)\n if @encoding == :etf\n handle_etf_message(data)\n else\n handle_json_message(data)\n end\n end", "def handle(message)\n case message.fetch('subtype') { :default }\n when :default, 'channel_join', 'channel_leave', 'channel_topic',\n 'channel_purpose', 'channel_name', 'channel_archive',\n 'channel_unarchive', 'group_join', 'group_leave', 'group_topic',\n 'group_purpose', 'group_name', 'group_archive', 'group_unarchive',\n 'file_share', 'file_comment', 'file_mention', 'pinned_item',\n 'unpinned_item'\n store(message)\n end\n end", "def receive_msg msg\n # stub, overwrite this in your handler\n end", "def received message, headers={}\n end", "def handle_messages(&handler)\n raise NotImplementedError\n end", "def process(message_instance)\n raise Errors::NotImplemented\n end", "def process_message(message)\n # TODO: May want to ignore some messages (say, if the community string is wrong)\n message.respond(dispatch(message))\n end", "def handle(msg)\n message = Remote::Message.decode(msg)\n assert_type(message)\n call_route(message)\n end", "def on_incoming_message(msg)\n type = msg.operation\n debug \"(#{id}) Deliver message '#{type}': #{msg.inspect}\"\n htypes = [type, :message]\n if type == :inform\n # TODO keep converting itype is painful, need to solve this.\n if (it = msg.itype(:ruby)) # format itype as lower case string\n case it\n when \"creation_ok\"\n htypes << :create_succeeded\n when 'status'\n htypes << :inform_status\n end\n\n htypes << it.to_sym\n end\n end\n\n debug \"(#{id}) Message type '#{htypes.inspect}' (#{msg.class}:#{msg.cid})\"\n hs = htypes.map { |ht| (@handlers[ht] || {}).values }.compact.flatten\n debug \"(#{id}) Distributing message to '#{hs.inspect}'\"\n hs.each do |block|\n block.call msg\n end\n if cbk = @context2cbk[msg.cid.to_s]\n debug \"(#{id}) Distributing message to '#{cbk.inspect}'\"\n cbk[:last_used] = Time.now\n cbk[:block].call(msg)\n end\n end", "def handle_message(message,sock)\n if message.nil? or !message.respond_to?(:type)\n Routing.log {|logger| logger.error(self.class) {\"Not a correct message: #{message.to_s}.\"}}\n return\n end\n\n case message.type\n when Protocol::MessageType::PING\n on_ping(message,sock)\n when Protocol::MessageType::PONG\n on_pong(message,sock)\n when Protocol::MessageType::REQUEST_SUPERNODES\n on_request_supernodes(message,sock)\n when Protocol::MessageType::RESPONSE_SUPERNODES\n on_response_supernodes(message,sock)\n when Protocol::MessageType::PROMOTION_ADS\n on_supernode_promotion(message,sock)\n else\n Routing.log{|logger| logger.error(self.class) {\"Unknown message type: #{message.to_s}.\"}}\n end\n end", "def message\n process_mess\n end", "def process message\n op = message[\"opcode\"]\n data = message[\"data\"]\n\n case op\n when PUBLISH\n emit(\"message\", data)\n when SUBSCRIBE_GRANTED\n emit(\"subscribe\")\n when SUBSCRIBE_DENIED\n emit(\"subscribe_denied\")\n when PUBLISH_DENIED\n emit(\"publish_denied\")\n when PUBLISH_GRANTED\n emit(\"publish_granted\")\n when UNSUBSCRIBE_COMPLETE\n emit(\"unsubscribe\")\n @callbacks.clear\n when AUTHORIZE_DENIED\n emit(\"authorize_denied\")\n when AUTHORIZE_COMPLETE\n emit(\"authorize_complete\")\n end\n\n end", "def process(message)\n end", "def handle(msg)\n msg_obj = Octo::Message::Message.new(msg)\n msg = msg_obj.to_h\n begin\n eventName = msg[:event_name]\n if (valid_events.include?eventName)\n call_hooks(eventName, msg)\n end\n rescue Exception => e \n puts e.message\n puts e.backtrace.inspect\n end\n end", "def process_msgs\n end", "def handle_message(message, obj)\n response = message.create_inform_reply_message()\n response.replyto replyto_address(obj, message.replyto)\n\n case message.operation\n when :create\n handle_create_message(message, obj, response)\n when :request\n response = handle_request_message(message, obj, response)\n when :configure\n handle_configure_message(message, obj, response)\n when :release\n handle_release_message(message, obj, response)\n when :inform\n nil # We really don't care about inform messages which created from here\n else\n raise StandardError, <<-ERROR\n Invalid message received (Unknown OMF operation #{message.operation}): #{message}.\n Please check protocol schema of version #{OmfCommon::PROTOCOL_VERSION}.\n ERROR\n end\n response\n end", "def handle_message(event)\n sender = @users[event['sender']]\n timestamp = event['origin_server_ts'] || Time.now.to_i\n content = event['content']\n message = Message.new sender, timestamp, content\n broadcast(:message, @room, message)\n Events.processed event\n end", "def handle(msg)\n Globot.logger.debug \"--> [#{msg.type}#{msg.person.nil? ? '' : ' / ' + msg.person.name}] #{msg.raw}\"\n @active.each { |p| p.handle(msg) }\n end", "def handle_message(message, obj)\n # We really don't care about inform messages which created from here\n return nil if message.operation == :inform\n\n unless [:create, :request, :configure, :release].include?(message.operation)\n raise StandardError, <<-ERROR\n Invalid message received (Unknown OMF operation #{message.operation}): #{message}.\n Please check protocol schema of version #{OmfCommon::PROTOCOL_VERSION}.\n ERROR\n end\n\n response = message.create_inform_reply_message(nil, {}, src: resource_address)\n response.replyto = replyto_address(obj, message.replyto)\n\n case message.operation\n when :create\n handle_create_message(message, obj, response)\n when :request\n handle_request_message(message, obj, response)\n when :configure\n handle_configure_message(message, obj, response)\n when :release\n handle_release_message(message, obj, response)\n end\n response\n end", "def process_message(message)\n case message\n when Vertica::Protocol::ErrorResponse\n raise Vertica::Error::ConnectionError.new(message.error_message)\n when Vertica::Protocol::NoticeResponse\n @notice_handler.call(message) if @notice_handler\n when Vertica::Protocol::BackendKeyData\n @backend_pid = message.pid\n @backend_key = message.key\n when Vertica::Protocol::ParameterStatus\n @parameters[message.name] = message.value\n when Vertica::Protocol::ReadyForQuery\n @transaction_status = message.transaction_status\n @mutex.unlock\n else\n raise Vertica::Error::MessageError, \"Unhandled message: #{message.inspect}\"\n end\n end", "def call(message)\n raise NotImplementedError, \"Must implement this method in subclass\"\n end", "def handle_message context, metadata, delivery_info, message = {}\n # Prepare data\n headers = metadata.headers || {}\n\n # Relay data if needed\n handle_relay context, message, headers\n\n # Handle errors and acknowledgments\n # log_debug \"handle_message : channel[#{@channel.inspect}]\"\n rescue Exception => e\n log_error \"handle_message: EXCEPTION: #{e.message}, #{e.inspect}\", e.backtrace\n channel_ackit(message[:tag], false)\n rescue StandardError => e\n log_error \"handle_message: unknown: #{e.message}, #{e.inspect}\", e.backtrace\n channel_ackit(message[:tag], false)\n else\n channel_ackit(message[:tag], true)\n end", "def process_message(msg)\n if msg =~ /^<<</\n handle_commands(msg)\n elsif msg =~ /^@\\S+/\n handle_pm(msg)\n elsif msg =~ /^\\\\/\n @server.forward(msg, self)\n else\n handle_chat_msg(msg)\n end\n end", "def handle(message)\n if message[\"event\"] == \"message\"\n puts \"#{message['event']} => #{message['user']}: #{message['content']}\"\n elsif message[\"event\"] == \"comment\"\n puts \"#{message['event']} => #{message['user']}: #{message['content']['text']}\"\n else\n puts \"#{message['event']} => #{message['id']} on #{message['flow']}\"\n end\n end", "def on_receive(message)\n end", "def handle_message(message)\n maybe_print(message)\n msg = MessageHandlerMessage.new(message, self)\n route_message(msg)\n rescue => e\n sender = msg.try(:sender) || \"UNKNOWN-SENDER\"\n send_error(sender, e)\n end", "def on_message(env, msg)\n log(\"received\", msg)\n Message.new(@connection, msg).dispath\n end", "def receive_message(message)\n end", "def dispatch(message)\n Turntabler.run { @handler.call(message) } if @handler\n end", "def handle_message(message)\n if @response_wait_list.waiting_for?(message)\n @response_wait_list.received(message)\n else\n @listener.receive_message(message)\n end\n end", "def on_message(event)\n message = JSON.parse(event.data)\n\n if message['id']\n message['command'] = 'response_received'\n elsif message['message']\n command, *args = *message['message']\n message = {'command' => command, 'args' => args}\n end\n\n logger.debug \"Message received: #{message.inspect}\"\n dispatch(message)\n end", "def handle_messages!\n self.logger.debug { \"Starting message handler.\" }\n \n loop do\n message = nil\n\n # reads data\n self.logger.debug { \"Waiting for messages.\" }\n message = self.protocol.wait_interaction!\n \n # if nil data arrived, it means termination\n if message.nil?\n break\n end\n \n self.logger.debug { \"Message of type '#{message.type}' received.\" }\n\n # calls processing method according to incoming message\n case message.type.to_sym\n when :order\n self.handle_order(message)\n end\n \n end\n \n self.logger.debug { \"Message handler terminated.\" }\n end", "def on_message_data_receiving_event(ctx) end", "def received\n end", "def message( message )\n\tend", "def handle_message(message_hash)\n socket_id = message_hash[\"socket_id\"]\n message = message_hash[\"message\"]\n type = message[\"type\"]\n\n post(send(type, message_hash))\n end", "def do_message_callback(message)\n topic = message.topic\n action = parse_action(topic)\n type = parse_type(topic)\n payload = message.payload\n token = nil\n new_version = -1\n @parser_mutex.synchronize() {\n @payload_parser.set_message(payload)\n new_version = @payload_parser.get_attribute_value(\"version\")\n token = @payload_parser.get_attribute_value(\"clientToken\")\n }\n if %w(get update delete).include?(action)\n if @token_pool.has_key?(token)\n @token_pool[token].cancel\n @token_pool.delete(token)\n if type.eql?(\"accepted\")\n do_accepted(message, action.to_sym, token, type, new_version)\n else\n do_rejected(token, action, new_version)\n end\n @task_count_mutex.synchronize {\n decresase_task_count(action.to_sym)\n }\n end\n elsif %w(delta).include?(action)\n do_delta(message, new_version)\n end\n end", "def update_message(data); end", "def update_message(data); end", "def call(message)\n if message.command == 'MESSAGE'\n handler.call(JSON.parse(message.body, symbolize_names: true))\n end\n rescue => e\n log.error(e.message) { \"\\n#{e.backtrace.inspect}\" }\n ensure\n ack(message)\n log.info('Processed') { %(#{message.headers['message-id']} from \"#{message.headers['destination']}\") }\n end", "def receive\n begin\n message = save_message\n rescue => err\n render :text => err.message, :status => 400\n return\n end\n \n begin\n message.process! params\n rescue => err\n message.reply = err.message\n ensure\n if (message.reply != \"Invalid command\")\n collection_id = get_collection_id(params[:body])\n if collection_id and collection_id >0\n message[:collection_id] = collection_id\n end\n end\n message.save\n render :text => message.reply, :content_type => \"text/plain\"\n end\n end", "def handle_arbitrary(msg)\n\t@raw_data = msg.dup()\n\tarbitrary(msg)\n end", "def received(message)\n if message.respond_to?(:encoding) && message.encoding != 'UTF-8'\n message.force_encoding 'UTF-8'\n end\n data = JSON.parse message, :symbolize_names => true\n\n case data[:type]\n when 'text'\n return if @nonces.include?(data[:nonce])\n @nonces << data[:nonce]\n room.message @user, data[:text], name_color, data[:client_ts]\n when 'av-invite', 'av-accept', 'av-close'\n return if @nonces.include?(data[:nonce])\n @nonces << data[:nonce]\n av_message data\n when 'sync'\n @last_event_id = data[:last_event_id].to_i\n sync_events\n when 'ping'\n respond pong: { nonce: data[:nonce], client_ts: data[:client_ts] }\n when 'relay'\n return if @nonces.include?(data[:nonce])\n @nonces << data[:nonce]\n room.relay @user, data[:to], data[:body], data[:client_ts]\n end\n end", "def message(message) end", "def on_message_call handler\n @@handler_symbol = handler\n end", "def process_message(message, connection)\n if(message.is_a?(FrameType::Message))\n distribution.register_message(message, connection.identifier)\n message.origin = current_actor\n end\n message\n end", "def handle_input(patch, json_message, &callback)\n message_hash = JSON.parse(json_message, :symbolize_names => true)\n message = Message.new(message_hash)\n @log.puts(\"Recieved message: #{message_hash.to_json}\") if @log\n yield(message) if block_given?\n message\n end", "def process_message(message)\n with_retries(max_tries: retries, handler: retry_handler) do\n handler.call(parse_message(message.value))\n end\n rescue StandardError => e\n handle_exception(e)\n stop\n else\n store_offset(offset)\n self\n end", "def receive\n # Process msg_descriptor\n Subscriber.execute_from_descriptor(msg_descriptor)\n head :no_content\n rescue InvalidSubscriberError\n # 404: Message delivery will be retried\n head :not_found\n rescue StandardError\n # 422: Message delivery will be retried\n head :unprocessable_entity\n end", "def message_handler(&message_proc)\n @message_proc = message_proc\n end", "def on_server_response(connection, message)\n end", "def on_message_data_event(ctx) end", "def on_message_data_event(ctx); end", "def message\n raise \"Override #message in the service class\"\n end", "def handle_message(message, sender)\n partition = message.split(/\\s+/) #parsing the message\n puts message\n message_type = partition[0]\n if message_type.upcase == \"EXEC\" #exec is used to execute commands from the ui\n func_name, *params = partition[1..-1]\n if EXEC_TABLE.include? func_name\n Thread.new{\n send(func_name, *params)\n }.run\n end\n else\n func_name = partition[0].downcase.sub('-', '_')\n if HANDLE_REQUEST_TABLE.include? \"handle_#{func_name}\"\n Thread.new {\n send(\"handle_#{func_name}\",message, sender)\n }.join\n end\n end\n end", "def handle_message(metadata, payload)\n @consumer_channel.push payload\n end", "def handle_message(message)\n\t\t\tif(message.type == 'exception')\n\t\t\t\t@logger.error(LOG_ERR,message.message)\n\t\t\t\treturn()\n\t\t\tend\n\n\t\t\t# If the message has a type of intention, then we have the chance to\n\t\t\t# basically say \"NO\" to the action. In this case we are going to\n\t\t\t# say no to any intention that references the filename 'notouch'. We could\n\t\t\t# in theory filter on any aspect of the message (the type, the tags, or\n\t\t\t# the content of the message itself), but in this case a simple regex hack\n\t\t\t# for example purposes will do nicely\n\t\t\tif(message.type == 'intention')\n\n\t\t\t\t# we can only really block intentions, so only bother checking\n\t\t\t\t# if the message is an intention\n\n\t\t\t\t@logger.notify(VERBOSE_MAJOR,message.message)\n\t\t\telsif (message.type == 'info')\n\t\t\t\tif(message.message =~ /^search|lock|backup/)\n\t\t\t\t\t# overrule status of these\n\t\t\t\t\t@logger.notify(VERBOSE_MINOR,message.message)\n\t\t\t\telse\n\t\t\t\t\t@logger.notify(VERBOSE_CRITICAL,message.message)\n\t\t\t\tend\n\t\t\telsif (message.type == 'verbose')\n\t\t\t\t@logger.notify(VERBOSE_MAJOR,message.message)\n\t\t\telsif (message.type == 'debug')\n\t\t\t\t@logger.notify(VERBOSE_MINOR,message.message)\n\t\t\telse\n\t\t\t\t@logger.notify(VERBOSE_MINOR,message.message)\n\t\t\tend\n\t\t\ttrue\n\t\tend", "def receive\n raise NotImplementedError\n end", "def handle_incoming_message(data)\n message = parse(data)\n text = message[:text].downcase\n\n if text.include?(\"now playing\") || text.include?(\"coming next\")\n @logger.debug(\"Discarding message #{message}\")\n else\n @logger.debug(\"Keeping message #{message}\")\n # fire on_message callbacks\n notify(:on_message, message)\n # if the is_new? is true then fire on_programme_changed callbacks\n notify(:on_programme_changed, message) if is_new?(message)\n # store the message in the cache\n cache_store(message[:station_id], message)\n end\n end", "def handle\n raise \"Not implemented yet!\"\n end", "def dispatch(message_payload)\n debug_me{[ :message_payload ]}\n raise ::SmartMessage::Errors::NotImplemented\n end", "def msg_handle(msg, exception)\n\n fexp = Ruote::Exp::FlowExpression.fetch(\n @context, msg['fei'] || msg['workitem']['fei']\n ) rescue nil\n\n handle(msg, fexp, exception)\n end", "def handle_item(msg)\n return nil unless @options['outgoing_token'].include? msg[:token] # ensure messages are for us from slack\n return nil if msg[:user_name] == 'slackbot' # do not reply to self\n return nil unless msg[:text].is_a?(String) # skip empty messages\n\n ## loop things to look for and collect immediate responses\n ## rescue everything here so the bot keeps running even with a broken script\n responses = @regexes.map do |regex, proc|\n if mdata = msg[:text].strip.match(regex)\n begin\n Slackbotsy::Message.new(self, msg).instance_exec(mdata, &proc)\n rescue => err\n err\n end\n end\n end\n\n ## format any replies for http response\n if responses\n { text: responses.compact.join(\"\\n\") }.to_json\n end\n end", "def process\n logger.info \"Beetle: received message #{message.inspect}\"\n end", "def onmessage(&blk); super; end", "def receive_object message\n transition_on_recv message_name(message), message\n end", "def message_received(client, msg)\n content = JSON.parse msg.data\n\n kind = content['type'] || 'empty message'\n\n OutputLogger.logger.info \"Received a message of the #{kind} type.\"\n OutputLogger.logger.debug content\n\n method = \"on_#{content['type']}\"\n\n send(method, content, client) if respond_to?(method)\n end", "def process_message(msg)\n if admin && authenticated?\n Socky::Message.process(self, msg)\n else\n self.send_message \"You are not authorized to post messages\"\n end\n end", "def message(message)\n # message can be also accessed via instance method\n message == self.payload # true\n # store_message(message['text'])\n end", "def message(event)\n req = Message.from_wire(event.data)\n\n if req.type == \"rpc\" then\n # Execute the requested method and return the result\n # Do it asynchronously so as not to hold up the EM-loop while the command is running\n @thread_pool.perform do\n json_req = req.json_request\n logger.debug { \"RPC request\\n#{json_req}\" }\n json_response = @handler.new(req).handle(json_req)\n EM.next_tick { ws.send(Response.new(json_response, req.id).to_wire) }\n end\n\n elsif req.type == \"rpc_result\" then\n # Pass the result back to the caller\n res = req.json_response\n logger.debug { \"RPC_RESULT for request id [#{req.id}]\\n#{res}\" }\n @responses[req.id].response = res\n\n elsif req.type == \"connect\" then\n # Agent request to CONNECT to the manager\n # will only be received by the server-end of the channel\n logger.debug { \"CONNECT request #{req.id}\"}\n ret = @handler.new(req).connect(req.json_request, self)\n if ret.kind_of? JsonResponse then\n ws.send(Response.new(ret, req.id).to_wire)\n else\n ws.send(Response.new(JsonResponse.new(\"success\"), req.id).to_wire)\n end\n\n end\n end", "def message(message)\n handler = handler_for_context\n return unless handler\n if handler.respond_to?(:call)\n instance_exec(message, &handler)\n else\n process(handler, *message['text'].split)\n end\n end", "def on_message(m)\n end", "def do_recv()\n data = super()\n message = Hurricane::Message.new()\n message.type = data.data[0].name\n message.destination = data.data[1]\n message.tag = data.data[2]\n message.data = data.data[3]\n message\n end", "def on_message(message)\n search_for = message.event.split(\"/\")\n raise InvalidBackendEvent(message.event) if search_for.size < 2\n klass = @handlers[search_for[0]] and handler = klass.method(search_for[1])\n raise UndefinedHandler.new(message.event) unless handler\n logger.info(\"#{message.event}, #{message.inspect}\")\n handler.call(message)\n end", "def handle(data)\n\t\t\t\tprocess_line(data)\n\t\t\tend", "def message_received(message)\n @message_handlers.each do |block|\n block.call(message)\n end\n end", "def handle\n respond\n nil\n end", "def handle_message( delivery_info, properties, payload, &work_callback )\n\t\tmetadata = {\n\t\t\tdelivery_info: delivery_info,\n\t\t\tproperties: properties,\n\t\t\tcontent_type: properties[:content_type],\n\t\t}\n\t\trval = work_callback.call( payload, metadata )\n\t\treturn self.ack_message( delivery_info.delivery_tag, rval )\n\n\t# Re-raise errors from AMQP\n\trescue Bunny::Exception => err\n\t\tself.log.error \"%p while handling a message: %s %s\" %\n\t\t\t[ err.class, err.message, err.backtrace.first ]\n\t\tself.log.debug \" \" + err.backtrace.join( \"\\n \" )\n\t\traise\n\n\trescue => err\n\t\tself.log.error \"%p while handling a message: %s %s\" %\n\t\t\t[ err.class, err.message, err.backtrace.first ]\n\t\tself.log.debug \" \" + err.backtrace.join( \"\\n \" )\n\t\treturn self.ack_message( delivery_info.delivery_tag, false, false )\n\tend", "def on_message(msg); @parent.on_message(@env, msg); end", "def handle\n case event_key\n when 'specialdeal'\n # it simulate an exchange with the special deal keyword\n SmartExchange::Process.new(user, 'special deal').perform\n when 'offers'\n # it simulate an exchange with the offers keyword\n SmartExchange::Process.new(user, '奖励').perform\n when 'groupchat'\n messenger.image! path: '/images/wechat/group.jpg'\n when 'chatsale'\n messenger.text! data(:chatsale)\n messenger.image! path: '/images/wechat/wechat_support_qr.jpg'\n when 'support'\n # it simulate an exchange with the support keyword\n SmartExchange::Process.new(user, '客服').perform\n when 'ping'\n messenger.text! data(:ping)\n end\n\n return_with(:success)\n end", "def handle(context)\n \n # Notify all connection listeners by calling their on_server_response method.\n super(context)\n \n # Notify all connection listeners by calling their on_private_message method.\n notify(context) do |connection_listener| \n connection_listener.on_private_message(context, IRC::Models::Channel.is_valid?(target) ? context.lookup_channel(target) : context.lookup_user(target), text)\n end\n\n end", "def unhandled_message(msg)\n msg.raw.prefix = msg.client.prefix\n push(msg)\n end", "def handle_readable_io_event( event )\n\t\tself.log.debug \"Got socket read event: %p\" % [ event ]\n\t\tmsg = event.socket.receive\n\t\ttype, data, header = Assemblage::Protocol.decode( msg )\n\n\t\tunless HANDLED_MESSAGE_TYPES.include?( type )\n\t\t\tself.log.error \"Got unhandled message type %p\" % [ type ]\n\t\t\traise \"Invalid action %p!\" % [ type ]\n\t\tend\n\n\t\tmethod_name = \"on_%s_message\" % [ type ]\n\t\thandler = self.method( method_name )\n\t\thandler.call( data, header )\n\tend", "def handle_message(message, ip, transport)\n payload = message.payload\n\n @message_hooks[payload.class].each do |hook|\n hook.call(payload)\n end\n @message_signal.broadcast\n end", "def on_message(event)\n data = event.data\n\n response = data.match(/~m~\\d*~m~(.*)/)[1]\n message =\n case response\n when /no_session/\n {'command' => 'no_session'}\n when /~h~([0-9]+)/\n # Send the heartbeat command back to the server\n @socket.send($1)\n {'command' => 'heartbeat'}\n else\n JSON.parse(response)\n end\n message['command'] = 'response_received' if message['msgid']\n\n logger.debug \"Message received: #{message.inspect}\"\n dispatch(message)\n end", "def new_message\n end", "def handle_message(consumer, delivery_info, properties, payload)\n serializer = consumer.get_serializer || Hutch::Config[:serializer]\n logger.debug {\n spec = serializer.binary? ? \"#{payload.bytesize} bytes\" : \"#{payload}\"\n \"message(#{properties.message_id || '-'}): \" +\n \"routing key: #{delivery_info.routing_key}, \" +\n \"consumer: #{consumer}, \" +\n \"payload: #{spec}\"\n }\n\n message = Message.new(delivery_info, properties, payload, serializer)\n consumer_instance = consumer.new.tap { |c| c.broker, c.delivery_info = @broker, delivery_info }\n with_tracing(consumer_instance).handle(message)\n @broker.ack(delivery_info.delivery_tag) unless consumer_instance.message_rejected?\n rescue => ex\n acknowledge_error(delivery_info, properties, @broker, ex)\n handle_error(properties, payload, consumer, ex)\n end", "def deliver(message)\n raise NotImplementedError\n end", "def process_job_msg(job_msg)\n msg = job_msg[\"msg\"]\n data = job_msg[\"data\"]\n\n if status == 'pending' && msg == 'begin'\n @status = 'running'\n @start_time = Time.now\n elsif (status == 'running' || status == 'unknown') && (msg == 'success' || msg == 'failure')\n @status = msg\n @result = data\n @duration = Time.now - @start_time\n elsif (status == 'running' || status == 'unknown') && msg == 'exception'\n @status = 'exception'\n @exception = data\n @duration = Time.now - @start_time\n elsif msg == \"info\"\n # Ignore client defined messages\n true\n elsif msg == \"arrhythmia\"\n @status = 'unknown'\n @duration = Time.now - @start_time\n else\n raise \"State machine Error #{job_msg}\"\n end\n end", "def onmessage(msg)\n Slanger::Statsd.increment(\"messages\")\n Slanger::Statsd.gauge(\"message_size\", msg.bytesize)\n\n msg = Oj.load(msg)\n\n msg[\"data\"] = Oj.load(msg[\"data\"]) if msg[\"data\"].is_a? String\n\n case msg[\"event\"]\n when /\\Aclient-/\n msg[\"socket_id\"] = socket_id\n Channel.send_client_message(msg)\n when \"pusher:ping\"\n pusher_ping(msg)\n when \"pusher:pong\"\n pusher_pong(msg)\n when \"pusher:subscribe\"\n pusher_subscribe(msg)\n when \"pusher:unsubscribe\"\n pusher_unsubscribe(msg)\n end\n rescue JSON::ParserError, Oj::ParseError\n send_error({ code: 5001, message: \"Invalid JSON\" })\n rescue Exception => e\n puts \"Error: #{e.class.name}: #{e.message}\\n#{e.backtrace.join(\"\\n\")}\"\n send_error({ code: 500, message: \"Internal Error\" })\n end", "def process_message(message, event_data={})\n log.debug(\"Processing #{message.inspect}, event=#{event_data}\")\n unless message_processor\n raise \"No message processor registered. Please call on_message on the adapter.\"\n end\n\n is_valid = verify(event_data)\n unless verify(event_data)\n log.warn(\"Not valid request ignored: event_data=#{event_data}, message=#{message.inspect}\")\n return nil\n end\n\n answer = message_processor.call(message, event_data)\n post_process(answer)\n end", "def do_dispatch(participant, msg)\n\n do_raw_dispatch(participant, msg)\n\n rescue => err\n @context.error_handler.msg_handle(msg, err)\n end", "def process_message(message, connection)\n discard = false\n if(message.is_a?(FrameType::Message))\n message.origin = current_actor\n message.connection = connection\n retried = false\n begin\n distribution.register_message(message, connection.identifier)\n rescue KeyError => e\n if(!retried && queue.scrub_duplicate_message(message))\n retried = true\n retry\n else\n error \"Received message is currently in flight and not in wait queue. Discarding! (#{message})\"\n discard = true\n end\n end\n end\n discard ? nil : message\n end", "def process_omf_message(message, topic)\n unless message.is_a? OmfCommon::Message\n raise \"Expected Message, but got '#{message.class}'\"\n #message = OmfCommon::Message.new(props.dup)\n end\n #puts \"PPP(#{topic.id}|#{uid})-> #{message}\"\n objects_by_topic(topic.id.to_s).each do |obj|\n #puts \"TTT(#{self})-> #{obj}\"\n if OmfCommon::Measure.enabled?\n OmfRc::ResourceProxy::MPReceived.inject(Time.now.to_f, self.uid, topic, message.msg_id) \n end\n execute_omf_operation(message, obj, topic)\n end\n end", "def on_message(raw_event, _sentry_span)\n Rails.logger.debug { \"#{Time.zone.now.getutc.inspect}: Receiving from #{@socket.url}: #{raw_event.data.inspect}\" }\n event = decode(raw_event.data)\n return unless BACKEND_OUTPUT_SCHEMA.valid?(event)\n\n event = event.deep_symbolize_keys\n message_type = event[:type].to_sym\n if WEBSOCKET_MESSAGE_TYPES.include?(message_type)\n __send__(\"handle_#{message_type}\", event)\n else\n @error = Runner::Error::UnexpectedResponse.new(\"Unknown WebSocket message type: #{message_type}\")\n close(:error)\n end\n end" ]
[ "0.77331185", "0.7644825", "0.74614835", "0.7396809", "0.7200166", "0.7144659", "0.7083334", "0.7058774", "0.70191526", "0.698522", "0.6972786", "0.6961261", "0.6907505", "0.68848187", "0.6877964", "0.6809597", "0.67771184", "0.67368746", "0.6706952", "0.67024106", "0.6696873", "0.66654646", "0.6645517", "0.6632563", "0.66051406", "0.656155", "0.65496916", "0.6500441", "0.6481071", "0.6466106", "0.643891", "0.6428487", "0.6426206", "0.64039195", "0.64018977", "0.63966966", "0.6370564", "0.637026", "0.6357914", "0.63286895", "0.63214326", "0.6298937", "0.62806606", "0.62716997", "0.62716997", "0.6259517", "0.6247315", "0.6240812", "0.62337816", "0.6212199", "0.62117267", "0.62083584", "0.6199266", "0.61827695", "0.6176907", "0.6170707", "0.61643577", "0.6163479", "0.6162982", "0.6156311", "0.61503017", "0.61479366", "0.61464596", "0.61458224", "0.6130736", "0.61159694", "0.6114447", "0.6111703", "0.60907495", "0.60854864", "0.6085126", "0.6079471", "0.60706234", "0.6063415", "0.6051094", "0.60504615", "0.60417914", "0.60315037", "0.60289", "0.6026114", "0.60135245", "0.6007359", "0.600052", "0.5996133", "0.5992459", "0.5975359", "0.59746414", "0.5971057", "0.5965501", "0.5959048", "0.5958371", "0.595248", "0.5946302", "0.59423876", "0.5937719", "0.5937328", "0.59319794", "0.5921248", "0.5919636", "0.59088516", "0.5906144" ]
0.0
-1
Concrete implementations that want to change the options used for queue subscription may override this for their specific requirements.
def subscription_opts { manual_ack: true, block: true } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_queue_options(options = {})\n @queue_options = options\n end", "def sidekiq_options(opts = T.unsafe(nil)); end", "def queue_opts\n {\n :max_bytes => 50_000,\n :service => config.kafka_response_topic,\n }\n end", "def initialize options\n super\n\n @group = 'Queue'\n @name = options[:name]\n @type = 'Queue'\n\n @queue = Queue.new\n @last_description = Time.at 0\n @last_size = 0\n end", "def initialize\n @queue_options = {}\n @queue_configs = []\n end", "def initialize(options)\n @options = {\n 'queue' => nil,\n 'forget' => false,\n }.merge(options.inject({}) { |h, (k, v)|\n h[k.to_s] = v; h\n })\n #\n # the inject is here to make sure that all options have String keys\n end", "def initialize(options)\n\n @options = {\n 'queue' => nil,\n 'forget' => false,\n }.merge(options.inject({}) { |h, (k, v)|\n h[k.to_s] = v; h\n })\n #\n # the inject is here to make sure that all options have String keys\n end", "def to_options\n { :ppg => ppg }.merge(queue.to_options)\n end", "def stompkiq_options(opts={})\n self.stompkiq_options_hash = get_stompkiq_options.merge(symbolize_keys(opts || {}))\n end", "def configure(options, cfg)\n cfg = super(options, cfg)\n cfg[:offline_queueing] = options[:offline_queueing]\n cfg[:filter_params] = options[:filter_params]\n cfg\n end", "def job_options\n end", "def set(options = {}) # :nodoc:\n self.scheduled_at = options[:wait].seconds.from_now.to_f if options[:wait]\n self.scheduled_at = options[:wait_until].to_f if options[:wait_until]\n self.queue_name = self.class.queue_name_from_part(options[:queue]) if options[:queue]\n self.priority = options[:priority].to_i if options[:priority]\n\n self\n end", "def options\n @options ||= { include: %i[topics]}\n end", "def subscription_options(subscription_id=nil)\n params = {}\n params['subid'] = subscription_id if subscription_id\n subscribee = connection.jid.bare\n\n iq = connection.iq_stanza({'to'=>jid.bare,'type'=>'get'},\n x('pubsub',{:xmlns => EM::Xmpp::Namespaces::PubSub},\n x('options',{'node' => node_id, 'jid'=>subscribee}.merge(params))\n )\n )\n\n send_iq_stanza_fibered iq\n end", "def autogenerated_queues\n @options['queues'] || []\n end", "def delivery_options(options=nil)\n if options.class == Hash && !block_given?\n @j_del.java_method(:deliveryOptions, [Java::IoVertxCoreEventbus::DeliveryOptions.java_class]).call(Java::IoVertxCoreEventbus::DeliveryOptions.new(::Vertx::Util::Utils.to_json_object(options)))\n return self\n end\n raise ArgumentError, \"Invalid arguments when calling delivery_options(options)\"\n end", "def delivery_options(options=nil)\n if options.class == Hash && !block_given?\n @j_del.java_method(:deliveryOptions, [Java::IoVertxCoreEventbus::DeliveryOptions.java_class]).call(Java::IoVertxCoreEventbus::DeliveryOptions.new(::Vertx::Util::Utils.to_json_object(options)))\n return self\n end\n raise ArgumentError, \"Invalid arguments when calling delivery_options(options)\"\n end", "def alter_subscription_options(name, options)\n base_command = \"ALTER SUBSCRIPTION #{connection.quote_ident(name)}\"\n typed_exec(command_builder.command_with_options(base_command, \"SET\", options))\n end", "def queue\n\n @queue ||= channel.queue(*(opt('queue') || [ '' ]))\n end", "def initialize(*)\n super\n self.options = options.dup\n end", "def quoteoptions()\n fail \"Not yet implemented\"\n end", "def set_async_defaults\n @async_transport_options ||= {}\n defaults = {\n queue: \"magic_pipe\"\n }\n @async_transport_options = defaults.merge(@async_transport_options)\n end", "def define_options(opt)\n # override this; no additional options by default\n end", "def options() end", "def initialize(options)\n Resque.redis = \"#{options[:server]}:#{options[:port]}\"\n Resque.redis.sadd(:queues, :default)\n end", "def initialize(options)\n Resque.redis = \"#{options[:server]}:#{options[:port]}\"\n Resque.redis.sadd(:queues, :default)\n end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def configuration_options\n iq = connection.iq_stanza({'to'=>jid.bare},\n x('pubsub',{:xmlns => EM::Xmpp::Namespaces::PubSubOwner},\n x('configure','node' => node_id)\n )\n )\n\n send_iq_stanza_fibered iq\n end", "def to_options\n { :queue_name => queue_name, :h_or_s => h_or_s }.merge(center.to_options)\n end", "def process_options\n \n end", "def process_options\n \n end", "def process_options\n \n end", "def process_options\n \n end", "def options(opt); end", "def options(opt); end", "def options; [] end", "def options\n self[:options] || {}\n end", "def options\n self[:options] || {}\n end", "def initialize_options(original_options)\n super\n\n case options[:backend]\n when String, Symbol, Class\n @backend, @backend_options = options[:backend], options.dup\n when Array\n @backend, @backend_options = options[:backend]\n @backend_options = @backend_options.merge(options)\n when NilClass\n @backend = @backend_options = nil\n else\n raise ArgumentError, \"backend must be either a backend name, a backend class, or a two-element array\"\n end\n\n @backend = load_backend(backend)\n end", "def queue(queue)\n @configuration.queue = queue\n end" ]
[ "0.7389216", "0.6692001", "0.6672528", "0.6628448", "0.6626808", "0.63843757", "0.6383831", "0.6185646", "0.6049891", "0.5959204", "0.591284", "0.5878031", "0.5867837", "0.5838161", "0.5834981", "0.582625", "0.582625", "0.58171904", "0.5816752", "0.5807549", "0.57887834", "0.5783073", "0.57295096", "0.5718462", "0.5713866", "0.5712744", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.57000136", "0.5699609", "0.56704384", "0.5663724", "0.5663724", "0.5663724", "0.56634384", "0.56472", "0.564602", "0.5637389", "0.5606712", "0.5597194", "0.5595024", "0.55918694" ]
0.6353319
7
GET /datos_usuarios GET /datos_usuarios.json
def index @datos_usuarios = DatosUsuario.all @talla = Talla.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @usuarios = Usuario.por_colegio(colegio.id).order(\"nombre\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usuarios }\n end\n end", "def index\n @usuarios = Usuario.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usuarios }\n end\n end", "def index\n @usuarios = Usuario.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usuarios }\n end\n end", "def index\n @usuarios = Usuario.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usuarios }\n end\n end", "def index\n @usuarios = Usuario.all\n # respond_to do |format|\n # format.html\n # format.json { render :json => @usuarios }\n # end\n end", "def index\n @usuarios = Usuario.all\n @usuarios_json = @usuarios.to_json\n end", "def index\n @deporte_usuarios = DeporteUsuario.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @deporte_usuarios }\n end\n end", "def show\n @usuario = Usuario.find(params[:id])\n\n render json: @usuario\n end", "def index\n @seguridad_usuarios = Seguridad::Usuario.order('usuario')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @seguridad_usuarios }\n end\n end", "def show\n @usuario = Usuario.find(params[:id])\n render json: @usuario\n end", "def show\n @usuario = Usuario.find(params[:id])\n render json: @usuario\n end", "def index\n @tipo_usuarios = TipoUsuario.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tipo_usuarios }\n end\n end", "def index\n @usuarios = Usuario.paginate(page: params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usuarios }\n end\n end", "def index\n @usuarios = Usuario.all\n\n @users = Usuario.all.order(:id)\n @users.each do |u|\n puts u.id\n end\n #render json: @usuarios\n render 'index.json.jbuilder'\n end", "def index\n @usuarios = Usuario.all\n end", "def index\n @usuarios = Usuario.all\n end", "def index\n @usuarios = Usuario.all\n end", "def index\n if params[:usuario_producto]\n @usuario = Usuario.find(params[:usuario_id])\n render json: @usuario.productos\n else\n @productos = Producto.all\n render json: @productos\n end\n end", "def show\n @usuario = Usuario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @usuario }\n end\n end", "def show\n @usuario = Usuario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @usuario }\n end\n end", "def index\n #@usuarios = Usuario.all\n end", "def show\n @usuarios = Usuario.all\n end", "def index\n # @usuarios = @topico.perguntas.usuarios\n end", "def index\n @tutorados = Tutorado.all\n\n render json: @tutorados, status: :ok\n end", "def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\n end", "def show\n @usuarios = Usuario.where(tipo: 'usuario')\n end", "def expiracion\n @usuario = Usuario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @usuario }\n end\n end", "def index\n #@usuarios = User.all.order_by([:email, :asc]).paginate(:page => params[:page], :per_page => @@page)\n @usuarios = User.accessible_by(current_ability).order_by([:email, :asc]).paginate(:page => params[:page], :per_page => @@page)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usuarios }\n end\n end", "def index\n @users = User.where(:apartamento_id => params[:apartamento_id])\n #@users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n \t\tif params[:usuario_pedido]\n \t\t\t@usuario = Usuario.find(params[:usuario_id])\n authorize! :show, @usuario\n \t\t\t@usuario.pedidos.reload\n \t\t\trender json: @usuario.pedidos\n \t\telse\n \t\t\t@negocio = Negocio.find(params[:negocio_id])\n authorize! :update, @negocio\n \t\t@negocio.pedidos.reload\n \t\trender json: @negocio.pedidos\n \t\tend\n \tend", "def index\n @users = User.all\n @title = \"Пользователи\"\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def show\n \t\tif params[:usuario_pedido]\n \t\t\t@usuario = Usuario.find(params[:usuario_id])\n \t\t\trender json: @usuario.pedidos.find(@pedido.id)\n \t\telse\n \t\t\t@negocio = Negocio.find(params[:negocio_id])\n \t\t\trender json: @negocio.pedidos.find(@pedido.id)\n \t\tend\n \tend", "def index\n render json: current_org.users\n end", "def list\r\n users = User.all\r\n render json: users\r\n end", "def get_ponto\n render json: Usuario.ultimo_ponto(params[:user_id], params[:evento_id]).to_json\n end", "def index\n users = User.all\n render json: { users: users }, status: :ok\n end", "def index\n\t @allUsuarios = Usuario.all\n end", "def index\n \treclamos = Reclamo.all\n \trender json: reclamos.to_json(include: [:tipo_reclamo, :ubicacion, :user], methods: [:valoracion])\n end", "def index\n json_response(User.all) \n end", "def index\n @users = User.all\n render json: @users, status: :ok\n end", "def show\n if Usuario.exists?(params[:id])\n @usuario = Usuario.find(params[:id])\n render json: @usuario\n else\n render json: %q[{\"error\": \"Usuario no encontrado\"}], status: 404\n end\n #render :show, status: :created, location: @usuario\n end", "def index\n @usuarios = Usuario.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @usuarios }\n end\n end", "def users\n @users = User.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @administration }\n end\n end", "def show\n @usuario = Usuario.find(params[:id])\n @posts = Post.where(:usuario_id => @usuario.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @usuario }\n end\n end", "def list\n render json: User.all\n end", "def index\r\n users = User.all\r\n render json: users\r\n end", "def index\n users = User.all\n render json: users \n end", "def index\n users = User.all \n render json: users \n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def index\n code = :ok\n currentUser = {\n id: current_user.utilisateur.id,\n fullName: current_user.utilisateur.prenom_nom,\n }\n result = {\n signedIn: user_signed_in?,\n currentUser: currentUser,\n locations: Lieu.all\n }\n render json: result, status: code \n end", "def index\n seleccionarMenu(:juzgados)\n @juzgados = Juzgado.order(:ciudad_id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @juzgados }\n end\n end", "def index\n @grupoassuntos = Grupoassunto.all\n\n render json: @grupoassuntos\n end", "def index\n @users = User.all\n render json: @users, status: :ok\n end", "def show\n\tadd_breadcrumb \"Mostrar usuario\", :usuario_path\n @usuario = Usuario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @usuario }\n end\n end", "def show\n @tipo_usuario = TipoUsuario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_usuario }\n end\n end", "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end", "def index\n user= User.all\n render json: {users:user}\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def show\n @usuario = Usuario.find(params[:id])\n respond_to do |format|\n if @usuario.save\n format.json { render :show, status: 200, location: @usuario }\n else\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n #para mostrar solo los post del usuario actual\n @posts = Post.where(usuario_id: current_usuario.id).all\n puts \"USUARIOOOO\"\n puts current_usuario.to_json\n\n #@posts = Post.all\n end", "def index\n users = User.all\n json_response(users)\n end", "def index\n @users = User.order_by(last_name: :desc)\n if @users\n render json: Oj.dump(json_for(@users, include: ['phones', 'cards'], meta: meta), mode: :compat)\n else\n return head :unauthorized\n end\n end", "def index\n respond_to do |format|\n if authorized?\n format.json { render json: User.all }\n else\n format.json { render json: unauthorized, status: :forbidden }\n end\n end\n end", "def index\n @users = User.all \n render json: @users, status: :ok \n end", "def login\n @users = User.all\n render json: User.all\n end", "def show\n @users = User.all\n json_response(@users)\n end", "def show_disposisi_user\n\t\t@user = Disposisi.where(user_id: params[:user_id]).order(id: :desc).limit(20)\n\t\trender json: @user\t\n\tend", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.where(\"id != ?\", current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n @usrs = Array.new\n format.json {\n @users = @users.select{ |user|\n usr = Hash.new\n user.attributes.each do |key, value|\n usr[key] = value\n end\n usr[:user_email] = \"<a href='mailto:#{user.email}' target='_top'>#{user.email}</a>\"\n if can? :edit, user\n usr[:user_name] = \"<a href='#{privilege_path(user)}'>#{user.name}</a>\"\n usr[:links] = CommonActions.object_crud_paths(nil, edit_privilege_path(user), nil)\n else\n usr[:user_name] = user.name\n usr[:links] = CommonActions.object_crud_paths(nil,nil, nil)\n end\n usr[:role] = user.role_symbols[0].to_s\n @usrs.push(usr)\n }\n render json: {:aaData => @usrs}\n }\n end\n end", "def index\n @tipo_usuarios = TipoUsuario.all\n end", "def index\n\n users = User.all \n render json: users\n\n end", "def index\n @establecimientos = Establecimiento.all\n respond_to do |format|\n format.json { \n\n if (params[:appkey].eql? appkey) #si el appkey es correcto\n\n ests = @establecimientos.map { |establecimiento| { :nombre_establecimiento => establecimiento.nombre, :id => establecimiento.id, \n :descripcion => establecimiento.descripcion, :longitud => establecimiento.longitud,\n :latitud => establecimiento.latitud, :direccion => establecimiento.direccion, :imagen => establecimiento.foto.url(:small),\n :eventos => establecimiento.eventos.map { |evento| { :nombre => evento.nombre } } } } \n render json: ests\n else\n render json: {:error => \"No autorizado\"}\n end\n\n\n\n }\n format.html { redirect_to :controller=>'login', :action=>'login' } #solo el app movil puede revisar toda la lista de establecimientos.\n end\n end", "def index\n @pedidos = Pedido.find(:all, :conditions => [\"cliente_id=?\", session[:usuario_id]])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pedidos }\n end\n end", "def index\n render json: { users: User.pluck(:email, :admin), password: 'PassworD@55' }\n end", "def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end", "def index\n @centro_usuarios = CentroUsuario.all\n end", "def users(args = {})\n get(\"/users.json\",args)\n end", "def show_my_disposisi\n\t\t@user = UserDisposisi.where(user_id: params[:user_id]).order(id: :desc).limit(20)\n\t\trender json: @user\t\n\tend", "def index\n\t\t# specifying json format in the URl\n\t uri = \"#{API_BASE_URL}/users.json\"\n\t # It will create new rest-client resource so that we can call different methods of it\n\t rest_resource = RestClient::Resource.new(uri, USERNAME, PASSWORD)\n\n\t # this next line will give you back all the details in json format, \n\t #but it will be wrapped as a string, so we will parse it in the next step.\n\t users = rest_resource.get \n\n\t # we will convert the return data into an array of hash. see json data parsing here\n\t @users = JSON.parse(users, :symbolize_names => true)\n\tend", "def index\n @ores = Ore.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ores }\n end\n end", "def index\n @users = @users.order('created_at DESC').page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @users, :except => [:perishable_token, :persistence_token, :email, :single_access_token, :last_login_ip, :current_login_ip, :crypted_password, :password_salt] }\n end\n end", "def users\n\t\trespond_with User.all\n\tend", "def index\n \t@users = User.all\n\n respond_to do |format| \n format.json { render json: @users }\n end\n end" ]
[ "0.7519951", "0.74547815", "0.74547815", "0.74547815", "0.7385613", "0.7343958", "0.7199539", "0.7184966", "0.7144348", "0.7110191", "0.7110191", "0.7069025", "0.70162743", "0.69480664", "0.67649865", "0.67649865", "0.67649865", "0.676061", "0.6754323", "0.6754323", "0.6743066", "0.6733725", "0.67309", "0.670633", "0.66811985", "0.66266924", "0.6622103", "0.66188896", "0.6572003", "0.6502993", "0.65022415", "0.6496055", "0.6465559", "0.64534545", "0.6446941", "0.64435333", "0.641743", "0.6416755", "0.6414386", "0.6379038", "0.6370074", "0.63661194", "0.63589966", "0.635793", "0.63543767", "0.634846", "0.63475204", "0.63423485", "0.6337534", "0.6337534", "0.6337534", "0.6337534", "0.6337186", "0.63361114", "0.63354963", "0.63248825", "0.6318325", "0.63160163", "0.63104445", "0.63026834", "0.6300747", "0.6300747", "0.6300747", "0.6300747", "0.6300747", "0.6300747", "0.6300747", "0.6300747", "0.6300747", "0.6300747", "0.6300021", "0.6298838", "0.6298838", "0.6298838", "0.6298838", "0.6298838", "0.6298838", "0.6295258", "0.6288339", "0.62865764", "0.62826747", "0.6281908", "0.62754816", "0.6272006", "0.62619144", "0.62459844", "0.6243004", "0.62367344", "0.62348247", "0.62334955", "0.62305015", "0.6227134", "0.6226964", "0.62263775", "0.6226101", "0.6222558", "0.6221668", "0.6219915", "0.6214029", "0.62118423", "0.6209657" ]
0.0
-1
GET /datos_usuarios/1 GET /datos_usuarios/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @usuario = Usuario.find(params[:id])\n\n render json: @usuario\n end", "def index\n @usuarios = Usuario.por_colegio(colegio.id).order(\"nombre\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usuarios }\n end\n end", "def show\n @usuario = Usuario.find(params[:id])\n render json: @usuario\n end", "def show\n @usuario = Usuario.find(params[:id])\n render json: @usuario\n end", "def index\n @usuarios = Usuario.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usuarios }\n end\n end", "def index\n @usuarios = Usuario.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usuarios }\n end\n end", "def index\n @usuarios = Usuario.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usuarios }\n end\n end", "def index\n @usuarios = Usuario.all\n # respond_to do |format|\n # format.html\n # format.json { render :json => @usuarios }\n # end\n end", "def index\n @usuarios = Usuario.all\n @usuarios_json = @usuarios.to_json\n end", "def index\n @usuarios = Usuario.all\n\n @users = Usuario.all.order(:id)\n @users.each do |u|\n puts u.id\n end\n #render json: @usuarios\n render 'index.json.jbuilder'\n end", "def index\n @tipo_usuarios = TipoUsuario.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tipo_usuarios }\n end\n end", "def show\n @usuario = Usuario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @usuario }\n end\n end", "def show\n @usuario = Usuario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @usuario }\n end\n end", "def index\n @deporte_usuarios = DeporteUsuario.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @deporte_usuarios }\n end\n end", "def index\n @seguridad_usuarios = Seguridad::Usuario.order('usuario')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @seguridad_usuarios }\n end\n end", "def index\n @usuarios = Usuario.paginate(page: params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usuarios }\n end\n end", "def expiracion\n @usuario = Usuario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @usuario }\n end\n end", "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end", "def index\n if params[:usuario_producto]\n @usuario = Usuario.find(params[:usuario_id])\n render json: @usuario.productos\n else\n @productos = Producto.all\n render json: @productos\n end\n end", "def show\n if Usuario.exists?(params[:id])\n @usuario = Usuario.find(params[:id])\n render json: @usuario\n else\n render json: %q[{\"error\": \"Usuario no encontrado\"}], status: 404\n end\n #render :show, status: :created, location: @usuario\n end", "def show\n @tipo_usuario = TipoUsuario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_usuario }\n end\n end", "def index\n # @usuarios = @topico.perguntas.usuarios\n end", "def show\n\tadd_breadcrumb \"Mostrar usuario\", :usuario_path\n @usuario = Usuario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @usuario }\n end\n end", "def show\n \t\tif params[:usuario_pedido]\n \t\t\t@usuario = Usuario.find(params[:usuario_id])\n \t\t\trender json: @usuario.pedidos.find(@pedido.id)\n \t\telse\n \t\t\t@negocio = Negocio.find(params[:negocio_id])\n \t\t\trender json: @negocio.pedidos.find(@pedido.id)\n \t\tend\n \tend", "def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\n end", "def index\n @users = User.where(:apartamento_id => params[:apartamento_id])\n #@users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def show\n utilisateur = UtilisateurService.instance.afficherUtilisateurParId(params[:id])\n (utilisateur != nil) ? (render json: utilisateur, status: :ok) : (render json: nil, status: :not_found)\n end", "def index\n @tutorados = Tutorado.all\n\n render json: @tutorados, status: :ok\n end", "def show\n @usuario = Usuario.find(params[:id])\n respond_to do |format|\n if @usuario.save\n format.json { render :show, status: 200, location: @usuario }\n else\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @users = User.all\n @title = \"Пользователи\"\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @usuarios = Usuario.all\n end", "def index\n @usuarios = Usuario.all\n end", "def index\n @usuarios = Usuario.all\n end", "def index\n #@usuarios = Usuario.all\n end", "def get_ponto\n render json: Usuario.ultimo_ponto(params[:user_id], params[:evento_id]).to_json\n end", "def show\n @usuarios = Usuario.all\n end", "def show\n @usuarios = Usuario.where(tipo: 'usuario')\n end", "def index\n render json: current_org.users\n end", "def index\n \t\tif params[:usuario_pedido]\n \t\t\t@usuario = Usuario.find(params[:usuario_id])\n authorize! :show, @usuario\n \t\t\t@usuario.pedidos.reload\n \t\t\trender json: @usuario.pedidos\n \t\telse\n \t\t\t@negocio = Negocio.find(params[:negocio_id])\n authorize! :update, @negocio\n \t\t@negocio.pedidos.reload\n \t\trender json: @negocio.pedidos\n \t\tend\n \tend", "def show_disposisi_user\n\t\t@user = Disposisi.where(user_id: params[:user_id]).order(id: :desc).limit(20)\n\t\trender json: @user\t\n\tend", "def index\n users = User.all\n render json: { users: users }, status: :ok\n end", "def index\n json_response(User.all) \n end", "def index\n #@users = User.all\n @respuesta = Consulta.new(300,params[0])\n\n respond_to do |format|\n format.json { render json: @respuesta }\n \n end\n end", "def show\n if params[:usuario_producto]\n @usuario = Usuario.find(params[:usuario_id])\n @producto = Producto.find(params[:id])\n render json: @usuario.productos.find(@producto.id)\n else\n \t @producto = Producto.find(params[:id])\n render json: @producto\n end\n end", "def show_my_disposisi\n\t\t@user = UserDisposisi.where(user_id: params[:user_id]).order(id: :desc).limit(20)\n\t\trender json: @user\t\n\tend", "def show\n @usuario = Usuario.find(params[:id])\n @posts = Post.where(:usuario_id => @usuario.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @usuario }\n end\n end", "def index\n #@usuarios = User.all.order_by([:email, :asc]).paginate(:page => params[:page], :per_page => @@page)\n @usuarios = User.accessible_by(current_ability).order_by([:email, :asc]).paginate(:page => params[:page], :per_page => @@page)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usuarios }\n end\n end", "def fetch_one_user_data\n get_url(\"/api/v1/users/#{@filter}\")\n end", "def index\n @users = User.all\n render json: @users, status: :ok\n end", "def show\n @usuario_cartum = UsuarioCartum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @usuario_cartum }\n end\n end", "def show\n @mensaje_usuario = MensajeUsuario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mensaje_usuario }\n end\n end", "def index\n users = User.all\n render json: users \n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def get \n render :json => User.find(params[:id])\n end", "def index\n users = User.all \n render json: users \n end", "def index\n user= User.all\n render json: {users:user}\n end", "def index\r\n users = User.all\r\n render json: users\r\n end", "def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end", "def new\n @usuario = Usuario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @usuario }\n end\n end", "def users\n @users = User.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @administration }\n end\n end", "def index\n @users = User.all\n render json: @users, status: :ok\n end", "def show\n render json: Users.find(params[\"id\"])\n end", "def index\n \treclamos = Reclamo.all\n \trender json: reclamos.to_json(include: [:tipo_reclamo, :ubicacion, :user], methods: [:valoracion])\n end", "def index\n @users = User.all \n render json: @users, status: :ok \n end", "def index\n #para mostrar solo los post del usuario actual\n @posts = Post.where(usuario_id: current_usuario.id).all\n puts \"USUARIOOOO\"\n puts current_usuario.to_json\n\n #@posts = Post.all\n end", "def index\n @grupoassuntos = Grupoassunto.all\n\n render json: @grupoassuntos\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @pedidos = Pedido.find(:all, :conditions => [\"cliente_id=?\", session[:usuario_id]])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pedidos }\n end\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n code = :ok\n currentUser = {\n id: current_user.utilisateur.id,\n fullName: current_user.utilisateur.prenom_nom,\n }\n result = {\n signedIn: user_signed_in?,\n currentUser: currentUser,\n locations: Lieu.all\n }\n render json: result, status: code \n end", "def show\n @utente = Utente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @utente }\n end\n end", "def index\n render :json => User.all, status: 200\n end", "def index\n seleccionarMenu(:juzgados)\n @juzgados = Juzgado.order(:ciudad_id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @juzgados }\n end\n end", "def index\n\t\t# specifying json format in the URl\n\t uri = \"#{API_BASE_URL}/users.json\"\n\t # It will create new rest-client resource so that we can call different methods of it\n\t rest_resource = RestClient::Resource.new(uri, USERNAME, PASSWORD)\n\n\t # this next line will give you back all the details in json format, \n\t #but it will be wrapped as a string, so we will parse it in the next step.\n\t users = rest_resource.get \n\n\t # we will convert the return data into an array of hash. see json data parsing here\n\t @users = JSON.parse(users, :symbolize_names => true)\n\tend", "def show\n @odontologia1 = Odontologia1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @odontologia1 }\n end\n end", "def login\n @users = User.all\n render json: User.all\n end", "def list\r\n users = User.all\r\n render json: users\r\n end", "def index\n users = User.all\n json_response(users)\n end", "def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end", "def index\n render json: User.all\n end", "def index\n render json: User.all\n end", "def index\n render json: User.all\n end", "def index\n @ores = Ore.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ores }\n end\n end", "def index\n @users = User.order_by(last_name: :desc)\n if @users\n render json: Oj.dump(json_for(@users, include: ['phones', 'cards'], meta: meta), mode: :compat)\n else\n return head :unauthorized\n end\n end" ]
[ "0.74363554", "0.7435379", "0.7362068", "0.7362068", "0.727093", "0.727093", "0.727093", "0.7173732", "0.70721734", "0.7041897", "0.6986085", "0.69748753", "0.69748753", "0.6967847", "0.6959963", "0.6899481", "0.68991673", "0.68777704", "0.67736435", "0.6683068", "0.66206574", "0.6571798", "0.6562795", "0.65618557", "0.6549766", "0.6546517", "0.6545977", "0.6536135", "0.6533142", "0.65173876", "0.6515095", "0.6515095", "0.6515095", "0.6513152", "0.6500774", "0.64816827", "0.64789504", "0.6475645", "0.6469047", "0.6456813", "0.6454754", "0.64499164", "0.6441036", "0.64323235", "0.64132303", "0.64128566", "0.640265", "0.63908243", "0.6353104", "0.6336978", "0.63221604", "0.63211507", "0.63194185", "0.63194185", "0.63194185", "0.63194185", "0.6315624", "0.63149494", "0.63137865", "0.63132656", "0.6306004", "0.6281312", "0.6277602", "0.62745124", "0.6274272", "0.62641764", "0.62638605", "0.6262957", "0.62585276", "0.6257009", "0.6257009", "0.6257009", "0.6257009", "0.6257009", "0.6257009", "0.6257009", "0.6257009", "0.6257009", "0.6257009", "0.6256001", "0.62548804", "0.62548804", "0.62548804", "0.62548804", "0.62548804", "0.62548804", "0.6251993", "0.62519896", "0.6250527", "0.6243545", "0.624026", "0.62361115", "0.62323755", "0.6228506", "0.62215215", "0.62214863", "0.62153155", "0.6214978", "0.6214978", "0.62138826", "0.6210092" ]
0.0
-1
POST /datos_usuarios POST /datos_usuarios.json
def create @datos_usuario = DatosUsuario.new(datos_usuario_params) respond_to do |format| if @datos_usuario.save format.html { redirect_to "/inicio/success", success: 'Datos usuario was successfully created.' } else format.html { render action: 'new' } format.json { render json: @datos_usuario.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @usuario = Usuario.new(usuario_params)\n\n if @usuario.save\n render json: @usuario, status: :created, location: @usuario\n else\n render json: @usuario.errors, status: :unprocessable_entity\n end\n end", "def create\n\n puts request.body.string\n\n if request.body.string.include? %q[\"id\"]\n render json: %q[{\"error\": \"No se puede crear usuario con id\"}], status: 400\n else\n @usuario = Usuario.new(usuario_params)\n #Tuve que hacerlo asi, pq por alguna razon no me dejaba de la forma tradicional!\n #@usuario = Usuario.new\n #@usuario.usuario = params[:usuario]\n #@usuario.nombre = params[:nombre]\n #@usuario.apellido = params[:apellido]\n #@usuario.twitter = params[:twitter]\n\n\n respond_to do |format|\n if @usuario.save\n #format.html { redirect_to @usuario, notice: 'Usuario was successfully created.' }\n format.json { render :show, status: :created, location: @usuario }\n else\n #format.html { render :new }\n format.json { render json: @usuario.errors, status: 404}# status: :unprocessable_entity }\n end\n end\n end\n end", "def create\n @usuario = Usuario.new(usuario_params)\n\n respond_to do |format|\n if @usuario.save\n format.html { redirect_to \"/usuarios\", notice: 'Usuario was successfully created.' }\n format.json { render :show, status: :created, location: @usuario }\n else\n format.html { render :new }\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @usuario = Usuario.new(params[:usuario])\n\n respond_to do |format|\n if @usuario.save\n format.html { redirect_to @usuario, notice: 'Usuario fue creado satisfactoriamente' }\n format.json { render json: @usuario, status: :created, location: @usuario }\n else\n format.html { render action: \"new\" }\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @juntum_usuario = JuntumUsuario.new(juntum_usuario_params)\n\n respond_to do |format|\n if @juntum_usuario.save\n format.html { redirect_to @juntum_usuario, notice: 'Juntum usuario was successfully created.' }\n format.json { render :show, status: :created, location: @juntum_usuario }\n else\n format.html { render :new }\n format.json { render json: @juntum_usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @usu = Usuario.new(usuario_params)\n respond_to do |format|\n if @usu.save\n format.html { redirect_to @usu, notice: 'Usuario was successfully created.' }\n format.json { render :show, status: :created, location: @usu }\n else\n format.html { render :new }\n format.json { render json: @usu.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @usuario = Usuario.new(usuario_params)\n respond_to do |format|\n if @usuario.save\n format.html { redirect_to usuarios_url, notice: 'Usuário criado com sucesso.' }\n format.json { render :show, status: :created, location: @usuario }\n else\n format.html { render :new }\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @usuario = Usuario.new(params[:usuario])\n\n all_saved = false\n respond_to do |format|\n begin \n @usuario.transaction do\n @usuario.save!\n @usuario.create_dias_usuario(params[:data_inicio])\n end\n all_saved = true\n rescue ActiveRecord::StatementInvalid\n all_saved = false\n end\n\n if all_saved\n format.html { redirect_to @usuario, notice: 'Usuario was successfully created.' }\n format.json { render json: @usuario, status: :created, location: @usuario }\n else\n format.html { render action: \"new\" }\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def registroapi\n @usuario = User.new(:email => params[:email], :password => params[:password], :password_confirmation => params[:password], :nombre => params[:nombre], :username => params[:username], :nacimiento => params[:nacimiento], :genero => params[:genero])\n if @usuario.save\n respond_to do |format|\n format.html { redirect_to '/users/sign_in', notice: 'Registro exitoso, puedes iniciar sesión.', :status => 200 }\n format.json { render json: { :error => 'false', :desc => 'Registro exitoso' } }\n end\n\n else\n respond_to do |format|\n format.html { redirect_to '/registro_api', alert: @usuario.errors.full_messages.to_sentence }\n format.json { render json: { :error => 'true', :desc => @usuario.errors.full_messages} }\n end\n end\n end", "def create\n @usuario = Usuario.new(usuario_params)\n respond_to do |format|\n if @usuario.save\n format.html { redirect_to @usuario, notice: 'Usuario was successfully created.' }\n format.json { render :show, status: :created, location: @usuario }\n else\n format.html { render :new }\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @usuario = Usuario.new(usuario_params)\n respond_to do |format|\n if @usuario.save\n format.html { redirect_to @usuario, notice: 'Usuario was successfully created.' }\n format.json { render :show, status: :created, location: @usuario }\n else\n format.html { render :new }\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @usuario = Usuario.new(usuario_params)\n respond_to do |format|\n if @usuario.save\n format.html { redirect_to @usuario, notice: 'Usuario was successfully created.' }\n format.json { render :show, status: :created, location: @usuario }\n else\n format.html { render :new }\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tipo_usuario = TipoUsuario.new(params[:tipo_usuario])\n\n respond_to do |format|\n if @tipo_usuario.save\n format.html { redirect_to tipo_usuarios_path, notice: 'Tipo usuario fue creado exitosamente.' }\n format.json { render json: @tipo_usuario, status: :created, location: @tipo_usuario }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tipo_usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n retorno = {erro: \"107\", body: \" \"}\n @usuario = Usuario.new(valid_request?)\n @usuario.status = 1\n if @usuario.mac.blank? \n @usuario.nivel = \"usuario_adm\"\n @usuario.status = 0\n usuario = Usuario.select(:mac).where(\"nivel = 1\").last\n @usuario.mac = (usuario.mac.to_i + 1).to_s\n end\n\n if @usuario.valid?\n if @usuario.save\n retorno = {erro: \"000\", body: {usuario_id: @usuario.id, usuario_nome: @usuario.nome, status: true}}\n end\n end\n #verifica erros na inserção no banco\n if @usuario.errors.any?\n retorno = Usuario.verifica_erro(@usuario.errors.messages)\n end\n render json: retorno.to_json\n end", "def create\n @usuario = Usuario.new(usuario_params)\n @usuario.nombres = @usuario.nombres.upcase\n @usuario.apellidos = @usuario.apellidos.upcase\n @usuario.salario = 0\n respond_to do |format|\n if @usuario.save\n format.html { redirect_to @usuario, notice: 'El Usuario se ha creado correctamente.' }\n format.json { render :show, status: :created, location: @usuario }\n else\n @div_edit_admin = true\n format.html { render :new }\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n end\n end\n \n end", "def datos_usuario_params\n params.require(:datos_usuario).permit(:usuario_id, :tel1, :tel2, :correo, :direccion1, :direccion2, :contacto1, :contacto2, :tipo_sangre_id, :talla_id)\n end", "def create\n @usuario = Usuario.new(params[:usuario])\n\n respond_to do |format|\n if @usuario.save\n\t\tguardar_log(session[:usuario_id], self.class.name,__method__.to_s, @usuario,nil )\n\t\tformat.html { redirect_to usuarios_url,:notice => \"Usuario #{@usuario.nombre} fue creado exitosamente.\" }\n format.json { render :json => @usuario, :status => :created, :location => @usuario }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @usuario.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @usuario = Usuario.new(usuario_params)\n\n respond_to do |format|\n if @usuario.save\n record_activity(\"Nuevo Usuario\")\n format.html { redirect_to @usuario, notice: 'Usuario was successfully created.' }\n format.json { render :show, status: :created, location: @usuario }\n else\n format.html { render :new }\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tipo_usuario = TipoUsuario.new(tipo_usuario_params)\n @tipo_usuarios = TipoUsuario.all.paginate(page: params[:page], per_page: 5)\n @action = { title: \"Novo\", button: \"Salvar\"}\n\n respond_to do |format|\n if @tipo_usuario.save\n format.html { redirect_to action: \"new\", notice: 'TIpo Usuário criada com sucesso.' }\n format.json { render :show, status: :created, location: @tipo_usuario }\n else\n format.html { render :new, location: @tipo_usuario}\n format.json { render json: @tipo_usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @usuarios = Usuario.all\n @usuarios_json = @usuarios.to_json\n end", "def create\n\t\t@usuario = Usuario.find(params[:seguido_id])\n\t\tusuario_actual.seguir(@usuario)\n\t\t\t# respuesta para AJAX\n\t\trespond_to do |formato|\n\t\t\tformato.html { redirect_to @usuario }\n\t\t\tformato.js\n\t\tend\n\tend", "def create\n @usuario = User.new(user_params)\n @usuario.ativo = true\n @usuario.mudar_senha = true\n\n respond_to do |format|\n if @usuario.save\n flash[:notice] = @@msgs\n format.html { redirect_to usuarios_url }\n format.json { render json: @usuario, status: :created, location: @usuario }\n else\n flash[:alert] = @@msge\n format.html { render action: \"new\" }\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n \n end\n end\n end", "def create\n @usuario = User.new(params[:user])\n \n respond_to do |format|\n if @usuario.save\n flash[:success] = \"Usuario criado com sucesso\"\n format.html { redirect_to usuarios_url }\n format.json { render json: @usuario, status: :created, location: @usuario }\n else\n flash[:error] = \"Erro ao criar o usuario\"\n format.html { render action: \"new\" }\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n \n end\n end\n end", "def create\n params.permit(:pseudo_administrateur, :email_administrateur, :motDePasse_administrateur)\n ajout = AdministrateurService.instance.creerNouveauAdmin(params[:pseudo_administrateur], params[:email_administrateur], params[:motDePasse_administrateur])\n (ajout != nil) ? (render json: ajout, status: :ok) : (render json: nil, status: :not_found)\n end", "def create\n @usuario = Usuario.new(usuario_params)\n @usuario.empresa_id = @empresa.id\n @usuario.estado = true\n @usuario.eliminado = false\n respond_to do |format|\n if @usuario.save\n format.html { redirect_to empresa_usuario_path(@usuario.empresa_id,@usuario.id), notice: 'Usuario was successfully created.' }\n format.json { render :show, status: :created, location: @usuario }\n else\n format.html { render :new }\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @usuario = Usuario.new\n \n @personasvinculadas = PersonaVinculada.anioescolar_colegio(anio_escolar.id).where(\"personas_vinculadas.id not in (select persona_vinculada_id from usuarios where colegio_id = ? and persona_vinculada_id <> 0)\", colegio.id).order(\"apellido_paterno\", \"apellido_materno\", \"nombres\")\n @alumnoscolegio = Alumno.por_anio_escolar(anio_escolar.id).where(\"alumnos.id not in (select alumno_id from usuarios where colegio_id = ? and alumno_id <> 0)\", colegio.id).order(\"apellido_paterno\", \"apellido_materno\", \"nombres\")\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @usuario }\n end\n end", "def create\n @seguridad_usuario = Seguridad::Usuario.new(params[:seguridad_usuario])\n\n respond_to do |format|\n if @seguridad_usuario.save\n format.html { redirect_to edit_seguridad_usuario_path(@seguridad_usuario), notice: 'Guardado Correctamente.' }\n format.json { render json: @seguridad_usuario, status: :created, location: @seguridad_usuario }\n else\n format.html { render action: \"new\" }\n format.json { render json: @seguridad_usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @anamnese = Anamnese.new(anamnese_params)\n @usuarios = Usuario.all\n\n respond_to do |format|\n if @anamnese.save\n format.html { redirect_to @anamnese, notice: 'Anamnese criada com sucesso.' }\n format.json { render :show, status: :created, location: @anamnese }\n else\n format.html { render :new }\n format.json { render json: @anamnese.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @deporte_usuario = DeporteUsuario.new(params[:deporte_usuario])\n\n respond_to do |format|\n if @deporte_usuario.save\n format.html { redirect_to deporte_usuarios_path, notice: 'El Usuario ha sido creado exitosamente.' }\n format.json { render json: @deporte_usuario, status: :created, location: @deporte_usuario }\n else\n format.html { render action: \"new\" }\n format.json { render json: @deporte_usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if request.raw_post.include? '\"id\"'\n render json: { \"error\": \"No se puede crear usuario con id\"}, :status => 400\n else\n @usuario = Usuario.new(usuario_params)\n respond_to do |format|\n if @usuario.save\n format.json { render :show, status: 201, location: @usuario }\n else\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def create\n @unidad = current_user.empresa.unidades.new(unidad_params)\n\n respond_to do |format|\n if @unidad.save\n format.html { redirect_to @unidad, notice: 'Unidad was successfully created.' }\n format.json { render action: 'show', status: :created, location: @unidad }\n else\n format.html { render action: 'new' }\n format.json { render json: @unidad.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #Creamos el objeto con los valores a ingresar.\n @usuario = Usuario.new({\n :nombre => params[:usuario][:nombre],\n :apellido => params[:usuario][:apellido],\n :user=> params[:usuario][:user],\n :pass => params[:usuario][:pass],\n });\n #Verificamos si el usuario ha sido creado.\n if @usuario.save()\n redirect_to :controller => \"usuarios\", :action => \"exito\", :notice => \"El usuario ha sido creado\";\n else\n render \"registrar\";\n end\n end", "def create\n @usuario_seguidor = UsuarioSeguidor.new(usuario_seguidor_params)\n\n respond_to do |format|\n if @usuario_seguidor.save\n format.html { redirect_to @usuario_seguidor, notice: 'Usuario seguidor was successfully created.' }\n format.json { render :show, status: :created, location: @usuario_seguidor }\n else\n format.html { render :new }\n format.json { render json: @usuario_seguidor.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @usuarios = Usuario.por_colegio(colegio.id).order(\"nombre\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usuarios }\n end\n end", "def usuario_params\n params.permit(:usuario, :nombre, :apellido, :twitter)\n end", "def create\n params.permit(:email, :adresseIp)\n ajout = UtilisateurService.instance.creerNouveauUtilisateur(params[:email], params[:adresseIp])\n (ajout != nil) ? (render json: ajout, status: :ok) : (render json: nil, status: :not_found)\n end", "def create\n @tablero = Tablero.new(tablero_params)\n m= params.require(:tablero).permit(:idusuario, :grupo, :descripcion, :e1, :e2, :e3, :puntaje)\n\n params[idusuario.each] do |i|\n miembros=[params[:idusuario[i]]:grupo[i], :descripcion[i], :e1[i], :e2[i], :e3[i], :puntaje[i]]\n end\n\n respond_to do |format|\n if @tablero.save\n format.html { redirect_to @tablero, notice: \"El tablero se creó correctamente\" }\n format.json { render :show, status: :created, location: @tablero }\n else\n format.html { render :new }\n format.json { render json: @tablero.errors, status: :unprocessable_entity }\n end\n end\n end", "def usuario_params\n params.require(:usuario).permit(:nombre, :apellido, :usuario, :twitter)\n end", "def create\n @centro_usuario = CentroUsuario.new(centro_usuario_params)\n\n respond_to do |format|\n if @centro_usuario.save\n format.html { redirect_to @centro_usuario, notice: 'Centro usuario was successfully created.' }\n format.json { render :show, status: :created, location: @centro_usuario }\n else\n format.html { render :new }\n format.json { render json: @centro_usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def juntum_usuario_params\n params.require(:juntum_usuario).permit(:usuario_id, :juntum_id)\n end", "def create\n @usuario_proyecto = UsuarioProyecto.new(usuario_proyecto_params)\n\n respond_to do |format|\n if @usuario_proyecto.save\n format.html { redirect_to @usuario_proyecto, notice: 'Usuario proyecto was successfully created.' }\n format.json { render :show, status: :created, location: @usuario_proyecto }\n else\n format.html { render :new }\n format.json { render json: @usuario_proyecto.errors, status: :unprocessable_entity }\n end\n end\n end", "def usuario_params\n params.require(:usuario).permit(:login, :nome, :email, :perfil, :status)\n end", "def usuario_params\n params.require(:usuario).permit(:title, :name, :lastName, :email, :groupId, :userId,:folio,:conteo)\n end", "def index\n @usuarios = Usuario.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usuarios }\n end\n end", "def index\n @usuarios = Usuario.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usuarios }\n end\n end", "def index\n @usuarios = Usuario.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usuarios }\n end\n end", "def usuario_params\n params.permit(:id,:nombre, :apellido, :usuario, :twitter)\n end", "def create\n @cadastro_usuario = CadastroUsuario.new(cadastro_usuario_params)\n\n respond_to do |format|\n if @cadastro_usuario.save\n format.html { redirect_to @cadastro_usuario, notice: 'Cadastro usuario was successfully created.' }\n format.json { render action: 'show', status: :created, location: @cadastro_usuario }\n else\n format.html { render action: 'new' }\n format.json { render json: @cadastro_usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @usuario = Usuario.new(params[:usuario])\n if not @usuario.bloqueado or @usuario.admin == 2\n #Usuario esta habilitado\n @usuario.bloqueado = 0\n end\n usuario.transcriptor = true unless usuario.transcriptor or usuario.responsable\n\n respond_to do |format|\n if not @usuario.transcriptor and not @usuario.responsable\n flash.keep\n format.html { render action: \"new\", alert: 'El administrador debe ser transcriptor y/o responsable' }\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n end \n\n if @usuario.save\n CorreosUsuario.enviar_contrasena(@usuario, flash[:contrasena], 1).deliver\n format.html { redirect_to @usuario, notice: 'Usuario creado exitosamente.'}\n format.json { render json: @usuario, status: :created, location: @usuario }\n else\n flash.keep\n format.html { render action: \"new\", alert: 'Usuario no pudo ser creado.' }\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @usuario = User.new\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @usuario }\n end\n end", "def create\n @comentario_autenticado = ComentarioAutenticado.new(comentario_autenticado_params)\n #@comentario_autenticado.autor = current_user.nome_completo\n #@comentario_autenticado.usuario = current_user\n\n respond_to do |format|\n if @comentario_autenticado.save\n format.html { redirect_to @comentario_autenticado, notice: 'Comentario autenticado was successfully created.' }\n format.json { render :show, status: :created, location: @comentario_autenticado }\n else\n format.html { render :new }\n format.json { render json: @comentario_autenticado.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @seguridad_usuario = Seguridad::Usuario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @seguridad_usuario }\n end\n end", "def index\n #@users = User.all\n @respuesta = Consulta.new(300,params[0])\n\n respond_to do |format|\n format.json { render json: @respuesta }\n \n end\n end", "def crear_usuario\n require 'keepass/password'\n contacto = Contacto.find_by_id params[:id]\n password = KeePass::Password.generate('uullA{8}')\n respond_to do |format|\n if !Usuario.find_by_email(contacto.email)\n Usuario.create(email: contacto.email, password: password, password_confirmation: password, role: \"Consulta\", contacto_id: contacto.id).send_reset_password_instructions\n format.html { redirect_to contactos_path, notice: 'El usuario ha sido creado exitosamente.' }\n format.json { head :no_content }\n else\n user = Usuario.find_by_email(contacto.email)\n user.contacto_id = contacto.id\n user.save\n user.send_reset_password_instructions\n format.html { redirect_to contactos_path, notice: 'Se han enviado instrucciones al usuario' }\n format.json { head :no_content }\n end\n\n\n end\n end", "def new\n @usuario = Usuario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @usuario }\n end\n end", "def create\r\n #@tipos_usuario = TiposUsuario.new(tipos_usuario_params)\r\n\r\n respond_to do |format|\r\n if @tipos_usuario.save\r\n format.html { redirect_to @tipos_usuario, notice: 'Se añadió un nombre de tipo de usuario correctamente.' }\r\n format.json { render :show, status: :created, location: @tipos_usuario }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @tipos_usuario.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def usuario_params\n params.require(:usuario).permit(:nome, :password, :email, :matricula, :mac)\n end", "def info_usuario_params\n params.require(:info_usuario).permit(:nombre, :apellido, :edad, :correo, :telefono, :Localidad_id, :Genero_id, :Usuario_id)\n end", "def usuario_params\n params.require(:usuario).permit(:nombre, :apellido, :user, :pass)\n end", "def usuario_params\n params.require(:usuario).permit(:user, :password, :nombre, :email, :fecha_nacimiento)\n end", "def index\n @usuarios = Usuario.all\n # respond_to do |format|\n # format.html\n # format.json { render :json => @usuarios }\n # end\n end", "def create\n @usuario = Usuario.new(parametros_de_usuario)\n @usuario.celular = params[:area] + params[:numero]\n @usuario.fh_sesion = Time.now.strftime(\"%Y%m%d%H%M\")\n @usuario.f_creado = Time.now\n @usuario.f_actualizado = Time.now\n\n celulart = params[:area] + params[:numero]\n respond_to do |format|\n if Usuario.exists?(celulart)\n @usuario = Usuario.find(celulart)\n if @usuario.f_eliminado == nil\n\n format.html { redirect_to usuarios_url, notice: '*** ERROR usuario existe ***' }\n else\n format.html { redirect_to usuarios_url, notice: '*** Advertencia: usuario eliminado por un administrador ***' } \n end\n else\n if Usuario.any?\n @usuario.rol = 'opera'\n else\n @usuario.rol = 'admin'\n end\n if @usuario.save\n if session[:rol_usuario] == nil\n session[:celular_usuario] = @usuario.celular\n end\n format.html { redirect_to @usuario, notice: '*** Cuenta creada ***' }\n else\n format.html { render :new }\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def create\n @mensaje_usuario = MensajeUsuario.new(params[:mensaje_usuario])\n\n respond_to do |format|\n if @mensaje_usuario.save\n format.html { redirect_to @mensaje_usuario, notice: 'Mensaje usuario was successfully created.' }\n format.json { render json: @mensaje_usuario, status: :created, location: @mensaje_usuario }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mensaje_usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @usuario = Usuario.new(params[:usuario])\n flash[:notice] = 'Usuario foi criado com sucesso.' if @usuario.save\n respond_with @usuario, :location => usuarios_path\n end", "def grabar_usuario_concesionario(nombre,password)\n @usuario = Usuario.find(:first, :conditions => \"nombre='#{nombre}'\")\n if @usuario!=nil\n $tirajson = '{ \"success\": \"true\", \"exito\": \"true\", \"message\": \"Ya existe ese nombre de usuario!\" }'\n else\n @usuario= Usuario.new\n @usuario.nombre=nombre\n @usuario.password=password\n @usuario.rols_id= 2\n @usuario.estatus='a'\n @usuario.save\n end\n valor=1\n $tirajson = '{ \"success\": \"true\", \"exito\": \"true\", \"message\": \"Datos guardados satisfactoriamente!\" }'\n end", "def create\n @sucursale = Sucursale.new(sucursale_params)\n @sucursale.usuarios_id = current_usuario.id\n respond_to do |format|\n if @sucursale.save\n format.html { redirect_to @sucursale, notice: 'Sucursal creada con exito!' }\n format.json { render :show, status: :created, location: @sucursale }\n else\n format.html { render :new }\n format.json { render json: @sucursale.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n pessoa = Pessoa.new(pessoa_params) \n \n if pessoa.save\n render json: {status: 'SUCCESSO', message:'Usuário cadastrado com sucesso!', data:pessoa},status: :ok\n else\n render json: {status: 'ERRO', message:'Usuário não pode ser cadastrado. Tente novamente mais tarde.', data:pessoa.errors},status: :unprocessable_entity\n end\n end", "def index\n @deporte_usuarios = DeporteUsuario.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @deporte_usuarios }\n end\n end", "def create\n @tecnico = Tecnico.new(params[:tecnico])\n @tecnico.user = current_user\n\n respond_to do |format|\n if @tecnico.save\n format.html { redirect_to @tecnico, notice: 'Técnico foi criado com sucesso.' }\n format.json { render json: @tecnico, status: :created, location: @tecnico }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tecnico.errors, status: :unprocessable_entity }\n end\n end\n end", "def post body=nil, headers={}\n @connection.post \"users.json\", body, headers\n end", "def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end", "def new\n @usuario = Usuario.new\n @data_inicio = I18n.l Date.today\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @usuario }\n end\n end", "def create\n @idioma_usuario = IdiomaUsuario.new(params[:idioma_usuario])\n @usuario = @idioma_usuario.usuario\n respond_to do |format|\n if @idioma_usuario.save\n format.html {\n flash[:notice] = 'Se agregó el idioma correctamente.'\n params[:oper].nil? ? redirect_to(cuenta(@formacion.usuario)) : render(:text => \"Ok\")\n }\n format.js {actualizar_view}\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @idioma_usuario.errors, :status => :unprocessable_entity }\n end\n end\n 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 usuario_params\n params.require(:usuarios).permit(:username,:curso_id,:tipoperfil_id,:bloqueio,:administrador)\n end", "def create\n #@usuario = Usuario.new(params[:usuario])\n #respond_to do |format|\n #Codigo insertado\n @usuario = Usuario.new(params[:usuario])\n if @usuario.save\n sign_in @usuario\n flash[:success] = \"Bienvenido a Sample App!\"\n redirect_to @usuario\n else\n render 'new'\n end\n end", "def create\n @catalogo_usuario = CatalogoUsuario.new(catalogo_usuario_params)\n\n respond_to do |format|\n if @catalogo_usuario.save\n format.html { redirect_to @catalogo_usuario, notice: 'Catalogo usuario was successfully created.' }\n format.json { render :show, status: :created, location: @catalogo_usuario }\n else\n format.html { render :new }\n format.json { render json: @catalogo_usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_ponto\n render json: Usuario.ultimo_ponto(params[:user_id], params[:evento_id]).to_json\n end", "def usuario_params\n params.require(:usuario).permit(:nombre, :password, :password_confirmation)\n end", "def create\n @ajudante = current_usuario.ajudantes.build(ajudante_params)\n\n respond_to do |format|\n if @ajudante.save\n format.html { redirect_to @ajudante, notice: \"Ajudante foi criado com sucesso.\" }\n format.json { render :show, status: :created, location: @ajudante }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @ajudante.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @usuario = Usuario.new(usuario_params)\n\n respond_to do |format|\n if @usuario.save\n format.html { redirect_to usuarios_url, notice: \"Se creó correctamente el usuario #{@usuario.nombre}\" }\n else\n format.html { render action: 'new' }\n end\n end\n end", "def create\n \n \n @usuario = Usuario.create(params[:usuario])\n @sitio=@usuario.sitio\n\n #@evento = Evento.new(params[:evento])\n respond_to do |format|\n if @usuario.save\n format.html { redirect_to(@usuario, :notice => t('exito') ) }\n format.xml { render :xml => @usuario, :status => :created, :location => @usuario }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @usuario.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n #require 'json'\n respond_to do |format|\n if @user.save\n if @user.role == \"docteur\"\n @doc = Doctor.new\n @doc.user_id = @user.id\n @doc.name = @user.name\n @doc.city = @user.cite\n @doc.date_of_birth = @user.date_of_birth\n @doc.address = @user.adress\n @doc.country = @user.country\n if @doc.save!\n flash[:notice] = 'Médecin enregistré avec succes.'\n else\n flash[:error] = \"Une erreur s'est produite.\"\n end\n\n \n\n # @all = Doctor.all\n # File.open(\"public/test.json\",\"w\") do |f|\n # f.write(@all.to_json)\n #end\n\n end\n\n UserMailer.welcome_email(@user).deliver_now\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n \n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @usuario_gusto = UsuarioGusto.new(usuario_gusto_params)\r\n\r\n respond_to do |format|\r\n if @usuario_gusto.save\r\n format.html { redirect_to @usuario_gusto, notice: 'Usuario gusto was successfully created.' }\r\n format.json { render action: 'show', status: :created, location: @usuario_gusto }\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @usuario_gusto.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def new\n @usuario = Usuario.new\n @usuario.admin = 0\n @usuario.bloqueado = 0\n @usuario.transcriptor = true\n flash[:accion] = \"Crear Usuario\"\n flash[:contrasena] = SecureRandom.hex(4)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @usuario }\n end\n end", "def usuario_params\n params.require(:usuario).permit(:nombre, :rut, :mail, :fechaingreso, :foto, :curso, :rol, :activo, :password, :password_confirmation, estudios_attributes: [:id, :carrera_o_curso, :institucion_id, :done, :_destroy, institucions_attributes: [:id, :nombre, :done, :_destroy]])\n end", "def create\n @usuario = Usuario.new(params[:usuario])\n datos = params[:usuario].to_hash\n if @usuario.save\n if session[:admin_new] == true \n session[:admin_new] = false\n redirect_to usuarios_path, notice: 'Usuario creado correctamente.'\n else\n if @usu = login(datos[\"username\"],datos[\"password\"])\n session[:usuario_new] = true\n redirect_to @usu, notice: 'Usuario creado y logueado correctamente.'\n else\n flash.now[:alert] = \"Algo salio mal con el login, haga login de nuevo.\"\n redirect_to :posts\n end\n end\n else\n flash.now[:alert] = \"Ha habido un problema al crear el usuario.\"\n render action: \"new\"\n end\n\n # Lo que estaba antes.\n # respond_to do |format|\n # if @usuario.save\n # format.html { redirect_to @usuario, notice: 'Usuario creado correctamente.' }\n # format.json { render json: @usuario, status: :created, location: @usuario }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @usuario.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def create\n @usuario = Usuario.find(params[:usuario_id])\n @copenometro = Copenometro.new(copenometro_params)\n @copenometro.usuario = @usuario\n\n respond_to do |format|\n if @copenometro.save\n format.html { redirect_to @usuario, notice: 'Agregado con Exito' }\n format.json { render :show, status: :created, location: @copenometro }\n else\n format.html { render :new }\n format.json { render json: @copenometro.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @usuario_prestamo = UsuarioPrestamo.new(usuario_prestamo_params)\n authorize! :crear, @usuario_prestamo\n respond_to do |format|\n if @usuario_prestamo.save\n format.html { redirect_to @usuario_prestamo, notice: 'El usuario de préstamo fue agregado correctamente' }\n format.json { render :show, status: :created, location: @usuario_prestamo }\n else\n format.html { render :new }\n format.json { render json: @usuario_prestamo.errors, status: :unprocessable_entity }\n end\n end\n end", "def usuario_params\n params.require(:usuario).permit(:nome, :email, :senha, :senha_confirmation)\n end", "def creacion\n fiesta = Fiesta.new (params[:id])\n if Fiesta.save\n puts \"su fiesta a sido registrada\"\n else \n puts \"su fiesta no a sido registrada\"\n end\n render = json: fiesta \n end", "def usuario_params\n params.require(:usuario).permit(:email, :name, :password, :password_confirmation)\n end", "def usuario_params\n params.require(:user).permit(:name, :apellidos, :email, :encrypted_password, :activo, :tipo, :foto)\n end", "def create\n params[:futbolada][:usuario_id] = current_usuario.id\n @futbolada = Futbolada.new(params[:futbolada])\n\n respond_to do |format|\n if @futbolada.save\n @futbolada.numero = \"#{Time.zone.now.strftime('%Y%m%d%H%M%S')}-#{@futbolada.id}F\"\n @futbolada.save\n StatusServicioSolicitado.servicio_email(current_usuario,@futbolada).deliver\n session[:exito] = \"si\"\n session[:modulo] = \"futbolada\"\n format.html { redirect_to index_url }\n format.json { render json: @futbolada, status: :created, location: @futbolada }\n else\n format.html { render action: \"new\" }\n format.json { render json: @futbolada.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @seguridad_usuarios = Seguridad::Usuario.order('usuario')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @seguridad_usuarios }\n end\n end", "def create\r\n @reclamacao = Reclamacao.new(reclamacao_params)\r\n user = Usuario.get_usuario_logado\r\n @reclamacao.write_attribute(:usuario_id, user.id)\r\n respond_to do |format|\r\n if @reclamacao.save\r\n format.html { redirect_to root_path, notice: 'RECLAMAÇÃO EFETUADA COM SUCESSO' }\r\n format.json { render :show, status: :created, location: @reclamacao }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @reclamacao.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n if (usuario_signed_in? != true) #Si no hay usuario logueado\n redirect_to :controller=>'login', :action=>'login' #lo envia a login\n end\n @establecimiento = Establecimiento.new(establecimiento_params)\n @establecimiento.usuario_id = current_usuario.id\n respond_to do |format|\n if @establecimiento.save\n format.html { redirect_to current_usuario, notice: 'Establecimiento was successfully created.' }\n format.json { render action: 'show', status: :created, location: @establecimiento }\n else\n format.html { render action: 'new' }\n format.json { render json: @establecimiento.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(users_params)\n @users = User.all\n #Verificacion de que los campos estén llenos\n if params[:user][:nombre_usuario] == \"\" || params[:user][:apellidos_usuario] == \"\" || params[:user][:email] == \"\" || params[:user][:rol] == \"\" || params[:user][:estado] == \"\"\n @titulo = \"Creacion de usuario\"\n @mensaje = \"Debe llenar todos los campos\"\n @tipo = \"warning\"\n @icono = \"icon fa fa-warning\"\n else\n #Verificacion de la password\n if params[:user][:password] != params[:user][:password_confirmation]\n @titulo = \"Creacion de usuario\"\n @mensaje = \"Las contraseñas son distintas\"\n @tipo = \"warning\"\n @icono = \"icon fa fa-warning\"\n else\n #Verificacion de la repeticion del nombre\n if !RepeticionUsuarioCreate(@users, params[:user][:nombre_usuario], params[:user][:apellidos_usuario])\n @titulo = \"Creacion de usuario\"\n @mensaje = \"Ya existe un usuario con ese nombre y apellido\"\n @tipo = \"warning\"\n @icono = \"icon fa fa-warning\"\n else\n if !RepeticionEmailCreate(@users, params[:user][:email])\n @titulo = \"Creacion de usuario\"\n @mensaje = \"Ya existe un usuario con correo electrónico registrado\"\n @tipo = \"warning\"\n @icono = \"icon fa fa-warning\"\n else\n if !RepeticionLoginCrete(@users, params[:user][:login])\n @titulo = \"Creacion de usuario\"\n @mensaje = \"Ya existe un usuario con ese login\"\n @tipo = \"warning\"\n @icono = \"icon fa fa-warning\"\n else\n respond_to do |format|\n if @user.save\n format.js\n format.html {redirect_to @user, notice: \"Usuario creado correctamente\"}\n format.json {render :show, status: :created, location: @user}\n @titulo = \"Creacion de usuario\"\n @mensaje = \"Se a creado el usuario correctamente\"\n @tipo = \"success\"\n @icono = \"icon fa fa-check\"\n else\n format.js\n format.html {render :new}\n format.json {render json: @user.errors, status: :unprocessable_entity}\n @titulo = \"Creacion de usuario\"\n @mensaje = \"Ha ocurrido un error\"\n @tipo = \"danger\"\n @icono = \"icon fa fa-ban\"\n end\n end\n end\n end\n end\n end\n end\n end", "def create\r\n @usuario = User.new(usuario_params)\r\n\r\n respond_to do |format|\r\n if @usuario.save\r\n @photo = Photo.new({:user_id =>@usuario.id})\r\n @photo.save\r\n\r\n if @usuario.rol_id.nil?\r\n format.html { redirect_to new_rol_path, notice: 'El usuario fue creado, asignele un nuevo rol.' }\r\n else\r\n format.html { redirect_to usuarios_url, notice: 'El usuario fue creado exitosamente.' }\r\n format.json { render :show, status: :created, location: @usuario }\r\n end\r\n\r\n else\r\n format.html { render :new }\r\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @datos_estudiante = DatosEstudiante.new(datos_estudiante_params)\n\n respond_to do |format|\n if @datos_estudiante.save\n format.html { redirect_to @datos_estudiante, notice: 'Datos estudiante was successfully created.' }\n format.json { render :show, status: :created, location: @datos_estudiante }\n else\n format.html { render :new }\n format.json { render json: @datos_estudiante.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7109719", "0.6738844", "0.6637198", "0.6607863", "0.6558902", "0.6545033", "0.65222543", "0.64741856", "0.6442691", "0.6431416", "0.6431416", "0.6431416", "0.64096564", "0.63900983", "0.6371617", "0.634856", "0.633861", "0.63312125", "0.63268054", "0.6308064", "0.630754", "0.6255382", "0.62516344", "0.62457854", "0.6240416", "0.62355554", "0.62330884", "0.619312", "0.61845505", "0.61661506", "0.61647284", "0.61503494", "0.61429715", "0.6128607", "0.6123279", "0.61178005", "0.61171234", "0.6101239", "0.61003345", "0.60920066", "0.60914135", "0.60878974", "0.60830057", "0.6076162", "0.6076162", "0.6076162", "0.6063818", "0.60605305", "0.60562265", "0.6046652", "0.60451394", "0.6041411", "0.6037955", "0.60365707", "0.60364634", "0.6034917", "0.6030414", "0.60294205", "0.60204166", "0.6018736", "0.6008213", "0.60029274", "0.59983987", "0.5996859", "0.5991523", "0.5981053", "0.5980145", "0.5979303", "0.5979234", "0.5962325", "0.5958623", "0.59376293", "0.5937404", "0.593689", "0.59267664", "0.5916873", "0.59123695", "0.5912199", "0.59119904", "0.5911949", "0.5905922", "0.5905296", "0.5902069", "0.58998096", "0.5899652", "0.589226", "0.58862305", "0.58776075", "0.5874033", "0.58732367", "0.5871827", "0.5868279", "0.5866013", "0.5853691", "0.5852191", "0.585148", "0.58359605", "0.5835553", "0.5826231", "0.5825478" ]
0.6822908
1
PATCH/PUT /datos_usuarios/1 PATCH/PUT /datos_usuarios/1.json
def update respond_to do |format| if @datos_usuario.update(datos_usuario_params) format.html { redirect_to root_path, notice: 'Datos usuario was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @datos_usuario.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @usuario = Usuario.find(params[:id])\n\n if @usuario.update(usuario_params)\n head :no_content\n else\n render json: @usuario.errors, status: :unprocessable_entity\n end\n end", "def update \n retorno = {erro: \"322\" ,body: \"\"}\n if @usuario.update(valid_request?)\n retorno = {erro: \"000\", body: {evento_id: @usuario.id, usuario_nome: @usuario.nome}}\n end\n render json: retorno.to_json\n end", "def update\n @usuario = Usuario.find_by_id(params[:id])\n if @usuario.nil?\n render :json => {:error => \"Usuario no encontrado\"}.to_json, :status => 404\n\n #render :json => {:error => \"id no es modificable\"}.to_json, :status => 400\n else\n if usuario_params.count==1\n respond_to do |format|\n # format.json { render json: usuario_params.count}\n if @usuario.update(usuario_params)\n #format.json { render json: @usuario}\n\n #format.html { redirect_to @usuario, notice: 'Usuario was successfully updated.' }\n #el segundo\n format.json { render :show, status: :ok, location: @usuario }\n end\n end\n elsif usuario_params.count==0\n # JSON.parse(usuario_params)\n respond_to do |format|\n format.json { render :json => {:error => \"id no es modificable\"}.to_json, :status => 400 }\n end\n else\n respond_to do |format|\n format.json { render :json => {:error => \"La modificación ha fallado\"}.to_json, :status => 500 }\n end\n end\n end\n end", "def update\n @usuario = Usuario.find(params[:id])\n\n respond_to do |format|\n if @usuario.update_attributes(params[:usuario])\n format.html { redirect_to @usuario, notice: 'Usuario actualizado correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @usuario.isAdmin = false unless current_user.isAdmin #bloqueio de atualização de permissão para usuarios que não são admin\n respond_to do |format|\n if @usuario.update(usuario_params)\n format.html { redirect_to (current_user.isAdmin ? usuarios_url : recibos_url), notice: 'Usuário atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @usuario }\n else\n format.html { render :edit }\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tipo_usuario = TipoUsuario.find(params[:id])\n\n respond_to do |format|\n if @tipo_usuario.update_attributes(params[:tipo_usuario])\n format.html { redirect_to @tipo_usuario, notice: 'Tipo usuario fue actualizado existosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if !Usuario.exists?(params[:id])\n render json: %q[{\"error\": \"Usuario no encontrado\"}], status: 404\n elsif request.body.string.include? %q[\"id\"] # id is set\n render json: %q[{\"error\": \"id no es modificable\"}], status: 400\n\n\n\n\n\n\n else\n @usuario = Usuario.find(params[:id])\n respond_to do |format|\n if @usuario.update(usuario_params)\n #format.html { redirect_to @usuario, notice: 'Usuario was successfully updated.' }\n #format.json { render :show, status: :ok, location: @usuario}\n format.json {render json: @usuario}\n else\n #format.html { render :edit }\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n end\n end\n\n end\n end", "def update\n @usuario = Usuario.find(params[:id])\n\n respond_to do |format|\n begin\n @usuario.transaction do\n @usuario.update_attributes(params[:usuario])\n @usuario.update_dias_usuario(params[:data_inicio])\n end\n all_saved = true\n rescue ActiveRecord::StatementInvalid\n all_save = false\n end\n\n if all_saved\n format.html { redirect_to @usuario, notice: 'Usuario was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n if @servicio.update_attributes(params[:servicio])\n format.html { redirect_to @servicio, :notice => 'Servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @servicio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n # respond_to do |format|\n # if @usuario.update(usuario_params)\n @usuario = Usuario.find_by_id(params[:id])\n p \"-----------------------------------\"\n p params[:usuario]\n p \"-----------------------------------\"\n if @usuario.update(usuario_params)\n # format.json { render :show, status: :ok, location: @usuario }\n render :json=> {:success=>true, :usuario=>@usuario, :message=>\"Usuario actualizado correctamente\"},:status=>200\n else\n render :json=> {:success=>false, :message=>\"Error al actualizar\"},:status=>404\n # format.json { render json: @usuario.errors, status: :unprocessable_entity }\n end\n # end\n end", "def update\n @usuario = User.find(params[:id])\n\n respond_to do |format|\n if @usuario.update_attributes(params[:user])\n flash[:success] = \"Usuario atualizado com sucesso\"\n format.html { redirect_to usuarios_url }\n format.json { head :no_content }\n else\n flash[:error] = \"Erro ao atualizar o usuario\"\n format.html { render action: \"edit\" }\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def activo_update\n respond_to do |format|\n activo = params[:laboratorio][:activo]\n id = params[:id]\n Laboratorio.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end", "def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end", "def update\r\n respond_to do |format|\r\n if @usuario.update(usuario_params)\r\n format.html { redirect_to usuarios_url, success: 'Editaste un usuario correctamente.' }\r\n format.json { render :show, status: :ok, location: @usuario }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @cadastro_usuario.update(cadastro_usuario_params)\n format.html { redirect_to @cadastro_usuario, notice: 'Cadastro usuario was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cadastro_usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @usuario.update(usuario_params)\n\n \n format.html { redirect_to \"/usuarios\", notice: 'Datos guardados satisfactoriamente.' }\n format.json { render :show, status: :ok, location: @usuario }\n\n \n else\n format.html { render :edit }\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def update\n respond_to do |format|\n if @usuario.update(usuario_params)\n format.html { redirect_to @usuario, notice: 'Usuario was successfully updated.' }\n format.json { render :show, status: :ok, location: @usuario }\n else\n format.html { render :edit }\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n end\n\n end\n end", "def update\n respond_to do |format|\n if @usuario.update(usuario_params)\n format.html { redirect_to @usuario, notice: 'Usuario was successfully updated.' }\n format.json { render :show, status: :ok, location: @usuario }\n else\n format.html { render :edit }\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @usuario.update(usuario_params)\n format.html { redirect_to @usuario, notice: 'Usuario was successfully updated.' }\n format.json { render :show, status: :ok, location: @usuario }\n else\n format.html { render :edit }\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @usuario.update(usuario_params)\n format.html { redirect_to @usuario, notice: 'Usuario was successfully updated.' }\n format.json { render :show, status: :ok, location: @usuario }\n else\n format.html { render :edit }\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @oferta = Oferta.find(params[:id])\n\n respond_to do |format|\n if @oferta.update_attributes(params[:oferta])\n format.html { redirect_to [:admin, @oferta], :notice => 'Exemplo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @oferta.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end", "def update\n @tecnico = Tecnico.find(params[:id])\n @tecnico.user = current_user\n\n respond_to do |format|\n if @tecnico.update_attributes(params[:tecnico])\n format.html { redirect_to @tecnico, notice: 'Técnico foi atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tecnico.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \t\tif params[:usuario_pedido]\n \t\t\t@usuario = Usuario.find(params[:usuario_id])\n \tusuario_pedido = @usuario.pedidos.find(@pedido.id)\n \t\tif usuario_pedido.update(parametros_actualizar_usuario_negocio)\n \t\thead :no_content\n \t\telse\n \t\trender json: @usuario_pedido.errors, status: :unprocessable_entity\n \t\tend\n else\n \t\t\t@negocio = Negocio.find(params[:negocio_id])\n \tnegocio_pedido = @negocio.pedidos.find(@pedido.id)\n \tif negocio_pedido.update(parametros_actualizar_pedido_negocio)\n \thead :no_content\n \telse\n \trender json: @negocio_pedido.errors, status: :unprocessable_entity\n \tend\n \tend\n end", "def update\n respond_to do |format|\n if @juntum_usuario.update(juntum_usuario_params)\n format.html { redirect_to @juntum_usuario, notice: 'Juntum usuario was successfully updated.' }\n format.json { render :show, status: :ok, location: @juntum_usuario }\n else\n format.html { render :edit }\n format.json { render json: @juntum_usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @mensaje_usuario = MensajeUsuario.find(params[:id])\n\n respond_to do |format|\n if @mensaje_usuario.update_attributes(params[:mensaje_usuario])\n format.html { redirect_to @mensaje_usuario, notice: 'Mensaje usuario was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mensaje_usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @usuario = Usuario.find(params[:id])\n\t@temp = @usuario.dup\n respond_to do |format|\n if @usuario.update_attributes(params[:usuario])\n\t\tguardar_log(session[:usuario_id], self.class.name,__method__.to_s, @temp,@usuario)\n\t\tformat.html { redirect_to usuarios_url,:notice => 'Usuario #{@usuario.nombre} fue actualizado correctamente.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @usuario.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @consumo = Consumo.find(params[:id])\n\n respond_to do |format|\n if @consumo.update_attributes(params[:consumo])\n format.html { redirect_to @consumo.cliente, :notice => 'Consumo alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @consumo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @usuario.nombres = @usuario.nombres.upcase\n @usuario.apellidos = @usuario.apellidos.upcase\n respond_to do |format|\n if @usuario.update(usuario_params)\n format.html { redirect_to @usuario, notice: 'El Usuario se ha editado correctamente.' }\n format.json { render :show, status: :ok, location: @usuario }\n else\n @div_edit_admin = true\n format.html { render :edit }\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @usu.update(usuario_params)\n format.html { redirect_to @usu, notice: 'Usuario was successfully updated.' }\n format.json { render :show, status: :ok, location: @usu }\n else\n format.html { render :edit }\n format.json { render json: @usu.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sistema = Sistema.find(params[:id])\n\n respond_to do |format|\n if @sistema.update_attributes(params[:sistema])\n format.html { redirect_to @sistema, notice: 'Sistema was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sistema.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @users = User.all.order(nombre1: :asc)\n if params[:coference][:user_ids]\n params[:coference][:user_ids] = params[:coference][:user_ids].map{|k, v| k}\n else\n params[:coference][:user_ids] = []\n end\n\n respond_to do |format|\n if @coference.update(coference_params)\n format.html { redirect_to @coference, notice: 'La actividad se actualizo con exito.' }\n format.json { render :show, status: :ok, location: @coference }\n else\n format.html { render :edit }\n format.json { render json: @coference.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def actualizacion \n fiesta.update (params[:id]) \n render json: fiesta\n end", "def update\n respond_to do |format|\n @unidad.empresa = current_user.empresa\n if @unidad.update(unidad_params)\n format.html { redirect_to @unidad, notice: 'Unidad was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @unidad.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @usuario = Usuario.find(params[:id])\n #@sitio=@usuario.sitio\n respond_to do |format|\n if @usuario.update_attributes(params[:usuario])\n format.html { redirect_to(@usuario, :notice => t('exitom')) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @usuario.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @usuario = Usuario.find(params[:id])\n usuario.transcriptor = true unless usuario.transcriptor or usuario.responsable\n params[:usuario].delete :password\n respond_to do |format|\n if @usuario.update_attributes(params[:usuario])\n if @usuario.admin == 2\n if @usuario.update_attribute(\"bloqueado\", 0)\n format.html { redirect_to @usuario, notice: 'Usuario actualizado exitosamente.' }\n format.json { head :no_content }\n else\n flash.keep\n format.html { render action: \"edit\", alert: 'Usuario no pudo ser actualizado.' }\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n end\n else\n if ocultar_prod_usr(@usuario.id)\n format.html { redirect_to @usuario, notice: 'Usuario actualizado exitosamente.' }\n format.json { head :no_content }\n else\n format.html { redirect_to @usuario, notice: 'Usuario actualizado exitosamente.' }\n format.json { head :no_content }\n end\n end\n else\n flash.keep\n format.html { render action: \"edit\", alert: 'Usuario no pudo ser actualizado.' }\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @perfisusuario.update(perfisusuario_params)\n format.html { redirect_to perfisusuarios_url, notice: 'Perfil de Usuário editado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @perfisusuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @usuario = Usuario.find(params[:id])\n if params[:user][:password].blank?\n params[:user].delete(:password)\n params[:user].delete(:password_confirmation)\n end\n respond_to do |format|\n if @usuario.update_attributes(params[:usuario])\n format.html { redirect_to usuarios_path, :notice => 'Usuario was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @usuario.errors, :status => :unprocessable_entity }\n end\n end\n end", "def activo_update\n respond_to do |format|\n activo = params[:producto][:activo]\n id = params[:id]\n Producto.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end", "def update\n @solicitud_servicio = SolicitudServicio.find(params[:id])\n\n respond_to do |format|\n if @solicitud_servicio.update_attributes(params[:solicitud_servicio])\n format.html { redirect_to @solicitud_servicio, notice: 'Solicitud servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @solicitud_servicio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @usuario = Usuario.find(params[:id])\n \n if !params[:clave_actual].nil?\n user = Usuario.authenticate(params[:usuario], params[:clave_actual])\n \n if !user\n format.html { render action: \"cambiar_clave\" }\n end\n end\n \n respond_to do |format|\n if @usuario.update_attributes(params[:usuario])\n format.html { redirect_to @usuario, notice: 'Usuario fue actualizado satisfactoriamente' }\n format.json { head :no_content }\n else\n if params[:perfil_id].nil?\n format.html { render action: \"cambiar_clave\" }\n else\n format.html { render action: \"edit\" }\n end\n \n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n if @tecnico.update_attributes(params[:tecnico])\n format.html { redirect_to @tecnico, notice: 'Tecnico atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tecnico.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n @sucursale.usuarios_id = current_usuario.id\n if @sucursale.update(sucursale_params)\n format.html { redirect_to @sucursale, notice: 'Sucursal actualizada con exito!' }\n format.json { render :show, status: :ok, location: @sucursale }\n else\n format.html { render :edit }\n format.json { render json: @sucursale.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:todo][:id])\n if @todo.update_attributes(user_params)\n render json: @todo\n else\n render nothing: true, status: :bad_request\n end\n end", "def update\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n if @veiculo.update_attributes(params[:veiculo])\n format.html { redirect_to @veiculo, :notice => 'Veiculo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @veiculo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @usuario = User.find(params[:id])\n\n respond_to do |format|\n if @usuario.update_attributes(user_params)\n flash[:notice] = @@msgs\n format.html { redirect_to usuario_url }\n format.json { head :no_content }\n else\n flash[:alert] = @@msge\n format.html { render action: \"edit\" }\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comentario = current_user.comentarios.find(params[:comentario])\n\n respond_to do |format|\n if @comentario.update_attributes(params[:id])\n format.html { redirect_to @comentario, notice: 'Comentario was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comentario.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @centro_usuario.update(centro_usuario_params)\n format.html { redirect_to @centro_usuario, notice: 'Centro usuario was successfully updated.' }\n format.json { render :show, status: :ok, location: @centro_usuario }\n else\n format.html { render :edit }\n format.json { render json: @centro_usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tipo_usuario = TipoUsuario.find(params[:id])\n\n respond_to do |format|\n if @tipo_usuario.update_attributes(params[:tipo_usuario])\n format.html { redirect_to(@tipo_usuario, :notice => ' - Dados atualizados com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_usuario.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @servico_pacote.update(servico_pacote_params)\n format.html { redirect_to @servico_pacote, notice: 'Pacote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @servico_pacote.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @usuarios_email.update(usuarios_email_params)\n format.html { redirect_to @usuarios_email, notice: 'Usuarios email was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @usuarios_email.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @voluntario.update(voluntario_params) and @voluntario.update_attributes(:modificador => current_user.id)\n format.html { redirect_to @voluntario, notice: 'Voluntario was successfully updated.' }\n format.json { render :show, status: :ok, location: @voluntario }\n else\n format.html { render :edit }\n format.json { render json: @voluntario.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @idioma_usuario = IdiomaUsuario.find(params[:id])\n @usuario = @idioma_usuario.usuario\n respond_to do |format|\n if @idioma_usuario.update_attributes(params[:idioma_usuario])\n format.html {\n flash[:notice] = 'Se edito el idioma correctamente.'\n redirect_to(cuenta(@formacion.usuario)) }\n format.js {actualizar_view}\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @idioma_usuario.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @calificacion_servicio = CalificacionServicio.find(params[:id])\n\n respond_to do |format|\n if @calificacion_servicio.update_attributes(params[:calificacion_servicio])\n format.html { redirect_to @calificacion_servicio, notice: 'Calificacion servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @calificacion_servicio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tipo_usuario.update(tipo_usuario_params)\n format.json { head :no_content}\n format.js\n #format.html { redirect_to @tipo_usuario, notice: 'Tipo usuario was successfully updated.' }\n #format.json { render :show, status: :ok, location: @tipo_usuario }\n else\n #format.html { render :edit }\n #format.json { render json: @tipo_usuario.errors, status: :unprocessable_entity }\n format.json{render json: @tipo_usuario.errors.full_messages, status: :unprocessable_entity}\n end\n end\n end", "def update\n respond_to do |format|\n if @catalogo_usuario.update(catalogo_usuario_params)\n format.html { redirect_to @catalogo_usuario, notice: 'Catalogo usuario was successfully updated.' }\n format.json { render :show, status: :ok, location: @catalogo_usuario }\n else\n format.html { render :edit }\n format.json { render json: @catalogo_usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update, Tipo\n respond_to do |format|\n if @tipo.update(tipo_params)\n log(\"Se ha editado la nomina #{@lt}\", 1)\n format.html { redirect_to tipos_path, notice: 'Los datos de la nómina fueron actualizados exitosamente.' }\n format.json { head :no_content }\n end\n end\n end", "def update\n respond_to do |format|\n if @empresa.update(empresa_params) and @empresa.update_attributes(:modificador => current_user.id)\n format.html { redirect_to @empresa, notice: 'Empresa was successfully updated.' }\n format.json { render :show, status: :ok, location: @empresa }\n else\n format.html { render :edit }\n format.json { render json: @empresa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @registro_servicio.update(registro_servicio_params)\n format.html { redirect_to @registro_servicio, notice: 'Servicio was successfully updated.' }\n format.json { render :show, status: :ok, location: @registro_servicio }\n else\n format.html { render :edit }\n format.json { render json: @registro_servicio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @topico.update(topico_params)\n format.html { redirect_to set_path, notice: 'Tópico atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @topico.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @servico.update(servico_params)\n format.html { redirect_to servicos_url, notice: 'Serviço atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @servico }\n else\n format.html { render :edit }\n format.json { render json: @servico.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @usuario_curso.update(usuario_curso_params)\n format.html { redirect_to @usuario_curso, notice: 'Usuário do Curso atualizado com sucesso!' }\n format.json { render :show, status: :ok, location: @usuario_curso }\n else\n format.html { render :edit, @current_usuario => current_usuario }\n format.json { render json: @usuario_curso.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @nombre = params[:usuario][\"nombre\"];\n @dni = params[:usuario][\"dni\"];\n @email = params[:usuario][\"email\"];\n @tarjeta = params[:usuario][\"tarjeta\"];\n @contrasenia = params[:usuario][\"contrasenia\"];\n @usuario = Usuario.find(params[:id]);\n @usuario.nombre = @nombre;\n @usuario.dni = @dni;\n @usuario.email = @email;\n @usuario.tarjeta = @tarjeta;\n @usuario.contrasenia = @contrasenia;\n if @usuario.save()\n redirect_to @usuario\n else\n render \"edit\";\n end\nend", "def update\n respond_to do |format|\n if @clientes_servico.update(clientes_servico_params)\n format.html { redirect_to @clientes_servico, notice: 'Clientes servico was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @clientes_servico.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @usuario = Usuario.find(params[:id])\n\n respond_to do |format|\n if @usuario.update_attributes(params[:usuario])\n format.html { redirect_to(@usuario, :notice => 'Usuario was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @usuario.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @tarefa.update(tarefa_params)\n format.html { redirect_to @tarefa, notice: 'Tarefa atualizada com sucesso!' }\n format.json { render :show, status: :ok, location: @tarefa }\n else\n format.html { render :edit , @current_usuario => current_usuario}\n format.json { render json: @tarefa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n @empresa_servicio = EmpresaServicio.find(params[:id])\n respond_to do |format|\n if @empresa_servicio.update_attributes(params[:empresa_servicio])\n\n format.html { redirect_to empresa_empresa_servicios_path, notice: \"Los datos del servicio fueron actualizados para la empresa #{@empresa_servicio.empresa.nombre_empresa}\"}\n \n else\n format.html { render action: \"edit\" }\n format.json { render json: @empresa_servicio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :editar, @usuario_prestamo\n respond_to do |format|\n if @usuario_prestamo.update(usuario_prestamo_params)\n format.html { redirect_to @usuario_prestamo, notice: 'La información del usuario de préstamos ha sido modificada correctamente' }\n format.json { render :show, status: :ok, location: @usuario_prestamo }\n else\n format.html { render :edit }\n format.json { render json: @usuario_prestamo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n if @tecnico.update_attributes(params[:tecnico])\n format.html { redirect_to @tecnico, :notice => 'Tecnico was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @tecnico.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n set_funcionario\n if @ordem_servico.update(ordem_servico_params)\n format.html { redirect_to @ordem_servico, notice: t('messages.cadastro_atualizado') }\n format.json { render :show, status: :ok, location: @ordem_servico }\n else\n format.html { render :edit }\n format.json { render json: @ordem_servico.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @recurso = Recurso.find(params[:id])\n\n respond_to do |format|\n if @recurso.update_attributes(params[:recurso])\n format.html { redirect_to @recurso, notice: 'O recurso de auto de infração foi atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recurso.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @proximo_codigo = @tipo_usuario.codigo\n respond_to do |format|\n if @tipo_usuario.update(tipo_usuario_params)\n format.html { redirect_to action: \"new\", notice: 'TIpo Usuário atualizado com sucesso..' }\n format.json { render :show, status: :ok, location: @tipo_usuario }\n else\n format.html { render :edit }\n format.json { render json: @tipo_usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tipo_de_servicio.update(tipo_de_servicio_params)\n format.html { redirect_to @tipo_de_servicio, notice: 'Tipo de servicio was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_de_servicio }\n else\n format.html { render :edit }\n format.json { render json: @tipo_de_servicio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @usuario.update(usuario_params)\n @usuario.modificar_role(params[:usuario][:roles])\n format.html { redirect_to empresa_usuarios_path(@usuario.empresa_id), notice: 'Usuario was successfully updated.' }\n format.json { render :show, status: :ok, location: @usuario }\n else\n format.html { render :edit }\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @inicio.update(inicio_params)\n format.html { redirect_to @inicio, notice: 'Inicio was successfully updated.' }\n format.json { render :show, status: :ok, location: @inicio }\n else\n format.html { render :edit }\n format.json { render json: @inicio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @solicitudrecurso = Solicitudrecurso.find(params[:id])\n \n\n respond_to do |format|\n\n# UN DRYYY!!!!!\n if params[:fechareserva]=~ /[0-3]?[0-9]\\-[0-1]?[0-9]\\-[0-9]{4}/\n nfechareserva=formato_europeo(params[:fechareserva])\n #fecha=params[:fechareserva].to_s.split('-')\n #nfechareserva=fecha[2]+\"-\"+fecha[1]+\"-\"+fecha[0]\n end\n \n \n nombrecomp = params[:usuario][:identificador].to_s.split(', ')\n if @solicitudrecurso.update_attributes(\n :usuario_id => Usuario.where( \"nombre = :nombre and apellidos = :apellidos\", {:nombre => nombrecomp[1], :apellidos => nombrecomp[0]}).first.id,\n :motivos => params[:motivos])\n \n @solicitudrecursos = Solicitudrecurso.all\n format.html { redirect_to :action => \"index\" }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @solicitudrecurso.errors, :status => :unprocessable_entity }\n end\n \n end\n end", "def update\n respond_to do |format|\n if @oficio.update(oficio_params)\n format.html { redirect_to oficios_url, notice: 'Oficio actualizado exitosamente.' }\n format.json { render :show, status: :ok, location: oficios_url }\n else\n format.html { render :edit }\n format.json { render json: @oficio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n if @cliente.update_attributes(params[:cliente])\n format.html { redirect_to @cliente, notice: 'Cliente atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n if(params[:usertype] != nil and params[:usertype] != 2)\n params[:sistema] = nil # TODO isso nao funfa\n end\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to root_url, notice: 'Usuario foi atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @asiento_de_servicio.update(asiento_de_servicio_params)\n format.html { redirect_to @asiento_de_servicio, notice: 'Asiento de servicio was successfully updated.' }\n format.json { render :show, status: :ok, location: @asiento_de_servicio }\n else\n format.html { render :edit }\n format.json { render json: @asiento_de_servicio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @opcao.update(opcao_params)\n format.html { redirect_to @opcao, notice: 'Opcao atualizada com sucesso!' }\n format.json { render :show, status: :ok, location: @opcao }\n else\n format.html { render :edit }\n format.json { render json: @opcao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n respond_to do |format|\r\n if @tipos_usuario.update(tipos_usuario_params)\r\n format.html { redirect_to @tipos_usuario, notice: 'La actualización del nombre del tipo de usuario se realizó correctamente.' }\r\n format.json { render :show, status: :ok, location: @tipos_usuario }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @tipos_usuario.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\r\n respond_to do |format|\r\n if @sivic_celula.update(sivic_celula_params)\r\n format.html { redirect_to @sivic_celula, notice: 'Registro alterado com sucesso.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @sivic_celula.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @telefono.update(telefono_params)\n format.html { redirect_to @telefono, notice: 'Telefono was successfully updated.' }\n format.json { render :show, status: :ok, location: @telefono }\n else\n format.html { render :edit }\n format.json { render json: @telefono.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n respond_to do |format|\r\n if @usuario_gusto.update(usuario_gusto_params)\r\n format.html { redirect_to @usuario_gusto, notice: 'Usuario gusto was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @usuario_gusto.errors, status: :unprocessable_entity }\r\n end\r\n end\r\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 activo_update\n respond_to do |format|\n activo = params[:presentacion][:activo]\n id = params[:id]\n Presentacion.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end", "def update\n respond_to do |format|\n if @user.update(nombre: params[:user][:nombre], primerApellido: params[:user][:primerApellido], segundoApellido: params[:user][:segundoApellido], correo: params[:user][:correo], contrasenna: params[:user][:contrasenna], foto: params[:user][:foto], token: params[:user][:token])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @area_usuario = AreaUsuario.find(params[:id])\n\n respond_to do |format|\n if @area_usuario.update_attributes(params[:area_usuario])\n format.html { redirect_to @area_usuario, notice: 'Area usuario was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @area_usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sivic_discipulo.update(sivic_discipulo_params_netested)\n format.html { redirect_to @sivic_discipulo, notice: 'Registro alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sivic_discipulo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @os_nivel_servico.update(os_nivel_servico_params)\n format.html { redirect_to @os_nivel_servico, notice: 'Os nivel servico foi atualizado(a)' }\n format.json { render :show, status: :ok, location: @os_nivel_servico }\n else\n format.html { render :edit }\n format.json { render json: @os_nivel_servico.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @usuario_cartum = UsuarioCartum.find(params[:id])\n\n respond_to do |format|\n if @usuario_cartum.update_attributes(params[:usuario_cartum])\n format.html { redirect_to @usuario_cartum, notice: 'Usuario cartum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @usuario_cartum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @usuario_proyecto.update(usuario_proyecto_params)\n format.html { redirect_to @usuario_proyecto, notice: 'Usuario proyecto was successfully updated.' }\n format.json { render :show, status: :ok, location: @usuario_proyecto }\n else\n format.html { render :edit }\n format.json { render json: @usuario_proyecto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @asiento = Asiento.find(params[:id])\n\n respond_to do |format|\n if @asiento.update_attributes(params[:asiento])\n format.html { redirect_to @asiento, :notice => 'El apunte fue cambiado.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @asiento.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_current_logged_in_user(args = {}) \n put(\"/users.json/current\", args)\nend", "def update\n respond_to do |format|\n if @tb_servicio.update(tb_servicio_params)\n format.html { redirect_to @tb_servicio, notice: 'Tb servicio was successfully updated.' }\n format.json { render :show, status: :ok, location: @tb_servicio }\n else\n format.html { render :edit }\n format.json { render json: @tb_servicio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @empresario.update(empresario_params) and @empresario.update_attributes(:modificador => current_user.id)\n format.html { redirect_to @empresario, notice: 'Empresario was successfully updated.' }\n format.json { render :show, status: :ok, location: @empresario }\n else\n format.html { render :edit }\n format.json { render json: @empresario.errors, status: :unprocessable_entity }\n end\n end\n end", "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 update\n respond_to do |format|\n if @tiposveiculo.update(tiposveiculo_params)\n format.html { redirect_to tiposveiculos_url, notice: 'Tipo de Veículo editado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @tiposveiculo.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.69414735", "0.68605804", "0.6786797", "0.6735289", "0.6701734", "0.661858", "0.6613183", "0.65865344", "0.65610427", "0.6542306", "0.6533505", "0.6482275", "0.6458359", "0.64562005", "0.64476734", "0.6444712", "0.64343387", "0.6413493", "0.6413493", "0.6413493", "0.6403426", "0.64024633", "0.6401686", "0.6393144", "0.6384647", "0.63683605", "0.6367405", "0.63645905", "0.63489664", "0.6327636", "0.6326864", "0.6313416", "0.63071924", "0.62857723", "0.62845594", "0.62773556", "0.6275923", "0.62734306", "0.6269711", "0.6269454", "0.6265918", "0.626591", "0.6259595", "0.6251823", "0.6248991", "0.62443733", "0.6243688", "0.62288225", "0.62250507", "0.62192297", "0.62139785", "0.6213463", "0.62115765", "0.6207136", "0.6204938", "0.61972123", "0.619178", "0.6188233", "0.61881715", "0.6186172", "0.6179323", "0.61785555", "0.61780936", "0.6175061", "0.6171693", "0.61706585", "0.61696076", "0.6168921", "0.6164845", "0.6161633", "0.6160626", "0.6160195", "0.61579126", "0.6157472", "0.6150848", "0.6150013", "0.61488783", "0.61467373", "0.61460584", "0.61422795", "0.6140022", "0.6134282", "0.6133951", "0.61337584", "0.6128545", "0.6124822", "0.61243004", "0.6124019", "0.6122624", "0.6118737", "0.6117246", "0.6114916", "0.6113027", "0.61099553", "0.6108911", "0.6106076", "0.6101483", "0.61005396", "0.61005396", "0.6098546" ]
0.6762894
3
DELETE /datos_usuarios/1 DELETE /datos_usuarios/1.json
def destroy @datos_usuario.destroy respond_to do |format| format.html { redirect_to datos_usuarios_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @usuario = Usuario.find(params[:id])\n @usuario.destroy\n\n respond_to do |format|\n format.html { redirect_to usuarios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @usuario = Usuario.find(params[:id])\n @usuario.destroy\n\n respond_to do |format|\n format.html { redirect_to usuarios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @usuario = Usuario.find(params[:id])\n @usuario.destroy\n\n respond_to do |format|\n format.html { redirect_to usuarios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @usuario = Usuario.find(params[:id])\n @usuario.destroy\n\n respond_to do |format|\n format.html { redirect_to usuarios_path }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Users.delete(params[\"id\"])\n end", "def destroy\n @usuario.destroy\n respond_to do |format|\n format.html { redirect_to usuarios_url, notice: 'Usuário eliminado com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @usuario_gusto.destroy\r\n respond_to do |format|\r\n format.html { redirect_to usuario_gustos_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @datos_insumos_reactivo.destroy\n respond_to do |format|\n format.html { redirect_to datos_insumos_reactivos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @usuario = Usuario.find(params[:id])\n @usuario.destroy\n\n respond_to do |format|\n format.html { redirect_to usuarios_url, notice: 'Usuario eliminado exitosamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tipo_usuario = TipoUsuario.find(params[:id])\n @tipo_usuario.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_usuarios_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def delete\n render json: User.delete(params[\"id\"])\n end", "def destroy\n @cadastro_usuario.destroy\n respond_to do |format|\n format.html { redirect_to cadastro_usuarios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n control_usuario\n @usuario.destroy\n respond_to do |format|\n format.html { redirect_to usuarios_url, notice: 'El Usuario se ha eliminado correctamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @usuario.destroy\n respond_to do |format|\n format.html { redirect_to usuarios_url, notice: 'Usuario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @usuario.destroy\n respond_to do |format|\n format.html { redirect_to usuarios_url, notice: 'Usuario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @usuario.destroy\n respond_to do |format|\n format.html { redirect_to usuarios_url, notice: 'Usuario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n usuario_eventos = UsuarioEvento.where(usuario_id: @usuario.id)\n usuario_eventos.each do |usuario_evento|\n usuario_evento.destroy\n end \n @usuario.destroy\n render json: {erro: \"000\", body: \"\"} \n end", "def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @usuario.destroy\n respond_to do |format|\n record_activity(\"Eliminación de Usuario\")\n format.html { redirect_to usuarios_url, notice: 'Usuario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @juntum_usuario.destroy\n respond_to do |format|\n format.html { redirect_to juntum_usuarios_url, notice: 'Juntum usuario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @usuario = Usuario.find(params[:id])\n @usuario.destroy\n\n head :no_content\n end", "def destroy\n @usuario_seguidor.destroy\n respond_to do |format|\n format.html { redirect_to usuario_seguidores_url, notice: 'Usuario seguidor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dato = Dato.find(params[:id])\n @dato.destroy\n\n respond_to do |format|\n format.html { redirect_to datos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @unidad.destroy\n respond_to do |format|\n format.html { redirect_to unidades_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @usu.destroy\n respond_to do |format|\n format.html { redirect_to usuarios_url, notice: 'Usuario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @servicio = Servicio.find(params[:id])\n @servicio.destroy\n\n respond_to do |format|\n format.html { redirect_to servicios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @centro_usuario.destroy\n respond_to do |format|\n format.html { redirect_to centro_usuarios_url, notice: 'Centro usuario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n supprimer = UtilisateurService.instance.supprimerUtilisateur(params[:id])\n (supprimer) ? (render json: true, status: :ok) : (render json: false, status: :not_found)\n end", "def destroy\n @rutas_usuario.destroy\n respond_to do |format|\n format.html { redirect_to rutas_usuarios_url, notice: 'Rutas usuario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mensaje_usuario = MensajeUsuario.find(params[:id])\n @mensaje_usuario.destroy\n\n respond_to do |format|\n format.html { redirect_to mensaje_usuarios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @odontologia1 = Odontologia1.find(params[:id])\n @odontologia1.destroy\n\n respond_to do |format|\n format.html { redirect_to odontologia1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @usuario = Usuario.find(params[:id])\n @usuario.destroy\n \n respond_to do |format|\n format.html { redirect_to(usuarios_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @sistema = Sistema.find(params[:id])\n @sistema.destroy\n\n respond_to do |format|\n format.html { redirect_to sistemas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @datosgenerale.destroy\n respond_to do |format|\n format.html { redirect_to datosgenerales_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @perfisusuario.destroy\n respond_to do |format|\n format.html { redirect_to perfisusuarios_url, notice: 'Perfil de Usuário excluído com sucesso.' }\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 @deporte_usuario = DeporteUsuario.find(params[:id])\n @deporte_usuario.destroy\n\n respond_to do |format|\n format.html { redirect_to deporte_usuarios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tipo_usuario.destroy\n respond_to do |format|\n format.html { redirect_to action: \"new\", notice: 'TIpo Usuário deletado com sucesso..' }\n format.json { head :no_content }\n end\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 @user.destroy\n render json: {message: 'Usuario Excluido'} , status: :ok\n end", "def destroy\n @asociado = Asociado.find(params[:id])\n @asociado.destroy\n\n respond_to do |format|\n format.html { redirect_to asociados_url }\n format.json { head :ok }\n end\n end", "def destroy\n @datos_estudiante.destroy\n respond_to do |format|\n format.html { redirect_to datos_estudiantes_url, notice: 'Datos estudiante was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @usuario = Usuario.find(params[:id])\n @usuario.destroy\n\n respond_to do |format|\n format.html { redirect_to(usuarios_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @usuario = Usuario.find(params[:id])\n @usuario.destroy\n\n respond_to do |format|\n format.html { redirect_to(usuarios_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @usuario = Usuario.find(params[:id])\n @usuario.destroy\n\n respond_to do |format|\n format.html { redirect_to(usuarios_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @usuario = Usuario.find(params[:id])\n @usuario.destroy\n\n respond_to do |format|\n format.html { redirect_to(usuarios_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @usuario.update(eliminado: true)\n respond_to do |format|\n format.html { redirect_to usuarios_url, notice: 'Usuario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @usuarios_email.destroy\n respond_to do |format|\n format.html { redirect_to usuarios_emails_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n \r\n #eliminar foto de perfil \r\n r = Photo.where(\"#{:user_id} =?\",params[:id])\r\n #solo eliminar si posee foto de perfil \r\n if r.present?\r\n r.destroy_all\r\n end\r\n\r\n @usuario.destroy\r\n respond_to do |format|\r\n format.html { redirect_to usuarios_url, success: 'Eliminaste un usuario correctamenteed.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n #--ADICIONADO\n @cliente.perfilclientes.destroy\n #--ADICIONADO\n @cliente.destroy\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @estatuto = Estatuto.find(params[:id])\n @estatuto.destroy\n\n respond_to do |format|\n format.html { redirect_to estatutos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @usuario_cartum = UsuarioCartum.find(params[:id])\n @usuario_cartum.destroy\n\n respond_to do |format|\n format.html { redirect_to usuario_carta_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cliente.destroy\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @trocaentreusuario.destroy\n respond_to do |format|\n format.html { redirect_to trocaentreusuarios_url, notice: 'Trocaentreusuario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ocorrencia.destroy\n respond_to do |format|\n format.html { redirect_to ocorrencias_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comentario = current_user.comentarios.find(params[:id])\n @comentario.destroy\n\n respond_to do |format|\n format.html { redirect_to comentarios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @usuario = Usuario.find(params[:id])\n @usuario.destroy\n \n redirect_to usuarios_path\n end", "def destroy\n @tipo_unidad.destroy\n respond_to do |format|\n format.html { redirect_to tipo_unidades_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if !Usuario.exists?(params[:id])\n render json: %q[{\"error\": \"Usuario no encontrado\"}], status: 404\n else\n @usuario = Usuario.find(params[:id])\n @usuario.destroy\n respond_to do |format|\n #format.html { redirect_to usuarios_url, notice: 'Usuario was successfully destroyed.' }\n format.json { }#head: no_content }\n end\n end\n end", "def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :ok }\n end\n end", "def destroy\n administradorId = @concurso.administrador_id\n @concurso.destroy\n respond_to do |format|\n format.html { redirect_to '/administradors/'+administradorId.to_s, notice: 'El concurso fue eliminado' }\n format.json { head :no_content }\n end\n end", "def destroy\n @usuario = Usuario.find_by_id(params[:id])\n if @usuario.nil?\n render :json => {:error => \"Usuario no encontrado\"}.to_json, :status => 404\n else\n @usuario.destroy\n respond_to do |format|\n #format.html { redirect_to usuarios_url, notice: 'Usuario was successfully destroyed.' }\n # format.json { render :json => {}.to_json, :status => 204 }\n format.json { head :no_content, status => 204}\n end\n end\n end", "def destroy\n authorize! :eliminar, @usuario_prestamo\n @usuario_prestamo.destroy\n respond_to do |format|\n format.html { redirect_to usuario_prestamos_url, notice: 'El usuario de préstamo fue eliminado correctamente' }\n format.json { head :no_content }\n end\n end", "def destroy\n @gran_unidad.destroy\n respond_to do |format|\n format.html { redirect_to gran_unidad_index_url }\n format.json { head :no_content }\n end\n end", "def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end", "def destroy\n @ocorrencium.destroy\n respond_to do |format|\n format.html { redirect_to ocorrencia_url, notice: 'Registro excluído com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @respuesta = Respuesta.find(params[:id])\n @respuesta.destroy\n\n respond_to do |format|\n format.html { redirect_to respuestas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sumario.destroy\n respond_to do |format|\n format.html { redirect_to sumarios_url, notice: 'Sumario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reconocimiento = Reconocimiento.find(params[:id])\n @reconocimiento.destroy\n\n respond_to do |format|\n format.html { redirect_to reconocimientos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @asiento = Asiento.find(params[:id])\n @asiento.destroy\n\n respond_to do |format|\n format.html { redirect_to asientos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @catalogo_usuario.destroy\n respond_to do |format|\n format.html { redirect_to catalogo_usuarios_url, notice: 'Catalogo usuario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @asignatura = Asignatura.find(params[:id])\n @asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to asignaturas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @asignatura = Asignatura.find(params[:id])\n @asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to asignaturas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @usuario_proyecto.destroy\n respond_to do |format|\n format.html { redirect_to usuario_proyectos_url, notice: 'Usuario proyecto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @tipos_usuario.destroy\r\n respond_to do |format|\r\n format.html { redirect_to tipos_usuarios_url, notice: 'El nombre del tipo de usuario se eliminó corrctamente.' }\r\n format.json { head :no_content }\r\n end\r\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 @datos_personal.destroy\n respond_to do |format|\n format.html { redirect_to datos_personals_url, notice: 'Datos personal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @oficio.destroy\n respond_to do |format|\n format.html { redirect_to oficios_url, notice: 'Oficio eliminado exitosamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @solicitud_servicio = SolicitudServicio.find(params[:id])\n @solicitud_servicio.destroy\n\n respond_to do |format|\n format.html { redirect_to solicitudes_servicios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @datoscontacto = Datoscontacto.find(params[:id])\n @datoscontacto.destroy\n\n respond_to do |format|\n format.html { redirect_to datoscontactos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n nombre = @usuario.nombre\n# @usuario.destroy\n @usuario.update(f_eliminado: Time.now)\n\n respond_to do |format|\n format.html { redirect_to usuarios_url, notice: \"*** #{nombre} fue borrado ***\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @cliente.destroy\n respond_to do |format|\n format.html { redirect_to clientes_url, notice: 'Cliente removido com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @usuario_perfil.destroy\n respond_to do |format|\n format.html { redirect_to usuario_perfils_url, notice: 'Usuario perfil was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sotrudniki = Sotrudniki.find(params[:id])\n @sotrudniki.destroy\n\n respond_to do |format|\n format.html { redirect_to sotrudnikis_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @utente = Utente.find(params[:id])\n @utente.destroy\n\n respond_to do |format|\n format.html { redirect_to utenti_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @relogio = Relogio.find(params[:id])\n @relogio.destroy\n\n respond_to do |format|\n format.html { redirect_to relogios_url }\n format.json { head :ok }\n end\n end", "def destroy\r\n @reclamacao.destroy\r\n respond_to do |format|\r\n format.html { redirect_to usuario_path(Usuario.get_usuario_logado), notice: 'RECLAMAÇÃO APAGADA! ' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n self.validar_admin\n @inventario.destroy\n respond_to do |format|\n format.html { redirect_to inventarios_url, notice: 'Inventario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @emailusuario = Emailusuario.find(params[:id])\n @emailusuario.destroy\n\n respond_to do |format|\n format.html { redirect_to verPerfil_path(:id => current_user.id) }\n format.json { head :no_content }\n end\n end", "def destroy\n @objeto.destroy\n respond_to do |format|\n format.html { redirect_to datos_url, notice: 'Dato was successfully destroyed.' }\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 destroy\n @clientes_servico.destroy\n respond_to do |format|\n format.html { redirect_to clientes_servicos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @autorizacion.destroy\n respond_to do |format|\n format.html { redirect_to autorizacions_url, notice: 'Autorizacion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tipo_usuario = TipoUsuario.find(params[:id])\n @tipo_usuario.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipo_usuarios_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @asos_datum.destroy\n respond_to do |format|\n format.html { redirect_to asos_data_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @duda.destroy\n respond_to do |format|\n format.html { redirect_to dudas_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.726784", "0.726784", "0.726784", "0.7264051", "0.713006", "0.71264446", "0.7099148", "0.7086893", "0.7081484", "0.7074859", "0.7073987", "0.70734173", "0.70703757", "0.70668596", "0.7061297", "0.7061297", "0.7061297", "0.70513105", "0.70404595", "0.70344204", "0.7025415", "0.7017163", "0.7009995", "0.7007284", "0.699389", "0.69855416", "0.6943783", "0.69364226", "0.69346386", "0.69305634", "0.69295585", "0.69174826", "0.6913443", "0.69114345", "0.689426", "0.6890899", "0.68877876", "0.6885911", "0.6878254", "0.68728274", "0.6861649", "0.68592983", "0.6857052", "0.68498147", "0.68498147", "0.68498147", "0.68498147", "0.6844297", "0.6839362", "0.6830893", "0.68281066", "0.6823223", "0.6822255", "0.6818681", "0.68166894", "0.68128026", "0.68039757", "0.68039554", "0.68039554", "0.68039554", "0.6800457", "0.6797942", "0.6797073", "0.6795129", "0.6794112", "0.6793289", "0.6790986", "0.6786201", "0.67851985", "0.67841", "0.6782217", "0.67804855", "0.6775842", "0.67705977", "0.6767515", "0.6767446", "0.6767446", "0.6766492", "0.6765771", "0.6765336", "0.6764472", "0.675855", "0.67562526", "0.6755945", "0.6752058", "0.6746812", "0.6746571", "0.67460954", "0.6743327", "0.6741529", "0.6741163", "0.6736874", "0.6730314", "0.6725608", "0.672544", "0.6724492", "0.67228943", "0.67192626", "0.67190874", "0.67187333" ]
0.74203104
0
Use callbacks to share common setup or constraints between actions.
def set_datos_usuario @datos_usuario = DatosUsuario.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 datos_usuario_params params.require(:datos_usuario).permit(:usuario_id, :tel1, :tel2, :correo, :direccion1, :direccion2, :contacto1, :contacto2, :tipo_sangre_id, :talla_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 valid_params_request?; 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 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 safe_params\n params.require(:user).permit(:name)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def filtering_params\n params.permit(:email)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\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 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 url_whitelist; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\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 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 maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "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 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 droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\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.6980957", "0.6783065", "0.6747844", "0.6741468", "0.67356336", "0.6592548", "0.65036845", "0.64978707", "0.64825076", "0.64795035", "0.64560914", "0.64397955", "0.6379666", "0.6376688", "0.6366702", "0.6319728", "0.6300833", "0.6300629", "0.6294277", "0.6293905", "0.6291174", "0.62905735", "0.6283171", "0.6242344", "0.62403613", "0.6218049", "0.62143815", "0.62104696", "0.61949855", "0.6178671", "0.6176147", "0.6173327", "0.6163395", "0.6153005", "0.6151833", "0.6147288", "0.61224324", "0.6118827", "0.61075264", "0.61054534", "0.6092497", "0.6080082", "0.60710967", "0.60627776", "0.60219413", "0.60175914", "0.60153484", "0.60107356", "0.60081726", "0.60081726", "0.60013986", "0.6000165", "0.59978646", "0.59936947", "0.59925723", "0.5992084", "0.59796256", "0.5967569", "0.5960056", "0.59589803", "0.5958441", "0.5958401", "0.5952607", "0.5952406", "0.5944409", "0.59391016", "0.593842", "0.593842", "0.5933845", "0.59312123", "0.5926475", "0.59248453", "0.59179676", "0.59109294", "0.59101623", "0.5908172", "0.59058356", "0.5899052", "0.5897749", "0.5896101", "0.58942914", "0.58939576", "0.5892063", "0.5887407", "0.588292", "0.58797663", "0.587367", "0.58681566", "0.5868038", "0.5866578", "0.58665025", "0.58655846", "0.58640826", "0.5863465", "0.5862226", "0.586065", "0.58581287", "0.5854443", "0.5854172", "0.58507544", "0.5849934" ]
0.0
-1
Increase the dogs position values by 5 using Array.map!.
def chasing_squirrels(dogs) dogs.map! do |individual_dog| individual_dog[:position] += 5 individual_dog end return dogs end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def return_dogs(dogs)\n dogs.map! do |individual_dogs|\n individual_dogs[:position] = 0\n individual_dogs\n end \n return dogs\nend", "def return_dogs(my_dogs)\n my_dogs.map! do |dog|\n dog[:position] = 0\n end\nend", "def walk_dogs\n dogs.map {|dog| dog.mood = \"happy\"}\n end", "def walk_dogs\n self.pets[:dogs].map do |dogs|\n dogs.mood = \"happy\"\n end\n end", "def add_five(array)\n array.map! do |element|\n if element.kind_of?(Array)\n add_five(element)\n else\n element + 5\n end\n end\nend", "def five(array)\n array.map.inject(:+) *2\nend", "def increase_array_values(array, number)\n array.map {|num| num + number}\nend", "def move_position(pos)\n # reassign value at this pos to :d to rep dog\n @map[pos] = :d\n old_pos = @current_dog.pos \n # reassigns dogs old pos to :x because dog moved\n @map[old_pos] = :x\n # changes dogs pos to reflect to value\n @current_dog.pos = pos\n end", "def walk_dogs\n @pets[:dogs][0].mood=(\"happy\")\n end", "def my_array_modification_method!(array, increase)\r\n array.map! do |x| \r\n if x.is_a? Integer\r\n x += increase\r\n else \r\n x\r\n end\r\n end\r\nend", "def my_array_modification_method!(array, num)\n array.map! { |x| x.is_a?(Integer)? (x + num) : x } #attempted .each, but the values were not updating, seems to work with map.\nend", "def map_value\n\t[3, 7, 14, 15, 22, 41].map { |e| e + 1 }\nend", "def age_increase(pet_arr)\n pet_arr.each do |x|\n x.age += 1\n end\nend", "def rig_santas(people)\n santas = people.dup\n santas[0] = people[5] # 0 gets from 5\n santas[1] = people[2] # 1 gets from 2\n santas[2] = people[0] # 2 gets from 0\n santas[3] = people[4] # 3 gets from 4\n santas[4] = people[1] # 4 gets from 1\n santas[5] = people[3] # 5 gets from 3\n (0..(people.size-1)).each { |n| people[n].santa = santas[n] }\n santas\nend", "def three_years_back\n @extinct_animals.map do |animal, year|\n @extinct_animals[animal] = @extinct_animals[animal] - 3\n end\n puts\n puts @extinct_animals\n puts\nend", "def walk_dogs \n self.dogs.each do |dog|\n dog.mood = \"happy\"\n end \n end", "def my_array_modification_method!(source, num_of_pets_wanted)\n source.map! do |x|\n if x.is_a?(Integer)\n x + num_of_pets_wanted\n else\n x\n end\n end\n return source\nend", "def walk_dogs\n pets[:dogs].each do |dog|\n dog.mood = \"happy\"\n end\n end", "def cracklepop3\n (1..100).zip(Array.new 100, nil).map do |i,x|\n [i%3, i%5].map.with_index do |y, j| \n x = x.to_s + ['crackle','pop'][j] if y==0\n end\n x ? x : i\n end\nend", "def walk_dogs\n\n self.dogs.each do |dog|\n dog.mood = \"happy\"\n end\n end", "def walk_dogs\n @pets[:dogs].each { |dog| dog.mood = \"happy\"}\n end", "def my_array_modification_method!(source, thing_to_modify)\n first_integer = []\n first_integer.push(i_want_pets[2])\n i_want_pets.delete_at(2)\n i_want_pets.insert(2, (first_integer.join.to_i + thing_to_modify) )\n\n second_integer = []\n second_integer.push(i_want_pets[7])\n i_want_pets.delete_at(7)\n i_want_pets.push(second_integer.join.to_i + thing_to_modify)\n\nend", "def walk_dogs\n @pets[:dogs].each {|dog| dog.mood = \"happy\"}\n end", "def my_array_modification_method!(sentence_array, increment)\n sentence_array.map! do |word|\n if word.is_a?(Integer)\n word += increment\n else\n word # no change, but needs to be specified or word goes to nil\n end\n end\n return sentence_array\nend", "def walk_dogs\n dogs.each do |dog|\n dog.mood = \"happy\"\n end\nend", "def mult5 array\n array.map do |value| \n value * 5 \n end\nend", "def walk_dogs\n self.dogs.each{|dog|\n dog.mood = \"happy\"\n }\n end", "def jumping_on_clouds arr\n jump_count = 1\n # create a duplicated array\n jump_arr = arr.dup\n # mark the first cloud as the first jump\n jump_arr[0] = 'J' #jump\n #mark the last loud as the last jump\n jump_arr[-1] = 'E' #end\n p jump_arr\n\n jump_arr.map.with_index do |cloud, i|\n if cloud == 'J'\n if jump_arr[i + 2] == 0 \n jump_arr[i + 2] = 'J'\n jump_count += 1\n elsif jump_arr[i + 1] == 0 && jump_arr[i + 2] == 1\n jump_arr[i + 1] = 'J'\n jump_count += 1\n end\n end\n break if jump_arr[i + 2] == 'E'\n end\n p jump_arr\n p jump_count\nend", "def []=(pos, dog_name)\n x, y = pos\n @grid[x][y] = dog.name\n end", "def my_array_modification_method!(source, thing_to_modify)\nsource.map! do |x|\n if x.is_a?(Integer)\n x + num_of_pets_wanted\n else\n x\n end\n end\n return source\nend", "def walk_dogs\n self.dogs.each {|dog| dog.mood = \"happy\"}\n end", "def walk_dogs\n self.pets[:dogs].each do |dog|\n dog.mood = \"happy\"\n end\n end", "def my_array_modification_method!(source, thing_to_modify)\n source.dup\n i_want_pets.map!{|number| number.is_a?(Integer) ? number + 1 : number}\nend", "def add1(arr)\n new_arr = arr.map do |num|\n num += 1\n end\n new_arr\nend", "def walk_dogs #walks the dogs which makes the dogs' moods happy\n # dog = Dog.new(\"Daisy\")\n # owner.pets[:dogs] << dog\n # owner.walk_dogs\n # expect(dog.mood).to eq(\"happy\")\n pets[:dogs].each do |dog|\n dog.mood = \"happy\"\n end\n end", "def my_array_modification_method(source, n)\n source.map{|i| \n if i.is_a? Integer \n i += n \n end \n i}\n p source\nend", "def update_eggs\n @eggs.each do |egg|\n if egg.position.y <= EggNestHeight and rand<EggHatchChance\n self << egg.hatch\n @eggs.delete(egg)\n @eggs.compact!\n elsif egg.position.y > EggNestHeight\n egg.move\n end\n end\n end", "def my_array_modification_method!(array, number)\n array.map! {|x|\n x.is_a?(Integer) ? (x + number): x}\nend", "def add_s(array) \n array.map do |w|\n if w != \"feet\"\n w = w + 's' \n else \n w = w \n end\n end\nend", "def assign_rooms(array)\n array.map.with_index do |name, i|\n \"Hello, #{name}! You'll be assigned to room #{i+1}!\"\n end\nend", "def four(array)\n array.map.inject(:+)\nend", "def placing_mines\n @count = 0\n @board.each.with_index do |ele,idx1|\n ele.each.with_index do |postion,idx2|\n @count+= 1\n if @random_spots.include?(@count)\n @board[idx1][idx2] = 1\n end\n end\n\n end\n print_board\n end", "def my_array_modification_method!(pets, thing_to_modify)\n pets.map! do |x|\n if x.is_a? Integer\n x += thing_to_modify\n else\n x\n end\n end\nend", "def map_with_pos(&block)\n dup.map_with_pos!(&block)\n end", "def walk_dogs\n Dog.all.collect do |dogs|\n dogs.mood=\"happy\"\n end\n end", "def next5\n x = @exact[0,5]\n x + @list[0,5 - x.size]\n end", "def test_map_bang\n array = [1,2,3,4,5,6,7,8]\n array.map! {|x| (x * 2 ) - 1 }\n assert_equal [1, 3, 5, 7, 9, 11, 13, 15] , array\n end", "def map(arr)\n i = 0\n # Double each item in the array and replace values.\n arr.each do |item|\n arr[i] = double(item)\n i += 1\n end\n # Return the new doubled array.\n # This is the result of the map function.\n return arr\nend", "def action_n(compass_position, num)\n compass_position[0] += num\nend", "def move\n @speed = map1d(total_count, (5..25), (0.1..0.4))\n @speed = (0..10.0).clip speed\n @position[Y] += speed\n @position[Y] = -height if position[Y] > height * 2\n end", "def map &block\n @legs.map &block\n end", "def map!\n i = 0\n while i < @total\n self[i] = yield(at(i))\n i += 1\n end\n self\n end", "def each_plus_one(array)\n array.map { |number|\n number += 1\n }\nend", "def add_value(at,by)\n self.each_with_index.map{|x,i| i == at ? x + by : x}\n end", "def advance_player\n @player_positions.map do |player, position|\n position += die.roll\n @player_positions[player] = calculate_player_position(position)\n end\n end", "def adv(size=0)\n @pos += size\n end", "def set_numbers\n @board.each.with_index do |arr, x|\n arr.each.with_index do |e, y|\n next if e.value == \"O\"\n traps = count_traps(x, y)\n next if traps == 0\n e.value = traps\n end\n end\n end", "def my_array_modification_method(array, number)\n\tarray = array.map! do |x|\n\t\tif x.is_a?(Integer)\n\t\t\tx + number\n\t\telse\n\t \tx\n\t end\nend\nend", "def iterativeMap(list)\n list.each do |i|\n list[i-1] = list[i-1] * 2\n end\n return list\nend", "def maps(x) x.map{|i| i * 2} end", "def incPopulation(n)\n @population += n ;\n end", "def initialize\n @@number_of_dogs +=1\n end", "def update_position\n DIMS.values.each { |dim| @position[dim] += @velocity[dim] }\n end", "def move_once(offset, pos)\n temp_pos = []\n pos.each_index do |i|\n temp_pos << pos[i] + offset[i]\n end\n temp_pos\n end", "def walk_dogs\n Dog.all.each do |dog|\n if dog.owner == self\n dog.mood = \"happy\"\n end\n end \n end", "def slide(i, l)\n \"[2, 2, 3, 2, 2] => [2, 2, 2, 3, 2]\"\n if (i + 1) < l.length\n l[i + 1] = 3\n l[i] = 2\n end\n l\nend", "def doubler(array)\n array.map do |num|\n num *= 2\n end\n\nend", "def super_fizbuzz(array)\n array.map! do |value|\n if value % 15 == 0\n value = \"FizzBuzz\"\n elsif value % 5 == 0\n value = \"Buzz\"\n elsif value % 3 == 0\n value = \"Fizz\"\n else\n value\n end\n end\n p array\nend", "def place_stones\n # iterate through array and place 4 stones in all cups, except player stores\n @cups.each_with_index do |cup, idx|\n unless (idx == 6 || idx == 13)\n 4.times do\n cup << :stone\n end\n end\n end\n end", "def round_to_five(numbers)\n numbers.map { |n| (n / 5.0).round * 5 }\nend", "def map_change\n i = 0\n while i < $Enemies.length \n $Enemies[i] = Enemy.new\n $Enemies[i].set_index(i)\n i += 1\n end\n end", "def cambioRondas(n)\n rond=@mapaactual[@mapaactual.keys[2]]\n @mapaactual[@mapaactual.keys[2]]=rond+n\n @mapaactual\n end", "def increment_position\n # return unless in_list?\n update_attribute position_column, self.send(position_column).to_i + 1\n end", "def update_map(move)\n case move\n when \"N\"\n @position_y += 1\n @pokemon_map << (\"#{@position_x};#{@position_y}\")\n when \"S\"\n @position_y -= 1\n @pokemon_map << (\"#{@position_x};#{@position_y}\")\n when \"E\"\n @position_x += 1\n @pokemon_map << (\"#{@position_x};#{@position_y}\")\n when \"O\"\n @position_x -= 1\n @pokemon_map << (\"#{@position_x};#{@position_y}\") \n else \n end\n end", "def assign_rooms(speakers)\r\n speakers.map.with_index do |speaker_name, index|\r\n \"Hello, #{speaker_name}! You'll be assigned to room #{index + 1}!\"\r\n end\r\nend", "def update\n @stars.each_with_index do |star, index|\n if star.sx == 0\n star.set_position(rand(320), rand(240))\n end\n star.update if (index * 10) <= @counter\n end\n @counter += 1\n end", "def increase_index\n @i +=1\n end", "def mutate\n @dog_count = rand(2) == 0 ? 1 + rand(6) : dog_count\n @cat_count = rand(2) == 0 ? 1 + rand(85) : cat_count\n @mouse_count = rand(2) == 0 ? 1 + rand(336) : mouse_count\n end", "def fly\n (0..4).map { @turkey.fly }\n end", "def increment_map(map, key, age)\n if map.key?(key)\n map[key] = map[key]+1/2**(age/HALF_LIFE)\n else\n map[key] = 1/2**(age/HALF_LIFE)\n end\nend", "def inc_by_2(numbers)\n p numbers\n p numbers.map {|x| x + 2 }\nend", "def change(move)\n value = self.dup\n value[0] += move[0]\n value[1] += move[1]\n Position.new(value)\n end", "def my_array_modification_method!(list, quantity_to_add)\n list.map! do |x|\n if x.is_a? Integer\n x = x + quantity_to_add\n end\n x\n end\n return list\nend", "def increment_position\n return unless in_list?\n # self_class_all_or_in_collection.where(:pos => my_position).\n adjust_position!(1)\n end", "def my_array_modification_method!(array, numadd)\n array.map!{|element| element.is_a?(Integer) ? element + numadd : element}\nend", "def walk_dogs\n self.pets.each do |family, type|\n if family.to_s == \"dogs\"\n type.each do |individual|\n individual.mood = \"happy\"\n end\n end\n end\nend", "def set_position_gamers\n pos = 1\n prev_score = -1\n gamers.order(score: :desc).each_with_index do |g, idx|\n if prev_score != -1\n if g.score != prev_score\n pos += 1\n end\n end\n g.position = pos\n prev_score = g.score\n g.save\n end\n end", "def pos=(pos)\n x, y = pos[0], pos[1]\n step_x, step_y = TABLEAU['indent']['x'], TABLEAU['indent']['y']\n\n piles.each { |pile|\n pile.pos = [x, y]\n x += step_x # Margin between piles along the axis X.\n y2 = 0 # Y position of the first card.\n\n pile.cards.each_with_index do |card, i|\n card.sprite.y += y2\n y2 += step_y # Y axis margin.\n card.face_down unless pile.last_card?(card)\n end\n }\n end", "def pos=(pos)\n x, y, step_x = pos[0], pos[1], FOUNDATION['indent']\n\n piles.each do |pile|\n pile.pos = [x, y]\n pile.background = Ray::Sprite.new image_path('foundation_bg')\n x += step_x # Margin between piles along the axis X.\n end\n end", "def score\n self.tiles.inject(0){|sum,num| sum+=TileBag.points_for(num)}\n end", "def increase_sizes(s)\n s.each do |k, v|\n new_size = (v * 0.05) + v\n new_size = new_size.to_i\n s[k] = new_size\n puts \"#{k}: #{s[k]}\"\n end\nend", "def add_s(array)\n array.map.each_with_index do |word, index|\n if index != 1\n word + \"s\" \n else\n word \n end\n end\nend", "def sell_pets\n self.pets[:dogs].each do |dog|\n dog.mood = \"nervous\"\n end\n self.pets[:cats].each do |cat|\n cat.mood = \"nervous\"\n end\n self.pets[:fishes].each do |fish|\n fish.mood = \"nervous\"\n end\n self.pets[:fishes] = []\n self.pets[:dogs] = []\n self.pets[:cats] = []\n end", "def buy_fruit(array)\n array.map {|value, index| [value] * index}.flatten # by placing value in [brackets] it makes it an array.\nend", "def multi_map(arr, num=1, &proc)\r\n new_arr = arr.clone\r\n arr.each_with_index do |el, i|\r\n num.times { new_arr[i] = proc.call(new_arr[i]) }\r\n end\r\n new_arr\r\nend", "def add_s_alternate(array)\n array.each_with_index.map do |word, index|\n if index != 1\n word = word + \"s\"\n else\n word\n end\n end\nend", "def change_actor_position(actor_id, pos)\n if @actors.include?(actor_id)\n @actor_positions[@actors.index(actor_id)] = pos\n \n sort_arrays()\n \n $game_player.refresh\n end\n end", "def transition\n newMap = []\n for x in 0...@map.length do\n for y in 0...@map[x].length do\n if !newMap[x]\n newMap[x] = []\n end\n if !newMap[x][y]\n newMap[x][y] = @map[x][y]\n end\n numAlive = neighbors(x, y).reduce(0) { |a, c| c == 1 ? a + 1 : a }\n if numAlive < 2\n newMap[x][y] = 0 # death by under population\n elsif numAlive > 3\n newMap[x][y] = 0 # death by over population\n elsif @map[x][y] == 0 and numAlive == 3\n newMap[x][y] = 1 # alive by reproduction\n end\n end\n end\n @map = newMap\n end", "def swingers(couples)\n mixed_couples = []\n couples.length.times do\n mixed_couples << []\n end\n females_from_back = couples.length - 1\n females_from_front = 0\n couples.each_with_index do |couple, index|\n if index >= couples.length / 2\n mixed_couples[index][0] = couple[0]\n mixed_couples[index][1] = couples[females_from_front][1]\n females_from_front += 1\n else\n mixed_couples[index][0] = couple[0]\n mixed_couples[index][1] = couples[females_from_back][1]\n females_from_back -= 1\n end\n \n end\n mixed_couples\nend", "def swim(index)\n end" ]
[ "0.6887292", "0.6700912", "0.6237477", "0.6179858", "0.6001572", "0.5958741", "0.5921573", "0.5817727", "0.57489455", "0.5707864", "0.5541045", "0.5515709", "0.55032694", "0.54967415", "0.5496465", "0.54896796", "0.5483739", "0.5477751", "0.5451388", "0.545095", "0.54459155", "0.5438437", "0.5434353", "0.543344", "0.5405471", "0.5405246", "0.54017824", "0.540147", "0.54005486", "0.53903204", "0.53794116", "0.5379081", "0.5366562", "0.5348613", "0.53485626", "0.5316939", "0.52566224", "0.52256817", "0.52192897", "0.5210106", "0.51711905", "0.5168632", "0.5159247", "0.5145227", "0.51436085", "0.5129694", "0.5128162", "0.51266617", "0.5123043", "0.5105009", "0.5104776", "0.5095766", "0.50945336", "0.5085242", "0.50826603", "0.50742066", "0.507089", "0.50521874", "0.50140095", "0.5013549", "0.501127", "0.50060874", "0.49759036", "0.4966002", "0.49652338", "0.49613142", "0.4925227", "0.49204382", "0.49195737", "0.49187455", "0.49150357", "0.4902002", "0.490068", "0.48997587", "0.4889715", "0.4876665", "0.48746845", "0.487062", "0.48603886", "0.48566955", "0.4840153", "0.4838186", "0.48312864", "0.48287272", "0.48198646", "0.48169917", "0.48130226", "0.4811081", "0.48108044", "0.48032296", "0.4803042", "0.47857726", "0.47773746", "0.47704545", "0.47699875", "0.4763824", "0.4756924", "0.47555614", "0.4750698", "0.4749383" ]
0.77814525
0
Write a new method called return_dogs that takes an array of dogs as an argument. It should reset all of the dogs' positions back to 0.
def return_dogs(dogs) dogs.map! do |individual_dogs| individual_dogs[:position] = 0 individual_dogs end return dogs end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def return_dogs(my_dogs)\n my_dogs.map! do |dog|\n dog[:position] = 0\n end\nend", "def chasing_squirrels(dogs)\n dogs.map! do |individual_dog|\n individual_dog[:position] += 5\n individual_dog\n end\n return dogs\nend", "def dogs_by_size_results\n dogs_by_size_results = []\n end", "def dogs \n dogs = self.walks.map {|walk| walk.dog}\n dogs.uniq\n end", "def call_absent_dogs (dogs_array)\n dogs_array.each do |dog|\n if dog[:position] > 10\n puts \"Come back, #{dog[:name]}!\"\n end\nend\nend", "def walk_dogs\n dogs.map {|dog| dog.mood = \"happy\"}\n end", "def mutate(array)\n array.pop \nend", "def mutate(array)\n array.pop\nend", "def mutate(array)\n array.pop\nend", "def mutate(array)\n array.pop\nend", "def mutate(array)\n array.pop\nend", "def mutate(array)\n array.pop\nend", "def mutate(array)\n array.pop\nend", "def mutate(array)\n array.pop\nend", "def mutate(array)\n array.pop\nend", "def mutate(array)\n array.pop\nend", "def mutate(array)\n array.pop\nend", "def return_animals\n puts @animals\n end", "def walk_dogs\n self.pets[:dogs].map do |dogs|\n dogs.mood = \"happy\"\n end\n end", "def sell_pets\n#this makes them all nervous\n pets.each do |species, animals|\n animals.each do |animal|\n animal.mood = \"nervous\"\n end\n animals.clear\n end\n end", "def mutate(arr)\n arr.pop # (no bang! here) mutates\nend", "def sell_pets\n all_pets = []\n all_pets << self.cats \n all_pets << self.dogs \n all_pets.flatten.map do |each_pet|\n each_pet.mood = \"nervous\"\n each_pet.owner = nil\n end\n end", "def sell_pets\n all_animals = self.pets.values\n\n all_animals.each do |species|\n species.each {|pet| pet.mood = \"nervous\"}\n species.clear\n end\n end", "def reset\n @dice.each(&:reset)\n if @dice.size > 2\n @dice.slice!(-2..-1)\n end\n end", "def mutate(arr)\n arr.pop # => 6\nend", "def walk_dogs\n @pets[:dogs][0].mood=(\"happy\")\n end", "def mutate(arr)\n arr.pop\n end", "def walk_dogs\n Dog.all.collect do |dogs|\n dogs.mood=\"happy\"\n end\n end", "def zoo\n animals.map(&:zoo).uniq\n # binding.pry\n end", "def sell_pets\n pets.each do |species, pet_array| #enumerate through pets hash...\n pet_array.each do |pet_object| #then enumerate through pet_array within pets hash...\n #binding.pry\n pet_object.mood = \"nervous\" #set each pet_object's mood to \"nervous\"\n end\n end #end loop\n self.pets.clear #and reset Owner instance .pets to an empty array, that is returned\n end", "def walk_dogs\n\n self.dogs.each do |dog|\n dog.mood = \"happy\"\n end\n end", "def sell_pets\n self.cats.each{ |each_cat|\n each_cat.mood = \"nervous\"\n each_cat.owner = nil\n }\n \n self.dogs.each{ |each_dog|\n each_dog.mood = \"nervous\"\n each_dog.owner = nil\n }\n\n self.cats.clear\n self.dogs.clear\n end", "def small_dogs\n small_array = []\n @dogs.each do |dog|\n if dog[:size] == :small\n small_array << dog\n end\n end\n p small_array\n end", "def index\n @dogs = dogs_with_ads\n end", "def walk_dogs \n self.dogs.each do |dog|\n dog.mood = \"happy\"\n end \n end", "def remix(ingredient_arrays)\n \n mixers = []\n \n ingredient_arrays.each do |array|\n mixers << array[1]\n end\n \n ingredient_arrays.each do |array|\n idx = rand(mixers.length)\n array[1] = mixers[idx]\n mixers.delete_at(idx)\n end\n \n return ingredient_arrays\n \nend", "def walk_dogs\n self.dogs.each {|dog| dog.mood = \"happy\"}\n end", "def make_raptors(birds_arr)\n yield(birds_arr)\nend", "def mutate(arr)\n arr.uniq!\nend", "def dogs\n collection_of_dogs = []\n Dog.all.each do |dog|\n if dog.owner == self\n collection_of_dogs << dog\n end \n end \n return collection_of_dogs\n end", "def map_to_no_change(array)\n return array\nend", "def walk_dogs\n self.dogs.each{|dog|\n dog.mood = \"happy\"\n }\n end", "def sell_pets\n @pets.each do |type, pet| \n pet.each { |animal| animal.mood = \"nervous\"}\n end\n @pets.clear\n end", "def map(arr)\n i = 0\n # Double each item in the array and replace values.\n arr.each do |item|\n arr[i] = double(item)\n i += 1\n end\n # Return the new doubled array.\n # This is the result of the map function.\n return arr\nend", "def view_animals(clients, shelter)\n\t# iterates through the array of pets at the shelfter and prints the animal's details\n\tshelter.pets.each { |pet| puts pet.to_s } # why does the shelter's pets array get displayed?\n\t\n\tputs\n\tputs \"Enter the name of the animal you would like to adopt:\"\n\tanimal_selected = gets.chomp.capitalize\n\t# find the animal in the animals array, delete and add as a pet to the client\n\tanimal_to_adopt = shelter.pets.find { |pet| animal_selected == pet.name }\n\tputs \"What is your name?\"\n\tclient_name = gets.chomp\n\tadopt_animal(animal_to_adopt, shelter.pets, clients)\nend", "def sell_pets\n self.pets[:dogs].each do |dog|\n dog.mood = \"nervous\"\n end\n self.pets[:cats].each do |cat|\n cat.mood = \"nervous\"\n end\n self.pets[:fishes].each do |fish|\n fish.mood = \"nervous\"\n end\n self.pets[:fishes] = []\n self.pets[:dogs] = []\n self.pets[:cats] = []\n end", "def using_pop (array)\n return array.pop\nend", "def my_array_modification_method!(source, thing_to_modify)\n source.dup\n i_want_pets.map!{|number| number.is_a?(Integer) ? number + 1 : number}\nend", "def no_mutate(array)\n array.last #returns the last element of the array but does not actually permanently modify the array in any way\nend", "def sell_pets \n self.dogs.each do |dog|\n dog.owner = nil\n dog.mood = \"nervous\"\n self.dogs.delete(dog)\n end \n self.cats.each do |cat|\n cat.owner = nil\n cat.mood = \"nervous\"\n self.cats.delete(cat)\n end\n end", "def remove_fish_river()\n @fish.slice(index,1)\nend", "def sell_pets\n pets = dogs + cats\n\n pets.each do |pet|\n pet.mood = \"nervous\"\n pet.owner = nil\n end\n end", "def buy_fruit(array)\n returner = []\n array.each{|subarray| subarray[1].times{returner << subarray[0]}}\n returner\nend", "def sell_pets\n cats.each do |pet|\n pet.mood = \"nervous\"\n pet.owner = nil\n end\n dogs.each do |pet|\n pet.mood = \"nervous\"\n pet.owner = nil\n end\n \n\n end", "def dominant_octopus(arr)\n return arr if arr.size <= 1\n\n mid = arr.size / 2\n left = dominant_octopus(arr.take(mid))\n right = dominant_octopus(arr.drop(mid))\n\n fish_merger(left, right)\nend", "def walk_dogs\n @pets[:dogs].each { |dog| dog.mood = \"happy\"}\n end", "def walk_dogs\n @pets[:dogs].each {|dog| dog.mood = \"happy\"}\n end", "def reset_ans\n puts \"Resetting answers!\"\n @answers_arr = reset_arr(&:clone)\nend", "def fruit([])\n\nend", "def awesomesauce(string_array)\n awesome_array = []\n string_array.each do |i|\n awesome_array << i\n awesome_array << 'awesomesauce'\n end\n awesome_array.pop\n return awesome_array\nend", "def my_array_modification_method!(sentence_array, increment)\n sentence_array.map! do |word|\n if word.is_a?(Integer)\n word += increment\n else\n word # no change, but needs to be specified or word goes to nil\n end\n end\n return sentence_array\nend", "def walk_dogs\n self.pets[:dogs].each do |dog|\n dog.mood = \"happy\"\n end\n end", "def pop_from_array(arr)\n arr.size.times do\n puts arr.pop\n end\nend", "def no_mutate(array)\n array.last\nend", "def no_mutate(array)\n array.last\nend", "def no_mutate(array)\n array.last\nend", "def no_mutate(array)\n array.last\nend", "def no_mutate(array)\n array.last\nend", "def small_dogs\n small_dogs =[]\n @dogs.each do |dog|\n if dog[:size] == :small\n small_dogs << dog\n end\n end\n small_dogs\n end", "def move_zeros(array)\n\nend", "def dog_eat(items)\n \t items.each do |item|\n \t\t puts \"My puppy likes #{item}\"\n \t end\n end", "def death(arr,pos,m)\n #define an empty result string\n result = \"\"\n #If the array size is 1, just return the first index\n if arr.size == 1\n return arr[0].to_s\n end\n #If the position is bigger than the size of the array\n if pos+m > arr.size\n #Set the pos back into size of the array\n pos = (pos+m)%arr.size\n # append the number in the position to result\n result << arr[pos].to_s\n #delete the number (a.k.a. kill it)\n arr.delete_at(pos)\n #Append to result a recursive call to death\n result += death(arr,pos,m)\n #return the result\n return result\n end\n #If the position is small than the size of the array\n if arr.size > pos+m \n #The next target is updated according to m\n pos = pos + m\n #Append the number in the position to result\n result << arr[pos].to_s\n #delete the number (a.k.a. kill it)\n arr.delete_at(pos)\n #Append the result of a recursive call to death\n result += death(arr,pos,m)\n \n return result\n end\n #if the target is past the end of the array\n if arr.size == pos+m \n #set the position to 0\n pos = 0\n #Append that number\n result << arr[pos].to_s\n #delete it\n arr.delete_at(pos)\n #Append the result of a recursive call to death\n result += death(arr,pos,m)\n #return\n return result\n end\nend", "def walk_dogs\n pets[:dogs].each do |dog|\n dog.mood = \"happy\"\n end\n end", "def using_pop(array)\n array.pop\nend", "def no_mutate(array)\n array.last #returns array with last item removed, no mutation of array\nend", "def using_pop(array)\n array.pop\nend", "def non_mutate(array)\n array.last\nend", "def buy_fruit(array)\n new_list = []\n number = 0\n array.each do |fruit|\n number = fruit.pop\n number.times { new_list << fruit }\n end\n new_list.flatten\nend", "def virus(input_array)\n i = input_array.length-1 \n new_array = []\n\n input_array.length.times do \n new_array << input_array[i]\n i -= 1\n end \n return new_array\nend", "def run(animals_array) # this is just the definition \n puts \"WELCOME TO THE PET STORE!!!\"\n puts \"Would you like to...\"\n puts \"1. See a list of all pet names?\"\n puts \"2. See a list of all dogs?\"\n puts \"3. Find an animal by name?\"\n choice = gets.chomp\n if choice.chomp == \"1\"\n # puts \"you selected see all names\"\n # all_names = []\n # animals_array.each { |animal| all_names << animal[:name] }\n # all_names\n p animals_array.map { |animal| animal[:name] } # or collect!!\n \n elsif choice.chomp == \"2\"\n p animals_array.select { |animal| animal[:species] == \"dog\" }\n # alternates are filter and find_all\n elsif choice.chomp == \"3\"\n puts \"Which animal are you looking for?\"\n name = gets.chomp\n p animals_array.find { |ani| ani[:name] == name } # or detect\n binding.pry\n else\n puts \"That was not a valid option. Please try again!\"\n run(animals_array)\n end\n\n\nend", "def my_array_modification_method!(source, thing_to_modify)\nsource.map! do |x|\n if x.is_a?(Integer)\n x + num_of_pets_wanted\n else\n x\n end\n end\n return source\nend", "def pets_by_breed(shop, breed) # def the function with two arguements of shop and breed which are passed in through test as @pet_shop and \"B/s\"\n pets_array = [] #creates a new array\n for pet in shop[:pets] #for loop says for a pet in @pet_shop pets\n pets_array.push(pet) if pet[:breed] == breed #push the pet breed of B/s into the pets array\n end\n return pets_array #return the pets array (2)\nend", "def populate_default_birds\r\n\tbird1 = Bird.new(\"Bob\", \"penguin\", \"tuxedo\", \"on ice\")\r\n\tbird2 = Bird.new(\"George\", \"eagle\", \"American\", \"in a pine tree\");\r\n\tbird3 = Bird.new(\"Jill\", \"flamingo\", \"pink and tall\", \"by a lagoon\");\r\n\tfor b in Bird.wild_birds\r\n\t\tprint \"#{b.to_s}\\n\"\r\n\tend\r\nend", "def using_pop(array)\n array.pop\nend", "def using_pop(array)\n array.pop\nend", "def using_pop(array)\n array.pop\nend", "def using_pop(array)\n array.pop\nend", "def using_pop(array)\n array.pop\nend", "def using_pop(array)\n array.pop\nend", "def using_pop(array)\n array.pop\nend", "def using_pop(array)\n array.pop\nend", "def using_pop(array)\n array.pop\nend", "def my_array_modification_method!(source, num_of_pets_wanted)\n source.map! do |x|\n if x.is_a?(Integer)\n x + num_of_pets_wanted\n else\n x\n end\n end\n return source\nend", "def three_years_back\n @extinct_animals.map do |animal, year|\n @extinct_animals[animal] = @extinct_animals[animal] - 3\n end\n puts\n puts @extinct_animals\n puts\nend", "def deal_player player_array, dealer_array\r\n card = deal player_array, dealer_array\r\n player_array << card\r\n return card\t\r\nend", "def walk_dogs\n dogs.each do |dog|\n dog.mood = \"happy\"\n end\nend", "def manipulating_arrays(array)\n puts array.reverse\n puts array.sort\n return array.sort.reverse\nend", "def using_pop(array)\n array.pop()\nend", "def swill(array)\n puts array[3]\nend", "def return_cards\n @hand = []\n end" ]
[ "0.70954454", "0.6231123", "0.55703455", "0.5535698", "0.5495427", "0.54411733", "0.5422618", "0.5411562", "0.5411562", "0.5411562", "0.5411562", "0.5411562", "0.5411562", "0.5411562", "0.5411562", "0.5411562", "0.5411562", "0.5244353", "0.52318317", "0.5107641", "0.5105909", "0.51032573", "0.5047296", "0.50264007", "0.49821395", "0.49692148", "0.4960883", "0.49582", "0.49525848", "0.49263933", "0.49115863", "0.49112305", "0.49057376", "0.48938304", "0.48710003", "0.48650962", "0.4861845", "0.48182642", "0.47919586", "0.4778716", "0.47743893", "0.4767497", "0.47666728", "0.47655618", "0.47654316", "0.47551173", "0.47543368", "0.47537827", "0.47515708", "0.4749009", "0.47402322", "0.47306222", "0.4717281", "0.47152978", "0.47112596", "0.47100142", "0.47092164", "0.47089928", "0.4687982", "0.46798372", "0.46766257", "0.4675693", "0.46736452", "0.46722984", "0.46722984", "0.46722984", "0.46722984", "0.46722984", "0.46699595", "0.46662945", "0.4665604", "0.466415", "0.46577516", "0.46556032", "0.4655463", "0.46509448", "0.4640911", "0.46402073", "0.46384814", "0.4637807", "0.4633328", "0.4622569", "0.4613592", "0.46095556", "0.46095556", "0.46095556", "0.46095556", "0.46095556", "0.46095556", "0.46095556", "0.46095556", "0.46095556", "0.46091348", "0.45994103", "0.45931154", "0.45849866", "0.45817453", "0.4577462", "0.45576012", "0.45530263" ]
0.7431859
0
Results from the WordReference.com API include a 'note' field that is rarely populated and does not seem very useful.
def strip_note!(data_array) data_array.pop end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notes\n @data[:notes]\n end", "def extract_references(hackney_note)\n WorkOrderReferenceFinder\n .new(hackney_note.work_order_reference)\n .find(hackney_note.text || \"\")\n end", "def notes params=nil\n @nimble.get \"contact/#{self.id}/notes\", params\n end", "def reference_document\n if document.blank?\n \"None Assigned\"\n else\n document.refno+\" : \"+document.title+\" : dated \"+document.letterdt.strftime(\"%d-%b-%Y\").to_s\n end\n end", "def note\n comment_list = []\n return @notes if !@notes.nil?\n for page in @pages\n next if !page || !page.list || page.list.size <= 0\n note_page = page.list.dup\n \n note_page.each do |item|\n next unless item && (item.code == 108 || item.code == 408)\n comment_list.push(item.parameters[0])\n end\n end\n @notes = comment_list.join(\"\\r\\n\")\n return @notes\n end", "def getNote(key)\n refreshToken\n url = \"/api/note?key=#{key}&auth=#{@token}\\&email=#{@email}&encode=base64\"\n response, result = agent.get(url)\n\n unless response.code.to_i == 200 or response.nil?\n raise \"Failed to fetch note for \\'#{key}\\'\"\n end\n\n note = {}\n note['note-key'] = response['note-key']\n note['note-createdate'] = response['note-createdate']\n note['note-modifydate'] = response['note-modifydate']\n note['deleted'] = response['note-deleted']\n note['note-text'] = Base64.decode64(result) \n \n note\n end", "def note\n return @poco_data[:note] unless @poco_data == nil\n pick_first_node(@poco.xpath('./poco:note'))\n end", "def test_get_footnote\n filename = 'Footnote.doc'\n remote_name = 'TestGetFootnote.docx'\n index = 0\n\n st_request = PutCreateRequest.new remote_test_folder + test_folder + '/' + remote_name, File.open(local_test_folder + test_folder + '/' + filename, \"r\").read \n @storage_api.put_create st_request\n\n request = GetFootnoteRequest.new remote_name, index, remote_test_folder + test_folder\n result = @words_api.get_footnote request\n assert_equal 200, result.code\n end", "def extract_notes( existing_payload, solr_doc, fedora_doc )\n\n # document notes (use the XML variant as it reflects the formatting better)\n notes = IngestHelpers.fedora_first_field_extract( fedora_doc, 'mods note' )\n return notes if notes.present?\n\n # general approach\n notes = IngestHelpers.solr_first_field_extract(solr_doc, 'note_t' )\n return notes if notes.present?\n\n return nil\n end", "def note note, preview=nil\n preview ||= note[0..64]\n params = {\n contact_ids: [ self.id ],\n note: note,\n note_preview: preview\n }\n @nimble.post \"contacts/notes\", params\n end", "def test_get_footnotes\n filename = 'Footnote.doc'\n remote_name = 'TestGetFootnotes.docx'\n\n st_request = PutCreateRequest.new remote_test_folder + test_folder + '/' + remote_name, File.open(local_test_folder + test_folder + '/' + filename, \"r\").read \n @storage_api.put_create st_request\n\n request = GetFootnotesRequest.new remote_name, remote_test_folder + test_folder\n result = @words_api.get_footnotes request\n assert_equal 200, result.code\n end", "def communication_note_for_solr\n return FinderHelper.strip(communication_note)\n end", "def get_notes(opts = {})\n data, status_code, headers = get_notes_with_http_info(opts)\n return data\n end", "def note\n DBC.require( bu?, \"Vin non bu: La note n'est pas definie\" )\n\n @note\n end", "def get_notes_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NotesApi#get_notes ...\"\n end\n \n # resource path\n path = \"/Notes\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'brief'] = opts[:'brief'] if opts[:'brief']\n query_params[:'skip'] = opts[:'skip'] if opts[:'skip']\n query_params[:'top'] = opts[:'top'] if opts[:'top']\n query_params[:'count_total'] = opts[:'count_total'] if opts[:'count_total']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\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']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, 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<APINote>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NotesApi#get_notes\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def notes(element_key)\n parameter = { basic_auth: @auth }\n\n response = self.class.get(\"/elements/#{element_key}/notes\", parameter)\n if response.success?\n search_response_header = SearchResponseHeader.new(response)\n search_response_header.elementList\n end\n end", "def note\n @attributes[:note]\n end", "def notes( params={} )\n notes = get_connections(\"notes\", params)\n return map_connections notes, :to => Facebook::Graph::Note\n end", "def get_notes_by_search_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NotesApi#get_notes_by_search ...\"\n end\n \n # resource path\n path = \"/Notes/Search\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'title'] = opts[:'title'] if opts[:'title']\n query_params[:'owner_user_id'] = opts[:'owner_user_id'] if opts[:'owner_user_id']\n query_params[:'updated_after_utc'] = opts[:'updated_after_utc'] if opts[:'updated_after_utc']\n query_params[:'brief'] = opts[:'brief'] if opts[:'brief']\n query_params[:'skip'] = opts[:'skip'] if opts[:'skip']\n query_params[:'top'] = opts[:'top'] if opts[:'top']\n query_params[:'count_total'] = opts[:'count_total'] if opts[:'count_total']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\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']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, 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<APINote>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NotesApi#get_notes_by_search\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def add_note # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity\n @bib.biblionote.each do |n|\n case n.type\n when \"annote\" then @item.annote = n.content\n when \"howpublished\" then @item.howpublished = n.content\n when \"comment\" then @item.comment = n.content\n when \"tableOfContents\" then @item.content = n.content\n when nil then @item.note = n.content\n end\n end\n end", "def notes(params = {})\n @notes ||= MailchimpAPI::Note.find(:all, params: { member_id: id }.deep_merge(prefix_options).deep_merge(params))\n end", "def add_note\n @extract = Csvarchive.find(params[:resource_id])\n note = Note.new(:words=>params[:words], :user_id=>current_user.id, :notable_id=>@extract.id, :notable_type=>\"Csvarchive\")\n note.save\n render :partial=>\"notes/note\", :locals=>{:note=>note}\n end", "def notes\n @attributes[:notes]\n end", "def notes\n @attributes[:notes]\n end", "def notes\n @notes\n end", "def note\n query_root_node(\"lgdp:note/text()\", @@NAMESPACES).to_s\n end", "def refused_docs\n data['refusedDocs']\n end", "def note\n qry = ActiveRDF::Query.new(Note).select(:note).distinct\n qry.where(:note, N::DCT.isPartOf, self)\n qry.execute\n end", "def read_notes_without_serializing(obs)\n Observation.connection.exec_query(\"\n SELECT notes FROM observations WHERE id = #{obs.id}\n \").rows.first.first\n end", "def note_contents\n self.notes.map(&:content)\n end", "def note_contents\n self.notes.map(&:content)\n end", "def note_contents\n self.notes.collect {|note| note.content }\n end", "def description; @doc['description']; end", "def description; @doc['description']; end", "def inferred_notes\n if scrubbed_notes?\n Rails.logger.debug \"not replacing scrubbed notes\"\n head_notes\n notes\n elsif head_notes.present?\n head_notes\n elsif notes.present? && ff?\n Rails.logger.debug \"not deleting old ff notes\"\n head_notes\n notes\n else\n head_notes\n end\n end", "def show\n @word_note = WordNote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word_note }\n end\n end", "def get_note(note_id)\n @notes[note_id]\n end", "def get_note(note_id)\n @notes[note_id]\n end", "def remarks\n self.dig_for_array(\"remarks\")\n end", "def notes\n data_series.find_all { |ds| ds.options[:note].present? }\n .map { |ds| { ds_name: ds.name, body: ds.options[:note] }}\n end", "def note_for ref\n @note_order << ref\n\n label = @note_order.length\n\n \"{*#{label}}[rdoc-label:foottext-#{label}:footmark-#{label}]\"\n end", "def note_contents\n self.notes.each.map{|note| note.content}\n end", "def note(note)\n\t\t@note = note\n\tend", "def show_notes\n info \"showing notes\"\n res = run(\"git notes --ref #{refname} show\")\n if res[:val] == 0\n info \"existing note: #{res[:out].strip}\"\n else\n info \"no existing note\"\n end\n end", "def additional_holdings_location_notes(document, location)\n location_notes = []\n\n # Law records need a link back to their native catalog\n if document && document.in_pegasus?\n location_notes << content_tag(:span, pegasus_item_link(document, 'Search Results'), class: 'url_link_note')\n end\n\n # Check for any location notes in app_config - that's used for\n # somewhat dynamic values that we don't want to put in code\n app_config_notes = Location.get_app_config_location_notes(location)\n location_notes << app_config_notes.html_safe unless app_config_notes.nil?\n\n return location_notes unless location_notes.empty?\n nil\n end", "def get\n return @note unless @note.nil?\n filter = ::Evernote::EDAM::NoteStore::NoteFilter.new\n filter.order = ::Evernote::EDAM::Type::NoteSortOrder::CREATED\n filter.notebookGuid = @notebook.guid\n filter.timeZone = \"Asia/Tokyo\"\n filter.ascending = false # descending\n note_list = @auth_store.note_store.findNotes(@auth_store.auth_token, filter, 0, 1)\n if note_list.notes.empty?\n Log4r::Logger.log_internal { \"Note not found at #{@notebook.guid}\" }\n @note = ::Evernote::EDAM::Type::Note.new\n else\n @note = note_list.notes[0]\n end\n @note\n end", "def note_contents\n self.notes.collect {|note| note.content}\n end", "def get_document_details(doc)\n tmp_hash = {}\n tmp_hash[\"id\"] = doc[\"bibid\"]\n tmp_hash[\"location\"] = doc[\"location\"].present? ? doc[\"location\"] : \"\"\n tmp_hash[\"title\"] = doc[\"fulltitle_display\"].present? ? doc[\"fulltitle_display\"] : \"\"\n if doc[\"format\"].present?\n if doc[\"format\"][1].present? and doc[\"format\"][1] == \"Microform\"\n the_format = doc[\"format\"][1]\n else\n the_format = doc[\"format\"][0]\n end\n else\n the_format = \"\"\n end\n # oclc_id and isbn are used to get the images from googlebooks\n oclc_id = doc[\"oclc_id_display\"].present? ? doc[\"oclc_id_display\"][0] : \"\"\n isbn = doc[\"isbn_display\"].present? ? doc[\"isbn_display\"][0].split(\" \")[0] : \"\"\n tmp_hash[\"format\"] = the_format\n tmp_hash[\"pub_date\"] = doc[\"pub_date_display\"].present? ? doc[\"pub_date_display\"] : \"\"\n tmp_hash[\"publisher\"] = doc[\"publisher_display\"].present? ? doc[\"publisher_display\"] : \"\"\n tmp_hash[\"author\"] = doc[\"author_display\"].present? ? doc[\"author_display\"] : \"\"\n tmp_hash[\"availability\"] = doc[\"availability_json\"].present? ? doc[\"availability_json\"] : \"\"\n tmp_hash[\"locations\"] = doc[\"availability_json\"].present? ? process_locations(doc[\"availability_json\"]) : []\n tmp_hash[\"citation\"] = doc[\"cite_preescaped_display\"].present? ? doc[\"cite_preescaped_display\"] : \"\"\n tmp_hash[\"callnumber\"] = doc[\"callnum_display\"].present? ? doc[\"callnum_display\"] : \"\"\n # the difference between these next two: \"internal_class_label\" gets used in the data attribute\n # of some elements, while the \"display_class_label\" gets displayed in the UI and has the added\n # font awesomne html\n classification = doc[\"classification_display\"].present? ? doc[\"classification_display\"] : \"\"\n tmp_hash[\"internal_class_label\"] = build_class_label(classification)\n tmp_hash[\"display_class_label\"] = tmp_hash[\"internal_class_label\"].gsub(' : ','<i class=\"fa fa-caret-right class-caret\"></i>').html_safe\n # tmp_hash[\"img_url\"] = get_googlebooks_image(oclc_isbn[0], oclc_isbn[1], the_format)\n tmp_hash[\"img_url\"] = get_googlebooks_image(oclc_id, isbn, the_format)\n\n return tmp_hash\n end", "def notes\n return bad_request unless params[:note_id] and request.format.json? || request.format.js?\n return not_found unless current_note\n @response = {'annotation' => current_note.canonical}\n render_cross_origin_json\n end", "def notes\n return @notes\n end", "def notes\n return @notes\n end", "def notes\n return @notes\n end", "def notes\n return @notes\n end", "def notes=(value)\n @notes = value\n end", "def notes=(value)\n @notes = value\n end", "def notes=(value)\n @notes = value\n end", "def notes=(value)\n @notes = value\n end", "def notes\n @default_options.fetch(:notes, nil)\n end", "def note_contents\n self.notes.collect do |note|\n note.content\n end\n end", "def collection\n return @client.api_helper.collection(\"notes\")\n end", "def endnote\n @response, @documents = get_solr_response_for_field_values(SolrDocument.unique_key,params[:id])\n respond_to do |format|\n format.endnote { render :layout => false } #wrapped render :layout => false in {} to allow for multiple items jac244\n format.mendeley { render :layout => false } \n end\n end", "def notes\n\t\tNote.find(:all)\n\tend", "def verify_note(test_data)\n verify_values_match(test_data[UseOfCollections::NOTE.name], element_value(note_text_area))\n end", "def notes_from_training\n end", "def documents\n reply.documents[0][RESULTS] || reply.documents[0][RESULT]\n end", "def notes(options = {})\n # Create a default 2 item hash and update if options is supplied\n options = {\n id: nil,\n type: nil\n }.update(options)\n return nil if @_notes.nil?\n return nil if @_notes.empty?\n\n # Empty 2-D Hash to be used for notes found based on id and type\n notes_found = Hash.new do |h, k|\n # h is the id portion of the hash\n # k is the type portion of the hash\n h[k] = {}\n end\n # Filter @notes based off of the id\n filter_hash(@_notes, options[:id]).each do |id, hash|\n # Filter hash based off of the type\n filter_hash(hash, options[:type]).each do |type, note|\n # Store the note into note_found\n notes_found[id][type] = note\n end\n end\n if notes_found.empty?\n nil\n elsif notes_found.size == 1\n notes_found.values.first.values.first\n else\n notes_found\n end\n end", "def rip_notes()\n if @version >= IOS_VERSION_9\n @database.execute(\"SELECT ZICNOTEDATA.ZNOTE FROM ZICNOTEDATA\") do |row|\n self.rip_note(row[\"ZNOTE\"])\n end\n end\n\n if @version == IOS_LEGACY_VERSION\n @database.execute(\"SELECT ZNOTE.Z_PK FROM ZNOTE\") do |row|\n self.rip_note(row[\"Z_PK\"])\n end\n end\n end", "def all_notes\n self.has_notes? ? self.annotations.map {|n| n.body }.join(' ') : '' \n end", "def footnote_content; end", "def additional_brief_location_note(document, _location)\n # Law records need a link back to their native catalog\n if document && document.in_pegasus?\n return content_tag(:span, pegasus_item_link(document, 'Search Results'), class: 'url_link_note')\n end\n end", "def set_retrieved(doc, request, modified)\n doc[\"retrieved\"] = {\n from: request.url,\n at: Time.now,\n modifiedAccordingToASNApi: modified\n }\n doc\nend", "def binding_note\n map_field(:binding_note).to_a.first\n end", "def to_up_notes(raw_notes)\n raw_notes.present? ? { other: raw_notes } : Observation.no_notes\n end", "def _notes\n @_notes ||= Hash.new do |h, k|\n h[k] = {}\n end\n end", "def index\n @internal_notes = InternalNote.all\n end", "def list_notes\n notes = if unsafe_params[:editable]\n Note.editable_by(@context).where.not(title: nil).accessible_by_private\n else\n Note.accessible_by(@context).where.not(title: nil)\n end\n\n if unsafe_params[:scopes].present?\n check_scope!\n notes = notes.where(scope: unsafe_params[:scopes])\n end\n\n if unsafe_params[:note_types].present?\n fail \"Param note_types can only be an Array of Strings containing 'Note', 'Answer', or 'Discussion'\" unless unsafe_params[:note_types].is_a?(Array) && unsafe_params[:note_types].all? { |type| %w(Note Answer Discussion).include?(type) }\n\n note_types = unsafe_params[:note_types].map { |type| type == \"Note\" ? nil : type }\n notes = notes.where(note_type: note_types)\n end\n\n result = notes.order(id: :desc).map do |note|\n if note.note_type == \"Discussion\"\n note = note.discussion\n elsif note.note_type == \"Answer\"\n note = note.answer\n end\n describe_for_api(note, unsafe_params[:describe])\n end\n\n render json: result\n end", "def get_note(obj, id)\n obj['notes'].find {|n| n['persistent_id'] == id}\nend", "def starred_notes\n fetch_notes_for nil, true\n end", "def all_notes\n result = {}\n self.class.all_note_fields.each do |field|\n value = send(field).to_s\n result[field] = value.presence\n end\n result\n end", "def verify_note(test_data)\n verify_values_match(test_data[CoreUseOfCollectionsData::NOTE.name], element_value(note_text_area))\n end", "def content\n return @content_ unless @content_.nil?\n @note.nil? and get\n @content_ = !@note.nil? && !@note.guid.nil? ? @auth_store.note_store.getNoteContent(@auth_store.auth_token, @note.guid) : \"\"\n end", "def notes_show_formatted\n Observation.show_formatted(notes)\n end", "def notes\n @reason_structure[@num]\n end", "def search_note(string)\n logger.info 'Searching for a string within a note'\n search string\n end", "def notes; end", "def notes; end", "def notes; end", "def get_credit_note(credit_note_id_or_number)\n request_params = {}\n\n url = \"#{@xero_url}/CreditNotes/#{CGI.escape(credit_note_id_or_number)}\"\n\n response_xml = http_get(@client, url, request_params)\n\n parse_response(response_xml, {:request_params => request_params}, {:request_signature => 'GET/CreditNote'})\n end", "def rip_note(note_id)\n query_string = \"SELECT ZICNOTEDATA.Z_PK, ZICNOTEDATA.ZNOTE, \" + \n \"ZICNOTEDATA.ZCRYPTOINITIALIZATIONVECTOR, ZICNOTEDATA.ZCRYPTOTAG, \" + \n \"ZICNOTEDATA.ZDATA, ZICCLOUDSYNCINGOBJECT.ZCRYPTOVERIFIER, \" + \n \"ZICCLOUDSYNCINGOBJECT.ZCRYPTOSALT, ZICCLOUDSYNCINGOBJECT.ZCRYPTOITERATIONCOUNT, \" + \n \"ZICCLOUDSYNCINGOBJECT.ZCRYPTOWRAPPEDKEY, ZICCLOUDSYNCINGOBJECT.ZISPASSWORDPROTECTED, \" +\n \"ZICCLOUDSYNCINGOBJECT.ZMODIFICATIONDATE1, ZICCLOUDSYNCINGOBJECT.ZCREATIONDATE1, \" +\n \"ZICCLOUDSYNCINGOBJECT.ZTITLE1, ZICCLOUDSYNCINGOBJECT.ZACCOUNT3, \" +\n \"ZICCLOUDSYNCINGOBJECT.ZACCOUNT2, ZICCLOUDSYNCINGOBJECT.ZFOLDER \" + \n \"FROM ZICNOTEDATA, ZICCLOUDSYNCINGOBJECT \" + \n \"WHERE ZICNOTEDATA.ZNOTE=? AND ZICCLOUDSYNCINGOBJECT.Z_PK=ZICNOTEDATA.ZNOTE\"\n folder_field = \"ZFOLDER\"\n account_field = \"ZACCOUNT3\"\n note_id_field = \"ZNOTE\"\n\n # In version 12, what is now in ZACCOUNT3 (the account ID) was in ZACCOUNT2\n if @version == IOS_VERSION_12\n account_field = \"ZACCOUNT2\"\n end\n\n # In version 11, what is now in ZACCOUNT3 was in ZACCOUNT2 and the ZFOLDER field was in a completely separate table\n if @version == IOS_VERSION_11\n query_string = \"SELECT ZICNOTEDATA.Z_PK, ZICNOTEDATA.ZNOTE, \" + \n \"ZICNOTEDATA.ZCRYPTOINITIALIZATIONVECTOR, ZICNOTEDATA.ZCRYPTOTAG, \" + \n \"ZICNOTEDATA.ZDATA, ZICCLOUDSYNCINGOBJECT.ZCRYPTOVERIFIER, \" + \n \"ZICCLOUDSYNCINGOBJECT.ZCRYPTOSALT, ZICCLOUDSYNCINGOBJECT.ZCRYPTOITERATIONCOUNT, \" + \n \"ZICCLOUDSYNCINGOBJECT.ZCRYPTOWRAPPEDKEY, ZICCLOUDSYNCINGOBJECT.ZISPASSWORDPROTECTED, \" +\n \"ZICCLOUDSYNCINGOBJECT.ZMODIFICATIONDATE1, ZICCLOUDSYNCINGOBJECT.ZCREATIONDATE1, \" +\n \"ZICCLOUDSYNCINGOBJECT.ZTITLE1, ZICCLOUDSYNCINGOBJECT.ZACCOUNT2, \" +\n \"Z_11NOTES.Z_11FOLDERS \" + \n \"FROM ZICNOTEDATA, ZICCLOUDSYNCINGOBJECT, Z_11NOTES \" + \n \"WHERE ZICNOTEDATA.ZNOTE=? AND ZICCLOUDSYNCINGOBJECT.Z_PK=ZICNOTEDATA.ZNOTE AND Z_11NOTES.Z_8NOTES=ZICNOTEDATA.ZNOTE\"\n folder_field = \"Z_11FOLDERS\"\n account_field = \"ZACCOUNT2\"\n end\n\n # In the legecy version, everything is different\n if @version == IOS_LEGACY_VERSION\n query_string = \"SELECT ZNOTE.Z_PK, ZNOTE.ZCREATIONDATE as ZCREATIONDATE1, \" + \n \"ZNOTE.ZMODIFICATIONDATE as ZMODIFICATIONDATE1, ZNOTE.ZTITLE as ZTITLE1, \" + \n \"ZNOTEBODY.ZCONTENT as ZDATA, ZSTORE.Z_PK as ZFOLDER, ZSTORE.ZACCOUNT \" +\n \"FROM ZNOTE, ZNOTEBODY, ZSTORE \" +\n \"WHERE ZNOTE.Z_PK=? AND ZNOTEBODY.Z_PK=ZNOTE.ZBODY AND ZSTORE.Z_PK=ZNOTE.ZSTORE\"\n folder_field = \"ZFOLDER\"\n account_field = \"ZACCOUNT\"\n note_id_field = \"Z_PK\"\n end\n\n # Execute the query\n @database.execute(query_string, note_id) do |row|\n # Create our note\n tmp_account = get_account(row[account_field])\n tmp_folder = get_folder(row[folder_field])\n tmp_note = AppleNote.new(row[\"Z_PK\"], \n row[note_id_field],\n row[\"ZTITLE1\"], \n row[\"ZDATA\"], \n row[\"ZCREATIONDATE1\"], \n row[\"ZMODIFICATIONDATE1\"],\n tmp_account,\n tmp_folder,\n self)\n tmp_account.add_note(tmp_note) if tmp_account\n tmp_folder.add_note(tmp_note) if tmp_folder\n\n # If this is protected, add the cryptographic variables\n if row[\"ZISPASSWORDPROTECTED\"] == 1\n tmp_note.add_cryptographic_settings(row[\"ZCRYPTOINITIALIZATIONVECTOR\"], \n row[\"ZCRYPTOTAG\"], \n row[\"ZCRYPTOSALT\"],\n row[\"ZCRYPTOITERATIONCOUNT\"],\n row[\"ZCRYPTOVERIFIER\"],\n row[\"ZCRYPTOWRAPPEDKEY\"])\n #tmp_note.decrypt_with_password(\"password\")\n end\n @notes[tmp_note.note_id] = tmp_note\n end\n end", "def body\n @note.content\n end", "def add_note(note)\n response = self.class.put(url(self.id), :query => {:notes => note}, :body => \"\") # nginx reject requests without body\n\n if response.code == 200\n return true\n else\n raise response.response\n end\n end", "def new\n @word_note = WordNote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @word_note }\n end\n end", "def note_content\n\t\tif self.note.present?\n\t\t\tself.note.content\n\t\telse\n\t\t\t\"-\"\n\t\tend\n\tend", "def synopsis_note\n note = @strip['note']\n syn = @strip['synopsis']\n if note.nil?\n syn\n else\n \"#{syn} #{note}\"\n end\n end", "def handle_import_document_reference(object, attrs, key, warnings, options = {})\n defaults = { :warning_key => key }\n options = defaults.merge(options)\n\n warning_key = options[:warning_key]\n ref_string = attrs.delete(key)\n\n if ref_string.present?\n documents = parse_document_reference(ref_string).map do |ref|\n if ref[:link].blank?\n warnings[warning_key.to_sym] ||= []\n warnings[warning_key.to_sym] << \"invalid reference (references must be formatted as follows: \\\"[www.yoururl.com Reference Title]\\\")\"\n nil\n else\n begin\n Document.find_or_create_by_link!(ref)\n rescue\n warnings[warning_key.to_sym] ||= []\n warnings[warning_key.to_sym] << \"invalid reference URL\"\n nil\n end\n end\n end.compact\n object.documents = documents\n end\n end", "def reference_credit_note\n object.credit_note_ref.to_s\n end", "def show\n @notes = @bookmark.notes\n end", "def updateNote(key,noteText)\n refreshToken\n path = \"/api/note?key=#{key}\\&auth=#{@token}\\&email=#{@email}&modify=#{ERB::Util.url_encode(Time.now.strftime(\"%Y-%m-%d %H:%M:%S\"))}\"\n data = noteText\n payload = Base64.encode64(data)\n response, data = agent.post(path,payload)\n\n unless response.code.to_i == 200\n raise \"Failed to update Note \\'#{key}\\'\"\n end\n return response.body\n end", "def get_document_info\n\n begin\n\n str_uri = $product_uri + '/words/' + @filename\n signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n\n response_stream = RestClient.get(signed_str_uri, {:accept => 'application/json'})\n\n stream_hash = JSON.parse(response_stream)\n stream_hash['Code'] == 200 ? stream_hash['Document'] : false\n\n rescue Exception => e\n print e\n end\n\n end", "def draft_release_notes_text\n extra_javascript 'docs'\n @hard_wrap = params[:hard_wrap]\n @bugs = sorted_bugs.select(&:doc_text_required?)\n end", "def issue_notes_for(name, version, issues, notes)\n notes << \"\\n### #{name} Issues resolved for #{version}\\n\\n\"\n do_references = ENV['REFERENCES']\n\n issues.reverse.each do |issue|\n if do_references\n notes << %Q{[#{issue[0]}]:#{issue[2]}\\n}\n else\n notes << %Q{- [#{issue[0]} - #{issue[1]}](#{issue[2]})\\n}\n end\n end\n notes\nend" ]
[ "0.6204273", "0.6130791", "0.6130684", "0.60005224", "0.59732217", "0.59448814", "0.5924261", "0.59074587", "0.58917123", "0.58571905", "0.5809384", "0.5803652", "0.5802366", "0.57787323", "0.57570773", "0.57346076", "0.5729203", "0.57263875", "0.57116216", "0.5672291", "0.56334287", "0.562946", "0.56092465", "0.56092465", "0.55745393", "0.5572918", "0.55659604", "0.5554775", "0.554098", "0.5532214", "0.5532214", "0.55291504", "0.5527903", "0.5527903", "0.5519626", "0.55155236", "0.55140156", "0.55140156", "0.5502306", "0.5497869", "0.5476765", "0.5474987", "0.5469934", "0.5462667", "0.5456736", "0.5445891", "0.54431593", "0.5441821", "0.54390883", "0.54319024", "0.54319024", "0.54319024", "0.54319024", "0.54219896", "0.54219896", "0.54219896", "0.54219896", "0.54096204", "0.5357539", "0.53529596", "0.5346176", "0.53426886", "0.5332708", "0.53306824", "0.53305256", "0.5324733", "0.532293", "0.52889884", "0.5286458", "0.52825975", "0.5277893", "0.52664024", "0.5263391", "0.52578753", "0.5255982", "0.5240414", "0.5233235", "0.5225874", "0.52252066", "0.5211491", "0.52064097", "0.5204316", "0.5198798", "0.51977456", "0.5190508", "0.5190508", "0.5190508", "0.5182026", "0.5179196", "0.51748186", "0.5172725", "0.516403", "0.51578295", "0.51565707", "0.5154237", "0.51491433", "0.5126873", "0.5125275", "0.51228154", "0.51219165", "0.5107299" ]
0.0
-1
This method takes three parameters: (1) An input file object containing the log messages that need to be translated (2) An output file object to write the translated messages to (3) The depth of the translations The input file object should be open for reading, while the output file object should be open for writing. TODO: This should eventually be multithreaded. Have each thread translate its own chunk of the parsed out messages, returning an array of translated messages. Then combine these messages together and print them out to the output file.
def reverse_translate(input_file, output_file, depth) LogParser.parse(input_file).each do |log_message| @tables[0].reverse_translate(log_message, depth) output_file.puts(log_message) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_file(filename, locale, output_locale)\n\n def assemble(templ, local)\n # If already assembling the string\n return local unless templ.is_a?(Hash)\n\n # If templ is a hash but local is nil, it means that the entire current \n # branch is not yet translated. Therefore create an empty hash to act as\n # placeholder\n local = {} if local.nil?\n\n # Recursing to traverse hash\n pairs = templ.collect { |k, v| [k, assemble(v, local[k])] }\n Hash[pairs]\n end\n\n def validate(node, path)\n if node.nil?\n puts \"Warning: path #{path} is nil. \"\n return\n end\n\n return unless node.is_a?(Hash)\n\n node.each { |k, v| validate(v, \"#{path}.#{k}\") }\n end\n\n puts \"Processing file #{filename} of locale #{locale}. \"\n\n # Directories\n locales_dir = Rails.root.join('config/locales')\n templ_dir = locales_dir.join('template')\n local_dir = locales_dir.join(locale)\n output_dir = locales_dir.join(output_locale)\n\n # Loading template\n templ_file = templ_dir.join(filename)\n templ = YAML::load_file(templ_file)['template']\n\n # If the topmost level of the template is not 'template'\n if !templ\n puts \"Warning: Template is nil for #{filename}. Aborting for this file. \"\n return\n end\n\n # Loading localized YAML\n local_file = local_dir.join(filename)\n local = File.exists?(local_file) ? YAML::load_file(local_file)[locale] : {}\n\n # Alert for new file creation\n puts \"Warning: Creating new file #{filename} of locale #{locale}. \" unless File.exists?(local_file)\n\n # Assemble localized strings into template file\n assembled = assemble(templ, local)\n\n # Validate to find missed translations\n validate(assembled, locale)\n\n # Output to file\n output_file = output_dir.join(filename)\n FileUtils.mkdir_p output_file.dirname\n content = {locale => assembled}.to_yaml\n File.open(output_file, 'w') { |f| f.write(content) }\n\n end", "def transform_files!(files, type) \n files.each do |file|\n parsed = \"\"\n namespace = [DEFAULT_LANGUAGE, 'txt', type] + Base.get_namespace(file, type)\n puts \"Converting: \" + file + \" into namespace: \"\n puts namespace.map {|x| \"[\\\"#{x}\\\"]\"}.join(\"\")\n \n n = Namespace.new(namespace)\n \n contents = Base.get_file_as_string(file)\n parsed << GettextI18nConvertor.string_to_i18n(contents, n)\n \n #puts parsed\n # write the file\n \n File.open(file, 'w') { |file| file.write(parsed)}\n \n \n \n n.merge(@translations)\n end\n end", "def convert\n # TODO: implementation\n output_file = choose_output\n return if output_file.nil?\n Converter.translate(@file, output_file)\n log(\"File conversion finished\")\n end", "def translate_log_file map, log_file\n state = :rs\n file_id = nil\n file = nil\n line = nil\n lineno = nil\n parameters_length = nil\n parameter_bytes = nil\n\n log_file.each_byte do |b|\n case state\n when :rs\n parameter_bytes = []\n state = :file_id_lo\n when :file_id_lo\n file_id = b\n state = :file_id_hi\n when :file_id_hi\n file_id += b * 256\n file = map[file_id]\n if file\n state = :lineno_lo\n else\n $stderr.puts \"File ID #{file_id} not found in map\"\n state = :lingering\n end\n when :lineno_lo\n lineno = b\n state = :lineno_hi\n when :lineno_hi\n lineno += b * 256\n line = file[:lines][lineno]\n state = :parameters_length\n when :parameters_length\n parameters_length = b % 128\n if parameters_length > 0\n state = :parameters\n else\n state = :checksum\n end\n when :parameters\n parameter_bytes << b\n parameters_length -= 1\n if parameters_length == 0\n state = :checksum\n end\n when :checksum\n if line\n parameters = split_parameter_bytes file, line, parameter_bytes\n message = format_log_message(file, lineno, line, parameters)\n puts message\n else\n $stderr.puts \"#{file[:file_name]}@#{lineno}: Line not found in map\"\n end\n state = :rs\n end\n end\nend", "def export(data, indent=0)\n target = data[@translate.lang]\n xml = <<EOF\n<?xml version=\"1.0\" encoding=\"#{@translate.options[:encoding]}\"?>\n<!DOCTYPE TS>\n<TS version=\"2.0\" language=\"#{@translate.lang}\">\nEOF\n\n keys = I18n::Translate.hash_to_keys(target).sort\n keys.each do |key|\n value = @translate.find(key, target)\n next unless value\n\n if value.kind_of?(String) || value.kind_of?(Array) || value.kind_of?(Integer)\n fuzzy = (value.to_s.empty?) ? %~ type=\"unfinished\"~ : \"\"\n xml += <<EOF\n <context>\n <name>#{::CGI.escapeHTML(key)}</name>\n <message>\n <source>#{::CGI.escapeHTML(@translate.find(key, @translate.default).to_s)}</source>\n <translation#{fuzzy}>#{::CGI.escapeHTML(value.to_s)}</translation>\n </message>\n </context>\nEOF\n else\n fuzzy = ((value[\"flag\"] == \"ok\") or value[\"flag\"].to_s.strip.empty?) ? \"\" : (value[\"flag\"] == \"obsolete\") ? %~ type=\"obsolete\"~ : %~ type=\"unfinished\"~\n xml += <<EOF\n <context>\n <name>#{::CGI.escapeHTML(key)}</name>\n <message>\nEOF\n if value[\"file\"] or value[\"line\"]\n xml += <<EOF\n <location filename=\"#{::CGI.escapeHTML(value[\"file\"].to_s)}\" line=\"#{::CGI.escapeHTML(value[\"line\"].to_s)}\" />\nEOF\n end\n xml += <<EOF\n <source>#{::CGI.escapeHTML(value[\"default\"].to_s)}</source>\nEOF\n unless value[\"old_default\"].to_s.empty?\n xml += <<EOF\n <oldsource>#{::CGI.escapeHTML(value[\"old_default\"].to_s)}</oldsource>\nEOF\n end\n unless value[\"extracted_comment\"].to_s.empty?\n xml += <<EOF\n <extracomment>#{::CGI.escapeHTML(value[\"extracted_comment\"].to_s)}</extracomment>\nEOF\n end\n unless value[\"comment\"].to_s.empty?\n xml += <<EOF\n <translatorcomment>#{::CGI.escapeHTML(value[\"comment\"].to_s)}</translatorcomment>\nEOF\n end\n xml += <<EOF\n <translation#{fuzzy}>#{::CGI.escapeHTML(value[\"translation\"].to_s)}</translation>\nEOF\n unless value[\"flag\"].to_s.strip.empty?\n xml += <<EOF\n <extra-po-flags>#{::CGI.escapeHTML(value[\"flag\"].to_s.strip)}</extra-po-flags>\nEOF\n end\n xml += <<EOF\n </message>\n </context>\nEOF\n end\n end\n\n xml += <<EOF\n</TS>\nEOF\n xml\n end", "def write_to_file keys\n init_translations_and_ignore_app_mode_file_dump if self.class.mode == :origin\n # Hash to capture the files updated on origin mode and the keys for each one\n result = {}\n keys.each do |key, value|\n #\n # Search the files where the translation will be applied to\n decide_filenames(key).each do |filename| \n (result[filename] ||= []) << key\n # Apply the current translation to the filenames\n #\n # It will save a key 'ubiquo.categories.index.title' with a value 'Title'\n # mergin the content of $filename with it\n #\n # Load the file\n hash = YAML.load_file(filename)\n # Morph the translation key\n # from: 'ubiquo.categories.index.title'\n # to: { :ubiquo => {\n # :categories => {\n # :index => {\n # :title => 'Title'\n # }\n # }\n # }\n # }\n # }\n branch_hash = Translate::Keys.to_deep_hash({key => value})\n #\n # Cast all the hash keys to String\n #\n branch_hash = Translate::File.deep_stringify_keys({self.locale => branch_hash})\n #\n # Merge the translation with the content of the file\n #\n #\n hash.deep_merge!(branch_hash)\n #\n # Save to file updated to disk\n Translate::File.new(filename).write(hash)\n end \n end\n result\n end", "def transform_files!(files, type) \n files.each do |file|\n @file = file\n @type = type\n parsed = \"\"\n @dirnames = Base.get_namespace(file,type) # directories after the app/type/ directory\n \n namespaces = LANGUAGES.collect do |lang|\n if type == 'views'\n namespace = [lang] + @dirnames\n else\n namespace = [lang, type] + @dirnames\n end\n \n puts \"Converting: \" + file + \" into namespace: \"\n puts namespace.map {|x| \"[\\\"#{x}\\\"]\"}.join(\"\")\n \n Namespace.new(namespace,lang)\n end\n\n contents = Base.get_file_as_string(file)\n parsed << GettextI18nConvertor.string_to_i18n(contents, namespaces, type)\n \n # write the app/type/file with new i18n format instead of gettext\n File.open(file, 'w') { |file| file.write(parsed)}\n \n namespaces.each do |ns|\n new_file_handler(ns)\n end\n end\n end", "def process\n unless File.exists?(@translation_file)\n raise Mongify::Mongoid::TranslationFileNotFound, \"Unable to find Translation File at #{@translation_file}\"\n end\n\n generate_models\n process_fields\n generate_embedded_relations\n write_models_to_file\n nil\n end", "def main\n #TODO: open in binary mode for Windows\n map_file = File.open(ARGV[0])\n map = load_map_file(map_file)\n log_file = File.new(ARGV[1])\n translate_log_file(map, log_file)\nend", "def parse_translation_file(pattern, model)\n # check if all languages have an associated column name\n Florensia::Language.all.map(&:name).each do |l|\n next if model.columns.map(&:name).include?(l)\n error \"Fatal error: '#{l}' not found in column names of {model.name} but within Florensia::Language\"\n raise \"Translation/Description Language Error\"\n end\n\n batch(Dir[pattern]) do |f|\n data = open(f).read # reading file\n data.encode!('utf-8', 'utf-16') # fix encoding\n data = data.split(\"\\r\\n\") # split into lines\n data.pop # delete __END\n\n # working on header/languages\n header = data.shift.downcase.split(\"\\t\")\n header.shift # 'Code' an identifier, not a language\n #check if we have all languages in our system\n header.delete(\"name\") # that's not a language but is included in Descriptions\n header.each do |l|\n next if model.columns.map(&:name).include?(l)\n error \"Fatal error: '#{l}' not found in column names of #{model.name}\"\n raise \"Translation/Description Language Error\"\n end\n\n # working on the datasets itself\n data.each do |line|\n line = line.split(\"\\t\")\n code = line.shift #first column is the identifier\n line.shift if model == Florensia::Description #second column is unused 'name' in description files\n line.collect!{|text| text.gsub('\\n', \"\\n\")} #fix line breaks\n t = model.where(code: code).first_or_initialize\n t.update_attributes(Hash[header.zip(line)])\n end\n end\n end", "def transform index_file\n InputBatch.log.info \"Opened txt file for processing\"\n puts \"Opened txt file for processing\"\n InputBatch.log.info \">>Index Transformation Starts \" + Time.now.to_s\n puts \">>Index Transformation Starts \" + Time.now.to_s\n @jobs = []\n @txt_lines = File.readlines(index_file)\n txt_lines.each do |row|\n @row = row.chomp\n save_records\n end\n\n puts \">>Index Transformation Ends \" + Time.now.to_s\n InputBatch.log.info \">>Index Transformation Ends \" + Time.now.to_s\n end", "def translate(filename)\r\n\t\t@array_translate = []\r\n\t\tFile.open(filename).each do |line|\r\n\t\t\t@array_translate << line.split\r\n\t\tend\r\n\tend", "def translate(src_lang, target_lang, output_file)\n # Check if a non empty output file is present and error out to avoid\n # the danger or overwriting some important file !!\n if File.exists?(output_file) && File.size(output_file) > 0\n raise InvalidInputException.new(\"Output file #{output_file} is not empty.\")\n else\n # Just open the file in writable mode and close it just to ensure that\n # we can write the output file\n File.open(output_file, \"w\") {|f|\n }\n end\n # Check if the file is writable ?\n unless File.writable?(output_file)\n raise InvalidInputException.new(\"Output file #{output_file} not writable.\")\n end\n # Further checks can be done only in caption specific implementations\n # or translation engine specific implementation\n end", "def parse\n @parsed_values = {}\n @buffer = {}\n @last_key_type = \"\"\n @errors = []\n File.foreach(@path_to_po) do |line|\n line = line.chomp\n case line\n # Empty lines means we have parsed one full message\n # so far and need to flush the buffer\n when /^$/ then flush_buffer\n\n # These are the po file comments\n # The second '#' in the following regex is in square brackets\n # b/c it messed up my syntax highlighter, no other reason.\n when /^(#[^~]|[#]$)/ then next\n\n when /^(?:#~ )?msgctxt\\s+(.*)/ then add_to_buffer($1, :msgctxt)\n\n when /^(?:#~ )?msgid\\s+(.*)/ then add_to_buffer($1, :msgid)\n\n when /^(?:#~ )?msgid_plural\\s+(.*)/ then add_to_buffer($1, :msgid_plural)\n\n when /^(?:#~ )?msgstr\\s+(.*)/ then add_to_buffer($1, :msgstr_0)\n\n when /^(?:#~ )?msgstr\\[0\\]\\s+(.*)/ then add_to_buffer($1, :msgstr_0)\n\n when /^(?:#~ )?msgstr\\[(\\d+)\\]\\s+(.*)/ then add_to_buffer($2, \"msgstr_#{$1}\".to_sym)\n\n when /^(?:#~ )?\"/ then add_to_buffer(line)\n\n else\n @errors << [\"Strange line #{line}\"]\n end\n end\n\n # In case the file did not end with a newline, we want to flush the buffer\n # one more time to write the last message too.\n flush_buffer\n\n # This will turn the header values into a friendlier json structure too.\n parse_header_lines\n\n return @parsed_values\n end", "def parse_log_file(file)\n File.open(file) { |input|\n input.each_line.inject(Array.new) { |acc, text|\n entry = restartable do\n restart :skip_log_entry do\n leave\n end\n parse_log_entry(text)\n end\n entry ? acc << entry : acc\n }\n }\nend", "def load_translations_and_collect_file_errors(files); end", "def parse_log_file0(file)\n File.open(file) { |input|\n input.each_line.inject(Array.new) { |acc, text|\n entry = handling do\n handle MalformedLogEntryError do\n end\n parse_log_entry(text)\n end\n entry ? acc << entry : acc\n }\n }\nend", "def translate(from, to, options={})\n stages = %w{packed unpacked cataloged decoded compressed baked compressed_baked}\n @directories = {}\n @symlinks = {}\n stages.each do |stage|\n @directories[stage.to_sym] = File.expand_path(File.join(to, stage))\n @symlinks[stage.to_sym] = options[:links] + '_' + stage if options[:links]\n end\n do_translate_steps(options).each do |step|\n case step\n when 'pull'\n # TODO DRY this up\n warn \"Pull files from the original archive\" unless options[:quiet]\n clear_stage :packed, options\n pull from, @directories[:packed], force: options[:force], quiet: options[:quiet]\n build_symlink :packed if options[:links] && options[:force]\n when 'unpack'\n warn \"Unpack the files (from Honeywell binary format)\" unless options[:quiet]\n clear_stage :unpacked, options\n clear_stage :cataloged, options\n unpack @directories[:packed], @directories[:unpacked], \n flatten: options[:flatten], strict: options[:strict], fix: options[:fix], \n force: options[:force], quiet: options[:quiet]\n build_symlink :unpacked if options[:links] && options[:force]\n when 'catalog'\n warn \"Catalog the files (using a catalog file)\" unless options[:quiet]\n raise MissingCatalog, \"No catalog specified\" unless options[:catalog]\n clear_stage :cataloged, options\n catalog @directories[:unpacked], @directories[:cataloged], :catalog=>options[:catalog], \n force: options[:force], quiet: options[:quiet]\n build_symlink :cataloged if options[:links]\n when 'decode'\n warn \"Decode the files\" unless options[:quiet]\n from = if File.exists?(@directories[:cataloged])\n @directories[:cataloged]\n else\n @directories[:unpacked]\n end\n clear_stage :decoded, options\n decode from, @directories[:decoded], force: options[:force], quiet: options[:quiet]\n build_symlink :decoded if options[:links] && options[:force]\n when 'compress'\n warn \"Compress the files\" unless options[:quiet]\n from = @directories[:decoded]\n clear_stage :compressed, options\n compress @directories[:decoded], @directories[:compressed], \n aggressive: options[:aggressive], link: options[:link],\n force: options[:force], quiet: options[:quiet]\n build_symlink :decoded if options[:links] && options[:force]\n when 'bake'\n warn \"Bake the files (i.e. remove metadata)\" unless options[:quiet]\n clear_stage :baked, options\n bake @directories[:compressed], @directories[:baked], force: options[:force], quiet: options[:quiet],\n index: options[:index]\n build_symlink :baked if options[:links] && options[:force]\n when 'tests'\n warn \"Rebuild test cases\" unless options[:quiet]\n cmd = 'bun test build'\n cmd += ' --quiet' if options[:quiet]\n system(cmd)\n else\n raise InvalidStep, \"Unknown step #{step}\"\n end\n end\n end", "def trans_enemies\n b = []\n a = \"\"\n for i in $data_enemies\n if i != nil and i.name != nil\n oldname = i.name.split(/\\//)[0]\n oldname = oldname.gsub(\"【data】\", \"\").gsub(\"【fix】\",\"\") if oldname.is_a?(String)\n if oldname!= \"\" and oldname!= nil #and oldname.translation_check != i.UK_name\n a = \"when \" + i.id.to_s + \" \\#\" + oldname + \"\\n\"\n b.push(a)\n a = \" return \\\"\" + i.UK_name + \"\\\"\"\n a = a + \" ***TODO\" if oldname == i.UK_name\n a = a + \"\\n\"\n b.push(a)\n end\n end\n end\n open(\"zzz.txt\",\"a+\") do |log|\n log.puts b\n end\nend", "def translate(lines, output_buffer)\n output_buffer.output_type = :start\n lines.each { |line| output_buffer.insert(line) }\n output_buffer.flush!\n output_buffer.pop_mode while output_buffer.current_mode\n output_buffer.output_footnotes!\n output_buffer.output\n end", "def transPt2Heroes\n pageNum = 1\n translatedFile = File.join('..', 'translatedData', \"ToTranslate_Heroes_#{pageNum}.txt\")\n heroes = @rawData[@cf::HEROES]\n while (File.exist?(translatedFile))\n dataFromFile = readPartitionedFile(translatedFile, File.read(translatedFile))\n dataFromFile.each do |heroTranslation|\n hero = heroes[heroTranslation[@cf::HERO_ID]]\n hero[@cf::NAME_JP] = hero[@cf::NAME]\n hero[@cf::NAME] = heroTranslation[@cf::NAME]\n \n heroUlt = hero[@cf::ULT]\n translatedUlt = heroTranslation[@cf::ULT]\n heroUlt[@cf::NAME_JP] = heroUlt[@cf::NAME]\n heroUlt[@cf::NAME] = translatedUlt[@cf::NAME]\n heroUlt[@cf::DESC] = translatedUlt[@cf::DESC]\n end\n pageNum += 1\n translatedFile = File.join('..', 'translatedData', \"ToTranslate_Heroes_#{pageNum}.txt\")\n end\n end", "def convert\n puts \"\\n--------------------------------\"\n puts \"Transforming #{File.extname(@file)} file to .#{@type} format...\"\n \n runHardklor if @hardklor && @file.downcase.include?(\".mzxml\")\n \n if @type == \"mgf\" || @type == \"ms2\"\n Ms::Msrun.open(@file) do |ms|\n file = @file.chomp(File.extname(@file)) + \"_#{@run}.#{@type}\"\n File.open(file, 'w') do |f|\n f.puts eval(\"ms.to_#{@type}\")\n end\n end\n else\n # If ms-msrun can't do it, then this might. Do something here to include run number. Doesn't work with Refiner, so\n # this is probably pointless to even have.\n #\n # And why do we run our own code to transform mzML instead of TPP?\n # 1) Prince said so\n # 2) I hate the TPP. The people who put that together don't deserve to be called programmers. I mean, come on! Methods\n # should never be longer than 100 lines of code, yet they've got methods that are over 1000 lines of code! Ack! It\n # just makes my skin crawl!\n system(\"/usr/local/src/tpp-4.3.1/build/linux/MzXML2Search -#{@type} #{@file}\")\n end\n end", "def process_one_dir(dir)\n Dir.glob(dir + '/*.txt') do |log_file|\n\n File.open(log_file, \"r\") do |infile|\n size = \"UNKNOWN\"\n jobid = \"UNKNOWN\"\n error = \"NO\"\n while (line = infile.gets)\n if (line.strip == \"------------------------------------------\")\n jobid, nnodes, ntasks, query, dbsize, run, nsplits, nrecords = parse_log_header(infile)\n next\n end\n if (line.include? \"VP:partitioningTime\")\n partitioningTime = line.split(\"VP:partitioningTime:\")[1].strip\n partitioningTime.sub!(\"ms\",\"\").strip!\n end\n if (line.include? \"Running job:\")\n hadoopjob = line.split(\"Running job:\")[1].strip\n end\n if (line.include? \"COMPOSING_TIME_LOAD_PARTIALS=\")\n loadpartials = line.split(\"COMPOSING_TIME_LOAD_PARTIALS=\")[1].strip\n end \n if (line.include? \"COMPOSING_TIME_COMBINE_PARTIALS=\")\n combinepartials = line.split(\"COMPOSING_TIME_COMBINE_PARTIALS=\")[1].strip\n end \n if (line.include? \"Copy result time:\")\n transferResult = line.split(\"Copy result time:\")[1].strip\n transferResult.sub!(\"ms.\",\"\").strip!\n end \n if (line.include? \"Total execution time:\")\n totaltime = line.split(\"Total execution time:\")[1].strip\n totaltime.sub!(\"ms.\",\"\").strip!\n end \n if (line.include? \"Size of output\")\n size = line.split(\":\")[1]\n size = size.split(\" \")[0].strip\n end\n if (line.include? \"Error\")\n error = \"YES\"\n end\n if (line.include? \"Failed reduce tasks\")\n if line.split(\"=\")[1].strip.to_i > 0\n error = \"YES\"\n end\n end\n if (line.include? \"Failed map tasks\")\n if line.split(\"=\")[1].strip.to_i > 0\n error = \"YES\"\n end\n end\n end\n nfragments = nsplits.to_i * nrecords.to_i\n puts \"#{jobid};#{hadoopjob};#{nnodes};#{nnodes.to_i * ntasks.to_i};#{query};#{run};#{dbsize};#{ntasks};#{nfragments};#{nsplits};#{nrecords};#{partitioningTime};#{loadpartials};#{combinepartials};#{transferResult};#{totaltime};#{size};#{error}\"\n end\n end\nend", "def translate(lang_from = @lang_from, lang_to = @lang_to, words)\n return [] if words.size == 0\n all_translated = [] #array of all translated words\n words.each_slice(800) do |slice| #slice into 1000 words doing >1000 runs into problems\n words_string = slice.join(\"&text=\")\n uri = \"https://translate.yandex.net/api/v1.5/tr.json/translate?key=APIkey&lang=FROM-TO&text=WORD\"\n uri = uri.sub(\"WORD\",words_string).sub(\"FROM\", lang_from).sub(\"TO\", lang_to).sub(\"APIkey\", @key)\n uri = URI.escape(uri) #escape unsafe characters in uri\n begin\n #puts uri\n #puts '****************************'\n json = open(uri).read #open uri of yandex translation\n rescue => e\n puts e.message\n end\n translated = JSON.parse(json)[\"text\"]\n #should probably check to make sure translated != nil\n if translated.nil?\n puts \"PROBLEM TRANSLATING - returned nil (URI may be too long)\"\n else\n all_translated += translated\n end\n end\n all_translated #return array of all translations\n end", "def translate_file(inp, literal=false)\n pn = Pathname.new(inp)\n # check file exists\n if pn.exist?\n # open and read\n text = File.open(inp).read\n ruleset = text.gsub(/\\r\\n?/, \"\\n\").split(\"\\n\") # split into rules\n out = \"\"\n # feed rules into converter and put output into variable\n ruleset.each { |rule| out << \"#{Phomo2Sce.new(rule).to_sce(literal)}\\n\" }\n out # return translated file\n else\n puts \"Error! Could not find file with path #{inp}\"\n end\nend", "def doing_textuals\n consumer = Fiber.new do |producer, queue|\n f = open(\"./tmp/insert_internals.txt\", \"a\") do |f| \n loop do\n queue = producer.transfer(consumer, queue)\n f.puts << queue\n queue.clear\n end\n raise StopIteration\n end\n end\n producer = Fiber.new do |consumer, queue|\n list = File.readlines(file_name)\n list = File.readlines(\"./lib/anagrams/anagrams_table_data.txt\")\n #list = File.readlines(\"./lib/anagrams/anagrams_table_data.txt\")\n full_list = list.sort_by { |x| x.downcase }\n #b = IO.readlines(file_name)\n #b = IO.readlines(ARGV)\n #b = IO.readlines(\"./lib/the_input.txt\")\n loop do\n while a = full_list.shift\n queue = a.to_textual unless nil\n consumer.transfer queue\n queue.clear\n end\n raise StopIteration\n end\n end\n consumer.transfer(producer, [])\n after_break\n end", "def translate\n @actions.each do |a|\n self.send(:\"parse_#{a['type'].gsub('-','_')}\", a)\n end\n @output = @output.split(\"\\n\").collect {|l| l.strip}.join(\"\\n\")\n end", "def main\n # check those arguments\n usage if ARGV[0].nil?\n target = ARGV[0].strip\n maildir = \"#{ENV['HOME']}/Library/Mail\"\n maildir = ARGV[1].strip unless ARGV[1].nil?\n puts \"Using source directory of '#{maildir}'...\"\n puts \"Using target directory of '#{target}'...\"\n deliveries = 0\n\n # make the target directory\n File.umask(077)\n FileUtils.mkdir(target)\n\n # for each dir in source dir matching /\\.mbox$/ (recursive)\n $stdout.sync = true\n traverse(maildir, /\\.mbox$/) do |dir|\n d = \"#{dir}/Messages\"\n next unless FileTest.directory?(d)\n new_d = new_maildir(target, maildir, d)\n\n # for each filename matching /\\.emlx$/\n msgs = 0\n Dir.entries(d).each do |file|\n next unless file =~ /\\.emlx$/\n msgs += 1\n\n # load all lines of source file into array\n lines = IO.readlines(\"#{d}/#{file}\")\n\n # remove first line from array\n lines.delete_at(0)\n\n # from the end of the array, look for \"</plist>\"; until we find\n # the matching \"<?xml...>\" line, we drop each line from the\n # array\n raise \"Invalid file format\" unless lines[-1] =~ /^<\\/plist>/\n last = \"\"\n flags = 0\n lines.reverse_each do |line|\n break if last =~ /^<\\?xml version=\"1.0\" encoding=\"UTF-8\"\\?>/\n if line =~ /<key>flags<\\/key>/\n flags = last.sub(/<integer>/, \"\").sub( /<\\/integer>.*/, \"\").to_i\n end\n last = lines[-1].dup\n lines.delete_at(-1)\n end\n\n # open new Maildir-formatted filename in target dir ($TARGET)\n deliveries += 1\n n = maildirname(deliveries, flags)\n File.open(new_d + \"/\" + n, \"w+\") do |f|\n lines.each { |x| f.print x }\n end\n\n print sprintf(\"\\r%s %d\", \"Converting #{dir}...\", msgs)\n end\n puts unless msgs.zero?\n end\nend", "def writeToFilePartitioned(dataToWrite, fileNamePrefix)\n pageNum = 1\n charCount = 0\n #Array of hero dicts\n writeQueue = ''\n dataToWrite.each do |data|\n writeQueueTemp = ''\n charCountTemp = 4\n data.map do |k, v|\n #For Ult\n if (v.is_a?(Hash))\n v.map do |k2, v2|\n charCountTemp += v2.length + 1\n writeQueueTemp += \"#{v2}\\n\"\n end\n else\n charCountTemp += v.length + 1\n writeQueueTemp += \"#{v}\\n\"\n end\n end\n writeQueueTemp += \"---\\n\"\n \n if ((charCount + charCountTemp) <= 4800)\n writeQueue += writeQueueTemp\n charCount += charCountTemp\n else\n File.open(File.join('..', 'toTranslateData', fileNamePrefix + \"_#{pageNum}.txt\"), 'w') { |f| f.write(writeQueue)}\n charCount = charCountTemp\n writeQueue = writeQueueTemp\n pageNum += 1\n end\n end\n\n if (charCount != 0)\n File.open(File.join('..', 'toTranslateData', \"#{fileNamePrefix}_#{pageNum}.txt\"), 'w') {|f| f.write(writeQueue)}\n end\n end", "def thread_message! message\n startt = Time.now\n\n ## build the path of msgids from leaf to ancestor\n ids = [message.safe_msgid] + message.safe_refs.reverse\n seen = {}\n ids = ids.map { |x| seen[x] = true && x unless seen[x] }.compact\n\n ## write parent/child relationships\n if ids.size > 1\n ids[0 .. -2].zip(ids[1 .. -1]).each do |id, parent|\n pkey = \"pmsgid/#{id}\"\n next if contains_key? pkey # don't overwrite--potential for mischief?\n write_string pkey, parent\n\n ckey = \"cmsgids/#{parent}\"\n v = load_set(ckey)\n v << id\n write_set ckey, v\n end\n end\n\n ## find the root of the whole thread\n root = ids.first\n seen = {} # guard against loops\n while(id = load_string(\"pmsgid/#{root}\"))\n #puts \"parent of #{root} is #{id}\"\n break if seen[id]; seen[id] = true\n root = id\n end\n\n ## get the thread structure in terms of docids docs we've actually seen.\n ## generate psuedo-docids to join trees with parents we haven't seen yet\n ## when necessary.\n thread_structure = build_thread_structure_from root\n #puts \"thread structure is #{thread_structure.inspect}\"\n threadid = thread_structure.first # might actually be a psuedo-docid\n #puts \"root msgid is #{root.inspect}, root docid is #{threadid}\"\n\n ## if any of these docs are roots of old threads, delete those old threads,\n ## but keep track of all the labels we've seen\n old_labels = thread_structure.flatten.inject(Set.new) do |labels, id|\n tkey = \"thread/#{id}\"\n labels + if contains_key? tkey\n lkey = \"tlabels/#{id}\"\n v = load_set lkey\n @store.delete lkey\n @store.delete tkey\n v\n else\n Set.new\n end\n end\n\n ## write the thread ids for all documents. we need this at search time to\n ## do the message->thread mapping.\n thread_structure.flatten.each do |id|\n next if id < 0 # pseudo root\n write_int \"threadid/#{id}\", threadid\n end\n\n @thread_time += (Time.now - startt)\n [threadid, thread_structure, old_labels]\n end", "def translate_file(filename)\n f = File.read(filename)\n f = translate_title(f)\n f = translate_body(f)\n f = update_category(f)\n f\n end", "def translate(texts, opts={})\n texts = Array(texts)\n if opts[:to].instance_of?(Array)\n return multiple_translate(texts, opts)\n end\n\n opts.merge!(:to => set_target(texts)) if opts[:to].nil?\n\n result, threads = [], []\n texts.each_with_index do |text, i|\n url = urlize(text, opts)\n threads << Thread.new(url, i) do |site, no|\n result << [no, send_request(site)]\n end\n end\n threads.each { |th| th.join }\n\n result.sort_by { |n, _| n }.map { |_, res| parse(res) }\n end", "def build_log(options = {})\n @completed_patterns = 0\n @total_vectors = 0\n @total_duration = 0\n @completed_files = 0\n @changed_patterns = 0\n @changed_files = 0\n @new_patterns = 0\n @new_files = 0\n @failed_patterns = 0\n @failed_files = 0\n log_method = options[:log_file] ? options[:log_file] : :info\n Origen.log.send(log_method, '*' * 70)\n completed_jobs.each do |job|\n File.open(log_file(job[:id])) do |f|\n last_line_blank = false\n f.readlines.each do |line|\n # Capture and combine the per job stats that look like this:\n # Total patterns: 1 1347 0.003674\n # New patterns: 0\n # Changed patterns: 1\n # FAILED patterns: 1\n # Total files: 1\n # New files: 0\n # Changed files: 0\n # FAILED files: 1\n\n line.gsub!(/\\e\\[\\d+m/, '') # Remove any coloring\n if line =~ /Total patterns:\\s+(\\d+)/\n @completed_patterns = Regexp.last_match[1].to_i\n elsif line =~ /Total vectors:\\s+(\\d+)/\n @total_vectors = Regexp.last_match[1].to_i\n elsif line =~ /Total duration:\\s+(\\d+\\.\\d+)/\n @total_duration = Regexp.last_match[1].to_f\n elsif line =~ /Total files:\\s+(\\d+)/\n @completed_files = Regexp.last_match[1].to_i\n elsif line =~ /Changed patterns:\\s+(\\d+)/\n @changed_patterns = Regexp.last_match[1].to_i\n elsif line =~ /Changed files:\\s+(\\d+)/\n @changed_files = Regexp.last_match[1].to_i\n elsif line =~ /New patterns:\\s+(\\d+)/\n @new_patterns = Regexp.last_match[1].to_i\n elsif line =~ /New files:\\s+(\\d+)/\n @new_files = Regexp.last_match[1].to_i\n elsif line =~ /FAILED patterns:\\s+(\\d+)/\n @failed_patterns = Regexp.last_match[1].to_i\n elsif line =~ /FAILED files:\\s+(\\d+)/\n @failed_files = Regexp.last_match[1].to_i\n elsif line =~ /ERROR!/\n stats.errors += 1\n Origen.log.send :relog, line, options\n else\n # Compress multiple blank lines\n if line =~ /^\\s*$/ || line =~ /.*\\|\\|\\s*$/\n unless last_line_blank\n Origen.log.send(log_method, nil)\n last_line_blank = true\n end\n else\n # Screen std origen output\n unless line =~ / origen save/ ||\n line =~ /Insecure world writable dir/ ||\n line =~ /To save all of/\n line.strip!\n Origen.log.send :relog, line, options\n last_line_blank = false\n end\n end\n end\n rescue\n # Sometimes illegal UTF-8 characters can get into crash dumps, if this\n # happens just print the line out rather than die\n Origen.log.error line\n end\n end\n stats.completed_patterns += @completed_patterns\n stats.total_vectors += @total_vectors\n stats.total_duration += @total_duration\n stats.completed_files += @completed_files\n stats.changed_patterns += @changed_patterns\n stats.changed_files += @changed_files\n stats.new_patterns += @new_patterns\n stats.new_files += @new_files\n stats.failed_patterns += @failed_patterns\n stats.failed_files += @failed_files\n end\n Origen.log.send(log_method, '*' * 70)\n stats.print_summary\n end", "def collect_entries(filename,root,is_erb = false)\r\n sp = ZLocalize::SourceProcessor.new(filename,root,is_erb)\r\n sp.translation_entries.each do |key,te|\r\n if @new_entries[key]\r\n te.references.each do |ref|\r\n @new_entries[key].add_reference(ref)\r\n end\r\n else\r\n @new_entries[key] = te.dup\r\n end\r\n end\r\n end", "def convert_to_po( source_file_h = nil, base_file = nil, fuzzy_list = nil )\n return false unless english_header?\n\n # What we actually do depends on what was setup for us.\n # If source_file_h is nil and po_locale is nil, we are xgettext.\n # If source_file_h is nil and we have po_locale, we are msginit.\n # If we have a source_file_h, then we are msgunfmt.\n action = :msgunfmt\n action = :msginit if source_file_h.nil? && po_locale\n action = :xgettext if source_file_h.nil? && po_locale.nil?\n\n # lang_en serves as the master reference for all output, especially\n # comments and metadata.\n lang_en = PoHeaderFile.new(@@default_en)\n return false unless lang_en.source_file\n\n # untranslated_items serves as the source for *untranslated* strings.\n # This differs from lang_en in that we may overwrite some of the\n # lang_en strings from the base_file, later. This can help when\n # translating, e.g., regional formats.\n untranslated_items = lang_en.items.clone\n if base_file\n lang_base = PoHeaderFile.new(base_file)\n return false unless lang_base.source_file\n untranslated_items.merge!(lang_base.items)\n end\n\n # We will use lang_source if we have a source_file_h, i.e., msgunfmt,\n # as the source for *translated* strings.\n if source_file_h\n lang_source = PoHeaderFile.new(source_file_h)\n return false unless lang_source.source_file\n else\n lang_source = nil\n end\n\n\n # If we were given a fuzzy_list and we have a source_file, then\n # we have to mark appropriate items as fuzzy.\n if fuzzy_list && fuzzy_list.count > 0 && lang_source\n untranslated_items.each do |key, value|\n if fuzzy_list.include?(key)\n value.each_value do |v|\n v[:fuzzy] = true\n end\n end\n\n end\n end\n\n # The information in the PO header can come from a few different sources\n # depending on what we're doing.\n header_plural_forms = nil\n header_pot_line = nil\n header_translate_to = nil\n\n if action == :xgettext\n header_plural_forms = \"Plural-Forms: nplurals=#{lang_en.plural_count}; plural=#{lang_en.plural_form}\"\n header_pot_line = \"POT-Creation-Date: #{DateTime.now.strftime('%Y-%m-%d %H:%M:%S')}\"\n header_translate_to = lang_en.items[:TIDY_LANGUAGE]['0'][:string].tr('\"', '')\n\n end\n if action == :msginit\n header_plural_forms = \"Plural-Forms: #{known_locales[po_locale.to_sym][:plural_form]}\"\n header_pot_line = \"PO-Revision-Date: #{DateTime.now.strftime('%Y-%m-%d %H:%M:%S')}\"\n header_translate_to = po_locale\n end\n if action == :msgunfmt\n header_plural_forms = \"Plural-Forms: nplurals=#{lang_source.plural_count}; plural=#{lang_source.plural_form}\"\n header_pot_line = \"PO-Revision-Date: #{DateTime.now.strftime('%Y-%m-%d %H:%M:%S')}\"\n header_translate_to = lang_source.items[:TIDY_LANGUAGE]['0'][:string].tr('\"', '')\n end\n\n header_plural_count = header_plural_forms.match(/nplurals=(.*?);/i)[1].to_i - 1\n\n # We'll use this closure to perform a repetitive task in the report.\n item_output = lambda do | label, string |\n result = ''\n if string.lines.count > 1\n result << \"#{label} \\\"\\\"\\n\"\n result << \"#{string}\\n\"\n else\n result << \"#{label} #{string}\\n\"\n end\n result\n end\n\n\n report = <<-HEREDOC\nmsgid \"\"\nmsgstr \"\"\n\"Content-Type: text/plain; charset=UTF-8\\\\n\"\n\"Language: #{header_translate_to}\\\\n\"\n\"#{header_plural_forms}\\\\n\"\n\"X-Generator: HTML Tidy #{File.basename($0)}\\\\n\"\n\"Project-Id-Version: \\\\n\"\n\"#{header_pot_line}\\\\n\"\n\"Last-Translator: #{ENV['USER']}#{ENV['USERNAME']}\\\\n\"\n\"Language-Team: \\\\n\"\n\n HEREDOC\n\n untranslated_items.delete(:TIDY_LANGUAGE)\n untranslated_items.delete(:TIDY_MESSAGE_TYPE_LAST)\n untranslated_items.each do |key, value|\n\n if value['0'][:comment]\n value['0'][:comment].each_line { |line| report << \"#. #{line.strip}\\n\"}\n end\n\n attribs = []\n attribs << 'fuzzy' if value['0'][:fuzzy] && action == :msgunfmt\n attribs << 'c-format' if %w(%u %s %d).any? { | find | value['0'][:string].include?(find) }\n if attribs.count > 0\n report << \"#, #{attribs.join(', ')}\\n\"\n end\n\n report << \"msgctxt \\\"#{key.to_s}\\\"\\n\"\n\n # Handle the untranslated strings, with the possibility that there\n # are two forms. PO/POT is English-based and supports only a singular\n # and plural form.\n value.each_value do | subitem |\n label = subitem[:case] == '0' ? 'msgid' : 'msgid_plural'\n report << item_output.(label, subitem[:string])\n end\n\n # Handle translated strings, with the possibility that there\n # are multiple plural forms for them.\n en_is_singular = value.count == 1\n\n if lang_source && lang_source.items[key]\n # Print translated strings.\n if en_is_singular\n report << item_output.( 'msgstr', lang_source.items[key]['0'][:string])\n else\n # Print available plural forms and write blanks for the rest.\n (0..header_plural_count).each do |i|\n if lang_source.items[key].has_key?(i.to_s)\n report << item_output.( \"msgstr[#{i}]\", lang_source.items[key][i.to_s][:string])\n else\n report << \"msgstr[#{i}] \\\"\\\"\\n\"\n end\n end\n end\n else\n # Print empty translated strings.\n if en_is_singular\n report << \"msgstr \\\"\\\"\\n\"\n else\n (0..header_plural_count).each do |i|\n report << \"msgstr[#{i}] \\\"\\\"\\n\"\n end\n end\n end\n\n report << \"\\n\"\n end # do\n\n if emacs_footer\n report << <<-HEREDOC\n# Local Variables:\n# mode: po\n# eval: (add-hook 'po-subedit-mode-hook '(lambda () (setq fill-column 78)))\n# End:\n HEREDOC\n end\n\n output_file = action == :xgettext ? 'tidy.pot' : \"language_#{header_translate_to}.po\"\n if File.exists?(output_file)\n File.rename(output_file, safe_backup_name(output_file))\n end\n File.open(output_file, 'w') { |f| f.write(report) }\n @@log.info \"#{__method__}: Results written to #{output_file}\"\n puts \"Wrote a new file to #{File.expand_path(output_file)}\"\n true\n end", "def process_and_write_to file\n \n return unless @is_relevant\t\n\n # svnadmin: Malformed dumpstream: Revision 0 must not contain node records\n #\n # so discard revision without nodes, _except_ for revision 0\n if @nodes.empty? && @num > 0\n return\n end\n\n file.puts \"# process_and_write #{self}\" if $debug\n\n faked_nodes = []\n\n @nodes.each do |node|\n \n next if node.action == :delete\n\n # check node.path and if we already have all parent dirs\n path = node.path\n if node.kind == :file\n\tpath = File.dirname(path)\n elsif node.kind == :dir\n\tcase node.path\n\twhen \"trunk\", \"branches\", \"tags\"\n\t next\n\tend\n end\n last_relevant, last_path = find_and_write_last_relevant_for path, file\n exit 1 unless last_relevant\n # check if this was an 'extra' path and if we have to add directories\n \n # if the node creates the dir path, then the dirname is missing, not the full path\n # (for the 'file' case, we take the parent dir already above)\n #\n missing_path = (node.kind == :dir) ? File.dirname(path) : path\n if $extra_pathes[node.path] &&\n\t last_path != missing_path # last_relevant was a parent\n missings = []\n\twhile last_path != missing_path\n\t missings << File.basename(missing_path)\n\t missing_path = File.dirname(missing_path)\n\t break if missing_path == \".\"\n\tend\n\t# consistency check. Maybe last_past was no parent ?!\n\tif missing_path == \".\"\n\t STDERR.puts \"Couldn't find missing directories\"\n\t STDERR.puts \"Last directory was #{last_path}\"\n\t STDERR.puts \"Missings #{missings.inspect}\"\n\t exit 1\n\tend\n # add fake nodes to create missing directories\n\twhile !missings.empty?\n\t missing_path = File.join(missing_path, missings.pop)\n\t unless $created_extras[missing_path]\n\t file.puts \"# Create #{missing_path}\" if $debug\n\t faked_nodes << FakeNode.new(:dir, :add, missing_path)\n\t $created_extras[missing_path] = true\n\t end\n\tend\n end\n\n if $extra_pathes[node.path]\n\tunless $created_extras[node.path]\n#\t STDERR.puts \"Cutting history for #{node} at rev #{@num}\"\n\t # the extra file could be a 'change' node. This happens\n\t # if it was created in another directory and then the directory\n\t # was renamed. Instead of backtracking directory renames, we cut\n\t # history here and make it an 'add' node\n\t node.action = :add if node.action == :change\n\t $created_extras[node.path] = true\n\tend\n end\n\n # check for Node-copyfrom-path and evtl. rewrite / backtrack\n\n path = node['Node-copyfrom-path']\n if path\n\t# backtrack, find last relevant revision for this path\n\trevnum = node['Node-copyfrom-rev'].to_i\n\tlast_relevant, last_path = find_and_write_last_relevant_for path, file, revnum\n\texit 1 unless last_relevant\n\tnewnum = @@revision_number_mapping[last_relevant.num]\n\tfile.puts \"# Node-copyfrom-rev #{revnum} -> #{newnum}<#{last_relevant.num}>\" if $debug\n\tnode['Node-copyfrom-rev'] = newnum\n end\n end # nodes.each\n \n # write Revision item\n \n self.copy_to file\n # write nodes\n faked_nodes.each do |node|\n node.copy_to file\n end\n @nodes.each do |node|\n node.copy_to file\n path = node.path\n while path != \".\"\n\t@@last_relevant_for[path] ||= []\n\t@@last_relevant_for[path] << self\n\tpath = File.dirname(path)\n end\n end\n end", "def process\n input_text = read_input_file\n s_exp = parse_to_s_expression(input_text)\n write_s_exp_file(s_exp)\n dot_data = get_method_calls(s_exp)\n write_dot_file(dot_data)\n end", "def scan_dir(from_dir, to_dir)\n Dir.foreach(from_dir) do |file|\n from_path = from_dir + File::SEPARATOR + file\n to_path = to_dir + File::SEPARATOR + file\n if file =~ /^\\./\n next\n elsif FileTest.directory?(from_path)\n scan_dir(from_path, to_path) \n elsif file =~ /\\.java$/\n File.makedirs(to_dir)\n output_file = to_path.sub(/\\.java$/, '.cs')\n print \"Translating #{from_path} to #{output_file}\\n\"\n transmogrify(from_path, output_file)\n else\n File.makedirs(to_dir)\n print \"Copying #{from_path} to #{to_path}\\n\"\n File.copy(from_path, to_path)\n end\n end\nend", "def translate(message_from_txt)\n message_character_array = separate(message_from_txt.chomp)\n message_character_array.map do |letter|\n one_braille_array = get_array(letter)\n #now the output is the 3-element braille array for that one letter character\n shovel(one_braille_array)\n end\n format_lines\n end", "def convert_files\n\n AppLogger.log.info(\"Starting JSON to CSV conversion.\")\n start_time = Time.now\n\n #Load keys from the Tweet Template.\n activity_template_file = @config.tweet_template\n contents = File.read(activity_template_file)\n activity_template = JSON.parse(contents)\n keys_template = Array.new\n keys_template = get_keys(activity_template)\n #Initialize @keys\n @keys = Array.new\n\n #Build header based on these keys.\n header = build_header(keys_template)\n\n #TODO - if we are handling compressed files, unzip, convert, then rezip?\n\n #tour output folder with current UUID and convert files\n\n Dir.glob(\"#{@config.inbox}/*.json\") do |file|\n\n AppLogger.log.debug(\"DEBUG, convert_files: Converting #{File.basename(file)} file...\")\n\n\n csv_filename = \"#{@config.outbox}/#{File.basename(file, \".*\")}.csv\"\n csv_file = File.open(csv_filename, \"w\")\n csv_file.puts header\n\n #This file has one or more activities in it, with a \"info\" footer.\n contents = File.read(file)\n\n activities = []\n\n #Inspect contents and determine the source of the data... Search API, HPT?\n #Markers:\n # Search API: file starts with '{\"results\":[' or '{\"next\":['.\n # HPT: last line is a \"info\" footer.\n # Realtime: contents start with '{\"id\":'. ##Not handling this yet....\n\n if (contents.start_with?('{\"results\":[') or contents.start_with?('{\"next\":'))\n\n json_contents = JSON.parse(contents)\n\n json_contents[\"results\"].each do |activity|\n activities << activity.to_json\n end\n\n elsif contents.include?('\"info\":{\"message\":\"Replay Request Completed\"')\n\n contents.split(\"\\r\")[0..-2].each { |line| #drop last \"info\" member.\n #Dev TODO: just added the \"id\": match, untested\n if line.include?('created_at') or line.include?('postedTime')\n activities << line\n end\n }\n\t\t \n\t else\n\n\t\t contents.split(\"\\n\").each { |line| #drop last \"info\" member.\n\t\t\t#Dev TODO: just added the \"id\": match, untested\n\t\t\tif line.include?('retweetCount') or line.include?('retweet_count')\n\t\t\t activities << line\n\t\t\tend\n\t\t }\n\n end\n\n activities.each { |activity|\n\n begin\n activity_hash = JSON.parse(activity)\n rescue Exception => e\n AppLogger.log.error(\"ERROR in convert_files: could not parse activity's JSON: #{e.message}\")\n end\n\n keys_activity = Array.new\n keys_activity = get_keys(activity_hash)\n\n #Initialize @keys\n @keys = Array.new\n\n #OK, time to compare this activity's payload with the template and grab only the matching keys.\n csv_array = []\n\n keys_template.each { |key_template|\n\n if keys_activity.include?(key_template)\n\n #p \"matched on #{key_template}\"\n\n if @config.arrays_to_collapse.split(',').any? { |item| key_template.include?(item) }\n #p \"NEED TO HANDLE SPECIAL CASE: #{key_template}\"\n data = get_collapsed_array_data(activity_hash, key_template)\n else\n #Go get this data and add it to csv_array\n data = get_data(activity_hash, key_template)\n end\n\n csv_array << data\n else\n csv_array << nil\n end\n }\n\n #Write csv array to CSV.\n csv_activity = CSV.generate do |csv|\n csv << csv_array\n end\n\n csv_file.puts csv_activity.to_s\n }\n\n csv_file.close #Close new CSV file.\n\n\n if (!@config.save_json)\n File.delete(file) #Delete json version.\n else #Move it to 'processed' folder.\n FileUtils.mv(file, \"#{@config.processed_box}/#{file.split('/')[-1]}\")\n end\n end\n\n AppLogger.log.info(\"Finished JSON to CSV conversion. Conversion required #{Time.now - start_time} seconds.\")\n\n end", "def process_locale(locale)\n # Directories\n locales_dir = Rails.root.join('config/locales')\n templ_dir = locales_dir.join('template')\n local_dir = locales_dir.join(locale)\n output_dir = locales_dir.join(\"#{locale}_tmp\")\n\n # Remove temporary directory if it exists\n FileUtils.rm_rf output_dir\n\n # Output results to temporary directory\n Dir[templ_dir.join('**/*.yml')].each do |f|\n process_file(\n Pathname.new(f).relative_path_from(templ_dir), # Filename\n locale, # Locale\n \"#{locale}_tmp\" # Output locale \n )\n end\n\n # Override the locales folder\n FileUtils.rm_rf local_dir\n FileUtils.mv output_dir, local_dir\n end", "def main (max_char, prefix, suffix)\r\n # Variable Definitions\r\n input_folder = 'Original/' # Folder of original files\r\n output_folder = 'Wrapped/' # Folder of processed files\r\n file_name = '' # The name of the file (test.rb)\r\n file_path = '' # The path of the file (folder/test.rb)\r\n output_path = '' # The path of the output file\r\n original_arr = [] # The lines of the original file\r\n wordwrapped_arr = [] # The formatxted file lines\r\n # Check if USER VARIABLES are valid.\r\n check_user_variables()\r\n # Get the name of the file that will be word wrapped.\r\n file_name = get_input_file_name()\r\n # Concatenate the folder name and file name to give a path so that the\r\n # file can be searched for later.\r\n file_path = input_folder + file_name\r\n # Check that the file_path is valid, if not the program will exit.\r\n check_input_file(file_path)\r\n # Now that the file path is vaild, read the file contents and save to\r\n # the array.\r\n original_arr = read_input_file(file_path)\r\n # Check the original_arr and make sure that no comment line is longer than\r\n # the max specified \r\n wordwrapped_arr = word_wrap(original_arr, max_char)\r\n # Create a path for the output file to go\r\n output_path = create_output_path(output_folder, file_name, prefix, suffix)\r\n # Write the formatted array to the output file\r\n write_formatted_file(wordwrapped_arr, output_path)\r\n puts(\"Formatting Succeded.\")\r\nend", "def parse_files\r\n ln_count = 0\r\n\r\n settings.file_order.each do |f|\r\n out = make_file(\"tmp.press\")\r\n\r\n ln_count += parse_lines(f, out)\r\n\r\n out.close\r\n tmp_files << out\r\n end\r\n\r\n ln_count\r\n end", "def run\r\n #check input format, either a file or standard input\r\n if @inputFile == STDIN\r\n f = STDIN\r\n else\r\n f = File.open(@inputFile, \"r\")\r\n end\r\n #flag to mark whether read the first instruction and be used to check lines before any instruction\r\n mark = false\r\n #process instructiions line by line\r\n f.each do |line|\r\n #skip comments\r\n next if line =~ /^\\/\\//\r\n #skip an empty line before any instruction\r\n next if mark == false and line =~ /^[\\s]*$/\r\n opts = format_input(line)\r\n mark = true if mark == false\r\n out_put = @tm.read(opts)\r\n unless out_put.nil?\r\n if @outputFile == STDOUT or @outputFile.nil?\r\n STDOUT.puts out_put\r\n else\r\n File.open(@outputFile, \"a\") do |log|\r\n log.puts out_put\r\n end\r\n end\r\n end\r\n end\r\n #add a time step for TM\r\n out_put = @tm.read([[\"advance\"]])\r\n unless out_put.nil?\r\n if @outputFile == STDOUT or @outputFile.nil?\r\n STDOUT.puts out_put\r\n else\r\n File.open(@outputFile, \"a\") do |log|\r\n log.puts out_put\r\n end\r\n end\r\n end\r\n\r\n f.close\r\n\r\n end", "def doing_phrase_lines\n consumer = Fiber.new do |producer, queue|\n f = open(\"./tmp/database_doings/doing_phrases/phrases_ready_to_load.txt\", \"a\") do |f| \n loop do\n queue = producer.transfer(consumer, queue)\n puts f << queue\n queue.clear\n end\n raise StopIteration\n end\n end\n producer = Fiber.new do |consumer, queue|\n IO.foreach(\"./tmp/database_doings/doing_phrases/phrases_sorted.txt\") do |line|\n queue = \"\"\n puts queue\n sequence_text = line.to_textual.de_comma\n sequence_creation = sequence_text.de_space unless nil\n sequence_complete = sequence_text.split(//).sort.join('').strip unless nil\n sequence_lexigram = lexigram_sequencer(sequence_text) unless nil\n sequence_singular = sequence_complete.squeeze unless nil\n sequence_lense = \"\"\n description = \"\"\n reference = \"\"\n anagram = 0\n name = 0\n phrase = 1\n research = 0\n external = 0\n internal = 0\n created_at = \"2011-12-12 12:12:00\"\n line = \"#{sequence_text}\\t#{sequence_creation}\\t#{sequence_complete}\\t#{sequence_lexigram}\\t#{sequence_singular}\\t#{sequence_lense}\\t#{description}\\t#{reference}\\t#{anagram}\\t#{name}\\t#{phrase}\\t#{research}\\t#{external}\\t#{internal}\\t#{created_at}\\n\"\n queue << line\n break unless line\n consumer.transfer queue\n queue.clear\n end\n raise StopIteration\n end \n consumer.transfer(producer, [])\n after_break\n end", "def execute\n settings = read_settings\n input, remove_regexp, output = get_in_out_removes(settings)\n create_output_dir(output)\n Dir.glob(input).each do |file|\n input_src = get_input(file)\n replaced = remove_head(input_src.encode('UTF-16BE', 'UTF-8', invalid: :replace, undef: :replace, replace: '?').encode('UTF-8'), remove_regexp)\n output_file(file, replaced, output)\n end\n end", "def parseChat(doc, chatFilePath, realStartTime, recordingStart, recordingStop)\n BigBlueButton.logger.info( \"Parsing chat messages\")\n\n timeFormat = '%H:%M:%S.%L'\n displayMessageTimeMax = 3 # seconds\n chatMessages = []\n\n # Gather messages\n chatEvents = doc.xpath(\"//event[@eventname='PublicChatEvent']\")\n\n recordingStart.each.with_index do |recordStartStamp, index|\n recordStopStamp = recordingStop[index]\n\n chatEvents.each do |node|\n chatTimestamp = node.at_xpath(\"timestampUTC\").content.to_i\n\n if (chatTimestamp >= recordStartStamp.to_i and chatTimestamp <= recordStopStamp.to_i)\n chatSender = node.xpath(\".//sender\")[0].text()\n chatMessage = node.xpath(\".//message\")[0].text()\n chatStart = Time.at((chatTimestamp - realStartTime) / 1000.0) #.utc.strftime(TIME_FORMAT)\n #chatEnd = Time.at((chatTimestamp - realStartTime) / 1000.0) + 2\n #chatEnd = chatEnd.utc.strftime(TIME_FORMAT)\n chatMessages.push({sender: chatSender,\n message: chatMessage,\n startTime: chatStart,\n endTime: Time.at(0)\n })\n end\n end\n\n end\n\n # Update timestamps\n chatMessages.each.with_index do |message, index|\n # Last message\n if chatMessages[index + 1].nil?\n message[:endTime] = message[:startTime] + displayMessageTimeMax\n break\n end\n\n if (chatMessages[index + 1][:startTime] - message[:startTime]) < displayMessageTimeMax\n message[:endTime] = chatMessages[index + 1][:startTime]\n else\n message[:endTime] = message[:startTime] + displayMessageTimeMax\n end\n end\n\n # Compile messages\n files = []\n files.push(\"WEBVTT\")\n files.push(\"\")\n chatMessages.each do |message|\n files.push(message[:startTime].utc.strftime(timeFormat).to_s + \" --> \" + message[:endTime].utc.strftime(timeFormat).to_s)\n files.push(message[:sender] + \": \" + message[:message])\n files.push(\"\")\n end\n\n if (chatMessages.length > 0)\n File.write(chatFilePath, files.join(\"\\n\"))\n end\nend", "def log_msgs\n @msg_log.logMessages.each do |msg|\n # DLM: you can filter on log channel here for now\n if /openstudio.*/.match(msg.logChannel) #/openstudio\\.model\\..*/\n # Skip certain messages that are irrelevant/misleading\n next if msg.logMessage.include?(\"Skipping layer\") || # Annoying/bogus \"Skipping layer\" warnings\n msg.logChannel.include?(\"runmanager\") || # RunManager messages\n msg.logChannel.include?(\"setFileExtension\") || # .ddy extension unexpected\n msg.logChannel.include?(\"Translator\") || # Forward translator and geometry translator\n msg.logMessage.include?(\"UseWeatherFile\") # 'UseWeatherFile' is not yet a supported option for YearDescription\n \n # Report the message in the correct way\n if msg.logLevel == OpenStudio::Info\n @runner.registerInfo(msg.logMessage)\n elsif msg.logLevel == OpenStudio::Warn\n @runner.registerWarning(\"[#{msg.logChannel}] #{msg.logMessage}\")\n elsif msg.logLevel == OpenStudio::Error\n @runner.registerError(\"[#{msg.logChannel}] #{msg.logMessage}\")\n elsif msg.logLevel == OpenStudio::Debug && @debug\n @runner.registerInfo(\"DEBUG - #{msg.logMessage}\")\n end\n end\n end\n @runner.registerInfo(\"Total Time = #{(Time.new - @start_time).round}sec.\")\n end", "def convert_to_h( file, base_file )\n\n po_content = PoPoFile.new(file)\n return false unless po_content.source_file && english_header? && header_template?\n\n # We will use English to ensure that no English strings are\n # included in the translation.\n lang_en = PoHeaderFile.new(@@default_en)\n return false unless lang_en.source_file\n filter_items = lang_en.items.clone\n\n # We will also filter out items that are already the same\n # in the base language, in order to keep Tidy small. It's\n # actually possible to miss some English strings if, for\n # some reason, the PO has English strings that the base\n # language does not, but severity * likelihood == unimportant.\n if base_file\n lang_base = PoHeaderFile.new(base_file)\n return false unless lang_base.source_file\n filter_items.merge!(lang_base.items)\n end\n\n # We will hard code these into the generated file.\n filter_items.delete(:TIDY_LANGUAGE)\n filter_items.delete(:TIDY_MESSAGE_TYPE_LAST)\n\n # Eliminate PO items if they match inherited items (in the filter), or\n # if they're not included in English (i.e., entries not used by Tidy).\n # We are comparing _complete entries_ right here, with the PO as the\n # official source. Therefore all plurals are accounted for, #IF groups,\n # and comments.\n po_content.items.reject! do |key, value|\n ( (filter_items.has_key?(key) && filter_items[key] == value) ) || !filter_items.has_key?(key)\n end\n\n # #if groups and comments:\n # We need to know which translated items belong in #if groups. Since we\n # don't store this metadata in the PO, find out which #if groups they\n # belong to from the original language_en.h.\n # Additionally we will only use comments from language_en.h. Besides\n # preventing us from having to format them, we ensure that only the\n # canonical comments are put into the H file in the event of changes.\n # Additionally only include comments if enabled.\n # Finally add fuzzy notes to comments if the PO item is fuzzy.\n po_content.items.each do |key, value|\n value.each_value do |item_entry|\n item_entry[:if_group] = lang_en.items[key]['0'][:if_group]\n item_entry[:comment] = force_comments ? lang_en.items[key]['0'][:comment] : nil\n item_entry[:comment] = \"(fuzzy) #{item_entry[:comment]}\" if item_entry[:fuzzy]\n end\n end\n\n\n # Gather some information to format this nicely, and perform\n # UTF escaping if necessary.\n longest_key = 22 # length of TIDY_MESSAGE_TYPE_LAST.\n longest_value = 10 # reasonable default in case no single-line strings are found.\n po_content.items.each do |key, value|\n longest_key = key.length if key.length > longest_key\n value.each_value do |value_inner|\n # If we're not plaintext then escape UTF sequences.\n unless plaintext\n value_inner[:string].gsub!(/[^\\u0000-\\u007e][0-9a-fA-F]?/) do |c|\n esc = c[0].bytes.map{ |b| '\\\\x' + b.to_s(16) }.join('')\n if c[1]\n esc += '\"\"' + c[1]\n end\n esc\n end\n end\n length = value_inner[:string].length\n longest_value = length if length > longest_value && !value_inner[:string].start_with?(\"\\n\")\n end\n end\n\n # Manually build the first line with the proper language code.\n report_body = \" {/* Specify the ll or ll_cc language code here. */\\n\"\n report_body << \" #{'TIDY_LANGUAGE,'.ljust(longest_key+2)}0, \\\"#{po_content.language}\\\"\\n\"\n report_body << \" },\\n\"\n\n # Generate the main header body. Although it's a machine-generated\n # document we still care that it's pretty-printed and readable. In\n # this respect we have four output formats: single line values;\n # single line values with developer comment; multiline values; and\n # multiline values with developer comment.\n if_group = nil\n po_content.items.each do |item_key, item_value|\n item_group = item_value[item_value.keys[0]][:if_group]\n unless item_group == if_group\n # The current if grouping has changed.\n unless if_group.nil?\n # Close current group.\n report_body << \"#endif /* #{if_group} */\\n\\n\"\n end\n if_group = item_group\n unless if_group.nil?\n # Open new group.\n report_body << \"\\n#if #{if_group}\\n\"\n end\n end\n\n # Handle each entry individually.\n item_value.each_value do |entry_value|\n if entry_value[:string].start_with?(\"\\n\")\n # Format a multiline value.\n if entry_value[:comment]\n report_body << \" {/* #{entry_value[:comment]} */\\n\"\n report_body << \" #{(item_key.to_s + ',').ljust(longest_key+2)}#{entry_value[:case]},\"\n else\n report_body << \" { #{(item_key.to_s + ',').ljust(longest_key+2)}#{entry_value[:case]},\"\n end\n entry_value[:string].lines.each do |line|\n report_body << \" #{line}\"\n end\n report_body << \"\\n },\\n\"\n else\n # Format a single line value.\n if entry_value[:comment]\n report_body << \" {/* #{entry_value[:comment]} */\\n\"\n report_body << \" #{(item_key.to_s + ',').ljust(longest_key+2)}#{entry_value[:case]}, #{entry_value[:string]}\\n\"\n report_body << \" },\\n\"\n else\n # known issue: ljust doesn't work for certain unicode characters, so no pretty-printing, e.g., Chinese.\n report_body << \" { #{(item_key.to_s + ',').ljust(longest_key+2)}#{entry_value[:case]}, #{entry_value[:string].ljust(longest_value+2)} },\\n\"\n end\n end\n end\n end # po_content.items.each\n\n # Close off current if_group if any, because there will\n # not be another state change to do so.\n unless if_group.nil?\n report_body << \"#endif /* #{if_group} */\\n\"\n end\n\n # Force the final closing line manually; can't count on PO. We\n # could add this to the template, but let's give it the same\n # pretty-printing as the other items.\n report_body_last = \" {/* This MUST be present and last. */\\n\"\n report_body_last << \" #{'TIDY_MESSAGE_TYPE_LAST,'.ljust(longest_key+2)}0, NULL\\n\"\n report_body_last << \" }\\n\"\n\n # We are going to use an external ERB template to build the report file.\n # Although it's trivial to hard-code all of the required text into this\n # method directly, it will be more convenient to keep an external file\n # synchronized with changes to language_en.h if we make changes.\n header_file = File.open(@@header_template) { |f| f.read }\n report = ERB.new(header_file).result(binding) # will use in-context vars.\n\n # Save\n output_file = \"language_#{po_content.language}.h\"\n if File.exists?(output_file)\n File.rename(output_file, safe_backup_name(output_file))\n end\n File.open(output_file, 'w') do |f|\n f.write \"\\uFEFF\" if plaintext # MSVC requires a BOM.\n f.write(report)\n end\n @@log.info \"#{__method__}: Results written to #{output_file}\"\n puts \"Wrote a new header file to #{File.expand_path(output_file)}\"\n true\n end", "def flatten_translations(locale, data, escape, subtree); end", "def emit_lines(log_state)\r\n begin\r\n # If the file doesn't exist do not emit lines. The watch will be cleaned up on the next refresh.\r\n if !File.exist?(log_state.pos_file.path)\r\n return\r\n end\r\n\r\n # If there are no unread lines from the last read and the file has not been modified\r\n # do not emit lines.\r\n if !log_state.unread_lines && File.mtime(log_state.pos_file.path) < log_state.last_emit\r\n return\r\n end\r\n\r\n file = File.open(log_state.pos_file.path)\r\n\r\n # Read in the last directives if they exist.\r\n if log_state.pos_file.last_directives_pos >= 0\r\n update_directives(file, log_state)\r\n end\r\n\r\n # Seek to the last read position.\r\n if log_state.pos_file.last_read_pos >= 0\r\n file.seek(log_state.pos_file.last_read_pos)\r\n end\r\n\r\n # Create an event stream to write records to.\r\n event_stream = MultiEventStream.new()\r\n\r\n # The last start position of directives.\r\n last_directives_pos = nil\r\n\r\n # Keep track of log directives as they are read in.\r\n # We cannot emit them as we read them as we need the date\r\n # from the Date directive to properly date all the directives.\r\n log_directives = []\r\n\r\n for _ in 0...@read_line_limit\r\n starting_pos = file.pos\r\n begin\r\n line = file.readline.strip\r\n rescue EOFError\r\n log_state.unread_lines = false\r\n break\r\n end\r\n\r\n if LogDirectives.is_directive(line)\r\n # If this is a new set of directives record needed info.\r\n if log_directives.empty?\r\n # Save the directive start position to record later.\r\n last_directives_pos = starting_pos\r\n # Clear out any old directives to ensure no stale data.\r\n log_state.log_directives = LogDirectives.new()\r\n end\r\n log_state.log_directives.process_info(line)\r\n log_directives.push(line)\r\n else\r\n # If we have finished reading directives write out the info.\r\n if !log_directives.empty?\r\n for directive in log_directives\r\n record = create_record(directive, path, log_state, false)\r\n event_stream.add(Engine.now, record)\r\n end\r\n end\r\n\r\n log_directives = []\r\n record = create_record(line, file.path, log_state, @process_logs)\r\n event_stream.add(Engine.now, record)\r\n end\r\n end\r\n\r\n # Update info in the LogState, close the file and emit the stream.\r\n log_state.pos_file.last_read_pos = file.pos\r\n log_state.pos_file.last_directives_pos = last_directives_pos if last_directives_pos != nil\r\n file.close()\r\n log_state.last_emit = Time.now\r\n router.emit_stream(@tag, event_stream)\r\n ensure\r\n log_state.timer = timer_execute(:iis_file_watchers, @read_log_entires, repeat: false, &log_state.method(:emit_lines))\r\n end\r\n end", "def topic_map_file\n\n # new stuff 1/Nov/2021\n # allow users to break up the topic map into multiple topic maps\n # load topic maps from a single folder called _topic_maps.\n # we assume that all files in this folder are correctly formatted topic maps. If not, you will get normal asciibinder errors\n topic_map_folder = TOPIC_MAP_FOLDER\n topic_file = TOPIC_MAP_FILENAME\n\n if !Dir.exist?(File.join(docs_root_dir, topic_map_folder))\n # if the _topic_maps directory doesn't exist or is empty, see if we can find the topic map in the root folder to maintain backward compatibility\n\n if !File.exist?(File.join(docs_root_dir, topic_file))\n # fall back to looking for a _topic_map in the root directory\n\n topic_file = BUILD_FILENAME # old folders use build_config.yml\n\n if !File.exist?(File.join(docs_root_dir, topic_file))\n # Critical error - no topic map file at all.\n Trollop::die \"Could not find a valid topic map file. There is no #{TOPIC_MAP_FOLDER} folder and the fall back files #{TOPIC_MAP_FILENAME} or #{BUILD_FILENAME} in branch '#{git.branch}' were also not found.\"\n else\n t = File.join(docs_root_dir, topic_file) # found build_config\n end\n else\n t = File.join(docs_root_dir, topic_file) # found topic_map in root\n end\n\n else\n\n # topic map files are in the _topic_maps folder\n\n # create a combined temp file with all topic maps\n tf = Tempfile.new(\"#{TOPIC_MAP_FILENAME}\")\n\n Dir.glob(\"#{topic_map_folder}/*.yml\").sort.each do |filename|\n lines = IO.read(filename)\n tf << lines\n tf.write \"\\n\"\n end\n\n tf.rewind\n t = tf.path\n end\n\n # returns the path to the final file\n t\n\n end", "def vm(input,output)\n\t# line index\n\ti = 1\n\t# bootstrap \n\tif input.any?{|x| x[:file] == \"Sys\"}\n\t\toutput.puts(\"@256\\nD=A\\n@SP\\nM=D\\n\")\n\t\toutput.puts(parseLine(\"callSys.init0\",\"origin\",\"0\"))\n\tend\n\t# iterate through each of the hashes with lines & filename\n\tinput.each{|x| \n\t\t# iterate through each of the lines in a given file\n\t\tx[:lines].each{|y|\n\t\t\t# grab the assembly representing a given line \n\t\t\tln = parseLine(y,x[:file],i.to_s)\n\t\t\t# if there is output and its valid then write it \n\t\t\t# to the output file \n\t\t\tif ln && ln.class == String then output.puts ln\n\t\t\t# otherwise log the occurrence of an error and break\n\t\t\telse puts \"Error parsing in line \"+i.to_s+\". Returned error \"+ln.to_s; return -1\n\t\t\tend\n\t\t\ti += 1\n\t\t}\n\t}\n\t# throw a loop at the end of the output file for style\n\toutput.puts \"(CTSLOOP)\\n@CTSLOOP\\n0;JMP\\n\"\n\tputs \"Successfully parsed \" + i.to_s + \" lines.\"\nend", "def flog(*files_or_dirs)\n files = Flog.expand_dirs_to_files(*files_or_dirs)\n\n files.each do |file|\n begin\n # TODO: replace File.open to deal with \"-\"\n ruby = file == '-' ? $stdin.read : File.read(file)\n warn \"** flogging #{file}\" if option[:verbose]\n\n ast = @parser.process(ruby, file)\n next unless ast\n mass[file] = ast.mass\n process ast\n rescue RegexpError, SyntaxError, Racc::ParseError => e\n if e.inspect =~ /<%|%>/ or ruby =~ /<%|%>/ then\n warn \"#{e.inspect} at #{e.backtrace.first(5).join(', ')}\"\n warn \"\\n...stupid lemmings and their bad erb templates... skipping\"\n else\n unless option[:continue] then\n warn \"ERROR! Aborting. You may want to run with --continue.\"\n raise e\n end\n warn file\n warn \"#{e.inspect} at #{e.backtrace.first(5).join(', ')}\"\n end\n end\n end\n end", "def format_io input\n input.each_line do |line|\n output.write format_log_line(line)\n end\n end", "def translate_and_write_page(source_page, tos, from, overwrite)\n if File.exist?(source_page)\n STDERR.puts \"Translating: #{source_page}\"\n else\n STDERR.puts \"Could not find file: #{source_page}\"\n return\n end\n \n if !translate_file?(source_page)\n STDERR.puts \"Not translating file: #{source_page}\"\n return\n end\n \n text = IO.read(source_page)\n \n begins_with_html = text['<html>']\n \n # Pull out all the code blocks so Google doesn't mess with those\n pattern = /\\<\\%.+\\%\\>/\n holder = '{{---}}'\n replacements = text.scan(pattern)\n text.gsub!(pattern, holder)\n \n # Pull out all the new lines so Google doesn't mess with those\n pattern = /\\n/\n newline_holder = '<brr />'\n newline_replacements = text.scan(pattern)\n text.gsub!(pattern, newline_holder)\n \n # Send to Google for translations\n translations = Babelphish::Translator.multiple_translate(text, tos, from)\n \n # Put the code back\n translations.each_key do |locale|\n replacements.each do |r|\n if translations[locale]\n translations[locale].sub!(holder, r)\n else\n STDERR.puts \"Unable to location translation for: #{locale} (From was #{from}. If they match then no translation was generated).\"\n end\n end\n end\n \n # Put the newlines back in\n translations.each_key do |locale|\n newline_replacements.each do |r|\n if translations[locale]\n translations[locale].sub!(newline_holder, r)\n if translations[locale]['<html>']\n # Google translate can insert '<html>' at the beginning of the result. Remove it.\n translations[locale]['<html>']= '' unless begins_with_html\n end\n end\n end\n end\n \n # Write the new file\n translations.each_key do |locale|\n translated_filename = get_translated_file(source_page, locale)\n if (locale != from) && (overwrite || !File.exists?(translated_filename))\n File.open(translated_filename, 'w') { |f| f.write(translations[locale]) }\n end\n end\n\n end", "def process_file(file_name)\n\tputs \"Processing File.... \"\n\n\tbegin\n\t\t#IO.foreach(file_name) do |line|\n\t\tsize = File.new(file_name).size\t# This is the only way I've been able to get the entire unique_tracks.txt to be read\n\t\tfile = File.open(file_name)\n\t\tlines = file.read(size)\n\t\tlines_array = lines.split(\"\\n\")\n\t\tlines_array.each do |line|\t# For each line of the file\n\t\t\tline += \"\\n\"\t# Above file parsing splits lines on the \\n character, but the cleanup_title\n\t\t\t # method uses the \\n charaacter in the non-English characters check so it needs to be added back\n\t\t\ttitle = cleanup_title(line)\t# Removes unwanted text and sets string to downcase\n\t\t\tbuild_bigram(title)\t# Builds the bigram structure\n\t\tend # do lines.each\n\t\tputs \"Finished. Bigram model built.\\n\"\n\trescue # begin\n\t\tSTDERR.puts \"Could not open file\"\n\t\traise\n\t\texit 4\n\tend # rescue\nend", "def parse( language, target=[] )\n file = file_name(language)\n content = File.open( file, 'r' ).read.gsub( /\\\"\\n\\\"/, '' )\n puts \"Parsing \\\"#{file}\\\" ...\"\n content.each_line do |line|\n parse_line( line, target ) unless line.first == '#'\n end\n target.shift # remove po header\n \n return target\n rescue Errno::ENOENT\n puts \"Can not found \\\"#{file}\\\", parsing skipped.\"\n return []\n end", "def process_compiled_file\n doc = Nokogiri::XML(File.open(@source))\n records = doc.xpath('//*[local-name()=\"mods\"]')\n records.each do |record|\n # record\n druid = record.parent['objectId']\n doc_node = Nokogiri::XML(record.to_s)\n mods_file = MODSFile.new(doc_node, @template_xml, @namespace)\n process_mods_file(mods_file, druid)\n end\n write_output if @analysis_only == false\n report_data_loss\n end", "def apply_rules_with_transitions(file, transitions, offsets, rules); end", "def generate_all(template_file, output_dir, override=false)\n parse_messages(template_file).each do |message|\n target_file = File.join(output_dir, \"#{message.name}.xml\")\n if !File.exist?(target_file) or override\n File.open(target_file, \"w\") do |file|\n file.write(generate_message_xml(message))\n end\n end\n end\nend", "def write_locale(directory, file, strings, plurals, locale, date); end", "def log(txt, level = \"INFO\", output_file = nil)\n safe_txt = privatize(txt)\n @output_file = output_file unless output_file.nil?\n puts log_message(safe_txt, level)\n if true #@output_file.nil?\n @fil = FileInUTF.open(@output_file,\"a\") if @fil.nil?\n @fil.puts(log_message(safe_txt, level))\n @fil.flush\n end\n end", "def doing_extract_data\n consumer = Fiber.new do |producer, queue|\n f = open(\"./tmp/database_doings/doing_phrases/phrases_ready_to_load.txt\", \"a\") do |f| \n loop do\n queue = producer.transfer(consumer, queue)\n puts f << queue\n queue.clear\n end\n raise StopIteration\n end\n end\n producer = Fiber.new do |consumer, queue|\n IO.foreach(\"./tmp/database_doings/doing_phrases/phrases_sorted.txt\") do |line| \n queue = \"\"\n puts queue\n sequence_text, sequence_creation, sequence_complete, sequence_lexigram, sequence_singular, sequence_lense, description, reference, anagram, name, phrase, research, external, internal, created_at = line.split(\"\\t\")\n extracted_data = sequence_text.to_textual\n queue << \"#{extracted_data}\\n\"\n break unless line\n consumer.transfer queue\n queue.clear\n end\n raise StopIteration\n end \n consumer.transfer(producer, [])\n after_break\n end", "def process_msgs\n end", "def prepareFile(infile, outfile)\r\n \r\n infileIo=File.new(infile)\r\n text = infileIo.readlines.join\r\n infileIo.close\r\n \r\n #include pdf files\r\n \r\n if @target == \"pdf\"\r\n text.gsub!(INCLUDE_PDF_PATTERN){|m| \r\n \r\n if $4\r\n pages=\"[pages=#{$4}]\"\r\n else\r\n pages=\"\"\r\n end\r\n \r\n if $5\r\n clearpage=$5\r\n else\r\n clearpage=\"cleardoublepage\"\r\n end\r\n \r\n if $3.length > 0\r\n level=$3\r\n else\r\n level=9\r\n end\r\n \r\n \"\\n\\n\\\\#{clearpage}\\n\\\\bookmark[level=#{level},page=\\\\thepage]{#{$2}}\\n\\\\includepdf#{pages}{#{$1}}\"\r\n }\r\n else #if not pdf then it gets a regular external link\r\n text.gsub!(INCLUDE_PDF_PATTERN){|m|\r\n \"[#{$2}](#{$1})\"\r\n } \r\n end\r\n \r\n #inject the anchors for references to traces ->[traceid]\r\n if @target == \"pdf\" then\r\n text.gsub!(TRACE_ANCHOR_PATTERN){|m| \"[#{$1}]#{$2}\\\\hypertarget{#{mkInternalTraceId($1)}}{}\"}\r\n else\r\n text.gsub!(TRACE_ANCHOR_PATTERN){|m| \"<a id=\\\"#{mkInternalTraceId($1)}\\\">[#{$1}]</a>#{$2}\"}\r\n end\r\n \r\n #substitute arbitrary anchors for arbitrary targets <a id=\"\">\r\n if @target == \"pdf\" then\r\n text.gsub!(ANY_ANCHOR_PATTERN){|m| \"\\\\hypertarget{#{mkInternalTraceId($1)}}{}\"}\r\n else\r\n # it is already html\r\n end\r\n \r\n #substitute arbitrary document internal references <a href=\"\"></a>\r\n if @target == \"pdf\" then\r\n text.gsub!(ANY_REF_PATTERN){|m| \"\\\\hyperlink{#{$1}}{#{mkTexTraceDisplay($2)}}\"}\r\n else\r\n # it is already html\r\n end\r\n \r\n # substitute the uptrace references\r\n text.gsub!(UPTRACE_REF_PATTERN){|m| \"}(#{prepareTraceReferences($1)})\"}\r\n \r\n # substitute the informal trace references\r\n text.gsub!(TRACE_REF_PATTERN){|m| \"[#{prepareTraceReferences($1)}]\"}\r\n \r\n File.open(outfile, \"w\"){|f| f.puts(text)}\r\n end", "def read(lines)\n ending = lines.find_index(1) { |l| ends_at?(l) }\n raise \"Did not find end of message (pattern '#{self.class}').\" if ending.nil?\n ending -= 1 unless @ending[:inclusive]\n\n # Use ending+1 since ending is the index when we drop the first line!\n msg = LogParser::Message.new(message: lines[0, ending + 1].join(\"\\n\"),\n preformatted: true, level: nil,\n pattern: self.class)\n [msg, ending + 1]\n end", "def logs target, file_path, reverse: true, branch: 'master', tag: 'HEAD'\n repo = get_repo target\n\n walker = Rugged::Walker.new repo\n walker.push last_commit_id(repo, branch: branch, tag: tag)\n walker.sorting Rugged::SORT_TOPO | Rugged::SORT_REVERSE\n get_object_id = ->(commit) { object_id_of(repo, commit.tree, file_path) }\n commits = walker.each.select(&get_object_id).uniq(&get_object_id)\n commits.reverse! if reverse\n\n groups = (0...commits.size).to_a.map {|i| [commits[i], commits[i + 1] || commits[i].parents.first] }\n tag_hash = oid_tag_hash repo\n groups.map do |new, old|\n {\n message: new.message,\n author: new.author,\n tags: tag_hash[new.oid].try(:map, &:name),\n diff: diff_between(repo, old, new, only: file_path)\n }\n end\n end", "def write_contents(filename = \"output.txt\")\n\t\t\tbegin\n\t\t\t\tputs \"Writing contents to file: \" + filename\n\t\t\t\tfile = File.open(filename, 'w')\n\t\t\t\t\n\t\t\t\t#TODO Load data mappings from xml file into the section tree\n\t\t\t\tif !@section_tree.nil? then\n\t\t\t\t\tfile.puts @section_tree.flatten\n\t\t\t\tend\n\t\t\t\t#size = line_count\n\t\t\t\t\n\t\t\t\t#for i in 0..size-1\n\t\t\t\t\t#Retrieve the dirty key from the line\n\t\t\t\t\t#dirtyKey = get_line_matchdata(i).to_s\n\t\t\t\t\t#If the line contains a key\n\t\t\t\t\t#if !dirtyKey.nil? && @replacements.count > 0 then\n\t\t\t\t\t\t#puts \"Dirty key: \" + dirtyKey\n\t\t\t\t\t\t#if @dirty_mappings.has_key? dirtyKey then\n\t\t\t\t\t\t\t#Retrieve the clean key from the dirty_mappings hash\n\t\t\t\t\t\t\t#cleanKey = @dirty_mappings[dirtyKey]\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t#if is_valid_key(cleanKey) > 0 then\n\t\t\t\t\t\t\t\t#puts \"Clean Key: \" + cleanKey\n\t\t\t\t\t\t\t\t#Retrieve the substitution value from the replacements table\n\t\t\t\t\t\t\t\t#value = get cleanKey\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t#Substitute the new value back into the content array\n\t\t\t\t\t\t\t\t#@contents[i] = @contents[i].gsub(dirtyKey, value.to_s)\n\t\t\t\t\t\t\t#end\n\t\t\t\t\t\t#end\n\t\t\t\t\t#end\n\t\t\t\t\n\t\t\t\t\t#Write the line to the file\n\t\t\t\t\t#file.puts @contents[i]\n\t\t\t\tend\n\t\t\t\n\t\t\tensure\n\t\t\t\tputs \"Closing output file: \" + filename\n\t\t\t\tfile.close unless file.nil?\n\t\t\tend", "def generate()\n\t\t\t@out = []\n\t\t\t@context = []\n\n\t\t\ttrim_nil_lines\n\n\t\t\t@lines.each_with_index do |line, i|\n\t\t\t\twrite_with_context(line.line, line.context, next_context(i))\n\t\t\tend\n\t\t\twrite_with_context(nil, [], [])\n\t\t\treturn @out.join\n\t\tend", "def to_file(i)\n raise RuntimeError, \"Call build_graph before to_file\" unless @people.count > 0 #Sanity check\n \n rec_filename = @c.reciprocated(i)\n unr_filename = @c.unreciprocated(i)\n \n if @people_cache.count > 0\n File.open(rec_filename+\"~\",\"w\") do |s|\n File.open(unr_filename+\"~\",\"w\") do |t|\n @people_cache.each do |k,v|\n v.each do |k2,v2|\n vf, vrev = v2\n if vf >= i\n if vrev >= i\n s.puts \"#{k} #{k2}\"\n elsif vrev == 0\n t.puts \"#{k} #{k2}\"\n end\n end\n end\n end\n end\n end\n File.rename(rec_filename+\"~\",rec_filename)\n File.rename(unr_filename+\"~\",unr_filename)\n else \n File.open(rec_filename+\"~\",\"w\") do |s|\n File.open(unr_filename+\"~\",\"w\") do |t|\n @people.each do |k,v|\n v.each do |k2,v2|\n if v2 >= i\n #if @people.include? k2 # Don't care, since k2 has >= n messages sent, even if k2 sends none to this set\n if @people[k2] && (@people[k2].include? k)\n if @people[k2][k] >= i\n s.puts \"#{k} #{k2}\" \n @people_cache[k] ||= {}\n @people_cache[k][k2] = [v2, @people[k2][k]]\n end\n else # k2 doesn't point to k, so 0 messages sent\n t.puts \"#{k} #{k2}\"\n @people_cache[k] ||= {}\n @people_cache[k][k2] = [v2, 0]\n end\n #else\n #puts \"#{k2} not included in @people but #{k} sent #{v2} messages\"\n #raise RuntimeException, \"@people must include #{k2}\"\n #end\n puts \"#{k2} not included in @people but #{k} sent #{v2} messages\" unless @people[k2]\n end\n end\n end\n end\n end\n File.rename(rec_filename+\"~\",rec_filename)\n File.rename(unr_filename+\"~\",unr_filename)\n end\n end", "def parse_file()\n\n if !self.has?()\n return\n end\n\n @logs = {}\n @configs = {}\n current_index = 0\n current_config = {}\n parsing_config = false\n config_script = \"\"\n\n ::IO.foreach(self.path()) do |line|\n line.strip!\n if line.match(/\\}/)\n parsing_config = false\n @configs[current_index] = current_config\n current_config = {}\n current_index += 1\n config_script = \"\"\n\n else\n\n if parsing_config\n config = line.split(/\\s+/, 2)\n config.reject!(&:empty?) # Oh Ruby, why do you have 10 ways to do everything?\n #config[0].strip!\n\n if config[0] == \"postrotate\"\n config_script = config[0]\n current_config[config[0]] = []\n\n else\n\n if config_script != \"\"\n if config[0] == \"endscript\"\n current_config[config_script] << config[0]\n #current_config[config[0]] = \"\"\n config_script = \"\"\n\n else\n #line.strip!\n current_config[config_script] << line\n\n end\n\n else\n val = true\n if config.length == 2\n val = config[1]\n end\n current_config[config[0]] = val\n\n end\n end\n\n else\n logs = line.split(/\\s+/)\n logs.reject! { |c| c.empty? || c == \"{\" } # remove blank entries\n logs.each do |log|\n log.strip!\n @logs[log] = current_index\n end\n\n if line.match(/\\{/)\n parsing_config = true\n end\n\n end\n\n end\n\n\n end # foreach\n\n end", "def read_post_text_files\n open(MENTION_FILE, 'r:UTF-8') do |file|\n @reply_mention_text = file.readlines.collect{|line| line.strip}\n end\n\n open(NOTMEITAN_FILE, 'r:UTF-8') do |file|\n @notmeitan_text = file.readlines.collect{|line| line.strip}\n end\n\n open(REPLY_CSHARP_FILE, 'r:UTF-8') do |file|\n @reply_csharp_text = file.readlines.collect{|line| line.strip}\n end\n\n open(REPLY_MORNING_FILE, 'r:UTF-8') do |file|\n @reply_morning_text = file.readlines.collect{|line| line.strip}\n end\n\n open(REPLY_SLEEPING_FILE, 'r:UTF-8') do |file|\n @reply_sleeping_text = file.readlines.collect{|line| line.strip}\n end\n\n open(REPLY_DEPARTURE_FILE, 'r:UTF-8') do |file|\n @reply_departure_text = file.readlines.collect{|line| line.strip}\n end\n\n open(REPLY_RETURN_FILE, 'r:UTF-8') do |file|\n @reply_return_text = file.readlines.collect{|line| line.strip}\n end\n\n log 'notmeitan text:'\n for s in @notmeitan_text do\n log ' ' + s\n end\n\n log 'reply text:'\n for s in @reply_mention_text do\n log ' ' + s\n end\n\n log 'reply csharp text:'\n for s in @reply_csharp_text do\n log ' ' + s\n end\n\n log 'reply departure text:'\n for s in @reply_departure_text do\n log ' ' + s\n end\n\n log 'reply returning text:'\n for s in @reply_return_text do\n log ' ' + s\n end\n end", "def parse(content, open_tags, prev_level, root_level)\n File.open(\"#{file.path}\", \"r\").each_line do |line|\n\n next if /^\\s*$/ === line\n\n line = line.chomp.split(/\\s+/, 3)\n \n level = line.shift.to_i\n \n if prev_level.nil?\n prev_level = root_level = level-1 # not assuming base level is 0\n end\n \n (level..prev_level).to_a.reverse.each do |i|\n content << \"\\t\" * (i - root_level) if content[-1] == ?\\n\n content << \"</#{open_tags.pop}>\\n\"\n end\n \n if line[0][0] == ?@\n xref_id, tag = line\n xref_id.gsub!(/^@(.*)@$/, '\\1')\n id_attr = ' id=\"' + xref_id + '\"'\n value = ''\n else\n tag, value = line\n id_attr = ''\n value ||= ''\n if /^@(\\w+)@$/ === value\n value = \"<xref>#{$1}</xref>\"\n else\n value.gsub!(/&/, '&amp;')\n value.gsub!(/</, '&lt;')\n value.gsub!(/>/, '&gt;')\n end\n end\n \n if tag == 'CONC' || tag == 'CONT'\n content << (tag == 'CONT' ? \"\\n\" : \" \")\n content << value\n level -= 1\n else\n content << \"\\n\" if level > prev_level\n tag.downcase!\n content << \"\\t\" * (level - root_level) + \"<#{tag}#{id_attr}>#{value}\"\n open_tags.push tag\n end\n \n prev_level = level\n end\n content\n end", "def read_keywords\n messages = (list(:cur) + list(:new)).inject({}) { |m, msg| m[msg.unique_name] = msg ; m }\n t = Time.now.to_i / 300\n keywords = []\n state = :head\n # process :list\n list_file = File.join(keyword_dir, ':list')\n File.open(list_file).each_line do |line|\n line.strip!\n if state == :head\n if line.empty?\n state = :messages\n next\n end\n keywords << line\n else\n key, ids = line.split(':')\n if msg = messages[key]\n msg.set_keywords(ids.split(/\\s/).map {|id| keywords[id.to_i - 1] })\n end\n end\n end if File.exist?(list_file)\n # collect keyword files\n keyword_files = (Dir.entries(keyword_dir) - %w(. .. :list)).inject({}) do |keyword_files, file|\n if file =~ /^\\.(\\d+)\\.(.*)$/\n n = $1\n key = $2\n else\n n = t + 1\n key = file\n FileUtils.mv(File.join(keyword_dir, file), File.join(keyword_dir, \".#{n}.#{key}\"))\n end\n if msg = messages[key]\n (keyword_files[key] ||= []) << [n, key]\n else # message doesn't exist\n fname = File.join(keyword_dir, file)\n if File.stat(fname).ctime < (Time.now - (15 * 60))\n File.unlink(fname)\n end\n end\n next(keyword_files)\n end\n # process keyword files\n keyword_files.each_pair do |key, files|\n files.sort! { |a, b| a[0] <=> b[0] }\n files[0..-2].each { |f| File.unlink(File.join(keyword_dir, \".#{f.join('.')}\")) } if files.last[0] < t\n msg = messages[key]\n file = (File.exist?(File.join(keyword_dir, files.last[1])) ? files.last[1] : \".#{files.last.join('.')}\")\n current_keywords = File.read(File.join(keyword_dir, file)).split(/\\s+/)\n msg.set_keywords(current_keywords)\n if (add = (current_keywords - keywords)).any?\n keywords += add\n end\n end\n # rebuild :list\n @keywords = {}\n tmp_file = File.join(path, 'tmp', ':list')\n File.open(tmp_file, 'w') { |f|\n f.write(keywords.join(\"\\n\")+\"\\n\\n\")\n messages.each_pair do |key, msg|\n next unless msg.keywords\n f.puts([key, msg.keywords.map{|kw| keywords.index(kw) + 1 }.sort.join(' ')].join(':'))\n @keywords[key] = msg.keywords\n end\n }\n FileUtils.mv(tmp_file, list_file)\n end", "def map_multi_lingual_strings(dictionary_node, output_node, lang)\n dictionary_node.each do |key, object_at_node|\n # ignore any nodes that are the terminal translation, e.g. {:en => 'Name'}\n return unless object_at_node.is_a?(Hash)\n\n # object_at_node might be another nested hash\n if object_at_node.has_key?(lang)\n # an example of this condition is:\n # {name => {:en => 'Name', :ja => 'JA name', :hint => {:en => '', :ja => ''}}}\n # will have object_at_node of {:en => 'Name', :ja => 'JA name', :hint => {:en => '', :ja => ''}}\n\n # if there is a lang code node, then map that value to the output node\n output_node[key] = object_at_node[lang]\n\n else\n # an example of this condition is:\n # {:activerecord => {:attributes => {}}}\n # will have object_at_node {:attributes => {}}\n output_node[key] ||= {}\n map_multi_lingual_strings(object_at_node, output_node[key], lang)\n\n end\n end\n end", "def strings_to_lines_textualed\n strings = File.read(file_name)\n strings.extend Textual\n new = strings.to_textual\n end", "def files_to_translate\n folders = [\n \"app\",\n \"lib\",\n \"config\",\n locale_path\n ].join(\",\")\n\n exts = [\n \"rb\",\n \"erb\",\n \"haml\",\n \"slim\",\n \"rhtml\",\n \"js\",\n \"jsx\",\n \"vue\",\n \"coffee\",\n \"handlebars\",\n \"hbs\",\n \"mustache\"\n ].join(\",\")\n\n Dir.glob(\n \"{#{folders}}/**/*.{#{exts}}\"\n )\n end", "def transform_files\n extract\n reorder_files\n transform @attendance_file, 'att' unless @attendance_file.blank?\n transform @enroll_file, 'enroll' unless @enroll_file.blank?\n transform @ili_file, 'ili' unless @ili_file.blank?\n end", "def translate_all(keys)\n returning ActiveSupport::OrderedHash.new do |oh|\n # fix the order first(for multi thread translating)\n keys.each do |key|\n if key.to_s.include? '.'\n key_prefix, key_suffix = key.to_s.split('.')[0...-1], key.to_s.split('.')[-1]\n key_prefix.inject(oh) {|h, k| h[k] ||= ActiveSupport::OrderedHash.new}[key_suffix] = nil\n else\n oh[key] = nil\n end\n end\n threads = []\n keys.each do |key|\n threads << Thread.new do\n logger.debug \"translating #{key} ...\"\n Thread.pass\n if key.to_s.include? '.'\n key_prefix, key_suffix = key.to_s.split('.')[0...-1], key.to_s.split('.')[-1]\n existing_translation = I18n.t(key, :default => key_suffix, :locale => locale_name)\n key_prefix.inject(oh) {|h, k| h[k]}[key_suffix] = existing_translation != key_suffix ? existing_translation : translator.translate(key_suffix)\n else\n existing_translation = I18n.t(key, :default => key, :locale => locale_name)\n oh[key] = existing_translation != key ? existing_translation : translator.translate(key)\n end\n end\n end\n threads.each {|t| t.join}\n end\n end", "def process_file(file_name)\n\tputs \"Processing File.... \"\n\n\tbegin\n\t\tIO.foreach(file_name) do |line|\n\t\t\t# call cleanup_title method to extract song titles\n\t\t\ttitle = cleanup_title(line)\n\n\t\t\t#ignore titles with non-english characters\n\t\t\tif title[/(\\w|\\s|\\')*/] == title\n\t\t\t\ttitle = title.split\n\t\t\t\ti = 0;\n\n\t\t\t\twhile i <= title.size-1 #loop through array of words\n\t\t\t\t\thasKey = $bigrams[title[i]] #first word\n\t\t\t\t\thasChild = $bigrams[title[i]] && $bigrams[title[i]][title[i+1]] #second word that follows first\n\t\t\t\t\tbreak if title[i+1].nil? #break if this is the last word in the array\n\n\t\t\t\t\tif hasChild #if child of primary key exists, add one to the count\n\t\t\t\t\t\t$bigrams[title[i]][title[i+1]] += 1;\n\t\t\t\t\telsif hasKey #if primary key exists, add new child with initial count = 1\n\t\t\t\t\t\t$bigrams[title[i]][title[i+1]] = 1;\n\t\t\t\t\telse #if primary key does not exist, add it and child key\n\t\t\t\t\t\t$bigrams[title[i]] = {title[i+1] => 1};\n\t\t\t\t\tend\n\t\t\t\t\ti += 1;\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tputs \"Finished. Bigram model built.\\n\"\n\trescue\n\t\tSTDERR.puts \"Could not open file\"\n\t\texit 4\n\t end\nend", "def process\n outs = []\n @infiles.each do |f|\n if f.instance_of? Hash\n dat = f[:block].(f[:file])\n if dat.instance_of? String\n out << dat + \"\\n\\n\"\n else\n fail TypeError, \"#{dat.class} returned, String expected\"\n end\n elsif f.instance_of? String\n outs << File.read(f)\n elsif f.instance_of? Array\n outs << f.map { |fn| File.read(fn) }\n else\n fail TypeError, \"Infile #{f.inspect} is not a hash nor a string nor an array!\"\n end\n end\n out = outs.join(\"\\n\\n\")\n if @block\n out = @block.(out)\n end\n if @outfile\n File.delete(@outfile) if File.exist? @outfile\n File.open(@outfile, 'w') do |f|\n f.write(out)\n end\n end\n out\n end", "def on_postbuild(src_tree, dst_tree, converter)\n current_branch = @git_itf.current_branch\n\n dst_tree.traverse_preorder do |level, dst_node|\n unless dst_node.leaf?\n dst_node.data = DataDelegator.new if dst_node.data.nil?\n dst_node.data.add(FileHistory.new(current_branch))\n next\n end\n\n src_node = dst_node.data.src_node\n next unless src_node.pathname.exist?\n\n # Get the commit history of the doc as an Array of entries\n file_log = FileHistory.new(current_branch)\n @git_itf.file_log(src_node.pathname.to_s).each do |log_entry|\n file_log.history << FileHistory::LogEntry.new(\n log_entry[\"date\"],\n log_entry[\"author\"],\n log_entry[\"message\"],\n log_entry[\"sha\"]\n )\n end\n dst_node.data.add(file_log)\n end\n end", "def tx(files, results, test, mediainfo, output_path)\n mutex = Mutex.new\n files.each do |src_file| \n t = Thread.new do\n puts \"Transcoding #{src_file}\"\n\n begin\n basename = File.basename(src_file.to_s, '.mov')\n filename = \"#{cleanup_filename(basename.to_s)}-#{test.filename}\"\n tx_command = process_command_line(test, mediainfo, src_file, File.join(output_path, filename))\n\n tx_start = Time.now\n success = run(tx_command, filename)\n tx_end = Time.now\n ensure\n if (@cleanup)\n File.unlink(filename)\n end\n end\n\n if success\n result = TestResult.new(tx_command, tx_start, tx_end)\n mutex.synchronize do\n results << result\n end\n end\n end\n end\nend", "def doing_phrases_file_decomma\n consumer = Fiber.new do |producer, queue|\n f = open(\"./tmp/database_doings/doing_phrases/mysql_history_001.txt\", \"a\") do |f| \n loop do\n queue = producer.transfer(consumer, queue)\n puts f << queue\n queue.clear\n end\n raise StopIteration\n end\n end\n producer = Fiber.new do |consumer, queue|\n IO.foreach(\"./tmp/database_doings/doing_phrases/phrases_sorted.txt\") do |line| \n queue = \"\"\n puts queue\n #sequence_text = line.to_textual.de_comma\n sequence_text = line.to_textual\n queue << \"#{sequence_text}\\n\"\n break unless line\n consumer.transfer queue\n queue.clear\n end\n raise StopIteration\n end \n consumer.transfer(producer, [])\n after_break\n end", "def main(args)\n cli_options = parse_args(args)\n if cli_options[:filepath] == nil\n puts \"must include a file path\"\n exit 1\n end\n\n parsed = nil\n\n begin\n parsed = parse_tm(File.read(cli_options[:filepath]))\n rescue Errno::ENOENT => e\n $stderr.puts \"File '#{cli_options[:filepath]}' not found: #{e}\"\n end\n\n options = { :output => 'tex', :expand_aliases => true, :duration => 500, :filepath => nil, :template => nil }\n .merge(parsed[:options].delete_if { |k, v| v.nil? })\n .merge(cli_options.delete_if { |k, v| v.nil? })\n\n puts \"options: \" + options.inspect\n\n parsed[:description] = transform(parsed[:description], options)\n\n if options[:template] != nil\n output = output_begin(parsed, options)\n run(parsed) do |state|\n output = output_stream(output, parsed, options, state)\n end\n output_end(output, parsed, options)\n else\n File.write(\n options.filepath + '.tex',\n generate_template(parsed[:description], options)\n )\n end\n\nend", "def texts_to_translations(db_texts, texts)\n db_text_map = hashify(db_texts, proc { |i| i.from_text.value })\n texts.collect do |text|\n next unless (db_text = db_text_map[text.to_s])\n @listener.update_progress(1) if @listener\n provider = db_text.provider\n translation = build_text(db_text.value, @to_locale)\n Result.new(text, translation, provider, from_database: true)\n end.compact\n end", "def log_msgs(debug = true)\n @msg_log.logMessages.each do |msg|\n # DLM: you can filter on log channel here for now\n if /openstudio.*/.match(msg.logChannel) #/openstudio\\.model\\..*/\n # Skip certain messages that are irrelevant/misleading\n next if msg.logMessage.include?(\"Skipping layer\") || # Annoying/bogus \"Skipping layer\" warnings\n msg.logChannel.include?(\"runmanager\") || # RunManager messages\n msg.logChannel.include?(\"setFileExtension\") || # .ddy extension unexpected\n msg.logChannel.include?(\"Translator\") # Forward translator and geometry translator\n # Report the message in the correct way\n if msg.logLevel == OpenStudio::Info\n @runner.registerInfo(msg.logMessage) \n elsif msg.logLevel == OpenStudio::Warn\n @runner.registerWarning(\"[#{msg.logChannel}] #{msg.logMessage}\")\n elsif msg.logLevel == OpenStudio::Error\n @runner.registerError(\"[#{msg.logChannel}] #{msg.logMessage}\")\n elsif msg.logLevel == OpenStudio::Debug && debug\n @runner.registerInfo(\"DEBUG - [#{msg.logChannel}] #{msg.logMessage}\")\n end\n end\n end\n end", "def log_msgs(debug = true)\n @msg_log.logMessages.each do |msg|\n # DLM: you can filter on log channel here for now\n if /openstudio.*/.match(msg.logChannel) #/openstudio\\.model\\..*/\n # Skip certain messages that are irrelevant/misleading\n next if msg.logMessage.include?(\"Skipping layer\") || # Annoying/bogus \"Skipping layer\" warnings\n msg.logChannel.include?(\"runmanager\") || # RunManager messages\n msg.logChannel.include?(\"setFileExtension\") || # .ddy extension unexpected\n msg.logChannel.include?(\"Translator\") # Forward translator and geometry translator\n # Report the message in the correct way\n if msg.logLevel == OpenStudio::Info\n @runner.registerInfo(msg.logMessage) \n elsif msg.logLevel == OpenStudio::Warn\n @runner.registerWarning(\"[#{msg.logChannel}] #{msg.logMessage}\")\n elsif msg.logLevel == OpenStudio::Error\n @runner.registerError(\"[#{msg.logChannel}] #{msg.logMessage}\")\n elsif msg.logLevel == OpenStudio::Debug && debug\n @runner.registerInfo(\"DEBUG - [#{msg.logChannel}] #{msg.logMessage}\")\n end\n end\n end\n end", "def convert\n STDERR.print \"\\nThis may take 10 minutes or more. Lines processed: \"\n line_in_count = 0\n\n # Create an object to store *all* lines of the *output* CSV\n @csv_out_data = FasterCSV.generate(FCSV_OUT_OPTS){|csv_out| \n\n # Iterate thru each *input* line\n FasterCSV.foreach(@in_file, FCSV_IN_OPTS) {|line_in|\n line_in_count += 1\n if line_in_count == 1\n self.class.verify_csv_in_headers(line_in.headers)\n @csv_out_headers = WILL_INCLUDE_INPUT_COLUMNS ? CSV_OUT_COLUMNS + CSV_IN_COLUMNS : CSV_OUT_COLUMNS\n end\n\n # Iterate thru each *output* column\n line_out = []\n @csv_out_headers.each_with_index{|col,i|\n csv_out << @csv_out_headers if line_in_count == 1 && i == 0\t# Header line\n\n case col\n when RmidItem, PrefixColOwner, PrefixColList\n line_out << line_in[col]\n when HdlItem\n line_out << get_handle_for_rmid(line_in[RmidItem])\n when HdlColOwner\n line_out << get_handle_for_collection_prefix(line_in[PrefixColOwner])\n when HdlColList\n if line_in[PrefixColList]\n prefixes = line_in[PrefixColList].split(VALUE_DELIMITER)\n handles = prefixes.inject([]){|a,prefix| a << get_handle_for_collection_prefix(prefix)}\n line_out << handles.join(VALUE_DELIMITER)\n else\n line_out << \"\"\n end\n end\n }\n csv_out << line_out\n STDERR.print \"#{line_in_count} \" if line_in_count % 200 == 0\n }\n }\n STDERR.puts \"; Total lines #{line_in_count} \"\n end", "def parse(input_file, label_count)\n output = []\n\n input_file.each_line do |line|\n next if line.match(/\\/\\/.*/) \n\n if match = line.match(/push (?<segment>.+) (?<index>.+)/)\n push_constant_asm = %{\n @%s\n D=A\n @SP\n A=M\n M=D\n @SP\n M=M+1\n }\n push_relative_asm = %{\n @%s\n D=A\n @%s\n A=D+M\n D=M\n @SP\n A=M\n M=D\n @SP\n M=M+1\n }\n push_pointer_asm = %{\n @%s\n D=A\n @L#{label_count}\n D;JEQ\n @THAT\n D=M\n @L#{label_count + 1}\n 0;JMP\n (L#{label_count})\n @THIS\n D=M\n (L#{label_count + 1})\n @SP\n A=M\n M=D\n @SP\n M=M+1\n }\n push_indirect_asm = %{\n @%s\n D=A\n @%s\n A=D+A\n D=M\n @SP\n A=M\n M=D\n @SP\n M=M+1\n }\n case match[:segment] \n when \"constant\"\n output << (push_constant_asm % match[:index].strip).split\n when \"local\"\n output << (push_relative_asm % [match[:index].strip, \"LCL\"]).split\n when \"argument\"\n output << (push_relative_asm % [match[:index].strip, \"ARG\"]).split\n when \"this\"\n output << (push_relative_asm % [match[:index].strip, \"THIS\"]).split\n when \"that\"\n output << (push_relative_asm % [match[:index].strip, \"THAT\"]).split\n when \"pointer\"\n output << (push_pointer_asm % match[:index].strip).split\n label_count = label_count + 2\n when \"temp\"\n output << (push_indirect_asm % [match[:index].strip, \"R5\"]).split\n when \"static\"\n output << (push_indirect_asm % [match[:index].strip, \"16\"]).split\n end\n end\n\n pop_relative_asm = %{\n @%s\n D=M\n @%s\n D=D+A\n @R13\n M=D\n @SP\n AM=M-1\n D=M\n @R13\n A=M\n M=D\n }\n pop_pointer_asm = %{\n @%s\n D=A\n @L#{label_count}\n D;JEQ\n @THAT\n D=A\n @L#{label_count + 1}\n 0;JMP\n (L#{label_count})\n @THIS\n D=A\n (L#{label_count + 1})\n @R13\n M=D\n @SP\n AM=M-1\n D=M\n @R13\n A=M\n M=D\n }\n pop_indirect_asm = %{\n @%s\n D=A\n @%s\n D=D+A\n @R13\n M=D\n @SP\n AM=M-1\n D=M\n @R13\n A=M\n M=D\n }\n if match = line.match(/pop (?<segment>.+) (?<index>.+)/)\n case match[:segment] \n when \"local\"\n output << (pop_relative_asm % [\"LCL\", match[:index].strip]).split\n when \"argument\"\n output << (pop_relative_asm % [\"ARG\", match[:index].strip]).split\n when \"this\"\n output << (pop_relative_asm % [\"THIS\", match[:index].strip]).split\n when \"that\"\n output << (pop_relative_asm % [\"THAT\", match[:index].strip]).split\n when \"pointer\"\n output << (pop_pointer_asm % match[:index].strip).split\n label_count = label_count + 2\n when \"temp\"\n output << (pop_indirect_asm % [match[:index].strip, \"R5\"]).split\n when \"static\"\n output << (pop_indirect_asm % [match[:index].strip, \"16\"]).split\n end\n end\n\n math_asm = %{\n @SP\n D=M\n AM=D-1\n D=M\n A=A-1\n M=M%sD\n }\n output << (math_asm % \"+\").split if line.match(/add/)\n output << (math_asm % \"-\").split if line.match(/sub/)\n\n binary_logic_asm = %{\n @SP\n D=M\n AM=D-1\n D=M\n A=A-1\n M=D%sM\n }\n output << (binary_logic_asm % \"|\").split if line.match(/or/)\n output << (binary_logic_asm % \"&\").split if line.match(/and/)\n\n unary_logic_asm = %{\n @SP\n A=M-1\n D=M\n M=%sD\n }\n output << (unary_logic_asm % \"-\").split if line.match(/neg/)\n output << (unary_logic_asm % \"!\").split if line.match(/not/)\n\n comp_asm = %{\n @SP\n AM=M-1\n D=M\n A=A-1\n D=M-D\n @L#{label_count}\n D;%s\n D=0\n @L#{label_count + 1}\n 0;JMP\n (L#{label_count})\n D=-1\n (L#{label_count + 1})\n @SP\n A=M-1\n M=D\n }\n if line.match(/eq/)\n output << (comp_asm % \"JEQ\").split\n label_count = label_count + 2\n end\n if line.match(/gt/)\n output << (comp_asm % \"JGT\").split\n label_count = label_count + 2\n end\n if line.match(/lt/)\n output << (comp_asm % \"JLT\").split\n label_count = label_count + 2\n end\n end\n return [output, label_count]\nend", "def convertAllUnits\n # Let the user know what we're doing\n puts \"Converting units.\"\n startTime = Time.now\n\n # Load allStruct and traverse it. This will create Unit and Unit_hier records for all units,\n # and delete any extraneous old ones.\n DB.transaction do\n allStructPath = \"/apps/eschol/erep/xtf/style/textIndexer/mapping/allStruct.xml\"\n open(allStructPath, \"r\") { |io|\n convertUnits(Nokogiri::XML(io, &:noblanks).root, {}, {}, Set.new)\n }\n end\nend", "def transform_enrollment_file\n #puts \"Transforming enrollment file for #{@district.name}\"\n att_array = []\n enr_array = []\n tmp_array = []\n #Load up the attendance and enrollment files into arrays\n for file_path in @files\n if !File.directory?(file_path)\n IO.foreach(file_path, sep_string = get_sep_string(file_path)) do |line|\n unless line.blank?\n line.gsub!(/[\"][^\"]*[\"]/) { |m| m.gsub(',','|') }\n att_array.push(line) if file_path.downcase.index('att')\n enr_array.push(line) if file_path.downcase.index('enroll')\n end \n end\n end\n end\n #Process enrollment file for rewrite\n @file_to_write = File.open(File.join(@dir, \"tmp_e.tmp\"),\"w\")\n #Run through each attendance record, when tea_id matches, use enrollment value to re-build enrollment file\n #with report dates\n att_array.each do |rec|\n date,@tmp_tea_id,absent = rec.split(\",\") if @allowed_attendance_headers.length == 3\n date,@tmp_tea_id,school_name,absent = rec.split(\",\") if @allowed_attendance_headers.length == 4\n if date.downcase.index(\"date\").blank?\n enr_array.each do |line|\n @enrolled = 0\n tmp_line = line.split(@delimiter)\n if tmp_line.length == 3\n if is_date?(tmp_line.first.gsub('\"',''))\n enroll_date,tea_id,enrolled = tmp_line\n else\n tea_id,name,enrolled = tmp_line\n end \n elsif tmp_line.length == 4\n enroll_date,tea_id,name,enrolled = tmp_line \n end\n unless @six_digit_campus_id\n tea_id = \"0#{value}\" if tea_id.length == 2\n tea_id = \"00#{value}\" if tea_id.length == 1\n tea_id = \"#{@district.district_id}#{tea_id}\"\n end\n @tmp_tea_id.gsub!('\"',\"\")\n tea_id.gsub!('\"',\"\")\n @tmp_tea_id.gsub!(\"'\",\"\")\n tea_id.gsub!(\"'\",\"\")\n tea_id.strip!\n @tmp_tea_id.strip!\n enrolled.strip!\n enrolled.gsub!('\"',\"\")\n enrolled.gsub!(\"'\",\"\")\n enrolled.gsub!(\"|\",\"\")\n if tea_id.to_i != @tmp_tea_id.to_i\n next\n else\n @enrolled = enrolled.to_i\n break\n end\n end\n tmp_array.push('\"'+date.gsub('\"',\"\")+'\"')\n tmp_array.push('\"'+@tmp_tea_id.gsub('\"',\"\")+'\"')\n tmp_array.push('\"'+school_name.gsub('\"',\"\").gsub('|',',')+'\"') unless school_name.blank?\n tmp_array.push('\"'+\"#{@enrolled}\"+'\"')\n @file_to_write.puts tmp_array.join(\",\")\n tmp_array = [] \n end\n end\n @file_to_write.close\n for file_path in @files\n if file_path.downcase.index('enroll')\n #Delete file just read\n File.delete(file_path)\n #Rename temp file to previously read file\n File.rename(File.join(@dir, \"tmp_e.tmp\"), file_path)\n end\n end\n end", "def write_thread_message_labels! thread_structure, labels\n thread_structure.flatten.each do |docid|\n next if docid < 0 # psuedo-root\n key = \"mlabels/#{docid}\"\n oldlabels = load_set key\n write_set key, labels\n\n ## write to index\n index_docid = get_index_docid_from_store_docid docid\n (oldlabels - labels).each do |l|\n puts \"; removing ~#{l} from #{index_docid} (store #{docid})\" if @debug\n @index.remove_label index_docid, l\n end\n (labels - oldlabels).each do |l|\n puts \"; adding ~#{l} to #{index_docid} (store #{docid})\" if @debug\n @index.add_label index_docid, l\n end\n end\n end", "def convert_msg filename, in_dir, out_dir\n new_filename = to_outfile in_dir, filename, out_dir, filename.gsub( /.msg$/, '.eml' )\n rv = Heathen::Executioner.new(logger).execute( \"#{File.dirname __FILE__}/msgconvert.pl\", filename, new_filename )\n raise \"Cannot run msgconvert.pl (see README.md for installation instructions\" if rv != 0\n raise \"Failed to convert #{filename} to .eml\" unless File.exist? new_filename\n new_filename\nend", "def load_translations(*filenames); end", "def load_translations(*filenames); end", "def parse_in_order(*files); end", "def process_directory\n Dir.foreach(@source) do |f|\n next unless f.match(/[a-z]{2}[0-9]{3}[a-z]{2}[0-9]{4}\\.xml/)\n druid = get_druid_from_filename(f)\n mods_file = MODSFile.new(Nokogiri::XML(File.open(File.join(@source, f))), @template_xml, @namespace)\n process_mods_file(mods_file, druid)\n end\n write_output if @analysis_only == false\n report_data_loss\n end", "def save filename\n File.open(filename, 'w') { |file| @translated.each {|value| file.write(\"#{value}\") } } \n end" ]
[ "0.59356", "0.5324292", "0.53112483", "0.52723163", "0.5198342", "0.51301986", "0.51266295", "0.5124699", "0.5114014", "0.5016925", "0.49943918", "0.4972415", "0.49414447", "0.49370247", "0.4913986", "0.4822616", "0.48075086", "0.47923738", "0.47459108", "0.4742143", "0.47181147", "0.46909356", "0.468853", "0.46862236", "0.46844965", "0.46523666", "0.46333995", "0.46319276", "0.46261394", "0.4616407", "0.4593586", "0.45929074", "0.45802385", "0.45582378", "0.45579207", "0.45269713", "0.45236412", "0.45170638", "0.45114103", "0.45037857", "0.44940326", "0.44844425", "0.44820443", "0.4478971", "0.4460428", "0.4459749", "0.44577134", "0.44569814", "0.44477192", "0.44347757", "0.4432622", "0.44252515", "0.44150412", "0.44090444", "0.44048402", "0.4390094", "0.43854845", "0.4383803", "0.43823972", "0.43814456", "0.43753096", "0.437397", "0.43720484", "0.4364915", "0.43642488", "0.43576756", "0.43565476", "0.43545297", "0.43513983", "0.4350985", "0.43399578", "0.43399206", "0.4338783", "0.4325935", "0.43186247", "0.43184438", "0.4315004", "0.43136278", "0.43107352", "0.43059567", "0.43022236", "0.42991284", "0.42939797", "0.42909226", "0.42866862", "0.42754206", "0.42718783", "0.42687234", "0.42687234", "0.4267527", "0.42625865", "0.42603144", "0.42561805", "0.42553222", "0.42542556", "0.42528167", "0.42528167", "0.42457956", "0.4239785", "0.42384568" ]
0.7104412
0
scoped collection for sortable column on Customers
def scoped_collection end_of_association_chain.includes([:customer]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __sortable__\n self\n end", "def sortable_columns\n @sortable_columns ||= ['Passport.name']\n end", "def sortable_columns\n resource_class.column_names + self.class.custom_sort_fields.keys.map(&:to_s)\n end", "def sortable_sort\n @sortable_sort\n end", "def sortable_columns\n # list columns inside the Array in string dot notation.\n # Example: 'users.email'\n # @sortable_columns ||= []\n @sortable_columns ||= ['users.name' ,'users.phone', 'users.address']\n end", "def sortable_columns\n {'id' => \"#{Contact.table_name}.id\"}.merge(available_columns.inject({}) {|h, column|\n h[column.name.to_s] = column.sortable\n h\n })\n end", "def sortable_columns\n [\"date\", \"dow\", \"sortable_title\", \"receipts\"]\n end", "def add_sort_field(*) super end", "def sortable_fields\n []\n end", "def collection_scope; end", "def sortable_columns\n available_columns.inject({}) {|h, column|\n h[column.name.to_s] = column.sortable\n h\n }\n end", "def sort_column\n super \"Room\", \"sort_order\"\n end", "def sort_column\n super \"Room\", \"sort_order\"\n end", "def customers_ordered\n customers.all(:order => 'name_normalized ASC')\n end", "def sortable(pos)\n @sortable[pos]\n end", "def sortable_name\n Person.sortable_name(self.public_name)\n end", "def index\n @sortable = Sortable.new\n @sortables = Sortable.all\n @column = Column.new\n @columns = Column.all\n end", "def sortable_columns\n {'id' => \"#{Issue.table_name}.id\"}.merge(available_columns.inject({}) {|h, column|\n h[column.name.to_s] = column.sortable\n h\n })\n end", "def order_collection!\n sort_field = (params[:sort] || '').underscore\n sort_direction_key = (params[:sortDirection] || '').downcase\n sort_direction = SortDirection::LIST[sort_direction_key]\n return if sort_field.blank? || sort_direction.blank?\n\n self.collection = collection.order(\n sort_field => sort_direction\n )\n end", "def user_sortable_list(sortable)\n sortable.order.join(\"\\n\")\n end", "def collection\n attr_name = \"@\" + self.resources_configuration[:self][:collection_name].to_s\n unless instance_variable_get(attr_name)\n col = end_of_association_chain\n col = col.sorted(params[:sort], default_sort)\n col = col.page(params[:page])\n instance_variable_set(attr_name, col)\n end\n instance_variable_get(attr_name)\n end", "def set_sortable\n @sortable = Sortable.find(params[:id])\n end", "def sort_column\n super \"User\", \"lastname\"\n end", "def sort_column\n super \"User\", \"lastname\"\n end", "def sort_column\n super \"User\", \"lastname\"\n end", "def sort_order\n super\n end", "def sort_vc_grid\n assert_privileges(\"miq_request_edit\")\n @edit = session[:edit]\n sort_grid('vc', @edit[:wf].get_field(:sysprep_custom_spec, :customize)[:values])\n end", "def order\n order = sortable_column_order do |column, direction|\n case column\n when \"name\", \"username\", \"email\"\n \"LOWER(#{column}) #{direction}\"\n when \"admin\"\n \"#{column} #{direction}\"\n else\n 'LOWER(username) ASC'\n end\n end\n end", "def user_sort_column\n institution_sort = SortableTable::SortColumnDefinition.new('tenant_id')\n name_sort = SortableTable::SortColumnCustomDefinition.new('name',\n asc: 'last_name asc, first_name asc',\n desc: 'last_name desc, first_name desc')\n role_sort = SortableTable::SortColumnDefinition.new('role')\n login_time_sort = SortableTable::SortColumnDefinition.new('last_login')\n sort_table = SortableTable::SortTable.new([name_sort, institution_sort, role_sort, login_time_sort])\n sort_table.sort_column(params[:sort], params[:direction])\n end", "def collection_names; end", "def sortable_attributes\n @sortable_attributes ||= []\n end", "def scoped_collection(_parent_records)\n raise NotImplementedError.new 'override #scoped_collection in a subclass'\n end", "def collection\n\n\n\n if !options[:collection] && column\n\n\n\n pluck_column\n\n\n\n else\n\n\n\n super\n\n\n\n end\n\n\n\n end", "def ordered_list; end", "def marc_sortable_author\n lambda do |record, accumulator|\n accumulator << Marc21Semantics.get_sortable_author(record)\n end\n end", "def sort_composer\n @ole.SortComposer\n end", "def sort_column\n super \"Umbra::Record\", \"title_sort\"\n end", "def manageable_sortable(column, title = nil, options = {})\n title ||= column.titleize\n\n if respond_to?(:sort_column) && respond_to?(:sort_direction)\n css_class = column && sort_column && column.to_sym == sort_column.to_sym ? \"sort_#{sort_direction}\" : nil\n direction = column && sort_column && column.to_sym == sort_column.to_sym && sort_direction == \"asc\" ? \"desc\" : \"asc\"\n options[:class] = [options[:class], css_class].compact.join(\" \")\n\n link_to title, params.merge(:sort => column, :direction => direction, :page => nil), options\n else\n title\n end\n end", "def update_sortable(pos, newVal)\n sort_function = @parent.sort_function(pos)\n if sort_function\n @sortable[pos] = sort_function.call(newVal)\n else\n @sortable[pos] = newVal\n end\n end", "def sort_column\n nil\n end", "def collection\n col_attrs = super\n col_attrs.merge(id: col_attrs[:identifier].first).merge(open_access)\n end", "def sortable_list_view_fields\n return @sortable_list_view_fields if defined? @sortable_list_view_fields\n\n @sortable_list_view_fields ||= all_list_view_fields.select(&:human_readable?)\n end", "def credit_customer\n #@customer = Customer.order(name: :asc)\n end", "def create_extended_collection(name, mkCol)\n end", "def sortable(sortable)\n raise \"sortable must be a boolean.\" unless is_bool? sortable\n @sortable = sortable\n self\n end", "def index\n @chemicals = Product.order(sort_column + \" \" + sort_direction)\n end", "def cloned_user_sortable(preset, attribute)\n if (order = preset.try(attribute)) && order.persisted?\n order.class.new(order.attributes.except('id', 'scenario_id'))\n end\n end", "def sortable?\n !@sortable.nil?\n end", "def do_params_sort scope\n if self.class.custom_sort_fields[sort_column].present?\n scope = self.class.custom_sort_fields[sort_column].call scope, sort_direction\n elsif resource_class.column_names.include? sort_column\n scope.reorder(resource_class.table_name+\".\"+sort_column + \" \" + sort_direction)\n end\n end", "def sort_column\n Admin::Coleccion.column_names.include?(params[:sort]) ? params[:sort] : \"nombre\" \n end", "def index\n if current_customer.admin?\n @ordered_items = OrderedItem.all\n else\n @ordered_items = OrderedItem.all.where(:customer_id => current_customer.id)\n end\n end", "def index\n #@contracts = Contract.all.order(sort_column + \" \" + sort_name).uniq{|contract| contract.name}\n @contracts = Contract.all.order(sort_column + \" \" + sort_name).uniq{|contract| contract.name}\n end", "def find_collection model = controller_model\n parent = find_first_parent\n collection = parent ? parent.send(type_of(model)) : model\n collection = collection.with_permissions_to(:show)\n collection = collection.limit(offset_amount).offset(params[:offset].to_i)\n \n if params[:order].present? && match = valid_order_column?(model, params[:order])\n \n @collection_ordered_table = match[:table]\n \n # No need to sanitize sql query because it is validated against\n # valid_order_column? which ensures valid format, table name, column\n # name, and direction. Sort by whether the ordered column is NULL or ''\n # to put all meaningful rows at the top.\n collection = collection.reorder(\n \"(#{match[:table]}.#{match[:column]} IS NULL OR\" +\n \" #{match[:table]}.#{match[:column]} = '') asc, #{params[:order]}\"\n )\n end\n \n \n \n if params[:search].present? && collection.respond_to?(:search)\n collection = collection.search(params[:search])\n end\n \n collection\n end", "def sort_id\n self.id\n end", "def customer\n @customer = Customer.order(name: :asc)\n end", "def sortable?\n self.sortable = Presenting::Defaults.grid_is_sortable unless defined? @sort_name\n self.sortable = self.id if @sort_name == true\n !@sort_name.blank?\n end", "def sort_entries; end", "def add_order_scopes(col)\n if self.column_names.include?(col.to_s)\n politely_add_named_scope :\"in_#{col}_order\", lambda { order(\"#{col}\") }\n politely_add_named_scope :\"in_reverse_#{col}_order\", lambda { order(\"#{col} DESC\") }\n end\n end", "def sortable?(attr)\n model_class.column_names.include?(attr.to_s) || \n sort_mappings.include?(attr.to_sym)\n end", "def add_order_scopes(col)\n if self.column_names.include?(col.to_s)\n politely_add_named_scope :\"in_#{col}_order\", { :order => \"#{col}\" }\n politely_add_named_scope :\"in_reverse_#{col}_order\", { :order => \"#{col} DESC\" }\n end\n end", "def ordering_query; end", "def sort_order\n sortable_column_order do |column, direction|\n if resource_handler.model_associations.present? && column.match(/\\./)\n table, column = column.split('.')\n if resource_handler.model_associations.detect { |a| a.table_name == table }\n \"#{table}.#{column} #{direction}\"\n else\n fallback_sort_order(direction)\n end\n elsif resource_handler.model.column_names.include?(column.to_s)\n \"#{resource_handler.model.table_name}.#{column} #{direction}\"\n else\n fallback_sort_order(direction)\n end\n end\n end", "def sort_column\n ItemTemplate.column_names.include?(params[:sort]) ? params[:sort] : \"name\"\n end", "def sort_column\n columns = %w[id]\n columns[params[:iSortCol_0].to_i]\n end", "def update_sort_key\n @item.sort_key = @sortable[@parent.sort_index]\n @item.reversed = @parent.reversed? ? -1 : 1\n end", "def sort_column(sort_column)\n columns = CandidateSheet.permitted_params.map { |attr| \"candidate_sheet.#{attr}\" }\n columns << 'account_name'\n columns << 'completed_date'\n columns.include?(sort_column) ? sort_column : 'account_name'\n end", "def sortPlayers\r\n\t@table.current_players = @table.sort\r\n\t@table.players = @table.current_players.dup\r\nend", "def iterator\n AlphabeticalOrderIterator.new(@collection)\n end", "def get_list_columns(object)\n MyAdmin.get_list_columns(object)\n end", "def cur_ordering\r\n @orderings\r\n end", "def index\n @people = Person.order(\"#{sort_column} #{sort_direction}\")\n end", "def sortable(*columns, validate: true)\n columns.each { |column| validate_column(column, validate) }\n sortable_columns.concat(columns.map(&:to_s))\n end", "def apply!(collection, value:, active_sorts_hash:, params: {})\n if type == :scope\n if active_sorts_hash.keys.include?(param)\n collection.public_send(internal_name, *mapped_scope_params(active_sorts_hash[param], params))\n elsif default.present?\n # Stubbed because currently Sift::Sort does not respect default\n # default.call(collection)\n collection\n else\n collection\n end\n elsif type == :string || type == :text\n if active_sorts_hash.keys.include?(param)\n collection.order(\"LOWER(#{internal_name}) #{individual_sort_hash(active_sorts_hash)[internal_name]}\")\n else\n collection\n end\n else\n collection.order(individual_sort_hash(active_sorts_hash))\n end\n end", "def sortable?\n true\n # not self.action? and\n # !options[:through] && !@column.nil?\n end", "def sort_name\n @ole.SortName\n end", "def collection_name; end", "def collection_name; end", "def collection_name; end", "def collection\n apply_scopes(super).order(:date).includes{[person, shift.shift_group, shift.county]}.uniq\n end", "def make_sortable(options={})\n sortable_element_js(javascript_variable('this'), options)\n end", "def orderable? = super && index.orderable?", "def order_by(&blk)\n OrderedCollection.new(@things.sort_by(&blk))\n end", "def sortable_params\n params.require(:sortable).permit(:position, :column)\n end", "def studies_order\n order = sortable_column_order do |column, direction|\n case column\n when \"name\"\n \"LOWER(studies.name) #{direction}\"\n when \"active\", \"public\", \"promoted\"\n \"studies.#{column} #{direction}\"\n else\n 'LOWER(studies.name) ASC'\n end\n end\n end", "def default_sort\n 'name asc'\n end", "def check_sort_options #:nodoc:\r\n table_name = @tables.first[1]\r\n return if session[table_name][:sort].nil? || @records.class != Mongoid::Criteria\r\n\r\n sort, direction = session[table_name][:sort].split(' ')\r\n @records = @records.order_by( sort => direction.to_i )\r\nend", "def is_sorted\r\n false\r\n end", "def sort_column\n # sortable_columns.include?(params[:column]) ? params[:column] : \"name\"\n # if params[:column] == \"postalCode\"\n # logger.info \"##0############### POSTAL ##################\"\n # \"postalCode\"\n # else\n params[:column] ? params[:column] : \"updated_at\"\n # end\n end", "def disableable_component_collection\n @settable.disableable_components.map { |c| [c.display_name, c.key.to_s] }.sort\n end", "def sort_column\n @houses = \n User.column_names.include?(params[:sort]) ? params[:sort] : \"name\"\n User.column_names.include?(params[:sort]) ? params[:sort] : \"email\"\n User.column_names.include?(params[:sort]) ? params[:sort] : \"phone\"\n User.column_names.include?(params[:sort]) ? params[:sort] : \"house_id\"\n User.column_names.include?(params[:sort]) ? params[:sort] : \"NOT(admin)\"\n end", "def default_sort_option\n\t\t'name'\n\tend", "def change_sort(column_name)\n if sorter.any? && sorter.first.match?(column_name)\n sorter.toggle_order\n else\n sorter.push(column_name)\n end\n self.page = 1\n self\n end", "def sortable?\n !faceted? && !hard_paginate?\n end", "def sort\n conditions = scope_condition\n list_items = order_by_position(conditions, :created_at.desc).to_a\n\n list_items.each_with_index do |list_item, index|\n list_item.set_my_position index + 1\n end\n end", "def sort\n conditions = scope_condition\n list_items = order_by_position(conditions, :created_at.desc).to_a\n\n list_items.each_with_index do |list_item, index|\n list_item.set_my_position index + 1\n end\n end", "def ordered_custom_fields(name)\n send(:\"#{name}_custom_fields\").sort { |a, b| (a.position || 0) <=> (b.position || 0) }\n end", "def inject_combo_for_name_column(c)\n netzke_attrs = config[:owner].data_class.netzke_attributes.map{ |a| a[:name] }\n c.merge(:editor => {:xtype => :combo, :store => netzke_attrs, :force_selection => true})\n end", "def collection; end", "def collection; end", "def sortable_class(options = {})\n on = options[:on] || :sort_position\n scope = options[:scope]\n\n class_exec do\n default_scope { order(on) }\n\n validates on, presence: true,\n numericality: { only_integer: true,\n greater_than: 0 },\n uniqueness: (scope.nil? ? true : { scope: scope })\n end\n\n sortable_methods(options)\n end" ]
[ "0.673435", "0.6656733", "0.65638524", "0.64786065", "0.6463767", "0.6199091", "0.61962616", "0.6162556", "0.60689604", "0.6068808", "0.6054389", "0.603937", "0.603937", "0.6008708", "0.59576327", "0.59016144", "0.57791984", "0.57561135", "0.5751532", "0.57115704", "0.56576496", "0.56514174", "0.56003445", "0.56003445", "0.56003445", "0.55829763", "0.5576432", "0.55219936", "0.5499989", "0.54996747", "0.54805684", "0.5436984", "0.54160815", "0.5406934", "0.5405844", "0.5399205", "0.53832597", "0.5348016", "0.5307332", "0.5294018", "0.52843183", "0.52709246", "0.5265824", "0.5265355", "0.5264809", "0.5250238", "0.52488655", "0.52455103", "0.5230995", "0.52269644", "0.5226559", "0.52161473", "0.52155375", "0.52128243", "0.5210009", "0.51887643", "0.51886755", "0.5168985", "0.5156397", "0.51493806", "0.5141107", "0.5113182", "0.51096344", "0.5085686", "0.50850064", "0.50797975", "0.50747836", "0.50657964", "0.50468343", "0.5034725", "0.5034272", "0.5032436", "0.50290704", "0.5025966", "0.50198174", "0.50121737", "0.50121737", "0.50121737", "0.5006893", "0.50050455", "0.5004801", "0.49993905", "0.49966794", "0.49947897", "0.49888888", "0.49856374", "0.49710846", "0.4966842", "0.4963757", "0.4960261", "0.49589998", "0.49588916", "0.49504074", "0.49392092", "0.49392092", "0.49318594", "0.49280617", "0.49231985", "0.49231985", "0.49209794" ]
0.5515113
28
Pause for one second before each vote Pass in array of candidates to vote from
def vote(candidates) sleep(1) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vote \n \t\n voters = Voter.voters_created\n \n politicians = Voter.voters_created.select {|voter| voter if voter.is_a? Politician}\n vote_count = Hash.new(0)\n who_voted_for_whom = Hash.new(0)\n #introduce an element of fairness by varying when candidates get to visit voters \n campaign_stops = politicians.product(voters).shuffle\n\n campaign_stops.each do |stump_speech|\n campaigner = stump_speech[0]\n campaignee = stump_speech[1]\n\n campaigner.stump(campaignee)\n \n #need way to cancel out votes \n\n if campaignee.cast_vote(campaigner)\n puts \"\\tYou bet!\"\n vote_count[campaigner.name] += 1\n who_voted_for_whom[campaignee.name] = campaigner.name\n puts\n elsif campaignee.voted == true \n puts \"\\tSorry, I've already voted\"\n puts\n elsif campaignee.cast_vote(campaigner) && (campaigner == campaignee)\n puts \"\\tI am #{campaigner.name}, and I am voting for myself!\"\n vote_count[campaigner.name] += 1 \n who_voted_for_whom[campaignee.name] = campaigner.name\n puts\n elsif ( !campaignee.cast_vote(campaigner) ) && ( !campaignee.is_a? Politician )\n puts \"\\tI am not persuded by your logic\"\n puts\n end \n end \n\n sorted_vote_count = vote_count.to_a.sort {|a,b| b[1] <=> a[1]}\n puts\n puts\n puts \"\\t\\tWINNER\"\n puts \"\\tAnd the winner is #{sorted_vote_count[0][0]}!\"\n puts \"\\t\\tWINNER\"\n puts\n puts \"\\tAnd because this is a transparent democracy, here's the vote totals:\"\n puts \n puts \"\\t#{vote_count}\"\n puts\n puts \"\\tAnd let's see who voted for whom so we can purge the disloyal.\"\n puts\n puts \"\\t#{who_voted_for_whom}\"\n\n Process.exit\n end", "def vote \n \t\n voters = Voter.voters_created\n \n politicians = Voter.voters_created.select {|voter| voter if voter.is_a? Politician}\n vote_count = Hash.new(0)\n who_voted_for_whom = Hash.new(0)\n #introduce an element of fairness by varying when candidates get to visit voters \n campaign_stops = politicians.product(voters).shuffle\n\n campaign_stops.each do |stump_speech|\n campaigner = stump_speech[0]\n campaignee = stump_speech[1]\n\n campaigner.stump(campaignee)\n \n #need way to cancel out votes \n\n if campaignee.cast_vote(campaigner)\n puts \"\\tYou bet!\"\n vote_count[campaigner.name] += 1\n who_voted_for_whom[campaignee.name] = campaigner.name\n puts\n elsif campaignee.voted == true \n puts \"\\tSorry, I've already voted\"\n puts\n elsif campaignee.cast_vote(campaigner) && (campaigner == campaignee)\n puts \"\\tI am #{campaigner.name}, and I am voting for myself!\"\n vote_count[campaigner.name] += 1 \n who_voted_for_whom[campaignee.name] = campaigner.name\n puts\n elsif ( !campaignee.cast_vote(campaigner) ) && ( !campaignee.is_a? Politician )\n puts \"\\tI am not persuded by your logic\"\n puts\n end \n end \n\n sorted_vote_count = vote_count.to_a.sort {|a,b| b[1] <=> a[1]}\n puts\n puts\n puts \"\\t\\tWINNER\"\n puts \"\\tAnd the winner is #{sorted_vote_count[0][0]}!\"\n puts \"\\t\\tWINNER\"\n puts\n puts \"\\tAnd because this is a transparent democracy, here's the vote totals:\"\n puts \n puts \"\\t#{vote_count}\"\n puts\n puts \"\\tAnd let's see who voted for whom so we can purge the disloyal.\"\n puts\n puts \"\\t#{who_voted_for_whom}\"\n\n voted_reset\n main_menu\n end", "def get_results\n\t\tputs \"\"\n\t\twinner = nil\n\t\t@candidates.each do |candidate|\n\t\t\t@winner ||= candidate\n\t\t\t@winner = candidate if @votes.count(candidate) > @votes.count(@winner)\n\t\t\tsleep(1)\n\t\t\tputs \"#{candidate.name} has #{@votes.count(candidate)} votes.\"\n\t\tend\n\t\tsleep(1)\n\t\tputs \"\\n#{@winner.name} won the election!\"\n\tend", "def vote\n\t\t@players.keys.select {|x| @players[x][:state] == :alive}.sample\n\tend", "def vote( to_proposal )\r\n sender = @voters[msg.sender]\r\n assert sender.voted? == false && to_proposal < @proposals.length\r\n sender.voted = true\r\n sender.vote = to_proposal\r\n @proposals[to_proposal].vote_count += sender.weight\r\nend", "def get_votes\n\t\t@voters.each{ |voter| @votes << voter.vote(@candidates) }\n\tend", "def hi\r\n puts \"\\n\"*2+'Welcome to Vivixx Elections 2017. '+ \"\\n\"*2\r\n puts \"\\n\"+'Here are the candidates ' + \"[Votes in: #{@v}]:\"+\"\\n\"*2\r\n ctr=0\r\n @candidates.each do\r\n ctr +=1\r\n puts \"#{ctr}. #{@candidates[ctr-1]}\"\r\n end\r\n vote\r\nend", "def seconds_for_expedition\n possible_votes / 3 + 1\n end", "def runoff(voters)\n\n def find_winner(voters, tallies=nil)\n if tallies\n min = tallies.values.min\n tallies.keep_if { |candidate, v| v == min }\n voters.each { |voter| voter.reject! {|vote| tallies.include? vote }}\n return nil if voters.length == 0\n end\n new_tallies = Hash.new(0)\n voters[0].each {|candidate| new_tallies[candidate] = 0 }\n voters.each_with_object(new_tallies) { |voter, nt| nt[voter[0]] += 1 }\n total_votes = new_tallies.values.reduce(:+);\n new_tallies.each { |candidate, v|\n return candidate if v / total_votes.to_f > 0.5\n }\n return find_winner(voters, new_tallies)\n end\n\n find_winner(voters)\n\nend", "def init_votes params, current_user_id\n #create votes for each user in the game\n game.users.each do |user|\n event_votes.create_vote_for_game user, params, current_user_id\n end\n reload\n\n Userpost.create_event_created(self)\n\n end", "def vote\r\n while @v < 20 do\r\n puts \"\\n\"*2+'Type the name of the candidate you want to vote for:'+\"\\n\"*2\r\n @vote = gets.chomp.strip\r\n case @vote.downcase\r\n when 'mika'\r\n @votes[0]+=1\r\n @v+=1\r\n puts \"\\n\"+'You voted for Mika.'.center(93)+\"\\n\"*2+'Thank you for voting.'.center(93)\r\n gets\r\n header\r\n hi\r\n break #so it won't go through the rest of the loop\r\n when 'reggie'\r\n @votes[1]+=1\r\n @v+=1\r\n puts \"\\n\"+'You voted for Reggie.'.center(93)+\"\\n\"*2+'Thank you for voting.'.center(93)\r\n gets\r\n header\r\n hi\r\n break\r\n when 'kenneth'\r\n @votes[2]+=1\r\n @v+=1\r\n puts \"\\n\"+'You voted for Kenneth.'.center(93)+\"\\n\"*2+'Thank you for voting.'.center(93)\r\n gets\r\n header\r\n hi\r\n break\r\n when 'trevor'\r\n @votes[3]+=1\r\n @v+=1\r\n puts \"\\n\"+'You voted for Trevor.'.center(93)+\"\\n\"*2+'Thank you for voting.'.center(93)\r\n gets\r\n header\r\n hi\r\n break\r\n when 'end'\r\n votetally\r\n break\r\n else\r\n puts \"\\n\"+'That is not one of the candidates. Pls try again.'.center(93)\r\n gets\r\n header\r\n hi\r\n end\r\n end\nvotetally\r\nend", "def runoff voters\n votes = get_leading_votes_from(voters)\n leading_candidate = who_has_most votes\n return leading_candidate if is_winner?(leading_candidate, votes)\n losers = who_has_least(votes, get_candidates_hash(voters))\n return nil if losers.empty?\n runoff(next_round(voters,losers))\nend", "def set_candidates(pv)\n @candidates = pv\n @value = @initial_value\n end", "def scheduled_update(time_elapsed)\n if time_elapsed >= 48.hours\n @motion.voting!\n elsif !@motion.objected? && time_elapsed >= 24.hours\n @motion.voting!\n end\n end", "def setUpNextVotingStep\r\n\t\tstep = current_user.isOnStep\r\n\t\tif step < 3 and current_user.campaignVotes.where(step: step).empty?\r\n\t\t\tcampaignVotes = genCampaignsForVoting(step)\r\n\t\telsif step >= 3\r\n\t\t\tcampaignVotes = current_user.campaignVotes.where.not(voteType: 0)\r\n\t\t\t@votedFor = current_user.campaignVotes.where(voteType: 2)\r\n\t\telse\r\n\t\t\tcampaignVotes = current_user.campaignVotes.where(step: step)\r\n\t\tend\r\n\r\n\t\tfor i in 0..2\r\n\t\t\tnext if campaignVotes[i].nil?\r\n\t\t\t@campaignVoting << campaignVotes[i].campaign\r\n\t\tend\r\n\tend", "def set_vote_tally!\n self.vote_tally = self.get_upvotes.size - self.get_downvotes.size\n end", "def maybe_pause_evolution\n\n end", "def simulate(preferences, vote_order, debug = false)\n\t#winner is an array where the index indicates the round of voting, and the value \n\t#indicates the candidate that will win given that they've made it to this round\n\twinner = []\n\tnum_rounds = vote_order.length - 1\n\tnum_candidates = preferences.length\n\n\t#start with the final round of voting and build backwards\n\tnum_rounds.downto(1).each do |i|\n\t\tmatchup_a = vote_order[i - 1]\n\t\t#a vote for matchup_b is a vote for b OR whoever is going to win in the next round\n\t\tmatchup_b = vote_order[i]\n\n\t\t#vote is an array where the index indicates the candidate, and the value indicates which of the \n\t\t#two current candidates they are voting for (0 = a, 1 = b)\n\t\tvote = []\n\n\t\tif winner.length == 0\n\t\t\t#if this is the last round, next winner is matchup_b\n\t\t\tnext_winner = matchup_b\n\t\telse\n\t\t\t#if this is not the last round, next winner is the winner in the next round\n\t\t\tnext_winner = winner[0]\n\t\tend \n\n\t\t0.upto(num_candidates - 1).each do |j|\n\t\t\t#if candidate j prefers next_winner to a, they vote for b. Otherwise they vote for a.\n\t\t\t#note there can never be a tie in this formulation.\n\t\t\tif debug\n\t\t\t\tputs \"Candidate \" + j.to_s + \" voting between \" + matchup_a.to_s + \" and \" + next_winner.to_s + \"...\"\n\t\t\tend\n\t\t\tif preferences[j].index(matchup_a) < preferences[j].index(next_winner)\n\t\t\t\tif debug\n\t\t\t\t\tputs matchup_a\n\t\t\t\tend\n\t\t\t\tvote[j] = 0\n\t\t\telse\n\t\t\t\tif debug\n\t\t\t\t\tputs next_winner\n\t\t\t\tend\n\t\t\t\tvote[j] = 1\n\t\t\tend\n\t\tend\n\t\t#if vote.inject(:+) < num_candidates.to_f / 2.0\n\t\tif vote.inject(:+) <= num_candidates.to_f / 2.0\n\t\t\t#a has it, a is this round's winner\n\t\t\tif debug\n\t\t\t\tputs \"**** \" + matchup_a.to_s + \" wins!\"\n\t\t\tend\n\t\t\twinner.unshift(matchup_a)\n\t\telse\n\t\t\t#b has it, this round's winner is whoever wins the next round\n\t\t\tif debug\n\t\t\t\tputs \"**** \" + next_winner.to_s + \" wins!\"\n\t\t\tend\n\t\t\twinner.unshift(next_winner)\n\t\tend\n\tend\n\treturn winner\nend", "def vote_up\n update_votes(1)\n end", "def vote \n\t\tsuggestion = Suggestion.find(suggestion_params[:id])\n\t\tuser_vote = UserVote.where({\n\t\t\t\t:user_hash => cookies[:user_hash],\n\t\t\t\t:suggestion_id => suggestion.id}).first\n\t\t\n\t\tif suggestion_params[:abort]\n\n\t\t\tnow = Time.now.to_i\n\t\t\tif now < (suggestion.voting_started_at + 55)\n\t\t\t\tsuggestion.voting_started_at = now - 55\n\t\t\tend\n \n else\n\n\t\t\tif user_vote # the user has already voted on this\n\t\t\t\tlogger.debug 'vote exists'\n\t\t\t\tif suggestion_params[:direction] == 'up' && user_vote.vote < 1\n\t\t\t\t\tuser_vote.vote += 1\n\t\t\t\t\tsuggestion.score += 1\n\t\t\t\t\t#user_reward(suggestion, 2)\n\t\t\t\telsif suggestion_params[:direction] == 'down' && user_vote.vote > -1\n\t\t\t\t\tuser_vote.vote -= 1\n\t\t\t\t\tsuggestion.score -= 1\n\t\t\t\t\t#user_reward(suggestion, -2)\n\t\t\t\tend\n\t\t\t\t\n\t\t\telse # the user votes on this for the first time\n\t\t\t\tlogger.debug 'new vote'\n\t\t\t\tif suggestion_params[:direction] == 'up' \n\t\t\t\t\tsuggestion.score += 1\n\t\t\t\t\t#user_reward(suggestion, 1)\n\t\t\t\t\tv = 1\n\t\t\t\telse \n\t\t\t\t\tsuggestion.score -= 1\n\t\t\t\t\t#user_reward(suggestion, -1)\n\t\t\t\t\tv = -1\n\t\t\t\tend\n\t\t\t\tuser_vote = UserVote.new(\n\t\t\t\t\t:user_hash => cookies[:user_hash],\n\t\t\t\t\t:suggestion_id => suggestion.id,\n\t\t\t\t\t:vote => v\n\t\t\t\t)\n\t\t\tend\n\t\t\t\n\t\t\tuser_vote.save\t\t\t\t\t\t\n\t\t\n\t\tend\t\t\t\n\t\t\n\n\t\tif suggestion_params[:top_boost]\n\t\t\t\tsuggestion.name2 = cookies[:user_name]\n\t\tend\n\t\t\t\t\t\t\t\t\n\t\tsuggestion.save\n\n\t\tPusher['chez_ois_chat'].trigger('update_suggestions_' + suggestion_params[:avatar_id], load_suggestions(suggestion_params[:avatar_id]))\n\t\t#Pusher['chez_ois_chat'].trigger('update_highscores', load_highscores)\n\t\trender json: suggestion\n\tend", "def vote\n vote_state = false\n user = User.find_by_electoral_id(params[:electoral_id])\n election = Election.find(params[:election_id])\n candidate = Candidate.find(params[:candidate_id])\n\n if user and election\n\n user_voting = UserVoting.where(\"election_id = #{election.id} and user_id = #{user.id}\").first\n voting = Vote.where( \"election_id = #{election.id} and candidate_id = #{candidate.id}\").first\n\n if user_voting\n count = user_voting.voting_count\n if count.to_i < election.max_votes_per_user\n if candidate\n #TODO: Transaction have to be implemented \n user_voting.update_attribute(:voting_count, count+1)\n vote_state = true\n else\n response = {message: Message.invalid_candidate}\n return response, :not_found\n end\n else\n response = {message: Message.forbidden_voting}\n return response, :forbidden\n end\n else\n if !user_voting\n params.update(voting_count: 1, user_id: user.id)\n UserVoting.create!(user_voting_params) \n end\n vote_state = true\n end\n else\n response = {message: Message.invalid_user_or_election}\n return response, :not_found\n end\n if vote_state \n if !voting \n voting = Vote.create!(vote_params)\n end\n v_count = voting.vote_count.to_i\n voting.update_attribute(:vote_count, v_count + 1)\n response = {message: Message.voting_success}\n return response, :created\n end\n end", "def vote\n\t\trandomPlayer\n\tend", "def safety_start_player_turn\n ai_done_tb if (@safety_tb+=1)> TM::Defaults::SafetyTimer &&TM.queues_empty?\n end", "def processVote(campaign_id)\r\n\t\tcase current_user.isOnStep\r\n\t\twhen 0..2\r\n\t\t\tcampaignVotes = current_user.campaignVotes.where(step: current_user.isOnStep)\r\n\t\t\t(0..2).each do |i|\r\n\t\t\t\tnext if campaignVotes[i].nil?\r\n\t\t\t\tcampaignVotes[i].update(voteType: 0)\r\n\t\t\tend\r\n\t\t\tcampaignVotes[campaign_id].update(voteType: 1)\r\n\t\twhen 3\r\n\t\t\tcampaignVotes = current_user.campaignVotes.where.not(voteType: 0)\r\n\r\n\t\t\tcampaignVotes[campaign_id].update(voteType: 2)\r\n\t\t\tcampaignVotes[campaign_id].campaign.roundScore += 10\r\n\t\t\tcampaignVotes[campaign_id].campaign.save\r\n\r\n\t\t\tsend_notification_user(\r\n\t\t\t\t\tcampaignVotes[campaign_id].campaign.user, \r\n\t\t\t\t\t1, \r\n\t\t\t\t\t'Someone voted for your nominee!', \r\n\t\t\t\t\t'/campaigns/' + campaignVotes[campaign_id].campaign.id.to_s, \r\n\t\t\t\t\tcampaignVotes[campaign_id].campaign.image, \r\n\t\t\t\t\tfalse)\r\n\t\t\tcampaignVotes[campaign_id].campaign.user.points += 1\r\n\t\t\tcampaignVotes[campaign_id].campaign.user.save\r\n\r\n\t\t\tsend_notification(1, 'You successfully voted this round!', '', '', false)\r\n\t\t\tcurrent_user.points += 1\r\n\t\t\tcurrent_user.save\r\n\t\t\tcurrent_user.campaignVotes.where(voteType: 1).each do |v|\r\n\t\t\t\tv.campaign.roundScore += 1\r\n\t\t\t\tv.campaign.save\r\n\t\t\tend\r\n\t\tend\r\n\tend", "def delegate( to )\r\n sender = @voters[msg.sender] # assigns reference\r\n assert sender.voted? == false\r\n\r\n while @voters[to].delegate != Address(0) && @voters[to].delegate != msg.sender do\r\n to = @voters[to].delegate\r\n end\r\n assert to != msg.sender\r\n\r\n sender.voted = true\r\n sender.delegate = to\r\n delegate_to = @voters[to]\r\n if delegate_to.voted\r\n @proposals[delegate_to.vote].vote_count += sender.weight\r\n else\r\n delegate_to.weight += sender.weight\r\n end\r\nend", "def runoff(voters)\n ballot= Hash.new\n # populate the hash with 0's\n voters.each do |votes|\n votes.each do |v|\n ballot[v] = 0;\n end\n end\n while voters.size/2 >= ballot.values.max && ballot.size > 1\n # reset ballot totals to zero at beginning of each round\n ballot.each { |k,v| ballot[k] = 0 }\n # tally votes for this round\n voters.each do |vote|\n votee = vote.select { |x| ballot.include?(x)}.first\n ballot[votee] += 1\n end\n ballot = ballot.select { |k,v| v > ballot.values.min }\n return nil if ballot.empty?\n end\n ballot.select { |k,v| v == ballot.values.max }.keys[0]\nend", "def vote\r\n\t\tif Campaign.where(votable: true).count < 15\r\n\t\t\trespond_to do |format|\r\n\t\t\t\tformat.js { render partial: \"home/not_enough_campaigns\"}\r\n\t\t\tend\r\n\t\telsif current_user && current_user.isOnStep <= 4\r\n\t\t\tif params[:id].to_i >= 0 && current_user.isOnStep < 4\r\n\t\t\t\tprocessVote(params[:id].to_i)\r\n\t\t\t\tcurrent_user.isOnStep += 1\r\n\t\t\t\tcurrent_user.save\r\n\t\t\tend\r\n\r\n\t\t\t@campaignVoting = []\r\n\t\t\tsetUpNextVotingStep\r\n\r\n\t\t\tif current_user.isOnStep == 4\r\n\t\t\t\trespond_to do |format|\r\n\t\t\t\t\tformat.js { render partial: \"campaignVotingDone\"}\r\n\t\t\t\tend\r\n\t\t\telse\r\n\t\t\t\trespond_to do |format|\r\n\t\t\t\t\tformat.js { render partial: \"campaignVoting\"}\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\telse\r\n\t\t\trespond_to do |format|\r\n\t\t\t\tformat.js { render partial: \"home/not_logged_in\"}\r\n\t\t\tend\r\n\t\tend\r\n\tend", "def add_votes(user)\n # select 20 random photos in week 0\n\n ids = db[:photos].select(:id).where(ready: true, week: 0).order(Sequel.lit('RANDOM()')).limit(20).all.map{|p| p[:id] }\n\n ids.each do |id|\n Volt.as_user(user) do\n photo = store.photos.where(id: id).first.sync\n\n up = rand(2) == 0\n\n if up\n photo.up_vote_count += 1\n else\n photo.down_vote_count += 1\n end\n\n store.votes.create(photo_id: id, up: up).sync\n end\n end\n end", "def required_votes\n possible_votes / 2 + 1\n end", "def wait_for_presses(attempts=2, timeout=@timeout)\n @intervals = []\n attempts.times do\n interval = []\n timer = Time.now\n while not_pressed? && (Time.now-timer) < timeout do\n sleep @measure_pause\n end\n interval << Time.now-timer\n timer = Time.now\n while pressed? do\n sleep @measure_pause\n end\n interval << Time.now-timer\n @intervals << interval\n end\n @intervals\n end", "def votes_left\n vote_total = 10\n # @submissions = Submission.find_all_by_story_id(params[:id])\n @submissions.each do |submission|\n vote_total -= submission.vote\n end\n vote_total\nend", "def vote up\n end", "def pause\n \tsleeper(25)\n end", "def pause\n \tsleeper(25)\n end", "def vote\n elected = 0\n @output.each_index do |o|\n elected = @output[o] > @output[elected] ? o : elected\n end\n elected\n end", "def vote\n if @current_worker and taskname = params[:task]\n displayed = params[:displayed] || []\n displayed = displayed.map { |el| el.to_i }\n\n flagged = params[:flagged] || []\n flagged = flagged.map { |el| el.to_i }\n\n approved = displayed - flagged\n\n approved.each do |fid|\n if foto = Photo.find_by_id(fid)\n foto.create_vote('pass', taskname, @current_worker)\n end\n end\n\n flagged.each do |fid|\n if foto = Photo.find_by_id(fid)\n foto.create_vote('fail', taskname, @current_worker)\n end\n end\n end\n\n redirect_to :action=>'review'\n end", "def run\n while ( rcs = remaining_candidates ).any?\n rcs.each do | candidate |\n while !candidate.exhausted_preferences? && candidate.free?\n candidate.propose_to_next_preference\n end\n end\n end\n self\n end", "def waitlist_update(candidate_data)\n candidate_data.each do |element|\n events_candidates << element\n element.allot_batch!\n element.save\n end\n end", "def set_vote_candidate\n @vote_candidate = VoteCandidate.find(params[:id])\n end", "def vote_or_random (list, index)\n # Set variable outside the loop so it is accessible within the method\n voterandom = nil\n loop do\n system 'clear'\n print \"Would you like to vote or have the program randomly pick an option for you?\\n\\n1. Vote\\n2. Random\\n\\nPlease enter 1 to vote or 2 to have the program randomly select a winner: \"\n # Converts user input into an Integer, if user input is not a number or does not contain a number at the start it will return 0\n voterandom = gets.to_i \n if voterandom == 1 || voterandom == 2 # Check if the user input a valid option\n break # If the user selected an valid option break out of the loop\n else\n print \"\\nThat is not a valid option please enter 1 to vote or 2 to randomly pick an option. \"\n sleep 1\n end\n end\n\n # Check which method to run based on valid user input\n if voterandom == 1 \n collect_votes(list, index)\n else\n random_winner(list)\n end\n\nend", "def vote\n\tend", "def vote( choice )\n assert @ponzico.invested[msg.sender] >= 100.finney && @voted[msg.sender] == false\n\n color = Color( choice )\n # 0.1 ETH (100 finney) invested in PonzICO per vote, truncated\n num = @ponzico.invested[msg.sender] / 100.finney\n @votes[color] += num\n @voted[msg.sender] = true\n log Votes.new( color, num )\nend", "def check_revote (list, index)\n revotewinner = nil\n loop do\n system 'clear'\n print \"There options are tied\\n\" \"would you like to revote with the tied options or have the program randomly pick an option for you?\\n\\n1. Revote\\n2. Random\\n\\nPlease enter 1 to revote or 2 have the program randomly select a winner: \"\n revotewinner = gets.to_i\n if revotewinner == 1 || revotewinner == 2\n break\n else\n print \"\\nThat is not a valid option please enter 1 to vote or 2 to randomly pick an option. \"\n sleep 1\n end\n end\n if revotewinner == 1\n collect_votes(list, index)\n else\n random_winner(list)\n end\nend", "def vote\n puts \"-----------------------------------------------\nSorry, voting system is currently not working\"\n \nend", "def awaiting_candidate_events\n candidate_events.select(&:awaiting_candidate?)\n end", "def select_winner(list, user_list)\n find_highest_votes(list) # Rebuilds the array so that it only has the option(s) with highest votes\n if list.length > 1\n check_revote(list, user_list)\n else\n random_winner(list)\n end\nend", "def select_winner(list, index)\n find_highest_votes(list) # Rebuilds the array so that it only has the option(s) with highest votes\n if list.length > 1\n check_revote(list, index)\n else\n random_winner(list)\n end\nend", "def reset\r\n@candidates = ['Mika', 'Reggie', 'Kenneth', 'Trevor']\r\n@votes = [m=0, r=0, k=0, t=0]\r\n@canname = ''\r\n@vote =''\r\n@v=0\r\n@tie = []\r\nend", "def pause\n @paused += 1\n end", "def vote(a_participant=nil, options={})\n defaults = { :created_at => Time.now.utc }\n options = defaults.merge(options).symbolize_keys\n \n if !poll.expired? && poll.active?\n if a_participant.nil?\n countings.create(:created_at => options[:created_at].utc)\n else\n countings.create(:participant_id => a_participant.id, :poll => poll, :created_at => options[:created_at].utc)\n end\n update_attribute('count', self.count+1)\n return true\n end\n false\n end", "def set_ponderated_best\n total_time = 0\n result_considered = 0\n result_collected = @best_results.count\n everage_time = 0\n\n # If no results, no action performed\n if result_collected > 0\n # If total best results collected >= (bests_to_be_ignored + max_results)\n # excludes first @bests_to_be_ignored results\n if result_collected >= (@bests_to_be_ignored + @max_results)\n @best_results.each_with_index do |mir, index|\n total_time += mir.get_timing_instance.to_hundreds if index >= @bests_to_be_ignored\n end\n result_considered = @max_results\n else\n @best_results.each do |mir|\n total_time += mir.get_timing_instance.to_hundreds\n end\n result_considered = result_collected\n end\n everage_time = (total_time / result_considered).round(0)\n end\n @ponderated_time = Timing.new(everage_time)\n end", "def get_votes\n\t$votes_table.each do |voter|\n\t\tvoter.each do |vote|\n\t\t\tputs \"Give me your vote\"\n\t\t\tvote = gets.chomp\n\t\tend\n\tend\nend", "def changes(i, sleeptime=0.5)\r\n q = adler_map(i)\r\n sleep(sleeptime)\r\n adler_compare(i, q)\r\n end", "def send_poll_results vote\n tweeter = Tweeter.default\n _winners = winners\n if _winners.length > 1\n status = \"@#{vote.voter_name} The current winners in the #{name} poll are #{winners_as_text}. #{fq_url} #{poll_tag}\"\n else\n status = \"@#{vote.voter_name} The current winner in the #{name} poll is #{winners_as_text}. #{fq_url} #{poll_tag}\"\n end\n tweeter.status_update( status, vote.tweet_id )\n logger.info(\"POLL RESULTS SENT\")\n end", "def run\n if @parties.one?\n handle_completly_uncontested!\n else\n adjust_for_third_parties!\n REPS_PER_DISTRICT.times do\n @parties\n .sort_by(&:effective_votes) # sort by effective votes\n .last.award # inform the winner\n end\n tweak_results!\n end\n end", "def phase_one\n puts \"Phase 1 has been started\"\n\n 8.times do\n selected_tribe = @borneo.immunity_challenge\n\t\tputs \"#{selected_tribe} was the tribe selected to vote\".yellow\n\t\tvoted_off = selected_tribe.tribal_council\n\t\tputs \"#{voted_off} was voted OUT!\".red\n end\nend", "def user_has_voted(user, meeting)\n meeting.suggestions.each do |suggestion|\n if suggestion.meeting_id == meeting.id\n suggestion.votes.each do |vote|\n if vote.voter_id == user.id && vote.decision == Vote::DONTKNOW\n return false\n end\n end\n end\n end\n return true\n end", "def votes(type)\n send(\"unrecorded_#{type}_votes\") + motion_votes.of_type(type).count\n end", "def perform\n candidates.each { |candidate| propose(candidate) }\n @matches\n end", "def vote_threshold\n vote_count = self.votes_for.count # Sets variable for tracking petition's vote count\n if vote_count >= 500 && self.filed == false && self.stage == 0 # Petition hit the goal threshold and hasn't already been filed\n self.update_attributes(pending: false, filed_at: Time.now, filed: true, stage: 1) # Updates petition to filed and the time it was filed and sets the stage to 1, setting the timer for days left\n return true\n elsif vote_count < 500\n return false \n else # Vote count is above 100\n return false\n end \n end", "def night_vote\n puts \"Its night time\"\n @players.each do |player|\n unless player.dead?\n if player.role == \"werewolf\"\n player.make_vote\n unless @player_names.include?(player.vote)\n puts \"You must kill someone in the game!\"\n player.make_vote\n end\n end\n end\n end\n vote_count = Hash.new(0)\n @players.each do |player|\n if player.role == \"werewolf\"\n vote_count[player.vote] += 1\n end\n end\n highest_vote = vote_count.max_by{ |k,v| v }\n highest_vote = highest_vote.delete_if {|item| item.is_a?(Integer)}\n if highest_vote.length == 1\n \t@players.each do |player|\n if player.name == highest_vote[0]\n player.kill\n @dead_players << player.name\n puts \"#{player.name} has been killed!\"\n end\n end\n else\n @players.each do |player|\n if player.name == highest_vote[rand(0..highest_vote.length)]\n player.kill\n @dead_players << player.name\n puts \"#{player.name} has been killed!\"\n end\n end\n end\n end", "def upvote(answer)\n upvoted_answers << answer\n end", "def upvote(user)\n unless self.voters.any? {|id| id.to_s == user.uid.to_s}\n self.voters << user.uid\n self.votes += 1\n self.relevance = calculate_relevance unless new_record?\n self.save\n end\n end", "def process_paused_offers\n asana = AsanaCommunicator.new\n Offer.where(aasm_state: 'paused').find_each do |paused_offer|\n if (Time.zone.now + 30.days).to_date == paused_offer.starts_at.to_date\n asana.create_seasonal_offer_ready_for_checkup_task paused_offer\n end\n end\n end", "def vote proposal, values=[], options={}\n return unless proposal\n return unless proposal.is_a?(VoteProposal)\n # return if values.blank?\n values = [values] if values.is_a?(VoteProposalOption)\n status = options[:status]\n action = options[:action] || :add\n\n voting_users = [self]\n voting_users += mandates_from.to_a\n voting_users.map do |user|\n vote = user.vote_in_proposal(proposal) \n if not vote\n user.create_vote proposal, values, status, self\n else\n if user != self and user.has_voted?(proposal)\n # if we are voting for mandate giver but user has already\n # voted by itself do nothing \n else\n # Currently only one option is give at a time.\n option = values.first\n if vote.vote_proposal_options.detect {|opt| opt.id == option.id }\n remove_vote_option vote, [option], self\n else\n add_vote_option vote, [option], self\n end\n end\n end\n end\n end", "def process\n return if processed?\n tweeter = Tweeter.default\n _winners = winners\n all_votes = votes.find_all_by_is_valid( true )\n all_votes.each do |vote|\n if _winners.length > 1\n status = \"@#{vote.voter_name} Thanks for voting! The final winners in the #{name} poll are #{winners_as_text}. #{fq_url} #{poll_tag}\"\n else\n status = \"@#{vote.voter_name} Thanks for voting! The final winner in the #{name} poll is #{winners_as_text}. #{fq_url} #{poll_tag}\"\n end\n tweeter.status_update( status, vote.tweet_id )\n end\n update_attributes!(:processed=>true)\n end", "def up_ballot_voters(*conds, &block)\n __eager_ballot_voters(\n find_ballots_for(*conds, &block).where(vote: true)\n )\n end", "def vote(vtr, value)\n\n original_points = self.point #Record original points to update user \n\n #Check that voter is not self's voter \n return nil if vtr == self.voter\n\n vt = Vote.where(voter_id:vtr.id, voteable_id:self.id).first\n if vt && vt.vote == value\n unvote(vtr,vt)\n return nil\n elsif vt\n self.point -= self.class.options(vt.vote) #Remove old vote points\n vtr.reputation -= self.class.vtback(vt.vote)\n else\n self.count += 1\n vt = Vote.new(voter_id:vtr.id, voteable_id:self.id)\n votes << vt\n end\n\n case value\n when :up ; self.up += 1\n when :down ; self.down += 1\n end\n\n self.point += self.class.options(value) #Add new vote points\n vtr.reputation += self.class.vtback(value)\n self.save\n vtr.save\n\n #Update votee reputation\n self.voter.reputation += self.point - original_points\n self.voter.save\n\n # Set vote to up or down\n vt.vote= value\n vt.save\n return vt\n end", "def hit\n coin = spawn :coin, :x => x, :y => y-40\n coin.collect\n\n @active = false\n @inactive_timer = HIT_RATE if has_more?\n end", "def candidates\n players = []\n players += Player.where(:position => \"QB\").first(20)\n players += Player.where(:position => \"RB\").first(20)\n players += Player.where(:position => \"WR\").first(20)\n players\n end", "def vote(value)\n args = self.state_properties\n args[:vote] += value[0]\n self.state_properties=args\n end", "def test_loop(type, quiz_name, quiz, user_name, time)\r\n clear\r\n # Initialize the array container for all necessary arguments\r\n status = []\r\n total_score = 0\r\n correct_count = 0\r\n incorrect_count = 0\r\n result = nil\r\n right_answer = nil\r\n start_time = 0\r\n status.push(total_score).push(correct_count).push(incorrect_count)\r\n # Loop the length of the quiz collection times to finish the test\r\n (1..quiz['Content'].size).each do |i|\r\n # Workaround timeout method by using the timeout libray in Ruby which automatically terminate the previous thread in a setting time\r\n Timeout.timeout(time) do\r\n clear\r\n # Get the start time stamp for future score calculation\r\n start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)\r\n # Displaying the question content and prompt for selection\r\n puts '-------------------Time is ticking:D---------------------------'.colorize(:light_magenta)\r\n puts 'You have get ' + (status[1]).to_s.colorize(:light_yellow) + ' correct answer(s) so far. And the total score is' + \" #{status[0]}.\\n\\n\".colorize(:light_blue)\r\n puts \"Question #{i}.\".colorize(:blue) + \" #{quiz['Content'][i - 1]['Question']}\\n\\n\"\r\n right_answer = quiz['Content'][i - 1]['Right_answer']\r\n\r\n # According to the selection, invoke the vailidat_answer method and pass necessary attributes\r\n options = [\r\n { name: \"A. #{quiz['Content'][i - 1]['A']}\", value: lambda {\r\n result = 'A'\r\n return result, right_answer, status, start_time, time\r\n } },\r\n { name: \"B. #{quiz['Content'][i - 1]['B']}\", value: lambda {\r\n result = 'B'\r\n return result, right_answer, status, start_time, time\r\n } },\r\n { name: \"C. #{quiz['Content'][i - 1]['C']}\", value: lambda {\r\n result = 'C'\r\n return result, right_answer, status, start_time, time\r\n } },\r\n { name: \"D. #{quiz['Content'][i - 1]['D']}\", value: lambda {\r\n result = 'D'\r\n return result, right_answer, status, start_time, time\r\n } }\r\n ]\r\n option = @prompt.select(\r\n \"Please select the answer as fast as you can to gain more score.\\nIf you select wrong answer or time expired, you will not get the score for Question #{i}\", options, help: \"(Pressing Enter to go back)\\n\\n\\n\", show_help: :always, per_page: 4\r\n )\r\n end\r\n validate_answer(result, right_answer, status, start_time, time)\r\n # If time expired, then apply the following logic to assian attribute to validate method\r\n rescue Timeout::Error\r\n clear\r\n timeout_banner\r\n puts\r\n puts \"\\n\\nOh, no!!! The #{time}s haven been passed.\"\r\n start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)\r\n right_answer = quiz['Content'][i - 1]['Right_answer']\r\n result = 'expired'\r\n validate_answer(result, right_answer, status, start_time, time)\r\n end\r\n\r\n clear\r\n test_banner\r\n puts\r\n puts \"Well done, My friend. You did a great job! Let's see waht the results is.\"\r\n enter_to_continue\r\n mode = @test.time_level.key(time)\r\n # Gather all the necessary attributes and form a array\r\n status.push(type).push(quiz_name).push(user_name).push(mode)\r\n # After finsih the test loop, pass attribute array to display result and save method\r\n dispaly_result_and_save(status)\r\n end", "def results(ballots, candidates)\n\n candidates.each do |can, points|\n ballots.each do |ballot|\n ballot.each do |num, vote|\n if can == vote && num == 1\n candidates[can] += 4\n elsif can == vote && num == 2\n candidates[can] += 2\n elsif can == vote && num == 3\n candidates[can] += 1\n end\n end\n end\n end\n return candidates\n\nend", "def up_voters\n self.votes.where({value: 1}).collect {|vote| vote.user}\n end", "def set_votes\n \n @upvote = []\n @downvote = []\n\n if logged_in?\n votes = Vote.where(:user_id => session[:user_id]).to_a\n votes.each do |vote|\n @upvote << vote[:comment_id].to_i if vote[:upvote].to_i == 1\n @downvote << vote[:comment_id].to_i if vote[:downvote].to_i == 1\n end\n end\n end", "def random_winner(list)\n winner = list.sample # Randomly picks a winner from the array, and also works if there is only a single object in the array (Possibly have a method where the user can choose to re-vote between winning options?)\n system 'clear'\n spinner = TTY::Spinner.new(format: :bouncing_ball)\n puts \"And the winner is ...\" \n spinner.auto_spin # Automatic animation with default interval\n sleep(2) # Perform task\n spinner.stop(\"#{winner.name.capitalize}!\") # Stop animation\n puts \" \"\nend", "def train_first(player1, player2, runs)\n separation\n tateti = Tateti.new\n p1 = 0\n p2 = 0\n ties = 0\n runs.times do\n loop do\n tateti = player1.play_to_learn(tateti, player2)\n break p1 += 1 if !tateti.winner.nil?\n break ties += 1 if tateti.tie?\n tateti = player2.play(tateti)\n break p2 += 1 if !tateti.winner.nil?\n break ties += 1 if tateti.tie?\n end\n tateti.empty_board\n end\n print_stats(player1, player2, runs, p1, p2, ties)\nend", "def runoff(voters)\n results = voters.map(&:first).reduce({}) { |t,v| t[v] = (t[v] || 0) + 1; t }\n most_votes, least_votes = results.values.max, results.values.min\n winners = results.select { |k,v| v == most_votes }.keys\n losers = results.select { |k,v| v == least_votes }.keys\n reduced_ballots = voters.map do |voter|\n voter.delete_if { |can| losers.include?(can) }\n end\n winners.length == 1 ? winners.first : runoff(reduced_ballots)\nend", "def update_vote\n @to_vote = PaperproposalVote.find(params[:id])\n @to_vote.update_attributes(params[:paperproposal_vote])\n @paperproposal = @to_vote.paperproposal\n\n unless @to_vote.save\n flash[:error] = @to_vote.errors\n redirect_to :profile\n end\n\n if @to_vote.vote == \"reject\"\n @paperproposal.board_state = \"re_prep\"\n @paperproposal.lock = false\n @paperproposal.save\n end\n\n all_none_votes = @paperproposal.paperproposal_votes.select{|vote| vote.vote == \"none\"}\n all_reject_votes = @paperproposal.paperproposal_votes.select{|vote| vote.vote == \"reject\"}\n\n if all_none_votes.empty? & all_reject_votes.empty?\n case @paperproposal.board_state\n when \"submit\"\n prepare_data_request_for_accept_state\n when \"accept\"\n @paperproposal.board_state = \"final\"\n @paperproposal.lock = false\n @paperproposal.save\n @paperproposal.datasets.each do |context|\n context.accepts_role! :proposer, @paperproposal.author\n end\n else\n #do nothing\n end\n end\n redirect_to :profile\n end", "def train\n @badasspoints += 1\n end", "def watch_the_point(server)\n\t\tpoint_details = server.begin_point(self)\n\t\tself.winner = point_details[:winner]\n\t\tself.loser = point_details[:loser]\n\t\t# binding.pry\n\t\t# random = [player_1, player_2].shuffle\n\t\t# self.winner = random.first\n\t\t# self.loser = random.last\n\t\tself.status = \"complete\"\n\t\tself.save\n\t\tgame ? game.check_status : tiebreak.check_status\n\tend", "def genCampaignsForVoting(step)\r\n\t\tcampaigns = Campaign.where(votable: true).order(\"timesShownInVoting DESC\")\r\n\t\tgenedCampaigns = []\r\n\t\tcase step\r\n\t\twhen (-1) #refresh\r\n\t\t\tgenedCampaigns = campaigns.last(campaigns.size * 0.5)\r\n\t\twhen 0\r\n\t\t\tgenedCampaigns = campaigns.last(campaigns.size * 0.2)\r\n\t\twhen 1\r\n\t\t\tgenedCampaigns = campaigns.slice((campaigns.size * 0.5)..(campaigns.size * 0.8))\r\n\t\twhen 2\r\n\t\t\tgenedCampaigns = campaigns.first(campaigns.size * 0.5)\r\n\t\tend\r\n\t\tcampaignVotes = current_user.campaignVotes\r\n\t\tvotedCampaigns = []\r\n\t\tcurrent_user.campaignsVoted.each{ |c| votedCampaigns << c}\r\n\t\tstaredCampaigns = [] \r\n\t\tcurrent_user.stars.where(round: current_round).each{ |s| staredCampaigns << s.campaign}\r\n\t\tcampaignVotes.where(step: current_user.isOnStep).each{ |cv| cv.destroy}\r\n\r\n\t\tgenedCampaigns = ((genedCampaigns | staredCampaigns) - votedCampaigns).sample(3)\r\n\t\tif genedCampaigns.count != 3\r\n\t\t\tgenedCampaigns += (Campaign.all - votedCampaigns - genedCampaigns).sample(3 - genedCampaigns.count)\r\n\t\tend\r\n\t\tgenedCampaigns.each do |gc|\r\n\t\t\tcampaignVotes.create(\r\n\t\t\t\tuser_id: current_user.id, \r\n\t\t\t\tcampaign_id: gc.id, \r\n\t\t\t\tstep: current_user.isOnStep)\r\n\t\tend\r\n\r\n\t\tcurrent_user.save\r\n\t\tcurrent_user.campaignVotes.where(step: current_user.isOnStep)\r\n\tend", "def winners\n answer_records = get_answers_with_votes\n _winners = []\n first = answer_records.shift\n if first[:num_votes] > 0\n _winners << first\n answer_records.each do |answer_record|\n _winners << answer_record if answer_record[:num_votes] == first[:num_votes]\n end\n end\n _winners\n end", "def update_state\n @paperproposal = Paperproposal.find(params[:id])\n pre_state = @paperproposal.board_state\n @paperproposal.update_attributes(params[:paperproposal])\n @paperproposal.lock = true\n @paperproposal.save\n\n #submit again\n if pre_state == \"re_prep\" && @paperproposal.board_state == \"submit\"\n @paperproposal.paperproposal_votes.each{|element| element.update_attribute(:vote, \"none\")}\n end\n\n project_board_role = Role.find_by_name(\"project_board\")\n users = project_board_role.users\n users.each{|user| @paperproposal.paperproposal_votes << PaperproposalVote.new(:user => user, :project_board_vote => true)}\n\n redirect_to @paperproposal\n end", "def perform(params, decision)\n ::ActiveRecord::Base.transaction do\n service = ::PlaylistSongVoterService.from_params(params, decision)\n service.create\n service.update_vote_counter\n end\n end", "def take_bets\n @players.each do |p|\n @events.handle(:pre_player_bet, p)\n\n p.hand.bet = p.place_bet\n\n @events.handle(:post_player_bet, p, p.hand.bet)\n end\n end", "def majority_vote(nums)\n candidate = nil\n count = 0\n nums.each do |num|\n candidate = num if count == 0\n if candidate == num\n count += 1\n else\n count -= 1\n end\n end\n\n count = 0\n nums.each do |num|\n if num == candidate\n count += 1\n end\n end\n\n return candidate if count > nums.size / 2\n return -1\nend", "def after_create\n election.vote_count = election.vote_count + 1\n election.save\n end", "def increment_votes\n Article.increment_vote_cache(article_id)\n end", "def ask_question_and_update_lives(player)\n result = ask_question_and_check_answer\n if !result\n player.lives -= 1\n end\n end", "def update_participant_point_totals!\n self.affected_participant_ids.each do |id|\n User.find(id).delay(queue: 'points').update_all_points!\n end\n end", "def pause(cycles)\n @paused = true\n @paused_counter = cycles\n end", "def pause(cycles)\n @paused = true\n @paused_counter = cycles\n end", "def take_a_nap\n sleep(2)\nend", "def resident_upvotes \n self.votes_for.voters.select { |user| user.city == self.city }\n end", "def vote(prompt_id, item_id = nil, voter_id = 0, response_time = 0)\n send_and_process(\"votes/add/#{prompt_id}/#{voter_id || 0}/#{response_time}#{\"/#{item_id}\" if item_id}\", 'vote')\n end", "def before_perform_pause(*args)\n if ResquePauseHelper.paused?(@queue)\n Kernel.sleep(@pause_check_interval || Resque::Plugins::Pause::PAUSE_CHECK_INTERVAL)\n ResquePauseHelper.check_paused(:queue => @queue, :class => self, :args => args)\n end\n end", "def train_second(player1, player2, runs)\n separation\n tateti = Tateti.new\n p1 = 0\n p2 = 0\n ties = 0\n runs.times do\n loop do\n tateti = player1.play(tateti)\n break p1 += 1 if !tateti.winner.nil?\n break ties += 1 if tateti.tie?\n tateti = player2.play_to_learn(tateti, player1)\n break p2 += 1 if !tateti.winner.nil?\n break ties += 1 if tateti.tie?\n end\n tateti.empty_board\n end\n print_stats(player1, player2, runs, p1, p2, ties)\nend", "def vote_up\n 15\n end", "def win_pts\n self.score += 1\n end" ]
[ "0.6240795", "0.6240795", "0.600417", "0.6002265", "0.59443545", "0.5872333", "0.5861349", "0.5665093", "0.5640046", "0.5535868", "0.5522088", "0.5502625", "0.54801744", "0.54690236", "0.54465747", "0.5413406", "0.53993326", "0.53858495", "0.5385673", "0.53786284", "0.53552616", "0.53410345", "0.53389704", "0.5284279", "0.52784306", "0.5247446", "0.5213753", "0.5204271", "0.52033234", "0.51970255", "0.5185821", "0.5183332", "0.51760656", "0.51760656", "0.51693726", "0.51663154", "0.5164202", "0.5159907", "0.5147283", "0.5146175", "0.5138386", "0.5116258", "0.51110244", "0.5099456", "0.50904834", "0.5089807", "0.5085812", "0.5074687", "0.5067653", "0.50608194", "0.50577706", "0.5044956", "0.5028716", "0.50284815", "0.5023417", "0.50100166", "0.50040674", "0.49994108", "0.49971753", "0.499371", "0.4993372", "0.49884614", "0.4987785", "0.49805638", "0.49669433", "0.4959802", "0.4959511", "0.49466047", "0.49454385", "0.4940642", "0.4932164", "0.49293682", "0.49279732", "0.492558", "0.49199337", "0.49189112", "0.4910384", "0.48743707", "0.4870793", "0.48705354", "0.4868935", "0.4864132", "0.48558012", "0.48529798", "0.48514214", "0.48374763", "0.48373157", "0.4831454", "0.48219392", "0.4820779", "0.4815261", "0.48019445", "0.48019445", "0.47963658", "0.47937346", "0.47930264", "0.47898042", "0.47857434", "0.47834787", "0.4777413" ]
0.8610753
0
Follow links corresponding to each character in the key Encounter a null link: create new node Encounter the last character of the key: set value in that node
def put(key, value) @root = put_rec(@root, key, value, 0) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def []=(key, value)\n current = @head\n until current.key == key\n @tail = @tail.nil? ? current.nxt : current\n current.nxt = current.nxt.nil? ? Link.new(current.key + 1, nil, nil, current) : current.nxt\n current = current.nxt\n end\n @tail = current if current.nxt.nil?\n current.val = value\n @length += 1\n end", "def put_rec(node, key, value, d)\n node = Node.new if node.nil?\n if(d == key.length) \n node.value = value\n return node\n end\n c_index = key[d].ord\n node.next[c_index] = put_rec(node.next[c_index], key, value, d+1)\n return node\n end", "def freshen(link, value)\n link.prev.next = link.next\n link.next.prev = link.prev\n attach_to_tail(link)\n link.val = value\n link\n end", "def update_link!(link)\n key = link.key\n val = link.val\n @store.remove(key)\n link = @store.append(key,val) #this is where you move the link to end of list\n @map[key] = link\n end", "def add(key, value)\r\n \t\t\t# Create new node for key, value to be added and set next to head \r\n \t\t\t# and then set head to the new node\r\n \t\t\tn = Node.new(key, value, @head)\r\n \t\t\t@head = n\r\n \t\tend", "def set(key, value)\n @semaphore.synchronize do\n node = Node.new(key, value)\n return false if value.value.length > @max_bytes\n\n if empty?\n @head_node = node\n @tail_node = node\n @hashed_storage[key] = node\n return node\n end\n while value.value.length + used_bytes > @max_bytes\n @hashed_storage.delete(@head_node.key)\n @head_node = @head_node.previous_node\n @head_node.next_node = nil if @head_node \n end\n node.next_node = @tail_node\n @tail_node.previous_node = node\n @tail_node = node\n @hashed_storage[key] = node\n end\n value\n end", "def add(key, value)\n if key.empty?\n @value = value\n else\n letter = key.shift\n if !@children[letter]\n @children[letter] = Node.new()\n end\n @children[letter].add(key, value)\n end\n end", "def move_to_end(key)\n return unless key? key\n\n @semaphore.synchronize do\n node = @hashed_storage[key]\n @head_node = node.previous_node if @head_node == node\n node.previous_node.next_node = node.next_node if node.previous_node\n node.next_node.previous_node = node.previous_node if node.next_node\n node.previous_node = nil\n node.next_node = @tail_node\n @tail_node.previous_node = node\n @tail_node = node\n end\n end", "def initialize(key, value, next_node)\r\n\t\t\t@key = key\r\n\t\t\t@value = value\r\n\t\t\t@next = next_node\r\n\t\tend", "def add(key, value)\n current_and_parent_pair = find_current_and_parent_nodes(key)\n if current_and_parent_pair[:current]\n # update new value if key exists\n current_and_parent_pair[:current].value = value\n else\n new_node = TreeNode.new(key,value)\n parent = current_and_parent_pair[:parent]\n link_node_to_parent(parent, new_node)\n end\n end", "def []=(key, value)\n root_node._hash = nil # reset pre-calculated roothash\n node = root_node\n ba_key = Bitarray.new(key)\n\n # finds or creates the node\n 1.upto(KEY_SIZE) do |depth|\n bit = ba_key[depth - 1]\n node =\n if bit == 0\n # 0, descend left\n node.left ||= (node.left = Node.new(key, depth))\n else\n # 1, descend right\n node.right ||= (node.right = Node.new(key, depth))\n end\n end\n node.value = value\n end", "def insert(key, value)\n i = key.hash % @table.size\n node = @table[i]\n while node\n if key == node.key\n node.value = value\n return\n end\n node = node.next\n end\n @table[i] = Node.new(key, value, @table[i])\n @count += 1\n end", "def add_node(key, value)\n node = Node.new(key, value)\n\n # if there is current no root node set for the tree we need to set it\n if root.nil?\n @root = node\n else\n # lets find where we need to place the node \n current = @root\n placed = false\n\n while not placed\n # get the property to travese, either left_child or right_child\n property = direction(node.key, current.key)\n\n # set a pointer to remember the previous loops node value and\n # change the current value current based on the property flag \n parent = current\n current = current.send(property)\n\n # if the node under examination is nil then this means we have found\n # a spot to place the current node and we set the placed flag to \n # true in order to exit out of the loop\n if current.nil?\n parent.send(property+'=', node)\n placed = true\n end\n end\n\n end\n end", "def link_chain_hash_creator(title)\n\tlink_chain = {}\n\tbroken = nil\n\tcurrent_title = title\n\twhile broken != true\n\t\tnext_title = $links[current_title] #|| $links[current_title.downcase]\n\t\t\n\t\t#puts \"Link chain: #{link_chain}\"\n\t\t#puts \"Current title: #{current_title}\"\n\t\t#puts \"Next title: #{next_title}\"\n\t\tunless next_title\n\t\t\tnext_title = $links[current_title.capitalize] if current_title\n\t\tend\n\n\t\tif link_chain.keys.include? next_title\t\t\t\n\t\t\t#alphabet_array = link_chain.alphat\n\t\t\t#link_chain.unshift(\"loop is\")\n\t\t\tbroken = true\n\t\tend\n\t\tlink_chain[current_title] = next_title\n\t\tcurrent_title = next_title\n\tend\n\tlink_chain\nend", "def next_node(current, key)\n return nil, nil unless current[:key_length]\n next_key = key[0...current[:key_length]]\n if current[:nodes].has_key?(next_key)\n return current[:nodes][next_key], key[next_key.length..-1]\n else\n return nil, nil\n end\n end", "def set(full_key, node)\n key_part, rest = full_key.split('.', 2)\n child = key_to_node[key_part]\n if rest\n unless child\n child = Node.new(key: key_part)\n append! child\n end\n child.children ||= []\n child.children.set rest, node\n dirty!\n else\n remove! child if child\n append! node\n end\n node\n end", "def push(key, value=key)\n raise ArgumentError, \"Heap keys must not be nil.\" unless key\n node = Node.new(key, value)\n # Add new node to the left of the @next node\n if @next\n node.right = @next\n node.left = @next.left\n node.left.right = node\n @next.left = node\n if @compare_fn[key, @next.key]\n @next = node\n end\n else\n @next = node\n end\n @size += 1\n \n arr = []\n w = @next.right\n until w == @next do\n arr << w.value\n w = w.right\n end\n arr << @next.value\n @stored[key] ||= []\n @stored[key] << node\n value\n end", "def push(value) #adding element at the end of LL\n new_node = Node.new(value) #create new node\n return @head = new_node if @head == nil #if head is nil(list is empty) new node becomes head\n #if list is not empty, we must traverse to last element in the list \n temp_node = @head #starting from the head\n until temp_node.link == nil #last element in the list is element whit link pointing to nil\n temp_node = temp_node.link #traversing through list using link variable\n end\n temp_node.link = new_node #to append node we assign new node ad last nodes link variable\n end", "def get_node(key); end", "def initialize(key)\n @key = key\n @left = nil\n @right = nil\n end", "def add(key, value)\n current_node = @root\n\n @root = TreeNode.new(key, value) if current_node.nil?\n\n until current_node.nil?\n if (key < current_node.key) && current_node.left.nil?\n current_node.left = TreeNode.new(key, value)\n elsif (key > current_node.key) && current_node.right.nil?\n current_node.right = TreeNode.new(key, value)\n elsif key < current_node.key\n current_node = current_node.left\n elsif key > current_node.key\n current_node = current_node.right\n else\n return\n end\n end\n end", "def link_key!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 7 )\n\n type = LINK_KEY\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 133:4: 'Link'\n match( \"Link\" )\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 add(key,value)\n @root = Node.new(key[0], nil) if (@root == nil)\n @root.add_vertical(key,value)\n end", "def insert_next prev_node, data\n\t\tnew_node = Node.new data\n\t\tif self.length == 0\n\t\t\tself.head = new_node.next = new_node\n\t\telse\n\t\t\tnew_node.next = prev_node.next\n\t\t\tprev_node.next = new_node\n\t\tend\n\t\tself.length += 1\n self.hash[data] = new_node\n new_node\n\tend", "def iterate_and_prep_hash\n self.input_ticket_arr.each do |src_destination_arr|\n src_node = node_for_key(src_destination_arr[0], :src)\n destination_node = node_for_key(src_destination_arr[1], :destn)\n src_node.next_node = destination_node\n end\n end", "def initialize(key, color)\n @key = key\n # node's color is parent link's color\n @color = color\n end", "def push(key, value)\n if @root.nil?\n @root = Node.new(key, value, nil, nil)\n @size = 1\n return value\n end\n splay(key)\n \n cmp = (key <=> @root.key)\n if cmp == 0\n @root.value = value\n return value\n end\n node = Node.new(key, value, nil, nil)\n if cmp < 1\n node.left = @root.left\n node.right = @root\n @root.left = nil\n else\n node.right = @root.right\n node.left = @root\n @root.right = nil\n end\n @root = node\n @size += 1\n value\n end", "def insert(key, value = nil)\n node = @root\n if node.full? \n @root = Btree::Node.new(@degree)\n @root.add_child(node)\n @root.split(@root.children.size - 1)\n #puts \"After split, root = #{@root.inspect}\"\n # split child(@root, 1)\n node = @root\n end\n node.insert(key, value)\n @size += 1\n return self\n end", "def put(key, value)\n if @hash.has_key? key\n @dlink.move_to_head key\n @hash[key] = value\n return @hash\n end\n if @hash.keys.size >= @capacity\n node = @dlink.remove_tail\n @hash.delete node.val\n end\n @hash[key] = value\n @dlink.add key\n @hash\n end", "def put key, value\n\t\t\t# if the key already exists, \n\t\t\tif @my_hash.has_key? key\n\t\t\t\t@my_hash[key].value = value\n\t\t\telse\n\t\t\t\t# if the list is full, remove the last node to create one spot for a new one\n\t\t\t\tif @my_hash.length == @max_size\n\t\t\t\t\tdeleted_key = @my_list.remove_last\n\t\t\t\t\t@my_hash.delete deleted_key\n\t\t\t\tend\n\t\t\t\t# create a new node in the list\n\t\t\t\t# store this node in the hash\n\t\t\t\tif @my_hash.length < @max_size\n\t\t\t\t\t@my_hash[key] = @my_list.add_to_first key, value\n\t\t\t\tend\n\t\t\tend\n\t\t\treturn @my_hash\n\t\tend", "def append(value)\n if @size == 0\n @head = Node.new(value)\n else\n node = @head\n node = node.link until node.link.nil?\n node.link = Node.new(value)\n end\n\n @size += 1\n end", "def add(key, value)\n new_node = TreeNode.new(key, value)\n\n if @root == nil\n @root = new_node\n return\n end\n\n current = @root\n\n while current != nil\n if current.key >= key\n break if current.left == nil\n current = current.left\n else\n break if current.right == nil\n current = current.right\n end\n end\n\n current.key >= key ? current.left = new_node : current.right = new_node\n end", "def initialize(tail,head)\n @tail = Sower::Node.ident(tail)\n @head = Sower::Node.ident(head)\n @key = [@tail,@head]\n end", "def transform_to_empty_key(key)\n (key.to_s << '/').to_sym\n end", "def delete(key)\n node = search key\n if node.l.key == nil && node.r.key == nil\n # It's leaf, just replace it to null-node for its parent.\n if node.p \n null_node = RBNode.new nil, BLACK\n node.p.l == node ? node.p.l = null_node : node.p.r = null_node\n null_node.p = node.p\n adjust(null_node)\n else\n @root = nil\n end\n elsif has_one_child(node)\n child = node.r && node.r.key ? node.r : node.l\n # Only color case: child must be red leaf. node must be black.\n if node.p\n node.p.l == node ? node.p.l = child : node.p.r = child\n child.p = node.p\n else\n @root = child\n child.p = nil\n end\n child.color = node.color # must be black\n else\n succ = find_succ node\n # succ must be in right subtree of node. \n # succ has at most one child in right branch.\n\n # succ is right child of node.\n if succ && succ.key\n if succ == node.r\n if node.p \n node.p.l == node ? node.p.l = succ : node.p.r = succ\n else\n @root = succ\n end\n succ.l, succ.p = node.l, node.p\n succ.l.p = succ\n if succ.r\n if succ.color == BLACK\n if succ.r.color == RED \n succ.r.color = BLACK \n else\n succ.color = node.color\n adjust(succ.r)\n end\n end\n end\n else\n node.key, succ.key = succ.key, node.key\n if succ.p \n succ.p.l == succ ? succ.p.l = succ.r : succ.p.r = succ.r\n end\n if succ.r \n succ.r.p = succ.p \n if succ.color == BLACK\n succ.r.color == RED ? succ.r.color == BLACK : adjust(succ.r)\n end\n end \n end\n end\n end\n end", "def initialize( key )\n @key = key\n @connected_to = {} # empty hash\n end", "def []=(key, value)\n i = index(key, size)\n @items[i] = LinkedList.new if @items[i].nil?\n @items[i].add_to_front(Node.new(key, value))\n @item_count += 1\n resize if load_factor >= @max_load_factor\n end", "def set_tail(value)\nlast_node(head).next_node = new_node(value)\n end", "def find_canididate_insertion_node(current, key)\n if current[:key_length].nil?\n new_node = insert_node(current, key)\n current[:key_length] = key.length\n return new_node, \"\"\n end\n\n # check if we have an existing shared prefix already\n current_key = key[0...current[:key_length]]\n\n # look for an existing key path\n if current[:nodes].has_key?(current_key)\n return current[:nodes][current_key], key[current_key.length..-1]\n end\n\n # search for a shared prefix, and split all the nodes if necessary\n current[:nodes].keys.each do |prefix|\n common_prefix = shared_prefix(key, prefix)\n next unless common_prefix\n\n new_key_length = common_prefix.length\n\n split_nodes(current, new_key_length)\n return current[:nodes][common_prefix], key[new_key_length..-1]\n end\n\n # potentially split all other keys\n if current_key.length < current[:key_length]\n split_nodes(current, current_key.length)\n end\n\n new_node = insert_node(current, current_key)\n return new_node, key[current_key.length..-1]\n end", "def swap(_first_key_previous, _first_key_element, _second_key_previous, _second_key_element)\n if _first_key_element.present? and _second_key_element.present?\n if _first_key_previous.blank? #Frist key element is head element\n temp_element = _second_key_element.next\n\n _second_key_element.next = _first_key_element.next\n self.head = _second_key_element\n\n _first_key_element.next = temp_element\n _second_key_previous.next = _first_key_element\n elsif _second_key_previous.blank? #Second key element is head element\n temp_element = _first_key_element.next\n\n _first_key_element.next = _second_key_element.next\n self.head = _first_key_element\n\n _second_key_element.next = temp_element\n _first_key_previous.next = _second_key_element\n else # None of the elemenet is head\n\n # Not sure what was the issue in this login\n # temp_element = _second_key_element.next\n\n # _second_key_element.next = _first_key_element.next\n # _first_key_previous.next = _second_key_element\n\n # _first_key_element.next = temp_element\n # _second_key_previous.next = _first_key_element\n\n\n _first_key_previous.next = _second_key_element\n _second_key_previous.next = _first_key_element\n\n temp_element = _second_key_element.next\n _second_key_element.next = _first_key_element.next\n _first_key_element.next = temp_element\n\n end\n else\n puts \"element not found\"\n end\n end", "def create_shortened_url\n key = self.id - 1\n\n if key == 0\n shortened = ALPHABET[0]\n else\n shortened = ''\n baseLength = ALPHABET.length\n\n until key < 1\n place = key % baseLength\n shortened += ALPHABET[place]\n\n key /= baseLength\n end\n end\n self.shortened = shortened\n self.save\n end", "def []=(key, value)\n if @items[index(key, size)] == nil\n @items[index(key, size)] = LinkedList.new\n end\n\n @items[index(key, size)].add_to_tail(Node.new(key, value))\n @item_count += 1\n\n if load_factor >= @max_load_factor\n resize\n end\n end", "def insert_help(key,value)\n val=[key,value]\n if empty?\n Kickup.new(val)\n elsif @val[0] == key\n Node2.new(val,@left,@right)\n elsif @val[0] > key\n help_two(@left,key,value,-1)\n else\n help_two(@right,key,value,0)\n end\n end", "def append( value )\n last.next = Node.new value\n end", "def insert_letter(letter)\n @node_pointers[letter.to_sym] = TrieNode.new if @node_pointers[letter.to_sym].nil?\n end", "def add(key, value)\n if @root.nil?\n @root = TreeNode.new(key, value)\n return\n end\n\n current_node = @root\n\n while current_node != nil\n if current_node.key < key \n if current_node.right == nil\n current_node.right = TreeNode.new(key, value)\n return\n end\n current_node = current_node.right \n else \n if current_node.left == nil\n current_node.left = TreeNode.new(key, value)\n return \n end\n current_node = current_node.left\n end\n end\n end", "def set_links(text)\n \tchunks = text.split(\",\")\n new_nodes = []\n\n \tchunks.each do |chunk|\n #perhaps have this find all of them\n \t\tchild_node = Node.find_by(title: chunk.strip, work_id:self.work)\n\n if child_node == nil #if the child doesn't exist, create it at the very end\n place = self.work.get_ordering.length\n self.work.add_new_element([place], [\".,\"+chunk])\n child_node = self.work.get_element_in_ordering(place, self.work.get_ordering)\n new_nodes << child_node\n end\n \n link = self.links.build\n #if it has a parent, give the link that parent. otherwise, set it to nil\n if self.node != nil\n link.parent_id = self.node.id\n else\n link.parent_id = nil\n end\n link.work = self.work\n link.child = child_node\n \tlink.save\n\t end\n\n return new_nodes\n end", "def key=(key); end", "def [](key, create = false)\n if create and not @succ.include? key\n @succ[key] = Node.new\n else\n @succ[key]\n end\n end", "def add_to_index(name, key, node); end", "def append(value)\n #needs .last method\n #self.last\n last.next = Node.new(value)\n end", "def []=(key, value)\r\n records, record = [], @head\r\n (@levels-1).downto(0) do |i|\r\n record = record.levels[i] while record.levels[i] != @tail and @compare.call(record.levels[i].key, key) < 1\r\n records[i] = record\r\n end\n if record.key == key\n record.values << value\n\t @length = @length + 1\n\t return value\n\t end\r\n new_record = SkipElement.new(key,value) \n new_record.levels[0], record.levels[0] = record.levels[0], new_record\r\n\t i = 1\r\n\t while toss\r\n\t\t if new_record.levels.length > @levels\r\n\t\t\t @levels = new_record.levels.length\r\n\t\t\t break\r\n\t\t end\r\n\t\t new_record.levels[i], records[i].levels[i] = records[i].levels[i], new_record if records[i]\r\n\t\t @head.levels[i], new_record.levels[i] = new_record, @tail unless records[i]\r\n\t\t i = i + 1\r\n\t end\r\n\t @length = @length + 1\r\n\t value\r\n end", "def []=(key, value)\n index = self.index(key, @items.length)\n if @items[index].nil?\n llist = LinkedList.new\n @items[index] = llist\n end\n @items[index].add_to_tail(Node.new(key, value))\n @item_count += 1\n if load_factor >= @max_load_factor\n self.resize\n end\n end", "def borrowFromRight( node, index)\n child = node.arr[index]\n sibling = node.arr[index + 1]\n # node key is inserted as the last key in child.\n child.keys[child.n] = node.keys[index]\n # Sibling's first child is inserted as the last child of child.\n if (!(child.leaf))\n child.arr[(child.n) + 1] = sibling.arr[0]\n end\n # First key from sibling is inserted into node.\n node.keys[index] = sibling.keys[0]\n \n # Moving all keys in sibling one step left\n i = 1\n while (i < sibling.n)\n sibling.keys[i - 1] = sibling.keys[i]\n i += 1\n end\n i = 1\n # Moving the child pointers one step behind\n while (!sibling.leaf && i <= sibling.n)\n sibling.arr[i - 1] = sibling.arr[i]\n i += 1\n end\n # Increase child key count and decrease sibling key count.\n child.n += 1\n sibling.n -= 1\n return\n end", "def setnx(key, value)\n node_for(key).setnx(key, value)\n end", "def put(key, value)\n has_key = get(key)\n\n if has_key != -1\n @store[key].val = value\n elsif has_key == -1 && length < capacity\n n = @store[key] = LNode.new(value, key)\n append_to_tail(n)\n @length += 1\n else #if has_key == -1 && length >= capacity\n lru = @store[:head].nxt\n remove_node_from_store_links(lru)\n @store.delete(lru.key)\n n = @store[key] = LNode.new(value, key)\n append_to_tail(n)\n end\n nil\n end", "def put(key, value)\n node = @map[key]\n if node.nil?\n if @size == @capacity\n node = @list.remove_last()\n @map.delete(node.key)\n node.key = key\n node.value = value\n @list.add_front(node)\n @map[key] = node\n else\n node = Node.new(key, value)\n @list.add_front(node)\n @map[key] = node\n @size += 1\n end\n else\n @list.remove_node(node)\n node.value = value\n @list.add_front(node)\n end\n end", "def resolve_numeric_key key\n d = @bookmarks[key]\n if d\n change_dir d\n return\n end\n\n set_bookmark key\n message \"Created bookmark #{key}.\"\nend", "def insert_final(*val)\n \n val.each do |nuevo_nodo|\n \n if @tail != nil\n @tail.next = nuevo_nodo\n nuevo_nodo.previous = @tail\n @tail = nuevo_nodo\n else\n @head = @tail = nuevo_nodo\n end\n @num_nodos += 1\n end\n end", "def prev node_or_key\n key = String.new\n case node_or_key\n when Node\n key = node_or_key.key\n when String\n key = node_or_key\n else\n p \"only accept String or Node type\"\n end\n\n prev = node = @head\n while node.next_ != nil && node.key != key\n prev = node\n node = node.next_\n end\n prev == node ? nil : prev\n end", "def nlink() end", "def add_node(key, val)\n @store.append(key, val)\n end", "def add(key, value)\n new_tree_node = TreeNode.new(key, value)\n\n if @root.nil?\n @root = new_tree_node\n else\n current = @root\n while current\n if new_tree_node.key <= current.key\n if !current.left\n current.left = new_tree_node\n return\n else\n current = current.left\n end\n else\n if !current.right\n current.right = new_tree_node\n return\n else\n current = current.right\n end\n end\n end\n end\n end", "def add(key, value)\n new_node = TreeNode.new(key, value)\n if !@root \n @root = new_node\n return \n end\n add_node(new_node, @root)\n\n end", "def associate_next_empty(key:, data:, column: nil)\n nxt = next_empty(key: key, column: column)\n associate(index: nxt, key: key, data: data)\n nxt\n end", "def add(key, value, current = @root)\n new_node = TreeNode.new(key, value)\n\n if @root == nil\n @root = new_node\n else\n if key <= current.key\n\n if current.left == nil\n current.left = new_node\n else\n add(key, value, current.left)\n end\n\n else\n\n if current.right == nil\n current.right = new_node\n else\n add(key, value, current.right)\n end\n\n end\n end\n end", "def insert( new_key )\n if new_key <= @key\n @left.nil? ? @left = Node.new( new_key ) : @left.insert( new_key )\n elsif new_key > @key\n @right.nil? ? @right = Node.new( new_key ) : @right.insert( new_key )\n end\n end", "def relational\r\n node = add()\r\n\r\n loop do\r\n if consume(\"<\")\r\n node = new_binary(ND_LT, node, add())\r\n elsif consume(\"<=\")\r\n node = new_binary(ND_LE, node, add())\r\n elsif consume(\">\")\r\n node = new_binary(ND_LT, add(), node)\r\n elsif consume(\">=\")\r\n node = new_binary(ND_LE ,add(), node)\r\n else\r\n return node\r\n end\r\n end\r\nend", "def add(word)\n node = @root\n word.downcase!\n word.each_char do |letter|\n node[letter] ||= Hash.new\n node = node[letter]\n end\n node[:end] = true\n end", "def []=(key,value)\r\n if record = touch(key)\r\n trail(record)\r\n record[:value] = value\r\n else\r\n shift if @store.length >= @max \r\n\r\n record = {:key=> key, :value=>value,:previous=>nil, :next=>nil}\r\n @store[key] = record\r\n if @store.length == 1\r\n @head = @tail = record\r\n else\r\n trail record\r\n end\r\n end\r\n value\r\n end", "def insert(word)\r\n n = @root\r\n word.chars.each_with_index do |chr, i|\r\n if !n.next.has_key?(chr)\r\n n.next[chr] = Node.new\r\n end\r\n n = n.next[chr]\r\n end\r\n #puts \"insert n=#{n}\"\r\n\r\n n.is_end = true\r\n end", "def insert_by_end(value)\n\t\tif @head.nil?\n\t\t\t@head = @Node.new(value, nil, nil)\n\t\t\t@tail = @head\n\t\telse\n\t\t\t@tail[:next] = @Node.new(value, nil, @tail)\n\t\t\t@tail = @tail[:next]\n\t\tend\n end", "def put(key, value)\n node = @cache[key]\n if node.nil?\n if(@size >= @capacity)\n tail = pop_tail()\n @cache.delete(tail.key)\n @size -= 1\n end\n newNode = DLinkedNode.new\n newNode.key = key\n newNode.value = value\n \n @cache[key] = newNode\n add_node(newNode)\n \n @size += 1\n else\n node.value = value\n move_to_head(node)\n end\n end", "def put(key, value)\n stored = @node_map[key]\n if stored\n stored.val = value\n #reusing the ips\n get(key)\n nil\n else\n node = CacheListNode.new()\n node.val = value\n node.key = key\n insert_node_at_head(node)\n @list_tail = node unless @list_tail\n @node_map[key] = node\n if @node_map.size > @capacity\n @node_map.delete(@list_tail.key)\n clip_node_from_list(@list_tail)\n end\n nil\n end\n end", "def nodeset(words, h = {})\n words.each do |w|\n chars = w.split(\"\")\n chars.each { |c| h[c] = \"\" }\n end\n\n h\nend", "def store_path_links_to(path, links)\n return if links.empty?\n redis.sadd path_links_to_key(path), links\n end", "def split_nodes(root, new_length)\n old_nodes = root[:nodes]\n split_length = root[:key_length] - new_length\n root[:key_length] = new_length\n root[:nodes] = {}\n old_nodes.each do |key, old|\n new_node = insert_node(root, key[0...new_length])\n new_node[:nodes][key[new_length..-1]] = old\n new_node[:key_length] = split_length\n end\n end", "def add(key, value)\n new_nodelet = TreeNode.new(key, value)\n\n if @root.nil?\n @root = new_nodelet \n else \n @root = add_helper(@root, new_nodelet)\n end \n end", "def kth_to_last(head, k)\n count = 0\n current_node = head\n node_hash = {}\n while current_node\n node_hash[count] = current_node\n count += 1\n current_node = current_node.next\n end\n node_hash[node_hash.keys.size - k].value\nend", "def put(key, value)\n slot = key % BUCKET_MOD\n head = @buckets[slot]\n if !head\n @buckets[slot] = Node.new(key, value)\n return\n end\n while head\n if head.key == key\n head.val = value\n break\n elsif head.next.nil?\n head.next = Node.new(key, value)\n break\n end\n head = head.next\n end\n end", "def insert_one(aliment)\n\t\tnode = Node.new(aliment, nil, nil)\n\t\tif(empty)\n\t\t\t@head = node\n\t\t\t@tail = node\n\t\telse\n\t\t\tnode[\"prev\"] = @tail\n\t\t\t@tail[\"next\"] = node\n\t\t\t@tail = node\n\t\tend\n\t\t@size += 1\n\tend", "def insert(key, value, __level = nil)\n @mutex.synchronize do\n newlevel = __level || random_level\n x = anchor\n level = node_level(x)\n update = Array.new(level)\n x = find_with_update(x, level, key, update)\n \n # rewrite existing key\n \t if node_compare(x, key) == 0\n \t node_set_value!(x, value)\n \t # insert in a middle\n \t else\n \t level = newlevel\n \t newx = new_node(newlevel, key, value)\n \t while level > 0\n \t level -= 1\n \t node_insert_after!(newx, update[level], level)\n end\n \t end\n end\n \tself\n \tend", "def setnx(key, value); end", "def setnx(key, value); end", "def insert_beginning(*val)\n \n val.each do |nuevo_nodo|\n \n if @head != nil\n \n @head.previous = nuevo_nodo\n nuevo_nodo.next = @head\n @head = nuevo_nodo\n else\n @head = nuevo_nodo\n end\n @num_nodos += 1\n \n end\n end", "def add(key, value)\n new_node = TreeNode.new(key, value)\n\n if @root.nil?\n @root = new_node \n else \n @root = add_helper(@root, new_node)\n end\n\n end", "def set_head(value)\n @head = new_node(value)\nend", "def initialize(path_or_key)\n if path_or_key.respond_to?(:head) && path_or_key.respond_to?(:tail)\n @head = path_or_key.head\n @tail = path_or_key.tail\n else\n path = path_or_key.to_s\n segments = path.nil? ? [] : path.split(SEPARATOR)\n\n unless segments.empty?\n @head = segments.shift\n @tail = segments.empty? ? nil : Key.new(segments.join(SEPARATOR))\n end\n end\n end", "def add(node)\n raise 'Node must be persisted!' unless node.persisted?\n # Traverse to the end\n last_link = nil\n each_link do |link|\n last_link = link\n end\n # Create a new link\n # If there is no last node, make the link the head\n # Otherwise, throw the link at the end\n link = Likewise::Node.create :ref_id => node.id\n if last_link.nil?\n self[:head_id] = link.id\n else\n last_link[:next_id] = link.id\n end\n # Increment our length, which is memoized\n element_added!\n end", "def add(key, value)\n # raise NotImplementedError\n # if the root is nil set the root to be a new node with the given value and return the node.\n return @root = TreeNode.new(key, value) if @root.nil?\n current = @root\n while current != nil \n if key <= current.key \n if current.left.nil?\n current.left = TreeNode.new(key, value)\n return\n end\n current = current.left\n else\n if current.right.nil?\n current.right = TreeNode.new(key, value)\n return\n end\n current = current.right\n end\n end\n end", "def add_help(current, new_node)\n return new_node if current.nil? \n\n new_node.key <= current.key ?\n current.left = add_help(current.left , new_node):\n current.right = add_help(current.right, new_node)\n\n return current\n end", "def add_helper(node, key, value)\n #if the node is empty, the create the node with a key, value\n if node.nil?\n node = TreeNode.new(key, value)\n #if the key is less than the node key, then put it to the left side\n elsif key < node.key\n node.left = add_helper(node.left, key, value)\n #if key is larger than the node key, then add it to the right side\n elsif key > node.key\n node.right = add_helper(node.right, key, value)\n end\n return node\n end", "def add_node(k, v, children_type)\n label = get_label(k, v)\n penwidth = get_penwidth(k, v)\n shape = get_shape(children_type)\n\n href = v['url']\n if href.nil?\n @gv.add_nodes(label, shape: shape, penwidth: penwidth)\n else\n # puts \"url #{href}\"\n @gv.add_nodes(label, shape: shape, penwidth: penwidth, URL: href)\n end\n end", "def put(key, value)\n @root = put_node(@root, key, value, 0)\n end", "def node_for_key(key, src_destination = nil)\n return self.src_destination_hash.delete(key) if self.src_destination_hash.key?(key)\n self.src_destination_hash[key] = ::SortFlightTickets::Node.new(key, src_destination)\n end", "def add(key, value)\n # recursive solution with helper method\n @root = add_helper(@root, key, value)\n\n # the while-looping way\n # if @root.nil?\n # @root = TreeNode.new(key, value)\n # else\n # current = @root\n # while true\n # if key < current.key\n # if !current.left.nil?\n # current = current.left\n # else\n # current.left = TreeNode.new(key, value)\n # return\n # end\n # else\n # if !current.right.nil?\n # current = current.right\n # else\n # current.right = TreeNode.new(key, value)\n # return\n # end\n # end\n # end\n # end\n end", "def link(index, next_index, prev_index)\n item = @lookup[index]\n item.next_link = @lookup[next_index]\n item.prev_link = @lookup[prev_index]\n end", "def write_value(to, key, value)\n return to if key.nil? or key == \"\"\n\n prev = nil\n key.split(/\\./).reverse.each {|x|\n a = Hash.new\n a[x] = if prev.nil? then value else prev end\n prev = a\n a\n }\n\n to.merge_recursive(prev)\n end", "def add(key, value)\n new_node = TreeNode.new(key, value)\n\n if @root == nil\n @root = new_node\n else\n add_node(@root, new_node)\n end\n end", "def change_key(key, new_key, delete=false)\n return if @stored[key].nil? || @stored[key].empty? || (key == new_key)\n \n # Must maintain heap property\n raise \"Changing this key would not maintain heap property!\" unless (delete || @compare_fn[new_key, key])\n node = @stored[key].shift\n if node\n node.key = new_key\n @stored[new_key] ||= []\n @stored[new_key] << node\n parent = node.parent\n if parent\n # if heap property is violated\n if delete || @compare_fn[new_key, parent.key]\n cut(node, parent)\n cascading_cut(parent)\n end\n end\n if delete || @compare_fn[node.key, @next.key]\n @next = node\n end\n return [node.key, node.value]\n end\n nil\n end", "def put(key, value)\n found = @hash[key]\n\n if found\n found.data = value\n @list.move_node_to_head(found)\n return\n end\n\n if @limit === @size\n tail = @list.remove_tail\n @hash.delete(tail.key)\n @size -= 1\n end\n\n add_entry(key, value)\n end" ]
[ "0.6807187", "0.6225873", "0.61746067", "0.6075987", "0.59658736", "0.59555244", "0.5862611", "0.5843943", "0.5787012", "0.5778651", "0.5755244", "0.5711249", "0.56569636", "0.5650341", "0.56378967", "0.563169", "0.55845034", "0.5577295", "0.55724865", "0.55655384", "0.55638707", "0.55634433", "0.5556703", "0.55559987", "0.5538706", "0.55042475", "0.54719657", "0.54711676", "0.5458042", "0.5428205", "0.5415034", "0.53977114", "0.5389334", "0.53801507", "0.5345198", "0.5341109", "0.5330703", "0.53204244", "0.52997047", "0.52896804", "0.5283071", "0.527655", "0.5272021", "0.5268742", "0.52631754", "0.526032", "0.5258987", "0.52529174", "0.52513397", "0.52453715", "0.5242745", "0.5233226", "0.5231806", "0.52164125", "0.5214709", "0.5213546", "0.5211665", "0.52058756", "0.51999843", "0.51634204", "0.51586396", "0.51500005", "0.5149146", "0.5148105", "0.5147442", "0.5141225", "0.5140537", "0.51396513", "0.5139267", "0.51337546", "0.51329696", "0.5130537", "0.51300836", "0.51237124", "0.51176965", "0.5116057", "0.5113483", "0.5113268", "0.5111427", "0.5110432", "0.5109689", "0.51041836", "0.5102642", "0.5102642", "0.5092571", "0.50920075", "0.5089256", "0.5086039", "0.5080462", "0.5077498", "0.5073276", "0.5073019", "0.5069149", "0.50665575", "0.5061627", "0.5053871", "0.5053441", "0.504756", "0.5046368", "0.50434184", "0.50412977" ]
0.0
-1
Search hit : Node where search ends has a non null value Search miss: Reach a node with null links or node where search ends has null value
def get(key) node = get_rec(@root, key, 0) return nil if node.nil? return node.value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search(node = @root)\n if node.position == @target\n @target_node = node\n return\n else\n node.connected_knights.each { |knight| search(knight) }\n end\n end", "def DFS(root, target)\n ## base case: \n return nil if root.nil?\n return root if root.value == target\n ##indecutive step: \n ## DFS on the left side then DFS on the right side \n root.children.each do |child|\n search_result = DFS(child, target) ## better to save the actual value then check the value then return nil\n return search_result unless search_result.nil?\n end \n return nil\nend", "def dfs_recursive(query, node=@tree) \n return nil if node.nil?\n return node if query == node.value\n\n# left search equals if the left child is not nil then call the method with target & left child node parameters, otherwise is nil\n left_search = node.left_child != nil ? dfs_recursive(query, node.left_child) : nil\n\n# return if left search does not result in nil\n return left_search if left_search != nil\n right_search = node.right_child != nil ? dfs_recursive(query, node.right_child) : nil\n return right_search if right_search != nil \n end", "def node_within_block_or_conditional?(node, stop_search_node); end", "def scanned_node?(node); end", "def search(path, final_point)\n\n current = path.first\n puts \"current.center = #{current.center}\"\n puts \"final_point.center = #{final_point.center}\"\n puts \"path.size = #{path.size}\"\n puts \"path = #{path.map{ |p| [p.center,p.wp_visited?].flatten }}\"\n puts \"current.wp_visited? = #{current.wp_visited?}\"\n\nbinding.pry # => debugger\n\n if wp_distance2(current, final_point) < 1.0\n puts \"found\"\n return path.reverse\n end\n\n wp_adjacents = sort_and_filter(current.wp_adjacents, final_point)\n\n wp_adjacents.each do |wp|\n search(path.unshift(wp), final_point)\nbinding.pry # => debugger\n wp.wp_mark\n end\n end", "def breadth_first_search(node, search_val = nil)\n return unless node\n visit_queue = [node]\n\n while (!visit_queue.empty?)\n node = visit_queue.shift\n node.visit\n return node if node.value == search_val\n node.connections.each do |conn|\n next if conn.marked\n conn.marked = true\n visit_queue.push(conn)\n end\n end\nend", "def depth_first_search(node)\n return if node.nil?\n node.visit\n node.connections.each do |conn|\n depth_first_search(conn) unless conn.visited\n end\nend", "def depth_first_search!(node)\n node.marked = true\n node.type = \"M\"\n node.adj.each do |n|\n if n.marked == false\n depth_first_search(n)\n end\n end\n end", "def node_search\n while (current_node = queue.shift).present? && final.nil?\n @processed += 1\n yield(current_node)\n log \"\\rProcessing #{start.name}.... %d / %d / %d / %d @ %ds - depth: %d\", @unmarked, @requeued, @processed, @steps, (Time.now - @started), current_node.depth\n end\n\n format_results\n save_results if final.present?\n self.final_path\n end", "def include?(query)\n query.chars.inject(root) do |node, c|\n node.edges[c] || break\n end\n end", "def breadth_first_search(start_node, target_value)\n\t\tvisited = [start_node]\t\t\t\n\t\tqueue = [start_node]\n\t\n\t\twhile ( queue.length > 0 )\t\n\n\t\t\t# dequeue\n\t\t\tvertex = queue.shift\n\t\t\treturn vertex if target_value.name == vertex.name\n\t\n\t\t\t# visit all adjacent unvisited vertexes, mark visited, enqueue\n\t\t\tNode.childPointers.each do |child|\n\t\t\t\tif !eval(\"vertex.#{child}.nil?\")\n\t\t\t\t\tif !eval(\"visited.include?vertex.#{child}\")\n\t\t\t\t\t\tvisited << eval(\"vertex.#{child}\")\n\t\t\t\t\t\teval(\"vertex.#{child}.prev = vertex\")\n\t\t\t\t\t\tqueue << eval(\"vertex.#{child}\")\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\tnil\n\tend", "def search key\r\n #start searching from the head (if the head is NULL, get out of the function and return NULL)\r\n node = @head\r\n #while there's still any unsearched node in the list (you haven't reach the end of the list) and the wanted node hasn't been found\r\n while (node != nil) && (node.get_value != key)\r\n #search the wanted node linearly using the next pointer\r\n node = node.get_next_node\r\n #You MUST keep the order of the logical checking or you'll get an error for trying to check the key of NULL\r\n end\r\n #return a pointer to the wanted node (if no node with the key appears in the list, this will return NULL)\r\n return node\r\n end", "def fakesearch_all_nodes(options = {})\n fakesearch_nodes(nil, options)\nend", "def traverse\n @result.clear\n @queue.clear\n\n @queue.enqueue(@node)\n @result.push @node\n\n\n while not @queue.empty?\n node = @queue.dequeue\n return @result unless node\n # puts \"Visiting node: #{node}\"\n return node if (@search and node==@search)\n node && node.children.each do |node|\n unless @result.include?(node)\n @result.push(node)\n @queue.enqueue(node)\n end\n end\n end\n return result\n end", "def depth_first_search node= self.root, value\n\t\tstack =[node]\n\n\t\twhile stack.length > 0\n\t\t\tcurrent = stack.pop\n\t\t\treturn \"Value #{value} found in #{current.to_s}\" if current.value == value\n\t\t\tstack.push(current.left) if current.left\n\t\t\tstack.push(current.right) if current.right\n\t\tend\n\tend", "def bfs(starting_node, target_value)\n visited = Set.new()\n queue = [starting_node]\n until queue.empty?\n dequeued = queue.shift\n return dequeued if dequeued.val == target_value\n visited.add(dequeued)\n dequeued.neighbors.each do |neighbor|\n queue << neighbor unless visited.include?(neighbor)\n end\n end\n nil\nend", "def search_jps\n open_list = [@nodes[@route.start_id]]\n close_list = []\n goal = @nodes[@route.goal_id]\n\n until open_list.empty?\n n = open_list.min_by { |node| @route.estimated_cost(node) }\n if n == goal\n @route.found = true\n break\n end\n\n close_list.push( open_list.delete(n) )\n\n adjacents_of_n = n.pruned_neighbors(@route.parent(n))\n adjacents_of_n.keys.each do |m|\n j = jump(n, clamp(m.x - n.x, -1, 1), clamp(m.y - n.y, -1, 1))\n next if j == nil or close_list.include?(j)\n h = @heuristic.call(j, goal)\n new_real_cost_j = @route.real_cost(n) + Math.sqrt((n.x-j.x)**2 + (n.y-j.y)**2) # g\n new_estimated_cost_j = new_real_cost_j + h # f = g + h\n if open_list.include?(j)\n # If estimated costs are equal then use real costs for more precise comparison (or we may get less optimal path).\n next if new_estimated_cost_j > @route.estimated_cost(j)\n next if new_estimated_cost_j == @route.estimated_cost(j) && new_real_cost_j >= @route.real_cost(j)\n @route.record(j, n, new_real_cost_j, h)\n else\n open_list.push(j)\n @route.record(j, n, new_real_cost_j, h)\n end\n @visited << j.id unless @visited.include? j.id # stats\n end\n @search_iter += 1 # stats\n end\n end", "def search_for_no_results\n visit('/locations?keyword=asdfdsggfdg')\n end", "def find_optional_node_by_criteria(stack, include_criteria=nil, exclude_criteria=nil)\n search_query = \"stack:#{stack}\"\n search_query = \"#{search_query} AND #{include_criteria}\" if include_criteria\n search_query = \"#{search_query} AND NOT name:#{node.name}\" unless exclude_criteria\n search_query = \"#{search_query} AND NOT (name:#{node.name} OR #{exclude_criteria})\" if exclude_criteria\n\n Chef::Log.debug \"find_optional_node_by_criteria(#{stack}, #{include_criteria}, #{exclude_criteria}) => search query: '#{search_query}'\"\n\n nodes = search(:node, \"#{search_query}\")\n nodes.flatten!\n\n # Warn if no node has been found in the stack\n Chef::Log.warn \"The search query '#{search_query}' returned 0 results.\" if nodes.size == 0\n # Fail if mutiple nodes have been found in the stack\n raise \"Multiple machines that match the search query '#{search_query}' were found in the #{stack} environment... This is not allowed. Cleanup of nodes may be necessary.\" if nodes.size > 1\n return nodes[0]\nend", "def bfs(starting_node, target_value)\n queue = [starting_node]\n visited = Set.new()\n\n starting_node.neighbors.each do |neighb_nodes|\n\n return queue.first.value if queue.first.value == target_value\n\n visited.add(queue.shift) \n\n queue.push(neighb_nodes) unless visited.include?(neighb_nodes)\n \n end\n nil\nend", "def test_with_node_none\r\n link1 = @linklist.add_link(@node1, @node2)\r\n link2 = @linklist.add_link(@node2, @node3) \r\n \r\n assert(@linklist.with_node(@node4).length == 0)\r\n end", "def depth_first_search(query)\n stack = [@tree]\n\n loop do\n# exit when empty stack\n return nil if stack.empty?\n\n# node is equal to top of stack\n node = stack.pop\n \n# return node if match\n return node if query == node.value\n\n# i think it is pushing every descendant of the parent?\n stack.push node.left_child if node.left_child != nil\n stack.push node.right_child if node.right_child != nil\n end\n end", "def search(node, qry)\n node.search(qry)\n end", "def bfs(starting_node, target_value)\n queue = [starting_node]\n checked_nodes = Set.new\n\n until queue.empty?\n current = queue.shift\n unless checked_nodes.include?(current)\n checked_nodes.add(current)\n return current if current.value == target_value\n queue += current.neighbors\n end\n end\n nil\nend", "def test_empty_branch\n #puts \"---------------test_branch-----------------\"\n t1 = t2 = nil\n GraphBuilder::Builder.build do |b|\n t1 = b.add(Thing1.new)\n b.branch do \n end\n t2 = b.add(Thing2.new)\n end\n\n r = Thing.links([t1,t2])\n assert_equal 1, r.size\n assert r.include? [t1,t2]\n end", "def breadth_first_search node= self.root, value\n\t\tqueue = [node]\n\t\twhile queue.length > 0\n\t\t\tcurrent = queue.pop\n\t\t\treturn \"Value #{value} found in #{current.to_s}\" if current.value == value\n\t\t\tqueue.unshift(current.left) if current.left\n\t\t\tqueue.unshift(current.right) if current.right\n\t\tend\n\tend", "def matches?(node); end", "def nothingToSearch? \n\t\treturn $toSearch.empty? \n\tend", "def search_for_a_node_after_another( nokogiri_nodeset, first_key_word, last_key_word )\n matches_found = 0\n start_copy = false\n\n # Convert node content to text lines and scan them all:\n nokogiri_nodeset.text.split(\"\\n\").each do |line|\n\n # Search for a terminator key only if we have begun:\n if start_copy\n start_copy = false if !( line =~ /#{ last_key_word }/ui ).nil?\n # Increase sequences found on end copy:\n matches_found += 1 if !start_copy\n# DEBUG\n puts line if start_copy\n\n # Search for a start only if we haven't already found one:\n else\n start_copy = !( line =~ /#{ first_key_word }/ui ).nil?\n end\n end\n matches_found\n end", "def search(search_crit)\n return @head if @head.value == search_crit\n node_before(search_crit).nexxt\n end", "def bfs(starting_node, target_value)\n return starting_node if starting_node.value == target_value\n queue = [starting_node]\n until queue.empty?\n queue += starting_node.neighbors\n queue.each { |neighbor| bfs(neighbor, tar) }\n end\n nil\nend", "def dfs_rec(value, node = Node.get_root_node)\n\n if !node.nil?\n puts \"Searching node #{node.value}\"\n if !node.value.nil?\n if node.value == value\n puts \"Found #{value} at node #{node}!\"\n return node\n end\n end\n else\n nil\n end\n\n left_child = node.left_child\n right_child = node.right_child\n\n if left_child.nil?\n puts \"No left child.\"\n else\n puts \"Left child is #{left_child.value}\"\n end\n\n if right_child.nil?\n puts \"No right child.\"\n else\n puts \"Right child is #{right_child.value}.\"\n end\n\n left_child.nil? ? nil : dfs_rec(value, left_child)\n right_child.nil? ? nil : dfs_rec(value, right_child)\nend", "def search_recursive(root,target_value)\n\n return root if root.payload == target_value\n\n root.children.each do |child|\n node = search_recursive(child,target_value)\n return node if node\n end\n\n return nil\n\nend", "def restrict_when_referenced\n return false if nodes.count > 0\n end", "def bradth_first_search_colors(start_vertex, stop_vertex)\n queue = Array.new()\n queue << search_vertex(start_vertex)\n until queue.empty?\n temp_vertex = queue.shift()\n break if temp_vertex.value == stop_vertex #found stop condition\n vertex_edges = temp_vertex.edges.head\n until vertex_edges == nil\n current_vertex = search_vertex(vertex_edges.value)\n if current_vertex.color == 'white'\n current_vertex.color = 'gray' #indicates that shorter path is available if found again\n current_vertex.distance = temp_vertex.distance + 1\n current_vertex.parent = temp_vertex.value\n queue << current_vertex\n end\n vertex_edges = vertex_edges.link\n end\n temp_vertex.color = 'black' #completly explored tree\n end\n graph_traversal(start_vertex, stop_vertex)\n end", "def dfs(node, target)\n return nil if (node.nil?) \n return node if (node.val == target) \n left = dfs(node.left, target)\n right = dfs(node.right, target)\n left || right\nend", "def process_node_bookmark(xn)\n pull_node(xn)\n flag_match_found\n end", "def breadth_first_search(start, target)\n queue = [ @vertices[start] ]\n visited = []\n until queue.empty?\n vertex = queue.shift\n break if vertex.key == target\n visited << vertex\n vertex.neighbors.each { |key| queue << @vertices[key] unless visited.include?(@vertices[key])}\n end\n visited\n end", "def non_deterministic_search(goal_vertex)\n @explored = {}\n @stack = [] #\n non_deterministic_recursive(self, goal_vertex)\n @stack\n end", "def bfs_search(root)\n queue = []\n\n root.marked = true\n queue.push(root)\n\n while queue.length != 0\n current = queue.shift\n visit(current)\n\n current.adjacent.each do |node|\n if !node.marked\n node.marked = true\n queue.push(node)\n end\n end\n end\nend", "def find_visibility_end(node); end", "def bsearch_tree(node, target)\n return target if node == target\n y = nil\n node.each do |x|\n if x.is_a? node.class\n y = bsearch_tree(x, target)\n else\n return target if x == target\n end\n end\n y\nend", "def dfs(root, target)\n return root if root.value == target\n root.children.each do |child|\n search_result = dfs(child, target)\n return search_result unless search_result.nil?\n end\n\n nil\nend", "def explore(start)\n visited = Hash.new(false)\n visited[start] = true \n start.out_edges.each do |edge|\n explore(edge.dest) if !visited[edge.dest]\n end\n return visited\n end", "def depth_first_search_recursive(source)\n visited.add(source)\n\n source.neighbors.each do |neighbor|\n unless visited.include?(neighbor)\n depth_first_search_recursive(neighbor)\n meta[neighbor] = source\n end\n end\n end", "def contains(node)\n return !(@nodes[node] == nil)\n end", "def find(start,last)\n next_nodes = Array.new\n next_nodes << start\n visited = {}\n while (not next_nodes.empty?)\n next_node = next_nodes.shift\n next if visited[next_node]\n visited[next_node] = true\n return true if next_node == last\n @paths[next_node].map do |x| next_nodes << x end\n end\n return false\n end", "def search(finish, node = @root, complete = [], inprogress = [])\n inprogress << node\n\n print_path(finish, inprogress) if node.value == finish\n\n node.children.each do |child|\n search(finish, child, complete, inprogress)\n end\n\n complete << node\n inprogress.delete(node)\n end", "def to_open_search_granules(doc, hits, params, url)\n doc, subtitle_node = to_open_search_common(doc, hits, params, 'granule')\n add_nav_links(doc, subtitle_node, hits, params, url)\n add_esipbp_uplink(doc, subtitle_node, url)\n doc.root.children.each do |node|\n if node.name == 'entry'\n id_node, last_link, start_time, end_time, mbr = nil\n non_atom = []\n # if/elsif is faster than case.\n node.children.each do |sub_node|\n if sub_node.name == 'title'\n sub_node[:type] = 'text' if sub_node.element?\n elsif sub_node.name == 'link'\n # resolve the ambiguous CMR #data ( OpenSearch enclosure) links which in some cases result in more than one\n # enclosure link but only one valid link for the actual data retrieval\n if sub_node['rel'].end_with?('/data#') && sub_node.at_xpath('echo:inherited', 'echo' => 'https://cmr.earthdata.nasa.gov/search/site/docs/search/api.html#atom')\n # the 'GET DATA' link should bot be there in the first place, it is inherited from the collection and does\n # not allow direct access to the granule data file\n sub_node.remove\n else\n decorate_link(node, sub_node)\n last_link = sub_node\n end\n elsif sub_node.name == 'id'\n id_node = sub_node\n elsif sub_node.name == 'start'\n start_time = sub_node.content\n elsif sub_node.name == 'end'\n end_time = sub_node.content\n elsif sub_node.name == 'georss:polygon' or sub_node.name == 'georss:line' or sub_node.name == 'georss:point'\n mbr = generate_mbr(doc, sub_node)\n end\n non_atom << sub_node.remove if sub_node.namespace.nil? or sub_node.namespace.href != 'http://www.w3.org/2005/Atom'\n end\n\n last_link = doc.root.children.last if last_link.nil?\n guid = id_node.content\n id_node.content = \"#{ENV['opensearch_url']}/granules.atom?uid=#{guid}\"\n add_cmr_metadata_link(doc, last_link, node, guid)\n add_dc_identifier(doc, guid, node)\n add_dc_temporal_extent(doc, node, start_time, end_time) unless start_time.nil? and end_time.nil?\n # Add non-atom element array\n non_atom.each do |element|\n node.add_child(element)\n end\n node.add_child(mbr) unless mbr.nil?\n end\n end\n doc.xpath('//echo:onlineAccessFlag', 'echo' => 'https://cmr.earthdata.nasa.gov/search/site/docs/search/api.html#atom').remove\n doc.xpath('//echo:browseFlag', 'echo' => 'https://cmr.earthdata.nasa.gov/search/site/docs/search/api.html#atom').remove\n doc.xpath('//echo:dayNightFlag', 'echo' => 'https://cmr.earthdata.nasa.gov/search/site/docs/search/api.html#atom').remove\n doc.xpath('//time:start', 'time' => 'http://a9.com/-/opensearch/extensions/time/1.0/').remove\n doc.xpath('//time:end', 'time' => 'http://a9.com/-/opensearch/extensions/time/1.0/').remove\n opensearch_doc = Nokogiri::XML(doc.to_xml) do |config|\n config.default_xml.noblanks\n end\n\n opensearch_doc\n end", "def bradth_first_search(start_vertex, stop_vertex)\n queue = Array.new()\n queue << search_vertex(start_vertex)\n until queue.empty?\n temp_vertex = queue.shift()\n break if temp_vertex.value == stop_vertex\n vertex_edges = temp_vertex.edges.head\n until vertex_edges == nil\n current = search_vertex(vertex_edges.value)\n if current.visited == false\n current.visited = true\n current.parent = temp_vertex.value\n queue << current\n end\n vertex_edges = vertex_edges.link\n end\n temp_vertex.visited = true\n end\n graph_traversal(start_vertex, stop_vertex)\n end", "def search_missing_node_of(other_state)\n results = []\n\n other_state.job_names.each do |other_job_name|\n other_state.job_nodes(other_job_name).size.times do |i|\n other_node = other_state.job_nodes(other_job_name)[i]\n found_node = job_nodes(other_job_name)[i] || job_extra_node(other_job_name, i)\n # found in other state or this state doens't has it either\n if (other_node && other_node.existing?) || found_node.nil?\n results.push(other_node)\n else\n results.push(found_node)\n end\n end\n end\n\n other_state.resource_pool_names.each do |other_resource_pool_name|\n my_exisiting_nodes = (\n idle_nodes(other_resource_pool_name) +\n idle_extra_nodes(other_resource_pool_name)\n ).select(&:existing?)\n\n other_exisiting_nodes = other_state\n .idle_nodes(other_resource_pool_name)\n .select(&:existing?)\n\n my_exclusive_nodes = my_exisiting_nodes.select do |my_node|\n other_exisiting_nodes.find do |other_node|\n my_node.id == other_node.id\n end.nil?\n end\n\n other_state.idle_nodes(other_resource_pool_name).size.times do |i|\n other_node = other_state.idle_nodes(other_resource_pool_name)[i]\n if other_node && other_node.existing?\n results.push(other_node)\n else\n my_node = my_exclusive_nodes.pop\n if my_node\n results.push(my_node)\n else\n results.push(other_node)\n end\n end\n end\n end\n\n results\n end", "def path_exists?(edges, start, finish) \n nodes = edges[start].keys\n touchedNodes = nodes + [start]\n newNodes = nodes\n\n until newNodes.length == 0\n return true if touchedNodes.include?(finish)\n newNodes = []\n nodes.each do |node|\n newNodes += edges[node].keys - touchedNodes\n end\n touchedNodes += newNodes\n nodes = newNodes\n end\n false\n end", "def next_node_not_div_or_nil?(node)\n next_node_name(node) != 'div' && next_node_name(node) != nil\n end", "def get_results()\n restriction_nodes = []\n result_nodes = []\n if !(@inputs.nil? || @inputs.empty? || @inputs.first.empty?)\n input_set = @inputs.first\n restriction_nodes= input_set.nodes\n result_nodes = input_set.breadth_first_search(true){|node| node.item.text.downcase.include?(@keyword_phrase.to_s.downcase)} \n end\n \n if !@inplace\n results = @server.match_all(parse_keyword_phrase(), restriction_nodes) \n result_nodes = results.map{|item| Xplain::Node.new(item: item)}\n end\n \n result_nodes\n \n end", "def dfs_rec(data, cur_node = @root)\n node_match = nil\n # no match possible if node is 'nil'\n unless cur_node.nil?\n # check for match\n if cur_node.value == data\n node_match = cur_node\n else\n # check for matches along each child path ('nil' returned = no match found)\n unless cur_node.left_child.nil?\n left_match = dfs_rec(data, cur_node.left_child)\n node_match = left_match unless left_match.nil?\n end\n unless cur_node.right_child.nil?\n right_match = dfs_rec(data, cur_node.right_child)\n node_match = right_match unless right_match.nil?\n end\n end\n end\n return node_match\n end", "def test_node_starts_with_empty_branches\n node = Node.new(50, \"movie a\")\n refute node.left_node\n refute node.right_node\n end", "def reachable_nodes\n recursive_set(@start) { |n| n.out }\n end", "def make_null_relative_uri_out_of_blank_node\n anno_stmts = @graph.query([nil, RDF.type, RDF::Vocab::OA.Annotation])\n anno_rdf_obj = anno_stmts.first.subject\n if anno_rdf_obj.is_a?(RDF::Node)\n # use null relative URI representation of blank node\n anno_subject = RDF::URI.new\n else # it's already a URI\n anno_subject = anno_rdf_obj\n end\n OA::Graph.subject_statements(anno_rdf_obj, @graph).each { |s|\n if s.subject == anno_rdf_obj && anno_subject != anno_rdf_obj\n @graph << RDF::Statement(subject: anno_subject,\n predicate: s.predicate,\n object: s.object)\n @graph.delete s\n else\n next\n end\n }\n end", "def get_nothing(nodes, metadata)\n record_call(:get_nothing, nodes, metadata)\n # Here we return something to test that if the first one fails we have the second CMDB\n nodes.map { |node| [node, \"#{node} has nothing\"] }.to_h\n end", "def init_search weight=nil, cutoff = nil\n # Attenuation is the compounded weights in descending to this associate (The global-to-local xform)\n # Weight is the weighting of THIS node. Thus, attenuation*weight is 1) the attenuation of any children,\n # and thus 2) the greatest value that any child can achieve\n @sn_cutoff = cutoff || 0.0\n @sn_associates = []\n @sn_local_to_global = 1.0\n @search_result = nil\n @search_node_weight = weight if weight\n @search_node_weight ||= 1.0 # Assert default if weight hasn't been set by other means\n @search_node_value = @search_node_weight\n end", "def breadthFirstSearch(target, node)\n\tqueue = []\n\tqueue << node # creates array\n\tqueue.each do |n| # checks each child\n\t\treturn n if n.data == target\n\t\tn.children.each { |c| queue.push(c) }\n\tend\n\treturn nil # return if found nothing\nend", "def nodes_near_me\n if @node['location'] && @node['location']['name']\n nodes_like_me['location.name' => @node.location.name]\n else\n nodes_like_me['location' => nil]\n end\n end", "def depth_first_search(adj_matrix, source_index, end_index)\n node_stack = [source_index]\n # The code uses a forever loop and then breaks when we encounter certain conditions.\n loop do\n curr_node = node_stack.pop\n return false if curr_node == nil\n return true if curr_node == end_index\n\n # Out of the adjacency matrix, pick the “children” of curr_node by checking the 1’s in the adjacency matrix\n children = (0..adj_matrix.length-1).to_a.select do |i| \n adj_matrix[curr_node][i] == 1\n end\n \n # Take those nodes and push them onto the end of the stack\n node_stack = node_stack + children\n end\n end", "def on_nil(node)\n :false\n end", "def all_node_values_with_nil\n tree_nodes = []\n queue = [@root]\n queue_all_nil = false\n # continue adding all child nodes to queue until it contains only nil nodes\n until queue_all_nil\n cur_node = queue.first\n next_value = cur_node.nil? ? nil : cur_node.value\n tree_nodes << next_value\n if cur_node.nil?\n # maintain \"complete tree\" structure using nil in queue where no nodes\n 2.times {queue.push(nil)}\n else\n queue.push(cur_node.left_child)\n queue.push(cur_node.right_child)\n end\n queue.shift\n queue_all_nil = queue.all? {|node| node.nil?}\n end\n return tree_nodes\n end", "def search key, lambda = {}\n node = head\n while node.next_ != nil && node.key != key\n node = node.next_\n end\n node\n end", "def dfs_rec(cur_node, value)\n return nil if cur_node.nil?\n \n if cur_node.value == value\n\tcur_node\n else\n tgt_node = nil\n cur_node.children.each do |child| \n\t tgt_node = dfs_rec(child, value)\n\t break unless tgt_node.nil?\n\tend\n\ttgt_node\n end\nend", "def search_key key\n node = self.head\n while node\n return node if node.key == key\n nc = node.child \n while nc\n return nc if nc.key == key\n ncs = nc.sibling\n while ncs \n return ncs if ncs.key == key\n ncs = ncs.sibling\n end\n nc = nc.child\n end\n node = node.sibling\n end\n end", "def dfs_rec(target, current_node=@root)\n return if current_node.nil?\n return current_node if current_node.value == target\n dfs_rec(target, current_node.left_child) ||\n dfs_rec(target, current_node.right_child)\n\tend", "def safe_navigation(node)\n s(:begin,\n s(:or,\n s(:send,\n s(:send, node, :nil?),\n :!),\n s(:nil)))\n end", "def fetch_search_results(context)\n\n params = @params\n site_id = context['__site_id']\n\n matching_ids = Node.search_ids do\n\n # Site ID\n with :site_id, site_id\n\n # Node classification\n if params['classification']\n with :classification, params['classification']\n end\n\n # Parent\n if params['scope_to']\n parent_scope = context[params['scope_to']]\n with :parent_uri, parent_scope['uri']\n elsif params['parent_uri']\n with :parent_uri, params['parent_uri']\n end\n\n # Ordering\n order_by_fields = params['order_by'].blank? ? [] : params['order_by'].split(',')\n order_by_fields.each do |order_by_field|\n\n field_name, direction = order_by_field.gsub(/[\"']/, '').strip.split(' ', 2)\n direction = 'asc' if direction.blank?\n order_by field_name.to_sym, direction.to_sym\n\n end\n\n # Limit\n if params['limit']\n paginate :page => 1, :per_page => params['limit']\n end\n\n end\n\n results = []\n matching_ids.each do |id|\n\n node = Rails.cache.fetch \"node_id:#{site_id}:#{id}\" do\n Node.where(:site_id => site_id).find(id).to_liquid\n end\n results << node\n\n end\n\n results\n\n end", "def neighbours_off_end(node)\n # Find all arcs that include this node in the right place\n passable_nodes = []\n @arcs.get_arcs_by_node_id(node.node_id).each do |arc|\n if arc.begin_node_id == node.node_id and arc.begin_node_direction\n # The most intuitive case\n passable_nodes.push nodes[arc.end_node_id]\n elsif arc.end_node_id == node.node_id and !arc.end_node_direction\n passable_nodes.push nodes[arc.begin_node_id]\n end\n end\n return passable_nodes.uniq\n end", "def empty?\n @node == nil\n end", "def find_target(root, k)\n return nil if root == nil\n hash = Set.new([])\n queue = [root]\n \n while !queue.empty?\n node = queue.shift\n \n return true if hash.include?(node.val)\n \n hash.add(k-node.val)\n \n if node.left; queue.push(node.left) end\n if node.right; queue.push(node.right) end\n end\n \n return false\nend", "def other_offense_in_same_range?(node); end", "def depth_first_search(find,tree)\n current = tree[0]\n answer = \"\"\n stack = [tree[0]]\n visited = [tree[0]]\n \n condition = false\n until condition == true\n connections = [current.find_right_child[0],current.find_left_child[0]].compact\n puts current.value\n puts connections.count\n puts \"---\"\n \n if current.value == find\n answer = current\n condition = true\n elsif visited.count == tree.count\n answer = nil\n condition = true\n else\n if connections.count < 1\n stack.pop\n current = stack[-1]\n elsif connections.count == 1\n if visited.include?(connections[0])\n stack.pop\n current = stack[-1]\n else\n current = connections[0]\n stack.push(current)\n visited.push(current)\n end\n else\n if visited.include?(connections[0]) && visited.include?(connections[1])\n stack.pop\n current = stack[-1]\n elsif !visited.include?(connections[0])\n current = connections[0]\n stack.push(current)\n visited.push(current)\n else\n current = connections[1]\n stack.push(current)\n visited.push(current)\n end\n end\n end\n end\n puts answer ? answer : \"Value not found!\"\n puts answer.value if answer != nil\nend", "def search(start, goal)\n openset = Set.new\n closedset = Set.new\n current = start\n\n if @maximize_cost # serves to invert the comparison\n openset_min_max = openset.method(:max_by)\n flip = -1\n else\n openset_min_max = openset.method(:min_by)\n flip = 1\n end\n\n openset.add(current)\n while not openset.empty?\n current = openset_min_max.call{|o| o.g + o.h }\n if current == goal\n path = []\n while current.parent\n path << current\n current = current.parent\n end\n path << current\n return path.reverse\n end\n openset.delete(current)\n closedset.add(current)\n @graph[current].each do |node|\n next if closedset.include? node\n\n if openset.include? node\n new_g = current.g + current.move_cost(node)\n if (node.g - new_g) * flip > 0\n node.g = new_g\n node.parent = current\n end\n else\n node.g = current.g + current.move_cost(node)\n node.h = heuristic(node, start, goal)\n node.parent = current\n openset.add(node)\n end\n end\n end\n return nil\n end", "def search(start_key, end_key, limit, offset, reverse, with_keys)\n offset ||= 0\n \n start_node = find_by_prefix(start_key, reverse)\n !start_node and return []\n \n start_node = skip_nodes(start_node, offset, reverse)\n !start_node and return []\n \n collect_values(start_node, end_key, limit, reverse, with_keys)\n end", "def findCicle(nodes, idInicio, passed)\n if(!passed.any?{|id| id == nodes.operationId})\n passed.push(nodes.operationId)\n nodes.entradas.each { \n |node|\n if(node.operationId != idInicio)\n return findCicle(node, idInicio, passed)\n else\n return true\n end \n }\n else \n return true\n end\n return false\nend", "def node()\n return SearchNodes.new(:node => self, :return_many => false)\n end", "def depth_first_search(target)\n # create an array that acts like a stack\n stack = [self]\n # visited array keeps the visited nodes\n visited = []\n \n # search until there are no nodes left\n until stack.length == 0\n # get the last element in the stack\n node = stack[-1]\n\n # mark current node as visited\n visited << node\n\n # return the current node if the target value found\n return node if node.value == target\n \n # if there is unvisited left node, add it to stack\n if node.left && !visited.include?(node.left)\n stack << node.left\n # else if there is unvisited right node, add it to stack\n elsif node.right && !visited.include?(node.right)\n stack << node.right\n # if there are no visited children, pop the node from stack\n else\n stack.pop\n end\n end\n nil\n end", "def empty?\n return @node == nil\n end", "def finished? nodes\n nodes.each { |k,v| return false if !v.done && v.distance != -1 }\n return true \n end", "def search(value, &block)\n work_list = [@root]\n\n while !work_list.empty?\n curr_node = yield(work_list)\n\n unless curr_node.value == value\n work_list << curr_node.left_child unless curr_node.left_child.nil?\n work_list << curr_node.right_child unless curr_node.right_child.nil?\n else\n return curr_node\n end\n end\n\n return nil\n end", "def search(search_value)\n if search_value == value\n return self\n elsif !left_child.nil? && value > search_value\n return left_child.search(search_value)\n elsif !right_child.nil? && value < search_value\n return right_child.search(search_value)\n else\n return nil\n end\n end", "def search( key, node=@root )\n return nil if node.nil?\n if key < node.key\n search( key, node.left )\n elsif key > node.key\n search( key, node.right )\n else\n return node\n end\n end", "def has_path_to?(end_node)\n @visited.include?(end_node)\n end", "def branch_is_empty?(node)\n children = node.children.dup\n return true if children.nil?\n\n # test for only-child situation\n first_born = children.shift\n if children.empty?\n if first_born == n0(:continue)\n return true\n else\n return false\n end\n end\n\n # if only 2 children, check qualificataions, else done and return false\n next_born = children.shift\n if children.empty?\n if (first_born.type == :continue && next_born.type == :set_result) ||\n (first_born.type == :set_result && next_born.type == :continue)\n return true\n end\n end\n false\n end", "def search_bfs(value)\n return false unless @root_node\n queue = Array.new\n queue.push(@root_node)\n\n while !queue.empty?\n node = queue.shift\n if node.value == value\n return value\n else\n queue.push(node.left) unless node.left.nil?\n queue.push(node.right) unless node.right.nil?\n end\n end\n return nil\n end", "def breadth_first_search_with_debug(data)\n search_order = [] # For Debug output\n queue = [@root]\n node_match = nil\n match_found = false\n until queue.empty? || match_found || @root.nil?\n cur_node = queue.first\n next_node_value = cur_node.nil? ? \"nil\" : cur_node.value # For Debug output\n search_order << next_node_value # For Debug output\n if cur_node.value == data\n match_found = true\n node_match = cur_node\n else\n queue.push(cur_node.left_child) unless cur_node.left_child.nil?\n queue.push(cur_node.right_child) unless cur_node.right_child.nil?\n queue.shift\n end\n end\n puts \"Breadth-first search order for nodes visited:\" # For Debug output\n p search_order # For Debug output\n puts \"\\nTotal nodes visited: #{search_order.size}\" # For Debug output\n return node_match\n end", "def partial_matched?(node, condition)\n node.child_nodes == node.child_nodes & condition.child_nodes\n end", "def find_reaching_nodes\n @visit = CAN_REACH_TARGET\n for node, count in @parents\n if node.visit == UNVISITED\n node.find_reaching_nodes\n end\n end\n end", "def search(target) \n node = @front\n distance = 0\n\n while node \n if node.data === target \n return distance\n end\n\n distance += 1\n node = node.next_node\n end\n\n -1\n end", "def find_node(search_key)\n x = @header\n @level.downto(0) do |i|\n #puts \"on level #{i}\"\n while x.forward[i] and x.forward[i].key < search_key\n #puts \"walked node #{x.key} on level #{i}\"\n x = x.forward[i]\n end\n end \n x = x.forward[0] if x.forward[0].key == search_key\n return x\n end", "def checkNode()\n source_set = []\n neighbor_set = []\n $networks.each do |s, nb|\n source_set << s\n nb[\"neighbors\"].each do |s_, dist|\n neighbor_set << s_\n end\n end\n source_set.sort!\n source_set.uniq!\n neighbor_set.sort!\n neighbor_set.uniq!\n return source_set == neighbor_set\nend", "def busqueda(g, d, h, nro_nodos, nodos_visitados, nro_nodos_en_caminos)\r\n #Luego, en esta variable dependiendo de si estamos en un objeto DFS o BFS, se definira el orden\r\n #en el que se seleccionaran los nodos para la busqueda. Ademas, esta variable tendra los elementos\r\n #adyacentes del nodo d ya sea en una pila o en una cola. \r\n pila_o_cola = self.orden_nodos(g,d)\r\n\r\n #pila_o_cola.estructura.each {|elem| puts elem}\r\n\r\n #Verificamos si la pila o cola, de adyacentes, incluye a \"h\"\r\n if pila_o_cola.estructura.include? h \r\n\r\n #De ser asi, se incluye el numero de nodos del recorrido que llevo a \"h\"\r\n nro_nodos_en_caminos << nro_nodos\r\n\r\n #Si la pila o cola no incluye a \"h\"\r\n else\r\n\r\n #Entonces mientras no este vacia, se recorre la estructura\r\n while not(pila_o_cola.vacio)\r\n\r\n #Luego se remueve un nodo de la estructura, que sera el siguiente que se usara\r\n #como \"inicio\" de la busqueda\r\n siguiente_nodo = pila_o_cola.remover\r\n\r\n #Si el nodo en cuestion no ha sido visitado\r\n if not(nodos_visitados.include? siguiente_nodo)\r\n #Lo agregamos al arreglo de visitados\r\n nodos_visitados << siguiente_nodo\r\n #Y hacemos una llamada recursiva al metodo busqueda pero esta vez partiendo\r\n #del nodo antes tomado. En esta llamada aumentamos el numero de nodos (nro_nodos)\r\n #en 1\r\n busqueda(g, siguiente_nodo, h , nro_nodos + 1 , nodos_visitados, nro_nodos_en_caminos)\r\n end\r\n end\r\n end\r\n\r\n #Luego de que acaba todo el procesamiento verificamos si en el arreglo \"nro_nodos_en_caminos\"\r\n #esta vacio, si es asi entonces significa que el nodo \"h\" no fue alcanzado entonces\r\n if nro_nodos_en_caminos.empty?\r\n #retornamos -1\r\n return -1\r\n end\r\n\r\n #Finalmente, si sobrevivimos todo lo anterior, llegados a este punto retornamos el numero de nodos que\r\n #fueron recorridos de \"d\" a \"h\". Recordamos que el arreglo \"nro_nodos_en_caminos\" contiene para todos los\r\n #caminos de \"d\" a \"h\", el numero de nodos recorridos.\r\n\r\n ## OJO: En este caso se retornara el nro de nodos recorridos del camino mas corto. ##\r\n\r\n #Sin embargo, si se quisiera el nro de nodos de solo el primer camino por el que se metio y encontro a \"h\"\r\n #bastaria con solo retornar \"nro_nodos_en_caminos[0]\".\r\n #Por otra parte, si se quisiera para cada camino el nro de nodos recorridos entonces basta con retornar\r\n #el arreglo completo, etc.\r\n \r\n return \"#{nro_nodos_en_caminos.min} nodos recorridos.\"\r\n end", "def search_graph(query)\n (search_following(query) + search_followers(query)).uniq\n end", "def depth_first_search\n visited = {}\n timestamp = {}\n tree_edges = {}\n back_edges = {}\n cross_edges = {}\n forward_edges = {}\n count = 0\n\n # begin workaround removing depencency to order of Hash#each\n if @index.empty? then\n preference_of_nodes = nil\n else\n preference_of_nodes = {}.merge(@index)\n i = preference_of_nodes.values.max\n @graph.each_key do |node0|\n preference_of_nodes[node0] ||= (i += 1)\n end\n end\n # end workaround removing depencency to order of Hash#each\n\n dfs_visit = Proc.new { |from|\n visited[from] = true\n timestamp[from] = [count += 1]\n ary = @graph[from].keys\n # begin workaround removing depencency to order of Hash#each\n if preference_of_nodes then\n ary = ary.sort_by { |node0| preference_of_nodes[node0] }\n end\n # end workaround removing depencency to order of Hash#each\n ary.each do |to|\n if visited[to]\n if timestamp[to].size > 1\n if timestamp[from].first < timestamp[to].first\n \t# forward edge (black)\n \tp \"#{from} -> #{to} : forward edge\" if $DEBUG\n \tforward_edges[from] = to\n else\n \t# cross edge (black)\n \tp \"#{from} -> #{to} : cross edge\" if $DEBUG\n \tcross_edges[from] = to\n end\n else\n # back edge (gray)\n p \"#{from} -> #{to} : back edge\" if $DEBUG\n back_edges[from] = to\n end\n else\n # tree edge (white)\n p \"#{from} -> #{to} : tree edge\" if $DEBUG\n tree_edges[to] = from\n dfs_visit.call(to)\n end\n end\n timestamp[from].push(count += 1)\n }\n\n ary = @graph.keys\n # begin workaround removing depencency to order of Hash#each\n if preference_of_nodes then\n ary = ary.sort_by { |node0| preference_of_nodes[node0] }\n end\n # end workaround removing depencency to order of Hash#each\n ary.each do |node|\n unless visited[node]\n dfs_visit.call(node)\n end\n end\n return timestamp, tree_edges, back_edges, cross_edges, forward_edges\n end", "def search_children(node, attribute, search_term)\n matches = []\n end", "def rl_noninc_reverse_search(count, key)\r\n noninc_search(-1, (key == '/') ? '/' : nil)\r\n end" ]
[ "0.58559656", "0.5639993", "0.5631654", "0.55755275", "0.553574", "0.55067873", "0.54931533", "0.54804397", "0.54681164", "0.5435645", "0.54339176", "0.54141426", "0.5386681", "0.5369071", "0.5301404", "0.5287991", "0.5287899", "0.5285222", "0.526787", "0.52652586", "0.5257144", "0.5255107", "0.5216483", "0.52138174", "0.5201561", "0.51921815", "0.5186387", "0.5184814", "0.51668435", "0.51640105", "0.51615036", "0.5161001", "0.51404214", "0.51359993", "0.5130948", "0.51178265", "0.5116111", "0.51120985", "0.51105326", "0.5106481", "0.5104618", "0.51031893", "0.5100255", "0.509823", "0.50959647", "0.5093213", "0.5088012", "0.5082709", "0.5079954", "0.5079343", "0.5067311", "0.5066125", "0.5064276", "0.50317293", "0.50289154", "0.50287616", "0.5026434", "0.5024544", "0.50237334", "0.5021533", "0.5017372", "0.5014265", "0.50080407", "0.49992457", "0.49986804", "0.49854", "0.49767014", "0.49751952", "0.4974684", "0.49718177", "0.49669588", "0.4958232", "0.49556008", "0.49543217", "0.49539882", "0.49537864", "0.4951248", "0.49303424", "0.49269938", "0.4921723", "0.49147323", "0.49114576", "0.490716", "0.4906985", "0.49067488", "0.48914507", "0.48789963", "0.4878771", "0.48762813", "0.48758292", "0.4875628", "0.48727196", "0.4866299", "0.48629054", "0.486119", "0.4854364", "0.4853473", "0.485102", "0.4846251", "0.4836397", "0.4836194" ]
0.0
-1
d is the depth of the current node in the trie
def put_rec(node, key, value, d) node = Node.new if node.nil? if(d == key.length) node.value = value return node end c_index = key[d].ord node.next[c_index] = put_rec(node.next[c_index], key, value, d+1) return node end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def depth(d)\n @depth = d\n self\n end", "def depth; end", "def depth\n node = @kids.max {|k, j| k.depth <=> j.depth }\n node.depth + 1\n end", "def total_depth(node, depth = 0)\n @d = depth\n @d = @d + 1 if node.children.size > 0\n node.children.map{|c| x = total_depth(c,@d) - 1; @d = x if x > @d }\n return @d\nend", "def set_depth(id=0, d=0, depth=Hash.new)\n depth[id] = d\n set_depth(self[id].right, d, depth) if self[id].right != nil\n set_depth(self[id].left, d + 1, depth) if self[id].left != nil\n depth\n end", "def get_tree_height(d,cnt = 0 )\n \n if ( d['l'] == {} && d['r'] == {} )\n @depth = cnt if @depth < cnt\n else\n cnt = cnt + 1\n get_tree_height(d['l'],cnt) if d.key?('l')\n get_tree_height(d['r'],cnt) if d.key?('r')\n end\n \n return @depth\n \nend", "def depth()\n #This is a stub, used for indexing\n end", "def my_depth\n 1\n end", "def depth(value)\n node = find(value)\n find_depth(node)\n end", "def depth\n @cur_level - @base_level + 1\n end", "def depth_search(data_to_find, node)\n if data_to_find < node.data && node.left\n @depth += 1\n depth_search(data_to_find, node.left)\n elsif data_to_find > node.data && node.right\n @depth += 1\n depth_search(data_to_find, node.right)\n elsif data_to_find == node.data\n @depth += 1\n else\n @depth = 0\n end\n end", "def test_depth_of_value_returns_depth_1_node\n @tree.insert(\"a\")\n assert_equal 0, @tree.depth_of?(\"a\")\n end", "def depth\n depth_support(self.root)\n end", "def depth=(_arg0); end", "def test_depth_of_method\n tree = BinarySearchTree.new\n tree.insert(50, \"movie a\")\n tree.insert(45, \"movie b\")\n tree.insert(40, \"movie c\")\n tree.insert(35, \"movie d\")\n assert_equal 3, tree.depth_of(35)\n end", "def depth\n @traversal_position.depth\n end", "def test_depth_three_levels\n @tree.insert(\"c\")\n @tree.insert(\"b\")\n @tree.insert(\"a\")\n assert_equal 2, @tree.depth_of?(\"a\")\n end", "def depth\n if empty?\n 0\n else\n if @left==nil || @right==nil\n if (@left==nil&&@right==nil) then 1\n else -1\n end\n else\n left, right = @left.depth, @right.depth\n if left==-1||right==-1||left!=right then -1\n else 1+left\n end\n end\n end\n end", "def depth\n self[:depth]\n end", "def depth_of(data_to_find)\n @depth = 0\n if @head.nil?\n return @depth\n else\n depth_search(data_to_find, head)\n end\n return @depth\n end", "def print_tree(d)\n \n print_tree(d['l']) if d.key?('l')\n print \"#{d['v']},\" if d.key?('v')\n print_tree(d['r']) if d.key?('r')\n \nend", "def depth\n children_depth + my_depth\n end", "def depth(key, count = 0, child = key)\n count += 1\n if root.data == child\n return count - 1\n else\n parent = find_parent(child).data\n depth(key, count, parent)\n end\n end", "def get_depth\n raise \"Not implemented\"\n end", "def dfs_levels(node, result, depth = 0)\n return if node.nil?\n\n result[depth] ||= [node.val.to_i, 1]\n\n result[depth] = [(result[depth].first + node.val.to_i), result[depth].last + 1]\n\n dfs_levels(node.left, result, depth + 1)\n dfs_levels(node.right, result, depth + 1)\nend", "def depth\n @depth ||= to && to.depth + 1 || 0\n end", "def dfs(root, depth)\n return if root.nil?\n @f[depth] = @f[depth].to_i + root.val\n dfs(root.left, depth + 1) if root.left\n dfs(root.right, depth + 1) if root.right\nend", "def build_tree( n , d )\n \n if d.key?('v')\n n < d['v'] ? build_tree(n , d['l']) : build_tree(n, d['r'])\n else\n d['l'] = {}\n d['v'] = n\n d['r'] = {}\n end\n \nend", "def test_depth_value_not_exist\n @tree.insert(\"c\")\n refute_equal 0, @tree.depth_of?(\"a\")\n end", "def test_depth_two_levels\n @tree.insert(\"a\")\n @tree.insert(\"b\")\n assert_equal 1, @tree.depth_of?(\"b\")\n end", "def maximum_depth(node, depth = 0)\n @h = depth\n node.descendants.map{|d| @h = d.depth if d.depth >= @h }\n @h \nend", "def depth(sought_node, current_node = @root)\n # Base case we've reached beyond a leaf node.\n return -1 if current_node.nil?\n\n # Base case: We've reached the node.\n return 0 if current_node == sought_node\n\n # Otherwise, return the minimum of the depths\n 1 + [depth(sought_node, current_node.left), depth(sought_node, current_node.right)].max\n end", "def depth\n n = 0\n p, q = lftp, lftq\n while p != 0\n x = p.inverse(q)\n p, q = (x * p - 1) / q, x\n n += 1\n end\n n\n end", "def get_depth(id)\n if id.nil?\n return 0\n end\n \n old_pairing = AssignmentPairing.find_by_assignment_id(id)\n if old_pairing.nil? \n return 0\n end\n\n old_pairing.depth + 1\n end", "def depth_min; depths.min end", "def depth\n return call_ancestry_method(:depth) if use_ancestry?\n\n rel = relationship(:raise_on_multiple => true) # TODO: Handle multiple nodes with a way to detect which node you want\n rel.nil? ? 0 : rel.depth\n end", "def depth(person)\n count = 0\n \n until person.ancestor == nil do\n person = person.ancestor\n count += 1\n end\n\n count\n end", "def depth(node = root, parent = root, edges = 0)\n return 0 if node == parent\n return -1 if node.nil?\n\n if node < parent.data\n edges += 1\n depth(node, parent.left, edges)\n elsif node > parent.data\n edges += 1\n depth(node, parent.right, edges)\n else\n edges\n end\n end", "def current_depth\n 0\n end", "def depth(node, current = @root, count = 0)\n if current.eql?(node)\n return count\n elsif current.nil?\n return 0\n else\n count += 1\n count = [depth(node, current.left_node, count), depth(node, current.right_node, count)].max\n return count\n end\n end", "def test_depth_of_method_returns_nil\n tree = BinarySearchTree.new\n tree.insert(50, \"movie a\")\n tree.insert(45, \"movie b\")\n assert_nil tree.depth_of(35)\n end", "def depth_helper(node, arr, depth)\n if node.left.nil? && node.right.nil? \n arr << depth\n return\n else \n depth += 1 \n if node.left\n depth_helper(node.left, arr, depth) \n end \n if node.right\n depth_helper(node.right, arr, depth)\n end \n end \n end", "def depth_of(k)\n if @root.key_array.empty?\n traverse_tree\n end\n @root.key_array.detect do | pair |\n pair.first == k\n end.last\n end", "def at_depth(depth)\n where \"NLEVEL(#{table_name}.#{ltree_path_column}) = ?\", depth\n end", "def dfs_rec(data, node = @root)\n if node\n puts \"Visiting node #{node.value}\" if @debug\n if data != node.value\n left = dfs_rec(data, node.left)\n if !left\n node = dfs_rec(data, node.right)\n else\n node = left\n end\n end\n end\n node\n end", "def depth\n PathExpression.range(path)[1]\n end", "def depth\n return 0 if nil?\n\n @accumulator_depth = 1\n depth_aux(self, @accumulator_depth)\n @accumulator_depth\n end", "def depth_of(score, current = @head, count = 0)\n if current.score == nil\n nil\n elsif current.score > score\n count += 1 \n depth_of(score, current.left, count)\n elsif\n current.score < score \n count += 1\n depth_of(score, current.right, count)\n else\n count\n end\n end", "def depth\n return 0 unless has_children?\n children.inject(0) {|dep,c| dep > c.depth ? dep : c.depth} + 1\n end", "def depth_traversal(node, &block)\n yield node.value # print the current block\n\n # recurse down to the left child\n depth_traversal(node.left, &block) if node.left\n\n # recurse down to the right child\n depth_traversal(node.right, &block) if node.right\nend", "def depth\n Sequel::SQL::NumericExpression.new(:NOOP, function(:depth, self))\n end", "def depth_of(score)\n if @head.score == score\n #depth at head is nil, this conditional assigns a zero\n #value to the head\n if @head.depth == nil\n 0\n else\n @head.depth\n end\n else\n #searches tree for node with inputted score\n if score < @head.score && @head.left_link != nil\n @head = @head.left_link\n depth_of(score)\n elsif score > @head.score && @head.right_link != nil\n @head = @head.right_link\n depth_of(score)\n end\n end\n end", "def depth\n self.dotted_ids.scan(/\\./).size\n end", "def depth\n breadcrumbs.size\n end", "def test_depth_of_root\n tree = BinarySearchTree.new\n tree.insert(13, \"Test1\")\n assert_equal tree.depth_of(13), 0\n end", "def test_add_third_node_to_right\n tree = BinarySearchTree.new\n tree.insert(50, \"movie a\")\n movie_b = tree.insert(60, \"movie b\")\n movie_c = tree.insert(70, \"movie c\")\n assert_equal 2, tree.root.right_node.right_node.depth\n end", "def traverse(map, right, down)\n bottom = map.count\n x, y, level, trees = 0, 0, 1, 0\n\n while level < bottom do\n x += right\n y += down\n trees += 1 if map[y][x.remainder(map[0].size)] == \"#\"\n level += down\n end\n trees\nend", "def test_add_third_node_to_left\n tree = BinarySearchTree.new\n tree.insert(50, \"movie a\")\n movie_b = tree.insert(40, \"movie b\")\n movie_c = tree.insert(30, \"movie c\")\n assert_equal 2, tree.root.left_node.left_node.depth\n end", "def depth(ast, acc=1)\n if null?(ast)\n acc\n elsif pair?(car(ast))\n depth(cdr(ast), [acc, depth(car(ast), 1 + acc)].max)\n else\n depth(cdr(ast), acc)\n end\n end", "def depth\n @attributes[:depth]\n end", "def test_insert_second_node_returns_depth\n tree = BinarySearchTree.new\n tree.insert(50, \"movie a\")\n movie_b = tree.insert(40, \"movie b\")\n assert_equal 1, tree.root.left_node.depth\n end", "def depth(ast, acc=1)\n if null?(ast)\n acc\n elsif pair?(car(ast))\n v = depth(car(ast), 1 + acc)\n depth(cdr(ast), [acc, v].max)\n else\n depth(cdr(ast), acc)\n end\nend", "def min_depth\n return 0 if @poss.empty?\n @poss[0].length\n end", "def depth\n crumbs.size\n end", "def depth_of(score)\n if include?(score) #This is calling the method on line 44\n 1 + @root_node.depth_of(score) \n else \n nil\n end \nend", "def depth_aux(current_node, accumulator)\n @accumulator_depth = accumulator if accumulator > @accumulator_depth \n depth_aux(current_node.left_child, accumulator + 1) unless current_node.left_child.nil?\n depth_aux(current_node.right_child, accumulator + 1) unless current_node.right_child.nil?\n end", "def get_node_level(node, key)\n get_level_of_node(node, key, 1)\nend", "def depth_first(value)\n\tend", "def test_node_depth\n assert_equal(0, @root.node_depth, \"A root node's depth is 0\")\n\n setup_test_tree\n\n for child in [@child1, @child2, @child3]\n assert_equal(1, child.node_depth, \"Node #{child.name} should have depth 1\")\n end\n\n assert_equal(2, @child4.node_depth, \"Child 4 should have depth 2\")\n end", "def depth=(depth)\n #This is a stub, used for indexing\n end", "def solution(t)\n # write your code in Ruby 2.2\n depth = 0\n childs = []\n\n childs << t.l if t.l\n childs << t.r if t.r\n\n while not childs.empty? do\n depth += 1\n\n cc = []\n childs.each do |t|\n cc << t.l if t.l\n cc << t.r if t.r\n end\n\n childs = cc\n end\n\n depth\nend", "def depth_max; depths.max end", "def dfs_rec node= self.root, value\n\t\tif node.value == value\n\t\t\treturn \"Value #{value} found in #{node.to_s}\"\n\t\telse\n\t\t\t dfs_rec(node.left, value) if node.left\n\t\t\t dfs_rec(node.right, value) if node.right\n\t\tend\n\tend", "def recursive_search(path,current_depth)\n # If we haven't hit our max depth\n if current_depth < @depth \n sub_hash = @wiki\n # Follow our path down the hash\n path.each do |node|\n sub_hash = sub_hash[node]\n end\n\n # Expand this node of the sub-tree\n sub_hash.keys.each do |link|\n sub_hash[link] = get_links(\"http://en.wikipedia.org#{link}\")\n # Here's our magic recursion, add this node to the\n # path, increment our depth, and traverse that\n recursive_search(path+[link],current_depth+1)\n end\n\n end\nend", "def depth\n @breadcrumb.scan( \"/\" ).size\n end", "def depth_of_index(link)\n self.avoid_zero_division(1, self.avoid_zero_division(self.depth_of_page_in_url(link), @dpus.values.max))\n end", "def dfs_tree_from_vertex(start)\n tree_from_vertex(start, :dfs)\n end", "def depth\n self.parents.size\n end", "def depth_first_search!(node)\n node.marked = true\n node.type = \"M\"\n node.adj.each do |n|\n if n.marked == false\n depth_first_search(n)\n end\n end\n end", "def depth_first_search(data)\n node = nil\n @list << @root if @root\n\n until @list.empty?\n # Get next node from the stack\n node = @list.pop\n puts \"Visiting node #{node.value}\" if @debug\n break if node.value == data\n # Push each child on the stack, making sure the left child\n # will be popped off the stack first (LIFO)\n @list << node.right if node.right\n @list << node.left if node.left\n end\n @list.clear # remove any remaining items from the stack\n\t node\n end", "def depth\n ancestors.count\n end", "def depth\n ancestors.count\n end", "def depth_iter(root=@root)\n return 0 if root.nil? # height of an empty tree is 0\n \n s = []\n h = 1\n s.push [root, h]\n loop do\n break if s.empty?\n node, _h = s.pop\n # nothing to do with node.val\n h = _h if h < _h # interested by the max\n s.push [node.rnode, _h+1] if node.rnode\n s.push [node.lnode, _h+1] if node.lnode\n end\n h\n end", "def find(rating)\n find_depth(rating, @root)\n end", "def dfs_rec(tree, value, args = {})\r\n verbose = args.fetch(:verbose, false)\r\n return nil if tree == nil \r\n return nil if tree.visited == true\r\n tree.visited = true\r\n return tree if tree.value == value\r\n puts \"current = #{tree}\" if verbose\r\n left = dfs_rec(tree.children[0], value, args)\r\n return left if left != nil\r\n right = dfs_rec(tree.children[1], value, args)\r\n return right # if right != nil\r\n end", "def eval_depth(name)\n depth = (name.length - name.lstrip.length) / 3 + 2\n if depth < @dir.length\n (@dir.length - depth).times {@dir.pop}\n end\n end", "def compute_level(dd)\r\n lev = 0\r\n if dd > @very_small\r\n while dd < @zoom_level_breaks[lev]\r\n lev += 1\r\n end\r\n return lev\r\n end\r\n end", "def leaves(node, depth=0)\n if node.left.nil? && node.right.nil?\n puts \"#{node.value}, depth: #{depth}\"\n return 1\n else\n leaves(node.left, depth+1) + leaves(node.right, depth+1)\n end\nend", "def dfs_rec(value, node = Node.get_root_node)\n\n if !node.nil?\n puts \"Searching node #{node.value}\"\n if !node.value.nil?\n if node.value == value\n puts \"Found #{value} at node #{node}!\"\n return node\n end\n end\n else\n nil\n end\n\n left_child = node.left_child\n right_child = node.right_child\n\n if left_child.nil?\n puts \"No left child.\"\n else\n puts \"Left child is #{left_child.value}\"\n end\n\n if right_child.nil?\n puts \"No right child.\"\n else\n puts \"Right child is #{right_child.value}.\"\n end\n\n left_child.nil? ? nil : dfs_rec(value, left_child)\n right_child.nil? ? nil : dfs_rec(value, right_child)\nend", "def dfs_rec(data)\n @root.each { |node| return node if data == node.data }\n end", "def depth_support(node)\n return 0 if node.nil?\n l_depth = depth_support(node.left)\n r_depth = depth_support(node.right)\n [l_depth, r_depth].max + 1\n end", "def challenge4\n\t@size = length(@rootNode)\n\tputs \"Challenge #4 solution: \"\n\tputs \"Number of nodes in tree: \" + @size.to_s\n\tputs \"-----------------------------------\"\nend", "def node_depths(root, depth = 0)\n if root.nil?\n return 0\n end\n\n return depth + node_depths(root.left, depth + 1) + node_depths(root.right, depth + 1)\nend", "def depth_first(node, visited = Set.new())\n return nil if visited.include?(node.val)\n\n puts node.val\n visited.add(node.val)\n\n node.neighbors.each do |neighbor|\n depth_first(neighbor, visited);\n end\nend", "def countingValleys(n, s)\n level = 0\n valley = 0\n s.each_char do |direction|\n if level == 0 && direction == 'D'\n valley += 1 \n end\n\n if direction == 'D'\n level -= 1\n else\n level += 1\n end\n end\n return valley\nend", "def do_deprecated_depth\n assert_equal(1, @root.depth, \"A single node's depth is 1\")\n\n @root << @child1\n assert_equal(2, @root.depth, \"This should be of depth 2\")\n\n @root << @child2\n assert_equal(2, @root.depth, \"This should be of depth 2\")\n\n @child2 << @child3\n assert_equal(3, @root.depth, \"This should be of depth 3\")\n assert_equal(2, @child2.depth, \"This should be of depth 2\")\n\n @child3 << @child4\n assert_equal(4, @root.depth, \"This should be of depth 4\")\n end", "def depth_char(depth, depth_char = \"--\")\n char = \"\"\n depth.times do |d|\n char << depth_char\n end\n char\n end", "def max_depth(node)\n return 0 if node.nil?\n [max_depth(node.left), max_depth(node.right)].max + 1\nend", "def traverse_df(node,level,&block)\n @children[node].sort_by {|a| length(a) }.reverse.each { |child| traverse_df(child, level+1, &block) }\n yield node, level if block_given?\n end", "def node_depths(root)\n sum_of_depths = 0\n stack = [{\"node\"=> root, \"depth\"=> 0}]\n\n while stack.length > 0\n node_info = stack.pop()\n node, depth = node_info[\"node\"], node_info[\"depth\"]\n if node.nil?\n next\n end\n sum_of_depths += depth\n stack.append({\"node\"=> node.left, \"depth\"=> depth + 1})\n stack.append({\"node\"=> node.right, \"depth\"=> depth + 1})\n end\n return sum_of_depths\n\nend", "def depth_of_page_in_url(link)\n @dpus[link]\n end" ]
[ "0.7234422", "0.66203463", "0.6538041", "0.6509234", "0.6468997", "0.64514095", "0.63912433", "0.6209808", "0.6192375", "0.6163275", "0.605258", "0.60335445", "0.60137516", "0.59910554", "0.59877807", "0.59876424", "0.5974969", "0.5973535", "0.5952356", "0.5936411", "0.59108096", "0.5905644", "0.58751214", "0.58577275", "0.583231", "0.58287966", "0.5792609", "0.5786261", "0.57641846", "0.5741918", "0.57394874", "0.566161", "0.56394076", "0.5634771", "0.56189275", "0.5618533", "0.5605884", "0.56002957", "0.55965036", "0.559608", "0.55952233", "0.5573839", "0.5573695", "0.55517375", "0.55305797", "0.5512227", "0.55042356", "0.5500763", "0.5480213", "0.5468472", "0.5466713", "0.5459052", "0.54451644", "0.54380286", "0.5422322", "0.54222286", "0.54191244", "0.5418991", "0.5413158", "0.54092896", "0.5400572", "0.5398929", "0.5388065", "0.5370104", "0.5350837", "0.53333825", "0.5319423", "0.53151673", "0.5312342", "0.52994937", "0.529429", "0.529261", "0.52815074", "0.52780765", "0.5273053", "0.5248762", "0.5238355", "0.52354175", "0.5224376", "0.52105623", "0.5209495", "0.5209495", "0.51976395", "0.51895815", "0.51859653", "0.517146", "0.51554936", "0.5151098", "0.5150296", "0.51476866", "0.513617", "0.5135474", "0.5130903", "0.5126028", "0.5124009", "0.5117465", "0.5110572", "0.510731", "0.51071405", "0.5100805", "0.5099278" ]
0.0
-1
toggle status of a chain_task to be active/inactive
def toggle_status @chain_task.toggle_status! render :text => :ok and return end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toggle(task_number) # Toggle method that calls the toggle_status method on the appropriate task from the all_tasks array\n all_tasks[task_number - 1].toggle_status\n end", "def make_inactive\n self.status = \"I\"\n end", "def toggle_status # Toggle status method that negates the completed? method above\n @completed_status = !completed?\n end", "def ignore_inactive?(_task)\n !active?\n end", "def make_active\n self.status = \"A\"\n end", "def inactivate\n self.status = \"Inactive\"\n end", "def activate\n self.status = \"Active\"\n end", "def toggle\n @batch = Batch.find(params[:id])\n @batch.update(:active => @batch.active? ? false : true)\n redirect_to :back\n end", "def remove_inactive_tasks\n self.tasks = self.tasks.active\n end", "def deactivate!\n self.status = 'Inactive'\n nil\n end", "def inactive!\n self.update_attribute(:status, INACTIVE)\n end", "def change_task_status\n @task_status = UserTask.update_task_status(params[:user_id],params[:task_id])\n end", "def active!\n self.update_attribute(:status, ACTIVE)\n end", "def deactivate\n update(state: 'inactive')\n end", "def activate!\n update_attribute(:status, STATUS[:active])\n end", "def deactivate\n return false if deactivated?\n self.status = 'deactivated'\n save\n end", "def activate!\n self.status = 'Active'\n nil\n end", "def set_status_to_pending\n self.status = :pending\n end", "def inactivate!\n self.update_attribute(:status, \"Inactive\")\n end", "def activate!\n self.update_attribute(:status, \"Active\")\n end", "def make_inactive\n self.active = false\n self.save!\n end", "def make_inactive\n self.active = false\n self.save!\n end", "def activate\n @status = true\n end", "def deactivate!\n update(status: false)\n end", "def update_status\n @completed_status = !completed_status\n puts \"#{description} Completed\"\n end", "def active?; status == :active; end", "def inactive_tasks\n @tasks.select { | task | ! task.active }\n end", "def activate\n self.status = 'current'\n self.save\n end", "def toggle(outlet, status)\n current_status = status(outlet)\n toggle_relay(outlet) if current_status != status\n status\n end", "def change\n task = Task.find(params[:id])\n task.completed = params[:state]\n task.save\n render :json => { status: 200 }\n end", "def toggle\n @task.update_attributes(:completed => params[:completed])\n respond_to do |format|\n format.js\n end\n end", "def toggle_completed\n update completed: !completed\n completed\n end", "def inactive!\n @active.update { |_| false }\n end", "def inactivate\n self.update_attribute(:active, false)\n end", "def task_schedule_status(task)\n\t\tstatus = []\n\tend", "def update_status\n\t\tIFeeSchedule.where(feeActive: true).where.not(id: self.id).update_all(feeActive: false)\n\tend", "def change_status(status)\n unless @status == status\n @status = status\n @start_time = Time.now\n end\n end", "def update_task_status(event) # :nodoc:\n\t if event.success?\n\t\tplan.task_index.add_state(self, :success?)\n\t\tself.success = true\n\t elsif event.failure?\n\t\tplan.task_index.add_state(self, :failed?)\n\t\tself.success = false\n @failure_reason ||= event\n @failure_event ||= event\n end\n\n\t if event.terminal?\n\t\t@terminal_event ||= event\n\t end\n\t \n\t if event.symbol == :start\n\t\tplan.task_index.set_state(self, :running?)\n\t\tself.started = true\n\t\t@executable = true\n\t elsif event.symbol == :stop\n\t\tplan.task_index.remove_state(self, :running?)\n plan.task_index.add_state(self, :finished?)\n\t\tself.finished = true\n self.finishing = false\n\t @executable = false\n\t end\n\tend", "def set_task_state\n @task_state = TaskState.find(params[:id])\n end", "def toggle!\n if self.active?\n self.stop!\n else\n self.start!\n end\n end", "def deactivate\n @active = false\n end", "def toggle_state\n state\n end", "def mark_active\n if ACTIVE_BY_DEFAULT.include? self.name\n self.active = true\n end\n end", "def deactivate\n transaction do\n if update(active: false)\n case_assignments.update_all(active: false)\n supervisor_volunteer&.update(is_active: false)\n end\n end\n self\n end", "def active?\n !canceled?\n end", "def update_task_status(event) # :nodoc:\n if event.symbol == :start\n plan.task_index.set_state(self, :running?)\n @starting = false\n @pending = false\n @started = true\n @running = true\n @executable = true\n end\n\n if event.success?\n plan.task_index.add_state(self, :success?)\n @success = true\n elsif event.failure?\n plan.task_index.add_state(self, :failed?)\n @failed = true\n @failure_reason ||= event\n @failure_event ||= event\n end\n\n @terminal_event ||= event if event.terminal?\n\n if event.symbol == :stop\n plan.task_index.remove_state(self, :running?)\n plan.task_index.add_state(self, :finished?)\n @running = false\n @finishing = false\n @finished = true\n @executable = false\n end\n nil\n end", "def set_active\n @active = true\n end", "def inactive!\n self.active = false\n save!\n end", "def update\n @attendance = Attendance.find(params[:id])\n @attendance.toggle!(:active)\n end", "def set_status\n self.status = 1\n end", "def deactivate\n last_state = @active\n @active = false\n return @active\n end", "def update\n @task = current_user.tasks.find(params[:id])\n if params[:commit] == 'Switch Now'\n @task.switch_now\n params[:task] ||= {}\n params[:task][:stop] = @task.stop\n end\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to(@task, :notice => 'Task was successfully updated.') }\n format.xml { head :ok }\n else\n @tags = current_user.tags.all\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @task.errors, :status => :unprocessable_entity }\n end\n end\n end", "def deactivate!\n update_column(:active, false)\n end", "def deactivate!\n update_column(:active, false)\n end", "def in_progress?\n self.status == 'active'\n end", "def in_progress?\n self.status == 'active'\n end", "def enter_pending\n update_attribute(:status, :pending)\n end", "def deactivate\n @active = false\n return\n end", "def state=(s)\n @tasks.each_value do |task|\n task.state = s\n end\n end", "def active!\n @active.update { |_| true }\n end", "def toggle(status)\n log_power_relay_connection(:toggle) do\n toggled_status = relay_connection.toggle(outlet, status)\n if secondary_outlet\n secondary_toggled_status = relay_connection.toggle(secondary_outlet, status)\n handle_mismatch_status(status, toggled_status) if toggled_status != secondary_toggled_status\n end\n toggled_status\n end\n end", "def set_not_done(id)\n task = Task.find(id)\n task.done=false\n task.save\nend", "def toggle!\n if status\n off!\n return false\n else\n on!\n return true\n end\n end", "def became_inactive?\n active_changed? && !active\n end", "def activate\n update_attribute(:active, true)\n end", "def toggle_active\n @question = Question.find(params[:id])\n @question.toggle :active\n @question.save\n redirect_to :back\n end", "def toggle\n @objective = Objective.find(params[:id])\n @objective.toggle!(:completed)\n render json: @objective \n end", "def make_active\n self.active = true\n self.save!\n end", "def update\n state = task_params[:state]\n prev_state = @task.state\n\n # Restrict access for non-admins unless\n # new state is 'in progress' or 'done' or missed in params\n check_if_admin unless ['in progress', 'done', nil].include?(state) and (\n # task belongs to user\n @task.user_id == @person.id or\n # user assigns task for himself AND task has not owner AND task is open\n task_params[:user_id] == @person.id && @task.user_id.nil? && prev_state == 'open')\n\n if @task.update(task_params)\n @task.decrease_reward if state == 'failed' && prev_state != 'failed'\n send_reward if state == 'verified' && prev_state != 'verified'\n render :show, status: :ok, location: @task\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end", "def deactivate!\n update_attribute('contact_status__c','Inactive')\n end", "def activate!\n self.metadata[:inactive] = nil\n self.metadata.save\n end", "def inactivate! record\n record.update_column(:active, false)\n end", "def toggle\n @done = !@done\n end", "def update\n if params[:active]\n update_status\n elsif params[:task]\n update_completion\n else\n raise \"Don't know what you want\"\n end\n end", "def active?\n !inactive\n end", "def deactivate\n self.active = false\n save\n end", "def active=(active)\n @active = active\n end", "def make_active\n self.active = true\n self.save!\n end", "def activate_stop\n self.is_active = true\n self.send(:update_without_callbacks)\n end", "def approved?\n self.status == Task::Status::FINISHED\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 became_active?\n active_changed? && active\n end", "def is_active?\n \tself.status.to_sym == :active\n end", "def toggle\n set_switch(!self.switch) if @switch\n end", "def toggle_booking_status\n slot = Slot.find(params[:id])\n slot.update(booked: !slot.booked)\n redirect_to pretty_newsletter_slots_path(@newsletter), notice: 'Slot was successfully updated.'\n end", "def complete_task(task)\n self.task_completion_status_cache ||= {}\n task = OfferingAdminPhaseTask.find(task) unless task.is_a?(OfferingAdminPhaseTask)\n tcs = task_completion_statuses.find_or_create_by_task_id(task.id)\n tcs.result = true\n tcs.complete = true\n tcs.save\n self.task_completion_status_cache[task.id] = tcs.attributes\n tcs\n end", "def set_active\n self.active = true if self.active.nil?\n end", "def activate\n update active: true\n end", "def set_status\n @completed = @progress == @number\n end", "def implement_requested_status\n self.task.baselines.each do |b|\n if b!=self and b.status!=:closed and b.status!=:final then\n b.close!\n end\n self.task.estimation_id=nil # no valid estimation anymore\n self.task.save!\n end\n end", "def toggle_state\n puts \"******* toggle_state *******\"\n end", "def active?\n self.status == \"Active\"\n end", "def status=(value)\n value = value.to_s.to_sym\n fail Deployment::InvalidArgument, \"#{self}: Invalid task status: #{value}\" unless ALLOWED_STATUSES.include? value\n status_changes_concurrency @status, value\n @status = value\n reset_forward if DEPENDENCY_CHANGING_STATUSES.include? value\n @status\n end", "def show_taskling_action(taskling)\n\t\tif taskling.status == 0\n\t\t\tcontent_tag :span, \"\", class: \"glyphicon glyphicon-question-sign task-action\"\n\t\telsif taskling.status == 1\n\t\t\tlink_to taskling_path(taskling, taskling: {status: 3}), method: :patch do\n\t\t\t\tcontent_tag :span, \"\", class: \"glyphicon glyphicon-ok-circle task-action active\" \n\t\t\tend\n\t\telse\n\t\t\tlink_to taskling_path(taskling, taskling: {status: 1}), method: :patch do\n\t\t\t\tcontent_tag :span, \"\", class: \"glyphicon glyphicon-ok-sign task-action complete\" \n\t\t\tend\n\t\tend\n\tend", "def mark_as(status)\n self.status = status\n self.save\n end", "def active?\n status == 'active'\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 set_status(val)\n self.status = val\n self\n end", "def activate_account!\n update_attribute :is_active, true\n end", "def set_status!(status)\n ## FIXME_NISH Fix this.\n ## FIXED\n update(status: (status == 'true'))\n end" ]
[ "0.7088847", "0.6777788", "0.6747348", "0.66822916", "0.6665876", "0.6624774", "0.6588358", "0.653686", "0.65157086", "0.6429222", "0.6387258", "0.6383257", "0.6362976", "0.63434106", "0.62647796", "0.6263705", "0.6255527", "0.6252904", "0.6242338", "0.6238309", "0.6222973", "0.6222973", "0.6170786", "0.61634624", "0.6157501", "0.61512965", "0.61463606", "0.6103906", "0.6074706", "0.6057258", "0.6040187", "0.60365695", "0.6036452", "0.6019243", "0.5997498", "0.59963864", "0.5977954", "0.5929347", "0.59266096", "0.5889555", "0.58743787", "0.584715", "0.58395344", "0.583518", "0.58347714", "0.5827749", "0.5825375", "0.58253014", "0.58242327", "0.58205956", "0.5815808", "0.5813625", "0.5812817", "0.5812817", "0.5806502", "0.5806502", "0.5799484", "0.57692575", "0.5768635", "0.5761639", "0.5761159", "0.5757086", "0.57505214", "0.57435256", "0.5731919", "0.5727132", "0.5721979", "0.57207686", "0.5719418", "0.57080173", "0.57015395", "0.5701223", "0.56991965", "0.5698357", "0.56909376", "0.5690546", "0.5685846", "0.5679607", "0.56776154", "0.566768", "0.56665504", "0.565899", "0.56346935", "0.5629685", "0.56258076", "0.5616352", "0.5613537", "0.56059784", "0.5605537", "0.5593403", "0.55888134", "0.55867594", "0.5586047", "0.55857486", "0.5585728", "0.55589706", "0.5557646", "0.5557023", "0.55530995", "0.5549552" ]
0.7906999
0
It defines a task that update status of resources.
def write_task(task_name, session, admin_auth=false, &block) task(task_name, session, :wt, admin_auth, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update task\n now = Time.now.to_i\n wait = task.wait.nil? ? now : task.wait\n wake = now + wait\n tasks = @db[:tasks]\n r = tasks.where(:id => task.id).update :changed => now,\n :status => task.getStatus,\n :wake => wake,\n :data => Marshal::dump(task)\n end", "def update\n if params[:active]\n update_status\n elsif params[:task]\n update_completion\n else\n raise \"Don't know what you want\"\n end\n end", "def do_task_work\n @web.add_status( @thing, @statusUpdates )\n end", "def update!(**args)\n @runnable = args[:runnable] if args.key?(:runnable)\n @task_id = args[:task_id] if args.key?(:task_id)\n @task_status = args[:task_status] if args.key?(:task_status)\n end", "def update_task_status(event) # :nodoc:\n\t if event.success?\n\t\tplan.task_index.add_state(self, :success?)\n\t\tself.success = true\n\t elsif event.failure?\n\t\tplan.task_index.add_state(self, :failed?)\n\t\tself.success = false\n @failure_reason ||= event\n @failure_event ||= event\n end\n\n\t if event.terminal?\n\t\t@terminal_event ||= event\n\t end\n\t \n\t if event.symbol == :start\n\t\tplan.task_index.set_state(self, :running?)\n\t\tself.started = true\n\t\t@executable = true\n\t elsif event.symbol == :stop\n\t\tplan.task_index.remove_state(self, :running?)\n plan.task_index.add_state(self, :finished?)\n\t\tself.finished = true\n self.finishing = false\n\t @executable = false\n\t end\n\tend", "def update \n\t logger.debug \"Params --------------------------------------- #{params}\"\n\n\t logger.debug \"task params --------------------------------------#{task_params}\"\n\t format_task_attributes(task_params)\n\t \n\t logger.debug \"-------------------------------------------------------------\"\n\t logger.debug \"Updated Params #{@updated_params}\"\n\t @updated_params[:id]=params[:id]\n\t @task = Task.find(@updated_params[:id])\n\t logger.debug \"#########################\"\n\t logger.debug \"Task found \"\n\t \n\t @task.assign_attributes(@updated_params)\n\t authorize! :update, @task\n\t @task.is_completed=false\n\t save_task\n\tend", "def update_task(id, pid, priority, description, status)\n x = []\n data.each_pair do|k, v|\n x << \"#{k} = #{v}\"\n end\n\n str = x.join(\",\")\n\n command = @db.exec(%Q[\n UPDATE tasks\n SET #{str}\n WHERE id = #{data[\"id\"]};\n ])\n TM::Task.new(command)\n end", "def update_task_status(event) # :nodoc:\n if event.symbol == :start\n plan.task_index.set_state(self, :running?)\n @starting = false\n @pending = false\n @started = true\n @running = true\n @executable = true\n end\n\n if event.success?\n plan.task_index.add_state(self, :success?)\n @success = true\n elsif event.failure?\n plan.task_index.add_state(self, :failed?)\n @failed = true\n @failure_reason ||= event\n @failure_event ||= event\n end\n\n @terminal_event ||= event if event.terminal?\n\n if event.symbol == :stop\n plan.task_index.remove_state(self, :running?)\n plan.task_index.add_state(self, :finished?)\n @running = false\n @finishing = false\n @finished = true\n @executable = false\n end\n nil\n end", "def change_task_status\n @task_status = UserTask.update_task_status(params[:user_id],params[:task_id])\n end", "def update!(**args)\n @tasks = args[:tasks] if args.key?(:tasks)\n end", "def update\n begin\n data = params\n data[:lawyer_email] = \"mkd@ddiplaw.com\" if data[:lawyer_email].eql?(\"mdickinson@mdick.liviaservices.com\")\n data.delete(:action)\n data.delete(:controller)\n data[:start_date] = data[:start_date].to_date if data[:start_date]\n data[:end_date] = data[:end_date].to_date if data[:end_date]\n attributes = data\n @task = MatterTask.find_by_zimbra_task_id_and_lawyer_email_and_category(attributes[:zimbra_task_id], attributes[:lawyer_email], \"todo\")\n if @task\n attributes[:zimbra_task_status] = true\n # if the task is completed at zimbra mark it's completion in the portal also -- Mandeep (21/04/10).\n if attributes[:progress].eql?(\"COMP\") && attributes[:progress_percentage].eql?(\"100\")\n attributes.merge!({:completed => true, :completed_at => Time.zone.now.to_date})\n end\n # if the task is changed from completed to other, need to change it in portal -- Ketki (23/09/2010).\n if @task.completed and !attributes[:progress].eql?(\"COMP\")\n attributes.merge!({:completed => false, :completed_at => nil}) \n end\n @task.progress = attributes[:progress]\n @task.progress_percentage = attributes[:progress_percentage]\n data[:name] = CGI.unescape(data[:name])\n matter_name = Matter.find(@task.matter_id).name\n data[:name].slice!(\"<#{matter_name}>\")\n if(data[:description] != \"null\")\n data[:description] =CGI.unescape(data[:description])\n end\n if @task.update_attributes(attributes)\n render :xml=>{:success => \"Task is sucessfully updated\"} \n else\n render :xml=>{:error => @task.errors}\n end\n else\n @task = ZimbraActivity.find_by_zimbra_task_id(data[:zimbra_task_id])\n if @task\n data = ZimbraActivity.zimbra_task_params(data)\n data[:name] = CGI.unescape(data[:name])\n if @task.update_attributes(data)\n render :xml=>{:success => \"Task is sucessfully created\"}\n else\n render :xml=>{:error => @task.errors}\n end\n else\n render :xml => \"Hash not found\"\n end\n end\n rescue Exception=>e\n render :xml=>{:error=>e}\n end\n end", "def task_status_updated(task_status, diff)\n @task_status_counters.add_value_to_status(task_status, diff)\n update_status\n end", "def task_schedule_status(task)\n\t\tstatus = []\n\tend", "def complete_task\n @task = Task.find_by(id: params[:id])\n puts @task.id, @task.status\n if @task.status == 0\n @task.update(status: 1)\n else\n @task.update(status: '0')\n end\n\n render :json => @task.as_json(:only => [:id, :status])\n end", "def update_attributes(id, name, task, status)\n\t\tDB.execute(\"UPDATE tasks SET task=\\\"#{task}\\\", name=\\\"#{name}\\\", status=\\\"#{status}\\\" WHERE id=\\\"#{id}\\\"\")\n\t\t@task = task\n\t\t@name = name\n\t\t@status = status\n\tend", "def update(task_number, task) # Update task based on task number\n all_tasks[task_number -1] = task # Updates task\n end", "def update\n @task.update(task_params)\n end", "def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @error = args[:error] if args.key?(:error)\n @execution = args[:execution] if args.key?(:execution)\n @executor_detail = args[:executor_detail] if args.key?(:executor_detail)\n @inputs = args[:inputs] if args.key?(:inputs)\n @outputs = args[:outputs] if args.key?(:outputs)\n @parent_task_id = args[:parent_task_id] if args.key?(:parent_task_id)\n @pipeline_task_status = args[:pipeline_task_status] if args.key?(:pipeline_task_status)\n @start_time = args[:start_time] if args.key?(:start_time)\n @state = args[:state] if args.key?(:state)\n @task_id = args[:task_id] if args.key?(:task_id)\n @task_name = args[:task_name] if args.key?(:task_name)\n end", "def update!(**args)\n @reload_tasks = args[:reload_tasks] if args.key?(:reload_tasks)\n end", "def update\n @task = @pickup.tasks.find(params[:id])\n\n if @task.update_status(params[:commit], current_user, params[:task][:comments])\n donemark \"#{@task.name} #{@task.status}.\"\n audit \"Pickup \\\"#{@pickup.name}\\\" task #{@task.name} #{@task.status}\", :auditable => @pickup\n else\n errormark \"Unable to update task.\"\n end\n\n redirect_to :action => 'index'\n end", "def update\n command = Tasks::Update.call(@task, params: task_params)\n respond_to do |format|\n if command.success?\n format.html { redirect_to @task, notice: \"Task was successfully updated.\" }\n else\n format.html { render :edit, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @task.update(task_params)\n success_task_show\n else\n error_task_save\n end\n end", "def task_completion_status(task_id, force_update = false)\n save if task_completion_status_cache.nil? || force_update\n task_completion_status_cache[task_id]\n end", "def update\n @task = Task.find(params[:id])\n # We need to use load then save instead of update_attributes with active resource models\n @task.load(params[:task])\n \n logger.info \"params[:task][:completed]: #{params[:task][:completed]}\"\n @task.completed_at = Time.now if params[:task][:completed]\n logger.info \"@task.completed?: #{@task.completed?}\"\n\n respond_to do |format|\n if @task.save\n \tcalculate_totals\n \t#flash[:notice] = 'Task was successfully updated.'\n format.js # run the update.js.rjs template\n format.xml { head :ok }\n else\n format.xml { render :xml => @task.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_tasks_task\n require 'net/https'\n require 'uri'\n \n uri = URI.parse('https://raw.github.com/wvanbergen/github-gem/master/tasks/github-gem.rake')\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n response = http.request(Net::HTTP::Get.new(uri.path))\n\n if Net::HTTPSuccess === response\n open(__FILE__, \"w\") { |file| file.write(response.body) }\n relative_file = File.expand_path(__FILE__).sub(%r[^#{@root_dir}/], '')\n if `#{git} ls-files -m #{relative_file}`.split(\"\\n\").any?\n sh git, 'add', relative_file\n sh git, 'commit', '-m', \"Updated to latest gem release management tasks.\"\n else\n puts \"Release managament tasks already are at the latest version.\"\n end\n else\n raise \"Download failed with HTTP status #{response.code}!\"\n end\n end", "def update!(**args)\n @status = args[:status] if args.key?(:status)\n end", "def update!(**args)\n @status = args[:status] if args.key?(:status)\n end", "def update!(**args)\n @status = args[:status] if args.key?(:status)\n end", "def update!(**args)\n @status = args[:status] if args.key?(:status)\n end", "def update!(**args)\n @status = args[:status] if args.key?(:status)\n end", "def update!(**args)\n @status = args[:status] if args.key?(:status)\n end", "def complete_task(task)\n self.task_completion_status_cache ||= {}\n task = OfferingAdminPhaseTask.find(task) unless task.is_a?(OfferingAdminPhaseTask)\n tcs = task_completion_statuses.find_or_create_by_task_id(task.id)\n tcs.result = true\n tcs.complete = true\n tcs.save\n self.task_completion_status_cache[task.id] = tcs.attributes\n tcs\n end", "def update\n task = @task_list.tasks.find(params[:id])\n task.update_attributes(task_params)\n render nothing: true\n end", "def update_status\n @completed_status = !completed_status\n puts \"#{description} Completed\"\n end", "def change\n task = Task.find(params[:id])\n task.completed = params[:state]\n task.save\n render :json => { status: 200 }\n end", "def update_late_tasks\n # find project\n project = Project.find(params[:id])\n # check user is manager of project\n if (!@superuser_is_superadmin && !(superuser_is_part_of_project? project))\n flash[:warning] = \"You can't do this action for this project\"\n redirect_to lato_core.root_path and return false\n end\n # find tasks\n today = Date.today\n tasks = project.tasks.where(status: ['wait', 'develop']).where('end_date < ?', today)\n # update tasks\n tasks.each do |task|\n days_long = task.end_date - task.start_date\n task.update(start_date: today, end_date: today + days_long)\n end\n # return result\n flash[:success] = 'Operation done'\n redirect_to lato_swpmanager.project_tasks_path(id: project.id)\n end", "def update_status\n\n command = params[:status].to_sym\n case command\n when :setup, :start, :abort, :terminate\n @project.send(\"#{command}_done!\")\n when :stop\n @project.stop_done!\n # save return result data\n raw_data = params[:data]\n results = JSON.parse(raw_data)\n results.each {|result| LoadTest.create!(result.merge(project_id: @project.id))}\n\n when :download, :export\n result_download_parms = {}\n result_download_parms[:status] = 1\n ProjectResultDownload.update(params[:request_id], result_download_parms)\n\n when :status\n status_data = params[:status_data]\n unless status_data.blank?\n if JSON.parse(status_data).empty?\n if @project.may_stop?\n submit_process(:stop)\n @project.stop! # TODO refactor as a :before callback to events\n end\n end\n end\n else\n raise \"Unknown command for status update: #{command}\"\n end\n\n flash[:success] = \"#{command} completed successfully!\"\n render nothing: true\n end", "def status=(value)\n value = value.to_s.to_sym\n fail Deployment::InvalidArgument, \"#{self}: Invalid task status: #{value}\" unless ALLOWED_STATUSES.include? value\n status_changes_concurrency @status, value\n @status = value\n reset_forward if DEPENDENCY_CHANGING_STATUSES.include? value\n @status\n end", "def update(options = {})\n self.merge!(Vermonster::Client.connection.put(\"tasks/#{self[\"id\"]}\", \"{\\\"task\\\": #{options.to_json}}\").body)\n end", "def status( *args )\n statusTask = StatusTask.new( @web, self, *args )\n statusTask.perform()\n end", "def update_status(status)\n @status = status\n @last_status_change = Time.now\n update_statusfile\n end", "def task_action\n action = params[:task_action]\n @task.update status: action \n respond_to do |format|\n format.html { redirect_to edit_ticket_path(@ticket), notice: \"Task #{action}.\" }\n format.json { head :no_content }\n end\n end", "def task\n end", "def status\n return @task_status if job_ended?\n\n current_task_status = puppet_to_task_status(puppet_status)\n\n self.task_status = case current_task_status\n when 'successful'\n processing_succeed_task\n when 'running'\n processing_running_task\n when 'failed'\n processing_error_task\n when 'undefined'\n processing_undefined_task\n end\n\n time_is_up! if should_stop?\n @task_status\n end", "def update!(**args)\n @resource = args[:resource] unless args[:resource].nil?\n @status = args[:status] unless args[:status].nil?\n @time_nanos = args[:time_nanos] unless args[:time_nanos].nil?\n end", "def update_status status\n @job.set({\n custom_status: status,\n pinged_at: Time.now\n })\n end", "def update\n @task = current_user.tasks.find(params[:id])\n if params[:commit] == 'Switch Now'\n @task.switch_now\n params[:task] ||= {}\n params[:task][:stop] = @task.stop\n end\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to(@task, :notice => 'Task was successfully updated.') }\n format.xml { head :ok }\n else\n @tags = current_user.tags.all\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @task.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_task\r\n\r\n t = BgWorker.task(:name => params[:task][:name]) # new task so we update data\r\n if t[:name].blank?\r\n flash[:error] = _('Invalid name!')\r\n redirect_to :action => :back\r\n end\r\n t[:filename]\t= Rails.root.join('lib', 'tasks', \"bg_worker_#{t[:name]}.rake\")\r\n id \t\t= params[:task][:id]\r\n t[:code]\t= params[:task][:code]\r\n t[:namespace] \t= params[:task][:namespace]\r\n t[:desc]\t= params[:task][:desc]\r\n t[:args]\t= params[:task][:args].blank? ? nil :\r\n params[:task][:args].tr(' :', ',').split(',').compact.map{|d|\r\n \":#{d}\".gsub('::', ':') unless d.blank?}.compact.join(', ')\r\n arg_string\t= \", [#{t[:args]}]\" unless t[:args].blank?\r\n t[:dependencies]= params[:task][:dependencies].blank? ? nil :\r\n params[:task][:dependencies].tr(' :', ',').split(',').compact.map{|d|\r\n \":#{d}\".gsub('::', ':') unless d.blank?}.compact.join(', ')\r\n dep_string\t= \" => [#{t[:dependencies]}]\" unless t[:dependencies].blank?\r\n t = BgWorker.task(t)\r\n file = %Q[# name: #{t[:name]}\r\n\r\n # args: #{t[:args]}\r\n # desc: #{t[:desc]}\r\n #{\"# namespace: #{t[:namespace]}\" unless t[:namespace].blank?}\r\n # dependencies: #{t[:dependencies] unless t[:dependencies].blank?}\r\n #{\"namespace :#{t[:namespace]} do\" unless t[:namespace].blank?}\r\n\r\n desc %q[#{t[:desc]}]\r\n task :#{t[:name]} #{arg_string} #{dep_string} do |task #{', args' if arg_string}|\r\n\r\n #{t[:code]}\r\n\r\n end\r\n\r\n #{'end' unless t[:namespace].blank?}]\r\n\r\n if !id.blank? && id != t[:name]\r\n begin\r\n File.rm(Rails.root.join('lib', 'tasks', \"#{id}.rake\"))\r\n rescue\r\n flash[:error] = _('Task %{obj} could not be erased!') % {:obj => id}\r\n end\r\n end\r\n begin\r\n File.open(t[:filename], 'w+') {|f| f.write file}\r\n flash[:notice] = _('%{obj} successfully modified') % {:obj => _('Task')}\r\n rescue\r\n flash[:error] ||= ''\r\n flash[:error] << _('%{obj} could not be modified!') % {:obj => _('Task')}\r\n end\r\n redirect_to :action => :list\r\n end", "def default_do_task(task, times)\n self.village.increment_resources!(task, times)\n end", "def update\n set_task\n respond_to do |format|\n if @task.update!(task_params)\n format.html\n format.json { respond_with_bip(@task) }\n end\n end\n end", "def update\n @task = Task.find_by(id: params[:id])\n if @task.update(task_params)\n render json: { message: I18n.t('task.update.success') }, status: 200\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end", "def update\n state = task_params[:state]\n prev_state = @task.state\n\n # Restrict access for non-admins unless\n # new state is 'in progress' or 'done' or missed in params\n check_if_admin unless ['in progress', 'done', nil].include?(state) and (\n # task belongs to user\n @task.user_id == @person.id or\n # user assigns task for himself AND task has not owner AND task is open\n task_params[:user_id] == @person.id && @task.user_id.nil? && prev_state == 'open')\n\n if @task.update(task_params)\n @task.decrease_reward if state == 'failed' && prev_state != 'failed'\n send_reward if state == 'verified' && prev_state != 'verified'\n render :show, status: :ok, location: @task\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end", "def update_task_if_children_tasks_are_completed\n if type == EducationDocumentSearchTask.name && children.last.completed?\n update!(status: Constants.TASK_STATUSES.completed)\n else\n update!(status: Constants.TASK_STATUSES.assigned)\n end\n end", "def update\n # avoids API call when only color is changed\n if (@task.changed_only_color(task_params))\n @task.color = task_params[\"color\"]\n return @task.save\n end\n @task.start = task_params[\"start\"].to_time.utc\n @task.end = task_params[\"end\"].to_time.utc\n # normal event dragged to all-day zone\n if (@task.start == @task.end && @task.start.localtime == @task.start.localtime.midnight)\n @task.end = @task.start + 1.days\n # all-day event dragged to normal zone\n elsif (@task.start == @task.end)\n @task.end = @task.start + 1.hours\n end\n @task.title = task_params[\"title\"]\n @task.description = task_params[\"description\"]\n # only change color if new color specified\n if !task_params[\"color\"].nil?\n @task.color = task_params[\"color\"]\n end\n # For Google API POST request\n event = @service.get_event(\"primary\", @task.google_id)\n event.summary = @task.title\n event.start = {date_time: @task.start.localtime.iso8601}\n event.end = {date_time: @task.end.localtime.iso8601}\n event.description = @task.description\n event = @service.update_event(\"primary\", @task.google_id, event)\n @task.save\n end", "def update\n @task.update(task_params) ? respond_with(@task) : false\n end", "def update\n if @task.update(task_params)\n render :show, status: :ok\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end", "def update\n previous_completed = @task.completed\n previous_deadline = @task.deadline\n previous_owner = @task.user\n new_owner = User.find_by(id: params[:task][:user_id])\n task_owner = @task.user\n project = @task.milestone.project\n success = @task.milestone.success\n\n #you can STILL edit tasks when the project becomes a success\n if project.present?\n project_owner = @task.milestone.project.user\n else\n success_owner = @task.milestone.success.leader\n end\n\n if !params[:task][:deadline].nil?\n new_deadline = params[:task][:deadline]\n if new_deadline != previous_deadline && current_user != task_owner\n task_owner.notify(\"alert\", \"#{view_context.link_to current_user.full_name, current_user} changed the due date of\n #{view_context.link_to @task.description, @task.milestone.project} to #{new_deadline}\")\n end\n end\n\n #Notify a task was completed\n if params[:task][:completed] == \"true\" && current_user != task_owner\n task_owner.notify(\"alert\", \"Your task '#{@task.description}' in #{view_context.link_to project.title, project} was completed by #{view_context.link_to current_user.full_name, current_user}\")\n end\n\n #notifies user they have a new task\n if !new_owner.nil? && new_owner != current_user && new_owner != task_owner\n if @task.milestone.project.present?\n new_owner.notify(\"alert\", \"You were assigned to a task in the project #{view_context.link_to @task.milestone.project.title, project}\")\n else\n new_owner.notify(\"alert\", \"You were assigned to a task in the success #{view_context.link_to @task.milestone.success.title, success}\")\n end\n end\n\n modified_params = task_params.clone\n if modified_params[:completed] == \"true\"\n modified_params.merge!({completed_at: DateTime.now})\n next_task = Task.find_by_position_and_milestone_id((@task.position - 1), @task.milestone_id)\n if next_task.present?\n next_task.ball_is_in_your_court(@task) if next_task.user.present? && next_task.crucial == true\n end\n elsif modified_params[:completed] == \"false\"\n modified_params.merge!({completed_at: nil})\n end\n\n respond_to do |format|\n if @task.update_attributes(modified_params)\n @task.create_activities(previous_completed, previous_deadline, previous_owner, current_user)\n\n # during update, if there is 1 last task remaining already and someone is updating client's remaining incomplete task the project owner will be notified every time\n # user!=project_owner ensures that if the changes are made by the project_owner, client is not notified (since client can see it)\n if @task.milestone.tasks.where(completed: false).size==1 && (task_owner!=project_owner || task_owner!=project_owner) && params[:task][:completed]\n\n # if never_alerted (which should be a boolean that shows if there already was a notification from this task)\n if project.present?\n project_owner.notify(\"alert\", \"One task left until #{view_context.link_to @task.milestone.name, project} is completed!\")\n else\n success_owner.notify(\"alert\", \"One task left until #{view_context.link_to @task.milestone.name, success} is completed!\")\n end\n end\n\n # user id gets saved as 0 sometimes when being set as nil. this changes it back\n if @task.user_id == 0\n @task.update_attributes(user_id: nil)\n end\n\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n if project.present?\n format.html { redirect_to project, notice: 'Task was successfully updated.' }\n else\n format.html { redirect_to success, notice: 'Task was successfully updated.' }\n end\n format.json { respond_with_bip(@task) }\n else\n if project.present?\n format.html { redirect_to project, alert: @task.errors.full_messages.to_sentence }\n else\n format.html { redirect_to success, alert: @task.errors.full_messages.to_sentence }\n end\n format.json { respond_with_bip(@task) }\n end\n end\n end", "def handle_task_status_update(completion_status_code)\n task.complete!(status: Task.completion_status_code(completion_status_code))\n task.claim_stablishment.update!(decision_date: Time.zone.now) if task.claim_establishment\n render json: {}\n end", "def update\n flash[:notice] = \"Task was successfully updated.\" if task.save\n respond_with(task)\n end", "def update\n if @task.update(task_params)\n return render_success_task_save\n else\n return render_error_save @task\n end\n end", "def mark_completed\n puts 'Enter task number(ID), please'\n\n entered_id = get_id_input\n\n if @tasks[entered_id]\n\n @tasks[entered_id].status = 'completed'\n\n else\n\n no_entry_message\n\n end\n\n end", "def update\n #@readonly_task = ReadonlyTask.find(params[:id])\n result = ''\n\n ReadonlyTask.transaction do\n all_tasks = ReadonlyTask.all\n ReadonlyTask.all.each do |rt|\n rt.destroy\n end\n\n unless params[:task_ids].blank?\n params[:task_ids].each do |task_id|\n\n unless task_id_in_readonly_task(all_tasks, task_id)\n task = Task.find(task_id.to_i)\n result += \"-------------------\\n\"\n result += \"Packages moved to state 'Already Released':\\n\"\n result += ReadonlyTask.move_other_packages_to_already_released(task_id.to_i)\n result += \"-------------------\\n\"\n task.active = nil\n task.frozen_state = \"1\"\n task.save\n end\n\n rt = ReadonlyTask.new\n rt.task_id = task_id.to_i\n rt.save\n end\n end\n end\n\n respond_to do |format|\n #if @readonly_task.update_attributes(params[:readonly_task])\n format.html do\n notice ='ReadonlyTask was successfully updated.'\n unless result.blank?\n notice += \"\\n\" + result\n end\n redirect_to(readonly_tasks_path,\n :notice => notice.gsub(\"\\n\", \"<br/>\"))\n end\n end\n end", "def update\n @task = Task.find(params[:id])\n oldtaskname = @task.name\n if @task\n if request.referrer && URI(request.referrer).path == edit_task_path(@task) && (task_params[:name] == nil|| task_params[:name] == \"\")\n flash[:error] = \"You must enter a name for a task\"\n redirect_to edit_task_path(@task.id)\n else\n oldcomplete = @task.complete\n oldassignee = @task.assignedto\n users = Project.find_by_id(@task.projectid).allshares.split(\",\")\n found = false\n if @task.assignedto == nil\n @task.assignedto = \"None\"\n end\n if task_params[:assignedto] == nil || task_params[:assignedto] == \"\"\n task_params[:assignedto] = @task.assignedto\n end\n if !(users.include? task_params[:assignedto])\n task_params[:assignedto] = @task.assignedto\n end\n # if task_params[:label] == nil || task_params[:label] == \"\"\n # @task.label = 0\n # end\n @task.update(task_params)\n @task.save!\n if @task.assignedto != oldassignee\n if @task.assignedto != \"None\"\n assignemail = \"\"\n users.each do |user|\n us = User.find_by_id(user)\n if us\n if (us.firstname + \" \" + us.lastname) == @task.assignedto\n if us.noemail != true\n assignemail = us.name\n end\n end\n end\n end\n send_assignment(@task, assignemail)\n\n end\n end\n\n if @task.complete == true && @task.complete != oldcomplete\n mark_complete(@task)\n elsif @task.complete == false\n mark_incomplete(@task)\n end\n\n respond_to do |format|\n if @task\n if oldcomplete == false && @task.complete == true\n @task.datecomplete = @task.updated_at\n elsif oldcomplete == true && @task.complete == false\n @task.datecomplete = nil\n end\n @task.save!\n flash[:alert] = 'Task was successfully updated.'\n if request.referrer && URI(request.referrer).path != edit_task_path(@task)\n format.html { redirect_to request.referrer }\n format.mobile { redirect_to request.referrer, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n elsif request.referrer && URI(request.referrer).path == edit_task_path(@task)\n format.html { redirect_to project_path(@task.projectid), notice: 'Task was successfully updated.' }\n format.mobile { redirect_to project_path(@task.projectid), notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to task_path(@task.id), notice: 'Task was successfully updated.' }\n format.mobile { redirect_to task_path(@task.id), notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n end\n else\n format.html { render action: 'edit' }\n format.mobile { render action: 'edit' }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end\n else\n flash[:error] = \"You must enter a name for a task\"\n redirect_to edit_task_path(@task.id)\n end\n end", "def update!(**args)\n @new_status = args[:new_status] if args.key?(:new_status)\n end", "def update_task_completion_status_cache!(tasks = nil)\n self.task_completion_status_cache ||= {}\n tasks ||= offering.tasks.find(:all, :conditions => \"context = 'applicant' AND completion_criteria != ''\")\n tasks = [tasks] unless tasks.is_a?(Array)\n for task in tasks\n tcs = task_completion_statuses.find_or_create_by_task_id(task.id)\n tcs.result = self.instance_eval(task.completion_criteria.to_s)\n tcs.complete = tcs.result == true\n tcs.save\n self.task_completion_status_cache[task.id] = tcs.attributes\n end\n task_completion_status_cache\n end", "def update_status\n do_load_resource\n do_authorize_instance\n\n update_status_user_check\n end", "def update\r\n @tasks = Task.find(params[:id])\r\n if @tasks.update(task_params)\r\n render json: @tasks\r\n else\r\n render json: @tasks.errors, status: :unprocessable_entity\r\n end\r\n end", "def update\n @task = Task.find(params[:id])\n if @task.closed = true\n @task.effective_achievement_date = Date.today\n @task.stopover_id = Stopover.find(:first, :conditions => \"name = 'Closed'\").id\n end\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def auto_update_status \n if self.status == \"To Be Published\"\n self.status = \"Published\"\n end \n end", "def update\n if @task.update(task_params)\n render :show, status: :ok, location: @task\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end", "def update!(**args)\n @failure_resource_count = args[:failure_resource_count] if args.key?(:failure_resource_count)\n @success_resource_count = args[:success_resource_count] if args.key?(:success_resource_count)\n end", "def change_task_status\n\n statuses = ['done', 'done_confirmed']\n\n if statuses.include? params[:status]\n @entity = Task.find(params[:id])\n concierge = User.find(@entity.concierge_id)\n suggestion = TaskSuggestion.find(@entity.suggestion_id) if @entity.suggestion_id.present?\n\n if params[:status].eql?('done')\n\n unless @entity.done?\n\n @entity.update_attributes(status: 'done', fact_end: Date.current)\n UserMailer.done_task_astra(@entity.owner.email, \"#{@current_user.first_name} #{@current_user.last_name}\",\n @entity.title).deliver\n\n message_body = \"#{@current_user.first_name} #{@current_user.last_name} — completed your task, please confirm\"\n\n message_params = [\n recipient_id: @entity.owner_id,\n author_id: @current_user.id,\n message_body: message_body,\n task_id: @entity.id,\n system: true,\n suggestion_id: @entity.suggestion_id\n ]\n\n feed_params = params.permit().tap do |param|\n param[:owner_id] = @current_user.id #author_id\n param[:user_id] = @entity.owner_id #author_id\n param[:message] = message_body\n param[:notification_type] = 'new_message'\n param[:task_id] = @entity.id\n param[:task_title] = @entity.title\n param[:suggestion_id] = @entity.suggestion_id\n param[:task_owner_id] = @entity.owner_id\n end\n\n suggestion.update_attribute(:hire_read, false) if suggestion.present?\n\n Message.create(message_params)\n\n feed = FeedNotification.new(feed_params)\n\n if feed.save!\n NotificationsWorker.perform_async(feed.id)\n end\n end\n\n elsif params[:status].eql?('done_confirmed')\n\n unless @entity.done_confirm?\n\n @entity.update_attributes(status: 'done_confirmed', completed_at: Time.now, fact_end: Date.current)\n\n message_body = \"#{@current_user.first_name} #{@current_user.last_name}: Has confirmed your work.\" if params[:status].eql?('done_confirmed')\n pdf = @entity.generate_pdf_invoice\n @entity.order_changes_confirmed.each do |line|\n @entity.generate_pdf_change_order_invoice(line)\n end\n @entity.checked_completed_quota\n SendInvoiceToQuickBooksJob.perform_async(@entity.id)\n UserMailer.confirm_task(@entity.concierge.email, @entity.id, @entity.title).deliver if pdf.present?\n UserMailer.confirm_task_astra(Settings['email.invoices'], @entity.id, @entity.title).deliver if pdf.present?\n message_params = [\n recipient_id: @entity.concierge_id,\n author_id: @current_user.id,\n task_id: @entity.id,\n message_body: message_body,\n system: true,\n suggestion_id: @entity.suggestion_id\n ]\n\n feed_params = params.permit().tap do |param|\n param[:owner_id] = @current_user.id #author_id\n param[:user_id] = @entity.concierge_id #recipient_id\n param[:message] = message_body\n param[:notification_type] = 'new_message'\n param[:task_id] = @entity.id\n param[:task_title] = @entity.title\n param[:suggestion_id] = @entity.suggestion_id\n param[:task_owner_id] = @entity.owner_id\n end\n\n Message.create(message_params)\n\n # Message.create(\n # author_id: @entity.owner_id,\n # recipient_id: @entity.concierge_id,\n # message_body: \"You 've been raited!\",\n # task_id: @entity.id,\n # rating: true,\n # system: true,\n # give_a_rate: true,\n # suggestion_id: @entity.suggestion_id\n # )\n\n favourites_tasks = FavoriteTask.where(task_id: @entity.id)\n favourites_tasks.destroy_all\n\n #concierge.update_attribute(:balance, concierge.balance.to_f + @entity.budget.to_f) #Added\n #TaskPayment.create(user_id: @entity.concierge_id, concierge: true, task_id: @entity.id , budget: @entity.budget.to_f)\n\n feed = FeedNotification.create(feed_params)\n if feed.save!\n NotificationsWorker.perform_async(feed.id)\n end\n end\n end\n\n render 'api/tasks/show'\n else\n render :json => {errors: {message: ['wrong task status']}}, :status => 500\n end\n end", "def complete\n @task.update_attributes(\"status\" => 3)\n redirect_to @task\n end", "def update_status\n begin\n if self.service_test.status_changed?\n results = self.service_test.test_results.last(2)\n unless results.empty?\n case results.length\n when 1\n previous = TestResult.new_with_unknown_status\n when 2\n previous = results[0] \n end\n \n if USE_EVENT_LOG\n \n service = self.service_test.service\n \n ActivityLog.create(:action => \"status_change\",\n :data =>{:current_result_id => self.id, :previous_result_id =>previous.id },\n :activity_loggable => self.service_test,\n :referenced => service)\n \n current_status = ServiceCatalographer::Monitoring::TestResultStatus.new(self)\n previous_status = ServiceCatalographer::Monitoring::TestResultStatus.new(previous)\n \n \n if ENABLE_TWITTER\n ServiceCatalographer::Util.say \"Called TestResult#update_status. A status change has occurred so submitting a job to tweet about...\"\n msg = \"Service '#{ServiceCatalographer::Util.display_name(service)}' has a test change status from #{previous_status.label} to #{current_status.label} (#{self.created_at.strftime(\"%Y-%m-%d %H:%M %Z\")})\"\n Delayed::Job.enqueue(ServiceCatalographer::Jobs::PostTweet.new(msg), :priority => 0, :run_at => 5.seconds.from_now)\n end\n \n unless MONITORING_STATUS_CHANGE_RECIPIENTS.empty?\n status_recipients_emails = MONITORING_STATUS_CHANGE_RECIPIENTS.dup\n \n if NOTIFY_SERVICE_RESPONSIBLE\n status_recipients_emails = status_recipients_emails + self.responsible_emails\n end\n ServiceCatalographer::Util.say \"Called TestResult#update_status. A status change has occurred so emailing the special set of recipients about it...\"\n subject = \"[#{SITE_NAME}] Service '#{ServiceCatalographer::Util.display_name(service)}' has a test change status from #{previous_status.label} to #{current_status.label}\"\n text = \"A monitoring test status change has occurred! Service '#{ServiceCatalographer::Util.display_name(service)}' has a test (#{self.service_test.test_type}, ID: #{self.service_test.test_id}) change status from #{previous_status.label} to #{current_status.label}. Last test result message: #{current_status.message}. Go to Service: #{ServiceCatalographer::Api.uri_for_object(service)}\"\n Delayed::Job.enqueue(ServiceCatalographer::Jobs::StatusChangeEmails.new(subject, text, status_recipients_emails), :priority => 0, :run_at => 5.seconds.from_now)\n end\n \n end\n end\n end\n rescue Exception => ex\n logger.error(\"There was problems updating the status for service test : #{self.service_test.id}\")\n logger.error(ex)\n end\n end", "def update\r\n @status_task = StatusTask.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @status_task.update_attributes(params[:status_task])\r\n format.html { redirect_to @status_task, notice: 'Status task was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @status_task.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n if @task.update(task_param)\n render json: get_task_hash(@task)\n else\n render json: @task.errors.full_messages\n end\n end", "def update\n status_key = STATUS[rand(STATUS.length)]\n\n n = Spooge.update_all_on_redis(:touch_date, DateTime.now)\n n = Spooge.update_all_on_redis(:status, status_key)\n resp = {:updated => n, :status_key => status_key}\n render :json => resp\n end", "def update!(**args)\n @run_duration = args[:run_duration] if args.key?(:run_duration)\n @state = args[:state] if args.key?(:state)\n @status_events = args[:status_events] if args.key?(:status_events)\n @task_groups = args[:task_groups] if args.key?(:task_groups)\n end", "def update!(**args)\n @id = args[:id] if args.key?(:id)\n @resource = args[:resource] if args.key?(:resource)\n @status = args[:status] if args.key?(:status)\n @sub = args[:sub] if args.key?(:sub)\n @time = args[:time] if args.key?(:time)\n end", "def update!(**args)\n @run_time = args[:run_time] if args.key?(:run_time)\n @status = args[:status] if args.key?(:status)\n end", "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n $redis.publish('tasks.update', TaskSerializer.new(Task.last).to_json)\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @task.update(task_params)\n flash.now.alert = \"Task was updated\"\n render json: full_task(@task)\n end\n end", "def update\n respond_to do |format|\n if @task.update(task_params)\n @task.whenever_reset unless task_params[:every].blank? && task_params[:at].blank?\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @agent_task_spec = args[:agent_task_spec] if args.key?(:agent_task_spec)\n @intended_state = args[:intended_state] if args.key?(:intended_state)\n @reached_barrier = args[:reached_barrier] if args.key?(:reached_barrier)\n @spec = args[:spec] if args.key?(:spec)\n @status = args[:status] if args.key?(:status)\n @task = args[:task] if args.key?(:task)\n @task_source = args[:task_source] if args.key?(:task_source)\n end", "def update_status\n\t\tasset.update_attributes(:status => STATUS[\"Assigned\"])\n\tend", "def update_status\n\t\tasset.update_attributes(:status => STATUS[\"Assigned\"])\n\tend", "def complete_task(list_id, task_id, is_completed)\n path = \"lists/#{list_id}/tasks/#{task_id}\"\n if is_completed\n completed = 1\n else\n completed = 0\n end\n params = {task: {is_completed: completed}}\n request(path, params, :put)\n\n # output full list again\n show_list(list_id)\n end", "def update\n @mytask = Task.find(params[:id])\n if @mytask.update({title: params[:task][:title], description: params[:task][:description], completed_at: params[:task][:completed_at], status: params[:task][:status]})\n # redirect_to(@mytask)}\n redirect_to tasks_path\n else\n render \"edit\"\n end\n end", "def update\n respond_to do |format|\n if (current_user.admin? && (task_params[:status].to_i > 4))\n return redirect_to @task, notice: 'Task was not updated. You are not allowed to change Task which in Pending for Approval or Approved'\n end\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_api_v1_task\n @api_v1_task = Task.find(params[:id])\n end", "def perform\n self.status = STATUS_DONE\n self.save\n job.update_status\n end", "def updateParallel(*resources)\n if ! advance? then return self end\n @@logger.debug \"Updating resource(s) in parallel #{resources.join(',')}.\"\n resources.each { |resource| @events.push( { :update => resource })}\n return self\n end", "def update!(**args)\n @success_resource_count = args[:success_resource_count] if args.key?(:success_resource_count)\n end", "def doUpdate(startState)\n if (new_resource.rackID.nil? || new_resource.rackID.empty?)\n return\n end\n \n json = \"{\\\"rackId\\\" : \\\"#{new_resource.rackID}\\\"}\"\n \n response = putRequest(\"/hosts/#{new_resource.hostname}\", json)\n \n unless response.code.to_i.between?(200,299)\n raise Exception.new(\"Host update of #{new_resource.hostname} failed with #{response.code} code. Body: #{response.body}\")\n end\n \n unless response.body == startState\n new_resource.updated_by_last_action true\n end\nend", "def complete\n affected = Task.where(id: params[:task_ids]).update_all(completed: true)\n\n if affected > 0\n @activity = PublicActivity::Activity.create key: \"task.complete\", parameters: { affected: affected }, owner: current_user\n @activity.mark_as_read! for: current_user\n PushNotificationService.new(current_user.id, current_tenant.id).push @activity, :add\n end\n\n respond_to do |format|\n format.html { redirect_to tasks_url, notice: 'Aufgaben erfolgreich als erledigt markiert.' }\n format.json { head :no_content }\n end\n end", "def update\n @task = Task.find_by(id: params[:id])\n if @task.nil?\n redirect_to tasks_path\n elsif @task.update(\n name: params[:task][:name],\n description: params[:task][:description],\n completed_at: params[:task][:completed_at]\n )\n redirect_to task_path(@task.id)\n else\n render :edit\n end\n end", "def update\n respond_to do |format|\n if @task.update(task_params)\n format.json { render :show, status: :ok, location: @task }\n else\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(options: {}, **data)\n\n refresh_with(parse(client.put(\"/tasks/#{gid}\", body: data, options: options)).first)\n end", "def update\n authorize! :update, Task\n @task = Task.find(params[:id])\n \n respond_to do |format|\n if @task.update_attributes(params[:task])\n # If status is complete, but completion date is blank, set it to today\n if (@task.status == 127) && (!@task.completion_date)\n @task.completion_date = Date.today\n @task.save\n end\n \n format.html { redirect_to(@task, :notice => 'Task was successfully updated.') }\n else\n @users_select = User.find(:all, :order => \"last_name\").collect {|u| [ u.first_name + ' ' + u.last_name, u.id ]}\n \n format.html { render :action => \"edit\" }\n end\n end\n end", "def update\n @user = current_user\n begin\n @task = Task.for_user(@user).find(params[:id])\n @task.change!(params[:task][:action])\n success = true\n error = nil\n rescue => e\n success = false\n error = e.message\n end\n render json: { task: (@task.constructor rescue nil), success: success, error: error }\n end", "def update\n self.init\n authorize! :read, @list\n authorize! :update, @task\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @list, notice: I18n.t('tasks.update_success') }\n format.json { render json: [] }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6845698", "0.6801073", "0.67391175", "0.6583245", "0.6478638", "0.64548254", "0.63506466", "0.63223267", "0.6319783", "0.6287183", "0.6284366", "0.62749386", "0.6274118", "0.6180931", "0.6166728", "0.6117071", "0.6110622", "0.6088655", "0.60884917", "0.6060909", "0.6023869", "0.60221165", "0.60182875", "0.599204", "0.596284", "0.59567696", "0.59567696", "0.59567696", "0.59567696", "0.59567696", "0.59567696", "0.59494644", "0.59389174", "0.593607", "0.5925385", "0.59235215", "0.59157497", "0.590109", "0.5895625", "0.58919686", "0.58898914", "0.58864355", "0.58845806", "0.5881253", "0.58796936", "0.5871897", "0.58496296", "0.58491737", "0.584747", "0.58386844", "0.58378625", "0.58342975", "0.5832224", "0.5832134", "0.58218896", "0.5814506", "0.58072954", "0.5806977", "0.5801627", "0.5789053", "0.5783538", "0.57742625", "0.57664484", "0.5765957", "0.5763574", "0.5746926", "0.5745314", "0.572132", "0.57211655", "0.5718909", "0.5708053", "0.57048476", "0.57024926", "0.57014936", "0.5699036", "0.5694353", "0.5691082", "0.5683868", "0.5683078", "0.5678629", "0.56781816", "0.5671604", "0.56614846", "0.5656157", "0.5654898", "0.5654898", "0.5647339", "0.5647321", "0.5643237", "0.56407243", "0.56390595", "0.56373334", "0.56314707", "0.56279546", "0.5625546", "0.56221694", "0.56146735", "0.56107336", "0.56023484", "0.5601747", "0.559475" ]
0.0
-1
It defines a task that queries information about resources.
def read_task(task_name, session, admin_auth=false, &block) task(task_name, session, :rd, admin_auth, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resources\n @task[:resources]\n end", "def retrieve_tasks\n Query.get_data(@values[:id], @values[:start_time], @values[:end_time])\n end", "def retrieve_tasks\n Query.get_data(@values[:id], @values[:start_time], @values[:end_time])\n end", "def retrieve_tasks\n Query.get_data(@values[:id], @values[:start_time], @values[:end_time])\n end", "def description\n \"This task hits the Corpwatch API and creates an object for all found entities.\"\nend", "def find_tasks\n\t Roby::Queries::Query.new(self)\n\tend", "def where(options = {})\n _, _, root = @client.get(\"/tasks\", options)\n\n root[:items].map{ |item| Task.new(item[:data]) }\n end", "def description\n \"This task hits the Corpwatch API and creates an entity for all found entities.\"\nend", "def list_all_tasks\n task = Task.all\nend", "def tasks(project_id)\n account = Config.details \n c = FreshBooks::Client.new(account[\"account\"], account[\"token\"])\n c.task.list :project_id => project_id\n end", "def index_tasks_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TasksApi.index_tasks ...'\n end\n # resource path\n local_var_path = '/tasks'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'sort_by'] = @api_client.build_collection_param(opts[:'sort_by'], :pipe) if !opts[:'sort_by'].nil?\n query_params[:'id'] = opts[:'id'] if !opts[:'id'].nil?\n query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?\n query_params[:'comment'] = opts[:'comment'] if !opts[:'comment'].nil?\n query_params[:'workflow_type'] = opts[:'workflow_type'] if !opts[:'workflow_type'].nil?\n query_params[:'workflow_action'] = opts[:'workflow_action'] if !opts[:'workflow_action'].nil?\n query_params[:'source_type'] = opts[:'source_type'] if !opts[:'source_type'].nil?\n query_params[:'destination_type'] = opts[:'destination_type'] if !opts[:'destination_type'].nil?\n query_params[:'priority'] = opts[:'priority'] if !opts[:'priority'].nil?\n query_params[:'conflict_resolution'] = opts[:'conflict_resolution'] if !opts[:'conflict_resolution'].nil?\n query_params[:'action'] = opts[:'action'] if !opts[:'action'].nil?\n query_params[:'activate'] = opts[:'activate'] if !opts[:'activate'].nil?\n query_params[:'creation_date'] = opts[:'creation_date'] if !opts[:'creation_date'].nil?\n query_params[:'creation_username'] = opts[:'creation_username'] if !opts[:'creation_username'].nil?\n query_params[:'modification_date'] = opts[:'modification_date'] if !opts[:'modification_date'].nil?\n query_params[:'modification_username'] = opts[:'modification_username'] if !opts[:'modification_username'].nil?\n query_params[:'job_started'] = opts[:'job_started'] if !opts[:'job_started'].nil?\n query_params[:'job_finished'] = opts[:'job_finished'] if !opts[:'job_finished'].nil?\n query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?\n query_params[:'processed_size'] = opts[:'processed_size'] if !opts[:'processed_size'].nil?\n query_params[:'to_process_size'] = opts[:'to_process_size'] if !opts[:'to_process_size'].nil?\n query_params[:'source_pool_id'] = opts[:'source_pool_id'] if !opts[:'source_pool_id'].nil?\n query_params[:'source_pool_name'] = opts[:'source_pool_name'] if !opts[:'source_pool_name'].nil?\n query_params[:'source_tape_id'] = opts[:'source_tape_id'] if !opts[:'source_tape_id'].nil?\n query_params[:'source_tape_barcode'] = opts[:'source_tape_barcode'] if !opts[:'source_tape_barcode'].nil?\n query_params[:'destination_pool_id'] = opts[:'destination_pool_id'] if !opts[:'destination_pool_id'].nil?\n query_params[:'destination_pool_name'] = opts[:'destination_pool_name'] if !opts[:'destination_pool_name'].nil?\n query_params[:'destination_tape_id'] = opts[:'destination_tape_id'] if !opts[:'destination_tape_id'].nil?\n query_params[:'destination_tape_barcode'] = opts[:'destination_tape_barcode'] if !opts[:'destination_tape_barcode'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'TaskCollection' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TasksApi#index_tasks\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def task\n end", "def tasks\n @tasks ||= Harvest::API::Tasks.new(credentials)\n end", "def task(name)\n get \"#{base_url}/tasks/#{name}\"\n end", "def fetch(task_name, opts = EMPTY_HASH)\n task(task_name, opts)\n end", "def tasks\n uri = URI(BASE_URL + TASKS_ENDPOINT)\n\n make_request(uri)\n end", "def own_tasks\n uri = self.uri\n query = Ruta::Sparql.select.where(\n [:task, RDF.type, Ruta::Class.task],\n [:task, Ruta::Property.has_creator, uri]\n )\n tasks = []\n query.each_solution { |sol| tasks.push(sol.task.as(Task)) }\n tasks\n end", "def description\n \"This task hits the Google API and finds related content. Discovered domains are created.\"\nend", "def description\n \"This task hits the Google API and finds related content. Discovered domains are created.\"\nend", "def show\n respond_with Task.find(params[:id])\n end", "def show\n find_task\n end", "def discovery\n resource ''\n end", "def task\n Camunda::Task.find_by_business_key_and_task_definition_key! business_key, task_key\n end", "def tasksOnHost(filter, host)\n java_import 'java.net.URL'\n java_import 'java.net.SocketException'\n java_import 'java.io.InputStreamReader'\n java_import 'org.apache.hbase.thirdparty.com.google.gson.JsonParser'\n\n infoport = @admin.getClusterMetrics.getLiveServerMetrics.get(host).getInfoServerPort.to_s\n\n begin\n schema = \"http://\"\n url = schema + host.hostname + ':' + infoport + '/rs-status?format=json&filter=' + filter\n json = URL.new(url).openStream\n rescue SocketException => e\n # Let's try with https when SocketException occur\n schema = \"https://\"\n url = schema + host.hostname + ':' + infoport + '/rs-status?format=json&filter=' + filter\n json = URL.new(url).openStream\n end\n\n parser = JsonParser.new\n\n # read and parse JSON\n begin\n tasks_array_list = parser.parse(InputStreamReader.new(json, 'UTF-8')).getAsJsonArray\n ensure\n json.close\n end\n # convert to an array of TaskMonitor::Task instances\n tasks = []\n tasks_array_list.each do |t|\n tasks.unshift Task.new(t.getAsJsonObject, host)\n end\n\n tasks\n end", "def resource\n @resource ||= begin\n resource_query\n .new(relation: resource_scope)\n .find_for_show(find_by_conditions: find_by_conditions)\n end\n end", "def tasks\n Easybill::Api::Tasks\n end", "def ar_retrieve_resources\n run_callbacks :ar_retrieve_resources do\n if params[:_search]\n # Fulltext search\n\n @resources = ar_model.search(params[:_search])\n @resources_count = @resources.count\n else\n intf = ar_model.interfaces[:rest]\n\n @resources_relation ||= ar_model.all\n\n # Authorization\n if intf.authorization_required?\n @resources_relation = @resources_relation.with_capability(aaa_context)\n end\n\n @authorized_resources_relation = @resources_relation\n\n # Filters\n @resources_relation = apply_scopes_to_relation(@resources_relation)\n @resources_relation = apply_json_filter_to_relation(@resources_relation)\n @resources_relation = apply_simple_filter_to_relation(@resources_relation)\n\n # Display filters\n @resources_relation = apply_sorting_to_relation(@resources_relation)\n @paginated_resources_relation = apply_pagination_to_relation(@resources_relation)\n\n @resources = @paginated_resources_relation\n @resources_count = @resources_relation.count\n end\n end\n\n @resources\n rescue ActiveRecord::RecordNotFound => e\n raise Exception::NotFound.new(e.message,\n :retry_possible => false)\n end", "def description\n \"This is an example Tapir task. It associates a random host with the calling entity.\"\n end", "def tasks_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TasksApi.tasks_get ...'\n end\n # resource path\n local_var_path = '/tasks'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BrainPortalSession']\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<CbrainTask>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TasksApi#tasks_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def find_task\n @task = Task.find(params[:id])\n end", "def tasks\n @client.list_tasks(cluster: @cluster, service_name: @name)[0]\n end", "def description\n \"This task hits the Google API and creates an entity for all discovered subdomains.\"\nend", "def query_resources\n powershell_exec(\"get-dscresource\").result\n end", "def show\n @task = Task.find(params[:id])\n end", "def show\n @task = Task.find(params[:id])\n end", "def show\n @task = Task.find(params[:id])\n end", "def index\n @api_tasks = Api::Task.all\n end", "def index\n @instances = Instance.all.where(task: params[:task_id])\n end", "def description\n\t\t\"This task creates & associates a host for every object it is given.\"\n\tend", "def execute!\n query_params = {}\n query_params[:skip_header] = true if config[:skip_column_names]\n Request.new(resources_path, :query_params => query_params, :sign => config[:my]).get(headers).print(config)\n end", "def task\n @keys[:task]\n end", "def resource\n\n end", "def find_task\n @task = Task.find(params[:id])\n end", "def load_task\n @task = Task.find(params[:id])\n end", "def description\n \"This is an example Tapir task. It associates a random host with the calling entity.\"\nend", "def get_tasks_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TasksApi#get_tasks ...\"\n end\n \n # resource path\n local_var_path = \"/Tasks\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'brief'] = opts[:'brief'] if opts[:'brief']\n query_params[:'skip'] = opts[:'skip'] if opts[:'skip']\n query_params[:'top'] = opts[:'top'] if opts[:'top']\n query_params[:'count_total'] = opts[:'count_total'] if opts[:'count_total']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\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']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \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<InlineResponse20014>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TasksApi#get_tasks\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_resource\n execute(resource_path, method: :get)\n end", "def desc\n @desc ||= \"Get #{this_resource.downcase} by ID\"\n end", "def show\n #@all_tasks = \n #if @tasks\n # @q = @tasks.ransack(params[:q])\n # @tasks = @q.result.page(params[:page])\n # else\n @tasks = @task.subtasks\n # -----------------------------\n @q = @tasks.ransack(params[:q])\n @tasks = @q.result.page(params[:page])\n #end\n end", "def tasks\n task_list.tasks\n end", "def initialize(task)\n @task = task\n end", "def get_tasks__simple\n request = NSFetchRequest.alloc.init\n request.entity = NSEntityDescription\\\n .entityForName('Task',\n inManagedObjectContext: @context)\n\n error_ptr = Pointer.new(:object)\n\n data = @context.executeFetchRequest(request, error: error_ptr)\n\n if data == nil\n raise \"[ERROR] Error fetching tasks: #{error_ptr[0].description}\"\n end\n\n data\n end", "def initialize\r\n load_tasks\r\n end", "def generic_resource( unit )\n resources unit, concerns: [:search_suggestion, :uniqueness_validation, :retrieve_resource]\n end", "def desc(*args)\n Rake.application.DescribeTask(*args)\n end", "def description\n \"This task hits the corpwatch API and adds detail for the organization.\"\nend", "def name\n\t\t\t@task\n end", "def resource\n @resource\n end", "def resource\n @resource\n end", "def work_tasks\n uri = self.uri\n query = Ruta::Sparql.select.where(\n [:task, RDF.type, Ruta::Class.task],\n [:task, Ruta::Property.has_worker, uri]\n )\n tasks = []\n query.each_solution { |sol| tasks.push(sol.task.as(Task)) }\n tasks\n end", "def resource\n @resource ||= Resource.new(uri, graph: graph)\n end", "def load_tasks\n end", "def get(action, task, params={})\n @action = action\n @task = task\n request(:get, params)\n end", "def task\n @task = MailTasks::Task.find( params[:id] )\n end", "def resources _args\n \"resources _args;\" \n end", "def show_tasks(hostname = nil)\n if hostname\n mirror = Mirror.find_by_hostname hostname\n\n if mirror\n puts \"#{mirror.tasks.size} tasks\"\n\n mirror.tasks.each do |task|\n puts \"#{task.command} #{task.path}\"\n end\n else\n puts \"hostname not found\"\n end\n else\n puts \"#{Task.count} tasks\"\n\n Task.all.each do |task|\n puts \"#{task.command} #{task.path}\"\n end\n end\n\n nil\nend", "def get_resource\n\t\t\tlogger.debug {\"ALLOCATING NEW RESOURCE --> #{ ActiveOrient.db_pool.size }\" }\n login = [ActiveOrient.default_server[:user] , ActiveOrient.default_server[:password]]\n server_adress = \"http://#{ActiveOrient.default_server[:server]}:#{ActiveOrient.default_server[:port]}\"\n\t\t\t RestClient::Resource.new(server_adress, *login)\n end", "def resources(opts={})\n Tripod::ResourceCollection.new(\n self.resource_class._resources_from_sparql(self.as_query(opts)),\n # pass in the criteria that was used to generate this collection, as well as whether the user specified return graph\n :return_graph => (opts.has_key?(:return_graph) ? opts[:return_graph] : true),\n :criteria => self\n )\n end", "def resources()\n end", "def query(name, resource_class = Resolv::DNS::Resource::IN::A, &block)\n\t\t\tmessage = Resolv::DNS::Message.new(next_id!)\n\t\t\tmessage.rd = 1\n\t\t\tmessage.add_question name, resource_class\n\t\t\t\n\t\t\tsend_message(message, &block)\n\t\tend", "def get_tasks_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TasksApi#get_tasks ...\"\n end\n \n # resource path\n path = \"/Tasks\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'brief'] = opts[:'brief'] if opts[:'brief']\n query_params[:'skip'] = opts[:'skip'] if opts[:'skip']\n query_params[:'top'] = opts[:'top'] if opts[:'top']\n query_params[:'count_total'] = opts[:'count_total'] if opts[:'count_total']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\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']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, 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<APITask>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TasksApi#get_tasks\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @task = Task.find params[:id]\n\n end", "def all\n setup_request \"#{@@resource_url}s\"\n end", "def description\n\t\"This task scrapes Hoovers for company info.\"\nend", "def description\n \"This task searches for common social media profiles\"\nend", "def description\n \"This task searches for common social media profiles\"\nend", "def show\n @task = Task.find params[:id]\n end", "def [](name)\n @task_manager.lookup(name, @scope)\n end", "def list_tasks\n # ASK REPO for the tasks\n tasks = @task_repository.all\n # ASK VIEW to display them\n @tasks_view.display(tasks)\n end", "def external_task\n output[:task]\n end", "def show\n @project = Project.find(params[:id])\n @tasks = Task.find_all_by_id(params[:id])\n end", "def show\n @page_title = \"Task List\"\n @task_list = TaskList.find(params[:id])\n @tasks = Task.find(:all,\n :conditions => [\"task_list_id = ?\",@task_list.id]\n ) \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @task_list }\n end\n end", "def index\n # GET /tasks\n @tasks = Task.all\n end", "def resource; end", "def task\n Task.all.find {|task| task.id == self.task_id}\n end", "def interviewer_tasks\n tasks.find(:all, :conditions => { :context => 'interviewers', :show_for_context_object_tasks => true })\n end", "def index\n active_task\n completed_task\n end", "def description\n \"This task runs an nmap scan on the target host or domain.\"\nend", "def resources(*args)\n run_context.resource_collection.find(*args)\n end", "def resource\n @resource ||= resource_set.createResource(uri)\n end", "def reviewer_tasks\n tasks.find(:all, :conditions => { :context => 'reviewers', :show_for_context_object_tasks => true })\n end", "def get_task(options, task)\n options[:method] = 'Get'\n options[:endpoint] = '/kapacitor/v1/tasks/' + task[:id]\n\n task = _do_request(options)\n\n return if task['error'] == 'no task exists'\n task\n end", "def run\n super\n\n # Attach to the corpwatch service & search\n x = Ear::Client::Corpwatch::CorpwatchService.new\n corps = x.search @object.name\n\n corps.each do |corp|\n # Create a new organization object & attach a record\n o = create_object Organization, { \n :name => corp.name, \n }\n o.physical_locations << create_object(PhysicalLocation, {\n :address => corps.first.address, \n :state => corps.first.state,\n :country => corps.first.country }\n )\n end\n \n #@task_run.save_raw_result corps.to_s\n\n # Queue a detailed search\n TaskManager.instance.queue_task_run(\"hoovers_company_detail\",o, {})\nend", "def description\n \"This task runs a masscan scan for the top ports on the target range.\"\nend", "def get_task_record(task)\n task = Task.find(task)\n end", "def run\n super\n\n entity_name = _get_entity_name\n entity_type = _get_entity_type_string\n\n api_key =_get_task_config(\"apility_api_key\")\n\n headers = { \"Accept\" => \"application/json\", \"X-Auth-Token\" => api_key }\n\n if entity_type == \"IpAddress\"\n search_apility_by_ip entity_name, headers\n elsif entity_type == \"Domain\"\n search_apility_by_domain entity_name, headers\n else\n _log_error \"Unsupported entity type\"\n end\n\n end", "def resources options={}\n @resources ||= find_resources options\n end", "def get_tasks_by_search_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TasksApi#get_tasks_by_search ...\"\n end\n \n # resource path\n local_var_path = \"/Tasks/Search\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'title'] = opts[:'title'] if opts[:'title']\n query_params[:'status'] = opts[:'status'] if opts[:'status']\n query_params[:'category_id'] = opts[:'category_id'] if opts[:'category_id']\n query_params[:'owner_user_id'] = opts[:'owner_user_id'] if opts[:'owner_user_id']\n query_params[:'updated_after_utc'] = opts[:'updated_after_utc'] if opts[:'updated_after_utc']\n query_params[:'brief'] = opts[:'brief'] if opts[:'brief']\n query_params[:'skip'] = opts[:'skip'] if opts[:'skip']\n query_params[:'top'] = opts[:'top'] if opts[:'top']\n query_params[:'count_total'] = opts[:'count_total'] if opts[:'count_total']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\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']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \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<InlineResponse20014>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TasksApi#get_tasks_by_search\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tasks_by_search_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TasksApi#get_tasks_by_search ...\"\n end\n \n # resource path\n path = \"/Tasks/Search\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'title'] = opts[:'title'] if opts[:'title']\n query_params[:'status'] = opts[:'status'] if opts[:'status']\n query_params[:'category_id'] = opts[:'category_id'] if opts[:'category_id']\n query_params[:'owner_user_id'] = opts[:'owner_user_id'] if opts[:'owner_user_id']\n query_params[:'updated_after_utc'] = opts[:'updated_after_utc'] if opts[:'updated_after_utc']\n query_params[:'brief'] = opts[:'brief'] if opts[:'brief']\n query_params[:'skip'] = opts[:'skip'] if opts[:'skip']\n query_params[:'top'] = opts[:'top'] if opts[:'top']\n query_params[:'count_total'] = opts[:'count_total'] if opts[:'count_total']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\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']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, 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<APITask>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TasksApi#get_tasks_by_search\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def my_task\n @my_id = current_user.id # may be redundant4 but will head towards service objects\n @tasks = Task.where(user_id: @my_id)\n end", "def description\n \"This task runs a web scan and adds webpages with interesting contents\"\nend" ]
[ "0.6930796", "0.6444213", "0.6444213", "0.6444213", "0.63464266", "0.6272939", "0.6172204", "0.6088833", "0.60840183", "0.6071859", "0.60604024", "0.6060078", "0.6015344", "0.60143095", "0.59993577", "0.5964142", "0.5947044", "0.5943093", "0.5943093", "0.5930226", "0.5928961", "0.59083796", "0.5906027", "0.58534056", "0.5836336", "0.58239514", "0.5823243", "0.5808541", "0.57997596", "0.5797855", "0.57964927", "0.57802576", "0.5750483", "0.5741805", "0.5741805", "0.5741805", "0.5740655", "0.57403874", "0.5728356", "0.5725187", "0.5722193", "0.57154524", "0.5714415", "0.57055974", "0.5691689", "0.5690876", "0.5690408", "0.5689867", "0.5681596", "0.5673345", "0.5662051", "0.56619036", "0.5661017", "0.5646061", "0.56401026", "0.56375325", "0.5631021", "0.5630578", "0.5630578", "0.5628876", "0.5616757", "0.5614557", "0.56102276", "0.56039417", "0.5603262", "0.56027526", "0.5602521", "0.5587197", "0.5578946", "0.5574213", "0.5566569", "0.55609185", "0.5559439", "0.5557837", "0.55555624", "0.55555624", "0.5552789", "0.5547808", "0.554607", "0.5545069", "0.55436176", "0.5533577", "0.55286115", "0.5526892", "0.5519462", "0.5516078", "0.55152017", "0.5513184", "0.55120224", "0.55115455", "0.5507776", "0.5507682", "0.55047816", "0.55003524", "0.5496585", "0.5493987", "0.5493823", "0.54937947", "0.5492838", "0.54901934", "0.54874825" ]
0.0
-1
It is used for define an xml handler's task. It does 1) locking, 2) authenticating, 3) executing a task, and 4)returning a result to a client. +task_name+ name of task +session+ a string that represents a user session +lock_mode+ a mode flag for exclusive access :rd for read lock and :wt for write lock. +admin_auth+ it does authentication for the administrator if true, otherwise does authentication for usual users. +block+ a block that defines a task routine +return+ an array of [bool, result]. +bool+ is true if execution of the task is successful, otherwise false. +result+ is defined by tasks. It can take integer, boolean, string, etc.
def task(task_name, session, lock_mode, admin_auth=false, &block) begin # lock if lock_mode == :wt @lock.write_lock else @lock.read_lock end begin rc = authenticate(session, admin_auth, &block) log_msg = rc rescue => e rc = [false, e.message] log_msg = [false, e] end ensure # unlock if lock_mode == :wt @lock.write_unlock else @lock.read_unlock end end log_result(task_name, get_user_from_session(session), log_msg) return rc end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_task(task_name, session, admin_auth=false, &block)\n task(task_name, session, :wt, admin_auth, &block)\n end", "def task(&block) \n task = TaskRunnable.new\n task.proc = Proc.new(block)\n task\n end", "def read_task(task_name, session, admin_auth=false, &block)\n task(task_name, session, :rd, admin_auth, &block)\n end", "def task(name,&ruby_block)\n HDLRuby::High::Std.task(name,&ruby_block)\n end", "def task(name, &block)\n name = name.to_s\n\n unless task = @tasks.find{|t| t.name == name}\n task = Salticid::Task.new(name, :salticid => self)\n @tasks << task\n end\n \n if block_given?\n task.block = block\n end\n\n task \n end", "def task(name, &block)\n task = Wodan::Task.new(name)\n yield(task)\n wodan.tasks << task\n end", "def define_task\n desc @desc\n task @name do\n config.mode == 'shell' ? run_shell : run\n end\n end", "def thor_task(klass, task_name, &block)\n if program.nil?\n warn \"WARNING:thor_task: no program is associated with #{class_name.upcase} task, does not make sense to create a thor task.\" if Bio::Ngs::Utils.verbose?\n return nil\n end \n if klass\n wrapper = self \n klass.class_eval do \n wrapper.options.each_pair do |name, opt|\n method_option name, opt\n end #each_pair\n # Thor's behavior should be respected passing attributes\n define_method task_name do |*args|\n #it's mandatory that the first and second parameter are respectively wrapper and task\n raise ArgumentError, \"wrong number of arguments (#{args.size} for #{block.parameters.size-2})\" if args.size != block.parameters.size-2\n yield wrapper, self, *args\n end\n end#class_eval\n end #klass\n end", "def task_instance(name,*args,&ruby_block)\n HDLRuby::High::Std.task_instance(name,*args,&ruby_block)\n end", "def task(name, &block)\r\n if name.kind_of?(Hash)\r\n name.each do |alias_name, task_name|\r\n raise(\"Undefined task `#{task_name}'\") unless @@tasks[task_name.to_s]\r\n @@tasks[alias_name.to_s] = @@tasks[task_name.to_s]\r\n @@descriptions[alias_name.to_s] = @@last_description\r\n end\r\n else\r\n raise(\"Task `#{name}' is defined more than once\") if @@tasks[name.to_s]\r\n @@tasks[name.to_s] = block\r\n @@descriptions[name.to_s] = @@last_description\r\n end\r\n\r\n @@last_description = nil\r\n end", "def task(name, *dependencies, &block)\n if block.nil?\n Task.new(name, *dependencies)\n else\n Task.new(name, *dependencies) do |task|\n task.define(&block)\n end\n end\n end", "def define\n logger.debug \"Defining tasks for #{name} #{version}\"\n\n namespace \"#{name}\" do\n define_download\n define_verify\n define_unpack\n define_patch\n define_build\n define_install\n\n task :done => \"#{name}:install\"\n task :default => \"#{name}:done\"\n end\n\n desc \"Build and Install #{name} #{version}\"\n task name => \"#{name}:default\"\n end", "def execute_task\n self.result_details = nil\n task_type = task['task_type'].to_s\n\n unless supported_tasks.include?(task_type)\n raise \"Unsupported task type: #{task_type}, valid options: #{supported_tasks.inspect}\"\n end\n\n # call the method to execute the task based on task and job type\n task_method = \"#{task_type}_#{job_type}\"\n send(task_method)\n raise \"Task must set the result details (via completed_with): #{task_method}\" unless result_details\n end", "def task(name, &block)\n name = name.to_s\n\n if task = @tasks.find{|t| t.name == name}\n # Found in self\n elsif (task = @salticid.tasks.find{|t| t.name == name}) and not block_given?\n # Found in salticid\n @tasks << task\n else\n # Create new task in self\n task = Salticid::Task.new(name, :salticid => @salticid)\n @tasks << task\n end\n\n if block_given?\n # Remove the task from our list, and replace it with a copy.\n # This is to prevent local declarations from clobbering global tasks.\n i = @tasks.index(task) || @task.size\n task = task.dup\n task.block = block\n @tasks[i] = task\n end\n\n task\n end", "def task(name, &block)\n name = name.to_s\n\n if task = @tasks.find{|t| t.name == name}\n # Found in self\n elsif (task = @salticid.tasks.find{|t| t.name == name}) and not block_given?\n # Found in salticid\n @tasks << task\n else\n # Create new task in self\n task = Salticid::Task.new(name, :salticid => @salticid)\n @tasks << task\n end\n\n if block_given?\n # Remove the task from our list, and replace it with a copy.\n # This is to prevent local declarations from clobbering global tasks.\n i = @tasks.index(task) || @task.size\n task = task.dup\n task.block = block\n @tasks[i] = task\n end\n\n task\n end", "def task(*args, &block)\n Util.task(*args, &block)\n end", "def task(task_name, opts = EMPTY_HASH)\n conf = OpenStruct.new # rubocop:disable Style/OpenStructUse\n yield conf\n tasks << ({ name: task_name, **opts, **conf.to_h })\n self\n end", "def task\n end", "def rake_tasks(&block); end", "def rake_tasks(&block); end", "def execute! &block\n task = block.call if block_given?\n return raise_no_workers if Server::workers.empty?\n task.service_id = id; self.tasks << task\n # Get worker and send task\n data = Task.send_with_worker(task)\n Logger.info 'Queued task ' + task.to_s + ' for worker: ' + data[:worker].to_s\n\n data\n end", "def task(*args, &block)\n args, cond = Rake::Task.strip_conditions(args)\n task = Rake::Task.define_task(*args, &block)\n task.add_conditions cond\n task\n end", "def initialize task_name = :opal, &block\n @task_name = task_name\n @builder = Builder.new\n @bundle = @builder.bundle\n\n @bundle.config(:normal) { yield @bundle } if block_given?\n\n define\n end", "def task(name, description=nil, &block)\n puts \"adding task :#{name}\"\n in_root(\"lib/tasks\") do |folder|\n File.open(\"#{folder}/application.rake\", \"a+\") do |f|\n if block_given?\n f.write(code_for(block))\n else\n f.write(data)\n end\n end\n end\n end", "def task_run(&block) \n task(&block).start\n end", "def task(&block)\n mina_app.test_task(&block)\nend", "def define\r\n\t\t\ttask :foo do\r\n\t\t\t\tputs 'foo!'\r\n\t\t\tend\r\n\t\tend", "def task(executor, message)\n\n domain = message['exid'].split('-', 2).first\n #tname = message['tasker']\n tname = determine_tasker_name(executor, message)\n\n tconf =\n ( ! message['routed'] &&\n (@unit.loader.tasker(domain, 'ganger', message) ||\n @unit.loader.tasker(domain, 'tasker', message))) ||\n @unit.loader.tasker(domain, tname, message)\n\n fail ArgumentError.new(\n \"tasker #{tname.inspect} not found\"\n ) unless tconf\n\n if tconf.is_a?(Array)\n\n points = [ nil, message['point'] ]\n points << 'detask' if points.include?('cancel')\n points << 'task' if points.include?('return')\n\n tconf = tconf.find { |h| points.include?(h['point']) }\n end\n\n fail ArgumentError.new(\n \"tconf #{tconf.inspect} not a hash\"\n ) unless tconf.is_a?(Hash)\n\n message['tconf'] = tconf unless tconf['include_tconf'] == false\n\n message['vars'] = gather_vars(executor, tconf, message)\n\n m = Flor.dup_message(message)\n #\n # the tasker gets a copy of the message (and it can play with it\n # to its heart content), meanwhile the message is handed to the\n # \"post\" notifiers.\n\n @unit.caller.call(self, tconf, m)\n #\n # might return a re-routing message,\n # especially if it's a domain tasker\n end", "def erb(args, &block)\n Necktie::ErbTask.define_task(args, &block)\nend", "def execute(&block)\n\tblock\nend", "def execute(&block)\n\tblock\nend", "def task name, options={}, &block\n task = Task.new name, options, &block\n TodoRunner.registry[name] = task\n end", "def task\n return @task\n end", "def task(name, options = {}, &block)\n name = name.to_s.downcase.to_sym\n task_re = /\\A[a-z0-9.:-_]+\\z/\n raise \"Task already exists: #{name}\" if $bot[:tasks].include?(name)\n raise \"Task name does not match regexp #{task_re.to_s}\" unless name.to_s.match(task_re)\n\n opts = {\n desc: ''\n }.merge(options)\n\n $bot[:tasks][name] ||= {\n block: block,\n desc: opts[:desc]\n }\n end", "def execute(&block)\r\n block\r\nend", "def define\n\t\ttask :foo do\n\t\t\tputs 'foo!'\n\t\tend\n\tend", "def task(task_class, mapping)\n task_class.new(mapping, runner).run(@changes)\n rescue Faraday::Error::ClientError => e\n task_mapping = TaskMapping.new(task_class, mapping)\n error SynchronizationError.new(e, task_mapping)\n end", "def trigger_task(task_name = nil, &block)\n task_lock(task_name || block) do\n block_given? ? yield : send(task_name)\n end\n end", "def trigger_task(task_name = nil, &block)\n task_lock(task_name || block) do\n block_given? ? yield : send(task_name)\n end\n end", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def set_task(name,task=nil) # Add a Task and its name\n @defaults['taskname']=name.to_s # taskname = task name\n if ! task.nil?\n @defaults['taskobj']=task # taskobj = the Task\n @defaults['env']=task.envars # env = the Task's env vars\n @defaults['seq']=task.seq # seq = Task's index location\n end\n return self\n end", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def task(upload=nil, &block)\n task = Task.new(self, upload, &block)\n\n return task unless block_given?\n task.metadata_hash\n end", "def execute\n if refresh_lock?\n lock_properties = @resource.refresh_lock\n elsif resource_locked?\n return :locked\n else\n # The `lockinfo` tag is used to specify the type of lock the client\n # wishes to have created.\n xml = xml_for body: body, node: 'lockinfo'\n return :bad_request if xml == :bad_request\n\n lock_properties = @resource.lock xml, @headers['Depth']\n end\n\n build_response lock_properties\n end", "def execute(&block)\n block # needs .call method here\nend", "def task=(value)\n @task = value\n end", "def initialize(name,&ruby_block)\n # Check and set the name of the task.\n @name = name.to_sym\n # Generate a name for the scope containing the signals of\n # the task.\n @scope_name = HDLRuby.uniq_name\n\n # # Sets the scope.\n # @scope = HDLRuby::High.cur_scope\n\n # Keep access to self.\n obj = self\n\n \n # The runner input ports by name.\n @runner_inputs = {}\n # The runner output ports by name.\n @runner_outputs = {}\n # The runner inout ports by name.\n @runner_inouts = {}\n \n # # The stopper input ports by name.\n # @stopper_inputs = {}\n # # The stopper output ports by name.\n # @stopper_outputs = {}\n # # The stopper inout ports by name.\n # @stopper_inouts = {}\n \n # The finisher input ports by name.\n @finisher_inputs = {}\n # The finisher output ports by name.\n @finisher_outputs = {}\n # The finisher inout ports by name.\n @finisher_inouts = {}\n\n # Create the namespaces for building the task, its readers\n # its writers and its accessers.\n\n # Creates the namespace of the task.\n @namespace = Namespace.new(self)\n # Make it give access to the internal of the class.\n @namespace.add_method(:runner_input, &method(:runner_input))\n @namespace.add_method(:runner_output, &method(:runner_output))\n @namespace.add_method(:runner_inout, &method(:runner_inout))\n # @namespace.add_method(:stopper_input, &method(:stopper_input))\n # @namespace.add_method(:stopper_output, &method(:stopper_output))\n # @namespace.add_method(:stopper_inout, &method(:stopper_inout))\n @namespace.add_method(:finisher_input, &method(:finisher_input))\n @namespace.add_method(:finisher_output, &method(:finisher_output))\n @namespace.add_method(:finisher_inout, &method(:finisher_inout))\n @namespace.add_method(:runner, &method(:runner))\n # @namespace.add_method(:stopper, &method(:stopper))\n @namespace.add_method(:finisher, &method(:finisher))\n\n # Creates the namespace of the runner.\n @runner_namespace = Namespace.new(self)\n # # Creates the namespace of the stopper.\n # @stopper_namespace = Namespace.new(self)\n # Creates the namespace of the finisher.\n @finisher_namespace = Namespace.new(self)\n @controller_namespace = Namespace.new(self)\n\n # Builds the task within a new scope.\n HDLRuby::High.space_push(@namespace)\n # puts \"top_user=#{HDLRuby::High.top_user}\"\n scope_name = @scope_name\n scope = nil\n HDLRuby::High.top_user.instance_eval do \n sub(scope_name) do\n # Generate the task code.\n ruby_block.call\n end\n end\n HDLRuby::High.space_pop\n\n # Keep access to the scope containing the code of the task.\n @scope = @namespace.send(scope_name)\n # puts \"@scope=#{@scope}\"\n # Adds the name space of the scope to the namespace of the\n # task\n @namespace.concat_namespace(@scope.namespace)\n\n # Gives access to the task by registering its name.\n obj = self\n # HDLRuby::High.space_reg(@name) { self }\n HDLRuby::High.space_reg(@name) { obj }\n end", "def operation\n puts \"HTTPResult#operation is deprecated and returns a task, switch to using #task\"\n task\n end", "def execute(&block)\n\tblock.call\nend", "def execute(&block)\n\tblock.call\nend", "def execute(&block)\n\tblock.call\nend", "def execute(&block)\n\tblock.call\nend", "def parse_task(tk)\n collect_tokens\n add_token tk\n\n token_listener self do\n skip_tkspace false\n\n tk = get_tk\n name = tk.text\n\n @task = @container.find_instance_method_named name\n\n unless @task then\n @task = RDoc::RakeTask.new tokens_to_s, name\n @container.add_method @task\n @stats.add_method @task\n end\n\n @task.comment += use_desc\n\n consume_task_arguments\n end\n\n @task.collect_tokens\n @task.add_tokens token_stream\n\n token_listener @task do\n consume_body\n end\n\n @task\n end", "def define\r\n\t\ttask :baz do\r\n\t\t\tputs 'these are ' + @message\r\n\t\tend\r\n\tend", "def define(&block)\n namespace :dm do\n namespace(:doc,&block)\n end\n\n task 'db:doc' => 'dm:doc'\n end", "def redmine_tasks(m, params)\n begin\n \tcertificate = redmine_check_auth(m)\n\t\tif ! certificate\n\t\t\t# ne rien faire, l'utilisateur n'est pas connecté\n\t\telse\n\t\t\tif params[:othername]\n\t\t\t\tuser_login = params[:othername]\n\t\t\telse\n\t\t\t\tuser_login = certificate[:username]\n\t\t\tend\n\t\t\tm.reply \"#{Underline}#{@redmine_l_currenttaskof} #{user_login} :#{Underline}\"\n\t\t\tif @registry.has_key? user_login\n\t\t\t\ttask_detected = false\n\t\t\t\t@registry[user_login].each do |task_logger|\n\t\t\t\t\ttask_detected = true\n\t\t\t\t\t\tif (task_logger.inprogress == \"pause\")\n\t\t\t\t\t\t\t# preparation du paramètre durée de tache\n\t\t\t\t\t\t\tgap = task_logger.alreadydone.to_i\n\t\t\t\t\t\t\thours = gap/3600.to_i\n\t\t\t\t\t\t\tmins = ( gap/60 % 60 ).to_i\n\t\t\t\t\t\t\tsecs = ( gap % 60 )\n\t\t\t\t\t\t\treal_hours = ( task_logger.alreadydone )/3600\n\t\t\t\t\t\t\tpause_message = \"[#{@redmine_l_pause}]\"\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tgap = ( Time.now - task_logger.time ).to_i + task_logger.alreadydone.to_i\n\t\t\t\t\t\t\thours = gap/3600.to_i\n\t\t\t\t\t\t\tmins = ( gap/60 % 60 ).to_i\n\t\t\t\t\t\t\tsecs = ( gap % 60 )\n\t\t\t\t\t\t\treal_hours = ( Time.now - task_logger.time )/3600\n\t\t\t\t\t\t\tpause_message = \"[#{@redmine_l_running}]\"\n\t\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\tm.reply \"#{@redmine_l_task} ##{task_logger.task}#{pause_message} (#{hours}h #{mins}m #{secs}s) : [#{task_logger.projectname}] #{task_logger.taskname} => #{@redmine_rapid_url}#{@redmine_issue_show_path}/#{task_logger.task}\"\n\t\t\t\tend\n\t\t\t\tif !task_detected\n\t\t\t\t\tif @redmine_debug_mode == 1\n\t\t\t\t\t\tm.reply \"#{@redmine_l_notaskrunning}\"\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\t\n\t\t\telse\n\t\t\t\t#if @redmine_debug_mode == 1\n\t\t\t\t\tm.reply \"#{@redmine_l_notaskrunning}\"\n\t\t\t\t#end\n\t\t\tend\n\t\tend\n rescue Exception => e\n m.reply e.message\n m.reply e.backtrace.inspect\n end\n end", "def _task_( library, name, &params )\n item = library.get(name)\n item.parent = self\n item.merge_instance_variables(self)\n item.instance_eval(&params) if block_given?\n item.generate\n end", "def async(name, &ruby_block)\n # Create the resulting state.\n result = State.new\n result.name = name.to_sym\n result.code = ruby_block\n # Add it to the lis of extra synchronous states.\n @extra_asyncs << result\n # Return it\n return result\n end", "def execute(&block)\n # block\n block.call\nend", "def start_task_run(project_id, scan_id, task_name, entity, options, handlers=[])\n\n # Create the task result, and associate our entity and options\n task_result = Intrigue::Model::TaskResult.create({\n :name => \"#{task_name}\",\n :task_name => task_name,\n :options => options,\n :base_entity => entity,\n :logger => Intrigue::Model::Logger.create(:project => Intrigue::Model::Project.get(project_id)),\n :project => Intrigue::Model::Project.get(project_id)\n })\n\n # Associate the scan result so we can query this later\n task_result.scan_results << Intrigue::Model::ScanResult.get(scan_id) if scan_id\n task_result.save\n\n ###\n # Create the task and start it\n ###\n task = Intrigue::TaskFactory.create_by_name(task_result.task_name)\n task.class.perform_async task_result.id, handlers\n\n task_result.id\n end", "def multitask(args, &block)\n Rake::MultiTask.define_task(args, &block)\n end", "def get_task( args = { :create => true } )\n app_name = params[:application]\n application = Zeidon.get_object_engine.get_app app_name\n task_id = session[:zeidon_task_id]\n jtask = Zeidon.get_object_engine.getTaskById( task_id )\n if jtask.nil?\n return unless args[:create]\n raise \"Must specify app name for :create\" unless app_name\n task = Zeidon.get_object_engine.get_app( app_name ).create_task\n add_task_to_session task\n return application, task\n end\n\n app = Zeidon.get_object_engine.get_app( app_name )\n return application, task = Zeidon::Task.new( app, jtask )\nend", "def do_LOCK(req, res)\n end", "def execute(&block)\n block.call \nend", "def execute_block(&block)\n @currently_executing_block = true\n output \"tell session id #{name}_tty\"\n self.instance_eval(&block)\n output \"end tell\"\n @currently_executing_block = false\n end", "def run_task(task_name)\n puts heading(\"Running #{task_name}\")\n @results[task_name] = Rake::Task[task_name].invoke\n end", "def definition; Mrowka::Tasks[self.type.to_sym]; end", "def execute(&block)\n block.call\n end", "def execute(&block)\n block.call\n end", "def define_tasks\n private_methods.grep(/^define_(\\w+)_tasks$/).each do |meth| \n namespace_name = meth.match(/^define_(\\w+)_tasks$/)[1]\n send(meth)\n end\n end", "def execute(block)\n block.call\nend", "def execute(block)\n block.call\nend", "def execute(block)\n block.call\nend", "def execute(block)\n block.call\nend", "def execute(block)\n block.call\nend", "def execute(block)\n block.call\nend", "def execute(block)\n block.call\nend", "def execute(&block)\n block.call\nend", "def run(&block)\n task('run').tap do |t|\n t.enhance &block if block\n end\n end", "def task(name, *args, &block)\n task_once(name, block) do\n super\n end\n end", "def call(*, &block)\n lock_instance.execute(&block)\n end", "def set_task\n @task = Task.where(authorization_id: Authorization.current_id).find(params[:id])\n end" ]
[ "0.6658985", "0.62150043", "0.6152634", "0.6058406", "0.60057646", "0.5915731", "0.57130474", "0.56931907", "0.56901515", "0.5670516", "0.5629411", "0.5472292", "0.5410859", "0.54104996", "0.54104996", "0.54072577", "0.53668725", "0.53229", "0.5310133", "0.5310133", "0.5275074", "0.5257726", "0.5247334", "0.52401423", "0.5216389", "0.52142656", "0.5201731", "0.5191847", "0.5184157", "0.51827693", "0.51827693", "0.51681274", "0.5160134", "0.51351494", "0.5115635", "0.5111352", "0.51107347", "0.51045424", "0.51045424", "0.50636107", "0.50636107", "0.50542295", "0.5048653", "0.5048653", "0.5048653", "0.5048653", "0.5048653", "0.5048653", "0.5048653", "0.5048653", "0.5048653", "0.5048653", "0.5048653", "0.5048653", "0.5048653", "0.5048653", "0.5048653", "0.5048653", "0.5048653", "0.5048653", "0.504092", "0.50208527", "0.5018255", "0.50067097", "0.49837", "0.49836308", "0.49722695", "0.49719486", "0.49719486", "0.49719486", "0.49620318", "0.49561912", "0.4943943", "0.49251288", "0.49190974", "0.49097502", "0.48968142", "0.4890157", "0.48847753", "0.48839518", "0.4867872", "0.4866586", "0.4864091", "0.48597875", "0.4858778", "0.4852587", "0.4852587", "0.48509786", "0.48460582", "0.48460582", "0.48460582", "0.48460582", "0.48460582", "0.48460582", "0.48460582", "0.48444775", "0.48440164", "0.48423445", "0.48340786", "0.483295" ]
0.73301953
0
It log rpc call result. +task_name+ name of called method +user+ name of user who executes this rpc call +result[0]+ true or false +result[1]+ a string representing error if result[0] is false, otherwise undefined
def log_result(task_name, user, result) if result[0] log_success(user, task_name) else log_fail(user, task_name, result[1]) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def result_log\n end", "def result_log\n end", "def result_log\n end", "def add_result name, res\n \n end", "def print_rpc_stats(stats)\n out.puts stats.report(\"Task Stats\", false, @verbose)\n end", "def log_http_call(payload); end", "def log_http_call(payload); end", "def log_result(label, &block)\n result = block.call\n self.log label % result.inspect\n result\n end", "def display_result(result)\r\n puts result\r\n end", "def sendTaskResult _obj, _args\n \"_obj sendTaskResult _args;\" \n end", "def sendTaskResult _obj, _args\n \"_obj sendTaskResult _args;\" \n end", "def print_task_summary(taskid, names, callers, completed, running, task_not_known, wrapper_failure, success, fails, runtime, rpcstats)\n if callers.size > 1 || names.size > 1\n out.puts\n out.puts(\"%s received more than 1 task name or caller name for this task, this should not happen\" % Util.colorize(:red, \"WARNING\"))\n out.puts(\"happen in normal operations and might indicate forged requests were made or cache corruption.\")\n out.puts\n end\n\n out.puts(\"Summary for task %s\" % [Util.colorize(:bold, taskid)])\n out.puts\n out.puts(\" Task Name: %s\" % names.join(\",\"))\n out.puts(\" Caller: %s\" % callers.join(\",\"))\n out.puts(\" Completed: %s\" % (completed > 0 ? Util.colorize(:green, completed) : Util.colorize(:yellow, completed)))\n out.puts(\" Running: %s\" % (running > 0 ? Util.colorize(:yellow, running) : Util.colorize(:green, running)))\n out.puts(\" Unknown Task: %s\" % Util.colorize(:red, task_not_known)) if task_not_known > 0\n out.puts(\" Wrapper Failure: %s\" % Util.colorize(:red, wrapper_failure)) if wrapper_failure > 0\n out.puts\n out.puts(\" Successful: %s\" % (success > 0 ? Util.colorize(:green, success) : Util.colorize(:red, success)))\n out.puts(\" Failed: %s\" % (fails > 0 ? Util.colorize(:red, fails) : fails))\n out.puts\n out.puts(\" Average Run Time: %.2fs\" % [runtime / (running + completed)])\n\n if rpcstats.noresponsefrom.empty?\n out.puts\n out.puts rpcstats.no_response_report\n end\n\n if running > 0\n out.puts\n out.puts(\"%s nodes are still running, use 'mco tasks status %s' to check on them later\" % [Util.colorize(:bold, running), taskid])\n end\n end", "def process_result res\n call = res[-1]\n\n check = check_call call\n\n if check and not @results.include? call\n @results << call\n\n if include_user_input? call[3]\n confidence = CONFIDENCE[:high]\n else\n confidence = CONFIDENCE[:med]\n end\n \n warn :result => res, \n :warning_type => \"Mass Assignment\", \n :message => \"Unprotected mass assignment\",\n :line => call.line,\n :code => call, \n :confidence => confidence\n end\n res\n end", "def result(res)\n clear_eval\n puts Debugger::PROMPTS[:result] + res.to_s\n end", "def result(res)\n clear_eval\n puts Debugger::PROMPTS[:result] + res.to_s\n end", "def postSuccessResult(caseId)\n puts \"----------------------------------------------------------------------------------\"\n puts \"\"\n @testRailUtility.postResult(caseId,\"Pass\",1,@runId)\n @passedLogs = @objRollbar.addLog(\"[Result ] Success\")\nend", "def make_result_info\n end", "def taskCompleted _args\n \"taskCompleted _args;\" \n end", "def print_result(result)\n status = result[:data]\n stdout_text = status[:stdout] || \"\"\n\n unless @verbose\n begin\n stdout_text = JSON.parse(status[:stdout])\n stdout_text.delete(\"_error\")\n stdout_text = stdout_text.to_json\n stdout_text = nil if stdout_text == \"{}\"\n rescue # rubocop:disable Lint/SuppressedException\n end\n end\n\n if result[:statuscode] != 0\n out.puts(\"%-40s %s\" % [\n Util.colorize(:red, result[:sender]),\n Util.colorize(:yellow, result[:statusmsg])\n ])\n\n out.puts(\" %s\" % stdout_text) if stdout_text\n out.puts(\" %s\" % status[:stderr]) unless [\"\", nil].include?(status[:stderr])\n out.puts\n elsif result[:statuscode] == 0 && @verbose\n out.puts(result[:sender])\n out.puts(\" %s\" % stdout_text) if stdout_text\n out.puts(\" %s\" % status[:stderr]) unless [\"\", nil].include?(status[:stderr])\n out.puts\n end\n end", "def hook_result(messages); end", "def get_execution_result\n @result\n end", "def call()\n @logger.info([@type, \"#{@codeline}(#{@count}) #{@shortdescription} (temporary: #{@result.inspect})\"])\n @count += 1\n end", "def _roda_after_90__common_logger(result)\n return unless result && (status = result[0]) && (headers = result[1])\n\n elapsed_time = if timer = @_request_timer\n '%0.4f' % (CommonLogger.start_timer - timer)\n else \n '-'\n end\n\n env = @_request.env\n\n line = \"#{env['HTTP_X_FORWARDED_FOR'] || env[\"REMOTE_ADDR\"] || \"-\"} - #{env[\"REMOTE_USER\"] || \"-\"} [#{Time.now.strftime(\"%d/%b/%Y:%H:%M:%S %z\")}] \\\"#{env[\"REQUEST_METHOD\"]} #{env[\"SCRIPT_NAME\"]}#{env[\"PATH_INFO\"]}#{\"?#{env[\"QUERY_STRING\"]}\" if ((qs = env[\"QUERY_STRING\"]) && !qs.empty?)} #{@_request.http_version}\\\" #{status} #{((length = headers[RodaResponseHeaders::CONTENT_LENGTH]) && (length unless length == '0')) || '-'} #{elapsed_time}\\n\"\n if MUTATE_LINE\n line.gsub!(/[^[:print:]\\n]/){|c| sprintf(\"\\\\x%x\", c.ord)}\n # :nocov:\n else\n line = line.gsub(/[^[:print:]\\n]/){|c| sprintf(\"\\\\x%x\", c.ord)}\n # :nocov:\n end\n opts[:common_logger_meth].call(line)\n end", "def report_test_result success, msg\n if(success)\n print_success msg\n else\n print_error msg\n end\nend", "def test_call\n log \"tast_call() called\"\n return \"test_call() return value\"\n end", "def _roda_after_90__common_logger(result)\n super if result && _common_log_request?(result)\n end", "def process_result(msg, success)\n @results_string += \"%-70s\" % msg \n @results_string += \": \" + (success ? \"Success\" : \"Failed\") + \"\\n\"\n @results.push(success)\nend", "def printResult(result)\n\t\tif result.has_key?('status') and result['status'] == 'success'\n\t\t\tputs \"Success, response contains:\"\n\t\t\tresult.each do |key,value|\n\t\t\t\tputs \"\\t#{key} => #{CGI::unescape(value)}\"\n\t\t\tend\n\t\t\ttrue\n\t\telse \n\t\t\tputs \"Error, trace is:\"\n\t\t\tresult.each do |key,value|\n\t\t\t\tputs \"\\t#{key} => #{CGI::unescape(value)}\"\n\t\t\tend\n\t\t\tfalse\n\t\tend\n\tend", "def agent_call\n begin\n agent = AgentClient.find_by(name: params[:name])\n task = agent.task\n log = TaskLog.new(\n task_id: task.id,\n start_datetime: DateTime.now(),\n exc_status: TaskLog::EXC_STATUS[rand(0..1)] # randomize result status\n )\n # ensure save\n if !log.save\n raise agent.errors\n else\n # calculate time to run\n end_dt, exc_time = log.exc_times\n log.update_attributes({end_datetime: end_dt, exc_time: exc_time})\n end\n # return response\n render json: {\n agent: agent,\n task: task,\n log: log\n }\n rescue => e\n render json: {\n error: e.message\n }\n end\n end", "def call()\r\n @logger.info([@type, \"#{@codeline}(#{@count}) #{@shortdescription} (temporary: #{@result.inspect})\"])\r\n @count += 1\r\n end", "def log_results( executable, procedure, results )\n if Maadi::Generic::Executable.is_executable?( executable ) and Maadi::Procedure::Procedure::is_procedure?( procedure ) and Maadi::Procedure::Results::is_results?( results )\n\n end\n end", "def process_result result\n call = result[:call]\n args = call.arglist\n first_arg = call.first_arg\n\n case call.method\n when :popen\n unless array? first_arg\n failure = include_user_input?(args) || dangerous_interp?(args)\n end\n when :system, :exec\n failure = include_user_input?(first_arg) || dangerous_interp?(first_arg)\n else\n failure = include_user_input?(args) || dangerous_interp?(args)\n end\n\n if failure and original? result\n\n if failure.type == :interp # Not from user input\n confidence = :medium\n else\n confidence = :high\n end\n\n warn :result => result,\n :warning_type => \"Command Injection\",\n :warning_code => :command_injection,\n :message => \"Possible command injection\",\n :code => call,\n :user_input => failure,\n :confidence => confidence\n end\n end", "def process_result\n end", "def record(result)\n r = result\n c = r.class\n file, = c.instance_method(r.name).source_location\n failures = Distributed.format(r.failures, manager)\n server.test_result(pid, file, c.name, r.name, failures, r.assertions, r.time)\n end", "def result_msg\n msgs = []\n results.each { |re| msgs.push(re[:msg]) unless re[:passed]}\n msgs\n end", "def rpc(service_name,task_name,arguments,options={})\n max_retries = options.fetch(:max_retries,1)\n left_retries = max_retries\n\n loop do\n request_id = \"#{@identity}-#{@counter+=1}\"\n request(\n service_name,\n :name => task_name,\n :arguments => [*arguments],\n :request_id => request_id\n )\n begin\n return receive_rpc_response(service_name,request_id,options)\n rescue TimeoutError\n rz_warn { \"rpc timeout, left retries #{left_retries}\" }\n left_retries -= 1\n raise unless left_retries > 0\n end\n end\n rescue TimeoutError => exception\n raise TimeoutError,\"#{exception.message} after #{max_retries} retries\"\n end", "def result_status(task)\n reason = why_ignore(task)\n case reason\n when :upstream then :-\n when :execute then :pending\n when :complete then :complete\n else; :\"ignore_#{reason}\"\n end\n end", "def result_status(task)\n reason = why_ignore(task)\n case reason\n when :upstream; :-\n when :execute; :pending\n when :complete; :complete\n else; :\"ignore_#{reason}\"\n end\n end", "def run(api_method = :api)\n orig_command = \"%s %s\" % [api_method, raw]\n Log.debug \"saying #{orig_command}\"\n resp = @fs_socket.say(orig_command)\n unless resp[\"body\"] == \"0 total.\"\n call_info, count = resp[\"body\"].split(\"\\n\\n\")\n require \"fsr/model/call\"\n require \"csv\"\n @calls = CSV.parse(call_info)\n return @calls[1 .. -1].map { |c| FSR::Model::Call.new(@calls[0],*c) }\n end\n []\n end", "def callback_logging(*args, &block)\n m = args.empty? ? \"OPERATION\" : args.map {|v| v.to_s.upcase }.join(\" \")\n proc do |callback|\n logger.error callback if callback.respond_to?(:error?) && callback.error?\n logger.debug \"#{m} SUCCEED\" if callback.respond_to?(:result?) && callback.result?\n block.call(callback) if block\n end\n end", "def run(api_method = :api)\n orig_command = \"%s %s\" % [api_method, raw]\n Log.debug \"saying #{orig_command}\"\n resp = @fs_socket.say(orig_command)\n unless resp[\"body\"] == \"0 total.\"\n call_info, count = resp[\"body\"].split(\"\\n\\n\")\n require \"fsr/model/call\"\n begin\n require \"fastercsv\"\n @calls = FCSV.parse(call_info)\n rescue LoadError\n require \"csv\"\n @calls = CSV.parse(call_info)\n end\n return @calls[1 .. -1].map { |c| FSR::Model::Call.new(@calls[0],*c) }\n end\n []\n end", "def rpc_send(method_name, *args, &block)\n return yield if rpc_in_server_mode? || rpc_enabled?\n begin\n rpc_client << [method_name, args]\n response = rpc_client.read\n rescue => e\n #FIXME: error handling as an error occured at the transport layer\n end\n if response.erred?\n #will have response.message = {:em => 'error msg', :eb => ['error backtrace'], :om => 'original message'}\n end\n response.message\n end", "def __log(method, path, params, body, url, response, json, took, duration)\n logger.info \"#{method.to_s.upcase} #{url} \" +\n \"[status:#{response.status}, request:#{sprintf('%.3fs', duration)}, query:#{took}]\"\n logger.debug \"> #{__convert_to_json(body)}\" if body\n logger.debug \"< #{response.body}\"\n end", "def store_result(result); end", "def call(method, *args) rpc_execute(method, *args) end", "def task_details_for_log\n \"Node #{@puppet_mclient.node_id}, task #{@task}, manifest \"\\\n \"#{@puppet_mclient.manifest}\"\n end", "def response\n response_parts = []\n response_parts << '\"version\": \"1.1\"'\n response_parts << '\"id\": ' + @id.to_json if @id\n if @error\n response_parts << '\"error\": ' + {:name => 'JSONRPCError'}.merge(@error).to_json\n else\n response_parts << '\"result\": ' + @result.to_json\n end\n '{' + response_parts.join(', ') + \"}\\n\" \n end", "def successful_call\n return @successful_call\n end", "def print_result_metadata(status)\n result = status.results\n\n if [0, 1].include?(result[:statuscode])\n if result[:data][:exitcode] == 0\n out.puts(\" %-40s %s\" % [result[:sender], Util.colorize(:green, result[:data][:exitcode])])\n else\n out.puts(\" %-40s %s\" % [result[:sender], Util.colorize(:red, result[:data][:exitcode])])\n end\n\n out.puts(\" %s by %s at %s\" % [\n Util.colorize(:bold, result[:data][:task]),\n result[:data][:callerid],\n Time.at(result[:data][:start_time]).utc.strftime(\"%F %T\")\n ])\n\n out.puts(\" completed: %s runtime: %s stdout: %s stderr: %s\" % [\n result[:data][:completed] ? Util.colorize(:bold, \"yes\") : Util.colorize(:yellow, \"no\"),\n Util.colorize(:bold, \"%.2f\" % result[:data][:runtime]),\n result[:data][:stdout].empty? ? Util.colorize(:yellow, \"no\") : Util.colorize(:bold, \"yes\"),\n result[:data][:stderr].empty? ? Util.colorize(:bold, \"no\") : Util.colorize(:red, \"yes\")\n ])\n elsif result[:statuscode] == 3\n out.puts(\" %-40s %s\" % [result[:sender], Util.colorize(:yellow, \"Unknown Task\")])\n else\n out.puts(\" %-40s %s\" % [result[:sender], Util.colorize(:yellow, result[:statusmsg])])\n end\n\n out.puts\n end", "def inspect\n return to_s if success?.nil?\n (success? ? \"success : \" : \"fail : \") + @command\n end", "def error_message(obj, name = \"\")\n if name.present? && obj.get_operation_result.code.zero?\n \"Could not find user '#{name}'\"\n else\n \"#{obj.get_operation_result.message} (code #{obj.get_operation_result.code})\"\n end\n end", "def remote_call(rpc_method, request_args)\n self.execute(rpc_method, request_args)\n self.last_response\n end", "def display_result(cmd_result)\n result = \"Process: #{cmd_result[\"pid\"]}\\nSTDOUT:\\n#{cmd_result[\"stdout\"]}\\n\"\n result = \"STDERR:\\n #{cmd_result[\"stderr\"]}\\n#{result}\" if cmd_result[\"stderr\"].length > 2\n result += \"#{EXIT_CODE_FAILURE} Command returned: #{cmd_result[\"status\"]}\" if cmd_result[\"status\"] != 0\n result\n end", "def format_result(result)\n result\n end", "def log_results( executable, procedure, results )\n if Maadi::Generic::Executable.is_executable?( executable ) and Maadi::Procedure::Procedure::is_procedure?( procedure ) and Maadi::Procedure::Results::is_results?( results )\n t = Time.now\n log_time = \"#{t.strftime('%Y/%m/%d %H:%M:%S')}\"\n\n if @db != nil\n is_ok = false\n rId = -1\n\n begin\n stm = @db.prepare( 'INSERT INTO tblResults (rTestId, rTime, rApp, rProc, rProcId) VALUES (?, ?, ?, ?, ?)')\n stm.bind_params( procedure.key_id, log_time, executable.to_s, procedure.to_s, procedure.key_id )\n rs = stm.execute\n rId = @db.last_insert_row_id.to_s\n stm.close\n is_ok = true\n rescue ::SQLite3::Exception => e\n Maadi::post_message(:Warn, \"Repository (#{@type}:#{@instance_name}) encountered an INSERT Results error (#{e.message}).\")\n end\n\n if is_ok && rId != -1\n if results.key_id == -1\n results.key_id == rId\n end\n # attempt to insert the procedure's steps into the tblSteps, since the tblProcedure INSERT was successful\n # CREATE TABLE IF NOT EXISTS tblResultData ( dID integer primary key, rID integer, dStep varchar(255), dStatus varchar(255), dType varchar(255), dData TEXT)\n\n results.results.each do |result|\n is_ok = false\n rdId = -1\n\n begin\n stm = @db.prepare( 'INSERT INTO tblResultData (rID, dStep, dStepId, dStatus, dType, dData) VALUES (?, ?, ?, ?, ?, ?)' )\n stm.bind_params( rId, result.step_name, result.step_key, result.status, result.type, result.data.to_s )\n rs = stm.execute\n rdId = @db.last_insert_row_id.to_s\n stm.close\n is_ok = true\n rescue ::SQLite3::Exception => e\n Maadi::post_message(:Warn, \"Repository (#{@type}:#{@instance_name}) encountered an INSERT Result error (#{e.message}).\")\n end\n\n # if we have encountered any INSERT errors, do not attempt to process any more INSERTs\n break if !is_ok\n\n if result.key_id == -1\n result.key_id = rdId\n end\n end\n end\n end\n end\n end", "def method_missing(method, *args, &block)\n tokens = method.to_s.split('_')\n result = tokens.pop\n action = tokens.join('_')\n if args.first.is_a? Hash\n message = Log.data(args.first)\n else\n message = args.join(' ')\n end\n Log.log self.level, \"action=#{action} status=#{result} #{message}\"\n end", "def async_result()\n #This is a stub, used for indexing\n end", "def do call, *args\n @results ||= []\n @results.push({\n :time => Time.now,\n :call => call,\n :args => args,\n :output => (self.send call, *args),\n })\n @results\n end", "def output\n self.check!\n data = {\n \"method\" => @method.to_s,\n \"params\" => @params,\n \"id\" => @id\n }\n end", "def write_result_msg(result)\n msg = if result then\n I18n.t 'config.recreated'\n else\n I18n.t 'config.updated'\n end\n @env.ui.info msg\n end", "def print_call ( i )\n\tname = @call.call_lookup i.target.hex\n\tif name\n\t w = i.line.split\n\t print w[0] + \"\\t\" + w[1] + \"\\t\\t\" + w[2]\n\t print \"\\t\" + name + \"\\t\\t; \" + w[3] + \"\\n\"\n\t #puts i.line + \"\\t; \" + name\n\telse\n\t # should never happen\n\t puts i.line + \"\\t; \" + \"????\"\n\tend\n end", "def progress_info\n\n color=\"#AAAAAA\"\n progress=0\n message=\"Log not available.\"\n\n if self.cluster_stdout\n\n color=\"blue\"\n progress=0\n message=\"Execution not started.\"\n\n self.cluster_stdout.each_line do |line| \n if /\\([0-9]* run \\/ [0-9]* fail \\/ [0-9]* done \\/ [0-9]* left\\)/.match(line)\n run = /[0-9]* run/.match(line)[0].to_s.split[0].to_f \n done = /\\/ [0-9]* done/.match(line)[0].to_s.split[1].to_f\n failed = /\\/ [0-9]* fail/.match(line)[0].to_s.split[1].to_f\n left = /\\/ [0-9]* left/.match(line)[0].to_s.split[1].to_f\n progress=100*(run+done+failed)/(run+done+failed+left)\n # set toolbar color \n red=255*(failed)/(failed+done+run)\n blue=255*(run).to_f/(failed+done+run).to_f\n green=128*(done).to_f/(failed+done+run).to_f\n color=\"rgb(#{red.to_i},#{green.to_i},#{blue.to_i})\"\n if progress!= 100 && (\n\t CbrainTask::COMPLETED_STATUS.include?(self.status) ||\n\t CbrainTask::FAILED_STATUS.include?(self.status) ||\n\t self.status == \"Post Processing\" ||\n\t self.status == \"Data Ready\")\n color=\"red\"\n end\n if progress==100\n\t color=\"green\"\n end\n message=\"PSOM tasks: #{run.to_i} run / #{failed.to_i} fail / #{done.to_i} done / #{left.to_i} left\"\n end\n end\n end \n return {:color => color,:percentage => progress, :message => message, :show_percentage => true}\n end", "def call(method_name, *params)\n request = nil\n response = nil\n\n @call_mutex.synchronize do\n request = [0, @msgid, method_name, params]\n @msgid = (@msgid % MAX_MSGID) + 1\n response = make_request_with_retries(request)\n end\n\n if response[0] != 1\n raise MsgpackRpcClient::Error, 'Response does not bear the proper type flag - something is very wrong'\n end\n if response[1] != request[1]\n raise MsgpackRpcClient::Error, 'Response message id does not match request message id - something is very wrong'\n end\n if response[2] != nil\n raise MsgpackRpcClient::Error, \"Server responded with error: #{response[2]}\"\n end\n\n response[3]\n end", "def to_text\n \"#{name}: #{call}\"\n end", "def request_result\n \n end", "def method\n \"result\"\nend", "def method\n \"result\"\nend", "def test_function_get_user_info_successfully\n user_id = 28\n\n #Call function get_user_info in model V1::User\n user = V1::User.get_user_info(user_id)\n\n #Get value code which is returned when call function get_user_info\n actual = user[:meta][:code]\n\n expected = 200\n #Show result of this function(true=>pass)\n puts this_method_name + \" - \" +assert_equal(expected, actual).to_s\n end", "def log_http_call(payload)\n logger.info \"Request[#{payload[:method]}]: #{payload[:uri].to_s}\"\n start_time = Time.now\n response = yield\n logger.info sprintf(\"Response[%s]: %s, Duration: %.3fs\", response.code,\n response.message, Time.now - start_time)\n response\n end", "def remote_call(remote_method, params)\n correlation_id = SecureRandom.uuid\n message = { id: correlation_id, jsonrpc: '2.0', method: remote_method, params: params}\n # Reply To => make sure the service knows where to send it's response.\n # Correlation ID => identify the results that belong to the unique call made\n @exchange.publish(message.to_json, routing_key: @server_queue.name, correlation_id: correlation_id,\n reply_to: @reply_queue.name)\n result = @results[correlation_id].pop\n @results.delete correlation_id # remove item from hash. prevents memory leak.\n result\n end", "def get_result(result_type) ; add_result(result_type, false) ; end", "def success(log_data = nil)\n results true, log_data\n end", "def response\n @rpc.response\n end", "def result_case\n if @succeeded\n color_print(\"Success\", :green)\n else\n color_print(\"Error\", :red)\n end\n end", "def verbose_output (ldap, operation)\n print operation\n puts ldap.get_operation_result.message\nend", "def zip_test_result_logs(result,\n test,\n target,\n project,\n machine,\n pool)\n handle_action_exceptions(__method__) do\n cmd_line = [\n \"ziptestresultlogs '#{result}' '#{test}' '#{target}' \"\\\n \"'#{project}' '#{machine}' '#{pool}'\"\n ]\n cmd_line << 'json' if @json\n\n stream = @toolshck_ether.cmd(cmd_line.join(' '))\n test_results = handle_return(stream)\n handle_test_results(test_results, stream)\n end\n end", "def result_pure_log(title, message, processlog)\n logprefix = get_log_prefix(title)\n execute \"result_pure_log\" do\n command \"echo '#{logprefix} #{message}' >> #{processlog}\"\n end\nend", "def result\n\n end", "def build_run_msg(task)\n date = Time.now.strftime(\"%b %d %H:%M:%S\")\n hostname = Socket.gethostname\n username = Etc.getpwuid(Process.uid).name\n \"#{date} #{hostname} #{$$} (#{username}) JOB (#{task})\"\n end", "def process_result(result, exit_status); end", "def result()\n end", "def send_result(test_case,result,id,testrun)\n testrail_status = case \n when result.passed?\n {id:1,comment: 'passed'}\n when result.failed?\n {id:5,comment: 'failed'}\n when result.undefined?\n {id:7,comment: 'undefined step'}\n when result.pending?\n {id:6,comment: 'pending step'}\n end\n unless result.passed?\n # the before step can fail. So we have to check\n if @failed_step[:step].source.last.is_a?(Cucumber::Hooks::BeforeHook)\n failed_step = 'failed in the before hook'\n location = 'before hook'\n elsif @failed_step[:step].source.last.is_a?(Cucumber::Hooks::AfterHook)\n failed_step = 'failed in the after hook'\n location = 'after hook'\n else\n failed_step = \"#{@failed_step[:step].source.last.keyword}#{@failed_step[:step].source.last.name}\"\n location=@failed_step[:step].source.last.file_colon_line\n end\n failure_message = <<-FAILURE\n Error message: #{testrail_status[:comment]} #{result.exception.message}\n Step: #{failed_step}\n Location: #{location}\n FAILURE\n else\n failure_message = nil\n end\n #only send defects if the test is not passed\n report_on_result = {status_id:testrail_status[:id],comment:failure_message,defects:testrail_status[:id]==1 ? '' : defects(test_case)}\n begin\n testrail_api_client.send_post(\"add_result_for_case/#{testrun}/#{id}\",report_on_result)\n rescue => e\n if e.message =~ /No \\(active\\) test found for the run\\/case combination/\n add_case_to_test_run(id,testrun)\n retry\n else\n puts \"#{e.message} testrun=#{testrun} test case id=#{id}\"\n end\n end\n end", "def call\n begin\n yield && result.success!\n rescue => e\n Rails.logger.info \"Error when execute service #{e.inspect}\"\n result.failed!\n end\n end", "def success_info(log_args)\n alert.send(success_method, *log_args)\n end", "def ljcall(ljfnname,params = {})\n get_challenge\n paramhash = @paramhash.merge Hash[*(params.map do |a,b| \n [a.to_s,b] \n end.flatten)]\n @client.call \"LJ.XMLRPC.#{ljfnname.to_s}\", paramhash\n end", "def print_result(formatted_result)\n puts formatted_result\n end", "def log_results( executable, procedure, results )\n if Maadi::Generic::Executable.is_executable?( executable ) and Maadi::Procedure::Procedure::is_procedure?( procedure ) and Maadi::Procedure::Results::is_results?( results )\n t = Time.now\n File.open( @options['FILENAME'], 'a') do |f|\n f.puts \"#{t.strftime('%Y%m%d%H%M%S')}\\tRESULTS\\t#{results.key_id}\\t#{results.source}\\t#{executable.to_s}\\t#{procedure.to_s}\\t#{procedure.key_id}\\t#{results.to_s}\"\n\n results.results.each do |result|\n f.puts \"\\tRESULT\\t#{result.key_id}\\t#{result.step_key}\\t#{result.step_name}\\t#{result.target}\\t#{result.status}\\t#{result.type}\\t#{result.data.to_s}\"\n end\n end\n end\n end", "def print_result_others(host, log_line, max_col_length)\n if log_line =~ /is running.../\n printf \"%-#{max_col_length}s %4s\\n\", host, \"[#{'OK'.green}]\"\n else\n printf \"%-#{max_col_length}s %4s\\n\", host, \"[#{'X'.red}]\"\n puts \" #{log_line}\".red\n end\n end", "def result\n wait_for\n # If the task threw an exception during execution we raise that here.\n @task_error ? raise(@task_error) : @task_result\n end", "def result\n operation.result\n end", "def format_result(result)\n result\n end", "def handle_result! json, peer\n Logger.info 'Processing data received from peer: ' + peer.to_s\n service = Executor::Service.get json[:service_id]\n service.trigger.send :perform, Result.new(json, peer) \n end", "def record(result)\n\t\t\tif options[:verbose]\n\t\t\t\tio.print \"%s#%s = %.2f s = \" % [result.class, result.name, result.time]\n\t\t\telse\n\t\t\t\tio.print \"#{result.name} \"\n\t\t\tend\n\t\t\tif result.result_code == '.'\n\t\t\t\tputs '✔'\n @@tests += 1\n else\n\t\t\t\tputs result.result_code\n end\n report_results(result, @@tests)\n end", "def result_summary_msg(result_type)\n if result_type == :pass && all_pass?\n all_pass_result_summary_msg\n else\n \"#{send(\"#{result_type}_result_count\")} #{result_type}\"\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 info\n if @succeeded then 'Success' else \"Failure message='#{@message}'\" end\n end", "def domain_create_result(proc_id)\n result = parse_attributes(result_retrieve(proc_id)[:body].split(\"\\n\\n\", 1)[0])\n puts result\n return nil unless result.has_key? :completion_status\n case result[:completion_status]\n when 'ack' then\n result_delete proc_id\n result[:object_name]\n when 'nack' then\n raise_response result\n else\n nil\n end\n end", "def contact_create_result(proc_id)\n result = parse_attributes(result_retrieve(proc_id)[:body].split(\"\\n\\n\", 1)[0])\n return nil unless result.has_key? :completion_status\n case result[:completion_status]\n when 'ack' then\n result_delete proc_id\n result[:object_name]\n when 'nack' then\n raise_response response\n else\n nil\n end\n end", "def info(*args)\n case args.size\n when 0\n info_filter(VM_POOL_METHODS[:info],\n @user_id,\n -1,\n -1,\n INFO_NOT_DONE)\n when 1\n info_filter(VM_POOL_METHODS[:info],\n args[0],\n -1,\n -1,\n INFO_NOT_DONE)\n when 3\n info_filter(VM_POOL_METHODS[:info],\n args[0],\n args[1],\n args[2],\n INFO_NOT_DONE)\n when 4\n info_filter(VM_POOL_METHODS[:info],\n args[0],\n args[1],\n args[2],\n args[3])\n end\n end", "def run_result; result['run_cyber_dojo_sh']; end" ]
[ "0.6135386", "0.6135386", "0.6135386", "0.58090156", "0.5774704", "0.5705321", "0.5705321", "0.56731874", "0.55995214", "0.55908805", "0.55908805", "0.5586277", "0.5569239", "0.5554616", "0.5554616", "0.5534579", "0.5484125", "0.5464913", "0.54558444", "0.5438367", "0.5433518", "0.5424857", "0.54190075", "0.5415883", "0.5408282", "0.53991127", "0.53687704", "0.5362625", "0.5361173", "0.53599125", "0.5356369", "0.53499216", "0.5342561", "0.53338355", "0.53098214", "0.53050125", "0.5290386", "0.5284447", "0.5283115", "0.5276071", "0.5269169", "0.52525884", "0.5236323", "0.5231308", "0.5224836", "0.5222814", "0.5212307", "0.52020854", "0.5198482", "0.5190726", "0.5178539", "0.51761925", "0.51728445", "0.51716596", "0.51658714", "0.516316", "0.5161749", "0.5157558", "0.5145329", "0.5138502", "0.5124646", "0.51170605", "0.5116857", "0.51082134", "0.50994366", "0.5097013", "0.5097013", "0.5094199", "0.50941235", "0.5093691", "0.5091484", "0.50910974", "0.5088636", "0.5078683", "0.50667155", "0.5064447", "0.5060875", "0.50592613", "0.505755", "0.50546396", "0.5038653", "0.5036242", "0.502781", "0.5021905", "0.5013841", "0.50132453", "0.501156", "0.5009967", "0.50095373", "0.5007238", "0.4996267", "0.49958476", "0.4993762", "0.49925447", "0.4989099", "0.49881664", "0.49867526", "0.49766442", "0.4974339", "0.49715722" ]
0.76327723
0
Permet d'afficher un user
def show @user = User.find(params[:id]) @titre = "Utilisateur" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_user; end", "def set_user\n puts \"STAN THE MANNNNNNNNNNN\"\n @user = User.find(params[:id])\n end", "def set_user\n @user = User.find(params[:id])\n\n return if unauthorized_local_access(@user.uo_id)\n end", "def set_user\n @user = User.where(:username => params[:id]).first!\n end", "def set_user\n @user = current_agent.users.where('users.username = ?', params[:id]).first\n end", "def set_user\n # @user = User.find(params[:id])\n @user = User.find_by_sql(['SELECT \"users\".* FROM \"users\" WHERE \"users\".\"id\" = ? LIMIT 1', params[:id]])[0]\n end", "def set_user\n @user = User.find(current_user[:id])\n end", "def set_user\n @user = User.find(current_user[:id])\n end", "def change\n @user = current_user\n end", "def set_user\n #@user = User.friendly.find(params[:id])\n \n \n end", "def set_user\n @user = User.find(user_id)\n end", "def set_user\n @user = User.find(params[:id])\n # automatically add user right when we see the user\n # /!\\ it add to every and single user visited!\n if !@user.is_user?\n @user.roles << Role.where(name: 'user').first_or_create\n end\n end", "def set_user\n @user = User.find(current_user)\n end", "def set_user\n @user = User.find(current_user)\n end", "def make_user\n end", "def set_user\n @user = User.find(params[:id])\n\t \n end", "def set_user\n @user = User.find(current_user.id)\n end", "def set_user\n @user = User.find(current_user.id)\n end", "def set_user\n @user = User.find(current_user.id)\n end", "def set_user\n @user = User.find(current_user.id)\n end", "def set_user\n @user = User.find(current_user.id)\n end", "def set_user\n @user = User.find(current_user.id)\n end", "def set_user\n @user = @current_user.admin ? User.find(params['id']) : @current_user\n end", "def set_user\r\n @user = current_user\r\n end", "def set_user\n @user = User.friendly.find(params[:id])\n end", "def set_user\n @user = User.friendly.find(params[:id])\n end", "def set_user\n @user = User.friendly.find(params[:id])\n end", "def set_user\n @user = User.friendly.find(params[:id])\n end", "def set_user\n @user = User.friendly.find(params[:id])\n end", "def set_user\n @user = User.friendly.find(params[:id])\n end", "def set_user\n @user = User.friendly.find(params[:id])\n end", "def set_user\n @user = User.friendly.find(params[:id])\n end", "def set_user\n @user = User.friendly.find(params[:id])\n end", "def set_user\n @user = User.find_by(id: params[:id])&.decorate\n\n redirect_to root_url, alert: 'Usuário não encontrado' if @user.blank?\n end", "def user=(value)\n @user = value\n end", "def user=(value)\n @user = value\n end", "def set_user\n @user = User.find(params[:id]).decorate\n\n end", "def set_user\n id = params[:id] == 'me' ? current_user.login : params[:id]\n @user = LDAP::User.find(id)\n end", "def set_user\n # if User.where(:user_id => ) == nil\n # redirect_to root_path\n # else\n @user = User.find(params[:id])\n refering_user(@user)\n # end\n end", "def set_user\n\t\t@active = \"user\"\n\t\t@user = current_user\n\tend", "def set_user\n @form_user = User.new(:email => self.user_email, :first_name => self.user_first_name,\n :last_name => self.user_last_name)\n @user = User.where(:email => self.user_email).first\n @new_user = false\n if @user.nil?\n @new_user = true\n @user = @form_user\n end\n end", "def set_user\n\t @usuario = User.find(params[:id])\n\t end", "def set_user\n @user = current_user \n end", "def set_user\n @user\n # @user = User.find(params[:id])\n end", "def set_user\n @user = params[:id].nil? ? current_user : User.readable(current_user).find(params[:id])\n end", "def set_user\n\t\t\t@user = User.find(params[:id])\n\t\tend", "def set_user\n\t\t\t@user = User.find(params[:id])\n\t\tend", "def set_user\n\t\t\t@user = User.find(params[:id])\n\t\tend", "def set_user\n @user = User.find_by_id(params[:id])\n require_same_user\n #redirect_to signin_path unless @user #for a route that does not exist redirect it back to home page\n end", "def set_user\r\n @user = User.find(params[:id])\r\n end", "def set_user\n @user = User.find(params[:id]) if params[:id].present?\n return if @user.present?\n @user = user\n end", "def set_user\n @user = User.find_by(id: params[:id])\n if @user\n @user\n else\n redirect_to root_path\n end\n end", "def set_user\n @user = User.find(params[:id])\n \tauthorize [:admin, @user]\n end", "def correct_user(id)\n @user = User.find(id)\n unless current_user? @user\n flash[:danger] = \"Azione non autorizzata\"\n redirect_to groups_path\n end\n end", "def set_user\n @user = User.find_by(username: params[:id])\n end", "def set_user\n\t @user = User.find(params[:id])\n\t end", "def set_user\n\t @user = User.find(params[:id])\n\t end", "def set_user\n\t @user = User.find(params[:id])\n\t end", "def set_user\n @user = User.find(params[:id])\n end", "def set_user\n @user = User.find(params[:id])\n end", "def set_user\n @user = User.find(params[:id])\n end", "def set_user\n @user = User.find(params[:id])\n end", "def set_user\n @user = User.find(params[:id])\n end", "def set_user\n @user = User.find(params[:id])\n end", "def set_user\n @user = User.find(params[:id])\n end", "def set_user\n @user = User.find(params[:id])\n end", "def set_user\n @user = User.find(params[:id])\n end", "def set_user\n @user = User.find(params[:id])\n end", "def set_user\n @user = User.find(params[:id])\n redirect_to admin_users_path, alert: 'You are Unauthorized to access that page' if @user.super_admin?\n end", "def set_user\n @user = User.find_by(name: params[:name]) || current_user\n end", "def set_user\n @user = User.find(params[:id]) or not_found\n end", "def set_user\n @user = User.find(params[:id]) #:id\n end", "def set_user\n if self.current_user and self.current_user.name == 'admin'\n @user = User.find(params[:id])\n else\n @user = User.find(current_user.id)\n end\n end", "def set_user\n @user = User.find(params[:id])\n unless @user == current_user\n redirect_to :index, :alert => \"Access denied.\"\n end\n end", "def set_user\n @user = User.includes(:addresses).find_by_username session[:username]\n end", "def set_user\n id = params[:id] ? params[:id] : params[:user_id]\n @user = User.find(id)\n end", "def set_user\n @cUser = current_user\n puts \"***#{@cUser}\"\n end", "def set_user\n @user = User.find(params[:user_id])\n if @user.blank?\n res_not_found(:user)\n end\n end", "def set_user\n user_id = params['user_id']\n @user = user_id ? User.find(user_id) : User.find(1)\n end", "def set_user\n @user = User.find(params[:user_name])\n end", "def set_user\n @user = User.select('first_name, last_name, email, username, id').find(params[:id])\n end", "def set_user\n puts \"In set user\"\n @user = User.find_by(id: params[:id])\n #redirect_to '/' unless @user\n missing_page unless @user\n end", "def set_usuario\n \n end", "def set_user\n\t\t@user = User.find(params[:id])\n\tend", "def set_user\n\t\t@user = User.find(params[:id])\n\tend", "def set_user\n\t\t@user = User.find(params[:id])\n\tend", "def set_user\n\t\t@user = User.find(params[:id])\n\tend", "def set_user\n\t\t@user = User.find(params[:id])\n\tend", "def set_user\n\t\t@user = User.find(params[:id])\n\tend", "def set_user\n\t\t@user = User.find(params[:id])\n\tend", "def set_user\n\t\t@user = User.find(params[:id])\n\tend", "def set_user\n\t\t@user = User.find(params[:id])\n\tend", "def set_user\n\t\t@user = User.find(params[:id])\n\tend", "def set_user\n\t\t@user = User.find(params[:id])\n\tend", "def set_user\n\t\t@user = User.find(params[:id])\n\tend", "def update_user\n end", "def set_user\n @user = User.find(session[:user_id])\n end", "def set_user\n @user = User.find(session[:user_id])\n end", "def set_user\n @user = current_user\n end", "def set_user\n @user = current_user\n end", "def set_user\n @user = current_user\n end" ]
[ "0.7425988", "0.710629", "0.7079632", "0.6988175", "0.697693", "0.69426143", "0.6921789", "0.6921789", "0.69029236", "0.68942374", "0.6894115", "0.6852207", "0.6847351", "0.6847351", "0.6843697", "0.6839744", "0.68086606", "0.6803851", "0.6803851", "0.6803851", "0.6803851", "0.6803851", "0.678212", "0.67820215", "0.67770916", "0.67770916", "0.67770916", "0.67770916", "0.67770916", "0.67770916", "0.67770916", "0.67770916", "0.67770916", "0.67761225", "0.6762251", "0.6762251", "0.6760912", "0.6760581", "0.6755088", "0.674571", "0.673224", "0.67229414", "0.67138267", "0.6709841", "0.6709237", "0.6691679", "0.6691679", "0.6691679", "0.6691447", "0.66611296", "0.6658874", "0.6656221", "0.6652512", "0.6651291", "0.66491425", "0.6642946", "0.6642946", "0.6642946", "0.6642089", "0.6642089", "0.6642089", "0.6642089", "0.6642089", "0.6642089", "0.6642089", "0.6642089", "0.6642089", "0.6642089", "0.6637418", "0.66321653", "0.663091", "0.6628156", "0.6627481", "0.66269636", "0.662634", "0.6624166", "0.66198367", "0.66163903", "0.6613949", "0.6610809", "0.66100603", "0.6609571", "0.6609488", "0.6609231", "0.6609231", "0.6609231", "0.6609231", "0.6609231", "0.6609231", "0.6609231", "0.6609231", "0.6609231", "0.6609231", "0.6609231", "0.6609231", "0.66075575", "0.6606386", "0.6606386", "0.6602587", "0.6602587", "0.6602587" ]
0.0
-1
Fin de def show Permet d'afficher la page d'un nouvel user
def new @user = User.new @titre = "Inscription" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n set_user\n end", "def show\n unless @user\n render 'not_found_page'\n end\n end", "def show\n # сделать текущего пользователя адмиристратором\n #current_user.update_attribute :admin, true\n @user = User.find(params[:id])\n @title = @user.username\n #@user_internals = @user.user_internals.paginate(page: params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n set_user\n end", "def show\n @user = User.find(params[:id])\n @titre = \"Utilisateur\"\n end", "def show\n verifica_user\n end", "def show\n @user = User.find_by_id(@publicacion.user_id)\n end", "def show\n @user = User.find(params[:id]) # Find user's page to render\n end", "def show\n @user = find_user\n end", "def show\n\t\tif current_user.is_admin\n\t\t\t@user = User.find(params[:id])\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html # show.html.erb\n\t\t\t\tformat.xml { render :xml => @user }\n\t\t\tend\n\t\telse\n\t\t\t\n\t\t\tif(current_user.id.to_i != params[:id].to_i)\n\t\t\t\tflash.now[:notice] = \"I privilegi da te posseduti non sono sufficienti a visualizzare altri utenti\"\n\t\t\tend\n\t\t\t@user = current_user\n\t\t\t\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html\n\t\t\t\tformat.xml { render :xml => @user }\n\t\t\tend\n\t\tend\n\n\tend", "def show\n show_user\n end", "def show\n @user = get_user\n end", "def show\n require_user()\n end", "def show\n\n @user = User.get(params[:id])\n \n if signed_in? && @user.id == current_user.id\n @menu = \"home\"\n @board = \"user\"\n @section = \"show\"\n \n render 'user'\n else\n redirect_to '/'\n end\n end", "def show\n\t\t@user = current_user\n\tend", "def show\n if current_user.access == 2\n redirect_to \"/users/indexU\"\n end\n end", "def show\n\t\t@user = User.find(params[:id]) #find user with that id and save as instance of user\n\t\trender :show\n\tend", "def show\n load_user\n return if (@user.blank?)\n\n respond_to do|format|\n format.html\n end\n end", "def show\n @user = User.find(params[:id])\n \n # A user cant edit or access another users page\n unless session[:user_id] == @user.id && !@user.guest\n flash[:danger] = \"You don't have access to that page!\"\n redirect_to root_url\n end\n end", "def show\n \t# get particular user here\n \t@user = User.find_by_id(params[:id])\n \t# if not @user\n \t# \tredirect_to \"/users\"\n \t# end\n end", "def show\n #here e find the user by its id to display its information. However, we need to impede users without\n # admin privileges to see other users information.\n #so first we check if someone is logged.\n unless current_user.nil?\n #if someone is logged we need to check if the logged user if admin.\n if current_user.admin?\n #if the user is admin we allow finding a user by its id.\n @user = User.find(params[:id])\n #if the logged user is not admin we add the current user in the variable @user, so the show view\n # will display only the current user information.\n else\n @user = current_user\n end\n end\n end", "def show\n # @u = current_user\n end", "def show\n\n @user = User.get(params[:id])\n \n if admin_signed_in?\n @menu = \"home\"\n @board = \"user\"\n @section = \"show\"\n \n render 'admin/users/user'\n else\n redirect_to '/'\n end\n end", "def show \n\t\t@user = User.find(params[:id])\n\t\trender :index\n\tend", "def show\n render_show @user\n end", "def show\n drop_breadcrumb(\"用户管理\",users_path)\n drop_page_title(\"用户详情\")\n drop_breadcrumb\n end", "def show\n check_user\n end", "def show\n \n @user = User.find(session[:id])\n end", "def show\n redirect_to(default_url) unless logged_in? || User.count > 0\n @user = current_user\n end", "def show\n @user = User.find(params[:id])\n # show me the user page\nend", "def show\n @user=current_user\n end", "def show\n @user = User.find(params[:id])\n\n if @user.state != 'active' or @user.login == 'admin'\n return redirect_to users_path\n end\n \n @page_ancestors = [{:name=>'Community', :url=> users_path}]\n @bc_title = 'User Profile'\n \n respond_to do |format|\n format.html # show.html.erb\n format.iphone\n format.xml { render :xml => @user }\n end\n end", "def show\n if params[:id]\n @user = User.find(params[:id])\n else\n @user = current_user\n end\n \n if @user == current_user\n render :show_full\n else\n render :show\n end\n end", "def show\n #@user=current_user\n end", "def show\n redirect_to user_articles_path(@user) unless @user == @current_user\n end", "def show\n @user = Helpers.show_each_user(params[:id])\n check_user_nil('Success', 'User does not exist', @user)\n end", "def show\n if User.find_by(id: params[:id]) && session[:user_id]\n @user = User.find_by(id: params[:id])\n render :show\n else\n redirect_to '/'\n end\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user = User.find(params[:id])\n @action = 'Show'\n end", "def show\n \n if @user.id == current_user.id || current_user.role == \"admin\"\n \n else\n \n redirect_to :root\n flash[:alert] = \"Vous n'avez pas les deroits a acceder ces informations.\"\n end\n end", "def show\n @user = current_user\n end", "def show\n redirect_user\n end", "def show\n\t\tthe_user_id = params[\"id\"]\n \t@user = User.find_by :id => the_user_id\n\tend", "def show\n @user = User.find(session[:user_id])\n end", "def show\n unless @user==User.find(params[:id])\n flash[:notice]= \"You can only see your own profile.\"\n redirect_to root_path\n end\n @user=User.find(params[:id])\n end", "def show\n\t\t@user = User.find(params[:id]) #save the user instance inside @user\n\t\tsession[:user_id] = @user.id\n\tend", "def show\n if !current_user.isAdmin? and current_user.id != @user.id\n redirect_to user_path(current_user.id)\n end\n end", "def show\n\t\t@user = current_user\n\t\trender_wizard\n\tend", "def show\n control_usuario\n end", "def show\n render :show, layout: 'userpage'\n\n end", "def show\n @user = User.find(current_user.id)\n end", "def show \n\t\t@user = User.find_by_id(params[:id])\n\tend", "def show\n user = User.find(current_user.username)\n redirect_to user_path(user)\n end", "def show\n @user = User.find(params[:id])\n render :show\n end", "def show\n @user = User.find(params[:id])\n render :show\n end", "def show\n\t\t@user = User.find(params[:id])\n\tend", "def show\n\t\t@user = User.find(params[:id])\n\tend", "def show\n\t\t@user = User.find(params[:id])\n\tend", "def show\n\t\t@user = User.find(params[:id])\n\tend", "def show\n\t\t@user = User.find(params[:id])\n\tend", "def show\n @user = User.find(params[:id])\n\t@cuser = current_user\n\t@visible = Relationship.where(\"accessed_id = ? AND accessor_id = ? AND accepted = ?\", @user.id, @cuser.id, true).first || Relationship.where(\"accessed_id = ? AND accessor_id = ? AND accepted = ?\", @cuser.id, @user.id, true).first || (@cuser.id == @user.id)\n\t@title = \"#{@user.first_name} #{@user.last_name}\"\n\tif (@user.relationships.find_by_accessed_id(@cuser).nil?)\n\t\t@rel = @cuser.relationships.find_by_accessed_id(@user)\n\telse\n\t\t@rel = @user.relationships.find_by_accessed_id(@cuser)\n\tend\n\t\t\n end", "def show\n @mostkhdmeen_user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostkhdmeen_user }\n end\n end", "def show\n\n if @user.id == current_user.id\n add_breadcrumb \"My Profile\"\n else\n add_breadcrumb @user.name\n end\n\n # get the @prev_record_path and @next_record_path view vars\n get_next_and_prev_object_keys(@user, INDEX_KEY_LIST_VAR)\n @prev_record_path = @prev_record_key.nil? ? \"#\" : user_path(@prev_record_key)\n @next_record_path = @next_record_key.nil? ? \"#\" : user_path(@next_record_key)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @user }\n end\n end", "def show\n update_navbar(@user)\n # 是访客而非页面的主人\n if session[:user_id] != params[:id].to_i\n @user.is_visitor = true\n else\n @user.is_visitor = false\n # 个人主页三大功能之一:创建新的任务\n @mission = Mission.new\n @mission.user_id = session[:user_id]\n @mission.user_token= session[:user_id]\n end\n\n render\n end", "def show\n\t if !current_user #if no current user, default to the \"register new user\" page\n\t \t@user = User.new\n\t \trender :action => 'new_user'\n\t \treturn\n\t end\t \n\tend", "def show\n # @profile = Profile.find(params[:id])\n redirect_to user_page_url(@profile.user)\n end", "def show\n if current_user.id == @user.id || is_admin?\n respond_to do |format|\n\n format.js { render partial: 'show_local',\n locals: {user: @user, current_page: @current_page},\n layout: false }\n format.html # show.html.erb\n format.json # show.json.builder\n format.xml { render :xml => @user.to_xml }\n end\n else\n #indicate_illegal_request I18n.t('users.not-your-account')\n indicate_unauthorised_request I18n.t('users.not-your-account')\n end\n end", "def show\n\t\t@user = User.find_by_md5(params[:id])\n\t\t@admin = User.find(1)\n\t\tsignin_and_active(@user,@admin)\n\n\tend", "def show\n\t\t@user = User.find(params(:id))\n\tend", "def show\n if @user.admin?\n @user = User.find(params[:id])\n end\n end", "def show\n if current_user && current_user.admin? \n @user = User.find(params[:id])\n respond_with user_path(@user)\n else\n flash[:notice] = 'You do not have Admin see users information'\n redirect_to :back\n end\n end", "def show\n if current_user.is_normal?\n @user = User.find( params[:id] )\n render :profile\n else\n redirect_to user_profile_path\n end\n end", "def show\n @my_accounts=@current_user\n\tend", "def show\n @user = @current_user \n @user = User.find( params[:id] ) \n end", "def show\n # @user = User.find(params[:id])\n @user = current_user\n end", "def show\n unless params[:id].blank?\n @user = User.find_by_id(params[:id])\n else\n if logged_in?\n @user = current_user\n else\n require_login and return\n end\n end\n \n if @user.blank?\n flash[:error] = \"User not found\"\n redirect_to root_path and return\n end\n\n @own_profile = (logged_in? && (@user.id == current_user.id))\n\n @page_title = @own_profile ? \"My profile\" : \"View profile\"\n\n @memberships = @user.liga_users.approved.map(&:league)\n end", "def show\n @user = User.find(params[:id])\n if current_user != @user\n redirect_to @user\n end\n end", "def show\n \t@user = User.find(params[:id])\n end", "def show\n \t@user = User.find(params[:id])\n end", "def show\n #Este es un caso especial: el archivo routes establece que User es un recurso, así que cuando llega a la ruta del\n # proyecto, por ejemplo, /project/15, es el perfil del proyecto con id 15, entonces como es un recurso, el controlador\n # automáticamente carga el usuario en la variable @project, listo para la vista. Esto lo hace con el metodo :set_project\n end", "def show\n \t@usuario = Usuario.find_by_nickname(params[:id])\n \tif @usuario\n \t\t#Traer post solo de este usuario\n \t\t#@posts = @usuario.posts.all.order(created_at: :desc).paginate(page: params[:page], per_page: 6)\n @articulos = Articulo.where(\"usuario_id = ?\", \"#{@usuario.id}\").order(created_at: :desc)\n \t \trender :show\n \t else\n \t \trender file: 'public/404', status: 404, formats: [:html]\n \t end \n end", "def show\n @user = User.first\n end", "def show\n authorize @page\n end", "def show\n @page = Page.find(params[:id])\n @users = User.all\n\n @users.delete_if do |user|\n unless user.page_ids.include?(@page.id.to_s)\n true\n end\n end\n\n @users = @users.paginate(page: params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end", "def show\n @empresa = Empresa.find_by(params[:user_id])\n # @empresa = Empresa.find_by_user_id(current_user.id) #buscar en la tabla empresa el user_id que sea igual al id del actual usuarios\n\n end", "def decideur_show\n @user = Admin.where(role_id: 2).order(name: :asc)\n add_breadcrumb 'utilisateur', parametre_admin_path\n add_breadcrumb 'decideurs', parametre_decideurs_path\n render layout: 'fylo'\n end" ]
[ "0.7754268", "0.7669289", "0.7650964", "0.76124954", "0.7576232", "0.7525393", "0.7501673", "0.7491344", "0.74366623", "0.7423454", "0.74190444", "0.7419031", "0.7417646", "0.740664", "0.73871315", "0.73198366", "0.73183495", "0.7300365", "0.7299271", "0.72986585", "0.7296277", "0.72804344", "0.7260671", "0.7245556", "0.72408533", "0.7201667", "0.71938235", "0.7187025", "0.718129", "0.7176638", "0.7158234", "0.7155207", "0.7149441", "0.7138651", "0.712616", "0.71128285", "0.7112619", "0.7111589", "0.7111589", "0.7111589", "0.7111589", "0.7111589", "0.7111589", "0.7111589", "0.7111589", "0.7111589", "0.7111589", "0.7111589", "0.7111589", "0.7111589", "0.7111589", "0.7111251", "0.7110349", "0.7106102", "0.7097464", "0.70913076", "0.708933", "0.7077906", "0.7074987", "0.70721155", "0.70690244", "0.7067522", "0.70668775", "0.7066261", "0.7043163", "0.7033705", "0.7024438", "0.70140874", "0.7001837", "0.7001837", "0.700173", "0.700173", "0.700173", "0.700173", "0.700173", "0.70009625", "0.69950706", "0.6989853", "0.6982942", "0.69796896", "0.69749284", "0.69697535", "0.6968287", "0.6967411", "0.69641", "0.6958869", "0.69516134", "0.6944846", "0.6940114", "0.6924753", "0.6917018", "0.6913993", "0.6912807", "0.6912807", "0.6912101", "0.69106334", "0.69098085", "0.69051963", "0.6904094", "0.69036543", "0.690341" ]
0.0
-1
Fin de def create Permet d'afficher la liste des users
def showUserList @titre = "Liste des utilisateurs" @users = User.all generatePDF(@users) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_list_users\n\n end", "def create_users\n @user_admin = User.create(:email => \"admin@test.tld\", :name => \"Admin user\", :password => \"testtest\", :password_confirmation => \"testtest\", :level => User::LEVEL_ADMINISTRATOR)\n @user_normal = User.create(:email => \"normal@test.tld\", :name => \"Normal user\", :password => \"testtest\", :password_confirmation => \"testtest\", :level => User::LEVEL_NORMAL)\n @user_guest = User.create(:email => \"guest@test.tld\", :name => \"Guest user\", :password => \"testtest\", :password_confirmation => \"testtest\", :level => User::LEVEL_GUEST)\n end", "def create\n @user = current_user.users.new(user_params)\n if @user.save\n @users = current_user.users\n end\n end", "def create\n @user = User.new(params[:user])\n\n # initialize users with a list and a normal userrole.\n @user.lists.build\n @user.lists.each do |list|\n list[:user_id] = \"some fake data here\"\n end\n normal_userrole = Userrole.where(:name => \"Normal\").first\n @user.userroles << normal_userrole\n respond_to do |format|\n if @user.save\n sign_in @user\n format.html { redirect_to(@user, :notice => 'Welcome to Animurecs!') }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n @title = \"Sign up\"\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(params[:user])\n get_list\n\n respond_to do |format|\n if @user.save\n flash[:notice] = \"User #{@user.fname} #{@user.lname} was successfully created.\"\n format.html { redirect_to(:action => :index) }\n format.xml { head :ok }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def users() @users = DiggUsers.new end", "def create_users()\n del_rec = []\n @good_user_records.each do |rec|\n existing_user = @users[rec.fields[\"email\"]]\n # check if the user doesn't exist already\n if (existing_user.nil?)\n\t# check to see if business already exists\n\texisting_business = @businesses[rec.fields[\"businessname\"]]\n\tif (!existing_business.nil?)\n\t new_user = User.new\n\t new_user.create(rec)\n\t existing_business.add_user(new_user)\n\t @users[new_user.email] = new_user\n\telse\n\t rec.is_malformed = true\n\t rec.add_malformed_message(\"ERROR: COMPANY NAME DOESN'T EXIST\")\n\t @bad_user_records << rec\n\t del_rec << rec\n\tend\n #User Already Exists treat it as malformed\n else \n\trec.is_malformed = true\n\trec.add_malformed_message(\"ERROR: USER EMAIL ALREADY EXISTS\")\n\t@bad_user_records << rec\n\tdel_rec << rec\n end\n end\n\n del_rec.each do |rec|\n @good_user_records.delete(rec)\n end\n \n end", "def create_users\n unless @users\n @users = {}\n @users[\"system\"] = User.automatic_creation(\"system\", \"system@toto.fr\", {:weight => 10})\n @users[\"administrator\"] = User.automatic_creation(\"administrator\", \"admin@toto.fr\", {:weight => 10})\n @users[\"blogger_1\"] = User.automatic_creation(\"blogger_1\", \"blogger_1@toto.fr\")\n @users[\"blogger_2\"] = User.automatic_creation(\"blogger_2\", \"blogger_2@toto.fr\")\n @users[\"blogger_expert\"] = User.automatic_creation(\"blogger_expert\", \"blogger_expert@toto.fr\", {:weight => 5})\n @users[\"manufacturer\"] = User.automatic_creation(\"manufacturer\", \"manufacturer@toto.fr\")\n \n assert User.get_user_system\n end\n end", "def create_listserv_user\n User.create!({\n email: 'list-recipient@chat.mindhub.org',\n first_name: 'list-recipient',\n last_name: 'chat.mindhub.org',\n password: 'creativefresno',\n password_confirmation: 'creativefresno',\n remember_me: false\n })\nend", "def list\n\t\t# retrieve all users\n @users = User.find(:all)\n end", "def addToUserList\n $store << [@email,@username,@password]\n puts \"Added user to list\"\n print $store.to_s + \"\\n\"\n end", "def create_users\n puts 'Creating Users'\n\n locations = Location.pluck(:id)\n\n #creates the default known users\n users = default_users\n\n used_names = Set.new\n while users.count < 1000 do\n random_first_name = Faker::Name.first_name\n random_last_name = Faker::Name.last_name\n random_location = locations.sample\n\n user_name = Faker::Internet.user_name(\"#{random_first_name} #{random_last_name}\")\n #ensures that there are only unique names\n next if used_names.include?(user_name)\n email = \"#{user_name}@#{Faker::Internet.domain_name}\"\n\n\n user = User.new(location_id: random_location, user_name: user_name,\n email: email, password: 'CS5200',\n first_name: random_first_name, last_name: random_last_name)\n\n next unless user.valid?\n\n users << user\n used_names.add(user_name)\n end\n #validate is false because secret validation with password prevents the import\n User.import(users, validate: false)\n end", "def list\n response = @client.get(\"/users\")\n response[\"users\"].map {|u| User.new(@client, u) }\n end", "def list\n flash[:notice] = \"Het volg-systeem is neergestort als een mir. Iedereen volgt gewoon iedereen. Wel zo communistisch en makkelijk\";\n @user = User.find(:all)\n end", "def batch_create\n email_list = params[:email_list].split\n @university = current_user.university\n @department = current_user.department\n\n email_list.each do |email|\n # Generate a password and create the user\n generated_password = Devise.friendly_token.first(8)\n user = User.new(:email => email, :password => generated_password, :role => params[:role])\n\n if user.save\n @university.users << user\n @department.users << user\n record_activity(\"created new user (batch): \" + user.email)\n # Send an email with generated password to the user\n UserMailer.welcome_email(user).deliver\n else\n record_activity(\"Failed - created new user (batch): \" + email)\n end\n end\n\n redirect_to users_path\n end", "def users\n \tunless params[:name] == nil\n \t\t@user = User.create(name: params[:name], age: params[:age])\n \tend \n\n \t@users = User.all\n end", "def index\n @new_users = NewUser.all\n end", "def user_list\n @user=User.all\n end", "def affro\r\n @users = User.all\r\n end", "def index\n @list_users = ListUser.all\n end", "def create\n\n # Create new saved list table entry\n @saved_list = SavedList.new\n\n # Store attributes\n @saved_list.login_id = params[:login_id]\n @saved_list.list_name = params[:list_name]\n @saved_list.saved_user_list = true\n @saved_list.date_saved = params[:date_saved]\n\n # Save the saved list\n respond_to do |format|\n if @saved_list.save\n\n # Create new user saved list entries for all users in list\n @user_ids = params[\"user_ids\"]\n @user_ids.each do |user_id|\n SavedListUser.create(saved_list_id: @saved_list.id, user_id: user_id)\n end\n\n format.html { redirect_to @saved_list, notice: 'Saved list was successfully created.' }\n format.json { render :show, status: :created, location: @saved_list }\n else\n format.html { render :new }\n format.json { render json: @saved_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @list_user = ListUser.new(list_user_params)\n\n respond_to do |format|\n if @list_user.save\n format.html { redirect_to @list_user, notice: 'List user was successfully created.' }\n format.json { render :show, status: :created, location: @list_user }\n else\n format.html { render :new }\n format.json { render json: @list_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @message = \"User List\"\n @users = [{name: \"Nitesh\", age: 12},\n {name: \"Nilesh\", age: 14},\n {name: \"Anil\", age: 14}]\n end", "def new_users\n print \"\\nadding 5 new users: \"\n users = []\n 5.times do\n print '.'\n user = User.create!(\n email: Faker::Internet.unique.email,\n password: \"password\",\n first_name: Faker::Superhero.descriptor,\n last_name: Faker::Superhero.suffix\n )\n users << user\n end\n users\nend", "def list\n @all_users = User.find(:all)\n end", "def create\n user = User.create(user_params)\n if user.valid?\n user.username.downcase\n @token = issue_token(user)\n list = List.create(name: user.username)\n list.user_id = user.id\n user.save\n list.save\n render json: { user: UserSerializer.new(user), jwt: @token }, status: :created \n else \n render json: { error: user.errors.full_messages }, status: :not_acceptable\n end \n end", "def new_members\n @members = User.all\n end", "def users\n #adding this instead of the create_users action\n if params[:name] != nil\n @user = User.create(name: params[:name], age: params[:age])\n end\n if(params[:id] != nil)\n\n end\n @users = User.all\n end", "def additional_users_for_new\n []\n end", "def loadUsers()\n @@userid_count+=1\n user1 = User.new(@@userid_count, \"Shweta\", \"Dublin 1\", 1, Array.new)\n @@userid_count+=1\n user2 = User.new(@@userid_count, \"Chirag\", \"Dublin 2\", 5, Array.new)\n @@userid_count+=1\n user3 = User.new(@@userid_count, \"Karishma\", \"Galway\", 5, Array.new)\n\n @users += [user1, user2, user3]\n end", "def list\n log \"retrieving users list from #{users_path}\"\n response = identity_client.get(users_path)\n records = JSON.load(response.body)[\"users\"]\n records.map { |record|\n record[\"username\"]\n }.map { |username|\n Raca::User.new(@account, username)\n }\n end", "def users_create(list, default_domain = nil, opts = { :client => GoodData.connection, :project => GoodData.project })\n default_domain_name = default_domain.respond_to?(:name) ? default_domain.name : default_domain\n domains = {}\n list.map do |user|\n # TODO: Add user here\n domain_name = user.json['user']['content']['domain'] || default_domain_name\n\n # Lookup for domain in cache'\n domain = domains[domain_name]\n\n # Get domain info from REST, add to cache\n if domain.nil?\n d = GoodData::Domain[domain_name, opts]\n domain = {\n :domain => d,\n :users => d.users(opts)\n }\n\n domain[:users_map] = Hash[domain[:users].map { |u| [u.email, u] }]\n domains[domain_name] = domain\n end\n\n # Check if user exists in domain\n domain_user = domain[:users_map][user.email]\n\n # Create domain user if needed\n unless domain_user\n password = user.json['user']['content']['password']\n\n # Fill necessary user data\n user_data = {\n :login => user.login,\n :firstName => user.first_name,\n :lastName => user.last_name,\n :password => password,\n :verifyPassword => password,\n :email => user.login\n }\n\n tmp = user.json['user']['content']['sso_provider']\n user_data[:sso_provider] = tmp if tmp && !tmp.empty?\n\n tmp = user.json['user']['content']['authentication_modes']\n user_data[:authentication_modes] = tmp && !tmp.empty?\n\n # Add created user to cache\n domain_user = domain[:domain].add_user(opts.merge(user_data))\n domain[:users] << domain_user\n domain[:users_map][user.email] = domain_user\n end\n domain_user\n end\n end", "def users(id)\n Request::Roles.list_users(id).map { |user| new user }\n end", "def save\n @@userList.push self\n self\n end", "def create_users(list, default_domain = nil, opts = { :client => GoodData.connection, :project => GoodData.project })\n client = client(opts)\n default_domain_name = default_domain.respond_to?(:name) ? default_domain.name : default_domain\n domain_obj = client.domain(default_domain_name)\n domains = {}\n list.map do |user|\n begin\n user_data = user.to_hash\n # TODO: Add user here\n domain_name = user_data[:domain] || default_domain_name\n\n # Lookup for domain in cache'\n domain = domains[domain_name]\n\n # Get domain info from REST, add to cache\n if domain.nil?\n domain = {\n :domain => domain_obj,\n :users => domain_obj.users\n }\n\n domain[:users_map] = Hash[domain[:users].map { |u| [u.login, u] }]\n domains[domain_name] = domain\n end\n\n # Check if user exists in domain\n domain_user = domain[:users_map][user_data[:login]]\n\n # Create domain user if needed\n if !domain_user\n # Add created user to cache\n domain_user = domain[:domain].add_user(user_data, opts)\n domain[:users] << domain_user\n domain[:users_map][domain_user.login] = domain_user\n { type: :user_added_to_domain, user: domain_user }\n else\n # fields = [:firstName, :email]\n diff = GoodData::Helpers.diff([domain_user.to_hash], [user_data], key: :login)\n next if diff[:changed].empty?\n\n domain_user = domain[:domain].update_user(domain_user.to_hash.merge(user_data.compact), opts)\n domain[:users_map][domain_user.login] = domain_user\n { type: :user_changed_in_domain, user: domain_user }\n end\n rescue RuntimeError => e\n { type: :error, reason: e }\n end\n end\n end", "def list_users\n @users = User.find(:all)\n end", "def users()\n\t\t\tend", "def new_user_create\n @user = User.create_user(user_params, current_user.account_id) # New User\n begin\n @user.save!\n @users = User.get_all(current_user.account_id)\n flash[:success] = \"User was created successfully!\"\n rescue => e\n flash[:alert] = \"User creation failed!\"\n end \n end", "def add_existing_users(users)\n users.map do |user|\n @current_course.course_users.build(user: user[:user], name: user[:name],\n workflow_state: :approved, creator: @current_user,\n updater: @current_user)\n end\n end", "def set_users\n\n end", "def add_existing_users(users)\n users.map do |user|\n @current_course.course_users.build(user: user[:user], name: user[:name],\n creator: @current_user,\n updater: @current_user)\n end\n end", "def create\n list = current_user.lists.build(params[:list])\n list.current_users << current_user\n\n if list.save\n flash[:notice] = t('messages.list.success.create', title: list.title)\n redirect_to list_experts_url(list)\n else\n flash[:alert] = t('messages.list.errors.create')\n redirect_to lists_url\n end\n end", "def create\n @user = current_user.users.build(user_params)\n\n if @user.save\n render json: @user\n else\n @user_items = []\n end\n end", "def index\n @title = \"Nos utilisateurs\"\n @description = \"Liste de nos plus fervents utilisateurs\"\n @users = User.all\n end", "def create\n @all = Users.find_users\n @approve = true\n @all.each do |a|\n if (a.username == params[ :username ]) \n @approve = false\n end\n end\n if(@approve == false)\n redirect_to :action => 'used'\n else\n @user=Users.create(params[ :email ],params[ :username ],params[ :password ],params[ :mobilenum ])\n end\n end", "def create\n @collaborator = Listable::Collaborator.new(params[:collaborator])\n \n @collaborator.list = @list\n @collaborator.creator = current_user\n\n unless @user = User.find_by_email(@collaborator.email)\n pw = ('a'..'z').sort_by {rand}[0,15].join # Give new user a crazy random password\n @user = User.new(:password => pw, :password_confirmation => pw, :email => @collaborator.email, :login => @collaborator.email, :creator => current_user)\n end\n \n if @user.save && link = create_user_list_link(@user, :list => @list, :creator => current_user)\n @collaborator.login = @user.login\n \n msg = \"Your list has been shared with #{@collaborator.email}\"\n msg += \" (Listable user #{@collaborator.login})\" unless @collaborator.email == @collaborator.login\n \n Notifier.deliver_new_invitation_notification(current_user, @user, @list)\n\n flash[:notice] = msg\n \n respond_to do |format|\n format.html do\n redirect_to list_collaborators_path(@list)\n end\n \n format.json { render :status => 200, :json => {:message => ''} }\n end\n \n else\n\n respond_to do |format|\n format.html do\n if @list.users.find_by_email(@collaborator.email)\n flash[:error] = \"User #{@collaborator.email} has already been added to this list.\"\n else\n flash[:error] = \"An unknown error has occurred\"\n end\n render :action => :new\n end\n \n format.json { render :status => 400, :json => {:message => 'Unable to subscribe user to list'} }\n end\n\n end\n end", "def add_users(users)\n users.each do |user|\n @users.push(user)\n end\n end", "def get_random_user_list \n @users = user_list.sample(5).insert(rand(5), {name: \"ME\", bot: false})\n end", "def list\n # ask the user_repository for a list of all the users\n users = @user_repository.all\n # pass that list to the view to display\n @view.list_users(users)\n end", "def users\n \n end", "def list_all_users\n\n end", "def lists\n load_user_lists\n end", "def create\n puts params[\"user_ids\"]\n puts \"in create\"\n if params[:new_list_name].nil? || params[:new_list_name].blank? && params[:list_name] != \"\" && !params[\"user_ids\"].nil?\n puts \"in creating from existing\"\n @list_name = params[:list_name]\n @saved_list = SavedList.find(params[:list_name])\n @user_ids = params[\"user_ids\"]\n @int_user_ids = @user_ids.map(&:to_i) #Changing string ids to integer\n\n # Removes duplicates from Saved Lists\n # Authored by Ryan Hilsabeck(previous version did not remove duplicates)\n @saved_list_user_ids = Array.new\n @saved_list.users.each do |u|\n @saved_list_user_ids.push (u.id)\n end\n\n @new_ids_for_list = Array.new\n\n @int_user_ids.each do |u|\n if @saved_list_user_ids.index(u)\n puts \"it exists\"\n else\n @new_ids_for_list.push (u)\n end\n end\n # End remove duplicates code\n\n @new_ids_for_list.each do |user_id|\n SavedListUser.create(saved_list_id: @saved_list.id, user_id: user_id)\n end\n @saved_list.save\n redirect_to @saved_list\n elsif !params[\"user_ids\"].nil? && (params[:new_list_name] != \"\" && !params[:new_list_name].nil? || !params[:new_list_name].blank?)\n puts \"in trying to create new list\"\n # Create new saved list table entry\n @saved_list = SavedList.new\n # Store attributes\n @saved_list.list_name = params[:new_list_name]\n @saved_list.login_id = params[:login_id]\n @saved_list.date_saved = params[:date_saved]\n @saved_list.saved_user_list = true\n # Save the saved list\n respond_to do |format|\n if @saved_list.save\n\n # Create new user saved list entries for all users in list\n @user_ids = params[\"user_ids\"]\n @int_user_ids = @user_ids.map(&:to_i) #Changing string ids to integer\n\n # Removes duplicates from Saved Lists\n # Authored by Ryan Hilsabeck(previous version did not remove duplicates)\n @saved_list_user_ids = Array.new\n @saved_list.users.each do |u|\n @saved_list_user_ids.push (u.id)\n end\n\n @new_ids_for_list = Array.new\n\n @int_user_ids.each do |u|\n if @saved_list_user_ids.index(u)\n puts \"it exists\"\n else\n @new_ids_for_list.push (u)\n end\n end\n # End remove duplicates code\n\n @new_ids_for_list.each do |user_id|\n SavedListUser.create(saved_list_id: @saved_list.id, user_id: user_id)\n end\n\n format.html { redirect_to @saved_list, notice: 'Saved list was successfully created.' }\n format.json { render :show, status: :created, location: @saved_list }\n else\n format.html { render :new }\n format.json { render json: @saved_list.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to saved_lists_path\n end\n end", "def create\n @user = User.new(params[:user])\n\trecipe_list = RecipeList.create\n\t@user.recipe_list = recipe_list\n respond_to do |format|\n if @user.save\n format.html { redirect_to(root_url, :notice => 'Registration successful') }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @list = List.new(params[:list])\n @list.user = current_user\n if @list.save\n user_session.select_list @list\n flash[:notice] = 'Lista criada com sucesso!'\n redirect_to edit_list_nomes_path\n else\n flash[:notice] = 'Não foi possível uma nova lista!'\n render :action => \"new\"\n end\n end", "def index\n @action = \"New\"\n @users = User.all\n @user = User.new\n end", "def users\n []\n end", "def create_users\n\n @user1 = User.create!(email:'cat@gmail.com', username: 'cat', password:'valid_password', password_confirmation: 'valid_password',\n remote_avatar_url:'http://4.bp.blogspot.com/-19SuhOvHCGw/Tt3aKiuFUQI/AAAAAAAAAbQ/-lGmEbkMc7s/s1600/woman-cooking-women-at-war-magazine-uk-1942.jpg')\n @user2 = User.create!(email:'mary@gmail.com', username: 'mary', password:'valid_password', password_confirmation: 'valid_password',\n remote_avatar_url:'http://weedmemes.com/wp-content/uploads/2015/12/grow-your-own-harvest-weedmemes.jpg')\n @user3 = User.create!(email:'coco@gmail.com', username: 'coco', password:'valid_password', password_confirmation: 'valid_password',\n remote_avatar_url:'https://i.pinimg.com/736x/54/3e/67/543e67ac2aa73013f73d4893b60b4338--cannabis-quotes-marijuana-humor.jpg')\n @user4 = User.create!(email:'lena@gmail.com', username: 'lena', password:'valid_password', password_confirmation: 'valid_password',\n remote_avatar_url:'https://s-media-cache-ak0.pinimg.com/originals/2d/e7/c4/2de7c46aebbe2111b92e81476ab25f36.jpg')\n @user5 = User.create!(email:'william@gmail.com', username: 'william', password:'valid_password', password_confirmation: 'valid_password',\n remote_avatar_url:'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQ4XvFsBYUIwpxWs0t-IeX_AbO-W2MhCl0SCtfR5m6datTAojjC')\n @user6 = User.create!(email:'tyler@gmail.com', username: 'tyler', password:'valid_password', password_confirmation: 'valid_password',\n remote_avatar_url:'https://s-media-cache-ak0.pinimg.com/736x/43/14/b9/4314b9927bf6e205b78939d09029caf0.jpg')\n\n# rescue Exception => e\n#\nend", "def non_creators(list, users)\n members = []\n users.each do |user|\n if !List.is_creator?(list, user)\n members << user\n end\n end\n members\n end", "def admin\n @userList = User.all\n end", "def create\n\t\t@user = User.new(params.require(:user).permit(:first_name, :last_name, :email, :password, :password_confirmation))\n\t\t@user.safety_schools = []\n\t\t@user.target_schools = []\n\t\t@user.reach_schools = []\n\n\t\t# if the creation is successful, user is directed to their profile where they can start adding schools to their lists\n\t\tif @user.save \n\t\t\tsession[:user_id] = @user.id.to_s\n\t\t\tflash[:info] = \"Welcome! Start adding schools to your list!\" \n\t\t\tredirect_to profile_path\n\t\telse\n\t\t# if the creation is unsuccessful, the new user form is rendered again and the user is told the errors in sentence form\n\t\t\tflash.now[:danger] = @user.errors.full_messages.to_sentence\n\t\t\trender :new\n\t\tend \n\n\tend", "def create_new_user\r\n touch(\"* id:'#{add}'\")\r\n end", "def new\n \t@risco = Risco.find(params[:risco_id])\n @project = Project.find(@risco.project_id)\n @acao = Acao.new\n @members = Member.where(project_id: @project.id)\n @users = []\n @members.each do |member|\n @users += User.where(id: member.user_id)\n end\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @acao }\n end\n end", "def list\n get('users')['users']\n end", "def build_default_interested_users_list\n self.create_interested_users_list\n true\n end", "def create\n @database = Database.new(params[:database])\n @database.created_by = User.find_by_id(params[:database][:user_id])\n params[:users].each { |id| @database.add_user User.find_by_id(id) } if params[:users]\n respond_to do |format|\n if @database.save\n flash[:notice] = 'Database was successfully created.'\n format.html { redirect_to(@database) }\n else\n @users = User.find(:all)\n format.html { render :action => \"new\" }\n end\n end\n end", "def get_user_list\n return User.find(:all, :order => 'last_name ASC').collect {|user| [user.full_name, user.id]}\n end", "def form_prep\n @users = User.all\n end", "def create\n @errors = validate(user_params)\n @user = LinkedData::Client::Models::User.new(values: user_params)\n\n if @errors.size < 1\n @user_saved = @user.save\n if response_error?(@user_saved)\n @errors = response_errors(@user_saved)\n # @errors = {acronym: \"Username already exists, please use another\"} if @user_saved.status == 409\n render action: \"new\"\n else\n # Attempt to register user to list\n if params[:user][:register_mail_list]\n Notifier.register_for_announce_list(@user.email).deliver rescue nil\n end\n\n flash[:notice] = 'Account was successfully created'\n session[:user] = LinkedData::Client::Models::User.authenticate(@user.username, @user.password)\n redirect_to_browse\n end\n else\n render action: \"new\"\n end\n end", "def generate_users\n @users = (1..GEN_USERS).to_a\n (1..@users.length).each do |user|\n username = Faker::Internet.user_name\n email = Faker::Internet.safe_email(username)\n unless User.create!(username: username, email: email)\n puts \"*********** ERROR ******************\"\n end\n end\nend", "def index\n\t\t@users = User.all\n\tend", "def index\n\t\t@users = User.all\n\tend", "def index\n\t\t@users = User.all\n\tend", "def index\n\t\t@users = User.all\n\tend", "def index\n\t\t@users = User.all\n\tend", "def index\n\t\t@users = User.all\n\tend", "def index\n @title = \"User List\"\n @users = User.all\n end", "def users\n\n end", "def all\n response = conn.get do |request|\n request.url \"/v1/admin/users.json\"\n end\n\n response.body[\"users\"].map {|attributes| Nuwe::User.new(attributes)}\n end", "def create\n @list = current_user.lists.build(params[:list])\n @list.user = current_user\n @user = @list.user\n respond_to do |format|\n if @list.save\n \n format.html { redirect_to root_path, notice: 'List was successfully created!' }\n format.json { render json: @user, status: :created, location: @user }\n else\n @feed_items = []\n format.html { render action: \"new\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_user(user)\n @users << user\n end", "def new\n @user = User.new\n @users_array = User.select(\"email\")\n \n render \"new\"\n end", "def initialize\n @Users = Array.new \n end", "def create\n @list = @user.lists.create(list_params)\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @list = List.new(list_params)\n \n # If user cannot enter in field it sets to their user id\n if @list.user_id.blank?\n if current_user\n @list.user_id = current_user.id\n end\n end\n # For admins to assign as ANON\n if @list.user_id == 0\n @list.user_id = nil\n end\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def users\n\t\t\telems = []\n\t\t\tget_resource_link(:users, \"users\", \"user\").each do |data|\n\t\t\t\telems << data\n\t\t\t\t# elems << User.new(data)\n\t\t\tend\n\t\t\telems\n\t\tend", "def index\n\t\t@user = User.new\n\tend", "def newUser(nom)\n File.open($userPath + \"users.txt\", \"a\")\n File.chmod(0777,$userPath + \"users.txt\")\n File.write($userPath + \"users.txt\", nom+\"\\n\", mode: \"a\")\n\n ##Ajout des dossiers 'Libre' et 'Aventure' \n ##qui contiendront les sauvegardes de ces modes respectifs \n $userPath += nom+\"/\"\n Dir.mkdir($userPath)\n Dir.mkdir($userPath+\"Libre/\")\n Dir.mkdir($userPath+\"Aventure/\")\n Dir.mkdir($userPath+\"Tuto/\")\n\n ##Ajout des premiers fichiers nécessaires pour un nouvel utilisateur\n File.open($userPath+\"Libre/config.txt\", \"w\")\n File.open($userPath+\"Aventure/config.txt\", \"w\")\n File.open($userPath+\"Tuto/config.txt\", \"w\")\n\n File.open($userPath+\"succes.txt\", \"w\")\n File.chmod(0777,$userPath + \"succes.txt\")\n i = 0\n while i <= 11 do\n File.write($userPath+\"succes.txt\", \"false 0 0\\n\", mode: \"a\")\n i+=1\n end\n return self\n end", "def users_list\r\n @users_list = User.order_by_asc('name').find(:all, :conditions => [\"group_id <> ?\", Group.get_guest.id])\r\n if params[:users]\r\n @users_list = User.get_user_list params\r\n end\r\n end", "def create\n @coleccionista = Coleccionista.new(params[:coleccionista])\n\n respond_to do |format|\n if @coleccionista.save\n \n @coleccionista.users << current_user\n @coleccionista.save\n \n format.html { redirect_to(@coleccionista, :notice => 'Coleccionista was successfully created.') }\n format.xml { render :xml => @coleccionista, :status => :created, :location => @coleccionista }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @coleccionista.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @users = User.new(params[:user])\n\n respond_to do |format|\n if @users.save\n format.html { redirect_to @users, notice: 'Regist was successfully created.' }\n format.json { render json: @users, status: :created, location: @users }\n else\n format.html { render action: \"new\" }\n format.json { render json: @users.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_secure_users(list_of_user)\n list_of_user.each do |user|\n user[:password] = create_new_hash(user[:password])\n end\n list_of_user\n end", "def users_list\n\t\t\tpost= { \"token\" => @token }\n\t\t\tdocxml = nil\n\t\t\tdocxml=nessus_request('users/list', post)\n\t\t\tif docxml.nil?\n\t\t\t\treturn\n\t\t\tend\n\t\t\tusers=Array.new\n\t\t\tdocxml.root.elements['contents'].elements['users'].each_element('//user') { |user|\n\t\t\t\tentry=Hash.new\n\t\t\t\tentry['name']=user.elements['name'].text\n\t\t\t\tentry['admin']=user.elements['admin'].text\n\t\t\t\tentry['lastlogin']=user.elements['lastlogin'].text\n\t\t\t\tusers.push(entry)\n\t\t\t}\n\t\t\treturn users\n\t\tend", "def create_life_list\n life_list = LifeList.create(:user => self)\n self.life_list = life_list\n self.save\n end", "def list\n @user = User.all(:order => :login) # sort by login name\n end", "def set_users\n @can_change_owner = policy(@run || Run).current_user_allowed_to_crud?\n @users = policy_scope(User).map{|u| [ u.name, u.id ] } if @can_change_owner\n end", "def user(*args)\n @users << User.add(*args)\n end", "def add_new_users(users)\n user = users.first\n wait_until_bus_section_load\n user_group_select.select(user.user_group) unless user.user_group.nil?\n storage_type_select.select(user.storage_type) unless user.storage_type.nil?\n storage_max_tb.type_text(user.storage_limit) unless user.storage_limit.nil?\n device_tb.type_text(user.devices) unless user.devices.nil?\n\n unless user.enable_stash.nil?\n if user.enable_stash.downcase.eql?('yes')\n enable_stash_cb.check\n else\n enable_stash_cb.uncheck\n end\n end\n\n users.each_index do |index|\n Log.debug \"##########adding the #{index} user\"\n find(:id, \"user#{index+1}_name\").type_text(users[index].name)\n find(:id, \"user#{index+1}_username\").type_text(users[index].email)\n add_user_btn.click if index != users.length-1\n end\n\n unless user.send_email.nil?\n if user.send_email.downcase.eql?('yes')\n send_emails_cb.check\n else\n send_emails_cb.uncheck\n end\n end\n\n submit_btn.click\n wait_until_bus_section_load\n end", "def add_user(name)\n\t@users << {:name => name}\n end", "def index\n \t@users = User.all\n \tend", "def add_users_to_cc_list(user_ids)\n user_ids.each { |id| self.users << User.find(id) }\n self.save\n end" ]
[ "0.7537084", "0.7170311", "0.6947841", "0.6914339", "0.68977755", "0.6812174", "0.6793629", "0.6735086", "0.6730102", "0.6688161", "0.6618217", "0.658859", "0.65717727", "0.65678287", "0.65619665", "0.6558257", "0.654893", "0.6539257", "0.65384805", "0.65250003", "0.6522454", "0.6497962", "0.64928967", "0.648982", "0.6488151", "0.6483063", "0.64824164", "0.6474697", "0.64681333", "0.64550424", "0.64516485", "0.6436014", "0.64326125", "0.642753", "0.64274865", "0.641938", "0.6415034", "0.63954955", "0.639494", "0.6392767", "0.6390259", "0.63851106", "0.63773257", "0.6377192", "0.6367422", "0.6361732", "0.6346542", "0.63458014", "0.6340005", "0.63355994", "0.63261586", "0.63233024", "0.63128936", "0.6309357", "0.63076115", "0.62999433", "0.629823", "0.6298003", "0.6295772", "0.62887615", "0.62821984", "0.62764", "0.62712073", "0.62612903", "0.62340057", "0.62327343", "0.6230772", "0.6221524", "0.6216124", "0.6204072", "0.61989397", "0.61989397", "0.61989397", "0.61989397", "0.61989397", "0.61989397", "0.6198664", "0.6194588", "0.61858255", "0.6178627", "0.6177555", "0.61691713", "0.6166552", "0.61662686", "0.61644375", "0.6159628", "0.6157146", "0.615399", "0.61444336", "0.6141999", "0.61405146", "0.61292756", "0.6124854", "0.61222893", "0.6121682", "0.61213815", "0.61172473", "0.611407", "0.61131376", "0.6106744", "0.61040705" ]
0.0
-1
Fin de def showUserList Permet d'afficher la liste des users non sportif voulant faire du sport
def showNonSportifList @users = User.where(isSportif: false, wantDoSport: true) @titre = "Liste des utilisateurs non sportifs" generatePDFnonSportif(@users) render 'showUserList' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list\n flash[:notice] = \"Het volg-systeem is neergestort als een mir. Iedereen volgt gewoon iedereen. Wel zo communistisch en makkelijk\";\n @user = User.find(:all)\n end", "def list\n # ask the user_repository for a list of all the users\n users = @user_repository.all\n # pass that list to the view to display\n @view.list_users(users)\n end", "def show\n @list = current_user.list\n end", "def showUserList\n @titre = \"Liste des utilisateurs\"\n @users = User.all\n generatePDF(@users)\n end", "def index\n @list_users = ListUser.all\n end", "def user_list\n @room = current_user.room\n @user_list = @room.users\n render partial: \"user_list\"\n end", "def index\n @title = \"Nos utilisateurs\"\n @description = \"Liste de nos plus fervents utilisateurs\"\n @users = User.all\n end", "def users_list\r\n @users_list = User.order_by_asc('name').find(:all, :conditions => [\"group_id <> ?\", Group.get_guest.id])\r\n if params[:users]\r\n @users_list = User.get_user_list params\r\n end\r\n end", "def show_users\n @users = User.all\n end", "def show\n @user_list= []\n \n @customtable = CustomeTable.where(:identifier_id => @hackathon.id)\n @reguser = Registration.where(:hackathon_id => @hackathon.id)\n \n @reguser.each do |user| \n u = User.find(user.userId)\n @user_list.push(u.user_name)\n end\n end", "def user_list\n current_user_cards = current_user.cards\n if !current_user_cards || current_user_cards.size.to_i == 0\n flash[:notice] = _('You_have_no_view_permission')\n redirect_to(:root) && (return false)\n end\n\n @page_title = _('Card_groups')\n\n session[:cardgroup_search_options] ||= {}\n\n @options = {\n 's_number' => '',\n 's_pin' => '',\n 's_balance_max' => '',\n 's_balance_min' => '',\n 's_sold' => '',\n 's_caller_id' => ''\n }\n\n @pin_visible = Confline.get_value('CCShop_hide_pins_for_distributors').to_i.zero?\n @options = @options.merge(session[:cardgroup_search_options])\n\n @cardgroups = Cardgroup.select('cardgroups.*, COUNT(cards.id) AS card_count').joins('LEFT JOIN cards ON (cards.cardgroup_id = cardgroups.id and cards.hidden = 0)').where(['cards.user_id = ?', current_user_id]).group('cardgroups.id').all\n end", "def index\n @all_users = User.all\n\trender \"list_users\"\n end", "def users_by_name\n if in_admin_mode?\n query = create_query(:User, :all, by: :name)\n show_selected_users(query)\n else\n flash_error(:permission_denied.t)\n redirect_to(action: \"list_rss_logs\")\n end\n end", "def list\n @users = User.where(organization: false)\n\n render \"list\"\n end", "def list\n\t\t# retrieve all users\n @users = User.find(:all)\n end", "def index\n @message = \"User List\"\n @users = [{name: \"Nitesh\", age: 12},\n {name: \"Nilesh\", age: 14},\n {name: \"Anil\", age: 14}]\n end", "def list\n @all_users = User.find(:all)\n end", "def index_user\n\t\t@user_convos = Conversation.involving_user(params[:user_id])\n\t\trender_list_of_convos(@user_convos)\n\tend", "def show \n available_users\n end", "def users_by_name # :norobots:\n if is_in_admin_mode?\n query = create_query(:User, :all, by: :name)\n show_selected_users(query)\n else\n flash_error(:permission_denied.t)\n redirect_to(action: \"list_rss_logs\")\n end\n end", "def index\n @users = @user.users\n render layout: false\n end", "def list\n\t\t\t# Author\n\t\t\tauthorize! :manage, User\n\n\t\t\t# Get params\n\t\t\tpage \t\t\t= \t(params[:page] || 1).to_i\n\t\t\tper \t\t\t=\t(params[:per] || 24).to_i\n\t\t\tsearch_params \t=\tparams[:search] || {}\n\t\t\torder_params \t= \tparams[:order] || {}\n\n\t\t\t# Get users\n\t\t\tusers = User.list_search_with_params search_params, order_params\n\n\t\t\t# Render result\n\t\t\trespond_to do |f|\n\t\t\t\tf.html {\n\t\t\t\t\trender 'list',\n\t\t\t\t\t\tlayout: 'layout_back',\n\t\t\t\t\t\tlocals: {\n\t\t\t\t\t\t\tusers: \tusers,\n\t\t\t\t\t\t\tpage: \tpage,\n\t\t\t\t\t\t\tper: \tper\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tf.json {\n\t\t\t\t\tusers_in_page = users.page page, per\n\n\t\t\t\t\t# Check if empty\n\t\t\t\t\tif users_in_page.count == 0\n\t\t\t\t\t\trender json: {\n\t\t\t\t\t\t\tstatus: 1\n\t\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\trender json: {\n\t\t\t\t\t\t\tstatus: 0,\n\t\t\t\t\t\t\tresult: {\n\t\t\t\t\t\t\t\tlist: render_to_string(\n\t\t\t\t\t\t\t\t\tpartial: 'list',\n\t\t\t\t\t\t\t\t\tformats: :html,\n\t\t\t\t\t\t\t\t\tlocals: {\n\t\t\t\t\t\t\t\t\t\tusers: users_in_page\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tpaginator: render_to_string(\n\t\t\t\t\t\t\t\t\tpartial: '/shared/pagination',\n\t\t\t\t\t\t\t\t\tformats: :html,\n\t\t\t\t\t\t\t\t\tlocals: {\n\t\t\t\t\t\t\t\t\t\ttotal: \tusers.count,\n\t\t\t\t\t\t\t\t\t\tper: \tper,\n\t\t\t\t\t\t\t\t\t\tpage: \tpage\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\tend\n\t\tend", "def list\n \n @allPeople = User.all.order('name ASC')\n @allNonUser = NonUser.all.order('name ASC')\n @allVets = Veterinarian.all.order('name ASC')\n @allTrainer = Trainer.all.order('name ASC')\n @allAniFaci = AnimalFacility.all.order('name ASC')\n user = User.all.order('name ASC')\n end", "def show\n @users = User.all\n end", "def show\n @users = User.all\n end", "def show\n @users = User.all\n end", "def show\n @users = User.all\n end", "def index\n if current_user && current_user.admin? \n @users = User.all\n respond_with users_path\n else\n flash[:notice] = 'You do not have rights to see the list of users.'\n redirect_to home_index_path\n end\n end", "def index # Used for list of favorites or followers/followings list\n @users = User.all\n end", "def listing\n @user = User.all\n unless current_user.admin?\n redirect_to dashboard_show_path\n end \n end", "def list_users\n @users = User.find(:all)\n end", "def users_index\n\t\t@view.users_list($users)\n\t\t@view.second_view(@current_user, @current_user.actions)\n\tend", "def new_list_users\n\n end", "def index \n\t @users = User.limit(4)\n if @users.present?\n render_collection(@users, 'user', User, \"users list...!\")\n else\n render_error(\"Not avalable user...!\")\n end\n end", "def index\n @title = \"User List\"\n @users = User.all\n end", "def index\n\t\t@users = User.paginate :per_page=>10, :page=>params[:page],\n\t\t\t:order=>'users.nickname'\n\t\t@page_title = 'User List'\n\tend", "def get_users_list\n service_response = AdminManagement::Users::UserList.new(params).perform\n render_api_response(service_response)\n end", "def user_list\n @user=User.all\n end", "def show_Users\n theUsers = User.select{ |user| user.group_id == self.id}\n theUsers\n end", "def index\n # only admins see the whole user list\n if current_user && current_user.is_admin\n @users = User.all\n render :index\n else\n redirect_to \"/\"\n end\n end", "def get_users\n\t\t\t@users = User.all.where(:on_beverage_list => true).order('firstname, lastname')\n\t\tend", "def index\n if current_user.admin?\n @users = User.all.paginate(:page => params[:page])\n else\n @users = User.where(unidade_id: current_user.unidade_id).paginate(:page => params[:page])\n end\n end", "def index\n @users = UserService.getAllUserList\n end", "def index\n @lists = current.user.list\n end", "def index\n @page_title = \"CBCL - Liste af Brugere\"\n @sort = params[:sort] || 'users.created_at'\n @order = params[:order] || \"asc\"\n\n @users = current_user.get_users(:page => params[:page], :per_page => Journal.per_page, :sort => params[:sort], :order => params[:order])\n\n if !params[:partial]\n render\n else\n render :partial => 'users/users', :layout => false\n end\n end", "def list_all_users\n\n end", "def index\n @corporate_users = User.get_all_users(current_user).where.not(id: current_user.id)\n @corporate_users = @corporate_users.paginate(:page => params[:page],:per_page => 10).order('id DESC')\n end", "def lista_users\n if params[:type_of].to_i == 6\n @role_users = RolesUser.find(:all, :joins => :user, :order => 'login ASC')\n else\n if params[:type_of].to_i == 1\n @role_users = RolesUser.find(:all, :joins => :user, :conditions => [\"users.unidade_id = ?\", current_user.unidade_id],:order => 'login ASC')\n end\n end\n\n render :update do |page|\n page.replace_html 'users', :partial => \"users\"\n end\n\n end", "def users\n unless @users\n userListService = $viewContext.getViewService(OTUserListService.java_class)\n @users = userListService.getUserList().sort_by { |user| #sort users by name\n (user.name && !user.name.empty?) ? user.name.downcase.split.values_at(-1, 0) : [''] \n }\n end\n @users\n end", "def users\n unless @users\n userListService = $viewContext.getViewService(OTUserListService.java_class)\n @users = userListService.getUserList().sort_by { |user| #sort users by name\n (user.name && !user.name.empty?) ? user.name.downcase.split.values_at(-1, 0) : [''] \n }\n end\n @users\n end", "def list_users\n tp @users, :real_name, :slack_id, :user_name => {:display_method => :name}\n end", "def list\n # ask the repo for a list of all the users\n users = @repo.all\n # pass that list to the view to display\n @view.list_users(users)\n end", "def users\n @page_title = _('Users for calendar %{calendar_name}') % {:calendar_name => @calendar}\n @users = @calendar.users.order :lastname, :firstname\n end", "def show\n @lists = @cocktail.lists.where(user_id: @current_user)\n # raise \"hell\"\n end", "def list\n authorize :user\n if params[:wedgetail].to_s!=\"\"\n redirect_to :action => \"show\", :wedgetail => params[:wedgetail]\n elsif !(params[:family_name].to_s==\"\" && params[:given_names].to_s==\"\")\n @patients = User.paginate(:page => params[:page],:per_page => 10, :order => 'family_name,wedgetail DESC, created_at DESC', :conditions => [\"visibility=? and family_name like ? and (given_names like ? or known_as like ?) and role=5\", true,params[:family_name].to_s+\"%\",params[:given_names].to_s+\"%\",params[:given_names].to_s+\"%\"])\n end\n render :layout=>'layouts/standard'\n end", "def index\n\n\n # if ( !current_user || !current_user.isAdmin )\n # render :text => \"You are not authorized to see this page\", :layout => true\n #\n # return\n # end\n\n @users = User.all\n end", "def index\n set_page_title\n\n if current_user.is_admin?\n @users = User.where(\"owner_type != ?\", \"Admin\").order(:first_name)\n else\n @users = current_user.farm.users.order(:first_name)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n users = get_collection(visible_users) || return\n\n respond_to do |format|\n format.xml { render xml: users.to_xml(only: DEFAULT_FIELDS, root: :users, skip_types: true) }\n format.json { render json: users.to_json(only: DEFAULT_FIELDS) }\n end\n end", "def show\n @users = User.all\n @user = current_user\n end", "def show_list\n\t\t\t@my_list.show\n\t\tend", "def index\n # FIXME: if logged in as an author, only show own user's crUd stuff; for\n # admins, show all CRUD operations for all users\n if logged_in?\n @users = User.order(:name)\n else\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'Cannot view all users.' }\n end\n end\n end", "def list(garbage, start)\n @all_user = session_user.agency.users\n @start = start.to_i || 0\n @limit = request.params[\"limit\"] || UserListingLength\n @user = @all_user[@start .. (@start+@limit)-1] # FIXME: Do it with sequel!\n @uparted = @user.partition{|u| @user.index(u) % 2 == 0 }\n end", "def show\n \n begin\n if params[\"search_by_username\"].nil?\n if session[:current_user_super_admin]\n @users = User.find(:all,:order => 'username')\n else\n @users = User.find(:all,:order => 'username', :joins => :member, :conditions => ['members.center_id = ?', session[:center_id]]).paginate :page => params[:page], :per_page => 10\n end\n else\n if session[:current_user_super_admin]\n @users = User.find(:all, :conditions => ['username like ?', \"%\"+params[\"search_by_username\"]+\"%\"])\n else\n @users = User.find(:all,:order => 'username', :joins => :member, :conditions => ['members.center_id = ? and username like ?', session[:center_id], \"%\"+params[\"search_by_username\"]+\"%\"]).paginate :page => params[:page], :per_page => 10\n end\n end\n rescue ActiveRecord::RecordNotFound\n logger.error(\"Attempt to access invalid user\")\n flash[:notice] = \"User Not Found\"\n redirect_to :action => :index\n else\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @users }\n end\n end\n end", "def index\n @users = User.valid_users.find(:all, :order => \"name DESC\")\n render :index\n end", "def visible_users\n is_superadmin? ? User.all : title.users\n end", "def print_user_list\n puts \"Please write down the slected movies onto piece of paper.\"\n puts \"Ability so save list will be implemented in near future.\"\n puts \"Please stand by :) \\n\\n\"\n\n puts \"Here are your selected movies:\"\n for film in @user_list\n puts \" - #{film}\"\n end\n puts \"\"\n end", "def index\n @show_users = ShowUser.all\n end", "def index\n @verfugbarkeits = Verfugbarkeit.all\n @alle_user = User.where(typ: :Mitarbeiter).order(:username)\n end", "def index\n if can? :update, @users\n @users = User.all\n else\n \n redirect_to :root\n flash[:alert] = \"Vous n'avez pas les deroits a acceder ces informations.\"\n end\n \n end", "def index\n if isAdmin?\n @title= \"Listing All Professors\"\n @users = User.where('role' => 2).paginate(page: params[:page])\n if(!@users.any?)\n flash[:notice]= \"No professor on CMS. To create a new professor click on Create New Professor\"\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n else\n flash[:notice]= \"You don't have permission to browse all users\"\n redirect_to courses_path\n end\n end", "def index\n @userls = Userl.all\n end", "def list_friend\n ActionCable.server.broadcast(\n \"conversations-#{connect_user.id}\",\n message: 'list_user',\n data: User.where.not(id: connect_user).select('id, email')\n )\n end", "def index\n if session[:current_user_super_admin]\n @users = User.find(:all,:order => 'username')\n else\n @users = User.find(:all,:order => 'username', :joins => :member, :conditions => ['members.center_id = ?', session[:center_id]]).paginate :page => params[:page], :per_page => 10\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def list\n @user = User.all(:order => :login) # sort by login name\n end", "def index\n unless params[:display_name]\n redirect_to admin_dashboard_path, notice: 'Please enter a user display name.'\n end\n\n @users = User.where(display_name: params[:display_name])\n end", "def index\n\t @users = User.all\t\n\t render :index_user\n\tend", "def lists\n load_user_lists\n end", "def index\n @listas = Lista.where(user_id: current_user.id)\n end", "def index\n if current_user.rol == 1\n @users = User.order(:id)\n else\n @mensaje = \"Seccion exclusiva para administrador\"\n end\n end", "def index\n @users = User.order(:name)\n if( !current_user.isadmin() )\n @users = @users.select { |u| u.isplayer(u.id) == true }\n end\n # print('heloo')\n case params[:format]\n when 'staff'\n @users = @users.select { |u| u.canrole == 'staff' } + @users.select { |u| u.canrole == 'medical' } + @users.select { |u| u.canrole == 'admin' } + @users.select { |u| u.canrole == 'staffpremiere' }\n when 'premiere'\n @users = @users.select { |u| u.canrole == 'premiere' }\n when 'staffpremiere'\n @users = @users.select { |u| u.canrole == 'satffpremiere' }\n when 'm21'\n @users = @users.select { |u| u.canrole == 'm21' }\n when 'm18'\n @users = @users.select { |u| u.canrole == 'm18' }\n when 'm16'\n @users = @users.select { |u| u.canrole == 'm16' }\n when 'm15'\n @users = @users.select { |u| u.canrole == 'm15' }\n when 'fe14'\n @users = @users.select { |u| u.canrole == 'fe14' }\n when 'fe13'\n @users = @users.select { |u| u.canrole == 'fe13' }\n when 'fe12'\n @users = @users.select { |u| u.canrole == 'fe12' }\n when 'fe11'\n @users = @users.select { |u| u.canrole == 'fe11' }\n when 'fc10'\n @users = @users.select { |u| u.canrole == 'fc10' }\n when 'fc9'\n @users = @users.select { |u| u.canrole == 'fc9' }\n when 'fc8'\n @users = @users.select { |u| u.canrole == 'fc8' }\n when 'fc7'\n @users = @users.select { |u| u.canrole == 'fc7' }\n when 'archived'\n @users = @users.select { |u| u.canrole == 'archived' }\n end\n end", "def index\n unless current_user == User.find(1)\n redirect_to root_url\n end\n @users = User.all\n end", "def index\n\t\t@users = User.all\n\t\thide_view_action\n\t\tsetup_remove_confirm_message 'users.confirm_delete'\n\t\tsetup_index_title 'users.index.title'\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @users }\n\t\tend\n\tend", "def index\n if current_user.admin?\n @users = User.all\n end\n \n end", "def show_users\n @users = User.where(store: false, admin: false)\n end", "def index\n if current_user.admin?\n @users = User.paginate(:page => params[:page], :per_page => 10)\n @title = \"All Users\"\n else\n redirect_to root_path\n end\n end", "def index\r\n # @users = User.all\r\n end", "def index\n if current_user.role == \"admin\"\n @user_role_change = true\n @users = User.all\n elsif current_user.member.category == \"kore\" \n @user_role_change = false\n circle = Circle.where(:id => current_user.member.main_circle).first\n members = circle.members\n @users = []\n members.each do |m|\n @users << m.user if m.user\n end\n puts @users\n else\n redirect_to root_path\n end\n end", "def index\n @users = User.desc.paginate(params.merge(:per_page => 20))\n display @users\n end", "def list_users\n \t#p params[:search]\n \tif params[:search].nil?\n \t\t@users= User.all\n \telse\n \t\t@users= User.search_users(params)#this function from model\n \tend\n end", "def index\n # for partial generic views\n @title_user = \"All Catstagram Users\"\n @users = User.all\n end", "def index\n\t\t@users = User.all\n\tend", "def index\n\t\t@users = User.all\n\tend", "def index\n\t\t@users = User.all\n\tend", "def index\n\t\t@users = User.all\n\tend", "def index\n\t\t@users = User.all\n\tend", "def index\n\t\t@users = User.all\n\tend", "def index\n \t@users = UsersService.UserListAll(params[:page])\n end", "def show\n @user = User.find(params[:id])\n @users = User.all\n end", "def index\n \t@users = User.all\n \tend", "def index\n @lists = @user.lists\n end" ]
[ "0.7508745", "0.7289053", "0.7224238", "0.72154486", "0.713127", "0.71035314", "0.70729965", "0.70715046", "0.7012907", "0.70045507", "0.698844", "0.6974018", "0.6945427", "0.6931473", "0.6894762", "0.6888174", "0.6881643", "0.6876684", "0.6847996", "0.6827284", "0.68108994", "0.6784635", "0.6784081", "0.67748576", "0.67748576", "0.67748576", "0.67748576", "0.6745588", "0.67366016", "0.6731853", "0.6723503", "0.6721795", "0.6680552", "0.6663063", "0.6659134", "0.6649478", "0.66377825", "0.6634099", "0.6625921", "0.66232795", "0.6621785", "0.66186404", "0.6614441", "0.6608276", "0.6602882", "0.660007", "0.65949756", "0.6593088", "0.6581295", "0.6581295", "0.6570106", "0.656306", "0.65506685", "0.6549299", "0.65445065", "0.6537867", "0.65329367", "0.6526917", "0.6525242", "0.65246266", "0.65225136", "0.65192413", "0.6513968", "0.65099996", "0.6506699", "0.6505306", "0.64934427", "0.6482722", "0.64763516", "0.6474816", "0.6474057", "0.6473706", "0.6471714", "0.646887", "0.64588106", "0.64574796", "0.644981", "0.644818", "0.6445408", "0.64431494", "0.644151", "0.64354783", "0.64334697", "0.64321136", "0.6431423", "0.64267683", "0.6426388", "0.6425516", "0.64163876", "0.64044935", "0.6403564", "0.6403564", "0.6403564", "0.6403564", "0.6403564", "0.6403564", "0.63987654", "0.6394883", "0.6386812", "0.63747877" ]
0.7696338
0
Fin de def showNonSportifList Genere un PDF de la liste des users
def generatePDF(all_users) Prawn::Document.generate("public/listUsers.pdf", :page_layout => :landscape) do |pdf| table_data = [["Nom", "Email", "Date de naissance", "Poids actuel", "Poids Idéal", "Taille", "IMC", "Sportif", "Souhaite faire du sport" ]] all_users.each do |u| table_data += [["#{u.nom}", "#{u.email}", "#{u.ddn}", "#{u.poidsActu}", "#{u.poidsIdeal}", "#{u.taille}", "#{u.imc_without_desc}", "#{u.isSportif}" , "#{u.wantDoSport}"]] end #Fin de boucle pdf.stroke_horizontal_rule pdf.formatted_text [{:text => "\nListe des utilisateurs\n\n",:styles => [:bold], :size => 20 }], :align => :center pdf.stroke_horizontal_rule pdf.text "\n \n \n" pdf.table(table_data,:width => 720, :row_colors => ["A9D0F5", "FFFFFF"]) pdf.text "\n\n" pdf.text "Document créé le " + Time.now.to_s + "\n" , :align => :center pdf.stroke_horizontal_rule end #Fin d'écriture document PDF end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def showNonSportifList\n @users = User.where(isSportif: false, wantDoSport: true)\n @titre = \"Liste des utilisateurs non sportifs\"\n generatePDFnonSportif(@users)\n render 'showUserList'\n end", "def showUserList\n @titre = \"Liste des utilisateurs\"\n @users = User.all\n generatePDF(@users)\n end", "def generatePDFnonSportif(all_users) \n Prawn::Document.generate(\"public/listUsers.pdf\", :page_layout => :landscape) do |pdf|\n \n table_data = [[\"Nom\", \"Email\", \"Date de naissance\", \"Poids actuel\", \"Poids Idéal\", \"Taille\", \"IMC\"]]\n \n all_users.each do |u|\n table_data += [[\"#{u.nom}\", \"#{u.email}\", \"#{u.ddn}\", \"#{u.poidsActu}\", \"#{u.poidsIdeal}\", \"#{u.taille}\", \"#{u.imc_without_desc}\"]] \n end #Fin de boucle \n\n pdf.stroke_horizontal_rule\n pdf.formatted_text [{:text => \"\\nListe des utilisateurs non sportif\\n\\n\",:styles => [:bold], :size => 20 }], :align => :center\n pdf.stroke_horizontal_rule\n pdf.text \"\\n \\n \\n\"\n pdf.table(table_data,:width => 720, :row_colors => [\"A9D0F5\", \"FFFFFF\"])\n pdf.text \"\\n\\n\"\n\n pdf.text \"Document créé le \" + Time.now.to_s + \"\\n\" , :align => :center\n pdf.stroke_horizontal_rule\n end #Fin d'écriture document PDF\n end", "def index\n @ruta_users = RutaUser.all\n respond_to do |format|\n format.html\n format.pdf do \n render pdf: 'listado_de_rutas_asignadas', \n orientation: 'Landscape',\n template: 'ruta_users/listado_de_rutas_asignadas.html.erb'\n end\n end\n end", "def index\n # @films = Film.search(params[:search]).paginate(page: params[:page], per_page: 10).order('films.brazilian_title')\n @films = Film.search(params[:search]).order('films.brazilian_title').page(params[:page])\n\n respond_to do |format|\n format.html\n format.pdf {\n render pdf: \"films-list-report\",\n encoding: 'utf-8',\n header: {center: \"[ #{I18n.l Date.today, format: '%d.%m.%Y'} - #{number_with_delimiter(Film.count)} filmes cadastrados. ]\"},\n footer: {center: \"[page] de [topage]\"}\n }\n end\n end", "def index\n @lists = current_user.lists\n respond_to do |format|\n format.html\n # Configuration for the pdf and the csv\n format.pdf { render template: 'lists/pdf', pdf: 'pdf'}\n format.csv { send_data @lists.to_csv, filename: \"csv-#{Date.today}.csv\" }\n end\n end", "def list\n authorize :user\n if params[:wedgetail].to_s!=\"\"\n redirect_to :action => \"show\", :wedgetail => params[:wedgetail]\n elsif !(params[:family_name].to_s==\"\" && params[:given_names].to_s==\"\")\n @patients = User.paginate(:page => params[:page],:per_page => 10, :order => 'family_name,wedgetail DESC, created_at DESC', :conditions => [\"visibility=? and family_name like ? and (given_names like ? or known_as like ?) and role=5\", true,params[:family_name].to_s+\"%\",params[:given_names].to_s+\"%\",params[:given_names].to_s+\"%\"])\n end\n render :layout=>'layouts/standard'\n end", "def list\r\n\r\n @restricted_fields = []\r\n pagin_opts = {:include => [:customers,:profiles]}\r\n pagin_opts[:page]\t = params[:page].to_i > 0 ? params[:page].to_i : 1\r\n pagin_opts[:per_page]\t = (params[:per_page] || cookies[:users_per_page] || 50).to_i\r\n pagin_opts[:order]\t = @default_order if @default_order\r\n pagin_opts[:order]\t||= 'users.' +params[:sort_by] if !params[:sort_by].blank?\r\n pagin_opts[:conditions] ||= @default_filter if @default_filter\r\n pagin_opts[:conditions] ||= params[:conditions] if params[:conditions].is_a?(Hash)\r\n pagin_opts[:joins]\t||= @joins_fields || []\r\n\r\n @users = User.paginate(pagin_opts)\r\n render(:xml => @users.to_xml(:dasherize => false, :only => [:id,:login,:first_name,:last_name,:email,:telephone,:language,:active,:hashed_password,:salt,:last_login,:last_session_id], :methods => [:customers_human_display,:password,:user_accesses_human_display,:accesses_human_display,:profiles_human_display,:dev_feedbacks_human_display,:file_imports_human_display])) and return if params[:format] == 'xml'\r\n render(:json => @users) and return if params[:format] == 'json'\r\n render(:pdf => @users, :action => :list) and return if params[:format] == 'pdf'\r\n if !params[:group_by].blank? && [\"login\", \"first_name\", \"last_name\", \"email\", \"telephone\", \"language\", \"active\", \"password\", \"hashed_password\", \"salt\", \"last_login\", \"last_session_id\"].include?(params[:group_by])\r\n @users_groups = @users.inject({}) { |acc,elt|\r\n crit = nil\r\n if [].include?(params[:group_by])\r\n crit = elt.send(params[:group_by]) ? elt.send(params[:group_by]).disp_name : nil\r\n else\r\n crit = elt.attributes[params[:group_by]]\r\n end\r\n acc[crit] ||= []\r\n acc[crit] << elt\r\n acc\r\n }\r\n end\r\n end", "def show \n \n @user = User.all#para la lista de checkbox\n @userr = User.find(@coference.creador)#para ver el nombre del creador\n respond_to do |format|\n format.html\n format.pdf do\n pdf = CoferenceshowPdf.new(@coference, view_context, @userr)\n send_data pdf.render, filename: \"coference_#{@coference.id}.pdf\",type: \"application/pdf\", disposition: \"inline\"\n \n end\n end\n \n end", "def menu_gestion_docencia\n periodo = Period.where(estatus: 'Activo').take\n \n @teachings = Teaching.joins(:users).where(users: {id: current_user.id}).where(ano_periodo: periodo).order(fecha_i: :desc)\n @teachings2 = @teachings\n @resultados = @teachings.count\n @teachings = @teachings.page(params[:page])\n\n respond_to do |format|\n format.html\n format.pdf do\n pdf = TeachingindexPdf.new(@teachings2, view_context)\n send_data pdf.render, filename: \"Lista de otras actividades del área de docencia.pdf\",type: \"application/pdf\", disposition: \"inline\"\n end\n end\n end", "def index\n @zgloszenies = Zgloszenie.includes(:user)\n .where(\"zgloszenies.nazwa_urzadzenia ILIKE :q OR users.email ILIKE :q OR users.first_name ILIKE :q OR users.last_name ILIKE :q\", q: \"%#{params[:search]}%\")\n .references(:users)\n .paginate(:page => params[:page], :per_page => 10)\n @user = current_user.id\n\n respond_to do |format|\n format.js\n format.html\n format.pdf do\n pdf = ZgloszenieListaPdf.new(@zgloszenies, @user)\n send_data pdf.render, {filename: \"zgloszenia.pdf\",\n type: \"application/pdf\",\n disposition: \"inline\"}\n end\n end\n end", "def print_user_list\n puts \"Please write down the slected movies onto piece of paper.\"\n puts \"Ability so save list will be implemented in near future.\"\n puts \"Please stand by :) \\n\\n\"\n\n puts \"Here are your selected movies:\"\n for film in @user_list\n puts \" - #{film}\"\n end\n puts \"\"\n end", "def list\n @users = User.where(organization: false)\n\n render \"list\"\n end", "def show\n specification = Specification.find(session[:specification_sel_id])\n @invitation = Invitation.find(params[:id])\n if specification.user_id == current_user.username\n\t\t@propio = true\n\telse\n\t\t@propio = false\n\tend\n\tif current_user.acquisition? || current_user.acquisition_analist? || current_user.import? || current_user.import_analist?\n\t\tif @propio\n\t\t\t@puedeEliminar = true\n\t\telse\n\t\t\t@puedeEliminar = false\n\t\tend\n\telse\n\t\t@puedeEliminar = true\n\tend\n\t\n respond_to do |format|\n format.html\n format.pdf do\n pdf = ReporteInvitations.new(@invitation)\n nombre = \"Especificacion_#{session[:specification_sel_id]}_Carta_Invitacion_Empresa_#{@invitation.nombre}.pdf\"\n send_data pdf.render, filename: nombre, type: 'application/pdf'\n end\n end\n end", "def index\r\n\r\n #find_by_name_or_all\r\n @sivic_celulas = SivicCelula.find_by_name_or_all(params[:q],current_user.sivic_pessoa.sivic_igreja_id).paginate(:page => params[:page], :per_page => 10)\r\n\r\n #@sivic_celulas = SivicCelula.where(\"sivic_igreja_id = ?\",current_user.sivic_pessoa.sivic_igreja_id).paginate(:page => params[:page], :per_page => 10).order(:id)\r\n @sivic_celulasreport = SivicCelula.where(\"sivic_igreja_id = ?\",current_user.sivic_pessoa.sivic_igreja_id)\r\n\r\n respond_to do |format|\r\n format.html\r\n format.pdf { render_civic_celula_list(@sivic_celulasreport) }\r\n end \r\n end", "def index\n if isAdmin?\n @title= \"Listing All Professors\"\n @users = User.where('role' => 2).paginate(page: params[:page])\n if(!@users.any?)\n flash[:notice]= \"No professor on CMS. To create a new professor click on Create New Professor\"\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n else\n flash[:notice]= \"You don't have permission to browse all users\"\n redirect_to courses_path\n end\n end", "def show\n @users = User.all\n respond_to do |format|\n format.html\n format.pdf {render pdf: \"show\" }\n end\n end", "def index\n @users = User.all\n respond_to do |format|\n format.html\n format.pdf do\n pdf = PDF::Writer.new\n @users.each do |user|\n pdf.text user.name\n end\n send_data pdf.render, :filename => 'products.pdf', :type => 'application/pdf', :disposition => 'inline'\n end\n end\n end", "def show\n # als er geen nietdilbeeks-param gegeven is, is nietdilbeeks sowieso false \n @niveau = Niveau.find(params[:id])\n nietdilbeeks = params[:nietdilbeeks] == \"true\"\n @proefs = @niveau.proefs.where(\"nietdilbeeks = ?\", nietdilbeeks) \n authorize! :show, @niveau\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @niveau }\n format.pdf do \n pdf = BlancoEvaluatielijstPdf.new(@niveau)\n pdf.number_pages \"(afgeprint op #{Time.now.strftime(\"%d/%m/%Y\")}) <page>/<total>\", :size => 9, :at => [620, 0]\n send_data pdf.render, filename: \"#{@niveau.name}_blanco_rijen.pdf\",\n type: \"application/pdf\",\n disposition: \"inline\"\n end\n end\n end", "def list\n flash[:notice] = \"Het volg-systeem is neergestort als een mir. Iedereen volgt gewoon iedereen. Wel zo communistisch en makkelijk\";\n @user = User.find(:all)\n end", "def show\n @user = User.all\n @userr = User.find(@teaching.creador)\n respond_to do |format|\n format.html\n format.pdf do\n pdf = TeachingshowPdf.new(@teaching, view_context, @userr)\n send_data pdf.render, filename: \"teaching_#{@teaching.id}.pdf\",type: \"application/pdf\", disposition: \"inline\"\n \n end\n end\n \n end", "def index\n authorize! :index, Notificacao\n @notificacoes = Notificacao.where(usuario_curso: @perfil.id).order('id desc').page(params[:page])\n end", "def list\n if !current_user.is_admin?\n render 'shared/forbidden'\n return\n end\n\n @list_title = \"SIMPD Complete List\"\n @list_type = 'complete'\n @fields = params[:fields]\n if !@fields\n @fields = Hash.new\n @fields[:account_number] = '1'\n @fields[:guid] = '1'\n @fields[:roles] = '1'\n @fields[:last_login] = '1'\n @fields[:real_user] = '1'\n end\n\n @users = User.all.sort_by{|u| u.sort_name}\n\n if params[:commit] == 'Download Excel'\n render 'list.xml', :content_type => 'application/xls'\n return\n end\n\n if params[:commit] == 'Clear'\n # Clear selections\n @fields = Hash.new\n end\n\n render :layout => 'list'\n end", "def show\n @duedate = Duedate.find(params[:id])\n\n\n @projetos = Project.find_all_by_duedate_id(@duedate.id)\n \n \n @tabelaConcluido = [[\"Nome\", \"RA\", \"Conceito\"]]\n @tabelaPendente = [[\"Nome\", \"RA\", \"Status\"]] \n \n @projetos.each do |p|\n if p.status == 6\n @aluno = User.find_by_id(p.aluno_id)\n \n @board_document = BoardDocument.find_by_project_id(p.id)\n \n @linha = [ @aluno.name, @aluno.ra, @board_document.mark ]\n @tabelaConcluido.append(@linha)\n else\n @aluno = User.find_by_id(p.aluno_id)\n \n @linha = [ @aluno.name, @aluno.ra, retorna_status(p.status)]\n @tabelaPendente.append(@linha)\n end\n \n \n end\n \n if @tabelaConcluido == [[\"Nome\", \"RA\", \"Conceito\"]]\n @tabelaConcluido = [[\"Nenhum Projeto Concluido\"]] \n end \n if @tabelaPendente == [[\"Nome\", \"RA\", \"Status\"]]\n @tabelaPendente = [[\"Nenhum Projeto Pendente\"]] \n end \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @duedate }\n format.pdf { render :layout=>false }\n end\n end", "def index\n @users = @current_show.users.includes(:events)\n @tickets = @current_show.tickets.paid.group(:user_id).sum(:quantity)\n @passes = @current_show.tickets.free.group(:user_id).sum(:quantity)\n @prizes = @current_show.packages.where.not(winner: nil).group(:winner_id).count\n\n respond_to do |format|\n format.html { @users = @users.reverse }\n format.pdf do\n booths_with_labels = @current_show.booths.approved.with_add_on('labels')\n printable_users = @users.where.not(address: nil).order(:first_name, :last_name)\n pdf = mailing_labels_pdf(booths_with_labels, printable_users)\n send_data(pdf.render, disposition: 'inline', filename: 'mailing_labels.pdf')\n end\n end\n end", "def index\n @title = \"Nos utilisateurs\"\n @description = \"Liste de nos plus fervents utilisateurs\"\n @users = User.all\n end", "def patient_list\n @patients = Patient.all\n render :pdf => \"patient_list\", :header => { :right => '[page] of [topage]' }, :margin => {\n :top => 40,\n :bottom => 0\n }\n end", "def showlist\n\t\t@people_list.each do |x|\n\t\t\tputs \"* #{capitalize(x.type)}, #{capitalize(x.name)}, #{capitalize(x.party)}\"\n\t\tend\n\tend", "def menu_gestion_docencia_trabajos\n periodo = Period.where(estatus: 'Activo').take\n \n @works = Work.joins(:users).where(users: {id: current_user.id}).where(ano_periodo: periodo).order(fecha_i: :desc)\n @works2 = @works\n @resultados = @works.count\n @works = @works.page(params[:page])\n\n respond_to do |format|\n format.html\n format.pdf do\n pdf = WorkindexPdf.new(@works2, view_context)\n send_data pdf.render, filename: \"Lista de actividades de trabajos de grado del área de docencia.pdf\",type: \"application/pdf\", disposition: \"inline\"\n end\n end\n end", "def show \n authorize! :show_almacen,Sigesp::Solicitud \n respond_to do |format|\n format.html {\n @grupo = SolicitudGrupo.grupoSolicitud(@sigesp_solicitud.numsol)\n if @grupo.nil?\n @grupo = SolicitudGrupo.new \n @grupo.solicitudes.append @sigesp_solicitud\n end \n }\n format.pdf do\n @solicitud = Sigesp::Solicitud.find(params[:id])\n end\n end\n end", "def show\n @user = User.all\n @userr = User.find(@research.creador)\n respond_to do |format|\n format.html\n format.pdf do\n pdf = ResearchshowPdf.new(@research, view_context, @userr)\n send_data pdf.render, filename: \"research_#{@research.id}.pdf\",type: \"application/pdf\", disposition: \"inline\"\n \n end\n end\n end", "def index\n @atenciones = Atencion.all\n respond_to do |format|\n format.html\n format.pdf do \n render pdf: 'Listado de Atenciones'\n end \n end\n end", "def index\n @questionnaires = Questionnaire.all\n\n respond_to do |format|\n format.html\n format.pdf do\n pdf = QuestionnairePdf.new\n User.all.each do |user|\n if (user.questionnaire)\n pdf.create_page(user.questionnaire)\n pdf.start_new_page\n end\n end\n\n send_data pdf.render, filename: \"questionnaire\", type: \"application/pdf\", disposition: \"inline\"\n end\n end\n end", "def show\n @estAdmin = admin?\n \n # Check si c'est sa facture\n if !@estAdmin && @facture.user_id != session[:user]['id']\n redirect_to factures_path, danger: \"Ce n'est pas une de vos factures\"\n end\n\n\n puts '--------------'\n puts @facture.id\n puts '--------------'\n \n if @facture.id\n @ligne_factures = LigneFacture.where(facture_id: @facture.id)\n end\n\n respond_to do |format|\n format.html\n format.pdf do\n render pdf: \"Facture No. #{@facture.id}\",\n page_size: 'A4',\n template: 'factures/pdf.html.erb',\n layout: 'pdf.html',\n lowquality: true,\n zoom: 1,\n dpi: 75\n end\n end\n\n end", "def index\n if current_user.is_admin?\n @noticias = Noticia.page(params[:page])\n else\n @noticias = current_user.noticias.page(params[:page])\n end\n end", "def index\n @page_title = \"CBCL - Liste af Brugere\"\n @sort = params[:sort] || 'users.created_at'\n @order = params[:order] || \"asc\"\n\n @users = current_user.get_users(:page => params[:page], :per_page => Journal.per_page, :sort => params[:sort], :order => params[:order])\n\n if !params[:partial]\n render\n else\n render :partial => 'users/users', :layout => false\n end\n end", "def index\n @periodistas = Periodista.listado(params[:page],params[:buscar], params[:departamento],params[:tipo_medio_id] , params[:institucion_periodistica_id])\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @periodistas }\n format.print{ @periodistas = Periodista.find(:all, :order => \"idDepartamento, nombre\"); render :layout => 'imprimir' }\n end\n end", "def menu_gestion_extension_conferencia_o_ponencia\n periodo = Period.where(estatus: 'Activo').take\n \n @coferences = Coference.joins(:users).where(users: {id: current_user.id}).where(ano_periodo: periodo).order(fecha_i: :desc)\n @coferences2 = @coferences\n @resultados = @coferences.count\n @coferences = @coferences.page(params[:page])\n \n respond_to do |format|\n format.html\n format.pdf do\n pdf = CoferenceindexPdf.new(@coferences2, view_context)\n send_data pdf.render, filename: \"Lista de Conferencia o ponencias.pdf\",type: \"application/pdf\", disposition: \"inline\"\n end\n end\n end", "def index\n # @users = User.all\n @users = User.paginate(page: params[:page], :per_page => 10)\n # @users = User.order(name: :desc).paginate(:page => params[:page], :per_page => 10).search(params[:search])\n respond_to do |format|\n format.html\n format.csv { send_data @users.to_csv }\n format.xls # { send_to @users.to_csv(col_sep: \"\\t\") }\n format.pdf do\n pdf = UsersPdf.new(@users)\n\t send_data pdf.render\n # pdf = Prawn::Document.new\n # pdf.text @users.count.to_s\n # send_data pdf.render\n # pdf = UsersPdf.new(@users)\n # pdf = UserPdf.new(@users, view_context)\n # send_data pdf.render, filename: \"users_#{Time.now}.pdf\",\n # type: \"application/pdf\",\n # disposition: \"inline\"\n end\n end\n end", "def show\n @user_list= []\n \n @customtable = CustomeTable.where(:identifier_id => @hackathon.id)\n @reguser = Registration.where(:hackathon_id => @hackathon.id)\n \n @reguser.each do |user| \n u = User.find(user.userId)\n @user_list.push(u.user_name)\n end\n end", "def list\r\n\r\n @restricted_fields = []\r\n pagin_opts = {:include => [:user]}\r\n pagin_opts[:page]\t = params[:page].to_i > 0 ? params[:page].to_i : 1\r\n pagin_opts[:per_page]\t = (params[:per_page] || cookies[:dev_feedbacks_per_page] || 50).to_i\r\n pagin_opts[:order]\t = @default_order if @default_order\r\n pagin_opts[:order]\t||= 'dev_feedbacks.' +params[:sort_by] if !params[:sort_by].blank?\r\n pagin_opts[:conditions] ||= @default_filter if @default_filter\r\n pagin_opts[:conditions] ||= params[:conditions] if params[:conditions].is_a?(Hash)\r\n pagin_opts[:joins]\t||= @joins_fields || []\r\n\r\n @dev_feedbacks = DevFeedback.paginate(pagin_opts)\r\n render(:xml => @dev_feedbacks.to_xml(:dasherize => false, :only => [:id,:ticket_status,:title,:text,:zone,:url,:controller,:action,:created_at,:ip,:ua,:browser,:parent_id], :methods => [:user_human_display])) and return if params[:format] == 'xml'\r\n render(:json => @dev_feedbacks) and return if params[:format] == 'json'\r\n render(:pdf => @dev_feedbacks, :action => :list) and return if params[:format] == 'pdf'\r\n if !params[:group_by].blank? && [\"title\", \"url\", \"controller\", \"action\", \"created_at\", \"user\", \"ip\", \"ua\", \"parent_id\"].include?(params[:group_by])\r\n @dev_feedbacks_groups = @dev_feedbacks.inject({}) { |acc,elt|\r\n crit = nil\r\n if [\"user\"].include?(params[:group_by])\r\n crit = elt.send(params[:group_by]) ? elt.send(params[:group_by]).disp_name : nil\r\n else\r\n crit = elt.attributes[params[:group_by]]\r\n end\r\n acc[crit] ||= []\r\n acc[crit] << elt\r\n acc\r\n }\r\n end\r\n end", "def index\n if current_user\n if current_user.acquisition? || current_user.import? || current_user.acquisition_analist? || current_user.import_analist? \n @especificacion = Specification.where(:id => session[:specification_sel_id]).first \n @user = User.where(:username => @especificacion.user_id).first \n if @user.director? || @user.directorate? || @user.gsmp? || @user.acquisition? || @user.import? || @user.quality? || @user.manage? || @user.acquisition_analist? || @user.import_analist? || @user.quality_analist? || @user.manage_analist?\n @mostrar = true\n else\n @mostrar = false\n end\n elsif current_user.director? || current_user.directorate? || current_user.gsmp? || current_user.quality? || current_user.quality_analist? || current_user.manage? || current_user.manage_analist? || current_user.section_boss? || current_user.proy_responsible?\n @mostrar = false \n else\n @mostrar = true\n end\n \t@acts = Act.where(:specification_id => session[:specification_sel_id]).all\n @sumActs = Act.where(:specification_id => session[:specification_sel_id]).count\n\t@act= Act.where(:specification_id => session[:specification_sel_id]).first\n end\n\trespond_to do |format|\n format.html do\n if @sumActs != 0\n redirect_to @act\n else\n\t\t\tredirect_to new_act_url\n end\n\tend\n format.pdf do\n\t\tpdf = ReporteActs.new(@act)\n \t\t send_data pdf.render, filename: \"Especificacion_#{session[:specification_sel_id]}_Acto_Motivado.pdf\", type: 'application/pdf'\n\t end\n format.xml do\n specification = Specification.find(session[:specification_sel_id])\n specification.p2 = 2\n specification.p3 = 2\n specification.p4 = 0\n specification.p5 = 2\n specification.p6 = 1\n specification.p8 = 1\n session[:specification_p3] = specification.p3\n session[:specification_p2] = specification.p2\n session[:specification_p4] = specification.p4\n session[:specification_p5] = specification.p5\n session[:specification_p6] = specification.p6\n session[:specification_p8] = specification.p8\n specification.save\n redirect_to \"/acts/#{@act.id}?pdf=1\"\n end\n end\n end", "def show\n if params[:name] == nil\n @pacientes = Paciente.paginate(:page => params[:page], :per_page => 5)\n else\n @pacientes = Paciente.or(nombre: /.*#{params[:name].downcase}.*/i)\n .or(apellido: /.*#{params[:name].downcase}.*/i)\n .or(carnet: /.*#{params[:name]}.*/i)\n .paginate(:page => params[:page], :per_page => 5)\n end\n \n @pacientes.to_a.each do |paciente|\n @parte_laboratorio.paciente_reporte_laboratorios.each do |paciente_reporte|\n if((paciente.id == paciente_reporte.paciente_id) && (paciente_reporte.fecha_consulta.to_date == Time.now.to_date))\n @pacientes.delete(paciente)\n end\n end\n end \n\n end", "def solicitudes\n report = SolicitudesReport.new(:page_size => 'LEGAL',\n :page_layout => :landscape)\n report.reporttitle = 'REPORTES DE SOLICITUDES'\n report.items = Solicitud.find(:all, :conditions => [\"solicitudes.institucion_id = ? and solicitudes.anulada = ?\", usuario_actual.institucion_id, false], :order => :numero)\n output = report.to_pdf\n\n file_name = \"solicitudes_\" + Time.now.to_i.to_s + \".pdf\"\n\n respond_to do |format|\n format.pdf do\n send_data output, :filename => file_name,\n :type => \"application/pdf\"\n end\n end\n end", "def index\n #@user = User.find(receiver.id)\n if current_user.registry_officer?\n @nasfiles = Nasfile.all.paginate(:page => params[:page], :per_page => 30)\n else\n @nasfiles = Nasfile.where(\"office_id = ?\", current_user.office_id).paginate(:page => params[:page], :per_page => 10)\n end\n end", "def index\n @users = User.where.not(designation: \"hr\").all\n end", "def index\n @administrativos = Administrativo.order('created_at DESC').all\n @total = false\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @administrativos }\n format.pdf { render :layout => false }\n end\n end", "def index\n\n if current_user\n @especificacion = Specification.where(:id => session[:specification_sel_id]).first \n @user = User.where(:username => @especificacion.user_id).first\n if current_user.acquisition? || current_user.import? || current_user.acquisition_analist? || current_user.import_analist? \n if @user.director? || @user.directorate? || @user.gsmp? || @user.acquisition? || @user.import? || @user.quality? || @user.manage? || @user.acquisition_analist? || @user.import_analist? || @user.quality_analist? || @user.manage_analist? \n @mostrar = true\n else\n @mostrar = false\n end\n elsif current_user.director? || current_user.directorate? || current_user.gsmp? || current_user.quality? || current_user.quality_analist? || current_user.manage? || current_user.manage_analist? || current_user.section_boss? || current_user.proy_responsible?\n\t@mostrar = false\n else\n @mostrar = true\n end\n @servicerequests = Servicerequest.where(:user_id => current_user.username).all\n @sumServReq = Servicerequest.where(:specification_id => session[:specification_sel_id]).count\n @servreq = Servicerequest.where(:specification_id => session[:specification_sel_id]).first\n end\n respond_to do |format|\n format.html do\n if @sumServReq != 0\n redirect_to @servreq\n end\n end\n format.pdf do\n\n #Revisamos si es un Acto Motivado\n if Recommendation.where(:specification_id => session[:specification_sel_id]).count == 0\n @act = Act.where(:specification_id => session[:specification_sel_id]).first\n @empresa = Invitation.where(:nombre => @act.proveedor,:specification_id => session[:specification_sel_id]).first\n @quote = Quote.where(:specification_id => session[:specification_sel_id]).first\n @itemsQts = Itemsquote.where(:specification_id => session[:specification_sel_id]).all\n @items = []\n\t\t\t @itemsQts.each do |itemsqts|\n @items.push(Service.where(:specification_id => session[:specification_sel_id],:id => itemsqts.id_item).first)\n end\n pdf = SolicitudServices.new(@servreq, @empresa, @items, @quote)\n end\n\n #Revisamos si es una Recomendacion\n if Recommendation.where(:specification_id => session[:specification_sel_id]).count != 0\n @reco = Recommendation.where(:specification_id => session[:specification_sel_id]).first\n @recoEmp = RecommendationsEmpresa.where(:id_informe => @reco.id, :opcion_numero => 1).first\n @empresa = Invitation.where(:quote_id => @recoEmp.quote_id).first\n #ERROR VACIO\n @quote = Quote.where(:id => @empresa.quote_id, :specification_id => session[:specification_sel_id]).first\n #ERROR VACIO\n @itemsQts = Itemsquote.where(:specification_id => session[:specification_sel_id],:id_oferta => @recoEmp.quote_id,:compra => 1).all\n @items = []\n @itemsQts.each do |itemsqts|\n @items.push(Service.where(:specification_id => session[:specification_sel_id],:id => itemsqts.id_item).first)\n end\n\n pdf = SolicitudServices.new(@servreq, @empresa, @items, @quote)\n end\n\n nombre = \"Especificacion_#{session[:specification_sel_id]}_Solicitud_de_Servicios.pdf\"\n send_data pdf.render, filename: nombre, type: 'application/pdf'\n end\n format.xml do\n specification = Specification.find(session[:specification_sel_id])\n\t specification.p6 = 2\n\t session[:specification_p6] = specification.p6\n\t specification.save\n redirect_to \"/servicerequests/#{@servreq.id}?pdf=1\"\n end\n end\n end", "def index\n if current_user.admin?\n @users = User.all.paginate(:page => params[:page])\n else\n @users = User.where(unidade_id: current_user.unidade_id).paginate(:page => params[:page])\n end\n end", "def menu_gestion_investigacion\n periodo = Period.where(estatus: 'Activo').take\n \n @researches = Research.joins(:users).where(users: {id: current_user.id}).where(ano_periodo: periodo).order(fecha_i: :desc)\n @researches2 = @researches\n @resultados = @researches.count\n @researches = @researches.page(params[:page])\n\n respond_to do |format|\n format.html\n format.pdf do\n pdf = ResearchindexPdf.new(@researches2, view_context)\n send_data pdf.render, filename: \"Lista de otras actividades del área de investigación.pdf\",type: \"application/pdf\", disposition: \"inline\"\n end\n end\n end", "def user_list\n current_user_cards = current_user.cards\n if !current_user_cards || current_user_cards.size.to_i == 0\n flash[:notice] = _('You_have_no_view_permission')\n redirect_to(:root) && (return false)\n end\n\n @page_title = _('Card_groups')\n\n session[:cardgroup_search_options] ||= {}\n\n @options = {\n 's_number' => '',\n 's_pin' => '',\n 's_balance_max' => '',\n 's_balance_min' => '',\n 's_sold' => '',\n 's_caller_id' => ''\n }\n\n @pin_visible = Confline.get_value('CCShop_hide_pins_for_distributors').to_i.zero?\n @options = @options.merge(session[:cardgroup_search_options])\n\n @cardgroups = Cardgroup.select('cardgroups.*, COUNT(cards.id) AS card_count').joins('LEFT JOIN cards ON (cards.cardgroup_id = cardgroups.id and cards.hidden = 0)').where(['cards.user_id = ?', current_user_id]).group('cardgroups.id').all\n end", "def index\n @conceptos_de_pago = ConceptoDePago.all\n @usuario = current_user\n respond_to do |format|\n format.html\n format.pdf do\n pdf = ConceptosDePagoPdf.new(@conceptos_de_pago, @usuario)\n send_data pdf.render, filename: \"conceptos_de_pago#{@conceptos_de_pago}.pdf\", type: \"application/pdf\", disposition: \"inline\"\n end\n format.xls\n end\n end", "def index\r\n\r\n @sivic_ministerios = SivicMinisterio.where(\"sivic_igreja_id = ?\", current_user.sivic_pessoa.sivic_igreja_id).paginate(:page => params[:page], :per_page => 10)\r\n\r\n end", "def index\n \n if params[:search]\n @searc = params[:search]\n else\n @searc = \"\"\n end\n\n #buscador\n if Queja.has_role(current_user.id) == \"instructor\"\n @quejas = Queja.indes(current_user.id).order(sort_column + \" \" + sort_direction).search(params[:search]).page(params[:page]).per_page(5)\n @estadoquejas = @quejas.where(:estado_id => 1)\n @estadoencomite = @quejas.where(:estado_id => 2)\n @quejacorreccion = @quejas.where(:estado_id => 3)\n else\n\n @quejas = Queja.order(sort_column + \" \" + sort_direction).search(params[:search]).page(params[:page]).per_page(5)\n @estadoquejas = Queja.where(:estado_id => 1) \n @estadoencomite = Queja.where(:estado_id => 2)\n @quejacorreccion = Queja.where(:estado_id => 3)\n end\n #esta variable trae todos los registros para el pdf\n @a= Queja.all \n end", "def index\n @protocolos = Protocolo.all\n respond_to do |format|\n format.html\n format.pdf { render_protocolos_list(@protocolos) }\n end\n end", "def index\n @propiedads = Propiedad.where(user: current_user)\n end", "def show\n @listaprecio = Listaprecio.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @listaprecio }\n format.pdf { render :pdf => false }\n end\n end", "def show\n @asunto = Asunto.find(params[:id])\n #if pertenece_a_mi_o_subordinados?(current_user,regresa_subordinados(current_user.id), @asunto.persona_turnado_id)\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @asunto }\n format.pdf { render :layout => false }\n \n end\n # else \n # redirect_to(root_path,:notice => 'No se tienen permisos.')\n # end\n\n end", "def index\n\t\tunless current_user.tiene_permiso_sobre? @cliente\n\t\t\tredirect_to clientes_url, alert: 'No tienes los permisos necesarios.'\n\t\telse\n\t\t @tiendas_clientes = @cliente.tiendas_clientes\n\t\t render layout: \"dataTables\"\n end\n end", "def download\r\n\r\n @restricted_fields = []\r\n @no_menubar\t= true\r\n @no_links\t= true\r\n @no_filterbar\t= true\r\n @no_row_links\t= true\r\n pagin_opts\t\t = {:include => [:customers,:user_accesses,:profiles,:dev_feedbacks,:file_imports]}\r\n pagin_opts[:order]\t = @default_order if @default_order\r\n pagin_opts[:order]\t||= \"users.#{params[:sort_by]}\" if !params[:sort_by].blank?\r\n pagin_opts[:conditions] ||= @default_filter\r\n pagin_opts[:joins]\t||= @joins_fields || []\r\n\r\n # pagin_opts[:select]\t||= \"`users`.`login`,`users`.`first_name`,`users`.`last_name`,`users`.`email`,`users`.`telephone`,`users`.`language`,`users`.`active`,`users`.`salt`\" unless params[:format] == 'html'\r\n\r\n if params[:id] && params[:id].to_i > 0\r\n @user = User.find_by_id(params[:id], pagin_opts)\r\n if !@user\r\n flash[:warning] = _(\"Error: %{obj} not found!\") % {:obj => _(%q[User])}\r\n begin\r\n redirect_to :back\r\n rescue\r\n redirect_to :action => :list\r\n end\r\n return\r\n end\r\n f_name = @user.disp_name\r\n respond_to do |format|\r\n format.html {\r\n @no_menubar = true\r\n @no_links = true\r\n data = render_to_string(:template => '/users/show.html.erb', :layout => 'minimal').gsub(/\\ssrc=\\\"\\//, %Q[ src=\"#{request.protocol}#{request.host_with_port}/])\r\n send_data(data, :filename => \"#{f_name}.html\", :disposition => 'attachment', :type => 'text/html;charset=utf-8') }\r\n format.doc {\r\n @no_menubar = true\r\n @no_links = true\r\n data = render_to_string(:template => '/users/show.html.erb', :layout => 'minimal').gsub(/\\ssrc=\\\"\\//, %Q[ src=\"#{request.protocol}#{request.host_with_port}/])\r\n send_data(data, :filename => \"#{f_name}.doc\", :disposition => 'attachment', :type => 'application/msword;charset=utf-8') }\r\n format.pdf {\r\n @pdf = true\r\n @debug_pdf = params[:debug_pdf]\r\n params[:format] = 'html'\r\n html = render_to_string(:template => '/users/show.html.erb', :format => :html, :id => @user.id, :layout => 'pdf')\r\n html.gsub!(/\\/images\\//, Rails.root.join('public', 'images/')) if !params[:debug_pdf]\r\n render(:text => html, :layout => 'pdf') and return if params[:debug_pdf]\r\n kit = PDFKit.new(html, :encoding => 'UTF-8')\r\n kit.stylesheets << Rails.root.join('public', 'stylesheets', 'pdf.css')\r\n pdf = kit.to_pdf\r\n send_data(pdf, :filename => \"#{@user.disp_name}.pdf\") unless params[:debug_pdf] || pdf.blank?\r\n\r\n # send_data(render_to_string(:format => :html, :layout => false, :action => :show, :id => @user.id), :filename => \"#{f_name}.pdf\", :disposition => 'attachment', :type => 'application/pdf;charset=utf-8')\r\n\r\n return\r\n }\r\n format.xml {\r\n send_data(@user.to_xml, :filename => \"#{f_name}.xml\", :disposition => 'attachment', :type => 'text/xml;charset=utf-8')}\r\n format.json {\r\n send_data(@user.to_json, :filename => \"#{f_name}.json\", :disposition => 'attachment', :type => 'text/json;charset=utf-8')}\r\n format.xls {\r\n book = Spreadsheet::Workbook.new\r\n sheet = book.create_worksheet(:name => \"users\")\r\n sheet.row(0).concat([\"Login\", \"First Name\", \"Last Name\", \"Email\", \"Telephone\", \"Language\", \"Active\", \"Salt\", \"User Accesses\", \"Profiles\"])\r\n sheet.row(1).replace([@user.login, @user.first_name, @user.last_name, @user.email, @user.telephone, @user.language, @user.active, @user.salt, @user.user_accesses.map(&:disp_name).to_sentence, @user.profiles.map(&:disp_name).to_sentence])\r\n fname = \"users.xls\"\r\n tmp = Tempfile.new(fname)\r\n book.write(tmp.path)\r\n tmp.close\r\n send_file(tmp.path, :filename => fname)\r\n }\r\n format.csv { row = @user\r\n @csv_string = FasterCSV.generate({:encoding => 'UTF-8', :col_sep => (SystemSetting['csv_export_separator'] || ';')}) do |csv|\r\n cols = []\r\n User::FIELDS.each{|k,v| cols << k if [:string, :text, :integer, :float, :date, :time, :datetime, :timestamp, :ho_assoc, :bt_assoc].include? v}\r\n cols.reject!{|c| [:customers, :accesses, :dev_feedbacks, :file_imports].include?(c) }\r\n csv << cols.map{|c|\r\n if [:ho_assoc, :bt_assoc].include?(User::FIELDS[c])\r\n v = row.send(c) ; v ? v.disp_name : nil\r\n else\r\n row.send(c)\r\n end\r\n }\r\n end\r\n @export_encoding ||= SystemSetting['csv_export_encoding'] || 'UTF-16LE'\r\n conv = Iconv.new(@export_encoding, 'UTF-8')\r\n send_data(conv.iconv(@csv_string), :filename => \"#{f_name}.csv\", :disposition => 'attachment', :type => \"text/csv;charset=#{@export_encoding.downcase}\")\r\n return\r\n }\r\n end\r\n else\r\n pagin_opts[:page] = 1\r\n pagin_opts[:per_page] = User.count+1\r\n @users = User.paginate(pagin_opts)\r\n respond_to do |format|\r\n format.html {\r\n @no_menubar = true\r\n @no_links = true\r\n data = render_to_string(:template => '/users/list.html.erb', :layout => 'minimal').gsub(/\\ssrc=\\\"\\//, %Q[ src=\"#{request.protocol}#{request.host_with_port}/])\r\n send_data(data, :filename => \"users.html\", :disposition => 'attachment', :type => 'text/html;charset=utf-8') }\r\n format.doc {\r\n @no_menubar = true\r\n @no_links = true\r\n data = render_to_string(:template => '/users/list.html.erb', :layout => 'minimal').gsub(/\\ssrc=\\\"\\//, %Q[ src=\"#{request.protocol}#{request.host_with_port}/])\r\n send_data(data, :filename => \"users.doc\", :disposition => 'attachment', :type => 'application/msword;charset=utf-8') }\r\n format.pdf {\r\n @pdf = true\r\n @debug_pdf = params[:debug_pdf]\r\n params[:format] = 'html'\r\n html = render_to_string(:template => '/users/list.html.erb', :layout => 'pdf')\r\n html.gsub!(/\\/images\\//, Rails.root.join('public', 'images/')) if !params[:debug_pdf]\r\n render(:text => html, :layout => 'pdf') and return if params[:debug_pdf]\r\n kit = PDFKit.new(html, :encoding => 'UTF-8')\r\n kit.stylesheets << Rails.root.join('public', 'stylesheets', 'pdf.css')\r\n pdf = kit.to_pdf\r\n send_data(pdf, :filename => \"users.pdf\") unless params[:debug_pdf] || pdf.blank?\r\n\r\n # send_data(render_to_string(:layout => false, :action => :list), :filename => \"users.pdf\", :disposition => 'attachment', :type => 'application/pdf;charset=utf-8')\r\n\r\n }\r\n format.xml {\r\n send_data(@users.to_xml, :filename => ('users.xml'), :disposition => 'attachment', :type => 'text/xml;charset=utf-8')}\r\n format.xls {\r\n book = Spreadsheet::Workbook.new\r\n sheet = book.create_worksheet(:name => \"users\")\r\n sheet.row(0).concat([\"Login\", \"First Name\", \"Last Name\", \"Email\", \"Telephone\", \"Language\", \"Active\", \"Salt\", \"User Accesses\", \"Profiles\"])\r\n @users.each_with_index do |row,i|\r\n sheet.row(i+1).replace([row.login, row.first_name, row.last_name, row.email, row.telephone, row.language, row.active, row.salt, row.user_accesses.map(&:disp_name).to_sentence, row.profiles.map(&:disp_name).to_sentence])\r\n end\r\n fname = \"users.xls\"\r\n tmp = Tempfile.new(fname)\r\n book.write(tmp.path)\r\n tmp.close\r\n send_file(tmp.path, :filename => fname)\r\n }\r\n format.csv {\r\n @csv_string = FasterCSV.generate({:encoding => 'UTF-8', :col_sep => (SystemSetting['csv_export_separator'] || ';')}) do |csv|\r\n cols = []\r\n User::FIELDS.each{|k,v| cols << k if [:string, :text, :integer, :float, :date, :time, :datetime, :timestamp, :ho_assoc, :bt_assoc].include? v}\r\n cols.reject!{|c| [:customers, :accesses, :dev_feedbacks, :file_imports].include?(c) }\r\n csv << cols.map{|c| _(c.titleize)}\r\n @users.map{|row|\r\n csv << cols.map {|c|\r\n if [:ho_assoc, :bt_assoc].include?(User::FIELDS[c])\r\n v = row.send(c) ; v ? v.disp_name : nil\r\n else\r\n row.send(c)\r\n end\r\n }\r\n }\r\n end\r\n @export_encoding ||= SystemSetting['csv_export_encoding'] || 'UTF-16LE'\r\n conv = Iconv.new(@export_encoding, 'UTF-8')\r\n send_data(conv.iconv(@csv_string), :filename => \"users.csv\", :disposition => 'attachment', :type => \"text/csv;charset=#{@export_encoding.downcase}\")\r\n }\r\n end\r\n end\r\n end", "def solicitudes\n report = SolicitudesReport.new(:page_size => 'LEGAL',\n :page_layout => :landscape)\n report.reporttitle = 'REPORTES DE SOLICITUDES'\n report.items = Solicitud.find(:all, :conditions => [\"solicitudes.institucion_id = ? and solicitudes.anulada = ?\", current_usuario.institucion_id, false], :order => :numero)\n output = report.to_pdf\n\n file_name = \"solicitudes_\" + Time.now.to_i.to_s + \".pdf\"\n\n respond_to do |format|\n format.pdf do\n send_data output, :filename => file_name,\n :type => \"application/pdf\"\n end\n end\n end", "def user_list\n @room = current_user.room\n @user_list = @room.users\n render partial: \"user_list\"\n end", "def show \n available_users\n end", "def index\n @clientes = Cliente.paginate(:page => params[:page], :per_page => 10)\n @empresa= Configuracion.find(:first)\n @nombreempresa = @empresa.nombre_empresa\n @logo = @empresa.logo\n @direccion = @empresa.direccion\n @telefono = @empresa.telefono\n @funcionario = current_user.funcionario.full_name\n @fecha = Time.now.strftime(\"%d %b %Y, %H:%m\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clientes }\n format.pdf{render :layout => false}\n end\n end", "def index\n users = get_collection(visible_users) || return\n\n respond_to do |format|\n format.xml { render xml: users.to_xml(only: DEFAULT_FIELDS, root: :users, skip_types: true) }\n format.json { render json: users.to_json(only: DEFAULT_FIELDS) }\n end\n end", "def show\n @list = current_user.list\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 index\n @corporate_users = User.get_all_users(current_user).where.not(id: current_user.id)\n @corporate_users = @corporate_users.paginate(:page => params[:page],:per_page => 10).order('id DESC')\n end", "def index\n #obtiene todos los registros de la tabla client\n #cambiar el 5 por el numero de elementos por pagiba\n @clients = Client.order(sort_column + \" \" + sort_diection).search(params[:search]).paginate(:per_page => 30, :page => params[:page])\n \n\n respond_to do |format|\n format.html\n format.json { render json: @clients }\n format.csv { send_data text: @clients.to_csv }\n format.xls \n format.pdf {render template: 'clients/reporte', pdf: 'Clientes', layout: 'pdf.html'}#, header: { right: 'Página [page] de [topage]' }}\n end\n end", "def index\n @publicaciones_para_mostrar = Array.new\n publicaciones = Announcement.aproved.reverse\n if current_user.is_oficial\n @publicaciones_para_mostrar = publicaciones\n else\n publicaciones.each do |publicacion|\n if publicacion.aprobada(current_user)\n @publicaciones_para_mostrar.push(publicacion)\n end\n end\n end\n @publicaciones_para_mostrar = @publicaciones_para_mostrar.paginate(page: params[:page], per_page: 1)\n\n respond_to do |format|\n format.html\n format.js\n end\n end", "def index\n # On récupère la liste des utilisateurs avec une requête sur la base, de sorte à ce qu'il\n # n'y ait rien d'affiché au chargement. Cela permet un chargement très rapide de la page.\n @utilisateurs = Utilisateur.requete_id(params[:requete]) + Utilisateur.requete_nom(params[:requete]) + Utilisateur.requete_prenom(params[:requete])\n end", "def index\n authorize @competition.competitors.new\n add_breadcrumb \"Display Competition Candidates\"\n @competitors = if @competition.score_ineligible_competitors?\n @competition.signed_up_competitors\n else\n @competition.signed_up_competitors.reject(&:ineligible?)\n end\n\n if params[:sort]\n case params[:sort]\n when \"result\"\n @competitors = @competitors.sort_by { |a| a.result }\n when \"gender\"\n @competitors = @competitors.sort_by { |a| [a.gender, a.overall_place] }\n end\n end\n\n if params[:gender]\n @gender = params[:gender]\n @lanes_for_places = []\n (1..8).each do |i|\n @lanes_for_places[i] = params[\"lane_for_place_#{i}\"]\n end\n end\n\n respond_to do |format|\n format.html\n format.pdf { render_common_pdf \"index\" }\n end\n end", "def citas_del_dia\n if current_user.tipo == \"medico\"\n doctor = Doctor.find_by(user_id: current_user.id)\n @pediatric_appointments = PediatricAppointment.search(params[:search]).where(doctor_id: doctor.id).order(:hora).paginate(:per_page => 4, :page => params[:page])\n else\n @pediatric_appointments = PediatricAppointment.search(params[:search]).order(:hora).paginate(:per_page => 4, :page => params[:page])\n end\n respond_to do |format|\n format.html\n format.pdf do\n pdf = PediatricAppointmentsPdf.new(@pediatric_appointments)\n send_data pdf.render, filename: \"citas_pediatricas_del_dia_#{params[:search]}.pdf\",\n type: \"application/pdf\",\n disposition: \"inline\"\n end\n end\n end", "def index\n @cios = Cio.includes(:animal, :cobertura).propriedade(current_usuario)\n \n respond_to do |format|\n format.html\n format.pdf {render pdf: \"Cios\"} \n end \n end", "def index\n @pago = Pago.new\n id = session[:farmacia_id]\n @cant_lab = Farmacium.find_by_sql(\"select cant_lab from farmacia where id = #{id} \").first\n sql = \"Select * from laboratorios where not exists (select * from lab_fars where lab_fars.laboratorio_id = laboratorios.id and lab_fars.farmacium_id = #{id} ) and laboratorios.activo = true order by nombre\"\n @laboratorios = Laboratorio.paginate_by_sql(sql, :page => params[:page], :per_page => 5)\n end", "def index\n\n\n unless session[:user].nil?\n if session[:user]['perfil'] == 'Administrador'\n @users = User.all\n else\n respond_to do |format|\n flash[:warning] ='Você não possui permissão para acessar esse recurso.'\n format.html {redirect_to '/'}\n end\n end\n else\n respond_to do |format|\n format.html {redirect_to '/'}\n end\n end\n end", "def index\n render plain: User.all.order(:id).to_formatted_list\n end", "def show\n if Perfilusuario.where(:id => current_user.id).exists?\n @valor = 1\n @telefonos = Telefonousuario.where(:idUser => current_user.id).order(\"tipo\")\n @emails = Emailusuario.where(:idUser => current_user.id)\n @perfilusuarios = Perfilusuario.find(current_user.id)\n @user = User.find(current_user.id)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @perfilusuarios }\n format.json { render json: @telefonos }\n format.json { render json: @emails }\n format.json { render json: @user }\n \n end\n else\n @valor = 0\n end\n \n\n end", "def index\n\t\tauthorize! :index, @user\n\n @fichario_assuntos = Fichario::Assunto.order('created_at ASC').paginate :page => params[:page], :per_page => 5\n @total = Fichario::Assunto.all.count\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @fichario_assuntos }\n end\n end", "def listing\n @user = User.all\n unless current_user.admin?\n redirect_to dashboard_show_path\n end \n end", "def index\n @recurso_servidors = RecursoServidor.all\n\n respond_to do |format| \n format.html\n format.pdf { \n render pdf: \"recursos\",\n footer: { center: \"[page] de [topage]\" },\n encoding: 'utf8',\n orientation: 'Landscape',\n page_size: 'A4',\n default_header: false,\n grayscale: false,\n enable_plugins: true,\n keep_relative_links: true,\n dpi: '300',\n print_media_type: true,\n no_pdf_compression: true,\n image_quality: 10,\n font_size: '30'\n }\n end\n end", "def show\n @lista = Lista.find(params[:id])\n\n respond_to do |format|\n if @lista.publica?\n format.html { render 'show' }\n else\n if (user_signed_in? && current_user.id == @lista.user_id)\n format.html { render 'show' }\n else\n format.html { render home_index_path, notice: \"Lista não encontrada.\" }\n end\n end\n end\n end", "def index\n @users = @user.users\n render layout: false\n end", "def show_list\n\t\t\t@my_list.show\n\t\tend", "def show\n id = session[:farmacia_id]\n laboratorio = params[:id]\n @lab = Laboratorio.find_by_sql(\"select nombre, id from laboratorios where id = #{laboratorio} \").first \n sql = \"Select * from productos where not exists (select * from pro_fars where pro_fars.producto_id = productos.id and pro_fars.farmacium_id = #{id}) and laboratorio_id = #{laboratorio} and productos.activo = true order by nombre\"\n @productos = Producto.paginate_by_sql(sql, :page => params[:page], :per_page => 8)\n @pro_far = ProFar.new\n render :template => \"pro_fars/index\"\n end", "def list\n # ask the user_repository for a list of all the users\n users = @user_repository.all\n # pass that list to the view to display\n @view.list_users(users)\n end", "def show\n if(session[:user]==nil)\n redirect_to \"/login\" and return\n end\n \n check=Auth.where(:username =>session[:user]).select('DISTINCT ON (username) *').pluck(:role)\n if(check[0]=='S' or check[0]=='Student' )\n redirect_to studet_path(check,:uin =>session[:user]) and return\n end\n if params[:uin] == nil\n params[:uin] = session[:pdf_user]\n end\n \n @detail=Review.rev_func(params[:uin]).select('DISTINCT ON (reviews.user_id,reviews.year) *').limit(1)\n @revs=Review.rev_func(params[:uin]).select('DISTINCT ON (reviews.user_id,reviews.year) *')\n temp=@detail.pluck(:user_id)\n temp2=User.where(:uin => temp[0]).pluck(:advisor)\n temp3=User.where(:uin => temp2[0]).pluck(:first_name)\n temp4=User.where(:uin => temp2[0]).pluck(:last_name)\n if temp3!=[] and temp4!=[]\n temp5=temp3[0]+' '+temp4[0]\n @tempad=temp5\n else \n @tempad=\"\"\n end\n session[:pdf_user]= params[:uin]\n end", "def index\n @institutos = Instituto.all;\n if @institutos.present?\n @teminst = 1;\n else\n @teminst = 0;\n end\n \n if params[:search]\n @institutos = Instituto.where(\"nome like ?\", \"%#{params[:search]}%\").page(params['page']).per(5);\n else\n @institutos = Instituto.order(:nome).page(params['page']).per(5);\n end\n \n respond_to do |format|\n format.html\n\n format.pdf { render pdf: \"\",\n footer: { center: \"[page] of [topage]\" }\n }\n end \n end", "def index\n @notis = Free.all\n @frees = Free.order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 10)\n end", "def show\n initLists\n end", "def index\n @pacientes = Paciente.all\n\n respond_to do |format|\n format.html\n format.json\n format.pdf {render template: 'pacientes/pdf', pdf: 'pacientes'}\n end\n\n end", "def index\n @depositos = Deposito.para_listar(prevision: prevision_activa)\n end", "def list_org\n @users = User.where(organization: true)\n\n render \"list_org\"\n end", "def index\n @user = current_user.id\n @users = User.order(sort_column + \" \" + sort_direction)\n respond_to do |format|\n format.html\n format.csv { render text: @users.to_csv }\n format.pdf do\n pdf = ReportPdf.new(@users)\n send_data pdf.render, filename: 'Report-'+ Time.now.strftime(\"%d/%m/%Y\") +'.pdf', type: 'application/pdf'\n end\n end\n end", "def alta_profesores_lista\n\t\t@profesores = []\n\t\t@tab = \"admin\"\n\t\tusuarios = User.select('id, matricula, nombre, apellido, admin, profesor').order(:matricula)\n\t\tusuarios.each do |usuario|\n\t\t\tif (usuario.matricula[0].chr == \"l\") || (usuario.matricula[0].chr == \"L\")\n\t\t\t#se checa primero que la matricula empiece con 'l'\n\t\t\t#'chr' se utiliza para leer el caracter tomando el ASCII\n\t\t\t\tif (!usuario.admin? && !usuario.profesor?)\n\t\t\t\t#checar que no sea admin ni profesor aun\n\t\t\t\t\t@profesores << usuario\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def index\n if current_user\n @especificacion = Specification.where(:id => session[:specification_sel_id]).first \n @user = User.where(:username => @especificacion.user_id).first\n if current_user.acquisition? || current_user.import? || current_user.acquisition_analist? || current_user.import_analist? \n if @user.director? || @user.directorate? || @user.gsmp? || @user.acquisition? || @user.import? || @user.quality? || @user.manage? || @user.acquisition_analist? || @user.import_analist? || @user.quality_analist? || @user.manage_analist? \n @mostrar = true\n else\n @mostrar = false\n end\n elsif current_user.director? || current_user.directorate? || current_user.gsmp? || current_user.quality? || current_user.quality_analist? || current_user.manage? || current_user.manage_analist? || current_user.section_boss? || current_user.proy_responsible?\n\t@mostrar = false\n else\n @mostrar = true\n end\n \t@requisitions = Requisition.where(:specification_id => session[:specification_sel_id]).first\n @sumRequisition = Requisition.where(:specification_id => session[:specification_sel_id]).count\n respond_to do |format|\n\t format.html do\n if @sumRequisition != 0\n redirect_to @requisitions\n end\n end\n format.pdf do\n\t\t\n\t\tredirect_to @requisitions.attachment\n\t end\n\t format.xml do\n specification = Specification.find(session[:specification_sel_id])\n\t specification.p6 = 2\n\t session[:specification_p6] = specification.p6\n\t specification.save\n redirect_to \"/requisitions/#{@requisitions.id}?pdf=1\"\n end\n end\n end\n end", "def show\n @usuario = current_user\n respond_to do |format|\n format.html\n format.xls # { send_data @products.to_csv(col_sep: \"\\t\") }\n format.pdf do\n pdf = EtapaPdf.new(@etapa, @usuario)\n send_data pdf.render, filename: \"etapa#{@etapa}.pdf\", type: \"application/pdf\", disposition: \"inline\"\n end\n end\n end", "def index_user\n\t\t@user_convos = Conversation.involving_user(params[:user_id])\n\t\trender_list_of_convos(@user_convos)\n\tend", "def show\n @user = User.all\n @userr = User.find(@work.creador)\n respond_to do |format|\n format.html\n format.pdf do\n pdf = WorkshowPdf.new(@work, view_context, @userr)\n send_data pdf.render, filename: \"work_#{@work.id}.pdf\",type: \"application/pdf\", disposition: \"inline\"\n \n end\n end\n end", "def index\n @achadoperdidos = Achadoperdido.where(condominio_id: current_user.condominio_id).page(params[:page]).per(10)\n end" ]
[ "0.9142709", "0.7918038", "0.7681406", "0.662754", "0.61289126", "0.60317403", "0.5996198", "0.5926648", "0.59234524", "0.5917533", "0.59018946", "0.5886396", "0.58857334", "0.5835835", "0.58339727", "0.58128566", "0.5802537", "0.5786431", "0.57667625", "0.5758169", "0.5742438", "0.57153726", "0.5713725", "0.5713157", "0.5706353", "0.56878364", "0.56851923", "0.56701124", "0.5666089", "0.56625336", "0.5659994", "0.5656057", "0.5643826", "0.5638038", "0.5635883", "0.5633642", "0.5618279", "0.5611489", "0.5606652", "0.5598452", "0.55902725", "0.5577546", "0.5571275", "0.55563563", "0.55539", "0.5541399", "0.55365413", "0.55344963", "0.55309373", "0.55307084", "0.5521989", "0.55207425", "0.5518375", "0.5509642", "0.55093163", "0.5485769", "0.5485715", "0.54825574", "0.54815614", "0.5474323", "0.5466357", "0.5463099", "0.546305", "0.5460911", "0.54556733", "0.5451581", "0.54505664", "0.5450022", "0.544886", "0.54456836", "0.5445037", "0.5440401", "0.5425392", "0.5422145", "0.5419014", "0.54144746", "0.54084283", "0.540553", "0.5402657", "0.54020387", "0.53984237", "0.53975487", "0.53974146", "0.53965086", "0.53898746", "0.5387927", "0.5387021", "0.5383614", "0.53796625", "0.53785986", "0.53785664", "0.5377955", "0.53708327", "0.53693223", "0.5368548", "0.5367739", "0.5361288", "0.5359043", "0.5355222", "0.5354786" ]
0.6936076
3
Fin de def generatePDFsportif Genere un PDF de la liste des users non sportif voulant faire du sport
def generatePDFnonSportif(all_users) Prawn::Document.generate("public/listUsers.pdf", :page_layout => :landscape) do |pdf| table_data = [["Nom", "Email", "Date de naissance", "Poids actuel", "Poids Idéal", "Taille", "IMC"]] all_users.each do |u| table_data += [["#{u.nom}", "#{u.email}", "#{u.ddn}", "#{u.poidsActu}", "#{u.poidsIdeal}", "#{u.taille}", "#{u.imc_without_desc}"]] end #Fin de boucle pdf.stroke_horizontal_rule pdf.formatted_text [{:text => "\nListe des utilisateurs non sportif\n\n",:styles => [:bold], :size => 20 }], :align => :center pdf.stroke_horizontal_rule pdf.text "\n \n \n" pdf.table(table_data,:width => 720, :row_colors => ["A9D0F5", "FFFFFF"]) pdf.text "\n\n" pdf.text "Document créé le " + Time.now.to_s + "\n" , :align => :center pdf.stroke_horizontal_rule end #Fin d'écriture document PDF end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generatePDF(all_users) \n Prawn::Document.generate(\"public/listUsers.pdf\", :page_layout => :landscape) do |pdf|\n \n table_data = [[\"Nom\", \"Email\", \"Date de naissance\", \"Poids actuel\", \"Poids Idéal\", \"Taille\", \"IMC\", \"Sportif\", \"Souhaite faire du sport\" ]]\n \n all_users.each do |u|\n table_data += [[\"#{u.nom}\", \"#{u.email}\", \"#{u.ddn}\", \"#{u.poidsActu}\", \"#{u.poidsIdeal}\", \"#{u.taille}\", \"#{u.imc_without_desc}\", \"#{u.isSportif}\" , \"#{u.wantDoSport}\"]] \n end #Fin de boucle \n \n pdf.stroke_horizontal_rule\n pdf.formatted_text [{:text => \"\\nListe des utilisateurs\\n\\n\",:styles => [:bold], :size => 20 }], :align => :center\n pdf.stroke_horizontal_rule\n pdf.text \"\\n \\n \\n\"\n pdf.table(table_data,:width => 720, :row_colors => [\"A9D0F5\", \"FFFFFF\"])\n pdf.text \"\\n\\n\"\n\n pdf.text \"Document créé le \" + Time.now.to_s + \"\\n\" , :align => :center\n pdf.stroke_horizontal_rule\n end #Fin d'écriture document PDF\n end", "def showUserList\n @titre = \"Liste des utilisateurs\"\n @users = User.all\n generatePDF(@users)\n end", "def showNonSportifList\n @users = User.where(isSportif: false, wantDoSport: true)\n @titre = \"Liste des utilisateurs non sportifs\"\n generatePDFnonSportif(@users)\n render 'showUserList'\n end", "def index\n @ruta_users = RutaUser.all\n respond_to do |format|\n format.html\n format.pdf do \n render pdf: 'listado_de_rutas_asignadas', \n orientation: 'Landscape',\n template: 'ruta_users/listado_de_rutas_asignadas.html.erb'\n end\n end\n end", "def menu_gestion_docencia\n periodo = Period.where(estatus: 'Activo').take\n \n @teachings = Teaching.joins(:users).where(users: {id: current_user.id}).where(ano_periodo: periodo).order(fecha_i: :desc)\n @teachings2 = @teachings\n @resultados = @teachings.count\n @teachings = @teachings.page(params[:page])\n\n respond_to do |format|\n format.html\n format.pdf do\n pdf = TeachingindexPdf.new(@teachings2, view_context)\n send_data pdf.render, filename: \"Lista de otras actividades del área de docencia.pdf\",type: \"application/pdf\", disposition: \"inline\"\n end\n end\n end", "def menu_gestion_docencia_trabajos\n periodo = Period.where(estatus: 'Activo').take\n \n @works = Work.joins(:users).where(users: {id: current_user.id}).where(ano_periodo: periodo).order(fecha_i: :desc)\n @works2 = @works\n @resultados = @works.count\n @works = @works.page(params[:page])\n\n respond_to do |format|\n format.html\n format.pdf do\n pdf = WorkindexPdf.new(@works2, view_context)\n send_data pdf.render, filename: \"Lista de actividades de trabajos de grado del área de docencia.pdf\",type: \"application/pdf\", disposition: \"inline\"\n end\n end\n end", "def index\n @users = User.all\n respond_to do |format|\n format.html\n format.pdf do\n pdf = PDF::Writer.new\n @users.each do |user|\n pdf.text user.name\n end\n send_data pdf.render, :filename => 'products.pdf', :type => 'application/pdf', :disposition => 'inline'\n end\n end\n end", "def menu_gestion_investigacion\n periodo = Period.where(estatus: 'Activo').take\n \n @researches = Research.joins(:users).where(users: {id: current_user.id}).where(ano_periodo: periodo).order(fecha_i: :desc)\n @researches2 = @researches\n @resultados = @researches.count\n @researches = @researches.page(params[:page])\n\n respond_to do |format|\n format.html\n format.pdf do\n pdf = ResearchindexPdf.new(@researches2, view_context)\n send_data pdf.render, filename: \"Lista de otras actividades del área de investigación.pdf\",type: \"application/pdf\", disposition: \"inline\"\n end\n end\n end", "def generar_planilla_siniestro\n add_variables_to_assigns\n htmldoc_env = \"HTMLDOC_NOCGI=TRUE;export HTMLDOC_NOCGI\"\n generator = IO.popen(\"#{htmldoc_env};htmldoc -t pdf --path \\\".;#{request.protocol}#{@request.env[\"HTTP_HOST\"]}\\\" --footer / --fontsize 10 --webpage -\", \"w+\")\n generator.puts @template.render(\"/solicitudes/orden_despacho_historico/_view_orden_despacho_planilla.rhtml\")\n generator.close_write\n send_data(generator.read, :filename => \"orden_despacho.pdf\", :type => \"application/pdf\")\n end", "def generate_pdf(filename, pupil)\n Prawn::Document.generate(filename) do\n text \"CONTRATO DE PRESTAÇÃO DE SERVIÇOS EDUCACIONAIS EM DANÇA\"\n text \"Dados do Contratante\"\n text \"Aluno: #{pupil.first_name} #{pupil.last_name}\"\n text \"Contratante: #{pupil.first_name} #{pupil.last_name}\"\n text \"Endereço: #{pupil.user.try(:street)}, #{pupil.user.try(:district)}, \" +\\\n \"#{pupil.user.try(:city)}, #{pupil.user.try(:state)}, #{pupil.user.try(:zip_code)}\"\n text \"CPF: #{pupil.user.try(:cpf)} RG: #{pupil.user.try(:rg)}\"\n text \"Telefone(s): #{pupil.user.phone_numbers.collect { |p| p.number }}\"\n text \"E-mail: #{pupil.user.try(:email)}\"\n text \"Dados do Contratado\"\n text \"ESPAÇO DANÇAS MANÁ, localizado na Rua 58, Quadra 47, Casa 02, Vinhais, São Luís/MA,\" +\\\n \"inscrito no CNPJ nº 10.724.129/0001-04, representada por DYANNE MIRELLE BARBOSA SANTANA\" +\\\n \"portadora do CP F nº 074.016.854-18.\"\n text \"DO OBJETO E DAS CONDIÇÕES\"\n text \"Cláusula 1º: A Contratante firma com o Contratado a matrícula no(s) curso(s) de: BALLET CLÁSSICO (____); DANÇA CONTEMPORÂNEA (____); SAPATEADO (____); ALONGAMENTO (____); JAZZ (____); DANÇA DE SALÃO (____); DANÇA DE RUA (____); DANÇA DO VENTRE (____); DANÇA SENSUAL (____).\"\n text \"Cláusula 2ª: O presente contrato compreende apenas a prestação de serviços educacionais em dança, não estão incluídos no valor deste curso: taxa de exames; outros cursos extracurriculares; materiais; uniformes; figurinos; dentre outros materiais e serviços, que serão cobrados separadamente pelo Contratado.\"\n text \"Cláusula 3ª: Os cursos oferecidos pelo Contratado terão duração de ___ (______) meses, de ___________ à ___________ de 2013, assim como o presente contrato.\"\n text \"Cláusula 4ª: A formação e a continuidade das turmas dos cursos oferecidos pelo Contratado dependerá do número mínimo de alunos de _____ por turma, a serem preenchidos dentro do prazo máximo de 2 (dois) meses, contados a partir do início das atividades.\"\n text \"§1º: O não atingimento do número mínimo de alunos por turma implicará no remanejamento do aluno para outra turma compatível em nível, carga horária e preço, de acordo com o interesse do Contratante.\"\n text \"§2º: Caso não seja de interesse do Contratante fazer o remanejamento na hipótese do parágrafo anterior, este poderá requerer o cancelamento da sua matrícula sem o pagamento de qualquer multa contratual, desde que este requerimento ocorra antes da data de vencimento da mensalidade.\"\n text \"Cláusula 5ª: A Contratada se obriga a oferecer ao Contratante apenas as aulas especificadas na carga horária e nos horários definidos na tabela em anexo.\"\n text \"§1º: A reposição de aulas perdidas só será possível se houver vaga em outra turma em nível compatível aquele cursado pelo Contratante. Caso contrário o Contratante não terá direito a repor a aula.\"\n text \"§2º: Os alunos horistas poderão remarcar as aulas com até 5 (cinco) horas de antecedência do horário previamente marcado.\"\n text \"§3º: O aluno horista que não remarcar a aula no prazo estabelecido no parágrafo anterior perderá o direito de repor a aula previamente marcada.\"\n text \"Cláusula 6ª: O contrato de prestação de serviço é personalíssimo em relação ao aluno acima discriminado.\"\n text \"Cláusula 7ª: O curso contratado não possui diplomação.\"\n text \"Cláusula 8ª: O Contratante aceita os programas de ensino adotados, acatando o regimento interno do Contratado, normas disciplinares e o agrupamento dos alunos de acordo como o seu nível técnico.\"\n text \"DO PAGAMENTO DA COBRANÇA\"\n text \"Cláusula 9ª: O curso tem o custo total de R$ __________ (_______________________________________).Parágrafo Único: O valor curso pode ser pago em até ___ (_______) parcelas de __________(_________________________)\"\n text \"Cláusula 10ª: A cobrança tanto das parcelas quanto do valor total do curso será feita por meio de boleto bancário.\"\n text \"§1º: O(s) boleto(s) pode(m) ser pago(s) na própria sede da Contratada: em espécie e em cartão na modalidade débito. As modalidades aqui descritas não excluem as outras disponibilizadas pela instituição financeira que emite o boleto de cobrança.\"\n text \"§2º: O pagamento no cartão na modalidade crédito é apenas permitido para o pagamento integral do valor do curso.\"\n text \"§3°: O pagamento da mensalidade em espécie e dentro da data do vencimento confere ao aluno desconto de 4% na mesma.\"\n text \"§4°: O pagamento integral do valor do curso pago em espécie confere ao aluno desconto de 5%.\"\n text \"Cláusula 11ª: O Contratante deseja pagar o curso em (____) parcela(s) de R$ __________ (_______________________________) e estabelece como dia do vencimento da(s) parcela(s) o dia ____ do mês (de cada mês).\"\n text \"Cláusula 12ª: Os juros e multa diária pelo atraso no pagamento serão estabelecidos pela instituição financeira que realiza a emissão do(s) boleto(s) de pagamento.\"\n text \"Cláusula 13ª: O atraso no pagamento por prazo superior a 30 (trinta) dias implicará na suspensão do acesso as aulas e na inscrição do nome do inadimplente no cadastro de protesto, SPC e Serasa.\"\n text \"DA RECISÃO CONTRATUAL\"\n text \"Cláusula 14ª: A rescisão do contrato pode ser feita unilateralmente pelo Contratado, quando não houverem sido alcançadas as condições estabelecidas na Cláusula 4ª e no seu §1º, do presente contrato.\"\n text \"Parágrafo Único: O contrato também pode ser reincidido unilateralmente pelo Contratado quando o contratante não obedecer aos ditames da Cláusula 8ª.\"\n text \"Cláusula 15ª: A rescisão pode ser feita sem custas adicionais pelo Contratante, desde que seja requerida até a data do vencimento da parcela vincenda.\"\n text \"DISPOSIÇÕES GERAIS\"\n text \"Cláusula 16ª: O ingresso dos alunos nas turmas será precedido de avaliação física.\"\n text \"§1º: O Contratante poderá dispensar a avaliação física desde que ateste por escrito que encontra-se em condições de saúde para a prática de exercícios físicos.\"\n text \"§2º: É de inteira responsabilidade do Contratante informar aos professores eventuais doenças, lesões ou sequelas.\"\n text \"\"\n text \"\"\n text \"\"\n text \"\"\n text \"São Luís, _____ de ______________________ de 2013.\"\n text \"Contratante:________________________ Contratado: ________________________\"\n text \"Testemunha: ______________________ Testemunha: ______________________\"\n text \"CPF: CPF:\"\n text \"Quadro de Turmas da Matrícula\"\n end\n end", "def solicitudes\n report = SolicitudesReport.new(:page_size => 'LEGAL',\n :page_layout => :landscape)\n report.reporttitle = 'REPORTES DE SOLICITUDES'\n report.items = Solicitud.find(:all, :conditions => [\"solicitudes.institucion_id = ? and solicitudes.anulada = ?\", usuario_actual.institucion_id, false], :order => :numero)\n output = report.to_pdf\n\n file_name = \"solicitudes_\" + Time.now.to_i.to_s + \".pdf\"\n\n respond_to do |format|\n format.pdf do\n send_data output, :filename => file_name,\n :type => \"application/pdf\"\n end\n end\n end", "def index\n @questionnaires = Questionnaire.all\n\n respond_to do |format|\n format.html\n format.pdf do\n pdf = QuestionnairePdf.new\n User.all.each do |user|\n if (user.questionnaire)\n pdf.create_page(user.questionnaire)\n pdf.start_new_page\n end\n end\n\n send_data pdf.render, filename: \"questionnaire\", type: \"application/pdf\", disposition: \"inline\"\n end\n end\n end", "def index\n @personnelspdf = Personnel.all\n @q = Personnel.paginate(:page => params[:page], :per_page => 10).search(params[:q])\n @personnels = @q.result\n\n ##pdf\n respond_to do |format|\n format.html\n format.pdf do\n pdf = PersonnelsPdf.new(@personnelspdf)\n send_data pdf.render, filename: 'personnels.pdf', type: 'application/pdf'\n end\n end\n\n\n end", "def index\n # @films = Film.search(params[:search]).paginate(page: params[:page], per_page: 10).order('films.brazilian_title')\n @films = Film.search(params[:search]).order('films.brazilian_title').page(params[:page])\n\n respond_to do |format|\n format.html\n format.pdf {\n render pdf: \"films-list-report\",\n encoding: 'utf-8',\n header: {center: \"[ #{I18n.l Date.today, format: '%d.%m.%Y'} - #{number_with_delimiter(Film.count)} filmes cadastrados. ]\"},\n footer: {center: \"[page] de [topage]\"}\n }\n end\n end", "def pdf_list_payers\n @insurance = load_insurance\n @rotation = @insurance.rotations.last\n\n respond_to do |format|\n format.pdf do\n pdf = ListPayersPdf.new(@rotation, view_context)\n send_data pdf.render,\n filename: \"#{@insurance.number}_rotation_#{@rotation.rotation_date.strftime(\"%Y-%m-%d\")}_list_payers.pdf\",\n type: \"application/pdf\",\n disposition: \"inline\" \n end\n end \n end", "def solicitudes\n report = SolicitudesReport.new(:page_size => 'LEGAL',\n :page_layout => :landscape)\n report.reporttitle = 'REPORTES DE SOLICITUDES'\n report.items = Solicitud.find(:all, :conditions => [\"solicitudes.institucion_id = ? and solicitudes.anulada = ?\", current_usuario.institucion_id, false], :order => :numero)\n output = report.to_pdf\n\n file_name = \"solicitudes_\" + Time.now.to_i.to_s + \".pdf\"\n\n respond_to do |format|\n format.pdf do\n send_data output, :filename => file_name,\n :type => \"application/pdf\"\n end\n end\n end", "def index\n # @users = User.all\n @users = User.paginate(page: params[:page], :per_page => 10)\n # @users = User.order(name: :desc).paginate(:page => params[:page], :per_page => 10).search(params[:search])\n respond_to do |format|\n format.html\n format.csv { send_data @users.to_csv }\n format.xls # { send_to @users.to_csv(col_sep: \"\\t\") }\n format.pdf do\n pdf = UsersPdf.new(@users)\n\t send_data pdf.render\n # pdf = Prawn::Document.new\n # pdf.text @users.count.to_s\n # send_data pdf.render\n # pdf = UsersPdf.new(@users)\n # pdf = UserPdf.new(@users, view_context)\n # send_data pdf.render, filename: \"users_#{Time.now}.pdf\",\n # type: \"application/pdf\",\n # disposition: \"inline\"\n end\n end\n end", "def output_pdf\n siz = @report.size.to_i\n if siz < 500 || Dialog.confirm(\"Cela demandera environ #{siz / 250} secondes\")\n path = ask_path('.pdf')\n path ? build_and_save_pdf(path) : 'Annulé'\n else\n 'Annulé'\n end\n rescue\n pdf_error\n end", "def index\n @zgloszenies = Zgloszenie.includes(:user)\n .where(\"zgloszenies.nazwa_urzadzenia ILIKE :q OR users.email ILIKE :q OR users.first_name ILIKE :q OR users.last_name ILIKE :q\", q: \"%#{params[:search]}%\")\n .references(:users)\n .paginate(:page => params[:page], :per_page => 10)\n @user = current_user.id\n\n respond_to do |format|\n format.js\n format.html\n format.pdf do\n pdf = ZgloszenieListaPdf.new(@zgloszenies, @user)\n send_data pdf.render, {filename: \"zgloszenia.pdf\",\n type: \"application/pdf\",\n disposition: \"inline\"}\n end\n end\n end", "def toPDF()\n doc = Prawn::Document.new(:compress => true, :page_size => [500, 280])\n doc.font 'Times-Roman'\n \n # Les images pour le background, le logo, la signature du tresorier\n doc.image \"public/images/recus/recu.png\", :at => [0, 200]\n doc.image \"public/images/recus/logo112x87.png\", :at => [370, 195], :fit => [56, 44]\n doc.image \"public/images/recus/signature_recu.png\", :at => [280, 80], :fit => [147,42]\n\n # Boite avec les informations principales du recu\n doc.bounding_box([5,180], :width => 500) do\n doc.text \"Date: \" + DateTime.now.strftime('%Y-%m-%d')\n \n doc.move_down 42\n annee = DateTime.now.strftime('%Y')\n doc.text \"Reçu pour abonnement à la piscine Dixie \" + annee, :style => :bold\n doc.text \"Receipt for Dixie pool registration \" + annee, :style => :bold\n \n doc.move_down 10\n doc.text \"Nom/Name: \" + nom\n doc.text \"Montant perçu/Amount paid: \" + sprintf('$%6.2f', @famille.paiementTotal)\n end\n \n # Boite avec les coordonnes de la piscine. En haut a droite avec le logo dedans\n doc.bounding_box([220, 195], :width => 210, :height => 45) do\n doc.stroke_bounds\n doc.bounding_box([2, 43], :width => 210) do\n doc.text \"Association Piscine Dixie Inc.\"\n doc.text \"CP 34045\"\n doc.text \"Lachine, Qc, H8S 4H4\"\n end\n end\n \n # Sous la signature\n doc.draw_text \"Trésorier / Treasurer\", :at => [300, 30]\n \n return doc\n end", "def user_c\n \n prueba=Cook.user_c(params[:city_id])\n respond_to do |format|\n format.html {render json: prueba,each_serializer: User_cSerializer, status:200}\n format.pdf do \n pdf = UsersdPdf.new(prueba)\n send_data pdf.render, filename: \"users_by_date.pdf\",\n type: \"application/pdf\",\n disposition: \"inline\"\n end\n end\nend", "def show \n \n @user = User.all#para la lista de checkbox\n @userr = User.find(@coference.creador)#para ver el nombre del creador\n respond_to do |format|\n format.html\n format.pdf do\n pdf = CoferenceshowPdf.new(@coference, view_context, @userr)\n send_data pdf.render, filename: \"coference_#{@coference.id}.pdf\",type: \"application/pdf\", disposition: \"inline\"\n \n end\n end\n \n end", "def enviar_validacion\n #Generamos la carta de verificacion\n pdf = WickedPdf.new.pdf_from_string(\"<h1>¡Hola #{self.hogar.user_admin.name}!</h1> <p>Su código de validación es #{self.activation_token} </p> <p> Un abrazo afectuoso,</p> <p> El equipo de Vesindo</p>\", encoding: \"UTF-8\")\n save_path = Rails.root.join('pdfs',\"#{self.hogar.user_admin.name}.pdf\")\n File.open(save_path, 'wb') do |file|\n file << pdf\n end\n end", "def index\n @users = @current_show.users.includes(:events)\n @tickets = @current_show.tickets.paid.group(:user_id).sum(:quantity)\n @passes = @current_show.tickets.free.group(:user_id).sum(:quantity)\n @prizes = @current_show.packages.where.not(winner: nil).group(:winner_id).count\n\n respond_to do |format|\n format.html { @users = @users.reverse }\n format.pdf do\n booths_with_labels = @current_show.booths.approved.with_add_on('labels')\n printable_users = @users.where.not(address: nil).order(:first_name, :last_name)\n pdf = mailing_labels_pdf(booths_with_labels, printable_users)\n send_data(pdf.render, disposition: 'inline', filename: 'mailing_labels.pdf')\n end\n end\n end", "def menu_gestion_extension_conferencia_o_ponencia\n periodo = Period.where(estatus: 'Activo').take\n \n @coferences = Coference.joins(:users).where(users: {id: current_user.id}).where(ano_periodo: periodo).order(fecha_i: :desc)\n @coferences2 = @coferences\n @resultados = @coferences.count\n @coferences = @coferences.page(params[:page])\n \n respond_to do |format|\n format.html\n format.pdf do\n pdf = CoferenceindexPdf.new(@coferences2, view_context)\n send_data pdf.render, filename: \"Lista de Conferencia o ponencias.pdf\",type: \"application/pdf\", disposition: \"inline\"\n end\n end\n end", "def index\n #pdf_filename = File.join(Rails.root, \"tmp/PDFs/18810993-2017-07-02-adecuacion.pdf\")\n #send_file(pdf_filename, :filename => \"18810993-2017-07-02-adecuacion.pdf\", :disposition => 'inline', :type => \"application/pdf\")\n #validar si se envio la adecuacion\n if session[:usuario_id] && session[:tutor]\n if(!session[:plan_id].blank?)\n\n @bool_enviado = 0\n @adecuacion = Adecuacion.where(planformacion_id: session[:plan_id]).take\n if session[:informe_id].blank?\n estatus_x = EstatusAdecuacion.where(adecuacion_id: @adecuacion.id, actual: 1).take\n else\n estatus_x = EstatusInforme.where(informe_id: session[:informe_id], actual: 1).take\n end\n if (estatus_x.estatus_id != 6 && estatus_x.estatus_id != 5)\n @bool_enviado = 1\n end\n @plan = Planformacion.where(id: session[:plan_id]).take\n\n if !@plan.blank?\n #Ver si el informe fue rachazado\n cpInstructor = Usuario.find(@plan.instructor_id)\n if (cpInstructor.activo == false)\n @cpBloquear = true\n else\n @cpBloquear = false\n end\n #fin\n end\n\n $actividad = params[:actividad_id].to_i\n @documents = []\n if !session[:informe_id].blank?\n @documents = Document.where(\"informe_id <= ? AND adecuacion_id = ? AND actividad_id = ?\",session[:informe_id].to_i , session[:adecuacion_id], $actividad).all\n else\n @documents = Document.where(adecuacion_id: session[:adecuacion_id], informe_id: nil).all\n end\n else\n flash.now[:info]=\"Seleccione una adecuación\"\n redirect_to controller:\"iniciotutor\", action: \"planformacions\"\n end\n else\n redirect_to controller:\"forminst\", action: \"index\"\n end\n end", "def pdf\n @viatico = Viatico.find(params[:id])\n company =@viatico.company_id\n @company =Company.find(company)\n \n \n $lcFecha1= @viatico.fecha1.strftime(\"%d/%m/%Y\") \n $lcMon = @viatico.get_moneda(1)\n $lcPay= \"\"\n $lcSubtotal=0\n $lcIgv=0\n $lcTotal=sprintf(\"%.2f\",@viatico.inicial)\n\n $lcDetracion=0\n $lcAprobado= @viatico.get_processed \n\n\n $lcEntrega5 = \"FECHA :\"\n $lcEntrega6 = $lcFecha1\n\n Prawn::Document.generate(\"app/pdf_output/#{@viatico.id}.pdf\") do |pdf|\n pdf.font \"Helvetica\"\n pdf = build_pdf_header(pdf)\n pdf = build_pdf_body_2(pdf)\n build_pdf_footer(pdf)\n $lcFileName = \"app/pdf_output/#{@viatico.id}.pdf\" \n \n end \n\n $lcFileName1=File.expand_path('../../../', __FILE__)+ \"/\"+$lcFileName\n \n send_file(\"#{$lcFileName1}\", :type => 'application/pdf', :disposition => 'inline')\n\n\n end", "def show\n @user = User.all\n @userr = User.find(@teaching.creador)\n respond_to do |format|\n format.html\n format.pdf do\n pdf = TeachingshowPdf.new(@teaching, view_context, @userr)\n send_data pdf.render, filename: \"teaching_#{@teaching.id}.pdf\",type: \"application/pdf\", disposition: \"inline\"\n \n end\n end\n \n end", "def pdf_list_insureds\n @insurance = load_insurance\n @rotation = @insurance.rotations.last\n\n respond_to do |format|\n format.pdf do\n pdf = ListInsuredsPdf.new(@rotation, view_context)\n send_data pdf.render,\n filename: \"#{@insurance.number}_rotation_#{@rotation.rotation_date.strftime(\"%Y-%m-%d\")}_list_insureds.pdf\",\n type: \"application/pdf\",\n disposition: \"inline\" \n end\n end \n end", "def rpt_facturas_all2_pdf\n\n $lcFacturasall = '0'\n @company=Company.find(params[:company_id]) \n @fecha1 = params[:fecha1] \n @fecha2 = params[:fecha2] \n @cliente = params[:customer_id] \n\n @facturas_rpt = @company.get_facturas_day_cliente(@fecha1,@fecha2,@cliente) \n\n\n Prawn::Document.generate(\"app/pdf_output/rpt_factura.pdf\") do |pdf|\n pdf.font \"Helvetica\"\n pdf = build_pdf_header_rpt(pdf)\n pdf = build_pdf_body_rpt(pdf)\n build_pdf_footer_rpt(pdf)\n $lcFileName = \"app/pdf_output/rpt_factura_all.pdf\" \n end \n $lcFileName1=File.expand_path('../../../', __FILE__)+ \"/\"+$lcFileName \n send_file(\"app/pdf_output/rpt_factura.pdf\", :type => 'application/pdf', :disposition => 'inline')\n end", "def pdf\n \n \n @company =Company.find(1)\n @cabecera =\"Facturacion\"\n @abajo =\"Viatico\"\n \n @cout = Cout.find(params[:id])\n \n Prawn::Document.generate(\"app/pdf_output/#{@cout.id}.pdf\") do |pdf|\n pdf.font \"Helvetica\"\n pdf = build_pdf_header(pdf)\n pdf = build_pdf_body(pdf)\n build_pdf_footer(pdf)\n @lcFileName = \"app/pdf_output/#{@cout.id}.pdf\" \n \n end \n\n $lcFileName1=File.expand_path('../../../', __FILE__)+ \"/\"+@lcFileName\n #send_file(\"#{$lcFileName1}\", :type => 'application/pdf', :disposition => 'inline')\n send_file(@lcFileName, :type => 'application/pdf', :disposition => 'inline')\n end", "def generate_pdf(client_info)\n Prawn::Document.new do\n fill_color \"2E64FE\"\n indent(10) do\n text \"Zimmedari<br/> ka<br/> Humsafar\",:size => 40, :inline_format => true\n end\n image \"#{Rails.root}/app/assets/images/logo.png\" ,:image_width => 60, :image_height => 60, :at => [350,750]\n\n client_info.each_with_index do |client,index|\n fill_color \"000000\"\n if client_info.length != 1\n pad(10) { text \"\\n Client #{index+1} Feedback Information\", align: :center, :size => 32 }\n else\n pad(10) { text \"\\n #{client.name}'s Feedback Information\", align: :center, :size => 32 }\n end\n stroke_horizontal_rule\n pad(10) { text \"<b>Personal Infirmation : </b>\", :size => 20,:inline_format => true }\n indent(30) do\n data = [[ \"<b>Name:</b> #{client.name}\",\"<b>Mobile:</b> #{client.mobile}\"],\n [\"<b>Address:</b> #{client.address}\",\"<b>Phone:</b> #{client.phone}\"],\n [\"<b>Pincode:</b> #{client.pincode}\",\"<b>Email:</b> #{client.email}\"],\n [\"<b>Date Of Birth:</b> #{client.date_of_birth.strftime(\"%F\") rescue \"\"}\",\"<b>Client Anniversary Date:</b> #{client.anniversary_date.strftime(\"%F\") rescue \"\"}\"]]\n table data, :cell_style => { :inline_format => true,:borders => [], :width => 250 }\n end\n pad(10) { text \"<b>Education & Job details : </b>\",:size => 20, :inline_format => true }\n indent(30) do\n data = [[\"<b>Education:</b> #{client.education}\",\"<b>Occupation:</b> #{client.occupation}\"],\n [\"<b>Name Of Company:</b> #{client.name_of_company}\",\"<b>Job Post:</b> #{client.job_post}\"],\n [\"<b>Job Experience:</b> #{client.job_expirience_year}\",\"<b>Income:</b> #{client.income}\"],\n [\"<b>Economical Liability:</b> #{client.economical_liability}\",\"<b>Retirement Age:</b> #{client.retirement_age}\"],\n [\"<b>How many years intend to work:</b> #{client.intend_to_work}\",\"\"]]\n table data, :cell_style => { :inline_format => true,:borders => [], :width => 250 }\n end\n pad(10){text \"<b>Child Details</b>\", :size => 20,:inline_format => true }\n indent(30) do\n pad(5){text \"<b>Number of Child: </b> #{client.number_of_child}\", :inline_format => true }\n data = []\n if !client.child_infos.nil?\n client.child_infos.each_with_index do |child,i|\n if !child.date_of_birth.nil?\n data << [\"<b>Child #{i+1} Age:</b> #{child.age}\",\"<b>Child #{i+1} Date of Birth:</b> #{child.date_of_birth.strftime(\"%F\") rescue \"\"}\"]\n else\n data << [\"<b>Child #{i+1} Age:</b> #{child.age}\",\"<b>Child #{i+1} Date of Birth: </b>\"]\n end\n\n end\n if data.blank?\n pad(5){text \"<b>No Child Information</b>\", :inline_format => true }\n else\n table data, :cell_style => { :inline_format => true,:borders => [], :width => 250 }\n end\n end\n end\n start_new_page\n pad(10){text \"<b>Personal Assets</b>\", :size => 20,:inline_format => true }\n indent(30) do\n if !client.house.nil?\n data = [[\"<b>House Owned:</b> #{client.house.owned}\",\"<b>Four Wheeler:</b> #{client.vehicle.four_wheeler}\"],\n [\"<b>House Rented:</b> #{client.house.rented}\",\"<b>Two Wheeler:</b> #{client.vehicle.two_wheeler}\"],\n [\"<b>House Co Provider:</b> #{client.house.co_provider}\",\"<b>No Vehicle:</b> #{client.vehicle.none}\"]]\n else\n data = [[\"<b>House Owned:</b> \",\"<b>Four Wheeler:</b> \"],\n [\"<b>House Rented:</b> \",\"<b>Two Wheeler:</b> \"],\n [\"<b>House Co Provider:</b>\",\"<b>No Vehicle:</b>\"]]\n end\n table data, :cell_style => { :inline_format => true,:borders => [], :width => 250 }\n end\n pad(10){text \"<b>Future Goal</b>\", :size => 20,:inline_format => true }\n indent(30) do\n data = [[\"<b>Short Term Goal:</b> #{client.short_term_goal}\",\"<b>Long Term Goal:</b> #{client.long_term_goal}\"]]\n table data, :cell_style => { :inline_format => true,:borders => [], :width => 250 }\n end\n pad(10){text \"<b>Plan</b>\", :size => 20,:inline_format => true }\n indent(30) do\n data = [[\"<b>Child Education:</b> #{client.plan_child_education}\",\"<b>Child Merriage:</b> #{client.plan_child_marriage}\"],\n [\"<b>Retirement Fund:</b> #{client.plan_retirement_fund}\",\"\"]]\n table data, :cell_style => { :inline_format => true,:borders => [], :width => 250 }\n end\n pad(10){text \"<b>Investment</b>\", :size => 20,:inline_format => true }\n indent(30) do\n if !client.investment_type.nil?\n data = [[\"<b>Fix Income:</b> #{client.investment_type.fix_income}%\",\"<b>Equity:</b> #{client.investment_type.equity}%\"],\n [\"<b>Gold:</b> #{client.investment_type.gold}%\",\"<b>Land and Estate:</b> #{client.investment_type.land_and_estate}%\"]]\n else\n data = [[\"<b>Fix Income:</b> 0%\",\"<b>Equity:</b> 0%\"],\n [\"<b>Gold:</b> 0%\",\"<b>Land and Estate:</b> 0%\"]]\n end\n table data, :cell_style => { :inline_format => true,:borders => [], :width => 250 }\n end\n if client_info.length != 1\n start_new_page\n end\n string = \"page <page> of <total>\"\n # Green page numbers 1 to 7\n options = { :at => [bounds.right - 150, 0],\n :width => 150,\n :align => :right,\n :page_filter => (1..7),\n :start_count_at => 1,\n :color => \"0000ff\" }\n number_pages string, options\n end\n end.render\n end", "def generate\n add_intro\n add_blood_pressure_intro\n add_blood_pressure_list\n add_blood_pressure_outro\n add_medications_intro\n add_medications_list\n add_about\n\n @pdf\n end", "def t4\n annee = params[:annee].to_i\n copies = (params[:dest] == 'employe' ? 2 : 1)\n employeur = Employeur.find(params[:id])\n doc = Prawn::Document.new(:skip_page_creation => true, :margin => 0)\n T4.renderMultiple(doc, Employe.employesPayes(annee), employeur, annee, copies)\n send_data doc.render, :filename => 't4-' + annee.to_s + '.pdf', :type => 'application/pdf', :disposition => 'inline'\n end", "def generate_event_pdf\n event = Event.find(params[:id])\n pdf = PDF::Writer.new()\n pdf.image \"public/images/about-neova.jpg\"\n pdf.select_font \"Courier\"\n pdf.margins_pt(36)\n pdf.text \"CERTIFICATE OF ATTENDANCE\", :font_size => 32,:justification => :center,:spacing => 2\n pdf.text \"This is to certify that\", :font_size => 15, :justification => :center,:spacing => 3\n pdf.text \"#{current_user.full_name}\", :font_size =>25,:justification => :center,:spacing => 2\n pdf.text \"attended the event\", :font_size =>15,:justification => :center,:spacing => 2\n pdf.text \"#{event.name}\", :font_size =>25,:justification => :center,:spacing => 2\n pdf.text \"held on #{event.starts_on}\",:font_size => 15,:justification => :center,:spacing => 2\n respond_to do |format|\n format.pdf do\n send_data pdf.render, :filename => 'event.pdf', :type => 'application/pdf', :disposition => 'attachment'\n end\n end\n #pdf.save_as(\"public/event_certificate_user#{current_user.id}_event#{event.id}.pdf\")\n #send_file \"public/event_certificate_user#{current_user.id}_event#{event.id}.pdf\", :type => 'application/pdf'\n end", "def index\n @covenant_forms = CovenantForm.all\n respond_to do |format|\n format.html\n format.pdf do\n pdf = CovenantPdf.new\n User.all.each do |user|\n if (user.covenant_form)\n pdf.create_page(user.covenant_form)\n pdf.start_new_page\n end\n end\n \n send_data pdf.render, filename: \"covenant form\", type: \"application/pdf\", disposition: \"inline\"\n end\n end\n end", "def pdf_list_benefits_nnw1\n @insurance = load_insurance\n @rotation = @insurance.rotations.last\n\n respond_to do |format|\n format.pdf do\n pdf = ListBenefitsNNW1Pdf.new(@rotation, view_context)\n send_data pdf.render,\n filename: \"#{@insurance.number}_list_benefits_nnw1.pdf\",\n type: \"application/pdf\",\n disposition: \"inline\" \n end\n end \n end", "def to_pdf requester, user, questionnaire, url_prefix, short_version=false\n font_families.update(\n \"DejaVuSans\" => { # Using DejaVuSans because it provides the 'filled_check_box' and the 'check_box' icons.\n :bold => \"#{Rails.root}/public/data/fonts/DejaVuSans-Bold.ttf\",\n :bold_italic => \"#{Rails.root}/public/data/fonts/DejaVuSans-BoldOblique.ttf\",\n :italic => \"#{Rails.root}/public/data/fonts/DejaVuSans-Oblique.ttf\",\n :normal => \"#{Prawn::BASEDIR}/data/fonts/DejaVuSans.ttf\"\n }\n )\n font \"DejaVuSans\"\n self.font_size = 9\n\n #check_box = \"\\xE2\\x98\\x90\"\n #filled_check_box = \"\\xE2\\x98\\x91\"\n\n ap = ApplicationProfile.first\n current_instance = (ap && ap.sub_title) || Rails.root.to_s.split('/')[3].split('-').first\n ap_logo = ap && ap.logo && ap.logo.path\n fallback_logo = Dir.glob(\"public/assets/logos/#{current_instance.split('-').first}*\", File::FNM_CASEFOLD).first\n logo = ap_logo || \"#{Rails.root}/#{fallback_logo}\"\n image logo, position: :right, width: 150 if logo\n text \"#{current_instance.upcase}\", size: 14, style: :bold\n\n move_down 10\n\n banner = questionnaire.header.path\n if banner.present? && File.exist?(banner)\n image banner, :position => :left, :width => 550\n end\n\n move_down 20\n\n authorization = AuthorizedSubmitter.find_by_questionnaire_id_and_user_id(questionnaire.id, user.id)\n I18n.locale = authorization.language\n questionnaire_field = ( questionnaire.questionnaire_fields.find_by_language(authorization.language) || questionnaire.questionnaire_fields.find_by_is_default_language(true) )\n text \"#{questionnaire_field.title.html_safe}\", :size => 16, :style => :bold\n #text \"Language: #{questionnaire.language_english_name}\"\n\n move_down 18\n\n text \"#{OrtSanitize.white_space_cleanse(questionnaire_field.introductory_remarks).gsub(\"\\n\", \"\\n\\n\")}\", :inline_format => true\n\n start_new_page\n\n fields = {}\n\n puts \"#{Time.now} - Started generating #{short_version ? \"short\" : \"\"} PDF for - #{questionnaire_field.title} - for #{user.full_name}\"\n logger.info \"#{Time.now} - Started generating #{short_version ? \"short\" : \"\"} PDF for - #{questionnaire_field.title} - for #{user.full_name}\"\n\n begin\n sections = questionnaire.sections\n sections.each_with_index do |section, i|\n fields.clear\n section.objects_fields_in authorization.language, fields\n answers = section.section_and_descendants_answers_for(user).select{ |ans| ans.filled_answer? }\n root_section_to_pdf(authorization.language, section, user, fields, answers, url_prefix, short_version)\n\n # new page for every new root section (if we're doing a short_version pdf only add the new page if the answers aren't empty)\n # the last check on the if is related with checking if there is any content for the next page\n if i < sections.size-1 && (!short_version || !answers.empty?) && page.content.stream !=\"/DeviceRGB cs\\n0.000 0.000 0.000 scn\\n/DeviceRGB CS\\n0.000 0.000 0.000 SCN\\nq\\n\" && cursor != 720.0\n # puts \"the cursor is here #{cursor}\"\n start_new_page\n end\n end\n\n #footer [ margin_box.left, margin_box.bottom + 25 ] do\n repeat(:all, :dynamic => true) do\n draw_text \"#{questionnaire_field.title} [#{user.full_name}, #{user.country}]\", :size => 7, :at => [0, -15]\n draw_text \"Page #{page_number} of #{page_count}\", :size => 8, :at => [500, (questionnaire.title.size > 50 ? -6 : -15)]\n end\n\n pdf_file = questionnaire.pdf_files.find_by_user_id_and_is_long(user.id, !short_version) || PdfFile.new(:questionnaire => questionnaire, :user => user, :is_long => !short_version)\n if !pdf_file.new_record? && File.exist?(pdf_file.location)\n FileUtils.rm(pdf_file.location)\n end\n\n sanitized_title = questionnaire.title[0,35].strip.\n gsub!(/[^0-9A-Za-z.\\-]/, '_')\n\n pdf_file.name = \"#{sanitized_title}_#{short_version ? \"short\" : \"long\"}_#{DateTime.now.strftime(\"%d%m%Y\")}.pdf\"\n location_rel = \"private/questionnaires/#{questionnaire.id}/users/#{user.id}/\"\n location_abs = \"#{Rails.root}/#{location_rel}\"\n if !File.directory? location_abs\n FileUtils.mkdir_p(location_abs)\n end\n pdf_file.location = location_rel + pdf_file.name\n pdf_file.save\n render_file pdf_file.location\n\n if File.directory?(\"#{Rails.root}/private/questionnaires/#{questionnaire.id}/users/#{user.id}/generating_#{short_version ? \"short\" : \"long\"}_pdf\")\n FileUtils.rmdir(\"#{Rails.root}/private/questionnaires/#{questionnaire.id}/users/#{user.id}/generating_#{short_version ? \"short\" : \"long\"}_pdf\")\n end\n\n puts \"#{Time.now.to_s} - PDF Successfully generated - #{questionnaire_field.title} - for #{user.full_name}\"\n logger.info \"#{Time.now.to_s} - PDF Successfully generated - #{questionnaire_field.title} - for #{user.full_name}\"\n\n rescue => e\n UserMailer.pdf_generation_failed(requester, user, questionnaire, e.message).deliver\n\n logger.info \"#{Time.now.to_s} - PDF failed to generate - #{questionnaire_field.title} - for #{user.full_name} - with error: #{e.message}\"\n logger.info e.backtrace\n\n if File.directory?(\"#{Rails.root}/private/questionnaires/#{questionnaire.id}/users/#{user.id}/generating_#{short_version ? \"short\" : \"long\"}_pdf\")\n FileUtils.rmdir(\"#{Rails.root}/private/questionnaires/#{questionnaire.id}/users/#{user.id}/generating_#{short_version ? \"short\" : \"long\"}_pdf\")\n end\n\n return\n end\n\n # mail the requester about the pdf being generated. (can be the user or an admin)\n UserMailer.pdf_generated(requester, questionnaire, user).deliver\n end", "def user_city\n prueba=City.user_city()\n respond_to do |format|\n format.html {render json: prueba,each_serializer: Cities::User_citySerializer, status:200}\n format.pdf do \n pdf = UsersPdf.new(prueba)\n send_data pdf.render, filename: \"users_city.pdf\",\n type: \"application/pdf\",\n disposition: \"inline\"\n end\n end\n \nend", "def pdf1\n \n \n @company =Company.find(1)\n @cabecera =\"Facturacion\"\n @abajo =\"Viatico\"\n \n @cout = Cout.find(params[:id])\n \n Prawn::Document.generate(\"app/pdf_output/#{@cout.id}.pdf\" ,:page_size => \"A4\",:margin=> 2 ) do |pdf|\n pdf.font \"Helvetica\"\n pdf = build_pdf_header_1(pdf)\n pdf = build_pdf_body_1(pdf)\n build_pdf_footer_1(pdf)\n @lcFileName = \"app/pdf_output/#{@cout.id}.pdf\" \n \n end \n\n $lcFileName1=File.expand_path('../../../', __FILE__)+ \"/\"+@lcFileName\n #send_file(\"#{$lcFileName1}\", :type => 'application/pdf', :disposition => 'inline')\n send_file(@lcFileName, :type => 'application/pdf', :disposition => 'inline')\n end", "def pdf_gen\n @@temp=1\n @guardiandatas=MgGuardian.find(params[:id])\n school=MgSchool.find(session[:current_user_school_id])\n @@school_logo=school.logo.url(:medium, timestamp: false)\n @last_guardian = @guardiandatas.id\n @@guardian_photo= @guardiandatas.photo.url(:medium, timestamp: false)\n puts \"before mg_user_id\"\n @guardianUserId= @guardiandatas.mg_user_id\n @customData = MgCustomFieldsData.where(mg_user_id:@guardianUserId,is_deleted:0,mg_school_id:session[:current_user_school_id])\n \n @guardian_details=\"select first_name,middle_name, last_name,DATE_FORMAT(dob,'%d/%m/%Y') 'date of birth', income, relation, occupation,education from mg_guardians where id=#{@guardiandatas.id}\"\n @guardian_detail=MgGuardian.find_by_sql(@guardian_details)\n std_all_dada=@guardian_detail.as_json \n\n##========Custom field=====================================================\n @@dbdatas = MgCommonCustomField.where(model_name: \"guardian\",is_deleted:0,mg_school_id:session[:current_user_school_id])\n @@customData = MgCustomFieldsData.where(mg_user_id:@guardianUserId,is_deleted:0,mg_school_id:session[:current_user_school_id])\n#customfield========================================================================\n \n##=========Custom field====================================================\n\n @get_gar_paddress=\"select address_line1, address_line2,street , city, state , pin_code, landmark, country from mg_addresses where mg_user_id=#{@guardianUserId}\"\n @gar_p=MgAddress.find_by_sql(@get_gar_paddress)\n std_p=@gar_p.as_json \n \n #GUARDIAN MOBILE NUMBER\n @gua_h_phone=\"SELECT phone_number, notification ,subscription from mg_phones where mg_user_id=#{@guardianUserId} and phone_type='mobile'\"\n @gu_h_phone=MgPhone.find_by_sql(@gua_h_phone)\n std_h_phone=@gu_h_phone.as_json\n # logger.info \"inside phone\"\n # logger.info std_h_phone\n\n #GUARDIAN HOME PHONE NUMBER\n @gua_p_phone=\"SELECT phone_number from mg_phones where mg_user_id=#{@guardianUserId} and phone_type='phone'\"\n @gu_p_phone=MgPhone.find_by_sql(@gua_p_phone)\n std_p_phone=@gu_p_phone.as_json\n puts\"phone===============================================================================\"\n \n @gua_email=\"SELECT mg_email_id, notification ,subscription from mg_emails where mg_user_id=#{@guardianUserId}\"\n @gua_email=MgEmail.find_by_sql(@gua_email)\n guardian_email=@gua_email.as_json\n \n\nputs \"email doneeeeeeeeeeeeeeeeeeeeeeee\"\n pdf = Prawn::Document.new do\n\n \n #this code for stamp\n #here this code should be first line of the code\n # create_stamp(\"approved this\") do\n # rotate(30, :origin => [-5, -5]) do\n # stroke_color \"FF3333\"\n # stroke_ellipse [0, 0], 100, 50\n # stroke_color \"000000\"\n # fill_color \"993456\"\n # font(\"Times-Roman\") do\n # draw_text \"approved this\", :at => [-23, -3]\n # end\n # fill_color \"000000\"\n # end\n # end\n # stamp \"approved this\"\n # stamp_at \"approved this\", [200, 400]\n\n\n # 2.times do\n # start_new_page\n # end\n\n repeat :all do\n\n # header\n bounding_box [bounds.left, bounds.top],:align => :right, :width => bounds.width do\n font \"Helvetica\"\n if File.exists?(\"#{Rails.root}/public/#{@@school_logo}\") \n image( \"#{Rails.root}/public/#{@@school_logo}\",:width => 45)\n # image (\"#{Rails.root}/public/#{@@school_logo}\"),:at=>[425,690],:width=>45\n # image \"#{Rails.root}/public/#{@@school_logo}\", :width => 45, :align => :left\n end\n move_up 15\n text school.school_name, :align => :center, :size => 18\n stroke_horizontal_rule\n end\n move_down 10\n\n # footer\n bounding_box [bounds.left, bounds.bottom + 45], :width => bounds.width do\n font \"Helvetica\"\n stroke_horizontal_rule\n move_down(5)\n # text \" Powered By - ©\", :size => 12\n move_down 12\n draw_text \"Terms & Conditions| Privacy Policy| About Us| Contact Us\",:at => [70,3]\n draw_text \"Powered By - ©\", :at => [400,3]\n image \"#{Rails.root}/app/assets/images/mindcom-logo.png\", :at=>[495,15], :width => 45, :align => :right\n end\n end\n \n\n bounding_box([bounds.left, bounds.top - 60], :width => bounds.width, :height => bounds.height - 100) do\n\n move_down 120\n if File.exists?(\"#{Rails.root}/public/#{@@guardian_photo}\")\n # image \"#{Rails.root}/public/#{@@emp_photo}\", :align => :right, :width =>45\n image(\"#{Rails.root}/public/#{@@guardian_photo}\", :at => [450,600], :width => 65)\n else\n\n end\n \n text \"General \"\n data = Array.new\n widths = Array.new(30, 50)\n cell_height = 15\n count=0\n \n $rowdata=Array.new\n \n std_all_dada[0].each_with_index { |(key, value), index|\n if index % 2==0\n $rowdata=Array.new\n end\n \n if(key != 'id')\n if( key =='date of birth')\n str=\"Date of Birth\"\n else\n str=key.tr('_', ' ') \n str=str.titleize\n end \n \n inner_table = make_table([ [\"#{str}\",\"#{value}\"] ],:column_widths => 135)\n \n # display +=[\"#{value}\"]\n end\n $rowdata +=[inner_table]\n if index % 2==1\n table([$rowdata],:column_widths => 270) \n \n end \n\n }\n\n move_down 25\n\n\n text \"Address\"\n data = Array.new\n widths = Array.new(30, 50)\n cell_height = 15\n count=0\n \n $rowdata=Array.new\n \n std_p[0].each_with_index { |(key, value), index|\n if index % 2==0\n $rowdata=Array.new\n end\n \n str=key.tr('_', ' ') \n str=str.titleize\n inner_table = make_table([ [\"#{str}\",\"#{value}\"] ],:column_widths => 135)\n \n # display +=[\"#{value}\"]\n \n $rowdata +=[inner_table]\n if index % 2==1\n table([$rowdata],:column_widths => 270) \n \n end \n }\n move_down 25\n\n \n text \"Contact Details \"\n\n @@phone_notification=\"No\"\n @@phone_subscription=\"No\"\n @@email_notification=\"No\"\n @@email_subscription=\"No\"\n\n data = Array.new\n widths = Array.new(30, 50)\n cell_height = 15\n count=0\n if std_p_phone[0].present?\n std_p_phone[0].each_with_index { |(key, value), index|\n if(key=='phone_number')\n $phone2 = value\n end\n } \n end\n \n $rowdata=Array.new\n if std_h_phone[0].present?\n std_h_phone[0].each_with_index { |(key, value), index|\n if(key=='phone_number')\n $phone1 = value\n end\n }\n\n \n\n table([\n [ \"Phone Number\",\"#{$phone2}\",\"Mobile Number\",\"+91-#{$phone1}\"]\n ],:column_widths => 135) \n#================================phone notification & subscription==================================\n\n #if (!(std_h_phone[0].notification == \"\"))\n std_h_phone[0].each_with_index { |(key, value), index|\n if(key=='notification')\n #$phone1 = value\n if value==true\n @@phone_notification=\"Yes\"\n end\n end\n }\n #end\n\n #if std_h_phone[0].subscription.present?\n std_h_phone[0].each_with_index { |(key, value), index|\n if(key=='subscription')\n #$phone1 = value\n if value==true\n @@phone_subscription=\"Yes\"\n end\n end\n }\n #end\n\n table([\n [ \"Notification\",\"#{@@phone_notification}\",\"Subscription\",\"#{@@phone_subscription}\"]\n ],:column_widths => 135) \n\n\n#================================phone notification & subscription==================================\n\n\n guardian_email[0].each_with_index { |(key, value), index|\n if(key=='mg_email_id')\n $email_id = value\n end\n }\n\n table([\n [ \"Email Id\",\"#{$email_id}\",\"\",\"\"]\n ],:column_widths => 135) \n\n#================================email notification & subscription==================================\n #if guardian_email[0].notification.present?\n guardian_email[0].each_with_index { |(key, value), index|\n if(key=='notification')\n #$phone1 = value\n if value==true\n @@email_notification=\"Yes\"\n end\n end\n }\n #end\n\n #if guardian_email[0].subscription.present?\n guardian_email[0].each_with_index { |(key, value), index|\n if(key=='subscription')\n #$phone1 = value\n if value==true\n @@email_subscription=\"Yes\"\n end\n end\n }\n #end\n table([\n [ \"Notification\",\"#{@@email_notification}\",\"Subscription\",\"#{@@email_subscription}\"]\n ],:column_widths => 135) \n\n#================================email notification & subscription==================================\n\n end\n move_down 25\n\n if @@customData.size>0\n text \"Custom Fields\"\n \n \n @@dbdatas.each do |dbdata| \n \n @@customData.each do |custDatas|\n\n if dbdata.id.to_s==custDatas.mg_custom_field_id\n\n\n custom_data=Array.new\n \n\n\n \n\n\n \n\n @@customData.each do |custData| \n\n if custData.mg_custom_field_id == dbdata.id.to_s\n @custValue = custData.value\n \n end\n end\n \n \n table([\n [ dbdata.name ,@custValue]\n \n ],:column_widths => 135) \n \n \n \n\n \n end\n\n end \n end\n\n \n \n\n\n\n\n\n\n\n \n\nend\n\n\nend\n#=====================================Custom fields=====================================================\n\n# end\n\n# end\nend\n \n\n # Sends the PDF as inline document with name x.pdf\n send_data pdf.render, :info => {\n :Title => \"My title\",\n :Author => \"John Doe\",\n :Subject => \"My Subject\",\n :Keywords => \"test metadata ruby pdf dry\",\n :Creator => \"ACME Soft App\",\n :Producer => \"Prawn\",\n :CreationDate => Time.now\n }, :filename => \"x.pdf\", :type => \"application/pdf\", :disposition => 'inline'\n end", "def generate_pdf\n\t\t\n\t\tfile_name = get_pdf_file_name\n\n\t\tac = ActionController::Base.new\n\n\t\tpdf = ac.render_to_string pdf: file_name,\n\t template: \"#{ Auth::OmniAuth::Path.pathify(self.class.name).pluralize}/pdf/show.pdf.erb\",\n\t locals: {:receipt => self, :organization => self.payable_to_organization},\n\t layout: \"pdf/application.html.erb\",\n \tquiet: true,\n\t header: {\n\t \thtml: {\n\t \t\ttemplate:'/layouts/pdf/receipt_header.pdf.erb',\n\t \t\tlayout: \"pdf/application.html.erb\",\n\t \t\tlocals: {:receipt => self, :organization => self.payable_to_organization}\n\t \t}\n\t },\n\t footer: {\n\t \t\thtml: { \n\t \t\t\ttemplate:'/layouts/pdf/receipt_footer.pdf.erb',\n\t \t\t\tlayout: \"pdf/application.html.erb\",\n\t \t\tlocals: {:receipt => self, :organization => self.payable_to_organization}\n\t }\n\t } \n\n #save_path = Rails.root.join('public',\"#{file_name}.pdf\")\n\t\t#File.open(save_path, 'wb') do |file|\n\t\t# file << pdf\n\t\t# self.pdf_urls = [save_path]\n\t\t# self.pdf_url = save_path\n\t\t#end\n\t\tTempfile.open(file_name) do |f| \n\t\t f.binmode\n\t\t f.write pdf\n\t\t f.close \n\t\t #IO.write(\"#{Rails.root.join(\"public\",\"test.pdf\")}\",pdf)\n\t\t response = Cloudinary::Uploader.upload(File.open(f.path), :public_id => file_name, :upload_preset => \"report_pdf_files\")\n\t\t puts \"response is: #{response}\"\n\t\t self.latest_version = response['version'].to_s\n\t\t self.pdf_url = response[\"secure_url\"]\n\t\tend\n\t\tself.skip_pdf_generation = true\n\t\t\n\t\tafter_generate_pdf\n\n\tend", "def show\n @users = User.all\n respond_to do |format|\n format.html\n format.pdf {render pdf: \"show\" }\n end\n end", "def generate_pdf\n\t\t\t\n\n\t\tfile_name = get_file_name\n\t\tfile_name = \"test\"\n\t \n\t ac = ActionController::Base.new\n\t \n\t pdf = ac.render_to_string pdf: file_name,\n template: \"#{ Auth::OmniAuth::Path.pathify(self.class.name).pluralize}/pdf/show.pdf.erb\",\n locals: {:object => self},\n layout: \"pdf/application.html.erb\",\n quiet: true,\n header: {\n \thtml: {\n \t\ttemplate:'/layouts/pdf/header.html.erb',\n \t\tlayout: '/layouts/pdf/empty_layout.html.erb',\n \t\tlocals: {:object => self}\n \t}\n },\n footer: {\n \t\thtml: { \n \t\t\ttemplate:'/layouts/pdf/footer.html.erb',\n \t\t\tlayout: '/layouts/pdf/empty_layout.html.erb',\n \t\tlocals: {:object => self}\n }\n } \n\n save_path = Rails.root.join('public',\"#{file_name}.pdf\")\n\t\tFile.open(save_path, 'wb') do |file|\n\t\t file << pdf\n\t\tend\n\n\t Tempfile.open(file_name) do |f| \n\t\t f.binmode\n\t\t f.write pdf\n\t\t f.close \n\t\t #IO.write(\"#{Rails.root.join(\"public\",\"test.pdf\")}\",pdf)\n\t\t response = Cloudinary::Uploader.upload(File.open(f.path), :public_id => file_name, :upload_preset => \"report_pdf_files\")\n\t\t puts \"response is-------------------------------------------------------------->: #{response}\"\n\t\t self.latest_version = response['version'].to_s\n\t\t self.pdf_url = response[\"url\"]\n\t\tend\n\n\t\tself.skip_pdf_generation = true\n\t\t\n\t\t#self.save\t\t\n\t\tafter_generate_pdf\n\n\tend", "def index\n @pacientes = Paciente.all\n\n respond_to do |format|\n format.html\n format.json\n format.pdf {render template: 'pacientes/pdf', pdf: 'pacientes'}\n end\n\n end", "def index\n @fichas = Ficha.order(:nome).paginate(per_page: 10, page: params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fichas }\n format.pdf do\n @fichas = Ficha.order(:nome)\n render pdf: Ficha.model_name.human(count: 2),\n layout: 'pdf.html'\n end\n end\n end", "def descarga_taxa_pdf\n unless Usuario::CORREO_REGEX.match(params[:correo])\n return self.resp = { estatus: false, msg: 'Favor de verificar el correo' }\n end \n \n lista = Lista.new\n lista.formato = 'pdf'\n lista.cadena_especies = original_url\n lista.usuario_id = 0 # Quiere decir que es una descarga, la guardo en lista para tener un control y poder correr delayed_job\n lista.nombre_lista = Time.now.strftime(\"%Y-%m-%d_%H-%M-%S-%L\") + \"_guia_EncicloVida\"\n\n if Rails.env.production?\n lista.delay(queue: 'descargar_taxa').to_pdf({ fecha: Time.now.strftime(\"%Y-%m-%d\"), original_url: original_url }) if lista.save\n else # Para que en development no la guarde en un trabajo\n lista.to_pdf({ fecha: Time.now.strftime(\"%Y-%m-%d\"), original_url: original_url }) if lista.save\n end\n\n self.resp.merge({ estatus: true, msg: nil }) \n end", "def index\n @casos = Caso.all\n respond_to do |format|\n format.html\n format.json\n format.pdf {render template: 'casos/reporte', pdf: 'Reporte', layout: 'pdf.html',\n page_size: 'Letter',\n margin: { top: 25, # default 10 (mm)\n bottom: 25,\n left: 30,\n right: 30 }\n\n }\n end\n end", "def show\n @user = User.all\n @userr = User.find(@research.creador)\n respond_to do |format|\n format.html\n format.pdf do\n pdf = ResearchshowPdf.new(@research, view_context, @userr)\n send_data pdf.render, filename: \"research_#{@research.id}.pdf\",type: \"application/pdf\", disposition: \"inline\"\n \n end\n end\n end", "def index\n @conceptos_de_pago = ConceptoDePago.all\n @usuario = current_user\n respond_to do |format|\n format.html\n format.pdf do\n pdf = ConceptosDePagoPdf.new(@conceptos_de_pago, @usuario)\n send_data pdf.render, filename: \"conceptos_de_pago#{@conceptos_de_pago}.pdf\", type: \"application/pdf\", disposition: \"inline\"\n end\n format.xls\n end\n end", "def show\n @registration = Registration.find_by_nama(params[:id])\n respond_to do |format|\n format.html\n format.pdf do\n pdf = RegisterPdf.new(@registration)\n send_data pdf.render,\n type: \"application/pdf\",\n disposition: \"inline\",\n filename: \"Formulir Calon Mahasiswa ISTPI atas nama #{@registration.nama}.pdf\"\n end\n end\n end", "def reservations_to_pdf\n sort_init 'Utente', 'ASC'\n sort_update 'Utente' => 'users.lastname',\n 'Login' => 'users.login',\n 'N' => 'num_persone',\n 'Provenienza' => 'comunes.name',\n 'Tel' => 'users.telefono',\n 'Id' => 'users.id'\n\n respond_to do |format|\n #ovverride for paging format.html # index.html.erb\n format.html {\n # Paginate results\n if params[:issue_id].present? && !params[:issue_id].nil?\n @reservations = Reservation.find(:all,\n :order => sort_clause,\n :include => [:issue, :user],\n :conditions => \"issues.id = #{params[:issue_id]}\"\n )\n\n @reservations_total = @reservations.sum { |itm| itm.num_persone } rescue 0\n @payments_total = @reservations.sum { |itm| itm.prezzo } rescue 0\n\n else\n\n @reservations = Reservation.find(:all,\n :order => sort_clause,\n :include => [{:issue => :project}, :user])\n render :layout => !request.xhr?\n\n end\n\n\n }\n format.xml { render :xml => @reservations }\n end\n end", "def index\n @proyectos = Proyecto.all\n @usuario = current_user\n respond_to do |format|\n format.html\n format.pdf do\n pdf = ProyectosPdf.new(@proyectos, @usuario)\n send_data pdf.render, filename: \"proyectos#{@proyectos}.pdf\", type: \"application/pdf\", disposition: \"inline\"\n end\n format.xls\n end\n end", "def index\n @cios = Cio.includes(:animal, :cobertura).propriedade(current_usuario)\n \n respond_to do |format|\n format.html\n format.pdf {render pdf: \"Cios\"} \n end \n end", "def index\n @special_allowances = SpecialAllowance.order('satuan asc')\n @title = 'Rincian Jabatan Khusus Dan Tunjangannya'\n respond_to do |format|\n format.html\n format.pdf do\n render pdf: 'Rincian Jabatan Khusus Dan Tunjangannya',\n template: 'special_allowances/index.pdf.erb',\n layout: 'pdf.html.erb'\n # render :pdf => 'Kurikulum Teknik Elektro', :layout => 'Kurikulum Teknik Elektro.html'\n end\n end\n end", "def index\n @search = @cliente.facturas.search(params[:search])\n @facturas = @search.page(params[ :page ]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @facturas }\n format.pdf do\n dump_tmp_filename = Rails.root.join('tmp',@facturas.first.cache_key)\n Dir.mkdir(dump_tmp_filename.dirname) unless File.directory?(dump_tmp_filename.dirname)\n save_list_pdf_to(dump_tmp_filename,@facturas) \n send_file(dump_tmp_filename, :type => :pdf, :disposition => 'attachment', :filename => \"facturas.pdf\")\n File.delete(dump_tmp_filename) \n end \n end\n end", "def index\n @user = current_user.id\n @users = User.order(sort_column + \" \" + sort_direction)\n respond_to do |format|\n format.html\n format.csv { render text: @users.to_csv }\n format.pdf do\n pdf = ReportPdf.new(@users)\n send_data pdf.render, filename: 'Report-'+ Time.now.strftime(\"%d/%m/%Y\") +'.pdf', type: 'application/pdf'\n end\n end\n end", "def pdf_certifications_insureds\n @insurance = load_insurance\n @rotation = @insurance.rotations.last\n\n case params[:prnscope]\n when 'A' # tylko włączenia\n @coverages = @rotation.coverages_add.joins(:rotation, :insured, :group).references(:rotation, :insured, :group).order(\"individuals.last_name, individuals.last_name, individuals.address_city\").all\n when 'B' # tylko włączenia\n @coverages = Coverage.joins(:rotation, :insured, :group).by_rotation(@rotation.id).references(:rotation, :insured, :group).order(\"individuals.last_name, individuals.last_name, individuals.address_city\").all\n end \n\n respond_to do |format|\n format.pdf do\n pdf = CertificationsInsuredsPdf.new(@coverages, view_context)\n send_data pdf.render,\n filename: \"#{@insurance.number}_rotation_#{@rotation.rotation_date.strftime(\"%Y-%m-%d\")}_certifications_insureds.pdf\",\n type: \"application/pdf\",\n disposition: \"inline\" \n end\n end \n end", "def generate_pdf \n pdf = ParkirPdf.new(@billing)\n pdf.render\n end", "def reporte\n puts \"======================================================================================================\"\n @agentes_pdf = Agente.all\n\n respond_to do |format| \n format.pdf do\n pdf = AgentesPdf.new(@agentes_pdf, view_context)\n send_data pdf.render, filename: \"agentes.pdf\",\n type: \"application/pdf\",\n disposition: \"inline\"\n end \n end\n end", "def index\n @certificados = Certificado.all\n respond_to do |format|\n format.html\n format.json\n format.pdf {render template: 'certificados/pdf', pdf: 'Reporte' }\n end\n end", "def index\n @group_clients = GroupClient.all\n respond_to do |format|\n format.html\n format.pdf do\n pdf = GroupClientPdf.new(@group_clients)\n send_data pdf.render, filename: 'group_clients.pdf', type: 'application/pdf'\n end\n end\n end", "def rpt_purchase2_all\n \n @company =Company.find(1)\n @fecha1 =params[:fecha1]\n @fecha2 =params[:fecha2]\n @tiporeporte =params[:tiporeporte]\n \n supplier_select = params[:cbox1]\n proveedor = params[:supplier_id]\n \n \n if supplier_select == \"1\"\n @rpt_detalle_purchase = @company.get_purchases_day_tipo(@fecha1,@fecha2,@tiporeporte) \n else\n @rpt_detalle_purchase = @company.get_purchases_day_tipo2(@fecha1,@fecha2,@tiporeporte,proveedor) \n end \n \n Prawn::Document.generate \"app/pdf_output/orden_1.pdf\" , :page_layout => :landscape do |pdf| \n \n pdf.font \"Helvetica\"\n pdf = build_pdf_header9(pdf)\n pdf = build_pdf_body9(pdf)\n build_pdf_footer9(pdf)\n $lcFileName = \"app/pdf_output/orden_1.pdf\" \n \n end \n\n $lcFileName1=File.expand_path('../../../', __FILE__)+ \"/\"+$lcFileName\n \n send_file(\"#{$lcFileName1}\", :type => 'application/pdf', :disposition => 'inline')\n \n\n end", "def index\r\n @medical_forms = MedicalForm.all\r\n\r\n respond_to do |format|\r\n format.html\r\n format.pdf do\r\n pdf = MedicalPdf.new\r\n User.all.each do |user|\r\n if (user.medical_form)\r\n pdf.create_page(user.medical_form)\r\n pdf.start_new_page\r\n end\r\n end\r\n\r\n send_data pdf.render, filename: \"medical form\", type: \"application/pdf\", disposition: \"inline\"\r\n end\r\n end\r\n end", "def show\n @user = User.all\n @userr = User.find(@work.creador)\n respond_to do |format|\n format.html\n format.pdf do\n pdf = WorkshowPdf.new(@work, view_context, @userr)\n send_data pdf.render, filename: \"work_#{@work.id}.pdf\",type: \"application/pdf\", disposition: \"inline\"\n \n end\n end\n end", "def show \n authorize! :show_almacen,Sigesp::Solicitud \n respond_to do |format|\n format.html {\n @grupo = SolicitudGrupo.grupoSolicitud(@sigesp_solicitud.numsol)\n if @grupo.nil?\n @grupo = SolicitudGrupo.new \n @grupo.solicitudes.append @sigesp_solicitud\n end \n }\n format.pdf do\n @solicitud = Sigesp::Solicitud.find(params[:id])\n end\n end\n end", "def rpt_facturas_all_pdf\n\n $lcFacturasall = '1'\n\n @company=Company.find(params[:company_id]) \n @fecha1 = params[:fecha1] \n @fecha2 = params[:fecha2] \n \n\n @facturas_rpt_1 = @company.get_facturas_day(@fecha1,@fecha2,\"1\") \n @facturas_rpt_2 = @company.get_facturas_day(@fecha1,@fecha2,\"2\") \n# respond_to do |format|\n# format.html \n# format.xls # { send_data @products.to_csv(col_sep: \"\\t\") }\n# end \n\n Prawn::Document.generate(\"app/pdf_output/rpt_factura.pdf\") do |pdf|\n pdf.font \"Helvetica\"\n pdf = build_pdf_header_rpt(pdf)\n pdf = build_pdf_body_rpt(pdf)\n build_pdf_footer_rpt(pdf)\n\n\n $lcFileName = \"app/pdf_output/rpt_factura_all.pdf\" \n end \n\n\n $lcFileName1=File.expand_path('../../../', __FILE__)+ \"/\"+$lcFileName \n send_file(\"app/pdf_output/rpt_factura.pdf\", :type => 'application/pdf', :disposition => 'inline')\n\n end", "def index\n\n if current_user\n @especificacion = Specification.where(:id => session[:specification_sel_id]).first \n @user = User.where(:username => @especificacion.user_id).first\n if current_user.acquisition? || current_user.import? || current_user.acquisition_analist? || current_user.import_analist? \n if @user.director? || @user.directorate? || @user.gsmp? || @user.acquisition? || @user.import? || @user.quality? || @user.manage? || @user.acquisition_analist? || @user.import_analist? || @user.quality_analist? || @user.manage_analist? \n @mostrar = true\n else\n @mostrar = false\n end\n elsif current_user.director? || current_user.directorate? || current_user.gsmp? || current_user.quality? || current_user.quality_analist? || current_user.manage? || current_user.manage_analist? || current_user.section_boss? || current_user.proy_responsible?\n\t@mostrar = false\n else\n @mostrar = true\n end\n @servicerequests = Servicerequest.where(:user_id => current_user.username).all\n @sumServReq = Servicerequest.where(:specification_id => session[:specification_sel_id]).count\n @servreq = Servicerequest.where(:specification_id => session[:specification_sel_id]).first\n end\n respond_to do |format|\n format.html do\n if @sumServReq != 0\n redirect_to @servreq\n end\n end\n format.pdf do\n\n #Revisamos si es un Acto Motivado\n if Recommendation.where(:specification_id => session[:specification_sel_id]).count == 0\n @act = Act.where(:specification_id => session[:specification_sel_id]).first\n @empresa = Invitation.where(:nombre => @act.proveedor,:specification_id => session[:specification_sel_id]).first\n @quote = Quote.where(:specification_id => session[:specification_sel_id]).first\n @itemsQts = Itemsquote.where(:specification_id => session[:specification_sel_id]).all\n @items = []\n\t\t\t @itemsQts.each do |itemsqts|\n @items.push(Service.where(:specification_id => session[:specification_sel_id],:id => itemsqts.id_item).first)\n end\n pdf = SolicitudServices.new(@servreq, @empresa, @items, @quote)\n end\n\n #Revisamos si es una Recomendacion\n if Recommendation.where(:specification_id => session[:specification_sel_id]).count != 0\n @reco = Recommendation.where(:specification_id => session[:specification_sel_id]).first\n @recoEmp = RecommendationsEmpresa.where(:id_informe => @reco.id, :opcion_numero => 1).first\n @empresa = Invitation.where(:quote_id => @recoEmp.quote_id).first\n #ERROR VACIO\n @quote = Quote.where(:id => @empresa.quote_id, :specification_id => session[:specification_sel_id]).first\n #ERROR VACIO\n @itemsQts = Itemsquote.where(:specification_id => session[:specification_sel_id],:id_oferta => @recoEmp.quote_id,:compra => 1).all\n @items = []\n @itemsQts.each do |itemsqts|\n @items.push(Service.where(:specification_id => session[:specification_sel_id],:id => itemsqts.id_item).first)\n end\n\n pdf = SolicitudServices.new(@servreq, @empresa, @items, @quote)\n end\n\n nombre = \"Especificacion_#{session[:specification_sel_id]}_Solicitud_de_Servicios.pdf\"\n send_data pdf.render, filename: nombre, type: 'application/pdf'\n end\n format.xml do\n specification = Specification.find(session[:specification_sel_id])\n\t specification.p6 = 2\n\t session[:specification_p6] = specification.p6\n\t specification.save\n redirect_to \"/servicerequests/#{@servreq.id}?pdf=1\"\n end\n end\n end", "def licensereport\n\t\t@licenses = License.find(:all)\t\t\n html = render :layout => false \n\tkit = PDFKit.new(html)\n\n\tkit.stylesheets << RAILS_ROOT + '/public/stylesheets/styles.css' \n\n\tsend_data(kit.to_pdf, :filename => \"licensereport.pdf\", :type => 'application/pdf')\n\tend", "def show\n @report = @report_orders_by_user.gen_report.each(:as => :hash)\n\n respond_to do |format|\n format.html\n format.pdf do\n pdf = ReportOrdersByUsers.new(@report, view_context)\n send_data pdf.render, filename: \"report_orders_by_users.pdf\",\n type: \"application/pdf\",\n disposition: \"inline\"\n end\n end\n\n end", "def index\n @atenciones = Atencion.all\n respond_to do |format|\n format.html\n format.pdf do \n render pdf: 'Listado de Atenciones'\n end \n end\n end", "def index\n @tipos_de_pago = TipoDePago.all\n @usuario = current_user\n respond_to do |format|\n format.html\n format.pdf do\n pdf = TiposDePagoPdf.new(@tipos_de_pago, @usuario)\n send_data pdf.render, filename: \"tipos_de_pago#{@tipos_de_pago}.pdf\", type: \"application/pdf\", disposition: \"inline\"\n end\n format.xls\n end\n end", "def create_all\n for i in 0..Pdf.get_pdf_file_count do\n pdf = Pdf.create_pdf(i.to_s, @client, @settings)\n pdf_file_name = Pdf.get_pdf_file_name(Pdf::PDFS.keys[i], @client)\n pdf.render_file(\"#{Rails.root}/app/assets/generated-pdfs/#{pdf_file_name}\")\n end\n generate_zip(@client)\n end", "def index\r\n\r\n #find_by_name_or_all\r\n @sivic_celulas = SivicCelula.find_by_name_or_all(params[:q],current_user.sivic_pessoa.sivic_igreja_id).paginate(:page => params[:page], :per_page => 10)\r\n\r\n #@sivic_celulas = SivicCelula.where(\"sivic_igreja_id = ?\",current_user.sivic_pessoa.sivic_igreja_id).paginate(:page => params[:page], :per_page => 10).order(:id)\r\n @sivic_celulasreport = SivicCelula.where(\"sivic_igreja_id = ?\",current_user.sivic_pessoa.sivic_igreja_id)\r\n\r\n respond_to do |format|\r\n format.html\r\n format.pdf { render_civic_celula_list(@sivic_celulasreport) }\r\n end \r\n end", "def generate_pdf(images,\n text_location,\n sizes,\n year: @infos[YEAR],\n name: @infos[STUDENT],\n lesson: @infos[LESSON],\n prop: @infos[PROP],\n exam_type: @infos[EXAM])\n @log.info 'Pdf generate start...'\n # TODO: omu dökümantasyon ilk sayfaya resim şeklinde eklenecek\n # TODO: unicode desteği ekle\n begin\n Prawn::Document.generate(@pdf_name, page_size: sizes, margin: 0) do\n bounding_box([0, text_location], width: bounds.width, height: bounds.height) do\n text lesson, align: :center, size: 300\n move_down 50\n text year, align: :center, size: 250\n move_down 50\n text exam_type, align: :center, size: 200\n move_down 50\n text prop, align: :center, size: 200\n move_down 70\n text name, align: :center, size: 250\n end\n images.each do |img|\n start_new_page\n image img, at: [0, sizes.last]\n end\n end\n @log.info 'Pdf generation finish with success!'\n true\n rescue StandardError\n @log.error 'Pdf generation fault!'\n false\n end\n end", "def index\n @salaries = Salary.order('period_id asc')\n @title = 'Rincian Daftar Gaji Dosen'\n respond_to do |format|\n format.html\n format.pdf do\n render pdf: 'Rincian Daftar Gaji Dosen',\n template: 'salaries/index.pdf.erb',\n layout: 'pdf.html.erb'\n # render :pdf => 'Kurikulum Teknik Elektro', :layout => 'Kurikulum Teknik Elektro.html'\n end\n end\n end", "def show\n respond_to do |format|\n format.html { redirect_to tipos_path, notice: 'Ruta no disponible.' }\n format.json\n format.pdf do\n case params[:doc]\n when '0'\n pdf = RecibosPdf.new(@tipo, 0, params[:c],params[:cp])\n file = \"Recibos_#{@tipo.nombre}\"\n when '1'\n pdf = RecibosPdf.new(@tipo, 1, params[:c],params[:cp])\n file = \"Recibos_#{@tipo.nombre}_ECO\"\n when '2'\n pdf = BancariosPdf.new(@tipo, 0)\n file = \"Bancarios_#{@tipo.nombre}\"\n when '3'\n pdf = BancariosPdf.new(@tipo, 1)\n file = \"Bancarios_#{@tipo.nombre}_ECO\"\n when '4'\n pdf = ConceptosPdf.new(@tipo, 3, params[:c],params[:cp])\n file = \"Conceptos_#{@tipo.nombre}\"\n when '5'\n pdf = ConceptosPdf.new(@tipo, 4, params[:c],params[:cp])\n file = \"Conceptos_#{@tipo.nombre}_ECO\"\n end\n send_data pdf.render, filename: file, type: 'application/pdf', disposition: 'inline'\n end\n end\n end", "def fiche_inscription\n respond_to do |format|\n format.pdf { render template: 'etudiants/fiche_inscription', pdf: 'Inscription' }\n end\n end", "def rpt_ccobrar4_pdf\n $lcxCliente =\"0\"\n @company=Company.find(params[:company_id]) \n @fecha1 = params[:fecha1] \n @fecha2 = params[:fecha2] \n @facturas_rpt = @company.get_pendientes_day(@fecha1,@fecha2) \n \n Prawn::Document.generate(\"app/pdf_output/rpt_pendientes4.pdf\") do |pdf|\n pdf.font \"Helvetica\"\n pdf = build_pdf_header_rpt4(pdf)\n pdf = build_pdf_body_rpt4(pdf)\n build_pdf_footer_rpt4(pdf)\n $lcFileName = \"app/pdf_output/rpt_pendientes4.pdf\" \n end \n $lcFileName1=File.expand_path('../../../', __FILE__)+ \"/\"+$lcFileName \n send_file(\"app/pdf_output/rpt_pendientes4.pdf\", :type => 'application/pdf', :disposition => 'inline')\n \n end", "def generate_invoice\n @patient = Patient.find(params[:id])\n @user_patients = @patient.user_patients.where(\"archive is null\")\n respond_to do |format|\n format.html\n format.pdf do\n pdf = HmsPdfDocument.new(SessionsHelper::FOR_PATIENT, @user_patients, view_context)\n @user_patients.update_all :archive => SessionsHelper::ARCHIVE\n send_data pdf.render, filename: \"invoice_summary_#{@patient.id}.pdf\", type: \"application/pdf\"\n end\n end\n end", "def patient_list\n @patients = Patient.all\n render :pdf => \"patient_list\", :header => { :right => '[page] of [topage]' }, :margin => {\n :top => 40,\n :bottom => 0\n }\n end", "def index\n #obtiene todos los registros de la tabla client\n #cambiar el 5 por el numero de elementos por pagiba\n @clients = Client.order(sort_column + \" \" + sort_diection).search(params[:search]).paginate(:per_page => 30, :page => params[:page])\n \n\n respond_to do |format|\n format.html\n format.json { render json: @clients }\n format.csv { send_data text: @clients.to_csv }\n format.xls \n format.pdf {render template: 'clients/reporte', pdf: 'Clientes', layout: 'pdf.html'}#, header: { right: 'Página [page] de [topage]' }}\n end\n end", "def citas_del_dia\n if current_user.tipo == \"medico\"\n doctor = Doctor.find_by(user_id: current_user.id)\n @pediatric_appointments = PediatricAppointment.search(params[:search]).where(doctor_id: doctor.id).order(:hora).paginate(:per_page => 4, :page => params[:page])\n else\n @pediatric_appointments = PediatricAppointment.search(params[:search]).order(:hora).paginate(:per_page => 4, :page => params[:page])\n end\n respond_to do |format|\n format.html\n format.pdf do\n pdf = PediatricAppointmentsPdf.new(@pediatric_appointments)\n send_data pdf.render, filename: \"citas_pediatricas_del_dia_#{params[:search]}.pdf\",\n type: \"application/pdf\",\n disposition: \"inline\"\n end\n end\n end", "def index\n @clientes = Cliente.paginate(:page => params[:page], :per_page => 10)\n @empresa= Configuracion.find(:first)\n @nombreempresa = @empresa.nombre_empresa\n @logo = @empresa.logo\n @direccion = @empresa.direccion\n @telefono = @empresa.telefono\n @funcionario = current_user.funcionario.full_name\n @fecha = Time.now.strftime(\"%d %b %Y, %H:%m\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clientes }\n format.pdf{render :layout => false}\n end\n end", "def to_pdf_data; end", "def show\n @pasien2 = Pasien2.find(params[:id])\n @hasil2 = Hasil2.where( :hsl_echantillon => @pasien2.id_echantillon )\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pasien2 }\n format.pdf do\n pdf = ReportPdf.new(@pasien2, current_user.name)\n send_data pdf.render, :filename => \n \"Report_#{@pasien2.created_at.strftime(\"%d/%m/%Y\")}.pdf\", :type => \"application/pdf\", :disposition => \"inline\" \n end\n end\n end", "def index\n @administrativos = Administrativo.order('created_at DESC').all\n @total = false\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @administrativos }\n format.pdf { render :layout => false }\n end\n end", "def show\n respond_to do |format|\n format.html\n #estimacion\n format.xlsx\n #pdf cotizacion\n format.pdf do\n pdf = Prawn::Document.new\n sos = \"#{Rails.root}/public/images/pdf/sos.png\" \n pdf.image sos, :position => :left, :width => 150 \n pdf.draw_text \"SOS Software S.A. de C.V.\", :at => [300,700]\n pdf.draw_text \"Medrano 710; General Real\", :at => [300,680]\n pdf.draw_text \"Teléfono: (0133) 3617-2968\", :at => [300,660]\n pdf.draw_text \"E-mail: info@sos-soft.com\", :at => [300,640]\n pdf.draw_text \"#{@ventum.cliente}\", :at => [300,600]\n pdf.text \"________________________________________________________________________________\"\n pdf.text \"<b><font size='24'>\\nCotización\\n</font></b>\", :inline_format => true, :align => :center\n pdf.text \"Girada el: #{@ventum.fecha}\\n\\n\\n\\n\\n \", :align => :right , :inline_format => true\n i = 0\n pdf.text \"Servicios/Productos Cotizados\\n\"\n @detail.each do |x|\n if x.producto == \"Presencialmente\" || x.producto == \"Remotamente\"\n pdf.text \"° Asesoría y soporte técnico vía \" + x.producto\n else\n pdf.text \"° \"+x.producto\n end\n end\n pdf.text \"\\n\\n\"\n if @ventum.distribuidor == \"distribuidorsi\"\n table_data = [['#', 'Artículo / Descripción', 'Cant', 'Precio unitario', 'Impuesto', 'Descuento','descuento proveedor','Total']]\n @detail.each do |x|\n i = i + 1\n table_data += [[i, x.producto, x.cantidad,x.precioventa,@ventum.iva,x.descuento,x.descuentoproveedor,x.total]]\n end\n else\n table_data = [['#', 'Artículo / Descripción', 'Cant', 'Precio unitario', 'Impuesto', 'Descuento','Total']]\n @detail.each do |x|\n i = i + 1\n table_data += [[i, x.producto, x.cantidad,x.precioventa,@ventum.iva,x.descuento,x.total]]\n end\n end\n pdf.table(table_data,:width => 540)\n iva = (@ventum.subtotal * ((@ventum.iva.to_f)/100)).round(2)\n if@ventum.descuentogeneral.present?\n totaladicional = ((iva + @ventum.subtotal)*((@ventum.descuentogeneral/100).to_f)).round(2)\n pdf.text \"\\nSub total: #{@ventum.subtotal}\\n Impuesto de ventas (#{@ventum.iva.to_i}%): #{iva}\\nDescuento(#{@ventum.descuentogeneral}%): #{totaladicional} \\n<b>Total: #{@ventum.total}</b>\", :align => :right , :inline_format => true\n else\n pdf.text \"\\nSub total: #{@ventum.subtotal}\\n Impuesto de ventas (#{@ventum.iva.to_i}%): #{iva}\\n <b>Total: #{@ventum.total}</b>\", :align => :right , :inline_format => true\n end\n pdf.text \"\\n\\nINFORMACIÓN DE PAGO: SOS Software S.A. de C.V.\\n\\n\n BANCO BANORTE: No. Cuenta: 0239431716; CLABE: 072320002394317160\\n\\n\n RFC: SOF1406233F5\\n\\n\\n\", :inline_format => true, :align => :justify\n pdf.text \"\\n\\nEstimado cliente, es muy importante validar que cuentas con el suficiente equipo para generar la instalación de nuestros productos o servicios, para ello se recomienda consultar nustro detalle de requerimientos mínimos en el enlace: \\nhttp://sos-soft.com/requerimientos.pdf\\n\\nTe invitamos a consultar los terminos y condiciones de nuestro servicio en el siguiente enlace \\nhttp://sos-soft.com/Politicassos.pdf\", :inline_format => true\n send_data pdf.render, filename: 'Cotización.pdf', type: 'application/pdf' \n end\n #PDF carta de aceptacion\n format.adicional do\n \n pdf = Prawn::Document.new\n sos = \"#{Rails.root}/public/images/pdf/sos.png\" \n pdf.image sos, :position => :left, :width => 150 \n pdf.draw_text \"SOS Software S.A. de C.V.\", :at => [300,700]\n pdf.draw_text \"Medrano 710; General Real\", :at => [300,680]\n pdf.draw_text \"Teléfono: (0133) 3617-2968\", :at => [300,660]\n pdf.draw_text \"E-mail: info@sos-soft.com\", :at => [300,640]\n pdf.text \"________________________________________________________________________________\"\n pdf.text \"<b><font size='24'>\\nCarta de agradecimiento\\n\\n</font></b>\", :inline_format => true, :align => :justify\n pdf.text \"Estimado/a #{@ventum.cliente}\\n\\nSOS Software se complace en dirigirse hacia usted para saludarlo y aprovechar la oportunidad para agradecerle profundamente la preferencia que ha mostrado por nuestros productos y servicio. Su apoyo nos hace cada día mejores personas y aumenta nuestro compromiso con su satisfacción a través de lo que le ofrecemos.\\n\\nEsperamos que su confianza en nosotros se incremente con cada adquisición de nuestros productos.\\n\\nQueremos comunicarle también que estamos complacidos de servirlo y ofrecerle productos de mejor calidad cada vez.\\nEsperamos satisfacer sus necesidades con productos de primera calidad y a través del mejor servicio en el mercado.\", :inline_format => true, :align => :justify\n pdf.text \"\\n\\nSe solicita amablemente enviar un correo con el asunto: Carta de aceptación y con el siguiente contenido:\", :inline_format => true, :align => :justify\n pdf.text \"________________________________________________________________________________\"\n pdf.text \"\\n\\nSOS Software confirma haber entregado los siguientes productos/servicios:\\n\\n\", :inline_format => true \n @detail.each do |x|\n \n if x.producto == \"Presencialmente\" || x.producto == \"Remotamente\"\n pdf.text \"° \"+x.cantidad.to_s+ \" Asesoría y soporte técnico vía \" + x.producto\n else\n pdf.text \"° \"+x.cantidad.to_s+\" \"+x.producto\n end\n end\n pdf.text \"\\n\\nMuchas gracias por tu tiempo y recuerda que nuestra misión es ayudarte a administrar y controlar mejor tu negocio de una manera automatizada.\", :inline_format => true , :align => :justify\n pdf.text \"\\n\\nSOS Software SA de CV\", :inline_format => :true, :align =>:justify \n pdf.text \"\\nDesarrollamos tus ideas\", :inline_format => :true, :align =>:justify \n \n send_data pdf.render, filename: 'Carta aceptacion.pdf', type: 'application/pdf' \n end\n end\n end", "def show\n # als er geen nietdilbeeks-param gegeven is, is nietdilbeeks sowieso false \n @niveau = Niveau.find(params[:id])\n nietdilbeeks = params[:nietdilbeeks] == \"true\"\n @proefs = @niveau.proefs.where(\"nietdilbeeks = ?\", nietdilbeeks) \n authorize! :show, @niveau\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @niveau }\n format.pdf do \n pdf = BlancoEvaluatielijstPdf.new(@niveau)\n pdf.number_pages \"(afgeprint op #{Time.now.strftime(\"%d/%m/%Y\")}) <page>/<total>\", :size => 9, :at => [620, 0]\n send_data pdf.render, filename: \"#{@niveau.name}_blanco_rijen.pdf\",\n type: \"application/pdf\",\n disposition: \"inline\"\n end\n end\n end", "def index\n @products = Product.all\n respond_to do |format|\n format.html\n format.pdf do\n pdf = ReportPdf.new(@products)\n pdf.encrypt_document(\n :user_password => 'password', \n :owner_password => \"vishal\",\n :permissions => { :print_document => false,\n :modify_contents => false,\n :copy_contents => false,\n :modify_annotations => false })\n send_data pdf.render, filename: 'report.pdf', type: 'application/pdf', :disposition => 'inline'\n end\n end\n end", "def report\n\n @projecta = Project.find(params[:id])\n\n pdf = Prawn::Document.new\n pdf.text \"Universidad Nacional de Ingenieria\" , :size => 30, :style => :bold, :position => :center\n pdf.move_down(10) \n pdf.text \"Vicerectoria de Investigación y Desarrollo.\" , :size => 25, :style => :bold, :position => :center\n pdf.move_down(10)\n pdf.text \"Programa de acompañamiento a Proyectos\" , :size => 20, :style => :bold, :position => :center\n pdf.text \"Reporte Generado por el programa de Tecnología de la Informacion PROAP\" , :size => 15, :position => :center\n pdf.move_down(45) \n pdf.image \"#{Rails.root.join}/app/assets/images/uni.jpg\", :position => :center ,:at => [0, 600], :height => 100\n pdf.move_down(80)\n pdf.text \"Nombre del Proyecto:\", :size => 20, :style => :bold\n pdf.move_down(10) \n pdf.text \"#{@projecta.name}\", :size => 20\n pdf.move_down(10)\n pdf.text \"Objetivo del Proyecto: \" , :size => 13, :style => :bold\n pdf.move_down(10) \n pdf.text \"#{@projecta.objetive}\", :size => 13\n pdf.move_down(10) \n pdf.text \"Estado del Proyecto: #{@projecta.status}\", :size => 13\n pdf.move_down(20) \n pdf.text \"Fase del Proyecto: #{@projecta.fase}\", :size => 13\n pdf.move_down(10)\n pdf.text \" Los Reportes que pertenecen a #{@projecta.name} son :\", :size => 13, :style => :bold\n pdf.move_down(20)\n @projecta.reports.each do |pr|\n pdf.text \"Nombre del Reporte: #{pr.name}\", :style => :bold\n pdf.move_down(10)\n pdf.text \"Descripcion del Reporte: #{pr.desc}\"\n pdf.move_down(10)\n pdf.text \"Fecha y Hora local de creacion del reporte: #{pr.created_at}\"\n pdf.move_down(10)\n pdf.text \"Fecha y Hora local de acutalizacion del repote: #{pr.date}\"\n pdf.move_down(10)\n pdf.line [0,100], [500,100]\n end\n \n\n pdf.create_stamp(\"Proyecto Aprobado\") do\n pdf.rotate(30, :origin => [-5, -5]) do\n pdf.stroke_color \"FF3333\"\n pdf.stroke_ellipse [0, 0], 49, 15\n pdf.stroke_color \"000000\"\n pdf.fill_color \"993333\"\n pdf.font(\"Times-Roman\") do\n pdf.draw_text \"Proyecto Aprobado\", :at => [-23, -3]\n end\n pdf.fill_color \"000000\"\n end\n end\n pdf.stamp \"Proyecto Aprobado\"\n pdf.stamp_at \"Proyecto Aprobado\", [250, 200]\n send_data pdf.render, :filename => \"#{@projecta.name}\", :disposition => \"inline\"\n pdf.text_box \"Informe Generado por el Programa de acompañamiento a Proyectos\", :at => [220,200], :style => :bold\n end", "def toPDF(doc, parent)\n if !parent\n raise \"Pas de parent pour le recu\"\n end\n \n doc.start_new_page\n doc.font 'Times-Roman'\n \n # On fait deux copies.\n [650, 400].each do |y|\n doc.bounding_box([0, y], :width => 500, :height => 200) do\n oneRecu(doc, parent)\n end\n end\n \n end", "def index\n \n if params[:search]\n @searc = params[:search]\n else\n @searc = \"\"\n end\n\n #buscador\n if Queja.has_role(current_user.id) == \"instructor\"\n @quejas = Queja.indes(current_user.id).order(sort_column + \" \" + sort_direction).search(params[:search]).page(params[:page]).per_page(5)\n @estadoquejas = @quejas.where(:estado_id => 1)\n @estadoencomite = @quejas.where(:estado_id => 2)\n @quejacorreccion = @quejas.where(:estado_id => 3)\n else\n\n @quejas = Queja.order(sort_column + \" \" + sort_direction).search(params[:search]).page(params[:page]).per_page(5)\n @estadoquejas = Queja.where(:estado_id => 1) \n @estadoencomite = Queja.where(:estado_id => 2)\n @quejacorreccion = Queja.where(:estado_id => 3)\n end\n #esta variable trae todos los registros para el pdf\n @a= Queja.all \n end", "def show\n @section_title = 'Detail'\n @volunteer = Volunteer.find(params[:id])\n \n respond_to do |format|\n format.pdf {\n \n #if !@volunteer.pdf.exists?\n pdf = doc_raptor_send({:document_type => \"pdf\".to_sym})\n friendlyName = \"Volunteer_#{@volunteer.user.name}.pdf\"\n friendlyName = friendlyName.gsub(\"/\", \"_\")\n File.open(\"#{Rails.root}/tmp/#{friendlyName}\", 'w+b') {|f| f.write(pdf) }\n @volunteer.pdf = File.open(\"#{Rails.root}/tmp/#{friendlyName}\");\n @volunteer.save!({:validate => false})\n send_data pdf, :filename => friendlyName, :type => \"pdf\"\n #else\n # redirect_to @volunteer.pdf.url\n #end\n \n }\n format.html {\n render\n }\n end\n \n end", "def index\n @descuentos = Descuento.all\n @usuario = current_user\n respond_to do |format|\n format.html\n format.pdf do\n pdf = DescuentosPdf.new(@descuentos, @usuario)\n send_data pdf.render, filename: \"descuentos#{@descuentos}.pdf\", type: \"application/pdf\", disposition: \"inline\"\n end\n format.xls\n end\n end", "def show\n @pcs = Pc.all\n @gjuhas = Gjuha.all\n @qytetets = Qytetet.all\n @pozi = Pozi.all\n @formularis= Formulari.find(params[:id])\n @status = Status.all\n respond_to do |format|\n format.html\n format.pdf do\n pdf=OrderPdf.new(@formularis)\n send_data pdf.render,\n filename: \"\", type: \"application/pdf\", desposition: \"inline\"\n end\n end\n end", "def index\n @recurso_servidors = RecursoServidor.all\n\n respond_to do |format| \n format.html\n format.pdf { \n render pdf: \"recursos\",\n footer: { center: \"[page] de [topage]\" },\n encoding: 'utf8',\n orientation: 'Landscape',\n page_size: 'A4',\n default_header: false,\n grayscale: false,\n enable_plugins: true,\n keep_relative_links: true,\n dpi: '300',\n print_media_type: true,\n no_pdf_compression: true,\n image_quality: 10,\n font_size: '30'\n }\n end\n end", "def generate_pdf\n respond_with(invoice)\n end", "def index\n if current_user\n \t@services = Service.where(:specification_id => session[:specification_sel_id]).all\n @sumService = Service.where(:specification_id => session[:specification_sel_id]).count\n\t end\nspecification = Specification.find(session[:specification_sel_id])\n respond_to do |format|\n format.html\n format.pdf do\n pdf = ReporteServices.new(@services, specification)\n nombre = \"Especificacion_#{session[:specification_sel_id]}.pdf\"\n send_data pdf.render, filename: nombre, type: 'application/pdf'\n end\n\tformat.xml do\n specification.p1 = 2\n specification.p2 = 1\n specification.save\n session[:specification_p2] = 1\n session[:specification_p1] = 2\n redirect_to \"/services?pdf=1\"\n end\n end\n end", "def pdf\n #render layout: false\n Car.find(params[:id])\n Prawn::Document.generate(\"app/assets/pdf/#{@car.targa}.pdf\") do |f|\n f.text \"Hello Worldd!\"\n end\n end" ]
[ "0.84078646", "0.7781275", "0.77485985", "0.72366893", "0.7180817", "0.6885193", "0.6836498", "0.6719058", "0.6714711", "0.6677746", "0.66435486", "0.6566865", "0.65306133", "0.65212435", "0.6520843", "0.6507961", "0.6481148", "0.6470316", "0.6405768", "0.6405592", "0.6389643", "0.6377266", "0.63640404", "0.63633716", "0.6358014", "0.63504833", "0.6345417", "0.63452345", "0.6312325", "0.6305028", "0.6302045", "0.6293791", "0.6285956", "0.626753", "0.62603575", "0.6249325", "0.624079", "0.6220889", "0.6194051", "0.6175623", "0.6164597", "0.6160677", "0.61503327", "0.61481595", "0.6144015", "0.6133679", "0.61293375", "0.61289585", "0.61269516", "0.6122755", "0.61057806", "0.6102564", "0.6101029", "0.6092379", "0.60871696", "0.60846406", "0.6081885", "0.608086", "0.6079168", "0.60671985", "0.60671616", "0.6061322", "0.6059659", "0.60579294", "0.605629", "0.60476774", "0.604758", "0.60352165", "0.6019282", "0.60090196", "0.5996175", "0.5986839", "0.5979168", "0.5976848", "0.59762895", "0.59746593", "0.59704405", "0.595479", "0.5954261", "0.5951132", "0.59209687", "0.5919997", "0.5917726", "0.5917586", "0.5914062", "0.59025973", "0.59011936", "0.5897144", "0.58942187", "0.5893591", "0.588976", "0.588687", "0.5884378", "0.5882942", "0.58767337", "0.58730525", "0.5871659", "0.58632445", "0.5858746", "0.58560735" ]
0.86636144
0
:nodoc: Google Calendar does not have a category concept. Instead a feed consists of multiple calendars. We've chosen to map the category into the calendar concept. This function, category, returns an array of calendar objects which match the requested category(ies). categories can be a single string/symbol or an array of strings/symbols.
def category categories categories = categories.to_a if !categories.is_a? Array categories.collect { |i| calendars.find_by_title i.to_s }.compact end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def categories\n nodes = @doc.xpath(\"atom:feed/atom:category\", ::AtomFeed::NS) || []\n nodes.map { |node| AtomCategory.new(node) }\n end", "def categories\n if @categories.nil?\n @categories = []\n category_nodes =\n FeedTools::XmlHelper.try_xpaths_all(self.channel_node, [\n \"category\",\n \"dc:subject\"\n ])\n unless category_nodes.nil?\n for category_node in category_nodes\n category = FeedTools::Category.new\n category.term = FeedTools::XmlHelper.try_xpaths(category_node, [\n \"@term\",\n \"text()\"\n ], :select_result_value => true)\n category.term.strip! unless category.term.blank?\n category.label = FeedTools::XmlHelper.try_xpaths(\n category_node, [\"@label\"],\n :select_result_value => true)\n category.label.strip! unless category.label.blank?\n category.scheme = FeedTools::XmlHelper.try_xpaths(category_node, [\n \"@scheme\",\n \"@domain\"\n ], :select_result_value => true)\n category.scheme.strip! unless category.scheme.blank?\n @categories << category\n end\n end\n end\n return @categories\n end", "def category(period, category) \n category = [category].flatten\n \n list = []\n category.uniq.each do |c|\n list << keys.select { |k| k.category == c and k.period == period }\n end\n \n return list.flatten!\n end", "def categories\n if nodes = @node.xpath(\"category\")\n nodes.map { |node| RSSCategory.new(node) }\n end\n end", "def get_categories\n cats = []\n params.each do |k,v|\n if k.starts_with? \"category\"\n name = v\n num = cat_number(k) \n cats << [name,num]\n end\n end\n return cats\n end", "def categories\n @categories ||= (@doc/\"Category\").collect { |it| Element.new(it) }\n end", "def categories\n add_to_query restrict_kind: 'category'\n end", "def categories\n return [] if @feed.channel.categories.empty? && @feed.channel.dc_subjects.empty?\n [@feed.channel.categories, ((@feed.channel.dc_subjects.empty?) ? nil : @feed.channel.dc_subjects)].flatten.uniq.compact.collect{|c| c.content}.reject{|c| c == '' || c.match(/^\\s+$/)}\n end", "def event_categories(options = {})\n response = connection.get do |req|\n req.url \"events/categories\", options\n end\n return_error_or_body(response, response.body.response.categories)\n end", "def get_categories\n @cards.each do |card|\n if !@categories.include?(card.category)\n @categories << card.category\n end\n end\n @categories\n end", "def categories(options = {})\n fetch_categories.at('categories').children_of_type('category').inject([]){ |r, i| r << parse_single_category_xml(i) }\n\tend", "def categories\n @categories = response[\"categories\"] || []\n @categories.map!{|category| Foursquared::Response::Category.new(client, category)}\n end", "def objects_in_category(category_type_, *category_spec_)\n @config.lock\n\n return nil unless @categories.include?(category_type_)\n spec_ = category_spec_.size == 1 && category_spec_.first.is_a?(::Array) ? category_spec_.first : category_spec_\n tuple_hash_ = (@catdata[category_type_] ||= {})[spec_]\n tuple_hash_ ? tuple_hash_.values.map{ |objdata_| objdata_[0] } : []\n end", "def categories\n response[\"categories\"].map!{|category| Foursquared::Response::Category.new(client, category)} if response[\"categories\"]\n end", "def category_candidates(category)\n return @category_cache[category] unless @category_cache[category].nil?\n # from whole name singularized\n candidates = []\n decorated_category = Cyclopedio::Syntax::NameDecorator.new(category, parse_tree_factory: @parse_tree_factory)\n @nouns.singularize_name(category.name, decorated_category.category_head).each do |name_singularized|\n candidates.concat(candidates_for_name(name_singularized,@category_filters))\n end\n candidate_set = create_candidate_set(category.name,candidates)\n return @category_cache[category] = candidate_set if !candidate_set.empty? || @category_exact_match\n # from simplified name\n candidate_set = candidate_set_for_syntax_trees(decorated_category.category_head_trees,@category_filters)\n return @category_cache[category] = candidate_set unless candidate_set.empty?\n # from original whole name\n candidate_set = candidate_set_for_name(category.name, @category_filters)\n @category_cache[category] = candidate_set\n end", "def calendars\n page_token = nil\n result = execute(:api_method => service.calendar_list.list)\n entries = []\n while true\n entries += result.data.items\n if !(page_token = result.data.next_page_token)\n break\n end\n result = execute(:api_method => service.calendar_list.list,\n :parameters => {'pageToken' => page_token})\n end\n\n entries\n end", "def articles_by_category(posts=articles)\n cats = []\n all_categories.each do |cat|\n cats << [cat, articles_with_category(cat)]\n end\n cats\n end", "def getCategoryAll()\n params = Hash.new\n return doCurl(\"get\",\"/category/all\",params)\n end", "def get_category_list\n ret_hash = Rails.cache.fetch(\"zaim_api/category\", expired_in: 1.day) do\n json_categories = self.zaim_api.category\n tmp_ret_hash = {}\n json_categories['categories'].each do |value|\n tmp_ret_hash[value['id']] = value['name']\n end\n tmp_ret_hash\n end\n ret_hash\n end", "def categories\n category\n end", "def find_agenda_item_categories\n @categories = AgendaItemCategory.all(:order => 'name')\n end", "def categories_available(from, to)\n\n not_available_event_type = ::Yito::Model::Calendar::EventType.first(:name => 'not_available')\n\n condition = Conditions::JoinComparison.new('$and',\n [Conditions::Comparison.new('event_type', '$eq', not_available_event_type),\n Conditions::JoinComparison.new('$or', \n [Conditions::JoinComparison.new('$and', \n [Conditions::Comparison.new('from','$lte', from),\n Conditions::Comparison.new('to','$gte', from)\n ]),\n Conditions::JoinComparison.new('$and',\n [Conditions::Comparison.new('from','$lte', to),\n Conditions::Comparison.new('to','$gte', to)\n ]),\n Conditions::JoinComparison.new('$and',\n [Conditions::Comparison.new('from','$eq', from),\n Conditions::Comparison.new('to','$eq', to)\n ]),\n Conditions::JoinComparison.new('$and',\n [Conditions::Comparison.new('from', '$gte', from),\n Conditions::Comparison.new('to', '$lte', to)]) \n ]\n ),\n ]\n )\n not_available_calendars = Set.new(condition.build_datamapper(Yito::Model::Calendar::Event).all.map { |item| item.calendar.id }).to_a\n\n categories_with_calendar = ::Yito::Model::Booking::BookingCategory.all(active: true).select { |cat| not cat.calendar.nil? }\n calendars = categories_with_calendar.map { |cat| {:code => cat.code, :calendar => cat.calendar.id} }\n calendars.select! { |cal| not_available_calendars.index(cal[:calendar]) == nil }\n calendars.map { |cal| cal[:code] }\n\n \t \tend", "def categories\n return [] if @categories.blank?\n @categories.records.map {|c| c.display_name}\n end", "def categories(options = {})\n options = options.merge(:facets => 'category', :facet_num_results => 100, :num_results => 0)\n search('*:*', options).facets['category'].values\n end", "def category_candidates(category)\n return @category_cache[category] unless @category_cache[category].nil?\n candidates = candidates_for_name(singularize_name(category.name, category.head), @category_filters)\n if !candidates.empty?\n candidate_set = create_candidate_set(category.name,candidates)\n else\n candidate_set = candidate_set_for_syntax_trees(category.head_trees,@category_filters)\n end\n if candidate_set.empty?\n candidates = candidates_for_name(category.name, @category_filters)\n candidate_set = create_candidate_set(category.name,candidates) unless candidates.empty?\n end\n @category_cache[category] = candidate_set\n end", "def get_calendars\r\n http = Net::HTTP.new(@google_url, 80)\r\n response, data = http.get(\"http://#{@google_url}/calendar/feeds/\" + @user_id, @headers)\r\n case response\r\n when Net::HTTPSuccess, Net::HTTPRedirection\r\n redirect_response, redirect_data = http.get(response['location'], @headers)\r\n case response\r\n when Net::HTTPSuccess, Net::HTTPRedirection\r\n doc = REXML::Document.new redirect_data\r\n \t doc.elements.each('//entry')do |e|\r\n \t title = e.elements['title'].text\r\n \t url = e.elements['link'].attributes['href']\r\n \t @calendars << GCalendar.new(title, url.sub!(\"http://#{@google_url}\",''))\r\n \t end\r\n return redirect_response\r\n else\r\n response.error!\r\n end\r\n else\r\n response.error!\r\n end\r\n end", "def getCategories\n @categories = []\n @categories << Category.new(name: \"All\", id: -1)\n @categories += Category.all\n end", "def extract_categories cats\n cats.inject Hash.new do |hash, tag|\n\n # iterate through groups if the tag belongs to multiple\n tag[\"groups\"].each do |group|\n name = group[\"name\"]\n hash[name] ||= []\n hash[name] << tag[\"name\"]\n end\n hash\n end\n end", "def fetch_all_categories\n everything = @@news_api.get_everything(\n language: 'en',\n sources:'techcrunch,talksport,the-next-web,\n national-geographic, al-jazeera-english,\n crypto-coins-news',\n page: 1\n )\n end", "def categories\n\t\t\t@cat_cache ||= @db.js('musicthoughts.all_categories()').map {|c| c.merge(category: c[@lang]) }\n\t\t\t@cat_cache\n\t\tend", "def categories(make, year)\n make_id = get_object_id make\n response = get_url \"Categories/#{make_id}/#{year}\"\n response_obj = JSON.parse response\n response_obj[\"GetCategoriesResult\"].map{|r| Models::Category.from_response_hash(r)}\n end", "def categories\n categories = []\n @deck.cards.map do |turn|\n categories << turn.category\n end\n categories.uniq!\n end", "def get_categories(query_obj=nil)\n uri = URI.parse(@uri + \"/Categories\")\n results = get(uri,query_obj)\n end", "def calendars\n records 'calendar', '/calendars.xml', :method => :get\n end", "def channel_categories\n build :channel_categories, :using => data_for(:channel_categories)\n end", "def find_categories\n page = agent.get(WEBSITE_URL)\n\n page.search(CATEGORIES_SELECTOR).each do |a|\n category_name = a.text.strip\n path = a.attribute('href').value.strip\n\n next if category_name.blank? || path.blank?\n\n data[category_name] = {\n 'url' => URI.join(WEBSITE_URL, path).to_s\n }\n end\n\n Helpers.wait\n end", "def get_categories()\n\t\tzomoato_categories_url = @base_uri + \"categories\"\n\t\tresponse = HTTParty.get(zomoato_categories_url, headers: @headers)\n\t\tif response.success?\n\t\t\t@categories = response.parsed_response\n\t\telse\n\t\t\traise response.response\n\t\tend\n\t\treturn @categories\n\tend", "def retrieve_distinct_categories\n if @distinct_categories\n categories = @distinct_categories\n else\n categories = []\n @team.season_types.each do |season_type|\n season_type.seasons.sort_season_by_begin_date\n .last\n .category_types.are_not_relays\n .sort_by_age.each do |category_type|\n categories << category_type unless categories.rindex { |e| e.code == category_type.code }\n end\n end\n end\n categories\n end", "def category_info\n {\n categories: self.object.appointments.map{ |appt| \n appt.category\n }\n \n }\n end", "def event_categories\n data.event_categories\n end", "def get_categories(add_params = nil)\n params = {\n }\n api_call('/global/categories(.:format)',:get,params,add_params)\n end", "def categories\n []\n end", "def categories(query_object)\n\t\tdata = do_get_json(CATEGORIES_ENDPOINT, query_object)\n\tend", "def get_categories\n @redis.smembers category_collection_key\n end", "def list_calendars\n unless @calendars\n xml = send(Addressable::URI.parse(\"#{BASE_URI}/default/allcalendars/full\"), :get)\n @calendars = Nokogiri::XML(xml.body)\n @calendars.remove_namespaces!\n end\n @calendars\n end", "def category_names\n categories.map {|category| CategoryCode[category]}\n end", "def list(category: nil, start_date_before: nil, start_date: nil, start_date_after: nil, end_date_before: nil, end_date: nil, end_date_after: nil, limit: nil, page_size: nil)\n self.stream(\n category: category,\n start_date_before: start_date_before,\n start_date: start_date,\n start_date_after: start_date_after,\n end_date_before: end_date_before,\n end_date: end_date,\n end_date_after: end_date_after,\n limit: limit,\n page_size: page_size\n ).entries\n end", "def category_types\n @category_types.each\n end", "def category_sets(category)\n category.curriculum_category_sets.map do |category_set|\n complete[category][category_set] = category_set.courses & taken_courses\n\n get_incomplete_from_set(category, category_set)\n end\n end", "def _build_category_list\n raw_categories = CatAPI.get_categories\n category_list = raw_categories.map {|category| category['name']}.sort\n # the \"kittens\" category is empty, and never returns photos\n category_list.delete(\"kittens\")\n return category_list.unshift(\"your favorites\")\nend", "def categories\n @categories = FinanceTransactionCategory.all(:conditions => {:deleted => false}, :order => 'name asc')\n @categories = @categories.select { |x| x.accessible? }\n @category_ids = @categories.map { |cat| cat.id if FinanceTransaction.find_by_category_id(cat.id).present? }.compact\n @multi_config = FinanceTransactionCategory.get_multi_configuration\n @fee_category_present = FinanceFeeCategory.first\n # @fixed_categories = @categories.reject { |c| !c.is_fixed }\n # @other_categories = @categories.reject { |c| c.is_fixed }\n end", "def categories\n data['JobCategory'] || []\n end", "def get_events_by_category(category_id, options = {})\n root = get_root\n object_from_response(GogoKit::PagedResource,\n GogoKit::EventsRepresenter,\n :get,\n \"#{root.links['self'].href}/categories/\" \\\n \"#{category_id}/events\",\n options)\n end", "def category_collection(categories = [])\n Upload.where(category: categories)\n end", "def categories\n @categories ||= wayfinder.decorated_vocabularies.sort_by(&:label)\n end", "def parse\n calendars = []\n\n while (line = next_multiline)\n fields = parse_line(line)\n if fields[:name] == Tokens::COMPONENT_BEGIN && fields[:value] == Calendar::VALUE\n calendar = parse_calendar\n calendars << calendar\n end\n end\n\n calendars\n end", "def categories\n\t\tbegin\n\t\t\t@categories = Category.select(:id, :name)\n\t\t\trender json: @categories\n\t\trescue Exception => e\n\t\t\terror_handling_bad_request(e)\n\t\tend\n\tend", "def scrape_categories(options = {}) # :nodoc:\n if self.class.category_scrapers\n self.class.category_scrapers.inject([]){|cats,scraper| cats + scraper.scrape(options)}\n end\n end", "def get_categories\n @categories = Category.all\n end", "def multiple_categories\n @categories = Category.all\n end", "def all_matching_categories(categories)\n cross_version_category_mapping\n .select { |key, _value| categories.include?(key) }\n .values\n .flatten\n .uniq\n end", "def get_categories_list\n args = receive_should_validate?\n get('redtube.Categories.getCategoriesList', {}, [], args[:should_validate])\n end", "def getCategories()\n\t\tcat = Array.new\n\t\tcat.push(\"heroku\")\n\t\tcat.push(\"go\")\n\t\tcat.push(\"github\")\n\t\tcat.push(\"docker\")\n\t\tcat.push(\"css\")\n\t\tcat.push(\"apache\")\n\t\tcat.push(\"html\")\n\t\tcat.push(\"bootstrap\")\n\t\tcat.push(\"java ee\")\n\t\tcat.push(\"javafx\")\n\t\tcat.push(\"java\")\n\t\tcat.push(\"jquery\")\n\t\tcat.push(\"mips\")\n\t\tcat.push(\"c++\")\n\t\tcat.push(\"laravel\")\n\t\tcat.push(\"linux\")\n\t\tcat.push(\"opengl\")\n\t\tcat.push(\"sml\")\n\t\tcat.push(\"javascript\")\n\t\tcat.push(\"mongo db\")\n\t\tcat.push(\"c\")\n\t\tcat.push(\"yacc\")\n\t\tcat.push(\"circuit\")\n\t\tcat.push(\"php\")\n\t\tcat.push(\"mysql\")\n\t\tcat.push(\"node js\")\n\t\tcat.push(\"photoshop\")\n\t\tcat.push(\"rails\")\n\t\tcat.push(\"postgres\")\n\t\tcat.push(\"ruby\")\n\t\tcat.push(\"redis\")\n\t\tcat.push(\"mac osx\")\n\t\tcat.push(\"sass\")\n\t\tcat.push(\"ubuntu\")\n\t\tcat.push(\"bower\")\n\t\tcat.push(\"wordpress\")\n\t\tcat.push(\"css\")\n\t\tcat.push(\"hosted\")\n\t\tcat.push(\"python\")\n\t\tcat.push(\"maven\")\n\t\tcat.push(\"maven mojo\")\n\t\tcat.push(\"composer\")\n\t\tcat.push(\"mips\")\n\t\tcat.push(\"gulp\")\n\t\tcat.push(\"grunt\")\n\t\tcat.push(\"phpstorm\")\n\t\tcat.push(\"react\")\n\t\tcat.push(\"swift\")\n\t\tcat.push(\"wordpress\")\n\t\tcat.push(\"tomcat\")\n\t\tcat.push(\"redis\")\n\t\tcat.push(\"travis\")\n\t\treturn cat\n\tend", "def categories\n return @categories\n end", "def categories\n return @categories\n end", "def categories\n return @categories\n end", "def categories\n return @categories\n end", "def category_key_value_pairs\n categories.collect{|k,v| [k,v['sCategory']]} rescue []\n end", "def categories\n category_keys.collect(&:to_s)\n end", "def core_category_candidates(category)\n candidates = []\n singularize_name_nouns(category.name, category.head).each do |phrase|\n candidates.concat(candidates_for_name(phrase, @category_filters))\n\n end\n candidate_set = create_candidate_set(category.name,candidates.uniq)\n end", "def movies_as(category)\n movies = document.css(\"#filmo-head-#{category.downcase}\").first.next_element.children.to_a\n movies.reject! { |movie| movie.class == Nokogiri::XML::Text }\n movies.map do |movie|\n movie_id = movie.attr('id')[/\\d+/]\n Movie.new(movie_id)\n end\n end", "def extract_events(calendar)\n events = []\n rep_until = Date.today >> MONTHS_ADVANCE_FOR_REPATING\n\n calendar.events.each do |event_entry|\n # for performance reasons, create event once and then clone per occurrence\n event = Event.build_from(Adapter.new(event_entry))\n occurences = event_entry.occurrences(:before => rep_until) \n # again, for performance and api limit reasons, get geo coordinates for repeating\n # events only once\n event.get_geo_coordinates #if occurences.size > 1\n \n occurences.each do |ical_event|\n adapter = Adapter.new(ical_event)\n occurrence = event.clone\n occurrence.starts_at = adapter.starts_at\n occurrence.ends_at = adapter.ends_at\n events << occurrence\n end\n end\n \n @log.info \"got #{events.size} events\"\n events\n end", "def categories(params={})\n return @categories if (@categories && !params[:force])\n @categories = get_categories\n end", "def setup_categories # :nodoc:\n [:event, :time, :salutation, :recurrency, :preposition,\n :article, :day, :verb, :name, :number, :interrogation].each do |category|\n @matches[category] = []\n end\n @matches[:guessing] = false\n end", "def all_categories\n @mutex.synchronize do\n @categories.keys\n end\n end", "def categories\n raw_categories.to_hashugar\n end", "def categories(args={})\n res = api_request('private.request.getCategories', 'GET')\n res = JSON.parse(res)['category'] rescue []\n\n unless args[:include_deleted] and args[:include_deleted] == true\n res.reject!{|k, v| v['fDeleted'] == '1'} rescue []\n end\n \n return res\n end", "def getCategoryList\n categoryDump = @course.assessment_categories\n categories = {}\n for cat in categoryDump do\n categories[cat.name] = cat.id\n end\n return categories\n end", "def categories\n parsed_json['data']\n end", "def categories\n expose Metadata.categories(@oauth_token)\n end", "def catses\n REXML::XPath.match(@xml, './app:categories', Names::XmlNamespaces)\n end", "def categories(sport_id)\n get(\"sports/en/sports/sr:sport:#{sport_id}/categories.xml\")\n end", "def get_categories(row)\n categories = []\n cat = at_in(:category1 , row) # should invent some loop here\n categories << cat if cat\n cat = at_in(:category2 , row) # but we only support\n categories << cat if cat\n cat = at_in(:category3 , row) # three levels, so there you go\n categories << cat if cat\n categories\n end", "def categories=(categories)\n @categories = categories\n end", "def find_categories\n categories = @deck.cards.group_by do |card|\n card.category\n end\n categories.keys\n end", "def data_categories_sheet\r\n @book.worksheet(WBF[:category_sheet])\r\n end", "def categories()\n @web.get('http://www.waymarking.com/cat/categorydirectory.aspx') do |page|\n ile = 0\n #puts page.parser.to_html.to_s\n cache = {}\n\n page.parser.css('div#content div.gutter a').each do |cat|\n href = cat.attr('href')\n m = Category::GUID_REGEXP.match href\n key = Waymarking::Utils.parameterize(cat.text)\n unless m.nil? then\n ile +=1\n raise DuplicatedCategory if cache.has_key? key\n\n cache[key] = m[1]\n #puts \"#{ile} #{key} #{cat.text} #{m[1]}\"\n else\n puts href\n end\n\n end\n\n cache2 = {}\n cache.keys.each do |key|\n @web.get(\"http://www.waymarking.com/cat/details.aspx?f=1&guid=#{cache[key]}&exp=True\") do |page2|\n begin\n cat = Waymarking::Category.from_html(page2)\n cache2[key] = cat\n rescue\n puts key\n end\n end\n end\n\n File.open('categories.yml', 'w') do |f|\n f.write YAML::dump(cache2)\n end\n end\n end", "def categories_list\n @categories = Category.all.collect { |p| [p.name, p.id] }\n end", "def categories\n if self.channel.generator == 'Twitter'\n return @item.title.scan(/#([^#\\s]+)/).flatten\n end\n return [] if @item.categories.empty?\n @item.categories.collect{|c| c.content}.reject{|c| c == '' || c.match(/^\\s+$/)}\n end", "def categories_for_solution_search(category)\n [Sfcatnode.root] + category.children\n end", "def get_categories\n body = build_request(2935, 1501, \"ACTIVEHEADINGS\")\n response = send_to_localeze(body)\n xml_doc = respond_with_hash(Nokogiri::XML(response.to_xml).text)\n end", "def calendar_category\n @request.path_parameters[:url][1]\n end", "def category_ids(categories)\n #This can accept an array or a single id\n categories = [categories] unless categories.class == Array\n bb_products = []\n categories.each do |category|\n category = ProductCategory.trim_retailer(category)\n product_infos = get_shallow_product_infos(category, english = true, use_cache = true)\n product_infos.select! { |product_info| product_info[\"isVisible\"] != false } \n bb_products += product_infos.map{ |p| BBproduct.new(:id => p[\"sku\"], :category => category) }\n end\n bb_products\n end", "def category_list_builder\n categories = API.get_categories\n categories.each do |cat|\n Category.new(cat)\n end\n end", "def categories\n Hash[self.class.catalogs.map { |fld, klass|\n name = fld.gsub(/_id$/, '_name');\n [fld, {:id => self.send(fld), :name => self.send(name)}] rescue nil\n }.reject {|cat| cat.nil?}]\n end", "def categories\n\t\trender :json => {:status => 1, :categories => {\"1\" => \"Apparel & Accessories\", \"2\" => \"Arts and Crafts\", \"3\" => \"Electronics\", \n\t\t\t\"4\" => \"Home Appliances\", \"5\" => \"Kids & Baby\", \"6\" => \"Movies, Music, Books & Games\", \"7\" => \"Motor Vehicles\", \n\t\t\t\"8\" => \"Office & Education\", \"9\" => \"Parties & Events\", \"10\" => \"Spaces & Venues\", \"11\" => \"Sports & Outdoors\", \"12\" => \"Tools & Gardening\", \"13\" => \"Other\"}}, :status => 200\n\t\treturn\n\tend", "def all_categories\n end", "def getCategories(_, _, _)\n @db.categories\n end", "def selectable_metadata_standards(category:)\n out = MetadataStandard.all.order(:title).map { |ms| [ms.title, ms.id] }\n return out if category.blank?\n\n MetadataStandard.where(descipline_specific: (category == 'disciplinary'))\n .map { |ms| [ms.title, ms.id] }\n end", "def categories(options=nil, &definition)\n if options\n if options[:for]\n @embed_for = options[:for]\n end\n end\n \n @embedded = CategoryScraper.new @fetcher_class,{:main_url => @main_url}, &definition\n end" ]
[ "0.6852299", "0.6690106", "0.66218275", "0.6471427", "0.6290092", "0.6238935", "0.6154424", "0.61530167", "0.5992287", "0.5916889", "0.588686", "0.5878624", "0.58754045", "0.58141625", "0.5810971", "0.58008677", "0.57922906", "0.5766532", "0.57505065", "0.57494134", "0.5740285", "0.5705577", "0.56936294", "0.5677981", "0.56552434", "0.5653443", "0.56498235", "0.5648755", "0.55936486", "0.55743706", "0.5562954", "0.55573237", "0.5529157", "0.55089605", "0.5507434", "0.5507418", "0.5501526", "0.5501447", "0.54955506", "0.549178", "0.5490056", "0.5487225", "0.547904", "0.5475219", "0.5464683", "0.5449828", "0.54408187", "0.54239184", "0.54227215", "0.54219294", "0.5418154", "0.54175526", "0.541676", "0.5416033", "0.5411556", "0.5411142", "0.54071915", "0.53962064", "0.5390712", "0.5382683", "0.5367067", "0.53659797", "0.53636324", "0.5349867", "0.5348651", "0.5348651", "0.5348651", "0.53464556", "0.53279424", "0.53277767", "0.5323617", "0.53184164", "0.5312361", "0.53110003", "0.53018844", "0.5297058", "0.5295165", "0.52747816", "0.5273584", "0.52735555", "0.5249787", "0.52441615", "0.52348596", "0.52332705", "0.5231553", "0.5229184", "0.5227166", "0.52207565", "0.5219317", "0.5215778", "0.5213251", "0.5211532", "0.5210185", "0.5209692", "0.5198444", "0.51951027", "0.5190113", "0.5188521", "0.5180178", "0.5177969" ]
0.76557314
0
Sessions are opened to the google api using a google username and password. This implemented so that only one session is used per feed. You probably won't need to use this, but if you do, you can access the session for a feed object by: feed = GCalendar::Feed.first feed.login assigns session feed.session => returns the GData Session object feed.session = GCal::Session.new if you so chose See also GCalendar::Feedlogin. The session is actually from GData. You shouldn't ordinarily need to use this function.
def session @@session ||= [] if @@session[self.id].nil? session = GData::Client::Calendar.new token = session.clientlogin(username,password) @@session[self.id] = session end @@session[self.id] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login\n self.session = GData::Client::Calendar.new if session.nil?\n @token = session.clientlogin(username,password)\n true\n end", "def get_session\n\t\trefresh_token = get_refresh_token\n\n\t\tclient = OAuth2::Client.new(\n\t\t CLIENT_ID,\n\t\t CLIENT_SECRET,\n\t\t site: \"https://accounts.google.com\",\n\t\t token_url: \"/o/oauth2/token\",\n\t\t authorize_url: \"/o/oauth2/auth\")\n\t\tauth_token = OAuth2::AccessToken.from_hash(client,{:refresh_token => refresh_token, :expires_at => 3600})\n\t\tauth_token = auth_token.refresh!\n\t\tsession = GoogleDrive.login_with_oauth(auth_token.token)\n\n\t\tFile.write(REFRESH_TOKEN_FILE_NAME, refresh_token) unless File.exists?(REFRESH_TOKEN_FILE_NAME)\n\t\treturn session\n\tend", "def session\n Thread.current['clients_manager'].client('Website').session\n end", "def login\n system('clear')\n puts 'Authorizing...'.green\n\n @session ||= GoogleDrive.saved_session('config.json')\n @ws ||= @session.spreadsheet_by_key(ENV['SPREADSHEET_KEY']).worksheets[0]\nend", "def authenticate_google\n if not session[:username] or not session[:password]\n redirect_to :action => :login and return\n end\n @account = Service.new()\n @account.debug = true\n @account.authenticate(session[:username], session[:password])\n @calendars = service.calendars\n end", "def google_session\n google_service_account_credential_file = 'pennypoll-d23e19e91329.json'\n\n GoogleDrive::Session.from_service_account_key(\n google_service_account_credential_file\n )\nend", "def login(email, pwd, source='googlecalendar.rubyforge.org-googlecalendar-default')\r\n # service The string cl, which is the service name for Google Calendar.\r\n @user_id = email\r\n response = Net::HTTPS.post_form(URI.parse(\"https://#{@google_url}/accounts/ClientLogin\"),\r\n { 'Email' => email, \r\n 'Passwd' => pwd, \r\n 'source' => source, \r\n 'accountType' => 'HOSTED_OR_GOOGLE', \r\n 'service' => 'cl'})\r\n response.error! unless response.kind_of? Net::HTTPSuccess\r\n @token = response.body.split(/=/).last\r\n @headers = {\r\n 'Authorization' => \"GoogleLogin auth=#{@token}\",\r\n 'Content-Type' => 'application/atom+xml'\r\n }\r\n return @token\r\n end", "def session; @session; end", "def session; @session; end", "def session; @session; end", "def get_session( params )\n LastFM.get( \"auth.getSession\", params, :secure )\n end", "def open_session; end", "def login\n if session[:token]\n reset_session \n end\n scope = 'https://www.google.com/analytics/feeds/'\n #next_url = 'http://localhost:3000/sites/select'\n next_url = 'http://greenalytics.heroku.com/sites/select'\n secure = false # set secure = true for signed AuthSub requests\n sess = true\n @authsub_link = GData::Auth::AuthSub.get_url(next_url, scope, secure, sess)\n end", "def session\n raw_session[\"warden.user.#{scope}.session\"] ||= {}\n end", "def get_session\n @authenticator.get_session\n end", "def auth_session\n @session ||= begin\n @session = Origen.session.user\n @session.private = true\n @session\n end\n end", "def session_get\n nessus_rest_get(\"session\")\n end", "def session\r\n @session ||= {}\r\n end", "def obtain_session\n session = @session_storage.obtain_session\n if !session\n session = @auth_client.auth(@username,\n @password,\n @client_id,\n @client_secret)\n @session_storage.store_session(session)\n end\n\n session\n end", "def login\n uri = URI('https://www.google.com/accounts/ClientLogin')\n\n q = { 'service' => 'sj',\n 'account_type' => 'GOOGLE',\n 'source' => 'ruby-skyjam-%s' % SkyJam::VERSION,\n 'Email' => @account,\n 'Passwd' => @password }\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n\n req = Net::HTTP::Post.new(uri.path)\n req.set_form_data(q)\n res = http.request(req)\n\n unless res.is_a? Net::HTTPSuccess\n fail Error, 'login failed: #{res.code}'\n end\n\n tokens = Hash[*res.body\n .split(\"\\n\")\n .map { |r| r.split('=', 2) }\n .flatten]\n @sid = tokens['SID']\n @auth = tokens['Auth']\n end", "def session\n @session ||= establish_connection\n end", "def sessions\n Thread.current[:sessions] ||= {}\n end", "def session\n @session ||= {}\n end", "def sessions\n @@session_set ||= ActiveRecord::SessionStore::Session.all.select{|s| s.data.has_key?(\"user_credentials_id\")}\n @@session_set.select{|s| s.data[\"user_credentials_id\"] == self.id}\n end", "def session\n Session.instance\n end", "def obtain_session\n session = @session_storage.obtain_session\n if session.nil?\n session = @auth_client.auth(@username,\n @password,\n @client_id,\n @client_secret)\n @session_storage.store_session(session)\n end\n\n session\n end", "def google_login(email, password)\n url = 'https://www.google.com/accounts/ClientLogin'\n source = \"KcK-GooglePicasaPreview-1.0.0\"\n # service=lh2 is a Picasa service\n # https://developers.google.com/gdata/faq#clientlogin\n params = 'accountType=HOSTED_OR_GOOGLE' \\\n \"&Email=#{email}\" \\\n \"&Passwd=#{password}\" \\\n '&service=lh2' \\\n \"&source=#{source}\"\n\n response = http_request(:post, url, params)\n\n if response.code =~ /20[01]/\n reset_captcha!\n self.user = email\n /Auth=([[:alnum:]_\\-]+)\\n/ =~ response.body.to_s\n self.token = $1\n else\n self.user = self.token = nil\n errors = scan_body_for_errors(response.body)\n # set captcha = true if captcha error comes from the service. We will tell user to unlock captcha for login redirecting to unlock captcha url\n # unlock captcha url: https://www.google.com/accounts/DisplayUnlockCaptcha\n self.captcha = true if errors.include?('CaptchaRequired')\n raise Picasa::PicasaLoginError, \"The request for login has failed. (#{errors.to_sentence})\"\n end\n end", "def session; end", "def session; end", "def session; end", "def session; end", "def session #:nodoc:\n @session ||= Session.new\n end", "def sessions\n Thread.current[:sessions] ||= {}\n end", "def session\n self\n end", "def set_auth_sessions(data)\n session[:authentication_token] = data[\"data\"][\"token\"][\"access_token\"]\n session[:refresh_token] = data[\"data\"][\"token\"][\"refresh_token\"]\n session[:expires_at] = DateTime.now + data[\"data\"][\"token\"][\"expires_in\"].to_i.seconds\n end", "def setup_session\n @session_id ||= if @smug_user.email\n setup_session_with_username\n else \n setup_session_anonymously\n end\n end", "def get_new_session\n client = prepare_request(auth_url)\n\n login_response = do_request_and_handle_errors do\n client.request :login do |soap|\n soap.body = {:id => @user, :pw => @pass}\n end\n end\n\n @session = login_response.to_hash[:login_response][:login_return]\n @cookie = login_response.http.headers[\"Set-Cookie\"]\n\n false unless @session.instance_of? Nori::StringWithAttributes\n end", "def login_from_session\n self.current_user = User.find_by_id( session[ :user_id ] ) if session[ :user_id ]\n end", "def login()\n content = {\n 'Email' => @username,\n 'Passwd' => @password,\n 'source' => @app_name,\n 'accountType' => 'HOSTED_OR_GOOGLE',\n 'service' => 'cl'}\n\n response = send(Addressable::URI.parse(@auth_url), :post_form, content)\n\n raise HTTPRequestFailed unless response.kind_of? Net::HTTPSuccess\n\n @token = response.body.split('=').last\n @headers = {\n 'Authorization' => \"GoogleLogin auth=#{@token}\",\n 'Content-Type' => 'application/atom+xml'\n }\n @update_header = @headers.clone\n @update_header[\"If-Match\"] = \"*\"\n end", "def session\n @session ||= Session.new(req)\n end", "def session\n end", "def session(token)\n get(:signed, {:method => \"auth.getSession\", :token => token})\n end", "def session\n @session ||= Session.new(@req)\n end", "def session\n @session ||= Session.new(@req)\n end", "def set_user_session\n session[:access_token] = user_credentials.access_token\n session[:refresh_token] = user_credentials.refresh_token\n session[:expires_in] = user_credentials.expires_in\n session[:issued_at] = user_credentials.issued_at\nend", "def open_session_with_login\n $system_config ||= load_config(@@SERVER_CONFIG_PATH)\n url = \"#{$system_config.protocol}://#{$system_config.host}:#{$system_config.port}\"\n Util.open_session(url)\n Util.login($system_config.user, $system_config.password)\n end", "def session\n object.session\n end", "def set_session\n\t #no idea why I need this, but login form seems to break otherwise\n\t session[:email] = session[:email]\n\t session[:password] = session[:password]\n\t end", "def session() request.session end", "def session\n @session ||= options[:session] || {} \n end", "def sessions\n @sessions ||= search_sessions(xml_doc)\n end", "def default_session\n @session ||= open_session\n end", "def login\n @user = User.find_by_email(params[:email])\n if @user.password == params[:password]\n session[:id] = @user.id\n session[:visit] = 0\n redirect \"users/#{@user.id}/feed\"\n else\n redirect '/'\n end\nend", "def _session\n\t\t\tThread.current[SESSION]\n\t\tend", "def session # :nodoc:\n sess = Mack::SessionStore.get($current_session_id, nil, nil, nil)\n if sess.nil?\n id = String.randomize(40).downcase\n set_cookie(configatron.mack.session_id, id)\n sess = Mack::Session.new(id)\n Mack::SessionStore.store.direct_set(id, sess)\n $current_session_id = id\n sess \n end\n sess\n end", "def session\n @session ||= Session.new(req)\n end", "def session\n @session ||= Session.new(req)\n end", "def session\n @session ||= Session.new(req)\n end", "def session\n @session ||= Session.new(req)\n end", "def session\n @session ||= Session.new(req)\n end", "def session\n @session ||= Session.new(@req)\n end", "def session\n @session ||= Session.new(@req)\n end", "def session\n @session ||= Session.new(@req)\n end", "def session\n @session ||= Session.new( req )\n end", "def start_session\n session_tracker.start_session\n end", "def current_session(env=Thread.current[:env])\n return nil unless env\n setup_env(env)\n key = session['user_credentials']\n if @sessions[key]\n @refresh_sessions[key] = true\n else\n @session_mutex.synchronize do\n unless @previous_sessions[key]\n oldkey = key\n s = find_session\n key = session['user_credentials']\n @previous_sessions[oldkey] = key\n @sessions[key] = s\n @refresh_sessions[key] = true\n Thread.new do\n sleep Config::PreviousSessionTimeout\n @previous_sessions.delete(oldkey)\n end\n Thread.new do\n while @refresh_sessions[key] do\n @refresh_sessions.delete(key)\n sleep Config::SessionTimeout\n end\n @sessions.delete(key)\n end\n params['_need_cookie_update'] = true if full_path == '/ajax/poll'\n else\n key = @previous_sessions[key]\n end\n end\n end\n @sessions[key]\n end", "def init_session\n if session\n if session.updated_at < Time.now - ::Gricer.config.max_session_duration\n self.session = Session.create previous_session: session, ip_address: @ip_address, agent: agent, requested_locale: @request_locale\n else\n self.session.touch\n end\n else\n self.is_first_in_session = true\n self.session = Session.create ip_address: @ip_address, agent: agent, requested_locale: @request_locale\n self.session.touch\n end\n \n session\n end", "def login\n content = {\n 'Email' => @username,\n 'Passwd' => @password,\n 'source' => @app_name,\n 'accountType' => 'HOSTED_OR_GOOGLE',\n 'service' => 'cl'}\n\n response = send(Addressable::URI.parse(@auth_url), :post_form, content)\n\n raise HTTPRequestFailed unless response.kind_of? Net::HTTPSuccess\n\n @token = response.body.split('=').last\n @headers = {\n 'Authorization' => \"GoogleLogin auth=#{@token}\",\n 'Content-Type' => 'application/atom+xml'\n }\n @update_header = @headers.clone\n @update_header[\"If-Match\"] = \"*\"\n end", "def login_from_session\n self.current_user = User.find_by_id(session[:user_id]) if session[:user_id]\n end", "def session_begin(cred, mode)\n #This is a stub, used for indexing\n end", "def set_session\n @session = session[:user_id]\n end", "def get_session(env, sid)\n raise '#get_session needs to be implemented.'\n end", "def login_from_session\n self.current_user = User.find(session[:user_id]) if session[:user_id]\n end", "def login_from_session\n self.current_user = User.find(session[:user_id]) if session[:user_id]\n end", "def set_session\n @session = BatchConnect::Session.find(params[:id])\n end", "def retrieve_session\n request.method = :get\n request.uri = '_session'\n Couchdbtools.execute(request)\n end", "def user_session\n\t\t@user_session ||= UserSession.new(session)\n\tend", "def session(email, password)\n post('/session', body: { email: email, password: password }, unauthenticated: true)\n end", "def session(options={}, &block)\n self.class.session self, &block\n end", "def start_session\n generate_token(:token)\n setup_session\n update_last_session\n end", "def session\n @session ||= Session.new(@request)\n @session\n end", "def get_session(env, sid)\n raise '#get_session not implemented.'\n end", "def login_from_session\n self.current_ma_user = MA[:user].find_with_conditions(:id => session[MA[:single_resource]]) if session[MA[:single_resource]]\n end", "def session\n @session ||= OpenStruct.new\n end", "def index\n sessions = request do\n api.request(\n :expects => 200,\n :headers => headers,\n :method => :get,\n :path => \"/oauth/sessions\"\n ).body\n end\n styled_header(\"OAuth Sessions\")\n styled_array(sessions.map { |session|\n [session[\"description\"], session[\"id\"]]\n })\n end", "def session\n @connection.request('session-get') do |resp|\n if resp == :connection_error\n yield :connection_error\n else\n yield Session.new(resp)\n end\n end\n end", "def create_session\n login, password = get_login_and_password\n create_session_with authenticate_user(login, password, :trace => true)\n end", "def auth_session\n @auth_session ||= Session.get_session(@controller)\n end", "def sessions!\n @sessions = search_sessions(xml_doc!)\n end", "def initialize\n print \"[GOOGLE DRIVE] Restoring session...\\n\"\n @session = GoogleDrive::saved_session(config, nil, CLIENT_ID, CLIENT_SECRET)\n end", "def with_session(auth = false, &block)\n auth_token = self.class.remembered_auth \n if auth_token.nil?\n auth_token = self.class.remembered_auth = get_auth_token\n end\n \n \n create_url = \"#{configuration.base_url}createsession?profile=#{configuration.profile}&guest=#{auth ? 'n' : 'y'}\" \n response_xml = get_with_auth(create_url) \n \n session_token = nil\n unless response_xml && (session_token = at_xpath_text(response_xml, \"//SessionToken\")) \n e = EdsCommException.new(\"Could not get SessionToken\") \n end\n \n begin \n block.yield(session_token)\n ensure \n if auth_token && session_token \n end_url = \"#{configuration.base_url}endsession?sessiontoken=#{CGI.escape session_token}\"\n response_xml = get_with_auth(end_url) \n end\n end\n \n end", "def session\n\t\t\t\t@session ||= response.session\n\t\t\tend", "def session\n @req.session\n end", "def login_from_session\n self.current_user = User.find_by_id(session[:user_id]) if session[:user_id]\n end", "def login_from_session\n self.current_user = User.find(session[:user_id]) if session[:user_id]\n end", "def login\n client.login(\n params[:user],\n params[:password],\n authParams: {\n scope: 'openid name email'\n },\n connection: 'Username-Password-Authentication'\n )\n end", "def session\n Session.wrap(Cproton.pn_link_session(@impl))\n end", "def set_session\n \n end", "def facebook_session\n @facebook_session ||=\n returning Facebooker::Session.create do |session|\n # Facebook sessions are only good for 1 hour after storing\n # secure_with! associates a session key to a\n # Facebooker::Session object\n session.secure_with!(session_key, facebook_id, 1.hour.from_now)\n end\n end", "def setup_session_with_username\n method = 'smugmug.login.withPassword'\n setup_session_with [\"method=#{method}\",\"EmailAddress=#{@smug_user.email}\",\"Password=#{@smug_user.password}\"]\n end" ]
[ "0.68258905", "0.672245", "0.63258857", "0.6272637", "0.6261305", "0.6250484", "0.6180397", "0.61020875", "0.61020875", "0.61020875", "0.601425", "0.59638363", "0.5951496", "0.59470797", "0.5916242", "0.5915621", "0.5907507", "0.58968884", "0.5867331", "0.586653", "0.58419687", "0.58402336", "0.5829751", "0.581924", "0.5802595", "0.57980657", "0.5788225", "0.5760342", "0.5760342", "0.5760342", "0.5760342", "0.5758763", "0.57564014", "0.57539237", "0.5729202", "0.57143265", "0.57112455", "0.56988734", "0.56926143", "0.569067", "0.56875646", "0.56874824", "0.56845695", "0.56845695", "0.5682041", "0.5669446", "0.5656065", "0.5638496", "0.563592", "0.56293327", "0.561982", "0.5619478", "0.56146365", "0.56035703", "0.5596079", "0.5592989", "0.5592989", "0.5592989", "0.5592989", "0.5592989", "0.5592105", "0.5592105", "0.5592105", "0.5583809", "0.5577549", "0.55647385", "0.55642116", "0.5558136", "0.5550485", "0.55502874", "0.55406207", "0.5534653", "0.5529095", "0.5529095", "0.5528771", "0.5522606", "0.5499615", "0.5496802", "0.5492469", "0.5491615", "0.5490781", "0.54885554", "0.5485857", "0.5482552", "0.5481913", "0.5478963", "0.54724675", "0.5462509", "0.5455711", "0.5448464", "0.5437091", "0.54314965", "0.54098064", "0.5407247", "0.540603", "0.5400363", "0.5396467", "0.5396003", "0.539021", "0.53851056" ]
0.7790588
0
Assign a value to the session for this object. note that it is saved in a class instance variable so it only needs to be done once per Feed id. You shouldn't ordinarily need to use this function.
def session=(val) @@session ||= [] @@session[self.id] = val end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def session_set(name,value)\n session[name] = value\n end", "def set_session\n @session = session[:user_id]\n end", "def set_session\r\n @session = Session.find(params[:id])\r\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = BatchConnect::Session.find(params[:id])\n end", "def set_session\n @session = FitnessSession.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:session_id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def []=(key, value)\r\n session[key] = value\r\n end", "def set_session\n @session = current_user.sessions.find(params[:id])\n end", "def set_user_session\n @user_session = UserSession.find\n end", "def set_user_session\n @user_session = UserSession.find(params[:id])\n end", "def id=(value)\n if value == @defaults['ai.session.id']\n @values.delete 'ai.session.id' if @values.key? 'ai.session.id'\n else\n @values['ai.session.id'] = value\n end\n end", "def set_session\n @session = current_session\n end", "def set_user_session\n user_session = UserSession.find(params[:id])\n end", "def save_to(session)\n attributes.each do |key, value|\n session[key] = value\n end\n self\n end", "def set(session_variable, value)\n current_session[session_variable] = value\n end", "def update\n return unless @session\n @session.data = @data\n @session.save\n end", "def set_user_session\n @user_session = User_session.find(params[:id])\n end", "def set_session_info\n @session_info = SessionInfo.find(params[:id])\n end", "def value=(val)\n session.set(@name, val)\n end", "def setSession(id)\n\tif id.class == Integer \n\t\tsession[:id] = id\n\telse \n\t\treturn false \n\tend\nend", "def set_class_session\n\t\t@class_session = ClassSession.find(params[:id])\n\tend", "def set_class_session\n @class_session = ClassSession.find(params[:id])\n end", "def update\n java_session = @java_request.getSession(true)\n hash = @session_data.dup\n hash.delete_if do |k,v|\n if String === k\n case v\n when String, Numeric, true, false, nil\n java_session.setAttribute k, v\n true\n else\n if v.respond_to?(:java_object)\n java_session.setAttribute k, v\n true\n else\n false\n end\n end\n end\n end\n unless hash.empty?\n marshalled_string = Marshal.dump(hash)\n marshalled_bytes = marshalled_string.to_java_bytes\n java_session.setAttribute(RAILS_SESSION_KEY, marshalled_bytes)\n end\n end", "def set_class_session\n @class_session = ClassSession.find(params[:id])\n end", "def set_user_site_session\n @user_site_session = UserSiteSession.find(params[:id])\n end", "def set_session\n \n end", "def set_user\n @user = User.find(session[:id]) if @user.nil && session[:id]\n end", "def set_active_data(key, value)\n @active_data ||= {}\n @active_data[key] = value\n session[key] = value\n end", "def set_session\n @admin_session = AdminSession.find(params[:id])\n end", "def set_session_login\n @session_login = SessionLogin.find(params[:id])\n end", "def update\n if @session\n @session.update_session(marshalize(@data))\n end\n end", "def set_session\n ses = Session.find_or_create_by(\n account: self,\n )\n ses.update(expires_at: 10.minutes.from_now)\n end", "def set_game_session\n\t\t@game_session_id = GameSession.find(params[:id])\n\tend", "def set_training_session\n @training_session = TrainingSession.find(params[:training_session_id])\n end", "def update #:nodoc:#\n Cachetastic::Caches::RailsSessionCache.set(@session_key, @session_data)\n end", "def set_tsession\n @tsession = Tsession.find(params[:id])\n end", "def store_session(using_token)\n if self.token != using_token\n self.update_attribute(self.send(:\"#{self.class.meetup_token_field}\"), using_token)\n end\n end", "def set_sevone_session\n @sevone_session = SevoneSession.find(params[:id])\n end", "def update_session(parsed, session)\n session ||= Session.new\n session.id = parsed[parsed.keys.first][\"customerSessionId\"] if parsed[parsed.keys.first]\n end", "def set_subject_session\n @subject_session = SubjectSession.find(params[:id])\n end", "def set_user\n @user = User.find(session[:user_id])\n end", "def set_user_session\n @user = user_session.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n session[:ticket] = @ticket.id\n end", "def update_session(data)\n update_attribute('data', data) \n end", "def set_timetabled_session\n @timetabled_session = TimetabledSession.find(params[:id])\n end", "def set_session\n session['token'] = @result['data']['token']\n current_user\n end", "def set_user\n @user = User.find(session[:user_id])\n end", "def set_game_session\n @game_session = GameSession.find(params[:id])\n end", "def set_possession\n @possession = Possession.find(params[:id])\n end", "def set_ergo_session\n @ergo_session = ErgoSession.find(params[:id])\n end", "def set_session user\n session[:user_id] = user.id\n session[:user_fullname] = user.fullname\n session[:user_email] = user.email\n session[:user_access] = user.access\n session[:company_id] = user.company_id\n end", "def session # :nodoc:\n sess = Mack::SessionStore.get($current_session_id, nil, nil, nil)\n if sess.nil?\n id = String.randomize(40).downcase\n set_cookie(configatron.mack.session_id, id)\n sess = Mack::Session.new(id)\n Mack::SessionStore.store.direct_set(id, sess)\n $current_session_id = id\n sess \n end\n sess\n end", "def set_session_event\n @session_event = SessionEvent.find(params[:id])\n end", "def set_lift_session\n @lift_session = LiftSession.find(params[:id])\n end", "def set_current(session)\n @@current_session = session\n end", "def set_user\n @user = User.find(session[:user_id])\n end", "def set_user\n @user = User.find(session[:user_id])\n end", "def set_user\n if session[:user_id].nil?\n @user = nil\n else\n @user = User.find(session[:user_id])\n end\n end", "def set_user\n require_logged_in\n @user = User.find_by(id: session[:user_id])\n end", "def set_dream_session\n @dream_session = DreamSession.find(params[:id])\n end", "def set_session_operation\n @session_operation = SessionOperation.find(params[:id])\n end", "def setup\n session[:user_id]=1\n end", "def set_student_session\n @student_session = StudentSession.find(params[:id])\n end", "def assign_session(user)\n\t\t@sessions[user] = issue_session\n\tend", "def session; @session; end", "def session; @session; end", "def session; @session; end", "def set_training_session\n @training_session = TrainingSession.where(\"id = ? AND user_id = ? AND open = ?\", params[:id], current_user.id, false)[0]\n end", "def []=(key, value)\n sess_hash[key.to_sym] = value\n end", "def set_session_for(user)\n UserSession.create(user)\n end", "def set_current_user\n @current_user =\n if session.key? :user_id\n User.active.find_by id: session[:user_id]\n elsif request.env.key? 'fcIdNumber'\n User.active.find_by spire: request.env['fcIdNumber']\n end\n session[:user_id] = @current_user.id if @current_user.present?\n end", "def set_user\n UserInfo.current_user = session[:user]\n end", "def _set_session(env, sid, new_session, options)\n logger.debug \"Setting session #{new_session.inspect}\" \n ses_obj = sessions.find_one( { :_id => sid } )\n if ses_obj\n logger.debug \"Found existing session for -- #{sid.inspect}\"\n session = MongoRack::SessionHash.new( deserialize( ses_obj['data'] ) )\n else\n logger.debug \"Unable to find session for -- #{sid.inspect}\"\n session = MongoRack::SessionHash.new\n end\n \n if options[:renew] or options[:drop]\n sessions.remove( { :_id => sid } )\n return false if options[:drop]\n sid = generate_sid\n sessions.insert( {:_id => sid, :data => {} } )\n end\n old_session = new_session.instance_variable_get('@old') || MongoRack::SessionHash.new\n logger.debug \"Setting old session -- #{old_session.inspect}\" \n merged = merge_sessions( sid, old_session, new_session, session )\n\n expiry = options[:expire_after]\n expiry = expiry ? Time.now + options[:expire_after] : 0\n\n # BOZO ! Use upserts here if minor changes ?\n logger.debug \"Updating session -- #{merged.inspect}\" \n sessions.save( { :_id => sid, :data => serialize( merged ), :expire => expiry } )\n return sid\n rescue => boom \n logger.error \"#{self} Hoy! Something went wrong. Unable to persist session.\"\n logger.error $!.inspect\n boom.backtrace.each{ |l| logger.error l }\n return false\n end", "def set_user_session(user)\n session[:logged_in_users_id] = user.id\n end", "def session=(_arg0); end", "def set_current_user(user)\n session[:user_id] = user.try :id\n end", "def set_module_session\n @module_session = ModuleSession.find(params[:id])\n end", "def offering_session_id=(session)\n self.write_attribute(:offering_session_id, session)\n self.write_attribute(:offering_session_order, nil)\n self.write_attribute(:moderator_comments, nil)\n self.write_attribute(:application_moderator_decision_type_id, nil)\n end" ]
[ "0.7102262", "0.6969943", "0.6961682", "0.69135517", "0.6913235", "0.6913235", "0.6913235", "0.6913235", "0.6913235", "0.6913235", "0.6913235", "0.6913235", "0.6913235", "0.6913235", "0.6913235", "0.6913235", "0.6913235", "0.6913235", "0.6913235", "0.6913235", "0.6913235", "0.6892281", "0.68124324", "0.678886", "0.67862487", "0.67862487", "0.67862487", "0.67862487", "0.6754979", "0.6686212", "0.6676066", "0.66472423", "0.66011107", "0.65937203", "0.65692186", "0.6567163", "0.65530086", "0.65087813", "0.6501794", "0.65014267", "0.64915", "0.648326", "0.6401612", "0.6384704", "0.6384704", "0.6384704", "0.6380624", "0.6368771", "0.6326601", "0.63187104", "0.63175714", "0.63101953", "0.6306634", "0.63013035", "0.6288887", "0.62864166", "0.6276768", "0.62514246", "0.624994", "0.6228397", "0.62182087", "0.61903334", "0.61804366", "0.6172745", "0.61707455", "0.6169874", "0.6153957", "0.61389184", "0.613785", "0.61227036", "0.6112781", "0.61104935", "0.6100736", "0.60986066", "0.60969406", "0.60873127", "0.60780627", "0.6066645", "0.6066645", "0.60659283", "0.6063776", "0.6054682", "0.6030606", "0.60270476", "0.6024826", "0.6020435", "0.6006545", "0.6006545", "0.6006545", "0.6003174", "0.59899694", "0.59800965", "0.59789675", "0.5957786", "0.5949612", "0.59492147", "0.59398085", "0.59367245", "0.59346676", "0.59308827" ]
0.6955854
3
create a new calendar object for this feed. name name or title of the calendar opts hash of fields for creating the calendar object. TODO, move or add function to the calendars association
def create_calendar(name, opts={}) opts[:name] = name cal = GCalendar::Calendar.new(:opts=>opts) calendars << cal cal.sync save end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_google_calendar\n unless self.apps_cal_id\n result = Gandalf::GoogleApiClient.insert_google_calendar({\n \"summary\" => self.name\n })\n self.apps_cal_id = result.data.id\n self.save!\n end\n end", "def create\n\t@calendar = @user.calendars.build(params[:calendar])\n\n respond_to do |format|\n if @calendar.save\n flash[:notice] = 'Calendar was successfully created.'\n format.html { redirect_to(calendars_path) }\n format.xml { render :xml => @calendar, :status => :created, :location => @calendar }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @calendar.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @calendar = Calendar.new(calendar_params)\n\n unless @calendar.import_file.nil?\n @calendar.import(params[:calendar][:import_file].tempfile)\n @calendar.title += \" | Copy #{Date.current}\"\n end\n\n @calendar.author_model = current_user\n @calendar.town_model = current_user.town_model\n\n respond_to do |format|\n if @calendar.save\n format.html { redirect_to [:calendars, @calendar], notice: t('calendar.create') }\n format.json { render :show, status: :created, location: @calendar }\n else\n format.html { render :new }\n format.json { render json: @calendar.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n\t\t@family_id = @user.fam_id\n\t\t@family = Fam.find(@family_id)\n\t\t@calendar = @user.calendars.build(params[:calendar])\n\t\t@calendar.fam_id = @family.id\n\n respond_to do |format|\n if @calendar.save\n flash[:notice] = 'Calendar was successfully created.'\n format.html { redirect_to(calendars_path) }\n format.xml { render :xml => @calendar, :status => :created, :location => @calendar }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @calendar.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n \n\t@family_id = @user.fam_id\n\t@family = Fam.find(:all, :conditions => [\"id=?\", @family_id])\n\t@calendar = @user.calendars.build(params[:calendar])\n\t@calendar.fam_id = @family[0].id\n\t#@calendar = @family[0].calendars.build(params[:calendar])\n\n respond_to do |format|\n if @calendar.save\n flash[:notice] = 'Calendar was successfully created.'\n format.html { redirect_to(calendars_path) }\n format.xml { render :xml => @calendar, :status => :created, :location => @calendar }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @calendar.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @calendar = Calendar.new(params[:calendar])\n\n respond_to do |format|\n if @calendar.save\n format.html { redirect_to @calendar, notice: 'Calendar was successfully created.' }\n format.json { render json: @calendar, status: :created, location: @calendar }\n else\n format.html { render action: \"new\" }\n format.json { render json: @calendar.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = @calendar.events.new(event_params)\n respond_to do |format|\n if @event.save\n format.json { render json: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @calendar = Calendar.new(calendar_params)\n\n respond_to do |format|\n if @calendar.save\n format.html { redirect_to @calendar, notice: 'Calendar was successfully created.' }\n format.json { render :show, status: :created, location: @calendar }\n else\n format.html { render :new }\n format.json { render json: @calendar.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @calendar = Calendar.new(calendar_params)\n\n respond_to do |format|\n if @calendar.save\n format.html { redirect_to @calendar, notice: 'Calendar was successfully created.' }\n format.json { render :show, status: :created, location: @calendar }\n else\n format.html { render :new }\n format.json { render json: @calendar.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @calendar = Calendar.new(calendar_params)\n\n respond_to do |format|\n if @calendar.save\n format.html { redirect_to @calendar, notice: \"Calendar was successfully created.\" }\n format.json { render :show, status: :created, location: @calendar }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @calendar.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @calendar = Calendar.new(params[:calendar])\n\n respond_to do |format|\n if @calendar.save\n flash[:notice] = 'Calendar was successfully created.'\n format.html { redirect_to(@calendar) }\n format.xml { render :xml => @calendar, :status => :created, :location => @calendar }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @calendar.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n calendar = Calendar.where(default: true, user_id: current_user.id)[0]\n @event = calendar.events.build(params[:event])\n\n parse_params\n if @event.save\n redirect_to request.referer\n else\n flash[:error] = \"Event creation failed!\"\n redirect_to request.referer\n end\n end", "def create\n @calendar = Calendar.new(params[:calendar])\n @calendar.user_id = current_user.id\n\n respond_to do |format|\n if @calendar.save\n format.html { redirect_to @calendar, :notice => 'Calendar was successfully created.' }\n format.json { render :json => @calendar, :status => :created, :location => @calendar }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @calendar.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_event(params = {})\n event = if block_given?\n Event.create(params.merge({:calendar => self}), &Proc.new)\n else\n Event.create(params.merge({:calendar => self}))\n end\n event.save\n end", "def create_calendar_event(calendar_event__context_code__,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :calendar_event__context_code__,\n :calendar_event__title__,\n :calendar_event__description__,\n :calendar_event__start_at__,\n :calendar_event__end_at__,\n :calendar_event__location_name__,\n :calendar_event__location_address__,\n :calendar_event__time_zone_edited__,\n :calendar_event__child_event_data_____x____start_at__,\n :calendar_event__child_event_data_____x____end_at__,\n :calendar_event__child_event_data_____x____context_code__,\n \n ]\n\n # verify existence of params\n raise \"calendar_event__context_code__ is required\" if calendar_event__context_code__.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :calendar_event__context_code__ => calendar_event__context_code__\n )\n\n # resource path\n path = path_replace(\"/v1/calendar_events\",\n )\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:post, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:post, path, query_params, form_params, headers)\n page_params_store(:post, path)\n response\n \n end", "def initialize(params={}, connection=nil)\n @connection = connection || Connection.factory(params)\n @id = params[:calendar]\n end", "def insert_calendar(opts = {})\n end", "def create_database\n DATA[:calendars].each do |calendar|\n CalendarCoordinator::Calendar.create(calendar).save\n end\n\n calendar = CalendarCoordinator::Calendar.first\n DATA[:events].each do |event|\n calendar.add_event(event)\n end\n end", "def calendar (id)\n @config.calendars.push(id)\n end", "def create\n @shop_calendar = ShopCalendar.new(shop_calendar_params)\n\n respond_to do |format|\n if @shop_calendar.save\n format.html { redirect_to @shop_calendar, notice: 'Shop calendar was successfully created.' }\n format.json { render :show, status: :created, location: @shop_calendar }\n else\n format.html { render :new }\n format.json { render json: @shop_calendar.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @calendar_date = CalendarDate.new(calendar_date_params)\n\n respond_to do |format|\n if @calendar_date.save\n format.html { redirect_to @calendar_date, notice: 'Calendar date was successfully created.' }\n format.json { render :show, status: :created, location: @calendar_date }\n else\n format.html { render :new }\n format.json { render json: @calendar_date.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @calendar_event = CalendarEvent.new(calendar_event_params)\n\n respond_to do |format|\n if @calendar_event.save\n format.html { redirect_to @calendar_event, notice: 'Calendar event was successfully created.' }\n format.json { render :show, status: :created, location: @calendar_event }\n else\n format.html { render :new }\n format.json { render json: @calendar_event.errors, status: :unprocessable_entity }\n end\n end\n end", "def calendar(remote_account_id, calendar_id, fields: nil)\n check_not_empty remote_account_id, 'remote_account_id'\n check_not_empty calendar_id, 'calendar_id'\n params = build_fields_params fields\n path = calendar_path remote_account_id, calendar_id\n res = @connection.get path, params\n Calendar.new res.body, self\n end", "def create\n @calendar = Calendar.new(params[:calendar])\n @calendar.user_id = session[:user_id]\n\n respond_to do |format|\n if @calendar.save\n format.html { redirect_to(@calendar, :notice => 'Calendar was successfully created.') }\n format.xml { render :xml => @calendar, :status => :created, :location => @calendar }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @calendar.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @calendar_event = CalendarEvent.new(params[:calendar_event])\n\n respond_to do |format|\n if @calendar_event.save\n format.html { redirect_to @calendar_event, notice: 'Calendar event was successfully created.' }\n format.json { render json: @calendar_event, status: :created, location: @calendar_event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @calendar_event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @calendar_date = CalendarDate.new(params[:calendar_date])\n\n respond_to do |format|\n if @calendar_date.save\n format.html { redirect_to @calendar_date, notice: 'Calendar date was successfully created.' }\n format.json { render json: @calendar_date, status: :created, location: @calendar_date }\n else\n format.html { render action: \"new\" }\n format.json { render json: @calendar_date.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @appt_calendar = ApptCalendar.new(params[:appt_calendar])\n\n respond_to do |format|\n if @appt_calendar.save\n format.html { redirect_to @appt_calendar, notice: 'Appt calendar was successfully created.' }\n format.json { render json: @appt_calendar, status: :created, location: @appt_calendar }\n else\n format.html { render action: \"new\" }\n format.json { render json: @appt_calendar.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @calender = Calender.new(calender_params)\n\n respond_to do |format|\n if @calender.save\n format.html { redirect_to @calender, notice: \"Calender was successfully created.\" }\n format.json { render :show, status: :created, location: @calender }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @calender.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n @org_calendars= current_user.organization.calendars(:order=>'created_at ASC')\n puts @org_calendars.inspect\n @org_last_calendar=@org_calendars.find(:last)\n puts \"#########################\"\n puts @org_last_calendar.inspect\n puts \"*****************************\"\n if !@org_calendars.blank? && !@org_last_calendar.blank?\n y= @org_last_calendar.cal_num.gsub!(\"CAL-\",\"\")\n \n m=y.to_i\n m = m +1\n x = (\"CAL-%0.4d\" %m.to_i).to_s\n\n params[:calendar][:cal_num] = x\n \n @calendar = Calendar.new(params[:calendar])\n @calendar.organization = current_user.organization\n @calendar.user = current_user\n else \n m = 1\n x = (\"CAL-%0.4d\" %m.to_i).to_s\n params[:calendar][:cal_num] = x\n @calendar = Calendar.new(params[:calendar])\n @calendar.organization = current_user.organization\n @calendar.user = current_user\n end\n \n @calendar.entry_date = change_date_format(params[:calendar][:entry_date]) if !(params[:calendar][:entry_date]).blank?\n respond_to do |format|\n if @calendar.save\n format.html { redirect_to calendars_url, notice: 'Calendar was successfully created.' }\n format.json { render json: @calendar, status: :created, location: @calendar }\n else\n format.html { render action: \"new\" }\n format.json { render json: @calendar.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @availability_calendar = AvailabilityCalendar.new(params[:availability_calendar])\n\n respond_to do |format|\n if @availability_calendar.save\n format.html { redirect_to(@availability_calendar, :notice => 'Availability calendar was successfully created.') }\n format.xml { render :xml => @availability_calendar, :status => :created, :location => @availability_calendar }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @availability_calendar.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @calendar = Calendar.new(calendar_params)\n dstart = Date.new(@calendar.year_c, 1, 1)\n dfinish = Date.new(@calendar.year_c + 1, 1, 1)\n while dstart < dfinish\n cld = Calendar.new\n cld.year_c = @calendar.year_c\n cld.date_c = dstart\n cld.is_output = (dstart.wday == 6 or dstart.wday == 0 ? true : false)\n cld.save\n dstart = dstart + 1.day\n end\n\n respond_to do |format|\n format.html { redirect_to calendars_path(year: @calendar.year_c), notice: 'Calendar was successfully created.' }\n end\n end", "def assign_calendar\n @event.calendar = Calendar.find(params[:calendars_event][:calendar_id])\n end", "def create\n @calendar_day = CalendarDay.new(calendar_day_params)\n\n respond_to do |format|\n if @calendar_day.save\n format.html { redirect_to @calendar_day, notice: 'Calendar day was successfully created.' }\n format.json { render :show, status: :created, location: @calendar_day }\n else\n format.html { render :new }\n format.json { render json: @calendar_day.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @calendario = Calendario.new(params[:calendario])\n\n respond_to do |format|\n if @calendario.save\n format.html { redirect_to @calendario, notice: 'Calendario was successfully created.' }\n format.json { render json: @calendario, status: :created, location: @calendario }\n else\n format.html { render action: \"new\" }\n format.json { render json: @calendario.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_calendar\n @calendar = Calendar.find(params[:id])\n end", "def create\n @google_calendar = GoogleCalendar.new(params[:google_calendar])\n\n respond_to do |format|\n if @google_calendar.save\n flash[:notice] = 'GoogleCalendar was successfully created.'\n format.html { redirect_to(@google_calendar) }\n format.xml { render :xml => @google_calendar, :status => :created, :location => @google_calendar }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @google_calendar.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @admin_calender = Admin::Calender.new(admin_calender_params)\n\n respond_to do |format|\n if @admin_calender.save\n format.html { redirect_to @admin_calender, notice: 'Calender was successfully created.' }\n format.json { render :show, status: :created, location: @admin_calender }\n else\n format.html { render :new }\n format.json { render json: @admin_calender.errors, status: :unprocessable_entity }\n end\n end\n end", "def to_hash\n hash = { 'calendar' => {} }\n hash['calendar'].store 'url', url unless url.nil?\n hash['calendar'].store 'name', name unless name.nil?\n hash['calendar'].store 'timeZone', name unless timezone.nil?\n hash\n end", "def create\n @track_calendar = TrackCalendar.new(params[:track_calendar])\n\n respond_to do |format|\n if @track_calendar.save\n flash[:notice] = 'TrackCalendar was successfully created.'\n format.html { redirect_to(track_calendars_url) }\n format.xml { render :xml => @track_calendar, :status => :created, :location => @track_calendar }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @track_calendar.errors, :status => :unprocessable_entity }\n end\n end\n end", "def init_calendar\n @cal = Icalendar::Calendar.new\n @cal.prodid = \"DoC Timetable\"\n set_calendar_name\n set_calendar_timezones\n end", "def create\n @calendar = Calendar.new(params[:calendar])\n @calendar.update_attribute :user_id, current_user.id\n\n params[:doors].each_value do |door|\n @calendar.doors.build(door)\n end\n\n respond_to do |format|\n if @calendar.save\n format.html { redirect_to @calendar, notice: 'Calendar was successfully created.' }\n format.json { render json: @calendar, status: :created, location: @calendar }\n else\n format.html { render action: \"new\" }\n format.json { render json: @calendar.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n @event.user_id = current_user.id\n\n respond_to do |format|\n if @event.save\n cal = Google::Calendar.new(:username => 'railscurso@gmail.com',\n :password => 'iloverails',\n :app_name => 'GDG-Aracaju')\n\n event = cal.create_event do |e|\n e.title = \"#{@event.description} criado por: #{@event.user.email}\"\n e.start_time = @event.dt_begin\n e.end_time = @event.dt_end\n end\n\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_org!(name:)\n org = ::Org.find_or_initialize_by(name: name)\n return org unless org.new_record?\n\n org.update(\n abbreviation: org.name_to_abbreviation,\n contact_email: ::Org.default_contact_email,\n contact_name: ::Org.default_contact_name,\n is_other: false,\n managed: false,\n organisation: true\n )\n org\n end", "def create\n @calendar_item = CalendarItem.new(params[:calendar_item])\n\n respond_to do |format|\n if @calendar_item.save\n format.html { redirect_to calendar_path, notice: 'Calendar item was successfully created.' }\n format.json { render json: @calendar_item, status: :created, location: @calendar_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @calendar_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_calendar\n @calendar = Calendar.find(params[:id])\n end", "def set_calendar\n @calendar = Calendar.find(params[:id])\n end", "def set_calendar\n @calendar = Calendar.find(params[:id])\n end", "def set_calendar\n @calendar = Calendar.find(params[:id])\n end", "def set_calendar\n @calendar = Calendar.find(params[:id])\n end", "def set_calendar\n @calendar = Calendar.find(params[:id])\n end", "def create\n @calendar_action = CalendarAction.new(calendar_action_params)\n respond_to do |format|\n if @calendar_action.save\n format.html { redirect_to @calendar_action, notice: t('calendar_action.create') }\n format.json { render :show, status: :created, location: @calendar_action }\n else\n format.html { render :new }\n format.json { render json: @calendar_action.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(name, attributes)\n\t\t\t\t@documents[name] = DesignDocument.new(@context, name, attributes)\n\t\t\tend", "def create_google_calendar_event(params)\n event = cal.create_event do |e|\n e.title = params[:title]\n e.start_time = params[:start_time]\n e.end_time = params[:end_time]\n end\n end", "def http_mk_calendar(request, _response)\n body = request.body_as_string\n path = request.path\n\n properties = {}\n\n unless body.blank?\n begin\n mkcalendar = @server.xml.expect(\n '{urn:ietf:params:xml:ns:caldav}mkcalendar',\n body\n )\n rescue Tilia::Xml::ParseException => e\n raise Dav::Exception::BadRequest, e.message\n end\n\n properties = mkcalendar.properties\n end\n\n # iCal abuses MKCALENDAR since iCal 10.9.2 to create server-stored\n # subscriptions. Before that it used MKCOL which was the correct way\n # to do this.\n #\n # If the body had a {DAV:}resourcetype, it means we stumbled upon this\n # request, and we simply use it instead of the pre-defined list.\n if properties.key?('{DAV:}resourcetype')\n resource_type = properties['{DAV:}resourcetype'].value\n else\n resource_type = ['{DAV:}collection', '{urn:ietf:params:xml:ns:caldav}calendar']\n end\n\n @server.create_collection(path, Dav::MkCol.new(resource_type, properties))\n\n @server.http_response.status = 201\n @server.http_response.update_header('Content-Length', 0)\n\n # This breaks the method chain.\n false\n end", "def create_event( event )\n body = {:summary => event.summary.force_encoding('UTF-8')}\n body.merge!(:description => event.description.force_encoding('UTF-8')) if event.description\n body.merge!(:location => event.location.force_encoding('UTF-8')) if event.location\n\n if all_day?(event)\n start_date = event.dtstart.to_s\n end_date = event.dtend.to_s\n\n body.merge!(\n :start => {:date => start_date},\n :end => {:date => end_date.size > 0 ? end_date : (Date.parse(start_date) + 1).to_s})\n else\n body.merge!(\n :start => {:dateTime => localtime(event.start_time)},\n :end => {:dateTime => localtime((event.respond_to? :end_time) ? event.end_time : event.start_time)})\n end\n\n client.execute(\n :api_method => calendar.events.insert,\n :parameters => {:calendarId => calendar_id},\n :headers => {'Content-Type' => 'application/json'},\n :body => JSON.dump(body)).response.body\n end", "def create\n @calendar = Calendar.find(params[:calendar_id])\n\t@event = @calendar.events.build(params[:event])\n\t@event.finished = 0;\n\t\n\n respond_to do |format|\n if @event.save\n flash[:notice] = 'Event was successfully created.'\n\t\t\t\tics_for_all #######\n\t\t\t\tformat.html { redirect_to(@calendar) }\n\t\t\t\tformat.xml { render :xml => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create (name, attrs = {})\n factory_by_name(name).create(attrs)\n end", "def create (name, attrs = {})\n factory_by_name(name).create(attrs)\n end", "def set_calendar\n @calendar = Calendar.find(params[:id])\n end", "def create\n @event = Event.new(event_params)\n respond_to do |format|\n if @event.save\n format.html { redirect_to :controller => 'calendar', :action => 'index' }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def init_and_auth_calendar(calendar_id, store)\n @client = ::Google::APIClient.new(\n :application_name => :ical2gcal,\n :application_version => Ical2gcal::VERSION,\n :user_agent => \"ical2gcal-#{Ical2gcal::VERSION} (#{RUBY_PLATFORM})\"\n )\n\n credential = ::Google::APIClient::FileStorage.new(store)\n secrets = ::Google::APIClient::ClientSecrets.load(File.dirname(store))\n\n if credential.authorization.nil?\n flow = ::Google::APIClient::InstalledAppFlow.new(\n :client_id => secrets.client_id,\n :client_secret => secrets.client_secret,\n :scope => 'https://www.googleapis.com/auth/calendar')\n client.authorization = flow.authorize\n credential.write_credentials(client.authorization)\n else\n client.authorization = credential.authorization\n end\n\n @calendar_id = calendar_id\n @calendar = client.discovered_api('calendar', 'v3')\n end", "def calendar_params\n params.require(:calendar).permit(:name, :UserId, :OtherId, :start_time, :end_time, :details, :conflict)\n end", "def calendar_params\n params.require(:calendar).permit(:name, :last_frost, :city, :state)\n end", "def g_cal\n @g_cal ||= Google::Calendar.new(\n :client_id => @client_id,\n :client_secret => @secret,\n :calendar => @calendar_id,\n :redirect_url => \"urn:ietf:wg:oauth:2.0:oob\" # this is what Google uses for 'applications'\n )\n end", "def create\n @calender_event = CalenderEvent.new(calender_event_params)\n respond_to do |format|\n if @calender_event.save\n format.html { redirect_to @calender_event, notice: '予定を追加しました。' }\n format.json { render :show, status: :created, location: @calender_event }\n else\n format.html { render :new }\n format.json { render json: @calender_event.errors, status: :unprocessable_entity }\n end\n end\n end", "def save\n if @id.nil?\n data = decode_response connection.post(\"/calendar/feeds/default/owncalendars/full\", {:data => self.to_hash})\n self.id = data[\"data\"][\"id\"].split(\"full/\").last\n else\n data = decode_response connection.put(\"/calendar/feeds/default/owncalendars/full/#{@id}\", {:apiVersion => \"2.3\", :data => self.to_hash})\n end\n self\n end", "def create\n @calendar = DefaultCalendar.find(params[:default_line_calendar][:calendar_id])\n @line_calendar = @calendar.default_line_calendars.build(default_line_calendar_params)\n\n if @line_calendar.save\n flash[:success]= 'Dia no laborable agregado correctamente al calendario'\n redirect_to default_calendar_path(@calendar)\n else\n render \"new\" \n end\n end", "def initialize(agenda_name)\n\t\t@agenda_name = agenda_name\n\t\t@contact_list = [] # no llamarlo \"agenda\", para evitar redundancias - claridad !\n\t\t@par = []\n\t\t\n\tend", "def insert\n params = { calendarId: Calendar.id }\n body = self.to_json\n request(Calendar.api.events.insert, params, body)\n end", "def calendar_params\n params.require(:calendar).permit(:title, :start, :end, :url, :user_id, :all_day)\n end", "def create(organization_name)\n organization = client.organization\n organization.name = organization_name\n organization.create!\n\n organization\n end", "def create(name)\n self.new(name)\n end", "def initialize(calendar_id, store = nil)\n raise CalendarIdNotDefined.new unless calendar_id\n\n @calendar_id = nil\n @calendar = nil # Calendar API\n @client = nil # Google API Client\n @events = nil\n\n init_and_auth_calendar(calendar_id, store)\n end", "def calendar_params\n params.fetch(:calendar, {})\n end", "def calendar_params\n params.fetch(:calendar, {})\n end", "def create!(attributes)\n obj = @base.new\n obj.id = @events.count\n attributes.each do |key, value|\n obj.send(key+'=', value)\n end\n\n @events << obj\n end", "def create\n @calificacione = Calificacione.new(params[:calificacione])\n\n respond_to do |format|\n if @calificacione.save\n format.html { redirect_to @calificacione, notice: 'Calificacione was successfully created.' }\n format.json { render json: @calificacione, status: :created, location: @calificacione }\n else\n format.html { render action: \"new\" }\n format.json { render json: @calificacione.errors, status: :unprocessable_entity }\n end\n end\n end", "def calendars\n records 'calendar', '/calendars.xml', :method => :get\n end", "def create\n @calificacion = Calificacion.new(params[:calificacion])\n\n respond_to do |format|\n if @calificacion.save\n format.html { redirect_to @calificacion, notice: 'Calificacion was successfully created.' }\n format.json { render json: @calificacion, status: :created, location: @calificacion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @calificacion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @calificacion = Calificacion.new(params[:calificacion])\n\n respond_to do |format|\n if @calificacion.save\n format.html { redirect_to @calificacion, notice: 'Calificacion was successfully created.' }\n format.json { render json: @calificacion, status: :created, location: @calificacion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @calificacion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_event(token, payload, folder_id = nil, user = nil)\n request_url = user_context(user)\n\n unless folder_id.nil?\n request_url << \"/Calendars/\" << folder_id\n end\n\n request_url << \"/Events\"\n\n create_event_response = make_api_call \"POST\", request_url, token, nil, payload\n\n parse_response(create_event_response)\n end", "def initialize(name, calories, flavor)\n\t\t@name = name\n\t\t@calories = calories\n\t\t@flavor = flavor\n\tend", "def build (name, attrs = {})\n factory_by_name(name).build(attrs)\n end", "def build (name, attrs = {})\n factory_by_name(name).build(attrs)\n end", "def initialize(days, events)\n super days\n add_associated_events_to_days(events)\n end", "def create\n @calificaciones = Calificaciones.new(calificaciones_params)\n\n respond_to do |format|\n if @calificaciones.save\n format.html { redirect_to @calificaciones, notice: 'Calificaciones was successfully created.' }\n format.json { render :show, status: :created, location: @calificaciones }\n else\n format.html { render :new }\n format.json { render json: @calificaciones.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @training_calendar = TrainingCalendar.new(params[:training_calendar])\n @training_calendar.status = TrainingCalendar::NOT_STARTED\n respond_to do |format|\n if @training_calendar.save\n format.html { redirect_to @training_calendar, :notice => 'Training calendar was successfully created.' }\n format.json { render :json => @training_calendar, :status => :created, :location => @training_calendar }\n else\n load_dependents\n format.html { render :action => \"new\" }\n format.json { render :json => @training_calendar.errors, :status => :unprocessable_entity }\n end\n end\n end", "def insert_calendar_list(opts = {})\n end", "def create\n @calf = Calf.new(calf_params)\n\n respond_to do |format|\n if @calf.save\n format.html { redirect_to @calf, notice: 'Calf was successfully created.' }\n format.json { render :show, status: :created, location: @calf }\n else\n format.html { render :new }\n format.json { render json: @calf.errors, status: :unprocessable_entity }\n end\n end\n end", "def retrieve_calendar\n response = send_calendar_request(\"/#{@id}\", :get)\n @raw = JSON.parse(response.body)\n instance_variable_set(:@summary, @raw['summary'])\n instance_variable_set(:@location, @raw['location'])\n instance_variable_set(:@description, @raw['description'])\n instance_variable_set(:@time_zone, @raw['timeZone'])\n @html_link = @raw['htmlLink']\n\n self\n end", "def create_event(title, start, duration = nil, description = \"\", particular = false)\n finish = set_finish_date(start, duration)\n return if finish.nil? or not events_in_period(start, finish).empty?\n\n event_class = ModelFabric.get_class(SocialFramework.event_class)\n event = event_class.create(title: title, start: start, finish: finish,\n description: description, particular: particular)\n\n unless event.nil?\n participant_event_class.create(event: event, schedule: self, confirmed: true, role: \"creator\")\n end\n\n return event\n end", "def calendar(options)\r\n t = options[:time]\r\n name = options[:name]\r\n js_function = \"change\" + name.gsub(/:/, '_').gsub(/@/, '_').gsub(/\\[/, '_').gsub(/\\]/, '_')\r\n js_format = \"format('%yyyy%%mm%%dd%%hh%%nn%%ss%')\"\r\n js_date = \"new Date(#{t.year}, #{t.month - 1}, #{t.day}, #{t.hour}, #{t.min}, #{t.sec})\"\r\n <<EOF\r\n<input type=\"hidden\" id=\"#{options[:name]}\" name=\"#{options[:name]}\" value=\"\" />\r\n<div id=\"#{options[:name]}_calendar\"></div>\r\n<script type=\"text/javascript\">\r\n<!--\r\n document.getElementById('#{options[:name]}').value = #{js_date}.#{js_format}\r\n function #{js_function}(calendar) { \r\n if (calendar.dateClicked) { \r\n document.getElementById('#{options[:name]}').value = calendar.date.#{js_format};\r\n } \r\n }; \r\n \r\n Calendar.setup( {\r\n flat : \"#{options[:name]}_calendar\", // ID of the parent element \r\n flatCallback : #{js_function}, // our callback function\r\n showsTime : true,\r\n date : #{js_date} \r\n });\r\n-->\r\n</script>\r\nEOF\r\n end", "def create_database\n DATA[:accounts].each do |account|\n CalendarCoordinator::AccountService.create(data: account).save\n end\n\n account = CalendarCoordinator::Account.first\n DATA[:calendars].each do |calendar|\n account.add_owned_calendar(calendar)\n end\n end", "def initialize(name, calories, flavor)\n\n \t@name = name\n \t@calories = calories\n \t@flavor = flavor\n \n end", "def create\n\t\t@event = current_user.events.create(params[:event])\n\t\tcurrent_user.add_role :author, @event\n\t\t#@event = Beautorial.new(params[:event])\n\n\t\trespond_to do |format|\n\t\t\tif @event.save\n\t\t\t\tformat.html { redirect_to @event, notice: 'Event was successfully created.' }\n\t\t\t\tformat.json { render json: @event, status: :created, location: @event }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @event.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def set_calendar\n @calendar = Calendar.find(params[:id])\n @site = @calendar.site\n end", "def create\n @event_params = event_params\n @start_date = @event_params.select {|k, _| k.include? \"event_start_date\"}.values.join('-').to_date\n\t\t@event = current_user.events.create(\n name: @event_params[:name],\n event_detail: @event_params[:event_detail],\n event_start_date: @start_date,\n )\n\t\tif @event.save\n redirect_to event_path(@event.id), :flash => { :success => \"Your event has been succesfully created\" }\n\t\telse\n\t\t\trender 'new'\n\t\tend\n end", "def create(attrs)\n if attrs.has_key? :description\n warn \"Fogbugz Case does not handle description\"\n end\n\n options = translate attrs,\n :title => :sTitle,\n :priority => :ixPriority,\n :assignee => :ixPersonAssignedTo,\n :project_id => :ixProject\n\n new_case = api.command(:new, options)\n\n options.merge!(:ixBug => new_case[\"case\"][\"ixBug\"])\n\n self.new options\n end", "def new_from_name(name, attributes={})\n event_class = find_by_name(name)\n raise ArgumentError, \"Unknown event name '#{name}'\" if event_class.nil?\n \n event_class.new(attributes)\n end", "def new\n @calendar = Calendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @calendar }\n end\n end" ]
[ "0.6745043", "0.64037484", "0.6184438", "0.61106306", "0.60955787", "0.604115", "0.60359687", "0.60336", "0.60326886", "0.5978073", "0.59324664", "0.5932209", "0.59209985", "0.5810863", "0.57801867", "0.570104", "0.559059", "0.5587822", "0.5585916", "0.55622834", "0.55153537", "0.551132", "0.5509311", "0.5507838", "0.5489309", "0.54749024", "0.54622847", "0.5450748", "0.54178125", "0.53948003", "0.5382135", "0.5366428", "0.53656965", "0.532167", "0.5320118", "0.5310542", "0.5272916", "0.52639127", "0.5241327", "0.5229212", "0.52239513", "0.52230096", "0.5212877", "0.5211895", "0.5211445", "0.5211445", "0.5211445", "0.5211445", "0.5211445", "0.5211445", "0.5202963", "0.51912254", "0.5174318", "0.5172024", "0.51677537", "0.51200366", "0.51195216", "0.51195216", "0.5087039", "0.5063584", "0.5058652", "0.50193363", "0.50186336", "0.5014761", "0.5002692", "0.5002491", "0.50012267", "0.49794608", "0.4978424", "0.4971059", "0.4960593", "0.49543512", "0.49542716", "0.49519202", "0.49519202", "0.49514177", "0.49486017", "0.49428517", "0.49364996", "0.49350432", "0.4888632", "0.4887822", "0.48868355", "0.48868355", "0.48845258", "0.48688504", "0.48583394", "0.48544693", "0.48334083", "0.4827313", "0.4820363", "0.48199642", "0.481031", "0.47935894", "0.4787626", "0.47855428", "0.4783087", "0.47811818", "0.47787222", "0.4777681" ]
0.82752556
0
Creates a login session for this feed. You shouldn't ordinarily need to use this function.
def login self.session = GData::Client::Calendar.new if session.nil? @token = session.clientlogin(username,password) true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_session\n login, password = get_login_and_password\n create_session_with authenticate_user(login, password, :trace => true)\n end", "def create\n action = LogUserIn.new :web\n @session = Session.new params[:session]\n\n if user = action.run(@session.login, @session.password)\n previous_path = session[:login_redirect_to]\n set_new_user_session user, @session.remember_me\n\n redirect_to previous_path || root_path\n else\n flash.now[:login_error] = true\n render action: \"new\"\n end\n end", "def login_user\n\t @user_session = UserSession.new\t \n\tend", "def open_session_with_login\n $system_config ||= load_config(@@SERVER_CONFIG_PATH)\n url = \"#{$system_config.protocol}://#{$system_config.host}:#{$system_config.port}\"\n Util.open_session(url)\n Util.login($system_config.user, $system_config.password)\n end", "def login\n response = @session.create\n @auth_token = response[\"token\"]\n @rest.default_headers = { 'Content-Type' => 'application/json', 'Auth-Token' => @auth_token }\n response\n end", "def create\n action = LogUserIn.new :web\n\n if user = action.run(params[:login], params[:password])\n previous_path = session[:login_redirect_to]\n\n reset_session\n cookies[:web_session_token] = {\n value: user.login_token(:web),\n httponly: true\n }\n\n redirect_to previous_path || root_path\n else\n flash.now[:login_error] = true\n render action: \"new\"\n end\n end", "def create_session\n @connection.create_session(@config || {})\n end", "def new_user_session(user)\n session = new_session\n session.login!(user)\n return session\n end", "def create_session(config)\n options = (config[:options] || {}).dup\n session = Moped::Session.new(config[:hosts], options)\n session.use(config[:database])\n if authenticated?(config)\n session.login(config[:username], config[:password])\n end\n session\n end", "def login\n # delete the session from their last login attempt if still there\n session.delete(:auth) unless session[:auth].nil?\n @login_form = LoginForm.new\n end", "def login(params = {})\n begin\n params.merge!(common_params)\n document = MagentoApiWrapper::Requests::Login.new(params)\n request = MagentoApiWrapper::Request.new(magento_url: params[:magento_url], call_name: :login)\n request.body = document.body\n login = MagentoApiWrapper::Login.new(request.connect!)\n @session_id = login.key\n login.key\n rescue MagentoApiWrapper::AuthenticationError => e\n raise e\n end\n end", "def autologin_the_user\n #unless logged_in?\n # FrontendUserSession.create(params[:frontend_user_session])\n #end\n end", "def auth_login\n\t\tauth_hash = request.env['omniauth.auth']\n\t\tauth_response = Authorization.find_or_create(auth_hash)\n\t\t# Create a session\n\t\tuser = auth_response.user\n\t\tsession[:user_id] = user.id\n\t\tsession[:token] = auth_response.token\n\t\tsession[:secret] = auth_response.secret\n\t\tsession[:user_role] = USER\n\t\tuser_session = UserSession.create(user)\n\t\tuser_session.save\n\t\tflash.keep[:notice] = t(\"general.login_successful\")\n\t\tredirect_to root_url\n end", "def login_nadrowski\n nadrowski = User.find_by_login 'nadrowski'\n UserSession.create(nadrowski)\n end", "def new_session\n open_session do |sess|\n sess.extend(SessionMethods)\n yield sess if block_given?\n end\n end", "def get_new_session\n client = prepare_request(auth_url)\n\n login_response = do_request_and_handle_errors do\n client.request :login do |soap|\n soap.body = {:id => @user, :pw => @pass}\n end\n end\n\n @session = login_response.to_hash[:login_response][:login_return]\n @cookie = login_response.http.headers[\"Set-Cookie\"]\n\n false unless @session.instance_of? Nori::StringWithAttributes\n end", "def login(username, password)\n open_session do |sess|\n# If we want to emulate https\n# sess.https!\n sess.post_via_redirect \"/sessions\", \"session[login_name]\" => username, \"session[password]\" => password\n assert_equal '/', sess.path\n assert_equal Constants::LOGGED_IN_NOTICE, sess.flash[:notice]\n# Unemulate https\n# sess.https!(false)\n end\n end", "def login\n make_login_call\n end", "def login\n @user = User.find_by_email(params[:email])\n if @user.password == params[:password]\n session[:id] = @user.id\n session[:visit] = 0\n redirect \"users/#{@user.id}/feed\"\n else\n redirect '/'\n end\nend", "def login\n\t\tbegin\n\t\t\tr = execute(make_xml('LoginRequest', { 'sync-id' => 0, 'password' => @password, 'user-id' => @username }))\n\t\trescue APIError\n\t\t\traise AuthenticationFailed.new(r)\n\t\tend\n\t\tif(r.success)\n\t\t\t@session_id = r.sid\n\t\t\treturn true\n\t\tend\n\tend", "def login_from_session\n self.current_user = User.find_by_id( session[ :user_id ] ) if session[ :user_id ]\n end", "def create\n if user = User.find_by_login(params[:login])\n # Save the user ID in the session so it can be used in subsequent requests\n session[:current_user_id] = user.id\n redirect_to root_url\n end\n end", "def new\n @session = Session.new('')\n end", "def start_session\n generate_token(:token)\n setup_session\n update_last_session\n end", "def login(login, pass)\n @logged_in_user = Fotolia::User.new(self, login, pass)\n res = self.remote_call('loginUser', login, pass)\n raise UserLoginError unless(res['session_id'])\n @session_id = res['session_id']\n end", "def login!(passwd = nil)\n self.password = passwd || self.password\n response = client.login(username.to_s, password.to_s)\n apply_attributes! response.result\n self.session_token.present?\n end", "def login\n create(:user).tap{ |user| login_as(user) }\n end", "def new\n @session = User::Session.new\n end", "def login(params={})\n params = {:session => {}}\n \n # if both username and password given as parameters or instance variables\n if ((@username && @password) || (params[:username] && params[:password]))\n params[:session][:username] = params[:username] || @username\n params[:session][:password] = params[:password] || @password\n end\n params[:session][:app_name] = @app_name || APP_CONFIG.asi_app_name\n params[:session][:app_password] = @app_password || APP_CONFIG.asi_app_password\n\n resp = RestHelper.make_request(:post, @@session_uri, params , nil, true)\n\n #@headers[\"Cookie\"] = resp[1].headers[:set_cookie].to_s\n @cookie = resp[1].cookies\n @person_id = resp[0][\"entry\"][\"user_id\"]\n end", "def new\n @session = Session.new\n end", "def login_from_session\n self.current_user = User.find_by_id(session[:user_id]) if session[:user_id]\n end", "def new\n @session = Session.new\n end", "def login\n \t\t response = @client.request :login do\n soap.body = { username: self.zconfig.user_name, password: self.zconfig.password}\n \t\t end\n \t\t response.to_hash\n \t \t self.session = response.to_hash[:login_response][:result][:session]\n end", "def login\n capture_session(self.class.post( \"/api/login\", {:body => {:user => @user, :passwd => @password, :api_type => 'json'}, :debug_output => @debug} ) )\n logged_in?\n end", "def login_from_session\n self.current_user = User.find(session[:user_id]) if session[:user_id]\n end", "def login_from_session\n self.current_user = User.find(session[:user_id]) if session[:user_id]\n end", "def login_as(user)\n Session.create(users(user))\n end", "def setup_session\n @session_id ||= if @smug_user.email\n setup_session_with_username\n else \n setup_session_anonymously\n end\n end", "def create\n if SessionService.authenticate(@user, params[:password])\n # TODO Add successful log in message\n logger.debug \"#{@user.email} is trying to create a API session\"\n root_path\n else\n logger.error \"** Failure** Attempt to login as #{params[:user_name]} - rejected\"\n render text: 'Login failed', status: :unauthorized\n end\n end", "def login\n return @token if @token or @auth_method == :api_key\n request = Request.new(\"Post\", \"#{@config[:base_url]}/user/login\")\n\n request.add_multipart_body ({\n name: @config[:username],\n pass: @config[:password],\n form_id: \"user_login\",\n op: \"Log in\",\n })\n\n response = request.perform\n @token = response['Set-Cookie'].split(\";\")[0] if response and response['Set-Cookie']\n @token\n end", "def create\n if request.get? && params[:action] == 'new' && @open_auth\n @open_auth.open_authentication.connection_established\n log_in @open_auth.open_authentication.user\n redirect_back_or_default user_newsfeed_url(@open_auth.open_authentication.user)\n end\n end", "def create\n\t\tuser = User.from_sso(cookies[:UTEP_SE], cookies[:UTEP_SA])\n\t\tlog_in(user) if user\n\t\tredirect_to root_url\n\tend", "def create_session\n @user = User.new(nickname: User.temp_user_name)\n @user.save\n session[:user_id] = @user.id\n @user\n end", "def login\n @login ||= begin\n client.user.login\n rescue Octokit::Unauthorized, Faraday::ConnectionFailed\n nil\n end\n end", "def login!\n session[:user_id] = @user.id\n end", "def create_session\n req_params = params[:user]\n unless req_params\n @msg = \"Login details not found\"\n render \"objects/msg.json\", status: :unauthorized and return\n end\n @user = User.find_by_email(req_params[:email])\n if @user && @user.authenticate(req_params[:password])\n session[:user_id] = @user.id\n render 'objects/user.json'\n else\n @msg = \"Email or password is invalid\"\n render \"objects/msg.json\", status: :unauthorized\n end\n end", "def create\n reset_session\n u = User.authenticate(params[:session][:login], params[:session][:password])\n \n if u\n reset_session\n session[:user_id] = u.id\n session[:user_login] = u.login\n @current_user = User.find(session[:user_id])\n flash[:notice] = 'hi, again!'\n redirect_to dashboard_url\n else\n flash[:error] = 'Invalid login or password.'\n redirect_to root_url\n end\n end", "def login\n @user = User.find_or_create_from_auth_hash(auth_hash)\n @user_name = @user.display_name\n\n session[:current_user_id] = @user.id\n\n render :login, :layout => false\n end", "def login(username, password)\n session.context.login(name, username, password)\n end", "def new\n # If someone is already logged in, skip this step\n login(current_user) and return if logged_in?\n end", "def create_session_without_render(login_content=nil, password_content=nil, encrypted_password_content=nil)\n login, password = get_login_and_password(login_content, password_content, encrypted_password_content)\n create_session_without_render_with authenticate_user(login, password, :trace => true) # if !login.blank? && !password.blank?\n end", "def login\n user = User.last\n login!(user)\n ses = session[:session_token]\n render json: {\"ses\": ses}\n end", "def login_as(user)\n UserSession.create(users(user))\n end", "def create\n @session = ::Session.authenticate(session_params)\n\n if @session.save\n render :show, status: :created, location: @session\n else\n render json: @session.errors, status: :unprocessable_entity\n end\n end", "def login(username = users(:common).username, pass = \"testpassword\")\n post login_url, params: {session: {username: username, password: pass}}\n end", "def login_from_session\n self.current_user = User.find_by_id(session[:user_id]) if session[:user_id]\n end", "def login_from_session\n self.current_user = User.find(session[:user_id]) if session[:user_id]\n end", "def login(login,pass,hash = nil)\n\n #login_from_session_ok = false\n #if (!hash.nil? && hash.length>0)\n #\t@connect = Connect.new\n #\t@id = @connect.login_from_cookie(hash)\n #\tif(!@id)\n #\t\t@connect = nil\n #\telse\n #\t\tlogin_from_session_ok = true\n #\t\t@me = true\n #\tend\n #end\n #unless(login_from_session_ok)\n @connect = Connect.new(login,pass)\n @id = @connect.login\n return @id unless @id\n @me = true\n #end\n\n self\n end", "def setup_session_with_username\n method = 'smugmug.login.withPassword'\n setup_session_with [\"method=#{method}\",\"EmailAddress=#{@smug_user.email}\",\"Password=#{@smug_user.password}\"]\n end", "def create_user_and_login \n\t\tinsert_into :users, {\n\t\t\tid: 1 ,\n\t\t\tfirst_name: 'First',\n\t\t\tlast_name: 'Last',\n\t\t\tlogin: 'login',\n\t\t\tpassword: 'password',\n\t\t\trole_id: 1,\n\t\t\tuid: \"a\"\n\t\t}\n\n\t\tproxy.post( 'http://my.ownet/api/session',{\n\t\t\tlogin: 'login',\n\t\t\tpassword: 'password'\n\t\t}.to_json)\n\tend", "def create\n reset_session\n params[:user] ||= {}\n username = params[:user][:username].to_s\n password = params[:user][:password].to_s\n user = User.where('username = ? and crypted_password = ?', username, User.encrypt(password)).first\n\n params[:client_uid] = 'Web Platform' if request.format.html?\n \n if user && params[:client_uid]\n session_obj = Session.create(user_id:user.id, client_uid:params[:client_uid])\n session[:app_session_id] = session_obj.id\n session[:user_id] = user.id\n\n if request.format.html?\n redirect_to controller: 'main'\n elsif request.format.json?\n render json: {success: true, session: session_obj.to_json}\n end\n else\n if request.format.html?\n flash[:alert] = \"Cannot login, please try again\"\n render action: 'new'\n elsif request.format.json?\n render json: {success: false, message: 'Cannot login, please try again'}\n end\n end\n end", "def new\n @user_session = UserSession.new(:email => session[:user_real_account_email])\n end", "def start_session\n session_tracker.start_session\n end", "def begin_session\n begin\n true if login\n rescue\n false\n end\n end", "def create_session\n session[:who_is_this] = \"admin\"\n end", "def create\n\t user = AdminUser.authenticate(params[:email], params[:password])\n\t logger.info 'session#create creating session'\n\t if user\n\t \tlogger.info 'session#create user authenticated'\n\t session[:user_id] = user.id\n\t redirect_to admin_category_index_path\n\t else\n\t flash.now.alert = \"Invalid email or password\"\n\t render \"new\", layout: \"login_layout\"\n\t end\n\tend", "def create\n\t# user = User.find_by_email(params[:session][:email])\n\t# if user.authenticate(params[:session][:password])\n\t# \tsign_in user\n\t# \tflash[:message] = \"Successfully logged in!\"\n\t# \tredirect_to feed_path(user.id)\n\t# else\n\t# \tflash[:error] = \"Your email or password is invalid\"\n\t# \tredirect_to signin_path\n\t# end\n\tUser.find(auth).nil? ? @user = User.find(auth) : @user = User.create(auth) \n\tsign_in @user\n\tredirect_to \"/\"\n\n end", "def create\n\t\tuser = User.find_by(email: params[:login][:email])\n\n\t\tif user && user.authenticate(params[:login][:password])\n\t\t\tsession[:user_id] = user.id.to_s\n\t\t\tredirect_to root_path\n\t\telse\n\t\t\trender :new\n\t\tend\n\n\tend", "def create\n @session = Session.new(session_params)\n\n respond_to do |format|\n if @session.save\n reset_session\n session[:user_id] = @session.user.id\n format.html { redirect_to root_path, notice: 'Login success!' }\n format.json { render :show, status: :created, location: @session }\n else\n format.html { render :new }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def run()\n login()\n end", "def login\n @client = Octokit::Client.new(login: username, oauth_token: token)\n end", "def login\n session[:user_id] = nil\n end", "def create\n @login = Login.new(params)\n @session = @login.authenticate_user\n\n if not @session\n respond_to do |format|\n handle_create_error(\"Invalid credentials. Please try again!\", format)\n end\n\n return\n end\n\n respond_to do |format|\n if @session.save\n @session.put_in_cookie(cookies)\n flash[:notice] = 'Hello ' + @session.user_name\n format.html { redirect_to(@session) }\n format.xml { render :action => \"show\", :status => :created, :location => @session }\n else\n handle_create_error(\"There was a problem logging in. Please try again.\", format)\n end\n end\n end", "def mints_user_login(email, password)\r\n # Login in mints\r\n response = @mints_user.login(email, password)\r\n # Get session token from response\r\n session_token = response['api_token']\r\n # Set a permanent cookie with the session token\r\n cookies[:mints_user_session_token] = { value: session_token, secure: true, httponly: true, expires: 1.day }\r\n end", "def create_user_session\n password = '12345678'\n user = User.make!(\n password: password,\n password_confirmation: password\n )\n UserSession.create!(\n email: user.email,\n password: password\n )\n end", "def new\n if current_user\n redirect_to root_url\n end\n @user_session = UserSession.new\n end", "def login_vet\n @vet = FactoryBot.create(:user, first_name: \"Ted\", username: \"ted\", role: \"vet\")\n get login_path\n post sessions_path, params: { username: \"ted\", password: \"secret\" }\n end", "def login(login = users(:zero_user).login, password = \"testpassword\",\n remember_me = true, session: self)\n login = login.login if login.is_a?(User) # get the right user field\n session.visit(\"/account/login/new\")\n\n session.within(\"#account_login_form\") do\n session.fill_in(\"user_login\", with: login)\n session.fill_in(\"user_password\", with: password)\n session.check(\"user_remember_me\") if remember_me == true\n\n session.first(:button, type: \"submit\").click\n end\n end", "def create\n return if Settings.readonly \n\n @session = Session.new(session_params)\n\n respond_to do |format|\n if @session.save\n format.html { redirect_to sessions_url, notice: 'Session was successfully created.' }\n format.json { render :show, status: :created, location: @session }\n else\n format.html { render :new }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def start_session(website_id, login, password, cookie_expiry = 365.days.from_now)\n if (not login.blank?) && (not password.blank?)\n case request.method\n when :post\n ss_login = login.downcase\n qs = \"website_id = ? AND (login = ? OR email = ?)\"\n if User.exists?([qs, website_id, ss_login, ss_login])\n @user = User.first(:conditions => [qs, website_id, ss_login, ss_login])\n if @user.valid_password?(password)\n session[:user_id] = @user.id\n cookies[:USERLOGIN] = { :value => ss_login, :expires => cookie_expiry }\n set_user_login_record\n return true\n else\n @user = nil end\n end\n else\n set_user_login end\n end\n return false\n end", "def create_session(parms)\n @session = Session.new(parms)\n pp @session\n returnValue = false\n if people = People.auth(@session)\n session[:people] = people.id\n cookies[:people] = people.id\n unless people.id.nil?\n returnValue = true\n end\n end\n returnValue\n end", "def create\n if user = User.authenticate_with_credentials(params_for_login)\n # a session cookie is assigned to logged users\n session[:user_id] = user.id\n redirect_to session[:return_to]\n else\n redirect_to session[:return_to], flash: { error: \"Invalid email address\" }\n end\n end", "def create_session(session_id, data)\n session_id = escape(session_id)\n new_session = new(session_id, data)\n new_session\n end", "def login (login = nil, password = nil, account_id=nil, external_auth=nil, domain=nil)\n\n if (login != nil && password == nil)\n # user given --> use generic user password\n # TODO: generate password (see https://forge.switch.ch/redmine/issues/2355)\n password = @pointconfig[\"generic_user_password\"]\n elsif (login == nil) && (password == nil)\n login = @pointconfig[\"username\"]\n password = @pointconfig[\"password\"]\n end\n\n res = query(\"login\",\n \"login\" => login,\n \"password\" => password,\n \"account-id\" => account_id,\n \"external-auth\" => external_auth,\n \"domain\" => domain)\n\n cookies = res.response[\"set-cookie\"]\n puts cookies.inspect\n cookies.split(\";\").each{|s|\n array = s.split(\"=\")\n if array[0] == \"BREEZESESSION\"\n @sessionid = array[1]\n end\n }\n puts \"ACS: Logged in\"\n return res.body\n end", "def create_session\n self.current_user = authenticate_user(params[:user][:login], params[:user][:password], :trace => true)\n \n # store remember me in token\n if logged_in?\n if params[:user][:remember_me] == \"1\"\n current_user.remember_me unless current_user.remember_token?\n cookies[cookie_auth_token] = {\n :value => self.current_user.remember_token, :expires => self.current_user.remember_token_expires_at\n }\n end\n \n # callback :after_authentication_success\n self.send(:after_authentication_success, self.current_user) if self.respond_to?(:after_authentication_success)\n \n if !performed? && request.xhr?\n render :update do |page|\n # JS code to close modal\n # update page header to show user information\n end\n elsif !performed?\n flash[:notice] = MESSAGE_LOGIN_SUCCESS\n redirect_back_or_default(authentication_success_url || '/')\n end\n else\n # callback :after_authentication_error\n self.send(:after_authentication_error, self.current_user) if self.respond_to?(:after_authentication_error)\n if !performed? && request.xhr?\n render :update do |page|\n # JS code to re-display login dialog\n end\n elsif !performed?\n flash[:error] = user_class.is_suspended?(params[:user][:login], params[:user][:password]) ? \n \"Login nicht möglich, da Benutzer gesperrt wurde.\" : \n MESSAGE_LOGIN_ERROR\n render :action => 'new'\n end\n end\n end", "def create_dev_session\n\t\t# redirect to root if not in dev environment\n\t\tredirect_to root_path unless Rails.env == 'development'\n\n\t\t# Get user name from .env file\n\t\tusername = ENV['DEV_USER']\n\n\t\t# if user with username doesn't exist, create one\n\t\tuser = User.find_by(name: username)\n\t\tunless user.present?\n\t\t\tuser = User.new(name: username)\n\t\t\tuser.save!\n\t\tend\n\n\t\t# sign in user and redirect to notes\n\t\tsession[:user_id] = user.id\n\t\tredirect_to user_notes_path(current_user)\n\tend", "def create_session\n raw_token, enc_token = account.create_session(ip, meta_info)\n set_account_cache(account, raw_token)\n set_auth_token_cache(enc_token, raw_token)\n return raw_token\n end", "def login(username=nil,password=nil)\n cookie = get_cookie\n if username&&password\n input=\"csrfmiddlewaretoken=#{cookie[:csrf]}&username=#{username}&password=#{password}&next=%2Ffakebook%2F\"\n else\n #input=\"csrfmiddlewaretoken=#{cookie[:csrf]}&username=001104765&password=50UK7HD7&next=%2Ffakebook%2F\"\n input=\"csrfmiddlewaretoken=#{cookie[:csrf]}&username=001941553&password=SZ6192HB&next=%2Ffakebook%2F\"\n end\n post_query = get_post_query(input.length,cookie[:csrf],cookie[:session_id])\n login_query = post_query+input\n response = get(login_query)\n @login_session = response.scan(/sessionid=\\w+/).first.split(\"=\")[1] \n end", "def open_session; end", "def create\n @user_session = UserSession.new(params[:user_session])\n if @user_session.save\n record_action!(:login, current_user)\n flash[:notice] = \"Login successful!\"\n redirect_back_or_default after_login_url\n else\n @failed = true\n render :action => :new\n end\n end", "def setup_default_session(cfg)\n setup_config_defaults!(cfg)\n\n return if !cfg.sessions.empty?\n\n cfg.sessions << {type: cfg.session_type, path: cfg.session_path, options: cfg.session_options.merge(default: true)}\n end", "def mints_user_login(email, password)\r\n # Login in mints\r\n response = @mints_user.login(email, password)\r\n # Get session token from response\r\n session_token = response['api_token']\r\n # Set a permanent cookie with the session token\r\n cookies[:mints_user_session_token] = { value: session_token, secure: true, httponly: true, expires: 1.day }\r\n end", "def login\n receive_until_token(@login_token)\n enter_login unless @logged_in\n if @password # if password was passed, else try without password\n receive_until_token(@password_token)\n enter_password unless @logged_in\n end\n receive_until_token(@prompt)\n @logger.info(\"logged in\") if @logger\n end", "def login(username = 'josh.starcher@example.com')\n @request.session[:user] = User.find(:first, :conditions => {:username => username}).id\n @request.session[:ministry_id] = 1\n end", "def create_session\n Puppet::HTTP::Session.new(self, build_resolvers)\n end", "def create_write_and_return_new_session!\n require 'timeout'\n\n session = DropboxSession.new(api_key, api_secret)\n\n # grab the request token for session\n session.get_request_token\n\n template = Backup::Template.new(\n {:session => session, :cached_file => cached_file}\n )\n template.render(\"storage/dropbox/authorization_url.erb\")\n\n # wait for user to hit 'return' to continue\n Timeout::timeout(180) { STDIN.gets }\n\n # this will raise an error if the user did not\n # visit the authorization_url and grant access\n #\n # get the access token from the server\n # this will be stored with the session in the cache file\n session.get_access_token\n\n template.render(\"storage/dropbox/authorized.erb\")\n write_cache!(session)\n template.render(\"storage/dropbox/cache_file_written.erb\")\n\n session\n\n rescue => err\n raise Errors::Storage::Dropbox::AuthenticationError.wrap(\n err, 'Could not create or authenticate a new session'\n )\n end", "def new_session(options={})\n if supports_sessions?\n api.rest_method('ADD_AUTHORIZATION', {\n :scope => 'session',\n :note => \"RHC/#{RHC::VERSION::STRING} (from #{Socket.gethostname rescue 'unknown'} on #{RUBY_PLATFORM})\",\n :reuse => true\n }, options)\n end\n end", "def login\n username.set 'tomsmith'\n password.set 'SuperSecretPassword!'\n end", "def login\n client.login(\n params[:user],\n params[:password],\n authParams: {\n scope: 'openid name email'\n },\n connection: 'Username-Password-Authentication'\n )\n end", "def new\n @user_session = UserSession.new\n end" ]
[ "0.7176973", "0.6638318", "0.65476924", "0.65343523", "0.6487713", "0.64872646", "0.6450655", "0.64279324", "0.6418893", "0.6397594", "0.63657343", "0.63279396", "0.62852913", "0.628054", "0.62694526", "0.6267532", "0.6263845", "0.62122685", "0.6194611", "0.61873055", "0.61804307", "0.6178648", "0.6175036", "0.6168055", "0.61494946", "0.61453223", "0.6142697", "0.6132935", "0.61320376", "0.6123899", "0.6112076", "0.6102228", "0.6099399", "0.6090853", "0.60899264", "0.60899264", "0.60824406", "0.6057473", "0.60562897", "0.6046727", "0.6044136", "0.6039798", "0.6033178", "0.60235643", "0.60097086", "0.5993532", "0.5993309", "0.59908247", "0.5983141", "0.5975013", "0.5963275", "0.59588575", "0.5951927", "0.5939262", "0.59371054", "0.59329146", "0.59245247", "0.5924027", "0.5923612", "0.59159976", "0.5911785", "0.5904791", "0.59012294", "0.58946985", "0.58946246", "0.5894294", "0.58825463", "0.5876383", "0.5872836", "0.58601326", "0.5854434", "0.5852506", "0.58481705", "0.584402", "0.5843875", "0.5831436", "0.5830341", "0.5817723", "0.58169204", "0.5806524", "0.5802839", "0.58020765", "0.5798412", "0.57982755", "0.5798142", "0.5794675", "0.57924706", "0.5790661", "0.5790376", "0.57801366", "0.5775395", "0.57746583", "0.5773741", "0.57664216", "0.5765248", "0.57625735", "0.5762028", "0.5761318", "0.57598156", "0.5757864" ]
0.6095762
33
Uses session to get the calendar feed for the user
def get_user_calendar_xml # :nodoc: response = session.get(USER_FEED) Nokogiri::XML(response.body) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calendar\n @calendars = Calendar.all.where(:UserId => [current_user.id, nil]).order(:start_time)\n end", "def get_feed\n if user_authorized?\n self.class.fetch_from_cache @canvas_course_id do\n get_feed_internal\n end\n else\n nil\n end\n end", "def get_calendars\r\n http = Net::HTTP.new(@google_url, 80)\r\n response, data = http.get(\"http://#{@google_url}/calendar/feeds/\" + @user_id, @headers)\r\n case response\r\n when Net::HTTPSuccess, Net::HTTPRedirection\r\n redirect_response, redirect_data = http.get(response['location'], @headers)\r\n case response\r\n when Net::HTTPSuccess, Net::HTTPRedirection\r\n doc = REXML::Document.new redirect_data\r\n \t doc.elements.each('//entry')do |e|\r\n \t title = e.elements['title'].text\r\n \t url = e.elements['link'].attributes['href']\r\n \t @calendars << GCalendar.new(title, url.sub!(\"http://#{@google_url}\",''))\r\n \t end\r\n return redirect_response\r\n else\r\n response.error!\r\n end\r\n else\r\n response.error!\r\n end\r\n end", "def feed\n if current_user\n feed = []\n Event.where(user_id: current_user.id).each do |event|\n event.comments.each do |comment|\n if (DateTime.current - comment.created_at.to_datetime).to_f < (DateTime.current - current_user.last_sign_in.to_datetime).to_f\n feed << event.name << comment\n end\n end\n event.file_attachments.each do |file|\n if (DateTime.current - file.created_at.to_datetime).to_f < (DateTime.current - current_user.last_sign_in.to_datetime).to_f\n feed << event.name << file\n end\n end\n end\n respond_with feed\n else\n redirect_to root_path\n end\n end", "def session\n @@session ||= []\n if @@session[self.id].nil?\n session = GData::Client::Calendar.new\n token = session.clientlogin(username,password)\n @@session[self.id] = session\n end\n @@session[self.id]\n end", "def index\n\t\t@login = @user.login\n\t\t@family_id = @user.fam_id\n\t\t@family = Fam.find(@family_id)\n\t\t@calendars = @family.users[0].calendars\n\t\t@user_session = params[:user_session]\n\t\t@count = @user.calendars.count\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @calendars }\n end\n end", "def index\n verify_owner(params[:gcal_id])\n\n calendar_list = @current_user.calendar_list\n calendar = calendar_list.calendars.find_or_create_by(gcal_id: params[:gcal_id])\n calendar.sync!(@current_user.access_token) if not calendar.synced?\n\n render json: calendar.json_data\n end", "def get_current_calendar\n session[:cal_time] ||= Time.now\n Entry.find(:all,\n :conditions => [ 'created_at > ? and created_at < ?',\n\t\t session[:cal_time].at_beginning_of_month,\n\t\t session[:cal_time].next_month.at_beginning_of_month ]\n\t ).collect { |e|\n e.created_at.day\n }.uniq\n end", "def index\n #@calendars = Calendar.all\n\t@login = @user.login\n\t@family_id = @user.fam_id\n\t@family = Fam.find(:all, :conditions => [\"id=?\", @family_id])\n\t@calendars = @family[0].users[0].calendars\n\t#@calendars = @user.calendars\n\t@user_session = params[:user_session]\n\t@count = @user.calendars.count\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @calendars }\n end\n end", "def index\n #@calendars = Calendar.all\n\t@calendars = @user.calendars.paginate ( :page => params[:page], :order => 'created_at ASC', :per_page => 3)\n\t@user_session = params[:user_session]\n\t@count = @user.calendars.count\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @calendars }\n end\n end", "def get_calendar \n\t\t@calendar = @current_user.calendar \n\t\ttodays_date_for_user = (Time.current.utc + @current_user.time_zone_offset.minutes).to_date\n\n\t\tif @calendar\n\t\t\ttodays_schedule = {}\n\t\t\ttomorrows_schedule = {}\n\n\t\t\t@calendar.schedule.each do |time, status|\n\t\t\t\t# get time and convert all times used to users time zone before doing anything \n\t\t\t\tusers_time = DateTime.parse(time) + @current_user.time_zone_offset.minutes\n\t\t\t\t\n\t\t\t\t# users actual date in their time zone and formatted time in schedule to users time zone \n\t\t\t\tdate = users_time.to_date \n\t\t\t\tformatted_time = users_time.strftime(\"%-I:%M%p\").downcase\n\t\t\t\t\n\t\t\t\tif date == todays_date_for_user\n\t\t\t\t\ttodays_schedule[formatted_time] = status \n\t\t\t\telsif date == (todays_date_for_user + 1.day)\n\t\t\t\t\ttomorrows_schedule[formatted_time] = status \n\t\t\t\telse \n\t\t\t\t\t# if outdated, remove from schedule and place in archive \n\t\t\t\t\t@calendar.schedule.except!(time)\n\t\t\t\t\t@calendar.archive[time] = status \n\t\t\t\tend\n\t\t\tend\n\n\t\t\tselected = todays_schedule.length + tomorrows_schedule.length == 0 ? false : true \n\t\t\t\n\t\t\trender json: {is_success: true, todays_schedule: todays_schedule, tomorrows_schedule: tomorrows_schedule, selected: selected}\n\t\t\t\n\t\t\t@calendar.save \t\n\t\t\t@calendar.touch \n\n\t\telse\n\t\t\tCalendar.new(\n\t\t\t\tuser: @current_user, \n\t\t\t\tschedule: {},\n\t\t\t\tarchive: {}\n\t\t)\n\t\t@current_user.calendar.save \n\t\trender json: {is_success: true, todays_schedule: {}, tomorrows_schedule: {}, selected: false }, status: :ok \n\t\tend\n\n\tend", "def feed\n get '/users/self/feed', auth_params\n end", "def calendar\n\t\t@pagenumber=154\n\t\tdata=params\n\t\tsession[:referer] = nil\n\t\tget_report_favourites\n\t\tset_date_and_month_for_calendar(data)\n\t\t@calendar = Redmine::Helpers::Calendar.new(Date.civil(@year, @month, 1), :month)\n\t\tget_receiver_and_provider\n\t\t@calendar.time_entries = Physical::Timeandexpenses::TimeEntry.find(:all,:conditions => ['employee_user_id = ? and (time_entry_date BETWEEN ? and ? ) and matter_people_id is null', @receiver.id, @calendar.startdt, @calendar.enddt ])\n\t\tif request.xhr?\t\t\t\n\t\t\trender :partial=> \"content\"\n\t\telse\n\t\t\trender :layout => \"left_with_tabs\"\n\t\tend\n\tend", "def show\n @calendar = Calendar.find(params[:id])\n\n unless @calendar.public?\n if user_signed_in?\n unless @calendar.user_id == current_user.id || current_user.calendars.includes(@calendar)\n redirect_to root_path, alert: 'You do not have permission to access this calendar!' and return\n end\n else\n redirect_to root_path, alert: 'You have to log in before you can access a private calendar' and return\n end\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @calendar }\n end\n end", "def get_feed\n if (feed = Canvas::CourseProvision.new(session[:user_id], options_from_params).get_feed)\n render json: feed.to_json\n else\n render nothing: true, status: 401\n end\n end", "def events_feed\n @group = Group.find_by(id: params[:id]) || not_found\n not_found unless @group.status?\n raise 'NotGroupMember' unless @group.member?(current_user)\n @events = @group.events.confirmed.by_date\n\n feed = []\n @events.each do |event|\n next if event.date_tba == true\n event_link = url_for(\n controller: 'events', action: 'show', group_id: @group.id,\n id: event.id\n )\n feed << {\n date: event.start_time.strftime('%Y-%m-%d'),\n title: \"#{event.time != '' ? event.time : 'TBA'} - #{event.event_name}\",\n url: event_link,\n ticket_stats: event.ticket_stats(@group, current_user)\n }\n end\n render json: feed\n end", "def fetch_user_google_calendars\n user_gcalendars = []\n if current_user.connected_to_google? && current_user.has_google_credentials?\n begin\n gcw = GoogleCalendarWrapper.new(current_user)\n gcw.import_calendars\n user_gcalendars = current_user.google_calendars\n rescue => e\n logger.error {\"#{e.message} #{e.backtrace.join(\"\\n\")}\"}\n current_user.update_attributes(connected_to_google: false)\n flash[:error] = \"We were not able to fetch data from #{current_user.name}'s Google account.\"\n end\n end\n user_gcalendars\n end", "def calendar\n get '/gtfs/calendar'\n end", "def index\n if session[:user_id]\n redirect_to home_feeds_url\n end\n end", "def index\n @annual_events = AnnualEvent.all\n @user_code = session[:login_user]\n end", "def get_calendar(user)\n source = get_page_source(user)\n source.css('svg.js-calendar-graph-svg g g')\n end", "def show\n\t\t@login = @user.login\n\t\t@family = Fam.find(@user.fam_id)\n\t\t@calendar = @family.calendar\n\t\t@entries = @calendar.events;\n\t\t@users = User.all(:conditions => {:fam_id => @user.fam_id}) # die whole Family\n\t\t\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @calendar }\n\t\t\tformat.ics { render :ics => @calendar }\n end\n end", "def calendars(user)\n Transport::url = Config.url\n\n _started = Time.now\n result = Transport::get(Config.username, Config.password, user, self.transport)\n _ended = Time.now\n KerioIcal.logger.info \"Transport::get spent #{_ended - _started}, with #{self.transport}\"\n\n _started = Time.now\n cals = Icalendar.parse(result)\n _ended = Time.now\n KerioIcal.logger.info \"Icalendar::parse spent #{_ended - _started}\"\n\n cals\n end", "def set_user_feed\n @feed = current_user.subscriptions.find(params[:id])\n end", "def scrape_calendar\n begin\n objects = objects_from_event_api\n objects.select! {|o| DateTime.strptime(o['start'],'%Y-%m-%d') > DateTime.now }\n activities = objects_to_activities(objects)\n return process_calendar(activities)\n rescue Exception => e\n return format_error(e)\n end\n end", "def get_google_calendar\n result = Gandalf::GoogleApiClient.get_google_calendar(self.apps_cal_id)\n result.data\n end", "def index\n @user_feeds = UserFeed.find_all_by_user_id(current_user.id)\n end", "def retrieve_calendar\n response = send_calendar_request(\"/#{@id}\", :get)\n @raw = JSON.parse(response.body)\n instance_variable_set(:@summary, @raw['summary'])\n instance_variable_set(:@location, @raw['location'])\n instance_variable_set(:@description, @raw['description'])\n instance_variable_set(:@time_zone, @raw['timeZone'])\n @html_link = @raw['htmlLink']\n\n self\n end", "def show\n if @connection.notion?\n @databases = @connection.client.list_databases\n else\n calendar_service = Google::Apis::CalendarV3::CalendarService.new\n calendar_service.authorization = Google::Auth::UserRefreshCredentials.new(\n client_id: Rails.application.credentials.google_client_id,\n client_secret: Rails.application.credentials.google_client_secret,\n scope: @connection.scope,\n access_token: @connection.access_token,\n refresh_token: @connection.refresh_token,\n # expires_at: data.fetch(\"expiration_time_millis\", 0) / 1000\n )\n\n @calendars = calendar_service.list_calendar_lists()\n end\n end", "def events\n client = Signet::OAuth2::Client.new(client_options)\n client.update!(session[:authorization])\n\n service = Google::Apis::CalendarV3::CalendarService.new\n service.authorization = client\n #controllo se non ho mai loggato con google\n if(!session[:authorization])\n client = Signet::OAuth2::Client.new(client_options)\n redirect_to client.authorization_uri.to_s\n else\n #controllo se il token è scaduto\n response = Net::HTTP.get(URI.parse('https://www.googleapis.com/oauth2/v1/tokeninfo?access_token='+(session[:authorization].first[1])))\n if(response.split[2][1,13] == \"invalid_token\")\n client =●●●●●● Signet::OAuth2::Client.new(client_options)\n redirect_to client.authorization_uri.to_s\n else\n @event_list = service.list_events(params[:calendar_id])\n end\n end\n end", "def show\n session[:oauth] = Koala::Facebook::OAuth.new(APP_ID, APP_SECRET, SITE_URL + '/callback?event_id='+params[:id])\n @auth_url = session[:oauth].url_for_oauth_code(:permissions=>\"email, user_events, friends_events, rsvp_event\") \n puts session.to_s + \"<<< session\"\n \n\n @event = Event.find(params[:id])\n \n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def get_feed\n self.class.fetch_from_cache @canvas_course_id do\n get_feed_internal\n end\n end", "def from_google\n @calendars = get_calendar(current_user).to_a\n @calendar_days = @calendars.group_by {|e| \n if e.start.date_time != nil \n e.start.date_time.strftime(\"%Y-%m-%d\").to_time\n end\n }\n @today = Time.now.strftime(\"%Y-%m-%d\").to_time\n @tomorrow = Time.now.tomorrow.strftime(\"%Y-%m-%d\").to_time\n end", "def fetch_by_user(user_id, start_date, end_date, basic = true, page = 1)\n RubyRedtail::Query.run(\"calendar/#{user_id}#{\"/basic\" if basic}?startdate=#{start_date}&enddate=#{end_date}&page=#{page}\", @api_hash, \"GET\")\n end", "def rss\n\n # Get the specified user, making sure that it exists\n if !@user = User.find_by_login(params[:user_login])\n raise ActiveRecord::RecordNotFound\n end\n\n # If the everybody flag is set, respond with feed items about everybody\n # on Blavel\n # Otherwise, respond with feed items only about the people that the\n # current user is following\n @everybody = params[:everybody]\n if @everybody\n @feed_items = gather_feed_items\n else\n @feed_items = gather_feed_items(current_user)\n end\n\n rescue ActiveRecord::RecordNotFound => error\n logger.info error\n flash[:notice] = 'The user you requested does not exist.'\n redirect_to '/'\n end", "def fetch_from_news_feed\n unless self.facebook_omniauth.blank?\n fb_user = self.facebook_client_user\n unless fb_user.blank?\n posts = fb_user.home # fetch posts\n Movie.name_is_not_blank.name_without_dictionary_word.this_year.each do |movie|\n posts.each do |post|\n FacebookFeed.create_facebook_post(post, movie, post.from)\n User.pull_comments(post, movie) #check for comments is present\n end # each post end\n end # movie end\n end\n end\n end", "def get_calendar_list()\n\t\tif(!@client.nil?)\n\t\t\tresponse = @client.execute(api_method: @service.calendar_list.list)\n\t\t\tcalendars = JSON.parse(response.body)\n\t\telse\n\t\t\tputs \"Client No Calendar boi\"\n\t\tend\n\tend", "def calendars\n if @event.travels_done?\n if current_user.expired == 1\n render :nothing => true, :status => :unauthorized\n else\n render :json => @event.to_json, :status => :ok\n end\n elsif @event.canceled?\n render :nothing => true, :status => :gone\n else\n render :nothing => true, :status => :not_found\n end\n end", "def set_calendar\n @calendar = Calendar.find(params[:id])\n end", "def create\n @calendar = Calendar.new(params[:calendar])\n @calendar.user_id = session[:user_id]\n\n respond_to do |format|\n if @calendar.save\n format.html { redirect_to(@calendar, :notice => 'Calendar was successfully created.') }\n format.xml { render :xml => @calendar, :status => :created, :location => @calendar }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @calendar.errors, :status => :unprocessable_entity }\n end\n end\n end", "def calendars\n records 'calendar', '/calendars.xml', :method => :get\n end", "def calendar_list\r\n logger.info(\"-- calendar list st --\") if logger\r\n auth unless @auth\r\n uri = URI.parse(CALENDAR_LIST_PATH)\r\n res = do_get(uri, {})\r\n logger.info(\"-- calendar list en(#{res.message}) --\") if logger\r\n res\r\n end", "def todays_session\n deck = data.decks.first\n deck.todays_session\n end", "def index\n if user_signed_in?\n @categories = Category.all\n @organisateur = Organisateur.find_by(user_id: current_user.id)\n if @organisateur\n @events = Evenement.where(organisateur_id: @organisateur.id)\n else\n @events = []\n end\n else\n redirect_to new_user_session_path\n end\n end", "def get_calendar_view(token, window_start, window_end, id = nil, fields = nil, user = nil, limit = 10)\n request_url = user_context(user)\n\n unless id.nil?\n request_url << \"/Calendars/\" << id\n end\n\n request_url << \"/CalendarView\"\n\n request_params = {\n 'startDateTime' => window_start.strftime('%Y-%m-%dT%H:%M:%SZ'),\n 'endDateTime' => window_end.strftime('%Y-%m-%dT%H:%M:%SZ'),\n '$top' => limit\n }\n\n unless fields.nil?\n request_params['$select'] = fields.join(',')\n end\n\n get_view_response =make_api_call \"GET\", request_url, token, request_params\n\n parse_response(get_view_response)\n end", "def get_feed\n return unless @access_granted\n begin\n raw_activity_feed = @worker.fetch_user_activity\n @processed_feed = @processor.process_feed(raw_activity_feed)\n rescue Exception => e\n Rails.logger.info \"#{self.class.name} with exception: #{e.message}\"\n end\n end", "def set_calendar\n @calendar = Calendar.find(params[:id])\n end", "def set_calendar\n @calendar = Calendar.find(params[:id])\n end", "def set_calendar\n @calendar = Calendar.find(params[:id])\n end", "def set_calendar\n @calendar = Calendar.find(params[:id])\n end", "def set_calendar\n @calendar = Calendar.find(params[:id])\n end", "def set_calendar\n @calendar = Calendar.find(params[:id])\n end", "def show\n redirect_to feeds_url\n # @feed = Feed.find(params[:id])\n # @user_feed = current_user.user_feeds.find_by_feed_id(@feed.id)\n end", "def calendar_list\n logger.info(\"-- calendar list st --\") if logger\n auth unless @auth\n uri = URI.parse(CALENDAR_LIST_PATH + @email)\n res = do_get(uri, {})\n logger.info(\"-- calendar list en(#{res.message}) --\") if logger\n res\n end", "def calendar\n\t\tif signed_in?\n\t\t\t@new_tasklist = current_user.task_lists.build\n\t\tend\n\tend", "def set_calendar\n @calendar = Calendar.find(params[:id])\n end", "def calendar(date=nil)\n date ||= Date.today\n time = date.to_time \n start_at = time.since(1.month).at_end_of_month\n end_at = time.ago(1.month).at_beginning_of_month\n\n Rails.cache.fetch(\"calendar_#{self.id}_#{self.entries_count}_#{start_at.to_i}_#{end_at.to_i}\", :expires_in => 1.day) do\n calendar = Entry.find_by_sql(['SELECT id, created_at, DATE_FORMAT(created_at, \"%d-%m-%y\") day, count(*) as count FROM entries WHERE user_id = ? AND is_private = 0 AND created_at < ? AND created_at > ? GROUP BY day ORDER BY created_at ASC', self.id, start_at.to_s(:db), end_at.to_s(:db)])\n calendar.group_by { |entry| entry.created_at.month }.sort_by { |a| a }\n end\n end", "def new\n\t@availability_calendar = User.find(session[:id]).availability_calendar\n\tif User.find(session[:id]).availability_calendar.nil?:\n\t User.find(session[:id]).availability_calendar=AvailabilityCalendar.create\n\t if User.find(session[:id]).availability_calendar.nil?:\n\t\tredirect_to \"http://google.com\"\n\t end\n\t #@availability_calendar = User.find(session[:id]).availability_calendar\n\t #14.times {\t|i|\n\t\t#@availability_calendar.availability_days.build(:availability_day => Date.today+i.days)\n\t #}\n\t User.find(session[:id]).availability_calendar.save\n\tend\n #@availability_calendar = User.find(session[:id]).availability_calendar\n\t#redirect_to (:action => 'edit', :id => @availability_calendar.id)# edit_availability_calendar @availability_calendar\n end", "def index\n @events = Event.order(:time).order(:date)\n \n fetch_calendar 'tgbgmclhk5gegn8t95fvqov0s8@group.calendar.google.com'\n end", "def feeds\n @user = current_user\n @subscribed_ids = @user.subscriptions.pluck(:feed_uid)\n end", "def index\n @github_events_by_date ||= begin\n if user_signed_in?\n Github::Event.user_events_by_day current_user_github_access_token,\n current_user_github_username\n else\n []\n end\n end\n end", "def set_calendar\n @calendar = @hairdresser.calendars.find(params[:calendar_id])\n end", "def index\n @events = current_user.events\n end", "def index\n @events = current_user.events\n end", "def show\n @user = User.find(params[:id])\n #redirect_to new_user_profiles_path if @user.profile.nil?\n \n if params[:date_change] && params[:date_change][:date]\n if params[:date_change][:date].split(\"/\").size > 1\n session[:day] = Date.strptime(params[:date_change][:date], \"%m/%d/%Y\")\n elsif params[:date_change][:date].split(\"-\").size > 1\n session[:day] = Date.strptime(params[:date_change][:date], \"%Y-%m-%d\") \n end\n end\n \n @day = session[:day]\n @day_entries = @user.day_entries(@day)\n @day_target = @user.day_target(@day)\n \n @activities = @user.activities || []\n \n @from_date, @through_date = @user.get_digest_dates(session[:day])\n\n respond_to do |format|\n format.html { render \"show.html.haml\" }# show.html.erb\n format.json { render json: @user }\n end\n end", "def feed\n Croak.where(\"user_id = ?\", self.id).includes(:user)\n end", "def set_calendar\n @calendar = Calendar.find(params[:id])\n @site = @calendar.site\n end", "def calendar_list\n\t\t logger.info(\"-- get_calendar_list_responce st --\") if logger\n\t\t auth unless @auth\n\t\t uri = URI.parse(CALENDAR_LIST_PATH)\n\t\t res = do_get(uri, {})\n\t\t logger.info(\"-- get_calendar_list_responce en(#{res.message}) --\") if logger\n\t\t res\n\t\tend", "def calendar_id\t\t\n \t\t# calendar id returns nil if user doesn't exist\n \t\tcalendar unless !has_calendar? \n \tend", "def show\n respond_to do |format|\n format.html do\n @date = Date.parse(params[:date]) rescue Date.today\n @date = Date.today if !@date.valid_gregorian_date?\n\n raise ActiveRecord::RecordNotFound if params[:date].present? && !@calendar.calendar_items.date_in_range?(@date)\n\n @calendar_items = @calendar.calendar_items.find_all_for_month_of(@date).group_by { |ci| ci.start_time.mday }\n end\n format.any(:rss, :atom) do\n @calendar_items = @calendar.calendar_items.accessible.all(:include => :node, :order => 'start_time', :conditions => [ 'nodes.ancestry = ? ', @calendar.node.child_ancestry ])\n render :layout => false\n end\n format.xml { render :xml => @calendar }\n end\n end", "def g_cal\n @g_cal ||= Google::Calendar.new(\n :client_id => @client_id,\n :client_secret => @secret,\n :calendar => @calendar_id,\n :redirect_url => \"urn:ietf:wg:oauth:2.0:oob\" # this is what Google uses for 'applications'\n )\n end", "def home\n\n @events = Event.limit(4)\n @events_calendar = Event.all\n\nend", "def set_user_today\n @day_of_week=Date.today.strftime('%A')\n # Variables for showing the pop-ups if they don't exist\n @userDailyQuestionnaireToday = UserDailyQuestionnaire.where(user: current_user, questionnaire_date: Date.today).first\n @userData = UserDatum.where(user: current_user).first\n end", "def feed\n # todo dangerous?\n klass = @type.constantize\n\n @community_slides = current_user.community(klass)\n @friends_slides = current_user.friends(klass)\n @private_slides = current_user.private(klass)\n\n # respond_with klass.feed(current_user).to_json\n respond_with 'slides/feed'\n end", "def getCurrentEventsForUser\n events_currentUser = current_user.getEventsAttending\n gon.user_id = current_user.id\n\n respond_to do |format|\n format.json {render :json => {:events_currentUser => events_currentUser}}\n end\n end", "def index\n @users = User.all\n \n session[:day] = Date.today\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def requesting_playdate\n @playdate ||= Playdate.findActivePlaydate(current_user) \n end", "def login\n self.session = GData::Client::Calendar.new if session.nil?\n @token = session.clientlogin(username,password)\n true\n end", "def session\n ReminderMailer.session\n end", "def correct_user\n @event = Event.find_by_id(params[:id])\n if @event.nil?\n redirect_to root_url\n else\n @calendar = current_user.calendars.find_by_id(@event.calendar_id)\n if @calendar.nil?\n @calendar = \n current_user.subscriptions.find_by_calendar_id(@event.calendar_id)\n end\n redirect_to root_url if @calendar.nil?\n end\n end", "def currentuser\n\n @events = Event.where(user_id: current_user).order('created_at DESC')\n\tend", "def fetch_events\n params = {'calendarId' => CONFIG[:cal_id], \n 'orderBy' => 'startTime',\n #'timeMax' => Time.utc(CONFIG[:year].to_i + 1, 4, 1).iso8601, \n #'timeMin' => Time.utc(CONFIG[:year].to_i, 4, 1).iso8601,\n 'singleEvents' => 'True'}\n \n result = @client.execute(:api_method => @cal.events.list, :parameters => params)\n\n @events_list = []\n result.data.items.each do |item|\n @events_list << item\n end\n end", "def getProfileFeed(lastDocumentID, lastEventID)\n request('getProfileFeed', {'lastDocumentID' => lastDocumentID, 'lastEventID' => lastEventID})\n end", "def index\n @calendar = Calendar.find(1)\n end", "def feed\r\n # check for valid access key:\r\n user = User.find_by_rss_access_key(params[:access_key])\r\n @authorized = !user.blank?\r\n\r\n # get the folder\r\n @folder = Folder.find_by_id(folder_id)\r\n\r\n # set appriopriate instance variables,\r\n # so the feed can be created in folder.rxml\r\n if @authorized and not @folder.blank?\r\n if @folder.is_root or user.can_read(@folder.id)\r\n @folders = @folder.list_subfolders(user, 'name')\r\n @myfiles = @folder.list_files(user, 'filename')\r\n else\r\n @authorized = false\r\n end\r\n end\r\n\r\n # finally, set correct header\r\n if @authorized\r\n headers['Content-Type'] = 'text/xml'\r\n else\r\n headers['Content-Type'] = 'text/html'\r\n end\r\n end", "def feed\n @articles = Article.feed_list(current_user, params[:page])\n end", "def get_user_to_act_on\n @user = session[:user]\n end", "def get_user_to_act_on\n @user = session[:user]\n end", "def load_events\r\n @events = Event.find(:all, \r\n :conditions => [\"user_id = \"\\\r\n \"#{session[:user_id]} and (begins >= CURRENT_DATE()\"\\\r\n \"or ends >= CURRENT_DATE())\"] ,\r\n :order => 'begins ASC')\r\n end", "def index\n user = self.current_user && User.find_by_id(self.current_user.id)\n @events = nil\n if user\n @events = user.events \n else\n @events = Event.find(:all)\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @events }\n end\n end", "def session\n @current_user = User.find_by_access_token(params[:access_token])\n \n # Fetch content for current user\n # find_friends_for_facebook_id(@current_user.facebook_id, since = nil)\n \n # return new friends\n # We want to send the entire friendslist hash of id, name to the client\n # friend_array = Friendship.find(:all, :select=>\"friend_id, friend_name\", :conditions=>\"user_id = #{@current_user.id}\").map {|f| {:friend_id=>f.friend_id.to_i, :friend_name=>f.friend_name}}\n # friend_id_array = friend_array.map do |f| f[:friend_id] end\n # \n # # The response should include the current user ID and name for the client to cache\n # session_response_hash = {\n # :access_token => @current_user.access_token,\n # :facebook_id => @current_user.facebook_id,\n # :name => @current_user.name,\n # :friends => friend_array\n # }\n \n session_response_hash = {\n :access_token => @current_user.access_token\n }\n\n respond_to do |format|\n format.xml { render :xml => session_response_hash.to_xml }\n format.json { render :json => session_response_hash.to_json }\n end\n end", "def calendar_view\n return @calendar_view\n end", "def index\n @events = current_user.account.events\n end", "def feed(usuario = \"me\")\n\t\t@graph.get_connections(usuario, 'feed')\n\tend", "def index\n @events = current_user.super_user ? Event.all : current_user.events\n end", "def show_nouser\n @feed = Feed.find_by_uid!(params[:feed])\n feed_uids = Rails.cache.fetch [:feed_uids, @feed] do\n [@feed.uid] + @feed.children.pluck(:uid)\n end\n\n if @date.nil?\n @date = @feed.last_paper_date\n end\n\n @backdate = _backdate(@date, @range)\n @recent_comments = _recent_comments(feed_uids)\n @papers, @pagination = _range_query(feed_uids, @backdate, @date, @page)\n\n render 'feeds/show'\n end", "def set_feeds_user\n @feeds_user = FeedsUser.find(params[:id])\n end", "def calendars\n page_token = nil\n result = execute(:api_method => service.calendar_list.list)\n entries = []\n while true\n entries += result.data.items\n if !(page_token = result.data.next_page_token)\n break\n end\n result = execute(:api_method => service.calendar_list.list,\n :parameters => {'pageToken' => page_token})\n end\n\n entries\n end", "def fetch_next_week_events\n return [] unless sources.try(:first).present?\n\n source = sources.first\n source.refresh_token_if_expired\n\n gdata = Googledata.new\n gdata.pull(source.oauth_token)\n end", "def get_schedule\n Log.add_info(request, params.inspect)\n\n @date = Date.parse(params[:date])\n\n @schedules = Schedule.get_user_day(@login_user, @date)\n\n render(:partial => 'schedule', :layout => false)\n end" ]
[ "0.66995835", "0.65903664", "0.6545744", "0.64435136", "0.64212537", "0.6359534", "0.63205767", "0.6309486", "0.62912303", "0.62804157", "0.62491924", "0.6234602", "0.62235904", "0.61670417", "0.61228895", "0.6111004", "0.6107281", "0.6093176", "0.6074947", "0.6073134", "0.60493416", "0.6036378", "0.59811217", "0.5969544", "0.5955945", "0.5947521", "0.59467816", "0.59389853", "0.5906124", "0.5871289", "0.5870943", "0.5860114", "0.5856602", "0.5846842", "0.58428144", "0.5840908", "0.58302927", "0.58072585", "0.57861227", "0.57768327", "0.57669497", "0.5764304", "0.5763912", "0.5755085", "0.5744784", "0.5735541", "0.57293206", "0.57293206", "0.57293206", "0.57293206", "0.57293206", "0.57293206", "0.5715899", "0.57092434", "0.57049394", "0.56995153", "0.56875265", "0.56673086", "0.56597155", "0.5644709", "0.5639478", "0.5617847", "0.56160516", "0.56160516", "0.56145906", "0.56145287", "0.5613341", "0.56077754", "0.5606848", "0.55960274", "0.5585616", "0.5569761", "0.5564544", "0.5558321", "0.55551285", "0.55424213", "0.55405396", "0.553791", "0.55325586", "0.5528129", "0.552441", "0.5519555", "0.5514674", "0.55138105", "0.54931194", "0.5491062", "0.54850626", "0.54850626", "0.54834753", "0.54754704", "0.5474811", "0.546571", "0.54606104", "0.5458673", "0.54551077", "0.5447683", "0.5447234", "0.5445007", "0.54337895", "0.5426427" ]
0.69711167
0
As stated, the goal of this library is to manipulate the google calendar, using ActiveRecord as a cache. This means that synchronization needs to follow these rules: a) data exists in gcal and not in local > create local objects note that deletion of a local event must either immediately delete the google object, or make note of it locally for the sync process to not recreate an object that should be deleted. b) data exists in local but not in gcal > create gcal objects see note for a). however this case can also be handled by inferring that someone deleted the google object by seeing the last updated timestamp on our cached object, and assuming that it's missing from google due to deletion and not unintentional data loss. c) data exists in both. timestamps don't match. > update older object d) data exists in both, timestamps match > do nothing (unless force update flag?) opts[:force] = true ignore updated timestamps and update from google unconditionally opts[:range] = Range(Datestart .. Dateend)
def sync_calendars(opts={}) # why does the primary calendar feed change every time? feed_xml = get_user_calendar_xml xml_ts = Time.zone.parse(feed_xml.xpath('/ns:feed/ns:updated', 'ns'=>'http://www.w3.org/2005/Atom').text) self.body = feed_xml.to_s if xml_ts != synced_at feed_xml.css('entry').each { |entry| existing_cal = calendars.find :first, :conditions=>{ :uid=>entry.css('id').text} if existing_cal existing_cal.events.destroy_all if opts[:force] == true existing_cal.sync_with_xml(entry, opts) # , range - allows calendar to only sync specified range else cal = Calendar.new(:init=>entry) puts "XXX not found. creating new calendar object for #{cal.title}" calendars << cal cal.sync_events end } # find any local calendars that are new and push them up to google calendars.find(:all, :conditions=>{:synced_at=>nil}).each do |entry| end self.synced_at = xml_ts save end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_events\n # TODO: handle simple \"date\" in \"all day\" events\n google_updated_events = get_updated_events\n current_user.events.destroy_all\n if google_updated_events.length > 0\n google_updated_events.each do |event|\n new_event = current_user.events.find_or_create_by(g_id: event.id)\n new_event.update_attributes!({\n 'g_id' => event.id,\n 'summary' => event.summary,\n 'description' => event.description,\n 'start' => event.start ? event.start[\"dateTime\"] : nil,\n 'end' => event.end ? event.end[\"dateTime\"] : nil,\n 'location' => event.location\n })\n end\n end\n end", "def gcupdate_event\n cal_event = Event.find_by(gamecall_tag: self.id)\n if cal_event.title != self.title || cal_event.start_time != self.start_time || cal_event.end_time != self.end_time\n cal_event.update :title => self.title, :start_time => self.start_time, :end_time => self.end_time \n end \n end", "def create_or_update_google_calendar_events\n client = Google::Apis::CalendarV3::CalendarService.new\n client.authorization = Google::Auth.get_application_default(Google::Apis::CalendarV3::AUTH_CALENDAR) \n\n if self.home_team.google_calendar_id\n event = self.build_google_calendar_event_for_team(self.home_team)\n if self.home_team_google_calendar_id\n client.update_event(self.home_team.google_calendar_id, self.home_team_google_calendar_id, event)\n else\n result = client.insert_event(self.home_team.google_calendar_id, event)\n self.update_column(:home_team_google_calendar_id, result.id)\n end\n end\n\n if self.away_team.google_calendar_id\n event = self.build_google_calendar_event_for_team(self.away_team)\n if self.away_team_google_calendar_id\n client.update_event(self.away_team.google_calendar_id, self.away_team_google_calendar_id, event)\n else\n result = client.insert_event(self.away_team.google_calendar_id, event)\n self.update_column(:away_team_google_calendar_id, result.id)\n end\n end\n end", "def update_from_google\n @calendars.each do |google_event|\n event = Event.find_by(gid: google_event.id)\n # Update existing event with updated Calendar info\n if event.present?\n event.title = google_event.summary\n event.description = google_event.description\n event.hangout_link = google_event.hangout_link\n event.starts = google_event.start.date_time\n event.ends = google_event.end.date_time\n if google_event.organizer.display_name == nil \n event.creator = google_event.organizer.email\n else\n event.creator = google_event.organizer.display_name\n end\n event.location = google_event.location\n google_category = google_event.summary.downcase\n if [\"1:1\", \"1-to-1\", \"one-to-one\"].include? google_category\n event.category = \"1:1\"\n elsif [\"standup\", \"stand-up\", \"stand up\", \"check-in\", \"check in\"].include? google_category \n event.category = \"check-in\"\n else\n event.category = \"general\"\n end\n event.save!\n # Update attendees list\n if google_event.attendees != nil\n google_event.attendees.each do |google_attendee|\n attendee = Attendee.find_by(email: google_attendee.email, event_id: google_event.id)\n if attendee.present?\n attendee.email = google_attendee.email\n attendee.name = google_attendee.display_name\n attendee.response = google_attendee.response_status\n attendee.save!\n else\n new_attendee = Attendee.new\n new_attendee.event_id = google_event.id\n new_attendee.gid = google_attendee.id\n new_attendee.email = google_attendee.email\n new_attendee.name = google_attendee.display_name\n new_attendee.organizer = google_attendee.organizer\n new_attendee.response = google_attendee.response_status\n new_attendee.save!\n end\n end\n end\n # Create a new event in case this doesn't exist yet\n else\n if google_event.start.date_time != nil\n new_event = current_user.events.new\n new_event.gid = google_event.id\n new_event.title = google_event.summary\n new_event.description = google_event.description\n new_event.hangout_link = google_event.hangout_link\n new_event.starts = google_event.start.date_time\n new_event.ends = google_event.end.date_time\n if google_event.organizer.display_name == nil\n new_event.creator = google_event.organizer.email\n else\n new_event.creator = google_event.organizer.display_name\n end\n new_event.location = google_event.location\n google_category = google_event.summary.downcase\n if [\"1:1\", \"1-to-1\", \"one-to-one\"].include? google_category\n new_event.category = \"1:1 meeting\"\n elsif [\"standup\", \"stand-up\", \"stand up\", \"check-in\", \"check in\"].include? google_category\n new_event.category = \"Check-in / Stand-up\"\n else\n new_event.category = \"General\"\n end\n new_event.save!\n end\n # Create attendees list\n if google_event.attendees != nil\n google_event.attendees.each do |google_attendee|\n new_attendee = Attendee.new\n new_attendee.event_id = google_event.id\n new_attendee.gid = google_attendee.id\n new_attendee.email = google_attendee.email\n new_attendee.name = google_attendee.display_name\n new_attendee.organizer = google_attendee.organizer\n new_attendee.response = google_attendee.response_status\n new_attendee.save!\n end\n end\n end\n end\n end", "def update_events\n calendar_changed = @event.is_a?(Googlize) && @event.calendar != params[:event][:calendar]\n if calendar_changed\n ge = @event.fetch_google_event\n ge.destroy! if ge #prevents an error when updating a canceled event\n @event.google_event_id = nil\n end\n success = @event.update_attributes(params[:event])\n @event.save if calendar_changed\n @repeat_events.each{|event| event.save } if success\n success\n end", "def update_calendar(opts = {})\n end", "def update_organization_units\n\n oldest_update = AdOrganizationUnit.order('created_at').last\n\n if bind && (oldest_update.nil? || oldest_update.created_at<1.day.ago)\n filter = Net::LDAP::Filter.eq(\"objectClass\", \"organizationalunit\")\n results = @connection.search(:base =>\"ou=Sync,\"+base_distinguished_name, :filter => filter)\n remote_organization_units = Hash.new\n local_organization_units = Hash.new\n\n # Build hash for local entries\n AdOrganizationUnit.find_each do |local_entry|\n local_organization_units[local_entry.distinguishedname] = local_entry.whenchanged\n end\n\n # Add new entries to local database\n results.each do |remote_entry|\n # Build hash for remote entries\n remote_organization_units[remote_entry.distinguishedname[0]] = remote_entry.whenchanged[0]\n if !local_organization_units.has_key?(remote_entry.distinguishedname[0])\n new_organization_unit = AdOrganizationUnit.new\n new_organization_unit.distinguishedname = remote_entry.distinguishedname[0]\n new_organization_unit.whenchanged = remote_entry.whenchanged[0]\n new_organization_unit.save!\n end\n end\n\n # Remove old entries from local database\n local_organization_units.each do |local_entry|\n if !remote_organization_units.has_key?(local_entry[0])\n AdOrganizationUnit.find_by_distinguishedname(local_entry[0]).destroy\n end\n end\n else\n return false\n end\n end", "def makeRecurr\n if repeats\n if recurrence.present?\n if recurrence.events.count == 1\n #We are the only event yet, HOOORAY\n dates = recurrence.getDatesAllInOne\n dates.each do |date|\n date = DateTime.parse(date.to_time.to_s)\n date = date.to_date\n if date != start.to_date\n\n #We do not want to override ourselve\n if !date.past?\n #We do not want to add past events\n time = start.to_time\n newStart = start\n newStart= newStart.to_time.change(day: date.to_time.day, year: date.to_time.year, month: date.to_time.month)\n newEnd = self.end\n newEnd = newEnd.to_time.change(day: date.to_time.day, year: date.to_time.year, month: date.to_time.month)\n newStart = DateTime.parse(newStart.to_s)\n newEnd = DateTime.parse(newEnd.to_s)\n\n newEvent= Event.new(title: self.title, description: self.description,\n event_category: self.event_category, ort: self.ort, role_ids: self.role_ids, url: self.url,\n imageURL: self.imageURL, start: newStart, end: newEnd, repeats: false,\n priority: self.priority, flag: self.flag, author: self.author, manager: self.manager, admin: self.admin, state: self.state, recurrence: self.recurrence)\n newEvent.save!(:validate => false)\n end\n end\n end\n end\n end\n end\n end", "def ensure_cache_up_to_date\n self.last_update_timestamp = self.redis.get(\"bluster:last_update_timestamp\").to_i\n if self.last_update_timestamp.nil?\n update_object_cache\n elsif self.last_update_timestamp != File.new(self.objects_path).mtime.to_i\n update_object_cache\n end\n end", "def load_calendar agency_id=nil\n expanded_calendar = {}\n\n #=========GET SERVICE_IDs, ASSOCIATE THEM WITH INTs=====\n sid_numbers = load_service_ids\n\n #=========FIGURE OUT THE SERVICE DAY BOUNDS=============\n\n day_bounds = conn.exec <<-SQL\n select min(departure_time), max(arrival_time) from gtf_stop_times\n SQL\n\n #convert day_bounds to seconds since beginning of local midnight\n sid_start = GoogleTransitFeed::parse_time( day_bounds[0][0] )\n sid_end = GoogleTransitFeed::parse_time( day_bounds[0][1] )\n\n #pop an error if service days overlap\n #if sid_end-sid_start > SECONDS_IN_DAY then raise \"Service day spans #{day_bounds[0][0]} to #{day_bounds[0][1]}; Service days may not overlap\" end\n\n #=========GET TIMEZONE INFORMATION======================\n if agency_id then\n timezone = conn.exec \"SELECT agency_timezone FROM gtf_agency WHERE agency_id='#{agency_id}'\"\n else\n timezone = conn.exec \"SELECT agency_timezone FROM gtf_agency\"\n end\n timezone = TZInfo::Timezone.get( timezone[0][0] ) #convert timezone string (eg \"America/New York\") to timezone\n tz_offset = timezone.current_period.utc_offset #number of seconds offset from UTC (eg -18000)\n dst_offset = timezone.current_period.std_offset #number of seconds changed during daylight savings eg 3600\n\n #=========EXPAND calendar TABLE INTO HASH===============\n dates = conn.exec <<-SQL\n SELECT service_id, monday, tuesday, wednesday, thursday, friday, saturday, sunday, start_date, end_date from gtf_calendar\n SQL\n\n #for each service_id in the calendar table\n dates.each do |service_id, mon, tue, wed, thu, fri, sat, sun, start_date, end_date|\n #convert to boolean daymask\n daymask = [mon.to_i, tue.to_i, wed.to_i, thu.to_i, fri.to_i, sat.to_i, sun.to_i].collect do |day| day == 1 end\n\n #Find the UTC date, as if we're in London\n i = GoogleTransitFeed::parse_date( start_date.to_s ) #date as parsed to UTC\n n = GoogleTransitFeed::parse_date( end_date.to_s ) #end date is inclusive\n\n #the expanded calendar is a hash with the dates where services run as keys and\n #the service_ids of particular services running each day as values, grouped in arrays\n #for each day in the service_id date range\n while i <= n do\n if daymask[ i.wday ] then\n expanded_calendar[i] ||= []\n expanded_calendar[i] << sid_numbers[service_id]\n end\n\n i += SECONDS_IN_DAY\n end\n end\n\n #=========APPLY EXCEPTIONS FROM calendar_dates TO expanded_calendar HASH=============\n single_dates = conn.exec <<-SQL\n SELECT service_id, date, exception_type from gtf_calendar_dates\n SQL\n\n single_dates.each do |service_id, date, exception_type|\n #returns UTC date, as if we're in London\n i = GoogleTransitFeed::parse_date( date.to_s )\n expanded_calendar[i] ||= []\n\n if exception_type.to_i == 1 then\n expanded_calendar[i] << sid_numbers[service_id]\n elsif exception_type.to_i == 2 then\n expanded_calendar[i].delete sid_numbers[service_id]\n end\n end\n\n #========CONVERT EXPANDED CALENDAR TO SORTED ARRAY===================================\n expanded_calendar = expanded_calendar.to_a\n expanded_calendar.sort! do |a,b|\n a.first <=> b.first\n end\n\n #========CONVERT SORTED ARRAY INTO CALENDAR OBJECT===================================\n ret = Calendar.new\n expanded_calendar.each do |day, service_ids|\n local_daystart = day.to_i-tz_offset\n #if daylight savings is in effect\n if timezone.period_for_utc( day.to_i ).dst? then\n local_daystart -= dst_offset\n daylight_savings = dst_offset\n else\n daylight_savings = 0\n end\n\n ret.append_day( local_daystart+sid_start, local_daystart+sid_end, service_ids, daylight_savings )\n end\n\n return ret.rewind!\n end", "def sync_sf_to_local(sync_query, sync_fields, remote_sobject, force = false)\n # local_object = sync_query.local_model.constantize.find_or_initialize_by(:sf_id => remote_sobject.Id)\n select_object = @local_objects.select {|lo| lo.sf_id == remote_sobject.Id} \n if select_object.empty?\n local_object = sync_query.local_model.constantize.new(:sf_id => remote_sobject.Id)\n else\n local_object = select_object.first\n end\n # Sync only if the Salesforce object is newer than the local object \n unless force == true\n diff = different?(local_object, remote_sobject, sync_fields)\n sf_newer = sobject_newer?(remote_sobject, local_object)\n print \"Different? #{diff}\\n\"\n end\n \n if (diff && sf_newer) || force == true \n sync_fields.each do |field|\n # Update the local field if it's value is different from the value in Salesforce\n local_object[\"#{field.local_field_name}\"] != remote_sobject[\"#{field.sf_field_name}\"] ? local_object[\"#{field.local_field_name}\"] = remote_sobject[\"#{field.sf_field_name}\"] : nil\n # If Model has a last_sync_at column add the current timestamp\n if local_object.has_attribute?(:last_sync_at) && local_object.has_changes_to_save?\n local_object.last_sync_at = Time.now\n end \n end\n if local_object.has_changes_to_save?\n local_object.save(:validate => false) ? puts(local_object.to_s) : 'error' \n end\n end \n end", "def from_google\n @calendars = get_calendar(current_user).to_a\n @calendar_days = @calendars.group_by {|e| \n if e.start.date_time != nil \n e.start.date_time.strftime(\"%Y-%m-%d\").to_time\n end\n }\n @today = Time.now.strftime(\"%Y-%m-%d\").to_time\n @tomorrow = Time.now.tomorrow.strftime(\"%Y-%m-%d\").to_time\n end", "def sync\n @events = nil\n each do |event|\n matching_event_page = @event_pages.find do |event_page|\n event_page.ical_url == event.url.to_s\n end\n\n if matching_event_page\n event.url = Icalendar::Values::Uri.new(matching_event_page.url)\n\n matching_event_page.title = event.summary\n # Dates are broken on Lanyrd: https://twitter.com/aslak_hellesoy/status/591272555035684864\n # Start dates is right, end date is wrong (!?!)\n # matching_event_page.dtstart = event.dtstart\n # matching_event_page.dtend = event.dtend\n end\n end\n end", "def patch_calendar(opts = {})\n update_calendar(opts)\n end", "def update(entry_id, start_date, end_date, options = {})\n end", "def update\n \t\t@start_date=Date.new(system_renewal_params[\"start_date(1i)\"].to_i,system_renewal_params[\"start_date(2i)\"].to_i,system_renewal_params[\"start_date(3i)\"].to_i)\n @end_date=Date.new(system_renewal_params[\"end_date(1i)\"].to_i,system_renewal_params[\"end_date(2i)\"].to_i,system_renewal_params[\"end_date(3i)\"].to_i)\n\t\t\n\t\t@start_date_google=system_renewal_params[\"start_date(1i)\"].to_s + '-' + system_renewal_params[\"start_date(2i)\"].to_s + '-' + system_renewal_params[\"start_date(3i)\"].to_s + 'T10:00:52-05:00'\n\t\t@end_date_google=system_renewal_params[\"end_date(1i)\"].to_s + '-' + system_renewal_params[\"end_date(2i)\"].to_s + '-' + system_renewal_params[\"end_date(3i)\"].to_s + 'T10:00:52-05:00'\n\t renovacion = System::Renewal.find(params[:id])\n \n x=renovacion.contract\n\t\tputs 'aki va el ID del calendariooooooooooooooooooooooooooooooooooooooooo'\n\t\tputs System::Renewal.find(params[:id]).google_event_start\n\t\tputs 'aki termina el ID del calendariooooooooooooooooooooooooooooooooooooooooo'\n\t\tSystem::Renewal.event_update(@start_date_google,@start_date_google,x.description,'neuro',System::Renewal.find(params[:id]).google_event_start)\n\t\tSystem::Renewal.event_update(@end_date_google,@end_date_google,x.description,'neuro',System::Renewal.find(params[:id]).google_event_end)\n\n \n @email = renovacion.contract.supplier.email\n @system_contract = renovacion.contract\n \n System::Renewal.delayed_event_delete(System::Renewal.find(params[:id]).delayed_id_start)\n System::Renewal.delayed_event_delete(System::Renewal.find(params[:id]).delayed_id_end)\n \n if params[:notification_date].nil?\n file_yaml = YAML.load_file \"#{Rails.root}/config/config.yml\"\n @before_days = file_yaml[\"production\"]['notification_time'].to_i.days\n else\n @before_days = params[:notification_date].to_i.days\n end\n \n @recordar1 = @start_date - @before_days\n @recordar2 = @start_date - @before_days\n \n @email_departamento = @system_contract.device.location.email \n array_mailer = [@email, @email_departamento]\n \n @delayed_id_start = ApplicationMailer.delay(run_at: @recordar1).send_mail(array_mailer, @system_contract,'update_renewal', @start_date, @end_date)\n @delayed_id_end = ApplicationMailer.delay(run_at: @recordar2).send_mail(array_mailer, @system_contract,'update_renewal', @start_date, @end_date)\n \n \n respond_to do |format|\n if @system_renewal.update(contract_id: x.id, start_date: @start_date, end_date: @end_date, monto: system_renewal_params[:monto], delayed_id_start: @delayed_id_start.id, delayed_id_end: @delayed_id_end.id)\n format.html { redirect_to @system_renewal, notice: 'Renewal was successfully updated.' }\n format.json { render :show, status: :ok, location: @system_renewal }\n format.js { redirect_to @system_renewal, notice: 'Renewal was successfully updated.' }\n else\n format.html { render :edit }\n format.json { render json: @system_renewal.errors, status: :unprocessable_entity }\n format.js { render :edit }\n end\n end\n end", "def clean_update(data, parameter_hash)\n\n factory = RGeo::Geographic.simple_mercator_factory(:srid => 4326)\n\n for item in data\n\n # Record event source\n item['miner_data_source'] = parameter_hash['source']\n\n\n # Clean Location Data for filtering before formatting\n raw_location = item[parameter_hash['location']]\n\n longitude = raw_location['coordinates'][0]\n latitude = raw_location['coordinates'][1]\n\n rgeo_point = factory.point(longitude, latitude)\n\n item['rgeo_location'] = factory.collection([rgeo_point])\n\n\n # Clean Time Field\n if parameter_hash['source'] == 'san_francisco'\n\n time = Time.strptime(item['time'], '%H:%M')\n date = DateTime.parse(item['date'])\n\n item['ruby_date_time'] = DateTime.new(date.year, date.month, \n date.day, time.hour, time.min, time.sec, time.zone)\n\n # Other 2 timefields are uniform\n else\n\n date_key = parameter_hash['fields']['date']\n\n no_utc_time = DateTime.parse(item[date_key])\n\n item['ruby_date_time'] = no_utc_time.new_offset('-08:00')\n\n end\n\n end\n\n return data\n\nend", "def sync_events\n events = @last_event_id ? @room.events_after(@last_event_id) :\n @room.recent_events(512)\n return if events.empty?\n respond_recent_events events\n end", "def update_calendar_list(opts = {})\n end", "def sync()\n #This is a stub, used for indexing\n end", "def sync(source_entry)\n [ :entry_status, :entry_author_id, :entry_allow_comments, :entry_allow_pings, \n :entry_convert_breaks, :entry_title, :entry_excerpt, :entry_text, :entry_text_more,\n :entry_to_ping_urls, :entry_pinged_urls, :entry_keywords, :entry_tangent_cache,\n :entry_created_on, :entry_modified_on, :entry_created_by, :entry_modified_by,\n :entry_basename, :entry_week_number ].each do |attribute|\n self[attribute] = source_entry[attribute]\n end\n\n # Sync placements ONLY if this entry has been previously saved.\n unless self.new_record?\n # Add or update placements.\n source_entry.placements.each do |source_placement|\n # Category may not exist yet; copy if so.\n target_category = MovableType::AR::Category.find(:first, :conditions => { :category_blog_id => self.entry_blog_id, :category_label => source_placement.category.category_label })\n target_category = MovableType::AR::Category.create(self.blog, source_placement.category) if target_category.blank?\n target_placement = self.placements.find(:first, :conditions => { :placement_category_id => target_category.category_id })\n target_placement.blank? ?\n self.placements << MovableType::AR::Placement.create(self, source_placement) :\n target_placement.sync!(source_placement)\n end\n \n # Remove old placements.\n if self.placements.size > source_entry.placements.size\n self.placements.each do |target_placement|\n source_category = MovableType::AR::Category.find(:first, :conditions => { :category_blog_id => source_entry.entry_blog_id, :category_label => target_placement.category.category_label })\n if source_category.blank?\n self.placements.delete(target_placement)\n next\n end\n \n source_placement = source_entry.placements.find(:first, :conditions => { :placement_category_id => source_category.category_id })\n self.placements.delete(target_placement) if source_placement.blank?\n end\n end\n \n # Comments need to be synchronized separately (should always flow from production -> beta).\n end\n end", "def set_start_end_dates\n # If the task is a schedule/appointment type then we need to set the start\n #+ and end time for it. We save them in the same fields start_date,\n #+ end_date. The start_time and end_time fields are deprecated and they \n #+ are used as place holders in form. They will be removed from table\n #+ definition.\n # Database migration and rake task is there to change field type for\n #+ start/end date. Now storing time and date in same fields.\n if self.category.eql?(\"appointment\")\n self.start_date = self.start_date_appointment unless self.start_date_appointment.blank?\n self.end_date = self.end_date_appointment unless self.end_date_appointment.blank? \n=begin\n if false && start_date && end_date\n sd = start_date.utc\n ed = end_date.utc\n st = start_time #.in_time_zone\n et = end_time \n p sd, ed, st, et\n self.start_date = DateTime.new(sd.year, sd.month, sd.day, st.hour, st.min, st.sec).utc\n self.end_date = DateTime.new(ed.year, ed.month, ed.day, et.hour, et.min, et.sec) \n p start_date\n p end_date\n end\n=end\n else\n #self.start_date = self.end_date_todo unless self.end_date_todo.blank? #self.start_date_todo unless self.start_date_todo.blank?\n self.start_date = self.start_date_todo unless self.start_date_todo.blank?\n self.end_date = self.end_date_todo unless self.end_date_todo.blank?\n end\n end", "def refresh!\n update_members\n update_owners\n \n # and also update google.\n self.send_later(:update_google_members)\n self.send_later(:update_google_owners)\n \n end", "def fetch\n api_obj.created_at.today? ? sync : self\n end", "def refresh_trip_schedules!\n excluded_dates = exclusion_dates.order(:excluded_date).map(&:excluded_date)\n\n # Try to build a list of valid trip schedules between the two trip\n # boundries\n updated_trip_schedules = [] \n working_date = boundry_start\n while working_date + duration.days < boundry_end do\n potential_start = working_date.to_date\n potential_end = (working_date + duration.days).to_date\n potential_range = (potential_start..potential_end)\n\n # tick the working date\n working_date = working_date + 1.day\n\n # Check trip day of week exclusions\n # next unless potential_range.any? { |date| dow_restriction_indexes.any? { |exclusion| exclusion.include? date.wday }}\n next unless dow_restriction_indexes.any? { |required_dows| required_dows.all? { |required_dow| potential_range.any? { |date| required_dow == date.wday }}}\n\n # Check excluded dates\n next if excluded_dates.any? { |excluded_date| (potential_range).include? excluded_date.to_date }\n\n # Create a trip schedule if it doesn't already exist\n ap potential_start\n updated_trip_schedules << TripSchedule.where(\n :trip => self,\n :start_date => potential_start.in_time_zone('EST'),\n :end_date => potential_end.in_time_zone('EST')\n ).first_or_initialize\n end\n\n self.trip_schedules = updated_trip_schedules\n save!\n end", "def add_google_info(access_token)\n if self.google_id.blank?\n if self.start_time.present? && self.title.present?\n google_event = Google::Event.search_by_date_range(\n access_token,\n self.start_time,\n (self.start_time + 1.minutes),\n self.google_calendar_id\n )\n if !google_event['error'] && items = google_event['data']['items']\n event = items.select{|item| item['title'] == self.title}.first\n if event\n self.details = event['details']\n self.google_id = event['id']\n end\n end\n end\n end\n end", "def update_occurrences\n occurrences.destroy_all\n if recurrence_rules.any?\n recurrence_horizon = Time.now + (Radiant::Config['event_calendar.recurrence_horizon'] || 10).to_i.years\n to_ri_cal.occurrences(:before => recurrence_horizon).each do |occ|\n occurrences.create!(self.attributes.merge(:start_date => occ.dtstart, :end_date => occ.dtend, :uuid => nil)) unless occ.dtstart == self.start_date\n end\n end\n end", "def update_cache_chain\n logger.debug \"DB ********** Touching Event #{id} ********** \"\n self.touch\n self.calendar.try(:update_cache_chain)\n end", "def sync() end", "def sync() end", "def sync() end", "def schedule(startAt,endAt,opts={})\n ## Caching ##\n @schedules ||= {}\n if @schedules[(startAt.xmlschema+endAt.xmlschema+opts.to_s).hash]\n return @schedules[(startAt.xmlschema+endAt.xmlschema+opts.to_s).hash]\n end\n ## End Caching ##\n\n # TODO Handle events starting within the range but ending outside of it?\n\n # TODO Offload this selection to the database; okay for testing though\n # NOTE This is actually faster thanks to the query cache for small numbers of operating times, but not very scalable\n #all_regular_operating_times = OperatingTime.find(:all, :conditions => {:place_id => self.id, :override => 0}).select{|t| (t.startDate - 1) <= endAt.to_date and startAt.to_date <= (t.endDate + 1)}\n #all_special_operating_times = OperatingTime.find(:all, :conditions => {:place_id => self.id, :override => 1}).select{|t| (t.startDate - 1) <= endAt.to_date and startAt.to_date <= (t.endDate + 1)}\n # Select all relevant times (1 day buffer on each end)\n # NOTE Make sure to use generous date comparisons to allow for midnight rollovers\n all_regular_operating_times = OperatingTime.regular.by_place_id(self.id).in_range(startAt..endAt).find(:all)\n all_special_operating_times = OperatingTime.special.by_place_id(self.id).in_range(startAt..endAt).find(:all)\n\n puts \"\\nRegular OperatingTimes: #{all_regular_operating_times.inspect}\" if DEBUG\n puts \"\\nSpecial OperatingTimes: #{all_special_operating_times.inspect}\" if DEBUG\n\n regular_times = []\n special_times = []\n special_ranges = []\n\n all_special_operating_times.each do |ot|\n puts \"\\nSpecial Scheduling for: #{ot.inspect}\" if DEBUG\n\n # Special Case: Overriding with NO times (e.g. closed all day)\n if ot.start == 0 and ot.length == 0 and startAt.to_date <= ot.startDate\n # Block out the range, but don't add the \"null Times\"\n special_ranges << Range.new(ot.startDate,ot.endDate)\n next\n end\n\n # Start a day early if possible\n earlyStart = startAt-1.day < ot.startDate.midnight ? startAt.midnight : startAt - 1.day\n puts \"EarlyStart: #{earlyStart.inspect}\" if DEBUG\n\n # Calculate the next set up open/close times\n open,close = ot.next_times(earlyStart)\n next if open.nil? # No valid occurrences in the future\n\n while not open.nil? and open <= endAt do\n if DEBUG\n puts \"Open: #{open}\"\n puts \"Close: #{close}\"\n puts \"Start Date: #{ot.startDate} (#{ot.startDate.class})\"\n puts \"End Date: #{ot.endDate} (#{ot.endDate.class})\"\n end\n\n if close < startAt # Skip forward to the first occurrance in our time range\n puts \"Seeking: #{close} < #{startAt}\" if DEBUG\n open,close = ot.next_times(close)\n next\n end\n\n special_times << [open,close]\n special_ranges << Range.new(ot.startDate,ot.endDate)\n open,close = ot.next_times(close)\n end\n\n end\n\n puts \"\\nSpecial Times: #{special_times.inspect}\" if DEBUG\n puts \"\\nSpecial Ranges: #{special_ranges.inspect}\" if DEBUG\n\n all_regular_operating_times.each do |ot|\n puts \"\\nRegular Scheduling for: #{ot.inspect}\" if DEBUG\n\n # Start a day early if possible\n earlyStart = startAt-1.day < ot.startDate.midnight ? startAt : startAt - 1.day\n puts \"EarlyStart: #{earlyStart.inspect}\" if DEBUG\n\n # Calculate the next set up open/close times\n open,close = ot.next_times(earlyStart)\n if DEBUG\n puts \"\"\n puts \"Open: #{open}\"\n puts \"Close: #{close}\"\n end\n\n if open.nil? # No valid occurrences in the future\n puts \"Skipping: No valid occurrences in the future.\" if DEBUG\n next\n end\n\n while not open.nil? and open <= endAt do\n if DEBUG\n puts \"\"\n puts \"Open: #{open}\"\n puts \"Close: #{close}\"\n end\n\n if close < startAt # Skip forward to the first occurrance in our time range\n puts \"Seeking: #{close} < #{startAt}\" if DEBUG\n open,close = ot.next_times(close)\n next\n end\n\n overridden = false\n special_ranges.each do |sr|\n overridden ||= sr.member?(open.to_date)\n end\n if overridden\n puts \"Overridden\" if DEBUG\n open,close = ot.next_times(close)\n next\n end\n\n # FIXME Causing an infinite loop; would be nice if this worked\n #open = startAt if open < startAt\n #close = endAt if close > endAt\n\n regular_times << [open,close]\n open,close = ot.next_times(close)\n end\n\n end\n\n puts \"\\nRegular Times: #{regular_times.inspect}\" if DEBUG\n\n # TODO Handle schedule overrides\n # TODO Handle combinations (i.e. part special, part regular)\n\n final_schedule = (regular_times+special_times).sort{|a,b|a[0] <=> b[0]}\n\n ## Truncate times larger than range ##\n if opts[:truncate]\n final_schedule.each_index do |i|\n final_schedule[i][0] = startAt.dup if final_schedule[i][0] < startAt\n final_schedule[i][1] = endAt.dup if final_schedule[i][1] > endAt\n end\n end\n ## End truncating ##\n\n ## Caching ##\n @schedules ||= {}\n @schedules[(startAt.xmlschema+endAt.xmlschema+opts.to_s).hash] = final_schedule\n ## End caching ##\n\n final_schedule\n end", "def sync_to_attendance_item\n if self.shift_id.to_i > 0\n att_item = AttendanceItem.find_or_create_by(roster_item_id: self.id)\n att_item.user = self.user\n att_item.position = self.user.position\n att_item.department = self.user.department\n att_item.shift_id = self.shift_id\n\n time_arr = self.class.caculate_time(self.date, self.shift.start_time, self.shift.end_time)\n\n att_item.plan_start_time = time_arr[:start_time]\n att_item.plan_end_time = time_arr[:end_time]\n att_item.attendance_date = self.date\n\n att_item.region = self.roster.region\n att_item.location_id = self.roster.location_id\n\n att_item.save\n\n elsif self.shift_id.to_i == 0\n #固定班\n if self.state.to_sym == :fixed\n att_item = AttendanceItem.find_or_create_by(roster_item_id: self.id)\n att_item.user = self.user\n att_item.position = self.user.position\n att_item.department = self.user.department\n att_item.shift_id = self.shift_id\n\n att_item.plan_start_time = self.date.saturday? || self.date.sunday? ? nil : self.start_time\n att_item.plan_end_time = self.date.saturday? || self.date.sunday? ? nil : self.end_time\n # att_item.plan_end_time = self.end_time\n att_item.attendance_date = self.date\n\n att_item.region = self.roster.region\n att_item.location_id = self.roster.location_id\n\n att_item.save\n\n # 重新排班后删除休息\n elsif self.state.to_sym == :holiday\n att_item = AttendanceItem.find_or_create_by(roster_item_id: self.id)\n att_item.user = self.user\n att_item.position = self.user.position\n att_item.department = self.user.department\n att_item.shift_id = self.shift_id\n att_item.attendance_date = self.date\n att_item.region = self.roster.region\n att_item.location_id = self.roster.location_id\n att_item.leave_type = self.leave_type\n\n att_item.plan_start_time = nil\n att_item.plan_end_time = nil\n\n att_item.save\n # att_item.delete if att_item\n else\n att_item = AttendanceItem.find_or_create_by(roster_item_id: self.id)\n att_item.user = self.user\n att_item.position = self.user.position\n att_item.department = self.user.department\n att_item.shift_id = -1\n\n att_item.attendance_date = self.date\n\n att_item.region = self.roster.region\n att_item.location_id = self.roster.location_id\n\n att_item.save\n end\n\n end\n end", "def search_for_future_calendar_events\n uri = URI.parse(\"https://www.googleapis.com/calendar/v3/calendars/ufbobbo%40gmail.com/events?orderBy=startTime&singleEvents=true&timeMin=#{Time.now.strftime(\"%FT%T%:z\")}&fields=items(id%2Cstart)&key=#{ENV['GOOGLE_API_KEY']}\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request).body\n end", "def update_cache(lastupdate)\n client = TheTvDbParty::Client.new(ENV['TVDB_API_KEY'])\n timeDelta = (Time.new()-lastupdate).to_i\n timeframe = \"day\"\n if timeDelta>86400\n timeframe = \"week\"\n if timeDelta>604800\n timeframe = \"month\"\n if timeDelta>2592000\n timeframe = \"all\"\n end\n end\n end\n update = client.get_updates_by_timeframe(timeframe)\n subscribedSeries = Array.new\n SeriesSubscription.all.group(:seriesid).find_each do |series|\n subscribedSeries.push(series.seriesid)\n end\n seriesToUpdate = Array.new\n # Look at the edited series and add them to our update list\n for series in update.series\n if(series[:updatetime].to_i>lastupdate && subscribedSeries.index(series[:seriesid].to_i).nil? == false)\n seriesToUpdate.push(series[:seriesid])\n end\n end\n if(update.episodes.nil? == false )\n # Look at the edited episodes and determine if we should update their series\n for episode in update.episodes\n if(episode[:updatetime].to_i>lastupdate && subscribedSeries.index(episode[:seriesid].to_i).nil? == false && seriesToUpdate.index(episode[:seriesid]).nil? == true)\n seriesToUpdate.push(episode[:seriesid])\n end\n end\n end\n\n for seriesid in seriesToUpdate\n # Get information about the show\n full_record = client.get_series_all(seriesid).full_series_record\n seriesInformation = SeriesInformation.find_by seriesid: seriesid\n if(seriesInformation.nil?)\n seriesInformation = new_series_information_from_series_record(full_record)\n end\n changed = false\n if(seriesInformation.seriesname != full_record.seriesname)\n seriesInformation.seriesname = full_record.seriesname\n changed = true\n end\n if(seriesInformation.overview != full_record.overview)\n seriesInformation.overview = full_record.overview\n changed = true\n end\n if(seriesInformation.genres != full_record.genres)\n seriesInformation.genres = full_record.genres\n changed = true\n end\n if(changed)\n seriesInformation.save\n end\n # Remove all episodes we have about the show\n EpisodeInformation.where(seriesid: seriesid).destroy_all\n \n # Go through the data and add in new episodes\n for j in 1..(full_record.episodes.length)\n if(full_record.episodes[full_record.episodes.length-j].firstaired)\n if(full_record.episodes[full_record.episodes.length-j].firstaired > Date.today.prev_day)\n # If we find an episode which hasn't aired yet, or airs today, add it to the list.\n new_episode_information_from_episode_record(full_record.episodes[full_record.episodes.length-j])\n else\n # As we go backwards through the episodes array we can break on the first episode which has already aired\n break\n end\n end\n end\n end\n end", "def patch_calendar_list(opts = {})\n update_calendar_list\n end", "def fix_dates( data )\n\n ## check for missing / no dates \n ## examples\n ## - rubytogether feed @ https://rubytogether.org/news.xml\n data.items.each do |item|\n if item.updated.nil? &&\n item.published.nil?\n ## try to get date from slug in url\n ## e.g. /news/2019-10-17-growing-ruby-together\n if (m=FIX_DATE_SLUG_RE.match( item.url ))\n ## todo/fix: make sure DateTime gets utc (no timezone/offset +000)\n published = DateTime.new( m[:year].to_i(10),\n m[:month].to_i(10),\n m[:day].to_i(10) )\n item.published_local = published\n item.published = published\n end\n end\n end\n\n \n ## check if all updated dates are the same (uniq count is 1)\n ## AND if all published dates are present\n ## than assume \"fake\" updated dates and nullify updated dates\n ## example real-world \"messed-up\" feeds include:\n ## - https://bundler.io/blog/feed.xml\n ## - https://dry-rb.org/feed.xml\n ##\n ## todo/check - limit to atom feed format only - why? why not?\n\n count = data.items.size\n count_published = data.items.reduce( 0 ) {|count,item| count += 1 if item.published; count }\n\n if count == count_published\n uniq_count_updated = 0\n last_updated = nil\n\n data.items.each do |item|\n uniq_count_updated += 1 if item.updated != last_updated\n last_updated = item.updated\n end\n\n if uniq_count_updated == 1\n puts \"bingo!! nullify all updated dates\"\n ## todo/fix: log report updated date fix!!!!\n data.items.each do |item|\n item.updated = nil\n item.updated_local = nil\n end\n end\n end\n end", "def sync; end", "def refresh_if_near_expiration; end", "def find_or_create!()\n event_order = @last_event_order\n @source_dao.meeting_events.each_with_index do |event, index|\n add_to_log( \"\\r\\nProcessing event #{ event.get_full_name }...\" )\n event_type_id = if event.instance_of?( MeetingEvent )\n add_to_log( \"Previosly detected as event_type_id: #{ event.event_type_id }.\" )\n event.event_type_id\n elsif event.instance_of?( FinCalendarParseResultDAO::EventTypeDAO )\n event_type = create_new_event_type( event )\n add_to_log( \"Created new event_type: #{ event_type.inspect }.\" )\n event_type.id\n end\n # Prepare MeetingEvent requires:\n meeting_session_id = @meeting_session.id\n event_type_id = event_type_id\n event_order += index + 1 # (We'll set the event_order as cumulative among all sessions)\n\n # [Steve, 20170920] We cannot safely detect the begin time from the start time\n # of the session here. (We need the entries, at least.)\n #\n # So this has been removed permanently from the search below:...\n #\n # begin_time = @source_dao.start_time_iso_format\n #\n # ...Together with the check for a change in the begin time, which resulted in\n # continuous event updates:\n #\n # ( begin_time.present? &&\n # Format.a_time( meeting_event.begin_time ) != Format.a_time( begin_time ) )\n\n # --- SEARCH #1: find pre-existing event ---\n meeting = @meeting_session.meeting\n add_to_log( \"Searching meeting Event n.#{ event_order }: #{ event.get_full_name } (type: #{ event_type_id }) among existing events for meeting #{ meeting.id }...\" )\n meeting_event = meeting.meeting_events.where( event_type_id: event_type_id ).first\n # Match found?\n if meeting_event.instance_of?( MeetingEvent )\n add_to_log( \"Meeting Event found! => #{ meeting_event.inspect }\" )\n # --- UPDATE ---\n # Force update of the found instance with the correct values if there are\n # any differences (except user_id):\n # (If the found MeetingEvent belongs to a different session, it will be \"moved\"\n # to the one specified in the constructor)\n if ( meeting_event.heat_type_id.to_i < 1 ) ||\n ( meeting_event.meeting_session_id != meeting_session_id )\n meeting_event = update_existing( meeting_event, meeting_session_id, event_order, nil, event_type_id )\n end\n # --- CREATION ---\n else\n meeting_event = create_new( meeting_session_id, event_order, @source_dao.start_time_iso_format, event_type_id )\n end\n # Add the created/updated event row to the list:\n @result_meeting_events << meeting_event\n end\n\n @last_event_order = event_order\n @result_meeting_events\n end", "def update\n # avoids API call when only color is changed\n if (@task.changed_only_color(task_params))\n @task.color = task_params[\"color\"]\n return @task.save\n end\n @task.start = task_params[\"start\"].to_time.utc\n @task.end = task_params[\"end\"].to_time.utc\n # normal event dragged to all-day zone\n if (@task.start == @task.end && @task.start.localtime == @task.start.localtime.midnight)\n @task.end = @task.start + 1.days\n # all-day event dragged to normal zone\n elsif (@task.start == @task.end)\n @task.end = @task.start + 1.hours\n end\n @task.title = task_params[\"title\"]\n @task.description = task_params[\"description\"]\n # only change color if new color specified\n if !task_params[\"color\"].nil?\n @task.color = task_params[\"color\"]\n end\n # For Google API POST request\n event = @service.get_event(\"primary\", @task.google_id)\n event.summary = @task.title\n event.start = {date_time: @task.start.localtime.iso8601}\n event.end = {date_time: @task.end.localtime.iso8601}\n event.description = @task.description\n event = @service.update_event(\"primary\", @task.google_id, event)\n @task.save\n end", "def update_if_necessary\n # we should have a counter stat already if it got to this class\n # only update stats if it's after the date of the last updated date for record\n return unless new_record? || updated_at.nil? || Time.new.localtime.to_date > updated_at.localtime.to_date\n update_usage!\n update_citation_count!\n\n self.updated_at = Time.new # seem to need this for some reason\n\n save!\n end", "def update_class(aclass, adbclass)\n #I honestly don't know why I did it this way. It isn't very DRY. There must be a reason, so tinker with caution.\n begin\n lastcreated = adbclass.find(:first, :order => 'created_date desc')\n lastmodified = adbclass.find(:first, :order => 'last_modified_date desc')\n for aobj in aclass.find(:all, :limit => 0, :conditions => 'createddate > ' + (lastcreated.created_date - 18000).to_s(:iso_8601_special))\n scrape(aobj, aclass, adbclass)\n end\n for aobj in aclass.find(:all, :limit => 0, :conditions => 'lastmodifieddate > ' + (lastmodified.last_modified_date - 18000).to_s(:iso_8601_special))\n adbclass.delete(aobj.id)\n scrape(aobj, aclass, adbclass)\n end\n rescue\n begin\n lastcreated = adbclass.find(:first, :order => 'created_date desc')\n lastmodified = adbclass.find(:first, :order => 'last_modified_date desc')\n for aobj in aclass.find(:all, :limit => 0, :conditions => 'created_date > ' + (lastcreated.created_date - 18000).to_s(:iso_8601_special))\n scrape(aobj, aclass, adbclass)\n end\n for aobj in aclass.find(:all, :limit => 0, :conditions => 'last_modified_date > ' + (lastmodified.last_modified_date - 18000).to_s(:iso_8601_special))\n adbclass.delete(aobj.id)\n scrape(aobj, aclass, adbclass)\n end\n rescue\n puts \"Skipping \" + aclass.to_s\n end\n end\n end", "def synchronize_reservations_before_save\n\t\t\t\t\tif !self.is_recurring?\n\t\t\t\t\t\tself.reservations(self.date_from_was).each do |reservation|\n\t\t\t\t\t\t\treservation.date_from = self.date_from\n\t\t\t\t\t\t\treservation.date_to = self.date_to\n\t\t\t\t\t\t\treservation.time_from = self.time_from\n\t\t\t\t\t\t\treservation.time_to = self.time_to\n\t\t\t\t\t\t\treservation.save\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\t# TODO how to solve it for recurring events ???\n\t\t\t\t\tend\n\t\t\t\tend", "def index\n if (Time.now - @@last_gcalendar_update).to_i > 3600\n Thread::start do\n load_events_from_calendar(\"/calendar/ical/enkarplan.org_j2njaqb2eapip42l32br00afgo%40group.calendar.google.com/public/basic.ics\")\n \n load_events_from_calendar(\"/calendar/ical/enkarplan.org_bhfbtue1pklla91t4u97m9ggno%40group.calendar.google.com/public/basic.ics\")\n \n load_events_from_calendar(\"/calendar/ical/enkarplan.org_5up3mopev5gkg9k17rcijrj0p4%40group.calendar.google.com/public/basic.ics\")\n end\n end\n \n if params[:near]\n near = params[:near].split(',')\n latitude = near[0].to_f\n longitude = near[1].to_f\n \n params[:page] = params[:page] || 0\n params[:limit] = params[:limit] || 10\n \n @pois = Poi.find_by_sql [\"select *, abs(latitude-(?))+abs(longitude-(?)) as 'distance' from pois order by distance asc limit ?, ?;\", latitude, longitude, (params[:page].to_i - 1) * params[:limit].to_i, params[:limit].to_i]\n else\n @pois = Poi.order('created_at desc').page(params[:page]).per(params[:limit] || 10) \n end\n \n if params[:type]\n @pois = @pois.where('poi_type_id = ?', params[:type])\n end\n \n if params[:search]\n search = \"%\" + params[:search].sub(\" \", \"%\") + \"%\"\n @pois = @pois.where('title like ? OR title_eu like ?', search, search)\n end\n \n @verfied = Poi.where('is_verified = ?', true)\n @top_pois = Poi.order('rating desc').limit(4)\n @last_pois = Poi.order('created_at desc').limit(4)\n @next_events = Event.where('ends_at > ?', Time.now).order('starts_at asc').limit(8)\n @last_photos = Photo.where(is_visible_on_index: true).order('created_at desc').limit(8)\n @last_comments = Comment.order('created_at desc').limit(10)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pois }\n end\n end", "def adjust(start,finish)\n @start=DateTime.new(start.year,start.month,start.day)\n @finish=DateTime.new(finish.year,finish.month,finish.day)\n refresh\n end", "def replay_oplog_and_sync(namespace, start_ts, end_ts, wait, &block)\n # Lock usage:\n # 1. calls dump_and_sync\n # 2. calls update_and_sync\n\n if start_ts.nil? then\n dump_and_sync(namespace, wait, &block)\n elsif compare_bson_ts(start_ts, end_ts) == -1 then\n result = nil\n\n doc = retry_until_ok do\n result = @oplog_coll.find({ \"ns\" => namespace,\n \"ts\" => { \"$gte\" => start_ts, \"$lte\" => end_ts }},\n { :sort => [\"$natural\", :asc] })\n result.next_document\n end\n\n if (doc.nil? or start_ts != doc[\"ts\"]) then\n # Timestamp is too old that the oplog entry for it is not available anymore\n dump_and_sync(namespace, wait, &block)\n else\n update_and_sync(namespace, result.to_a, wait, &block)\n end\n else\n # No new ops since last update on Solr. Advance to the end timestamp.\n retry_until_ok { @config_writer.update_timestamp(namespace, end_ts) }\n end\n end", "def events_from_big_query_for_repo_in_date_range(owner_name, repo_name, start_date_string, end_date_string)\n return @events if @events\n\n query_string = events_query_string(owner_name, repo_name, start_date_string, end_date_string)\n\n json = fetch_query(query_string)\n @events = json\n\n # clear_event_memoizations\n end", "def for_update\n cached_dataset(:_for_update_ds){lock_style(:update)}\n end", "def sync_records(data)\n params = data.symbolize_keys\n model_class = params[:model_name].safe_constantize\n\n if model_class && model_class < ApplicationRecord\n is_being_reloaded = params[:stale_since].blank?\n is_being_synced = params[:stale_since].present?\n\n active_record_relation = LiveRecord::BaseChannel::SearchAdapters.mapped_active_record_relation(\n model_class: model_class,\n conditions_hash: params[:where].to_h,\n current_user: current_user,\n )\n\n if is_being_synced\n active_record_relation = active_record_relation.where(\n 'updated_at >= ?', DateTime.parse(params[:stale_since]) - LiveRecord.configuration.sync_record_buffer_time\n )\n end\n\n # we `transmmit` a message back to client for each matching record\n active_record_relation.find_each do |record|\n # but first, check for the authorised attributes, if exists\n whitelisted_attributes = LiveRecord::BaseChannel::Helpers.whitelisted_attributes(record, current_user)\n\n if whitelisted_attributes.size > 0\n message = { 'action' => 'createOrUpdate', 'attributes' => record.attributes }\n response = filtered_message(message, whitelisted_attributes)\n transmit response if response.present?\n end\n end\n\n # if being reloaded, we finally still transmit a \"done\" action indicating that reloading has just finished\n if is_being_reloaded\n response = { 'action' => 'afterReload', 'recordIds' => active_record_relation.pluck(:id) }\n transmit response\n end\n else\n respond_with_error(:bad_request, 'Not a correct model name')\n reject_subscription\n end\n end", "def create_google_calendar\n unless self.apps_cal_id\n result = Gandalf::GoogleApiClient.insert_google_calendar({\n \"summary\" => self.name\n })\n self.apps_cal_id = result.data.id\n self.save!\n end\n end", "def reload_after_odata(options = nil)\n # aggregations.rb\n clear_aggregation_cache\n\n # autosave_association.rb\n @marked_for_destruction = false\n @destroyed_by_association = nil\n\n # associations.rb\n clear_association_cache\n\n # persistence.rb (only 1 line of code chaned in here)\n self.class.connection.clear_query_cache\n\n fresh_object =\n if options && options[:lock]\n self.class.unscoped { self.class.lock(options[:lock]).find(id) }\n else\n # Remove unscope here\n self.class.find(id)\n end\n\n @attributes = fresh_object.instance_variable_get(\"@attributes\")\n @new_record = false\n\n # attribute_methods/dirty.rb\n @previous_mutation_tracker = nil\n clear_mutation_trackers\n @changed_attributes = ActiveSupport::HashWithIndifferentAccess.new\n\n self\n end", "def get_google_calendar\n result = Gandalf::GoogleApiClient.get_google_calendar(self.apps_cal_id)\n result.data\n end", "def add_event(doc, n, *args)\r\n# p 'Add event ' + args[1][0..199]\r\n new_event = CalendarEvent.find_or_initialize_by_pageextsourceID(:pageextsourceID => doc.xpath(\"//item//id\")[n].text, \r\n :event_type => 'ce', :event_title => args[1][0..199],\r\n :cbody => doc.xpath(\"//item//description\")[n].text, \r\n :postdate => DateTime.parse(doc.xpath(\"//item//pubDate\")[n].text),\r\n :eventstartdate => args[2], :eventstarttime => args[2], :eventenddate => args[3], :eventendtime => args[3],\r\n :contentsourceURL => args[5][0..99], \r\n :location => doc.xpath(\"//item//xCal:location\")[n].text,\r\n :mapplacename => doc.xpath(\"//item//xCal:adr//xCal:x-calconnect-venue-name\")[n].text[0..59],\r\n :mapstreet => doc.xpath(\"//item//xCal:adr//xCal:x-calconnect-street\")[n].text[0..39],\r\n :mapcity => doc.xpath(\"//item//xCal:adr//xCal:x-calconnect-city\")[n].text[0..39],\r\n :mapstate => doc.xpath(\"//item//xCal:adr//xCal:x-calconnect-region\")[n].text[0..24],\r\n :mapzip => doc.xpath(\"//item//xCal:adr//xCal:x-calconnect-postalcode\")[n].text[0..9],\r\n :mapcountry => doc.xpath(\"//item//xCal:adr//xCal:x-calconnect-country\")[n].text[0..39],\r\n :contactphone => doc.xpath(\"//item//phone\")[n].text[0..14],\r\n :contentsourceID => args[4], :localGMToffset => args[6], :endGMToffset => args[6],\r\n :subscriptionsourceID => args[4]) \r\n new_event.longitude, new_event.latitude = doc.xpath(\"//item//geo:long\")[n].text.to_f, doc.xpath(\"//item//geo:lat\")[n].text.to_f \r\n new_event.imagelink = doc.xpath(\"//item//images//url\")[n].text rescue nil\r\n new_event.save(:validate=>false)\r\n end", "def update_relatives_dates\n return if new_record?\n return unless force_relatives_dates\n return unless starts_at_changed? || ends_at_changed?\n return unless recurrence.present?\n return unless future_relatives.any?\n\n future_relatives.each do |outing|\n outing.assign_attributes(metadata: outing.metadata.merge({\n starts_at: outing.metadata[:starts_at] + (self.metadata[:starts_at] - starts_at_was),\n ends_at: outing.metadata[:ends_at] + (self.metadata[:ends_at] - ends_at_was)\n }))\n end\n end", "def update_object_cache\n in_object = false\n objects = {}\n data = {}\n type = \"\"\n File.open(self.objects_path, \"r\").readlines.each { |line|\n line = line.strip\n if line =~ %r{^define (\\w+) .*}\n type = $1\n in_object = true\n data = {}\n if objects[type].nil?\n objects[type] = []\n end\n else\n if in_object == true\n if line == \"}\"\n in_object = false\n objects[type] << data\n else\n chunks = line.squeeze(' ').split(' ')\n data[chunks.first] = chunks[1..-1].join(' ')\n end\n end\n end\n }\n \n objects[\"contact\"].each { |contact|\n namespace = \"bluster:objects:contact:#{contact['contact_name']}\"\n contact.keys.each { |key|\n self.redis.set(\"#{namespace}:#{key}\", contact[key]) if key != \"contact_name\"\n }\n }\n \n objects[\"command\"].each { |command|\n namespace = \"bluster:objects:command:#{command['command_name']}\"\n command.keys.each { |key|\n self.redis.set(\"#{namespace}:#{key}\", command[key]) if key != \"command_name\"\n }\n }\n \n self.redis.set(\"bluster:last_update_timestamp\", File.new(self.objects_path).mtime.to_i)\n end", "def regenerate?\n outdated? ||\n updated_at < sheet.updated_at ||\n updated_at < sheet.design.updated_at ||\n updated_at < sheet.project.updated_at ||\n updated_at < Time.zone.today - 1.hour\n end", "def update_event(org_unit_id, event_id, event_data)\n # PUT /d2l/api/le/#{$le_ver}/#{org_unit_id}/calendar/event/#{event_id}\n path = \"/d2l/api/le/#{$le_ver}/#{org_unit_id}/calendar/event/#{event_id}\"\n payload = { # Calendar.EventDataInfo\n \"Title\" => \"\",\n \"Description\" => \"\",\n \"StartDateTime\" => nil, # UTCDateTime || nil\n \"EndDateTime\" => nil, # UTCDateTime || nil\n \"StartDay\" => nil, # LocalDateTime || nil\n \"EndDay\" => nil, # LocalDateTime || nil\n \"GroupId\" => nil, # D2LID || nil\n \"RecurrenceInfo\" => # Calendar.RecurrenceInfo\n {\n \"RepeatType\" => 0, # number -- repeat type\n \"RepeatEvery\" => 0, # number\n \"RepeatOnInfo\" => # Calendar.RepeatOnInfo\n {\n \"Monday\" => false, # boolean\n \"Tuesday\" => false, # boolean\n \"Wednesday\" => false, # boolean\n \"Thursday\" => false, # boolean\n \"Friday\" => false, # boolean\n \"Saturday\" => false, # boolean\n \"Sunday\" => false, # boolean\n },\n \"RepeatUntilDate\" => \"\" # UTCDATETIME\n },\n \"HasVisibilityRestrictions\" => false,\n \"VisibilityRestrictions\" => # Calendar.VisibilityInfo\n {\n \"Type\" => 0, # <number:VISIBILITY_T>,\n \"Range\" => nil, # <number>|null,\n \"HiddenRangeUnitType\" => nil, # <number:HIDDENUNIT_T>|null,\n \"StartDate\" => nil, # <string:UTCDateTime>|null,\n \"EndDate\" => nil # <string:UTCDateTime>|null,\n },\n \"CalendarEventViewUrl\" => \"\" # String:URL\n }.merge!(event_data)\n check_calendar_event_data_validity(payload) # NOTE: Test later\n _put(path, payload)\nend", "def check_for_changes_affecting_cached_coverage\n overlap = %w(branching_logic position) & previous_changes.keys\n return if overlap.empty?\n\n design.touch :coverage_cache_busted_at\n end", "def touch_mtime_of_anyone_related_to(obj)\n now = Time.now\n\n relationships.map do |relationship_defn|\n models = relationship_defn.participating_models\n\n # If this relationship doesn't link to records of type `obj`, we're not\n # interested.\n next unless models.include?(obj.class)\n\n their_ref_columns = relationship_defn.reference_columns_for(obj.class)\n my_ref_columns = relationship_defn.reference_columns_for(self)\n their_ref_columns.each do |their_col|\n my_ref_columns.each do |my_col|\n\n # This one type of relationship (between the software agent and\n # anything else) was a particular hotspot when analyzing real-world\n # performance.\n #\n # Terrible to have to do this, but the MySQL optimizer refuses\n # to use the primary key on agent_software because it (often)\n # only has one row.\n #\n if DB.supports_join_updates? &&\n self.table_name == :agent_software &&\n relationship_defn.table_name == :linked_agents_rlshp\n\n DB.open do |db|\n id_str = Integer(obj.id).to_s\n\n db.run(\"UPDATE `agent_software` FORCE INDEX (PRIMARY) \" +\n \" INNER JOIN `linked_agents_rlshp` \" +\n \"ON (`linked_agents_rlshp`.`agent_software_id` = `agent_software`.`id`) \" +\n \"SET `agent_software`.`system_mtime` = NOW() \" +\n \"WHERE (`linked_agents_rlshp`.`archival_object_id` = #{id_str})\")\n end\n\n return\n end\n\n # Example: if we're updating a subject record and want to update\n # the timestamps of any linked archival object records:\n #\n # * self = ArchivalObject\n # * relationship_defn is subject_rlshp\n # * obj = #<Subject instance that was updated>\n # * their_col = subject_rlshp.subject_id\n # * my_col = subject_rlshp.archival_object_id\n\n\n # Join our model class table to the relationship that links it to `obj`\n #\n # For example: join ArchivalObject to subject_rlshp\n # join Instance to instance_do_link_rlshp\n base_ds = self.join(relationship_defn.table_name,\n Sequel.qualify(relationship_defn.table_name, my_col) =>\n Sequel.qualify(self.table_name, :id))\n\n # Limit only to the object of interest--we only care about records\n # involved in a relationship with the record that was updated (obj)\n base_ds = base_ds.filter(Sequel.qualify(relationship_defn.table_name, their_col) => obj.id)\n\n # Now update the mtime of any top-level record that links to that\n # relationship.\n self.update_toplevel_mtimes(base_ds, now)\n end\n end\n end\n end", "def load_cached\n if Cache.has?(@course_id)\n events = Cache.get(@course_id)\n init_calendar\n add_to_calendar(events)\n true\n else\n false\n end\n rescue\n false\n end", "def request_events(access_token, my_email, calendar_id, calendar_zone)\n service = build_service(access_token)\n\n # Return each google api calendar as an ActiveRecord Calendar model\n events = get_calendar_events(service, calendar_id).map do |item|\n upsert_service_event_item(my_email, calendar_zone, item)\n end\n\n # upsert_service_event_item sometimes returns nils, when an event doesn't\n # get made\n events.reject(&:nil?)\n end", "def set_doe_util_changes\n\n # there is no bldg_id column for sca projects\n buildings = self.school_buildings\n\n buildings_ids_array = buildings.map {|b| b['bldg_id']}.uniq\n\n doe_significant_utilization_changes = CeqrData::DoeSignificantUtilizationChanges.version(\n data_package.table_for(\"doe_significant_utilization_changes\")\n ).doe_util_changes_matching_with_building_ids(buildings_ids_array)\n\n self.doe_util_changes = doe_significant_utilization_changes.map do |d|\n {\n url: d[:url],\n title: d[:title],\n org_id: d[:org_id],\n bldg_id: d[:bldg_id],\n vote_date: d[:vote_date],\n at_scale_year: d[:at_scale_year],\n at_scale_enroll: d[:at_scale_enroll],\n bldg_id_additional: d[:bldg_id_additional]\n }\n end\nend", "def upsert_service_calendar_item(item)\n Calendar.where(external_id: item['Id']).first_or_create do |calendar|\n calendar.name = item['Name']\n # calendar.time_zone = 'Etc/UTC'\n end\n end", "def add(is_full_flush)\n content_data = $local_content_data\n return if content_data.empty?\n\n # for the latest content data added to the DB\n latest_snapshot = nil\n # for instances that were added regarding latest_snapshot\n added_cd = nil\n # for insrances that were removed regarding latest_snapshot\n removed_cd = nil\n\n latest_index_time = nil\n content_data.each_instance do |_,_,_,_,_,_,index_time|\n if latest_index_time.nil? || latest_index_time < index_time.to_i\n latest_index_time = index_time.to_i\n end\n end\n\n # Checking time consistency\n content_data_timestamp = DateTime.from_epoch(latest_index_time)\n if !@latest_timestamp.nil? && (content_data_timestamp <= @latest_timestamp)\n # It is possible when instances added at @latest_timestamp\n # were removed and any new instances addded,\n # then latest indexed time in the new content data\n # is earlier then @latest_timestamp\n # Example:\n # ContentData for Date1 (noted as latest_snapshot):\n # Content1\n # location1\n # location2\n # Between Date1 and Date2 location2 was removed\n # and no other file operations were done.\n # ContentData for Date2 (noted as content_data):\n # Content1\n # location1\n # Then:\n # content_data.remove_instances(latest_snapshot) is empty.\n latest_snapshot = get(@latest_timestamp)\n added_cd = content_data.remove_instances(latest_snapshot)\n msg = \"latest index time of the content data: #{content_data_timestamp}\" +\n \"must be later then latest timestamp: #{latest_timestamp}\"\n if added_cd.empty?\n # In this case we do not know exactly when the indexation was\n # then the timestamp is fake\n # TODO better solution?\n latest_timestamp_epoch = @latest_timestamp.strftime('%s')\n content_data_timestamp = DateTime.from_epoch(latest_timestamp_epoch.to_i + 1)\n Log.warning msg\n else\n fail msg\n end\n end\n\n if is_full_flush\n save(content_data,\n DiffFile::SNAPSHOT_TYPE,\n nil, # 'from' param is not relevant for full flush\n content_data_timestamp)\n end\n\n # If it is not the first content data that we store,\n # i.e there are already stored content data,\n # then a diff files are relevant.\n # NOTE we save diff (added/removed) files even in the case of full flush\n # cause of data consistency. It is crucial for the diff operation.\n # Example (simple, without removed):\n # When:\n # date1-date2.added\n # date2-date3.added (added along with a snapshot)\n # date3.snapshot\n # date3-date4.added\n # Then:\n # ContentDataDb.diff(date2, date4) = date2-date3.added + date3-date4.added\n if @latest_timestamp.nil?\n earliest_index_time = nil\n content_data.each_instance do |_,_,_,_,_,_,index_time|\n if earliest_index_time.nil? || earliest_index_time > index_time\n earliest_index_time = index_time\n end\n end\n content_data_from = DateTime.from_epoch(earliest_index_time)\n save(content_data,\n DiffFile::ADDED_TYPE,\n content_data_from,\n content_data_timestamp)\n else\n latest_snapshot ||= get(@latest_timestamp)\n\n added_cd ||= content_data.remove_instances(latest_snapshot)\n unless added_cd.empty?\n save(added_cd,\n DiffFile::ADDED_TYPE,\n @latest_timestamp,\n content_data_timestamp)\n end\n\n removed_cd = latest_snapshot.remove_instances(content_data)\n unless removed_cd.empty?\n save(removed_cd,\n DiffFile::REMOVED_TYPE,\n @latest_timestamp,\n content_data_timestamp)\n end\n end\n\n @latest_timestamp = content_data_timestamp\n end", "def sync_records(data)\n params = data.symbolize_keys\n model_class = params[:model_name].safe_constantize\n\n if model_class && model_class < ApplicationRecord\n is_being_reloaded = params[:stale_since].blank?\n is_being_synced = params[:stale_since].present?\n\n active_record_relation = LiveRecord::BaseChannel::SearchAdapters.mapped_active_record_relation(\n model_class: model_class,\n conditions_hash: params[:where].to_h,\n current_user: current_user,\n )\n\n if is_being_synced\n active_record_relation = active_record_relation.where(\n 'created_at >= ?', DateTime.parse(params[:stale_since]) - LiveRecord.configuration.sync_record_buffer_time\n )\n end\n\n # we `transmmit` a message back to client for each matching record\n active_record_relation.find_each do |record|\n # but first, check for the authorised attributes, if exists\n whitelisted_attributes = LiveRecord::BaseChannel::Helpers.whitelisted_attributes(record, current_user)\n\n if whitelisted_attributes.size > 0\n message = { 'action' => 'create', 'attributes' => record.attributes }\n response = filtered_message(message, whitelisted_attributes)\n transmit response if response.present?\n end\n end\n\n # if being reloaded, we finally still transmit a \"done\" action indicating that reloading has just finished\n if is_being_reloaded\n response = { 'action' => 'afterReload', 'recordIds' => active_record_relation.pluck(:id) }\n transmit response\n end\n else\n respond_with_error(:bad_request, 'Not a correct model name')\n reject_subscription\n end\n end", "def reset_local_range(start_date, end_date)\n if start_date.is_a?(Date) && end_date.is_a?(Date)\n @local_range = start_date.to_time.change(:hour => 6, :min => 30)..end_date.to_time.change(:hour => 6, :min => 30)\n elsif local_range.begin.acts_like_time? && local_range.end.acts_like_time?\n @local_range = start_date...end_date\n else\n raise ArgumentError, \"args must either be dates or times\"\n end\n if local_range.begin < begin_time or local_range.end > end_time\n logger.info \"reloading Timeseries #{symbol} #{local_range.begin.to_formatted_s(:ymd)} < #{begin_time.to_formatted_s(:ymd)} *OR* \"+\n \"#{local_range.end.to_formatted_s(:ymd)} > #{end_time.to_formatted_s(:ymd)}\"\n populate()\n puts \"repopulating timeseries on reset_local_range #{start_date}..#{end_date}\"\n else\n map_local_range()\n end\n end", "def sync_availability\n room_type = self.room_type\n property = self.room_type.property\n pool = PropertyChannel.find_by_channel_id_and_property_id(self.channel.id, property.id).pool\n\n room_type_to_use = room_type\n if room_type.is_inventory_linked?\n room_type_to_use = room_type.linked_room_type\n end\n\n logs = Array.new\n loop_date = DateTime.now.in_time_zone.beginning_of_day\n\n # loop until 400th day\n while loop_date <= Constant.maximum_end_date\n existing_inv = Inventory.find_by_date_and_property_id_and_pool_id_and_room_type_id(loop_date, property.id, pool.id, room_type_to_use.id)\n\n if !existing_inv.blank?\n logs << InventoryNewRoomLog.create_inventory_new_room_log(existing_inv)\n else\n inventory = Inventory.new\n inventory.date = loop_date\n inventory.total_rooms = 0\n inventory.room_type_id = room_type_to_use.id\n inventory.property = property\n inventory.pool_id = pool.id\n\n inventory.save\n\n logs << InventoryNewRoomLog.create_inventory_new_room_log(inventory)\n end\n\n loop_date = loop_date + 1.day\n end\n \n InventoryNewRoomChangeSet.create_job(logs, pool, self.channel, self)\n end", "def old_sync; end", "def meta_fact_update(method, ts_begin, ts_end)\n connection[meta_collection].find_one_and_update(\n {},\n {\n '$set' => {\n last_fact_update: {\n ts_begin: ts_begin.iso8601,\n ts_end: ts_end.iso8601,\n method: method\n },\n method => {\n ts_begin: ts_begin.iso8601,\n ts_end: ts_end.iso8601\n }\n }\n },\n { upsert: true }\n )\n end", "def create_schedule_conflict(rname,day,stime,etime)\r\n #flag=false\r\n @statuss=Status.find(:all,:conditions => [\"room_name = ? AND schedule_day = ?\",rname,day])\r\n if @statuss\r\n @statuss.each do |s|\r\n if time_conflict(stime,etime,s[\"start_time\"],s[\"end_time\"])\r\n return true\r\n end\r\n end\r\n end\r\n return false\r\n end", "def update_tree_activities(activity, title, start_time, end_time)\n\n #First update itself.\n #\n #\n activity.name = title\n activity.start_time = start_time\n activity.end_time = end_time\n activity.save\n\n #Activity Root Node just update all children.\n #\n #\n if (activity.reference_activity == nil)\n\n ref_activities = Activity.where('reference_activity_id = ?', \"#{ activity.id }\")\n\n ref_activities.each do |ref_item|\n ref_cal = Google::Calendar.new(:username => ref_item.user.email,\n :password => ref_item.user.email_password,\n :app_name => 'firmy')\n\n if (ref_cal != nil)\n ref_event = ref_cal.find_event_by_id(ref_item.reference)\n ref_event.title = title\n ref_event.start_time = start_time\n ref_event.end_time = end_time\n ref_cal.save_event(ref_event)\n end\n\n ref_item.name = title\n ref_item.start_time = start_time\n ref_item.end_time = end_time\n ref_item.save\n end\n\n #Activity Child Node need to find root node and then update all children.\n #\n #\n else\n root_activity = Activity.where('id = ?', \"#{ activity.reference_activity.id }\").first\n\n root_cal = Google::Calendar.new(:username => root_activity.user.email,\n :password => root_activity.user.email_password,\n :app_name => 'firmy')\n\n if (root_cal != nil)\n root_event = root_cal.find_event_by_id(root_activity.reference)\n root_event.title = title\n root_event.start_time = start_time\n root_event.end_time = end_time\n root_cal.save_event(root_event)\n end\n\n root_activity.name = title\n root_activity.start_time = start_time\n root_activity.end_time = end_time\n root_activity.save\n\n update_tree_activities(root_activity, title, start_time, end_time)\n end\n\n end", "def synchronize\n Log.debug('Synchronizing starting...')\n apply_events fetch_events missed_events\n Log.debug('Synchronizing done!')\n end", "def check_for_changes_affecting_cached_pdfs\n overlap = %w(branching_logic position requirement) & previous_changes.keys\n return if overlap.empty?\n\n design.touch :pdf_cache_busted_at\n end", "def merge_entries\n # Find a time entry that could be adjacent\n t = nil\n begin\n t = TimeEntry.find(:last, :conditions=>['id <> :id AND project_id=:project_id AND user_id=:user_id AND issue_id=:issue_id AND\n (comments=:comments OR (comments is null and :comments is null)) AND activity_id=:activity_id AND spent_on=:spent_on AND\n (spent_to BETWEEN :s1 AND :e1 OR :start1 BETWEEN SUBTIME(spent_from,MAKETIME(0,2,0)) AND ADDTIME(spent_to,MAKETIME(0,2,0)))',\n {:id=>self.id || 0, :project_id=>self.project_id, :user_id=>self.user_id, :issue_id=>self.issue_id,\n :comments=>self.comments, :activity_id=>self.activity_id, :spent_on=>self.spent_from.to_date,\n :s1=>self.spent_from-2.minutes, :e1=>self.spent_to+2.minutes,\n :start1=>self.spent_from}])\n return unless t\n self.spent_from = t.spent_from if t.spent_from < self.spent_from\n self.spent_to = t.spent_to if t.spent_to > self.spent_to\n self.update_entry_origin_atts\n # no longer need that entry\n t.destroy\n end while t\n end", "def fetch_user_google_calendars\n user_gcalendars = []\n if current_user.connected_to_google? && current_user.has_google_credentials?\n begin\n gcw = GoogleCalendarWrapper.new(current_user)\n gcw.import_calendars\n user_gcalendars = current_user.google_calendars\n rescue => e\n logger.error {\"#{e.message} #{e.backtrace.join(\"\\n\")}\"}\n current_user.update_attributes(connected_to_google: false)\n flash[:error] = \"We were not able to fetch data from #{current_user.name}'s Google account.\"\n end\n end\n user_gcalendars\n end", "def create_or_update_previous_runs!; end", "def create_or_update_previous_runs!; end", "def process(calendar)\n # if the property trying to have its calendar synchronised was not\n # synchronised by Concierge, then do not attempt to update its calendar,\n # since the API call to Roomorama is going to fail (the +identifier+\n # will not be recognised.)\n return unless synchronised?(calendar.identifier)\n\n return if calendar.empty?\n\n calendar.validate!\n update_counters(calendar)\n operation = Roomorama::Client::Operations.update_calendar(calendar)\n\n run_operation(operation)\n rescue Roomorama::Error => err\n missing_data(err.message, calendar.to_h)\n Result.error(:missing_data, err.message).tap do |error|\n announce_failure(error)\n end\n end", "def update\n @event = Event.find(params[:id])\n @owner = @event.created_by?(current_user) \n if @owner\n @event.start_dt_tm = Time.zone.parse(params[:start]).at_beginning_of_day.utc\n @event.end_dt_tm = params[:end] != nil ? Time.zone.parse(params[:end]).at_beginning_of_day.utc : @event.start_dt_tm\n\n @event.freq_interval = params[:freq_interval] if (params[:freq_interval] != nil) \n\n if (params[:freq_interval_details] != nil) then\n fix = 0b1\n @event.freq_interval_qual = 0\n\n params[:freq_interval_details].collect{|char| @event.freq_interval_qual |= fix << ((char.to_i)-1) } \n end\n #Do we store who updated it?\n\n if params[:event][:venue_name] != nil && !params[:event][:venue_name].blank?\n if @event.venue.name != params[:event][:venue_name] #If venue has not changed, no need to recheck and repopulate\n @event.venue_id = Venue.find_by_name(params[:event][:venue_name].strip).id\n end\n else\n @event.venue_id = nil\n end\n end\n \n respond_to do |format|\n if @owner && @event.update_attributes(params[:event])\n flash[:notice] = 'Event was successfully updated.'\n format.html { redirect_to(@event) }\n format.xml { head :ok }\n else\n @categories = Category.for_events_by_groups\n @freqtypes = Schedulehelper::FREQ_TYPES\n load_frequency_data\n format.html { \n if !@owner\n flash[:notice] = \"Only the member that added this event can edit. <br/> If you feel the information is incorrect, please contact us.\" \n redirect_to(@event)\n else\n render :action => \"edit\" \n end\n }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end", "def lookup force_reprocess = false\n logger.info \"searching #{self.doc_id}\"\n\n raise \"not saved yet\" unless self.id\n\n # Check if the last image search was more than a day ago\n if (\n self.last_search.nil? ||\n self.last_search < (DateTime.current - LOOKUP_LIMIT) ||\n force_reprocess\n ) &&\n !self.locked\n\n self.last_search = DateTime.current\n\n if self.music?\n MusicBrainzWorker.perform_async self.id\n # fails over to LastFM\n\n elsif self.ht_id.present?\n # Check Hathi Trust 1st when available.\n # this will fail over to google if necessary\n HathiTrustWorker.perform_async self.id\n\n else\n SyndeticsWorker.perform_async self.id\n\n # if syndetics fails, it kicks off google\n # if google fails, it kicks off the OpenLibrary job\n end\n end\n\n # Used to stop the after_commit callback\n self.run_lookup = false\n save\n\n rescue StandardError => e\n self.status = 'error'\n self.response_data = e\n end", "def update!(**args)\n @custom_end_date = args[:custom_end_date] if args.key?(:custom_end_date)\n @custom_start_date = args[:custom_start_date] if args.key?(:custom_start_date)\n @range = args[:range] if args.key?(:range)\n end", "def fetch_appointments(obj, t_d)\n (z = obj.state.appointments_for_dates[t_d]) ? z : {}\n # x = (z = obj.state.appointment_availabilities[t_d]) ? z : {}\n # begining = Moment.new(t_d).set(hour: 9).format()\n # ending = Moment.new(t_d).set(hour: 19).format()\n # x.each do |k, v|\n # v.each do |av|\n # break if av.map.is_a? Array\n # p_av = JSON.parse(av.map).each_slice(2).to_a.sort {|x, y| x[1] <=> y[1]} unless av.map.length == 1\n # p_av.unshift([begining, begining])\n # p_av.push([ending, ending])\n # _map = []\n # i = 0\n # while i < (p_av.length - 1)\n # first = Moment.new p_av[i][1]\n # second = Moment.new p_av[i + 1][0]\n # d = second.diff(first, \"minutes\")\n # if d > 20\n # _map << [first, second]\n # end\n # i += 1\n # end\n # av.map = _map\n # end\n # end \n # x\n end", "def update!(**args)\n @disable_auto_scheduling = args[:disable_auto_scheduling] if args.key?(:disable_auto_scheduling)\n @end_time = args[:end_time] if args.key?(:end_time)\n @start_time = args[:start_time] if args.key?(:start_time)\n end", "def load_calendars!\n puts \"Loading calendars...\"\n @emails = CONFIGURATION[\"people\"].map { |p| p[\"email\"] }\n\n # Load all calendars that aren't in our history.\n (Set.new(@emails) - @previously_loaded_emails).each do |email|\n puts \"Loading calendar: #{email}\"\n @service.insert_calendar_list(\n Google::Apis::CalendarV3::CalendarListEntry.new(id: email)\n )\n sleep 1 # Avoid exceeding Google's rate limit.\n end\n end", "def merge_entries\n return unless self.spent_from && self.spent_to\n # Find a time entry that could be adjacent\n t = nil\n begin\n t = TimeEntry.find(:last, :conditions=>['id <> :id AND project_id=:project_id AND user_id=:user_id AND issue_id=:issue_id AND\n (comments=:comments OR (comments is null and :comments is null)) AND activity_id=:activity_id AND spent_on=:spent_on AND\n (spent_to BETWEEN :s1 AND :e1 OR :start1 BETWEEN SUBTIME(spent_from,MAKETIME(0,2,0)) AND ADDTIME(spent_to,MAKETIME(0,2,0)))',\n {:id=>self.id || 0, :project_id=>self.project_id, :user_id=>self.user_id, :issue_id=>self.issue_id,\n :comments=>self.comments, :activity_id=>self.activity_id, :spent_on=>self.spent_from.to_date,\n :s1=>self.spent_from-2.minutes, :e1=>self.spent_to+2.minutes,\n :start1=>self.spent_from}])\n return unless t\n self.spent_from = t.spent_from if t.spent_from < self.spent_from\n self.spent_to = t.spent_to if t.spent_to > self.spent_to\n # no longer need that entry\n t.destroy\n end while t\n end", "def check_dates\r\n self.start_time -= 8.hours\r\n self.end_time -= 8.hours\r\n end", "def sync\n cached_dataset(:_sync) do\n clone(:async=>false)\n end\n end", "def scheduled_projects_ics(start_date = Date.today, end_date = 8.days.from_now)\n calendar = Icalendar::Calendar.new\n selected_entries_started = entries.where(start_date: start_date.to_date...end_date.to_date).all\n selected_entries_ended = entries.where(end_date: start_date.to_date...end_date.to_date).all\n selected_entries_started.concat(selected_entries_ended).uniq.each do |entry|\n calendar.add_event(entry.to_ics)\n end\n calendar\n end", "def get_calendars\r\n http = Net::HTTP.new(@google_url, 80)\r\n response, data = http.get(\"http://#{@google_url}/calendar/feeds/\" + @user_id, @headers)\r\n case response\r\n when Net::HTTPSuccess, Net::HTTPRedirection\r\n redirect_response, redirect_data = http.get(response['location'], @headers)\r\n case response\r\n when Net::HTTPSuccess, Net::HTTPRedirection\r\n doc = REXML::Document.new redirect_data\r\n \t doc.elements.each('//entry')do |e|\r\n \t title = e.elements['title'].text\r\n \t url = e.elements['link'].attributes['href']\r\n \t @calendars << GCalendar.new(title, url.sub!(\"http://#{@google_url}\",''))\r\n \t end\r\n return redirect_response\r\n else\r\n response.error!\r\n end\r\n else\r\n response.error!\r\n end\r\n end", "def create_events!(opts={})\n cutoff = Time.now.yesterday # All events before this date will be skipped\n events = []\n transaction do\n for event in self.to_events(opts)\n if opts[:skip_old]\n next if event.title.blank? && event.description.blank? && event.url.blank?\n next if event.old?\n end\n \n # Skip invalid events that start after they end\n next if event.end_time && event.end_time < event.start_time\n \n # convert to local time, because time zone is simply discarded when event is saved\n event.start_time.localtime\n event.end_time.localtime if event.end_time\n \n # clear duplicate_of_id field in case to_events picked up orphaned duplicate\n # TODO clear the duplicate_of_id at the point where the object is created, not down here\n event.duplicate_of_id = nil if event.duplicate_of_id\n event.save!\n if event.venue\n event.venue.duplicate_of_id = nil if event.venue.duplicate_of_id\n event.venue.save! if event.venue\n end\n events << event\n end\n self.save!\n end\n return events\n end", "def save!\n parse_timestamps\n # Create a deep copy of self and convert all timestamps to rfc822 to avoid OS specific rounding aberrations\n to_sync = Hash[self.keys.map { |label| [label, self[label].map(&:rfc822)] }]\n # Check existing occurrence_entries\n @object.occurrence_entries.each do |occurrence|\n # Delete occurrences that are not in this hash\n occurrence.destroy unless to_sync.has_key?(occurrence.label) && to_sync[occurrence.label].include?(occurrence.at.rfc822)\n # Remove existing occurrences from the hash of occurrences to create\n to_sync[occurrence.label].delete(occurrence.at.rfc822) if to_sync.has_key?(occurrence.label)\n end\n # Create missing occurrences\n to_sync.each do |label, timestamps|\n timestamps.each do |rfc822_timestring|\n OccurrenceEntry.create!(:post => @object, :label => label, :at => Time.rfc822(rfc822_timestring))\n end\n end\n end", "def sync_with campaign\n campaign_id = campaign.id if campaign.is_a?(Campaign) \n campaign_id ||= campaign\n\n sync_list = self.sync\n sync_list[:with] ||= []\n sync_list[:with] << campaign_id\n self.sync = sync_list\n self.save\n end", "def is_conflict?(param_start, param_end, room_object)\n check = room_object.reservations.where(\"(? < start_date AND end_date < ?) AND status = ?\", param_start, param_end, 1)\n check.size > 0 ? true : false\n end", "def update(date)\n remove date\n Calendar.create_new_events if all.count <= 1\n end", "def assign \n\n # Start by getting all uncommitted timesheets.\n\n @timesheets = Timesheet.where( :committed => false ).order( 'start_day_cache ASC' )\n\n # Further restrict this to timesheets ending before the start of\n # the current month. If the current week falls into the previous\n # month - i.e. the current week starts sooner than the month -\n # then go back one month from there. The idea is to be able to\n # \"close off\" a historical month, without accidentally commiting\n # timesheets in \"this\" month (or close to it) that a user may be\n # legitimately editing.\n #\n # Under Rails, subtracting \"1.month\" from a Date does do the right\n # thing - it doesn't just subtract a fixed number of days. Whatever\n # month it is now, we end up with the start of the previous month.\n\n earliest = Date.today.beginning_of_month\n compare = Date.today.beginning_of_week\n\n @earliest = ( compare < earliest ) ? earliest - 1.month : earliest\n\n # Remember, we want the timesheet's *last day* to fall *before*\n # the start-of-month date now stored in \"earliest\". Or to put it\n # another way, any timesheet that starts at or earlier than 7\n # days prior to \"earliest\" must finish just before \"earliest\".\n\n @timesheets = @timesheets.where( 'start_day_cache <= ?', @earliest - 7.days )\n\n unless ( @timesheets.count.zero? )\n @object = TimesheetForceCommit.new()\n @object.earliest_limit = @timesheets.first.start_day_cache\n @object.latest_limit = @timesheets.last.start_day_cache + 6.days\n end\n end", "def update_existing( existing_meeting_event, meeting_session_id, event_order, begin_time, event_type_id )\n add_to_log( \"\\r\\nUpdating existing MeetingEvent #{ existing_meeting_event.get_full_name }, session: #{ meeting_session_id } n.#{ event_order }, type: #{ event_type_id }\" )\n existing_meeting_event.meeting_session_id = meeting_session_id\n # [Steve, 20170713] It's better not to change the previously found event_order,\n # since most previously existing event rows have a single ordering among all\n # the sessions.\n# existing_meeting_event.event_order = event_order if event_order != existing_meeting_event.event_order\n existing_meeting_event.begin_time = begin_time if begin_time.present?\n existing_meeting_event.event_type_id = event_type_id if event_type_id.to_i > 0\n existing_meeting_event.heat_type_id = HeatType::FINALS_ID if existing_meeting_event.heat_type_id.to_i < 1\n existing_meeting_event.is_out_of_race = false\n existing_meeting_event.is_autofilled = true\n existing_meeting_event.user_id = @current_user.id\n existing_meeting_event.has_separate_gender_start_list = true\n existing_meeting_event.has_separate_category_start_list = false\n\n sql_attributes = existing_meeting_event.attributes.select do |key|\n [\n 'meeting_session_id', 'event_order', 'event_order',\n # [Steve, 20170713] See note above\n# 'event_order',\n 'event_type_id', 'heat_type_id',\n 'is_out_of_race', 'is_autofilled', 'user_id', 'user_id',\n 'has_separate_gender_start_list', 'has_separate_category_start_list'\n ].include?( key.to_s )\n end\n # Serialize the update:\n super( existing_meeting_event, sql_attributes, self.class.name )\n existing_meeting_event\n end", "def conflicts\n if new_record?\n query = 'unit_id = ? AND daterange(start_at, end_at) && daterange(?, ?)'\n Reservation.where(query, unit_id, start_at, end_at)\n else\n query = 'id <> ? AND unit_id = ? AND daterange(start_at, end_at) && daterange(?, ?)'\n Reservation.where(query, id, unit_id, start_at, end_at)\n end\n end", "def update_cache\n # Does nothing...up to subclasses to implement.\n end", "def set_swimmer_career_dao\n sc = SwimmerCareerDAO.new( @swimmer, @to_date, @fronm_date )\n\n #retrieve_data if @data_retrieved.nil?\n if !@data_retrieved.nil?\n # Cycle between retrieved data to populate DAO\n @data_retrieved.each do |result|\n # if pool_type not exists create it\n pool_code = result['pool_code']\n pool = sc.get_pool( pool_code )\n pool = sc.add_pool( pool_code ) if !pool\n\n # Add meeting data to pool collection if not present\n meeting_id = result['meeting_id'].to_i\n pool.add_meeting( meeting_id, result['meeting_date'], result['meeting_name'], result['federation_code'], result['category_code'], result['category_age'].to_i ) if !pool.meetings.has_key?( meeting_id )\n\n # Add result data to meeting collection (never already present)\n time_swam = Timing.new( result['hundreds'].to_i, result['seconds'].to_i, result['minutes'].to_i )\n event_code = result['event_code']\n pool.add_result( meeting_id, result['result_id'].to_i, result['event_order'].to_i, event_code, time_swam, (result['is_disqualified'].to_i) > 0, (result['is_personal_best'].to_i) > 0 )\n\n # Add passages if present\n if result['passages'] != 'null'\n resultDAO = pool.get_result( meeting_id, event_code )\n extract_passages( passage_keys, result['passages'] ).each do |passage|\n time_pass = Timing.new( passage[:hundreds], passage[:seconds], passage[:minutes] )\n time_from_start = Timing.new( passage[:hundreds_from_start], passage[:seconds_from_start], passage[:minutes_from_start] )\n resultDAO.add_passage( passage[:length_in_meters], time_pass, time_from_start )\n end\n end\n\n # Sets max updated at value\n sc.updated_at = result['updated_at'] if sc.updated_at = 0 || sc.updated_at < result['updated_at']\n end\n end\n sc\n end" ]
[ "0.59438396", "0.5750888", "0.5750374", "0.5620669", "0.54809636", "0.5429109", "0.53840345", "0.5326818", "0.52438563", "0.52224904", "0.52220815", "0.52198017", "0.5211574", "0.51997334", "0.5149853", "0.51306593", "0.5128895", "0.5109369", "0.5105655", "0.5094184", "0.5074441", "0.50689137", "0.5038319", "0.50227606", "0.49798176", "0.49516732", "0.49436158", "0.49202222", "0.49029392", "0.49029392", "0.49029392", "0.48948216", "0.48945606", "0.48880047", "0.48587555", "0.48507968", "0.4848416", "0.48421183", "0.48394445", "0.48339725", "0.4829176", "0.48241702", "0.48190284", "0.4818843", "0.48149478", "0.48124263", "0.47892392", "0.47815818", "0.47746274", "0.4771633", "0.4771369", "0.47602278", "0.4759999", "0.47560617", "0.47362915", "0.47250694", "0.47209543", "0.4708644", "0.4707646", "0.4701057", "0.47004718", "0.46952116", "0.46948397", "0.46935228", "0.46868396", "0.46863028", "0.46826512", "0.46754387", "0.4674012", "0.46663237", "0.46608162", "0.46572253", "0.4652903", "0.464474", "0.4642477", "0.46402764", "0.46365505", "0.46365505", "0.4634767", "0.46262586", "0.46253282", "0.46244413", "0.46243447", "0.46243352", "0.46229702", "0.46168232", "0.46146002", "0.46104482", "0.4609622", "0.46076152", "0.4607293", "0.46041334", "0.4598368", "0.4594259", "0.45900008", "0.4583918", "0.4576017", "0.4574895", "0.45748892", "0.4573762" ]
0.6464298
0
return a Nokogiri xml object of this feed. For docs on functions to view and manipulate the xml object, see Nokogiri. For docs on the format of the Atom xml feed, see the google calendar api docs.
def xml Nokogiri::XML(body) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rss\r\n Nokogiri::XML(body)\r\n end", "def xml\n @feed ||= FeedzirraPodcast::Parser::Podcast.parse(open(self.url))\n end", "def xml\n xml = Builder::XmlMarkup.new(indent: 2)\n\n xml.instruct! :xml, encoding: 'UTF-8'\n xml.rss version: '2.0' do |rss|\n rss.channel do |channel|\n channel.title 'Haxpressen'\n\n last_ten_days.each do |day|\n summary = summary_for day\n\n if summary.present?\n channel.item do |item|\n item.title \"Sammanfattning för #{day}\"\n item.pubDate day\n item.description summary\n end\n end\n end\n end\n end\n end", "def to_nokogiri\n base_document = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|\n xml.entry('xmlns:atom' => 'http://www.w3.org/2005/Atom',\n 'xmlns:apps' => 'http://schemas.google.com/apps/2006' ) {\n\n # Namespaces cannot be used until they are declared, so we need to\n # retroactively declare the namespace of the parent\n xml.parent.namespace = xml.parent.namespace_definitions.select {|ns| ns.prefix == \"atom\"}.first\n xml.category(\"scheme\" => \"http://schemas.google.com/g/2005#kind\",\n \"term\" =>\"http://schemas.google.com/apps/2006#user\")\n xml['apps'].login(login_attributes)\n xml['apps'].quota(\"limit\" => @limit) if @limit\n xml['apps'].name(\"familyName\" => @family_name, \"givenName\" => @given_name)\n }\n end\n\n base_document\n end", "def xml\n @xml ||= Nokogiri::XML(body)\n end", "def feed\n @feed ||= (parsed_feed('rss') || parsed_feed('atom'))\n end", "def feed\n @feed ||= (parsed_feed('rss') || parsed_feed('atom'))\n end", "def generate_atom_feed\n xml = \"\"\n builder = Builder::XmlMarkup.new\n @articles_published.each do |article|\n content = process_with_filter(article)\n xml = builder.entry do |b|\n b.title(type: \"html\") { |t| t.cdata!(article.title) }\n unless article.authors.empty?\n b.author { |a| a.name(article.authors.first.full_name) }\n end\n b.link(rel: 'alternate', type: 'text/html', href: full_request(article.permalink))\n b.id(full_request(article.permalink))\n b.updated(article.updated_at.xmlschema)\n b.published(article.published_on.xmlschema)\n b.content(type: \"html\") { |c| c.cdata!(content) }\n end\n end\n { xml: xml }\n end", "def rss\n @rss ||= build_rss\n end", "def feed\n @data.feed ||= parsed_document.xpath(\"//link\").select{ |link|\n link.attributes[\"type\"] && link.attributes[\"type\"].value =~ /(atom|rss)/\n }.map { |link|\n absolutify_url(link.attributes[\"href\"].value)\n }.first rescue nil\n end", "def xml\n @xml ||= Nokogiri::XML.parse body\n end", "def get_user_calendar_xml # :nodoc:\n response = session.get(USER_FEED)\n Nokogiri::XML(response.body)\n end", "def parse_rss\n parser = Parsers::RSS.new\n noko_sax = Nokogiri::XML::SAX::Parser.new(parser)\n noko_sax.parse(@data)\n parser.feed\n end", "def to_atom\n require 'nelumba/atom/feed'\n\n Nelumba::Atom::Feed.from_canonical(self)\n end", "def to_opml\n\t\tdoc = Nokogiri::XML::DocumentFragment.parse \"\"\n\t\tNokogiri::XML::Builder.with(doc) { |xml|\n\t\t\txml.outline(:title => self.title, :text => self.title) {\n\t\t\t\tself.feeds.each do |feed|\n\t\t\t\t\txml.__send__ :insert, feed.to_opml\n\t\t\t\tend\n\t\t\t}\n\t\t}\n\t\treturn doc\n\tend", "def feed\n\t\t\tpost = { \"token\" => @token }\n\t\t\tdocxml = nil\n\t\t\tdocxml = nessus_request('feed', post)\n\t\t\tif docxml.nil?\n\t\t\t\treturn\n\t\t\tend\n\t\t\tfeed = docxml.root.elements['contents'].elements['feed'].text\n\t\t\tversion = docxml.root.elements['contents'].elements['server_version'].text\n\t\t\tweb_version = docxml.root.elements['contents'].elements['web_server_version'].text\n\t\t\treturn feed, version, web_version\n\t\tend", "def parse_feed\n feed = self.download_feed\n Nokogiri::XML(feed).xpath(\"//item\").map do |item|\n enclosure = item.xpath(\"enclosure\").first\n\n title = CGI::unescapeHTML(item.xpath(\"title\").text.chomp)\n publish_date = Time.parse(item.xpath(\"pubDate\").inner_html.chomp)\n type = enclosure ? enclosure[:type] : nil\n url = enclosure ? enclosure[:url] : nil\n Podcast.new title, publish_date, type, url, self\n end\n end", "def xml_document\n if @xml_document.nil?\n return nil if self.feed_data.blank?\n if self.feed_data_type != :xml\n @xml_document = nil\n else\n begin\n @xml_document = REXML::Document.new(self.feed_data_utf_8)\n rescue Exception\n # Something failed, attempt to repair the xml with html5lib.\n begin\n @xml_document = HTML5::XMLParser.parse(self.feed_data_utf_8)\n rescue Exception\n # Failed again, give up.\n return nil\n end\n end\n end\n end\n return @xml_document\n end", "def build_xml(feed_type=(self.feed_type or \"atom\"), feed_version=nil,\n xml_builder=Builder::XmlMarkup.new(\n :indent => 2, :escape_attrs => false))\n \n if self.find_node(\"access:restriction/@relationship\").to_s == \"deny\"\n raise StandardError,\n \"Operation not permitted. This feed denies redistribution.\"\n elsif self.find_node(\"@indexing:index\").to_s == \"no\"\n raise StandardError,\n \"Operation not permitted. This feed denies redistribution.\"\n end\n \n self.full_parse()\n \n xml_builder.instruct! :xml, :version => \"1.0\",\n :encoding => (self.configurations[:output_encoding] or \"utf-8\")\n if feed_type.nil?\n feed_type = self.feed_type\n end\n if feed_version.nil?\n feed_version = self.feed_version\n end\n if feed_type == \"rss\" &&\n (feed_version == nil || feed_version <= 0.0)\n feed_version = 1.0\n elsif feed_type == \"atom\" &&\n (feed_version == nil || feed_version <= 0.0)\n feed_version = 1.0\n end\n if feed_type == \"rss\" &&\n (feed_version == 0.9 || feed_version == 1.0 || feed_version == 1.1)\n # RDF-based rss format\n return xml_builder.tag!(\"rdf:RDF\",\n \"xmlns\" => FEED_TOOLS_NAMESPACES['rss10'],\n \"xmlns:content\" => FEED_TOOLS_NAMESPACES['content'],\n \"xmlns:rdf\" => FEED_TOOLS_NAMESPACES['rdf'],\n \"xmlns:dc\" => FEED_TOOLS_NAMESPACES['dc'],\n \"xmlns:syn\" => FEED_TOOLS_NAMESPACES['syn'],\n \"xmlns:admin\" => FEED_TOOLS_NAMESPACES['admin'],\n \"xmlns:taxo\" => FEED_TOOLS_NAMESPACES['taxo'],\n \"xmlns:itunes\" => FEED_TOOLS_NAMESPACES['itunes'],\n \"xmlns:media\" => FEED_TOOLS_NAMESPACES['media']) do\n channel_attributes = {}\n unless self.link.nil?\n channel_attributes[\"rdf:about\"] =\n FeedTools::HtmlHelper.escape_entities(self.link)\n end\n xml_builder.channel(channel_attributes) do\n unless self.title.blank?\n xml_builder.title(\n FeedTools::HtmlHelper.strip_html_tags(self.title))\n else\n xml_builder.title\n end\n unless self.link.blank?\n xml_builder.link(self.link)\n else\n xml_builder.link\n end\n unless images.blank?\n xml_builder.image(\"rdf:resource\" =>\n FeedTools::HtmlHelper.escape_entities(\n images.first.url))\n end\n unless description.nil? || description == \"\"\n xml_builder.description(description)\n else\n xml_builder.description\n end\n unless self.language.blank?\n xml_builder.tag!(\"dc:language\", self.language)\n end\n unless self.rights.blank?\n xml_builder.tag!(\"dc:rights\", self.rights)\n end\n xml_builder.tag!(\"syn:updatePeriod\", \"hourly\")\n xml_builder.tag!(\"syn:updateFrequency\",\n (self.time_to_live / 1.hour).to_s)\n xml_builder.tag!(\"syn:updateBase\", Time.mktime(1970).iso8601)\n xml_builder.items do\n xml_builder.tag!(\"rdf:Seq\") do\n unless items.nil?\n for item in items\n if item.link.nil?\n raise \"Cannot generate an rdf-based feed with a nil \" +\n \"item link field.\"\n end\n xml_builder.tag!(\"rdf:li\", \"rdf:resource\" =>\n FeedTools::HtmlHelper.escape_entities(item.link))\n end\n end\n end\n end\n xml_builder.tag!(\n \"admin:generatorAgent\",\n \"rdf:resource\" => self.configurations[:generator_href])\n build_xml_hook(feed_type, feed_version, xml_builder)\n end\n unless self.images.blank?\n best_image = nil\n for image in self.images\n if image.link != nil\n best_image = image\n break\n end\n end\n best_image = self.images.first if best_image.nil?\n xml_builder.image(\"rdf:about\" =>\n FeedTools::HtmlHelper.escape_entities(best_image.url)) do\n if !best_image.title.blank?\n xml_builder.title(best_image.title)\n elsif !self.title.blank?\n xml_builder.title(self.title)\n else\n xml_builder.title\n end\n unless best_image.url.blank?\n xml_builder.url(best_image.url)\n end\n if !best_image.link.blank?\n xml_builder.link(best_image.link)\n elsif !self.link.blank?\n xml_builder.link(self.link)\n else\n xml_builder.link\n end\n end\n end\n unless items.nil?\n for item in items\n item.build_xml(feed_type, feed_version, xml_builder)\n end\n end\n end\n elsif feed_type == \"rss\"\n # normal rss format\n return xml_builder.rss(\"version\" => \"2.0\",\n \"xmlns:content\" => FEED_TOOLS_NAMESPACES['content'],\n \"xmlns:rdf\" => FEED_TOOLS_NAMESPACES['rdf'],\n \"xmlns:dc\" => FEED_TOOLS_NAMESPACES['dc'],\n \"xmlns:taxo\" => FEED_TOOLS_NAMESPACES['taxo'],\n \"xmlns:trackback\" => FEED_TOOLS_NAMESPACES['trackback'],\n \"xmlns:itunes\" => FEED_TOOLS_NAMESPACES['itunes'],\n \"xmlns:media\" => FEED_TOOLS_NAMESPACES['media']) do\n xml_builder.channel do\n unless self.title.blank?\n xml_builder.title(\n FeedTools::HtmlHelper.strip_html_tags(self.title))\n end\n unless self.link.blank?\n xml_builder.link(link)\n end\n unless self.description.blank?\n xml_builder.description(description)\n else\n xml_builder.description\n end\n unless self.author.email.blank?\n xml_builder.managingEditor(self.author.email)\n end\n unless self.publisher.email.blank?\n xml_builder.webMaster(self.publisher.email)\n end\n unless self.published.blank?\n xml_builder.pubDate(self.published.rfc822)\n end\n unless self.updated.blank?\n xml_builder.lastBuildDate(self.updated.rfc822)\n end\n unless self.copyright.blank?\n xml_builder.copyright(self.copyright)\n end\n unless self.language.blank?\n xml_builder.language(self.language)\n end\n xml_builder.ttl((time_to_live / 1.minute).to_s)\n xml_builder.generator(\n self.configurations[:generator_href])\n build_xml_hook(feed_type, feed_version, xml_builder)\n unless items.nil?\n for item in items\n item.build_xml(feed_type, feed_version, xml_builder)\n end\n end\n end\n end\n elsif feed_type == \"atom\" && feed_version == 0.3\n raise \"Atom 0.3 is obsolete.\"\n elsif feed_type == \"atom\" && feed_version == 1.0\n # normal atom format\n return xml_builder.feed(\"xmlns\" => FEED_TOOLS_NAMESPACES['atom10'],\n \"xml:lang\" => language) do\n unless title.blank?\n xml_builder.title(title,\n \"type\" => \"html\")\n end\n xml_builder.author do\n unless self.author.nil? || self.author.name.nil?\n xml_builder.name(self.author.name)\n else\n xml_builder.name(\"n/a\")\n end\n unless self.author.nil? || self.author.email.nil?\n xml_builder.email(self.author.email)\n end\n unless self.author.nil? || self.author.url.nil?\n xml_builder.uri(self.author.url)\n end\n end\n unless self.href.blank?\n xml_builder.link(\"href\" => self.href,\n \"rel\" => \"self\",\n \"type\" => \"application/atom+xml\")\n end\n unless self.link.blank?\n xml_builder.link(\n \"href\" =>\n FeedTools::HtmlHelper.escape_entities(self.link),\n \"rel\" => \"alternate\")\n end\n unless self.subtitle.blank?\n xml_builder.subtitle(self.subtitle,\n \"type\" => \"html\")\n end\n if self.updated != nil\n xml_builder.updated(self.updated.iso8601)\n elsif self.time != nil\n # Not technically correct, but a heck of a lot better\n # than the Time.now fall-back.\n xml_builder.updated(self.time.iso8601)\n else\n xml_builder.updated(Time.now.gmtime.iso8601)\n end\n unless self.rights.blank?\n xml_builder.rights(self.rights)\n end\n xml_builder.generator(self.configurations[:generator_name] +\n \" - \" + self.configurations[:generator_href])\n if self.id != nil\n unless FeedTools::UriHelper.is_uri? self.id\n if self.link != nil\n xml_builder.id(FeedTools::UriHelper.build_urn_uri(self.link))\n else\n raise \"The unique id must be a valid URI.\"\n end\n else\n xml_builder.id(self.id)\n end\n elsif self.link != nil\n xml_builder.id(FeedTools::UriHelper.build_urn_uri(self.link))\n elsif self.url != nil\n xml_builder.id(FeedTools::UriHelper.build_urn_uri(self.url))\n else\n raise \"Cannot build feed, missing feed unique id.\"\n end\n build_xml_hook(feed_type, feed_version, xml_builder)\n unless items.nil?\n for item in items\n item.build_xml(feed_type, feed_version, xml_builder)\n end\n end\n end\n else\n raise \"Unsupported feed format/version.\"\n end\n end", "def atom()\r\n atom = \"<?xml version=\\\"1.0\\\"?><entry xmlns=\\\"http://www.w3.org/2005/Atom\\\" xmlns:media=\\\"http://search.yahoo.com/mrss/\\\" \"\r\n atom << \"xmlns:yt=\\\"http://gdata.youtube.com/schemas/2007\\\"> <media:group> <media:title type=\\\"plain\\\">#{@name}\"\r\n atom << \"</media:title> <media:description type=\\\"plain\\\">#{@description}</media:description>\"\r\n atom << \"<media:category scheme=\\\"http://gdata.youtube.com/schemas/2007/developertags.ca\\\">#{@category}</media:category>\"\r\n atom << \"<media:keywords>#{@keywords.join(', ')}</media:keywords></media:group></entry>\"\r\n end", "def to_xml\n self.xml ||= fetch({\"service\"=>self.service_type,\"metric\"=>self.metric,\"start\"=>self.sdate.to_s,\"end\"=>self.edate.to_s,\"artistID\"=>self.artist_id,\"apiKey\"=>$nbs_api_key,\"format\"=>\"xml\"})\n end", "def to_xml\n PodcastsController.renderer.new(\n 'action_dispatch.request.path_parameters' => {\n controller: 'podcasts',\n action: 'show',\n id: podcast.id\n }\n ).render :show, format: :rss\n end", "def rss\n render_rss_feed_for Announcement.find(:all, :order => 'created_at DESC',\n :limit => 10), {\n :feed => {\n :title => 'OpenMind New Announcements',\n :link => announcements_url,\n :pub_date => :created_at\n },\n :item => {\n :title => :headline,\n :description => :formatted_description,\n :link => Proc.new{|announcement| \"#{announcements_url}##{announcement.id}\" }\n }\n }\n end", "def get_rss\n #version = \"1.0\" # [\"0.9\", \"1.0\", \"2.0\"]\n version = @version\n\n content = RSS::Maker.make(@version) do |m|\n m.channel.title = @title\n m.channel.description = @description \n m.channel.link = @link \n m.channel.language = @language\n m.channel.about = @about\n m.items.do_sort = true # sort items by date\n m.channel.updated = Time.now.to_s\n m.channel.author = NAME\n\n if @image != nil\n m.image.url = @image\n m.image.title = @title\n end\n\n for mp3 in @mp3s \n item = m.items.new_item\n item.title = mp3\n ## add a base url \n if base != ''\n link = base + '/' + URI::escape(mp3.path)\n else \n link = URI::escape(mp3.path)\n end\n item.link = link\n item.date = mp3.mtime\n item.enclosure.url = link\n item.enclosure.length = mp3.length\n item.enclosure.type = mp3.type\n end\n end\n\n return content\n end", "def to_xml\n @xml ||= get_xml\n end", "def to_xml()\n @xml ||= Nokogiri::XML(cmark(\"--to\", \"xml\"))\n @xml\n end", "def xml\n @xml ||= Nokogiri::XML(remote_record_source_metadata).remove_namespaces!\n end", "def parse\n Ox.parse(@xml)\n end", "def to_xml(xml_builder = Builder::XmlMarkup.new)\n xml_builder.tag!('ExternalFeed') do\n %w(URL OwnerEmail PollingInterval SecurityType SignatureType BasicAuthUsername BasicAuthPassword).each do |tag_name|\n xml_builder.tag!(tag_name, self.edits[tag_name]) if self.edits[tag_name]\n end\n end\n end", "def document\n @doc ||= Nokogiri::XML(@xml)\n end", "def to_atom(options = {})\n Atom::Feed.new do |feed|\n feed.title = \"#{self.user.login}:#{self.name}\"\n feed.id = \"#{options[:base_uri]}/#{user.login}/tags/#{self.name}\"\n feed.updated = self.updated_on\n feed[CLASSIFIER_NAMESPACE, 'classified'] << self.last_classified_at.xmlschema if self.last_classified_at\n feed[CLASSIFIER_NAMESPACE, 'bias'] << self.bias.to_s\n feed.categories << Atom::Category.new(:term => self.name, :scheme => \"#{options[:base_uri]}/#{user.login}/tags/\")\n \n feed.links << Atom::Link.new(:rel => \"alternate\", :href => URI.escape(\"#{options[:base_uri]}/#{user.login}/tags/#{self.name}.atom\"))\n feed.links << Atom::Link.new(:rel => \"#{CLASSIFIER_NAMESPACE}/edit\", \n :href => URI.escape(\"#{options[:base_uri]}/#{user.login}/tags/#{self.name}/classifier_taggings.atom\"))\n \n conditions = []\n condition_values = []\n \n if options[:training_only]\n conditions << 'classifier_tagging = 0'\n feed.links << Atom::Link.new(:rel => \"self\", :href => URI.escape(\"#{options[:base_uri]}/#{user.login}/tags/#{self.name}/training.atom\"))\n else\n conditions << 'strength <> 0'\n feed.links << Atom::Link.new(:rel => \"self\", \n :href => URI.escape(\"#{options[:base_uri]}/#{user.login}/tags/#{self.name}.atom\"))\n feed.links << Atom::Link.new(:rel => \"#{CLASSIFIER_NAMESPACE}/training\", \n :href => URI.escape(\"#{options[:base_uri]}/#{user.login}/tags/#{self.name}/training.atom\")) \n end\n \n if options[:since]\n conditions << 'taggings.created_on > ?'\n condition_values << options[:since].getutc\n end\n \n self.taggings.find(:all, :conditions => [conditions.join(\" and \"), *condition_values], \n :limit => (options[:training_only] ? nil : (options[:limit] or 100)),\n :order => 'feed_items.updated DESC', :include => [{:feed_item, :content}]).each do |tagging|\n feed.entries << tagging.feed_item.to_atom(options.merge({:include_tags => self, :training_only => options[:training_only]}))\n end\n end\n end", "def entries\n nodes = @doc.xpath(\"atom:feed/atom:entry\", ::AtomFeed::NS) || []\n nodes.map { |node| AtomFeedEntry.new(node) }\n end", "def rss\n @events = Post.find(:all, {:conditions=> \"status=public\"},:order => \"id DESC\")\n render :layout => false\n headers[\"Content-Type\"] = \"application/xml; charset=utf-8\"\n end", "def get_feed(feed_url = nil)\n unless feed_url.blank?\n # trim the url element\n feed_url.strip!\n begin\n feed = Atom::Feed.load_feed(URI.parse(feed_url))\n rescue\n feed = nil\n end\n feed\n end\n end", "def parse(str)\n # Dirty hack: some feeds contain the & char. It must be changed to &amp;\n str.gsub!(/&(\\s+)/, '&amp;\\1')\n doc = REXML::Document.new(str)\n @xml = doc.root\n # get feed info\n @encoding = doc.encoding\n @title,@link,@description,@creator = nil\n @items = []\n if doc.root.elements['channel'] || doc.root.elements['rss:channel']\n @type = \"rss\"\n # We have a RSS feed!\n # Title\n if (e = doc.root.elements['channel/title'] ||\n doc.root.elements['rss:channel/rss:title']) && e.text\n @title = e.text.unescape_html.toUTF8(@encoding).rmWhiteSpace!\n end\n # Link\n if (e = doc.root.elements['channel/link'] ||\n doc.root.elements['rss:channel/rss:link']) && e.text\n @link = e.text.rmWhiteSpace!\n end\n # Description\n if (e = doc.root.elements['channel/description'] || \n doc.root.elements['rss:channel/rss:description']) && e.text\n @description = e.text.toUTF8(@encoding).rmWhiteSpace!\n end\n # Creator\n if ((e = doc.root.elements['channel/dc:creator']) && e.text) ||\n ((e = doc.root.elements['channel/author'] ||\n doc.root.elements['rss:channel/rss:author']) && e.text)\n @creator = e.text.unescape_html.toUTF8(@encoding).rmWhiteSpace!\n end\n # Items\n if doc.root.elements['channel/item']\n query = 'channel/item'\n elsif doc.root.elements['item']\n query = 'item'\n elsif doc.root.elements['rss:channel/rss:item']\n query = 'rss:channel/rss:item'\n else\n query = 'rss:item'\n end\n doc.root.each_element(query) { |e| @items << RSSItem::new(e, self) }\n\n elsif doc.root.elements['/feed']\n # We have an ATOM feed!\n @type = \"atom\"\n # Title\n if (e = doc.root.elements['/feed/title']) && e.text\n @title = e.text.unescape_html.toUTF8(@encoding).rmWhiteSpace!\n end\n # Link\n doc.root.each_element('/feed/link') do |e|\n if e.attribute('type') and (\n e.attribute('type').value == 'text/html' or\n e.attribute('type').value == 'application/xhtml' or\n e.attribute('type').value == 'application/xhtml+xml')\n if (h = e.attribute('href')) && h\n @link = h.value.rmWhiteSpace!\n end\n end\n end\n # Description\n if e = doc.root.elements['/feed/info']\n e = e.elements['div'] || e\n @description = e.to_s.toUTF8(@encoding).rmWhiteSpace!\n end\n # Items\n doc.root.each_element('/feed/entry') do |e|\n @items << AtomItem::new(e, self)\n end\n else\n raise UnknownFeedTypeException::new\n end\n end", "def get_xml(url)\n Nokogiri::XML.parse(get(url), nil, nil, Nokogiri::XML::ParseOptions::STRICT)\n end", "def retrieve_feed\n uri = URI.parse(@feed_url)\n Net::HTTP.get_response(uri).body\n end", "def import_xml(raw)\n doc = Nokogiri::XML(raw)\n\n @events = []\n doc.css('entry').each do |entry|\n fields = {\n :id => entry.css('id').text,\n :published => entry.css('published').text,\n :title => entry.css('title').text,\n :summary => entry.css('content').text,\n :start => DateTime.parse(entry.xpath('gd:when').first['startTime']),\n :end => DateTime.parse(entry.xpath('gd:when').first['endTime']),\n :where => entry.xpath('gd:where').first['valueString'],\n :url => entry.css('link').first['href']\n }\n \n @events << Event.new(fields)\n end\n\n return @events\n end", "def parse(feed)\n document = Nokogiri::XML(feed)\n if root = document.root\n root.add_namespace_definition('atom', 'http://www.w3.org/2005/Atom')\n root.add_namespace_definition('rdf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#')\n root.add_namespace_definition('rss1', 'http://purl.org/rss/1.0/')\n root.add_namespace_definition('dc', 'http://purl.org/dc/elements/1.1/')\n parsers.each do |parser|\n node = root.xpath(parser.root_node).first\n if node\n return parser.new(node)\n end\n end\n end\n # if we cannot find a parser, raise an error.\n raise InvalidFeedFormat\n end", "def to_s\n rss.to_s\n end", "def find_feed\n @feed = @node.content\n end", "def atom\n sup_id = Configuration.for('app').sup_id\n response['Content-Type'] = 'application/atom+xml'\n response['Cache-Control'] = 'max-age=900, public'\n response['Expires'] = (Time.now + 900).utc.rfc2822\n response['X-SUP-ID'] = \"http://friendfeed.com/api/public-sup.json##{sup_id}\"\n respond Tamanegi::to_atom.to_xml\n end", "def xml_document\n xml = XML::Document.new\n xml.root = self.to_xml\n xml\n end", "def to_xml\n http.body\n end", "def xml_to_instance\r\n ATTRIBUTES_MAP.each do |name, hash| \r\n elem = @xml.root.elements[hash[\"element\"]]\r\n unless elem.nil?\r\n val = (hash.has_key?(\"attribute\") ? elem.attributes[hash[\"attribute\"]] : elem.text)\r\n val = self.send(hash[\"from_xml\"], val) if hash.has_key?(\"from_xml\")\r\n self.send(name+\"=\", val)\r\n end\r\n end\r\n self.status = :old\r\n\r\n @xml.root.elements.each(\"link\") do |link|\r\n @feed = link.attributes[\"href\"] if link.attributes[\"rel\"] == \"edit\"\r\n end\r\n end", "def fetch\n feed_data = REXML::Document.new(open(@url, :proxy => true)).root\n parse(feed_data)\n end", "def open_document\n @document = Nokogiri::XML(open(@feed_uri).read)\n end", "def to_xml\n doc = Nokogiri::XML::Document.new\n element = to_nokogiri(doc)\n element.to_s\n end", "def to_xml\n doc = Nokogiri::XML::Document.new\n element = to_nokogiri(doc)\n element.to_s\n end", "def atomlink(xml)\n # Effectively memoize this XMLAttr object, since we can use it for\n # ever parsed page.\n @atomlink ||= GProv::Provision::EntryBase::XMLAttr.new(:link, :xpath => %{/xmlns:feed/xmlns:link[@rel = \"next\"]/@href})\n\n # REVIEW This might be utilizing behavior that's unexpected. This\n # retrieves a fully qualified URL, which means that it might be\n # bypassing some of the logic in the GProv::Conection code. Instead of\n # passing in the base resource URI like the rest of GProv, we're\n # blindly using this\n #\n # So instead of retrieving this:\n #\n # /group/2.0/:domain/<group>@<domain>/member?start=<string>\n #\n # We're retrieving this:\n #\n # https://apps-apis.google.com/a/feeds/group/2.0/<domain>/<group>@<domain>/member?start=<string>\n #\n # This works, since by the nature of this request the group and domain\n # are filled in correctly. However, it ignores the baseuri respected by\n # the rest of this library, the :domain symbol, and other behaviors.\n # This should continue to work, but if HTTParty stops allowing fully\n # qualified URLs like this and merely prepends the current baseuri to\n # this string then the world will explode.\n link = @atomlink.parse(xml)\n link unless link.empty?\n end", "def xml_document\n xml = XML::Document.new\n xml.root = self.to_xml\n xml\n end", "def parse(xml)\n document = make_document(xml)\n\n Atom::XML::Parser.document(document).parse\n end", "def to_xml\n Ox.to_xml document\n end", "def rss\n render_rss_feed_for Idea.find(:all, :order => 'created_at DESC',\n :limit => 10), {\n :feed => {\n :title => 'OpenMind New Ideas',\n :link => url_for(:controller => 'ideas', :action => 'list', :only_path => false),\n :pub_date => :created_at\n },\n :item => {\n :title => :title,\n :description => :formatted_description,\n :link => Proc.new{|idea| url_for(:controller => 'ideas',\n :action => 'show', :id => idea.id)}\n }\n }\n end", "def links\n nodes = @doc.xpath(\"atom:feed/atom:link\", ::AtomFeed::NS) || []\n nodes.map { |node| AtomLink.new(node) }\n end", "def xml\n @_node.asXml\n end", "def rss\n @title = t('titles.news', brand: website.brand_name)\n @description = website.value_for(\"default_meta_tag_description\")\n @news = News.all_for_website(website)\n respond_to do |format|\n format.xml # render rss.xml.builder\n end\n end", "def parse_feed\n remove_previous_entries\n @items = @content[\"rss\"][\"channel\"][\"item\"]\n if !@items.nil?\n for item in @items do\n item[\"pubDate\"] ||= \"\"\n item[\"creator\"] ||= \"\"\n item[\"guid\"] ||= \"\"\n item[\"title\"] ||= \"\"\n item[\"description\"] ||= \"\"\n clean_content(item[\"encoded\"] ||= \"\")\n item[\"link\"] ||= \"\"\n params = { \n :pubdate => item[\"pubDate\"], \n :creator => item[\"creator\"], \n :guid => relative_link(item[\"guid\"]), \n :title => item[\"title\"], \n :description => item[\"description\"], \n :content => @content, \n :link => relative_link(item[\"link\"])\n }\n insert_entry(params)\n end\n end\n end", "def render_feed(type, tag_name)\n raise if !type.instance_of?(Symbol)\n raise if !tag_name.instance_of?(String)\n\n last_modified_date = Post.order(\"updated_at DESC\").first.try(:created_at).try(:to_datetime) || DateTime.now\n tag = Tag.where(:name => tag_name).first\n if !tag\n return render_404\n end\n posts = tag.posts.where(:is_public => true).order(\"sort_id DESC\")\n xml = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" ?>\\r\\n\"\n case type\n when :rss\n xml << \"<rss version=\\\"2.0\\\" xmlns:atom=\\\"http://www.w3.org/2005/Atom\\\">\\r\\n\"\n xml << \" <channel>\\r\\n\"\n xml << \" <title>\" + APP_TITLE + \"</title>\\r\\n\"\n if tag.name == \"home\"\n xml << \" <description>\" + APP_DESCRIPTION.encode(:xml => :text) + \"</description>\\r\\n\"\n else\n xml << \" <description>\" + APP_DESCRIPTION.encode(:xml => :text) + \" Category: \" + tag.name + \".</description>\\r\\n\"\n end\n xml << \" <link>\" + (APP_PROTOCOL + APP_HOST).encode(:xml => :text) + \"</link>\\r\\n\"\n xml << \" <pubDate>\" + last_modified_date.to_formatted_s(:rfc822).encode(:xml => :text) + \"</pubDate>\\r\\n\"\n if tag.name == \"home\"\n xml << \" <atom:link href=\\\"\" + (APP_PROTOCOL + APP_HOST).encode(:xml => :text) + \"/rss\\\" rel=\\\"self\\\" type=\\\"application/rss+xml\\\" />\\r\\n\"\n else\n xml << \" <atom:link href=\\\"\" + (APP_PROTOCOL + APP_HOST).encode(:xml => :text) + \"/rss/\" + tag.name + \"\\\" rel=\\\"self\\\" type=\\\"application/rss+xml\\\" />\\r\\n\"\n end\n for post in posts\n xml << \" <item>\\r\\n\"\n xml << \" <title>\" + post.title.encode(:xml => :text) + \"</title>\\r\\n\"\n xml << \" <description>\" + post.summary.encode(:xml => :text) + \"</description>\\r\\n\"\n xml << \" <link>\" + (APP_PROTOCOL + APP_HOST).encode(:xml => :text) + post.canonical_uri.encode(:xml => :text) + \"</link>\\r\\n\"\n xml << \" <guid>\" + (APP_PROTOCOL + APP_HOST).encode(:xml => :text) + post.canonical_uri.encode(:xml => :text) + \"</guid>\\r\\n\"\n xml << \" <pubDate>\" + post.created_at.to_datetime.to_formatted_s(:rfc822).encode(:xml => :text) + \"</pubDate>\\r\\n\"\n xml << \" </item>\\r\\n\"\n end\n xml << \" </channel>\\r\\n\"\n xml << \"</rss>\\r\\n\"\n when :atom\n xml << \"<feed xmlns=\\\"http://www.w3.org/2005/Atom\\\">\\r\\n\"\n xml << \" <title>\" + APP_TITLE + \"</title>\\r\\n\"\n if tag.name == \"home\"\n xml << \" <subtitle>\" + APP_DESCRIPTION.encode(:xml => :text) + \"</subtitle>\\r\\n\"\n else\n xml << \" <subtitle>\" + APP_DESCRIPTION.encode(:xml => :text) + \" Category: \" + tag.name + \".</subtitle>\\r\\n\"\n end\n if tag.name == \"home\"\n xml << \" <link href=\\\"\" + (APP_PROTOCOL + APP_HOST).encode(:xml => :text) + \"/atom\\\" rel=\\\"self\\\" />\\r\\n\"\n else\n xml << \" <link href=\\\"\" + (APP_PROTOCOL + APP_HOST).encode(:xml => :text) + \"/atom/\" + tag.name + \"\\\" rel=\\\"self\\\" />\\r\\n\"\n end\n xml << \" <link href=\\\"\" + (APP_PROTOCOL + APP_HOST).encode(:xml => :text) + \"/\\\" />\\r\\n\"\n xml << \" <id>\" + (APP_PROTOCOL + APP_HOST).encode(:xml => :text) + \"/</id>\\r\\n\"\n xml << \" <updated>\" + last_modified_date.to_formatted_s(:rfc3339).encode(:xml => :text) + \"</updated>\\r\\n\"\n for post in posts\n xml << \" <entry>\\r\\n\"\n xml << \" <title>\" + post.title.encode(:xml => :text) + \"</title>\\r\\n\"\n xml << \" <link href=\\\"\" + (APP_PROTOCOL + APP_HOST).encode(:xml => :text) + post.canonical_uri.encode(:xml => :text) + \"\\\" />\\r\\n\"\n xml << \" <id>\" + (APP_PROTOCOL + APP_HOST).encode(:xml => :text) + post.canonical_uri.encode(:xml => :text) + \"</id>\\r\\n\"\n xml << \" <updated>\" + post.created_at.to_datetime.to_formatted_s(:rfc3339).encode(:xml => :text) + \"</updated>\\r\\n\"\n xml << \" <summary>\" + post.summary.encode(:xml => :text) + \"</summary>\\r\\n\"\n xml << \" <author>\\r\\n\"\n xml << \" <name>\" + APP_AUTHOR.encode(:xml => :text) + \"</name>\\r\\n\"\n xml << \" <email>\" + APP_EMAIL.encode(:xml => :text) + \"</email>\\r\\n\"\n xml << \" </author>\\r\\n\"\n xml << \" </entry>\\r\\n\"\n end\n xml << \"</feed>\\r\\n\"\n else\n return render_404\n end\n return render :xml => xml\n end", "def feed_url\n \"http://#{@account}.github.com/feed.xml\"\n end", "def to_xml()\n builder = Nokogiri::XML::Builder.new(:encoding => ENCODING) do |xml|\n xml.Types(:xmlns => Axlsx::XML_NS_T) {\n each { |type| type.to_xml(xml) }\n }\n end\n builder.to_xml(:save_with => 0)\n end", "def metadata_xml\n Nokogiri::XML(original_file.content)\n end", "def to_xml\n response\n end", "def to_xml\n to_xml_builder.to_xml\n end", "def to_xml\n to_xml_builder.to_xml\n end", "def xml_feed_entries(feed_url, locale, offset)\r\n p \"Feed #{feed_url}\"\r\n doc = Nokogiri::XML(open(feed_url))\r\n doc.xpath(\"//item\").count.times do |n|\r\n \r\n # process dates\r\n sdt = DateTime.parse(doc.xpath(\"//item//xCal:dtstart\")[n].text) rescue nil\r\n edt = doc.xpath(\"//item//xCal:dtend\")[n].text\r\n edt.blank? ? enddt = sdt.advance(:hours => 2) : enddt = DateTime.parse(edt)\r\n \r\n # get event title and url\r\n etitle = doc.xpath(\"//item//title\")[n].text.split(' at ')[0]\r\n url = doc.xpath(\"//item//link\")[n].text \r\n sid = doc.xpath(\"//item//id\")[n].text \r\n\r\n # get county based on coordinates\r\n lat = doc.xpath(\"//item//geo:lat\")[n].text\r\n lng = doc.xpath(\"//item//geo:long\")[n].text\r\n county = Schedule.chk_geocode(lat, lng) rescue nil\r\n \r\n # add only current events \r\n if sdt >= Date.today\r\n \r\n # find correct channel and location\r\n cid = LocalChannel.select_channel(etitle, county, locale).flatten 1\r\n# cid.map {|channel| p \"Channel: #{channel.channelID}\" }\r\n\r\n # add event to calendar\r\n cid.map {|channel| add_event(doc, n, sid, etitle[0..199], sdt, enddt, channel.channelID, url, offset)} if cid\r\n# add_event(doc, n, sid, etitle[0..199], sdt, enddt, cid[0].channelID, url, offset) if cid\r\n end\r\n end \r\n end", "def get_xml\n @link += \"&maxwidth=\" + @options[:maxwidth] if @options[:maxwidth]\n @link += \"&maxheight=\" + @options[:maxheight] if @options[:maxheight]\n xml = Nokogiri::XML(open(@link))\n xml.xpath('/oembed').children.each do |row|\n self[row.name] = row.text\n end\n end", "def feed\r\n @posts = Post.all(:order => \"created_at DESC\")\r\n respond_to do |format|\r\n format.rss\r\n end\r\n end", "def xml\n @entry ||= open(entry_url).read\n rescue => e\n raise RuntimeError, \"coult not open entry url: #{entry_url} : \\n#{e}\"\n end", "def content_xml\n return @content_xml unless @content_xml.nil?\n @content_xml = Nokogiri::XML(content)\n end", "def to_html\n # header\n puts Header % [convert_entity(@feed_name), convert_entity(@feed_description)]\n \n # the entries\n @feed_data.each do |item|\n puts Entry % [convert_link(item['link']), convert_entity(item['title'])]\n end\n \n # footer\n print Footer % Version\n end", "def parse_list\n doc = REXML::Document.new(list)\n root = doc.root\n list_items = []\n root.elements.each(\"//atom:feed\") do |entry|\n item = {}\n entry.elements.each do |e|\n case e.name\n when \"id\", \"link\", \"updated\"\n item[e.name] = e.text\n when \"author\"\n item[e.name] ||= []\n e.elements.each(\"atom:name\") do |author|\n item[e.name] << author.text\n end\n end\n end\n list_items << item unless item.empty?\n end\n list_items\n end", "def render(&block)\n output = ''\n \n xml = Builder::XmlMarkup.new(:target => output, :indent => 2)\n xml.instruct!\n xml.feed \"xmlns\" => \"http://www.w3.org/2005/Atom\" do\n xml.id feed_id\n xml.link \"rel\" => \"self\", \"href\" => feed_url\n xml.updated Time.now.iso8601\n xml.author { xml.name @account }\n \n xml.title @title\n xml.subtitle @description\n \n repos.each do |repo|\n xml.entry do\n xml.id id_for_repo(repo)\n xml.updated updated_for_repo(repo)\n xml.title title_for_repo(repo)\n xml.link :href => link_for_repo(repo)\n xml.summary summary_for_repo(repo)\n xml.content description_for_repo(repo)\n end\n end\n end\n end", "def rss\n @logs = RssLog.includes(:name, :species_list, observation: :name).\n where(\"datediff(now(), updated_at) <= 31\").\n order(updated_at: :desc).\n limit(100)\n\n render_xml(layout: false)\n end", "def read_rss\n query = \"http://news.google.ru/news?hl=ru&topic=#{@topic}&output=rss&ned=ru_ru&num=30&&scoring=n\"\n feed = Feedjira::Feed.fetch_and_parse(query)\n feed.entries.map do |entry|\n {\n uuid: SecureRandom.uuid,\n title: entry.title,\n url: entry.url.match(GOOGLE_URI_REGEX)[0],\n published_datetime: entry.published,\n published_unixtime: entry.published.to_i\n }\n end\n end", "def to_xml(*)\n self\n end", "def get_rss\n all( :conditions => ['published_at IS NOT NULL'], :order => 'published_at DESC', :limit => per_page )\n end", "def build_rss\n ::RSS::Maker.make('2.0') do |maker|\n maker.channel.link = @wiki.settings.url\n maker.channel.title = @wiki.settings.title\n maker.channel.description = @wiki.settings.description.to_s\n maker.channel.author = @wiki.settings.author.to_s\n maker.channel.updated = Time.now.to_s\n maker.items.do_sort = true\n\n posts.each do |post|\n html = post.content\n date = Time.parse(post.post_date)\n\n next if date > Time.now unless @wiki.settings.future\n\n if i = html.index('</p>')\n text = html[0..i+4]\n else\n text = html\n end\n\n maker.items.new_item do |item|\n item.title = post.title\n item.link = File.join(@wiki.settings.url, post.href)\n item.date = date\n item.description = text\n end\n end\n end\n end", "def rss\n @headers[\"Content-Type\"] = \"application/xml\"\n @articles = Article.find(:all, \n :order => 'created_at DESC',\n :conditions => [\"articles.approved = ?\", true],\n :limit => 10\n )\n render :layout => false\n end", "def rss\n\t\theaders[\"Content-Type\"] = \"text/xml; charset=utf-8\"\n\t\trender :layout => false\n\tend", "def bf_xml\n doc = Nokogiri::XML(bfMetadata.to_xml)\n doc.root.children.to_xml\n end", "def to_s\n return self.xml\n end", "def rss # :nologin:\n @logs = RssLog.all(conditions: \"datediff(now(), updated_at) <= 31\",\n order: \"updated_at desc\", limit: 100,\n include: [:name,\n :species_list,\n { observation: :name }\n ])\n render_xml(layout: false)\n end", "def to_xml\n to_node.document.to_xml\n end", "def make_document(xml)\n xml.is_a?(Atom::XML::Document) ? xml : Atom::XML::Document.string(xml)\n end", "def entries\n if @entries.nil?\n raw_entries = FeedTools::XmlHelper.select_not_blank([\n FeedTools::XmlHelper.try_xpaths_all(self.channel_node, [\n \"atom10:entry\",\n \"atom03:entry\",\n \"atom:entry\",\n \"entry\"\n ]),\n FeedTools::XmlHelper.try_xpaths_all(self.root_node, [\n \"rss10:item\",\n \"rss11:items/rss11:item\",\n \"rss11:items/item\",\n \"items/rss11:item\",\n \"items/item\",\n \"item\",\n \"atom10:entry\",\n \"atom03:entry\",\n \"atom:entry\",\n \"entry\",\n \"story\"\n ]),\n FeedTools::XmlHelper.try_xpaths_all(self.channel_node, [\n \"rss10:item\",\n \"rss11:items/rss11:item\",\n \"rss11:items/item\",\n \"items/rss11:item\",\n \"items/item\",\n \"item\",\n \"story\"\n ])\n ])\n\n # create the individual feed items\n @entries = []\n unless raw_entries.blank?\n for entry_node in raw_entries.reverse\n new_entry = FeedItem.new\n new_entry.feed_data = entry_node.to_s\n new_entry.feed_data_type = self.feed_data_type\n new_entry.root_node = entry_node\n if new_entry.root_node.namespace.blank?\n new_entry.root_node.add_namespace(self.root_node.namespace)\n end\n @entries << new_entry\n end\n end\n end\n \n # Sort the items\n if self.configurations[:entry_sorting_property] == \"time\"\n @entries = @entries.sort do |a, b|\n (b.time or Time.utc(1970)) <=> (a.time or Time.utc(1970))\n end\n elsif self.configurations[:entry_sorting_property] != nil\n sorting_property = self.configurations[:entry_sorting_property]\n @entries = @entries.sort do |a, b|\n eval(\"a.#{sorting_property}\") <=> eval(\"b.#{sorting_property}\")\n end\n else\n return @entries.reverse\n end\n return @entries\n end", "def feed\n cached = Rails.cache.read(\"rss\")\n return cached unless cached.nil?\n\n resp = HTTParty.get(Rails.configuration.x.application.blog_rss)\n return [] unless resp.code == 200\n\n rss = RSS::Parser.parse(resp.body, false).items.first(5)\n cache_content(\"rss\", rss)\n rss\n rescue StandardError => e\n # If we were unable to connect to the blog rss\n logger.error(\"Caught exception RSS parse: #{e}.\")\n []\n end", "def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end", "def xml\n @xml ||= Nokogiri::XML(path).remove_namespaces!\n end", "def parse_xml(xml)\n Nokogiri::XML(xml, &:noblanks)\n end", "def new_empty_doc\n Atom::XML::Document.new\n end", "def rss\n @event = Event.find_by_key(params['id'])\n @histories = @event.histories(:order => 'created_at DESC')\n render :layout => false\n response.headers[\"Content-Type\"] = \"application/xml; charset=utf-8\"\n end", "def to_xml\n RAGE::XMLCodec.new.encode(self)\n end", "def to_xml\n @xml.to_xml\n end", "def xml_document\n @root_node.to_s\n end", "def xml_document\n @root_node.to_s\n end", "def get_xml_doc()\n doc = REXML::Document.new \"<top description='My Description' name='My Data Set'></top>\"\n root_node = @all_depths[0].first[1]\n doc.elements[\"top\"].add_element root_node.xml\n\n # see method below\n xml_recurse_helper(root_node)\n\n return doc\n end", "def to_node\n Nokogiri::XML::Builder.new do |xml|\n build xml\n end.doc.root\n end", "def feed(prefer = :rss)\n rss = rss_feed\n atom = atom_feed\n if rss && atom\n prefer == :rss ? rss : atom\n else\n rss || atom\n end\n end", "def root_element\n root.xml \n end" ]
[ "0.73685086", "0.71328753", "0.6789851", "0.66832626", "0.6654748", "0.6617596", "0.6617596", "0.6574094", "0.6538268", "0.65363604", "0.63761663", "0.63690704", "0.63032526", "0.6260213", "0.6195887", "0.6177639", "0.6134267", "0.61024654", "0.6069902", "0.6034875", "0.60018086", "0.5993524", "0.5964391", "0.5953335", "0.59425867", "0.59410137", "0.59368664", "0.59251845", "0.59088767", "0.58910865", "0.58710676", "0.5866263", "0.5865111", "0.5831851", "0.5818545", "0.5816504", "0.5811986", "0.5803942", "0.5786362", "0.57801837", "0.57509536", "0.5750659", "0.5745119", "0.57232845", "0.5721337", "0.5701439", "0.5701407", "0.5676905", "0.5676905", "0.5666853", "0.5650602", "0.5607179", "0.5585516", "0.55467093", "0.5540934", "0.5540267", "0.5526711", "0.55241203", "0.55171204", "0.55156255", "0.5514812", "0.5509392", "0.5509039", "0.55049706", "0.55049706", "0.54963344", "0.5489034", "0.5484209", "0.5470569", "0.54676044", "0.5459178", "0.54515636", "0.5449768", "0.5440869", "0.5439572", "0.5428731", "0.5427667", "0.542699", "0.54218227", "0.54072666", "0.54055524", "0.540555", "0.53937256", "0.53903747", "0.5389706", "0.53759676", "0.53744894", "0.5361166", "0.53571177", "0.535442", "0.5347338", "0.53455067", "0.53439605", "0.53302354", "0.53240365", "0.53240365", "0.53171957", "0.53118235", "0.5311775", "0.5292932" ]
0.64805335
10
has_many :questions, foreign_key: 'author_id' has_many :answers, foreign_key: 'author_id' has_many :comments
def password @password ||= BCrypt::Password.new(hashed_password) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authored_questions\n Question.find_by_author_id(self.id)\n end", "def authored_questions\n Question.find_by_author_id(self.id)\n end", "def authored_questions\n Question.find_by_author_id(@id)\n end", "def author\n # data = QuestionsDatabase.instance.execute(\"SELECT fname, lname FROM questions\")\n User.find_by_user_id(@author_id)\n\n end", "def questions_author\n self.question.poll.author.id\n end", "def test_has_many_through_has_many_with_has_many_through_habtm_source_reflection\n greetings, more = comments(:greetings), comments(:more_greetings)\n\n assert_equal [greetings, more], authors(:bob).category_post_comments.order(\"comments.id\")\n end", "def test_has_many_through_has_and_belongs_to_many_with_has_many_source_reflection\n greetings, more = comments(:greetings), comments(:more_greetings)\n\n assert_equal [greetings, more], categories(:technology).post_comments.order(\"comments.id\")\n end", "def associations; end", "def authors_join_table\n self.class.authors_join_table\n end", "def related_posts; end", "def stores_foreign_key?; true; end", "def commenters\n # User.joins(:comments).where(comments: {discussion_id: id}).uniq\n User.where(id: comments.pluck(:author_id))\n end", "def associated\n end", "def macro\n :belongs_to_related\n end", "def my_questions\n self.questions.map(&:id)\n end", "def relatedChallenges\n Challenge.all(:select => \"challenges.*,skill_challenges.parent_id\",\n :joins => :skill_challenges,\n :conditions => { \n :skill_challenges => { :parent_id => self.skill_challenges.first.parent_id }\n },\n :order => \"skill_challenges.lft\")\n end", "def stores_foreign_key?; false; end", "def stores_foreign_key?; false; end", "def test_has_many_through_has_many_with_has_and_belongs_to_many_source_reflection\n general, cooking = categories(:general), categories(:cooking)\n\n assert_equal [general, cooking], authors(:bob).post_categories.order(\"categories.id\")\n end", "def posts\n Post.all.select {|post| post.author == self}\nend", "def answers\n return Answer.where(question_id: self.id) \n end", "def question\n @posts = Post.all\n end", "def author\n authors = QuestionsDBConnection.instance.execute(<<-SQL, self.author_id)\n SELECT fname, lname FROM user\n WHERE id = ?\n SQL\n\n return nil if authors.length < 0\n\n \n authors.map{|author| UserModel.new(author)}\n \n end", "def replies\n Reply.find_by_question_id(self.id)\n end", "def model_relationships; end", "def set_question\n @question = Question.includes(:answers).find(params[:id])\n end", "def foreign_key\n association.foreign_key \n end", "def preloaded_questions\n Question.includes(:answers => :votes)\n .includes(:answers => :comments)\n .includes(:votes)\n .includes(:comments)\n end", "def question\n Question.find_by_id(questions_id)\n end", "def set_child_foreign_keys\n self.children.each do |child|\n child.post_id = self.post_id\n end\n end", "def relatedQuestions(section)\n relQuestions = []\n \n questions = sectionQuestions(pretest())\n questions.each do |question|\n question.getActivityReferences.getVector.each do |reference|\n if section.equals(reference.getReferencedObject)\n relQuestions << question\n break\n end\n end\n end\n \n relQuestions\n end", "def talks\n @talks ||= Talk.all.select do |t|\n if t.authors.any?\n t.author_id.include?(self.id)\n else\n t.author_id == self.id\n end\n end\n end", "def question_params\n params.require(:question).permit(:title, :discipline, :body, :tags, :user_id, answer_attributes: [:body])\n end", "def question_params\n params.require(:question).permit(:user_id, :title, :description, :topics)\n end", "def show\n @questions = Question.find(params[:id])\n @answers = @question.answers.all\n end", "def foreign_key\n self.name + \"_id\"\n end", "def question_params\n params.require(:question).permit(:title, topic_ids: [], answers_attributes: [:id, :content, :is_correct])\n end", "def question\n Question.find_by_id(self.question_id)\n end", "def assigned_questions\n Course::Assessment::Question.\n joins(question_bundles: [:question_group, question_bundle_assignments: :submission]).\n merge(Course::Assessment::Submission.where(id: self)).\n merge(Course::Assessment::QuestionGroup.order(:weight)).\n merge(Course::Assessment::QuestionBundleQuestion.order(:weight)).\n extending(Course::Assessment::QuestionsConcern)\n end", "def posts \n Post.all.select {|post| post.author == self}\n end", "def question_details\n result = []\n entities.each do |entity|\n group = entity.meta_attribute_entity_group\n result.push({\n :questions=>questions_for_entity(entity).map{|q|q.attribute_name},\n :table=>entity.entity_type,\n :year=>entity.reference_year,\n :group=>group.group_name,\n :parent_table=>group.parent_table,\n :link_to=>(group.parent_group.nil? ? nil : group.parent_group.parent_table)\n })\n end\n result\n end", "def author\n User.find_by_id(self.author_id)\n end", "def rows\n self.choice_questions.includes(:question_content).includes(:choice_answers)\n end", "def record_foreign_keys(parent_record)\n association_foreign_keys(parent_record)\n end", "def many_to_many_associated_tables\n @many_to_many_associated_tables\n end", "def question_params\n params.require(:question).permit(:title, :content, :user_id)\n end", "def child_relation; end", "def question_params\n params.require(:question).permit(questions_attributes: [:survey_id, :id, :content, answers_attributes: [:id, :question_id, :correct_answer, :content], correct_answers_attributes: [:guess, :question_id]])\n end", "def questions\n \n end", "def eager_answer\n Answer.includes(question: :primary_focus)\n end", "def edit_question\n @questions=Admin::Questionbank.find(:all,:select=>\"id,question_code,subject_name,question_number,internal_ref_number\",:order=>'created_at DESC',:limit=>3)\n @questionbank=Admin::Questionbank.find(params[:id])\n @examtypes=Admin::Examtype.find(:all,:select=>\"id,examtype\",:order=>'examtype')\n @sectiontopics=Admin::Sectiontopic.find(:all,:select => 'DISTINCT Topic,id')\n @sectiontags=Admin::Sectiontemplate.find(:all,:select=>'SectionTags')\n end", "def questions_for_entity entity\n questions.select{|question|question.meta_attribute_entity==entity}\n end", "def replies\n Reply.find_by_question_id(@id)\n end", "def is_author?\n Response.joins(question: :poll).where(\"polls.user_id = ?\", self.user_id).exists?\n end", "def relatedQuestions(section)\n relQuestions = []\n\n questions = sectionQuestions(pretest())\n questions.each do |question|\n question.getActivityReferences.getVector.each do |reference|\n if section.equals(reference.getReferencedObject)\n relQuestions << question\n break\n end\n end\n end\n \n relQuestions\nend", "def relatedQuestions(section)\n relQuestions = []\n\n questions = sectionQuestions(pretest())\n questions.each do |question|\n question.getActivityReferences.getVector.each do |reference|\n if section.equals(reference.getReferencedObject)\n relQuestions << question\n break\n end\n end\n end\n \n relQuestions\nend", "def related_to(*args)\n@relations = args.map(&:to_s)\nend", "def book_author_params\n params.require(:book_author).permit(:book_id, :author_id)\n end", "def foreign_key(*attributes)\n self.foreign_keys += attributes\n end", "def has_and_belongs_to_many(others)\n @others = others\n @collection = ManyToManyCollection\n self.send('attr_reader', others)\n end", "def get_author_resources\n # Get the user and author ids for the current resource\n author = self.author_id\n user = self.user_id\n\n rel_resource_list = {}\n # If an author is assigned use that\n if author\n Resource.where('author_id=? OR user_id=?', author, author).find_each do |rel_resource|\n if rel_resource.id != self.id\n if rel_resource.author_id == author\n rel_resource_list[rel_resource.id] = rel_resource.title\n elsif rel_resource.author_id == nil and rel_resource.user_id == user\n rel_resource_list[rel_resource.id] = rel_resource.title\n end\n end\n end\n # If not, use the user who created the Resource\n else\n Resource.where('author_id=? OR user_id=?', user, user).find_each do |rel_resource|\n if rel_resource.id != self.id\n if rel_resource.author_id == user\n rel_resource_list[rel_resource.id] = rel_resource.title\n elsif rel_resource.author_id == nil and rel_resource.user_id == user\n rel_resource_list[rel_resource.id] = rel_resource.title\n end\n end\n end\n end\n return rel_resource_list\n end", "def question_params\n params.require(:question).permit(:content,:user_id)\n end", "def setup_associations; end", "def authored_articles\n Article.where(author: self)\n end", "def foreign_key\n meta(foreign_key: true)\n end", "def question_params\n params.require(:question).permit(:title, :body, :user_id)\n end", "def show_comments\r\n @comments = Comment.find_by_sql(\"select * from comments where subject_id order by created_at DESC\")\r\n @replies = []\r\n @comments.each do|c| \r\n Comment.find_all_by_reply(c.id).each do|r|\r\n @replies << r\r\n end\r\n end \r\n end", "def related_submissions\n\t\tself.user.previous_submissions_for(self.task).includes(comments: :user)\n\tend", "def add_post(post)\n post.author = self\n end", "def add_post(post)\n post.author = self\n end", "def add_post(post)\n post.author = self\n end", "def show\n @question = Question.find(params[:id])\n\n @answers = Answer.where(question_id: @question.id).order(created_at: :desc)\n @users = User.includes(:userprofile).all\n @question = Question.find(params[:id])\n @userprofile = @users.find(@question.user_id)\n\n end", "def question_params\n params.require(:question).permit(:text, answers_attributes: [:id, :text, :_destroy])\n end", "def books_author_params\n params.require(:books_author).permit(:book_id, :author_id)\n end", "def entities\n @entities ||= questions.map{|question|question.meta_attribute_entity}.uniq\n end", "def questions\r\n return @questions \r\nend", "def related_articles\n respond_to?(:relatedArticle) ? relatedArticle : []\n end", "def question_params\n params.require(:question).permit(:title, :description, :category_id, :user_id)\n end", "def show\n @question = Question.find(params[:id])\n\t@choice0 = @question.choices[0]\n\t@choice1 = @question.choices[1]\n#\t@comment0 = @choice0.comments.build(:choice_id => @choice0.id, :user_id => current_user.id)\n#\t@comment1 = @choice1.comments.build(:choice_id => @choice1.id, :user_id => current_user.id)\n#\t@comment0 = @choice0.comments.build()\n#\t@comment1 = @choice1.comments.build()\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end", "def create_comments\n Author.all.each do |author|\n 2.times do\n Comment.create(body: Faker::Hipster.sentence(2), author_id: author.id, article_id: Article.pluck(:id).sample)\n end\n end\nend", "def test_has_many_through_has_many_with_has_many_through_source_reflection\n general = tags(:general)\n assert_equal [general, general], authors(:david).tags\n end", "def set_author_id\n if self.author_id.blank?\n self.author_id = self.user_id\n end\n end", "def set_author_id\n if self.author_id.blank?\n self.author_id = self.user_id\n end\n end", "def related_messages\n Message.related(self.id)\n end", "def show \n @answers = @question.answers\n @photos = @question.photos\nend", "def transfer_associations(question)\n attrs = question_params\n if attrs[:annotations_attributes].present?\n attrs[:annotations_attributes].each_key do |key|\n old_annotation = question.annotations.select do |a|\n a.org_id.to_s == attrs[:annotations_attributes][key][:org_id] &&\n a.type.to_s == attrs[:annotations_attributes][key][:type]\n end\n unless old_annotation.empty?\n attrs[:annotations_attributes][key][:id] = old_annotation.first.id\n end\n end\n end\n # TODO: This question_options id swap feel fragile. We cannot really match on any\n # of the data elements because the user may have changed them so we rely on its\n # position within the array/query since they should be equivalent.\n if attrs[:question_options_attributes].present?\n attrs[:question_options_attributes].each_key do |key|\n next unless question.question_options[key.to_i].present?\n hash = attrs.dig(:question_options_attributes, key)\n hash[:id] = question.question_options[key.to_i].id.to_s\n end\n end\n attrs\n end", "def answer_params\n params.permit(:body, :user_id, :question_id, :question_accepted_id)\n end", "def survey_question_relationship_params\n params.require(:survey_question_relationship).permit(:survey_id, :question_id)\n end", "def author_index\n @comments.authors.index(author)\n end", "def question_params\n params.require(:question).permit(:body, :user_id, :type, answers_attributes:[:body, :question_id])\n end", "def poll_author?\n self.answer_choice.question.poll.author_id\n end", "def author\n User.find(self.user_id)\n end", "def index\n @questions = @questionable.questions\n end", "def index\n @questions = Question.includes(:user, :topics, answers: [:user]).all\n @questions = @questions.topic(params[:topic_id]) if params[:topic_id]\n end", "def author\n User.find_by_id(users_id)\n end", "def quiz_questions\n @questions = set_quiz.questions\n end", "def answer_params\n params.require(:answer).permit(:content, :user_id, :post_id)\n end", "def relation_by_sql_form\n # Nothing to do here\n end", "def add_post(post)\n post.author = self \n end", "def answer_params\n params.require(:answer).permit(:answer, :question_id, :user_id)\n end", "def associations\r\n [nil, joins]\r\n end" ]
[ "0.67443025", "0.67443025", "0.6645587", "0.6143136", "0.6134022", "0.5980279", "0.58381337", "0.57939976", "0.57939184", "0.57310164", "0.56920415", "0.56775796", "0.56759346", "0.5598748", "0.55856943", "0.5510686", "0.54476494", "0.54476494", "0.53976554", "0.538454", "0.53774697", "0.5375548", "0.5349792", "0.531947", "0.53064364", "0.53037524", "0.5293562", "0.5291486", "0.5279956", "0.5266356", "0.5249712", "0.5228128", "0.52185833", "0.5217853", "0.5212566", "0.5206429", "0.52013785", "0.5196892", "0.51875234", "0.5187016", "0.5180076", "0.51772934", "0.5176526", "0.51747924", "0.5154447", "0.51516896", "0.514742", "0.51444644", "0.5143469", "0.5132319", "0.51270753", "0.5122368", "0.5121741", "0.5119413", "0.5118391", "0.5118391", "0.51088697", "0.5106358", "0.5097207", "0.50965333", "0.5092826", "0.5087411", "0.5085429", "0.50638103", "0.5056407", "0.5055696", "0.50551623", "0.5050442", "0.50462234", "0.50462234", "0.50462234", "0.5043902", "0.504238", "0.5006536", "0.49942148", "0.4994052", "0.49777845", "0.49728873", "0.49611333", "0.49600387", "0.4958957", "0.4958846", "0.4958846", "0.49551514", "0.49534506", "0.49527207", "0.49496183", "0.49480686", "0.49476224", "0.4943383", "0.49366844", "0.49340785", "0.493199", "0.49307102", "0.49243703", "0.49242646", "0.49238965", "0.49216726", "0.4919458", "0.49184272", "0.4917009" ]
0.0
-1
compare the results of "working solution" with "optimized solution"
def compare_solutions(count = 5, n_min = 1, n_max = 300) arr = generate(count, n_min, n_max) if solve(arr) != solve_opt(arr) puts "\nFAILED" puts 'data: ' + arr.to_s puts 'solution: ' + solve(arr).to_s puts 'optimized solution: ' + solve_opt(arr).to_s end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_tests\n check_solution(1, [6, 29, 18, 2, 72, 19, 18, 10, 37], 18, 2)\n check_solution(2, [6, 29, 18, 2, 72, 19, 18, 10, 37], 9, -1)\nend", "def run_tests()\n check_solution(1, [1, 4, 10, 13, 15], true)\n check_solution(2, [1, 4, 10, 10, 13, 15], true)\n check_solution(3, [1, 2, 5, 3, 4 ], false)\nend", "def run_tests()\n check_solution(1, [1, 4, 10, 13, 15], true)\n check_solution(2, [1, 4, 10, 10, 13, 15], true)\n check_solution(3, [1, 2, 5, 3, 4 ], false)\nend", "def run_tests()\n check_solution(1, [1, 3, 5, 4], [5])\n check_solution(2, [4, 2, 3, 6, 10], [4, 10])\n check_solution(3, [4, 2, 11, 6, 10], [4, 11, 10])\nend", "def run_tests\n check_solution(1, (100..200).to_a, 135, 35)\n check_solution(2, [13, 19, 24, 29, 32, 37, 43], 35, -1)\nend", "def condition(i, j)\n # first solved the two equations for just i and j\n 500_000 - 1000*i - 1000*j + i*j == 0\nend", "def solve\n s = Hash[(1...1000).map { |i| [i, i * i] }]\n (1...1000).each do |c|\n (1...c).each do |b|\n (1..b).each do |a|\n return a * b * c if (a + b + c) == 1000 && (s[a] + s[b]) == s[c]\n end\n end\n end\nend", "def hook_solution?(a); end", "def solution\n\n return self if solved?\n\n while [hidden_singles, naked_singles].any?\n end\n\n return self if solved?\n\n\n # Brute force\n i = each_empty_cell.sort_by { |cell, n| legal_values(n).size }.first.try :last\n\n legal_values(i).map do |value|\n fill(i, value).solution\n end.compact.select { |n| n.solved? }.first\n end", "def solvable?\n find_solution > 0\n end", "def has_solution(n)\n# Store input in variable N\n$N = n\n\n#Declare and initialize variables to find the maximum number of times 6, 9 and 20 divide into N\n$A_1 = $N/$x\n$A_2 = $N/$y\n$A_3 = $N/$z\n\n#Declare and initialize arrays to store potential combinations, where A is number of 6 packs, B number of 9 packs and C number of 20 packs\n@A = (0..$A_1).to_a\n@B = (0..$A_2).to_a\n@C = (0..$A_3).to_a\n\n#Declare function to calculate different combinations of A, B and C\ndef test(i,j,k)\nreturn @A[i]*$x + @B[j]*$y + @C[k]*$z\nend\n\n#Loop to exhaustively test combinations of A, B and C, with values ranging between 1 and the maximum number of times 6, 9 and 20 divide into N\nfor i in (0..$A_1)\n for j in (0..$A_2)\n for k in (0..$A_3)\n #Use declared function test to check each combination of i,j and k, and if it is equal to N, print out values of i, j and k\n if test(i,j,k) == $N\n return true\n end\n end\n end\nend\n\nend", "def verifierCorrect()\n return @solution.equals(@partie.getCurrentGrid())\n end", "def run_tests()\n check_solution(1,\"aaabbc\", \"3a2bc\")\n check_solution(2, \"xxyyyyzz\", \"2x4y2z\")\n check_solution(3, \"qqqqq\", \"5q\")\n check_solution(4, \"mississippi\", \"mi2si2si2pi\")\nend", "def run_tests()\n check_solution(1,\"aaabbc\", \"3a2bc\")\n check_solution(2, \"xxyyyyzz\", \"2x4y2z\")\n check_solution(3, \"qqqqq\", \"5q\")\n check_solution(4, \"mississippi\", \"mi2si2si2pi\")\nend", "def run_tests()\n check_solution(1,\"aaabbc\", \"3a2bc\")\n check_solution(2, \"xxyyyyzz\", \"2x4y2z\")\n check_solution(3, \"qqqqq\", \"5q\")\n check_solution(4, \"mississippi\", \"mi2si2si2pi\")\nend", "def test_find_stack_overflow\n skip # because it takes *forever*\n @starting_point = MM::Ratio.new(1,1)\n @search = MM::Search.new(@starting_point)\n @search.delta = 0.001\n @search.adjacent_points_function = ->(current) {\n [MM::Ratio.new(1,1), MM::Ratio.new(-1,1)].map {|m| m + current}\n }\n goal = MM::Ratio.new(9000,1)\n @search.cost_function = ->(x) {\n (x - goal).abs\n }\n assert_equal goal, @search.find\n puts @search.iterations\n end", "def eval_solution(current_solution)\n cities_dist = Array.new\n File.open(\"simane_data_from_datamaker.dump\", 'r') do |file|\n cities_dist = Marshal.load(file)\n end\n\n if cities_dist[0].length == current_solution.length\n total_distance = current_solution.inject(0) do |suma, numero|\n if current_solution.last == numero\n suma += cities_dist[current_solution.first][current_solution.last]\n suma\n else\n unless current_solution[numero + 1].nil?\n suma += cities_dist[numero][current_solution[numero + 1]]\n end\n suma\n end\n end\n return total_distance\n else\n \"cities_distances y current_solution son de diferentes tamanhos: #{cities_dist.length}, #{current_solution.length}\"\n end\nend", "def optimal_answer?\n \tanswer_value == optimal_value\n end", "def solve(show_res=true, debug=false)\n\n while not done?\n step(debug)\n end\n\n if show_res or debug then\n puts show_state\n puts \"computed in #{@duration} sec\"\n end\n\n solution\n end", "def solution(a, b)\n a.size > b.size ? b+a+b : a+b+a\nend", "def slow_solution(a)\n m = 0\n a.size.times do |i|\n a[i] = a[i].abs\n m = [a[i], m].max\n end\n maxsum = a.sum # sum of absolute val of all nums in array\n # maxsum = a.map(&:abs).sum <- Ruby shortcut\n\n # If dp = 1 at an index, it means some combo of elements in a add up to that index\n dp = [0] * (maxsum + 1)\n dp[0] = 1\n\n a.size.times do |j|\n maxsum.downto(0).each do |possible_sum|\n puts \"a[j]: #{a[j]}, possible sum: #{possible_sum}\"\n if (dp[possible_sum] == 1) and (possible_sum + a[j] <= maxsum)\n\n # if possible_sum + new element a[j] is possible sum, dp = 1!\n dp[possible_sum + a[j]] = 1\n puts \"Mark #{possible_sum + a[j]} as possible sum in dp\"\n end\n end\n puts \"row: #{j}, a[j]: #{a[j]}, dp: #{dp}\"\n puts\n end\n\n min_q_minus_p = maxsum\n\n # Divide array a into 2 parts, where P = sum of part 1 and Q = sum of part 2,\n # P + Q = maxsum, and P <= maxsum / 2 <= Q.\n # We want largest possible P to get smallest possible Q-P.\n\n # loop from 0 to maxsum / 2, covering every possible P, Q division\n (maxsum / 2 + 1).times do |possible_half_sum|\n # puts \"possible_half_sum: #{possible_half_sum}\"\n if dp[possible_half_sum] == 1 # means P or Q = possible_half_sum\n q_minus_p = maxsum - 2 * possible_half_sum\n # puts \"Q - P: #{q_minus_p}\"\n min_q_minus_p = [min_q_minus_p, q_minus_p].min\n # puts \"min Q - P: #{min_q_minus_p}\"\n end\n end\n\n min_q_minus_p\nend", "def how_many_solutions?(a, b, c)\n test = b**2 - 4*a*c\n if test > 0\n 2\n elsif test == 0\n 1\n else\n 0\n end\nend", "def compute\n ans = 0 \n for a in 100..999\n for b in 100..999\n ab = a * b \n ans = ab if palindrome? ab and ab > ans \n end\n end\n ans\nend", "def solution\n solve unless solved?\n @solution\n end", "def test_solve_empty_3x3\n square = MagicSquare.new(3)\n square.solve\n assert square.solved?\n assert_equal @@solutions.first, square.solution\n end", "def local_search(problem, max_iterations, max_unimprove_iterations, max_time, \n max_unimprove_time, mut_rate, report_time_interval = 2)\n best = greedy_solve(problem)[:solution]\n best_find_time = 0\n iter = 1\n unimprove_iter = 1\n unimprove_start_time = Time.now\n last_improve_time = Time.now\n start_time = Time.now\n last_rep_time = Time.now\n while ((!max_iterations || iter <= max_iterations) and \n (!max_unimprove_iterations || unimprove_iter <= max_unimprove_iterations) and\n (!max_time || (Time.now - start_time).to_i <= max_time) and \n (!max_unimprove_time || (Time.now - last_improve_time).to_i <= max_unimprove_time)) do\n nxt = mutate(best, problem.path_funcs.length, mut_rate) \n if objective_function(nxt, problem.path_funcs) > objective_function(best, problem.path_funcs) \n unimprove_start_time = Time.now\n last_improve_time = Time.now\n unimprove_iter = 1\n best = nxt\n best_find_time = Time.now - start_time\n else\n unimprove_iter += 1\n end\n iter += 1\n if (Time.now - last_rep_time).to_i >= report_time_interval\n msg = \"Iteration = #{iter}, Obj = #{objective_function(best, problem.path_funcs)}, \"\n msg += \"Elapsed Time = #{Time.now - start_time}\"\n puts msg\n last_rep_time = Time.now\n end\n end\n {:solution => best, :objective_func => objective_function(best, problem.path_funcs), \n :elapsed_time => Time.now - start_time, :best_find_time => best_find_time}\n end", "def solve\n squares = (1..500).to_a.map{ |i| i*i }\n squares.each do |a2|\n squares.each do |b2|\n c2 = a2 + b2\n if squares.include? c2\n a = Math.sqrt(a2).to_i\n b = Math.sqrt(b2).to_i\n c = Math.sqrt(c2).to_i\n if ( a + b + c ) == 1000\n return a * b * c\n end\n end\n end\n end\nend", "def solution \n row_search \n columns_search \n diagonal_search\n end", "def optimize\n left.ne(right.first)\n end", "def solution_correct?\n current = params[:solution].strip\n current.gsub!(/\\/\\*[\\w\\s]*\\*\\//,\"\") \n current.gsub!(/--.*\\n/,\"\")\n existing = format_str(@lesson.solution.strip)\n current = format_str(current.strip)\n if existing == current\n return true\n else\n existing_arr = existing.split\n current_arr = current.split\n len= existing_arr.length\n err =[]\n j=0 \n for i in 0..len\n if existing_arr[i]!=current_arr[i]\n err[j]= existing_arr[i]\n j=j+1 \n end\n end\n return err\n end \n end", "def right_optimizable?\n !right.equal?(operation.right)\n end", "def check_solution(test_number, array, target, expected)\n actual = linear_search(array, target)\n if actual != expected\n puts \"Test ##{test_number}: Incorrect value: got #{actual}, expected #{expected}\"\n return false\n end\n\n puts \"Test ##{test_number}: Correct\"\n return true\nend", "def solve\n a = Time.new\n for i in 0..@itemsSize - 1\n @table[0][i] = 0\n end\n \n for i in 1..@itemsSize - 1\n price = @problem.prices[i-1]\n weight = @problem.weights[i-1]\n for w in 1..@weights - 1\n if weight <= w\n if (price + @table[w - weight][i - 1]) > @table[w][i -1]\n @table [w][i]= price + @table[w - weight][i - 1]\n else\n @table[w][i] = @table[w][i - 1]\n end\n else\n @table[w][i] = @table[w][i - 1]\n end\n end\n end\n \n \n prev_item = 0\n for i in 1..@itemsSize - 1\n curr_item = @table[@weights - 1][i]\n if prev_item < curr_item\n @best_configuration.push(1)\n else\n @best_configuration.push(0)\n end\n prev_item = curr_item\n end\n \n @best_fitness = @table[@weights - 1][@itemsSize - 1]\n \n b = Time.new\n @time = b-a\n end", "def perform\n # Execute the naive algorithm and puts the result\n @standard_algorithm = StandardAlgorithm.new @a_matrix, @b_matrix\n puts 'Naive Algorithm:'\n @standard_algorithm.perform.print\n\n # This use the Ruby library to check the result\n puts @standard_algorithm.result == @a_matrix * @b_matrix ? 'OK' : 'NOK'\n\n # Same as above, using Strassen algorithm\n @strassen_algorithm = StrassenAlgorithm.new @a_matrix, @b_matrix\n puts 'Strassen Algorithm:'\n @strassen_algorithm.perform.print\n puts @strassen_algorithm.result == @a_matrix * @b_matrix ? 'OK' : 'NOK'\n end", "def solve0(show_res=true, debug=false)\n\n while not done?\n step0(debug)\n end\n\n if show_res or debug then\n puts show_state\n puts \"computed in #{@duration} sec\"\n end\n\n solution\n end", "def solution(a)\n return 0 if a.count < 3\n \n a.sort!\n for i in (2...a.count)\n x = a[i - 2]\n y = a[i - 1]\n z = a[i]\n \n return 1 if x + y > z && x + z > y && z + y > x\n end\n \n return 0\nend", "def solve_for_d_optimized\n hash = {}\n for a in (1..5)\n for b in (1..5)\n result = (a**2) + (b**2)\n if hash[result].nil?\n hash[result] = [\"(#{a}, #{b})\"]\n else\n hash[result] << \"(#{a}, #{b})\"\n end\n end\n end\n\n hash.each do |key, array|\n if array.length > 1\n puts \"This is the result (#{array})\"\n end\n end\nend", "def solve(ingredients, part_two: false)\n score = 0\n max = 0\n\n (0..100).each do |i|\n (0..100 - i).each do |j|\n (0..100 - i - j).each do |k|\n l = 100 - i - j - k\n capacity = calculate_total(ingredients, \"capacity\", i, j, k, l)\n durability = calculate_total(ingredients, \"durability\", i, j, k, l)\n flavor = calculate_total(ingredients, \"flavor\", i, j, k, l)\n texture = calculate_total(ingredients, \"texture\", i, j, k, l)\n calories = calculate_total(ingredients, \"calories\", i, j, k, l)\n\n next if part_two && calories != 500\n next if capacity <= 0 || durability <= 0 || flavor <= 0 || texture <= 0\n\n score = capacity * durability * flavor * texture\n max = score if score > max\n end\n end\n end\n max\nend", "def checkmate(k,a)\n # Checkmate test where king may be: k_attacks - used - king_attaks - cells_behind_the_king\n all = all_position\n p used = [k,a]\n k_attacks = king_position(k).uniq \n a_attacks = (amazon_postion(a) - free_cells(k,a)).uniq\n stand_positions = a_attacks - k_attacks - used\n safe_squares = (all - k_attacks - a_attacks - used).uniq\n ans = stand_positions.reduce([]){ |acc,x| \n if (safe_squares & king_position(x)).empty?\n p x\n acc.push(x) \n end\n acc\n }\n p ans\n ans.size\n \nend", "def recursive_solution\n\n end", "def main\n\n sum = 0\n\n (0..999).each do |i|\n sum += check(i)\n end\n\n puts \"Total - O(n) #{sum}\"\n\n # Needed to refresh following: https://en.wikipedia.org/wiki/Arithmetic_progression\n sum2 = sum_multiples(3, 1000) + sum_multiples(5, 1000) - sum_multiples(15, 1000)\n\n # Refreshed Big O too : http://stackoverflow.com/questions/487258/plain-english-explanation-of-big-o \n puts \"Total - O(1) #{sum2}\"\n\nend", "def solution(a, b)\n # write your code in Ruby 1.9.3\n a = 0 if a < 0\n return 0 if b<0\n return Math.sqrt(b).floor - Math.sqrt(a).ceil + 1\nend", "def solution(a)\n first_sum = a[0]\n second_sum = a.inject(&:+) - a.first\n result = (first_sum - second_sum).abs\n\n a[1..-2].each do |elem|\n first_sum = first_sum + elem\n second_sum = second_sum - elem\n tmp_result = (first_sum - second_sum).abs\n result = tmp_result if tmp_result < result\n end\n\n result\nend", "def done?\n puts \"iteration: #{@iterations += 1}\"\n return true if @iterations >= @max_iterations\n return false unless @simplex.permutation(2).map { |e|\n l = Math.sqrt((e[0] - e[1]).to_a.map{ |f| f**2 }.inject(&:+))\n l <= 0.5\n }.all?\n\n _f = 1/3 * @simplex.map(&:result).inject(&:+)\n _d = 1/3 * @simplex.map{ |e| (e.result - _f)**2 }.inject(&:+)\n _d <= TOLERANCE**2\n end", "def naive_solution(step_by_step = false)\n while grid.has_zeros?\n naked_single\n print_grid if step_by_step\n end\n raise StandardError, 'Something went wrong!' unless grid.valid?\n unless step_by_step\n grid.calculate_possible_values! # This is to avoid printing the last step\n print_grid\n end\n puts \"------ Solved! ------\\n\\n\"\n rescue\n raise StandardError, 'Something went wrong!' unless grid.valid?\n boxed_single\n print_grid if step_by_step\n naive_solution\n end", "def calculate_solution\n Solve.it!(\n GraphBuilder.graph_from_cache(@cache, @options),\n resolver.constraints\n )\n end", "def solved?\n self.fittest.fitness >= 1.0\n end", "def solve\n loop { break if !shift }\n return @solutions\n end", "def solution1\n n = 1000\n\n (1..n).each do |a|\n (1..n).each do |b|\n (1..n).each do |c|\n # d = 3rd root of (a**3 + b**3 - c**3)\n d = (a**3 + b**3 - c**3)**(1 / 3)\n print [a, b, c, d] if a**3 + b**3 == c**3 + d**3\n end\n end\n end\nend", "def evalSolution(pop, maxcost, minben)\r\n\r\n results=false \r\n # scan culture for solution\r\n (0...pop.get_population_size).each do |sgenomidx|\r\n\r\n if ( @opts.isWinner(pop.get_sgenome(sgenomidx),maxcost,minben) ) \r\n # we have a winner!\r\n @winner = pop.get_sgenome(sgenomidx) # save \r\n printAnSgenome(pop,sgenomidx) # show \r\n results=true\r\n break\r\n else\r\n results=false\r\n end\r\n\r\n end\r\n results\r\n\r\n end", "def solution(a)\n result = 0\n tmp_count = 0\n a.each_with_index do |val, idx|\n if val.zero?\n tmp_count += 1\n else\n result += tmp_count\n end\n end\n return result > 1000000000 ? -1 : result\nend", "def solved(ans)\n\n end", "def test\n\t\t@a+@b > @c && @a+@c > @b && @b+@c > @a\n\tend", "def check_solution(test_number, array, expected)\n actual = find_peaks(array)\n if actual != expected\n puts \"Test ##{test_number}: Incorrect value: got #{actual}, expected #{expected}\"\n return false\n end\n\n puts \"Test ##{test_number}: Correct\"\n return true\nend", "def solve\n end", "def isCryptSolution(crypt, solution)\n match = {}\n solution.each do |set|\n match[set[0]] = set[1]\n end\n\n nums = []\n temp = \"\"\n crypt.each do |word|\n word.each_char do |let|\n temp += match[let]\n end\n if temp[0] == '0' && temp.size > 1\n return false\n end\n nums << temp.to_i\n temp = \"\"\n end\n nums[0,2].reduce(:+) == nums.last\nend", "def check_solution(test_number, array, target, expected)\n actual = binary_search(array, target)\n if actual != expected\n puts \"Test ##{test_number}: Incorrect value: got #{actual}, expected #{expected}\"\n return false\n end\n\n puts \"Test ##{test_number}: Correct\"\n return true\nend", "def solve\n\t\t# Attempt to find a mismatch in start/end\n\t\t# letters in the maps. This signifies first\n\t\t# and last words of the solution\n\t\tdiff_list = []\n\t\t@start_map.each {|k,v|\n\t\t\tr = @end_map[k]\n\t\t\tdiff = r-v\n\t\t\tputs \"#{k} => #{v} | #{r} diff #{diff}\"\n\t\t\t\n\t\t\t# If values in map don't match, remember this\n\t\t\tif diff != 0\n\t\t\t\tdiff_list << diff\n\t\t\tend\n\t\t}\n\n\t\t# Ensure the matchings satisfy the properties of\n\t\t# and solvable puzzle. If there are \n\t\tputs diff_list\n\t\tif diff_list.size == 0\n\t\t\t# This means there are cycles (multiple\n\t\t\t# choices for the first word).\n\t\telsif diff_list.size == 2\n\t\t\t# Ensure there is exactly one starting\n\t\t\t# word and exactly one ending word\n\t\t\treturn [] if !diff_list.include?( 1 )\n\t\t\treturn [] if !diff_list.include?( -1 )\n\t\telse\n\t\t\t# This signifies an unsolvable puzzle\n\t\t\tputs \"Not Solvable\"\n\t\t\treturn []\n\t\tend\n\n\t\t# The characteristics of this word list look\n\t\t# good so far. Let's now try to enumerate the\n\t\t# solution array\n\t\treturn enumerate_solution\n end", "def problem_60\n prime_check = lambda do |a,b|\n (a + b).to_i.prime? && (b + a).to_i.prime?\n end\n\n find_match = lambda do |a,k|\n r = a.select {|p| k != p && prime_check.call(k,p) }\n end\n\n primes = Primes.upto(10_000).map(&:to_s)\n primes.delete(\"2\")\n\n hit = {}\n\n primes.each do |p1|\n p1a = find_match.call(primes,p1)\n p1a.each do |p2|\n p2a = find_match.call(p1a,p2)\n p2a.each do |p3|\n p3a = find_match.call(p2a,p2)\n p3a.each do |p3|\n p4a = find_match.call(p3a,p3)\n p4a.each do |p4|\n p5a = find_match.call(p4a,p4)\n if p5a.length > 0\n p5a.each do |p5|\n a = [p1,p2,p3,p4,p5]\n sum = a.map(&:to_i).reduce(&:+)\n unless hit[sum]\n puts \"#{sum} #{a.inspect}\"\n else\n hit[sum] = true\n end\n return sum\n end\n end\n end\n end\n end\n end\n end\nend", "def solve(nums, target)\n bs = nil\n nums.sort.reverse.combination(2).each do |i, j|\n %I{+ - * /}.each do |op|\n next if op == :* && (i == 1 || j == 1)\n next if op == :/ && (j == 1 || i % j != 0)\n res = i.send(op, j)\n next if op == :- && res == 0\n\n return \"#{i} #{op} #{j} = #{res}\" if res == target\n\n nn = nums.dup + [res]\n nn.delete_at(nn.index(i))\n nn.delete_at(nn.index(j))\n if ss = solve(nn, target)\n bs = \"#{i} #{op} #{j} = #{res}\\n#{ss}\"\n end\n end\n end\n bs\nend", "def solve\n answer_vector = Vector.float(@stiff_matrix.size)\n current_residuum = @force.clone\n current_z_vector = @force.clone.mul! @precondition_vector\n p_vector = @force.clone.mul! @precondition_vector\n\n while current_residuum.max_by{|n| n.abs}.abs > 0.001\n last_residuum = current_residuum.clone\n last_z_vector = current_z_vector.clone\n product_of_stiff_matrix_and_p_vector = @stiff_matrix.product(p_vector)\n alpha_val = last_residuum * last_z_vector / (p_vector * product_of_stiff_matrix_and_p_vector)\n answer_vector += alpha_val * p_vector\n current_residuum = last_residuum - alpha_val * product_of_stiff_matrix_and_p_vector\n #loop can be broken here if residuum is small enough\n current_z_vector = current_residuum.clone.mul! @precondition_vector\n p_vector = current_z_vector + p_vector * (current_z_vector * current_residuum / (last_z_vector * last_residuum))\n end\n\n return answer_vector\n end", "def test_HEURISTIC_20\n path=\"/home/miro/NetBeansProjects/Knapsack/test/\"\n\n p=Solver.new\n\n p.read_problem(path+\"input3\")\n\n assert_equal(1979, p.heuristic)\n\n p=Solver.new\n p.read_problem(path+\"input4\")\n\n assert_equal(2168, p.heuristic)\n\n p=Solver.new\n p.read_problem(path+\"input5\")\n\n assert_equal(2516, p.heuristic)\n\n\n\n end", "def better_two_sum?(arr, target_sum)\n hash = {}\n arr.each_with_index do |ele,i|\n hash[ele] = i\n end\n arr.each_with_index do |ele,i|\n target = target_sum - ele\n return true if !hash[target].nil? && i != hash[target]\n end\n \n false\nend", "def solution(m, a)\n n = a.count\n result = 0\n front = 0\n numbers = Array.new(m + 1, false)\n n.times { |back|\n while front < n and not numbers[a[front] - 1]\n numbers[a[front] - 1] = true\n front += 1\n result += front - back\n return 1_000_000_000 if result >= 1_000_000_000\n end\n numbers[a[back] - 1] = false\n }\n result\nend", "def solution\n (2..(9**5 * 6)).select do |n|\n n.to_s.split(//).map do |d|\n d.to_i ** 5\n end.reduce(:+) == n\n end.reduce(:+)\nend", "def sol inp\n k, ins = inp.split(' ',2)\n k = k.to_i\n ps, pr, pi, pu, pw, pd, pl = ins.split.map(&:to_f)\n\n @ps = ps\n @pr = pr\n @pu = pu\n @pw = pw\n @pd = pd\n @pl = pl\n\n #\n # required_wins = 2\n # # winning 1st set\n # first_set = ps*pi + pr*(1-pi)\n # # winning 2nd set\n # first_set * winning_another_set + (1-first_set)*winning_another_set\n #\n # required_wins.times do |i|\n # count = 0\n # while count <= i\n # wins[i] = win_scene(pi,ps,pr, count)\n # count+=1\n # break if count == i\n # lose_scene(pi,ps,pr, pr,count)\n # end\n # end\n\n # winning second set after winning first + winning second set after winning one\n # wins[0]*win_scene(pi,ps,pr) + (1-wins[0])*lose_scene(pi,ps,pr)\n\n def win_scene(pi,round,required_wins,current_wins)\n return 0 if round >= required_wins\n # puts \"w #{' '*round},#{required_wins},#{current_wins})\"\n sunny = (round == 0) ? pi : (pi+(@pu*@pw))\n sunny = 1.0 if sunny > 1\n sunny = 0.0 if sunny < 0\n chance = sunny*@ps + (1-sunny)*@pr\n binding.pry if chance > 1\n\n if required_wins == current_wins+1\n chance\n else\n # return 0 if round > 100\n return 0 if (10**7*chance).to_i < 1\n wins = win_scene(sunny,round+1,required_wins,current_wins+1)\n # lose = lose_scene(sunny,round+1,required_wins,current_wins+1)\n chance * (wins)#+ (1-chance)*lose\n end\n end\n\n def lose_scene(pi,round,required_wins,current_wins)\n return 0 if round >= required_wins\n # puts \"l #{' '*round},#{required_wins},#{current_wins})\"\n sunny = (round == 0) ? pi : (pi-(@pd*@pl))\n sunny = 1.0 if sunny > 1\n sunny = 0.0 if sunny < 0\n chance = sunny*@ps + (1-sunny)*@pr\n binding.pry if chance > 1\n\n if required_wins == current_wins\n chance\n else\n # return 0 if round > 100\n return 0 if (10**7*chance).to_i < 1\n wins = win_scene(sunny,round+1,required_wins,current_wins+1)\n # lose = lose_scene(sunny,round+1,required_wins,current_wins+1)\n chance * (wins) #+ (1-chance)*lose\n end\n end\n\n # a = win_scene(pi,0,1,0)\n b = win_scene(pi,0,k,0)\n c = lose_scene(pi,0,k,0)\n # c = (k > 1) ? lose_scene(pi,1,k,0) : 0\n\n puts b\n puts c\n b +c\n # wtf?\n # 0.4* win_scene(pi,0,k,0)+ (1-0.6)*lose_scene(pi,0,k,0)\n\n# def smth(pi, ps, pr, setcount=0)\n# arr[1] = arr[0]\n# end\n# # set 2+ ?\n# set2 = ((ps+pu)*pw + ps*(1-pw))*pi\n# (1-set1)*((ps-pd)*pl + ps*(1-pl))\n# if k > 1\n# (k-1).times do\n#\n# end\n# end\nend", "def solve( n = 10_000 )\n (1..n).select {|i| i.amicable?}.reduce( :+ )\n end", "def solution4\n palindrome = 1000\n (900..999).each do |num1| # checks between 900-999, likely solutions are probably here\n (900..999).each do |num2|\n product = num1 * num2\n palindrome = product if palindrome?(product) && product > palindrome\n end\n end\n palindrome\nend", "def combo_optimal?\n optimal_value == combo_witheffect\n end", "def solution(x, y, d)\r\n # write your code in Ruby 2.2\r\n i=1\r\n loop do\r\n s=x+i*d\r\n \r\n break if(s>=y)\r\n \r\n i+=1\r\n end \r\n i\r\nend", "def solution(n)\n\tval = 0.0\n\tval += 1.0 unless n[0].zero?\n\tval += 2.0 unless n[1].zero?\n\tval += 4.0 unless n[2].zero?\n\tval += 8.0 unless n[3].zero?\n val\n\t\nend", "def problem_106\n a = [1,2,3,4]\n a = [1,2,3,4,5,6,7]\n a = [1,2,3,4,5,6,7,8,9,10,11,12] \n \n num = 0\n seen = {}\n # Don't do length of 1, they are ordered\n # Because they are size ordered, and 2 smalls are bigger than a large\n 2.upto(a.length/2) do |n|\n puts \"n = #{n}\"\n a.combination(n) do |set_a|\n b = a - set_a\n break if b.length < n\n b.combination(n) do |set_b|\n key = [set_a,set_b].sort\n next if seen[key]\n seen[key] = true\n index = 0\n state = 0\n 0.upto(set_a.length-1) do |i|\n break unless set_b[i] && set_a[i]\n if set_a[i] < set_b[i]\n state -= 1\n else\n state += 1\n end\n end\n\n# print \"#{set_a.inspect} #{set_b.inspect} #{state}\"\n if state.abs <= (set_a.length - 2) ||\n (state < 0 && set_a.last > set_b.last) ||\n (state > 0 && set_a.first < set_b.first)\n# puts \" good\"\n num += 1\n else\n# puts \"\"\n end\n end\n end\n end\n num\nend", "def checkSrepIntersection\n (0..$sreps.length-1).each do |j|\n (0..$sreps.length-1).each do |i|\n if i != j\n $sreps[j].checkIntersection($sreps[i])\n end\n end\n end\n end", "def compute_best_score(team, pilots, pilot_contests)\n combination = []\n total = 0.0\n total_possible = 0\n puts 'compute_score TBD'\nend", "def checker\n @correct_pos = 0\n @correct_num = 0\n x = 0\n @guess.each do |i|\n if (i == @solution[x])\n @correct_pos += 1\n elsif @solution.include?(i)\n @correct_num += 1\n end\n x += 1\n end\n end", "def approxmatching(a,b)\n\treturn (a==b)\nend", "def brute_force_optimal(tg,faulty,replacements,n)\n if tg[1].size == 0 # special case if there are no edges(all replacements are equal)\n return get_mappings(faulty,replacements)[0] # return the first mapping\n end\n get_mappings(faulty,replacements).min_by do |a|\n euclidean_distance(tg,a,n) \n end\nend", "def solve\n return ((1..40).inject(:*) / ((1..20).inject(:*) ** 2))\nend", "def formingMagicSquare(s)\r\n out = 100\r\n for i in 0...8 do\r\n cost = 0\r\n for j in 0...3 do\r\n for k in 0...3 do\r\n cost += ($magic_square[i][j][k] - s[j][k]).abs\r\n end\r\n end\r\n puts cost\r\n out = [out, cost].min\r\n end \r\n out\r\nend", "def solution_proximity_heuristic(amount,comb,coins)\n (amount-comb.sum)*min_size_heuristic(amount,comb,coins)\nend", "def improve\n return false unless valid?\n true\n end", "def solution\n (1..40).inject(:*) / (1..20).inject(:*)**2\nend", "def solution(a, b)\n count = 0\n puts 0 if b < a || b < 0\n (a..b).each do |s|\n count += 1 if square?(s)\n end\n puts count\nend", "def solution(a)\r\n # write your code in Ruby 2.2\r\n #trangular\r\n # a[0] = 10\r\n # a[2] = 5\r\n # a[4] = 8\r\n # 10 + 5 > 8\r\n # 5 + 8 > 10\r\n #8 + 10 > 5\r\n \r\n \r\n l=a.count\r\n \r\n i=0\r\n while(i<l) do\r\n j=i+1\r\n while(j<l) do\r\n k=j+1\r\n \r\n \r\n while(k<l) do\r\n if((a[i] + a[j] > a[k]) && (a[j] +a[k] > a[i]) && (a[k] + a[i] >a[j]))\r\n return 1\r\n end\r\n k+=1 \r\n end \r\n \r\n j+=1 \r\n end\r\n i+=1\r\n end\r\n \r\n return 0\r\n \r\nend", "def optimize\n right\n end", "def optimize\n right\n end", "def solution(s, p, q)\n # write your code in Ruby 2.2\n g = s.length + 1\n a = (s.length + 1)**3\n c = (s.length + 1)**2\n tmp = []\n res = []\n tmp.push 0\n o = 0\n s.split('').each do |i|\n o += if i == 'T'\n 1\n elsif i == 'G'\n g\n elsif i == 'C'\n c\n else\n a\nend\n tmp.push o\n end\n (0...p.length).each do |k|\n o = tmp[q[k] + 1] - tmp[p[k]]\n if o >= a\n res.push 1\n elsif o >= c\n res.push 2\n elsif o >= g\n res.push 3\n else\n res.push 4\n end\n end\n res\nend", "def solver (seed_char, blanks_words_sizes, matrix)\n\t# Set numerical target\n\ttarget = magic_num(seed_char)\t\n\t# Find magic number sum buckets\n\tskynet(target, blanks_words_sizes, blanks_words_sizes.length - 1, 0, [])\n\t# Alphabetical sort input matrix\n\tsorted_seed_char = seed_char.chars.sort.join\t\n\n\t# Find unique sets from skynet solutions\n\t$answer[:trace].each do |arrOarr|\n\t\tarrOarr.sort!\n\tend \n\n\t$answer[:trace].uniq!\t\n\t\n\t# Finds match for complete set of words from skynet solutions\n\t$answer[:trace].each do |answer_arr_el|\t\t\t\t\n\t\tunordered_match(sorted_seed_char, matrix, answer_arr_el, answer_arr_el.length - 1, \"\", [])\n\t\t# Can be ignored\n\t\t$ops += $seed[answer_arr_el[0][0]][:num_groups][answer_arr_el[0][1]].length *\n\t\t\t$seed[answer_arr_el[1][0]][:num_groups][answer_arr_el[1][1]].length *\n\t\t\t$seed[answer_arr_el[1][0]][:num_groups][answer_arr_el[1][1]].length *\n\t\t\t$seed[answer_arr_el[1][0]][:num_groups][answer_arr_el[1][1]].length\t\t\n\tend\n\t\n\treturn $answer[:words]\nend", "def get_to target\n calculate if @results.nil?\n @results.each do |eq, result|\n puts \"*\" * 30 if result == target.to_i\n puts \"#{eq} = #{result}\"\n puts \"*\" * 30 if result == target.to_i\n end\n\n puts \"%d equations tested\" % @equations.length\n end", "def naive(a, target)\n\ta.each do |ie, i|\n\t\ta.each do |je, j|\n\t\t\tnext if i == j # cant be the same, i assume\n\t\t\treturn true if ie + je == target\n\t\tend\n\tend\n\treturn false\nend", "def special_pythag_trip(target_sum)\n\ta = 1\n\tb = 1\n\tfor a in (1..target_sum) do\n\t\tfor b in (1..target_sum) do\n\t\t\t#puts \"a : #{a}\"\n\t\t\t#puts \"b : #{b}\"\n\t\t\tsum_of_squares = a*a + b*b\n\t\t\tc = Math.sqrt(sum_of_squares).to_i\n\t\t\t\n\t\t\tif c*c == sum_of_squares\n\t\t\t\ttriple = [a,b,c] \n\t\t\t\tsum = triple.inject(0) {|sum,num| sum + num}\n\t\t\t\t\n\t\t\t\treturn triple[0]*triple[1]*triple[2] if sum == target_sum\n\t\t\tend\n\t\t\t\n\t\tend\n\t\n\tend\nend", "def optimize\n left\n end", "def optimize\n left\n end", "def optimize\n left\n end", "def find_target_sum_ways(nums, s)\n return calculate(nums, 0, 0, s, cache={})\nend", "def solve\n solution_candidate(intersections.next_people_with_similar_tastes)\n end", "def temp_test(sudoku_datas)\n sudoku_cells = prepare_sudoku_cells(sudoku_datas)\n # display_sudoku(sudoku_cells, \"Sudoku to solve\")\n # build the potential list of values for each cell\n build_potential_value_list(sudoku_cells)\n update_cells(sudoku_cells) # update the value of each cell\n counter = 0\n # continue to the try to solve\n # if the counter goes beyond a million\n # it's probably a bad sudoku\n \n display_sudoku(sudoku_cells, \"Test\")\n shed_potential_value_list(sudoku_cells)\n \n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n double_whammer(sudoku_cells)\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n double_whammer(sudoku_cells)\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n double_whammer(sudoku_cells)\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n double_whammer(sudoku_cells)\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n double_whammer(sudoku_cells)\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n double_whammer(sudoku_cells)\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n double_whammer(sudoku_cells)\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n double_whammer(sudoku_cells)\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n double_whammer(sudoku_cells)\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n double_whammer(sudoku_cells)\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n double_whammer(sudoku_cells)\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n double_whammer(sudoku_cells)\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n \nend", "def is_solution? \n zero= false\n 0.upto(@width-1) do |x|\n 0.upto(@height-1) do |y|\n if @pole[x][y]==0\n zero = true\n break\n end\n end\n end\n print \"Je to reseni, pyco!\\n\" if !zero\n return !zero \n end", "def simulatedAnnealing(is,cS,cC,bSolution,bCost,temp,final_temp,alpha)\n #membuat array untuk menampung setiap solusi\n solusiTemp = {}\n solusiBestSolution = {}\n solusiBestCost= {}\n j=1 #insisialisasi\n while temp > final_temp do\n\n for i in 1..100\n #memunculkan bilangan random untuk perbandingan sekarang dengan yang baru\n x11 = fungsiRandom()\n x22 = fungsiRandom()\n nS = [x11,x22] #state baru\n nC = cost(nS) #perhitungan fungsi dari state baru\n end\n if nC < cC then #membandingkan costBaru dengan costSekarang\n cS = nS\n cC = nC\n if cC < bCost then #jika costBaru lebih kecil dari costSekarang maka bandingkan dengan bestCost\n bSolution = cS\n bCost = cC\n end\n else #jika tidak maka diliat nilai probab\n #ilitasnya lalu bandignkan dengan nilai random(0,1)\n if (prob(nC,cC,temp) > fungsiRandom01()) then\n cS = nS\n cC = nC\n end\n #menampung solusi\n solusiTemp[j] = temp\n solusiBestSolution[j] = bSolution\n solusiBestCost[j] = bCost\n end\n j = j+1\n temp = temp * alpha #Menghitung penentu iterasi temperatur\n end\n xx = solusiTemp[solusiTemp.length]\n y = bSolution\n z = bCost\n #mengembalikan nilai solusi\n return solusiTemp,solusiBestSolution,solusiBestCost,xx,y,z\n\nend", "def compute_best\n best = @population.max_by { |x| x.fitness(@target) }\n @finished = true if best.fitness(@target) == @perfect_score\n best.phrase\n end" ]
[ "0.7030417", "0.67422885", "0.67422885", "0.66741127", "0.6667087", "0.6551995", "0.6245569", "0.6243538", "0.62407213", "0.62390614", "0.62370056", "0.6219705", "0.61195153", "0.61195153", "0.61195153", "0.6039978", "0.60141444", "0.5994897", "0.5981281", "0.59684575", "0.5967763", "0.5949301", "0.5919466", "0.59172416", "0.5905405", "0.5900278", "0.5900035", "0.58831584", "0.58586246", "0.5843724", "0.5839463", "0.58371496", "0.58350235", "0.583487", "0.583282", "0.58320105", "0.5806386", "0.58002174", "0.57981646", "0.5780018", "0.57784075", "0.57653844", "0.5745477", "0.57451826", "0.574356", "0.57246614", "0.5704061", "0.5695567", "0.5691306", "0.5685267", "0.5673992", "0.5661481", "0.56611", "0.56553864", "0.56489897", "0.5632119", "0.56316954", "0.5630642", "0.5628319", "0.5621782", "0.56182176", "0.56158704", "0.5610085", "0.5609558", "0.56043017", "0.5588553", "0.5587982", "0.55868936", "0.55866116", "0.5578704", "0.55698025", "0.55665207", "0.5565664", "0.55651873", "0.5564576", "0.55642575", "0.55562156", "0.5555481", "0.5549504", "0.5542305", "0.5538127", "0.5537965", "0.5534269", "0.55334294", "0.5533033", "0.5533033", "0.55318826", "0.55287045", "0.5518156", "0.55129784", "0.5512377", "0.551156", "0.551156", "0.551156", "0.55108565", "0.55087966", "0.55066055", "0.54978186", "0.54842967", "0.5484183" ]
0.76241046
0
I chose to add the room object just in case I need to access the fields for each room
def add_room(room) @@number_of_rooms += 1 @rooms << room end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def room; end", "def room\n end", "def room\n Room.all.find { |room| room.id == room_id }\n end", "def add_room(room)\n @rooms << room\n return self\nend", "def create_room\n Room.new\n end", "def initialize\n @credentials = Authenticate.get_credentials\n @db = CouchRest.database(\"http://#{@credentials[\"user\"]}:#{@credentials[\"password\"]}@localhost:5984/rooms\")\n @rooms = {}\n @db.get(\"_design/room\").\n view(\"all_rooms\")['rows'].map{|x| x['value']}.each do |room|\n id = room['_id']\n @rooms[id] = {}\n @rooms[id]['_id'] = id\n @rooms[id]['room'] = room\n devices = @db.get('_design/room').view('devices_for_room', {:key => id})['rows'].map{|x| x['value']}\n @rooms[id]['sources'] = @db.get('_design/cmdr_web').view('sources', {:key => id})['rows'].map{|x| x['value']}\n @rooms[id]['actions'] = @db.get('_design/cmdr_web').view('actions', {:key => id})['rows'].map{|x| x['value']}\n @rooms[id]['room_name'] = room['attributes']['name']\n devs = {}\n DEVICES.each do |r,_|\n devs[r] = room['attributes'][r]\n end\n @rooms[id]['devices'] = devs\n @rooms[id]['devices_by_id'] = {}\n @rooms[id]['device_record_by_resource'] = {}\n devs.each do |k,v|\n d = devices.find {|d| d['attributes']['name'] == v}\n if d\n @rooms[id]['devices_by_id'][d['_id']] ||= []\n @rooms[id]['devices_by_id'][d['_id']] << k\n end\n @rooms[id]['device_record_by_resource'][k] = d\n end\n end\n end", "def room\n return self\n end", "def add_room(room)\n @rooms << room\n return self\n end", "def add_room(room)\n @rooms << room\n return self\n end", "def new\n @room = Room.new\n @room = @venue.rooms.new\n end", "def set_room\n @room = Room.get_room(params[:id], params[:branch_id]).first\n end", "def mainroom\n\t\tself.class.instance_variable_get(:@mainroom)\n\tend", "def make_hotel_rooms\n (1..20).each do |num|\n @all_rooms << num #Hotel::Room.new(num) I don't think I have to do this\n end\n end", "def populate_room\n unless @dungeon.first_room\n @enemy = Zarta::Enemy.new(@dungeon) if enemy_spawned\n end\n @dungeon.first_room = false\n @weapon = Zarta::Weapon.new(@dungeon) if weapon_spawned\n @stairs = stairs_spawned\n end", "def set_room\n @room = Room.find(params[:id])\n \n end", "def add_room(reference, name, description, connections)\n new_room = Room.new(reference, name, description, connections) \n @rooms << new_room\n return new_room\n end", "def search_room\n @rooms=Room.new\n \n\n # #debugger\n end", "def room_list\n\t\t@room = Accommodation.find_all_by_host_id(@current_user.id)\n\t\t@date = RoomBooking.find_all_by_room_id(@room)\n \tend", "def set_room\n @room = Room.find(params[:id])\n end", "def initialize()\n super\n @odata_type = \"#microsoft.graph.room\"\n end", "def create\n @room = Room.new(room_params)\n @room.name = \"Room \" +@room.name\n @room.admin_id = current_admin.id\n respond_to do |format|\n if @room.save\n format.html { redirect_to rooms_path , notice: 'Room was successfully created.' }\n format.json { render :show, status: :created, location: @room }\n else\n format.html { render :new }\n format.json { render json: @room.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_room\n @room = Room.find(params[:id])\n end", "def set_room\n @room = Room.find(params[:id])\n end", "def set_room\n @room = Room.find(params[:id])\n end", "def set_room\n @room = Room.find(params[:id])\n end", "def set_room\n @room = Room.find(params[:id])\n end", "def set_room\n @room = Room.find(params[:id])\n end", "def set_room\n @room = Room.find(params[:id])\n end", "def set_room\n @room = Room.find(params[:id])\n end", "def set_room\n @room = Room.find(params[:id])\n end", "def set_room\n @room = Room.find(params[:id])\n end", "def set_room\n @room = Room.find(params[:id])\n end", "def set_room\n @room = Room.find(params[:id])\n end", "def set_room\n @room = Room.find(params[:id])\n end", "def set_room\n @room = Room.find(params[:id])\n end", "def set_room\n @room = Room.find(params[:id])\n end", "def set_room\n @room = Room.find(params[:id])\n end", "def set_room\n @room = Room.find(params[:id])\n end", "def set_room\n @room = Room.find(params[:id])\n end", "def set_room\n @room = Room.find(params[:id])\n end", "def set_room\n @room = Room.find(params[:id])\n end", "def set_room\n @room = Room.find(params[:id])\n end", "def set_room\n @room = Room.find(params[:id])\n end", "def set_room\n @room = Room.find(params[:id])\n end", "def set_room\n @room = Room.find(params[:id])\n end", "def set_room\n @room = Room.find(params[:id])\n end", "def set_room\n @room = Room.find(params[:id])\n end", "def set_room\n @room = Room.find(params[:id])\n end", "def set_room\n @room = Room.find(params[:id])\n end", "def set_room\n @room = Room.find(params[:id])\n end", "def set_room\n @room = Room.find(params[:id])\n end", "def set_room\n @room = Room.find(params[:id])\n end", "def local_rooms\n @local_rooms ||= begin\n room_hashes = @data['rooms'] || []\n room_hashes.map { |hash| Room.new(hash) }\n end\n end", "def get_room(id)\n @rooms[id]\n end", "def add(room)\r\n raise \"Illegal room: #{room.inspect}\" unless room.class == Room\r\n puts \"Room #{room.id} already exists.\" if @rooms[room.id]\r\n @rooms[room.id] = room\r\n @current_room = room unless @current_room\r\n end", "def setup_hotel\n single = Room.new('Single', 1, 30)\n double = Room.new('Double', 2, 50)\n family = Room.new('Family', 4, 85)\n\n hotel = Hotel.new\n hotel.add_room_type(single, 2)\n hotel.add_room_type(double, 3)\n hotel.add_room_type(family, 1)\n hotel\nend", "def update_rooms\n Room.find_or_create_by(name: @moving_item.room)\n end", "def set_room\n @room = Room.find_by_id(params[:id])\n end", "def room_list\n @roomtype = DetailRoom.all_types\n @time = Room.all_times\n @day_list = Room.all_days\n if session[:admin] == nil\n redirect_to rooms_path\n end\n @admin = session[:admin]\n @rooms = {} \n @roomtype.each do |type|\n @rooms[type] = DetailRoom.find_all_by_room_type(type)\n end \n end", "def set_room\n @room = TmuAdmin::Room.find(params[:id])\n end", "def add_item_to_the_room\n @item = Item.find(params[:id])\n @room = Room.find(params[:room_id])\n \n @item.rooms << @room\n \n render json: @item, include: :rooms\n\n end", "def room_params\n params.require(:room).permit(:title, :location, :description, :user_id)\n end", "def add_room(reference, name, description, connections)\n\t\t@rooms << Room.new(reference, name, description, connections)\n\tend", "def set_room\n @room = Room.find(params[:room_id])\n end", "def set_room\n @room = Room.find(params[:room_id])\n end", "def new\n @room = Hotel.find(params[:hotel_id]).rooms.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @room }\n end\n end", "def roll\n room = Room.new\n room.short_name = short_name\n room.description = description\n room\n end", "def set_room\n\t\t\t@room = Room.find(params[:id])\n\t\tend", "def create\n param = room_params\n \n roomtype=Roomtype.new\n roomtype.AC=param[:AC]\n roomtype.beds=param[:beds].to_i\n param.delete(\"AC\")\n param.delete(\"beds\")\n @room = current_hotel.rooms.build(param)\n respond_to do |format|\n if @room.save\n roomtype.room_id=@room.id\n roomtype.save\n format.html { redirect_to @room, notice: \"Room was successfully created.\" }\n format.json { render :show, status: :created, location: @room }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @room.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(id, alas, users, timestamp)\n room = rooms[id]\n room.alias = alas unless alas.nil? || alas.empty?\n room.users = users unless users.nil? || users.empty?\n room.timestamp = timestamp unless timestamp.nil?\n room\n end", "def show\n gon.current_user = current_user\n gon.users = @room.users\n @new_room = Room.new\n @rooms = Room.all\n end", "def rooms\n Hpricot(get.body).search(\"//h2/a\").collect do |a|\n Room.new(self, room_id_from_url(a.attributes['href']), a.inner_html)\n end\n end", "def edit\n @rooms = { \n items: Room.all, \n }\n end", "def add_room(reference, name, description, connections)\r\n @rooms << Room.new(reference, name, description, connections)\r\n end", "def set_room_user\n\t\t\t@room_user = {'owner': Room.find(params[:id]).owner, \"admins\": [], \"members\": []}\n\t\t\tRoom.find(params[:id]).admins.order(\"state DESC, nickname ASC\").each do |admin|\n\t\t\t\t@room_user[:admins] << admin unless @room_user[:owner] == admin\n\t\t\tend\n\t\t\tRoom.find(params[:id]).members.order(\"state DESC, nickname ASC\").each do |member|\n\t\t\t\t@room_user[:members] << member unless @room_user[:owner] == member || @room_user[:admins].include?(member)\n\t\t\tend\n\t\tend", "def initialize\n @rooms = list_rooms\n @reservations = []\n end", "def get_room\n @key = @a_keys.shift\n find_room(@key)\n end", "def get_room(id)\n return @rooms[id] if @rooms.key? id\n room = Room.new id, @users, @matrix\n @rooms[id] = room\n broadcast(:added, room)\n room\n end", "def set_room_information\n @room_information = RoomInformation.find(params[:id])\n end", "def room_params\n params.require(:room).permit(:name, :description, :floor_id, :capacity,\n :computers, :roomtype_id)\n end", "def rooms_by_key\n @rooms_by_key ||= begin\n by_key = {}\n\n rooms.each do |room|\n if by_key.key?(room.key)\n raise \"Unexpected duplicate room #{room.key}: #{room.inspect}\"\n end\n\n by_key[room.key] = room\n end\n\n by_key\n end\n end", "def room(location = nil)\n return @@current_room if location.nil?\n Item.allRooms.each do |r|\n return r if r.item_id == location\n end\n# @room[@room_id]\n end", "def room_params\n params.fetch(:room, {}).permit(:name, :floor, :building)\n end", "def create\n @room = Room.new(room_params)\n @room.hotel = Hotel.find_by_name(params[:room][:hotel])\n \n respond_to do |format|\n if @room.save\n format.html { redirect_to crew_rooms_path, notice: 'Quarto foi criado com sucesso.' }\n format.json { render :edit, status: :created, location: @room }\n else\n format.html do\n set_hotel_names\n render :new \n end \n\n format.json { render json: @room.errors, status: :unprocessable_entity }\n end\n end\n end", "def to_resource\n\t\t\tr = super\n\t\t\tr[\"current room\"] = r.delete(:parent)\n\t\t\tr\n\t\tend", "def edit_plug_data\n @form_data = Hash.new\n @form_data[:rooms] = Array.new\n \n current_user.rooms.each do |r|\n @form_data[:rooms].push r\n \n if r.id == @object.room_id\n @form_data[:current_room_id] = r.id\n @form_data[:current_room_name] = r.name\n end\n end\n end", "def room_params\n params.require(:room).permit(:name, :ubication, :location_id, :noise, :sockets, :availability)\n end", "def room_params\n params.require(:room).permit(:title, :code, :building_id)\n end", "def room_params\n params.require(:room).permit(:title, :code, :building_id)\n end", "def set_room\n @room = Room.find(params[:room_id].to_i) unless params[:room_id].nil?\n end", "def set_room\n @room = current_user.rooms.find_by(id: params[:id] || params[:room_id])\n end", "def create\n @admin_room = Room.new(admin_room_params)\n @room_detail = @admin_room.room_detail\n\n respond_to do |format|\n if @admin_room.save\n format.html { redirect_to @admin_room, notice: 'Room was successfully created.' }\n format.json { render action: 'show', status: :created, location: @admin_room }\n else\n format.html { render action: 'new' }\n format.json { render json: @admin_room.errors, status: :unprocessable_entity }\n end\n end\n end", "def room_params\n params.require(:room).permit(:room_name)\n end", "def create\n @room = Room.new(room_attributes.merge(owner: current_user))\n if @room.save\n created(@room)\n else\n validation_errors(@room)\n end\n end", "def room_params\n params.require(:room).permit(:name, :user_id)\n end", "def room_params\n params.require(:room).permit(:name, :description)\n end", "def room\n return Cave.roomInstance(@@currentRoom-1)\n end", "def set_room\n @room = Room.find(params[:id])\n @page_title << @room.name\n end", "def initialize\n @name = \"Purr Seasons\"\n @address = \"32 Cat St, Tabby Town\"\n @phone = \"1800 MEOW MEOW\"\n @email = \"say_meow@purrseasons.com\"\n @about = \"~ An Experience Your Cat Won\\'t Forget ~ \\n The Purr Seasons is a luxury cat hotel. \\n It's so good you'll wish you could stay too! \\n\\n All our rooms are heated to the purr-fect temperature,\\n are fitted with cosy furnishings,\\n include lots of cuddle time (if your cat likes that!),\\n and are designed to make your cat feel at home. \"\n @rooms = [] # Array of room objects - one advantage of having this array is that when new rooms are added to the Hotel class, the rest of the code does not have to be changed, and it will display in the main application. \n end", "def room_params\n\t\t\tparams.require(:room).permit(:room_name)\n\t\tend" ]
[ "0.7319732", "0.7277355", "0.6999474", "0.693979", "0.690429", "0.6823303", "0.67996067", "0.6752659", "0.6752659", "0.66493374", "0.65897214", "0.6576417", "0.6555604", "0.65161395", "0.65097165", "0.64731073", "0.64707375", "0.64694667", "0.64661926", "0.6459539", "0.64592284", "0.64515287", "0.64515287", "0.64515287", "0.64515287", "0.64515287", "0.64515287", "0.64515287", "0.64515287", "0.6446552", "0.6446552", "0.6446552", "0.6446552", "0.6446552", "0.6446552", "0.6446552", "0.6446552", "0.6446552", "0.6446552", "0.6446552", "0.6446552", "0.6446552", "0.6446552", "0.6446552", "0.6446552", "0.6446552", "0.6446552", "0.6446552", "0.6446552", "0.6446552", "0.6446552", "0.64457214", "0.6445122", "0.64347064", "0.6423556", "0.6423381", "0.6415503", "0.6414258", "0.64077365", "0.640259", "0.63886607", "0.6387932", "0.6378104", "0.6368707", "0.6368707", "0.6361319", "0.6359622", "0.6353482", "0.63490826", "0.63335425", "0.6310067", "0.6293517", "0.6287885", "0.62595326", "0.6250301", "0.6246237", "0.62421113", "0.62363046", "0.623276", "0.6223052", "0.61980844", "0.6188263", "0.61835754", "0.61771125", "0.6160083", "0.61593795", "0.61578745", "0.6150861", "0.6150861", "0.61463416", "0.61455584", "0.61409914", "0.6140011", "0.61353946", "0.61338603", "0.61194015", "0.6106476", "0.6099917", "0.6098565", "0.60944265" ]
0.6479908
15
prompt asks us to create a list of directors with their names only using source as an argument. pping source indicates that source is the entire nds
def list_of_directors(source) dir_list = [] dir_index =0 while dir_index<source.length do dir_list << source[dir_index][:name] dir_index +=1 end dir_list end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_of_directors(source)\nrow_index = 0\narray =[]\nwhile row_index < source.length\n array << source[row_index][:name]\n row_index += 1\nend\narray\nend", "def print_directors(nds)\n pp nds\nend", "def directors\n parse_crew('Directed by')\n end", "def list_sources\n sources = Profile.get_guardian_headlines\n # prints out numbered articles\n sources.each do |key, value|\n puts ColorizedString[\"#{key}.\"].red + \" #{value[0]}\"\n end\n # asks for input\n input = choose_source(sources)\n choice = sources[input][0]\n print ColorizedString[\"You have chosen:\"].red\n puts ColorizedString[\" #{choice}\"].underline\n sources[input][1]\n end", "def directors\n to_array search_by_itemprop 'director'\n end", "def directors_name\n document[\"castingShort\"][\"directors\"].split(\", \") rescue nil\n end", "def create_destination_name_options (destination_names)\n return \"\" if destination_names.empty?\n\n str = \"\"\n destination_names.each { |name|\n str << \"-destination name='#{name}' \"\n }\n return str.strip\nend", "def test_fortune_from_all_named_fortune_sources\n sources = LinuxFortune.get_sources\n fortunes = []\n fortunes << LinuxFortune.generate( sources )\n assert !fortunes.empty?\n end", "def find_sources\n names = \"\"\n Googlenews.items(100).each do |report|\n name = report['title'].match(/ - ([\\w. ]+)/)[1]\n names << name\n unless Source.find_by_name(name)\n source = Source.new({\n :name => name\n })\n source.save\n end\n end\n render :text => names\n end", "def movies_with_directors_set(source)\n result = []\n i = 0 \n while i < source.length do \n dir_name = source[i][:name]\n dir_movies = source[i][:movies]\n result << movies_with_director_key(dir_name, dir_movies)\n end \n result \nend", "def create_source_files(pattern)\n source_files = []\n if pattern[:cn]\n names = pattern[:cn].scan(/(^[a-zA-Z]*)[^a-zA-Z]*([a-zA-Z]*)/).flatten\n names[0] = '*' if names[0].empty?\n names[1] = '*' if names[1].empty?\n names.permutation do |names|\n file = File.join(URL, \"#{names.join('_').downcase}.contact\")\n Dir.glob(file).each { |file| source_files << file }\n end\n elsif pattern[:sn] or pattern[:gn]\n sn = pattern[:sn] ? pattern[:sn].strip.downcase : '*'\n gn = pattern[:gn] ? pattern[:gn].strip.downcase : '*'\n Dir.glob(File.join(URL, \"#{gn}_#{sn}.contact\")).each do |file|\n source_files << file\n end\n else\n Dir.glob(File.join(URL, \"*_*.contact\")).each do |file|\n source_files << file\n end\n end\n source_files\n end", "def choose_source(sources)\n input = nil\n until (1..sources.count).member?(input)\n puts \"\"\n puts ColorizedString[\"Please enter a number of desired article\"].bold\n input = gets.chomp.to_i\n end\n input\n end", "def get_source_ids(source_names)\n if source_names and current_user.try(:admin_or_staff?)\n source_ids = Source.where(\"lower(name) in (?)\", source_names.split(\",\")).order(\"name\").pluck(:id)\n elsif source_names\n source_ids = Source.where(\"private = ?\", false).where(\"lower(name) in (?)\", source_names.split(\",\")).order(\"name\").pluck(:id) #.where(\"private = 0 AND lower(name) in (?)\", source_names.split(\",\")).order(\"name\").pluck(:id)\n elsif current_user.try(:admin_or_staff?)\n source_ids = Source.order(\"name\").pluck(:id)\n else\n source_ids = Source.where(\"private = ?\", false).order(\"name\").pluck(:id) #where(\"private = 0\").order(\"name\").pluck(:id)\n end\n end", "def build_actor_collection!(source)\n source.map! do |s|\n s.has_key?('name') ? Entity.new(s) : Person.new(s)\n end\n end", "def source\n AQL.name_node(input.name)\n end", "def get_source_ids(source_names)\n if source_names && current_user.try(:is_admin_or_staff?)\n source_ids = Source.where(\"lower(name) in (?)\", source_names.split(\",\")).order(\"name\").pluck(:id)\n elsif source_names\n source_ids = Source.where(\"private = ?\", false).where(\"lower(name) in (?)\", source_names.split(\",\")).order(\"name\").pluck(:id)\n elsif current_user.try(:is_admin_or_staff?)\n source_ids = Source.order(\"name\").pluck(:id)\n else\n source_ids = Source.where(\"private = ?\", false).order(\"name\").pluck(:id)\n end\n end", "def get_source_ids(source_names)\n if source_names && current_user.try(:is_admin_or_staff?)\n source_ids = Source.where(\"lower(name) in (?)\", source_names.split(\",\")).order(\"name\").pluck(:id)\n elsif source_names\n source_ids = Source.where(\"private = ?\", false).where(\"lower(name) in (?)\", source_names.split(\",\")).order(\"name\").pluck(:id)\n elsif current_user.try(:is_admin_or_staff?)\n source_ids = Source.order(\"name\").pluck(:id)\n else\n source_ids = Source.where(\"private = ?\", false).order(\"name\").pluck(:id)\n end\n end", "def create_list(name, source, opt_in_type)\n endpoint = \"/api/#{@version}/list/create/\"\n custom_params = {\n \"name\" => name,\n \"source\" => source,\n \"opt_in_type\" => opt_in_type\n }\n make_post_request(endpoint, custom_params)\n end", "def sources_list_dl(sources, opts)\n mods = opts.categories ? sources.parse_mods(opts.categories) : nil\n sources.apply_mods(mods) if mods\n\n if opts.download\n Storage.instance.download_sources\n else\n IO.instance.sources_print(sources.sources)\n end\n end", "def add_source(*source)\n unless source.blank?\n what.query.add(:sources) << source.flatten \n changed\n end\n end", "def directors_totals(source)\n result = {}\n director_index = 0\n while director_index < source.size do\n director = source[director_index]\n result[director[:name]] = gross_for_director(director)\n director_index += 1\n end\n result\nend", "def prepareArticlesBySource(source)\n articles_from_database = @apiParser.getArticles(source)\n if !articles_from_database.nil?\n articles_from_database.each do |article|\n text = \"\"\n if !article.title.nil?\n text += article.title + \"\\n\"\n end\n\n if !article.description.nil?\n text += article.description + \"\\n\"\n end\n\n @articles.push(UserProfile.new(article.url, article.urlToImage,\n article.article_id, text))\n end\n end\n end", "def town_names(amount,location)\n starts=['Bed','Brunn','Dun','Far','Glen','Tarn']\n middles=['ding','fing','ly','ston']\n ends=['borough','burg','ditch','hall','pool','ville','way','worth']\n near_water=['falls','-on-sea']\n mountain=['Mount ', 'The hills of ']\n names=[]\n\n amount.times do\n if location == 'near_water'\n names.push(starts.sample+middles.sample+ends.sample+near_water.sample)\n elsif location == 'mountain'\n names.push(mountain.sample+starts.sample+middles.sample+ends.sample)\n elsif location == 'short_name'\n names.push(starts.sample+ends.sample)\n else\n names.push(starts.sample+middles.sample+ends.sample)\n end\n end\n return names\nend", "def add_source(source)\n all << source unless all.any? { |s| s.url == source || s.name == source.name }\n end", "def total_gross(source)\n total =0 \n name_key = list_of_directors(source)\n individual_gross_hash = directors_totals(source)\n dir_index=0\n while dir_index < name_key.length\n total+= individual_gross_hash[name_key[dir_index]]\n dir_index+=1 \n end\n total\nend", "def create_list(name, source, opt_in_type)\n endpoint = \"/api/v1/list/create/\"\n base_params = base_params(endpoint)\n custom_params = {\n \"name\" => name,\n \"source\" => source,\n \"opt_in_type\" => opt_in_type\n }\n uri = post_api_uri(endpoint)\n http = setup_request(uri)\n result = http.post(uri.path, base_params.merge(custom_params).to_query)\n JSON.parse(result.body)\n end", "def source_list(label, *list)\n _logger.warn \"Duplicate source_list '#{label}'\" if @result.source_lists.has_key?(label)\n @result.source_lists[label] += list\n end", "def do_list(args)\n if args[\"zonename\"] == \"example.com\"\n @result = [\n record(\"example.com\", \"SOA\", \"sns.dns.icann.org noc.dns.icann.org 2013012485 7200 3600 1209600 3600\"),\n record(\"example.com\", \"NS\", \"sns.dns.icann.org\"),\n record_prio(\"example.com\", \"MX\", \"test.example.com\",10),\n record(\"test.example.com\", \"A\", \"127.0.0.1\")\n ]\n end\n end", "def source_list(source)\n if source.nil? || source.empty?\n raise Error, 'No source specified for query'\n end\n auto_alias_count = @opts[:num_dataset_sources] || 0\n m = source.map do |s|\n case s\n when Dataset\n auto_alias_count += 1\n s.to_table_reference(\"t#{auto_alias_count}\")\n else\n table_ref(s)\n end\n end\n m.join(COMMA_SEPARATOR)\n end", "def test_fortune_from_each_source\n sources = LinuxFortune.get_sources\n fortunes = []\n sources.each do |src|\n fortunes << src.fortune\n assert fortunes.size > 0\n #puts \"#{fortunes.last.source} --- #{src.fullpath}\"\n assert fortunes.last.source == src.fullpath\n end\n end", "def parse_input source, options\n entries = if source.match /^http/\n http = Atom::HTTP.new\n\n setup_http http, options\n\n http_to_entries source, options[:complete], http\n elsif source == '-'\n stdin_to_entries\n else\n dir_to_entries source\n end\n\n if options[:verbose]\n entries.each do |entry|\n puts \"got #{entry.title}\"\n end\n end\n\n entries\n end", "def list_masters *names\n print names\nend", "def saying(source: nil)\n sourced_sayings = translate('faker.dune.sayings').keys\n\n if source.nil?\n source = sample(sourced_sayings).to_s\n else\n source = source.to_s.downcase\n\n unless sourced_sayings.include?(source.to_sym)\n raise ArgumentError,\n \"Sources quoted in sayings can be left blank or #{sourced_sayings.join(', ')}\"\n end\n end\n\n fetch(\"dune.sayings.#{source}\")\n end", "def print_members(p)\n puts p.getNetid + ':'\n DSpace.create(p).groups.each { |g| puts \"\\t#{g.getName}\" }\nend", "def source_reflection_names\n @source_reflection_names ||= (options[:source] ? [options[:source]] : [name.to_s.singularize, name]).collect { |n| n.to_sym }\n end", "def generate_list(name, count); end", "def print_reps(input)\n @list = if input != \"ALL\"\n @@all.select { |rep| rep.party.strip == input.to_s }\n else\n @@all\n end\n @list.each_with_index do |rep, index|\n puts <<-DOC\n #{index + 1}. #{rep.name} - Party: #{rep.party.rstrip}, #{rep.district}\n Phone: #{rep.phone}, Email: #{rep.email}\n DOC\n end\n end", "def prepopulate_list\n\t\tname_list = ['ben', 'bob obobb', 'mary kate', 'kim possible', 'steve-o', 'jill and jack', 'veronica mars', 'danny trejo',\n\t\t 'jon snow', 'mario anluigi', 'ed obannon', 'amy winehouse', 'juan jones', 'walter okiefe', 'fred love']\n\t\tparty_list = ['tea party', 'conservative', 'neutral', 'liberal', 'socialist']\n\t\tjimbo = Human.new \"politician\", 'jimbo jones', 'democrat'\n\t\tgene = Human.new \"politician\", 'gene wilder', 'republican'\n\t\t@people_list << jimbo\n\t\t@people_list << gene\n\n\t\tname_list.map do |name|\n\t\t\trandom_party = party_list.sample\n\t\t\tname = Human.new \"voter\", name, random_party\n\t\t\t@people_list << name\n\t\tend\n\n\tend", "def names(*args)\n options = args.extract_options!\n send_data(\"NAMES #{args.join(',')} #{options[:target]}\".strip)\n end", "def directors_ids\n directors_ids = []\n directors_name.each_with_index do |director, index|\n directors_ids << document[\"castMember\"][index][\"person\"][\"code\"] if director == document[\"castMember\"][index][\"person\"][\"name\"]\n end\n directors_ids\n end", "def initSource(source)\n\t\tfor i in 0..(@graph.size - 1) do\n\t\t\tif @graph[i].node == source\n\t\t\t\t@graph[i].distance = 0\n\t\t\t\tbreak\n\t\t\tend \n\t\tend\n\tend", "def dlist\n @dests.keys\n end", "def get_director(dandp)\n dandp.to_s.chop # Chop removes the last char (i.e. the port)\n end", "def shortest_paths(source, dest)\n @graph_paths=[]\n @source = source\n dijkstra source\n @path=[]\n find_path dest\n actual_distance=if @distance[dest] != INFINITY\n @distance[dest]\n else\n \"no path\"\n end\n \"Shortest route and distance : #{@path.join(\"-->\")}, #{actual_distance} km\"\n end", "def title_for(source)\n (source[N::DCNS.title].first || source[N::RDF.label].first || N::URI.new(source.uri).local_name.titleize)\n end", "def compact_local_names(source)\n for_outstrings_of(source) do |str|\n NamesCompactor.compact str\n end\n end", "def shortest_paths(s)\n\t\t@source = s\n\t\tdijkstra s\n\t\tputs \"Source: #{@source}\"\n\t\t@nodes.each do |dest|\n\t\t\tputs \"\\nTarget: #{dest}\"\n\t\t\tprint_path dest\n\t\t\tif @d[dest] != @INFINITY\n\t\t\t\tputs \"\\nDistance: #{@d[dest]}\"\n\t\t\telse\n\t\t\t\tputs \"\\nNO PATH\"\n\t\t\tend\n\t\tend\n\tend", "def sources\n @sources.names\n end", "def directors\n @directors = Person.find(:all, :conditions => {:position => ['Director', 'Co-Director']})\n @directors.sort! {|a, b| a.last_name.upcase <=> b.last_name.upcase}\n \n respond_to do |format|\n format.html # directors.html.erb\n format.xml { render :xml => nil }\n end\n end", "def annotate_sources\n item_names.each do |source_name|\n with_valid_source source_name do |source_card|\n add_report_type source_card\n add_company source_card\n end\n end\nend", "def dn(name)\n [\"#{rdn}=#{name}\", base].join(\",\")\n end", "def cmd_twitt_set_source(*args)\n\t\t\t\tif args.length > 0\n\t\t\t\t\tprint_status(\"Setting the source name to #{args[0]}\")\n\t\t\t\t\t@source = args[0]\n\t\t\t\telse\n\t\t\t\t\tprint_error(\"Please provide a value\")\n\t\t\t\tend\n\t\t\tend", "def each_pluralized_source()\n @sources.each do |source|\n if source.is_an?(Array) then\n reference, singular_name = *source\n yield( reference.slot_name, reference.symbol_name, singular_name )\n end\n end\n end", "def build_list_of_players\n [\n \"cliff\",\n \"anne\",\n \"harry\",\n \"sam\",\n \"devin\",\n \"ally\",\n \"bob\",\n \"jane\",\n \"jimmy\",\n \"dave\"\n ]\nend", "def bulk_rename_confirm\n @prefix = params[:prefix]\n begin\n @destinations = Destination.dst_by_prefix(@prefix)\n rescue\n flash[:notice] = _('Invalid_prefix')\n redirect_to :controller => :directions, :action =>:list and return false\n end\n if @destinations.size > 0\n @destination_count = @destinations.size\n @destination_name = params[:destination]\n else\n flash[:notice] = _('No_destinations_found')\n redirect_to :controller => :destination_groups, :action => :list\n end\n end", "def dest_prompt\n db_prompt 'destination'\n end", "def source_prompt\n db_prompt 'source'\n end", "def do_names\n animal_list = get_names()\n print_names(animal_list)\n end", "def print_sources(sources)\n sources.each do |source|\n UI.title source.name do\n print_source_at_path source.repo\n end\n end\n UI.puts \"\\n\"\n end", "def print_sources(sources)\n sources.each do |source|\n UI.title source.name do\n print_source_at_path source.repo\n end\n end\n UI.puts \"\\n\"\n end", "def sources *names\n ## reader\n return @sources if names.size == 0\n ## affectation\n names.each do |sname|\n s = @flow.sources(sname)\n @sources << s if s\n raise \"Unknown source #{sname} in monitor #{name}!\" unless s\n end\n end", "def frwdlp(session,hostlst,domain,dest)\n\tdest = dest + \"-DNS-forward-lookup.txt\"\n\tprint_status(\"Performing DNS Forward Lookup for hosts in #{hostlst} for domain #{domain}\")\n\tfilewrt(dest,\"DNS Forward Lookup for hosts in #{hostlst} for domain #{domain}\")\n\tresult = []\n\tthreads = []\n\ttmpout = []\n\tbegin\n\tif ::File.exists?(hostlst)\n\t\t::File.open(hostlst).each {|line|\n \t\t\tthreads << ::Thread.new(line) { |h|\n \t\t\t#print_status(\"checking #{h.chomp}\")\n\t\t \tr = session.sys.process.execute(\"nslookup #{h.chomp}.#{domain}\", nil, {'Hidden' => true, 'Channelized' => true})\n \t\t \twhile(d = r.channel.read)\n \t\t\tif d =~ /(Name)/\n \t\t\t\td.scan(/Name:\\s*\\S*\\s*Address\\w*:\\s*.*?.*?.*/) do |n|\n \t\t\t\ttmpout << n.split\n \t\t\tend\n \t\t\tbreak\n \t\tend\n end\n\n r.channel.close\n r.close\n\t\t\t}\n\t\t}\n\tthreads.each { |aThread| aThread.join }\n\ttmpout.uniq.each do |t|\n \tprint_status(\"\\t#{t.join.sub(/Address\\w*:/, \"\\t\")}\")\n \tfilewrt(dest,\"#{t.join.sub(/Address\\w*:/, \"\\t\")}\")\n end\n\n\telse\n\t\tprint_status(\"File #{hostlst}does not exists!\")\n\t\texit\n\tend\n\trescue ::Exception => e\n \t\tprint_status(\"The following Error was encountered: #{e.class} #{e}\")\n\tend\nend", "def member_names(members)\n members.times do \n @band << @musicians.sample\n end\n\n puts \"Cool, that means the lineup will include:\"\n @band.each do |musician|\n puts \"#{musician}\"\n end\n\n end", "def create_domains(split_cp_domain)\n # EXPECTATION:\n # # [\"com\", \"com\", \"com\"]\n # # [\"com\", \"leetcode.com\", \"leetcode.com\"]\n names_collection = [] # [\"com\", \"leetcode.com\", \"discuss.leetcode.com\"]\n i = 0\n aggregate_dp_dom = \"\"\n while (i < split_cp_domain.length) do\n current_dp_dom = split_cp_domain[split_cp_domain.length - (i + 1)] # com\n if (aggregate_dp_dom == \"\")\n aggregate_dp_dom = current_dp_dom # com\n else\n aggregate_dp_dom = \"#{current_dp_dom}.#{aggregate_dp_dom}\" # leetcode.com\n end\n names_collection[i] = aggregate_dp_dom\n i += 1\n end\n names_collection\nend", "def names(channels = nil, target = nil)\n channel_list = Array(channels).map(&:to_s).join ','\n \n raw \"NAMES #{channel_list} #{target}\".strip << \"\\r\\n\"\n end", "def shortest_paths(s)\n @source = s\n dijkstra s\n puts \"Source: #{@source}\"\n @nodes.each do |dest|\n puts \"\\nTarget: #{dest}\"\n print_path dest\n if @d[dest] != @INFINITY\n puts \"\\nDistance: #{@d[dest]}\"\n else\n puts \"\\nNO PATH\"\n end\n end\n end", "def remove_source(*source)\n unless source.blank?\n what.query[:sources] && what.query[:sources] >> source.flatten\n changed\n end\n end", "def importPatients(source, count=nil)\n begin\n sourceBtn = getImportSourceBtn(source)\n sourceBtn.click\n\n # The patient table can take a while to load when large amounts of data is present.\n waitForPatientList\n # Once the table is on the screen we can finally read it.\n importScreen = MainScreen.new\n patientList = importScreen.getPatientList\n @systemBtn.click\n\n if patientList.size == 0\n Log.TestLog(\"No patients to import from #{source}\")\n return []\n end\n if count == nil \n count = patientList.size\n end\n \n (0...count).each do |patient_index|\n details = get_patient_details_for_import(sourceBtn, importScreen, patientList, patient_index)\n\n # if there are multiple CT's for this patient, import each CT\n details.patientCTPlans.each_with_index do |ct_plan_obj, ct_index|\n # import the CT for the patient by double clicking on the row\n details.patientCTPlans[ct_index].ct.dClick\n\n # check to see if this CT for the patient is the last one in the list\n # if it is not, repeat the script steps to get back to the patient details to import the next CT\n if ct_index < details.patientCTPlans.count\n details = get_patient_details_for_import(sourceBtn, importScreen, patientList, patient_index)\n end\n end\n\n end\n @systemBtn.click\n Log.TestLog(\"Imported #{count} patients\")\n return patientList[0,count]\n rescue Exception => e\n Log.TestFail(\"Failed to import patients: #{e.message}\")\n end\n end", "def progname; \"Dis-organizer\"; end", "def progname; \"Dis-organizer\"; end", "def progname; \"Dis-organizer\"; end", "def initialize( givenname_path = File.join(File.dirname(__FILE__), 'givennamelist.txt'),\n surname_path = File.join(File.dirname(__FILE__), 'surnamelist.txt'),\n street_name_path = File.join(File.dirname(__FILE__), 'streetnamelist.txt'),\n postal_town_path = File.join(File.dirname(__FILE__), 'postaltownlist.txt')\n )\n @name_source = NameSource.new( givenname_path, surname_path )\n @address_source = AddressSource.new( street_name_path, postal_town_path )\n @phone_number_source = PhoneNumberSource.new()\n @email_address_source = EmailAddressSource.new()\n end", "def total_gross(source)\n # Write this implementation\n #\n # Should use methods:\n # 1. directors_totals: returns a Hash of { dir_name => gross }\n # 2. list_of_directors: names provides an Array of directors names (use\n \n total_all_directors = 0\n idx_dir = 0\n # Array de string\n noms_de_dirs = list_of_directors(source)\n # Hash donde las llaves son string y los valores son Integer\n money_dirs = directors_totals(source)\n \n while idx_dir < noms_de_dirs.length\n # Key is a string\n key = noms_de_dirs[idx_dir]\n total_all_directors += money_dirs[key]\n idx_dir += 1 \n end\n \n return total_all_directors\n \n #\n # Visit each key (i.e. director name), look up the value in the hash\n # returned by directors_totals, and add it to a running total. When done,\n # return the total\nend", "def source=(input); end", "def get_candidates\n\t$cand_table.each do |x|\n\t\tputs \"Give me a candidate name:\"\n\t\tx[0] = gets.chomp\n\tend\nend", "def art_directors\n to_array search_by_text 'художник'\n end", "def main()\n case ARGV[0]\n when \"--list\"\n cd_source = CDSource.new CACHE_FILE, SOURCE_DIRS, nil, MAX_LEVEL\n cd_source.list()\n when \"--delete\"\n cd_source = CDSource.new CACHE_FILE, SOURCE_DIRS, nil, MAX_LEVEL\n cd_source.delete(ARGV[1])\n when \"--set\"\n cd_source = CDSource.new CACHE_FILE, SOURCE_DIRS, nil, MAX_LEVEL\n cd_source.set(ARGV[1], ARGV[2])\n when \"--help\", \"-h\"\n puts HELP_INFO\n exit 1\n else\n cd_source = CDSource.new CACHE_FILE, SOURCE_DIRS, ARGV[0], MAX_LEVEL\n cd_source.search()\n end\nend", "def view_patient_diseases\n puts format(\"Enter your name (exactly as you entered before)\")\n name_input = gets.chomp\n patient = Patient.find_or_create_by(name: name_input)\n patient_diseases = PatientDisease.where(patient_id: patient.id)\n if patient_diseases.empty?\n format(\"None found! Sorry\")\n else\n result = patient_diseases.map {|pd| Disease.where(id: pd.disease_id).pluck(:name)}\n format(result)\n end\n puts \"Press any key to return to main menu.\"\n vpd_response = STDIN.getch\n if vpd_response\n welcome\n end\nend", "def command_sources(str_opts)\n command :sources do |c|\n c.syntax = 'budik sources [options]'\n c.summary = @str_sources.summary\n c.description = @str_sources.description\n c.option '-c', '--categories [string]', String, str_opts.categories\n c.option '-d', '--download', str_opts.download\n c.option '-e', '--edit', str_opts.download\n c.action { |_args, opts| Command.new(:sources, opts) }\n end\n end", "def build_new_source(name, domain=nil)\n # Try to see if there is an existing source object with an identical name but a null domain\n # If so, use that and update the info for that source object\n source = Source.find(:first, :conditions => [\"domain IS NULL AND name = ?\", name])\n if source.nil?\n ## Build a new source object!\n source = Source.new\n source.name = name\n source.section = nil\n source.ownership = IND\n source.status = PENDING\n source.source_media << SourceMedium.new(:medium => SourceMedium::OTHER, :main => true)\n source.created_at = Time.now\n source.updated_at = Time.now\n end\n\n if domain\n source.domain = domain\n source.slug = domain.gsub(/\\./, '_')\n end\n\n return source\n end", "def choose_source_to_search(source)\n $logger.info(\"HomePage: select search source to: '#{source}'\")\n search_source_menu.click\n search_source_name(source).click\n end", "def sources\n %w[\n sample_source\n ]\nend", "def test_source_lists\n config=<<EOF\nsource_list \"test\", %w(test-1.example.com)\n\nsource_list \"has_ipv4\", \"0.0.0.0/0\"\n\nsource_list \"has_ipv6\", \"2000::/3\"\nEOF\n\n Configuration.current = ConfigurationBuilder.parse(config)\n\n a = Alert.new\n a.subject = \"www.example.com\"\n\n assert( a.in_source_list?(\"test\") )\n assert_equal( %w(test has_ipv4).sort, a.source_lists.sort )\n\n a.subject = \"www2.example.com\"\n assert( a.in_source_list?(\"has_ipv6\") )\n assert_equal( %w(has_ipv6 has_ipv4).sort, a.source_lists.sort )\n end", "def list_of_owners\n @owners = Owner.find(:all, :order=>\"state,city\")\n @report_name = \"List of Owners\"\n end", "def collect_name\n\tputs \"Please enter full name of the student you wish to add / amend.\"\n\tprint \"Alternatively press enter to exit and print results.\\n > \"\n\tname = gets.chomp.split.map(&:capitalize).join(' ').strip\n\tname\nend", "def ask_name\n puts \"Nom du player 1 ?\"\n print \"> \"\n @players << Player.new(gets.chomp.to_s, \"o\")\n\n puts \"Nom du player 2 ?\"\n print \"> \"\n @players << Player.new(gets.chomp.to_s, \"x\")\n end", "def sources_for(source)\n dependencies_for(source) << source\n end", "def select_fan_from_list(my_fans)\n require \"tty-prompt\"\n prompt = TTY::Prompt.new\n\n puts \"\\n \\n\"\n\n prompt.select(\"Here's a list of the players: (you can type the name of the player to filter through the players)\", filter: true) do |menu|\n my_fans.each do |fan|\n menu.choice fan.name\n end\n end\n \nend", "def san_network_ports\n if san_nics.length == sans.length \n san_nics.map {|x| x.port_name }\n else\n []\n end\n end", "def cmd_people_names\n\t\tquery_json do\n\t\t\t\"SELECT DISTINCT ?name\n\t\t\tWHERE {\n\t\t\t\t?p a foaf:Person .\n\t\t\t\t?p foaf:name ?name .\n\t\t\t}\n\t\t\tORDER BY ?name\"\n\t\tend\n\tend", "def annotate_sources\n item_names.each do |source_name|\n with_valid_source source_name do |source_card|\n tag_with_report_type source_card\n tag_with_company source_card\n tag_with_year source_card\n end\n end\nend", "def shortest_paths(source)\n init(source)\n relax_edges\n PathBuilder.new(source, @visitor.parents_map).paths(@graph.vertices)\n end", "def start_point_ls\n help = [\n '',\n \"Use: #{me} start-point [OPTIONS] ls\",\n '',\n 'Lists the names of all cyber-dojo start-points',\n '',\n minitab + '--quiet Only display start-point names'\n ]\n\n if ARGV[2] == '--help'\n show help\n exit succeeded\n end\n\n # As of docker 1.12.0 there is no [--filter label=LABEL]\n # option on the [docker volume ls] command.\n # So I have to inspect all volumes.\n # Could be slow for lots of volumes.\n\n names = run(\"docker volume ls --quiet\").split\n names = names.select{ |name| cyber_dojo_volume?(name) }\n\n if ARGV[2] == '--quiet'\n names.each { |name| puts name }\n else\n\n unless ARGV[2].nil?\n STDERR.puts \"FAILED: unknown argument [#{ARGV[2]}]\"\n exit failed\n end\n\n types = names.map { |name| cyber_dojo_type(name) }\n urls = names.map { |name| cyber_dojo_label(name) }\n\n headings = { :name => 'NAME', :type => 'TYPE', :url => 'SRC' }\n\n gap = 3\n max_name = ([headings[:name]] + names).max_by(&:length).length + gap\n max_type = ([headings[:type]] + types).max_by(&:length).length + gap\n max_url = ([headings[:url ]] + urls ).max_by(&:length).length + gap\n\n spacer = lambda { |max,s| s + (space * (max - s.length)) }\n\n name = spacer.call(max_name, headings[:name])\n type = spacer.call(max_type, headings[:type])\n url = spacer.call(max_url , headings[:url ])\n unless names.empty?\n puts name + type + url\n end\n names.length.times do |n|\n name = spacer.call(max_name, names[n])\n type = spacer.call(max_type, types[n])\n url = spacer.call(max_url , urls[n])\n puts name + type + url\n end\n end\nend", "def initSingleSource(graph, source)\n\t\n\tfor i in 0..(graph.size - 1)\n\t\tgraph.changeDistance(i, Float::INFINITY)\n\t\tgraph.changePredecessor(i, nil)\n\tend\n\t\n\tgraph.initSource(source)#initializes the source node\nend", "def name(names)\n names.sample\nend", "def getAnts(groupName)\n\n result = `/home/obs/ruby/bin/fxconf.rb sals`\n\n list = [];\n\n # Get the antennas in the \"groupName\" group\n result.each do |line| \n line = line.chomp.strip; \n if(line.include?(groupName) == true) \n parts = line.chomp.split(/\\s+/);\n parts[1..-1].each do |a|\n list << Ant.new(a);\n end\n end\n end \n return list; \nend", "def select_players_for_gryffindor(full_list_of_players, already_used_players)\nend", "def build_target_device_list(recipient)\n\t\tdevicelist = []\n\t\tif recipient == \"mentors\"\n\t\t\tdevices = db.exec(\"SELECT fcm_id FROM accounts WHERE mentor AND fcm_id IS NOT NULL\")\n\t\t\tdevices.each_row do |value, id|\n\t\t\t\tdevicelist << value\n\t\t\tend\n\t\telsif recipient == \"mentees\"\n\t\t\tdevices = db.exec(\"SELECT fcm_id FROM accounts WHERE mentee AND fcm_id IS NOT NULL\")\n\t\t\tdevices.each_row do |value, id|\n\t\t\t\tdevicelist << value\n\t\t\tend\n\t\telsif recipient == \"alldevices\"\n\t\t\tdevices = db.exec(\"SELECT fcm_id FROM accounts WHERE fcm_id IS NOT NULL\")\n\t\t\tdevices.each_row do |value, id|\n\t\t\t\tdevicelist << value\n\t\t\tend\n\t\tend\n\t\tdevicelist\n\tend", "def san_nics\n x = nics.find_all_by_network_type('san', :order =>:port_name)\n x = [] if x.nil?\n x\n end", "def update_sources\n\t @sources.each { |s| @source_counts[s] = { label: s, value: rand(100) } } \n\tend" ]
[ "0.6226463", "0.5875862", "0.5812536", "0.5537217", "0.5404482", "0.530637", "0.52944124", "0.5172631", "0.5120825", "0.51141346", "0.5075698", "0.5062013", "0.5061534", "0.50594467", "0.5026288", "0.500214", "0.500214", "0.4969472", "0.4941467", "0.49374163", "0.48720124", "0.48605707", "0.48603123", "0.48316735", "0.48201352", "0.48185468", "0.479213", "0.47811735", "0.47764835", "0.4768177", "0.47649106", "0.476389", "0.47450995", "0.47175902", "0.46987543", "0.4693924", "0.4678155", "0.46750328", "0.46433836", "0.46346164", "0.46327767", "0.46210828", "0.46182775", "0.46133322", "0.46119872", "0.460453", "0.45992061", "0.459434", "0.45923397", "0.4588398", "0.4587933", "0.45824984", "0.45776483", "0.45739543", "0.45676592", "0.45485553", "0.4547324", "0.45464227", "0.4544104", "0.4544104", "0.45391142", "0.4518321", "0.45181957", "0.45025247", "0.44967934", "0.44883612", "0.4485861", "0.44831923", "0.44802704", "0.44802704", "0.44802704", "0.44736233", "0.44692826", "0.44529757", "0.4449208", "0.44430107", "0.4440196", "0.44362992", "0.44336182", "0.44325215", "0.4431969", "0.443156", "0.44291633", "0.44290355", "0.4423059", "0.44219556", "0.44181636", "0.44171128", "0.4408039", "0.43990934", "0.43966204", "0.43962118", "0.439496", "0.43878412", "0.43864766", "0.43796778", "0.43731007", "0.43717453", "0.4371736", "0.43663317" ]
0.6517475
0
the goal is to add up gross from every director and return the total amount
def total_gross(source) total =0 name_key = list_of_directors(source) individual_gross_hash = directors_totals(source) dir_index=0 while dir_index < name_key.length total+= individual_gross_hash[name_key[dir_index]] dir_index+=1 end total end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gross_for_director(director_data)\n sum = 0\n\t\n\tdirector_data[:movies].each do |movie|\n\t\tsum += movie[:worldwide_gross]\n\tend\n\t\n\treturn sum\nend", "def gross_for_director(director_data)\n total = 0\n movies = director_data[:movies]\n movies.length.times do |movie_idx|\n total+=movies[movie_idx][:worldwide_gross]\n end\n return total\nend", "def gross_for_director(director_data)\n gross = 0\n director_data[:movies].each do |n|\n gross +=n[:worldwide_gross]\n end\n return gross\nend", "def gross_for_director(director_data)\n movie_index = 0\n director_total = 0\n while movie_index < director_data[:movies].length\n director_total += director_data[:movies][movie_index][:worldwide_gross]\n movie_index += 1\n end\n director_total\n\n end", "def gross_for_director(director_data)\n total_director_gross = 0\n director_data[:movies].each do |movie|\n total_director_gross += movie[:worldwide_gross]\n end\n total_director_gross\nend", "def gross_for_director(director_data)\n index = 0 \n total = 0 \n while index < director_data[:movies].length do\n total+=director_data[:movies][index][:worldwide_gross]\n index+=1\n end\n total\n end", "def gross_for_director(director_data)\n row_index = 0\n director_total = 0\n\n while row_index < director_data[:movies].length do\n director_total += director_data[:movies][row_index][:worldwide_gross]\n \n row_index += 1\n end\n\n director_total\nend", "def gross_for_director(director_data)\n array = director_data[:movies]\n i = 0 \n total = 0\n \n while i < array.length do\n obj = array[i]\n income = obj[:worldwide_gross]\n \n total += income\n i+=1\n end\n \n return total\nend", "def gross_for_director(director_data)\n count = 0\n sum = 0\n while director_data[:movies][count] do\n sum += director_data[:movies][count][:worldwide_gross]\n count += 1\n end\n \n return sum\nend", "def gross_for_director(director_data)\n #pp director_data\n\n result = []\n movie_index = 0\n\n while movie_index < director_data[:movies].length do\n total_gross = director_data[:movies][movie_index][:worldwide_gross]\n result.push(total_gross)\n movie_index += 1\n end\n puts result\n return result.sum\n end", "def total_gross(source)\n # Write this implementation\n #\n # Should use methods:\n # 1. directors_totals: returns a Hash of { dir_name => gross }\n # 2. list_of_directors: names provides an Array of directors names (use\n \n total_all_directors = 0\n idx_dir = 0\n # Array de string\n noms_de_dirs = list_of_directors(source)\n # Hash donde las llaves son string y los valores son Integer\n money_dirs = directors_totals(source)\n \n while idx_dir < noms_de_dirs.length\n # Key is a string\n key = noms_de_dirs[idx_dir]\n total_all_directors += money_dirs[key]\n idx_dir += 1 \n end\n \n return total_all_directors\n \n #\n # Visit each key (i.e. director name), look up the value in the hash\n # returned by directors_totals, and add it to a running total. When done,\n # return the total\nend", "def gross_for_director(director_data)\n #total gross for director\n director_total = 0\n #movie iterator\n movie_element = 0\n #iterate through movies\n while movie_element < director_data[:movies].length do\n #add movie gross to total for director\n director_total += director_data[:movies][movie_element][:worldwide_gross]\n #increase movie iterator\n movie_element += 1\n end\n return director_total\nend", "def gross_for_director(director_data)\n i = 0\n tot = 0\n while i < director_data[:movies].count do\n tot += director_data[:movies][i][:worldwide_gross]\n i += 1\n end\n return tot\nend", "def gross_for_director(director_data)\n i = 0 \n total = 0\n while i < director_data[:movies].length do \n total += director_data[:movies][i][:worldwide_gross]\n i += 1 \n end \n total \nend", "def gross_for_director(director_data)\n gross_for_director=0\n i=0\n while i<director_data[:movies].size\n gross_for_director+=director_data[:movies][i][:worldwide_gross]\n i+=1\n end\n gross_for_director\nend", "def gross_for_director(d)\n total = 0\n index = 0\n while index < d[:movies].length do\n total += d[:movies][index][:worldwide_gross]\n index += 1\n end\n total\nend", "def gross_for_director(director_data)\n \n total = 0\n i = 0 \n while i < director_data[:movies].length do\n total += director_data[:movies][i][:worldwide_gross]\n i += 1\n\n\nend\n\nreturn total\nend", "def gross_for_director(director_data)\n\n result = 0\n movie_idx = 0\n while movie_idx < director_data[:movies].count\n result += director_data[:movies][movie_idx][:worldwide_gross]\n movie_idx += 1\n end\n result\nend", "def gross_for_director(nds)\n\n sum=0\n idx2 = 0\n while idx2 < nds[:movies].length\n # p director_database[idx1][:movies][idx2][:worldwide_gross]\n sum += nds[:movies][idx2][:worldwide_gross]\n idx2 +=1\n end\n # puts sum\n # puts \"-\"\n sum\nend", "def gross_for_director(director_data)\n #dir_name = director_data[:name]\n movie_list = director_data[:movies]\n dir_gross = 0\n movie_index = 0\n while movie_index < movie_list.length do\n dir_gross += movie_list[movie_index][:worldwide_gross]\n movie_index += 1\n end\n dir_gross\nend", "def gross_for_director(director_data)\n sum = 0\n x = 0\n\n while x < director_data[:movies].length do\n sum += director_data[:movies][x][:worldwide_gross]\n x += 1\n end\n\n sum\nend", "def gross_for_director(director_data)\n total = 0\n index = 0\n\n while index < director_data[:movies].length do\n total += director_data[:movies][index][:worldwide_gross]\n index += 1\n end\n\n total\nend", "def gross_for_director(director_data)\n m_index = 0\n director_data = 0\n gross = 0\n while m_index < directors_database[director_data][:movies].length do\n gross += directors_database[director_data][:movies][m_index][:worldwide_gross]\n m_index += 1\nend\ngross\nend", "def gross_for_director(director_data)\n total=0\n rownum=0\n while rownum< director_data[:movies].length\n total+=director_data[:movies][rownum][:worldwide_gross]\n rownum+=1\nend\nreturn total\nend", "def gross_for_director(director_data)\n earnings = 0\n which_mov = 0\n while which_mov < director_data[:movies].length do\n earnings += director_data[:movies][which_mov][:worldwide_gross]\n which_mov += 1\n end\n earnings \nend", "def gross_for_director(director_data)\n director_total = 0 #intialization\n row_index = 0 # intialization\n\n while row_index < director_data[:movies].length do # \n \n director_total += director_data[:movies][row_index][:worldwide_gross] # adds each movies gross to a value director_total \n \n # puts \" World wide gross for the #{row_index + 1} movie is #{director_total}\" \n row_index += 1 \n end\n return director_total\nend", "def gross_for_director(director_data)\n total_gross = 0\n\n i = 0\n while i < director_data[:movies].length\n worldwide_gross = director_data[:movies][i][:worldwide_gross]\n total_gross += worldwide_gross\n i += 1\n end\n\n total_gross\nend", "def gross_for_director(director_data)\n #p director_data\n i = 0\n total = 0\n while i < director_data[:movies].length do\n total += director_data[:movies][i][:worldwide_gross] \n i += 1\n end\n total\nend", "def directors_totals(nds)\n total = {}\n i = 0\n while i < nds.length do\n director = nds[i][:name]\n total[director] = gross_for_director(nds[i])\n i += 1 \n end\n return total \nend", "def gross_for_director(director_data)\n grand_total = 0\n row_index = 0\n column_index = 0\n while column_index < directors_database[row_index][:movies].length do\n grand_total += directors_database[row_index][:movies][column_index][:worldwide_gross]\n column_index += 1\n end\n grand_total\nend", "def gross_for_director(director_data)\ntotal=0\nm= director_data[:movies]\nrow = 0\nwhile row < m.length \n g= m[row][:worldwide_gross]\n row += 1\n total += g\nend\ntotal\n\nend", "def directors_totals(source)\n result = {}\n director_index = 0\n while director_index < source.size do\n director = source[director_index]\n result[director[:name]] = gross_for_director(director)\n director_index += 1\n end\n result\nend", "def gross_for_director(director_data)\ndirector_gross = 0\n movie_len = director_data[:movies].length\n movie_index = 0\n while movie_index < movie_len do\n director_gross += director_data[:movies][movie_index][:worldwide_gross]\n movie_index += 1\n end\n director_gross\nend", "def gross_for_director(director_data)\n movie_index = 0 \n inner_result = 0 \n while movie_index < director_data[:movies].length do\n inner_result += director_data[:movies][movie_index][:worldwide_gross]\n movie_index += 1 \n end\n inner_result\nend", "def directors_totals(nds)\n # Remember, it's always OK to pretty print what you get *in* to make sure\n # that you know what you're starting with!\n #\n #\n # The Hash result be full of things like \"Jean-Pierre Jeunet\" => \"222312123123\"\n\n #\n # Use loops, variables and the accessing method, [], to loop through the NDS\n # and total up all the\n # ...\n # ...\n # ...\n #\n #\n # Be sure to return the result at the end!\n\n result = {}\n\n director_index = 0\n movie_index = 0\n\n while director_index < nds.size do\n director = nds[director_index][:name]\n result[director] = 0\n while movie_index < nds[director_index][:movies].size do\n result[director] += nds[director_index][:movies][movie_index][:worldwide_gross]\n movie_index += 1\n end\n director_index += 1\n movie_index = 0\n end\n\n result\nend", "def gross_for_director(director_data)\n director_gross = 0\n movie_count = 0\n while movie_count < director_data[:movies].length do\n director_gross += director_data[:movies][movie_count][:worldwide_gross]\n movie_count += 1\n end\n director_gross\nend", "def gross_for_director(director_data)\n new_array = director_data[:movies]\n i = 0 \n total_gross = 0\n while i < new_array.length do\n anotha_array = new_array[i]\n gross = anotha_array[:worldwide_gross]\n total_gross += gross\n i+=1\n end\n total_gross\nend", "def gross_for_director(director_data)\n movie_index = 0\n worldwide_grosses = 0\n while movie_index < director_data[:movies].length\n worldwide_grosses += director_data[:movies][movie_index][:worldwide_gross]\n movie_index += 1\n end\nworldwide_grosses\nend", "def gross_for_director(director_data)\nmovieNum = 0\ntotalGross = 0\nwhile movieNum < director_data[:movies].length do\n totalGross += director_data[:movies][movieNum][:worldwide_gross]\n movieNum += 1\nend\ntotalGross\nend", "def gross_for_director(director_data)\n movies_index = 0\n director_gross = 0\n movies_array = director_data[:movies]\n while movies_index < movies_array.length do\n director_gross += movies_array[movies_index][:worldwide_gross]\n movies_index += 1\n end\n p director_gross\nend", "def gross_for_director(director_data)\ntotal = 0\nindex_movies = 0\nmovie = director_data[:movies]\nwhile index_movies < movie.length do\n puts movie[index_movies][:worldwide_gross]\n total = total + movie[index_movies][:worldwide_gross]\n index_movies += 1\n \nend\ntotal\nend", "def gross_for_director(director_data)\ntotal = 0\nmovie_index = 0\n while movie_index<director_data[:movies].length do\n total+=director_data[:movies][movie_index][:worldwide_gross]\n movie_index+=1\n end\ntotal\nend", "def gross_for_director(director_data)\n movie_count = 0\n total_gross = 0\n while movie_count < director_data[:movies].length do\n total_gross += director_data[:movies][movie_count][:worldwide_gross]\n movie_count += 1\n end\n total_gross\nend", "def gross_for_director(nds, element_index)\n total = 0\n new_index = 0\n \n #extract numbers\n while new_index < nds[element_index][:movies].length do\n total = total + nds[element_index][:movies][new_index][:worldwide_gross]\n new_index += 1\n end\n total\nend", "def gross_for_director(director_data)\n movie_index = 0 \n total_gross = 0\n while director_data[:movies][movie_index] do \n movie_hash = director_data[:movies][movie_index]\n total_gross += movie_hash[:worldwide_gross]\n movie_index += 1\n end \n total_gross\nend", "def studios_totals(nds)\n a_o_a_movies_with_director_names = movies_with_directors_set(nds)\n movies_with_director_names = flatten_a_o_a(a_o_a_movies_with_director_names)\n return gross_per_studio(movies_with_director_names)\nend", "def studios_totals(nds)\n a_o_a_movies_with_director_names = movies_with_directors_set(nds)\n movies_with_director_names = flatten_a_o_a(a_o_a_movies_with_director_names)\n return gross_per_studio(movies_with_director_names)\nend", "def studios_totals(nds)\n a_o_a_movies_with_director_names = movies_with_directors_set(nds)\n movies_with_director_names = flatten_a_o_a(a_o_a_movies_with_director_names)\n return gross_per_studio(movies_with_director_names)\nend", "def studios_totals(nds)\n a_o_a_movies_with_director_names = movies_with_directors_set(nds)\n movies_with_director_names = flatten_a_o_a(a_o_a_movies_with_director_names)\n return gross_per_studio(movies_with_director_names)\nend", "def studios_totals(nds)\n a_o_a_movies_with_director_names = movies_with_directors_set(nds)\n movies_with_director_names = flatten_a_o_a(a_o_a_movies_with_director_names)\n return gross_per_studio(movies_with_director_names)\nend", "def studios_totals(nds)\n a_o_a_movies_with_director_names = movies_with_directors_set(nds)\n movies_with_director_names = flatten_a_o_a(a_o_a_movies_with_director_names)\n return gross_per_studio(movies_with_director_names)\nend", "def studios_totals(nds)\n a_o_a_movies_with_director_names = movies_with_directors_set(nds)\n movies_with_director_names = flatten_a_o_a(a_o_a_movies_with_director_names)\n return gross_per_studio(movies_with_director_names)\nend", "def studios_totals(nds)\n a_o_a_movies_with_director_names = movies_with_directors_set(nds)\n movies_with_director_names = flatten_a_o_a(a_o_a_movies_with_director_names)\n return gross_per_studio(movies_with_director_names)\nend", "def studios_totals(nds)\n a_o_a_movies_with_director_names = movies_with_directors_set(nds)\n movies_with_director_names = flatten_a_o_a(a_o_a_movies_with_director_names)\n return gross_per_studio(movies_with_director_names)\nend", "def studios_totals(nds)\n a_o_a_movies_with_director_names = movies_with_directors_set(nds)\n movies_with_director_names = flatten_a_o_a(a_o_a_movies_with_director_names)\n return gross_per_studio(movies_with_director_names)\nend", "def studios_totals(nds)\n a_o_a_movies_with_director_names = movies_with_directors_set(nds)\n movies_with_director_names = flatten_a_o_a(a_o_a_movies_with_director_names)\n return gross_per_studio(movies_with_director_names)\nend", "def studios_totals(nds)\n a_o_a_movies_with_director_names = movies_with_directors_set(nds)\n movies_with_director_names = flatten_a_o_a(a_o_a_movies_with_director_names)\n return gross_per_studio(movies_with_director_names)\nend", "def studios_totals(nds)\n a_o_a_movies_with_director_names = movies_with_directors_set(nds)\n movies_with_director_names = flatten_a_o_a(a_o_a_movies_with_director_names)\n return gross_per_studio(movies_with_director_names)\nend", "def gross_for_director(director_data)\n\ntotal = 0 \nindex = 0 \n while index < director_data[:movies].length \n director_gross = director_data[:movies][index][:worldwide_gross]\n total += director_gross\n index += 1 \n end \n\n#binding.pry \n\nreturn total\nend", "def director_gross(director_data)\n movies_index = 0\n total = 0\n \n while movies_index < director_data[:movies].count do\n total += director_data[:movies][movies_index][:worldwide_gross] \n movies_index += 1\n end\n total\nend", "def gross_for_director(director_data)\n\n \n col = 0\n value = 0\n \n while col < director_data[:movies].length do\n \n value = value + director_data[:movies][col][:worldwide_gross]\n # puts director_data[row][:movies][col][:worldwide_gross]\n # puts value\n col += 1\n end\n # puts value\n value \nend", "def directors_totals(nds)\nresult = []\n r_index=0 \n while r_index < nds.length \n i=0 \n total=0 \n\n n= nds[r_index][:name]\n t= nds[r_index][:movies]\n while i < t.length\n \n k= t[i][:worldwide_gross]\n total += k\n \n i += 1\n end\n r_index += 1\n result << [n , total]\n end\n result.to_h\n end", "def gross_for_director(director_data)\n counter = 0\n #gross = directors_database[:movies].count()\n # len = directors_database[director_data][:movies].length\n# while counter < len do \n# gross = directors_database[0][:movies][0][:worldwide_gross]\n# end\n\n# counter += 1\n # while\n new = 0\n limit = director_data[:movies].size\n while counter < limit do\n new += director_data[:movies][counter][:worldwide_gross]\n \n counter += 1\nend \n \n new\nend", "def gross_for_director(director_data)\ntotal=0 \ncolumn_index=0\nwhile column_index<director_data[:movies].length do \ntotal+=director_data[:movies][column_index][:worldwide_gross]\ncolumn_index+=1\nend\ntotal\nend", "def directors_totals(nds)\n result = {} \n directors_index = 0 \n while directors_index < nds.length do \n directors = nds[directors_index][:name]\n result[directors] = 0 \n movie_index = 0\n totalmade = 0 \n while movie_index < nds[directors_index][:movies].length do\n directors_gross = nds[directors_index][:movies][movie_index][:worldwide_gross]\n result[directors] += directors_gross\n movie_index += 1 \n end \n directors_index += 1 \n end \n result\nend", "def gross_amount\n get_awards[:gross_amt]\n end", "def money_total(people)\n count = 0\n people.each do |person|\n count += person[:monies] \nend\nreturn count\nend", "def cumulative_gross(array)\n #gave the franchise total of 0\n bond_franchise = 0\n #loop through the array of each movie\n array.each {|movie|\n #get the movie to be an integer and put that as a variable of the gross\n the_gross = movie[:gross].delete('$').split(',').join.to_i\n #the total of the franchise will add the gross of each movie\n #as it loops it will continue adding all the gross together\n bond_franchise = bond_franchise + the_gross\n }\n #this will output the total gross in integer that is converted back into $ with , to read the total $ about better\n puts \"#{bond_franchise.to_s.reverse.scan(/.{1,3}/).join(',').reverse.insert(0,'$')}\"\nend", "def gross_for_director(director_data)\nend", "def gross_for_director(director_data)\nend", "def total_cost\n# Get the total cost of a specific lifter's gym memberships\n membs_cost = memberships.map{|membership|membership.cost}\n cost_total = membs_cost.inject(:+)\n end", "def gross_for_director(director_data)\n \n result = {}\n movie_gross = 0\n movie_index = 0\n \n director_movies = director_data[:movies] # this is pointing to an array of hashes\n puts director_movies\n director_name = director_data[:name] # √\n \n while movie_index < director_movies.count do\n movie_gross += director_movies[movie_index][:worldwide_gross]\n movie_index +=1\n end\n \n movie_gross \nend", "def gross_for_director(director_data)\n # index = 0\n coordinate_total = 0\n # while index < director_data.length do\n totalindex = 0\n while totalindex < director_data[:movies].length do\n coordinate_total += director_data[:movies][totalindex][:worldwide_gross]\n totalindex += 1\n # end\n # index += 1\n end\n coordinate_total\n\nend", "def total_cost\n total = 0\n memberships.each do |membership|\n total += membership.cost\n end\n total\nend", "def gross_total\n self.gross_amount = self.net_total + self.tax_total\n end", "def gross_revenue\n purchasers.to_a.sum(&:gross_revenue)\n end", "def gift_total_amount_per_donor(donor)\n selected_gifts = Gift.where(:donor_id => donor)\n sum = 0\n selected_gifts.each do |g|\n sum+=g.amount\n end\n return sum\n end", "def gross_total\n self.gross_amount = self.net_total + self.tax_total\n end", "def total_money(people)\n total = 0\n for person in people\n total += person[:monies]\n end\n return total\nend", "def total_money(people)\n total = 0\n for person in people\n total += person[:monies]\n end\n return total\nend", "def total_money( people)\n total_money = 0\n\n for person in people\n total_money += person[:monies]\n end\n return total_money\nend", "def gross_for_director(director_data)\n\nend", "def gross_total\n self.gross_amount ||= self.net_total + self.tax_total\n end", "def gift_total_amount_per_donor(donor)\n selected_gifts = Gift.where(:donor_id => donor)\n sum = 0\n selected_gifts.each do |g|\n sum+=g.amount\n end\n return sum\n end", "def gross_for_director(director_data)\nfilmsMade = director_data[:movies].length\n movies_index = 0 \n gross_index = 0\n\n while gross_index < filmsMade do\n director_gross = director_data[:movies][gross_index][:worldwide_gross]\n movies_index += director_gross \n gross_index += 1\n end \n\n movies_index\nend", "def total_annual_rent_collected\n units.map { |unit| unit.is_vacant ? 0 : unit.monthly_rent }.reduce(:+) * 12\n end", "def total_everyone_money(people)\n total_money = 0\n for person in people\n total_money += person[:monies]\n end\n return total_money\nend", "def total_cost\n memberships.map{|membership|\n membership.cost\n }.sum\n end", "def total_cost\n total_cost = []\n memberships.select do |member_object|\n if member_object.name == self\n total_cost << member_object.cost\n end\n end\n total_cost.inject(:+)\n end", "def gross_revenue\n purchases.to_a.sum(&:gross_revenue)\n end", "def total_donations\n donations.successful.sum(:amount)\n end", "def gross_total\n self.gross_amount ||= self.net_total + self.tax_total\n end", "def total_money(people) #function\n money = 0\n\n for person in people\n money += person[:monies]\n #person[:monies] = 0\n end\n\n return money\n \n\nend", "def gross_per_studio(collection)\n result = {}\n i = 0\n while i < collection.size do\n studio = collection[i][:studio]\n total_earnings = collection[i][:worldwide_gross]\n if !result[studio]\n result[studio] = total_earnings\n else\n result[studio] += total_earnings\n end\n i += 1\n end\n \n # GOAL: Given an AoH where each Hash is a movie, return a Hash that includes\n # the total worldwide_gross of all the movies from each studio.\n #\n # INPUT: (collection) AoH where each Hash represents a movie\n #\n # RETURN: Hash where the keys are the studios and the values are the sum of\n # all the worldwide_gross numbers for every movie in the input Hash\n \n result\nend", "def salary_advance\n advs = @faculty.employee_advance_payments.belongs_to_month(@generation_date.strftime(\"%b\")).belongs_to_year(@generation_date.strftime(\"%Y\"))\n advs.inject(0){|sum, adv| sum+adv.amount_in_rupees}\n end", "def lifter_total_cost\n total_cost = 0 \n self.memberships.each do |membership_instance|\n total_cost += membership_instance.cost \n end\n total_cost\n end", "def calculate_total\n self.total = total_money(total_gross)\n end", "def total_cost\n lifter_memberships.map {|membership| membership.cost}.sum\n end", "def total_deposit\n self.group_loan_memberships.sum(\"deposit\")\n end", "def get_grand_total_one_month\n\t$pokitdok_call.each do |drug|\n\t$total_cost << drug['retail']['total_cost_30_day']['amount'].to_f\n\tend\n\t\n\tsum_total_cost = $total_cost.inject(:+)\nend" ]
[ "0.81893647", "0.79300594", "0.7928562", "0.7915463", "0.7907552", "0.7865057", "0.7715541", "0.7697522", "0.7692344", "0.76661074", "0.7602979", "0.7578513", "0.7572221", "0.75611305", "0.7560513", "0.75470454", "0.7504994", "0.7503252", "0.7491744", "0.7475745", "0.74615794", "0.74545723", "0.7451519", "0.7445858", "0.7444156", "0.7439411", "0.74219817", "0.7407192", "0.7374164", "0.7373583", "0.7343899", "0.73383033", "0.7323519", "0.731688", "0.73040354", "0.72705597", "0.7264576", "0.72638994", "0.72410065", "0.72366005", "0.7232159", "0.7209244", "0.72079384", "0.7178151", "0.7161679", "0.7073691", "0.7073691", "0.7073691", "0.7073691", "0.7073691", "0.7073691", "0.7073691", "0.7073691", "0.7073691", "0.7073691", "0.7073691", "0.7073691", "0.70734197", "0.70675707", "0.7019981", "0.70104635", "0.7001493", "0.69916093", "0.6930521", "0.6913214", "0.6860048", "0.6792345", "0.6780229", "0.6757643", "0.6757643", "0.6728295", "0.6718649", "0.67115355", "0.6700596", "0.6688933", "0.6670493", "0.66663396", "0.66515785", "0.66407037", "0.66407037", "0.66348666", "0.6608807", "0.65405846", "0.6509692", "0.65051144", "0.64259005", "0.6408962", "0.6393801", "0.63759", "0.6364288", "0.6355595", "0.6346926", "0.6343976", "0.63367176", "0.6329785", "0.6321125", "0.63185734", "0.6309948", "0.6296492", "0.62781453" ]
0.712375
45
cscope egrep is pretty bad very few character classes
def generate_cscope_pattern(base) pattern = base.downcase #in order to do case insensitive matching cscope requires lower case return "^(.* )?#{pattern}" if pattern.length <= 2 return "^(.* )?#{pattern}" #return '^(.* )?p[a-zA-Z0-9]*a' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def re; end", "def filter_chars\n # In Python we apply a string to a regexp,\n # but in Ruby we apply a regexp to a string, that's why we don't have to append\n $stack.push($stack.pop().gsub(Regexp.compile('[\\W_]+'), ' ').downcase)\nend", "def regexp; end", "def regexp; end", "def regexps; end", "def start_re; end", "def lex_en_regexp_modifiers; end", "def lex_en_regexp_modifiers; end", "def lex_en_regexp_modifiers; end", "def test_regexp\n# (find-node \"(emacs-ja)Regexps\")\n \n conv = lambda{|from,to| assert_equal(to, el4r_conv_regexp(from)) }\n conv[ //, '' ]\n conv[ /a/, 'a' ]\n conv[ /a./, 'a.' ]\n conv[ /a*/, 'a*' ]\n conv[ /a+/, 'a+' ]\n conv[ /a?/, 'a?' ]\n conv[ /[ab]/, '[ab]' ]\n conv[ /[^ab]/, '[^ab]' ]\n conv[ /^ab/, '^ab' ]\n conv[ /ab$/, 'ab$' ]\n conv[ /a|b/, 'a\\|b' ]\n conv[ /(ab)/, '\\(ab\\)' ]\n conv[ /\\As/, '\\`s' ]\n conv[ /s\\Z/, %q[s\\'] ]\n # \\=\n conv[ /\\bball\\B/, '\\bball\\B']\n # \\<\n # \\>\n conv[ /\\w/, '[0-9A-Za-z_]']\n conv[ /\\W/, '[^0-9A-Za-z_]']\n # \\sC\n # \\SC\n # \\D (number)\n end", "def heggeleggleggo(word)\n pp word.gsub /[^ aeiou]/i, '\\0egg'\nend", "def test_extended_patterns_no_flags\n [\n [ \".*\", \"abcd\\nefg\", \"abcd\" ],\n [ \"^a.\", \"abcd\\naefg\", \"ab\" ],\n [ \"^a.\", \"bacd\\naefg\", \"ae\" ],\n [ \".$\", \"bacd\\naefg\", \"d\" ]\n ].each do |reg, str, result|\n m = RustRegexp.new(reg).match(str)\n puts m.inspect\n unless m.nil?\n assert_equal result, m[0]\n end\n end\n end", "def find_enoding\n scmdlog = `file -I #{@file_name}`.strip\n scmdlog[/charset=(.+?)$/, 1]\n end", "def match(regexp); end", "def pre_match() end", "def longexpr\n end", "def scan(pattern); end", "def lexer_regexp; LEXER_REGEXP end", "def start_re=(_); end", "def lex_en_regexp_modifiers=(_arg0); end", "def lex_en_regexp_modifiers=(_arg0); end", "def lex_en_regexp_modifiers=(_arg0); end", "def regexp=(_arg0); end", "def regexp\n @regexp ||= Regexp.compile(source.to_s, Regexp::IGNORECASE)\n end", "def find_match\n @skips.each { |pattern| @scanner.skip(pattern) }\n @tests.each do |pattern, block|\n if result = @scanner.scan(pattern)\n return (block.arity.zero? ? block.call : block.call(result))\n end\n end\n raise \"Error: Unregocnized character (#{@scanner.peek(1).inspect}).\"\n end", "def matching_lines(regex); end", "def consumed_chars\n return scanner.charpos if scanner.respond_to?(:charpos)\n\n (scanner.pre_match + scanner.matched).scan(%r{.}mu).length\n end", "def find_char\n if @match == true\n find_array\n remove_miss_match_words\n @match == false\n else\n remove_miss_match_words\n end\n\n @chars = analysis\n\n #for short words do\n if @remain > 1\n find_main_char\n else\n @chars\n end\n end", "def grep_successive_cursors(*regexps)\n cursors = []\n\n scanner = StringScanner.new(@data)\n\n until scanner.eos?\n pos = scanner.pos\n\n regexps.each do |regex|\n if match = scanner.scan(regex)\n cursors << new_cursor((scanner.pos - match.size), scanner.pos)\n end\n end\n\n # nothing matches here, go forward one character\n scanner.scan(/./um) if pos == scanner.pos\n end\n\n return cursors\n end", "def grep_color(regex, opts={} )\n deb \"string grep_color(regex: '#{regex}')\"\n color = opts[:color] || true # false\n verbose = opts[:verbose] || true # TODO false\n return red(self) if self.match(regex)\n return verbose ?\n self :\n ''\n end", "def iseuc(str)\n RegexpEucjp.match( str )\n end", "def code_regexp\n unless defined?(@code_regexp)\n @code_regexp = nil\n\n if reg_str = vocab_entry.format_regexp\n @code_regexp = Regexp.union(Regexp.new(reg_str, Regexp::IGNORECASE), /\\A\\*\\Z/)\n end\n end\n @code_regexp\n end", "def stringexpr \n\t\n\t$cst.add_branch(\"StringExpr\")\n\t\n\tmatch_token(\"T_QUOTE\", $tokens[$index])\n\tcharList\n\tmatch_token(\"T_QUOTE\", $tokens[$index])\n\n\t$cst.ascend\n\t\nend", "def short_pattern\n /\n (?:^|\\W) # beginning of string or non-word char\n (?:(#{qualifier_regex})(?:\\s))? # qualifier (optional)\n (?:(#{REPOSITORY_NAME})? # repository name (optional)\n \\#|(?:GH\\-))(\\d+) # issue number\n (?=\n \\.+[ \\t]| # dots followed by space or non-word character\n \\.+$| # dots at end of line\n [^0-9a-zA-Z_.]| # non-word character except dot\n $ # end of line\n )\n /ix\n end", "def match(pattern); end", "def do_process(ps )\n word = nil\n buf = \"\"\n tokens = ps.sentence.split(/[ \\t]/)\n \n for word in tokens do\n #문자열의 길이가 최대 허용치보다 길다면...\n if word.length() > REPEAT_CHAR_ALLOWED then\n repaedCnt = 0\n checkChar = word[0]\n \n buf << checkChar\n \n for i in 1..(word.length-1) do\n if checkChar == word[i] then\n if repaetCnt == (REPEAT_CHAR_ALLOWED-1) then\n buf << \" \"\n buf << word[i]\n repeatCnt = 0\n else\n buf << word[i]\n repeadCnt +=1\n end\n else\n if checkChar == \".\" then\n buf << \" \"\n end\n \n buf << word[i]\n checkChar = word[i]\n repeadCnt = 0\n end\n end\n else\n buf << word\n end\n buf << \" \"\n end\n ps.sentence=buf\n return ps\n end", "def simple_grep(filename, phrase)\n regexp = Regexp.new(phrase)\n File.open(filename, 'r') do |file|\n # file.each_line {|line| puts line if regexp =~line}\n file.each_line do |line|\n puts \"#{$.} - #{line}\" if regexp =~line \n end\n end\nend", "def scan_for_quote(token); end", "def r regex\n raise 'First use `use`!' if @use.empty?\n \n @use.each_line do |line|\n line.gsub! /\\n$/, ''\n puts '---- ---- ---- ---- ---- ---- ----'\n puts line.inspect\n results = line.match(regex)\n if results.nil?\n puts \"No match\"\n next\n end\n puts \"Match: #{results[0].inspect}\"\n results.captures.each do |capture|\n puts \"Capture #{results.captures.index capture}: #{capture.inspect}\"\n end\n end\n puts '---- ---- ---- ---- ---- ---- ----'\nend", "def test_shortcut_character_classes_are_negated_with_capitals\n assert_equal 'the number is ', \"the number is 42\"[/\\D+/]\n assert_equal 'space:', \"space: \\t\\n\"[/\\S+/]\n # ... a programmer would most likely do\n assert_equal ' = ', \"variable_1 = 42\"[/[^a-zA-Z0-9_]+/]\n assert_equal ' = ', \"variable_1 = 42\"[/\\W+/]\n end", "def egrep(pattern)\n Dir['**/*'].\n find_all { |fn| FileTest.file?(fn) }.\n reject { |fn| File.basename(fn) =~ /^\\./ }.\n reject { |fn| fn =~ /^hosting\\// }.\n each do |fn|\n line_count = 0\n open(fn) do |f|\n while line = f.gets\n line_count += 1\n if line =~ pattern\n puts \"#{fn}:#{line_count}:#{line.strip}\"\n end\n end\n end\n end\nend", "def alpha_search(str)\r\n\r\nend", "def pattern2regex(pattern); end", "def extended_regexps!\n @hsh = self.class.er(@hsh)\n end", "def check_scan(s, pattern); end", "def check_scan(s, pattern); end", "def esc_seq!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 7 )\n\n \n # - - - - main rule block - - - -\n # at line 295:5: ( '\\\\\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\\\\\"' | '\\\\'' | '\\\\\\\\' | 'e' ) | UNICODE_ESC | OCTAL_ESC )\n alt_2 = 3\n look_2_0 = @input.peek( 1 )\n\n if ( look_2_0 == 0x5c )\n case look_2 = @input.peek( 2 )\n when 0x22, 0x27, 0x5c, 0x62, 0x65, 0x66, 0x6e, 0x72, 0x74 then alt_2 = 1\n when 0x75 then alt_2 = 2\n when 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37 then alt_2 = 3\n else\n raise NoViableAlternative( \"\", 2, 1 )\n end\n else\n raise NoViableAlternative( \"\", 2, 0 )\n end\n case alt_2\n when 1\n # at line 295:9: '\\\\\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\\\\\"' | '\\\\'' | '\\\\\\\\' | 'e' )\n match( 0x5c )\n if @input.peek(1) == 0x22 || @input.peek(1) == 0x27 || @input.peek(1) == 0x5c || @input.peek(1) == 0x62 || @input.peek( 1 ).between?( 0x65, 0x66 ) || @input.peek(1) == 0x6e || @input.peek(1) == 0x72 || @input.peek(1) == 0x74\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n when 2\n # at line 296:9: UNICODE_ESC\n unicode_esc!\n\n when 3\n # at line 297:9: OCTAL_ESC\n octal_esc!\n\n end\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 7 )\n\n end", "def search_expansions(str, pos= 0, len= -1, limit= 0)\n end", "def test_shortcut_character_classes_are_negated_with_capitals\n assert_equal \"the number is \", \"the number is 42\"[/\\D+/]\n assert_equal \"space:\", \"space: \\t\\n\"[/\\S+/]\n assert_equal \" = \", \"variable_1 = 42\"[/\\W+/]\n end", "def special_chars_in_exported_path?\n entries = `grep -inrE 'á|â|ã|é|ê|í|ó|õ|ô|ú|ç' . --exclude-dir={.git,screenshots,config,support,test_servers} --exclude='*.zip'`\n if entries.count(\"\\n\") > 0\n puts_special_chars_error_message(entries)\n exit 1\n end\nend", "def roboclassify(desc)\n @pat_matches = []\n Pattern.all.each do |pattern|\n @pat_matches += pattern.codes if regex(pattern).match(desc)\n end\n @pat_matches\n end", "def ellipses_to_wildcards_regex(line)\n content_pieces = line.split(ELLIPSIS_REGEX, -1)\n .map(&Regexp.method(:escape))\n /\\A#{content_pieces.join('.*?')}\\Z/\n end", "def expand_ctrl_chars(str)\n str = str.gsub(/^.*?\\r/, '')\n str.gsub!(/(\\A#{\"\\b\"}|.#{\"\\b\"}|#{\"\\a\"}|#{\"\\0\"})/m, '')\n str.gsub!(/(^.*?)\\f/) { \"#{$1}\\n#{' ' * $1.length}\" }\n str\n end", "def parse_escaped_chars; end", "def end_word_pattern; end", "def grep(filename, phrase)\n File.open(filename) do |lines|\n lines.each do |line|\n puts \"#{lines.lineno}. #{line}\" if line =~ Regexp.new(phrase)\n end\n end\nend", "def match_string_to_regexp(str)\n #str = str.split(/(\\(\\(.*?\\)\\))(?!\\))/).map{ |x|\n # x =~ /\\A\\(\\((.*)\\)\\)\\Z/ ? $1 : Regexp.escape(x)\n #}.join\n #str = str.gsub(/\\\\\\s+/, '\\s+')\n #Regexp.new(str, Regexp::IGNORECASE)\n\n #str = str.split(/([#$]\\(.*?\\))/).map{ |x|\n # x =~ /\\A[#$]\\((.*)\\)\\Z/ ? ($1.start_with?('#') ? \"(#{$1})\" : $1 ) : Regexp.escape(x)\n #}.join\n #str = str.gsub(/\\\\\\s+/, '\\s+')\n #Regexp.new(str, Regexp::IGNORECASE)\n\n$stderr.puts \"HERE!!!!!!\"\n\n str = str.split(PATTERN).map{ |x|\n case x\n when /\\A\\(\\((.*)\\)\\)\\Z/\n $1\n when /\\A[#$]\\((.*)\\)\\Z/\n $1.start_with?('#') ? \"(#{$1})\" : $1\n else\n Regexp.escape(x)\n end\n }.join\n\n str = str.gsub(/\\\\\\s+/, '\\s+')\n\n Regexp.new(str, Regexp::IGNORECASE)\n\n #rexps = []\n #str = str.gsub(/\\(\\((.*?)\\)\\)/) do |m|\n # rexps << '(' + $1 + ')'\n # \"\\0\"\n #end\n #str = Regexp.escape(str)\n #rexps.each do |r|\n # str = str.sub(\"\\0\", r)\n #end\n #str = str.gsub(/(\\\\\\ )+/, '\\s+')\n #Regexp.new(str, Regexp::IGNORECASE)\n end", "def try_regexp( str, re )\n\tif str =~ re\n\t\tputs \" #$PREMATCH\",\n\t\t \" \" + colorize( 'bold', 'green' ) { $MATCH },\n\t\t \" #$POSTMATCH\"\n\telse\n\t\tputs colorize( \"Nope.\", 'red' )\n\tend\nend", "def lex_en_character=(_arg0); end", "def define_word_CEDICT(word)\n @cedict = 'cedict.txt'\n @word_matches = File.readlines(@cedict).grep(/#{word}/)\n\n @best_match = []\n\n @word_matches.each do |x|\n # CEDICT lists simplified and traditional characters, space delimited\n # 学 = \"學 学 [xue2] /to learn/to study/science/-ology/\"\n @match = x.split\n\n if @match[0] == word || @match[1] == word\n @best_match << x\n end\n end\n\n return @best_match\n end", "def initialize()\n @regexps = Hash.new {|hash,key| hash[key] = Regexp.new(key)}\n @memoization = nil\n @terminal_parse_failures = nil\n end", "def ruby_grep(filename, pattern)\n regexp = Regexp.new(pattern)\n File.open(filename, 'r') do |file|\n file.each_line {|line| puts line if regexp =~ line}\n end\nend", "def fscan!(str, fuzziness=2)\n str.gsub!(/\\n/, \" \")\n words = str.extend(TRE).ascan regex, TRE.fuzziness(fuzziness)\n words.uniq\n end", "def scan(search_exp, used_as_search_exp_occurence = nil)\n if used_as_search_exp_occurence then\n encode(@str).\n gsub(Regexp.new(used_as_search_exp_occurence.encoded_regexp_str)) do |o|\n \"S#{o.hex_encode}S\"\n end.\n scan(Regexp.new(search_exp.encoded_regexp_str)).\n map do |part|\n part.gsub!(/S\\h+S/) { |m| m[1...-1].hex_decode }\n Text.new(decode(part))\n end\n else\n encode(@str).\n scan(Regexp.new(\"(#{search_exp.encoded_regexp_str})\")).map(&:first).\n map { |part| Text.new(decode(part)) }\n end\n end", "def lex_en_inside_string; end", "def test_match_case_sensitive_special_char\r\n\t\t#content with exact match\r\n\t\tcontent = \"first line.\\nthis string contains a case sensitive match on: My(Match123\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"My(Match123\" \r\n\t\tsnort_rule_content.nocase = false\r\n\t\t\r\n\t\tmatch = snort_rule_content.match(content,0)\r\n\t\tassert_equal(60, match,\"no case sensitive match on content with special char.\")\r\n\tend", "def look_ahead(kclass, index, char, buffer, classified_sentence, nivel_parentese)\n if @raw[index + 1] && kclass::REGEX.match( \"#{buffer}#{char}#{@raw[index + 1]}\" )\n buffer.concat char\n else\n classified_sentence.push kclass.new(buffer+char)\n buffer.clear\n end\n end", "def invalid_regexp_chars\n @invalid_regexp_chars ||= TwitterCldr::Utils::RangeSet.new(\n [2..7, 55296..57343]\n )\n end", "def regex_end_prefix\n Regexp.new(\"endline#{VM_PREFIX}\")\nend", "def process_scope exp\n # NOPE?\n end", "def on_regexp_beg(token)\n log \"REGEXP_BEG: '#{token}'\"\n super(token)\n end", "def has_special_ch?(str)\n (str =~ @@regex)?true:false\n end", "def methods_matching(re); end", "def chunk_char!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 14 )\n\n \n # - - - - main rule block - - - -\n # at line 68:3: (~ ( '>' | '<' | '#' | '`' | '\\\"' | '\\\\'' | '|' | '(' | ')' | '$' | ';' | ' ' | '?' | '*' | '~' | '\\\\\\\\' | '\\\\t' | '{' | '}' | '\\\\n' | '\\\\r' ) | '\\\\\\\\' . )\n alt_23 = 2\n look_23_0 = @input.peek( 1 )\n\n if ( look_23_0.between?( 0x0, 0x8 ) || look_23_0.between?( 0xb, 0xc ) || look_23_0.between?( 0xe, 0x1f ) || look_23_0 == 0x21 || look_23_0.between?( 0x25, 0x26 ) || look_23_0.between?( 0x2b, 0x3a ) || look_23_0 == 0x3d || look_23_0.between?( 0x40, 0x5b ) || look_23_0.between?( 0x5d, 0x5f ) || look_23_0.between?( 0x61, 0x7a ) || look_23_0.between?( 0x7f, 0xffff ) )\n alt_23 = 1\n elsif ( look_23_0 == 0x5c )\n alt_23 = 2\n else\n raise NoViableAlternative( \"\", 23, 0 )\n end\n case alt_23\n when 1\n # at line 68:5: ~ ( '>' | '<' | '#' | '`' | '\\\"' | '\\\\'' | '|' | '(' | ')' | '$' | ';' | ' ' | '?' | '*' | '~' | '\\\\\\\\' | '\\\\t' | '{' | '}' | '\\\\n' | '\\\\r' )\n if @input.peek( 1 ).between?( 0x0, 0x8 ) || @input.peek( 1 ).between?( 0xb, 0xc ) || @input.peek( 1 ).between?( 0xe, 0x1f ) || @input.peek(1) == 0x21 || @input.peek( 1 ).between?( 0x25, 0x26 ) || @input.peek( 1 ).between?( 0x2b, 0x3a ) || @input.peek(1) == 0x3d || @input.peek( 1 ).between?( 0x40, 0x5b ) || @input.peek( 1 ).between?( 0x5d, 0x5f ) || @input.peek( 1 ).between?( 0x61, 0x7a ) || @input.peek( 1 ).between?( 0x7f, 0xff )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n when 2\n # at line 70:5: '\\\\\\\\' .\n match( 0x5c )\n match_any\n\n end\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 14 )\n\n end", "def regexp_from_string(str)\n if str[0,1] == '%'\n str = str[1..-1]\n else\n str = '^' + str\n end\n\n if str[-1,1] == '%'\n str = str[0..-2]\n else\n str = str + '$'\n end\n Regexp.new(str, Regexp::IGNORECASE)\n end", "def yylex # 826 lines\n c = ''\n self.space_seen = false\n command_state = false\n src = self.src\n\n self.token = nil\n self.yacc_value = nil\n\n return yylex_string if lex_strterm\n\n command_state = self.command_start\n self.command_start = false\n\n last_state = lex_state\n\n loop do # START OF CASE\n if src.scan(/[\\ \\t\\r\\f\\v]/) then # \\s - \\n + \\v\n self.space_seen = true\n next\n elsif src.check(/[^a-zA-Z]/) then\n if src.scan(/\\n|#/) then\n self.lineno = nil\n c = src.matched\n if c == '#' then\n src.pos -= 1\n\n while src.scan(/\\s*#.*(\\n+|\\z)/) do\n @comments << src.matched.gsub(/^ +#/, '#').gsub(/^ +$/, '')\n end\n\n return RubyLexer::EOF if src.eos?\n end\n\n # Replace a string of newlines with a single one\n src.scan(/\\n+/)\n\n next if in_lex_state?(:expr_beg, :expr_value, :expr_class,\n :expr_fname, :expr_dot)\n\n if src.scan(/([\\ \\t\\r\\f\\v]*)\\./) then\n self.space_seen = true unless src[1].empty?\n\n src.pos -= 1\n next unless src.check(/\\.\\./)\n end\n\n self.command_start = true\n self.lex_state = :expr_beg\n return :tNL\n elsif src.scan(/[\\]\\)\\}]/) then\n if src.matched == \"}\" then\n self.brace_nest -= 1\n else\n self.paren_nest -= 1\n end\n\n cond.lexpop\n cmdarg.lexpop\n tern.lexpop\n\n self.lex_state = if src.matched == \")\" then\n :expr_endfn\n else\n :expr_endarg\n end\n\n self.yacc_value = src.matched\n result = {\n \")\" => :tRPAREN,\n \"]\" => :tRBRACK,\n \"}\" => :tRCURLY\n }[src.matched]\n return result\n elsif src.scan(/\\!/) then\n if in_lex_state?(:expr_fname, :expr_dot) then\n self.lex_state = :expr_arg\n\n if src.scan(/@/) then\n self.yacc_value = \"!@\"\n return :tUBANG\n end\n else\n self.lex_state = :expr_beg\n end\n\n if src.scan(/[=~]/) then\n self.yacc_value = \"!#{src.matched}\"\n else\n self.yacc_value = \"!\"\n end\n\n return TOKENS[self.yacc_value]\n elsif src.scan(/\\.\\.\\.?|,|![=~]?/) then\n self.lex_state = :expr_beg\n tok = self.yacc_value = src.matched\n return TOKENS[tok]\n elsif src.check(/\\./) then\n if src.scan(/\\.\\d/) then\n rb_compile_error \"no .<digit> floating literal anymore put 0 before dot\"\n elsif src.scan(/\\./) then\n self.lex_state = :expr_dot\n self.yacc_value = \".\"\n return :tDOT\n end\n elsif src.scan(/\\(/) then\n result = if ruby18 then\n yylex_paren18\n else\n yylex_paren19\n end\n\n self.paren_nest += 1\n\n self.expr_beg_push \"(\"\n\n return result\n elsif src.check(/\\=/) then\n if src.scan(/\\=\\=\\=|\\=\\=|\\=~|\\=>|\\=(?!begin\\b)/) then\n self.fix_arg_lex_state\n tok = self.yacc_value = src.matched\n return TOKENS[tok]\n elsif src.scan(/\\=begin(?=\\s)/) then\n @comments << src.matched\n\n unless src.scan(/.*?\\n=end( |\\t|\\f)*[^\\n]*(\\n|\\z)/m) then\n @comments.clear\n rb_compile_error(\"embedded document meets end of file\")\n end\n\n @comments << src.matched\n\n next\n else\n raise \"you shouldn't be able to get here\"\n end\n elsif src.scan(/\\\"(#{ESC_RE}|#(#{ESC_RE}|[^\\{\\#\\@\\$\\\"\\\\])|[^\\\"\\\\\\#])*\\\"/o) then\n self.yacc_value = src.matched[1..-2].gsub(ESC_RE) { unescape $1 }\n self.lex_state = :expr_end\n return :tSTRING\n elsif src.scan(/\\\"/) then # FALLBACK\n self.lex_strterm = [:strterm, STR_DQUOTE, '\"', \"\\0\"] # TODO: question this\n self.yacc_value = \"\\\"\"\n return :tSTRING_BEG\n elsif src.scan(/\\@\\@?#{IDENT_CHAR_RE}+/o) then\n self.token = src.matched\n\n rb_compile_error \"`#{token}` is not allowed as a variable name\" if\n token =~ /\\@\\d/\n\n return process_token(command_state)\n elsif src.scan(/\\:\\:/) then\n if is_beg? || in_lex_state?(:expr_class) || is_space_arg? then\n self.lex_state = :expr_beg\n self.yacc_value = \"::\"\n return :tCOLON3\n end\n\n self.lex_state = :expr_dot\n self.yacc_value = \"::\"\n return :tCOLON2\n elsif ! is_end? && src.scan(/:([a-zA-Z_]#{IDENT_CHAR_RE}*(?:[?!]|=(?==>)|=(?![=>]))?)/) then\n # scanning shortcut to symbols\n self.yacc_value = src[1]\n self.lex_state = :expr_end\n return :tSYMBOL\n elsif src.scan(/\\:/) then\n # ?: / then / when\n if is_end? || src.check(/\\s/) then\n self.lex_state = :expr_beg\n # TODO warn_balanced(\":\", \"symbol literal\");\n self.yacc_value = \":\"\n return :tCOLON\n end\n\n case\n when src.scan(/\\'/) then\n self.lex_strterm = [:strterm, STR_SSYM, src.matched, \"\\0\"]\n when src.scan(/\\\"/) then\n self.lex_strterm = [:strterm, STR_DSYM, src.matched, \"\\0\"]\n end\n\n self.lex_state = :expr_fname\n self.yacc_value = \":\"\n return :tSYMBEG\n elsif src.check(/[0-9]/) then\n return parse_number\n elsif src.scan(/\\[/) then\n self.paren_nest += 1\n\n result = src.matched\n\n if in_lex_state? :expr_fname, :expr_dot then\n self.lex_state = :expr_arg\n case\n when src.scan(/\\]\\=/) then\n self.paren_nest -= 1 # HACK? I dunno, or bug in MRI\n self.yacc_value = \"[]=\"\n return :tASET\n when src.scan(/\\]/) then\n self.paren_nest -= 1 # HACK? I dunno, or bug in MRI\n self.yacc_value = \"[]\"\n return :tAREF\n else\n rb_compile_error \"unexpected '['\"\n end\n elsif is_beg? then\n self.tern.push false\n result = :tLBRACK\n elsif is_arg? && space_seen then\n self.tern.push false\n result = :tLBRACK\n else\n result = :tLBRACK2\n end\n\n self.expr_beg_push \"[\"\n\n return result\n elsif src.scan(/\\'(\\\\.|[^\\'])*\\'/) then\n self.yacc_value = src.matched[1..-2].gsub(/\\\\\\\\/, \"\\\\\").gsub(/\\\\'/, \"'\") # \"\n self.lex_state = :expr_end\n return :tSTRING\n elsif src.check(/\\|/) then\n if src.scan(/\\|\\|\\=/) then\n self.lex_state = :expr_beg\n self.yacc_value = \"||\"\n return :tOP_ASGN\n elsif src.scan(/\\|\\|/) then\n self.lex_state = :expr_beg\n self.yacc_value = \"||\"\n return :tOROP\n elsif src.scan(/\\|\\=/) then\n self.lex_state = :expr_beg\n self.yacc_value = \"|\"\n return :tOP_ASGN\n elsif src.scan(/\\|/) then\n self.fix_arg_lex_state\n self.yacc_value = \"|\"\n return :tPIPE\n end\n elsif src.scan(/\\{/) then\n self.brace_nest += 1\n if lpar_beg && lpar_beg == paren_nest then\n self.lpar_beg = nil\n self.paren_nest -= 1\n\n expr_beg_push \"{\"\n\n return :tLAMBEG\n end\n\n result = if is_arg? || in_lex_state?(:expr_end, :expr_endfn) then\n :tLCURLY # block (primary)\n elsif in_lex_state?(:expr_endarg) then\n :tLBRACE_ARG # block (expr)\n else\n self.tern.push false\n :tLBRACE # hash\n end\n\n self.expr_beg_push \"{\"\n self.command_start = true unless result == :tLBRACE\n\n return result\n elsif src.scan(/->/) then\n self.lex_state = :expr_endfn\n return :tLAMBDA\n elsif src.scan(/[+-]/) then\n sign = src.matched\n utype, type = if sign == \"+\" then\n [:tUPLUS, :tPLUS]\n else\n [:tUMINUS, :tMINUS]\n end\n\n if in_lex_state? :expr_fname, :expr_dot then\n self.lex_state = :expr_arg\n if src.scan(/@/) then\n self.yacc_value = \"#{sign}@\"\n return utype\n else\n self.yacc_value = sign\n return type\n end\n end\n\n if src.scan(/\\=/) then\n self.lex_state = :expr_beg\n self.yacc_value = sign\n return :tOP_ASGN\n end\n\n if (is_beg? || (is_arg? && space_seen && !src.check(/\\s/))) then\n if is_arg? then\n arg_ambiguous\n end\n\n self.lex_state = :expr_beg\n self.yacc_value = sign\n\n if src.check(/\\d/) then\n if utype == :tUPLUS then\n return self.parse_number\n else\n return :tUMINUS_NUM\n end\n end\n\n return utype\n end\n\n self.lex_state = :expr_beg\n self.yacc_value = sign\n return type\n elsif src.check(/\\*/) then\n if src.scan(/\\*\\*=/) then\n self.lex_state = :expr_beg\n self.yacc_value = \"**\"\n return :tOP_ASGN\n elsif src.scan(/\\*\\*/) then\n result = if is_space_arg? src.check(/./m) then\n warning \"`**' interpreted as argument prefix\"\n :tDSTAR\n elsif is_beg? then\n :tDSTAR\n else\n # TODO: warn_balanced(\"**\", \"argument prefix\");\n :tPOW\n end\n self.yacc_value = \"**\"\n self.fix_arg_lex_state\n return result\n elsif src.scan(/\\*\\=/) then\n self.lex_state = :expr_beg\n self.yacc_value = \"*\"\n return :tOP_ASGN\n elsif src.scan(/\\*/) then\n result = if is_space_arg? src.check(/./m) then\n warning(\"`*' interpreted as argument prefix\")\n :tSTAR\n elsif is_beg? then\n :tSTAR\n else\n # TODO: warn_balanced(\"*\", \"argument prefix\");\n :tSTAR2 # TODO: rename\n end\n\n self.yacc_value = \"*\"\n self.fix_arg_lex_state\n return result\n end\n elsif src.check(/\\</) then\n if src.scan(/\\<\\=\\>/) then\n self.fix_arg_lex_state\n self.yacc_value = \"<=>\"\n return :tCMP\n elsif src.scan(/\\<\\=/) then\n self.fix_arg_lex_state\n self.yacc_value = \"<=\"\n return :tLEQ\n elsif src.scan(/\\<\\<\\=/) then\n self.fix_arg_lex_state\n self.lex_state = :expr_beg\n self.yacc_value = \"\\<\\<\"\n return :tOP_ASGN\n elsif src.scan(/\\<\\</) then\n if (!in_lex_state?(:expr_dot, :expr_class) &&\n !is_end? &&\n (!is_arg? || space_seen)) then\n tok = self.heredoc_identifier\n return tok if tok\n end\n\n self.fix_arg_lex_state\n self.yacc_value = \"\\<\\<\"\n return :tLSHFT\n elsif src.scan(/\\</) then\n self.fix_arg_lex_state\n self.yacc_value = \"<\"\n return :tLT\n end\n elsif src.check(/\\>/) then\n if src.scan(/\\>\\=/) then\n self.fix_arg_lex_state\n self.yacc_value = \">=\"\n return :tGEQ\n elsif src.scan(/\\>\\>=/) then\n self.fix_arg_lex_state\n self.lex_state = :expr_beg\n self.yacc_value = \">>\"\n return :tOP_ASGN\n elsif src.scan(/\\>\\>/) then\n self.fix_arg_lex_state\n self.yacc_value = \">>\"\n return :tRSHFT\n elsif src.scan(/\\>/) then\n self.fix_arg_lex_state\n self.yacc_value = \">\"\n return :tGT\n end\n elsif src.scan(/\\`/) then\n self.yacc_value = \"`\"\n case lex_state\n when :expr_fname then\n self.lex_state = :expr_end\n return :tBACK_REF2\n when :expr_dot then\n self.lex_state = if command_state then\n :expr_cmdarg\n else\n :expr_arg\n end\n return :tBACK_REF2\n end\n self.lex_strterm = [:strterm, STR_XQUOTE, '`', \"\\0\"]\n return :tXSTRING_BEG\n elsif src.scan(/\\?/) then\n\n if is_end? then\n self.lex_state = ruby18 ? :expr_beg : :expr_value # HACK?\n self.tern.push true\n self.yacc_value = \"?\"\n return :tEH\n end\n\n if src.eos? then\n rb_compile_error \"incomplete character syntax\"\n end\n\n if src.check(/\\s|\\v/) then\n unless is_arg? then\n c2 = { \" \" => 's',\n \"\\n\" => 'n',\n \"\\t\" => 't',\n \"\\v\" => 'v',\n \"\\r\" => 'r',\n \"\\f\" => 'f' }[src.matched]\n\n if c2 then\n warning(\"invalid character syntax; use ?\\\\\" + c2)\n end\n end\n\n # ternary\n self.lex_state = ruby18 ? :expr_beg : :expr_value # HACK?\n self.tern.push true\n self.yacc_value = \"?\"\n return :tEH\n elsif src.check(/\\w(?=\\w)/) then # ternary, also\n self.lex_state = :expr_beg\n self.tern.push true\n self.yacc_value = \"?\"\n return :tEH\n end\n\n c = if src.scan(/\\\\/) then\n self.read_escape\n else\n src.getch\n end\n self.lex_state = :expr_end\n\n if version == 18 then\n self.yacc_value = c[0].ord & 0xff\n return :tINTEGER\n else\n self.yacc_value = c\n return :tSTRING\n end\n elsif src.check(/\\&/) then\n if src.scan(/\\&\\&\\=/) then\n self.yacc_value = \"&&\"\n self.lex_state = :expr_beg\n return :tOP_ASGN\n elsif src.scan(/\\&\\&/) then\n self.lex_state = :expr_beg\n self.yacc_value = \"&&\"\n return :tANDOP\n elsif src.scan(/\\&\\=/) then\n self.yacc_value = \"&\"\n self.lex_state = :expr_beg\n return :tOP_ASGN\n elsif src.scan(/&/) then\n result = if is_arg? && space_seen &&\n !src.check(/\\s/) then\n warning(\"`&' interpreted as argument prefix\")\n :tAMPER\n elsif in_lex_state? :expr_beg, :expr_mid then\n :tAMPER\n else\n :tAMPER2\n end\n\n self.fix_arg_lex_state\n self.yacc_value = \"&\"\n return result\n end\n elsif src.scan(/\\//) then\n if is_beg? then\n self.lex_strterm = [:strterm, STR_REGEXP, '/', \"\\0\"]\n self.yacc_value = \"/\"\n return :tREGEXP_BEG\n end\n\n if src.scan(/\\=/) then\n self.yacc_value = \"/\"\n self.lex_state = :expr_beg\n return :tOP_ASGN\n end\n\n if is_arg? && space_seen then\n unless src.scan(/\\s/) then\n arg_ambiguous\n self.lex_strterm = [:strterm, STR_REGEXP, '/', \"\\0\"]\n self.yacc_value = \"/\"\n return :tREGEXP_BEG\n end\n end\n\n self.fix_arg_lex_state\n self.yacc_value = \"/\"\n\n return :tDIVIDE\n elsif src.scan(/\\^=/) then\n self.lex_state = :expr_beg\n self.yacc_value = \"^\"\n return :tOP_ASGN\n elsif src.scan(/\\^/) then\n self.fix_arg_lex_state\n self.yacc_value = \"^\"\n return :tCARET\n elsif src.scan(/\\;/) then\n self.command_start = true\n self.lex_state = :expr_beg\n self.yacc_value = \";\"\n return :tSEMI\n elsif src.scan(/\\~/) then\n if in_lex_state? :expr_fname, :expr_dot then\n src.scan(/@/)\n end\n\n self.fix_arg_lex_state\n self.yacc_value = \"~\"\n\n return :tTILDE\n elsif src.scan(/\\\\/) then\n if src.scan(/\\r?\\n/) then\n self.lineno = nil\n self.space_seen = true\n next\n end\n rb_compile_error \"bare backslash only allowed before newline\"\n elsif src.scan(/\\%/) then\n if is_beg? then\n return parse_quote\n end\n\n if src.scan(/\\=/) then\n self.lex_state = :expr_beg\n self.yacc_value = \"%\"\n return :tOP_ASGN\n end\n\n return parse_quote if is_arg? && space_seen && ! src.check(/\\s/)\n\n self.fix_arg_lex_state\n self.yacc_value = \"%\"\n\n return :tPERCENT\n elsif src.check(/\\$/) then\n if src.scan(/(\\$_)(\\w+)/) then\n self.lex_state = :expr_end\n self.token = src.matched\n return process_token(command_state)\n elsif src.scan(/\\$_/) then\n self.lex_state = :expr_end\n self.token = src.matched\n self.yacc_value = src.matched\n return :tGVAR\n elsif src.scan(/\\$[~*$?!@\\/\\\\;,.=:<>\\\"]|\\$-\\w?/) then\n self.lex_state = :expr_end\n self.yacc_value = src.matched\n return :tGVAR\n elsif src.scan(/\\$([\\&\\`\\'\\+])/) then\n self.lex_state = :expr_end\n # Explicit reference to these vars as symbols...\n if last_state == :expr_fname then\n self.yacc_value = src.matched\n return :tGVAR\n else\n self.yacc_value = src[1].to_sym\n return :tBACK_REF\n end\n elsif src.scan(/\\$([1-9]\\d*)/) then\n self.lex_state = :expr_end\n if last_state == :expr_fname then\n self.yacc_value = src.matched\n return :tGVAR\n else\n self.yacc_value = src[1].to_i\n return :tNTH_REF\n end\n elsif src.scan(/\\$0/) then\n self.lex_state = :expr_end\n self.token = src.matched\n return process_token(command_state)\n elsif src.scan(/\\$\\W|\\$\\z/) then # TODO: remove?\n self.lex_state = :expr_end\n self.yacc_value = \"$\"\n return \"$\"\n elsif src.scan(/\\$\\w+/)\n self.lex_state = :expr_end\n self.token = src.matched\n return process_token(command_state)\n end\n elsif src.check(/\\_/) then\n if src.beginning_of_line? && src.scan(/\\__END__(\\r?\\n|\\Z)/) then\n self.lineno = nil\n return RubyLexer::EOF\n elsif src.scan(/\\_\\w*/) then\n self.token = src.matched\n return process_token(command_state)\n end\n end\n end # END OF CASE\n\n if src.scan(/\\004|\\032|\\000/) || src.eos? then # ^D, ^Z, EOF\n return RubyLexer::EOF\n else # alpha check\n rb_compile_error \"Invalid char #{src.rest[0].chr} in expression\" unless\n src.check IDENT_RE\n end\n\n self.token = src.matched if self.src.scan IDENT_RE\n\n return process_token(command_state)\n end\n end", "def start_word_pattern; end", "def shell_regex\n /\n (\\`.+\\`)\n /xm\n end", "def count_code(string) # return the number of times 'co'+any_char+'e' appears\n return string.scan(/co.e/).length #easy way with regex\nend", "def test_match_string\n lisp = %q((progn\n (switch-to-buffer \"a\")\n\n (save-excursion\n (insert \"abcdefg\\n\")\n (goto-char 1)\n (re-search-forward \"^\\\\\\\\(.+\\\\\\\\)$\")\n )\n (match-string 1)))\n\n ruby = lambda{\n##### [with]\n with(:save_excursion) do\n goto_char 1\n re_search_forward('^\\\\(.+\\\\)$')\n end\n match_string 1\n##### [/with]\n }\n assert_equal(el4r_lisp_eval(lisp), ruby[])\n\n end", "def initialize find, replace\n @regexp = Regexp.new(\"^#{find}$\")\n @replace = replace\n end", "def escape_re(str)\n str.gsub(@re_chars) {|c| @re_esc + c}\n end", "def find_complemental_infix\n verb, complement = @word.chars\n\n if complement == \"得\"\n query = \"#{verb} 不得\"\n else\n query = \"#{verb} 不|得 #{complement}\"\n end\n @complemental_infix = query_leeds_corpus(query) do |context|\n context.match.map(&:text).join\n end\n\n report_words_with_frequency(\"Complemental Infixes\", @complemental_infix)\n end", "def rejected_characters_regexp\n @rejected_characters_regexp ||= %r{(#{RESOURCES_REJECTED_CHARS.join('|')})}\n end", "def occurGrep(pattern, filename)\n\tregexp = Regexp.new(pattern)\n\tFile.foreach(filename).with_index { |line, line_num| \n\t\tputs \"#{line_num}: #{line}\" if regexp =~ line }\nend", "def lex_en_interp_string; end", "def lex_en_interp_string; end", "def lex_en_interp_string; end", "def parse_escaped_chars\n @src.pos += @src.matched_size\n add_text(@src[1])\n end", "def fix_common_typos!\n # well, I don't know what kind of typos people do!\n @pattern.squish!\n end", "def query_regexp( query )\n read_db do |dbm|\n dbm.each_key do |key|\n puts RDictCcEntry.format_str(dbm[key]) if key =~ /#{query}/\n end\n end\n end", "def vowels # :nodoc:\n /((?<!q)u|[aeio]|(?<=[bcdfghjklmnprstvwxz])y).*$/\n end", "def exp_command_line\n\t\tst = \"\\033[7m\"\n\t\ten = \"\\033[m\"\n\t\tputs \"Enter an empty string at any time to exit\"\n\t\twhile true\n\t\t\tprint \"str> \"; STDOUT.flush; str = gets.chop\n\t\t\tbreak if str.empty?\n\t\t\tprint \"pat> \"; STDOUT.flush; pat = gets.chop\n\t\t\tbreak if pat.empty?\n\t\t\tre = Regexp.new(pat)\n\t\t\tputs str.gsub(re, \"#{st}\\\\&#{en}\")\n\t\tend\n\tend", "def make_regexp\n @intent = self.intent\n regexp = self.pattern.dup.downcase\n words = regexp.split(\" \")\n words.each do |word|\n if word.include? '/'\n regexp = regexp.gsub(word,\"(#{word})\")\n\n end\n\n end\n regexp = regexp.gsub('/',\"|\")\n regexp = regexp.gsub('^ ','.{0,60}').gsub(' ^','.{0,60}').gsub(' *','.{1,60}').gsub('* ','.{1,60}').gsub('^','.{1,60}').gsub(' [','.{0,60}[')\n regexp = regexp.gsub(' .{0,60}','.{0,60}')\n regexp = regexp.gsub(' .{1,60}','.{1,60}')\n regexp = '.{0,60}' + regexp + '.{0,60}'\n self.regexp = regexp\n chunks = self.pattern.split(' ')\n chunks.each do |ch|\n result= Regexp.new(/\\[.{0,12}\\]/) =~ ch\n if(result==0)\n set = WordSet.find_by_keyword(ch[1..-2])\n str = '(' + set.words.join('|') + ')'\n regexp = self.regexp.gsub(ch,str)\n self.regexp = regexp\n end\n end\n self.save\n end", "def sanitize(string)\n string.gsub(ANSI_MATCHER, \"\")\n end", "def enter_regex\n print \"Enter (regex) pattern: \"\n #$patt = gets().chomp\n $patt = Readline::readline('>', true)\n ctr = 0\nend", "def grep_file(file_path, grep_pattern)\n logc(\"method: #{__method__}, params: #{file_path}, #{grep_pattern}\")\n\n # with File.open(file_path, 'r').each.grep(grep_pattern) possible invalid byte sequence in UTF-8 (ArgumentError)\n # so we use \"match\" to check if line match pattern and 'scrub' to skip bad encoding symbols\n res = []\n File.open(file_path, 'r').each {|line| res << line if line.scrub.match(grep_pattern)}\n return res\nend", "def regex(_obj)\n raise NotImplementedError\n end", "def search_filenames\n # * => all files\n # r => search from its subdirectories\n # i => ignore cases\n # l => list file name\n # c => show word occurence count\n # w => words\n\n args = set_args\n # grep -ril '#keyword1' --include=\\*.rb *\n `grep -ril '#{args}' #{search_extension} *`\n end", "def query_fulltext_regexp( query )\n read_db do |dbm|\n dbm.each_value do |raw_val|\n val = RDictCcEntry.format_str(raw_val)\n match_line_found = false\n val.each_line do |line|\n if line =~ /^\\s+/\n if match_line_found\n puts line\n else\n # Skip lines starting with blanks, because these are already\n # translations and they don't belong to the matching line.\n next\n end\n else\n match_line_found = false\n end\n if line.downcase =~ /#{query}/\n puts line\n match_line_found = true\n end\n end\n end\n end\n end" ]
[ "0.59010875", "0.5761099", "0.5750851", "0.5750851", "0.5691109", "0.5656059", "0.56263065", "0.56263065", "0.56263065", "0.55732644", "0.55520415", "0.55158806", "0.5479506", "0.5418283", "0.5416123", "0.53727305", "0.5343021", "0.5310164", "0.52442944", "0.52180696", "0.52180696", "0.52180696", "0.52172554", "0.52068996", "0.5199988", "0.5184784", "0.5171914", "0.51621103", "0.5157035", "0.5132739", "0.51237494", "0.509763", "0.50836957", "0.5080956", "0.5047143", "0.50403154", "0.5039365", "0.5038312", "0.5037825", "0.5034834", "0.50319505", "0.5022476", "0.5016264", "0.50038606", "0.49905857", "0.49905857", "0.49641958", "0.495143", "0.49495196", "0.49447158", "0.493788", "0.4934844", "0.49068004", "0.49018535", "0.48898828", "0.48860136", "0.48849392", "0.48740458", "0.4870747", "0.48659307", "0.48591733", "0.48529786", "0.48463547", "0.4845452", "0.48299715", "0.48216346", "0.48204252", "0.48182228", "0.4814401", "0.48075002", "0.4798736", "0.47974494", "0.47931144", "0.47903672", "0.47886583", "0.47831482", "0.47799867", "0.47772616", "0.4764602", "0.47601053", "0.4758312", "0.47571862", "0.47558048", "0.47500458", "0.47466344", "0.47438952", "0.47438952", "0.47438952", "0.4740689", "0.47396693", "0.47389385", "0.4726206", "0.47193205", "0.4717461", "0.47121412", "0.47071", "0.46960616", "0.46960533", "0.46871942", "0.4684532" ]
0.5864471
1
Wipe out _all_ data in memcached, use with care.
def cache_clear @store.flush_all rescue ::MemCache::MemCacheError => e Log.error(e) nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_cache\n @all = nil\n end", "def clear_all!\n @cache = Cache.new\n end", "def cache_clear\n @client.flushall\n end", "def clear_all\n data.delete_all\n self\n end", "def cache_clear\n @dataset.delete\n end", "def cache_clear\n @dataset.delete\n end", "def clear_all\n clear\n clear_stored_requests\n end", "def clear_all\n FileUtils.rm_rf(CACHE_DIR)\n end", "def clear_cache\n ccs.each(&:clear_cache)\n end", "def clear_all_training_data\n @redis.flushdb\n end", "def cache_clear\n @moneta.clear\n end", "def clear\n synchronize_block do\n @data.clear\n @key_access_store.clear\n end\n end", "def clear\n cache.clear\n end", "def clear\n @lock.write_sync{ @data.clear }\n end", "def clear!\n @cache = {}\n end", "def delete_all_caching_without_touching_additives\n\t\t\tself.delete_category_menu_fragments\n \t\tself.delete_cache\n \t\tself.delete_shared_item_items\n\t\t\tself.delete_category_browser_fragments\nend", "def purge!\n @data = nil\n end", "def purge!\n @data = nil\n end", "def clear ; @data.clear ; end", "def clear\r\n @cache.flush\r\n end", "def cache_clear\n @store.clear\n end", "def clear\n @cache.clear\n end", "def clear_cache!\n # this should be overridden by concrete adapters\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 @metadata = {}\n clear_cache\n end", "def flush_memos\n CACHE.clear\n end", "def memcache_flush\n ukcd_memcache_key = self.singleton_class.get_by_ued_memcache_key_object.key_template % {\n user_extended_detail_id: self.user_extended_detail_id,\n shard_identifier: self.singleton_class.shard_identifier\n }\n Memcache.delete(ukcd_memcache_key)\n end", "def cache_clear\n @store.delete\n end", "def clear_cache; end", "def memcache_flush\n memcache_key = self.singleton_class.get_memcache_key_object.key_template % {\n shard_identifier: self.singleton_class.shard_identifier,\n user_kyc_detail_id: self.user_kyc_detail_id,\n user_extended_detail_id: self.user_extended_detail_id\n }\n Memcache.delete(memcache_key)\n end", "def erase_old_data()\n Djinn.log_run(\"rm -rf /tmp/h*\")\n Djinn.log_run(\"rm -f ~/.appscale_cookies\")\n Djinn.log_run(\"rm -f #{APPSCALE_HOME}/.appscale/status-*\")\n Djinn.log_run(\"rm -f #{APPSCALE_HOME}/.appscale/database_info\")\n\n Nginx.clear_sites_enabled\n HAProxy.clear_sites_enabled\n Djinn.log_run(\"echo '' > /root/.ssh/known_hosts\") # empty it out but leave the file there\n CronHelper.clear_crontab\n end", "def clear\n @cache = {}\n end", "def invalidate_all!\n FileUtils.rm_r(@cache_path, force: true, secure: true)\n end", "def clear_all(key)\n _mutex.synchronize do\n _store[key] = {}\n end\n end", "def clear\n # TODO: this is rather brutal, in future need to be able to revert\n Rails.logger.info(\"Clearing OpenbisMedataStore at #{filestore_path}\")\n # cache.delete_matched(/.*/)\n # need to add an entry to empty cache otherwise the clear failes on unexisting deak\n cache.fetch('fake') { '' } unless File.exist?(cache.cache_path)\n cache.clear\n end", "def remove_all\n synchronized { @hash = {} }\n end", "def clear_cache\n @cache = {}\n end", "def clear_cache!\n @cache = {}\n end", "def clear_cache!\n @cache = {}\n end", "def clear_cache() @cache = {}; end", "def clear\n @data = {}\n @next_keys = {}\n end", "def clear\n\n set_id_to_cache_key_map\n\n @id_to_cache_key_map.each do |_, keys|\n Memcache.delete(keys[:kit])\n Memcache.delete_from_all_instances(keys[:saas])\n end\n\n nil\n\n end", "def clear\n\t\t@data.clear\n\t\t@modified = true\n\tend", "def clear\n\t\t@data_base = {}\n\t\tupdate_database\n\tend", "def memcache_flush\n memcache_key = self.singleton_class.get_memcache_key_object.key_template % {\n shard_identifier: self.singleton_class.shard_identifier,\n aml_search_uuid: aml_search_uuid\n }\n Memcache.delete(memcache_key)\n end", "def clear\n @redis.flushdb\n end", "def clear\n @data = nil\n end", "def clear\n @cache.clear\n entries.clear\n self\n end", "def clear(options = nil)\n rescue_error_with(nil) { @data.with { |c| c.flush_all } }\n end", "def clear(options = nil)\n @client.flush_all\n rescue Spymemcached::Error => e\n logger.error(\"Spymemcached::Error (#{e}): #{e.message}\") if logger\n nil\n end", "def clear\n @server.clear_data\n end", "def clean!\n @data = freezer(@data.merge(@dirty))\n @dirty.clear\n self\n end", "def memcache_flush\n client_pepo_campaign_details_memcache_key = ClientPepoCampaignDetail.get_memcache_key_object.key_template % {client_id: self.client_id}\n Memcache.delete(client_pepo_campaign_details_memcache_key)\n end", "def clear\n\n set_id_to_cache_key_map\n\n cache_response = fetch\n @id_to_cache_key_map.each do |id, key|\n Memcache.delete(key)\n Memcache.delete(\"ca_sa_shared_de_sa_cs_#{cache_response[id][:api_key]}\")\n end\n\n nil\n\n end", "def clear_cache\n @results = nil\n @result_ids = nil\n @num_results = nil\n @letters = nil\n end", "def flush\n Dir[ File.join( store, '*.cache' ) ].each do |file|\n File.delete(file)\n end\n end", "def disconnect_all\n @cache.values.map(&:clear_all_connections!)\n end", "def clear\n instrument(:clear, nil, nil) do\n failsafe(:clear) do\n with(&:flushdb)\n end\n end\n end", "def clear_cached\n Rails.cache.delete(self.cache_key, opts_for_cache)\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_training_data\n keys = @redis.keys(base_key.join(':') + '*')\n\n keys.each do |key|\n @redis.del key\n end\n end", "def clean\n puts \"== removing all data from redis ==\"\n submission_keys = redis.lrange(SUBMISSIONS_KEY, 0, -1)\n redis.del(submission_keys) unless submission_keys.empty?\n redis.del(SUBMISSIONS_KEY)\n end", "def clear_cache\n\t\tprint \"Clearing cache...\"\n\t\turl = get_url(\"clear\", @uid, @password, @sid)\n\t\trun_1010(url, \"\") { puts \"done\" }\n\tend", "def clear_in_database_caches!\n self.cached_attachment_text_clipped = nil\n self.cached_main_body_text = nil\n self.save!\n end", "def flush!\n @_cache = {}\n end", "def clear\n @mutex.synchronize do\n @tuples.clear\n @objects.clear\n @catdata.clear\n end\n self\n end", "def clear_buffer_cache!\n @buffers = nil\n end", "def clear\n lib.tcidbvanish( @db )\n end", "def clear() end", "def clear() end", "def clear!\n BULK_APIS.keys\n .each { |key| redis.del(redis_key(key)) }\n end", "def delete_all\n super\n Rails.cache.delete_matched(/#{self.configure.cache.namespace}/)\n end", "def memcache_flush\n client_memcache_key = ClientKycPassSetting.get_memcache_key_object.key_template % {client_id: self.client_id}\n Memcache.delete(client_memcache_key)\n end", "def clear_garbage\n self.tmp_garbage.each do |relation, record|\n if record.is_a? Array\n record.each { |r| r.destroy }\n else\n record.destroy\n end\n end if self.tmp_garbage.present?\n self.tmp_garbage = {}\n end", "def clear_cache\n Rails.cache.delete(self.class.cache_key(self.key))\n end", "def clear\n FileUtils.rm_f(cache_file)\n initialize!\n end", "def delete_all\n store.delete(KEY)\n self\n end", "def clear_data \n @data = []\n end", "def drop_buffered_data\n @stats_engine.reset!\n @error_collector.drop_buffered_data\n @transaction_sampler.reset!\n @transaction_event_recorder.drop_buffered_data\n @custom_event_aggregator.reset!\n @span_event_aggregator.reset!\n @log_event_aggregator.reset!\n @sql_sampler.reset!\n\n if Agent.config[:clear_transaction_state_after_fork]\n Tracer.clear_state\n end\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 reset\r\n @cache.reset\r\n end", "def clear_data!\n @data = ''\n end", "def clear\n store.clear\n end", "def clear\n @cache.clear\n self\n end", "def clear\n @redis.delete_matched(\"#{@key}:*\")\n end", "def clear!\n Goalkeeper.redis.del(key)\n end", "def clear!\n @documents = {}\n @attributes = {}\n @lookup_map = nil\n @all_loaded = false\n @all = []\n end", "def clear_all!\n ::Instana.processor.clear!\n ::Instana.tracer.clear!\n $redis.flushall if $redis\n nil\nend", "def memcache_flush\n customer_memcache_key = Customer.get_memcache_key_object.key_template % {id: self.id}\n Memcache.delete(customer_memcache_key)\n end", "def purge!\n\n fetch_all({}).each { |hwi| @context.storage.delete(hwi) }\n end", "def clear_caches\n self.log.debug \"Clearing entry and values caches.\"\n\t\t@entry = nil\n\t\t@values.clear\n\tend", "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 clearAPI\n persist = [\"ip\", \"session\", \"cuid\", \"lang\", \"site\", \"currentURI\", \"previousURI\", \"clientToken\", \"recContent\"]\n @request_data.keep_if {|key,value| persist.include? key} \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 purge!\n @map = {}\n end", "def delete_all\n self.store.delete_keys(find_keys)\n end", "def reset!\n @cache = nil\n end", "def clear_cache\n $redis.del self.id\n end", "def clear_cache\n $redis.del self.id\n end", "def clear; end" ]
[ "0.7689602", "0.75279087", "0.746647", "0.74202067", "0.732359", "0.732359", "0.72238535", "0.72179556", "0.7085443", "0.7084503", "0.7064522", "0.7056828", "0.7037176", "0.6992707", "0.6986727", "0.6979858", "0.69779724", "0.69779724", "0.6965602", "0.6954527", "0.69540924", "0.6928167", "0.69082254", "0.6900248", "0.68973404", "0.6889219", "0.6863938", "0.68611175", "0.68434066", "0.6815856", "0.67925704", "0.6786935", "0.6784549", "0.6779961", "0.6760726", "0.6759779", "0.6754414", "0.674283", "0.674283", "0.6738202", "0.67266357", "0.6717656", "0.6708505", "0.66923517", "0.6679083", "0.66581815", "0.665696", "0.66560656", "0.6642842", "0.6640176", "0.66359484", "0.66078186", "0.6598483", "0.65959036", "0.65911824", "0.6571315", "0.655828", "0.6558098", "0.65348923", "0.6531441", "0.6525952", "0.6525784", "0.65205723", "0.65177953", "0.65136147", "0.65078247", "0.65045106", "0.65039456", "0.65019506", "0.65019506", "0.6488287", "0.64870983", "0.6480505", "0.6471299", "0.64687395", "0.6459561", "0.6423575", "0.64187264", "0.6415996", "0.641519", "0.64085495", "0.6407741", "0.6405138", "0.6401214", "0.63829434", "0.6379414", "0.63785994", "0.63690114", "0.6366903", "0.63624483", "0.6360388", "0.63522506", "0.6341494", "0.6328014", "0.6327265", "0.6322846", "0.6315447", "0.6311704", "0.6311704", "0.6309396" ]
0.7071637
10
NOTE: We have no way of knowing whether the value really is nil, we assume you wouldn't cache nil and return the default instead.
def cache_fetch(key, default = nil) value = @store[key] value.nil? ? default : value rescue ::MemCache::MemCacheError => e Log.error(e) nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def if_nil(val, default)\n if val.nil?\n return default\n end\n return val\n end", "def value_or_default\n self.value || self.default || self.try_alternate\n end", "def value_or_default\n self.value || self.default || self.try_alternate\n end", "def resolve_value value\n value.nil? ? @default : value\n end", "def default\n return nil unless default_value\n default_value.respond_to?(:call) ? default_value.call : default_value.dup\n end", "def default_value_if_blank(value, default)\n # Stolen from: http://api.rubyonrails.org/classes/Object.html#method-i-blank-3F\n empty = value.respond_to?(:empty?) ? !!value.empty? : !value\n if empty\n return default\n else\n return value\n end\n end", "def default_value(value); value; end", "def unwrap(default_value)\n @value || default_value\n end", "def default value = nil\n @default = value if value\n @default\n end", "def default_value\n match = if definition =~ /timestamp|datetime/i\n /default '?(.+[^'])'?/i.match(definition)\n else\n /default '?(\\w+)'?/i.match(definition)\n end\n\n return unless match\n\n match[1].downcase != 'null' ? match[1] : nil\n end", "def default_value\n self[:value] ||= {}\n self[:value][:default_value] ||= ''\n self[:value][:default_value].to_f unless self[:value][:default_value].empty?\n end", "def default\n nil\n end", "def default\n nil\n end", "def default_or_inferred_for(key_name)\n @defaults[key_name] || send(\"default_value_for_#{key_name}\") || \\\n raise(\"No default value for: #{key_name}\")\n end", "def get_default_value\n raise 'get_default_value must be implemented'\n end", "def extract_value_from_default(default)\n case default\n # Quoted types\n when /\\A[\\(B]?'(.*)'.*::\"?([\\w. ]+)\"?(?:\\[\\])?\\z/m\n # The default 'now'::date is CURRENT_DATE\n if $1 == \"now\" && $2 == \"date\"\n nil\n else\n $1.gsub(\"''\", \"'\")\n end\n # Boolean types\n when 'true', 'false'\n default\n # Numeric types\n when /\\A\\(?(-?\\d+(\\.\\d*)?)\\)?(::bigint)?\\z/\n $1\n # Object identifier types\n when /\\A-?\\d+\\z/\n $1\n else\n # Anything else is blank, some user type, or some function\n # and we can't know the value of that, so return nil.\n nil\n end\n end", "def getValue(value)\n return nil if value==nil \n return value\nend", "def value_or_default_for_form(value)\n if value.nil? || value[:value].nil?\n if field_defaults.length == 0\n return \"\"\n else\n return collect_default_values.first\n end\n else\n value[:value]\n end \n end", "def default_value\n return unless default?\n\n node_parts[1]\n end", "def default\n d = opts[ :default ]\n d = type_default if d.nil? && ! allow_null\n d\n end", "def default_value\n self['default']\n end", "def default_value\n return @default_value\n end", "def default_value\n\t\t# This bizarre construct is done in order to not be reliant\n\t\t# on the inherent assignment-order when using Property.new({...})\n\t\t# since that hash can be ordered anywhich way .daniel\n\t\tif value_id\n\t\t\tvalue_object.default_value\n\t\telse\t\t\t\n\t\t\t@default_value\n\t\tend\n\tend", "def or_nil\n get_or_else(nil)\n end", "def default_value\n @value || recommended_value\n end", "def default_value\n @value || recommended_value\n end", "def default_value\n @default_value ||= (value_hash[{}] ||= Value.new(self, labels: labels))\n end", "def fallback_to_default(localization_key, localization)\n localization_key.localizations.where.not(default_value: nil). \\\n where.not(id: localization.id).first&.default_value\n end", "def default_if_not_specified(opt,default_opt)\n opt ? opt : default_opt\nend", "def default\n entry = enumerations[type]\n entry[:default] || entry[:values]&.first\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 [](key)\n result = default(key)\n result ? result.value : nil\n end", "def default\n return @default\n end", "def default_value\n return @default_value if @default_value\n\n superclass.default_value if superclass.respond_to?(:default_value)\n end", "def default\n igetset(:default) { nil }\n end", "def default!\n @value = default\n end", "def value\n value_set? ? @value : default\n end", "def get_with_default(hash, key, default)\n hash.key?(key) ? hash[key] : default\n end", "def default_value(default)\n case default\n # This is a performance optimization for Ruby 1.9.2 in development.\n # If the value is nil, we return nil straight away without checking\n # the regular expressions. If we check each regular expression,\n # Regexp#=== will call NilClass#to_str, which will trigger\n # method_missing (defined by whiny nil in ActiveSupport) which\n # makes this method very very slow.\n when NilClass\n nil\n # Numeric types\n when /\\A\\(?(-?\\d+(\\.\\d*)?\\)?)\\z/\n $1\n # Character types\n when /\\A'(.*)'::(?:character varying|bpchar|text)\\z/m\n $1\n # Character types (8.1 formatting)\n when /\\AE'(.*)'::(?:character varying|bpchar|text)\\z/m\n $1.gsub(/\\\\(\\d\\d\\d)/) { $1.oct.chr }\n # Binary data types\n when /\\A'(.*)'::bytea\\z/m\n $1\n # Date/time types\n when /\\A'(.+)'::(?:time(?:stamp)? with(?:out)? time zone|date)\\z/\n $1\n when /\\A'(.*)'::interval\\z/\n $1\n # Boolean type\n when 'true'\n true\n when 'false'\n false\n # Geometric types\n when /\\A'(.*)'::(?:point|line|lseg|box|\"?path\"?|polygon|circle)\\z/\n $1\n # Network address types\n when /\\A'(.*)'::(?:cidr|inet|macaddr)\\z/\n $1\n # Bit string types\n when /\\AB'(.*)'::\"?bit(?: varying)?\"?\\z/\n $1\n # XML type\n when /\\A'(.*)'::xml\\z/m\n $1\n # Arrays\n when /\\A'(.*)'::\"?\\D+\"?\\[\\]\\z/\n $1\n # Object identifier types\n when /\\A-?\\d+\\z/\n $1\n else\n # Anything else is blank, some user type, or some function\n # and we can't know the value of that, so return nil.\n nil\n end\n end", "def set_default\n (!default || value?) ? self : add_value(default)\n end", "def default\n #----------\n \n # the default field value; retrieve from the options\n default = options[ :default ]\n \n # is there are default value?\n unless default.nil?\n self.value_from( default.respond_to?( :call ) ? default.call : default )\n end\n \n end", "def get(key, default=nil)\n\t\t\tval = self.send(key)\n\t\t\tval || default\n\t\tend", "def default_value \n self[:value] ||= {}\n self[:value][:default_value] ||= []\n self[:value][:default_value].delete('-1')\n self[:value][:default_value]\n end", "def default_value\n default_db_value ? default_db_value.to_s : \"null\"\n end", "def default(default_value)\n lambda do |rec, acc|\n if acc.empty?\n acc << default_value\n end\n end\n end", "def default_value(name)\n @@default_value[name]\n end", "def default_value\n if @default.is_a?(Proc)\n @default.call\n else\n @default\n end\n end", "def lookup_or_default(arg)\n instance = lookup_without_default(arg)\n instance ||= association_class.new(:value => association_class.raw_default(arg))\n instance.value_serialized = property_serialized?(arg)\n instance\n end", "def default_value(relvar, tuple)\n case d = options[:default]\n when ::Rubyrel::Defaults::DefaultHandler\n d.compute_value(relvar, self, tuple)\n else\n d\n end\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 default(key) end", "def cache_fetch(key, default = nil)\n value = @client.get(key)\n value.nil? ? default : ::Marshal.load(value)\n end", "def get_value(*given)\n given.size == 1 ? given.first : @default_value\n end", "def cache_value?; end", "def default=(_); end", "def default\n @default\n end", "def default?\n @default\n end", "def dynamic_value(val, type = nil)\n FieldDefaults.calculate_default(current_instance, val, type, allow_nil: true)\n end", "def get!(key, default=nil, &block)\n value = get key, default, &block\n raise \"Nil value found for option: #{key}, #{default}\" if value.nil?\n return value\n end", "def lookup_or_default(arg)\n instance = detect { |property| property.name.to_sym == arg.to_sym }\n instance ||= new(:value => default(arg))\n end", "def default_value(obj, options)\n field_value = options[name]\n if field_value.nil?\n if default?\n default_value = default\n elsif block?\n default_value = block[obj]\n end\n else\n field_value\n end\n end", "def cache_default_values?\n @cache_default_values\n end", "def extract_value_from_default(default)\n super ||\n extract_escaped_string_from_default(default) ||\n extract_time_from_default(default) ||\n extract_empty_array_from_default(default) ||\n extract_decimal_from_default(default)\n end", "def fetch_or_default(key, &block)\n @hash[key] = @hash.fetch(key, &block)\n end", "def value\n @value || default_value\n end", "def default\n @default ||= highest\n end", "def option_or_default(key, default)\n options? ? options.fetch(key, default) : default\n end", "def default_when_null(sql, default)\n \"COALESCE (#{sql}, #{dispatch(default)})\"\n end", "def default_value\n { 'value' => '', 'other' => '' }\n end", "def cached_lookup(key, default, &block)\n if cache_has_key(key)\n retval = cached_value(key)\n else\n retval = yield key, default\n cache(key, retval)\n end\n retval\nend", "def optional?\n @default || (@default.nil? && @optional)\n end", "def default(id = T.unsafe(nil)); end", "def get_cache(var, default = nil)\n stored = Rails.cache.read(var)\n stored == nil ? default : stored\nend", "def default\n if @default_block.nil?\n return nil\n end\n\n return @default_block.call\n end", "def default=(value); end", "def default(key = nil) \n if key.is_a?(Symbol) && key?(key) \n self[key] \n else \n key ? super : super()\n end \n end", "def default(value)\n @default = value\n @is_default_set = true\n class << self\n define_method :default do |*args|\n raise ArgumentError, \"default has already been set to #{@default.inspect}\" unless args.empty?\n\n alternative(@default)\n end\n end\n nil\n end", "def value_or(_val = nil)\n @value\n end", "def get(key, default=nil)\n find = KeyValue.find_by_key(key)\n find ? find.value : default\n end", "def compute_default(value)\n @which == :block ? @default_value.call(value) : @default_value\n end", "def default?\n @default\n end", "def default_value\n # generally, elements contain string (except containers)\n ''\n end", "def default?; return !explicit?; end", "def default\n find_by(default: 1)\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 get_setting(key, default)\r\n setting = Setting.where(key: key).first\r\n setting && !setting.value.blank? ? setting.value : default\r\n end", "def default_value(val); @@next_default_value = val; end", "def evaluate_default_value(val)\n if val.respond_to?(:call)\n val.call\n elsif val.duplicable?\n val.dup\n else\n val\n end\n end", "def evaluate_default_value(val)\n if val.respond_to?(:call)\n val.call\n elsif val.duplicable?\n val.dup\n else\n val\n end\n end", "def param_or_default(key)\n return params[key] unless params[key].nil?\n if (alt_key = alternative_key(key)) && params[alt_key]\n return params[alt_key]\n end\n\n user_params_model[key].default_value\n end", "def maybe_get_noncomplex_default_value(to_dtype) #:nodoc:\n default_value = 0\n unless self.stype == :dense then\n if self.dtype.to_s.start_with?('complex') and not to_dtype.to_s.start_with?('complex') then\n default_value = self.default_value.real\n else\n default_value = self.default_value\n end\n end\n default_value\n end", "def default\n self['default']\n end", "def default(value)\n Defaulting.new default: value\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 default_value(val); @next_default_value = val; end", "def default_value(val); @next_default_value = val; end", "def default_value\n if @default_value\n @default_value\n elsif @multiple\n []\n end\n end", "def set_nil_default( var_name, var_value )\n if self.has_attribute?( var_name ) && ( read_attribute( var_name ).nil? )\n write_attribute( var_name, var_value )\n end\n end", "def default_value\n config[:default]\n end" ]
[ "0.78828216", "0.73851043", "0.73851043", "0.7090408", "0.69637555", "0.6917361", "0.68385935", "0.6817701", "0.67880493", "0.6736963", "0.65498435", "0.65226907", "0.65226907", "0.65073395", "0.6489343", "0.6478569", "0.64534724", "0.6426565", "0.6407903", "0.6380114", "0.63747114", "0.6358064", "0.6315501", "0.6296791", "0.6282451", "0.6282451", "0.6259539", "0.6244605", "0.6199402", "0.6193999", "0.6189333", "0.6171355", "0.6168142", "0.61453867", "0.6140197", "0.61346054", "0.61330897", "0.6131574", "0.6122984", "0.6122371", "0.6118814", "0.6102927", "0.6077083", "0.60626733", "0.60611147", "0.6043598", "0.6017899", "0.60142815", "0.59922475", "0.5989214", "0.5985707", "0.59836894", "0.5979784", "0.5975631", "0.5967381", "0.5939755", "0.59370893", "0.5910506", "0.59093446", "0.5909307", "0.5906841", "0.58965194", "0.588969", "0.5883938", "0.5872631", "0.5866207", "0.5865028", "0.5864487", "0.58638644", "0.58541036", "0.5850031", "0.58498734", "0.5841419", "0.58399516", "0.58380735", "0.5835706", "0.5820259", "0.58192307", "0.58165395", "0.58150864", "0.5814863", "0.5804248", "0.5796757", "0.57955986", "0.57926965", "0.57851565", "0.57808596", "0.5779898", "0.5779898", "0.5777205", "0.5767086", "0.57663596", "0.57652277", "0.57591903", "0.57591903", "0.5756468", "0.5756468", "0.57533985", "0.5751765", "0.5719474" ]
0.6494071
14
switch to different namespace
def namespace=(ns) @namespace = @store.namespace = ns; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def namespace=(ns); end", "def namespace=(ns); end", "def namespace; end", "def namespace; end", "def namespace; end", "def namespace; end", "def namespace; end", "def namespace; end", "def namespace; end", "def namespace; end", "def set_namespace\n @namespace = Namespace.find(params[:namespace_id])\n end", "def set_namespace(namespace)\n return unless namespace\n\n @namespace = namespace\n @ext.set_namespace(namespace)\n end", "def change_space(namespace)\n update!(name: namespace)\n end", "def set_namespace\n @namespace = Namespace.find(params[:id])\n end", "def set_namespace\n @namespace = Namespace.find(params[:id])\n end", "def swap_namespace(url, namespace = nil)\n url.gsub(/\\:([\\w-]+)\\//, \":#{namespace || client.user.username}/\")\n end", "def namespaces; end", "def namespaces; end", "def namespaces; end", "def namespaces; end", "def set_namespace(namespace)\n return if !active? ||\n Appsignal::Transaction.current.nil? ||\n namespace.nil?\n Appsignal::Transaction.current.set_namespace(namespace)\n end", "def namespace=(obj); end", "def set_namespace(ns = '')\n settings['namespace'] = ns\n end", "def namespace=(v); end", "def isolate_namespace(mod); end", "def isolate_namespace(mod); end", "def namespace(namespace = nil)\n @namespace = namespace if namespace\n @namespace\n end", "def namespace\n @namespace ||= 'silver_spoon'\n end", "def find_or_new_namespace(name, uri)\n namespace = @namespaces.find { |n| n.namespace == name } || (@namespaces << Restfulie::Common::Builder::Rules::Namespace.new(name, uri)).last\n namespace.uri = uri unless uri.nil?\n namespace\n end", "def fix_namespace api, namespace\n namespace.split(\"::\").map { |node| api.fix_namespace node }.join(\"::\")\n end", "def namespace(namespace = nil)\n @namespace = namespace if namespace\n @namespace if defined? @namespace\n end", "def namespace(namespace = nil, options = {})\n return @namespace unless namespace\n\n @namespace = namespace.to_sym if namespace\n @base_namespace = options[:base].to_sym if options[:base]\n end", "def test_namespace\n N::Namespace.shortcut(:test_namespace, \"http://test_namespace/\")\n assert_equal(:test_namespace, N::URI.new(\"http://test_namespace/\").namespace)\n assert_equal(:test_namespace, N::URI.new(\"http://test_namespace/else\").namespace)\n assert_equal(nil, N::URI.new(\"http://test_namespace/else/other\").namespace)\n end", "def namespace(ns)\n if ns == :interpreter\n self\n else\n @storage[ns]\n end\n end", "def register_namespace(name_and_href)\n (@default_namespaces ||= []) <<name_and_href\n end", "def register_namespace(name_and_href)\n (@default_namespaces ||= []) <<name_and_href\n end", "def namespace\n @namestack.join(\"::\")\n end", "def default_namespace(url)\n @namespaces[''] = url\n end", "def namespace(name)\n @node = @parser.namespaces(name)\n end", "def namespace=( namespace )\n\t\t@namespace = namespace.nil? ? nil : namespace.to_sym\n\tend", "def namespace(ns)\n new_name = namespace_value(ns, @name)\n new_transitions = Hash[@transitions.map do |(event, target)|\n [event, namespace_value(ns, target)]\n end]\n\n new_type = @type\n if new_type == :final\n new_event_cb = ->(_) { Puppet::StateMachine::FINAL_EVENT }\n new_type = nil\n else\n new_event_cb = @event_cb\n end\n Puppet::StateMachine::State.new(new_name, @action_cb, new_event_cb, new_type, new_transitions)\n end", "def default_namespace=(url); end", "def default_namespace=(url); end", "def get_namespace(node, prefix); end", "def namespace=(value)\n @namespace = value\n end", "def namespace=(value)\n @namespace = value\n end", "def namespace\n @namespace\n end", "def current_namespace\n @current_namespace\n end", "def namespace\n NAMESPACE\n end", "def namespace\n self.class.new split(NAMESPACE_SEPARATOR).first\n end", "def namespace(path, options = T.unsafe(nil)); end", "def namespace(name = nil, url = nil)\n @namespaces[name.to_s] = url\n end", "def namespace\n @intf_namespace ||= self.class.name.split('::').last.downcase\n end", "def namespace(name, &block)\n @namespace = clean_path(name)\n yield self\n end", "def namespace\n @namespace || self.class.namespace\n end", "def ns(ns)\n self.namespace = ns\n self\n end", "def namespace_inheritance=(_arg0); end", "def namespace_inheritance=(_arg0); end", "def namespace(value = nil)\n if value\n @namespace = value\n else\n @namespace\n end\n end", "def register_namespaces(namespaces); end", "def register_namespaces(namespaces); end", "def namespace(new_namespace=nil,name=nil,&block)\n raise ArgumentError, \"Scope must be a string, a symbol, or a hash with string values.\" if !new_namespace.nil? && !(new_namespace.is_a?(String) || new_namespace.is_a?(Symbol) || new_namespace.is_a?(Hash))\n @namespace ||= '/'\n if new_namespace.is_a?(Hash)\n new_namespace.each do |name,new_namespace|\n block_given? ? namespace(new_namespace,name) { block.call } : namespace(new_namespace,name)\n end\n else\n # Here we have just one namespace and *possibly* a name to save for the first route registered with this namespace.\n # Sanitize new namespace to NOT end with a slash OR begin with a slash.\n @next_route_name = new_namespace if new_namespace.is_a?(Symbol)\n new_namespace = new_namespace.to_s.gsub(/(^\\/|\\/$)/,'') if new_namespace\n @next_route_name = name if name\n # Join namespace to previous namespace by a slash.\n if block_given?\n old_namespace = @namespace\n @namespace = @namespace.gsub(/\\/$/,'')+'/'+new_namespace\n yield\n @namespace = old_namespace\n else\n if new_namespace.nil?\n @namespace\n else\n @namespace = @namespace.gsub(/\\/$/,'')+'/'+new_namespace\n end\n end\n end\n end", "def add_namespace(namespace) \n @namespaces[namespace.name] = namespace\n end", "def set_tab(name, namespace = nil)\n tab_stack[namespace || :default] = name\n end", "def namespace(name = nil)\n if name\n super\n else\n @namespace ||= super.chomp(\"_command\").sub(/:command:/, \":\")\n end\n end", "def session_namespace( new_namespace=nil )\n\t\t\t@session_namespace = new_namespace if new_namespace\n\t\t\t@session_namespace ||= self.default_appid\n\t\t\treturn @session_namespace\n\t\tend", "def namespace name\n declare_namespace(resource, name.intern)\n end", "def namespace(prefix = T.unsafe(nil)); end", "def namespace\n @namespace.ns\n end", "def namespace_name\n @namespace_name ||= namespaces.join('::')\n end", "def find_namespace(name = '')\n @namespaces[name]\n end", "def namespace=(value)\n self.namespaces = [value]\n end", "def namespace(n)\n only :job\n str! :namespace, n\n end", "def namespace\n nil\n end", "def session_namespace=( namespace )\n\t\tself.log.debug \"Setting session namespace to %p\" % [ namespace ]\n\t\t@session_namespace = namespace\n\n\t\t# If the session has already been created, switch its current namespace\n\t\t@session.namespace = namespace if @session\n\tend", "def namespace\n return NAMESPACE\n end", "def namespace_declarations(ctx); end", "def namespace_declarations(ctx); end", "def namespace(name)\n @node = @parser.namespaces.find(:all, :name => name)\n end", "def initialize(namespace)\n self.namespace = namespace\n end", "def namespace(name, href)\n @resource.add_namespace(name, href)\n end", "def register_default_namespace(name)\n self.namespace.each do |n|\n if n.to_s == nil\n register_namespace(\"#{name}:#{n.href}\")\n return\n end\n end\n raise \"No default namespace found\"\n end", "def set_soap_namespace\n \n # @client.wsdl.namespaces[\"xmlns:ns2\"] = \"http://www.ups.com/XMLSchema/XOLTWS/Pickup/v1.1\"\n # @client.wsdl.namespaces[\"xmlns:ns3\"] = \"http://www.ups.com/XMLSchema/XOLTWS/UPSS/v1.0\"\n end", "def set_api_namespace\n @api_namespace = ApiNamespace.friendly.find(params[:id])\n end", "def namespace(name)\n @namespaces.push Namespace.new(name, @namespaces.last)\n yield\n @namespaces.pop\n end", "def set_default_namespace(value = nil, &block)\n define_attr_method :default_namespace, value, &block\n end", "def namespace\n nil\n end", "def from_namespace(namespace, &block)\n original_namespace = Resque.redis.namespace\n Resque.redis.namespace = namespace\n\n yield if block_given?\nensure\n Resque.redis.namespace = original_namespace\nend", "def fix_namespaces(doc)\n if is_jruby?\n # Only needed in jruby, nokogiri's jruby implementation isn't weird\n # around namespaces in exactly the same way as MRI. We need to keep\n # track of the namespaces in outer contexts ourselves, and then see\n # if they are needed ourselves. :(\n namespaces = namespaces_stack.compact.reduce({}, :merge)\n default_ns = namespaces.delete(\"xmlns\")\n\n namespaces.each_pair do |attrib, uri|\n ns_prefix = attrib.sub(/\\Axmlns:/, '')\n\n # gotta make sure it's actually used in the doc to not add it\n # unecessarily. GAH.\n if doc.xpath(\"//*[starts-with(name(), '#{ns_prefix}:')][1]\").empty? &&\n doc.xpath(\"//@*[starts-with(name(), '#{ns_prefix}:')][1]\").empty?\n next\n end\n doc.root.add_namespace_definition(ns_prefix, uri)\n end\n\n if default_ns\n doc.root.default_namespace = default_ns\n # OMG nokogiri, really?\n default_ns = doc.root.namespace\n doc.xpath(\"//*[namespace-uri()='']\").each do |node|\n node.namespace = default_ns\n end\n end\n\n end\n return doc\n end", "def set_hcao_namespace\n @hcao_namespace = HcaoNamespace.find(params[:id])\n end", "def namespace\n Matsuri::Platform.send(Matsuri::Config.environment).namespace || 'default'\n end", "def namespace\n @namespace ||= self.class.to_s.split('::').first.gsub('_', '').sub('Application', '')\n end", "def namespace=(namespace)\n @connection = nil\n if namespace.nil?\n @namespace = nil\n else\n @namespace = namespace\n end\n end", "def node_namespace name:\n label = make_label name\n attrs = { name: name }\n\n add_node :Namespace, label, attrs\n end", "def namespace_module\n klass.name.to_s.split('::')[0..-4].join('::').constantize\n end", "def namespace_inheritance; end", "def namespace_inheritance; end", "def normalize(namespace)\n namespace.to_s.sub(/^[\\/:\\s]*/, '').sub(/[\\/:\\s]*$/, '').gsub(/[\\/\\\\:]+/, '::')\n end", "def namespace\n @namespace ||= [request.args.namespace_name, request.args.application_name].compact.join('-')\n end", "def register_default_namespace(name)\n self.namespaces.each do |n|\n if n.prefix == nil\n register_namespace(\"#{name}:#{n.href}\")\n return\n end\n end\n raise \"No default namespace found\"\n end" ]
[ "0.71983963", "0.71983963", "0.6885492", "0.6885492", "0.6885492", "0.6885492", "0.6885492", "0.6885492", "0.6885492", "0.6885492", "0.6877264", "0.68771654", "0.67248905", "0.6709705", "0.6709705", "0.6581664", "0.6539663", "0.6539663", "0.6539663", "0.6539663", "0.6514985", "0.64544713", "0.63994086", "0.6311577", "0.6309774", "0.6309774", "0.63050896", "0.62618136", "0.6236022", "0.6214064", "0.61992264", "0.6152283", "0.61433387", "0.6118189", "0.6083638", "0.6083638", "0.6078759", "0.6068697", "0.60621107", "0.60559314", "0.6037337", "0.6032645", "0.6032645", "0.60145557", "0.59813815", "0.59813815", "0.5940651", "0.59278893", "0.59142363", "0.5910734", "0.5908219", "0.5898057", "0.5897232", "0.58971405", "0.5894663", "0.5891457", "0.58911633", "0.58911633", "0.58891857", "0.58859634", "0.58859634", "0.58732104", "0.5867427", "0.5851327", "0.582301", "0.5794385", "0.5786456", "0.57743734", "0.577436", "0.57363033", "0.5735338", "0.57232577", "0.5709061", "0.5672251", "0.56717217", "0.5669392", "0.5660224", "0.5660224", "0.5655168", "0.56545156", "0.56469613", "0.56456655", "0.5645598", "0.5635764", "0.56316805", "0.5625537", "0.56248164", "0.5610187", "0.56085867", "0.56085134", "0.55824417", "0.55815774", "0.55772036", "0.5557923", "0.5556463", "0.555232", "0.555232", "0.5545077", "0.55417293", "0.5541304" ]
0.64632154
21
state of compression (true/false)
def compression; @store.compression; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compressed?\n @compressed == true\n end", "def compression?; end", "def compressed?\n false\n end", "def compression=(bool); @store.compression = bool; end", "def compression_was_achieved\n return compression_ratio() < 1\n end", "def compression; end", "def is_compressed?\n bit_set?(COMPRESSED_FLAG_BIT)\n end", "def compression\n unless defined?(@compression)\n @compression = :bzip2\n reset_computed_values\n end\n @compression\n end", "def compression\n @j_del.getTryUseCompression\n end", "def compression\n @j_del.isCompressionSupported\n end", "def compression_method; end", "def testing_compression?\n compression_enabled? && op_msg_enabled?\nend", "def compression_level; end", "def cannot_compress?\n !can_compress?\n end", "def tar_compression_flag\n case compression\n when :bzip2, \"bzip2\", nil\n \"j\"\n when :gzip, \"gzip\"\n \"z\"\n when :none, \"none\"\n \"\"\n end\n end", "def compress!; end", "def compress?(what)\n !!asset_config[\"compress\"][what]\n end", "def compressor; end", "def default_compression; end", "def test_compressed_instance\r\n assert_respond_to(@fh, :compressed=)\r\n assert_nothing_raised{ @fh.compressed = true }\r\n assert(File.compressed?(@file))\r\n assert_nothing_raised{ @fh.compressed = false }\r\n assert_equal(false, File.compressed?(@file))\r\n end", "def archive_ok?\n #todo, we lack any real heuristic for this.\n true\n end", "def compression\n configuration[:copy_compression] || :gzip\n end", "def compression_enabled?\n !SpecConfig.instance.compressors.nil?\nend", "def compression\n instance.options[:compression]\n end", "def compression\n instance.options[:compression]\n end", "def encode_stage?\n\t\ttrue\n\tend", "def compression_server; end", "def compressed_value?(v)\n v.to_s.start_with?(COMPRESSION_MARKER)\n end", "def compress!\n self.compressed = compressed? || !!compress_tree!\n self\n end", "def default_compression=(_arg0); end", "def is_compressed_file?\n ['rar', 'zip', 'zipx', 'tar', 'bzip', 'bzip2', 'bz2', 'gz', 'tgz', '7z', 's7z'].include? self.image_file_name.split('.').last\n end", "def compression_method=(_arg0); end", "def compression_codec\n cluster.config.compression_codec if compressed?\n end", "def action_compress\n end", "def binary?\n @binary\n end", "def gzip_enabled; end", "def gzip_enabled; end", "def binary?\n false\n end", "def compressed_size; end", "def compressed_size; end", "def compression\n @gapi.compression\n end", "def check_compression\n abort \"Invalid compression type: #{options['compress']}\" unless Compressor.compression_types.include? options['compress'].to_sym\n end", "def finished?\n\t\t\t@size == @transient_count\n\t\tend", "def compress_value?(value, req_options)\n return false unless value.bytesize >= compression_min_size\n return compress_by_default? unless req_options && !req_options[:compress].nil?\n\n req_options[:compress]\n end", "def finalized?\n self.state != STATE_NEW\n end", "def isZippedOutput()\n @fields.fetch('image_mode', '') == 'separate' || @fields.fetch('css_mode', '') == 'separate' || @fields.fetch('font_mode', '') == 'separate' || @fields.fetch('force_zip', false) == true\n end", "def binary?\n @binary\n end", "def unzip?\n self.unzip ||= false\n end", "def can_compress?\n # The \"charset\" of a mime type is present if the value is\n # encoded text. We can check this value to see if the asset\n # can be compressed.\n #\n # We also check against our list of non-text compressible mime types\n @charset || COMPRESSABLE_MIME_TYPES.include?(@content_type)\n end", "def archived?\n archived == true\n end", "def compress\n Zlib::Deflate.deflate(marshal)\n end", "def binary?\n @format == 1\n end", "def compression_client; end", "def finished_compressing\n %Q{Compressing done ...}\n end", "def accept_gzip?\n return if @ext__veto_gzip\n @ext__recv_gzip\n end", "def packed?\n @packed\n end", "def compression= new_compression\n frozen_check!\n @gapi.compression = new_compression\n end", "def backup?\n @backup || false\n end", "def gzip_enabled=(_arg0); end", "def binary?\n flag? Flags::ARBITRARY_BYTES\n end", "def decompressor; end", "def write_state; end", "def write_state; end", "def finished?\n @state == :finished\n end", "def compress(data); end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def compression_mode\n mediainfo.audio.compression_mode\n end", "def archival?\n false\n end", "def archival?\n false\n end", "def compressed(v); @options[:compressed] = v;end", "def compression\n type = configuration[:copy_compression] || :gzip\n case type\n when :gzip, :gz then Compression.new(\"tar.gz\", %w(tar czf), %w(tar xzf))\n when :bzip2, :bz2 then Compression.new(\"tar.bz2\", %w(tar cjf), %w(tar xjf))\n when :zip then Compression.new(\"zip\", %w(zip -qr), %w(unzip -q))\n else raise ArgumentError, \"invalid compression type #{type.inspect}\"\n end\n end", "def compress(file)\n if File.file?(file) # file file file file\n content = File.read(file)\n zipped = Zlib::Deflate.deflate(content)\n puts \"Compressed '#{File.basename(file)}' : #{content.size - zipped.size} bytes smaller than original\"\n return zipped\n else\n return false\n end\n end", "def binary? # :nodoc:\n false\n end", "def start_compressing\n %Q{Start compressing of dump ... }\n end", "def complete?\n @bytes == [[0, @length - 1, true]]\n end", "def archived?\n (status == ARCHIVED)\n end", "def is_archive?\n @is_archive\n end", "def compressed?\n cluster.config.compressed_topics.include?(name)\n end", "def succeeded?\n finished? && !discarded?\n end", "def get_compression()\n return(get_cmd('CP;',0.1,0.5,3).gsub(/^CP/,'').gsub(/;$/,'').to_i)\nend", "def backup?\n @backup.nil? ? false : @backup\n end", "def finished?\n @buffer.size == @size\n end", "def can_transcode? \n [STATUS_NOTENCODED, STATUS_ENCODING_FAILED].include?(status) and subdir_is_writable?\n end", "def set_compression(compression)\n puts \"Setting compression to #{compression}\" if $verbose\n c='CP'+(('000'+compression.to_s)[-3..-1])+';'\n puts c if $verbose\n ret=send_cmd(c,'CP;',c,0.5,1.5,3)\n if(ret)\n return(ret.gsub(/^CP/,'').gsub(/;$/,'').to_i)\n else\n return(nil)\n end\nend", "def encoded?\n self.status == 'Convertido' ? true : false\n end", "def valid_gzip? archive\n return unless archive\n return unless File.exist? archive\n `tar tf #{archive} >/dev/null`\n $?.exitstatus == 0\nend", "def gzip?\n path.extname == '.gz'\n end", "def should_deflate?(env, status, headers, body)\n return false if Utils::STATUS_WITH_NO_ENTITY_BODY.include?(status.to_i) ||\n headers['Cache-Control']&.include?('no-transform') ||\n headers['Content-Encoding']&.include?('identity')\n\n return false if @compressible_types&.include?(headers['Content-Type']&.split(';')&.first) == false\n return false if @condition&.call(env, status, headers, body) == false\n\n true\n end", "def ready_optimizing?\n state == :READY_OPTIMIZING\n end", "def tar_compression_flag(path)\n case path\n when /\\.tar\\.bz2$/\n return \"-j\"\n when /\\.tar\\.gz$|\\.tgz$/\n return \"-z\"\n when /\\.tar\\.xz$/\n return \"-J\"\n else\n return nil\n end\n end", "def might_have_data?\n @state.to_s =~ /finished|aborted|running/\n end", "def binary?\n @kind == :binary\n end", "def final?\n @finals.include? @state\n end" ]
[ "0.7953848", "0.7773901", "0.77393115", "0.7299576", "0.7200247", "0.7077999", "0.705533", "0.6734818", "0.6716565", "0.66841877", "0.6625517", "0.6564874", "0.65547127", "0.6514972", "0.6502894", "0.6491436", "0.6430902", "0.6422654", "0.63162684", "0.6301061", "0.6260005", "0.6160089", "0.613844", "0.6117912", "0.6117912", "0.61029756", "0.61004883", "0.60670733", "0.5961389", "0.5882174", "0.57916415", "0.57586753", "0.5747585", "0.5747256", "0.5739407", "0.571757", "0.571757", "0.5716337", "0.5704036", "0.5704036", "0.5702949", "0.5680003", "0.5652609", "0.5639514", "0.56208307", "0.5617826", "0.56074375", "0.55998075", "0.5596539", "0.55886954", "0.5578377", "0.55763656", "0.55747557", "0.5571305", "0.5561063", "0.5551054", "0.5545849", "0.554057", "0.5539621", "0.5539047", "0.5538006", "0.5525756", "0.5525756", "0.5505872", "0.54926", "0.5488291", "0.5488291", "0.5488291", "0.5488291", "0.5488291", "0.5488291", "0.5488291", "0.5488291", "0.5471459", "0.5469079", "0.5469079", "0.5464273", "0.5463895", "0.54636675", "0.54634565", "0.5453779", "0.54491913", "0.54481226", "0.5443071", "0.54397684", "0.5427881", "0.54263127", "0.54234403", "0.5416623", "0.54150444", "0.5410712", "0.540041", "0.5398598", "0.5395454", "0.5385882", "0.5372072", "0.5371596", "0.5363359", "0.53597134", "0.53527063" ]
0.68844116
7
turn compression on or off
def compression=(bool); @store.compression = bool; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compression?; end", "def default_compression; end", "def compression; end", "def compression\n configuration[:copy_compression] || :gzip\n end", "def compression_method; end", "def compressed?\n false\n end", "def gzip_enabled; end", "def gzip_enabled; end", "def gzip_enabled=(enabled); end", "def compression\n unless defined?(@compression)\n @compression = :bzip2\n reset_computed_values\n end\n @compression\n end", "def compression_level; end", "def compression\n @j_del.getTryUseCompression\n end", "def default_compression=(_arg0); end", "def compression_enabled?\n !SpecConfig.instance.compressors.nil?\nend", "def compression_server; end", "def gzip_enabled=(_arg0); end", "def set_compression(compression)\n puts \"Setting compression to #{compression}\" if $verbose\n c='CP'+(('000'+compression.to_s)[-3..-1])+';'\n puts c if $verbose\n ret=send_cmd(c,'CP;',c,0.5,1.5,3)\n if(ret)\n return(ret.gsub(/^CP/,'').gsub(/;$/,'').to_i)\n else\n return(nil)\n end\nend", "def SetCompression(compress)\n\t\t#Set page compression\n\t\tif (respond_to?('gzcompress'))\n\t\t\t@compress = compress\n\t\telse\n\t\t\t@compress = false\n\t\tend\n\tend", "def compressor; end", "def compress!; end", "def compression; @store.compression; end", "def compressed?\n @compressed == true\n end", "def compression\n instance.options[:compression]\n end", "def compression\n instance.options[:compression]\n end", "def compression=(supported)\n @j_del.setTryUseCompression(supported)\n end", "def enable_gzip; @opts[:enable_gzip]; end", "def configure_compression(options, env)\n return unless (env[:method] == :get) &&\n !options[:head].key?('accept-encoding')\n\n options[:head]['accept-encoding'] = 'gzip, compressed'\n end", "def compressed(v); @options[:compressed] = v;end", "def compression_client; end", "def compression_codec\n cluster.config.compression_codec if compressed?\n end", "def compression\n @j_del.isCompressionSupported\n end", "def gzip_enabled=enabled\n @agent.gzip_enabled = enabled\n end", "def no_send_gzip!\n if @ext__send_gzip\n @ext__send_gzip = false\n end\n end", "def compression=(supported)\n @j_del.setCompressionSupported(supported)\n end", "def tar_compression_flag\n case compression\n when :bzip2, \"bzip2\", nil\n \"j\"\n when :gzip, \"gzip\"\n \"z\"\n when :none, \"none\"\n \"\"\n end\n end", "def compress?(what)\n !!asset_config[\"compress\"][what]\n end", "def send_gzip!\n if !@ext__send_gzip\n @ext__send_gzip = true\n end\n end", "def compression_was_achieved\n return compression_ratio() < 1\n end", "def decompressor; end", "def deflate!\n self.replace(deflate)\n end", "def testing_compression?\n compression_enabled? && op_msg_enabled?\nend", "def compression= new_compression\n frozen_check!\n @gapi.compression = new_compression\n end", "def compressors\n uri_options[:compressors]\n end", "def maybe_compress(compressor, zlib_compression_level = nil)\n self\n end", "def compression_method=(_arg0); end", "def compress!\n self.compressed = compressed? || !!compress_tree!\n self\n end", "def cannot_compress?\n !can_compress?\n end", "def update!(**args)\n @compression = args[:compression] if args.key?(:compression)\n end", "def gzip_disabled?\n @disable_gzip\n end", "def compression\n @gapi.compression\n end", "def compress!\n compress\n \n File.open(@input_file, 'w') do |file|\n file.puts @compressed_css\n end\n end", "def gzip_enabled\n @agent.gzip_enabled\n end", "def action_compress\n end", "def compression_setup!(machine, options)\n if !options[:compression_type]\n if machine.guest.capability_host_chain.first[0] == :windows\n options[:compression_type] = :zip\n else\n options[:compression_type] = :tgz\n end\n end\n if !VALID_COMPRESS_TYPES.include?(options[:compression_type])\n raise Vagrant::Errors::UploadInvalidCompressionType,\n type: options[:compression_type],\n valid_types: VALID_COMPRESS_TYPES.join(\", \")\n end\n options[:decompression_method] = \"decompress_#{options[:compression_type]}\".to_sym\n if !machine.guest.capability?(options[:decompression_method])\n raise Vagrant::Errors::UploadMissingExtractCapability,\n type: options[:compression_type]\n end\n end", "def compression\n type = configuration[:copy_compression] || :gzip\n case type\n when :gzip, :gz then Compression.new(\"tar.gz\", %w(tar czf), %w(tar xzf))\n when :bzip2, :bz2 then Compression.new(\"tar.bz2\", %w(tar cjf), %w(tar xjf))\n when :zip then Compression.new(\"zip\", %w(zip -qr), %w(unzip -q))\n else raise ArgumentError, \"invalid compression type #{type.inspect}\"\n end\n end", "def check_compression\n abort \"Invalid compression type: #{options['compress']}\" unless Compressor.compression_types.include? options['compress'].to_sym\n end", "def compression_mode\n mediainfo.audio.compression_mode\n end", "def generate_compressed path, img\n img.write(path) { self.quality = 70 }\n end", "def add_compression_type(opts = {})\n @compression_type = opts[:compression_type] || @compression_type\n opts.delete(:compression_type)\n end", "def compress\n return if request.skip_compression?\n return if response.body.length < 2.kilobytes\n accepts = request.env['HTTP_ACCEPT_ENCODING']\n return unless accepts && accepts =~ /(x-gzip|gzip)/\n encoding = $1\n compressed = ActiveSupport::Gzip.compress(response.body)\n if compressed.length < response.body.length\n response.body = compressed\n response.headers['Content-Encoding'] = encoding\n end\n end", "def compress_output(codec, type)\n properties['mapred.output.compress'] = 'true'\n properties['mapred.output.compression.codec'] = case codec\n when :default then Java::OrgApacheHadoopIoCompress::DefaultCodec.java_class.name\n when :gzip then Java::OrgApacheHadoopIoCompress::GzipCodec.java_class.name\n else raise \"Codec #{codec} not yet supported by cascading.jruby\"\n end\n properties['mapred.output.compression.type'] = case type\n when :none then Java::OrgApacheHadoopIo::SequenceFile::CompressionType::NONE.to_s\n when :record then Java::OrgApacheHadoopIo::SequenceFile::CompressionType::RECORD.to_s\n when :block then Java::OrgApacheHadoopIo::SequenceFile::CompressionType::BLOCK.to_s\n else raise \"Compression type '#{type}' not supported\"\n end\n end", "def is_compressed?\n bit_set?(COMPRESSED_FLAG_BIT)\n end", "def compress\n compressed_data = @compressor.deflate @data\n JSON.dump({:version => Ripple::Compression::VERSION, :data => Base64.encode64(compressed_data)})\n end", "def get_compression()\n return(get_cmd('CP;',0.1,0.5,3).gsub(/^CP/,'').gsub(/;$/,'').to_i)\nend", "def no_accept_gzip!\n return if @ext__veto_gzip\n if @ext__recv_gzip\n send_frame Settings.frame_from({Settings::ACCEPT_GZIPPED_DATA => 0})\n @ext__recv_gzip = false\n end\n end", "def gzip_requests; end", "def accept_gzip!\n return if @ext__veto_gzip\n if !@ext__recv_gzip\n send_frame Settings.frame_from({Settings::ACCEPT_GZIPPED_DATA => 1})\n @ext__recv_gzip = true\n end\n end", "def compress\n scheme + compressed_path\n end", "def compress_option_sql(attrs)\n\t case value=attrs[:compress]\n\t when Fixnum, Integer then \"COMPRESS(#{value})\"\n\t else flag_option_sql attrs, :compress\n\t end\n end", "def compress(value)\n Zlib::Deflate.deflate(value)\n end", "def compress!(img)\n puts 'Compressing image.'\n image_optim = ImageOptim.new(allow_lossy: true, verbose: false, skip_missing_workers: true, optipng: false,\n pngcrush: false, pngquant: { allow_lossy: true },\n advpng: false, pngout: false, svgo: false)\n image_optim.optimize_image(img)\n puts 'compressed.'\n end", "def start_compressing\n %Q{Start compressing of dump ... }\n end", "def compressed\n require 'jsmin'\n @compressed ||= self.class.compress(combined)\n end", "def tar_compression_flag(path)\n case path\n when /\\.tar\\.bz2$/\n return \"-j\"\n when /\\.tar\\.gz$|\\.tgz$/\n return \"-z\"\n when /\\.tar\\.xz$/\n return \"-J\"\n else\n return nil\n end\n end", "def all_virtual_compression_statistics\n super\n end", "def compress\n Zlib::Deflate.deflate(marshal)\n end", "def compress \n accepts = request.env['HTTP_ACCEPT_ENCODING'] \n return unless accepts && accepts =~ /(x-gzip|gzip)/ \n\n encoding = $1 \n output = StringIO.new \n\n def output.close # Zlib does a close. Bad Zlib... \n rewind \n end \n\n gz = Zlib::GzipWriter.new(output) \n gz.write(response.body) \n gz.close \n\n if output.length < response.body.length \n response.body = output.string \n response.headers['Content-encoding'] = encoding\n end \n end", "def test_compressed_instance\r\n assert_respond_to(@fh, :compressed=)\r\n assert_nothing_raised{ @fh.compressed = true }\r\n assert(File.compressed?(@file))\r\n assert_nothing_raised{ @fh.compressed = false }\r\n assert_equal(false, File.compressed?(@file))\r\n end", "def compress!\n File.open(@file_path, 'w') { |file| file.write(output) } if compress.modified?\n self\n end", "def set_compressor\n @compressor = Compressor.find(params[:id])\n end", "def accept_gzip?\n return if @ext__veto_gzip\n @ext__recv_gzip\n end", "def compress(data); end", "def optimize_for_pagespeed\n # according to https://developers.google.com/speed/docs/insights/OptimizeImages\n if self.file.content_type == 'image/jpeg'\n # convert orig.jpg -sampling-factor 4:2:0 -strip -quality 85 -interlace JPEG orig_converted.jpg\n manipulate! do |img|\n img.sampling_factor '4:2:0'\n img.strip\n img.quality 85\n img.interlace 'JPEG'\n img\n end\n else\n # convert cuppa.png -strip cuppa_converted.png\n manipulate! do |img|\n img.strip\n img\n end\n end\n end", "def compress_with\n Backup::Logger.warn(\n \"[DEPRECATION WARNING]\\n\" +\n \" Compressor::Lzma is being deprecated as of backup v.3.0.24\\n\" +\n \" and will soon be removed. Please see the Compressors wiki page at\\n\" +\n \" https://github.com/meskyanichi/backup/wiki/Compressors\"\n )\n super\n end", "def tar_compression_extension\n case compression\n when :bzip2, \"bzip2\", nil\n \".bz2\"\n when :gzip, \"gzip\"\n \".gz\"\n when :none, \"none\"\n \"\"\n end\n end", "def fallback(str, type, options)\n if type == :js\n compress str, :js, :jsmin, :no_fallback => true\n elsif type == :css\n compress str, :css, :simple, :no_fallback => true\n end\n end", "def snapshots_transport_gzip_requests; end", "def initialize\n @http = HTTPX.plugin :compression\n end", "def js_compressor=(compressor)\n expire_index!\n\n unregister_bundle_processor 'application/javascript', :js_compressor\n return unless compressor\n\n register_bundle_processor 'application/javascript', :js_compressor do |context, data|\n compressor.compress(data)\n end\n end", "def cannot_compress?(mime_types)\n !can_compress?(mime_types)\n end", "def compress\n input_len = @input.bytesize\n tmp = optipng(quantize(@input))\n\n # Check to see whether we've improved the situation\n output_len = tmp.bytesize\n if input_len > output_len\n $LOG.debug \" %d bytes -> %d bytes = %.1f%%\" % [ input_len, output_len, 100 * output_len/input_len ] if $LOG.debug?\n @output = tmp\n @modified = true\n else\n $LOG.debug \" no gain\" if $LOG.debug?\n @output = @input\n @modified = false\n end\n self\n end", "def deflate(s)\n Snappy.compress(s)\n end", "def gzip_compress(s)\n io = StringIO.new('w')\n w = Zlib::GzipWriter.new(io)\n w.write(s)\n w.close\n io.string\nend", "def write filename, compress=nil\n STDERR.puts(\"Writing #{self.inspect} to #{filename}\")\n x = super(filename)\n `gzip #{filename}` if compress\n x\n end", "def compressor\n @compressor ||= Compressor.for_current_system(compressors.keys).new(self)\n end", "def apply_processors\n if user_id.present? or company_id.present? or file.options[:no_watermark]\n [:compression]\n else\n [:watermark, :compression]\n end\n end", "def js_compressor\n bundle_processors('application/javascript').detect { |klass|\n klass.respond_to?(:name) &&\n klass.name == 'Sprockets::Processor (js_compressor)'\n }\n end", "def compress_gzip(data)\n buffer = StringIO.new('','w')\n compressor = Zlib::GzipWriter.new(buffer)\n begin\n compressor.write(data)\n ensure\n compressor.close()\n end\n buffer.string\n end", "def supports_zlib?\n Kernel.warn(\"Ethon: Easy#supports_zlib? is deprecated and will be removed, please use Easy#.\")\n Easy.supports_zlib?\n end", "def normalize_compression_name(name); end" ]
[ "0.79042566", "0.7686397", "0.7352654", "0.730841", "0.7262949", "0.72500896", "0.72238404", "0.72238404", "0.7205714", "0.7174773", "0.7150642", "0.7114816", "0.7114453", "0.70307225", "0.69887763", "0.6977512", "0.6913873", "0.6909236", "0.6869278", "0.68684053", "0.68562347", "0.6854996", "0.68182254", "0.68182254", "0.6758125", "0.6694005", "0.6681124", "0.6621004", "0.6558418", "0.6531873", "0.6530232", "0.6529737", "0.6518418", "0.6498264", "0.6480936", "0.6464382", "0.64432096", "0.64141023", "0.6393005", "0.6355228", "0.6332353", "0.6318785", "0.6222371", "0.6202827", "0.62013894", "0.6177888", "0.6124566", "0.61198443", "0.6104", "0.6091583", "0.60859483", "0.6023192", "0.6019161", "0.59903973", "0.5965236", "0.5964665", "0.5944579", "0.5922278", "0.58709186", "0.5861256", "0.5854774", "0.5853097", "0.5837373", "0.5836263", "0.58196163", "0.5796193", "0.57555455", "0.5734695", "0.570672", "0.57049626", "0.56947607", "0.5683911", "0.5680857", "0.56703776", "0.56541526", "0.5601564", "0.5564876", "0.55639166", "0.5532242", "0.5480599", "0.54693013", "0.5469127", "0.54665023", "0.5457654", "0.5427868", "0.54275614", "0.5411194", "0.54097253", "0.536379", "0.53577536", "0.53233594", "0.5312656", "0.53053766", "0.5291616", "0.5265675", "0.52587384", "0.5258383", "0.5248714", "0.5248257", "0.52463704" ]
0.8008264
0
For everything else that we don't care to document right now.
def method_missing(*args, &block) @store.__send__(*args, &block) rescue ::MemCache::MemCacheError => e Log.error(e) nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def document?; end", "def document?; end", "def doc; end", "def doc; end", "def doc; end", "def doc; end", "def document; end", "def document; end", "def document; end", "def document; end", "def document; end", "def document; end", "def document; end", "def document; end", "def document; end", "def document; end", "def document; end", "def document; end", "def document; end", "def document; end", "def document; end", "def document; end", "def document; end", "def document; end", "def document; end", "def document; end", "def document; end", "def docs; end", "def ignores; end", "def internal; end", "def ignore; end", "def silence_deprecations; end", "def base_docstring; end", "def start_document; end", "def start_document; end", "def request_doc\n \n end", "def document=(_arg0); end", "def document=(_arg0); end", "def document=(_arg0); end", "def document=(_arg0); end", "def document=(_arg0); end", "def document=(_arg0); end", "def document=(_arg0); end", "def document=(_arg0); end", "def document=(_arg0); end", "def extra; end", "def internal?; end", "def refutal()\n end", "def custom; end", "def custom; end", "def document\n comment_code\n super\n end", "def initialize; @docs = {} end", "def raise_deprecations; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def no_doc!\n @controller.doc = false\n end", "def print_undocumented_objects; end", "def doc_task; end", "def specialty; end", "def process_post\n\t\traise \"Ehh, What's up Doc?\"\n\tend", "def overrides; end", "def docs=(_arg0); end", "def render_document; end", "def docstring; end", "def docstring; end", "def pre #:doc:\n end", "def rearrange_docs!; end", "def probers; end", "def check_resource_semantics!; end", "def link_documentation; end", "def documents; end", "def documents; end", "def current_document=(_arg0); end", "def weber; end", "def fulldoc_template; end", "def doc=(_arg0); end", "def doc=(_arg0); end", "def doc=(_arg0); end", "def process!(document); end", "def document\n capture_args\n capture_return\n super\n end", "def initialize(doc); end", "def implementation; end", "def implementation; end", "def missing; end", "def document\n capture_parameters\n capture_return_type\n super\n end", "def extra_annotations; end", "def warnings; end", "def warnings; end", "def warnings; end", "def warnings; end", "def warnings; end", "def warnings; end", "def warnings; end", "def warnings; end", "def special\n override\n end", "def assign_current_document!; end", "def private_method\n end", "def before_lint; end" ]
[ "0.6939718", "0.6720141", "0.6720141", "0.658978", "0.658978", "0.658978", "0.658978", "0.64870316", "0.64870316", "0.64870316", "0.64870316", "0.64870316", "0.64870316", "0.64870316", "0.64870316", "0.64870316", "0.64870316", "0.64870316", "0.64870316", "0.64870316", "0.64870316", "0.64870316", "0.64870316", "0.64870316", "0.64870316", "0.64870316", "0.64870316", "0.64870316", "0.6463258", "0.6422281", "0.6363206", "0.634189", "0.63268596", "0.6199303", "0.6171515", "0.6171515", "0.616302", "0.6123368", "0.6123368", "0.6123368", "0.6123368", "0.6123368", "0.6123368", "0.6123368", "0.6123368", "0.6123368", "0.61188567", "0.610902", "0.6101901", "0.6099627", "0.6099627", "0.6080309", "0.60724527", "0.60415196", "0.6035946", "0.6035946", "0.6035946", "0.6035946", "0.60327923", "0.6008399", "0.6001151", "0.5999995", "0.5986618", "0.597878", "0.5975685", "0.5962257", "0.594794", "0.594794", "0.5943917", "0.5938777", "0.59372836", "0.5931253", "0.59190047", "0.5917402", "0.5917402", "0.58873814", "0.5878653", "0.5864137", "0.58632636", "0.58632636", "0.58632636", "0.58559084", "0.58352077", "0.5833909", "0.5817208", "0.5817208", "0.5810387", "0.58025324", "0.5800325", "0.57869387", "0.57869387", "0.57869387", "0.57869387", "0.57869387", "0.57869387", "0.57869387", "0.57869387", "0.57831615", "0.575951", "0.57546735", "0.5738707" ]
0.0
-1
GET /legalissues GET /legalissues.json
def index @legalissues = Legalissue.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gather_issues\n url = \"#{URL}/projects/foreman/issues.json?status_id=1&limit=100&release_id=#{@current_release_id}\"\n puts url\n uri = URI(URI.escape(url))\n response = Net::HTTP.get(uri)\n JSON.parse(response)\nend", "def index\n @issues = Issue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @issues }\n end\n end", "def index\n @issues = Issue.all\n end", "def index\n @issues = Issue.all\n end", "def index\n @issues = Issue.all\n end", "def index\n @issues = Issue.all\n end", "def index\n @issues = Issue.all\n end", "def index\n @issues = Issue.where({assignee: current_user.github_username})\n\n render json: @issues\n end", "def issue\n id = params[:issue_id]\n if id\n @issue = Issue.find(id.to_i)\n unless @issue\n render :status => 404, :text => 'Issue not found'\n end\n else\n render :status => 400 , :text => 'Invalid issue_id'\n end\n @journals = @issue.journals.find(:all, :include => [:user, :details], :order => \"#{Journal.table_name}.created_on ASC\")\n @journals.each_with_index {|j,i| j.indice = i+1}\n @journals.reverse! if User.current.wants_comments_in_reverse_order?\n @changesets = @issue.changesets\n @changesets.reverse! if User.current.wants_comments_in_reverse_order?\n @allowed_statuses = @issue.new_statuses_allowed_to(User.current)\n @edit_allowed = User.current.allowed_to?(:edit_issues, @project)\n @priorities = IssuePriority.all\n @time_entry = TimeEntry.new\n @project = @issue.project\n @title = \"#{@project.name}: #{@issue.subject}\"\n\n jsonres = Hash.new\n jsonres[:issue] = @issue\n jsonres[:issue_status] = @issue.status.to_s\n jsonres[:authorName] = @issue.author.to_s\n jsonres[:authorEmail] = @issue.author.mail\n jsonres[:journals] = @journals\n jsonres[:project] = @project\n jsonres[:changesets] = @changesets\n render :json => jsonres.to_json\n end", "def get_my_issues\n get_json( GITHUB_ISSUES_URL ).each do |item|\n puts \"#{ item[ 'repository' ][ 'full_name' ] }: ##{ item[ 'number' ] } #{ item[ 'title' ] } | href=#{ item[ 'html_url' ] }\"\n end\nend", "def open_issues\n @open_issues = @github.issues.list user: APP_CONF['org'],\n repo: APP_CONF['repo'],\n state: 'all',\n # labels: 'Complete',\n assignee: params[:username]\n render json: @open_issues\n end", "def issues\n @query = Query.new(:name => \"_\")\n @issues = @query.issues(:order => \"issues.created_on desc\", :limit => 50, :include => [:project, :author])\n res = Array.new\n @issues.each do |is|\n res << {:issue_id => is.id, :issue_title => is.subject, :issue_content => is.description, :project_name => is.project.name,\n :author_name => is.author.to_s, :author_email => is.author.mail, :issue_created_at => is.created_on, :issue_status => is.status.to_s }\n end\n render :json => res.to_json\n end", "def index\n @issues = current_user.issues\n end", "def all_issues()\n @endpoint = \"/issues.json?limit=100\"\n setup_get\n res = @http.request(@req)\n return JSON.load(res.body)[\"issues\"].sort_by { |issue| issue[\"id\"] }\n end", "def get_issues\n jira_issues = Hash.new\n # This is the REST URL that will be hit. Change the jql query if you want to adjust the query used here\n uri = URI(JIRA_BASE_URL + '/rest/api/2/search?jql=assignee+%3D+currentUser()+AND+status+not+in+(Closed,+Resolved)')\n\n Net::HTTP.start(uri.hostname, uri.port, :use_ssl => uri.scheme == 'https') do |http|\n request = Net::HTTP::Get.new(uri)\n request.basic_auth USERNAME, PASSWORD\n response = http.request request\n # If the response was good, then grab the data\n if response.code =~ /20[0-9]{1}/\n data = JSON.parse(response.body)\n data[\"issues\"].each do |item|\n jira_id = item[\"key\"]\n jira_issues[jira_id] = item[\"fields\"][\"summary\"]\n end\n else\n raise StandardError, \"Unsuccessful response code \" + response.code + \" for issue \" + issue\n end\n end\n return jira_issues\nend", "def issues\n Sifter.\n get(api_issues_url).\n fetch(\"issues\", []).\n map { |i| Sifter::Issue.new(i) }\n end", "def issues_for(year)\n path = \"/besplatni-izdanija.nspx?pYear=#{year}\"\n response = @http.get(path)\n html = ''\n if response.code == '200'\n html = response.body.force_encoding('utf-8')\n else\n raise \"error opening free issue page: #{response.code} #{response.message}\"\n end\n \n results = []\n # get link tag\n re = %r{<a\\s+href\\s*=\\s*\"([^\"]*)\"[^>]*?>\\s*СЛУЖБЕН ВЕСНИК НА РМ бр.\\s*(\\d+)}i\n pos = 0\n while html.index(re, pos)\n results[Regexp.last_match[2].to_i] = Regexp.last_match[1].dup\n pos = Regexp.last_match.end(2).to_i\n end\n\n return nil if results.size == 0\n results\n end", "def get_issues\n jira_issues = Hash.new\n # This is the REST URL that will be hit. Change the jql query if you want to adjust the query used here\n uri = URI(JIRA_BASE_URL + '/rest/api/2/search?jql=' + JQL)\n\n Net::HTTP.start(uri.hostname, uri.port, :use_ssl => uri.scheme == 'https') do |http|\n request = Net::HTTP::Get.new(uri)\n request.basic_auth USERNAME, PASSWORD\n response = http.request request\n # If the response was good, then grab the data\n if response.code =~ /20[0-9]{1}/\n data = JSON.parse(response.body)\n data[\"issues\"].each do |item|\n jira_id = item[\"key\"]\n jira_issues[jira_id] = item[\"fields\"][\"summary\"]\n end\n else\n raise StandardError, \"Unsuccessful HTTP response code: \" + response.code\n end\n end\n return jira_issues\nend", "def get_github_issues github_uri\n user,project = get_github_user_project(github_uri)\n url = \"http://github.com/legacy/issues/search/#{user}/#{project}/open/number\"\n $stderr.print url,\"\\n\"\n issues = JSON.parse(Http::get_http_body(url))\n if issues == nil or issues == {}\n $stderr.print \"\\nWARNING: issues link not working!\\n\"\n issues = {\"issues\"=>[]} \n end\n $stderr.print issues['issues'].size, \"\\n\" \n issues['issues']\n end", "def show\n @voucher = Voucher.find(params[:id])\n @issues = @voucher.issues\n\n end", "def show\n respond_with(@issue) do |format|\n format.json { render json: @issue.to_json }\n end\n end", "def index\n @issues = Issue.order(\"date DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @issues }\n end\n end", "def index\n authorize! :read, Issue\n\n respond_to do |format|\n format.html\n format.js\n format.json { render json: IssuesDatatable.new(view_context) }\n end\n end", "def index\n @issues = Issue.filter(\n params.slice(:build_product, :build_branch, \n :build_name, :build_id, :similar_to, :signature, :include_hit_count)\n )\n render json: @issues\n end", "def index\n @notice = \"ALL Issues\"\n @@selected_label=nil\n @@found_by=false\n @@assigned_to=false\n get_bugs\n get_count_of_issue\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bugs }\n end\n end", "def index\n @jira_issues = JiraIssue.all\n end", "def index\n @issues = Issue.all.order(created_at: :desc)\n if @issues.present?\n render :index, status: :ok\n else\n @message = \"no issues found\"\n render :error, status: :not_found\n end\n end", "def gather_issues(status_id, options)\n url = \"#{options[:url]}/issues.json?status_id=#{status_id}&updated_on=#{options[:date]}\" +\n \"&assigned_to_id=#{user_to_id(options[:user])}&limit=100\"\n puts url\n uri = URI(URI.escape(url))\n response = Net::HTTP.get(uri)\n JSON.parse(response)\nend", "def index\n @local_issues = LocalIssue.all\n end", "def show\n @issue = Issue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @issue }\n end\n end", "def index\n @issues = @account.issues.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @issues }\n end\n end", "def index\n github = Github.new\n #@repo = github.repos.get(:user => \"rails\", :repo => \"rails\")\n @page = (params[:page].nil?) ? 1 : params[:page]\n @issues = github.issues.list(:user => 'rails', :repo => 'rails', :per_page => 25, :page => @page.to_i)\n\n @paging = {page: @page.to_i, totalpages: @issues.count_pages}\n\n respond_with(@issues, @paging)\n end", "def list_issues(owner,repo, options = {})\n Issues.get(\n \"/repos/#{owner}/#{repo}/issues\",\n :headers => @auth,\n :body => options.to_json\n )\n end", "def index\n @git_hub_issues = GitHubIssue.all\n end", "def show\n #@publication = Publication.find(params[:id])\n #@issues = @publication.issues.where( :issue_states => {:name => 'released'})\n #render json: @issues\n\n publication = Publication.find_by_product_code(params[:id])\n\n state = IssueState.find_by_name('Released')\n\n issues = Issue.where(:publication_id => publication, :issue_state_id => state)\n render json: issues.as_json({:except => :pdf_zip})\n\n end", "def index\n if @issuable\n if @issuable.class.to_s == 'Project'\n @pre_issues = @issuable.issues\n @pre_issues.concat(@issuable.lists.map{|l| l.studies.map{|s| s.issues }}.flatten)\n else\n @pre_issues = @issuable.issues.order('sequential_id DESC')\n end\n else\n @pre_issues = Issue.scoped\n end\n\n @issues = @pre_issues\n \n unless params[:state]\n params[:state] = 'open'\n end\n\n if params[:state] == 'open'\n @issues = @issues.where(closed: false)\n end\n if params[:state] == 'closed'\n @issues = @issues.where(closed: true)\n end\n if params[:creator]\n @issues = @issues.where(creator_id: params[:creator])\n end\n if params[:assignee]\n @issues = @issues.where(assigned_id: params[:assignee])\n end\n if params[:aspect]\n @project = Project.find(params[:aspect])\n @issues = @project.issues\n end\n\n respond_to do |format|\n format.html { render layout: 'fluid' }# index.html.erb\n format.json { render json: @issues }\n end\n end", "def index\n if params[:github_name]\n @user = User.find_by_github_name(params[:github_name])\n @issues = @user.issues\n else\n @issues = Issue.all\n end\n end", "def show\n @normal_issue = NormalIssue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @normal_issue }\n end\n end", "def get_all_incident_issues\n response = Octokit.list_issues(\"department-of-veterans-affairs/appeals-support\", direction: \"asc\", state: \"open\")\n response.reject { |v| v[:created_at] >= 10.days.ago }\n end", "def get_all_incident_issues\n response = Octokit.list_issues(\"department-of-veterans-affairs/appeals-support\", direction: \"asc\", state: \"open\")\n response.reject { |v| v[:created_at] >= 10.days.ago }\n end", "def legalissue_params\n params.require(:legalissue).permit(:name, :issue, :comment, :done)\n end", "def index \n render :json => Project.find(11).bug_tracker.bugs\n end", "def get(*args)\n arguments(args, required: [:user, :repo, :number])\n\n get_request(\"/repos/#{arguments.user}/#{arguments.repo}/issues/#{arguments.number}\", arguments.params)\n end", "def issues\n dashboard = fetch_email_dashboard\n respond_with Emails.new(dashboard.issues, issues_emails_url)\n end", "def index\n @issues = Issue.search( params[:query]).order('created_at desc').page(params[:page]).per(64)\n end", "def show\n @important_issue = ImportantIssue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @important_issue }\n end\n end", "def create\n @legalissue = Legalissue.new(legalissue_params)\n\n respond_to do |format|\n if @legalissue.save\n format.html { redirect_to @legalissue, notice: 'Legalissue was successfully created.' }\n format.json { render :show, status: :created, location: @legalissue }\n else\n format.html { render :new }\n format.json { render json: @legalissue.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_issues( url, label )\n\t\tissues = @git.client.issues( url, :per_page => 100 )\n\t\tcleaned_issues = parse_issue_array( issues, label )\n\t\tputs cleaned_issues.inspect\n\t\treturn cleaned_issues\n\tend", "def query_v3\n if params[:workflow]\n @collection = current_user.workflow_issues\n else\n raise \"not sure what to do here\"\n end\n\n @include_workflow_state = true\n @include_issue_team = true\n @include_issue_tracker = true\n\n render 'api/v2/issues/index'\n end", "def index\n @sub_issues = SubIssue.all\n end", "def set_legalissue\n @legalissue = Legalissue.find(params[:id])\n end", "def show\n @issue = Issue.find(params[:id])\n logger.debug @issue.inspect\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @issue }\n end\n end", "def get_closed_prs(client)\n # search for GitHub issues and sort search results\n pull_requests = client.search_issues(\"state:closed author:santos22 type:pr\", options = {sort: \"created\", order: \"asc\"})\n\n result = pull_requests.to_h\n pr_info = result.to_json\n pr_arr = JSON.parse(pr_info)\n data = pr_arr['items'].map { |pr| PullRequest.new(pr['title'], pr['html_url'], format_date(pr['closed_at']) , pr['comments']) }\n\n # return response\n headers['Access-Control-Allow-Origin'] = '*'\n content_type :json\n data.to_json\nend", "def fetch_closed_issues_and_pr\n print \"Fetching closed issues...\\r\" if @options[:verbose]\n issues = []\n page_i = 0\n count_pages = calculate_pages(@client, \"issues\", closed_pr_options)\n\n iterate_pages(@client, \"issues\", closed_pr_options) do |new_issues|\n page_i += PER_PAGE_NUMBER\n print_in_same_line(\"Fetching issues... #{page_i}/#{count_pages * PER_PAGE_NUMBER}\")\n issues.concat(new_issues)\n break if @options[:max_issues] && issues.length >= @options[:max_issues]\n end\n print_empty_line\n Helper.log.info \"Received issues: #{issues.count}\"\n\n # separate arrays of issues and pull requests:\n issues.map { |issue| stringify_keys_deep(issue.to_hash) }\n .partition { |issue_or_pr| issue_or_pr[\"pull_request\"].nil? }\n end", "def show\n @issue = scan.issues.find( params.require( :id ) )\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @issue }\n end\n end", "def issues(*args)\n params = arguments(args, required: [:q]).params\n params['q'] ||= arguments.q\n\n get_request('/search/issues' , params)\n end", "def show\n @issue = current_repository.issues.find_by(number: params[:number])\n\n if @issue.blank?\n render json: { error: 'Issue not found' }, status: :not_found\n end\n end", "def issues\n if @issues.nil?\n @issues = {}\n max_result = 3\n jql = \"/rest/api/2/search?jql=project=\\\"#{name}\\\" AND issuetype NOT IN (Epic, Sub-task)&expand=changelog&maxResults=#{max_result}\"\n #r = nil\n #without_cache{ r = self.class.get(\"#{jql}&startAt=0\") }\n r = self.class.get(\"#{jql}&startAt=0\")\n pages = (r['total'] / max_result)\n (0..pages).each do |current_page|\n begin\n # If you can get the latest version of the last page, do so, otherwise load the cached version\n query = \"#{jql}&startAt=#{(current_page * max_result)}\"\n if current_page == pages\n #without_cache{ r = self.class.get(query) }\n # else\n r = self.class.get(query)\n end\n r['issues'].each do |issue|\n # Cast raw response to Issue(), passing project reference into constructor\n issue['project'] = self\n @issues[issue['key']] = Issue.new(issue)\n end\n # rescue => exception\n # puts \"#{exception.message} (#{exception.class})\"\n # pp exception.backtrace\n end\n end\n end\n @issues\n end", "def index\n @legal_entities = LegalEntity.all\n end", "def issues\n workspace_id = zenhub_workspace_id\n repo_id = zenhub_repo_id\n url = \"https://api.zenhub.io/p2/workspaces/#{workspace_id}/repositories/#{repo_id}/board\" \n issues = Array.new\n uri = URI(url)\n response = Net::HTTP.start(uri.host, uri.port, :use_ssl => true) do |http|\n request = Net::HTTP::Get.new(uri)\n request['Content-Type'] = 'application/json'\n request['X-Authentication-Token'] = ENV['TOKEN']\n\n http.request(request)\n end\n\n board = JSON.parse(response.body)\n board[\"pipelines\"].each do |columns|\n if columns[\"name\"] == COLUMN\n columns[\"issues\"].each do |issue|\n issues.push(issue['issue_number'])\n end\n end\n end\n issues\nend", "def get_all_master_issues\n Octokit.list_issues(\"department-of-veterans-affairs/appeals-support\", direction: \"asc\", state: \"all\")\n end", "def get_all_master_issues\n Octokit.list_issues(\"department-of-veterans-affairs/appeals-support\", direction: \"asc\", state: \"all\")\n end", "def show\n @issues = Issue.where(tenant: @tenant)\n end", "def issues(created_on: nil, limit: 100, project:nil, status:nil, sort:nil)\n x = {}\n x[:created_on] = created_on if created_on\n x[:limit] = limit if limit\n x[:project_id] = project if project\n x[:status] = status if status\n x[:sort] = sort if sort\n qs = x.empty? ? \"\" : x.reduce(\"?\") { |s,(k,v)| s+=\"#{k}=#{CGI.escape(v.to_s)}&\" }\n return get(\"issues.json\"+qs)\n end", "def issue(project, id)\n get(\"/projects/#{url_encode project}/issues/#{id}\")\n end", "def issues(status=nil, prioirty=nil)\n\n issues = []\n\n # Build filter string\n filters = \"&s=#{status}\" if status\n filters.to_s << \"&p=#{priority}\" if prioirty\n \n # Inital request url\n issues_url = api_issues_url + \"?page=1&per_page=100\" + filters\n \n while issues_url do # while next_page_url is not nil add issues to the list \n page = Sifter.get(issues_url + filters.to_s)\n \n issues += page.fetch(\"issues\", []).map { |p| Sifter::Issue.new(p) }\n issues_url = page.fetch(\"next_page_url\")\n end\n\n issues\n end", "def issue\n @issue = Issue.find(params[:id])\n end", "def new\n @issue = Issue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end", "def index\n @problems = Problem.active.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @problems }\n end\n end", "def index\n @problems = Problem.all\n\n render json: @problems\n end", "def get(issue_id)\n HTTParty.get(url(issue_id))\n end", "def show\n @data = URI.parse(\"https://api.github.com/repos/dylanpavelko/\"+@git_hub_repo.repo+\"/issues\").read\n @structuredResponse = JSON.parse(@data)\n @repoID = @git_hub_repo.id\n @structuredResponse.each do |issue|\n #if issue doesn't already exist\n if GitHubIssue.where(:gitHubID => issue['id']).count == 0\n #create issue for repo and top level node\n @ghIssue = GitHubIssue.new(\n :gitHubID => issue['id'], \n :number => issue['number'],\n :title => issue['title'],\n :created => issue['created_at'],\n :updated => issue['updated_at'],\n :closed => issue['closed_at'],\n :body => issue['body'],\n :repo_id => @repoID,\n :node => @git_hub_repo.node)\n @ghIssue.save\n end\n end\n\n end", "def index\n @issue_skills = IssueSkill.all\n render json: @issue_skills\n end", "def show\n github = Github.new\n @issue = github.issues.get(:user => 'rails', :repo => 'rails', :number => params[:id])\n @comments = github.issues.comments.all(:user => 'rails', :repo => 'rails', :issue_id => params[:id]) unless @issue.comments == 0\n\n respond_with(:issue => @issue, :comments => @comments)\n end", "def index\n @solutions = @idea.solutions.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @solutions }\n end\n end", "def org_issues(org, options = {})\n paginate \"#{Organization.path org}/issues\", options\n end", "def index\n @issue_histories = IssueHistory.all\n end", "def show\n begin\n @vehicle = Vehicle.find_by_id(params[:id])\n @vin = @vehicle.vin.scan(/.{1,9}/) if @vehicle.vin\n @issues = @vehicle.issues.order(id: :desc)\n @closed_issues = (@issues - @issues.open)\n rescue \n render_404\n end\n end", "def get_issue(issue_key)\n url = \"#{@base_url}/rest/api/2/issue/#{issue_key}\"\n result = rest_call(url, \"get\", @login_options)\n log result.inspect\n result\n end", "def index\n @conflict_illnesses = ConflictIllness.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @conflict_illnesses }\n end\n end", "def get_issues(label='',mode)\n debug_msg(\"get_issues: #{label}\",3)\n case mode\n when 'inclusive'\n uri = URI.parse(JIRA_BASE_URL + \"/rest/api/2/search?jql=assignee+%3D+currentUser()+AND+status+not+in+(Closed,+Resolved)+AND+labels+in(#{label})\")\n debug_msg(uri,9)\n when 'exclusive'\n uri = URI.parse(JIRA_BASE_URL + \"/rest/api/2/search?jql=assignee+%3D+currentUser()+AND+status+not+in+(Closed,+Resolved)+AND+labels+not+in(#{label})\")\n debug_msg(uri,9)\n else\n raise StandardError \"mode has an unsupported value: #{mode}. should be 'inclusive' or 'exclusive'\"\n end\n jira_issues = Hash.new\n j_issue = Hash.new\n # This is the REST URL that will be hit. Change the jql query if you want to adjust the query used here\n # uri = URI.parse(JIRA_BASE_URL + \"/rest/api/2/search?jql=assignee+%3D+currentUser()+AND+status+not+in+(Closed,+Resolved)+AND+labels+in(#{label})\")\n\n Net::HTTP.start(uri.hostname, uri.port, :use_ssl => uri.scheme == 'https') do |http|\n request = Net::HTTP::Get.new(uri.request_uri)\n debug_msg(request,10)\n request.basic_auth(\"#{USERNAME}\", \"#{PASSWORD}\")\n response = http.request (request)\n debug_msg(response,10)\n # If the response was good, then grab the data\n if response.code =~ /20[0-9]{1}/\n data = JSON.parse(response.body)\n debug_msg(\"DATA: #{data}\",9)\n data[\"issues\"].each do |item|\n debug_msg(\"ITEM: #{item}\",10)\n jira_id = item[\"key\"]\n j_id = item['key']\n j_issue[j_id] = Hash.new\n j_issue[j_id]['status'] = item['fields']['status']['name']\n j_issue[j_id]['summary'] = item['fields']['summary']\n# p item\n# p \"-----------------------------------------\"\n# binding.pry;\n summary_status = '[' + item['fields']['status']['name']+ '] '+item['fields']['summary']\n# jira_issues[jira_id] = item['fields']['summary']\n# jira_issues[jira_id] = item['fields']['status']['name']\n# jira_issues[jira_id].['summary'] = item['fields']['summary']\n# jira_issues[jira_id].['status'] = item['fields']['status']['name']\n jira_issues[jira_id] = item['fields']['summary']\n\n # binding.pry;\n end\n else\n raise StandardError, \"Unsuccessful response code \" + response.code + \" for #{label} \"\n end\n end\n #return jira_issues\n return j_issue\nend", "def index\n @discussions = @issue.discussions.all\n end", "def new\n @important_issue = ImportantIssue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @important_issue }\n end\n end", "def index\n @issue_types = IssueType.all\n end", "def update\n respond_to do |format|\n if @legalissue.update(legalissue_params)\n format.html { redirect_to @legalissue, notice: 'Legalissue was successfully updated.' }\n format.json { render :show, status: :ok, location: @legalissue }\n else\n format.html { render :edit }\n format.json { render json: @legalissue.errors, status: :unprocessable_entity }\n end\n end\n end", "def open_issues\n project.source.open_issues\n end", "def index\n @tissues = Tissue.all\n end", "def retrieve_solved\n\t\trender json: @@problems_solved_shared\n\tend", "def index\n @leases = Lease.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @leases }\n end\n end", "def index_issue\n @work_orders = WorkOrder.accessible_by(current_ability).search(params[:search]).order(\"issued_at desc, received\").page(params[:page]).includes{work_order_items.tool_part_item}\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @work_orders }\n format.xml { render xml: @work_orders }\n end\n end", "def new\n @normal_issue = NormalIssue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @normal_issue }\n end\n end", "def index\n authorize Bug\n @bugs = Bug.all\n end", "def show\n @partner = Partner.find(params[:id])\n @issueable = @partner\n @issues = @issueable.issues\n @issue = Issue.new\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @partner }\n end\n end", "def project_issues(project)\n Issue.where(:project_id=>project.id)\n end", "def index\n @issue_areas = IssueArea.all\n end", "def show\n @fix_issue = FixIssue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @fix_issue }\n end\n end", "def show\n @base_issue = BaseIssue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @base_issue }\n end\n end", "def issues(*args)\n params = args.extract_options!\n normalize! params\n\n required = ['owner', 'repo', 'state', 'keyword']\n assert_required_keys required, params\n\n options = required.inject({}) do |hash, key|\n hash[key] = params.delete(key)\n hash\n end\n\n get_request(\"/legacy/issues/search/#{options['owner']}/#{options['repo']}/#{options['state']}/#{options['keyword']}\", params)\n end", "def maintenances\n @project = Project.find(params[:id])\n @trackers = @project.trackers\n @issue_categories = @project.issue_categories\n @versions = @project.versions\n @issue_statuses = IssueStatus.all\n @issue_priorities = Enumeration.find_all_by_opt(\"IPRI\")\n result = {'trackers' => @trackers, 'statuses' => @issue_statuses, 'versions' => @versions,\n 'categories' => @issue_categories, 'priorities' => @issue_priorities}\n\n respond_to do |format|\n format.html\n format.xml { render :xml => result, :status => :ok}\n format.json { render :json => result }\n end\n\n end", "def destroy\n @legalissue.destroy\n respond_to do |format|\n format.html { redirect_to legalissues_url, notice: 'Legalissue was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.67881715", "0.6640637", "0.65331256", "0.65331256", "0.65331256", "0.65331256", "0.65331256", "0.65185523", "0.6490595", "0.6456931", "0.6420763", "0.6381829", "0.6354505", "0.629856", "0.6297153", "0.6279212", "0.6173057", "0.6162876", "0.61561894", "0.6114037", "0.6112848", "0.6104182", "0.6097108", "0.6090583", "0.6073179", "0.605965", "0.60306096", "0.60225075", "0.602079", "0.59931844", "0.5987434", "0.59796476", "0.5971059", "0.5968372", "0.5955987", "0.59474874", "0.59363496", "0.59346694", "0.59107286", "0.59107286", "0.59078413", "0.5890297", "0.5877915", "0.5877878", "0.5869724", "0.5867775", "0.5866874", "0.5853632", "0.58371866", "0.58200693", "0.580559", "0.5780924", "0.57794845", "0.57590276", "0.5749417", "0.57405645", "0.5735138", "0.573486", "0.5730973", "0.57177323", "0.5717404", "0.5717404", "0.56979823", "0.5693181", "0.56809026", "0.5679914", "0.56796616", "0.5672263", "0.56613916", "0.56582856", "0.5657634", "0.5654009", "0.5653442", "0.56521845", "0.56505424", "0.56331605", "0.56312245", "0.5626522", "0.5623411", "0.56233764", "0.56178594", "0.5612274", "0.55896527", "0.55867916", "0.5586642", "0.557737", "0.55721015", "0.557165", "0.5569179", "0.55656123", "0.556293", "0.5549499", "0.5548661", "0.55478525", "0.55413735", "0.5536875", "0.55336684", "0.5528643", "0.5513845", "0.55074716" ]
0.7637797
0
GET /legalissues/1 GET /legalissues/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @legalissues = Legalissue.all\n end", "def issue\n id = params[:issue_id]\n if id\n @issue = Issue.find(id.to_i)\n unless @issue\n render :status => 404, :text => 'Issue not found'\n end\n else\n render :status => 400 , :text => 'Invalid issue_id'\n end\n @journals = @issue.journals.find(:all, :include => [:user, :details], :order => \"#{Journal.table_name}.created_on ASC\")\n @journals.each_with_index {|j,i| j.indice = i+1}\n @journals.reverse! if User.current.wants_comments_in_reverse_order?\n @changesets = @issue.changesets\n @changesets.reverse! if User.current.wants_comments_in_reverse_order?\n @allowed_statuses = @issue.new_statuses_allowed_to(User.current)\n @edit_allowed = User.current.allowed_to?(:edit_issues, @project)\n @priorities = IssuePriority.all\n @time_entry = TimeEntry.new\n @project = @issue.project\n @title = \"#{@project.name}: #{@issue.subject}\"\n\n jsonres = Hash.new\n jsonres[:issue] = @issue\n jsonres[:issue_status] = @issue.status.to_s\n jsonres[:authorName] = @issue.author.to_s\n jsonres[:authorEmail] = @issue.author.mail\n jsonres[:journals] = @journals\n jsonres[:project] = @project\n jsonres[:changesets] = @changesets\n render :json => jsonres.to_json\n end", "def gather_issues\n url = \"#{URL}/projects/foreman/issues.json?status_id=1&limit=100&release_id=#{@current_release_id}\"\n puts url\n uri = URI(URI.escape(url))\n response = Net::HTTP.get(uri)\n JSON.parse(response)\nend", "def index\n @issues = Issue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @issues }\n end\n end", "def index\n @issues = Issue.all\n end", "def index\n @issues = Issue.all\n end", "def index\n @issues = Issue.all\n end", "def index\n @issues = Issue.all\n end", "def index\n @issues = Issue.all\n end", "def index\n @issues = Issue.where({assignee: current_user.github_username})\n\n render json: @issues\n end", "def show\n respond_with(@issue) do |format|\n format.json { render json: @issue.to_json }\n end\n end", "def get_my_issues\n get_json( GITHUB_ISSUES_URL ).each do |item|\n puts \"#{ item[ 'repository' ][ 'full_name' ] }: ##{ item[ 'number' ] } #{ item[ 'title' ] } | href=#{ item[ 'html_url' ] }\"\n end\nend", "def show\n @issue = Issue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @issue }\n end\n end", "def show\n @normal_issue = NormalIssue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @normal_issue }\n end\n end", "def show\n @voucher = Voucher.find(params[:id])\n @issues = @voucher.issues\n\n end", "def show\n @issue = current_repository.issues.find_by(number: params[:number])\n\n if @issue.blank?\n render json: { error: 'Issue not found' }, status: :not_found\n end\n end", "def show\n @important_issue = ImportantIssue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @important_issue }\n end\n end", "def get_issues\n jira_issues = Hash.new\n # This is the REST URL that will be hit. Change the jql query if you want to adjust the query used here\n uri = URI(JIRA_BASE_URL + '/rest/api/2/search?jql=assignee+%3D+currentUser()+AND+status+not+in+(Closed,+Resolved)')\n\n Net::HTTP.start(uri.hostname, uri.port, :use_ssl => uri.scheme == 'https') do |http|\n request = Net::HTTP::Get.new(uri)\n request.basic_auth USERNAME, PASSWORD\n response = http.request request\n # If the response was good, then grab the data\n if response.code =~ /20[0-9]{1}/\n data = JSON.parse(response.body)\n data[\"issues\"].each do |item|\n jira_id = item[\"key\"]\n jira_issues[jira_id] = item[\"fields\"][\"summary\"]\n end\n else\n raise StandardError, \"Unsuccessful response code \" + response.code + \" for issue \" + issue\n end\n end\n return jira_issues\nend", "def show\n @issue = scan.issues.find( params.require( :id ) )\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @issue }\n end\n end", "def show\n @issue = Issue.find(params[:id])\n logger.debug @issue.inspect\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @issue }\n end\n end", "def issues\n @query = Query.new(:name => \"_\")\n @issues = @query.issues(:order => \"issues.created_on desc\", :limit => 50, :include => [:project, :author])\n res = Array.new\n @issues.each do |is|\n res << {:issue_id => is.id, :issue_title => is.subject, :issue_content => is.description, :project_name => is.project.name,\n :author_name => is.author.to_s, :author_email => is.author.mail, :issue_created_at => is.created_on, :issue_status => is.status.to_s }\n end\n render :json => res.to_json\n end", "def set_legalissue\n @legalissue = Legalissue.find(params[:id])\n end", "def issue\n @issue = Issue.find(params[:id])\n end", "def index\n @issues = current_user.issues\n end", "def index\n @issues = Issue.order(\"date DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @issues }\n end\n end", "def show\n @base_issue = BaseIssue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @base_issue }\n end\n end", "def get_issues\n jira_issues = Hash.new\n # This is the REST URL that will be hit. Change the jql query if you want to adjust the query used here\n uri = URI(JIRA_BASE_URL + '/rest/api/2/search?jql=' + JQL)\n\n Net::HTTP.start(uri.hostname, uri.port, :use_ssl => uri.scheme == 'https') do |http|\n request = Net::HTTP::Get.new(uri)\n request.basic_auth USERNAME, PASSWORD\n response = http.request request\n # If the response was good, then grab the data\n if response.code =~ /20[0-9]{1}/\n data = JSON.parse(response.body)\n data[\"issues\"].each do |item|\n jira_id = item[\"key\"]\n jira_issues[jira_id] = item[\"fields\"][\"summary\"]\n end\n else\n raise StandardError, \"Unsuccessful HTTP response code: \" + response.code\n end\n end\n return jira_issues\nend", "def open_issues\n @open_issues = @github.issues.list user: APP_CONF['org'],\n repo: APP_CONF['repo'],\n state: 'all',\n # labels: 'Complete',\n assignee: params[:username]\n render json: @open_issues\n end", "def issue(project, id)\n get(\"/projects/#{url_encode project}/issues/#{id}\")\n end", "def index\n @issues = Issue.filter(\n params.slice(:build_product, :build_branch, \n :build_name, :build_id, :similar_to, :signature, :include_hit_count)\n )\n render json: @issues\n end", "def show\n #@publication = Publication.find(params[:id])\n #@issues = @publication.issues.where( :issue_states => {:name => 'released'})\n #render json: @issues\n\n publication = Publication.find_by_product_code(params[:id])\n\n state = IssueState.find_by_name('Released')\n\n issues = Issue.where(:publication_id => publication, :issue_state_id => state)\n render json: issues.as_json({:except => :pdf_zip})\n\n end", "def gather_issues(status_id, options)\n url = \"#{options[:url]}/issues.json?status_id=#{status_id}&updated_on=#{options[:date]}\" +\n \"&assigned_to_id=#{user_to_id(options[:user])}&limit=100\"\n puts url\n uri = URI(URI.escape(url))\n response = Net::HTTP.get(uri)\n JSON.parse(response)\nend", "def get(*args)\n arguments(args, required: [:user, :repo, :number])\n\n get_request(\"/repos/#{arguments.user}/#{arguments.repo}/issues/#{arguments.number}\", arguments.params)\n end", "def create\n @legalissue = Legalissue.new(legalissue_params)\n\n respond_to do |format|\n if @legalissue.save\n format.html { redirect_to @legalissue, notice: 'Legalissue was successfully created.' }\n format.json { render :show, status: :created, location: @legalissue }\n else\n format.html { render :new }\n format.json { render json: @legalissue.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @issue = Issue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end", "def get_github_issues github_uri\n user,project = get_github_user_project(github_uri)\n url = \"http://github.com/legacy/issues/search/#{user}/#{project}/open/number\"\n $stderr.print url,\"\\n\"\n issues = JSON.parse(Http::get_http_body(url))\n if issues == nil or issues == {}\n $stderr.print \"\\nWARNING: issues link not working!\\n\"\n issues = {\"issues\"=>[]} \n end\n $stderr.print issues['issues'].size, \"\\n\" \n issues['issues']\n end", "def index\n @jira_issues = JiraIssue.all\n end", "def index\n @local_issues = LocalIssue.all\n end", "def all_issues()\n @endpoint = \"/issues.json?limit=100\"\n setup_get\n res = @http.request(@req)\n return JSON.load(res.body)[\"issues\"].sort_by { |issue| issue[\"id\"] }\n end", "def index \n render :json => Project.find(11).bug_tracker.bugs\n end", "def index\n @notice = \"ALL Issues\"\n @@selected_label=nil\n @@found_by=false\n @@assigned_to=false\n get_bugs\n get_count_of_issue\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bugs }\n end\n end", "def issues\n Sifter.\n get(api_issues_url).\n fetch(\"issues\", []).\n map { |i| Sifter::Issue.new(i) }\n end", "def index\n if @issuable\n if @issuable.class.to_s == 'Project'\n @pre_issues = @issuable.issues\n @pre_issues.concat(@issuable.lists.map{|l| l.studies.map{|s| s.issues }}.flatten)\n else\n @pre_issues = @issuable.issues.order('sequential_id DESC')\n end\n else\n @pre_issues = Issue.scoped\n end\n\n @issues = @pre_issues\n \n unless params[:state]\n params[:state] = 'open'\n end\n\n if params[:state] == 'open'\n @issues = @issues.where(closed: false)\n end\n if params[:state] == 'closed'\n @issues = @issues.where(closed: true)\n end\n if params[:creator]\n @issues = @issues.where(creator_id: params[:creator])\n end\n if params[:assignee]\n @issues = @issues.where(assigned_id: params[:assignee])\n end\n if params[:aspect]\n @project = Project.find(params[:aspect])\n @issues = @project.issues\n end\n\n respond_to do |format|\n format.html { render layout: 'fluid' }# index.html.erb\n format.json { render json: @issues }\n end\n end", "def index\n @issues = Issue.all.order(created_at: :desc)\n if @issues.present?\n render :index, status: :ok\n else\n @message = \"no issues found\"\n render :error, status: :not_found\n end\n end", "def index\n @issues = @account.issues.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @issues }\n end\n end", "def get_issue(issue_key)\n url = \"#{@base_url}/rest/api/2/issue/#{issue_key}\"\n result = rest_call(url, \"get\", @login_options)\n log result.inspect\n result\n end", "def show\n github = Github.new\n @issue = github.issues.get(:user => 'rails', :repo => 'rails', :number => params[:id])\n @comments = github.issues.comments.all(:user => 'rails', :repo => 'rails', :issue_id => params[:id]) unless @issue.comments == 0\n\n respond_with(:issue => @issue, :comments => @comments)\n end", "def new\n @important_issue = ImportantIssue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @important_issue }\n end\n end", "def issues_for(year)\n path = \"/besplatni-izdanija.nspx?pYear=#{year}\"\n response = @http.get(path)\n html = ''\n if response.code == '200'\n html = response.body.force_encoding('utf-8')\n else\n raise \"error opening free issue page: #{response.code} #{response.message}\"\n end\n \n results = []\n # get link tag\n re = %r{<a\\s+href\\s*=\\s*\"([^\"]*)\"[^>]*?>\\s*СЛУЖБЕН ВЕСНИК НА РМ бр.\\s*(\\d+)}i\n pos = 0\n while html.index(re, pos)\n results[Regexp.last_match[2].to_i] = Regexp.last_match[1].dup\n pos = Regexp.last_match.end(2).to_i\n end\n\n return nil if results.size == 0\n results\n end", "def index\n if params[:github_name]\n @user = User.find_by_github_name(params[:github_name])\n @issues = @user.issues\n else\n @issues = Issue.all\n end\n end", "def index\n authorize! :read, Issue\n\n respond_to do |format|\n format.html\n format.js\n format.json { render json: IssuesDatatable.new(view_context) }\n end\n end", "def new\n @normal_issue = NormalIssue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @normal_issue }\n end\n end", "def single_issue_request_response(fq_repo_name, issue_id)\n repository_url = \"https://api.github.com/repos/#{fq_repo_name}\"\n {\n \"id\" => issue_id,\n \"url\" => \"https://api.github.com/repos/#{fq_repo_name}/issues/#{issue_id}\",\n \"number\" => issue_id,\n \"repository_url\" => repository_url,\n \"labels\" => [\n {\"name\" => \"bug\"},\n {\"name\" => \"wip\"}\n ]\n }.to_json\n end", "def show\n @fix_issue = FixIssue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @fix_issue }\n end\n end", "def get(issue_id)\n HTTParty.get(url(issue_id))\n end", "def show\n @data = URI.parse(\"https://api.github.com/repos/dylanpavelko/\"+@git_hub_repo.repo+\"/issues\").read\n @structuredResponse = JSON.parse(@data)\n @repoID = @git_hub_repo.id\n @structuredResponse.each do |issue|\n #if issue doesn't already exist\n if GitHubIssue.where(:gitHubID => issue['id']).count == 0\n #create issue for repo and top level node\n @ghIssue = GitHubIssue.new(\n :gitHubID => issue['id'], \n :number => issue['number'],\n :title => issue['title'],\n :created => issue['created_at'],\n :updated => issue['updated_at'],\n :closed => issue['closed_at'],\n :body => issue['body'],\n :repo_id => @repoID,\n :node => @git_hub_repo.node)\n @ghIssue.save\n end\n end\n\n end", "def show\n @issue = @issuable.issues.find(params[:id])\n\n respond_to do |format|\n format.html { render layout: 'fluid' }# show.html.erb\n format.json { render json: @issue }\n end\n end", "def index\n github = Github.new\n #@repo = github.repos.get(:user => \"rails\", :repo => \"rails\")\n @page = (params[:page].nil?) ? 1 : params[:page]\n @issues = github.issues.list(:user => 'rails', :repo => 'rails', :per_page => 25, :page => @page.to_i)\n\n @paging = {page: @page.to_i, totalpages: @issues.count_pages}\n\n respond_with(@issues, @paging)\n end", "def index\n @git_hub_issues = GitHubIssue.all\n end", "def get_issue(number)\n github.issues.get(*github_org_repo, number)\n end", "def show\n headers['Access-Control-Allow-Origin'] = \"*\"\n\n if params[:id]=='0'\n sql=%Q{select * from clavis.issue where manifestation_id=#{params[:manifestation_id]} and start_number notnull order by issue_id desc limit 1;}\n # logger.warn(sql)\n # @clavis_issue = ClavisIssue.all(:order=>'issue_id desc',:limit=>1,:conditions=>{:manifestation_id=>params[:manifestation_id],:start_number=>params[:start_number]})\n @clavis_issue = ClavisIssue.find_by_sql(sql)\n @clavis_issue = @clavis_issue.first if @clavis_issue!=[]\n else\n @clavis_issue = ClavisIssue.find(params[:id])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @clavis_issue }\n end\n end", "def index\n @issues = Issue.search( params[:query]).order('created_at desc').page(params[:page]).per(64)\n end", "def index\n @sub_issues = SubIssue.all\n end", "def query_v3\n if params[:workflow]\n @collection = current_user.workflow_issues\n else\n raise \"not sure what to do here\"\n end\n\n @include_workflow_state = true\n @include_issue_team = true\n @include_issue_tracker = true\n\n render 'api/v2/issues/index'\n end", "def show\n final_params = []\n unless @repo.scans.last == nil\n last_scan_id = @repo.scans.last.id\n final_query_array = [\"SELECT * FROM issues WHERE scan_id = ?\", \"ORDER BY issues.severity DESC\"]\n final_params.push(last_scan_id)\n final_query = final_query_array.join(\" \")\n @issues = Issue.find_by_sql [final_query, *final_params]\n end\n end", "def show\n @issue = @account.issues.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @issue }\n end\n end", "def legalissue_params\n params.require(:legalissue).permit(:name, :issue, :comment, :done)\n end", "def show\n render :json => Project.find(params[:project_id]).bug_tracker.bugs.find(params[:id])\n end", "def show\n @issues = Issue.where(tenant: @tenant)\n end", "def show\n index\n @issue_show = Issue.find(params[:id])\n render :index\n end", "def update\n respond_to do |format|\n if @legalissue.update(legalissue_params)\n format.html { redirect_to @legalissue, notice: 'Legalissue was successfully updated.' }\n format.json { render :show, status: :ok, location: @legalissue }\n else\n format.html { render :edit }\n format.json { render json: @legalissue.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @base_issue = BaseIssue.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @base_issue }\n end\n end", "def show\n @title = Title.find(params[:id])\n @publisher = Publisher.find(@title.publisher_id)\n issue_ids = @title.issues.collect{ |issue| issue.id }\n @issues = Issue.find(issue_ids)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @title }\n end\n end", "def show\n @partner = Partner.find(params[:id])\n @issueable = @partner\n @issues = @issueable.issues\n @issue = Issue.new\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @partner }\n end\n end", "def show\n begin\n @vehicle = Vehicle.find_by_id(params[:id])\n @vin = @vehicle.vin.scan(/.{1,9}/) if @vehicle.vin\n @issues = @vehicle.issues.order(id: :desc)\n @closed_issues = (@issues - @issues.open)\n rescue \n render_404\n end\n end", "def new\n @issue = Issue.new\n\n @new = true\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end", "def issues(created_on: nil, limit: 100, project:nil, status:nil, sort:nil)\n x = {}\n x[:created_on] = created_on if created_on\n x[:limit] = limit if limit\n x[:project_id] = project if project\n x[:status] = status if status\n x[:sort] = sort if sort\n qs = x.empty? ? \"\" : x.reduce(\"?\") { |s,(k,v)| s+=\"#{k}=#{CGI.escape(v.to_s)}&\" }\n return get(\"issues.json\"+qs)\n end", "def new\n @fix_issue = FixIssue.new\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @fix_issue }\n end\n end", "def issue_status\n id = params[:issue_id]\n if id\n issue = Issue.find(id.to_i)\n if issue\n render :status => 200, :text => issue.status.name\n else\n render :status => 404, :text => 'Issue not found'\n end\n else\n render :status => 400 , :text => 'Invalid issue_id'\n end\n end", "def show\n @jira_issue_summary = JiraIssueSummary.get(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @jira_issue_summary }\n end\n end", "def new\n @bug = Bug.new\n @users =Bug.get_users_project(get_project_id)\n get_count_of_issue\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bug }\n end\n end", "def get_issues( url, label )\n\t\tissues = @git.client.issues( url, :per_page => 100 )\n\t\tcleaned_issues = parse_issue_array( issues, label )\n\t\tputs cleaned_issues.inspect\n\t\treturn cleaned_issues\n\tend", "def index\n @issue_types = IssueType.all\n end", "def project_issues(project)\n Issue.where(:project_id=>project.id)\n end", "def index\n @issue_histories = IssueHistory.all\n end", "def find_issue\n # Issue.visible.find(...) can not be used to redirect user to the login form\n # if the issue actually exists but requires authentication\n @issue = Issue.includes(:project, :tracker, :status, :author, :priority, :category).find(params[:issue_id])\n unless @issue.visible?\n deny_access\n return\n end\n @project = @issue.project\n rescue ActiveRecord::RecordNotFound\n render_404\n end", "def get(user, repo_name, id, params={})\n issue_data = @connection.get(\"/repos/#{user}/#{repo_name}/issues/#{id.to_s}\", params)\n GitHubV3API::Issue.new_with_all_data(self, issue_data)\n rescue RestClient::ResourceNotFound\n raise NotFound, \"The issue #{user}/#{repo_name}/issues/#{id} does not exist or is not visible to the user.\"\n end", "def index\n @issue_skills = IssueSkill.all\n render json: @issue_skills\n end", "def get_issue(issue_id)\n issue_resource.find_by_id(issue_id, expand: \"renderedFields\")\n end", "def show\n @conflict_illness = ConflictIllness.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @conflict_illness }\n end\n end", "def destroy\n @legalissue.destroy\n respond_to do |format|\n format.html { redirect_to legalissues_url, notice: 'Legalissue was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def issues\n if @issues.nil?\n @issues = {}\n max_result = 3\n jql = \"/rest/api/2/search?jql=project=\\\"#{name}\\\" AND issuetype NOT IN (Epic, Sub-task)&expand=changelog&maxResults=#{max_result}\"\n #r = nil\n #without_cache{ r = self.class.get(\"#{jql}&startAt=0\") }\n r = self.class.get(\"#{jql}&startAt=0\")\n pages = (r['total'] / max_result)\n (0..pages).each do |current_page|\n begin\n # If you can get the latest version of the last page, do so, otherwise load the cached version\n query = \"#{jql}&startAt=#{(current_page * max_result)}\"\n if current_page == pages\n #without_cache{ r = self.class.get(query) }\n # else\n r = self.class.get(query)\n end\n r['issues'].each do |issue|\n # Cast raw response to Issue(), passing project reference into constructor\n issue['project'] = self\n @issues[issue['key']] = Issue.new(issue)\n end\n # rescue => exception\n # puts \"#{exception.message} (#{exception.class})\"\n # pp exception.backtrace\n end\n end\n end\n @issues\n end", "def index\n @problems = Problem.active.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @problems }\n end\n end", "def get_closed_prs(client)\n # search for GitHub issues and sort search results\n pull_requests = client.search_issues(\"state:closed author:santos22 type:pr\", options = {sort: \"created\", order: \"asc\"})\n\n result = pull_requests.to_h\n pr_info = result.to_json\n pr_arr = JSON.parse(pr_info)\n data = pr_arr['items'].map { |pr| PullRequest.new(pr['title'], pr['html_url'], format_date(pr['closed_at']) , pr['comments']) }\n\n # return response\n headers['Access-Control-Allow-Origin'] = '*'\n content_type :json\n data.to_json\nend", "def show\n @solution = @idea.solutions.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @solution }\n end\n end", "def get_all_master_issues\n Octokit.list_issues(\"department-of-veterans-affairs/appeals-support\", direction: \"asc\", state: \"all\")\n end", "def get_all_master_issues\n Octokit.list_issues(\"department-of-veterans-affairs/appeals-support\", direction: \"asc\", state: \"all\")\n end", "def index\n @problems = Problem.all\n\n render json: @problems\n end", "def get_issues(label='',mode)\n debug_msg(\"get_issues: #{label}\",3)\n case mode\n when 'inclusive'\n uri = URI.parse(JIRA_BASE_URL + \"/rest/api/2/search?jql=assignee+%3D+currentUser()+AND+status+not+in+(Closed,+Resolved)+AND+labels+in(#{label})\")\n debug_msg(uri,9)\n when 'exclusive'\n uri = URI.parse(JIRA_BASE_URL + \"/rest/api/2/search?jql=assignee+%3D+currentUser()+AND+status+not+in+(Closed,+Resolved)+AND+labels+not+in(#{label})\")\n debug_msg(uri,9)\n else\n raise StandardError \"mode has an unsupported value: #{mode}. should be 'inclusive' or 'exclusive'\"\n end\n jira_issues = Hash.new\n j_issue = Hash.new\n # This is the REST URL that will be hit. Change the jql query if you want to adjust the query used here\n # uri = URI.parse(JIRA_BASE_URL + \"/rest/api/2/search?jql=assignee+%3D+currentUser()+AND+status+not+in+(Closed,+Resolved)+AND+labels+in(#{label})\")\n\n Net::HTTP.start(uri.hostname, uri.port, :use_ssl => uri.scheme == 'https') do |http|\n request = Net::HTTP::Get.new(uri.request_uri)\n debug_msg(request,10)\n request.basic_auth(\"#{USERNAME}\", \"#{PASSWORD}\")\n response = http.request (request)\n debug_msg(response,10)\n # If the response was good, then grab the data\n if response.code =~ /20[0-9]{1}/\n data = JSON.parse(response.body)\n debug_msg(\"DATA: #{data}\",9)\n data[\"issues\"].each do |item|\n debug_msg(\"ITEM: #{item}\",10)\n jira_id = item[\"key\"]\n j_id = item['key']\n j_issue[j_id] = Hash.new\n j_issue[j_id]['status'] = item['fields']['status']['name']\n j_issue[j_id]['summary'] = item['fields']['summary']\n# p item\n# p \"-----------------------------------------\"\n# binding.pry;\n summary_status = '[' + item['fields']['status']['name']+ '] '+item['fields']['summary']\n# jira_issues[jira_id] = item['fields']['summary']\n# jira_issues[jira_id] = item['fields']['status']['name']\n# jira_issues[jira_id].['summary'] = item['fields']['summary']\n# jira_issues[jira_id].['status'] = item['fields']['status']['name']\n jira_issues[jira_id] = item['fields']['summary']\n\n # binding.pry;\n end\n else\n raise StandardError, \"Unsuccessful response code \" + response.code + \" for #{label} \"\n end\n end\n #return jira_issues\n return j_issue\nend", "def get_all_incident_issues\n response = Octokit.list_issues(\"department-of-veterans-affairs/appeals-support\", direction: \"asc\", state: \"open\")\n response.reject { |v| v[:created_at] >= 10.days.ago }\n end", "def get_all_incident_issues\n response = Octokit.list_issues(\"department-of-veterans-affairs/appeals-support\", direction: \"asc\", state: \"open\")\n response.reject { |v| v[:created_at] >= 10.days.ago }\n end" ]
[ "0.7498894", "0.67790335", "0.6697155", "0.6615499", "0.65039104", "0.65039104", "0.65039104", "0.65039104", "0.65039104", "0.6468243", "0.63978815", "0.63960963", "0.63843143", "0.63695896", "0.6331499", "0.62996495", "0.6282418", "0.6257719", "0.624164", "0.6239917", "0.6209608", "0.6206411", "0.6195645", "0.6176204", "0.612335", "0.61089367", "0.61050963", "0.6103478", "0.6097593", "0.6083743", "0.60740703", "0.60662794", "0.6045713", "0.60440993", "0.602799", "0.60278296", "0.60252076", "0.6015074", "0.60126203", "0.6011497", "0.6007908", "0.60007715", "0.59978247", "0.5994238", "0.59905297", "0.59700096", "0.5967118", "0.5960537", "0.5948859", "0.5946968", "0.59411323", "0.5938621", "0.59259236", "0.5914913", "0.5902958", "0.58929545", "0.58745795", "0.5871377", "0.58623827", "0.5859599", "0.5853591", "0.58481735", "0.58413833", "0.5838364", "0.58380276", "0.58302605", "0.5828957", "0.5820155", "0.5805641", "0.5804211", "0.5788402", "0.57743376", "0.5771881", "0.57711107", "0.5770031", "0.57697856", "0.57571286", "0.5747783", "0.5728869", "0.5668943", "0.56683916", "0.56678355", "0.5662892", "0.5653497", "0.564272", "0.5639761", "0.56372875", "0.5622605", "0.56199", "0.5618648", "0.56117636", "0.5606974", "0.56055963", "0.5605081", "0.5599564", "0.55960816", "0.55960816", "0.5592939", "0.5591515", "0.5586998", "0.5586998" ]
0.0
-1
POST /legalissues POST /legalissues.json
def create @legalissue = Legalissue.new(legalissue_params) respond_to do |format| if @legalissue.save format.html { redirect_to @legalissue, notice: 'Legalissue was successfully created.' } format.json { render :show, status: :created, location: @legalissue } else format.html { render :new } format.json { render json: @legalissue.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def legalissue_params\n params.require(:legalissue).permit(:name, :issue, :comment, :done)\n end", "def create\n @issue = Issue.new(issue_params)\n\n respond_to do |format|\n if @issue.save\n format.html { redirect_to issues_url, notice: 'Issue was successfully created.' }\n format.json { render json: @issue }\n else\n format.html { redirect_to issues_url, notice: 'There was a problem saving your issue. Do you need a tissue?' }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @legalissues = Legalissue.all\n end", "def create\n @issue = Issue.new(issue_params)\n @issue.status=\"Open\"\n @issue.resolution=\"\"\n\n respond_to do |format|\n if @issue.save\n format.html { redirect_to @issue, notice: 'Issue was successfully created.' }\n format.json { render action: 'show', status: :created, location: @issue }\n else\n format.html { render action: 'new' }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @issue = Issue.new(issue_params)\n\n respond_to do |format|\n if @issue.save\n format.html { redirect_to :success, notice: 'Issue was successfully created.' }\n format.json { render json: @issue }\n else\n format.html { render :new }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @issue = Issue.new(issue_params)\n\n respond_to do |format|\n if @issue.save\n format.html { redirect_to @issue, notice: 'Issue was successfully created.' }\n format.json { render :show, status: :created, location: @issue }\n else\n format.html { render :new }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @issue = Issue.new(issue_params)\n\n respond_to do |format|\n if @issue.save\n format.html { redirect_to @issue, notice: 'Issue was successfully created.' }\n format.json { render :show, status: :created, location: @issue }\n else\n format.html { render :new }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @issue = Issue.new(issue_params)\n\n respond_to do |format|\n if @issue.save\n format.html { redirect_to @issue, notice: 'Issue was successfully created.' }\n format.json { render :show, status: :created, location: @issue }\n else\n format.html { render :new }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @issue = Issue.new(issue_params)\n\n respond_to do |format|\n if @issue.save\n format.html { redirect_to @issue, notice: 'Issue was successfully created.' }\n format.json { render :show, status: :created, location: @issue }\n else\n format.html { render :new }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @issue = Issue.new(params[:issue])\n\n respond_to do |format|\n if @issue.save\n format.html { redirect_to @issue, notice: 'Issue was successfully created.' }\n format.json { render json: @issue, status: :created, location: @issue }\n else\n format.html { render action: \"new\" }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_issue(issue)\n proj = issue[\"project\"][\"name\"]\n cat = issue[\"category\"] ? issue[\"category\"][\"name\"] : nil\n id = issue[\"id\"]\n subject = issue[\"subject\"]\n description = issue[\"description\"]\n author = issue[\"author\"][\"name\"]\n # author_slack = Utils.convert_redmine_name_to_slack author\n assigned_to = issue[\"assigned_to\"] ? issue[\"assigned_to\"][\"name\"] : :not_assigned\n assigned_to_slack = Utils.convert_redmine_name_to_slack assigned_to\n tracker = issue[\"tracker\"][\"name\"]\n url = SlackAPI.url(issue_url(id), \"##{id}\")\n # updated = issue[\"updated_on\"]\n created = issue[\"created_on\"]\n\n description = RedmineSlackGlue.convert_textile_to_markdown(description.gsub(/\\n\\n/,\"\\n\"))\n color = RedmineSlackGlue.priority_to_color(issue[\"priority\"][\"id\"])\n\n puts \"#{issue[\"priority\"][\"id\"]} #{created} #{proj} ##{id} #{cat} #{subject}\" if self.verbose\n\n cat = RedmineSlackGlue.convert_category(cat)\n\n @slack_api.post({\n :channel => \"##{proj.downcase}\",\n :text => \"#{assigned_to_slack}: Ticket #{url} *#{subject}* - #{tracker}#{cat}\",\n :attachments => [{\n :fallback => RedmineSlackGlue.clean_markup(description),\n :color => color,\n :text => description,\n :mrkdwn_in=> [\"text\"]\n }],\n :username => \"#{author}\",\n :icon_url => REDMINE_ICON_URL\n })\n end", "def create\n @issue = Issue.new(issue_params)\n\n respond_to do |format|\n if @issue.save\n format.html { redirect_to :back, notice: 'Issue was successfully created.' }\n format.json { render :show, status: :created, location: @issue }\n else\n format.html { render :new }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def solution_params\n params.require(:solution).permit(:issue_id, :description)\n end", "def create\n @issue = @issuable.issues.new(params[:issue])\n\n respond_to do |format|\n if @issue.save\n track_activity(@issuable, 'open', nil, @issue)\n format.html { redirect_to [@issuable, @issue], notice: 'Issue was successfully created.' }\n format.json { render json: @issue, status: :created, location: @issue }\n else\n format.html { render layout: 'form', action: \"new\" }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @normal_issue = NormalIssue.new(params[:normal_issue])\n\n respond_to do |format|\n if @normal_issue.save\n format.html { redirect_to @normal_issue, notice: 'Normal issue was successfully created.' }\n format.json { render json: @normal_issue, status: :created, location: @normal_issue }\n else\n format.html { render action: \"new\" }\n format.json { render json: @normal_issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_issue(issue_obj)\n @endpoint = \"/issues.json\"\n setup_post\n @req_obj = {\"issue\" => issue_obj}\n req_obj_to_json_body\n res = @http.request(@req)\n return JSON.load(res.body)[\"issue\"][\"id\"]\n end", "def create_ticket\n jiraPair = @defect.getJiraList\n mapping = jiraAPIMapping\n payload = {\n :fields =>\n {:project =>\n {:key => \"#{jiraPair['Project']}\"},\n :summary => jiraPair['Summary'] + \" (#{@defect.get_story})\",\n :description => Sanitize.clean(jiraPair['Description']),\n mapping['Release Milestone'] => {:value => jiraPair['Release Milestone']},\n :customfield_10143 => [{:value => jiraPair['Environment'],}],\n :issuetype => {:name => jiraPair['issuetype']},\n mapping['Functional Group'] => {:value => jiraPair['Functional Group']},\n mapping['Project Manager'] => {:value => jiraPair['Project Manager']},\n :versions => [{:name => \"#{jiraPair['Release']}\",}],\n },\n }\n\n response = self.class.post('/rest/api/latest/issue/',\n :body => payload.to_json,\n :headers => {'Content-Type' => 'application/json' },\n :verify => false)\n\n url = \"\"\n if response['key']\n url = $JIRA['base_uri'] + \"/browse/\" + response['key']\n @defect.setJiraLink(url)\n else\n errormsg = \"Error (#{@defect.get_story}): #{response}\"\n p errormsg\n @defect.setDefectError(errormsg)\n end\n\n return url\n end", "def create\n respond_to do |format|\n if issue.save\n format.html { redirect_to issue, notice: 'Issue was successfully created.' }\n format.json { render action: 'show', status: :created, location: issue }\n else\n format.html { render action: 'new' }\n format.json { render json: issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @issue = Issue.new(params[:issue])\n\n respond_to do |format|\n if @issue.save\n format.html { redirect_to issues_path, notice: 'O assunto foi criado com sucesso.' }\n else\n format.html { render action: \"new\" }\n end\n end\n end", "def create\n @issue = Issue.new(issue_params)\n @issue.userCreator = current_user.id\n @issue.idUserAssignee = current_user.id\n @issue.votes = 0\n @issue.creationDate = Time.now\n @issue.updated = Time.now\n @issue.status = 'NEW'\n respond_to do |format|\n if @issue.save\n format.html { redirect_to @issue, notice: 'Issue was successfully created.' }\n format.json { render :show, status: :created, location: @issue }\n else\n format.html { render :new }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @appissue = Appissue.new(appissue_params)\n\n respond_to do |format|\n if @appissue.save\n format.html { redirect_to @appissue, notice: 'Appissue was successfully created.' }\n format.json { render :show, status: :created, location: @appissue }\n else\n format.html { render :new }\n format.json { render json: @appissue.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @jira_issue = JiraIssue.new(jira_issue_params)\n\n respond_to do |format|\n if @jira_issue.save\n format.html { redirect_to @jira_issue, notice: 'Jira issue was successfully created.' }\n format.json { render :show, status: :created, location: @jira_issue }\n else\n format.html { render :new }\n format.json { render json: @jira_issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @local_issue = LocalIssue.new(local_issue_params)\n\n respond_to do |format|\n if @local_issue.save\n format.html { redirect_to @local_issue, notice: 'Local issue was successfully created.' }\n format.json { render :show, status: :created, location: @local_issue }\n else\n format.html { render :new }\n format.json { render json: @local_issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def issue_params\n params.require(:issue).permit(:title, :description, :url, :lat, :lng, :status, :organisation, :tag_list)\n end", "def create\n@conference=Conference.find(params[:conference_id])\n@issue=@conference.issues.create(params[:issue])\n\tredirect_to conference_path(@conference)\nend", "def issue_params\n params.require(:issue).permit(:description, :status, :resolution, :thermostat_id)\n end", "def create\n @important_issue = ImportantIssue.new(params[:important_issue])\n\n respond_to do |format|\n if @important_issue.save\n format.html { redirect_to @important_issue, notice: 'Important issue was successfully created.' }\n format.json { render json: @important_issue, status: :created, location: @important_issue }\n else\n format.html { render action: \"new\" }\n format.json { render json: @important_issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def issue_params\n params.require(:issue).permit(:title, :description, :received, :progressing, :resolved)\n end", "def native_issue_params\n params.require(:native_issue).permit(:summary, :description, :enhancement, :issue_with_id, \n :resolved_with_id, :close_without_resolution, :asana_id, :asana_url, :asana_workspace_id, :asana_name, :added_by_id)\n end", "def create\n @git_hub_issue = GitHubIssue.new(git_hub_issue_params)\n\n respond_to do |format|\n if @git_hub_issue.save\n format.html { redirect_to @git_hub_issue, notice: 'Git hub issue was successfully created.' }\n format.json { render :show, status: :created, location: @git_hub_issue }\n else\n format.html { render :new }\n format.json { render json: @git_hub_issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def issue_params\n params.require(:issue).permit(:retro_id, :issue_type, :creator_id, :description)\n end", "def create\n @risk = Risk.new(params[:risk])\n respond_to do |format|\n if @risk.save\n format.html { redirect_to :controller => \"issues\" }\n else\n format.html { redirect_to :controller => \"issues\" }\n end\n end\n end", "def issue_params\n # params[:issue]\n params.require(:issue).permit(\n :date,\n :note,\n {pictures: []}, \n :address_id,\n :home_owner_id, \n :issue_category_id,\n :issue_status_category_id\n )\n end", "def create\n@conference=Conference.find(params[:conference_id])\n #@issue = @conference.issues.new(params[:issue])\n@issue = @conference.issues.create(params[:issue])\n respond_to do |format|\n if @issue.save\n format.html { redirect_to [@conference,@issue], notice: 'Issue was successfully created.' }\n format.json { render json: @issue, status: :created, location: @issue }\n else\n format.html { render action: \"new\" }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def issue_params\n params.require(:issue).permit(:title, :severity, :description, :customtargets, :rating, :recommendation, :type,\n :index)\n end", "def post_ticket(params)\n ticket = Lighthouse::Ticket.new(:project_id => project_id)\n ticket.title = params[:title]\n ticket.body = params[:body]\n ticket.tags = params[:tags]\n ticket.save\n end", "def create\n @unsolved = Unsolved.new(unsolved_params)\n respond_to do |format|\n if @unsolved.save\n format.html { redirect_to @unsolved, notice: 'Unsolved problem was successfully added.' }\n format.json { render json: @unsolved, status: :created, location: @unsolved }\n end\n end\n end", "def create\n verify_post_request\n verify_ajax_request\n\n component_key = params[:component]\n if Api::Utils.is_integer?(component_key)\n component = Project.find(component_key)\n component_key = (component ? component.key : nil)\n end\n\n issue_result = Internal.issues.create(params.merge({:component => component_key}))\n if issue_result.ok\n @issue_results = Api.issues.find(issue_result.get.key)\n render :partial => 'issue/manual_issue_created', :locals => {:issue => @issue_results.first}\n else\n render :partial => 'shared/result_messages', :status => 500, :locals => {:result => issue_result}\n end\n end", "def issue\n id = params[:issue_id]\n if id\n @issue = Issue.find(id.to_i)\n unless @issue\n render :status => 404, :text => 'Issue not found'\n end\n else\n render :status => 400 , :text => 'Invalid issue_id'\n end\n @journals = @issue.journals.find(:all, :include => [:user, :details], :order => \"#{Journal.table_name}.created_on ASC\")\n @journals.each_with_index {|j,i| j.indice = i+1}\n @journals.reverse! if User.current.wants_comments_in_reverse_order?\n @changesets = @issue.changesets\n @changesets.reverse! if User.current.wants_comments_in_reverse_order?\n @allowed_statuses = @issue.new_statuses_allowed_to(User.current)\n @edit_allowed = User.current.allowed_to?(:edit_issues, @project)\n @priorities = IssuePriority.all\n @time_entry = TimeEntry.new\n @project = @issue.project\n @title = \"#{@project.name}: #{@issue.subject}\"\n\n jsonres = Hash.new\n jsonres[:issue] = @issue\n jsonres[:issue_status] = @issue.status.to_s\n jsonres[:authorName] = @issue.author.to_s\n jsonres[:authorEmail] = @issue.author.mail\n jsonres[:journals] = @journals\n jsonres[:project] = @project\n jsonres[:changesets] = @changesets\n render :json => jsonres.to_json\n end", "def create\n # create issues and attach them to the project found by title\n # Project.find_by_title(params{issue: {summary: \"text\", status: \"text\", description: \"text\"}}\n Project.find_by_title(params[:title]).issues.create!(\n summary: params[:summary], \n description: params[:description],\n status: params[:status])\n\n # Project.find_by_title(params[:title]).issues.create!(issue_params)\n # Project.find_by_title(params[:title]).issues.create!(\n # summary: params[:summary], \n # description: params[:description], \n # status: params[:status])\n redirect_to issues_url\n end", "def create\n @sub_issue = SubIssue.new(sub_issue_params)\n\n respond_to do |format|\n if @sub_issue.save\n format.html { redirect_to @sub_issue, notice: 'Sub issue was successfully created.' }\n format.json { render :show, status: :created, location: @sub_issue }\n else\n format.html { render :new }\n format.json { render json: @sub_issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_issue\n logger.info \"Creating new issue in project #{project.jira_project}: #{pull_request.title}\"\n\n jira_issue = PuppetLabs::Jira::Issue.build(client, project)\n fields = PuppetLabs::Jira::Formatter.format_pull_request(pull_request)\n\n jira_issue.create(fields[:summary], fields[:description])\n link_issue(jira_issue)\n\n logger.info \"Created jira issue with webhook-id #{pull_request.identifier}\"\n rescue PuppetLabs::Jira::APIError => e\n logger.error \"Failed to save #{pull_request.title}: #{e.message}\"\n end", "def new\n @issue = @issuable.issues.new\n @issue.comments.build\n\n respond_to do |format|\n format.html { render layout: 'form' }# new.html.erb\n format.json { render json: @issue }\n end\n end", "def issue_params\n \t\tparams.require(:issue).permit(:description, :location, :tenant_notes, :status, :priority, :building_id, :user_id, :contractor_id, :admin_notes)\n\tend", "def issue_params\n params.require(:issue).permit(:title, :url, :labels, :project_id)\n end", "def new\n @issue = Issue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end", "def new\n @fix_issue = FixIssue.new\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @fix_issue }\n end\n end", "def create\n @book_issue = BookIssue.new(book_issue_params)\n\n respond_to do |format|\n if @book_issue.save\n format.html { redirect_to @book_issue, notice: 'Book issue was successfully created.' }\n format.json { render :show, status: :created, location: @book_issue }\n else\n format.html { render :new }\n format.json { render json: @book_issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @issue = Issue.new\n\n @new = true\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end", "def issue_params\n params.require(:issue).permit(:subject, :description, :status,\n :due_date, :user_id, :category_id, :project_id)\n end", "def create\n @issue = Issue.new(issue_params)\n @issue.user_id = current_user.id \n respond_to do |format|\n if @issue.save\n format.html { redirect_to @issue, notice: 'Issue was successfully created.' }\n format.json { render :show, status: :created, location: @issue }\n else\n format.html { render :new }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @issue = Issue.new(params[:issue])\n\n respond_to do |format|\n if @issue.save\n flash[:notice] = 'Issue was successfully created.'\n format.html { redirect_to(@issue) }\n format.xml { render :xml => @issue, :status => :created, :location => @issue }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @issue.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @normal_issue = NormalIssue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @normal_issue }\n end\n end", "def set_legalissue\n @legalissue = Legalissue.find(params[:id])\n end", "def destroy\n @legalissue.destroy\n respond_to do |format|\n format.html { redirect_to legalissues_url, notice: 'Legalissue was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create_issue(summary, params = {})\n params[:summary] = summary\n post('issues', params)\n end", "def create\n #@feedback = Feedback.find(params[:feedback_id])\n #@issue.feedback_id = @feedback.id\n @issue = Issue.new(params[:issue])\n @tester = Tester.find(current_tester)\n @issue.tester_id = @tester.id\n @issue.approvalstatus = \"Waiting for Approval\"\n\n respond_to do |format|\n if @issue.save\n format.html { redirect_to projects_tester_path(@issue), notice: 'Issue was successfully created.' }\n format.json { render json: @issue, status: :created, location: @issue }\n else\n format.html { render action: \"new\" }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def issue_params\n params.require(:issue).permit(:title, :body, :project_id)\n end", "def issue_params\n params.require(:issue).permit(:title, :description, :status, :category, :estimated_time, :priority, :estimated_end_date,\n :estimated_start_date, :actual_start_date, :actual_end_date, :reviewer_id, :creator_id, :assignee_id, :project_id)\n end", "def create\n #@feedback = Feedback.find(params[:feedback_id])\n #@issue.feedback_id = @feedback.id\n @issue = Issue.new(params[:issue])\n @tester = Tester.find(current_tester)\n @issue.tester_id = @tester.id\n @issue.approvalstatus = \"Waiting for Approval\"\n\n\n respond_to do |format|\n if @issue.save\n format.html { redirect_to projects_path, notice: 'Issue was successfully created.' }\n format.json { render json: @issue, status: :created, location: @issue }\n else\n format.html { render action: \"new\" }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @legalissue.update(legalissue_params)\n format.html { redirect_to @legalissue, notice: 'Legalissue was successfully updated.' }\n format.json { render :show, status: :ok, location: @legalissue }\n else\n format.html { render :edit }\n format.json { render json: @legalissue.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @important_issue = ImportantIssue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @important_issue }\n end\n end", "def create\n @issue = Issue.new(params[:issue])\n respond_to do |format|\n if @issue.save\n format.html { redirect_to(:action => \"index\", :notice => 'Issue was successfully created.') }\n format.xml { render :xml => @issue, :status => :created, :location => @issue }\n else\n format.html { redirect_to(:action => \"index\") }\n flash[:error] = ''\n @issue.errors.each_full do |msg|\n if flash[:error] == ''\n flash[:error] += msg\n else\n flash[:error] += \"<br />\" + msg\n end\n end\n end\n end\n end", "def create\n @issue_type = IssueType.new(issue_type_params)\n\n respond_to do |format|\n if @issue_type.save\n format.html { redirect_to @issue_type, notice: 'Issue type was successfully created.' }\n format.json { render :show, status: :created, location: @issue_type }\n else\n format.html { render :new }\n format.json { render json: @issue_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def bug_params\n params.require(:bug).permit(:title, :deadline, :issue_type, :status, :bug_image)\n end", "def issue_params\n params.require(:issue).permit(:name, :description, :issue_status_id, :user_id, :project_id)\n end", "def create\n @legalstatus = Legalstatus.new(legalstatus_params)\n\n respond_to do |format|\n if @legalstatus.save\n format.html { redirect_to @legalstatus, notice: 'Legalstatus was successfully created.' }\n format.json { render :show, status: :created, location: @legalstatus }\n else\n format.html { render :new }\n format.json { render json: @legalstatus.errors, status: :unprocessable_entity }\n end\n end\n end", "def appissue_params\n params.require(:appissue).permit(:uuid, :yourname, :originalmeet, :issueid, :meetingname, :structurecode, :county, :district, :status, :issuedistrict, :community, :category, :raisedby, :disputant, :duration, :actioncommittee, :actiondescription, :actionnote, :resolved, :resolutiondate, :docslink, :updatetype, :resolutiontype, :updated_on, :updatedesc, :mediationdate, :mediationoutcome, :issuedesc, :issuename, :issuenote, :statusnote)\n end", "def issue_params\n params.require(:issue)\n .permit(:name, :code, :url, :company, :base_unit, :trade_unit)\n end", "def create\n @issue = Issue.new(issue_params)\n @issue.retro_id = params[:retro_id]\n @issue.creator_id = current_user.id\n @retro = Retro.find(params[:retro_id])\n respond_to do |format|\n if @issue.save\n\n format.html { redirect_to @retro }\n @index = Issue.where(\"retro_id = #{params[:retro_id]} AND issue_type = '#{@issue.issue_type}'\").order('votes_count DESC').index @issue\n format.json { render json: {issue: @issue,\n retro: @retro,\n index: @index,\n creator_name: current_user.name,\n issue_type: @issue.type_to_int,\n method: \"POST\" } }\n Pusher.trigger('retro_channel', 'create-issue-event', {issue: @issue,\n retro: @retro,\n index: @index,\n creator_name: current_user.name,\n issue_type: @issue.type_to_int,\n method: \"POST\" } )\n else\n flash[:error] = @issue.errors\n format.html { render :new }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @legal_entity = LegalEntity.new(legal_entity_params)\n\n respond_to do |format|\n if @legal_entity.save\n format.html { redirect_to @legal_entity, notice: 'Legal entity was successfully created.' }\n format.json { render :show, status: :created, location: @legal_entity }\n else\n format.html { render :new }\n format.json { render json: @legal_entity.errors, status: :unprocessable_entity }\n end\n end\n end", "def issue_params\n params.require(:issue).permit(:description, :reported_date, :software_version, :reporter_name, :severity, :title, :github_issue_number_reference, :customer_id, :status, :user_id)\n end", "def issue_params\n params.require(:issue).permit(:id, :summary, :status, :description, :address, :image_full)\n end", "def create\n @issue = Issue.new(params[:id])\n project = Project.find(params[:project_id])\n @issue.project_id = project.id\n @issue.resolved = 0\n @issue.title = params[:issue][:title]\n @issue.description = params[:issue][:description]\n\n if @issue.save\n flash[:notice] = \"Your Issue was Added\"\n redirect_to(:controller => \"projects\", :action => 'show', :id => project)\n else\n flash[:error] = \"Error in Saving. Please retry.\"\n render action: \"new\"\n end\n end", "def create\n @tissue = Tissue.new(tissue_params)\n\n respond_to do |format|\n if @tissue.save\n format.html { redirect_to @tissue, notice: 'Tissue was successfully created.' }\n format.json { render :show, status: :created, location: @tissue }\n else\n format.html { render :new }\n format.json { render json: @tissue.errors, status: :unprocessable_entity }\n end\n end\n end", "def issue_params\n params.require(:issue).permit(:subject, :description, :due_date, custom_field_values: (1..6).map(&:to_s)).merge(project_id: REDMINE_PROJECT, tracker: \"Data Request\", status: \"New\")\n end", "def submit_issue\n if params[:description] == ''\n redirect_to :back, flash: { error: 'Please fill out all required fields.' }\n else\n response = GithubInterface.send_issue(params)\n if response.code == '201'\n redirect_to root_path, flash: { success: 'Issue submitted successfully.' }\n else\n redirect_to root_path, flash: { error: JSON.parse(response.body)['message'] }\n end\n end\n end", "def create\n @issue_area = IssueArea.new(issue_area_params)\n\n respond_to do |format|\n if @issue_area.save\n format.html { redirect_to @issue_area, notice: 'Issue area was successfully created.' }\n format.json { render :show, status: :created, location: @issue_area }\n else\n format.html { render :new }\n format.json { render json: @issue_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def issue_params\n params.require(:issue).permit(:companyid, :companyname, :sicdescription, :price, :sharesout, :sharesheld, :numholders, :industryid, :industry, :sectorid, :sector, :type, :querydate, :issuetitle, :isprimary, :activeonly, :ticker, :exchangeid, :exchange, :cik, :sic, :street1, :street2, :city, :state, :zip, :country, :phonecountrycode, :phoneareacode, :phonenumber, :sharesoutdate, :pricedate, :numbernewholders, :numbuyers, :numsellers, :numbersellouts)\n end", "def issue_params\n params.require(:issue).permit(:image_url, :location, :title, :description, :resolved, :resolved_notes, :user_id)\n end", "def create\n @bug = @project.bugs.new(bug_params.merge!(user_status: current_user))\n respond_to do |format|\n if @bug.save\n send_slack_notification ( {create: true} )\n format.html { redirect_to [@project, @bug], notice: 'Bug was successfully created.' }\n format.json { render :show, status: :created, location: @bug }\n else\n format.html { render :new }\n format.json { render json: @bug.errors, status: :unprocessable_entity }\n end\n end\n end", "def issue_params\n params.require(:issue).permit( :lat, :lng, :description, :category)\n end", "def create\n @issue = Issue.new(issue_params)\n @issue.author =@logged_user\n\n\n respond_to do |format|\n if @issue.save\n format.html { redirect_to issues_url, notice: 'Нарушение успешно добавлено, №'+@issue.id.to_s }\n format.json { render :show, status: :created, location: @issue }\n else\n format.html { render :new }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(query)\n load_token\n load_current_repo\n result = post(\"/repos/#{@current_repo}/issues?access_token=#{@token}\", query)\n puts result\n end", "def bug_params\n params.require(:bug).permit(:title, :deadline, :kind, :screenshot, :status,:description)\n end", "def create\n @item = Issue.find_by_url(params[:issue_url])\n\n if @item\n response.status = :ok\n else\n # Find or create Tracker\n tracker = Tracker.find_by_url(params[:project_url])\n tracker ||= Tracker.create!(\n url: params[:project_url],\n name: params[:project_name]\n )\n\n @item = tracker.issues.create!(\n url: params[:issue_url],\n title: params[:title],\n number: params[:number]\n )\n\n response.status = :created\n end\n\n render 'api/v2/issues/show'\n end", "def create\n @issue = Issue.new(params[:issue])\n\n respond_to do |format|\n if @issue.save\n # expire_action(:controller => \"/issue\", :action => \"toc\")\n format.html { redirect_to [:admin, @issue], notice: 'Issue was successfully created.' }\n format.json { render json: @issue, status: :created, location: @issue }\n else\n format.html { render action: \"new\" }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def sub_issue_params\n params.require(:sub_issue).permit(:name, :description, :status, :team_member_id, :project_id, :organization_id, :team_id, :issue_id)\n end", "def new_issue(issue)\n @issue = issue\n\n mail subject: \"New Issue Ticket\"\n end", "def issue_params\n params.require(:issue).permit(:title, :closed, :comments_attributes => [:body])\n end", "def issue_params\n params.require(:issue).permit(:text, :state)\n end", "def new\n @issue.state = 'Open'\n @issue.issue_type = 'Malfunction'\n @issue.comments.build\n\n respond_to do |format|\n format.html\n format.js\n end\n end", "def issue_params\n params.require(:issue).permit(:place_id, :summary, :status, :description, :address, :scf_image_url, :lat, :lng, \n :geofence_radius, :custom_image, :question, :answer1, :answer2, :answer3, :answer4, :answer5, :answer6 )\n end", "def create\n @ticket.save\n\n respond_with(@story, @ticket)\n end", "def new_issue(title)\n result = YAML.load(RestClient.post(\"https://github.com/api/v2/yaml/issues/open/#{@repository}\", :login => @username,\n :token => @api_token, :title => title))\n result[\"issue\"][\"number\"]\n end", "def create\n @issue_type = IssueType.new(issue_type_params)\n @issue_types = IssueType.all\n @issue_type.save\n @issue_type = IssueType.new\n redirect_to new_issue_type_path\n flash[:notice] = \"Saved Successfully\"\n end", "def new\n @issue = Issue.new\n @issue.copy_from(params[:copy_from]) if params[:copy_from]\n @issue.project = @project\n @issue.user_story_id = params[:user_story_id] unless params[:user_story_id].blank? \n # Tracker must be set before custom field values\n @issue.tracker ||= @project.trackers.find((params[:issue] && params[:issue][:tracker_id]) || params[:tracker_id] || :first)\n if @issue.tracker.nil?\n render_error l(:error_no_tracker_in_project)\n return\n end\n if params[:issue].is_a?(Hash)\n @issue.attributes = params[:issue]\n @issue.watcher_user_ids = params[:issue]['watcher_user_ids'] if User.current.allowed_to?(:add_issue_watchers, @project)\n end\n @issue.author = User.current\n\n default_status = IssueStatus.default\n unless default_status\n render_error l(:error_no_default_issue_status)\n return\n end\n @issue.status = default_status\n @allowed_statuses = ([default_status] + default_status.find_new_statuses_allowed_to(User.current.roles_for_project(@project), @issue.tracker)).uniq\n\n if request.get? || request.post? && !params[:reload].blank?\n @issue.start_date ||= Date.today\n @priorities = IssuePriority.all\n render :partial => \"issue_sprints/new\"\n else\n requested_status = IssueStatus.find_by_id(params[:issue][:status_id])\n # Check that the user is allowed to apply the requested status\n @issue.status = (@allowed_statuses.include? requested_status) ? requested_status : default_status\n @issue.fixed_version_id = @issue.user_story.version_id\n if @issue.save\n status = done_ratio_to_status(@issue)\n attach_files(@issue, params[:attachments])\n call_hook(:controller_issues_new_after_save, { :params => params, :issue => @issue})\n @issue_statuses = IssueStatus.find(:all)\n @project_users = User.find(:all, :joins => :members, :conditions => [\"members.project_id = ?\", @project.id])\n render :update do |p|\n p.insert_html :bottom, \"tasks_#{status}_us_#{@issue.user_story_id}\", :partial => \"shared/task_view\",\n :locals => {:task => @issue, :issue_statuses => @issue_statuses,\n :project_users => @project_users}\n end\n return\n end\n end\n end", "def solution_params\n params.require(:solution).permit(:description, :status, :ref)\n end", "def create\n @project_issue = ProjectIssue.new(project_issue_params)\n @project_issue.user_id = current_user.id\n\n respond_to do |format|\n if @project_issue.save\n format.html { redirect_to @project_issue, notice: 'Project issue was successfully created.' }\n format.json { render action: 'show', status: :created, location: @project_issue }\n else\n format.html { render action: 'new' }\n format.json { render json: @project_issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def issue(summary)\n params = { fields: {\n summary: summary,\n issuetype: { name: (options[:type] || 'story') },\n project: { key: (options[:project] || current_project) },\n } }\n params[:fields][:assignee] = { name: options[:user] } if options[:user]\n\n response = Jeera.client.post('issue', params)\n if success_response? response\n success_message \"Issue #{response.body['key']} created. - #{summary}\"\n else\n error_message \"Unable to create this issue\"\n end\n end" ]
[ "0.6914207", "0.6222062", "0.6152061", "0.61462396", "0.6139026", "0.611973", "0.611973", "0.611973", "0.611973", "0.60966796", "0.59854704", "0.5918201", "0.5905252", "0.58883154", "0.58745193", "0.5866919", "0.58435154", "0.5821397", "0.58004516", "0.5793907", "0.5792755", "0.5788307", "0.5777465", "0.5774099", "0.5768734", "0.5750254", "0.574873", "0.57421464", "0.5741449", "0.57389194", "0.5733559", "0.57308006", "0.5722553", "0.5717989", "0.5689986", "0.5682785", "0.56732637", "0.56732595", "0.5672839", "0.56660986", "0.5651562", "0.5651484", "0.56387365", "0.56299514", "0.5628539", "0.5628484", "0.56198144", "0.5618865", "0.5602423", "0.56005526", "0.5593615", "0.55935895", "0.5592114", "0.5578958", "0.5577647", "0.55772084", "0.55706", "0.55694264", "0.5562764", "0.5562347", "0.5552172", "0.554119", "0.5532111", "0.55307853", "0.5525871", "0.5525481", "0.5525092", "0.5513037", "0.55130345", "0.5511966", "0.5505407", "0.5502165", "0.548987", "0.54823357", "0.5476101", "0.5474553", "0.545478", "0.54540104", "0.5452328", "0.54522026", "0.5449232", "0.5429908", "0.5429515", "0.5428865", "0.5418644", "0.541046", "0.54082274", "0.54019785", "0.54006684", "0.53897035", "0.53860855", "0.5377264", "0.5368007", "0.5365506", "0.535504", "0.5349549", "0.5344875", "0.5341957", "0.5341369", "0.5321222" ]
0.70450634
0
PATCH/PUT /legalissues/1 PATCH/PUT /legalissues/1.json
def update respond_to do |format| if @legalissue.update(legalissue_params) format.html { redirect_to @legalissue, notice: 'Legalissue was successfully updated.' } format.json { render :show, status: :ok, location: @legalissue } else format.html { render :edit } format.json { render json: @legalissue.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @issue = Issue.find(params[:id])\n\n respond_to do |format|\n if @issue.update_attributes(params[:issue])\n format.html { redirect_to @issue, notice: 'Issue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @issue = Issue.find(params[:id])\n\n respond_to do |format|\n if @issue.update_attributes(params[:issue])\n format.html { redirect_to @issue, notice: 'Issue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if issue.save\n format.html { redirect_to issue, notice: 'Issue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @normal_issue = NormalIssue.find(params[:id])\n\n respond_to do |format|\n if @normal_issue.update_attributes(params[:normal_issue])\n format.html { redirect_to @normal_issue, notice: 'Normal issue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @normal_issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @issue.update(issue_params)\n format.html { redirect_to @issue, notice: 'Issue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @conference=Conference.find(params[:conference_id])\n @issue = @conference.issues.find(params[:id])\n\n respond_to do |format|\n if @issue.update_attributes(params[:issue])\n format.html { redirect_to [@conference,@issue], notice: 'Issue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @important_issue = ImportantIssue.find(params[:id])\n\n respond_to do |format|\n if @important_issue.update_attributes(params[:important_issue])\n format.html { redirect_to @important_issue, notice: 'Important issue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @important_issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @issue.update(issue_params)\n format.html { redirect_to issues_url, notice: 'Issue was successfully updated.' }\n format.json { render json: {'success' => true} }\n else\n format.html { render :edit }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @issue.update(issue_params)\n format.html { redirect_to @issue, notice: 'Issue was successfully updated.' }\n format.json { render :show, status: :ok, location: @issue }\n else\n format.html { render :edit }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @issue.update(issue_params)\n format.html { redirect_to @issue, notice: 'Issue was successfully updated.' }\n format.json { render :show, status: :ok, location: @issue }\n else\n format.html { render :edit }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @issue.update(issue_params)\n format.html { redirect_to @issue, notice: 'Issue was successfully updated.' }\n format.json { render :show, status: :ok, location: @issue }\n else\n format.html { render :edit }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @issue.update(issue_params)\n format.html { redirect_to @issue, notice: 'Issue was successfully updated.' }\n format.json { render :show, status: :ok, location: @issue }\n else\n format.html { render :edit }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @issue.update(issue_params)\n format.html { redirect_to @issue, notice: 'Issue was successfully updated.' }\n format.json { render :show, status: :ok, location: @issue }\n else\n format.html { render :edit }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @issue.update(issue_params)\n show\n else\n render json: @issue.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @issue.update(issue_params)\n format.html { redirect_to issues_path, notice: 'Issue was successfully updated.' }\n format.json { render :show, status: :ok, location: @issue }\n else\n format.html { render :edit }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @issue.update(issue_params)\n render :show, status: :ok, location: @issue\n else\n render json: @issue.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @issue.update(issue_params)\n format.html { redirect_to course_path(@issue.courseid), notice: 'Issue was successfully updated.' }\n format.json { render :show, status: :ok, location: @issue }\n else\n format.html { render :edit }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @local_issue.update(local_issue_params)\n format.html { redirect_to @local_issue, notice: 'Local issue was successfully updated.' }\n format.json { render :show, status: :ok, location: @local_issue }\n else\n format.html { render :edit }\n format.json { render json: @local_issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @appissue.update(appissue_params)\n format.html { redirect_to @appissue, notice: 'Appissue was successfully updated.' }\n format.json { render :show, status: :ok, location: @appissue }\n else\n format.html { render :edit }\n format.json { render json: @appissue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project_issue.update(project_issue_params)\n format.html { redirect_to @project_issue, notice: 'Project issue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @project_issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n @issue.votes = 0\n if @issue.update(issue_params)\n format.html { redirect_to @issue, notice: 'Issue was successfully updated.' }\n format.json { render :show, status: :ok, location: @issue }\n else\n format.html { render :edit }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_initiative.update(api_v1_initiative_params)\n format.html { redirect_to @api_v1_initiative, notice: 'Initiative was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_initiative_update.update(api_v1_initiative_update_params)\n format.html { redirect_to @api_v1_initiative_update, notice: 'Initiative update was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative_update }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative_update.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @base_issue = BaseIssue.find(params[:id])\n\n respond_to do |format|\n if @base_issue.update_attributes(params[:base_issue])\n format.html { redirect_to @base_issue, :notice => 'Base issue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @base_issue.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @jira_issue.update(jira_issue_params)\n format.html { redirect_to @jira_issue, notice: 'Jira issue was successfully updated.' }\n format.json { render :show, status: :ok, location: @jira_issue }\n else\n format.html { render :edit }\n format.json { render json: @jira_issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @formulary.update(formulary_params)\n format.html { redirect_to formularies_url, alert: I18n.t('activerecord.models.formulary') + I18n.t('helpers_locale.models.updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @formulary.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sub_issue.update(sub_issue_params)\n format.html { redirect_to @sub_issue, notice: 'Sub issue was successfully updated.' }\n format.json { render :show, status: :ok, location: @sub_issue }\n else\n format.html { render :edit }\n format.json { render json: @sub_issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @issue.update(issue_params)\n format.html { redirect_to issues_url, notice: 'Нарушение №'+@issue.id.to_s+' обновлено.' }\n format.json { render :show, status: :ok, location: @issue }\n else\n format.html { render :edit }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n logger.info { \"PARAMS: #{params.inspect}\" }\n project_id, id = params[:id].split('-')\n ticket = Lighthouse::Ticket.find(id, :params => {:project_id => project_id})\n \n # insanely hacky. can't nest json, so don't want to do a willy-nilly merge.\n # move mergeable params to the [:ticket] hash to follow usual rails conventions\n # before merging\n params[:ticket] = {}\n %w(assigned_user_id state milestone_id).each do |field|\n params[:ticket].merge!( field => params.delete(field) ) if params[field]\n end\n logger.info { \"TICKET ATTRS TO UPDATE: #{params[:ticket].inspect}\"}\n \n ticket.attributes.merge!( params[:ticket] )\n ticket.save\n\n respond_to do |format|\n # if @ticket.update_attributes(params[:ticket])\n # flash[:notice] = 'Ticket was successfully updated.'\n # format.html { redirect_to(@ticket) }\n # format.xml { head :ok }\n # else\n # format.html { render :action => \"edit\" }\n # format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n # end\n end\n end", "def update\n respond_to do |format|\n if @issue.update(issue_params)\n @index = Issue.where(\"retro_id = #{@issue.retro_id} AND issue_type = '#{@issue.issue_type}'\").order('votes_count DESC').index @issue\n format.html { redirect_to @retro }\n format.json { render json: {issue: @issue,\n retro: @retro,\n index: @index,\n creator_name: current_user.name,\n issue_type: @issue.type_to_int,\n method: \"PATCH\" } }\n Pusher.trigger('retro_channel', 'update-issue-event', {issue: @issue,\n retro: @retro,\n index: @index,\n creator_name: current_user.name,\n issue_type: @issue.type_to_int,\n method: \"PATCH\" } )\n else\n flash[:error] = @issue.errors\n format.html { render :edit }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @issue = Issue.find(params[:id])\n\n respond_to do |format|\n if @issue.update_attributes(params[:issue])\n format.html { redirect_to issues_path, notice: 'O assunto foi atualizado com sucesso.' }\n else\n format.html { render action: \"edit\" }\n end\n end\n end", "def update\n respond_to do |format|\n if @book_issue.update(book_issue_params)\n format.html { redirect_to @book_issue, notice: 'Book issue was successfully updated.' }\n format.json { render :show, status: :ok, location: @book_issue }\n else\n format.html { render :edit }\n format.json { render json: @book_issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\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 patch!\n request! :patch\n end", "def update\n @initiative = Initiative.find(params[:id])\n \n respond_to do |format|\n if @initiative.update_attributes(params[:initiative])\n \n format.html { redirect_to @initiative, notice: 'Initiative was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @initiative.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @issues = args[:issues] if args.key?(:issues)\n end", "def update\n @issue = Issue.find(params[:id])\n @feedback = Feedback.find(params[:issue][:feedback_id])\n\n respond_to do |format|\n if @issue.update_attributes(params[:issue])\n format.html { redirect_to feedback_issue_path(@feedback.id), notice: 'Issue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @solution = @idea.solutions.find(params[:id])\n\n if @solution.update_attributes(params[:solution])\n render json: { text: \"success\" }\n else\n render json: { text: \"fail\"}\n end\n end", "def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n @ticket.update_responsible(:status, 'Waiting for Staff Response')\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @issue = Issue.find(params[:id])\n\n respond_to do |format|\n if @issue.update_attributes(params[:issue])\n flash[:notice] = 'Issue was successfully updated.'\n format.html { redirect_to(@issue) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @issue.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @git_hub_issue.update(git_hub_issue_params)\n format.html { redirect_to @git_hub_issue, notice: 'Git hub issue was successfully updated.' }\n format.json { render :show, status: :ok, location: @git_hub_issue }\n else\n format.html { render :edit }\n format.json { render json: @git_hub_issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_initiative_field.update(api_v1_initiative_field_params)\n format.html { redirect_to @api_v1_initiative_field, notice: 'Initiative field was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative_field }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative_field.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @incident.update(incident_params)\n format.json { head :no_content }\n else\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "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 @special_requirement.update(special_requirement_params)\n format.html { redirect_to @special_requirement, notice: 'Special requirement was successfully updated.' }\n format.json { render :show, status: :ok, location: @special_requirement }\n else\n format.html { render :edit }\n format.json { render json: @special_requirement.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @issue = @issuable.issues.find(params[:id])\n @changed = @issue.closed != params[:closed]\n\n respond_to do |format|\n if @issue.update_attributes(params[:issue])\n (@changed == true && @issue.closed == true) ? (track_activity(@issuable, 'close', nil, @issue)) : (track_activity(@issuable, 'update', @issue.previous_changes, @issue))\n\n format.html { redirect_to [@issuable, @issue], notice: 'Issue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render layout: 'form', action: \"edit\" }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tissue.update(tissue_params)\n format.html { redirect_to @tissue, notice: 'Tissue was successfully updated.' }\n format.json { render :show, status: :ok, location: @tissue }\n else\n format.html { render :edit }\n format.json { render json: @tissue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reqdifficulty.update(reqdifficulty_params)\n format.html { redirect_to @reqdifficulty, notice: 'Reqdifficulty was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @reqdifficulty.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @requirement.update_attributes(requirement_params)\n format.html { redirect_to action: :index, notice: 'Update Success.' }\n format.json { render action: :index, status: :accepted }\n else\n format.html { render action: :edit }\n format.json { render json: @requirement.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n @laboratory = Laboratory.find(params[:id])\n\n if @laboratory.update!(laboratory_params)\n render json: @laboratory\n else \n render json: @laboratory.errors, status: :unprocessable_entity\n end\n end", "def update\n official = Official.find(params[:id])\n if official.update(official_params)\n render json: official, status: 200, location: [:api, official]\n else\n failed_to_update(official, \"official\")\n end\n end", "def update\n @major = Major.find(params[:id])\n\n respond_to do |format|\n if @major.update_attributes(params[:major])\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\n respond_to do |format|\n if @issue_type.update(issue_type_params)\n format.html { redirect_to @issue_type, notice: 'Issue type was successfully updated.' }\n format.json { render :show, status: :ok, location: @issue_type }\n else\n format.html { render :edit }\n format.json { render json: @issue_type.errors, status: :unprocessable_entity }\n end\n end\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 { render :show, status: :ok, location: @major }\n else\n format.html { render :edit }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interested = Interested.find(params[:id])\n\n respond_to do |format|\n if @interested.update_attributes(params[:interested])\n format.html { redirect_to @interested, notice: 'Interested was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interested.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @jira.update(jira_params)\n format.html { redirect_to @jira, notice: 'Jira was successfully updated.' }\n format.json { render :show, status: :ok, location: @jira }\n else\n format.html { render :edit }\n format.json { render json: @jira.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if current_user.id == @ticket.user_id || ProjectUser.verify_role(current_user.id, @project, 'developer')\n if params[:ticket][:status] == 'closed'\n # Unless doesn't work, but if! does for some reason?\n if !ProjectUser.verify_role(current_user.id, @project, 'owner')\n render json: { error: 'You must be the ticket author, or project owner to edit this' }, status: :unauthorized\n return\n end\n end\n if @ticket.update(ticket_params)\n render json: @ticket, status: 200\n else\n render json: @ticket.errors, status: :unprocessable_entity\n end\n else\n render json: { error: 'You must be the entry author, or on the admin team to edit this' }, status: :unauthorized\n end\n end", "def set_legalissue\n @legalissue = Legalissue.find(params[:id])\n end", "def update\n respond_to do |format|\n if @labticket.update(labticket_params)\n format.html { redirect_to @labticket, notice: 'Labticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @labticket }\n else\n format.html { render :edit }\n format.json { render json: @labticket.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bg_check.update(bg_check_params)\n format.html { redirect_to bg_check_path(@bg_check), notice: 'Bg check was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { \n @issues = @bg_check.issues\n render action: 'edit' \n }\n format.json { render json: @bg_check.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @fuel_issued.update(fuel_issued_params)\n format.html { redirect_to @fuel_issued, notice: (t 'fuel_issueds.title')+(t 'actions.updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @fuel_issued.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @funding_requirement.update(funding_requirement_params)\n format.html { redirect_to @funding_requirement, notice: 'Funding requirement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @funding_requirement.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @incident = Incident.find(params[:id])\n\n if @incident.update(incident_params)\n head :no_content\n else\n render json: @incident.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to :json\n\n if @expense_claim.update(expense_claim_params)\n head :ok\n else\n render partial: 'expense_claim_key_data', layout: false, status: :ok, locals: { expense_claim: @expense_claim }\n end\n end", "def update\n\n if is_adm? && params[:type] == 'complete'\n request = MaintenanceRequest.find(maintenance_request_params[:ticket_no])\n request.app_status = 2\n request.save\n redirect_to maintenance_requests_url\n return\n else\n @maintenance_request = MaintenanceRequest.find(params[:id])\n end\n\n respond_to do |format|\n if @maintenance_request.update(maintenance_request_params)\n format.html { redirect_to @maintenance_request, notice: 'Maintenance request was successfully updated.' }\n format.json { render :show, status: :ok, location: @maintenance_request }\n else\n format.html { render :edit }\n format.json { render json: @maintenance_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @legal_entity.update(legal_entity_params)\n format.html { redirect_to @legal_entity, notice: 'Legal entity was successfully updated.' }\n format.json { render :show, status: :ok, location: @legal_entity }\n else\n format.html { render :edit }\n format.json { render json: @legal_entity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @formulary = Formulary.find(params[:id])\n\n respond_to do |format|\n if @formulary.update_attributes(params[:formulary])\n format.html { redirect_to @formulary, notice: 'Formulario actualizado exitosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @formulary.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @legalstatus.update(legalstatus_params)\n format.html { redirect_to @legalstatus, notice: 'Legalstatus was successfully updated.' }\n format.json { render :show, status: :ok, location: @legalstatus }\n else\n format.html { render :edit }\n format.json { render json: @legalstatus.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @problem = Problem.find(params[:id])\n\n if @problem.update(problem_params)\n head :no_content\n else\n render json: @problem.errors, status: :unprocessable_entity\n end\n end", "def update\n # build_resource\n if resource.status == 'Open'\n resource.update_attributes permitted_params[:contract]\n if !resource.valid?\n render json: resource.errors, status: :unprocessable_entity\n else\n resource.save\n respond_with json: {}, status: :ok\n end\n else\n respond_with json: [{'error':'The contract must be Open to edit.'}], status: :unprocessable_entity\n end\n end", "def update\n @uni_major = UniMajor.find(params[:id])\n\n respond_to do |format|\n if @uni_major.update_attributes(params[:uni_major])\n format.html { redirect_to @uni_major, notice: 'Uni major was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @uni_major.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ticket = Ticket.find(params[:id])\n\n # if open \n if params[:ticket][:ticket_status_id] == \"1\"\n \t@ticket.solver_id = nil\n # if solved\n elsif params[:ticket][:ticket_status_id] == \"2\"\n \t@ticket.solver_id = current_user.id\n \t@ticket.solved_at = Time.now\n end\n \n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n \t\n format.html { redirect_to(@ticket, :notice => 'Ticket was successfully updated.') }\n # format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n # format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update(issue_id, attributes={})\n post(\"issue/#{issue_id}\", query: attributes)\n response.parsed_response\n end", "def update(issue_id, attributes={})\n post(\"issue/#{issue_id}\", query: attributes)\n response.parsed_response\n end", "def update\n respond_to do |format|\n if @bug.update(bug_params.merge!(user_status: current_user))\n send_slack_notification ( {update: true} )\n format.html { redirect_to [@project, @bug], notice: 'Bug was successfully updated.' }\n format.json { render :show, status: :ok, location: @bug }\n else\n format.html { render :edit }\n format.json { render json: @bug.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interesting = Interesting.find(params[:id])\n\n respond_to do |format|\n if @interesting.update_attributes(params[:interesting])\n format.html { redirect_to @interesting, notice: 'Interesting was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interesting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n params[:requirement][:industry_ids] ||= []\n if params['Submit_for_Approval']\n @requirement.status = 'Submitted'\n end\n if params[:requirement][:status] == \"Rejected\"\n Requirement.destroy(params[:id])\n redirect_to requirements_path\n else\n respond_to do |format|\n if @requirement.update_attributes(params[:requirement])\n if (params['Submit_for_Approval']) and (@requirement.status != 'Submitted')\n flash[:error] = 'Could not submit requirement for approval'\n end\n format.html { redirect_to @requirement, notice: 'Requirement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @requirement.errors, status: :unprocessable_entity }\n end\n end\n end\n\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 patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n respond_to do |format|\n if @minor.update(minor_params)\n format.html { redirect_to :show, notice: 'Minor was successfully updated.' }\n format.json { render :show, status: :ok, location: @minor }\n else\n format.html { render :edit }\n format.json { render json: @minor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def update\n @enhancement = Enhancement.find(params[:id])\n\n respond_to do |format|\n if @enhancement.update_attributes(params[:enhancement])\n format.html { redirect_to @enhancement, notice: 'Enhancement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @enhancement.errors, status: :unprocessable_entity }\n end\n end\n end", "def UpdateTicket params = {}\n \n APICall(path: 'tickets.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n @solution = Solution.find(params[:id])\n\n respond_to do |format|\n if @solution.update_attributes(params[:solution])\n format.html { redirect_to @solution, notice: 'Solution was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @solution.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @restriction = Restriction.find(params[:id])\n\n if @restriction.update(params[:restriction])\n head :no_content\n else\n render json: @restriction.errors, status: :unprocessable_entity\n end\n end", "def update\n @ticket.update_attributes(params[:ticket])\n\n respond_with(@story, @ticket)\n end", "def update\n @claim_submission = ClaimSubmission.find(params[:id])\n\n respond_to do |format|\n if @claim_submission.update_attributes(params[:claim_submission])\n format.html { redirect_to @claim_submission, notice: 'Claim submission was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @claim_submission.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n expire_page :action => :index\n expire_page :action => :show\n \n @jira_issue_summary = JiraIssueSummary.get(params[:id])\n\n respond_to do |format|\n if @jira_issue_summary.update(params[:jira_issue_summary])\n format.html { redirect_to(@jira_issue_summary, :notice => 'Jira issue summary was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @jira_issue_summary.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @open_source_work.update(open_source_work_params)\n format.html { redirect_to @open_source_work, notice: 'Open source work was successfully updated.' }\n format.json { render :show, status: :ok, location: @open_source_work }\n else\n format.html { render :edit }\n format.json { render json: @open_source_work.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bug = Bug.find(params[:id])\n\n respond_to do |format|\n if @bug.update_attributes(params[:bug])\n format.html { redirect_to @bug, notice: 'Bug was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bug.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bug = Bug.find(params[:id])\n\n respond_to do |format|\n if @bug.update_attributes(params[:bug])\n format.html { redirect_to @bug, notice: 'Bug was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bug.errors, status: :unprocessable_entity }\n end\n end\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 update\n @commission_fixing = CommissionFixing.find(params[:id])\n if @commission_fixing.update_attributes(params[:commission_fixing])\n render :json=>{:response=>\"success\"}\n else\n render :json=>failure1(@commission_fixing.errors)\n end \n end", "def update\n respond_to do |format|\n if @native_issue.update(native_issue_params)\n add_activity_to_subscribers_inbox(@native_issue.create_activity :update, owner: @current_user)\n format.html { redirect_to @native_issue, notice: 'Native issue was successfully updated.' }\n format.json { render :show, status: :ok, location: @native_issue }\n else\n format.html { render :edit }\n format.json { render json: @native_issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @requirement.update(requirement_params)\n format.html { redirect_to @requirement, notice: 'Requirement was successfully updated.' }\n format.json { render :show, status: :ok, location: @requirement }\n else\n format.html { render :edit }\n format.json { render json: @requirement.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bug.update(bug_params)\n BugHistoric.create(bug_id: @bug.id, ref: BugHistoric.MODIFIED, user_id: current_user.id)\n format.html { redirect_to @bug, notice: 'Bug was successfully updated.' }\n format.json { render :show, status: :ok, location: @bug }\n else\n format.html { render :edit }\n format.json { render json: @bug.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @incident_proof.update(incident_proof_params)\n format.html { redirect_to @incident_proof, notice: 'Incident proof was successfully updated.' }\n format.json { render :show, status: :ok, location: @incident_proof }\n else\n format.html { render :edit }\n format.json { render json: @incident_proof.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @initiative = Initiative.find(params[:id])\n @initiative.phase_id=params[:phase_id]\n\n respond_to do |format|\n if @initiative.update_attributes(params[:initiative])\n format.html { render :nothing => true }\n #format.html { redirect_to @initiative, notice: 'Initiative was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @initiative.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @incident_kind = IncidentKind.find(params[:id])\n\n respond_to do |format|\n if @incident_kind.update_attributes(params[:incident_kind])\n format.html { redirect_to @incident_kind, notice: 'Incident kind was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @incident_kind.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.65650684", "0.65646195", "0.65445703", "0.65286845", "0.6524324", "0.6488429", "0.6436699", "0.64295053", "0.6403991", "0.6403991", "0.6403991", "0.6403991", "0.6403991", "0.6394467", "0.63700014", "0.63647205", "0.6310345", "0.6296002", "0.62875754", "0.62737715", "0.626686", "0.62515855", "0.6234406", "0.6206263", "0.6186659", "0.618453", "0.6181944", "0.61795205", "0.6177959", "0.617669", "0.6165899", "0.61436546", "0.6112854", "0.6109574", "0.61000013", "0.608774", "0.6086765", "0.60586137", "0.6056624", "0.60494155", "0.6035225", "0.6030406", "0.6018924", "0.6007651", "0.598832", "0.59774494", "0.59636503", "0.59495497", "0.5940442", "0.59331393", "0.59321123", "0.59274304", "0.592348", "0.592054", "0.5917772", "0.58909905", "0.5884518", "0.5880604", "0.58719206", "0.58676416", "0.5863109", "0.5856831", "0.58565205", "0.5847621", "0.58415645", "0.5838453", "0.58333105", "0.58321273", "0.5830997", "0.5823508", "0.582268", "0.58210427", "0.5808364", "0.5801383", "0.5801383", "0.57983136", "0.57932305", "0.5790204", "0.57829165", "0.57826257", "0.57782936", "0.57775474", "0.5774322", "0.5772454", "0.57713836", "0.5763969", "0.57570845", "0.5753416", "0.5751914", "0.57480437", "0.57458293", "0.57458293", "0.57454365", "0.5741707", "0.57414544", "0.57394916", "0.5738821", "0.5738309", "0.57370627", "0.5730904" ]
0.697537
0
DELETE /legalissues/1 DELETE /legalissues/1.json
def destroy @legalissue.destroy respond_to do |format| format.html { redirect_to legalissues_url, notice: 'Legalissue was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n issues_permissions\n @issue.destroy\n respond_to do |format|\n format.html { redirect_to issues_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @normal_issue = NormalIssue.find(params[:id])\n @normal_issue.destroy\n\n respond_to do |format|\n format.html { redirect_to normal_issues_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue.destroy\n respond_to do |format|\n format.html { redirect_to issues_url }\n format.json { head :no_content }\n end\n end", "def destroy\n issue.destroy\n respond_to do |format|\n format.html { redirect_to issues_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue = Issue.find(params[:id])\n @issue.destroy\n\n respond_to do |format|\n format.html { redirect_to issues_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue = Issue.find(params[:id])\n @issue.destroy\n\n respond_to do |format|\n format.html { redirect_to issues_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue = Issue.find(params[:id])\n @issue.destroy\n\n respond_to do |format|\n format.html { redirect_to issues_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue = Issue.find(params[:id])\n @issue.destroy\n\n respond_to do |format|\n format.html { redirect_to issues_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @important_issue = ImportantIssue.find(params[:id])\n @important_issue.destroy\n\n respond_to do |format|\n format.html { redirect_to important_issues_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @base_issue = BaseIssue.find(params[:id])\n @base_issue.destroy\n\n respond_to do |format|\n format.html { redirect_to base_issues_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue.destroy\n respond_to do |format|\n format.html { redirect_to issues_url, notice: 'Issue was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue.destroy\n respond_to do |format|\n format.html { redirect_to issues_url, notice: 'Issue was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue.destroy\n respond_to do |format|\n format.html { redirect_to issues_url, notice: 'Issue was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue.destroy\n respond_to do |format|\n format.html { redirect_to issues_url, notice: 'Issue was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue.destroy\n respond_to do |format|\n format.html { redirect_to issues_url, notice: 'Issue was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue.destroy\n respond_to do |format|\n format.html { redirect_to issues_url, notice: 'Issue was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\n @issue.destroy\n respond_to do |format|\n format.html { redirect_to issues_url, notice: 'Issue was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue.destroy\n respond_to do |format|\n format.html { redirect_to issues_url, notice: 'Issue was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @project_issue.destroy\n respond_to do |format|\n format.html { redirect_to project_issues_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue.destroy\n respond_to do |format|\n format.html { redirect_to issues_url, notice: 'Нарушение №'+@issue.id.to_s+' удалено.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue = Issue.find(params[:id])\n @issue.destroy\n\n respond_to do |format|\n format.html { redirect_to(issues_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @issue = Issue.find(params[:id])\n @issue.destroy\n\n respond_to do |format|\n format.html { redirect_to(issues_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @legalstatus.destroy\n respond_to do |format|\n format.html { redirect_to legalstatuses_url, notice: 'Legalstatus was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reqdifficulty.destroy\n respond_to do |format|\n format.html { redirect_to reqdifficulties_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @local_issue.destroy\n respond_to do |format|\n format.html { redirect_to local_issues_url, notice: 'Local issue was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue = @issuable.issues.find(params[:id])\n @issue.destroy\n track_activity @issue\n\n respond_to do |format|\n format.html { redirect_to [@issuable, :issues] }\n format.json { head :no_content }\n end\n end", "def destroy\n @index = Issue.where(\"retro_id = #{@issue.retro_id} AND issue_type = '#{@issue.issue_type}'\").order('votes_count DESC').index @issue\n @type = @issue.type_to_int\n @issue.destroy\n respond_to do |format|\n\n format.html { redirect_to @retro }\n format.json { render json: {index: @index, type: @type } }\n Pusher.trigger('retro_channel', 'delete-issue-event', {index: @index, type: @type })\n end\n end", "def destroy\n @native_issue.destroy\n respond_to do |format|\n format.html { redirect_to native_issues_url, notice: 'Native issue was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fix_issue = FixIssue.find(params[:id])\n @fix_issue.destroy\n\n respond_to do |format|\n format.html { redirect_to fix_issues_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue.destroy\n end", "def destroy\n @issue.destroy\n end", "def destroy\n @issue.clients.delete_all\n @issue.screenshots.delete_all\n @issue.destroy\n respond_with_refresh('Issue was successfully destroyed.', 'success')\n end", "def destroy\n @formulary = Formulary.find(params[:id])\n @formulary.destroy\n\n respond_to do |format|\n format.html { redirect_to formularies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @appissue.destroy\n respond_to do |format|\n format.html { redirect_to appissues_url, notice: 'Appissue was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sub_issue.destroy\n respond_to do |format|\n format.html { redirect_to sub_issues_url, notice: 'Sub issue was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n courseid = @issue.courseid\n @issue.destroy\n respond_to do |format|\n format.html { redirect_to course_path(courseid), notice: 'Issue was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue = scan.issues.find( params.require( :id ) )\n @issue.destroy\n\n respond_to do |format|\n format.html { redirect_to scans_issues_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue.destroy\n respond_to do |format|\n format.html { redirect_to issues_url, notice: 'Issue was successfully destroyed.' }\n format.json { head :no_content }\n end\n authorize! :destroy, @issue\n end", "def destroy\n @incident.destroy\n respond_to do |format|\n format.html { redirect_to incidents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @incident.destroy\n respond_to do |format|\n format.html { redirect_to incidents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @violation.destroy\n respond_to do |format|\n format.html { redirect_to violations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue_type.destroy\n respond_to do |format|\n format.html { redirect_to issue_types_url, notice: 'Issue type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue = Issue.find(params[:id])\n @issue.destroy\n # expire_action(:controller => \"/issue\", :action => \"toc\")\n respond_to do |format|\n format.html { redirect_to admin_issues_url }\n format.json { head :no_content }\n end\n end", "def destroy\n official = Official.find(params[:id])\n official.destroy\n head 204\n end", "def destroy\n expire_page :action => :index\n expire_page :action => :show\n \n @jira_issue_summary = JiraIssueSummary.get(params[:id])\n @jira_issue_summary.destroy\n\n respond_to do |format|\n format.html { redirect_to(jira_issue_summaries_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @issue = @account.issues.find(params[:id])\n @issue.destroy\n\n respond_to do |format|\n format.html { redirect_to(account_issues_url(@account)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @git_hub_issue.destroy\n respond_to do |format|\n format.html { redirect_to git_hub_issues_url, notice: 'Git hub issue was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @jira_issue.destroy\n respond_to do |format|\n format.html { redirect_to jira_issues_url, notice: 'Jira issue was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tissue.destroy\n respond_to do |format|\n format.html { redirect_to tissues_url, notice: 'Tissue was successfully destroyed.' }\n format.json { head :no_content }\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 destroy\n @incident = Incident.find(params[:id])\n @incident.destroy\n\n respond_to do |format|\n format.html { redirect_to incidents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @incident = Incident.find(params[:id])\n @incident.destroy\n\n respond_to do |format|\n format.html { redirect_to incidents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @violation = Violation.find(params[:id])\n @violation.destroy\n\n respond_to do |format|\n format.html { redirect_to violations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @incident = Incident.find(params[:id])\n @incident.destroy\n\n head :no_content\n end", "def destroy\n @material_transfer_issue = MaterialTransferIssue.find(params[:id])\n @material_transfer_issue.destroy\n respond_to do |format|\n format.html do\n redirect_to(material_transfer_issues_url)\n end\n format.json do\n head(:no_content)\n end\n end\n end", "def destroy\n @issue_history.destroy\n respond_to do |format|\n format.html { redirect_to issue_histories_url, notice: 'Issue history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bugreport.destroy\n respond_to do |format|\n format.html { redirect_to bugreports_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_exercise.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_exercises_url, notice: 'Exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @native_issue_has_asana.destroy\n respond_to do |format|\n format.html { redirect_to native_issue_has_asanas_url, notice: 'Native issue has asana was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @req_breakdown = ReqBreakdown.find(params[:id])\n @req_breakdown.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_req_breakdowns_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @incident_kind = IncidentKind.find(params[:id])\n @incident_kind.destroy\n\n respond_to do |format|\n format.html { redirect_to incident_kinds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client_bug.destroy\n respond_to do |format|\n format.html { redirect_to client_bugs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # Logic to delete a record\n @maintenance = Maintenance.find(params[:id])\n @maintenance.destroy\n\n respond_to do |format|\n format.html { redirect_to maintenances_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @competency.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @incident_type = IncidentType.find(params[:id])\n @incident_type.destroy\n\n respond_to do |format|\n format.html { redirect_to incident_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n return if auth(\"website_administrator\")\n @incident = Incident.find(params[:id])\n @incident.destroy\n\n respond_to do |format|\n format.html { redirect_to incidents_url }\n format.json { head :ok }\n end\n end", "def destroy\n @lease = Lease.find(params[:id])\n @lease.destroy\n\n respond_to do |format|\n format.html { redirect_to leases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @solution.destroy\n render json: {solutions: @solution}, status: 200\n end", "def destroy\n @api_v1_initiative_update.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_initiative_updates_url, notice: 'Initiative update was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @solution.destroy\n respond_to do |format|\n format.html { redirect_to solutions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @report_narrative = ReportNarrative.find(params[:id])\n @report_narrative.destroy\n\n respond_to do |format|\n format.html { redirect_to report_narratives_url }\n format.json { head :ok }\n end\n end", "def destroy\n @api_v1_initiative.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_initiatives_url, notice: 'Initiative was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reqstatus.destroy\n respond_to do |format|\n format.html { redirect_to reqstatuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @complexity = Complexity.find(params[:id])\n @complexity.destroy\n\n respond_to do |format|\n format.html { redirect_to complexities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @internal = Internal.find(params[:id])\n @internal.destroy\n\n respond_to do |format|\n format.html { redirect_to internals_url }\n format.json { head :ok }\n end\n end", "def destroy\n @exercise_plan = ExercisePlan.find(params[:id])\n @exercise_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to exercise_plans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fullassessment.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @magissue = Magissue.find(params[:id])\n @magissue.destroy\n\n respond_to do |format|\n format.html { redirect_to magissues_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exerciseoverview.destroy\n respond_to do |format|\n format.html { redirect_to exerciseoverviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bug = Bug.find(params[:id])\n @bug.destroy\n\n respond_to do |format|\n format.html { redirect_to bugs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bug = Bug.find(params[:id])\n @bug.destroy\n\n respond_to do |format|\n format.html { redirect_to bugs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_expense.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_expenses_url, notice: 'Expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @retroaspecto = Retroaspecto.find(params[:id])\n @retroaspecto.destroy\n\n respond_to do |format|\n format.html { redirect_to retroaspectos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @patient_exercise = PatientExercise.find(params[:id])\n @patient_exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to patient_exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @legal_entity.destroy\n respond_to do |format|\n format.html { redirect_to legal_entities_url, notice: 'Legal entity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @infrastructure = Infrastructure.find(params[:id])\n checkaccountobject(\"infrastructures\",@infrastructure)\n @infrastructure.send_delete\n\n respond_to do |format|\n format.html { redirect_to infrastructures_url }\n format.json { head :ok }\n end\n end", "def destroy\n @editability = Editability.find(params[:id])\n @editability.destroy\n\n respond_to do |format|\n format.html { redirect_to tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @solution = Solution.find(params[:id])\n @solution.destroy\n\n respond_to do |format|\n format.html { redirect_to solutions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @badge = Badge.find(params[:id])\n @badge.destroy\n\n respond_to do |format|\n format.html { redirect_to badges_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @enrollment.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @fuel_issued.destroy\n respond_to do |format|\n format.html { redirect_to fuel_issueds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @story.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @medium_mission = MediumMission.find(params[:id])\n @medium_mission.destroy\n\n respond_to do |format|\n format.html { redirect_to medium_missions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @maintenance_ressource.destroy\n\n respond_to do |format|\n format.html { redirect_to maintenance_ressources_url, notice: \"Maintenance ressource was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @journal.destroy\n respond_to do |format|\n format.html { redirect_to journals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @restriction = Restriction.find(params[:id])\n @restriction.destroy\n\n respond_to do |format|\n format.html { redirect_to restrictions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @funding_requirement.destroy\n respond_to do |format|\n format.html { redirect_to funding_requirements_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @agreement.destroy\n respond_to do |format|\n format.html { redirect_to agreements_url, notice: 'Agreement was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @node_incident = NodeIncident.find(params[:id])\n @node_incident.destroy\n\n respond_to do |format|\n format.html { redirect_to node_incidents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @subway.destroy\n respond_to do |format|\n format.html { redirect_to subways_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.7490082", "0.73655206", "0.7324575", "0.7291069", "0.7239899", "0.7239899", "0.7239899", "0.7239899", "0.71790385", "0.71443486", "0.7019203", "0.7019203", "0.7019203", "0.7019203", "0.7019203", "0.7019203", "0.7018853", "0.7018107", "0.69881946", "0.6968155", "0.6956399", "0.6956399", "0.6912119", "0.68997264", "0.68932164", "0.6887494", "0.6885244", "0.6871611", "0.68276274", "0.6826581", "0.6826581", "0.682603", "0.6814729", "0.68107754", "0.68027246", "0.68022484", "0.67848116", "0.67844117", "0.67750347", "0.67750347", "0.677203", "0.6767159", "0.67613053", "0.6730971", "0.67165136", "0.67129254", "0.67038363", "0.66810673", "0.66789955", "0.667563", "0.6666744", "0.6666744", "0.66653216", "0.6658631", "0.6656499", "0.6654947", "0.6651827", "0.6650102", "0.66467506", "0.66446793", "0.6638067", "0.66378057", "0.663768", "0.6636135", "0.66302174", "0.66254056", "0.6623173", "0.6612937", "0.66107994", "0.6603089", "0.66023064", "0.66016155", "0.6600282", "0.65985006", "0.65948725", "0.65924054", "0.6591201", "0.6583736", "0.6583073", "0.65778816", "0.65778816", "0.65698355", "0.65687025", "0.6567882", "0.656668", "0.65524966", "0.65494484", "0.6547663", "0.6547326", "0.65432656", "0.6540573", "0.65359795", "0.6533974", "0.65326303", "0.6531097", "0.6529784", "0.6524954", "0.6523824", "0.65216506", "0.65200126" ]
0.7760089
0
Use callbacks to share common setup or constraints between actions.
def set_legalissue @legalissue = Legalissue.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 setup_handler\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 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 setup\n #implement in subclass;\n end", "def after_set_callback; 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 setup(easy)\n super\n easy.customrequest = @verb\n end", "def around_hooks; 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 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 shared_action(name, &block)\n @controller.shared_actions[name] = 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", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def duas1(action)\n action.call\n action.call\nend" ]
[ "0.6165152", "0.60463154", "0.59467196", "0.5917112", "0.5890387", "0.58345735", "0.57773316", "0.56991524", "0.56991524", "0.565454", "0.5622282", "0.54232633", "0.54119074", "0.54119074", "0.54119074", "0.53937256", "0.53801376", "0.5358599", "0.53412294", "0.5340814", "0.53314966", "0.53114754", "0.52984965", "0.52977055", "0.5296272", "0.5260649", "0.5245076", "0.52388334", "0.52388334", "0.52388334", "0.52388334", "0.52388334", "0.5235081", "0.52321917", "0.5228592", "0.5220735", "0.52198535", "0.52139324", "0.5208539", "0.5206585", "0.5178542", "0.5175199", "0.5173538", "0.5167041", "0.51614195", "0.51577675", "0.5153909", "0.51528823", "0.5152225", "0.51429904", "0.5141399", "0.51345575", "0.51145", "0.5114052", "0.5114052", "0.5110216", "0.5108656", "0.50935394", "0.5089196", "0.5081936", "0.5079627", "0.50675833", "0.5056105", "0.5053687", "0.5050475", "0.5050475", "0.503471", "0.5028311", "0.501982", "0.50157547", "0.5013552", "0.50014806", "0.50011593", "0.49976763", "0.4990292", "0.4990292", "0.49882022", "0.4981269", "0.49792367", "0.49766538", "0.4967978", "0.49667212", "0.4958987", "0.49572337", "0.49550423", "0.4954479", "0.4952353", "0.494726", "0.4944055", "0.4935437", "0.4931248", "0.49283475", "0.49281213", "0.49268973", "0.4921738", "0.49204507", "0.4918924", "0.49182287", "0.4916538", "0.49158585", "0.49156788" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def legalissue_params params.require(:legalissue).permit(:name, :issue, :comment, :done) 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
Public: Appends the notice to the notices array attribute. notice The notice data to be sent (Hash or JSON string) Returns nil
def send_to_honeybadger(notice) @notices << notice end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_notice(notice)\n key = notice_key(notice)\n unless @notices.include?(key)\n @notices.add(key)\n end\n end", "def add_notice(notice)\n @notices << notice\n self\n end", "def notice(msg)\n @notices << msg\n blah @notices.last\n end", "def notice=(message)\n self[:notice] = message\n end", "def notice=(message)\n self[:notice] = message\n end", "def notice\n self[:notice]\n end", "def notice=(message); end", "def notice=(message); end", "def notice!\n self.severity = :NOTICE\n end", "def set_notice\n @notice = Notice.find(params[:id])\n end", "def set_notice\n @notice = Notice.find(params[:id])\n end", "def set_notice\n @notice = Notice.find(params[:id])\n end", "def set_notice\n @notice = Notice.find(params[:id])\n end", "def set_notice\n @notice = Notice.find(params[:id])\n end", "def create\n @notice = Notice.new(notice_params)\n @notice.user_id = current_user.id\n\n respond_to do |format|\n if @notice.save\n format.html { redirect_to @notice, notice: 'Notice was successfully created.' }\n format.json { render :show, status: :created, location: @notice }\n else\n format.html { render :new }\n format.json { render json: @notice.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_notice\n @notice = Notice.find_by_id(params[:id])\n end", "def set_notice\r\n @notice = Notice.find(params[:id])\r\n end", "def set_notice\n @notice = Notice.find(params[:id])\n end", "def notice(to_nick, text)\n split_send(\"NOTICE #{to_nick} :\", text)\n end", "def create\n @notice = Notice.new(notice_params)\n @notice.client = current_client if current_client\n @notice.order_num = 0\n\n shuffle_notices(current_client.id) if current_client\n\n @notices = Notice.all.where(client_id: current_client.id) if current_client\n\n respond_to do |format|\n if @notice.save\n format.json { render action: 'index', status: :created }\n else\n format.json { render json: @notice.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @notice = @person.notices.new(params[:notice])\n\n respond_to do |format|\n if @notice.save\n format.html { redirect_to person_notices_path, notice: 'notice was successfully created.' }\n format.json { render json: @notice, status: :created, location: @notice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @notice.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @notice = Notice.new(notice_params)\n @notice.creator = current_user\n\n respond_to do |format|\n if @notice.save\n format.html { redirect_to @notice, notice: 'Notice was successfully created.' }\n format.json { render :show, status: :created, location: @notice }\n else\n format.html { render :new }\n format.json { render json: @notice.errors, status: :unprocessable_entity }\n end\n end\n end", "def notice\n Notice.find(user_id: id).first || Notice.new(user_id: self.id)\n end", "def notice(t, m)\n @socket << \"NOTICE #{t} :#{m}\"\n end", "def update_notices_cache\n first_notice = notices.first\n last_notice = notices.last\n notice ||= @notice || first_notice\n\n attrs = {}\n attrs.merge!(\n first_notice_at: first_notice.created_at,\n first_notice_commit: first_notice.git_commit,\n first_notice_environment: first_notice.environment_name\n ) if first_notice\n attrs.merge!(\n last_notice_at: last_notice.created_at,\n last_notice_commit: last_notice.git_commit,\n last_notice_environment: last_notice.environment_name\n ) if last_notice\n attrs.merge!(\n message: notice.message,\n where: notice.where,\n messages: attribute_count(:message, messages),\n hosts: attribute_count(:host, hosts),\n user_agents: attribute_count(:user_agent_string, user_agents)\n ) if notice\n problem.update_attributes!(attrs)\n rescue Exception\n $!.additional_information[\"attrs\"] = attrs\n raise\n end", "def _notice(msg, type = :notice)\n if type == :error\n add_error(msg)\n else\n add_msg(\"* #{msg}\", type)\n end\nend", "def create\r\n @notice = Notice.new(notice_params)\r\n @notice.admin = current_admin\r\n\r\n respond_to do |format|\r\n if @notice.save\r\n format.html { redirect_to news_path, notice: 'Notícia criada com sucesso.' }\r\n format.json { render :show, status: :created, location: news_path }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @notice.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def contains_notice?(notice)\n key = notice_key(notice)\n @notices.include?(key)\n end", "def notice(receiver, message)\n raw Helpers.splitted(\"NOTICE #{receiver}\", message.to_s)\n end", "def notice\n #\n end", "def notice_params\n params.fetch(:notice, {})\n end", "def notice(target, message)\n send_data(\"NOTICE #{target} :#{message}\")\n end", "def on_notice(&block)\n @notice_handler = block\n end", "def notice_params\n params.require(:notice).permit(:title, :to, :from, :auther, :greet, :content)\n end", "def notice_params\n params.require(:notice).permit(:title, :content)\n end", "def create\n @notice = Notice.new(params[:notice])\n\n respond_to do |format|\n if @notice.save\n format.html { redirect_to @notice, notice: 'Notice was successfully created.' }\n format.js { render json: @notice, status: :created, location: @notice }\n else\n format.html { render action: \"new\" }\n end\n end\n end", "def channel_notice(chan, notice)\n @connection.send(\"NOTICE #{chan} :#{notice}\")\n end", "def notices(notice, alert)\n\n\n html = ['<script language=\"javascript\">', '$(function () {']\n html << \"EnergyFolks.showNotice('#{notice.gsub(/'/, \"\\\\\\\\'\")}');\" if notice.present?\n html << \"EnergyFolks.showNotice('#{alert.gsub(/'/, \"\\\\\\\\'\")}','red');\" if alert.present?\n return '' unless html.length > 2\n html << '});'\n html << '</script>'\n return html.join(\"\\n\")\n end", "def push_notice_message(msg)\n push_message(:notice, msg)\n end", "def push_notice_message(msg)\n push_message(:notice, msg)\n end", "def notice_params\r\n params.require(:notice).permit(:title, :content, :image)\r\n end", "def notice_params\n params.require(:notice).permit(:title, :category_id, :text)\n end", "def notice?\n severity == :NOTICE\n end", "def [](notice)\n @now[notice.to_s] || @now[notice.to_sym] || @flash[notice.to_s]\n end", "def notice_messages\n return \"\" if notice.blank?\n\n message = notice.class == Array ? notice.map { |msg| content_tag(:li, msg) }.join : \"<li>#{notice.to_s}</li>\"\n\n html = <<-HTML\n <div class=\"alert alert-block alert-info\">\n <a class=\"close\" data-dismiss=\"alert\">&times;</a>\n <h4 class=\"alert-heading\">#{t('notice_title')}</h4>\n <ul>#{message}</ul>\n </div>\n HTML\n html.html_safe\n end", "def notice_params\n params.require(:notice).permit(:title, :description, :public, :d_publish, :d_remove, :sort,:image)\n end", "def notice_stickie (message, options={})\n Stickies::Messages.notice(session, message, options)\n end", "def v2_notice_hash(notice)\n {\n 'error' => {\n 'class' => notice['error_class'],\n 'message' => notice['error_message'],\n 'backtrace' => parse_backtrace(notice['back'].blank? ? notice['backtrace'] : notice['back'])\n },\n 'environment' => (notice['server_environment'].blank? ? notice['environment'] : notice['server_environment']),\n 'session' => notice['session'],\n 'request' => notice['request']\n }\n end", "def update_nc_log\n type = Parameter.as_hash[self.notice_type].parameter_id\n \n params = {\n :operation_id => Transactions::MODIFY_NOTICE,\n :job_id => self.job_id,\n :drawing_id => '',\n :part_id => '',\n :quantity => '',\n :reason => '',\n :description => 'Modify Job Notice',\n :user => self.updated_by,\n :revision => '',\n :key => type + \" \" + self.notice_id\n }\n Transaction.record_transaction(params)\n end", "def notice; end", "def send_notice(text)\n client.api.send_notice(id, text)\n end", "def notice_params\n params.require(:notice).permit(:client_id, :header, :body)\n end", "def show\n @notice = Notice.get(params[:id])\n \n if @notice\n @menu = \"board\"\n @board = \"notice\"\n @section = \"show\"\n \n @notice.hit_cnt += 1\n @notice.save\n \n render 'notice'\n else\n redirect_to '/notices'\n end\n end", "def show\n @notice = Notice.get(params[:id])\n \n if @notice\n @menu = \"board\"\n @board = \"notice\"\n @section = \"show\"\n \n @notice.hit_cnt += 1\n @notice.save\n \n render 'notice'\n else\n redirect_to '/notices'\n end\n end", "def on_notice(connection, user, message)\n end", "def replicate_notice\n users = case noticeable\n # Notify people who follow a topic\n when Post \n noticeable.topic.monitoring_users\n # Notify people who are the member of a group plus the creator's friends\n when GroupMembership\n (noticeable.group.members + creator.friends).uniq\n when Friendship\n creator.friends.reject {|u| u == noticeable.friend}\n # Notify the friends of the creator\n else\n creator.friends\n end\n self.notify_users(users) if users.size <= App.max_users_to_notify\n end", "def update\n @notice.update(notice_params)\n respond_to do |format|\n format.json { render action: 'show' }\n end\n end", "def flash_notice_js(notice, opts={})\n if notice.present?\n notice = view_context.escape_javascript(notice)\n notice_type = opts[:type] || 'notice'\n nofade = opts[:nofade] || notice_type == :error\n \"displayFlashNotice('#{notice_type}','#{notice.full_stop}', #{nofade});#{opts[:do_after]}\"\n else\n 'jQuery.noop();'\n end\n end", "def notice_params\n params.require(:notice).permit(:title ,:content, :top)\n end", "def notify(notice)\n if @config.use_dogapi?\n notify_dogapi_event(notice) if @config.send_event\n notify_dogapi_metric(notice) if @config.send_metric\n end\n if @config.use_statsd?\n notify_statsd_event(notice) if @config.send_event\n notify_statsd_metric(notice) if @config.send_metric\n end\n end", "def to_notice(_notification_class, *_args)\n raise \"to be implemented by including class!\"\n end", "def saw_notification\n current_user.notice_seen = true\n current_user.save\n end", "def set_notice_message\n @notice_message = NoticeMessage.find(params[:id])\n end", "def notice_message\n flash_messages = []\n\n flash.each do |type, message|\n type = :success if type == :notice\n type = :error if type == :alert\n text = content_tag(:p, message, :class => \"#{type}\")\n flash_messages << text if message\n end\n\n flash_messages.join(\"\\n\").html_safe\n end", "def update\n @notice = Notice.get(params[:id])\n \n content = params[:notice][:content]\n title = params[:notice][:title]\n \n @notice.content = content\n \n @notice.title = title\n if params[:is_notice] == \"0\"\n @notice.is_notice = false\n else\n @notice.is_notice = true\n end\n \n \n if @notice.save\n redirect_to(@notice) \n end\n end", "def create\n @menu = \"board\"\n @board = \"notice\"\n\n \n @notice = Notice.new(params[:notice])\n\n if @notice.save\n redirect_to admin_notices_url\n else\n @section = \"new\" \n render 'notice'\n end\n\n end", "def create\n @activity_notice = ActivityNotice.new(activity_notice_params)\n\n respond_to do |format|\n if @activity_notice.save\n format.html { redirect_to @activity_notice, notice: 'Activity notice was successfully created.' }\n format.json { render action: 'show', status: :created, location: @activity_notice }\n else\n format.html { render action: 'new' }\n format.json { render json: @activity_notice.errors, status: :unprocessable_entity }\n end\n end\n end", "def remote_notice(sender, body)\n if sender == 'server'\n sender = ''\n else\n sender = \"#{sender} \"\n end\n _notice \"#{sender}#{body}\", :notice\nend", "def update\n @notice = Notice.find(params[:id])\n\n respond_to do |format|\n if @notice.update_attributes(params[:notice])\n format.html { redirect_to @notice, notice: 'Notice was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @notice.errors, status: :unprocessable_entity }\n end\n end\n end", "def flash_notice_message(notice, opts={})\n render :js => flash_notice_js(notice, opts)\n end", "def send(notice, promise)\n return will_not_deliver(notice, promise) if @unsent.size >= @unsent.max\n\n @unsent << [notice, promise]\n promise\n end", "def update\n respond_to do |format|\n if @notice.update(notice_params)\n format.html { redirect_to @notice, notice: 'Notice was successfully updated.' }\n format.json { render :show, status: :ok, location: @notice }\n else\n format.html { render :edit }\n format.json { render json: @notice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @notice.update(notice_params)\n format.html { redirect_to @notice, notice: 'Notice was successfully updated.' }\n format.json { render :show, status: :ok, location: @notice }\n else\n format.html { render :edit }\n format.json { render json: @notice.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @notice = Notice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notice }\n end\n end", "def notice_params\n params.require(:notice).permit(:Circular_Title, :Select_File)\n end", "def add_to_unsorted\n @notice = Notice.find(params[:id])\n if @notice.sorted\n @notice.update_attribute(:sorted, false)\n @notice.update_attribute(:tag, '')\n @@number_of_new_notices += 1\n @@number_of_sorted_notices -= 1\n end\n head :no_content\n end", "def flash(type, header, message)\n session[\"notice\"] ||= []\n session[\"notice\"] << {\n :type => type,\n :header => header,\n :message => message\n }\nend", "def set_user_notice\n @user_notice = UserNotice.find(params[:id])\n end", "def create\n @death_notice = DeathNotice.new(death_notice_params)\n @death_notice.user = current_user\n\n respond_to do |format|\n if @death_notice.save\n format.html { redirect_to @death_notice, notice: 'Death notice was successfully created.' }\n format.json { render :show, status: :created, location: @death_notice }\n else\n format.html { render :new }\n format.json { render json: @death_notice.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @notice_message = NoticeMessage.new(notice_message_params)\n\n respond_to do |format|\n if @notice_message.save\n format.html { redirect_to @notice_message, notice: 'Notice message was successfully created.' }\n format.json { render :show, status: :created, location: @notice_message }\n else\n format.html { render :new }\n format.json { render json: @notice_message.errors, status: :unprocessable_entity }\n end\n end\n end", "def flash_notice\n if flash[:notice]\n message = flash[:notice]\n flash.clear\n flash[:success] = message\n end\n end", "def send_overdue_notice(notice)\n p \"Reminder #{get_name} #{notice}\"\n end", "def send_overdue_notice(notice)\n p \"Reminder #{get_name} #{notice}\"\n end", "def create\n @os_groups_notice = OsGroupsNotice.new(os_groups_notice_params)\n\n respond_to do |format|\n if @os_groups_notice.save\n format.html { redirect_to @os_groups_notice, notice: 'Os groups notice was successfully created.' }\n format.json { render :show, status: :created, location: @os_groups_notice }\n else\n format.html { render :new }\n format.json { render json: @os_groups_notice.errors, status: :unprocessable_entity }\n end\n end\n end", "def notice(msg) log(5, msg); end", "def redirect_notice(record = nil)\n { notice: I18n.t(\"crud.notices.#{action_name}\", model: t_model,\n record: record.present? ? \"#{record} \" : '') }\n end", "def update\n @notice = @person.notices.find(params[:id])\n\n respond_to do |format|\n if @notice.update_attributes(params[:notice])\n format.html { redirect_to person_notices_path( @person), notice: 'notice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @notice.errors, status: :unprocessable_entity }\n end\n end\n end", "def do_NOTICE(u, msg)\n ircsend(\":#{@server.sid}AAAAAA NOTICE #{u.is_a?(User) ? u.uid : u} :#{msg}\", @conn)\n end", "def new\n @notice=Notice.new\n end", "def update\r\n respond_to do |format|\r\n if @notice.update(notice_params)\r\n format.html { redirect_to news_path, notice: 'Noticia editada com sucesso' }\r\n format.json { render :show, status: :ok, location: news_path }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @notice.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def send_overdue_notice(notice)\n \"#{@name} #{notice}\"\n end", "def notice(notification)\n @notification = notification\n\n mail to: @notification.user_email, :subject => \"Cipher-tech wants you to know: #{@notification.notifier_type} #{@notification.message}\"\n end", "def send_notice(message, *recipients)\n normalize_message(message) { |message|\n recipients.each { |recipient|\n send_raw(NOTICE, recipient, message)\n }\n }\n end", "def set_notice(i18n)\n flash[:notice] = I18n.t(i18n)\n end", "def update\n if @notice.creator == current_user\n respond_to do |format|\n if @notice.update(notice_params)\n format.html { redirect_to @notice, notice: 'Notice was successfully updated.' }\n format.json { render :show, status: :ok, location: @notice }\n else\n format.html { render :edit }\n format.json { render json: @notice.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.html { redirect_to notices_path, alert: 'You have no right to update this notice.' }\n format.json { head :no_content }\n end\n end\n end", "def notice_message?\n true if message[:notice]\n end", "def show\n @notice = Notice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @notice }\n end\n end", "def index\n @notices = Notice.all\n end", "def add_note warning, note\n @changed = true\n @notes[warning.fingerprint] = note\n end", "def flash_notice(message_key, *strs)\r\n flash[:notice] = sprintf(I18n.t(message_key),*strs)\r\n end" ]
[ "0.74966514", "0.74949765", "0.69697726", "0.6808126", "0.6808126", "0.63089424", "0.6151657", "0.6151657", "0.6143349", "0.60047", "0.60047", "0.60047", "0.60047", "0.60047", "0.5976178", "0.5955026", "0.5923222", "0.5886591", "0.5861925", "0.585482", "0.58275014", "0.58075583", "0.5763047", "0.57593054", "0.57550424", "0.5734652", "0.5715473", "0.5714199", "0.5692734", "0.5639566", "0.56378824", "0.56305003", "0.56101835", "0.5563599", "0.5557594", "0.5549873", "0.5543056", "0.55393785", "0.55294156", "0.55294156", "0.5511082", "0.55102754", "0.5488553", "0.54541004", "0.5453542", "0.54493415", "0.5447471", "0.5447094", "0.54038787", "0.5403169", "0.5389008", "0.53874075", "0.5348526", "0.5348526", "0.5338687", "0.5309004", "0.5267424", "0.52622694", "0.52614206", "0.5252307", "0.5244937", "0.52344304", "0.52291805", "0.52288854", "0.52198654", "0.5206259", "0.5193417", "0.51604843", "0.51492554", "0.51373595", "0.51344097", "0.5130841", "0.5130841", "0.51096827", "0.50854325", "0.5081952", "0.5081705", "0.50812745", "0.50769544", "0.5075836", "0.50479865", "0.5031403", "0.5031403", "0.50306475", "0.50112695", "0.50080127", "0.50021523", "0.49764714", "0.49684346", "0.49683887", "0.49535242", "0.49439088", "0.49304834", "0.49170938", "0.4903958", "0.4894691", "0.48747596", "0.48669523", "0.48618525", "0.48569688" ]
0.7102133
2
=begin ================================================== PROBLEM: MENTAL MODEL: INPUT: OUTPUT: EDGE CASES: ASSUMPTIONS: QUESTIONS: PSEUDO: ================================================== EVALUATION ================================================== =end
def remove_vowels(arr) arr.map { |a| a.tr('aeiouAEIOU', '') } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_out_edges_on_examples\n assert_equal(@small_dfa.ith_edges(0), @small_dfa.out_edges(0,true))\n assert_equal(@small_dfa.ith_edges(1,2,5), @small_dfa.out_edges(1,true))\n assert_equal(@small_dfa.ith_edges(4), @small_dfa.out_edges(2,true))\n assert_equal(@small_dfa.ith_edges(3), @small_dfa.out_edges(3,true))\n\n assert_equal(@small_nfa.ith_edges(0), @small_nfa.out_edges(0,true))\n assert_equal(@small_nfa.ith_edges(1,2,3), @small_nfa.out_edges(1,true))\n assert_equal(@small_nfa.ith_edges(4,6), @small_nfa.out_edges(2,true))\n assert_equal(@small_nfa.ith_edges(5), @small_nfa.out_edges(3,true))\n end", "def test_in_edges_on_examples\n assert_equal(@small_dfa.ith_edges(4), @small_dfa.in_edges(0,true))\n assert_equal(@small_dfa.ith_edges(0,5), @small_dfa.in_edges(1,true))\n assert_equal(@small_dfa.ith_edges(1,3), @small_dfa.in_edges(2,true))\n assert_equal(@small_dfa.ith_edges(2), @small_dfa.in_edges(3,true))\n\n assert_equal(@small_nfa.ith_edges(5), @small_nfa.in_edges(0,true))\n assert_equal(@small_nfa.ith_edges(0,1,6), @small_nfa.in_edges(1,true))\n assert_equal(@small_nfa.ith_edges(2), @small_nfa.in_edges(2,true))\n assert_equal(@small_nfa.ith_edges(3,4), @small_nfa.in_edges(3,true))\n end", "def step\n any_independent = false\n net.edges.each do |e|\n a, b = e.source, e.target\n intersect = (@net.adjacent_either(a, b) & @net.verts_on_paths(a, b)).extend(PowerSet)\n \n # Is |Aab ^ Uab| > n? \n if intersect.length <= n\n next\n else\n # Are a and b independent conditioned on any subsets of Aab ^ Uab of cardinality n+1?\n valid_intersects = intersect.power_set.select {|s| s.length == n+1}.reject { |subset| subset.include?(a) || subset.include?(b) }\n if valid_intersects.any? { |subset|\n print \"Testing independence between #{a.name} and #{b.name}, conditioning on #{(subset.any? ? subset.map(&:name).join(', ') : 'nothing') + '...'}\"\n print (coindependent?(p_value, a, b, *subset) ? \"[+]\\n\" : \"[-]\\n\")\n coindependent?(p_value, a, b, *subset)\n }\n @net = remove_edge(net, e)\n net.edges.each do |e|\n puts \"#{e.source.name} => #{e.target.name}\"\n end\n any_independent = true\n end\n end\n end\n @n += 1\n any_independent\n end", "def edge_stmt\n\t\tputs \"Start recognizing an edge statement\"\n\t\tedgeRHS\n\t\tif(@tokens[@counter].type == @LBRACK)\n\t\t\tattr_list\n\t\tend\n\t\tif(@tokens[@counter].type == @SEMI)\n\t\t\tputs \"Finish recognizing an edge statement\"\n\t\telse\n\t\t\tabort( \"Error: expecting ; or edge, but found: init\")\n\t\tend \n\tend", "def set_semantic_labels_for_edges\n # puts \"*** inside set_semantic_labels_for_edges\"\n for i in (0.. @vertices.length - 1)\n if(!@vertices[i].nil? and !@vertices[i].parent.nil?) #parent = null for ROOT\n #search for the parent vertex\n for j in (0..@vertices.length - 1)\n if(!@vertices[j].nil? and (@vertices[j].name.casecmp(@vertices[i].parent) == 0 or \n @vertices[j].name.downcase.include?(@vertices[i].parent.downcase)))\n # puts(\"**Parent:: #{@vertices[j].name}\")\n parent = @vertices[j]\n break #break out of search for the parent\n end\n end\n if(!parent.nil?)#{\n #check if an edge exists between vertices[i] and the parent\n for k in (0..@edges.length - 1)\n if(!@edges[k].nil? and !@edges[k].in_vertex.nil? and !@edges[k].out_vertex.nil?)\n if((@edges[k].in_vertex.name.equal?(@vertices[i].name) and @edges[k].out_vertex.name.equal?(parent.name)) or (@edges[k].in_vertex.name.equal?(parent.name) and @edges[k].out_vertex.name.equal?(@vertices[i].name)))\n #set the role label\n if(@edges[k].label.nil?)\n @edges[k].label = @vertices[i].label\n elsif(!@edges[k].label.nil? and (@edges[k].label == \"NMOD\" or @edges[k].label == \"PMOD\") and (@vertices[i].label != \"NMOD\" or @vertices[i].label != \"PMOD\"))\n @edges[k].label = @vertices[i].label\n end\n end \n end\n end\n end#end of if paren.nil? condition\n end \n end #end of for loop\nend", "def solution4(input)\n end", "def test_ith_edges_on_examples\n assert_equal(@small_dfa.edges, @small_dfa.ith_edges(0,1,2,3,4,5))\n assert_equal([@small_dfa.ith_edge(1)], @small_dfa.ith_edges(1))\n assert_equal([@small_dfa.ith_edge(1), @small_dfa.ith_edge(4)], @small_dfa.ith_edges(1,4))\n assert_equal(@small_nfa.edges, @small_nfa.ith_edges(0,1,2,3,4,5,6))\n assert_equal([@small_nfa.ith_edge(1)], @small_nfa.ith_edges(1))\n assert_equal([@small_nfa.ith_edge(1), @small_nfa.ith_edge(4)], @small_nfa.ith_edges(1,4))\n end", "def edges\n inputs + outputs\n end", "def test_edges_on_examples\n assert_equal(6,@small_dfa.edges.size)\n assert_equal(7,@small_nfa.edges.size)\n end", "def test_step_on_examples\n assert_equal([], @small_dfa.step(0,'b'))\n @small_dfa.each_state do |s|\n s.out_edges.each do |e|\n assert_equal([e.target], @small_dfa.step(s,e.symbol))\n end\n end\n\n assert_equal([], @small_nfa.step(0, 'b'))\n assert_equal(@small_nfa.ith_states(1), @small_nfa.step(0, 'a'))\n assert_equal(@small_nfa.ith_states(2,3), @small_nfa.step(1, 'b'))\n assert_equal(@small_nfa.ith_states(1), @small_nfa.step(1, nil))\n end", "def est\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 4 )\n\n begin\n # at line 42:11: ( dclr | asign | comp | prt | red )\n # at line 42:11: ( dclr | asign | comp | prt | red )\n alt_4 = 5\n case look_4 = @input.peek( 1 )\n when T__44, T__45, T__46, T__47 then alt_4 = 1\n when ID then look_4_2 = @input.peek( 2 )\n\n if ( look_4_2 == EQLS )\n look_4_6 = @input.peek( 3 )\n\n if ( look_4_6 == MINUS || look_4_6 == LPAR || look_4_6.between?( ID, STRING ) )\n alt_4 = 2\n elsif ( look_4_6 == IN )\n alt_4 = 5\n else\n raise NoViableAlternative( \"\", 4, 6 )\n end\n elsif ( look_4_2.between?( PLUS, DIV ) || look_4_2 == RPAR || look_4_2.between?( GRTH, OR ) || look_4_2 == T__42 )\n alt_4 = 3\n else\n raise NoViableAlternative( \"\", 4, 2 )\n end\n when MINUS, LPAR, NUMBER, FLOAT, BOOL, STRING then alt_4 = 3\n when OUT, OUTS then alt_4 = 4\n when IN then alt_4 = 5\n else\n raise NoViableAlternative( \"\", 4, 0 )\n end\n case alt_4\n when 1\n # at line 42:12: dclr\n @state.following.push( TOKENS_FOLLOWING_dclr_IN_est_231 )\n dclr\n @state.following.pop\n\n when 2\n # at line 42:19: asign\n @state.following.push( TOKENS_FOLLOWING_asign_IN_est_235 )\n asign\n @state.following.pop\n\n when 3\n # at line 42:27: comp\n @state.following.push( TOKENS_FOLLOWING_comp_IN_est_239 )\n comp\n @state.following.pop\n\n when 4\n # at line 42:34: prt\n @state.following.push( TOKENS_FOLLOWING_prt_IN_est_243 )\n prt\n @state.following.pop\n\n when 5\n # at line 42:40: red\n @state.following.push( TOKENS_FOLLOWING_red_IN_est_247 )\n red\n @state.following.pop\n\n end\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 4 )\n\n end\n \n return \n end", "def anything\n EDGE_LIST.each do |record|\n from, to, weight = record\n @adj_matrix[from.id][to.id] = weight\n @adj_matrix[to.id][from.id] = weight\n end\n end", "def classify_edge(x,y)\n if y.parent == x\n return :tree\n elsif y.discovered? and !y.processed?\n return :back\n elsif y.processed? and y.pre < x.pre\n return :cross\n elsif y.processed? and x.pre < y.pre\n return :forward\n end\nend", "def detect_cycle_in_graph(edges)\nend", "def test_dfa_step_on_examples\n assert_equal(nil, @small_dfa.dfa_step(0,'b'))\n @small_dfa.each_state do |s|\n s.out_edges.each do |e|\n assert_equal(e.target, @small_dfa.dfa_step(s,e.symbol))\n end\n end\n end", "def test_each_state_on_examples\n @examples.each do |fa|\n edges = []\n fa.each_edge {|e| edges << e}\n assert_equal(fa.edges, edges)\n end\n end", "def main\n args = get_input\n directed_graph = create_directed_graph(args.fetch(:raw_edge_list))\n display_adjacency_matrix(args.fetch(:num_nodes), directed_graph)\nend", "def common_face(edge2)\n end", "def common_face(edge2)\n end", "def generate_graph\n end", "def learn_structure\n puts \"Learning undirected net structure...\"\n # Perform step until every pair of adjacent variables is dependent, and\n # set final_net to the _second-to-last_ state of @net\n begin\n puts \"n = #{n}\"\n final_net = net\n step\n end while n < 1\n \n net = final_net\n \n direct_edges\n end", "def test_add_edge_aliases\n Automaton.new(false) do |fa|\n s0 = fa.add_state(:initial => true)\n s1 = fa.create_state\n assert_not_nil fa.add_edge(s0,s1, 'a')\n assert_not_nil fa.create_edge(s0,s1,'b')\n assert_not_nil fa.connect(s0,s1,'c')\n end\n end", "def test_graph_to_s\n sut_graph = Graph.new\n sut_graph.name=\"test_graph\" \n sut_graph.type=:digraph\n sut_graph.node_style=:ellipse\n #sut_graph.add_node \"TEST1\"\n #sut_graph.add_node \"TEST2\"\n sut_graph.add_edge(\"TEST1\" , \"TEST2\" , \"take_me_to_test_2\")\n \n \n returned_obj = sut_graph.to_s\n assert( returned_obj.instance_of?(String) , \"Check to_s returns String, returns: #{returned_obj.class}\" )\n assert(returned_obj.scan(/test_graph/).length==1 , \"Check once occurence of graph name in dot to_s.\")\n assert(returned_obj.scan(/digraph test_graph/).length==1 , \"Check graph type and name in dot to_s.\") \n assert(returned_obj.scan(/shape = ellipse/).length==1 , \"Check graph node style in dot to_s.\") \n #assert(returned_obj.scan(/TEST1\\;/).length==1 , \"Check that Node definition is included: TEST1;\")\n #assert(returned_obj.scan(/TEST2\\;/).length==1 , \"Check that Node definition is included: TEST2}\")\n assert(returned_obj.scan(/label = \\\"take_me_to_test_2\"/).length==1 , \"Check that arc label is included\")\n \n end", "def describe_node(x)\n res = []\n @k.each_vertex do |y|\n if y.type == :positive and not x == y\n if @k[x,y] == :provable_true\n res << describe_edge(x,y)\n elsif @k[x,y.opposite] == :provable_true\n res << describe_edge(x,y.opposite)\n elsif @k[x,y]\n res << describe_edge(x,y)\n elsif @k[x,y.opposite]\n res << describe_edge(x,y.opposite)\n end\n end\n end\n \n res\n end", "def gamma_decomposition\r\n k = 0; comparability=true; classification={}\r\n edges.map {|edge| [edge.source,edge.target]}.each do |e|\r\n if classification[e].nil?\r\n k += 1\r\n classification[e] = k; classification[e.reverse] = -k\r\n comparability &&= gratr_comparability_explore(e, k, classification)\r\n end\r\n end; [classification, comparability]\r\n end", "def test_ith_edge_on_examples\n @examples.each do |fa|\n edges = []\n 0.upto(fa.edge_count-1) do |i|\n edges << fa.ith_edge(i)\n end\n assert_equal(fa.edges, edges)\n end\n end", "def gamma_decomposition\n k = 0; comparability=true; classification={}\n edges.map {|edge| [edge.source,edge.target]}.each do |e|\n if classification[e].nil?\n k += 1\n classification[e] = k; classification[e.reverse] = -k\n comparability &&= plexus_comparability_explore(e, k, classification)\n end\n end; [classification, comparability]\n end", "def create_dot_graph\r\n\r\n \t# Create the base object, then add edges/nodes later etc\r\n \tmy_graph = Graph.new\r\n \tmy_graph.name= \"State_Model\"\r\n \tmy_graph.node_style= :ellipse\r\n \tmy_graph.type = :digraph\r\n\r\n \t# For each entry in the Adjacency matrix extract the relationships and add the graph edges.\r\n \tself.adjacency_matrix.each_key do |table_key|\r\n \t\ttransition_list=self.adjacency_matrix[table_key]\r\n \t\ttransition_list.each do |transition|\r\n \t\t # is the action guarded?\r\n \t\t if self.guarded_actions !=nil\r\n \t\t guarded=self.guarded_actions.include? transition.action\r\n \t\t\tend # end if \r\n \t\t\t# add the edge...\r\n \t\t\tmy_graph.add_edge(transition.start_state, transition.end_state, \" #{transition.action} \", guarded)\r\n \t\tend # end add transitions\r\n \tend # end add nodes\r\n\r\n \treturn my_graph\r\n end", "def transformation_into_apnf\n self.simplification\n unless @operator.nil?\n old_left = ( @left_sentence ? Sentence.new(@left_sentence) : nil )\n old_right = ( @right_sentence ? Sentence.new(@right_sentence) : nil )\n\n if @operator.is_negation?\n unless @right_sentence.operator.nil?\n case @right_sentence.operator.type\n when :implication\n apnf_rules_for_negated_implication\n\n # ******* NEW APNF RULES FOR NEGATED IMPLICATION FORMULA CAN BE ADDED HERE AS A METHOD JUST LIKE THE METHOD ABOVE *******\n # ******* FOR EXAMPLE:\n new_apnf_rules_for_negated_implication()\n\n when :conjunction\n apnf_rules_for_negated_conjunction\n\n # ******* NEW APNF RULES FOR NEGATED CONJUNCTION FORMULA CAN BE ADDED HERE AS A METHOD JUST LIKE THE METHOD ABOVE *******\n # ******* FOR EXAMPLE:\n new_apnf_rules_for_negated_conjunction()\n\n when :disjunction\n apnf_rules_for_negated_disjunction\n\n # ******* NEW APNF RULES FOR NEGATED DISJUNCTION FORMULA CAN BE ADDED HERE AS A METHOD JUST LIKE THE METHOD ABOVE *******\n # ******* FOR EXAMPLE:\n new_apnf_rules_for_negated_disjunction()\n\n when :new_operator\n # ******* OR A NEW OPERATOR NOT USED BEFORE CAN BE ADDED IN THE SIMPLIFICATION - LIKE NEGATION FOR EXAMPLE *******\n\n # ******* AND A NEW SIMPLIFICATION RULE CAN BE ADDED TO THIS OPERATOR *******\n # ******* FOR EXAMPLE: *******\n apnf_rules_for_negated_new_operator()\n end\n @left_sentence.transformation_into_apnf if @left_sentence\n @right_sentence.transformation_into_apnf if @right_sentence\n end\n else\n case @operator.type\n when :implication\n apnf_rules_for_implication\n\n # ******* NEW APNF RULES FOR IMPLICATION CAN BE ADDED HERE AS A METHOD JUST LIKE THE METHOD ABOVE *******\n # ******* FOR EXAMPLE:\n new_apnf_rules_for_implication()\n\n # ******* OR NEW RULES FOR CONJUNCTION AND DISJUNCTION CAN BE ADDED TOO, IN A NEW OPTION FOR THE CASE\n # ******* FOR EXAMPLE:\n when :conjunction\n new_apnf_rules_for_conjunction()\n\n when :disjunction\n new_apnf_rules_for_disjunction()\n\n when :new_operator\n # ******* OR A NEW OPERATOR NOT USED BEFORE CAN BE ADDED IN THE SIMPLIFICATION - LIKE NEGATION FOR EXAMPLE *******\n\n # ******* AND A NEW SIMPLIFICATION RULE CAN BE ADDED TO THIS OPERATOR *******\n # ******* FOR EXAMPLE: *******\n apnf_rules_for_new_operator()\n\n end\n @left_sentence.transformation_into_apnf if @left_sentence\n @right_sentence.transformation_into_apnf if @right_sentence\n end\n\n unless Sentence.equals?(old_left, @left_sentence) && Sentence.equals?(old_right, @right_sentence)\n update\n end\n end\n self.simplification\n end", "def each_relation_edge(rg)\n rg.nodes.each { |node|\n [:src,:dst].each { |rg_level|\n next unless node.get_block(rg_level)\n node.successors(rg_level).each { |node2|\n if node2.type == :exit || node2.get_block(rg_level)\n yield IPETEdge.new(node,node2,pml_level(rg_level))\n end\n }\n }\n }\n end", "def compare_edges_diff_types(rev, subm, num_rev_edg, num_sub_edg)\n # puts(\"*****Inside compareEdgesDiffTypes :: numRevEdg :: #{num_rev_edg} numSubEdg:: #{num_sub_edg}\") \n best_SV_VS_match = Array.new(num_rev_edg){Array.new}\n cum_edge_match = 0.0\n count = 0\n max = 0.0\n flag = 0\n wnet = WordnetBasedSimilarity.new \n for i in (0..num_rev_edg - 1)\n if(!rev[i].nil? and rev[i].in_vertex.node_id != -1 and rev[i].out_vertex.node_id != -1)\n #skipping edges with frequent words for vertices\n if(wnet.is_frequent_word(rev[i].in_vertex.name) and wnet.is_frequent_word(rev[i].out_vertex.name))\n next\n end\n #identifying best match for edges\n for j in (0..num_sub_edg - 1) \n if(!subm[j].nil? and subm[j].in_vertex.node_id != -1 and subm[j].out_vertex.node_id != -1)\n #checking if the subm token is a frequent word\n if(wnet.is_frequent_word(subm[j].in_vertex.name) and wnet.is_frequent_word(subm[j].out_vertex.name))\n next\n end \n #for S-V with S-V or V-O with V-O\n if(rev[i].in_vertex.type == subm[j].in_vertex.type and rev[i].out_vertex.type == subm[j].out_vertex.type)\n #taking each match separately because one or more of the terms may be a frequent word, for which no @vertex_match exists!\n sum = 0.0\n cou = 0\n if(!@vertex_match[rev[i].in_vertex.node_id][subm[j].out_vertex.node_id].nil?)\n sum = sum + @vertex_match[rev[i].in_vertex.node_id][subm[j].out_vertex.node_id]\n cou +=1\n end\n if(!@vertex_match[rev[i].out_vertex.node_id][subm[j].in_vertex.node_id].nil?)\n sum = sum + @vertex_match[rev[i].out_vertex.node_id][subm[j].in_vertex.node_id]\n cou +=1\n end \n if(cou > 0)\n best_SV_VS_match[i][j] = sum.to_f/cou.to_f\n else\n best_SV_VS_match[i][j] = 0.0\n end\n #-- Vertex and SRL\n best_SV_VS_match[i][j] = best_SV_VS_match[i][j]/ compare_labels(rev[i], subm[j])\n flag = 1\n if(best_SV_VS_match[i][j] > max)\n max = best_SV_VS_match[i][j]\n end\n #for S-V with V-O or V-O with S-V\n elsif(rev[i].in_vertex.type == subm[j].out_vertex.type and rev[i].out_vertex.type == subm[j].in_vertex.type)\n #taking each match separately because one or more of the terms may be a frequent word, for which no @vertex_match exists!\n sum = 0.0\n cou = 0\n if(!@vertex_match[rev[i].in_vertex.node_id][subm[j].in_vertex.node_id].nil?)\n sum = sum + @vertex_match[rev[i].in_vertex.node_id][subm[j].in_vertex.node_id]\n cou +=1\n end\n if(!@vertex_match[rev[i].out_vertex.node_id][subm[j].out_vertex.node_id].nil?)\n sum = sum + @vertex_match[rev[i].out_vertex.node_id][subm[j].out_vertex.node_id]\n cou +=1\n end \n if(cou > 0)\n best_SV_VS_match[i][j] = sum.to_f/cou.to_f\n else\n best_SV_VS_match[i][j] =0.0\n end\n flag = 1\n if(best_SV_VS_match[i][j] > max)\n max = best_SV_VS_match[i][j]\n end\n end\n end #end of the if condition\n end #end of the for loop for submission edges\n \n if(flag != 0) #if the review edge had any submission edges with which it was matched, since not all S-V edges might have corresponding V-O edges to match with\n # puts(\"**** Best match for:: #{rev[i].in_vertex.name} - #{rev[i].out_vertex.name} -- #{max}\")\n cum_edge_match = cum_edge_match + max\n count+=1\n max = 0.0 #re-initialize\n flag = 0\n end\n end #end of if condition\n end #end of for loop for review edges\n \n avg_match = 0.0\n if(count > 0)\n avg_match = cum_edge_match.to_f/ count.to_f\n end\n return avg_match\nend", "def describe_edge(x, y, aff = true)\n case @k[x,y]\n when :provable_true\n case y.type\n when :positive \n return \"All #{x.name}s are #{y.name}s\"\n when :negative\n return \"No #{x.name}s are #{y.name}s\"\n end\n when :provable_false\n case y.type\n when :positive\n if aff\n return \"Some #{x.name}s are not #{y.name}s\"\n else\n return \"Not all #{x.name}s are #{y.name}s\"\n end\n when :negative\n if aff\n return \"Some #{x.name}s are #{y.name}s\"\n else\n return \"Not all #{x.name}s are not #{y.name}s\"\n end\n end\n end\n end", "def generate_graph(text, pos_tagger, coreNLPTagger, forRelevance, forPatternIdentify)\n #initializing common arrays \n @vertices = Array.new\n @num_vertices = 0\n @edges = Array.new\n @num_edges = 0\n\n @pos_tagger = pos_tagger #part of speech tagger\n @pipeline = coreNLPTagger #dependency parsing\n #iterate through the sentences in the text\n for i in (0..text.length-1)\n if(text[i].empty? or text[i] == \"\" or text[i].split(\" \").empty?)\n next\n end\n unTaggedString = text[i].split(\" \")\n # puts \"UnTagged String:: #{unTaggedString}\"\n taggedString = @pos_tagger.get_readable(text[i])\n# puts \"taggedString:: #{taggedString}\"\n \n #Initializing some arrays\n nouns = Array.new\n nCount = 0\n verbs = Array.new\n vCount = 0\n adjectives = Array.new\n adjCount = 0\n adverbs = Array.new\n advCount = 0\n \n parents = Array.new\n labels = Array.new\n \n #------------------------------------------#------------------------------------------\n #finding parents\n parents = find_parents(text[i])\n parentCounter = 0\n #------------------------------------------#------------------------------------------\n #finding parents\n labels = find_labels(text[i])\n labelCounter = 0\n #------------------------------------------#------------------------------------------\n #find state\n sstate = SentenceState.new\n states_array = sstate.identify_sentence_state(taggedString)\n states_counter = 0\n state = states_array[states_counter]\n states_counter += 1\n #------------------------------------------#------------------------------------------\n \n taggedString = taggedString.split(\" \")\n prevType = nil #initlializing the prevyp\n \n #iterate through the tokens\n for j in (0..taggedString.length-1)\n taggedToken = taggedString[j]\n plainToken = taggedToken[0...taggedToken.index(\"/\")].to_s\n posTag = taggedToken[taggedToken.index(\"/\")+1..taggedToken.length].to_s \n #ignore periods\n if(plainToken == \".\" or taggedToken.include?(\"/POS\") or (taggedToken.index(\"/\") == taggedToken.length()-1) or (taggedToken.index(\"/\") == taggedToken.length()-2))#this is for strings containinig \"'s\" or without POS\n next\n end\n \n #SETTING STATE\n #since the CC or IN are part of the following sentence segment, we set the STATE for that segment when we see a CC or IN\n if(taggedToken.include?(\"/CC\"))#{//|| ps.contains(\"/IN\")\n state = states_array[states_counter]\n states_counter+=1\n end\n # puts(\"**Value:: #{plainToken} LabelCounter:: #{labelCounter} ParentCounter:: #{parentCounter} POStag:: #{posTag} .. state = #{state}\")\n\n #------------------------------------------\n #if the token is a noun\n if(taggedToken.include?(\"NN\") or taggedToken.include?(\"PRP\") or taggedToken.include?(\"IN\") or taggedToken.include?(\"/EX\") or taggedToken.include?(\"WP\"))\n #either add on to a previous vertex or create a brand new noun vertex\n if(prevType == NOUN) #adding to a previous noun vertex\n nCount -= 1 #decrement, since we are accessing a previous noun vertex\n prevVertex = search_vertices(@vertices, nouns[nCount], i) #fetching the previous vertex\n nouns[nCount] = nouns[nCount].to_s + \" \" + plainToken #concatenating with contents of the previous noun vertex\n #checking if the previous noun concatenated with \"s\" already exists among the vertices\n if((nounVertex = search_vertices(@vertices, nouns[nCount], i)) == nil) \n prevVertex.name = prevVertex.name.to_s + \" \" + plainToken #concatenating the nouns\n nounVertex = prevVertex #the current concatenated vertex will be considered\n if(labels[labelCounter] != \"NMOD\" or labels[labelCounter] != \"PMOD\")#resetting labels for the concatenated vertex\n nounVertex.label = labels[labelCounter]\n end\n #fAppendedVertex = 1\n end#if the vertex already exists, just use nounVertex - the returned vertex for ops. \n else #if the previous token is not a noun, create a brand new vertex\n nouns[nCount] = plainToken #this is checked for later on\n nounVertex = search_vertices(@vertices, plainToken, i)\n if(nounVertex == nil) #the string doesn't already exist\n @vertices[@num_vertices] = Vertex.new(nouns[nCount], NOUN, i, state, labels[labelCounter], parents[parentCounter], posTag)\n nounVertex = @vertices[@num_vertices] #the newly formed vertex will be considered\n @num_vertices+=1\n end\n end #end of if prevType was noun\n remove_redundant_vertices(nouns[nCount], i)\n nCount+=1 #increment nCount for a new noun vertex just created (or existing previous vertex appended with new text)\n \n #checking if a noun existed before this one and if the adjective was attached to that noun.\n #if an adjective was found earlier, we add a new edge\n if(prevType == ADJ)\n #set previous noun's property to null, if it was set, if there is a noun before the adjective\n if(nCount > 1)\n v1 = search_vertices(@vertices, nouns[nCount-2], i) #fetching the previous noun, the one before the current noun (therefore -2) \n v2 = search_vertices(@vertices, adjectives[adjCount-1], i) #fetching the previous adjective \n #if such an edge exists - DELETE IT - search_edges_to_set_null() returns the position in the array at which such an edge exists\n if(!v1.nil? and !v2.nil? and (e = search_edges_to_set_null(@edges, v1, v2, i)) != -1) #-1 is when no such edge exists\n @edges[e] = nil #setting the edge to null\n #if @num_edges had been previously incremented, decrement it\n if(@num_edges > 0)\n @num_edges-=1 #deducting an edge count\n end\n end \n end\n #if this noun vertex was encountered for the first time, nCount < 1,\n #so do adding of edge outside the if condition \n #add a new edge with v1 as the adjective and v2 as the new noun\n v1 = search_vertices(@vertices, adjectives[adjCount-1], i)\n v2 = nounVertex #the noun vertex that was just created\n #if such an edge did not already exist\n if(!v1.nil? and !v2.nil? and (e = search_edges(@edges, v1, v2, i)) == -1)\n @edges[@num_edges] = Edge.new(\"noun-property\",VERB)\n @edges[@num_edges].in_vertex = v1\n @edges[@num_edges].out_vertex = v2\n @edges[@num_edges].index = i\n @num_edges+=1\n #since an edge was just added we try to check if there exist any redundant edges that can be removed\n remove_redundant_edges(v1, v2, i)\n end\n end\n #a noun has been found and has established a verb as an in_vertex and such an edge doesnt already previously exist\n if(vCount > 0) #and fAppendedVertex == 0 \n #add edge only when a fresh vertex is created not when existing vertex is appended to\n v1 = search_vertices(@vertices, verbs[vCount-1], i)\n v2 = nounVertex\n #if such an edge does not already exist add it\n if(!v1.nil? and !v2.nil? and (e = search_edges(@edges,v1, v2, i)) == -1)\n @edges[@num_edges] = Edge.new(\"verb\", VERB) \n @edges[@num_edges].in_vertex = v1 #for vCount = 0\n @edges[@num_edges].out_vertex = v2\n @edges[@num_edges].index = i\n @num_edges+=1\n #since an edge was just added we try to check if there exist any redundant edges that can be removed\n remove_redundant_edges(v1, v2, i)\n end\n end\n prevType = NOUN\n #------------------------------------------\n \n #if the string is an adjective\n #adjectives are vertices but they are not connected by an edge to the nouns, instead they are the noun's properties\n elsif(taggedToken.include?(\"/JJ\")) \n adjective = nil\n if(prevType == ADJ) #combine the adjectives\n # puts(\"PREV ADJ here:: #{plainToken}\")\n if(adjCount >= 1)\n adjCount = adjCount - 1\n prevVertex = search_vertices(@vertices, adjectives[adjCount], i) #fetching the previous vertex\n adjectives[adjCount] = adjectives[adjCount] + \" \" + plainToken \n #if the concatenated vertex didn't already exist\n if((adjective = search_vertices(@vertices, adjectives[adjCount], i)).nil?)\n prevVertex.name = prevVertex.name+\" \"+plainToken\n adjective = prevVertex #set it as \"adjective\" for further execution\n if(labels[labelCounter] != \"NMOD\" or labels[labelCounter] != \"PMOD\") #resetting labels for the concatenated vertex\n adjective.label = labels[labelCounter]\n end\n end\n end\n else #new adjective vertex\n adjectives[adjCount] = plainToken\n if((adjective = search_vertices(@vertices, plainToken, i)).nil?) #the string doesn't already exist\n @vertices[@num_vertices] = Vertex.new(adjectives[adjCount], ADJ, i, state, labels[labelCounter], parents[parentCounter], posTag)\n adjective = @vertices[@num_vertices]\n @num_vertices+=1\n end\n end\n remove_redundant_vertices(adjectives[adjCount], i) \n adjCount+=1 #incrementing, since a new adjective was created or an existing one updated.\n \n #by default associate the adjective with the previous/latest noun and if there is a noun following it immediately, then remove the property from the older noun (done under noun condition)\n if(nCount > 0) #gets the previous noun to form the edge\n v1 = search_vertices(@vertices, nouns[nCount-1], i) \n v2 = adjective #the current adjective vertex\n #if such an edge does not already exist add it\n if(!v1.nil? and !v2.nil? and (e = search_edges(@edges, v1, v2, i)) == -1)\n # puts \"** Adding noun-adj edge .. #{v1.name} - #{v2.name}\"\n @edges[@num_edges] = Edge.new(\"noun-property\",VERB)\n @edges[@num_edges].in_vertex = v1\n @edges[@num_edges].out_vertex = v2\n @edges[@num_edges].index = i\n @num_edges+=1 \n #since an edge was just added we try to check if there exist any redundant edges that can be removed\n remove_redundant_edges(v1, v2, i) \n end\n end\n prevType = ADJ\n #end of if condition for adjective\n #------------------------------------------\n \n #if the string is a verb or a modal//length condition for verbs is, be, are...\n elsif(taggedToken.include?(\"/VB\") or taggedToken.include?(\"MD\"))\n verbVertex = nil\n if(prevType == VERB) #combine the verbs \n vCount = vCount - 1\n prevVertex = search_vertices(@vertices, verbs[vCount], i) #fetching the previous vertex\n verbs[vCount] = verbs[vCount] + \" \" + plainToken \n #if the concatenated vertex didn't already exist\n if((verbVertex = search_vertices(@vertices, verbs[vCount], i)) == nil)\n prevVertex.name = prevVertex.name + \" \" + plainToken\n verbVertex = prevVertex #concatenated vertex becomes the new verb vertex\n if(labels[labelCounter] != \"NMOD\" or labels[labelCounter] != \"PMOD\")#resetting labels for the concatenated vertex\n verbVertex.label = labels[labelCounter]\n end\n end\n else\n verbs[vCount] = plainToken\n if((verbVertex = search_vertices(@vertices, plainToken, i)) == nil)\n @vertices[@num_vertices] = Vertex.new(plainToken, VERB, i, state, labels[labelCounter], parents[parentCounter], posTag)\n verbVertex = @vertices[@num_vertices] #newly created verb vertex will be considered in the future\n @num_vertices+=1\n end\n end\n remove_redundant_vertices(verbs[vCount], i)\n vCount+=1\n \n #if an adverb was found earlier, we set that as the verb's property\n if(prevType == ADV)\n #set previous verb's property to null, if it was set, if there is a verb following the adverb\n if(vCount > 1)\n v1 = search_vertices(@vertices, verbs[vCount-2], i) #fetching the previous verb, the one before the current one (hence -2) \n v2 = search_vertices(@vertices, adverbs[advCount-1], i) #fetching the previous adverb \n #if such an edge exists - DELETE IT\n if(!v1.nil? and !v2.nil? and (e = search_edges_to_set_null(@edges, v1, v2, i)) != -1)\n @edges[e] = nil #setting the edge to null\n if(@num_edges > 0)\n @num_edges-=1 #deducting an edge count\n end\n end\n end\n #if this verb vertex was encountered for the first time, vCount < 1,\n #so do adding of edge outside the if condition\n #add a new edge with v1 as the adverb and v2 as the new verb\n v1 = search_vertices(@vertices, adverbs[advCount-1], i)\n v2 = verbVertex\n #if such an edge did not already exist\n if(!v1.nil? and !v2.nil? and (e = search_edges(@edges, v1, v2, i)) == -1)\n @edges[@num_edges] = Edge.new(\"verb-property\",VERB)\n @edges[@num_edges].in_vertex = v1\n @edges[@num_edges].out_vertex = v2\n @edges[@num_edges].index = i\n @num_edges+=1 \n #since an edge was just added we try to check if there exist any redundant edges that can be removed\n remove_redundant_edges(v1, v2, i)\n end\n end\n \n #making the previous noun, one of the vertices of the verb edge\n if(nCount > 0) #and fAppendedVertex == 0 \n #gets the previous noun to form the edge\n v1 = search_vertices(@vertices, nouns[nCount-1], i)\n v2 = verbVertex\n #if such an edge does not already exist add it\n if(!v1.nil? and !v2.nil? and (e = search_edges(@edges, v1, v2, i)) == -1)\n @edges[@num_edges] = Edge.new(\"verb\",VERB)\n @edges[@num_edges].in_vertex = v1 #for nCount = 0;\n @edges[@num_edges].out_vertex = v2 #the verb\n @edges[@num_edges].index = i\n @num_edges+=1\n #since an edge was just added we try to check if there exist any redundant edges that can be removed\n remove_redundant_edges(v1, v2, i)\n end\n end\n prevType = VERB\n #------------------------------------------ \n #if the string is an adverb\n elsif(taggedToken.include?(\"RB\"))\n adverb = nil\n if(prevType == ADV) #appending to existing adverb\n if(advCount >= 1)\n advCount = advCount - 1\n end\n prevVertex = search_vertices(@vertices, adverbs[advCount], i) #fetching the previous vertex\n adverbs[advCount] = adverbs[advCount] + \" \" + plainToken\n #if the concatenated vertex didn't already exist\n if((adverb = search_vertices(@vertices, adverbs[advCount], i)) == nil)\n prevVertex.name = prevVertex.name + \" \" + plainToken\n adverb = prevVertex #setting it as \"adverb\" for further computation\n if(labels[labelCounter] != \"NMOD\" or labels[labelCounter] != \"PMOD\") #resetting labels for the concatenated vertex\n adverb.label = labels[labelCounter]\n end\n end\n else #else creating a new vertex\n adverbs[advCount] = plainToken\n if((adverb = search_vertices(@vertices, plainToken, i)) == nil)\n @vertices[@num_vertices] = Vertex.new(adverbs[advCount], ADV, i, state, labels[labelCounter], parents[parentCounter], posTag);\n adverb = @vertices[@num_vertices]\n @num_vertices+=1\n end\n end \n remove_redundant_vertices(adverbs[advCount], i) \n advCount+=1\n \n #by default associate it with the previous/latest verb and if there is a verb following it immediately, then remove the property from the verb\n if(vCount > 0) #gets the previous verb to form a verb-adverb edge\n v1 = search_vertices(@vertices, verbs[vCount-1], i)\n v2 = adverb\n #if such an edge does not already exist add it\n if(!v1.nil? and !v2.nil? && (e = search_edges(@edges, v1, v2, i)) == -1)\n @edges[@num_edges] = Edge.new(\"verb-property\",VERB)\n @edges[@num_edges].in_vertex = v1 #for nCount = 0;\n @edges[@num_edges].out_vertex = v2 #the verb\n @edges[@num_edges].index = i\n @num_edges+=1\n #since an edge was just added we try to check if there exist any redundant edges that can be removed\n remove_redundant_edges(v1, v2, i)\n end\n end\n prevType = ADV\n #end of if condition for adverb\n end #end of if condition\n #------------------------------------------ \n #incrementing counters for labels and parents\n labelCounter+=1\n parentCounter+=1 \n end #end of the for loop for the tokens\n #puts \"here outside the for loop for tokens\"\n nouns = nil\n verbs = nil\n adjectives = nil\n adverbs = nil\n end #end of number of sentences in the text\n\n @num_vertices = @num_vertices - 1 #since as a counter it was 1 ahead of the array's contents\n if(@num_edges != 0)\n @num_edges = @num_edges - 1 #same reason as for num_vertices\n end\n set_semantic_labels_for_edges\n #print_graph(@edges, @vertices)\n# puts(\"Number of edges:: #{@num_edges}\")\n# puts(\"Number of vertices:: #{@num_vertices}\")\n return @num_edges\nend", "def enterEdges\n\t\tputs \"\\nEnter edge between two vertices Eg: A,B\".yellow\n\t\tloop do\n\t\t\tputs \"Enter Vertices pair:\".yellow\n\t\t\tedge_value = gets.chomp.upcase\n\t\t\tif edge_value != ''\n\t\t\t\t# Calling method to create edges\n\t\t\t\t@g.addDirectedEdge(edge_value)\n\t\t\telse\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\tend", "def reduce_edges(graph)\n graph.nodes.each_value do |node|\n if SIMPLE_INPUTS.include?(node.props.dig(:node_class, :node_class))\n node.props[:inlined] = true\n end\n end\n end", "def alg; end", "def test_automaton_of_whole_langage_on_a\n fa, s0, e0 = nil\n assert_nothing_raised do\n fa = Automaton.new do |fa|\n s0 = fa.add_state(:initial => true, :accepting => true)\n e0 = fa.add_edge(s0, s0, {:symbol => 'a'})\n end\n end\n\n # check the whole automaton\n assert_equal(1, fa.state_count)\n assert_equal(1, fa.edge_count)\n assert_equal([s0], fa.states)\n assert_equal([e0], fa.edges)\n assert_equal(true, fa.deterministic?)\n assert_equal([s0], fa.initial_states)\n assert_equal(s0, fa.initial_state)\n assert_equal([e0], fa.in_edges(s0))\n assert_equal([e0], fa.out_edges(s0))\n assert_equal(['a'], fa.in_symbols(s0))\n assert_equal(['a'], fa.out_symbols(s0))\n assert_equal([s0], fa.adjacent_states(s0))\n assert_equal([s0], fa.in_adjacent_states(s0))\n assert_equal([s0], fa.out_adjacent_states(s0))\n end", "def emotional_adjective; end", "def edge_class() @parallel_edges ? Plexus::MultiEdge : Plexus::Edge; end", "def solve\n # 1\n generation = Generation.new(@starting_paths)\n\n # 2\n while !generation.target_reached?\n generation = generation.next\n end\n\n # 3\n message = \"Maze description : going from #{@source} to #{@target}\\n\"\n message << generation.to_s\n Renderer.result(message)\n end", "def test_graph_to_s_incomplete\n sut_graph = Graph.new\n sut_graph.name=\"test_graph\" \n #sut_graph.type=:digraph\n sut_graph.node_style=:ellipse\n \n sut_graph.add_edge(\"TEST1\" , \"TEST2\" , \"take_me_to_test_2\")\n assert_raises RuntimeError do\n returned_obj = sut_graph.to_s\n end # end assert\n end", "def compare_SVO_edges(rev, subm, num_rev_edg, num_sub_edg)\n # puts(\"***********Inside compare SVO edges numRevEdg:: #{num_rev_edg} numSubEdg:: #{num_sub_edg}\")\n best_SVO_SVO_edges_match = Array.new(num_rev_edg){Array.new}\n cum_double_edge_match = 0.0\n count = 0\n max = 0.0\n flag = 0\n wnet = WordnetBasedSimilarity.new \n for i in (0..num_rev_edg - 1)\n if(!rev[i].nil? and !rev[i+1].nil? and rev[i].in_vertex.node_id != -1 and rev[i].out_vertex.node_id != -1 and \n rev[i+1].out_vertex.node_id != -1 and rev[i].out_vertex == rev[i+1].in_vertex)\n #skipping edges with frequent words for vertices\n if(wnet.is_frequent_word(rev[i].in_vertex.name) and wnet.is_frequent_word(rev[i].out_vertex.name) and wnet.is_frequent_word(rev[i+1].out_vertex.name))\n next\n end\n #best match\n for j in (0..num_sub_edg - 1)\n if(!subm[j].nil? and !subm[j+1].nil? and subm[j].in_vertex.node_id != -1 and subm[j].out_vertex.node_id != -1 and \n subm[j+1].out_vertex.node_id != -1 and subm[j].out_vertex == subm[j+1].in_vertex)\n #checking if the subm token is a frequent word\n if(wnet.is_frequent_word(subm[j].in_vertex.name) and wnet.is_frequent_word(subm[j].out_vertex.name))\n next\n end \n #making sure the types are the same during comparison\n if(rev[i].in_vertex.type == subm[j].in_vertex.type and rev[i].out_vertex.type == subm[j].out_vertex.type and \n rev[i+1].out_vertex.type == subm[j+1].out_vertex.type)\n #taking each match separately because one or more of the terms may be a frequent word, for which no @vertex_match exists!\n sum = 0.0\n cou = 0\n if(!@vertex_match[rev[i].in_vertex.node_id][subm[j].in_vertex.node_id].nil?)\n sum = sum + @vertex_match[rev[i].in_vertex.node_id][subm[j].in_vertex.node_id]\n cou +=1\n end\n if(!@vertex_match[rev[i].out_vertex.node_id][subm[j].out_vertex.node_id].nil?)\n sum = sum + @vertex_match[rev[i].out_vertex.node_id][subm[j].out_vertex.node_id]\n cou +=1\n end\n if(!@vertex_match[rev[i+1].out_vertex.node_id][subm[j+1].out_vertex.node_id].nil?)\n sum = sum + @vertex_match[rev[i+1].out_vertex.node_id][subm[j+1].out_vertex.node_id]\n cou +=1\n end\n #-- Only Vertex match\n if(cou > 0)\n best_SVO_SVO_edges_match[i][j] = sum.to_f/cou.to_f\n else\n best_SVO_SVO_edges_match[i][j] = 0.0\n end\n #-- Vertex and SRL\n best_SVO_SVO_edges_match[i][j] = best_SVO_SVO_edges_match[i][j].to_f/ compare_labels(rev[i], subm[j]).to_f\n best_SVO_SVO_edges_match[i][j] = best_SVO_SVO_edges_match[i][j].to_f/ compare_labels(rev[i+1], subm[j+1]).to_f\n #-- Only SRL\n if(best_SVO_SVO_edges_match[i][j] > max)\n max = best_SVO_SVO_edges_match[i][j]\n end\n flag = 1\n end\n end #end of 'if' condition\n end #end of 'for' loop for 'j'\n \n if(flag != 0) #if the review edge had any submission edges with which it was matched, since not all S-V edges might have corresponding V-O edges to match with\n # puts(\"**** Best match for:: #{rev[i].in_vertex.name} - #{rev[i].out_vertex.name} - #{rev[i+1].out_vertex.name} -- #{max}\")\n cum_double_edge_match = cum_double_edge_match + max\n count+=1\n max = 0.0 #re-initialize\n flag = 0\n end\n end #end of 'if' condition\n end #end of 'for' loop for 'i'\n \n avg_match = 0.0\n if(count > 0)\n avg_match = cum_double_edge_match.to_f/ count.to_f\n end\n return avg_match\nend", "def annotate_edges(graph)\n graph.edges.each do |edge|\n if edge.to.props.dig(:node_class, :node_class) == 'org.graalvm.compiler.nodes.ValuePhiNode' && edge.props[:name] == 'values'\n merge_node = edge.to.edges.find { |e| e.props[:name] == 'merge' }.from\n control_into_merge = %w[ends loopBegin]\n merge_node_control_edges_in = merge_node.edges.select { |e| control_into_merge.include?(e.props[:name]) && e.to.props.dig(:node_class, :node_class) != 'org.graalvm.compiler.nodes.LoopExitNode' }\n matching_control_edge = merge_node_control_edges_in[edge.props[:index]]\n control_in_node = matching_control_edge.nodes.find { |n| n != merge_node }\n edge.props[:label] = \"from #{control_in_node.id}\"\n edge.props[:kind] = 'data'\n next\n end\n\n # Look at the name of the edge to decide how to treat them.\n case edge.props[:name]\n\n # Control edges.\n when 'ends', 'next', 'trueSuccessor', 'falseSuccessor', 'exceptionEdge'\n edge.props[:kind] = 'control'\n case edge.props[:name]\n when 'trueSuccessor'\n # Simplify trueSuccessor to T\n edge.props[:label] = 'T'\n when 'falseSuccessor'\n # Simplify falseSuccessor to F\n edge.props[:label] = 'F'\n when 'exceptionEdge'\n # Simplify exceptionEdge to unwind\n edge.props[:label] = 'unwind'\n end\n\n # Info edges, which are drawn reversed as they point from the user\n # to the info.\n when 'frameState', 'callTarget', 'stateAfter'\n edge.props[:label] = nil\n edge.props[:kind] = 'info'\n edge.props[:reverse] = true\n\n # Condition for branches, which we label as ?.\n when 'condition'\n edge.props[:kind] = 'data'\n edge.props[:label] = '?'\n\n # loopBegin edges point from LoopEndNode (continue) and LoopExitNode\n # (break) to the LoopBeginNode. Both are drawn reversed.\n when 'loopBegin'\n edge.props[:hidden] = true\n\n case edge.to.props.dig(:node_class, :node_class)\n when 'org.graalvm.compiler.nodes.LoopEndNode'\n # If it's from the LoopEnd then it's the control edge to follow.\n edge.props[:kind] = 'loop'\n edge.props[:reverse] = true\n when 'org.graalvm.compiler.nodes.LoopExitNode'\n # If it's from the LoopExit then it's just for information - it's\n # not control flow to follow.\n edge.props[:kind] = 'info'\n edge.props[:reverse] = true\n else\n raise EncodingError, 'loopBegin edge not to LoopEnd or LoopExit'\n end\n\n # Merges are info.\n when 'merge'\n edge.props[:kind] = 'info'\n edge.props[:reverse] = true\n\n # Successors are control from a switch.\n when 'successors'\n # We want to label the edges with the corresponding index of the key.\n if edge.props[:index] == edge.from.props['keys'].size\n label = 'default'\n else\n label = \"k[#{edge.props[:index]}]\"\n end\n edge.props[:label] = label\n edge.props[:kind] = 'control'\n\n # Successors are control from a switch.\n when 'arguments'\n # We want to label the edges with their corresponding argument index.\n edge.props[:label] = \"arg[#{edge.props[:index]}]\"\n edge.props[:kind] = 'data'\n\n # Everything else is data.\n else\n edge.props[:kind] = 'data'\n edge.props[:label] = edge.props[:name]\n\n end\n end\n end", "def edge_array\n\t\t\t to_return = @responses.collect { |item| item.sollutions }\n\t\t\t return to_return\n\t\tend", "def synpred1_Entity\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 30 )\n\n\n # at line 76:6: function_call_statement assignment_type\n @state.following.push( TOKENS_FOLLOWING_function_call_statement_IN_synpred1_Entity_591 )\n function_call_statement\n @state.following.pop\n @state.following.push( TOKENS_FOLLOWING_assignment_type_IN_synpred1_Entity_593 )\n assignment_type\n @state.following.pop\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 30 )\n\n\n end", "def compare_edges_syntax_diff(rev, subm, num_rev_edg, num_sub_edg)\n # puts(\"*****Inside compareEdgesSyntaxDiff :: numRevEdg :: #{num_rev_edg} numSubEdg:: #{num_sub_edg}\") \n best_SV_VS_match = Array.new(num_rev_edg){Array.new}\n cum_edge_match = 0.0\n count = 0\n max = 0.0\n flag = 0\n wnet = WordnetBasedSimilarity.new \n for i in (0..num_rev_edg - 1)\n if(!rev[i].nil? and rev[i].in_vertex.node_id != -1 and rev[i].out_vertex.node_id != -1)\n #skipping frequent word\n if(wnet.is_frequent_word(rev[i].in_vertex.name) and wnet.is_frequent_word(rev[i].out_vertex.name))\n next\n end\n for j in (0..num_sub_edg - 1)\n if(!subm[j].nil? and subm[j].in_vertex.node_id != -1 and subm[j].out_vertex.node_id != -1)\n #checking if the subm token is a frequent word\n if(wnet.is_frequent_word(subm[j].in_vertex.name) and wnet.is_frequent_word(subm[j].out_vertex.name))\n next\n end \n if(rev[i].in_vertex.type == subm[j].out_vertex.type and rev[i].out_vertex.type == subm[j].in_vertex.type)\n #taking each match separately because one or more of the terms may be a frequent word, for which no @vertex_match exists!\n sum = 0.0\n cou = 0\n if(!@vertex_match[rev[i].in_vertex.node_id][subm[j].out_vertex.node_id].nil?)\n sum = sum + @vertex_match[rev[i].in_vertex.node_id][subm[j].out_vertex.node_id]\n cou +=1\n end\n if(!@vertex_match[rev[i].out_vertex.node_id][subm[j].in_vertex.node_id].nil?)\n sum = sum + @vertex_match[rev[i].out_vertex.node_id][subm[j].in_vertex.node_id]\n cou +=1\n end \n \n if(cou > 0)\n best_SV_VS_match[i][j] = sum.to_f/cou.to_f\n else\n best_SV_VS_match[i][j] = 0.0\n end\n \n flag = 1\n if(best_SV_VS_match[i][j] > max)\n max = best_SV_VS_match[i][j]\n end\n end\n end #end of the if condition\n end #end of the for loop for the submission edges \n \n if(flag != 0)#if the review edge had any submission edges with which it was matched, since not all S-V edges might have corresponding V-O edges to match with\n # puts(\"**** Best match for:: #{rev[i].in_vertex.name} - #{rev[i].out_vertex.name}-- #{max}\")\n cum_edge_match = cum_edge_match + max\n count+=1\n max = 0.0 #re-initialize\n flag = 0\n end\n \n end #end of the if condition\n end #end of the for loop for the review\n \n avg_match = 0.0\n if(count > 0)\n avg_match = cum_edge_match.to_f/count.to_f\n end\n return avg_match\nend", "def build_assignment_graph(layer)\n\t\th = @via_positions.length\n\t\tfail if (h == 0) || h.odd?\n\t\tfail if @start_node.pads.min < 0 || @start_node.pads.max >= @layer_count\n\t\tfail if @end_node.pads.min < 0 || @end_node.pads.max >= @layer_count\n\t\tvia_count = h / 2\n\t\tputs via_count\n\t\tlayers = 0..(@layer_count - 1) \n\t\tcolums = 0..(via_count * 2) # F O F O F for via_count == 2 \n\t\t#vp = @via_positions.dup # x,y pairs\n\t\t#vp.unshift(@start_node.y)\n\t\t#vp.unshift(@start_node.x)\n\t\tvp = [@start_node.x, @start_node.y] + @via_positions\n\t\tm = Array.new(@layer_count){Array.new(via_count * 2 + 1)}\n\t\tfor i in colums # from T back to S\n\t\t\tif i.even?\n\t\t\t\ty = vp.pop\n\t\t\t\tx = vp.pop\n\t\t\tend\n\t\t\tfor j in layers\n\t\t\t\tl = Array.new\n\t\t\t\tif i.even? # forward\n\t\t\t\t\tk = i + 1\n\t\t\t\t\twhile k > 0\n\t\t\t\t\t\tk -= 2\n\t\t\t\t\t\tif k == -1 # link forward node to T node\n\t\t\t\t\t\t\tl << @end_node if @end_node.pads.include?(j)\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tif (h = m[j][k])\n\t\t\t\t\t\t\t\tl << h # link to up/down node \n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tunless l.empty?\n\t\t\t\t\t\tm[j][i] = F_node.new(x, y, j, l)\n\t\t\t\t\t\tl.each{|el|\n\t\t\t\t\t\t#unless @segment_list.index{|m| m.x1 == && m.y1 == el.y1 & m.x2 == el.x2 && m.y2 == el.y2}\n\t\t\t\t\t\t\t@segment_list << Segment.new(x, y, el.x, el.y)\n\t\t\t\t\t\t}\n\t\t\t\t\tend\n\t\t\t\telse #up/down\n\t\t\t\t\tfor k in layers do\n\t\t\t\t\t\tif (k != j) && (h = m[k][i - 1])\n\t\t\t\t\t\t\tl << h\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tunless l.empty?\n\t\t\t\t\t\tm[j][i] = V_node.new(x, y, j, l)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t#puts @segment_list.length\n\t\t@segment_list.uniq!{|el| [el.x1, el.y1, el.x2, el.y2]}\n\t\tputs @segment_list.length\n\t\t@all_intersecting_segments = Array.new\n\t\t@segment_list.each{|el|\n\t\t\t@all_intersecting_segments += el.intersecting_segments\n\t\t}\n\t\t@all_intersecting_segments.uniq!\n\n\t\tfor j in layers\n\t\t\tif (h = m[j][-1]) && @start_node.pads.include?(j)\n\t\t\t\t@start_node.next << h\n\t\t\tend\n\t\tend\n\tend", "def each_edge(v)\n raise NotImplementedError\n end", "def new_edge\n\t\t\traise NotImplementedError.new('#new_edge must be implemented')\n\t\tend", "def synpred8_Jejune\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 94 )\n\n # at line 556:7: member assignment_op\n @state.following.push( TOKENS_FOLLOWING_member_IN_synpred8_Jejune_3692 )\n member\n @state.following.pop\n @state.following.push( TOKENS_FOLLOWING_assignment_op_IN_synpred8_Jejune_3694 )\n assignment_op\n @state.following.pop\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 94 )\n\n end", "def get_relevance(reviews, submissions, num_reviews, pos_tagger, core_NLP_tagger, speller) #double dimensional arrays that contain the submissions and the reviews respectively\n review_vertices = nil\n review_edges = nil\n subm_vertices = nil\n subm_edges = nil\n num_rev_vert = 0\n num_rev_edg = 0 \n num_sub_vert = 0 \n numSubEdg = 0\n vert_match = 0.0\n edge_without_syn = 0.0\n edge_with_syn = 0.0\n edge_diff_type = 0.0\n double_edge = 0.0\n double_edge_with_syn = 0.0\n \n #since Reviews and Submissions \"should\" contain the same number of records review - submission pairs\n g = GraphGenerator.new\n #generating review's graph\n g.generate_graph(reviews, pos_tagger, core_NLP_tagger, true, false)\n review_vertices = g.vertices\n review_edges = g.edges\n num_rev_vert = g.num_vertices\n num_rev_edg = g.num_edges\n \n #assigning graph as a review graph to use in content classification\n @review = g.clone\n \n# puts \"@review.num_edges: #{@review.num_edges}\"\n \n #generating the submission's graph\n g.generate_graph(submissions, pos_tagger, core_NLP_tagger, true, false)\n subm_vertices = g.vertices\n subm_edges = g.edges\n num_sub_vert = g.num_vertices\n num_sub_edg = g.num_edges\n \n vert_match = compare_vertices(pos_tagger, review_vertices, subm_vertices, num_rev_vert, num_sub_vert, speller)\n if(num_rev_edg > 0 and num_sub_edg > 0)\n edge_without_syn = compare_edges_non_syntax_diff(review_edges, subm_edges, num_rev_edg, num_sub_edg)\n edge_with_syn = compare_edges_syntax_diff(review_edges, subm_edges, num_rev_edg, num_sub_edg)\n edge_diff_type = compare_edges_diff_types(review_edges, subm_edges, num_rev_edg, num_sub_edg)\n edge_match = (edge_without_syn.to_f + edge_with_syn.to_f )/2.to_f #+ edge_diff_type.to_f\n double_edge = compare_SVO_edges(review_edges, subm_edges, num_rev_edg, num_sub_edg)\n double_edge_with_syn = compare_SVO_diff_syntax(review_edges, subm_edges, num_rev_edg, num_sub_edg)\n double_edge_match = (double_edge.to_f + double_edge_with_syn.to_f)/2.to_f\n else\n edge_match = 0\n double_edge_match = 0\n end\n \n #differently weighted cases\n #tweak this!!\n alpha = 0.55\n beta = 0.35\n gamma = 0.1 #alpha > beta > gamma\n relevance = (alpha.to_f * vert_match.to_f) + (beta * edge_match.to_f) + (gamma * double_edge_match.to_f) #case1's value will be in the range [0-6] (our semantic values) \n scaled_relevance = relevance.to_f/6.to_f #scaled from [0-6] in the range [0-1]\n \n #printing values\n# puts(\"vertexMatch is [0-6]:: #{vert_match}\")\n# puts(\"edgeWithoutSyn Match is [0-6]:: #{edge_without_syn}\")\n# puts(\"edgeWithSyn Match is [0-6]:: #{edge_with_syn}\")\n# puts(\"edgeDiffType Match is [0-6]:: #{edge_diff_type}\")\n# puts(\"doubleEdge Match is [0-6]:: #{double_edge}\")\n# puts(\"doubleEdge with syntax Match is [0-6]:: #{double_edge_with_syn}\")\n# puts(\"relevance [0-6]:: #{relevance}\")\n# puts(\"scaled relevance on [0-1]:: #{scaled_relevance}\")\n# puts(\"*************************************************\")\n return scaled_relevance\nend", "def nd!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 50 )\n\n type = ND\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n d = nil\n\n\n \n # - - - - main rule block - - - -\n # at line 349:5: d= ( ( DIGIT )* ) '2' ( 'N' | 'n' ) ( 'D' | 'd' )\n # at line 349:7: ( ( DIGIT )* )\n # at line 349:8: ( DIGIT )*\n # at line 349:8: ( DIGIT )*\n while true # decision 2\n alt_2 = 2\n look_2_0 = @input.peek( 1 )\n\n if ( look_2_0 == 0x32 )\n look_2_1 = @input.peek( 2 )\n\n if ( look_2_1.between?( 0x30, 0x39 ) )\n alt_2 = 1\n\n end\n elsif ( look_2_0.between?( 0x30, 0x31 ) || look_2_0.between?( 0x33, 0x39 ) )\n alt_2 = 1\n\n end\n case alt_2\n when 1\n # at line 349:8: DIGIT\n digit!\n\n else\n break # out of loop for decision 2\n end\n end # loop for decision 2\n\n match( 0x32 )\n if @input.peek(1) == 0x4e || @input.peek(1) == 0x6e\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n if @input.peek(1) == 0x44 || @input.peek(1) == 0x64\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 50 )\n\n end", "def compare_edges_non_syntax_diff(rev, subm, num_rev_edg, num_sub_edg)\n# puts(\"*****Inside compareEdgesnNonSyntaxDiff numRevEdg:: #{num_rev_edg} numSubEdg:: #{num_sub_edg}\") \n best_SV_SV_match = Array.new(num_rev_edg){Array.new}\n cum_edge_match = 0.0\n count = 0\n max = 0.0\n flag = 0\n \n wnet = WordnetBasedSimilarity.new\n for i in (0..num_rev_edg - 1)\n if(!rev[i].nil? and rev[i].in_vertex.node_id != -1 and rev[i].out_vertex.node_id != -1)\n #skipping edges with frequent words for vertices\n if(wnet.is_frequent_word(rev[i].in_vertex.name) and wnet.is_frequent_word(rev[i].out_vertex.name))\n next\n end\n \n #looking for best matches\n for j in (0..num_sub_edg - 1)\n #comparing in-vertex with out-vertex to make sure they are of the same type\n if(!subm[j].nil? && subm[j].in_vertex.node_id != -1 && subm[j].out_vertex.node_id != -1)\n \n #checking if the subm token is a frequent word\n if(wnet.is_frequent_word(subm[j].in_vertex.name) and wnet.is_frequent_word(subm[j].out_vertex.name))\n next\n end \n \n #carrying out the normal comparison\n if(rev[i].in_vertex.type == subm[j].in_vertex.type && rev[i].out_vertex.type == subm[j].out_vertex.type)\n if(!rev[i].label.nil?)\n if(!subm[j].label.nil?)\n #taking each match separately because one or more of the terms may be a frequent word, for which no @vertex_match exists!\n sum = 0.0\n cou = 0\n if(!@vertex_match[rev[i].in_vertex.node_id][subm[j].in_vertex.node_id].nil?)\n sum = sum + @vertex_match[rev[i].in_vertex.node_id][subm[j].in_vertex.node_id]\n cou +=1\n end\n if(!@vertex_match[rev[i].out_vertex.node_id][subm[j].out_vertex.node_id].nil?)\n sum = sum + @vertex_match[rev[i].out_vertex.node_id][subm[j].out_vertex.node_id]\n cou +=1\n end \n #--Only vertex matches\n if(cou > 0)\n best_SV_SV_match[i][j] = sum.to_f/cou.to_f\n else\n best_SV_SV_match[i][j] = 0.0\n end\n #--Vertex and SRL - Dividing it by the label's match value\n best_SV_SV_match[i][j] = best_SV_SV_match[i][j]/ compare_labels(rev[i], subm[j])\n flag = 1\n if(best_SV_SV_match[i][j] > max)\n max = best_SV_SV_match[i][j]\n end\n end\n end\n end\n end\n end #end of for loop for the submission edges\n \n #cumulating the review edges' matches in order to get its average value\n if(flag != 0) #if the review edge had any submission edges with which it was matched, since not all S-V edges might have corresponding V-O edges to match with\n # puts(\"**** Best match for:: #{rev[i].in_vertex.name} - #{rev[i].out_vertex.name} -- #{max}\")\n cum_edge_match = cum_edge_match + max\n count+=1\n max = 0.0#re-initialize\n flag = 0\n end\n end\n end #end of 'for' loop for the review's edges\n \n #getting the average for all the review edges' matches with the submission's edges\n avg_match = 0.0\n if(count > 0)\n avg_match = cum_edge_match/ count\n end\n return avg_match\nend", "def process_iasgn exp\n exp = exp.dup\n exp.rhs = process exp.rhs\n exp\n end", "def test_to_s\n graph = DirectedGraph.new\n vertex_a = Vertex.new('a')\n vertex_b = Vertex.new('b')\n vertex_c = Vertex.new('c')\n graph.add_vertex(vertex_a).add_vertex(vertex_b).add_vertex(vertex_c)\n graph.add_edge('a','b').add_edge('c','b')\n\n assert(graph.to_s == 'a=>b,b=>,c=>b')\n end", "def test_edge_count_on_examples\n assert_equal(6, @small_dfa.edge_count)\n assert_equal(7, @small_nfa.edge_count)\n end", "def relation\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 28 )\n\n\n value = nil\n\n\n type = nil\n a = nil\n b = nil\n\n\n begin\n # at line 178:5: a= add (type= ( '==' | '!=' | '<' | '<=' | '>=' | '>' ) b= relation )?\n @state.following.push( TOKENS_FOLLOWING_add_IN_relation_1322 )\n a = add\n @state.following.pop\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value = a \n # <-- action\n end\n\n # at line 179:3: (type= ( '==' | '!=' | '<' | '<=' | '>=' | '>' ) b= relation )?\n alt_44 = 2\n look_44_0 = @input.peek( 1 )\n\n if ( look_44_0 == T__31 || look_44_0.between?( T__47, T__48 ) || look_44_0.between?( T__50, T__52 ) )\n alt_44 = 1\n end\n case alt_44\n when 1\n # at line 179:6: type= ( '==' | '!=' | '<' | '<=' | '>=' | '>' ) b= relation\n type = @input.look\n\n if @input.peek(1) == T__31 || @input.peek( 1 ).between?( T__47, T__48 ) || @input.peek( 1 ).between?( T__50, T__52 )\n @input.consume\n @state.error_recovery = false\n\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n\n mse = MismatchedSet( nil )\n raise mse\n\n end\n\n\n @state.following.push( TOKENS_FOLLOWING_relation_IN_relation_1359 )\n b = relation\n @state.following.pop\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value = DoubleOperandExpressionEval.new(type.text, a, b) \n # <-- action\n end\n\n\n end\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 28 )\n\n\n end\n\n return value\n end", "def make_graph(input)\n dg = RGL::AdjacencyGraph[]\n lines = input.split(\"\\n\")\n n = lines[0].to_i\n for i in 1..n do\n data = lines[i].split(\" \")\n next if data[0].to_i <= 0\n data.shift # break data\n data.each{|v| dg.add_edge i, v.to_i }\n end\n dg\nend", "def test_in_edges_and_out_edges_by_state_name\n dfa = ADL.parse_automaton <<-DFA\n 2 2\n First true false\n Second false true\n First Second a\n Second First b\n DFA\n assert_equal dfa.ith_edges(0), dfa.in_edges('Second')\n assert_equal dfa.ith_edges(0), dfa.out_edges('First')\n end", "def test_specific_info\n \n # Start a new graph with no vertices\n graph = Graph.new()\n \n # Add 2 vertices to the graph\n origin = { \"code\" => \"NYC\" ,\n \"name\" => \"New York\" ,\n \"country\" => \"US\" ,\n \"continent\" => \"North America\" ,\n \"timezone\" => -5 ,\n \"coordinates\" => { \"N\" => 41, \"W\" => 74 } ,\n \"population\" => 22200000 ,\n \"region\" => 3 }\n \n destination = { \"code\" => \"WAS\" ,\n \"name\" => \"Washington\" ,\n \"country\" => \"US\" ,\n \"continent\" => \"North America\" ,\n \"timezone\" => -5 ,\n \"coordinates\" => {\"N\" => 39, \"W\" => 77} ,\n \"population\" => 8250000 ,\n \"region\" => 3 } \n graph.add_node(origin)\n graph.add_node(destination)\n \n assert_equal(graph.get_specific_info(\"CHI\"), \"City doesn't exist in the graph.\")\n \n # Get information on Washington and check that correct information is\n # contained in the return value\n info = graph.get_specific_info(\"WAS\")\n \n assert_equal( info.include?(\"WAS\"), true )\n assert_equal( info.include?(\"Washington\"), true )\n assert_equal( info.include?(\"US\"), true )\n assert_equal( info.include?(\"North America\"), true )\n assert_equal( info.include?(\"N 39, W 77\"), true )\n assert_equal( info.include?(\"Population: 8250000\"), true )\n assert_equal( info.include?(\"Region: 3\"), true )\n assert_equal( info.include?(\"Direct Connections: WAS\"), false )\n \n # Add an edge and check if that information is reflected in the return value\n graph.add_edge(\"NYC\",\"WAS\" ,570)\n info = graph.get_specific_info(\"NYC\")\n \n assert_equal( info.include?(\"Direct Connections: WAS - 570\"), true)\n\n end", "def greibach_normal_form\n raise NotImplementedError\n end", "def graph\n \n \n @graphml = \"<graphml><key id='label' for='all' attr.name='label' attr.type='string'/><key id='link' for='all' attr.name='link' attr.type='string'/><key id='weight' for='all' attr.name='weight' attr.type='double'/><key id='edgetype' for='edge' attr.name='edgetype' attr.type='string'/><key id='nodetype' for='node' attr.name='nodetype' attr.type='string'/><graph edgedefault='directed'>\" \n @sif = ''\n \n @max = 2\n @log = Array.new\n @additional = {'cleavage' => {}, 'inverse_cleavage' => {}, 'inhibition' => {}, 'inverse_inhibition' => {}, 'interaction' => {}}\n add_nodes(nil,self.protein,nil,0,nil)\n add_additional_nodes(@additional['cleavage'],'cleavage')\n add_additional_nodes(@additional['inverse_cleavage'],'inverse_cleavage')\n add_additional_nodes(@additional['inhibition'],'inhibition')\n add_additional_nodes(@additional['inverse_inhibition'],'inverse_inhibition')\n \n @graphml << \"</graph></graphml>\"\n\n \n # f = File.open(\"#{RAILS_ROOT}/public/images/dynamic/#{self.protein.name}-#{'ppi' if ppi}network.graphml\", 'w')\n # f << @graphml\n # f.close\n\n return @graphml\n end", "def DFS_solution\n\n\t\t# Checking if I got the final solution\n\t\tif @graph.solution?\n\t\t\tif DEBUG\n\t\t\t\tputs \"Solution found:\\n#{@graph.plot_graph}\"\n\t\t\tend\n\t\t\treturn 0\n\t\tend\n\n\t\t# If not i'll find which are the possible next actions from this state\n\t\t# and iterates on them.\n\t\tresult = -1\n\t\t@graph.find_next_actions\n\t\tif DEBUG\n\t\t\tputs \"Un-A -> #{@graph.get_current_node.get_unexplored_actions}\"\n\t\tend\n\t\t# TODO Make this correct, i am skipping a level in the structures\n\t\t@graph.get_current_node.get_unexplored_actions.each do |i|\n\t\t\t# I have to create a new node starting from the current one and \n\t\t\t# knowing the action we have chosen\n\t\t\t@graph.next_state( i )\n\t\t\tresult = self.DFS_solution\n\t\t\t# With break I have to pass over all the calls in the recursive\n\t\t\t# stack, with return it skips all these steps.\n\t\t\t# break if result == 0\n\t\t\treturn 0 if result == 0\n\t\tend\n\n\t\t# If I get here means that with this configuration I will not get to a\n\t\t# solution, so I have to delete what I did in this step.\n\t\t# I'll delete the last positioned Queen, replacing it with a nil.\n\t\tunless result == 0\n\t\t\tif DEBUG\n\t\t\t\tputs \"BACKWARD!\"\n\t\t\tend\n\t\t\t@graph.delete_last_action\n\t\t\treturn -1 \n\t\tend\n\n\tend", "def traverse_graph(start_node_name, definitions, file_name)\n json_result = []\n all_paths = find_all_paths_from_node(start_node_name)\n all_paths = remove_subarrays(all_paths)\n\n all_paths.each do |path|\n p \"path: #{path}\"\n next if path.length < 2\n\n (0..path.length - 1).each do |i|\n break if i == path.length - 1\n break if @adj_matrix[path[i]].eql? nil\n break if @adj_matrix[path[i]][path[i + 1]].eql? nil\n\n @adj_matrix.fetch(path[i]).fetch(path[i + 1]).fetch('function')\n begin\n definitions.send(@adj_matrix.fetch(path[i]).fetch(path[i + 1]).fetch('function'))\n @adj_matrix[path[i]][path[i + 1]]['value'] = true\n rescue RuntimeError => e\n puts \"ERROR going from #{path[i]} to #{path[i + 1]}\"\n puts e.message.to_s\n # unless @adj_matrix[path[i]][path[i + 1]]['value'] = false\n # appended_error = @adj_matrix[path[i]][path[i + 1]]['label'].concat(\" \\nError: #{e.message}\")\n # @adj_matrix[path[i]][path[i + 1]]['label'] = appended_error\n # end\n @adj_matrix[path[i]][path[i + 1]]['value'] = false\n end\n\n temp = {}\n temp['source'] = path[i]\n temp['destination'] = path[i + 1]\n temp['label'] = @adj_matrix[path[i]][path[i + 1]]['label']\n temp['value'] = @adj_matrix[path[i]][path[i + 1]]['value']\n json_result.push(temp)\n end\n build_model(json_result, file_name)\n end\n build_model(json_result, file_name)\n end", "def class_disambiguation(rdfdata,transitive)\n puts \"RDF to SVM WITH META PROPERTIES ...\"\n number_homonyms=[]\n max=nil\n min=nil\n svmmodelbygroup=[]\n ftotal = 0\n max_featuresbygroup=[]\n min_featuresbygroup=[]\n global_maximum=0\n\n # puts \"DATA DEBUG 1\"\n # puts rdfdata[0][0]\n puts \"############# RESTRICTED INVERSE FUNCTIONAL PROPERTIES\"\n # puts $textp\n ifp = restricted_IFP(rdfdata) + $textp + propertyoverflow(rdfdata)\n ifp.uniq!\n # puts ifp\n ifp.map!{|x| getCode(x.to_s.hash.abs)}\n\n groups_counter=[]\n count=-1\n pivot = nil # the smallest ambiguous set\n\n rdfdata.each{|group|\n count=count+1\n ######################## All Predicates ##########################\n # puts \"Encoding group ...\"\n #puts group.uniq.map{|s,p,o| s.to_s + \" \" + p.to_s + \" \" + o.to_s}\n new_group = group.uniq.map{|s,p,o| [getCode(s.to_s.hash.abs),getCode(p.to_s.hash.abs),getCode(o.to_s.hash.abs),o.instance_of?(RDFS::Resource) ] }.compact\n # new_group = group.uniq.map{|s,p,o| [ (s.to_s ), (p.to_s ), (o.to_s),o.instance_of?(RDFS::Resource) ] }.compact\n # puts \"Selecting items of measurement ...\"\n predicate_counter = new_group.map{|s,p| p }.compact\n datatype_objects = new_group.map{|s,p,o,t| o if !t and !ifp.include?(p) }.compact\n object_properties = new_group.map{|s,p,o,t| o if t and !ifp.include?(p) }.compact\n tuple_counter = new_group.map{|s,p,o,t| p.to_s + \" \" + o.to_s if !ifp.include?(p) }.compact\n #tuple_counter = new_group.map{|s,p,o,t| p.to_s + \" \" + o.to_s if !ifp.include?(p) && discriminative_predicates.include?(p) }.compact\n\n # puts \"Grouping subjects ...\"\n subjects = new_group.map{|s,p,o,t| s}.uniq\n groupedsubject = subjects.map{|x| new_group.find_all{|s,p,o,t| s==x}}\n groups_counter << [groupedsubject,predicate_counter,datatype_objects,object_properties,tuple_counter]\n }\n\n puts \"Buiding Model ...\"\n #####################################################################\n groups_counter_idx = -1\n groups_counter.each{|gs, group_predicates, group_datatype, group_objects, group_tuple|\n groups_counter_idx = groups_counter_idx + 1\n ################ GLOBAL PREDICATES AND OBJECTS ##############\n lines=[]\n max=nil\n count=count+1\n puts \"GROUP############## - \" + groups_counter_idx.to_s\n puts gs.size\n number_homonyms << gs.size\n gs.each{|subject|\n predicates = subject.map{|s,p| p }.compact\n datatype_objects = subject.map{|s,p,o,t| o if !t and !ifp.include?(p) }.compact\n object_properties = subject.map{|s,p,o,t| o if t and !ifp.include?(p) }.compact\n tuple_counter = subject.map{|s,p,o| p.to_s + \" \" + o.to_s if !ifp.include?(p) }.compact\n # tuple_counter = subject.map{|s,p,o| p.to_s + \" \" + o.to_s if !ifp.include?(p) && discriminative_predicates.include?(p) }.compact\n\n features = []\n sim1 = 0\n sim2 = 0\n sim3 = 0\n sim4 = 0\n counter1 = -1\n # puts \"SUBJECT\"\n puts subject[0][0]\n # puts tuple_counter\n ############################ Resource Vs. Origin Pivot\n if groups_counter_idx < $origin_subjects.size\n # puts \"ORIGIN SIZE \"\n # puts $origin_subjects.size\n # puts $origin_subjects[groups_counter_idx].size\n\n origin_s = $origin_subjects[groups_counter_idx].map{|p,o| [ getCode(p.to_s.hash.abs),getCode(o.to_s.hash.abs),o.instance_of?(RDFS::Resource) ] }.compact\n # origin_s = $origin_subjects[groups_counter_idx].map{|p,o| [ (p.to_s ), (o.to_s),o.instance_of?(RDFS::Resource) ] }.compact\n origin_predicates = origin_s.map{|p,o| p}.compact\n origin_datatype_objects = origin_s.map{|p,o,t| o if !t }.compact\n origin_object_properties = origin_s.map{|p,o,t| o if t }.compact\n origin_tuple_counter = origin_s.map{|p,o| p.to_s + \" \" + o.to_s }.compact\n\n groups_counter.each{|gs,group_predicates,group_datatype, group_objects, group_tuple|\n sim1 = sim1 + hm(origin_predicates,predicates, gs.size.to_f)\n sim2 = sim2 + hm(origin_datatype_objects, datatype_objects, gs.size.to_f)\n sim3 = sim3 + hm(origin_object_properties, object_properties, gs.size.to_f)\n sim4 = sim4 + hm(origin_tuple_counter, tuple_counter, gs.size.to_f)\n }\n end\n # puts \"PIVOT SIMILARITY\"\n # puts sim1\n # puts sim2\n # puts sim3\n # puts sim4\n ############################ Resource Vs. Pseudo-Homonyms\n groups_counter.each{|gs,group_predicates,group_datatype, group_objects, group_tuple|\n counter1 = counter1 + 1\n next if groups_counter_idx == counter1\n sim1 = sim1 + hm(group_predicates,predicates, gs.size.to_f)\n sim2 = sim2 + hm(group_datatype, datatype_objects, gs.size.to_f)\n sim3 = sim3 + hm(group_objects, object_properties, gs.size.to_f)\n sim4 = sim4 + hm(group_tuple, tuple_counter, gs.size.to_f)\n }\n # puts \"SIMILARITY\"\n # puts sim1\n # puts sim2\n # puts sim3\n # puts sim4\n # features << sim1\n # features << sim2\n # features << sim3\n # features << sim4\n features << (sim1 + sim2 + sim3 + sim4 ).abs\n\n lines << features\n max = Array.new(features) if max == nil\n max.each_index{|idx| max[idx] = features[idx] if max[idx] < features[idx]}\n }\n max.each {|gg| global_maximum = gg if global_maximum < gg}\n max_featuresbygroup << max\n svmmodelbygroup << lines\n # lines.each{|ss| puts ss.join (\" \") }\n puts \"END GROUP ###\"\n }\n # put \"####### Maximum Absolute\"\n # max_featuresbygroup.map{|v| }\n puts \"########### Normalizing Features\"\n idx=-1\n svmmodelbygroup.map!{|g|\n idx=idx+1\n subidx = -1\n g.map!{|f|\n subidx = subidx+1\n line = \"\"\n f.each_index{|i|\n v = f[i]\n if max_featuresbygroup[idx][i] != 0\n v = f[i] / global_maximum\n\n # v = f[i] / max_featuresbygroup[idx][i]\n\n if f[i] == global_maximum\n # add_pivot(rdfdata[idx], @searchedlabels[idx] ,subidx) if $usepivot\n add_pivot(rdfdata[idx], nil ,subidx) if $usepivot\n end\n end\n line = line + \"#{i+1}:#{v} \" if !v.nan?\n }\n line\n }\n }\n # puts \"THRESHOLD USED\"\n # # change this if more than one feature is used.\n # $threshold_global = (max_featuresbygroup.flatten.sum.to_f/ max_featuresbygroup.size.to_f) / global_maximum\n # if $threshold_global > 0.90\n # $threshold_global = max_featuresbygroup.flatten.min\n # end\n puts $threshold_global\n # svmmodelbygroup.each{|g| puts \"GROUP ########\"\n # puts g\n # puts \"############3\"\n # }\n puts \"NUMBER OF GROUPS\"\n puts svmmodelbygroup.size\n puts \"NUMBER OF ELEMENTS BY GROUPS 0\"\n puts svmmodelbygroup[0].size if svmmodelbygroup.size > 0\n puts \"NUMBER OF HOMONYMS\"\n number_homonyms.each{|v | $number_homonyms = $number_homonyms + v}\n $list_number_homonyms = $list_number_homonyms + number_homonyms\n puts number_homonyms.sort.join(\"\\t\")\n puts number_homonyms.join(\"\\t\")\n\n return svmmodelbygroup\n end", "def element_type\n :edge\n end", "def findMaximum(weights)\n\t\n\tputs \"Weights\" if DEBUG_OUTPUT\n\tprintMatrix(weights) if DEBUG_OUTPUT\n\t# l(x) == l[x]\n\t\t\n\teq = EqualityGraph.new(weights)\n\teq.generateLabelFunctions()\n\t\n\t#Generate equality graph\n\t\n\teq.generateEqualityGraph()\n\t\n\t#Pick an abitrary matching in the equality subgraph\n\t\n\teq_match = MatchGraph.new(eq.x_vertices, eq.y_vertices)\n\t\n\teq.initialMatch(eq_match)\t\n\t\n\tputs \"Equality Match\\n#{eq_match.to_s}\" if DEBUG_OUTPUT\n\t\n\t#puts \"Is Equality Match perfect? #{eq_match.isPerfectMatch}\" if DEBUG_OUTPUT\n\t\t\t\n\tuntil(eq_match.isPerfectMatch)\n\t\t#Pick a free vertex in X\n\t\tfreeX = eq_match.get_free_x_vertex\n\t\t\n\t\teq_match.alt_tree_x_nodes.push(freeX)\n\t\t\t\n\t\tputs \"\\nMAJOR STEP Picked a free X: #{freeX}\" if DEBUG_OUTPUT\n\t\t\n\t\ts_vertices = [ freeX ]\n\t\tt_vertices = Array.new\n\t\t\n\t\t#Though sets s and t should be enough, will keep track of the alternating paths \n\t\t#originating at freeX\n\t\t\n\t\t\n\t\ts_neighbors = eq.get_neighbors_of_x_vertices(s_vertices).to_set\n\t\t\n\t\ts_neighbors_not_in_t = s_neighbors.to_a\n\t\t\n\t\tuntil(false)\n\t\t\tputs \"S = #{s_vertices.to_a} N(S) = #{s_neighbors.to_a} T= #{t_vertices.to_a}\" if DEBUG_OUTPUT\n\t\t\t\t\n\t\t\tif s_neighbors.size == t_vertices.size\n\t\t\t\tputs \"\\nSTEP No more s_neighbors to process, growing eq\" if DEBUG_OUTPUT\n\t\t\t\told_size = s_neighbors.size\n\t\t\t\t\n\t\t\t\teq.growEqualityGraph(s_vertices, t_vertices, s_neighbors, s_neighbors_not_in_t)\n\t\t\t\t\n\t\t\t\traise \"s neighbors did not increase\" if s_neighbors.size <= old_size\t\t\t\t\t\t\n\t\t\telse\n\t\t\t\tputs \"\\nSTEP Picking a new Y not yet in T from S neighbors\" if DEBUG_OUTPUT\n\t\t\t\t#pick y\n\t\t\t\ty = s_neighbors_not_in_t.pop #(s_neighbors - t_vertices).find { true } \n\t\t\t\tif eq_match.is_y_vertex_free(y)\n\t\t\t\t\t#Reset S and T\n\t\t\t\t\traise \"T and S are out of wack\" if s_vertices.size != t_vertices.size + 1\t\t\t\t\t\n\t\t\t\t\teq_match = growMatch(y, eq_match, eq, freeX)\n\t\t\t\t\tputs \"Grew match Equality Graph was #{eq}\" if DEBUG_OUTPUT\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\tputs \"y[#{y}] is matched\" if DEBUG_OUTPUT\n\t\t\t\t\tnew_s_node = growTree(s_vertices, t_vertices, y, eq, eq_match)\n\t\t\t\t\t\n\t\t\t\t\tnew_s_neighbors = eq.get_neighbors_of_x_vertices( [new_s_node] )# - t_vertices\n\t\t\t\t\ts_neighbors.merge( new_s_neighbors )\n\t\t\t\t\t#new_s_neighbors could intesect with t\n\t\t\t\t\ts_neighbors_not_in_t = (s_neighbors - t_vertices).to_a\n\t\t\t\tend\n\t\t\tend \n\t\tend\n\tend\n\t\n\tputs \"Sum is #{eq_match.sumEdgeWeights(weights)}\" if DEBUG_OUTPUT\n\t\n\treturn eq_match.sumEdgeWeights(weights)\nend", "def problem_107\n if false\n net = [ \"-,16,12,21,-,-,-\", \"16,-,-,17,20,-,-\", \"12,-,-,28,-,31,-\",\n \"21,17,28,-,18,19,23\", \"-,20,-,18,-,-,11\", \"-,-,31,19,-,-,27\",\n \"-,-,-,23,11,27,-\" ]\n net.map! {|line| line.split(/,/).map {|i| i == '-' ? nil : i.to_i}}\n else\n net = []\n open(\"network.txt\").each do |line|\n net << line.chomp.split(/,/).map {|i| i == '-' ? nil : i.to_i}\n end\n end\n\n # Reformat into an array of nodes, with the their connections\n nodes = Hash.new {|h,k| h[k] = Hash.new }\n net.each_with_index do |row,i| # Each nodes is connected to...\n row.each_index do |col| # For each possible connection....\n # Add the node we are connected to and the cost\n nodes[i][col] = row[col] if row[col]\n end\n end\n\n initial = nodes.reduce(0) do |a,row|\n row[1].reduce(a) {|aa,p| aa + p[1] }\n end / 2\n # add to the 'borg' that is node0\n node0,node0_links = nodes.shift\n ans = []\n node0_contains = Hash.new\n node0_contains[node0] = true\n\n # What we do select the lowest link, the 'merge' it into node0, repeat\n while nodes.length > 0\n n,v = node0_links.min {|a,b| a[1] <=> b[1]}\n ans << [n,v] # Save the link for the answer\n node0_contains[n] = true # add to the 'borg' that is node0\n nodes[n].each_pair do |k,a| # Now merge in new poin, update vertexs\n next if node0_contains[k]\n node0_links[k] = [a, node0_links[k] || 1_000_000].min\n end\n nodes.delete(n) # Remove from free nodes\n node0_links.delete(n) # Remove from vertexes to resolve\n end\n\n now = ans.reduce(0) {|a,v| a + v[1]}\n puts \"initial = #{initial}\"\n puts \"now = #{now}\"\n initial - now\nend", "def test_node_change_log1\r\n @mymodel = Model.new(1, \"rubylicious\") \r\n node_list = @mymodel.node_list\r\n\r\n node1 = node_list.add_node('autonum', 'node one', NODE);\r\n perfind2 = node_list.add_node('autonum', 'pi two', PERFIND); \r\n process3 = node_list.add_node('autonum', 'process three', PROCESS);\r\n process4 = node_list.add_node('autonum', 'process four', PROCESS); \r\n\r\n process3.evidence = [0.2, 0.3]\r\n process4.evidence = [0.54, 0.777]\r\n \r\n assert(@mymodel.consume_next_node_change.nil?)\r\n end", "def possible_bipartition_VERBOSE(dislikes)\n puts \"\\nADJ LIST = #{dislikes}\"\n # when can we stop? when we visited all the dogs\n # what about friendly dogs? they're exempt\n \n friendlies = dislikes.select do |enemyList|\n enemyList == []\n end\n \n needToVisitThisMany = dislikes.length - friendlies.length\n puts \"NEED TO VISIT THIS MANY: #{needToVisitThisMany}\"\n \n dislikes.length.times do |i|\n puts \"\\nNEW STARTER NODE = #{i}\"\n # start a new scenario with i as the starterNode\n queue = [i]\n visited = {}\n # visited will have key of index# for each dog, and value of T/F for easy flipping back and forth\n \n visited[i] = true\n \n until queue.empty?\n currDog = queue.pop()\n newColor = !visited[currDog]\n puts \"looking at currDog = #{currDog}\"\n \n dislikes[currDog].each do |enemy|\n puts \"\\tenemy = #{enemy}\"\n if visited[enemy].nil?\n visited[enemy] = newColor \n queue << enemy\n elsif visited[enemy] != newColor\n return false\n end\n end\n \n newColor = !newColor if queue.empty?\n end\n \n puts \"visited = #{visited}, ARE WE DONE? #{visited.keys.count} == #{needToVisitThisMany}\"\n return true if visited.keys.count == needToVisitThisMany\n end\n \n return true\nend", "def simplify\r\n model = Sketchup.active_model\r\n #define everything as one undo operation\r\n model.start_operation \"Simplify\"\r\n\r\n prompts = [\"Angle (degrees)\"]\r\n values = [10]\r\n result=UI.inputbox prompts, values, \"hoi\"\r\n angle = (180-result[0])/57.3 #in radians\r\n \r\n #search all edges in selection set\r\n while (model.selection.length>0)\r\n #remove the first Entity from the Selection and put it in e\r\n e=model.selection.shift\r\n if (e.kind_of?(Sketchup::Edge) && e.valid?)\r\n domino(e,angle)\r\n end\r\n end\r\nend", "def feed_forward\n # light up the input nodes corresponding to the\n # words in our query\n word_ids.size.times do |i|\n all_in[i] = 1.0\n end\n \n # hidden activations\n hidden_ids.size.times do |j|\n sum = 0.0\n word_ids.size.times do |i|\n sum += all_in[i] * weights_in[i][j]\n end\n all_hidden[j] = Math.tanh(sum)\n end\n\n #output activations\n url_ids.size.times do |k|\n sum = 0.0\n hidden_ids.size.times do |j|\n sum += all_hidden[j] * weights_out[j][k]\n end\n all_out[k] = Math.tanh(sum)\n end\n\n all_out\n end", "def converge(state) ; end", "def token!\n # at line 1:8: ( AMP | AMP_ASGN | GEQ | AND | GET | GREATER | HAT | HAT_ASGN | QMARK | ARROW | RBRACE | ASGN | IF | RBRACK | IN | BL_END | INCR | BREAK | INSTANCEOF | RETURN | IS_DEFINED | RPAREN | CASE | RSHIFT | CATCH | RSHIFT3 | COLON | LBRACE | RSHIFT3_ASGN | COMMA | LBRACK | RSHIFT_ASGN | LEQ | SEMI | CONST | LESS | SET | CONTINUE | LET | DECR | LPAREN | DEFAULT | LSHIFT | STAR | DELETE | LSHIFT_ASGN | STAR_ASGN | MACRO | SWITCH | MINUS | THIS | DO | MINUS_ASGN | THROW | DOT | TILDE | TRUE | NEQ | TRY | NEQQ | TYPEOF | NEW | EACH | NOT | UNDEFINED | ELSE | NULL | UNLESS | EQ | UNTIL | EQQ | OR | FALSE | OR_ASGN | VAR | FINALLY | VOID | FOR | PIPE | WHILE | PIPE_ASGN | WITH | FUNCTION | PLUS | YIELD | PLUS_ASGN | IS_UNDEFINED | POUND | DEF | CLASS_DEF | OBJECT_DEF | T__148 | T__149 | T__150 | MOD | SLASH | DOC | STRING | NUMBER | NEWLINE | IVAR | ID | WS | EJS )\n alt_72 = 104\n alt_72 = @dfa72.predict( @input )\n case alt_72\n when 1\n # at line 1:10: AMP\n amp!\n\n when 2\n # at line 1:14: AMP_ASGN\n amp_asgn!\n\n when 3\n # at line 1:23: GEQ\n geq!\n\n when 4\n # at line 1:27: AND\n and!\n\n when 5\n # at line 1:31: GET\n get!\n\n when 6\n # at line 1:35: GREATER\n greater!\n\n when 7\n # at line 1:43: HAT\n hat!\n\n when 8\n # at line 1:47: HAT_ASGN\n hat_asgn!\n\n when 9\n # at line 1:56: QMARK\n qmark!\n\n when 10\n # at line 1:62: ARROW\n arrow!\n\n when 11\n # at line 1:68: RBRACE\n rbrace!\n\n when 12\n # at line 1:75: ASGN\n asgn!\n\n when 13\n # at line 1:80: IF\n if!\n\n when 14\n # at line 1:83: RBRACK\n rbrack!\n\n when 15\n # at line 1:90: IN\n in!\n\n when 16\n # at line 1:93: BL_END\n bl_end!\n\n when 17\n # at line 1:100: INCR\n incr!\n\n when 18\n # at line 1:105: BREAK\n break!\n\n when 19\n # at line 1:111: INSTANCEOF\n instanceof!\n\n when 20\n # at line 1:122: RETURN\n return!\n\n when 21\n # at line 1:129: IS_DEFINED\n is_defined!\n\n when 22\n # at line 1:140: RPAREN\n rparen!\n\n when 23\n # at line 1:147: CASE\n case!\n\n when 24\n # at line 1:152: RSHIFT\n rshift!\n\n when 25\n # at line 1:159: CATCH\n catch!\n\n when 26\n # at line 1:165: RSHIFT3\n rshift_3!\n\n when 27\n # at line 1:173: COLON\n colon!\n\n when 28\n # at line 1:179: LBRACE\n lbrace!\n\n when 29\n # at line 1:186: RSHIFT3_ASGN\n rshift_3_asgn!\n\n when 30\n # at line 1:199: COMMA\n comma!\n\n when 31\n # at line 1:205: LBRACK\n lbrack!\n\n when 32\n # at line 1:212: RSHIFT_ASGN\n rshift_asgn!\n\n when 33\n # at line 1:224: LEQ\n leq!\n\n when 34\n # at line 1:228: SEMI\n semi!\n\n when 35\n # at line 1:233: CONST\n const!\n\n when 36\n # at line 1:239: LESS\n less!\n\n when 37\n # at line 1:244: SET\n set!\n\n when 38\n # at line 1:248: CONTINUE\n continue!\n\n when 39\n # at line 1:257: LET\n let!\n\n when 40\n # at line 1:261: DECR\n decr!\n\n when 41\n # at line 1:266: LPAREN\n lparen!\n\n when 42\n # at line 1:273: DEFAULT\n default!\n\n when 43\n # at line 1:281: LSHIFT\n lshift!\n\n when 44\n # at line 1:288: STAR\n star!\n\n when 45\n # at line 1:293: DELETE\n delete!\n\n when 46\n # at line 1:300: LSHIFT_ASGN\n lshift_asgn!\n\n when 47\n # at line 1:312: STAR_ASGN\n star_asgn!\n\n when 48\n # at line 1:322: MACRO\n macro!\n\n when 49\n # at line 1:328: SWITCH\n switch!\n\n when 50\n # at line 1:335: MINUS\n minus!\n\n when 51\n # at line 1:341: THIS\n this!\n\n when 52\n # at line 1:346: DO\n do!\n\n when 53\n # at line 1:349: MINUS_ASGN\n minus_asgn!\n\n when 54\n # at line 1:360: THROW\n throw!\n\n when 55\n # at line 1:366: DOT\n dot!\n\n when 56\n # at line 1:370: TILDE\n tilde!\n\n when 57\n # at line 1:376: TRUE\n true!\n\n when 58\n # at line 1:381: NEQ\n neq!\n\n when 59\n # at line 1:385: TRY\n try!\n\n when 60\n # at line 1:389: NEQQ\n neqq!\n\n when 61\n # at line 1:394: TYPEOF\n typeof!\n\n when 62\n # at line 1:401: NEW\n new!\n\n when 63\n # at line 1:405: EACH\n each!\n\n when 64\n # at line 1:410: NOT\n not!\n\n when 65\n # at line 1:414: UNDEFINED\n undefined!\n\n when 66\n # at line 1:424: ELSE\n else!\n\n when 67\n # at line 1:429: NULL\n null!\n\n when 68\n # at line 1:434: UNLESS\n unless!\n\n when 69\n # at line 1:441: EQ\n eq!\n\n when 70\n # at line 1:444: UNTIL\n until!\n\n when 71\n # at line 1:450: EQQ\n eqq!\n\n when 72\n # at line 1:454: OR\n or!\n\n when 73\n # at line 1:457: FALSE\n false!\n\n when 74\n # at line 1:463: OR_ASGN\n or_asgn!\n\n when 75\n # at line 1:471: VAR\n var!\n\n when 76\n # at line 1:475: FINALLY\n finally!\n\n when 77\n # at line 1:483: VOID\n void!\n\n when 78\n # at line 1:488: FOR\n for!\n\n when 79\n # at line 1:492: PIPE\n pipe!\n\n when 80\n # at line 1:497: WHILE\n while!\n\n when 81\n # at line 1:503: PIPE_ASGN\n pipe_asgn!\n\n when 82\n # at line 1:513: WITH\n with!\n\n when 83\n # at line 1:518: FUNCTION\n function!\n\n when 84\n # at line 1:527: PLUS\n plus!\n\n when 85\n # at line 1:532: YIELD\n yield!\n\n when 86\n # at line 1:538: PLUS_ASGN\n plus_asgn!\n\n when 87\n # at line 1:548: IS_UNDEFINED\n is_undefined!\n\n when 88\n # at line 1:561: POUND\n pound!\n\n when 89\n # at line 1:567: DEF\n def!\n\n when 90\n # at line 1:571: CLASS_DEF\n class_def!\n\n when 91\n # at line 1:581: OBJECT_DEF\n object_def!\n\n when 92\n # at line 1:592: T__148\n t__148!\n\n when 93\n # at line 1:599: T__149\n t__149!\n\n when 94\n # at line 1:606: T__150\n t__150!\n\n when 95\n # at line 1:613: MOD\n mod!\n\n when 96\n # at line 1:617: SLASH\n slash!\n\n when 97\n # at line 1:623: DOC\n doc!\n\n when 98\n # at line 1:627: STRING\n string!\n\n when 99\n # at line 1:634: NUMBER\n number!\n\n when 100\n # at line 1:641: NEWLINE\n newline!\n\n when 101\n # at line 1:649: IVAR\n ivar!\n\n when 102\n # at line 1:654: ID\n id!\n\n when 103\n # at line 1:657: WS\n ws!\n\n when 104\n # at line 1:660: EJS\n ejs!\n\n end\n end", "def predict(input)\n # Perform forward propagation to predict output\n \n # Activation on input nodes should simply be the input\n @activation_input[-1] = 1 # set bias node's activation to 1\n @activation_input[0..-2] = input\n \n # Compute the weighted sum into each hidden node\n @hiddenNodes.times do |x|\n s = 0.0\n @inputNodes.times do |i|\n s = s + (@activation_input[i] * @w_1[i][x])\n end\n # update activation for the hidden layer\n @activation_hidden[x] = NeuralNetwork::activation(s)\n end\n \n # Now compute the weighted sum into each output node\n @outputNodes.times do |x|\n s = 0.0\n @hiddenNodes.times do |h|\n s = s + (@activation_hidden[h] * @w_2[h][x])\n end\n # update activations for the output layer\n @activation_output[x] = NeuralNetwork::activation(s)\n end\n\n @activation_output\n\n end", "def input; end", "def input; end", "def input; end", "def k_asignacion!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 32 )\n\n\n\n type = K_ASIGNACION\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 381:3: ( 'add' | 'div' | 'mul' | 'sub' | 'pot' | 'sqrt' | 'copy' | 'del' | 'porcent' )\n # at line 381:3: ( 'add' | 'div' | 'mul' | 'sub' | 'pot' | 'sqrt' | 'copy' | 'del' | 'porcent' )\n alt_7 = 9\n case look_7 = @input.peek( 1 )\n when 0x61 then alt_7 = 1\n when 0x64 then look_7_2 = @input.peek( 2 )\n\n if ( look_7_2 == 0x69 )\n alt_7 = 2\n elsif ( look_7_2 == 0x65 )\n alt_7 = 8\n else\n raise NoViableAlternative( \"\", 7, 2 )\n\n end\n when 0x6d then alt_7 = 3\n when 0x73 then look_7_4 = @input.peek( 2 )\n\n if ( look_7_4 == 0x75 )\n alt_7 = 4\n elsif ( look_7_4 == 0x71 )\n alt_7 = 6\n else\n raise NoViableAlternative( \"\", 7, 4 )\n\n end\n when 0x70 then look_7_5 = @input.peek( 2 )\n\n if ( look_7_5 == 0x6f )\n look_7_11 = @input.peek( 3 )\n\n if ( look_7_11 == 0x74 )\n alt_7 = 5\n elsif ( look_7_11 == 0x72 )\n alt_7 = 9\n else\n raise NoViableAlternative( \"\", 7, 11 )\n\n end\n else\n raise NoViableAlternative( \"\", 7, 5 )\n\n end\n when 0x63 then alt_7 = 7\n else\n raise NoViableAlternative( \"\", 7, 0 )\n\n end\n case alt_7\n when 1\n # at line 381:4: 'add'\n match( \"add\" )\n\n\n when 2\n # at line 381:10: 'div'\n match( \"div\" )\n\n\n when 3\n # at line 381:16: 'mul'\n match( \"mul\" )\n\n\n when 4\n # at line 381:22: 'sub'\n match( \"sub\" )\n\n\n when 5\n # at line 381:28: 'pot'\n match( \"pot\" )\n\n\n when 6\n # at line 381:34: 'sqrt'\n match( \"sqrt\" )\n\n\n when 7\n # at line 381:41: 'copy'\n match( \"copy\" )\n\n\n when 8\n # at line 381:48: 'del'\n match( \"del\" )\n\n\n when 9\n # at line 381:54: 'porcent'\n match( \"porcent\" )\n\n\n end\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 32 )\n\n\n end", "def test_to_s\n graph = Graph.new\n vertex_a = Vertex.new('a')\n vertex_b = Vertex.new('b')\n vertex_c = Vertex.new('c')\n graph.add_vertex(vertex_a).add_vertex(vertex_b).add_vertex(vertex_c)\n graph.add_edge('a','b').add_edge('c','b')\n\n assert(graph.to_s == 'a=>b,b=>a,b=>c,c=>b')\n end", "def edgesymbol\n directed ? '->' : '--'\n end", "def plexus_comparability_explore(edge, k, classification, space='')\n ret = plexus_comparability_explore_inner(edge, k, classification, :forward, space)\n plexus_comparability_explore_inner(edge.reverse, k, classification, :backward, space) && ret\n end", "def chomsky_normal_form\n raise NotImplementedError \n end", "def test_add_edge\n @graph.add_edge('a', 'b');\n vertex_a = @graph.find_vertex('a')\n vertex_b = @graph.find_vertex('b')\n\n # 0 and 1 are indexes of vertex a and vertex b respectively\n assert(@graph.vertices[0].neighbours[1] == true && @graph.vertices[1].neighbours[0] == true)\n end", "def relation\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 55 )\n return_value = RelationReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n shift249 = nil\n relation_op250 = nil\n shift251 = nil\n\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 609:5: shift ( relation_op shift )*\n @state.following.push( TOKENS_FOLLOWING_shift_IN_relation_4033 )\n shift249 = shift\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, shift249.tree )\n end\n # at line 609:11: ( relation_op shift )*\n while true # decision 59\n alt_59 = 2\n look_59_0 = @input.peek( 1 )\n\n if ( look_59_0 == GEQ || look_59_0 == GREATER || look_59_0 == INSTANCEOF || look_59_0 == LEQ || look_59_0 == LESS )\n alt_59 = 1\n elsif ( look_59_0 == IN ) and ( ( !( @InFor_stack.last && @InFor_stack.last.active ) ) )\n alt_59 = 1\n\n end\n case alt_59\n when 1\n # at line 609:14: relation_op shift\n @state.following.push( TOKENS_FOLLOWING_relation_op_IN_relation_4038 )\n relation_op250 = relation_op\n @state.following.pop\n if @state.backtracking == 0\n root_0 = @adaptor.become_root( relation_op250.tree, root_0 )\n end\n @state.following.push( TOKENS_FOLLOWING_shift_IN_relation_4042 )\n shift251 = shift\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, shift251.tree )\n end\n\n else\n break # out of loop for decision 59\n end\n end # loop for decision 59\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 55 )\n\n end\n \n return return_value\n end", "def test_documentation_example2\n # create some automaton (here a non deterministic automaton)\n nfa = Automaton.new do |fa|\n s0 = fa.add_state(:initial => true, :accepting => false)\n s1 = fa.add_state(:initial => false, :accepting => true)\n s2 = fa.add_state(:initial => false, :accepting => true)\n fa.add_edge(s0, s1, 'a')\n fa.add_edge(s0, s2, 'a')\n end\n\n # check that it is recognized as a non deterministic one\n assert_equal false,nfa.deterministic?\n end", "def generate_input(graph,inputs)\r\n \r\nputs\"--- INPUT --------\" \r\n\r\n # ciclo gli Inputs\r\n inputs.each_with_index do |inline,i|\r\n fields = inline.split(',')\r\n \r\n#---------------------creo l'elenco dei job -------------------------\r\n\r\n found_job = fields[0].split('(').last\r\n @Jobs << found_job\r\n \r\n \r\n#---------------------creo l'elenco delle risorse IO ----------------\r\n\r\n io_resource = \"IO_\" + fields[1].chomp(')')\r\n unless @InOut.include? io_resource\r\n #Se non é giá stata creata, aggiungo la risorsa di IO al grafo\r\n graph.add_node(\"\\\"\" + io_resource + \"\\\"\",\"is_resourceIO\")\r\n puts \"aggiunta risorsa IO: \" + io_resource\r\n @InOut << io_resource\r\n end \r\n \r\n \r\n#---------------------creo gli elementi INPUT ----------------------- \r\n \r\n #aggiungo il nodo di input e il collegamento con la risorse IO \r\n input_name = found_job + \".\" + \"INPUT_\" + fields[1].chomp(')') \r\n \r\n #aggiungo il nodo \r\n graph.add_node(\"\\\"\" + input_name + \"\\\"\",\"is_input\")\r\n puts \"aggiunto input: \" + input_name\r\n \r\n # aggiungo il link\r\n graph.add_link(io_resource, input_name,\"\")\r\n puts \"aggiunto link: \" + \"\\\"\" + io_resource + \"\\\"\" + \"->\" + input_name\r\n \r\n \r\n # analizzo gli inputPath Multipli \r\n unless fields[3].nil? \r\n classe = fields[3].split('.') \r\n mapper_name = found_job + \".\" + \"MAPPER_\" + classe[0]\r\n \r\n #aggiungo il nodo\r\n graph.add_node(mapper_name,\"is_mapper\")\r\n puts \"aggiunto multiMapper: \" + mapper_name\r\n \r\n # aggiungo il link\r\n graph.add_link(input_name, mapper_name,\"\")\r\n puts \"aggiunto link: \" + \"\\\"\" + input_name + \"\\\"\" + \"->\" + mapper_name\r\n \r\n # memorizzo i link aperti (per creare i futuri link) \r\n @OpenLink.push(mapper_name); \r\n \r\n \r\n else # allore é un iputPath semplice che punta al mapper class definito\r\n #inserisco l'input nella lista dei nodi aperti per il job corrent\r\n @OpenLink.push(input_name);\r\n \r\n end \r\n end \r\n\r\n end", "def test_add_edge_with_cycles\n @graph.add_edge('a', 'b');\n @graph.add_edge('b', 'c');\n @graph.add_edge('c', 'a');\n\n # 0 and 2 are indexes of vertex a and vertex c respectively\n assert(@graph.vertices[0].neighbours[2] == true && @graph.vertices[2].neighbours[0] == true)\n end", "def test_add_edge\n @dgraph.add_edge('a', 'b');\n\n # 0 and 1 are indexes of vertex a and vertex b respectively\n assert(@dgraph.vertices[0].neighbours[1] == true && @dgraph.vertices[1].neighbours[0] == nil)\n end", "def deduce\n each_vertex do |v1|\n each_vertex do |v2|\n each_vertex do |v3|\n \n if self[v1,v2] == :provable_true and self[v2,v3] == :provable_true\n add_assertion(v1, v3, :provable_true)\n end\n \n if self[v2,v1] == :provable_false and self[v2,v3] == :provable_true\n add_assertion(v3, v1, :provable_false)\n end\n \n if self[v1,v2] == :provable_true and self[v3,v2] == :provable_false\n add_assertion(v3, v1, :provable_false)\n end\n \n break if @contradiction\n end\n end\n end\n end", "def parse(input)\n while(!input.empty?)\n input = parse_edge(input)\n if input.nil?\n raise 'error parsing'\n return nil\n end\n end\n self.assign_uniform_probs\n @start_node = self.get_start_node\n end", "def predict(input)\n if (DEBUG)\n System.err.println(\"Enter DFA.predict for decision \" + RJava.cast_to_string(@decision_number))\n end\n mark_ = input.mark # remember where decision started in input\n s = 0 # we always start at s0\n begin\n while (true)\n if (DEBUG)\n System.err.println(\"DFA \" + RJava.cast_to_string(@decision_number) + \" state \" + RJava.cast_to_string(s) + \" LA(1)=\" + RJava.cast_to_string(RJava.cast_to_char(input._la(1))) + \"(\" + RJava.cast_to_string(input._la(1)) + \"), index=\" + RJava.cast_to_string(input.index))\n end\n special_state = @special[s]\n if (special_state >= 0)\n if (DEBUG)\n System.err.println(\"DFA \" + RJava.cast_to_string(@decision_number) + \" state \" + RJava.cast_to_string(s) + \" is special state \" + RJava.cast_to_string(special_state))\n end\n s = special_state_transition(special_state, input)\n if (DEBUG)\n System.err.println(\"DFA \" + RJava.cast_to_string(@decision_number) + \" returns from special state \" + RJava.cast_to_string(special_state) + \" to \" + RJava.cast_to_string(s))\n end\n if ((s).equal?(-1))\n no_viable_alt(s, input)\n return 0\n end\n input.consume\n next\n end\n if (@accept[s] >= 1)\n if (DEBUG)\n System.err.println(\"accept; predict \" + RJava.cast_to_string(@accept[s]) + \" from state \" + RJava.cast_to_string(s))\n end\n return @accept[s]\n end\n # look for a normal char transition\n c = RJava.cast_to_char(input._la(1)) # -1 == \\uFFFF, all tokens fit in 65000 space\n if (c >= @min[s] && c <= @max[s])\n snext = @transition[s][c - @min[s]] # move to next state\n if (snext < 0)\n # was in range but not a normal transition\n # must check EOT, which is like the else clause.\n # eot[s]>=0 indicates that an EOT edge goes to another\n # state.\n if (@eot[s] >= 0)\n # EOT Transition to accept state?\n if (DEBUG)\n System.err.println(\"EOT transition\")\n end\n s = @eot[s]\n input.consume\n # TODO: I had this as return accept[eot[s]]\n # which assumed here that the EOT edge always\n # went to an accept...faster to do this, but\n # what about predicated edges coming from EOT\n # target?\n next\n end\n no_viable_alt(s, input)\n return 0\n end\n s = snext\n input.consume\n next\n end\n if (@eot[s] >= 0)\n # EOT Transition?\n if (DEBUG)\n System.err.println(\"EOT transition\")\n end\n s = @eot[s]\n input.consume\n next\n end\n if ((c).equal?(RJava.cast_to_char(Token::EOF)) && @eof[s] >= 0)\n # EOF Transition to accept state?\n if (DEBUG)\n System.err.println(\"accept via EOF; predict \" + RJava.cast_to_string(@accept[@eof[s]]) + \" from \" + RJava.cast_to_string(@eof[s]))\n end\n return @accept[@eof[s]]\n end\n # not in range and not EOF/EOT, must be invalid symbol\n if (DEBUG)\n System.err.println(\"min[\" + RJava.cast_to_string(s) + \"]=\" + RJava.cast_to_string(@min[s]))\n System.err.println(\"max[\" + RJava.cast_to_string(s) + \"]=\" + RJava.cast_to_string(@max[s]))\n System.err.println(\"eot[\" + RJava.cast_to_string(s) + \"]=\" + RJava.cast_to_string(@eot[s]))\n System.err.println(\"eof[\" + RJava.cast_to_string(s) + \"]=\" + RJava.cast_to_string(@eof[s]))\n p = 0\n while p < @transition[s].attr_length\n System.err.print(RJava.cast_to_string(@transition[s][p]) + \" \")\n p += 1\n end\n System.err.println\n end\n no_viable_alt(s, input)\n return 0\n end\n ensure\n input.rewind(mark_)\n end\n end", "def element\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 21)\n return_value = ElementReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n labelOp = nil\n g = nil\n __ACTION103__ = nil\n __SEMPRED104__ = nil\n id94 = nil\n atom95 = nil\n ebnf_suffix96 = nil\n id97 = nil\n block98 = nil\n ebnf_suffix99 = nil\n atom100 = nil\n ebnf_suffix101 = nil\n ebnf102 = nil\n tree_spec105 = nil\n ebnf_suffix106 = nil\n\n tree_for_labelOp = nil\n tree_for_g = nil\n tree_for_ACTION103 = nil\n tree_for_SEMPRED104 = nil\n stream_LIST_LABEL_ASSIGN = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token LIST_LABEL_ASSIGN\")\n stream_LABEL_ASSIGN = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token LABEL_ASSIGN\")\n stream_SEMPRED = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token SEMPRED\")\n stream_T__86 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__86\")\n stream_tree_spec = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule tree_spec\")\n stream_id = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule id\")\n stream_atom = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule atom\")\n stream_block = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule block\")\n stream_ebnf_suffix = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule ebnf_suffix\")\n begin\n # at line 233:2: ( id (labelOp= '=' | labelOp= '+=' ) atom ( ebnf_suffix -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] ^( $labelOp id atom ) EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) ) | -> ^( $labelOp id atom ) ) | id (labelOp= '=' | labelOp= '+=' ) block ( ebnf_suffix -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] ^( $labelOp id block ) EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) ) | -> ^( $labelOp id block ) ) | atom ( ebnf_suffix -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] atom EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) ) | -> atom ) | ebnf | ACTION | SEMPRED (g= '=>' -> GATED_SEMPRED[$g] | -> SEMPRED ) | tree_spec ( ebnf_suffix -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] tree_spec EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) ) | -> tree_spec ) )\n alt_46 = 7\n alt_46 = @dfa46.predict(@input)\n case alt_46\n when 1\n # at line 233:4: id (labelOp= '=' | labelOp= '+=' ) atom ( ebnf_suffix -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] ^( $labelOp id atom ) EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) ) | -> ^( $labelOp id atom ) )\n @state.following.push(TOKENS_FOLLOWING_id_IN_element_1399)\n id94 = id\n @state.following.pop\n if @state.backtracking == 0\n stream_id.add(id94.tree)\n end\n # at line 233:7: (labelOp= '=' | labelOp= '+=' )\n alt_39 = 2\n look_39_0 = @input.peek(1)\n\n if (look_39_0 == LABEL_ASSIGN) \n alt_39 = 1\n elsif (look_39_0 == LIST_LABEL_ASSIGN) \n alt_39 = 2\n else\n @state.backtracking > 0 and raise(ANTLR3::Error::BacktrackingFailed)\n nvae = NoViableAlternative(\"\", 39, 0)\n raise nvae\n end\n case alt_39\n when 1\n # at line 233:8: labelOp= '='\n labelOp = match(LABEL_ASSIGN, TOKENS_FOLLOWING_LABEL_ASSIGN_IN_element_1404) \n if @state.backtracking == 0\n stream_LABEL_ASSIGN.add(labelOp)\n end\n\n when 2\n # at line 233:20: labelOp= '+='\n labelOp = match(LIST_LABEL_ASSIGN, TOKENS_FOLLOWING_LIST_LABEL_ASSIGN_IN_element_1408) \n if @state.backtracking == 0\n stream_LIST_LABEL_ASSIGN.add(labelOp)\n end\n\n end\n @state.following.push(TOKENS_FOLLOWING_atom_IN_element_1411)\n atom95 = atom\n @state.following.pop\n if @state.backtracking == 0\n stream_atom.add(atom95.tree)\n end\n # at line 234:3: ( ebnf_suffix -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] ^( $labelOp id atom ) EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) ) | -> ^( $labelOp id atom ) )\n alt_40 = 2\n look_40_0 = @input.peek(1)\n\n if (look_40_0 == T__74 || look_40_0.between?(T__91, T__92)) \n alt_40 = 1\n elsif (look_40_0 == SEMPRED || look_40_0 == TREE_BEGIN || look_40_0 == REWRITE || look_40_0.between?(TOKEN_REF, ACTION) || look_40_0 == RULE_REF || look_40_0 == T__71 || look_40_0.between?(T__81, T__83) || look_40_0 == T__87 || look_40_0 == T__90) \n alt_40 = 2\n else\n @state.backtracking > 0 and raise(ANTLR3::Error::BacktrackingFailed)\n nvae = NoViableAlternative(\"\", 40, 0)\n raise nvae\n end\n case alt_40\n when 1\n # at line 234:5: ebnf_suffix\n @state.following.push(TOKENS_FOLLOWING_ebnf_suffix_IN_element_1417)\n ebnf_suffix96 = ebnf_suffix\n @state.following.pop\n if @state.backtracking == 0\n stream_ebnf_suffix.add(ebnf_suffix96.tree)\n end\n # AST Rewrite\n # elements: atom, ebnf_suffix, id, labelOp\n # token labels: labelOp\n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_labelOp = token_stream(\"token labelOp\", labelOp)\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 234:17: -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] ^( $labelOp id atom ) EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) )\n # at line 234:20: ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] ^( $labelOp id atom ) EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) )\n root_1 = @adaptor.create_flat_list!\n root_1 = @adaptor.become_root(stream_ebnf_suffix.next_node(), root_1)\n\n # at line 234:35: ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] ^( $labelOp id atom ) EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] )\n root_2 = @adaptor.create_flat_list!\n root_2 = @adaptor.become_root(@adaptor.create!(BLOCK, \"BLOCK\"), root_2)\n\n # at line 234:52: ^( ALT[\\\"ALT\\\"] ^( $labelOp id atom ) EOA[\\\"EOA\\\"] )\n root_3 = @adaptor.create_flat_list!\n root_3 = @adaptor.become_root(@adaptor.create!(ALT, \"ALT\"), root_3)\n\n # at line 234:65: ^( $labelOp id atom )\n root_4 = @adaptor.create_flat_list!\n root_4 = @adaptor.become_root(stream_labelOp.next_node, root_4)\n\n @adaptor.add_child(root_4, stream_id.next_tree)\n @adaptor.add_child(root_4, stream_atom.next_tree)\n\n @adaptor.add_child(root_3, root_4)\n @adaptor.add_child(root_3, @adaptor.create!(EOA, \"EOA\"))\n\n @adaptor.add_child(root_2, root_3)\n @adaptor.add_child(root_2, @adaptor.create!(EOB, \"EOB\"))\n\n @adaptor.add_child(root_1, root_2)\n\n @adaptor.add_child(root_0, root_1)\n\n\n\n return_value.tree = root_0\n\n end\n when 2\n # at line 235:8: \n # AST Rewrite\n # elements: labelOp, atom, id\n # token labels: labelOp\n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_labelOp = token_stream(\"token labelOp\", labelOp)\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 235:8: -> ^( $labelOp id atom )\n # at line 235:11: ^( $labelOp id atom )\n root_1 = @adaptor.create_flat_list!\n root_1 = @adaptor.become_root(stream_labelOp.next_node, root_1)\n\n @adaptor.add_child(root_1, stream_id.next_tree)\n @adaptor.add_child(root_1, stream_atom.next_tree)\n\n @adaptor.add_child(root_0, root_1)\n\n\n\n return_value.tree = root_0\n\n end\n end\n\n when 2\n # at line 237:4: id (labelOp= '=' | labelOp= '+=' ) block ( ebnf_suffix -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] ^( $labelOp id block ) EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) ) | -> ^( $labelOp id block ) )\n @state.following.push(TOKENS_FOLLOWING_id_IN_element_1476)\n id97 = id\n @state.following.pop\n if @state.backtracking == 0\n stream_id.add(id97.tree)\n end\n # at line 237:7: (labelOp= '=' | labelOp= '+=' )\n alt_41 = 2\n look_41_0 = @input.peek(1)\n\n if (look_41_0 == LABEL_ASSIGN) \n alt_41 = 1\n elsif (look_41_0 == LIST_LABEL_ASSIGN) \n alt_41 = 2\n else\n @state.backtracking > 0 and raise(ANTLR3::Error::BacktrackingFailed)\n nvae = NoViableAlternative(\"\", 41, 0)\n raise nvae\n end\n case alt_41\n when 1\n # at line 237:8: labelOp= '='\n labelOp = match(LABEL_ASSIGN, TOKENS_FOLLOWING_LABEL_ASSIGN_IN_element_1481) \n if @state.backtracking == 0\n stream_LABEL_ASSIGN.add(labelOp)\n end\n\n when 2\n # at line 237:20: labelOp= '+='\n labelOp = match(LIST_LABEL_ASSIGN, TOKENS_FOLLOWING_LIST_LABEL_ASSIGN_IN_element_1485) \n if @state.backtracking == 0\n stream_LIST_LABEL_ASSIGN.add(labelOp)\n end\n\n end\n @state.following.push(TOKENS_FOLLOWING_block_IN_element_1488)\n block98 = block\n @state.following.pop\n if @state.backtracking == 0\n stream_block.add(block98.tree)\n end\n # at line 238:3: ( ebnf_suffix -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] ^( $labelOp id block ) EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) ) | -> ^( $labelOp id block ) )\n alt_42 = 2\n look_42_0 = @input.peek(1)\n\n if (look_42_0 == T__74 || look_42_0.between?(T__91, T__92)) \n alt_42 = 1\n elsif (look_42_0 == SEMPRED || look_42_0 == TREE_BEGIN || look_42_0 == REWRITE || look_42_0.between?(TOKEN_REF, ACTION) || look_42_0 == RULE_REF || look_42_0 == T__71 || look_42_0.between?(T__81, T__83) || look_42_0 == T__87 || look_42_0 == T__90) \n alt_42 = 2\n else\n @state.backtracking > 0 and raise(ANTLR3::Error::BacktrackingFailed)\n nvae = NoViableAlternative(\"\", 42, 0)\n raise nvae\n end\n case alt_42\n when 1\n # at line 238:5: ebnf_suffix\n @state.following.push(TOKENS_FOLLOWING_ebnf_suffix_IN_element_1494)\n ebnf_suffix99 = ebnf_suffix\n @state.following.pop\n if @state.backtracking == 0\n stream_ebnf_suffix.add(ebnf_suffix99.tree)\n end\n # AST Rewrite\n # elements: labelOp, id, ebnf_suffix, block\n # token labels: labelOp\n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_labelOp = token_stream(\"token labelOp\", labelOp)\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 238:17: -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] ^( $labelOp id block ) EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) )\n # at line 238:20: ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] ^( $labelOp id block ) EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) )\n root_1 = @adaptor.create_flat_list!\n root_1 = @adaptor.become_root(stream_ebnf_suffix.next_node(), root_1)\n\n # at line 238:35: ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] ^( $labelOp id block ) EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] )\n root_2 = @adaptor.create_flat_list!\n root_2 = @adaptor.become_root(@adaptor.create!(BLOCK, \"BLOCK\"), root_2)\n\n # at line 238:52: ^( ALT[\\\"ALT\\\"] ^( $labelOp id block ) EOA[\\\"EOA\\\"] )\n root_3 = @adaptor.create_flat_list!\n root_3 = @adaptor.become_root(@adaptor.create!(ALT, \"ALT\"), root_3)\n\n # at line 238:65: ^( $labelOp id block )\n root_4 = @adaptor.create_flat_list!\n root_4 = @adaptor.become_root(stream_labelOp.next_node, root_4)\n\n @adaptor.add_child(root_4, stream_id.next_tree)\n @adaptor.add_child(root_4, stream_block.next_tree)\n\n @adaptor.add_child(root_3, root_4)\n @adaptor.add_child(root_3, @adaptor.create!(EOA, \"EOA\"))\n\n @adaptor.add_child(root_2, root_3)\n @adaptor.add_child(root_2, @adaptor.create!(EOB, \"EOB\"))\n\n @adaptor.add_child(root_1, root_2)\n\n @adaptor.add_child(root_0, root_1)\n\n\n\n return_value.tree = root_0\n\n end\n when 2\n # at line 239:8: \n # AST Rewrite\n # elements: block, labelOp, id\n # token labels: labelOp\n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_labelOp = token_stream(\"token labelOp\", labelOp)\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 239:8: -> ^( $labelOp id block )\n # at line 239:11: ^( $labelOp id block )\n root_1 = @adaptor.create_flat_list!\n root_1 = @adaptor.become_root(stream_labelOp.next_node, root_1)\n\n @adaptor.add_child(root_1, stream_id.next_tree)\n @adaptor.add_child(root_1, stream_block.next_tree)\n\n @adaptor.add_child(root_0, root_1)\n\n\n\n return_value.tree = root_0\n\n end\n end\n\n when 3\n # at line 241:4: atom ( ebnf_suffix -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] atom EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) ) | -> atom )\n @state.following.push(TOKENS_FOLLOWING_atom_IN_element_1553)\n atom100 = atom\n @state.following.pop\n if @state.backtracking == 0\n stream_atom.add(atom100.tree)\n end\n # at line 242:3: ( ebnf_suffix -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] atom EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) ) | -> atom )\n alt_43 = 2\n look_43_0 = @input.peek(1)\n\n if (look_43_0 == T__74 || look_43_0.between?(T__91, T__92)) \n alt_43 = 1\n elsif (look_43_0 == SEMPRED || look_43_0 == TREE_BEGIN || look_43_0 == REWRITE || look_43_0.between?(TOKEN_REF, ACTION) || look_43_0 == RULE_REF || look_43_0 == T__71 || look_43_0.between?(T__81, T__83) || look_43_0 == T__87 || look_43_0 == T__90) \n alt_43 = 2\n else\n @state.backtracking > 0 and raise(ANTLR3::Error::BacktrackingFailed)\n nvae = NoViableAlternative(\"\", 43, 0)\n raise nvae\n end\n case alt_43\n when 1\n # at line 242:5: ebnf_suffix\n @state.following.push(TOKENS_FOLLOWING_ebnf_suffix_IN_element_1559)\n ebnf_suffix101 = ebnf_suffix\n @state.following.pop\n if @state.backtracking == 0\n stream_ebnf_suffix.add(ebnf_suffix101.tree)\n end\n # AST Rewrite\n # elements: ebnf_suffix, atom\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 242:17: -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] atom EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) )\n # at line 242:20: ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] atom EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) )\n root_1 = @adaptor.create_flat_list!\n root_1 = @adaptor.become_root(stream_ebnf_suffix.next_node(), root_1)\n\n # at line 242:35: ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] atom EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] )\n root_2 = @adaptor.create_flat_list!\n root_2 = @adaptor.become_root(@adaptor.create!(BLOCK, \"BLOCK\"), root_2)\n\n # at line 242:52: ^( ALT[\\\"ALT\\\"] atom EOA[\\\"EOA\\\"] )\n root_3 = @adaptor.create_flat_list!\n root_3 = @adaptor.become_root(@adaptor.create!(ALT, \"ALT\"), root_3)\n\n @adaptor.add_child(root_3, stream_atom.next_tree)\n @adaptor.add_child(root_3, @adaptor.create!(EOA, \"EOA\"))\n\n @adaptor.add_child(root_2, root_3)\n @adaptor.add_child(root_2, @adaptor.create!(EOB, \"EOB\"))\n\n @adaptor.add_child(root_1, root_2)\n\n @adaptor.add_child(root_0, root_1)\n\n\n\n return_value.tree = root_0\n\n end\n when 2\n # at line 243:8: \n # AST Rewrite\n # elements: atom\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 243:8: -> atom\n @adaptor.add_child(root_0, stream_atom.next_tree)\n\n\n\n return_value.tree = root_0\n\n end\n end\n\n when 4\n root_0 = @adaptor.create_flat_list!\n\n\n # at line 245:4: ebnf\n @state.following.push(TOKENS_FOLLOWING_ebnf_IN_element_1605)\n ebnf102 = ebnf\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child(root_0, ebnf102.tree)\n end\n\n when 5\n root_0 = @adaptor.create_flat_list!\n\n\n # at line 246:6: ACTION\n __ACTION103__ = match(ACTION, TOKENS_FOLLOWING_ACTION_IN_element_1612)\n if @state.backtracking == 0\n\n tree_for_ACTION103 = @adaptor.create_with_payload!(__ACTION103__)\n @adaptor.add_child(root_0, tree_for_ACTION103)\n\n end\n\n when 6\n # at line 247:6: SEMPRED (g= '=>' -> GATED_SEMPRED[$g] | -> SEMPRED )\n __SEMPRED104__ = match(SEMPRED, TOKENS_FOLLOWING_SEMPRED_IN_element_1619) \n if @state.backtracking == 0\n stream_SEMPRED.add(__SEMPRED104__)\n end\n # at line 247:14: (g= '=>' -> GATED_SEMPRED[$g] | -> SEMPRED )\n alt_44 = 2\n look_44_0 = @input.peek(1)\n\n if (look_44_0 == T__86) \n alt_44 = 1\n elsif (look_44_0 == SEMPRED || look_44_0 == TREE_BEGIN || look_44_0 == REWRITE || look_44_0.between?(TOKEN_REF, ACTION) || look_44_0 == RULE_REF || look_44_0 == T__71 || look_44_0.between?(T__81, T__83) || look_44_0 == T__87 || look_44_0 == T__90) \n alt_44 = 2\n else\n @state.backtracking > 0 and raise(ANTLR3::Error::BacktrackingFailed)\n nvae = NoViableAlternative(\"\", 44, 0)\n raise nvae\n end\n case alt_44\n when 1\n # at line 247:16: g= '=>'\n g = match(T__86, TOKENS_FOLLOWING_T__86_IN_element_1625) \n if @state.backtracking == 0\n stream_T__86.add(g)\n end\n # AST Rewrite\n # elements: \n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 247:23: -> GATED_SEMPRED[$g]\n @adaptor.add_child(root_0, @adaptor.create!(GATED_SEMPRED, g))\n\n\n\n return_value.tree = root_0\n\n end\n when 2\n # at line 247:46: \n # AST Rewrite\n # elements: SEMPRED\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 247:46: -> SEMPRED\n @adaptor.add_child(root_0, stream_SEMPRED.next_node)\n\n\n\n return_value.tree = root_0\n\n end\n end\n\n when 7\n # at line 248:6: tree_spec ( ebnf_suffix -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] tree_spec EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) ) | -> tree_spec )\n @state.following.push(TOKENS_FOLLOWING_tree_spec_IN_element_1645)\n tree_spec105 = tree_spec\n @state.following.pop\n if @state.backtracking == 0\n stream_tree_spec.add(tree_spec105.tree)\n end\n # at line 249:3: ( ebnf_suffix -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] tree_spec EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) ) | -> tree_spec )\n alt_45 = 2\n look_45_0 = @input.peek(1)\n\n if (look_45_0 == T__74 || look_45_0.between?(T__91, T__92)) \n alt_45 = 1\n elsif (look_45_0 == SEMPRED || look_45_0 == TREE_BEGIN || look_45_0 == REWRITE || look_45_0.between?(TOKEN_REF, ACTION) || look_45_0 == RULE_REF || look_45_0 == T__71 || look_45_0.between?(T__81, T__83) || look_45_0 == T__87 || look_45_0 == T__90) \n alt_45 = 2\n else\n @state.backtracking > 0 and raise(ANTLR3::Error::BacktrackingFailed)\n nvae = NoViableAlternative(\"\", 45, 0)\n raise nvae\n end\n case alt_45\n when 1\n # at line 249:5: ebnf_suffix\n @state.following.push(TOKENS_FOLLOWING_ebnf_suffix_IN_element_1651)\n ebnf_suffix106 = ebnf_suffix\n @state.following.pop\n if @state.backtracking == 0\n stream_ebnf_suffix.add(ebnf_suffix106.tree)\n end\n # AST Rewrite\n # elements: ebnf_suffix, tree_spec\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 249:17: -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] tree_spec EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) )\n # at line 249:20: ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] tree_spec EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) )\n root_1 = @adaptor.create_flat_list!\n root_1 = @adaptor.become_root(stream_ebnf_suffix.next_node(), root_1)\n\n # at line 249:35: ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] tree_spec EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] )\n root_2 = @adaptor.create_flat_list!\n root_2 = @adaptor.become_root(@adaptor.create!(BLOCK, \"BLOCK\"), root_2)\n\n # at line 249:52: ^( ALT[\\\"ALT\\\"] tree_spec EOA[\\\"EOA\\\"] )\n root_3 = @adaptor.create_flat_list!\n root_3 = @adaptor.become_root(@adaptor.create!(ALT, \"ALT\"), root_3)\n\n @adaptor.add_child(root_3, stream_tree_spec.next_tree)\n @adaptor.add_child(root_3, @adaptor.create!(EOA, \"EOA\"))\n\n @adaptor.add_child(root_2, root_3)\n @adaptor.add_child(root_2, @adaptor.create!(EOB, \"EOB\"))\n\n @adaptor.add_child(root_1, root_2)\n\n @adaptor.add_child(root_0, root_1)\n\n\n\n return_value.tree = root_0\n\n end\n when 2\n # at line 250:8: \n # AST Rewrite\n # elements: tree_spec\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 250:8: -> tree_spec\n @adaptor.add_child(root_0, stream_tree_spec.next_tree)\n\n\n\n return_value.tree = root_0\n\n end\n end\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look(-1)\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing(root_0)\n @adaptor.set_token_boundaries(return_value.tree, return_value.start, return_value.stop)\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node!(@input, return_value.start, @input.look(-1), re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 21)\n\n end\n \n return return_value\n end", "def instruction\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 1 )\n value = nil\n instruction_start_index = @input.index\n put_ingredient_into_mixing_bowl1 = nil\n liquefy_mixing_bowl2 = nil\n pour_contents_into_baking_dish3 = nil\n fold_ingredient_into_mixing_bowl4 = nil\n clean_the_mixing_bowl5 = nil\n take_ingredient_from_refrigerator6 = nil\n remove_ingredient_from_mixing_bowl7 = nil\n refrigerate_for_hours8 = nil\n add_ingredient_to_mixing_bowl9 = nil\n serve_with10 = nil\n mix_the_mixing_bowl_well11 = nil\n combine_ingredient_into_mixing_bowl12 = nil\n stir_mixing_bowl13 = nil\n stir_ingredient_into_the_mixing_bowl14 = nil\n\n success = false # flag used for memoization\n\n begin\n # rule memoization\n if @state.backtracking > 0 and already_parsed_rule?( __method__ )\n success = true\n return value\n end\n # at line 36:3: ( put_ingredient_into_mixing_bowl | liquefy_mixing_bowl | pour_contents_into_baking_dish | fold_ingredient_into_mixing_bowl | clean_the_mixing_bowl | take_ingredient_from_refrigerator | remove_ingredient_from_mixing_bowl | refrigerate_for_hours | add_ingredient_to_mixing_bowl | serve_with | set_aside | mix_the_mixing_bowl_well | combine_ingredient_into_mixing_bowl | divide_ingredient_into_mixing_bowl | stir_mixing_bowl | stir_ingredient_into_the_mixing_bowl )\n alt_1 = 16\n alt_1 = @dfa1.predict( @input )\n case alt_1\n when 1\n # at line 36:5: put_ingredient_into_mixing_bowl\n @state.following.push( TOKENS_FOLLOWING_put_ingredient_into_mixing_bowl_IN_instruction_83 )\n put_ingredient_into_mixing_bowl1 = put_ingredient_into_mixing_bowl\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = put_ingredient_into_mixing_bowl1\n \n # <-- action\n end\n\n when 2\n # at line 39:5: liquefy_mixing_bowl\n @state.following.push( TOKENS_FOLLOWING_liquefy_mixing_bowl_IN_instruction_91 )\n liquefy_mixing_bowl2 = liquefy_mixing_bowl\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = liquefy_mixing_bowl2\n \n # <-- action\n end\n\n when 3\n # at line 42:5: pour_contents_into_baking_dish\n @state.following.push( TOKENS_FOLLOWING_pour_contents_into_baking_dish_IN_instruction_99 )\n pour_contents_into_baking_dish3 = pour_contents_into_baking_dish\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = pour_contents_into_baking_dish3\n \n # <-- action\n end\n\n when 4\n # at line 45:5: fold_ingredient_into_mixing_bowl\n @state.following.push( TOKENS_FOLLOWING_fold_ingredient_into_mixing_bowl_IN_instruction_107 )\n fold_ingredient_into_mixing_bowl4 = fold_ingredient_into_mixing_bowl\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = fold_ingredient_into_mixing_bowl4\n \n # <-- action\n end\n\n when 5\n # at line 48:5: clean_the_mixing_bowl\n @state.following.push( TOKENS_FOLLOWING_clean_the_mixing_bowl_IN_instruction_115 )\n clean_the_mixing_bowl5 = clean_the_mixing_bowl\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = clean_the_mixing_bowl5\n \n # <-- action\n end\n\n when 6\n # at line 51:5: take_ingredient_from_refrigerator\n @state.following.push( TOKENS_FOLLOWING_take_ingredient_from_refrigerator_IN_instruction_123 )\n take_ingredient_from_refrigerator6 = take_ingredient_from_refrigerator\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = take_ingredient_from_refrigerator6\n \n # <-- action\n end\n\n when 7\n # at line 54:5: remove_ingredient_from_mixing_bowl\n @state.following.push( TOKENS_FOLLOWING_remove_ingredient_from_mixing_bowl_IN_instruction_131 )\n remove_ingredient_from_mixing_bowl7 = remove_ingredient_from_mixing_bowl\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = remove_ingredient_from_mixing_bowl7\n \n # <-- action\n end\n\n when 8\n # at line 57:5: refrigerate_for_hours\n @state.following.push( TOKENS_FOLLOWING_refrigerate_for_hours_IN_instruction_139 )\n refrigerate_for_hours8 = refrigerate_for_hours\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = refrigerate_for_hours8\n \n # <-- action\n end\n\n when 9\n # at line 60:5: add_ingredient_to_mixing_bowl\n @state.following.push( TOKENS_FOLLOWING_add_ingredient_to_mixing_bowl_IN_instruction_147 )\n add_ingredient_to_mixing_bowl9 = add_ingredient_to_mixing_bowl\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = add_ingredient_to_mixing_bowl9\n \n # <-- action\n end\n\n when 10\n # at line 63:5: serve_with\n @state.following.push( TOKENS_FOLLOWING_serve_with_IN_instruction_155 )\n serve_with10 = serve_with\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = serve_with10\n \n # <-- action\n end\n\n when 11\n # at line 66:5: set_aside\n @state.following.push( TOKENS_FOLLOWING_set_aside_IN_instruction_163 )\n set_aside\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = $serve_with.value\n \n # <-- action\n end\n\n when 12\n # at line 69:5: mix_the_mixing_bowl_well\n @state.following.push( TOKENS_FOLLOWING_mix_the_mixing_bowl_well_IN_instruction_171 )\n mix_the_mixing_bowl_well11 = mix_the_mixing_bowl_well\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = mix_the_mixing_bowl_well11\n \n # <-- action\n end\n\n when 13\n # at line 72:5: combine_ingredient_into_mixing_bowl\n @state.following.push( TOKENS_FOLLOWING_combine_ingredient_into_mixing_bowl_IN_instruction_179 )\n combine_ingredient_into_mixing_bowl12 = combine_ingredient_into_mixing_bowl\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = combine_ingredient_into_mixing_bowl12\n \n # <-- action\n end\n\n when 14\n # at line 75:5: divide_ingredient_into_mixing_bowl\n @state.following.push( TOKENS_FOLLOWING_divide_ingredient_into_mixing_bowl_IN_instruction_187 )\n divide_ingredient_into_mixing_bowl\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = $stir_ingredient_into_the_mixing_bowl.value\n \n # <-- action\n end\n\n when 15\n # at line 78:5: stir_mixing_bowl\n @state.following.push( TOKENS_FOLLOWING_stir_mixing_bowl_IN_instruction_195 )\n stir_mixing_bowl13 = stir_mixing_bowl\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = stir_mixing_bowl13\n \n # <-- action\n end\n\n when 16\n # at line 81:5: stir_ingredient_into_the_mixing_bowl\n @state.following.push( TOKENS_FOLLOWING_stir_ingredient_into_the_mixing_bowl_IN_instruction_203 )\n stir_ingredient_into_the_mixing_bowl14 = stir_ingredient_into_the_mixing_bowl\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = stir_ingredient_into_the_mixing_bowl14\n \n # <-- action\n end\n\n end\n success = true\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 1 )\n memoize( __method__, instruction_start_index, success ) if @state.backtracking > 0\n\n end\n \n return value\n end", "def test_dfa_delta_on_examples\n assert_equal(nil, @small_dfa.dfa_delta(0,'b'))\n @small_dfa.each_state do |s|\n s.out_edges.each do |e|\n assert_equal(e.target, @small_dfa.dfa_delta(s,e.symbol))\n end\n end\n end", "def has_edge?(vertex1, vertex2)\n\tend", "def getNodeWeights()\n # (two possible sources: flipped and negated, so \n # add them for each node)\n \n tabRead(@edges){|arr|\n ordered = [arr[0],arr[2]].sort\n @allEdgeWeightScores[ordered.join(\"--\")] += arr[3].to_f\n @nodeList[arr[0]] = 1\n @nodeList[arr[2]] = 1\n }\nend", "def solution\n Solution.new @encumbent_value, :offset => @encumbent_offset, :speed => @encumbent_speed\n end", "def element\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 21 )\n return_value = ElementReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n labelOp = nil\n g = nil\n __ACTION103__ = nil\n __SEMPRED104__ = nil\n id94 = nil\n atom95 = nil\n ebnf_suffix96 = nil\n id97 = nil\n block98 = nil\n ebnf_suffix99 = nil\n atom100 = nil\n ebnf_suffix101 = nil\n ebnf102 = nil\n tree_spec105 = nil\n ebnf_suffix106 = nil\n\n tree_for_labelOp = nil\n tree_for_g = nil\n tree_for_ACTION103 = nil\n tree_for_SEMPRED104 = nil\n stream_LIST_LABEL_ASSIGN = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token LIST_LABEL_ASSIGN\" )\n stream_LABEL_ASSIGN = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token LABEL_ASSIGN\" )\n stream_SEMPRED = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token SEMPRED\" )\n stream_T__86 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__86\" )\n stream_tree_spec = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule tree_spec\" )\n stream_id = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule id\" )\n stream_atom = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule atom\" )\n stream_block = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule block\" )\n stream_ebnf_suffix = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule ebnf_suffix\" )\n begin\n # at line 224:2: ( id (labelOp= '=' | labelOp= '+=' ) atom ( ebnf_suffix -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] ^( $labelOp id atom ) EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) ) | -> ^( $labelOp id atom ) ) | id (labelOp= '=' | labelOp= '+=' ) block ( ebnf_suffix -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] ^( $labelOp id block ) EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) ) | -> ^( $labelOp id block ) ) | atom ( ebnf_suffix -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] atom EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) ) | -> atom ) | ebnf | ACTION | SEMPRED (g= '=>' -> GATED_SEMPRED[$g] | -> SEMPRED ) | tree_spec ( ebnf_suffix -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] tree_spec EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) ) | -> tree_spec ) )\n alt_46 = 7\n alt_46 = @dfa46.predict( @input )\n case alt_46\n when 1\n # at line 224:4: id (labelOp= '=' | labelOp= '+=' ) atom ( ebnf_suffix -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] ^( $labelOp id atom ) EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) ) | -> ^( $labelOp id atom ) )\n @state.following.push( TOKENS_FOLLOWING_id_IN_element_1394 )\n id94 = id\n @state.following.pop\n if @state.backtracking == 0\n stream_id.add( id94.tree )\n end\n # at line 224:7: (labelOp= '=' | labelOp= '+=' )\n alt_39 = 2\n look_39_0 = @input.peek( 1 )\n\n if ( look_39_0 == LABEL_ASSIGN )\n alt_39 = 1\n elsif ( look_39_0 == LIST_LABEL_ASSIGN )\n alt_39 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 39, 0 )\n end\n case alt_39\n when 1\n # at line 224:8: labelOp= '='\n labelOp = match( LABEL_ASSIGN, TOKENS_FOLLOWING_LABEL_ASSIGN_IN_element_1399 )\n if @state.backtracking == 0\n stream_LABEL_ASSIGN.add( labelOp )\n end\n\n when 2\n # at line 224:20: labelOp= '+='\n labelOp = match( LIST_LABEL_ASSIGN, TOKENS_FOLLOWING_LIST_LABEL_ASSIGN_IN_element_1403 )\n if @state.backtracking == 0\n stream_LIST_LABEL_ASSIGN.add( labelOp )\n end\n\n end\n @state.following.push( TOKENS_FOLLOWING_atom_IN_element_1406 )\n atom95 = atom\n @state.following.pop\n if @state.backtracking == 0\n stream_atom.add( atom95.tree )\n end\n # at line 225:3: ( ebnf_suffix -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] ^( $labelOp id atom ) EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) ) | -> ^( $labelOp id atom ) )\n alt_40 = 2\n look_40_0 = @input.peek( 1 )\n\n if ( look_40_0 == T__74 || look_40_0.between?( T__91, T__92 ) )\n alt_40 = 1\n elsif ( look_40_0 == SEMPRED || look_40_0 == TREE_BEGIN || look_40_0 == REWRITE || look_40_0.between?( TOKEN_REF, ACTION ) || look_40_0 == RULE_REF || look_40_0 == T__71 || look_40_0.between?( T__81, T__83 ) || look_40_0 == T__87 || look_40_0 == T__90 )\n alt_40 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 40, 0 )\n end\n case alt_40\n when 1\n # at line 225:5: ebnf_suffix\n @state.following.push( TOKENS_FOLLOWING_ebnf_suffix_IN_element_1412 )\n ebnf_suffix96 = ebnf_suffix\n @state.following.pop\n if @state.backtracking == 0\n stream_ebnf_suffix.add( ebnf_suffix96.tree )\n end\n # AST Rewrite\n # elements: id, labelOp, ebnf_suffix, atom\n # token labels: labelOp\n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_labelOp = token_stream( \"token labelOp\", labelOp )\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 225:17: -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] ^( $labelOp id atom ) EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) )\n # at line 225:20: ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] ^( $labelOp id atom ) EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_ebnf_suffix.next_node, root_1 )\n\n # at line 225:35: ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] ^( $labelOp id atom ) EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] )\n root_2 = @adaptor.create_flat_list\n root_2 = @adaptor.become_root( @adaptor.create( BLOCK, \"BLOCK\" ), root_2 )\n\n # at line 225:52: ^( ALT[\\\"ALT\\\"] ^( $labelOp id atom ) EOA[\\\"EOA\\\"] )\n root_3 = @adaptor.create_flat_list\n root_3 = @adaptor.become_root( @adaptor.create( ALT, \"ALT\" ), root_3 )\n\n # at line 225:65: ^( $labelOp id atom )\n root_4 = @adaptor.create_flat_list\n root_4 = @adaptor.become_root( stream_labelOp.next_node, root_4 )\n\n @adaptor.add_child( root_4, stream_id.next_tree )\n @adaptor.add_child( root_4, stream_atom.next_tree )\n\n @adaptor.add_child( root_3, root_4 )\n @adaptor.add_child( root_3, @adaptor.create( EOA, \"EOA\" ) )\n\n @adaptor.add_child( root_2, root_3 )\n @adaptor.add_child( root_2, @adaptor.create( EOB, \"EOB\" ) )\n\n @adaptor.add_child( root_1, root_2 )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n when 2\n # at line 226:8: \n # AST Rewrite\n # elements: atom, id, labelOp\n # token labels: labelOp\n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_labelOp = token_stream( \"token labelOp\", labelOp )\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 226:8: -> ^( $labelOp id atom )\n # at line 226:11: ^( $labelOp id atom )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_labelOp.next_node, root_1 )\n\n @adaptor.add_child( root_1, stream_id.next_tree )\n @adaptor.add_child( root_1, stream_atom.next_tree )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n end\n\n when 2\n # at line 228:4: id (labelOp= '=' | labelOp= '+=' ) block ( ebnf_suffix -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] ^( $labelOp id block ) EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) ) | -> ^( $labelOp id block ) )\n @state.following.push( TOKENS_FOLLOWING_id_IN_element_1471 )\n id97 = id\n @state.following.pop\n if @state.backtracking == 0\n stream_id.add( id97.tree )\n end\n # at line 228:7: (labelOp= '=' | labelOp= '+=' )\n alt_41 = 2\n look_41_0 = @input.peek( 1 )\n\n if ( look_41_0 == LABEL_ASSIGN )\n alt_41 = 1\n elsif ( look_41_0 == LIST_LABEL_ASSIGN )\n alt_41 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 41, 0 )\n end\n case alt_41\n when 1\n # at line 228:8: labelOp= '='\n labelOp = match( LABEL_ASSIGN, TOKENS_FOLLOWING_LABEL_ASSIGN_IN_element_1476 )\n if @state.backtracking == 0\n stream_LABEL_ASSIGN.add( labelOp )\n end\n\n when 2\n # at line 228:20: labelOp= '+='\n labelOp = match( LIST_LABEL_ASSIGN, TOKENS_FOLLOWING_LIST_LABEL_ASSIGN_IN_element_1480 )\n if @state.backtracking == 0\n stream_LIST_LABEL_ASSIGN.add( labelOp )\n end\n\n end\n @state.following.push( TOKENS_FOLLOWING_block_IN_element_1483 )\n block98 = block\n @state.following.pop\n if @state.backtracking == 0\n stream_block.add( block98.tree )\n end\n # at line 229:3: ( ebnf_suffix -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] ^( $labelOp id block ) EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) ) | -> ^( $labelOp id block ) )\n alt_42 = 2\n look_42_0 = @input.peek( 1 )\n\n if ( look_42_0 == T__74 || look_42_0.between?( T__91, T__92 ) )\n alt_42 = 1\n elsif ( look_42_0 == SEMPRED || look_42_0 == TREE_BEGIN || look_42_0 == REWRITE || look_42_0.between?( TOKEN_REF, ACTION ) || look_42_0 == RULE_REF || look_42_0 == T__71 || look_42_0.between?( T__81, T__83 ) || look_42_0 == T__87 || look_42_0 == T__90 )\n alt_42 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 42, 0 )\n end\n case alt_42\n when 1\n # at line 229:5: ebnf_suffix\n @state.following.push( TOKENS_FOLLOWING_ebnf_suffix_IN_element_1489 )\n ebnf_suffix99 = ebnf_suffix\n @state.following.pop\n if @state.backtracking == 0\n stream_ebnf_suffix.add( ebnf_suffix99.tree )\n end\n # AST Rewrite\n # elements: block, labelOp, id, ebnf_suffix\n # token labels: labelOp\n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_labelOp = token_stream( \"token labelOp\", labelOp )\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 229:17: -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] ^( $labelOp id block ) EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) )\n # at line 229:20: ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] ^( $labelOp id block ) EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_ebnf_suffix.next_node, root_1 )\n\n # at line 229:35: ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] ^( $labelOp id block ) EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] )\n root_2 = @adaptor.create_flat_list\n root_2 = @adaptor.become_root( @adaptor.create( BLOCK, \"BLOCK\" ), root_2 )\n\n # at line 229:52: ^( ALT[\\\"ALT\\\"] ^( $labelOp id block ) EOA[\\\"EOA\\\"] )\n root_3 = @adaptor.create_flat_list\n root_3 = @adaptor.become_root( @adaptor.create( ALT, \"ALT\" ), root_3 )\n\n # at line 229:65: ^( $labelOp id block )\n root_4 = @adaptor.create_flat_list\n root_4 = @adaptor.become_root( stream_labelOp.next_node, root_4 )\n\n @adaptor.add_child( root_4, stream_id.next_tree )\n @adaptor.add_child( root_4, stream_block.next_tree )\n\n @adaptor.add_child( root_3, root_4 )\n @adaptor.add_child( root_3, @adaptor.create( EOA, \"EOA\" ) )\n\n @adaptor.add_child( root_2, root_3 )\n @adaptor.add_child( root_2, @adaptor.create( EOB, \"EOB\" ) )\n\n @adaptor.add_child( root_1, root_2 )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n when 2\n # at line 230:8: \n # AST Rewrite\n # elements: labelOp, id, block\n # token labels: labelOp\n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_labelOp = token_stream( \"token labelOp\", labelOp )\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 230:8: -> ^( $labelOp id block )\n # at line 230:11: ^( $labelOp id block )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_labelOp.next_node, root_1 )\n\n @adaptor.add_child( root_1, stream_id.next_tree )\n @adaptor.add_child( root_1, stream_block.next_tree )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n end\n\n when 3\n # at line 232:4: atom ( ebnf_suffix -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] atom EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) ) | -> atom )\n @state.following.push( TOKENS_FOLLOWING_atom_IN_element_1548 )\n atom100 = atom\n @state.following.pop\n if @state.backtracking == 0\n stream_atom.add( atom100.tree )\n end\n # at line 233:3: ( ebnf_suffix -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] atom EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) ) | -> atom )\n alt_43 = 2\n look_43_0 = @input.peek( 1 )\n\n if ( look_43_0 == T__74 || look_43_0.between?( T__91, T__92 ) )\n alt_43 = 1\n elsif ( look_43_0 == SEMPRED || look_43_0 == TREE_BEGIN || look_43_0 == REWRITE || look_43_0.between?( TOKEN_REF, ACTION ) || look_43_0 == RULE_REF || look_43_0 == T__71 || look_43_0.between?( T__81, T__83 ) || look_43_0 == T__87 || look_43_0 == T__90 )\n alt_43 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 43, 0 )\n end\n case alt_43\n when 1\n # at line 233:5: ebnf_suffix\n @state.following.push( TOKENS_FOLLOWING_ebnf_suffix_IN_element_1554 )\n ebnf_suffix101 = ebnf_suffix\n @state.following.pop\n if @state.backtracking == 0\n stream_ebnf_suffix.add( ebnf_suffix101.tree )\n end\n # AST Rewrite\n # elements: atom, ebnf_suffix\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 233:17: -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] atom EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) )\n # at line 233:20: ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] atom EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_ebnf_suffix.next_node, root_1 )\n\n # at line 233:35: ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] atom EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] )\n root_2 = @adaptor.create_flat_list\n root_2 = @adaptor.become_root( @adaptor.create( BLOCK, \"BLOCK\" ), root_2 )\n\n # at line 233:52: ^( ALT[\\\"ALT\\\"] atom EOA[\\\"EOA\\\"] )\n root_3 = @adaptor.create_flat_list\n root_3 = @adaptor.become_root( @adaptor.create( ALT, \"ALT\" ), root_3 )\n\n @adaptor.add_child( root_3, stream_atom.next_tree )\n @adaptor.add_child( root_3, @adaptor.create( EOA, \"EOA\" ) )\n\n @adaptor.add_child( root_2, root_3 )\n @adaptor.add_child( root_2, @adaptor.create( EOB, \"EOB\" ) )\n\n @adaptor.add_child( root_1, root_2 )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n when 2\n # at line 234:8: \n # AST Rewrite\n # elements: atom\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 234:8: -> atom\n @adaptor.add_child( root_0, stream_atom.next_tree )\n\n\n\n return_value.tree = root_0\n\n end\n end\n\n when 4\n root_0 = @adaptor.create_flat_list\n\n\n # at line 236:4: ebnf\n @state.following.push( TOKENS_FOLLOWING_ebnf_IN_element_1600 )\n ebnf102 = ebnf\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, ebnf102.tree )\n end\n\n when 5\n root_0 = @adaptor.create_flat_list\n\n\n # at line 237:6: ACTION\n __ACTION103__ = match( ACTION, TOKENS_FOLLOWING_ACTION_IN_element_1607 )\n if @state.backtracking == 0\n\n tree_for_ACTION103 = @adaptor.create_with_payload( __ACTION103__ )\n @adaptor.add_child( root_0, tree_for_ACTION103 )\n\n end\n\n when 6\n # at line 238:6: SEMPRED (g= '=>' -> GATED_SEMPRED[$g] | -> SEMPRED )\n __SEMPRED104__ = match( SEMPRED, TOKENS_FOLLOWING_SEMPRED_IN_element_1614 )\n if @state.backtracking == 0\n stream_SEMPRED.add( __SEMPRED104__ )\n end\n # at line 238:14: (g= '=>' -> GATED_SEMPRED[$g] | -> SEMPRED )\n alt_44 = 2\n look_44_0 = @input.peek( 1 )\n\n if ( look_44_0 == T__86 )\n alt_44 = 1\n elsif ( look_44_0 == SEMPRED || look_44_0 == TREE_BEGIN || look_44_0 == REWRITE || look_44_0.between?( TOKEN_REF, ACTION ) || look_44_0 == RULE_REF || look_44_0 == T__71 || look_44_0.between?( T__81, T__83 ) || look_44_0 == T__87 || look_44_0 == T__90 )\n alt_44 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 44, 0 )\n end\n case alt_44\n when 1\n # at line 238:16: g= '=>'\n g = match( T__86, TOKENS_FOLLOWING_T__86_IN_element_1620 )\n if @state.backtracking == 0\n stream_T__86.add( g )\n end\n # AST Rewrite\n # elements: \n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 238:23: -> GATED_SEMPRED[$g]\n @adaptor.add_child( root_0, @adaptor.create( GATED_SEMPRED, g ) )\n\n\n\n return_value.tree = root_0\n\n end\n when 2\n # at line 238:46: \n # AST Rewrite\n # elements: SEMPRED\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 238:46: -> SEMPRED\n @adaptor.add_child( root_0, stream_SEMPRED.next_node )\n\n\n\n return_value.tree = root_0\n\n end\n end\n\n when 7\n # at line 239:6: tree_spec ( ebnf_suffix -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] tree_spec EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) ) | -> tree_spec )\n @state.following.push( TOKENS_FOLLOWING_tree_spec_IN_element_1640 )\n tree_spec105 = tree_spec\n @state.following.pop\n if @state.backtracking == 0\n stream_tree_spec.add( tree_spec105.tree )\n end\n # at line 240:3: ( ebnf_suffix -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] tree_spec EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) ) | -> tree_spec )\n alt_45 = 2\n look_45_0 = @input.peek( 1 )\n\n if ( look_45_0 == T__74 || look_45_0.between?( T__91, T__92 ) )\n alt_45 = 1\n elsif ( look_45_0 == SEMPRED || look_45_0 == TREE_BEGIN || look_45_0 == REWRITE || look_45_0.between?( TOKEN_REF, ACTION ) || look_45_0 == RULE_REF || look_45_0 == T__71 || look_45_0.between?( T__81, T__83 ) || look_45_0 == T__87 || look_45_0 == T__90 )\n alt_45 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 45, 0 )\n end\n case alt_45\n when 1\n # at line 240:5: ebnf_suffix\n @state.following.push( TOKENS_FOLLOWING_ebnf_suffix_IN_element_1646 )\n ebnf_suffix106 = ebnf_suffix\n @state.following.pop\n if @state.backtracking == 0\n stream_ebnf_suffix.add( ebnf_suffix106.tree )\n end\n # AST Rewrite\n # elements: ebnf_suffix, tree_spec\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 240:17: -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] tree_spec EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) )\n # at line 240:20: ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] tree_spec EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_ebnf_suffix.next_node, root_1 )\n\n # at line 240:35: ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] tree_spec EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] )\n root_2 = @adaptor.create_flat_list\n root_2 = @adaptor.become_root( @adaptor.create( BLOCK, \"BLOCK\" ), root_2 )\n\n # at line 240:52: ^( ALT[\\\"ALT\\\"] tree_spec EOA[\\\"EOA\\\"] )\n root_3 = @adaptor.create_flat_list\n root_3 = @adaptor.become_root( @adaptor.create( ALT, \"ALT\" ), root_3 )\n\n @adaptor.add_child( root_3, stream_tree_spec.next_tree )\n @adaptor.add_child( root_3, @adaptor.create( EOA, \"EOA\" ) )\n\n @adaptor.add_child( root_2, root_3 )\n @adaptor.add_child( root_2, @adaptor.create( EOB, \"EOB\" ) )\n\n @adaptor.add_child( root_1, root_2 )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n when 2\n # at line 241:8: \n # AST Rewrite\n # elements: tree_spec\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 241:8: -> tree_spec\n @adaptor.add_child( root_0, stream_tree_spec.next_tree )\n\n\n\n return_value.tree = root_0\n\n end\n end\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 21 )\n\n end\n \n return return_value\n end", "def id!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 28 )\n\n\n\n type = ID\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 49:5: ( 'a' .. 'z' | 'A' .. 'Z' ) ( ( 'a' .. 'z' | 'A' .. 'Z' ) | '_' | ( '0' .. '9' ) )*\n if @input.peek( 1 ).between?( 0x41, 0x5a ) || @input.peek( 1 ).between?( 0x61, 0x7a )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n\n end\n\n\n # at line 49:33: ( ( 'a' .. 'z' | 'A' .. 'Z' ) | '_' | ( '0' .. '9' ) )*\n while true # decision 8\n alt_8 = 2\n look_8_0 = @input.peek( 1 )\n\n if ( look_8_0.between?( 0x30, 0x39 ) || look_8_0.between?( 0x41, 0x5a ) || look_8_0 == 0x5f || look_8_0.between?( 0x61, 0x7a ) )\n alt_8 = 1\n\n end\n case alt_8\n when 1\n # at line \n if @input.peek( 1 ).between?( 0x30, 0x39 ) || @input.peek( 1 ).between?( 0x41, 0x5a ) || @input.peek(1) == 0x5f || @input.peek( 1 ).between?( 0x61, 0x7a )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n\n end\n\n\n\n else\n break # out of loop for decision 8\n end\n end # loop for decision 8\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 28 )\n\n\n end", "def gratr_comparability_explore(edge, k, classification, space='')\r\n ret = gratr_comparability_explore_inner(edge, k, classification, :forward, space)\r\n gratr_comparability_explore_inner(edge.reverse, k, classification, :backward, space) && ret\r\n end" ]
[ "0.602473", "0.58223206", "0.5796132", "0.5785436", "0.5667515", "0.5629039", "0.55871546", "0.55492944", "0.55449575", "0.55413264", "0.54922765", "0.5463637", "0.54575306", "0.5448993", "0.5435643", "0.53800136", "0.53603363", "0.53337824", "0.53337824", "0.5307849", "0.5296823", "0.5242391", "0.52345747", "0.52290183", "0.521467", "0.5209784", "0.5208134", "0.5181095", "0.5162167", "0.5159135", "0.51512796", "0.514974", "0.51445776", "0.51432323", "0.513868", "0.51360357", "0.513386", "0.5101377", "0.50883085", "0.5085989", "0.50857526", "0.50769925", "0.50705934", "0.50665635", "0.5065979", "0.5065299", "0.50605005", "0.50587356", "0.5056658", "0.5053412", "0.50520754", "0.505072", "0.5047342", "0.5039454", "0.50353247", "0.50327396", "0.5031204", "0.5021435", "0.50207144", "0.5009531", "0.4993032", "0.49920523", "0.49898288", "0.49857932", "0.49821532", "0.49774587", "0.4974356", "0.49704543", "0.49621725", "0.49521405", "0.4952017", "0.49459898", "0.49418694", "0.4934647", "0.4933375", "0.49253735", "0.49253735", "0.49253735", "0.49186057", "0.49185184", "0.49111325", "0.4910291", "0.49092034", "0.49087408", "0.49048615", "0.4890313", "0.4884996", "0.48725212", "0.48678547", "0.48672998", "0.48580357", "0.48473307", "0.4841277", "0.48411375", "0.48351198", "0.48329", "0.48260528", "0.4821442", "0.48210672", "0.48197663", "0.4818514" ]
0.0
-1
REQUIRED. FluidFeatures will call this to determine if your user is logged in, what the unique id of this user is and any additional attributes you wish to use for selecting users.
def fluidfeatures_current_user(verbose=false) if current_user if verbose { :id => @current_user[:id], :name => @current_user[:name], :uniques => { :twitter => @current_user[:twitter_id] }, :cohorts => { # Example attributes for the user. # These can be any fields you wish to select users by. :company => { # "display" is used to help you find it in the dashboard. # Highly recommended unless you work with ids. # This display name can change over time without consequence. :display => @current_user[:company_name], # "id" should be unique this this cohort and must be static # over time. :id => @current_user[:company_id] }, # For this boolean cohort "true"|"false" is the "display" # and the "id" :admin => @current_user[:admin] } } else { :id => @current_user.id } end else end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def identify_the_user\n \t@current_user = User.find_by_id(session[\"user_id\"])\n end", "def user?\n get_mode == :user\n end", "def user_on\n session[:user_id] = '3980284084'\n end", "def user_id; config[:user_id]; end", "def client_side_current_user\n if session[:user_id]\n User.select([:first_name, :last_name, :email]).find session[:user_id]\n end\n end", "def parametrizr_user\n current_user\n end", "def set_user; end", "def actual_user\n User.find_by_id(session[:user_id])\n end", "def get_user\n @user = current_user\n @is_logged_in = user_signed_in? #true fals\n @is_user = @is_logged_in && @user.role =='user'\n @is_admin = @is_logged_in && @user.role =='admin'\n end", "def user_id\n @attributes[:user_id]\n end", "def user_id\n @attributes[:user_id]\n end", "def user_id\n @attributes[:user_id]\n end", "def user_id\n @attributes[:user_id]\n end", "def user_id\n @attributes[:user_id]\n end", "def user_id\n @attributes[:user_id]\n end", "def user_id\n @attributes[:user_id]\n end", "def user_id\n @attributes[:user_id]\n end", "def user_id\n @attributes[:user_id]\n end", "def user_id\n @attributes[:user_id]\n end", "def is_this_user\n\t\t@user.id == current_user.id\n\tend", "def set_user\n @user = User.find(params[:id])\n\n return if unauthorized_local_access(@user.uo_id)\n end", "def current_user\n @feat.user\n end", "def user_data\n User.user_data login\n end", "def current_user\n\t\tauthenticated(User)\n\tend", "def get_user \n\t\treturn User.find(self.user_id)\n\tend", "def user?\n type == :user_id\n end", "def user?\n type == :user_id\n end", "def user_id; 1; end", "def user; end", "def user; end", "def get_user_to_act_on\n @user = session[:user]\n end", "def get_user_to_act_on\n @user = session[:user]\n end", "def show\n\n #Make sure only logged in admins can manipulate users\n\n if @loggedinuser && @loggedinuser.authorizationlevel >= 4\n \t@user = User.find(params[:id])\n else \n redirect_to '/'\n end\n end", "def get_user_id\n if current_user\n @user = User.find(current_user.id)\n end\nend", "def current_user\n session[:usr_id]\n end", "def user_id\n return @user_id\n end", "def user_id\n return @user_id\n end", "def user_id\n return @user_id\n end", "def user_id\n return @user_id\n end", "def user_id\n return @user_id\n end", "def user_id\n return @user_id\n end", "def user_id\n\t\t@user_id || nil\n\tend", "def phi_allowed_by\n phi_context[:user_id]\n end", "def require_user\n end", "def get_authenticated_user # rubocop:disable Style/AccessorMethodName\n @user_id = YourMembership::Member.isAuthenticated(self)\n end", "def logged_in_user\n if session[:user]\n if session[:user].to_i < 1\n @logged_in_user = Person.new\n elsif !@logged_in_user || @logged_in_user.id != session[:user].to_i\n @logged_in_user = Person.find session[:user].to_i\n end\n end\n \n @logged_in_user\n end", "def user_id\n self.title_and_name\n end", "def load_user\n if(user_signed_in?)\n @user = User.find(current_user.id)\n @config = @user.config\n @timer = @user.timer\n active_quest = @user.active_quest\n if(active_quest.nil?)\n @active_quest_model = nil\n @active_quest_name = ''\n @active_quest_url = '#'\n @active_quest_campaign_name = ''\n @active_quest__campaign_url = '#'\n else\n @active_quest_model = active_quest\n @active_quest_name = active_quest.name\n @active_quest_url = quest_path(active_quest)\n @active_quest_campaign_name = active_quest.campaign.name\n @active_quest_campaign_url = campaign_path(active_quest.campaign)\n end\n end\n end", "def user_defined?\n !@user.nil? || !@user['userId'].nil?\n end", "def is_user_specific?\n false\n end", "def user\n\t\tfalse\n\tend", "def current_user\n \n # Normally we would look in the session to see if there is a user_id \n # to figure out if the user is loggged in.\n # For demo purposes this app randomly picks if the user is logged in\n if rand(100) > 20 \n User.last\n else\n nil\n end\n end", "def setup \n @user = current_user\n end", "def user_layout\n if user_signed_in?\n # If user is admin, set admin flag\n if current_user.admin?\n @admin = true\n end\n # set users fullname for display\n @user_name = current_user.name\n @user = current_user\n end\n \n end", "def current_user\n User.find_by(uid: session[:user]) if logged_in?\n end", "def set_user\n require_logged_in\n @user = User.find_by(id: session[:user_id])\n end", "def current_user\n\n \tif session[:user_id].present?\n \t\tUser.find(session[:user_id])\n\n \tend\n\n end", "def load_user_if_logged_in\n if user?\n @user = current_user\n else\n @user = nil\n end\n return true\nend", "def hubssolib_get_user_data\n user = self.hubssolib_current_session ? self.hubssolib_current_session.session_user : nil\n\n if (user && user.user_id)\n return user\n else\n return nil\n end\n end", "def this_user\n return nil unless session[:user_id].present?\n\n @this_user || @this_user = User.where(id: session[:user_id]).first\n end", "def current_user\n User.find_by_id(session[:user_id]) if session[:user_id] \n end", "def user_id\n username\n end", "def current_user\n # authorization initialization if not run yet\n # (in the case of paper_trial it might not have run)\n authorization_init\n @logged_in_user\n end", "def current_user\n # super: don't change anything, i just want the exact same behavior \n # as in the method that we are overriding\n\n # what this line means is that if the user is logged in, super is true,\n # then call super treat everything normal, and ignore right hand side\n # if super == false, call right hand side\n\n # super comes from devise class\n # meanwhile the r.h.s comes from open struct class\n super || guest_user\n end", "def _user uid = 0\n\t\tinfos \t\t\t= {}\n\t\tinfos[:uid] \t= uid\n\t\tinfos[:name] \t= 'unknown'\n\t\tinfos[:level] \t= 0\n\t\tinfos[:sid] \t= ''\n\n\t\tif uid == 0\n\t\t\tif sid = request.cookies['sid']\n\t\t\t\tuid = _session_has sid\n\t\t\tend\n\t\tend\n\n\t\tif uid.to_i > 0\n\t\t\tds = DB[:_user].filter(:uid => uid)\n\t\t\tinfos[:uid]\t\t= uid\n\t\t\tinfos[:name] \t= ds.get(:name)\n\t\t\tinfos[:level] \t= ds.get(:level)\n\t\t\tinfos[:sid] \t= sid\n\t\tend\n\t\tinfos\n\tend", "def current_user_id\n 1\n end", "def load_current_user\n the_id = session[:user_id]\n @current_user = User.where({ :id => the_id }).first\n end", "def is_potential_user?\n\t\ttrue\n\tend", "def set_user_and_verify #TODO: Make this common to both items and tags\n @user = User.find_by(id: params[:user_id])\n if @user.blank?\n head :forbidden\n end\n end", "def is_user?\n user ? true : false\n end", "def user\n {user_id: self.object.user.id,\n user_name: self.object.user.name\n }\n end", "def show\n {\n id: @current_user.id,\n first_name: @current_user.first_name,\n last_name: @current_user.last_name,\n email: @current_user.email,\n role_name: @current_user.super_admin ? 'Super Admin' : @current_user.role.try(:name),\n permissions: Permissions::Builder.user_permissions(@current_user)\n }\n end", "def current_user\n\tif session[:user_id].present?\n\t\tUser.find(session[:user_id])\t\n\tend\nend", "def context; { user: current_user } end", "def set_user\n @user = current_agent.users.where('users.username = ?', params[:id]).first\n end", "def user\n user_id.get_object\n end", "def logged_in\n logged_in_user != nil\n end", "def loaded_user\n user_type == 'MeetupUser' ? meetup_user : bridgetroll_user\n end", "def set_user\n @user = User.find(session[:user_id])\n if current_user.is_seeker\n @jobseeker = Jobseeker.find_by(user_id: current_user.id)\n end\n if current_user.is_biz\n @bizowner = Bizowner.find_by(user_id: current_user.id)\n end\n end", "def check_user_id\n if self.user_id.nil?\n set_user_id\n end\n end", "def user_id\n @logged_in_user = User.find_by(id: params[:id])\n @user_id = @logged_in_user.id\n end", "def user\n @user\n end", "def is_logged_in\n #since these are also marked as helper methods, they are availalble in not just all ctronollers (cuz they inherit from appc ontroler) but also avialble to views\n\n (session[:user_id] && session[:user_id].present? ) ? true : false\n end", "def user_id\n self.user.id unless user.nil?\n end", "def hubssolib_current_user\n hubssolib_get_user_data\n end", "def current_user\n\t\tUser.find_by(:id => session[:user_id])\n\tend", "def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]#Returns the current chef's id or (||) Finds chef_id only if user is loged in. - Chef_id is stored in browser's cookie so that db hits are avoided.\n end", "def user_setup\n\t\tif self.id.blank?\n\t\t\tself.id = self.email\n\t\t\n\t\tend\n\tend", "def current_user # Check the current user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n end", "def current_user_id\n session[:user_id]\n end", "def logged_in_user_id\n session[:user_id]\n end", "def initialize_user\n @current_user = User.find_by_id(session[:user]) unless session[:user].blank?\n puts @current_user\n end", "def user_id\n self.user.id\n end", "def set_user\n @user = User.select('first_name, last_name, email, username, id').find(params[:id])\n end", "def setup_current_user\n @current_user = User.find(session[:user_id]) unless session[:user_id].nil?\n end", "def load_user_and_authorization\n @owner_user = User.find( params[:user_id] )\n @current_user_is_owner = ( current_user_id == params[:user_id].to_i )\n end", "def user\n end", "def current_user\n User.find_by(id: session[:user_id])\n end", "def current_user\n User.find_by(id: session[:user_id])\n end", "def current_user\n if session[:user_id]\n puts \"session user_id #{session[:user_id]}\"\n User.find(session[:user_id])\n end\nend" ]
[ "0.6494902", "0.6472428", "0.63992727", "0.6356453", "0.6355614", "0.6339612", "0.6291046", "0.6288785", "0.6267838", "0.6265769", "0.6265769", "0.6265769", "0.6265769", "0.6265769", "0.6265769", "0.6265769", "0.6265769", "0.6265769", "0.6265769", "0.6230814", "0.6205879", "0.6203754", "0.62009525", "0.6194228", "0.616197", "0.6159617", "0.6159617", "0.6157678", "0.6148684", "0.6148684", "0.61472833", "0.61472833", "0.6125742", "0.61147267", "0.60991687", "0.6098984", "0.6098984", "0.6098984", "0.6098984", "0.6098984", "0.6098984", "0.6098145", "0.6094593", "0.6092086", "0.60916", "0.608257", "0.6071989", "0.60687387", "0.6065969", "0.6065125", "0.60634047", "0.60630226", "0.60578805", "0.6052191", "0.6043779", "0.6043591", "0.6041074", "0.6035944", "0.6033512", "0.6031393", "0.6030465", "0.6030378", "0.60291237", "0.6028915", "0.6027338", "0.602104", "0.60195726", "0.6018408", "0.60147494", "0.6010827", "0.6009331", "0.6009245", "0.60089165", "0.6008296", "0.60000646", "0.59991276", "0.59964496", "0.59951717", "0.59939986", "0.5992427", "0.5987678", "0.5985516", "0.5982664", "0.5980231", "0.5975911", "0.5974449", "0.59740883", "0.5972712", "0.5968255", "0.5967643", "0.59634334", "0.5959728", "0.5955048", "0.59544283", "0.59532285", "0.5951949", "0.5949108", "0.59479684", "0.59479684", "0.59466803" ]
0.6771621
0
OPTIONAL Set default for any new features. These are only used for the first time that FluidFeatures sees a feature. This happens when this feature is deployed for the first time.
def fluidfeatures_defaults { # By default unknown features are disabled. :enabled => false, # no visible to any users # You can also use these values... #:enabled => true, # visible to all users (use for depreciating old features) #:enabled => 10, # 10 percent of user will see it #:enabled => "dev", # only members of the "dev" team (cohort) will see it initially. # OPTIONAL # Version can be omitted. This is used for A/B testing of a feature. #:version => 1 # Can be a number :version => "default" # Can be a string } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_defaults\n self.featured ||= 1\n end", "def set_default\n end", "def default\n @default = true\n end", "def feature_flags_with_defaults\n flag_names = FeatureFlag.pluck(:name).sort\n FeatureFlag.default_flag_hash.merge(feature_flags_for(*flag_names)).with_indifferent_access\n end", "def set_default\n cmd = \"{\\\"id\\\":8,\\\"method\\\":\\\"set_default\\\",\\\"params\\\":[]}\\r\\n\"\n request(cmd)\n end", "def default(default)\n @default = default\n end", "def default\n end", "def set_defaults\n end", "def set_defaults\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\n end", "def default\n igetset(:default) { nil }\n end", "def default_fauxture_name\n :default\n end", "def set_default_options\n end", "def default; end", "def default; end", "def default=(new_default)\n @default_proc = nil\n @default = new_default\n end", "def set_default(value)\r\n\t\t\tself.default_value = value\r\n\t\tend", "def set_defaults\n #self.required_by_manufacturer ||= true\n end", "def default\r\n @opts[:default]\r\n end", "def default(default)\n @default = default\n self\n end", "def default\n nil\n end", "def default\n nil\n end", "def default\n @default\n end", "def add_defaults_local\n super\n self.timestamp ||= Java.now\n self.user ||= default_user\n end", "def default\n @default || atlas_default\n end", "def set_default pixel\n\t\t\t@default = pixel\n\t\tend", "def default=(value)\n @default = value\n end", "def set_defaults\n self.published ||= false\n self.archived ||= false\n self.is_default ||= false\n self.version ||= 0\n self.visibility = ((self.org.present? && self.org.funder_only?) || self.is_default?) ? Template.visibilities[:publicly_visible] : Template.visibilities[:organisationally_visible] unless self.id.present?\n self.customization_of ||= nil\n self.family_id ||= new_family_id\n self.archived ||= false\n self.links ||= { funder: [], sample_plan: [] }\n end", "def default\n @what = :default\n self\n end", "def configured_default\n @options[:default] || default_entry\n end", "def default_options; end", "def default_options; end", "def default_options; end", "def set_default\n (!default || value?) ? self : add_value(default)\n end", "def default\n options[:default]\n end", "def default_data\n end", "def set_defaults\n # should set the default based on category\n if self.fta_asset_category.try(:name) == 'Facilities'\n self.useful_life_benchmark ||= 3\n self.useful_life_benchmark_unit ||= 'condition_rating'\n elsif self.fta_asset_category.try(:name) != 'Infrastructure'\n self.useful_life_benchmark ||= self.asset_level.try(:default_useful_life_benchmark)\n self.useful_life_benchmark_unit ||= self.asset_level.try(:useful_life_benchmark_unit)\n end\n\n self.useful_life_benchmark_locked = self.useful_life_benchmark_locked.nil? ? false : self.useful_life_benchmark_locked\n\n if self.fta_asset_category.try(:name) == 'Infrastructure'\n self.pcnt_goal ||= 10\n else\n self.pcnt_goal ||= 0\n end\n\n self.pcnt_goal_locked = self.pcnt_goal_locked.nil? ? false : self.pcnt_goal_locked\n\n end", "def new_model_defaults\n end", "def default_definition() {} end", "def is_default=(value)\n @is_default = value\n end", "def is_default=(value)\n @is_default = value\n end", "def default=(val)\n self['default'] = val\n end", "def default_options; {} end", "def default_attributes=(v)\n cfg_set(:default_attributes, v)\n end", "def reset_is_default_flags\n if self.is_default == true\n self.time_series.weights.get_all_but(self.id).update_all(is_default: false)\n end\n end", "def set_defaults\n super\n end", "def set_defaults\n super\n end", "def default\n @type = :default\n 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 reset_is_default_flags\n if self.is_default == true\n self.dataset.weights.get_all_but(self.id).update_all(is_default: false)\n end\n end", "def default_factory=(factory); end", "def set_default\n @manager.set_default(@entity['id']) if @manager.respond_to?(:set_default)\n end", "def defaults\n super\n end", "def defaults!; end", "def defaults!; end", "def add_defaults_local\n super\n self.site ||= default_site\n end", "def default_attributes=(v)\n cfg_set(:default_attributes, v)\n end", "def default=(value); end", "def set_defaults\n self.version = 0\n end", "def set_defaults\n self.active ||= true\n end", "def default_version\n nil\n end", "def set_defaults\n super\n self.extended_useful_life_months ||= 0\n self.extended_useful_life_miles ||= 0\n end", "def default_opts\n { :default => default }.merge( opts )\n end", "def set_default(name, *args, &block)\n set(name, *args, &block) unless exists?(name)\nend", "def set_default(name, *args, &block)\n set(name, *args, &block) unless exists?(name)\nend", "def default\n on_current_site.find_by(default: true)\n end", "def set_default(inVariable,default)\n\t if nil == inVariable\n\t\t default\n\t else\t\n\t\t\t if inVariable.empty?\n\t\t\t\t default\n\t\t\t else \n\t\t\t inVariable\n\t\t\t end\n\t end\n end", "def default\n attributes.default\n end", "def default value = nil\n @default = value if value\n @default\n end", "def method_missing(*args)\n default\n end", "def set_study_default_options\n case study_file.file_type\n when 'Metadata'\n set_default_annotation\n when 'Cluster'\n set_default_cluster\n set_default_annotation\n when 'AnnData'\n set_default_cluster\n set_default_annotation\n end\n Rails.logger.info \"Setting default options in #{study.name}: #{study.default_options}\"\n study.save\n # warm all default caches for this study\n ClusterCacheService.delay(queue: :cache).cache_study_defaults(study)\n end", "def required_defaults; end", "def set_study_default_options\n @default_cluster = @study.default_cluster\n @default_cluster_annotations = {\n 'Study Wide' => @study.viewable_metadata.map {|metadata| metadata.annotation_select_option }\n }\n unless @default_cluster.nil?\n @default_cluster_annotations['Cluster-based'] = @default_cluster.cell_annotations\n .keep_if {|annot| @default_cluster.can_visualize_cell_annotation?(annot)}\n .map {|annot| @default_cluster.formatted_cell_annotation(annot)}\n end\n end", "def set_defaults\n self.active = self.active.nil? ? true : self.active\n self.show_in_dashboard = self.show_in_dashboard.nil? ? true : self.show_in_dashboard\n self.system_activity = self.system_activity.nil? ? false : self.system_activity\n self.frequency_quantity ||= 1\n end", "def default_values\n self.mode ||= 'challenge_quick'\n end", "def default_values\n self.subtype ||= \"registered\"\n self.status ||= \"NEW\"\n end", "def default(name,value)\n @network.spec_factory.defaults[name]=value\n end", "def set_default!\n @@default_user = self\n end", "def set_default_profile(opts)\n opts = check_params(opts,[:defaults])\n super(opts)\n end", "def set_default_profile(opts)\n opts = check_params(opts,[:defaults])\n super(opts)\n end", "def set_default_profile(opts)\n opts = check_params(opts,[:defaults])\n super(opts)\n end", "def set_default_profile(opts)\n opts = check_params(opts,[:defaults])\n super(opts)\n end", "def set_default_profile(opts)\n opts = check_params(opts,[:defaults])\n super(opts)\n end", "def set_default_profile(opts)\n opts = check_params(opts,[:defaults])\n super(opts)\n end", "def set_default_profile(opts)\n opts = check_params(opts,[:defaults])\n super(opts)\n end", "def set_default_profile(opts)\n opts = check_params(opts,[:defaults])\n super(opts)\n end" ]
[ "0.73025465", "0.7030864", "0.6691541", "0.6508182", "0.64392126", "0.6403648", "0.6371976", "0.63308704", "0.63308704", "0.62926894", "0.62926894", "0.62926894", "0.62926894", "0.62926894", "0.62926894", "0.6229842", "0.62219995", "0.62165314", "0.6201505", "0.6201505", "0.6134255", "0.6093718", "0.6083909", "0.6080542", "0.60721666", "0.6064198", "0.6064198", "0.6019714", "0.60091287", "0.5994096", "0.5990584", "0.59507626", "0.59428704", "0.59345526", "0.59176713", "0.5915771", "0.5915771", "0.5915771", "0.59042215", "0.5903826", "0.5891916", "0.58758914", "0.5853864", "0.5849527", "0.5843476", "0.5843476", "0.5840678", "0.5837656", "0.58371854", "0.5833349", "0.5825219", "0.5825219", "0.58216786", "0.5806544", "0.5806544", "0.5806544", "0.5806544", "0.5806544", "0.5806544", "0.5806544", "0.5806544", "0.5806544", "0.5806544", "0.57960606", "0.5785899", "0.57685435", "0.5768094", "0.5759148", "0.5759148", "0.5754152", "0.5753973", "0.5737713", "0.57351446", "0.57339585", "0.5733829", "0.57334304", "0.57326907", "0.57324445", "0.57324445", "0.5731852", "0.5726171", "0.5724055", "0.5721139", "0.571965", "0.57185763", "0.5714881", "0.5712236", "0.57115513", "0.57067835", "0.5690792", "0.5688253", "0.568721", "0.56743103", "0.56743103", "0.56743103", "0.56743103", "0.56743103", "0.56743103", "0.56743103", "0.56743103" ]
0.7272927
1
Return an array of strings, one for each line in the file
def read_file @read_file ||= File.open(self.file) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_file_as_string_array\n file = (\"#{File.dirname(__FILE__)}/../data/seed.txt\")\n string_array = []\n \n File.open(file, 'r') do |f|\n f.each_line do |line|\n string_array << line\n end\n end\n \n string_array\n end", "def file_to_array file\n lines = []\n File.open(file, \"r\") do |infile|\n while (line = infile.gets)\n lines.push(line.gsub(\"\\n\", \"\").rstrip)\n end\n end\n lines\n end", "def get_from_file(path)\n\n array = []\n file = File.open(path)\n if file != nil\n array = file.readlines.map(&:chomp) # Discard the final '\\n'\n file.close\n end\n\n return array\n\nend", "def _read filename\n d = []\n File.open(filename).each { |line|\n d << line\n }\n return d\n end", "def get_file_array(path)\n array = []\n File.open(path) do |f|\n f.each_line do |line|\n array.push(line)\n end\n end\n return array\nend", "def get_lines(filename); end", "def load\n arr = []\n begin\n while(!@file.eof?)\n line = @file.readline.chomp\n arr.concat(line.split)\n end\n ensure\n @file.close\n end\n arr\n end", "def load_file(path)\n file_array = IO.readlines(path)\n file_array.map {|element| element.chomp}\nend", "def read_input\n ary = []\n File.open('./input.txt', 'r') do |file|\n file.each do |line|\n ary << line.to_s\n end\n end\n\n ary.freeze\nend", "def lines\n result = Array.new\n @theLines.each { |l| result << String.new(l) }\n return result\n end", "def list\n file_correct?(@file_path)\n file = File.open(@file_path)\n file.map { |row| row.split(' ') }\n end", "def read_file(file)\n lines = []\n IO.foreach(find(file)) do |line|\n lines << line.strip unless line.strip == ''\n end\n lines\n end", "def getFileContent(dir, file):Array\n arr = Array.new\n File.open(\"#{dir}/#{file}\", \"r\").each do |line|\n arr.push line\n end\n arr\n end", "def read_in\n File.foreach(file_name).map(&:chomp)\n end", "def get_lines(filename)\n return File.open(filename, 'r').readlines\nend", "def get_lines(filename)\n return File.open(filename, 'r').readlines\nend", "def get_lines(filename)\n return File.open(filename, 'r').readlines\nend", "def file_to_string_array\n card_list = []\n # File.open(\"./lib/two_cards.txt\").each do |line|\n File.open(@filename).each do |line|\n card_list << line\n end\n card_list.each do |card|\n card.slice!(\"\\n\")\n end\n #puts \"#{@card_list}\"\n #@card_list\n end", "def file_list(dir)\n array = Array.new\n array += File.readlines(dir).map(&:chomp)\nend", "def get_data_from_file(file)\r\n f = File.open(file, \"r\")\r\n gene = Array.new\r\n f.each_line do |line|\r\n gene << line.delete(\"\\n\") # We remove end of line \\n \r\n end\r\n return gene\r\nend", "def import_ori(file_path)\n string = IO.read(file_path)\n array = string.split(\"\\n\")\n array.shift\n return array\n end", "def le_arquivoL (arq)\n l = Array.new\n text = File.open(arq).read\n text.gsub!(/\\r\\n?/, \"\\n\")\n text.each_line do |line|\n l = l << line\n end\n return l\n end", "def q1_read_to_array(data_file_name)\r\n array2d = []\r\n \r\n read_file(\"data/\"+data_file_name).each{ |line|\r\n array1d = line.split(\",\").map(&:strip).map(&:to_s)\r\n array2d << array1d\r\n }\r\n return array2d\r\nend", "def read_file(fname=nil)\n return if fname.nil?\n # Array we use to store entries\n lines = Array.new\n ah_data = Array.new\n # Deal with DOS line endings by reading in file, then manually splitting on DOS line ending\n File.open(fname).each_line do |line|\n lines = line.split(/\\r\\n?/).map(&:chomp)\n end\n return lines\nend", "def GenerateListFromFile(fileName)\n\tf = File.open(fileName, \"r\")\n\titems = []\n\t\n\tf.each_line do |item|\n\t\titems.push(item.strip)\n\tend\n\t\n\treturn items\nend", "def getNames()\n\t#open file\n\tf = File.open(\"names.txt\", \"r\")\n\t#initialize namear array\n\tnamear = []\n\tf.each_line do |line|\n\t\t#remove '\"' and line escapes\n\t\tline = line.gsub(/\"/,'').strip\n\t\t#split the line into individual names separating at ','\n\t\tnamear = line.split(',')\n\tend\n\t#close file\n\tf.close\n\t#return array\n\treturn namear\nend", "def read_input_file(input_path)\n all_lines = []\n\n File.open(input_path, \"r:UTF-8\") do |file|\n while (line = file.gets)\n all_lines += [line]\n end\n end\n\n all_lines\nend", "def load_list filename\n\tlist = []\n\tbegin\n\t\topen filename do |f|\n\t\t\tuntil (line = f.gets).nil?\n\t\t\t\tnext if line.strip.empty?\n\t\t\t\tlist << line.strip\n\t\t\tend\n\t\tend\n\trescue Errno::ENOENT\n\tend\n\tlist\nend", "def parse_txt_file(filename)\n file_lines = []\n File.open(filename).each do |line|\n file_lines << line.chomp\n end\n file_lines\nend", "def read_file_to_arr(path)\n ret = []\n File.open(path, \"r\") do |f|\n f.each_line do |line|\n ret << line.split(\" \").map { |s| s.to_i}\n end\n end\n return ret\nend", "def open_file (file)\r\n \r\n data = Array.new\r\n input = File.new(file, \"r\")\r\n input.gets\r\n while line = input.gets # gets each line of the file\r\n line.chomp! # deletes \\n\r\n data << line\r\n end\r\n input.close\r\n \r\n return data\r\n \r\nend", "def parsed_file\n data.split(\"\\n\").map do |line|\n line.split(' ')\n end\n end", "def words_from_file( f )\n result = Array.new\n File.foreach( f ) do | line |\n result << self.words_from_string( line )\n end\n result.flatten\n end", "def file_2_list(f,lc=true)\n puts \"Loading records from file: #{f}\" if @verbose\n begin\n list=Array.new\n file = File.open(f, \"r\")\n file.each_line do |line|\n line=line.chomp.strip\n next if line.nil?\n next if line.empty?\n next if line =~ /^\\s*#/\n line=line.downcase if lc==true\n list.push(line.chomp.strip)\n end\n file.close\n return list\n rescue => ee\n puts \"Exception on method #{__method__} for file #{f}: #{ee}\" if @verbose\n return nil\n end\n end", "def get_lines raw_file\n lines = raw_file.split(\"\\n\").compact\n lines = lines.uniq.reject{|line| line.empty?}\n lines = lines.reject do |line| \n not LEGAL_CATEGORIES.include? line.split[0]\n end\n end", "def readFile(fileName)\n if File.file?(fileName)\n return File.read(fileName).split(/\\n/)\n else\n return \"\"\n end \nend", "def read_content(file)\n\t\tcontent = []\n\t\tfile.each do |f|\n\t\t\tif File.file?(f)\n\t\t\t\tFile.open(f, \"r\") do |f|\n\t\t\t\t\tword = \"\"\n\t\t\t\t\tf.each_line do |line|\n\t\t\t\t\t\tword += \"#{line}\"\n\t\t\t\t\tend\n\t\t\t\t\tcontent += [word]\n\t\t\t\tend\n\t\t\tend\t\t\t\n\t\tend\n\t\treturn calculate_content(content)\n\tend", "def line_maker\n @lines = File.readlines(path, chomp: true)\n end", "def get_file_contents(file_path)\n input_file = File.open(file_path, 'r')\n input_file_contents = input_file.read\n input_file.close\n input_file_contents.split(\"\\n\")\n end", "def load_lines file\n\n\t\tlines = Array.new\n\t\tlines = @file.split(\"\\n\")\n\n\t\t#fuck that, i dont like the dyanmic feed, just pre-parse it\n\t\tlines.map! do |line| #map overwrites the old array\n\t\t\tif line.include? '#'\n\t\t\t\tsplit = line.split '#'\n\t\t\t\t#puts split.to_s\n\t\t\t\tsplit.shift\n\t\t\telse\n\t\t\t\tline\n\t\t\tend\n\t\tend\n\n\t\t#removing blank lines\n\t\tlines.delete_if do |line|\n\t\t\ttrue if line.empty?\n\t\tend\n\n\t\tlines.each { |line| line.chomp! }\n\n\t\tlines\n\tend", "def lines; [to_s]; end", "def read_keys_file(path)\n return [] unless File.exists?(path)\n File.readlines(path).map! { |l| l.chomp.strip }\n end", "def file_lines\r\n if File.exist?(@file_name)\r\n file_reader = File.open(@file_name, 'r')\r\n file_reader.each_line do |line|\r\n @lines.push line\r\n end\r\n file_reader.close\r\n @lines\r\n else\r\n raise \"File '#{@file_name}' does not exist\"\r\n end\r\n end", "def read_contents\n\t\treturn File.open(self.file_name).read.lines.map(&:chomp) if self.file_name\n\tend", "def file_to_a file_path_str, delimiter=\"\\n\"\n File.read(file_path_str).lines(separator=delimiter)\n end", "def read_file(file_name=\"\")\n\tFile.open(file_name) do |file|\n\t\twhile line = file.gets\n\t\t\ta = %w{#{line}}\n\t\t\tputs a\n\t\t\tputs line\n\t\tend\n\tend\nend", "def parse_csv_file(delim, file_name) \n \n temp_array = Array.new #Create an array\n file = File.open(file_name, \"r\") #Open a file for reading\n \n \n #Iterate file, parse strings and store\n file.each_line do |line|\n temp_array.push(parse_line(delim, line))\n end\n\n #Close resource\n file.close\n \n return temp_array\nend", "def readList # read the list file and return an array\n array_list = []\n i = 0\n File.open(\"list.txt\").readlines.each do |line|\n array_list[i] = line\n i += 1\n end\n array_list\nend", "def read_loaded_txt_file_to_array(file)\n\ttext_array = file.read.split(\",\")\nend", "def get_lines\n lines = []\n line = \"\"\n until line == \".\"\n line = Readline.readline\n lines << line\n end\n lines.join(\"\\n\")\n end", "def file_2_list(f,lc=true)\n\t\tputs \"Loading records from file: #{f}\" if @verbose\n\t\tbegin\n\t\t\tlist=Array.new\n\t\t\tfile = File.open(f, \"r\")\n\t\t\tfile.each_line do |line|\n\t\t\t\tline=line.chomp.strip\n\t\t\t\tnext if line.nil?\n\t\t\t\tnext if line.empty?\n\t\t\t\tnext if line =~ /^\\s*#/\n\t\t\t\tline=line.downcase if lc==true\n\t\t\t\tlist.push(line.chomp.strip)\n\t\t\tend\n\t\t\tfile.close\n\t\t\treturn list\n\t\trescue => ee\n\t\t\tputs \"Exception on method #{__method__} for file #{f}: #{ee}\" if @verbose\n\t\t\treturn nil\n\t\tend\n\tend", "def readContents(filename)\r\n file = File.open(filename)\r\n contents = \"\"\r\n file.each { |line|\r\n contents << line\r\n }\r\n contents\r\nend", "def read_file\r\n\t\treturn File.readlines( COLOR_FILE ).map{ |line| line.chomp }\r\n\tend", "def readlines\n lns = infile.readlines.map(&:strip)\n infile.close unless infile.tty?\n lns\n end", "def readNames(path)\n return File.read(path).rstrip.split(/\\n/).map{|r| r.downcase.split(/\\|/)}\nend", "def parse(filename)\n result = []\n File.open(filename,'r') do |file|\n for line in file\n result << line.split(' ').map(&:to_i)\n end\n end\n result\nend", "def input_file(file)\n inputs = []\n t = -1\n i = 0\n f = File.new(file)\n f.each_line do |line|\n if t == -1\n t = line.to_i\n else\n if i < t\n inputs << line\n i += 1\n end\n end\n end\n return inputs\nend", "def input_file(file)\n inputs = []\n t = -1\n i = 0\n f = File.new(file)\n f.each_line do |line|\n if t == -1\n t = line.to_i\n else\n if i < t\n inputs << line\n i += 1\n end\n end\n end\n return inputs\nend", "def read_lines\n File.read(@document_file).split(\"\\n\")\n end", "def read(file)\n content_set = Set.new\n open(file) do |line|\n next if line.nil?\n content_set << \"#{line}\"\n end\n content_set.to_a.join(\"\\n\")\n end", "def read\n data = []\n\n File.open(@source) do |file|\n while line = file.gets\n data.push(Hash[@columnNames.zip(line.split(' '))])\n end\n end\n\n data\n end", "def get_lines\n lines = []\n read_file.each_line{|l| lines << l.chomp }\n @total_lines = lines.shift.to_i\n lines\n end", "def read()\n a=[]\n f=open(\"words.txt\")\n f.each_line {|line|\n a[a.length]=line.chomp}\n f.close\n return a\nend", "def contenu_fichier(nom_fichier)\n IO.readlines(nom_fichier).map(&:chomp)\nend", "def get_source_content\n\t\treturn [] unless File.exists? @source\n\t\treturn File.read(@source).split(\"\\n\")\n\tend", "def file_array_parser\n @array_of_parse_files = []\n file_array.each do |file|\n File.open(\"text_files/#{file}\").readlines.each do |line|\n if line.include?(\"\\n\") # removes '\\n' (line breaker)\n @array_of_parse_files << [line.gsub!(/\\n/, '')]\n else\n @array_of_parse_files << [line]\n end \n end\n @array_of_parse_files \n end\n\nend", "def contenu_fichier( nom_fichier )\n IO.readlines(nom_fichier).map(&:chomp)\nend", "def contenu_fichier( nom_fichier )\n IO.readlines(nom_fichier).map(&:chomp)\nend", "def read_paths(output_file)\n rows = []\n paths = []\n File.readlines(output_file).map do |line|\n rows << line.chomp.split(\"#\")\n end\n for r in rows \n str = r[0].split(\" \")\n paths << [ str[2].to_i, str[3].to_i, str[4] ]\n end\n return paths\nend", "def lines_for(file_name, name = T.unsafe(nil)); end", "def read_file\n match_file = File.new(\"matches.txt\", \"r\")\n no_of_match = match_file.gets\n if no_of_match != nil\n for i in 0..no_of_match.to_i - 1\n match_result = match_file.gets\n @matchesarr << match_result\n end\n end\n match_file.close\n end", "def read_lines(file_path)\n raise(format(ERROR_FILE_NOT_EXIST, file_path)) unless File.exist?(file_path)\n\n File.readlines(file_path, chomp: true)\n end", "def read_file(file)\r\n\tlines = IO.readlines(file)\r\n\tif lines != nil\r\n\t\tfor i in 0 .. lines.length-1\r\n\t\t\tlines[i] = lines[i].sub(\"\\n\",\"\")\r\n\t\tend\r\n\t\treturn lines[0..lines.length-1]\r\n\tend\r\n\treturn nil\r\nend", "def read_file(path)\n file_contents = []\n File.open(path).each { |line| file_contents << line }\n\n file_contents\n end", "def text_file_read(filename)\n text_file = File.open(filename, 'r')\n all_lines_from_file = text_file.read\n text_file.close\n return all_lines_from_file\nend", "def readFile(input)\n\t\tmain=[]\n\t\tentryList=[]\n\t\tinputFileObj=File.open(input, \"r\")\n\t\tinputFileObj.readlines.each do |x|\n\t\t\tentryList<<(x)\n\t\tend\n\t\tentryList.each do |x|\n\t\t\tline=Array.new()\n\t\t\tobj=x.split(\" \")\n\t\t\tobj.each do |x|\n\t\t\t\tline<<(x)\n\t\t\t\tif $hashMain[x].nil?\n\t\t\t\t\t$hashMain[x]=1\n\t\t\t\telse\n\t\t\t\t\t$hashMain[x]+=1\n\t\t\t\tend\n\t\t\tend\n\t\t\tmain<<(line)\n\t\tend\n\t\treturn main\n\tend", "def analyze_file()\n arrayLinAnaly=[]\n linenum=0\n File.foreach('test.txt') do |line|\n arrayLinAnaly << LineAnalyzer.new(line, linenum)\n linenum+=linenum\n end\n return arrayLinAnaly\n end", "def get_recipients(file_path)\n data = ''\n f = File.open(file_path, \"r\")\n f.each_line do |line|\n data += line\n end\n\n data_arry = data.split(\",\")\n return data_arry\n end", "def get_aa_lines(file_name)\n File.open(\"#{File.dirname(__FILE__)}/../../config/aa/#{file_name}.txt\") {|f| f.readlines }\n end", "def safe_readlines(filename)\n unless File.exists?(filename)\n puts \"File #{filename} not found\"\n return\n end\n\n # assume files are not huge as their comparison makes no sense in this case\n File.readlines(filename).map{|line| line.strip}\nend", "def get_html path\n array = []\n\n archivo = File.open(path, 'r:UTF-8')\n archivo.each do |l|\n array.push(l.strip)\n\tend\n archivo.close\n\n return array\nend", "def readFile(filename)\n # create an string[] of commnadlines\n commandlines = []\n # open file\n command_file = File.open(filename)\n #raise \"WARNING! The file is not valid!\"\n File.open(filename) do |f|\n f.each_line do |line|\n commandlines << line.gsub(\"\\n\", \"\")\n end\n end\n # return an string[]\n return commandlines\n rescue SystemCallError => e\n puts e.class.name\n puts e.message\n false\n else\n puts \"File is loaded.\"\n ensure\n command_file.close if command_file\n end", "def read_file pn\n pn.readlines.map(&:chomp)\n .each do |line|\n @entries.add line, pn\n end\n end", "def ReadFromFile()\n wordArray = Array.new\n File.open(\"mastermindWordList.txt\", \"r\") do |file| # Uncomment this to have a larger list (466000+ words)\n # Note: Only use if in original repository that contains words.txt\n # File.open(\"mastermindWordList.txt\", \"r\") do |file| # Comment this if previous line is uncommented\n file.each_line do |word|\n if CheckValidWord(word) == true\n wordArray.push(word.chomp.downcase)\n end\n end\n end\n return wordArray\nend", "def readlines(eol=$/)\n ary = []\n ary << line while line = self.gets(eol)\n ary\n end", "def get_multi_line_input_int_arr(original_filename)\n get_input_str_arr(original_filename).map(&:to_i)\nend", "def getFileContents(file)\n fileContent = \"\";\n File.open(file).each do |line|\n fileContent += line;\n end\n fileContent;\nend", "def lines\n\t\tcontents.split(\"\\n\")\n\tend", "def lines\n\t\tcontents.split(\"\\n\")\n\tend", "def readFile\r\n\t\tfile = File.open(fileName, \"r\")\r\n\r\n\t\t#Array for partial matches\t\t\r\n\t\t@dictionary = Array.new\r\n\t\tfile.each do |line|\r\n\t\t\tif line != \"\\n\"\r\n\t\t\t\t@dictionary << line.split(/[:;\\n]/)\r\n\t\t\tend\r\n\t\tend\r\n\t\tstartStrategies\r\n\tend", "def build_cls_list(file_name, arr)\n file = File.open(file_name, \"r\")\n while !file.eof?\n line = file.readline.chomp\n arr.push(line)\n end\n file.close\nend", "def read_from_file\n commands = []\n File.readlines(@location).each { |line| commands << line.strip }\n commands\n end", "def read_lines\n lines = Array.new\n line = @file.gets\n tokens = line.scan(/[-+]?\\d*\\.?\\d+/)\n x1 = Integer(tokens[0])\n x2 = Integer(tokens[1])\n \n while not (x1==0 and x2==0)\n l = Line.new(x1,x2)\n lines.push(l)\n line = @file.gets\n tokens = line.scan(/[-+]?\\d*\\.?\\d+/)\n \n x1 = Integer(tokens[0])\n x2 = Integer(tokens[1])\n \n end\n \n return lines\n \n end", "def file_load(file)\n\t\tresult = \"\"\n\t\tFile.open(file.to_s, 'r') do |f|\n\t\t\twhile l = f.gets \n\t\t\t\tresult << l\n\t\t\tend\n\t\tend\n\t\tresult\n\tend", "def body\n lines = ''\n in_head = true\n File.open(@file).each_line do |line|\n in_head = false if in_head and line.chomp.empty?\n lines << line unless in_head\n end\n return lines\n end", "def translate(filename)\r\n\t\t@array_translate = []\r\n\t\tFile.open(filename).each do |line|\r\n\t\t\t@array_translate << line.split\r\n\t\tend\r\n\tend", "def load_data(fileName)\n set = open(fileName, 'r')\n data = []\n set.each_line do |line|\n categories = line.split(' ')\n data.push(categories)\n end\n return data\n end", "def generate_words\n ret = []\n\n File.open('enable.txt').each do |line|\n new_line = line\n # We don't care for the new line character in the game of hangman.\n new_line = new_line.delete(\"\\n\")\n ret << new_line\n end\n\n return ret\nend", "def content\n lines.uniq.join(\"\\n\").lstrip\n end", "def readlines\n return nil unless __advance!\n\n lines = []\n while line = gets()\n lines << line\n end\n\n lines\n end", "def read_file\n\t\tif @filename == \"\"\n\t\t\t@text = [\"\"]\n\t\t\treturn\n\t\telse\n\t\t\tif File.exists? @filename\n\t\t\t\ttext = IO.read(@filename)\n\t\t\telse\n\t\t\t\t@text = [\"\"]\n\t\t\t\treturn\n\t\t\tend\n\t\tend\n\t\t# get rid of crlf\n\t\ttemp = text.gsub!(/\\r\\n/,\"\\n\")\n\t\tif temp == nil\n\t\t\t@eol = \"\\n\"\n\t\telse\n\t\t\t@eol = \"\\r\\n\"\n\t\tend\n\t\ttext.gsub!(/\\r/,\"\\n\")\n\t\t@text = text.split(\"\\n\",-1)\n\tend" ]
[ "0.796819", "0.76737267", "0.76098794", "0.7311648", "0.7307313", "0.7231026", "0.71605325", "0.7138764", "0.71165675", "0.7067568", "0.6923033", "0.69197065", "0.6876195", "0.684857", "0.6839768", "0.6839768", "0.6839768", "0.68338364", "0.67883384", "0.6773707", "0.67484325", "0.67344457", "0.6716339", "0.6694439", "0.6678103", "0.667314", "0.6636521", "0.6622247", "0.66204125", "0.66126144", "0.6607184", "0.65701294", "0.65655255", "0.65415525", "0.6495999", "0.64918035", "0.64755976", "0.64741665", "0.6469668", "0.6465367", "0.6463202", "0.6453108", "0.64319927", "0.6425108", "0.6403061", "0.6384909", "0.63843334", "0.6376859", "0.6348756", "0.6347402", "0.6323781", "0.63109076", "0.63091516", "0.6287891", "0.6271631", "0.6270419", "0.62679136", "0.62679136", "0.6259826", "0.62404716", "0.62342954", "0.6202486", "0.61847657", "0.6160041", "0.61428946", "0.6141719", "0.6137329", "0.6137329", "0.613662", "0.6127975", "0.611871", "0.6113898", "0.6077364", "0.60664654", "0.60632324", "0.6058961", "0.6055406", "0.6055078", "0.6051241", "0.6044566", "0.60391283", "0.60344565", "0.6033925", "0.6012477", "0.60110533", "0.6002477", "0.60000455", "0.5993852", "0.5993852", "0.59913236", "0.59739476", "0.59681845", "0.5962416", "0.5955391", "0.59327656", "0.59277385", "0.59159636", "0.5914808", "0.5900754", "0.5898298", "0.58933777" ]
0.0
-1
TODO: use generate instead of pretty_generate to pipe output straight into mongoimport
def to_s self.to_array.map{ |hsh| JSON.pretty_generate(hsh) }.join("\n") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_rebalancing\n dbname = 'baybike'\n collection_name = 'rebalancing'\n `mongo #{dbname} --eval \"db.dropDatabase()\"`\n command = \"mongoimport -d #{dbname} -c #{collection_name} --type csv --file #{rebalancing} --headerline\"\n `#{command}`\nend", "def pipeline_to_mongosh_script(infile, outfile)\n txt = File.read(infile)\n data = JSON.parse(txt)\n\n ns_split = data['namespace'].split '.', 2\n dbname = ns_split[0]\n collname = ns_split[1]\n\n the_pipeline = \"[\\n\"\n is_first = true\n data['pipeline'].each do |pstage|\n if not pstage[\"isEnabled\"]\n next\n end\n\n if is_first\n is_first = false\n else\n the_pipeline += ', '\n end\n stage_txt = pstage['stage']\n stage_txt = stage_txt.gsub(\"\\\\r\", \"\\r\").gsub(\"\\\\n\", \"\\n\")\n the_pipeline += \"{ #{pstage['stageOperator']}: \" + stage_txt + \" }\"\n end\n the_pipeline += \"\\n]\"\n\n mongosh_script_out =\n\"//Query name: #{data['name']}\n\ndb.getSiblingDB('#{dbname}').#{collname}.aggregate(\n\" + the_pipeline + \"\n, {allowDiskUse: true}\n);\n\"\n\n File.write(outfile, mongosh_script_out)\nend", "def mongodump\n \"#{ mongodump_utility } #{ database } #{ credential_options } \" +\n \"#{ connectivity_options } #{ ipv6_option } #{ user_options } #{ dump_directory }\"\n end", "def mongodump\n \"#{ utility(:mongodump) } #{ database } #{ credential_options } \" +\n \"#{ connectivity_options } #{ ipv6 } #{ additional_options } #{ dump_directory }\"\n end", "def db_dump_cmd\n \"mongodump\"\n end", "def mongo_dump_command\n cmd = \"\"\n cmd = \"mongodump -h #{config['host']}:#{config['port']} -d #{config['database']} -o . \"\n cmd += \"--username #{config['username']} --password #{config['password']}\" unless config[\"username\"].nil? and config[\"password\"].nil?\n cmd\n end", "def dump!\n run(mongodump)\n end", "def dump!\n run(mongodump)\n end", "def export_mongo\n # defined in immunoscore_results_loader\n JSON_CLASS_MAPPER.values.each do |mm_class|\n mm_class.all.each do |mm_object|\n puts \"#{mm_object}: #{mm_object[:case_n]}\"\n next unless mm_object[:case_n] != nil\n case_dir=(EXPORT_DIR+\"/\"+ mm_object[:case_n]) \n Dir.mkdir case_dir unless Dir.exist?(case_dir)\n fh=export_file case_dir, mm_object[:path]\n fh.write(mm_object[:data_load])\n fh.close\n \n end\n end\nend", "def mongoize(object)\n object.mongoize\n end", "def print_j2bson(io)\n io.each_line do |line|\n jsonobj = JSON.parse(line, { :object_class => BSON::OrderedHash } )\n bsonobj = BSON.serialize(jsonobj)\n STDOUT << bsonobj.to_s\n end\nend", "def generate_from_collection(model, items, parent_key, parent_id, poly_in)\n model_table = model.to_s.gsub(/::/, \"_\").tableize\n insert_string = \"INSERT INTO \" << model_table << \"(\"\n\n # map mongo types to sql\n sql_types = {\"String\"=>\"text\", \"BSON::ObjectId\"=>\"primary_key\", \"Time\"=>\"time\", \"Object\"=>\"integer\", \"Array\"=>\"text\", \"Integer\"=>\"integer\", \"string\"=>\"text\", \"DateTime\"=>\"datetime\", \"Date\"=>\"date\", \"Hash\"=>\"text\", \"Boolean\"=>\"boolean\", \"Float\"=>\"float\"}\n ignored_fields = ['_type', \"_keywords\"]\n\n # maintain list of fields you either want renamed or if you want them skipped by all transforms include them here\n renamed_fields = {\"_id\" => \"mongo_id\"}\n\n # hash of habtm relations from your schema - make sure the key is alpha before the value\n habtm = {'AlphaTable' => 'BetaTable'}\n\n # user mongoid to figure out relationships we need to iterate over\n relations_in = model.relations.select {|key,value| value[:relation]==Mongoid::Relations::Embedded::Many}\n single_in = model.relations.select {|key,value| value[:relation]==Mongoid::Relations::Embedded::One}\n items.each_with_index do |obj, i|\n id_to_use_next = @@id_counter[model_table] || 100000\n @@id_counter[model_table] = id_to_use_next+1 # hash to keep track of postgres id sequences\n obj_hash = {}\n obj_id = \"\"\n postgres_obj_id = \"\"\n model.fields.each do |field|\n next if ignored_fields.include?(field.first) or field.first.end_with?(\"_ids\")\n field_name = field.first\n\n val = obj.send(field.first.to_sym)\n val = val.to_s if val.is_a?(BSON::ObjectId)\n # serialize hashes & arrays\n if val.is_a?(BSON::OrderedHash)\n val = val.to_h.to_yaml\n elsif val.is_a?(Array)\n val = val.map {|v| v.is_a?(BSON::OrderedHash) ? v.to_h : v }\n val = val.to_yaml\n elsif val.is_a?(Hash)\n val = val.to_yaml\n end\n\n # clean up any apostrophes\n val = val.gsub(/'/, \"''\") unless val.nil? || !val.is_a?(String)\n val = val.to_time.utc if val.present? && ([DateTime, Date, Time].include?(field[1].options[:type]))\n val = '' if val.nil? && (field[1].options[:type] == Time || field[1].options[:type] == DateTime || field[1].options[:type] == Date)\n\n if renamed_fields.include?(field_name)\n field_name = renamed_fields[field_name]\n elsif field_name==\"number\" # we were using a number field for user facing 'id'\n field_name = \"id\"\n elsif field_name.end_with?(\"_id\")\n if val.blank?\n obj_hash[field_name] = \"\"\n else\n # throw in placeholder values with the bson id\n obj_hash[field_name] = \"#{val}_placeholder\"\n field_name = \"mongo_#{field_name.to_s.gsub(/::/, \"_\").downcase}\"\n @@id_indexed[\"#{val}_placeholder\"] << @@lines.count\n @@all_objects[\"#{val}_placeholder\"] = field_name\n end\n end\n obj_id = val if field_name==\"mongo_id\"\n postgres_obj_id = val if field_name==\"id\"\n obj_hash[field_name] = val\n end\n if poly_in # do polymorphic foreign keys\n obj_hash[\"mongo_#{poly_in}_id\"] = parent_id\n obj_hash[\"#{poly_in}_type\"] = parent_key.classify\n obj_hash[\"#{poly_in}_id\"] = \"#{parent_id}_placeholder\"\n @@all_objects[\"#{parent_id}_placeholder\"] = parent_key.classify\n @@id_indexed[\"#{parent_id}_placeholder\"] << @@lines.count\n elsif !parent_key.nil?\n obj_hash[\"mongo_#{parent_key.to_sym}_id\"] = parent_id\n obj_hash[\"#{parent_key.to_sym}_id\"] = \"#{parent_id}_placeholder\"\n @@all_objects[\"#{parent_id}_placeholder\"] = parent_key.classify\n @@id_indexed[\"#{parent_id}_placeholder\"] << @@lines.count\n end\n if postgres_obj_id.blank?\n postgres_obj_id = id_to_use_next\n obj_hash[\"id\"] = postgres_obj_id\n end\n @@id_hash[(\"#{obj_id}_placeholder\")] = postgres_obj_id.to_s\n\n # create sql from array of hashes\n insert_sql(insert_string, obj_hash)\n\n # HABTM\n target=habtm[model.to_s]\n if target\n habtm_collection = obj.send(\"#{target.downcase}_ids\")\n if habtm.size>0\n habtm_obj_hash = Hash.new\n habtm_collection.each do |target_obj|\n habtm_obj_hash[\"mongo_#{target.downcase}_id\"] = target_obj.to_s\n habtm_obj_hash[\"#{target.downcase}_id\"] = \"#{target_obj.to_s}_placeholder\"\n habtm_obj_hash[\"mongo_#{model.to_s.downcase}_id\"] = obj._id\n habtm_obj_hash[\"#{model.to_s.downcase}_id\"] = postgres_obj_id\n @@id_indexed[\"#{target_obj.to_s}_placeholder\"] << @@lines.count\n insert_sql(\"INSERT INTO #{model_table}_#{target.to_s.gsub(/::/, \"_\").tableize} (\", habtm_obj_hash)\n end\n end\n end\n single_in.each do |key, embedded|\n poly_as = embedded[:as] unless embedded[:as].blank?\n embed_collection = obj.send(key.to_sym)\n next if embed_collection.blank?\n generate_from_collection(embed_collection.class, [embed_collection], embedded[:inverse_class_name].to_s.gsub(/::/, \"_\").downcase, obj_id, poly_as) << \"\\n\\r\" unless embed_collection.blank?\n end\n relations_in.each do |key, embedded|\n poly_as = embedded[:as] unless embedded[:as].blank?\n embed_collection = obj.send(key.to_sym)\n generate_from_collection(embed_collection.first.class, embed_collection, embedded[:inverse_class_name].to_s.gsub(/::/, \"_\").downcase, obj_id, poly_as) << \"\\n\\r\" unless embed_collection.blank?\n end\n end\n end", "def run\n Kernel.system \"#{mongo_dump_command}\"\n self\n end", "def mongo_shell\n [utility(:mongo), database, credential_options, connectivity_options, ipv6].join(' ')\n end", "def pull_data args\n already_seen = {}\n File.open args[:output_file_name], 'w' do |f|\n key = args[:fields].shift\n @collection.find().each do |doc|\n primary_field = doc[key]\n already_seen[primary_field] = args[:fields].map { |f| doc[f] }\n end\n already_seen.keys.sort.each do |key|\n f.puts key\n already_seen[key].each do |v|\n f.puts v\n end\n end\n end\n end", "def create_kitten(db,data)\n db.execute(\".mode csv\n.import ? pods\", [data])\nend", "def insertDocs(coll)\n\n # start by dropping any existing data\n # result = @DB[coll].drop\n\n # Insert this many documents\n for i in 1..ARGV[0].to_i\n\n ing1 = Faker::Food.ingredient\n ing2 = Faker::Food.ingredient\n ing3 = Faker::Food.ingredient\n bread = @bread[rand(@bread.size)]\n range = @range[rand(@range.size)]\n # define the Ruby Hash object for the document\n doc =\n {\n :description => \"#{range} #{ing1}, #{ing2} and #{ing3} on #{bread}\",\n :fillings => [\n {\n :ingredient => ing1,\n :calories => rand(100),\n },\n {\n :ingredient => ing2,\n :calories => rand(100),\n },\n {\n :ingredient => ing3,\n :calories => rand(100),\n },\n ],\n :on => bread,\n :price => @price[rand(@price.size)],\n :rating => rand(10),\n :lastUpdate => Time.now\n }\n # Send to the console\n ap doc\n # Insert into the database\n result = @DB[coll].insert_one(doc)\n end\nend", "def mongoize\n self\n end", "def generate_document(data)\n template = config.get(:template)\n options = template[:options]\n file = \"#{template[:root]}/mongoid.slim\"\n # create template\n document = Slim::Template.new(\n # delegate file read to slim\n file,\n # declare default options\n options\n )\n .render(\n # ensure helpers are scoped\n self,\n # pass data via parameter\n data: data\n )\n # publish data to file\n publish_document(document)\n # return document\n document\n end", "def executables\n %w{\n mongo mongod mongodump mongoexport mongofiles mongoimport mongorestore\n mongos mongostat\n }\n end", "def make_undergraduate_paper_collection_structure(mapping_path, foxpath, user)\r\nputs \"running make_collection_structure\"\r\nmapping_file = mapping_path +\"ug_col_mapping.txt\"\r\n# make the top Theses level first, with a CurationConcerns (not dlibhydra) model.\r\n#array of lines including title\r\ntopmapping = []\r\n# we also need a pid:id hash so we can extract id via a pid key\r\nidmap ={}\r\ntoppid = \"york:808102\" #top level collection\r\ntopcol = Object::Collection.new\r\ntopcol.title = [\"Undergraduate essays and projects\"]\r\ntopcol.former_id = [toppid]\r\ntopcol = populate_collection(toppid, topcol, foxpath) \r\n#the top collection is visible to the general public but not the underlying records or collections\r\ntopcol.permissions = [Hydra::AccessControls::Permission.new({:name=> \"public\", :type=>\"group\", :access=>\"read\"}), Hydra::AccessControls::Permission.new({:name=>\"admin\", :type=> \"group\", :access => \"edit\"})]\r\ntopcol.depositor = user\r\ntopcol.save!\r\ntopcol_id = topcol.id.to_s\r\nputs \"topcol.id was \" +topcol.id\r\nmappings_string = toppid + \",\" + + topcol.title[0].to_s + \",\" + topcol_id \r\n\ttopmapping.push(mappings_string) \r\n# write to file as permanent mapping that we can use when mapping theses against collections \r\n# open(\"/vagrant/files_to_test/col_mapping.txt\", \"a+\")do |mapfile|\r\nopen(mapping_file, \"a+\")do |mapfile|\r\nmapfile.puts(topmapping)\r\nend\r\n\r\n=begin\r\nnow we need to read from the list which I will create, splitting into appropriate parts and for each create an id and add it to the top level collection\r\n=end\r\n# hardcode second level file, but could pass in as param\r\n# csv_text = File.read(\"/vagrant/files_to_test/thesescollectionsLevel2SMALL.txt\")\r\nlevel2file = mapping_path + \"UGpaperCollsLevel2.txt\"\r\ncsv_text = File.read(level2file)\r\n# csv_text = File.read(\"/vagrant/files_to_test/thesescollectionsLevel2.txt\")\r\ncsv = CSV.parse(csv_text)\r\n# we also need a file we can write to, as a permanent mapping\r\nmappings_level2 = []\r\n\r\nputs \"starting second level(subjects)\"\r\ncsv.each do |line|\r\n puts line[0]\r\n\tcol = Object::Collection.new\r\n\t# col = Dlibhydra::Collection.new\r\n\t#col.title = [line[1]]\r\n\ttitle = line[1]\r\n\ttitle.gsub!(\"&amp;\",\"&\")\r\n\tcol.title = [title]\r\n\tcol.former_id = [line[0].strip]\r\n\tcol = populate_collection(line[0].strip, col, foxpath)\r\n\tcol.permissions = [Hydra::AccessControls::Permission.new({:name=> \"york\", :type=>\"group\", :access=>\"read\"}), Hydra::AccessControls::Permission.new({:name=>\"admin\", :type=> \"group\", :access => \"edit\"})]\r\n\tcol.depositor = user\r\n\tcol.save!\r\n\tcol_id = col.id.to_s\r\n\tputs \"subject col id was\" + col_id\r\n\ttopcol.members << col\r\n\ttopcol.save!\r\n\tmappings_string = line[0] + \",\" + + line[1] + \",\" + col_id \r\n\tmappings_level2.push(mappings_string)\r\n\t# add to hash, old pid as key, new id as value\r\n\tkey = line[0]\t\r\n\tidmap[key] = col.id\r\nend\r\n\r\n# write to file as permanent mapping that we can use when mapping theses against collections\r\nopen(mapping_file, \"a+\")do |mapfile| \r\n# open(\"/vagrant/files_to_test/col_mapping.txt\", \"a+\")do |mapfile|\r\n\tmapfile.puts(mappings_level2)\r\nend\r\n\r\n# but we still have our mappings array, so now use this to make third level collections\r\n\r\nsleep 5 # wait 5 seconds before moving on to allow 2nd level collections some time to index before the level3s start trying to find them\r\n\r\n# read in third level file\r\nmappings_level3 = []\r\n# csv_text3 = File.read(\"/vagrant/files_to_test/thesescollectionsLevel3SMALL.txt\")\r\nlevel3collsfile = mapping_path + \"UGpaperCollsLevel3.txt\"\r\ncsv_text3 = File.read(level3collsfile)\r\n# csv_text3 = File.read(\"/vagrant/files_to_test/thesescollectionsLevel3.txt\")\r\ncsv_level3 = CSV.parse(csv_text3)\r\n\r\nyearpidcount = 1\r\nputs \"starting third level (years)\"\r\ncsv_level3.each do |line|\r\nyearpidcount = yearpidcount +1\r\n puts \"starting number \" +yearpidcount.to_s+ \" in list\"\r\n puts line[0]\r\n\tyear_col = Object::Collection.new\r\n\tputs \"started new year collection\"\r\n\t# col = Dlibhydra::Collection.new extend cc collection instead\r\n\tyear_col_title = line[1].to_s \r\n\tyear_col_title.gsub!(\"&amp;\", \"&\")\r\n\tputs \"got level 3 title which was \" + year_col_title\r\n\tyear_col.title = [year_col_title] #just in case\r\n\tyear_col.former_id = [line[0].strip]\r\n\tyear_col = populate_collection(line[0].strip, year_col, foxpath)\r\n\tyear_col.permissions = [Hydra::AccessControls::Permission.new({:name=> \"york\", :type=>\"group\", :access=>\"read\"}), Hydra::AccessControls::Permission.new({:name=>\"admin\", :type=> \"group\", :access => \"edit\"})]\r\n\tyear_col.depositor = user\r\n\tputs \"saved permissions and depositor for year collection\"\r\n\tyear_col.save!\r\n\tputs \"saved collection\"\r\n\tyear_col_id = year_col.id.to_s\r\n\tputs \"year col id was \" + year_col_id\r\n\t# need to find the right parent collection here\t\r\n\tparent_pid = line[2]# old parent pid, key to find new parent id\r\n\tputs \" subject col pid was \" + parent_pid\r\n\tmapped_parent_id = idmap[parent_pid]\t\r\n\tputs \"mapped parent id was \" + mapped_parent_id\r\n\tparent = Object::Collection.find(mapped_parent_id)\r\n\tparent.members << year_col\r\n\tputs \"parent id was\" + parent.id.to_s\r\n\tputs \"year collection id was\" + year_col.id.to_s\r\n\tparent.save!\r\n\tputs \"parent.members were\" + parent.members.to_s\r\n\tmappings_string = line[0] + \",\" + + line[1] + \",\" + year_col_id \r\n\tmappings_level3.push(mappings_string)\r\nend\r\n\r\n# and write to permanent mapping file - these can be all the same whether level 2 or 3 or 1\r\nopen(mapping_file, \"a+\")do |mapfile|\r\n\tmapfile.puts(mappings_level3)\r\nend\r\n\r\nputs \"done\"\r\n=begin\r\ninformation we need for each collection is the old pid as a key, plus its parent pid, plus the collection name and the new id once it is created\r\ntop level will be the top level theses ie current Masters Dissertations (york:18179). \r\nsecond level is discipline eg Archaeology, Education etc\r\nOPTIONAL third level is year eg 1973. Not all disciplines have this level\r\n=end\r\nend", "def create_output(descriptions)\n# render view which will create actual mail report\n body = DcApplicationController.new.render_to_string(\n :template => 'models/dump_models',\n :locals => { descriptions: descriptions },\n :layout => 'models' \n ) \n File.open(Rails.root.join('public','models_dump.html'),'w') {|f| f.write(body)}\n#\n body = ''\n descriptions.each do |description|\n collection = description.first\n all_fields = description.last \n body << \"#\\n# == Schema information\\n#\\n\"\n body << \"# Collection name: #{collection['id']} : #{collection['description']}\\n#\\n\"\n \n all_fields.each do |field|\n body << \"# #{field['field'].ljust(20)} #{field['type'].to_s.ljust(20)} #{field['description']}\\n\"\n end\n body << \"\\n\\n\"\n end \n File.open(Rails.root.join('public','description_dump.html'),'w') {|f| f.write(body)}\nend", "def mongodump_options\n options = String.new\n options += \" --username='#{user}' \" unless user.blank?\n options += \" --password='#{password}' \" unless password.blank?\n options += \" --host='#{host}' \" unless host.blank?\n options += \" --port='#{port}' \" unless port.blank?\n options += \" --db='#{database}' \" unless database.blank?\n options\n end", "def mongoize(object)\n case object\n when Array then MongoizedLine.new(object).mongoize\n else object\n end\n end", "def pretty_print_nds(nds)\n # Change the code below to pretty print the nds with pp\n require 'pp'\n pp directors_database\n \nend", "def index\n @products = Product.all\n # @product = Product.where(:created_at.lte => Date.today).group_by {|d| d.created_at.strftime(\"%d-%m-%y\")}\n respond_to do |format|\n @products_bson1 = []\n @products_bson2 = []\n @products.each do |pro|\n @products_bson = BSON::Document.new(pro.attributes)\n @products_bson1.push(@products_bson)\n @products_bson2 = @products_bson1.to_bson\n format.html # index.html.erb\n format.bson { render json: @products_bson2 }\n format.json { render json: @products }\n format.xml { render xml: @products }\n end\n end\nend", "def from_mongo(docs)\n\n rekey(docs) { |k| k.gsub(/^ⸯ\\$/, '$').gsub(/˛/, '.') }\n end", "def export_to_collection(matched_crime)\n doc_to_export = []\n matched_crime.each do |document|\n doc_to_export = document\n end\n result = export.insert_one(doc_to_export)\n puts \"Zapisano w kolekcji crime_export\"\nend", "def generate_class\n code = \"require 'mongoid'\" + \"\\n\"\n code = code + 'class ' + @doc['name'].downcase.capitalize + \"\\n\"\n code += \"\\tinclude Mongoid::Document\\n\"\n @doc['fields'].each{ |field|\n code = code + \"\\tfield :\" + field[\"name\"]+( translate_type(field[\"type\"]).to_s != \"\" ? \",type: \" + translate_type(field[\"type\"]) : \"\") + \"\\n\"\n }\n code += 'end'\n return code\n end", "def mongo_load_all search_results=search_all(), json_class_mapper=JSON_CLASS_MAPPER\n search_results.each_with_index do |data_set,i|\n puts \"#{i}: #{data_set}\"\n puts data_set[\"type\"]\n mm_class=( json_class_mapper[data_set[\"type\"]].to_sym or json_class_mapper[data_set[:type]])\n puts \"mm_class=#{mm_class}\"\n #puts \"data set type=#{data_set[:type]}\"\n puts \"class =#{mm_class}\"\n query=make_query data_set\n puts \"query= #{query}\"\n #query= {:case_n=>\"RS-SV-05-16335\", :cd_type=>\"CD8\", :tile=>\"CT4\"}\n if mm_class.where(query).all.empty?\n mm_object=mm_class.create data_set\n puts \"mm created #{mm_object}\"\n else\n # upserts if entry pre-existing\n mm_class.set(query, data_set, :upsert => true )\n puts \"uspsert created #{mm_object}\"\n mm_object=mm_class.where(data_set).find_one\n end\n #binding.pry\n mm_object.get_cd\n mm_object.save\n \n end\n puts \"\\n\\n\\n\"\n puts \"finished uploading to databes\"\nend", "def render_sql_template(range)\n data = {players: make_players(range)}\n template = Erubis::Eruby.new(File.read(\"merge_template.sql\")).result(data)\n File.open('generated/team_merge.sql', 'w') do |file|\n file.write(template)\n end\n return data\nend", "def import\n raise \"Could not find #{@opts.exec} in your PATH\" unless system(\"which #{opts.exec} > /dev/null\")\n\n file = File.join(@path, \"#{@name}.json\")\n cmd = \"#{opts.exec} --host #{opts.host} --port #{opts.port} --drop --db #{opts.db} --collection #{opts.collection} #{file}\"\n `#{cmd}`\n end", "def pretty_print_nds(nds)\n # Change the code below to pretty print the nds with pp\n require \"pp\"\n pp directors_database\nend", "def pretty_print_nds(nds)\n # Change the code below to pretty print the nds with pp\n require 'pp'\n p directors_database\nend", "def psql_db_dump_replacer_batch_generator__from psql_db_dump_replacer\n\n psql_db_dump_replacer = array__from psql_db_dump_replacer\n\n psql_db,\n db_dumps__backup_desired_path,\n db_dumps__to_be_applied,\n psql_dump_apply_options,\n psql_db__get_dumps_to_be_applied,\n reserved = psql_db_dump_replacer\n\n psql_db = array__from psql_db\n db_dumps__backup_desired_path = array__from db_dumps__backup_desired_path\n db_dumps__to_be_applied = array__from db_dumps__to_be_applied\n psql_db__src_dumps_to_be_applied = array__from psql_db__get_dumps_to_be_applied\n\n batch_generators = [\n psql_db__get_dumps_to_be_applied.nne && [\n :psql_db_batch__cli_or_generate_dumps,\n psql_db__src_dumps_to_be_applied,\n db_dumps__to_be_applied,\n \"\",\n ],\n [\n :psql_db_batch__cli_or_generate_dumps,\n psql_db,\n db_dumps__backup_desired_path,\n \"\",\n ],\n [\n :psql_db_batch__db_queries_method,\n psql_db,\n :db_queries__drop_owned_current_user,\n ],\n [\n :psql_db_batch__cli_or_apply_dumps,\n psql_db,\n db_dumps__to_be_applied,\n psql_dump_apply_options,\n ],\n ].compact\n\n batch_generators.map {|batch_generator|\n batch__from_batch_generator batch_generator\n }.flatten 1\n end", "def populatemongonetwork\n \n db = Mongo::Connection.new(\"localhost\", 27017).db(\"networks\")\n \n #coll = db.collection(\"masterNetwork\")\n \n Network.where(\"degree=1\").find_each(:batch_size => 5000) do |network| \n coll = db.collection(network['facebook_id'])\n #doc = {\"_id\"=> User.find_by_facebook_id(network['friend_id']).id, \"d\"=>network['degree']}\n doc = {\"_id\"=> network['friend_id'], \"d\"=>network['degree']}\n coll.insert(doc) \n end\n \nend", "def mongoize\n \"#{format('%04d', year)}-#{format('%02d', month)}-#{format('%02d', day)}\"\n end", "def utils_construct_json(mongocursor)\n str = '['\n mongocursor.each do |res|\n str += '%s' % res.to_json\n if mongocursor.has_next?\n str += ', '\n end\n end\n\n return str + ']'\nend", "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 collect_document(input, output)\r\n inputs=input.map{|xx| xx.esc.to_osPath }.join(\" \") # qoute cond combine the inputs\r\n\r\n #now combine the input files\r\n @log.info(\"combining the input files\")\r\n cmd=\"pandoc -s -S -o #{output} --ascii #{inputs}\" # note that inputs is already quoted\r\n system(cmd)\r\n if $?.success? then\r\n PandocBeautifier.new().beautify(output)\r\n end\r\n end", "def mongoize\n { name: name, quote: quote, image_url: image_url }\n end", "def build_docs\n object_map.each do |index, objects|\n objects.each do |object|\n template_context = {\n #:meta => Site\n index => object\n }\n content = converter.render(template_map[index], template_context)\n filename = converter.filename_for(object)\n write_output_file(filename, content)\n end\n end\n end", "def mongoize\n {:name=>@name, :place=>@place}\n end", "def pretty_print_nds(nds)\n # Change the code below to pretty print the nds with pp\n #nil\n require 'pp'\n pp directors_database\n puts directors_database\nend", "def dump(schemas, output_filename)\n\n # Redirect output to output_filename (or use stdout)\n\n if output_filename then\n begin\n $stdout = File.open(output_filename, 'w');\n rescue => ex\n $stderr.puts \"Error: output file: #{ex.message}\"\n exit 1\n end\n end\n\n # Dump schemas\n\n schemas.each do |s|\n puts \"#---\"\n puts s.to_dump()\n puts\n end\n\n # Close output\n\n if output_filename then\n $stdout.close\n end\n\nend", "def to_pipeline\n pipeline = []\n pipeline.push({ \"$skip\" => skip }) if skip\n pipeline.push({ \"$limit\" => limit }) if limit\n pipeline.push({ \"$sort\" => sort }) if sort\n pipeline\n end", "def pretty_print_nds(nds)\n # Change the code below to pretty print the nds with pp\n pp directors_database\nend", "def pretty_print_nds(nds)\n # Change the code below to pretty print the nds with pp\n pp directors_database\nend", "def pretty_print_nds(nds)\n # Change the code below to pretty print the nds with pp\n pp directors_database\nend", "def pretty_print_nds(nds)\n # Change the code below to pretty print the nds with pp\n pp directors_database\nend", "def pretty_print_nds(nds)\n # Change the code below to pretty print the nds with pp\n pp directors_database\nend", "def pretty_print_nds(nds)\n # Change the code below to pretty print the nds with pp\n pp directors_database\nend", "def to_mongo(doc)\n\n # vertical tilde and ogonek to the rescue\n\n rekey(doc) { |k| k.to_s.gsub(/^\\$/, 'ⸯ$').gsub(/\\./, '˛') }\n end", "def bulk_generate\n\n end", "def pretty_print_nds(nds)\n pp directors_database\nend", "def import(cnf)\n #\n # Connect to databases\n #\n begin\n $dbh_pg = DBI.connect(\n \"dbi:Pg:#{cnf[:from_db_name]}:\",\n cnf[:from_db_user],\n cnf[:from_db_password]\n )\n rescue\n STDERR.puts \"### Error in #{__FILE__} on line #{__LINE__}. See errorlog.\"\n Log.write_log(:error, \"Could not connect to database. Message: #{$!}\\ncnf:#{cnf.inspect}\")\n exit\n end\n begin\n $dbh_ms = DBI.connect(\n \"dbi:Mysql:#{cnf[:to_db_name]}:\",\n cnf[:to_db_user],\n cnf[:to_db_password]\n )\n rescue\n STDERR.puts \"### Error in #{__FILE__} on line #{__LINE__}. See errorlog.\"\n Log.write_log(:error, \"Could not connect to database. Message: #{$!}\")\n exit\n end\n $dbh_ms.do(\"SET sql_mode='TRADITIONAL,ANSI'\")\n $dbh_ms.do(\"SET NAMES 'utf8'\")\n \n $reaktor_insert_count = 0\n $import_log = 'import'\n $debug = cnf[:debug]\n \n #\n # Initialize plugins\n #\n ArtworkDataPlugin::set_data_path(cnf[:path_data])\n \n #\n # Drop id_store table if it exists\n #\n begin\n sth = $dbh_pg.execute(\"SELECT relname FROM pg_class WHERE relname = 'id_store'\")\n rescue\n $stderr.puts \"### Error in #{__FILE__} on line #{__LINE__}. See errorlog\"\n Log.write_log('error', \"Could not process query. Message: #{$!} query: #{get_query_string(sth)}.\")\n raise\n exit\n end\n relname = sth.fetch\n \n if relname\n begin\n sth = $dbh_pg.execute(%Q{DROP TABLE id_store})\n rescue\n $stderr.puts \"### Error in #{__FILE__} on line #{__LINE__}. See errorlog\"\n Log.write_log('error', \"Could not process query. Message: #{$!} query: #{get_query_string(sth)}.\")\n raise\n exit\n end\n STDERR.puts \"Dropped id_store table from prototype.\"\n end\n \n #\n # Load the schema map\n #\n require 'schema_map'\n \n #\n # Process tables\n #\n $schema.each do |t|\n process_table(t)\n end\n \n #\n # Write reports\n #\n ArtworkDataPlugin.flush_logs\n ArtworkDataPlugin.write_report\n \n ArtworkTopicTaggingPlugin::flush_logs\n ArtworkTopicTaggingPlugin::write_report\n \n ArtworkInternalDiscussionPlugin::flush_logs\n ArtworkInternalDiscussionPlugin::write_report\n \n ReaktoruserArtworkgroupsPlugin::flush_logs\n ReaktoruserArtworkgroupsPlugin::write_report\nend", "def table_import(op)\n op.banner << \"\\nsupported formats:\\n\"\n op.banner << \" apache\\n\"\n op.banner << \" syslog\\n\"\n op.banner << \" msgpack\\n\"\n op.banner << \" json\\n\"\n\n format = 'apache'\n time_key = 'time'\n auto_create = false\n\n op.on('--format FORMAT', \"file format (default: #{format})\") {|s|\n format = s\n }\n\n op.on('--apache', \"same as --format apache; apache common log format\") {\n format = 'apache'\n }\n\n op.on('--syslog', \"same as --format syslog; syslog\") {\n format = 'syslog'\n }\n\n op.on('--msgpack', \"same as --format msgpack; msgpack stream format\") {\n format = 'msgpack'\n }\n\n op.on('--json', \"same as --format json; LF-separated json format\") {\n format = 'json'\n }\n\n op.on('-t', '--time-key COL_NAME', \"time key name for json and msgpack format (e.g. 'created_at')\") {|s|\n time_key = s\n }\n\n op.on('--auto-create-table', \"Create table and database if doesn't exist\", TrueClass) { |b|\n auto_create = b\n }\n\n db_name, table_name, *paths = op.cmd_parse\n\n client = get_client\n\n if auto_create\n # Merge with db_create and table_create after refactoring\n API.validate_database_name(db_name)\n begin\n client.create_database(db_name)\n $stderr.puts \"Database '#{db_name}' is created.\"\n rescue AlreadyExistsError\n end\n\n API.validate_table_name(table_name)\n begin\n client.create_log_table(db_name, table_name)\n $stderr.puts \"Table '#{db_name}.#{table_name}' is created.\"\n rescue AlreadyExistsError\n end\n end\n\n case format\n when 'json', 'msgpack'\n #unless time_key\n # $stderr.puts \"-t, --time-key COL_NAME (e.g. '-t created_at') parameter is required for #{format} format\"\n # exit 1\n #end\n if format == 'json'\n require 'json'\n require 'time'\n parser = JsonParser.new(time_key)\n else\n parser = MessagePackParser.new(time_key)\n end\n\n else\n regexp, names, time_format = IMPORT_TEMPLATES[format]\n if !regexp || !names || !time_format\n $stderr.puts \"Unknown format '#{format}'\"\n exit 1\n end\n parser = TextParser.new(names, regexp, time_format)\n end\n\n get_table(client, db_name, table_name)\n\n require 'zlib'\n\n files = paths.map {|path|\n if path == '-'\n $stdin\n elsif path =~ /\\.gz$/\n require 'td/compat_gzip_reader'\n Zlib::GzipReader.open(path)\n else\n File.open(path)\n end\n }\n\n require 'msgpack'\n require 'tempfile'\n #require 'thread'\n\n files.zip(paths).each {|file,path|\n import_log_file(file, path, client, db_name, table_name, parser)\n }\n\n puts \"done.\"\n end", "def mongoize(options = {})\n create_new_record(options)\n runtime = Benchmark.measure{ yield }.real if block_given?\n rescue Exception => e\n add(3, e.message + \"\\n\" + e.backtrace.join(\"\\n\"))\n # Re-raise the exception for anyone else who cares\n raise e\n ensure\n # In case of exception, make sure runtime is set\n @mongo_record[:runtime] = ((runtime ||= 0) * 1000).ceil\n begin\n @insert_block.call\n rescue\n # do extra work to inpect (and flatten)\n force_serialize @mongo_record\n @insert_block.call rescue nil\n end\n end", "def pretty_print_nds(nds)\n # Change the code below to pretty print the nds with pp\n nds = directors_database()\n pp(nds)\nend", "def setup\n @compare_count = 200\n\n prepare_test_results_dir DocumentComparerTest\n\n @documents = []\n @manager = NGramsManager.new\n @comparer = DocumentComparer.new @manager\n\n #@src = SheetSource.new '../../data/EKG_opis.ods', header = 1\n\n @mongo_client = MongoClient.new\n @collection = @mongo_client.db('text_mining').collection('documents')\n @src = IO::MongoSource.new @collection, :body\n\n doc_id = 1\n while doc_id < @src.count - 1 and doc_id < @@how_many_in_test\n begin\n doc = @src.next\n puts 'DocumentID: ' + doc_id.to_s + '/' + @src.count.to_s if doc_id % 10 == 0\n\n if doc.nil?\n puts 'Empty document!'\n next\n else\n document = Document.new doc\n end\n\n @documents << document\n @first_doc = document if doc_id == 1\n @second_doc = document if doc_id == 2\n\n @manager.add document\n rescue\n end\n\n doc_id += 1\n end\n end", "def to_bson\n end", "def dbvalidationmul(table_name)\nmongo_client = Mongo::Client.new($mongo_connect_string)\n@list=mongo_client[:\"#{table_name}\"].find.to_a\n# mongo collections have fields called \"_id\" which is not returned by api response\n# deleting the \"_id\" field from mongo response to map api response\n@list.each do |l|\nl.delete(\"_id\")\nend\nputs \"===========================================\"\nputs @list\nputs \"===========================================\"\nreturn @list\nend", "def dofile(file,output)\r\n # we are using the fact that the path will be given by \\ in command line, so / is added by ruby\r\n filename=file[file.index(\"/\")+1..file.size]\r\n output.puts \"*** START: [\"+filename+\"] ***\\n\"\r\n IO.foreach(file) do |line|\r\n output.puts line.lstrip if (line=~/^\\s*import\\s+/ or line=~/from\\s+\\w+\\s+import\\s+/) and not (line=~/^\\s*#/)\r\n output.puts \"! Dynamic import !\\n\" if line=~/__import__/\r\n end\r\n output.puts \"*** END: [\"+filename+\"] ***\\n\"\r\nend", "def setup\n @last_import_data = { string_field: \"import four\", integer_field: 4, extra_field: \" extra\" }\n end", "def pretty_print_nds(nds)\n pp directors_database\nend", "def pretty_print_nds(nds)\n pp directors_database\nend", "def to_inserts(args={})\n args[:table] ||= Pathname.new(@filename).basename.to_s.downcase.gsub(/\\W/, '_')\n args[:before] ||= @@defaults[:before]\n args[:after] ||= @@defaults[:after]\n insert_sql = args[:ignore] ? 'insert ignore' : 'insert'\n if args[:bulk]\n args[:before] += \"#{insert_sql} into #{args[:table]} values\"\n args[:values_glue] ||= \", \"\n args[:row_format] ||= \" (%s)\"\n args[:row_glue] ||= \",\\n\"\n else\n args[:before] ||= \"\"\n args[:values_glue] ||= \", \"\n args[:row_format] ||= \"#{insert_sql} into #{args[:table]} values(%s)\"\n args[:row_glue] ||= \";\\n\"\n end\n to_any args\n end", "def pretty_print_nds(nds)\n # Change the code below to pretty print the nds with pp\n pp directors_database\n nil\nend", "def pretty_print_nds(nds)\n # Change the code below to pretty print the nds with pp\n pp directors_database\n nil\nend", "def source opts={}\n opts[:host] ||= \"localhost\"\n opts[:port] ||= 27017\n self.db = Mongo::Connection.new(opts[:host], opts[:port]).db(\"extraextra\")\n self.collection = db[\"extras\"]\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 publish_document(document)\n schema = config.get(:schema)\n paths = config.get(:paths)\n file = \"#{paths[:output]}/#{schema[:name].downcase}\"\n puts \"\\n>> #{file}\"\n # puts document\n File.write(\"#{file}.rb\", document)\n end", "def merge_mongo_and_solr(collection, resp)\n\t\t\tsolr_objects = resp['response']['docs']\n\t\t\tmkey,skey = @mongo_match_by.split(\"::\")\n collection.each_with_index do |document,index|\n\t\t\t\tmid = document.fetch(\"#{mkey}\")\n sdoc = solr_objects.find {|sd| sd[\"#{skey}\"] == \"#{mid}\"}\n for pkey in @mongo_projection_keys.split(\",\")\n if document.has_key?(\"#{pkey}\")\n sdoc[\"#{pkey}\"] = document.fetch(\"#{pkey}\")\n end\n end\n end\n\t\t\tresp['response']['docs'] = solr_objects\n\t\t\treturn resp\n\t\tend", "def perform\n tmp_mongo_dir = \"mongodump-#{Time.now.strftime(\"%Y%m%d%H%M%S\")}\"\n tmp_dump_dir = File.join(tmp_path, tmp_mongo_dir)\n\n case self.backup_method.to_sym\n when :mongodump\n #this is the default options \n # PROS:\n # * non-locking\n # * much smaller archive sizes\n # * can specifically target different databases or collections to dump\n # * de-fragements the datastore\n # * don't need to run under sudo\n # * simple logic\n # CONS:\n # * a bit longer to restore as you have to do an import\n # * does not include indexes or other meta data\n log system_messages[:mongo_dump]\n exit 1 unless run \"#{mongodump} #{mongodump_options} #{collections_to_include} -o #{tmp_dump_dir} #{additional_options} > /dev/null 2>&1\"\n when :disk_copy\n #this is a bit more complicated AND potentially a lot riskier: \n # PROS:\n # * byte level copy, so it includes all the indexes, meta data, etc\n # * fast recovery; you just copy the files into place and startup mongo\n # CONS:\n # * locks the database, so ONLY use against a slave instance\n # * copies everything; cannot specify a collection or a database\n # * will probably need to run under sudo as the mongodb db_path file is probably under a different owner. \n # If you do run under sudo, you will probably need to run rake RAILS_ENV=... if you aren't already\n # * the logic is a bit brittle... \n log system_messages[:mongo_copy]\n\n cmd = \"#{mongo} #{mongo_disk_copy_options} --quiet --eval 'printjson(db.isMaster());' admin\"\n output = JSON.parse(run(cmd, :exit_on_failure => true))\n if output['ismaster']\n puts \"You cannot run in disk_copy mode against a master instance. This mode will lock the database. Please use :mongodump instead.\"\n exit 1\n end\n \n begin\n cmd = \"#{mongo} #{mongo_disk_copy_options} --quiet --eval 'db.runCommand({fsync : 1, lock : 1}); printjson(db.runCommand({getCmdLineOpts:1}));' admin\"\n output = JSON.parse(run(cmd, :exit_on_failure => true))\n\n #lets go find the dbpath. it is either going to be in the argv just returned OR we are going to have to parse through the mongo config file\n cmd = \"mongo --quiet --eval 'printjson(db.runCommand({getCmdLineOpts:1}));' admin\"\n output = JSON.parse(run(cmd, :exit_on_failure => true))\n #see if --dbpath was passed in\n db_path = output['argv'][output['argv'].index('--dbpath') + 1] if output['argv'].index('--dbpath') \n #see if --config is passed in, and if so, lets parse it\n db_path ||= $1 if output['argv'].index('--config') && File.read(output['argv'][output['argv'].index('--config') + 1]) =~ /dbpath\\s*=\\s*([^\\s]*)/ \n db_path ||= \"/data/db/\" #mongo's default path\n run \"cp -rp #{db_path} #{tmp_dump_dir}\" \n ensure\n #attempting to unlock\n cmd = \"#{mongo} #{mongo_disk_copy_options} --quiet --eval 'printjson(db.currentOp());' admin\"\n output = JSON.parse(run(cmd, :exit_on_failure => true))\n (output['fsyncLock'] || 1).to_i.times do\n run \"#{mongo} #{mongo_disk_copy_options} --quiet --eval 'db.$cmd.sys.unlock.findOne();' admin\"\n end\n end\n else\n puts \"you did not enter a valid backup_method option. Your choices are: #{BACKUP_METHOD_OPTIONS.join(', ')}\"\n exit 1\n end \n \n log system_messages[:compressing]\n run \"tar -cz -C #{tmp_path} -f #{File.join(tmp_path, compressed_file)} #{tmp_mongo_dir}\"\n end", "def dump_to_file(options = {})\r\n options.reverse_merge!(:bulk => false)\r\n bulk_mode = options[:bulk]\r\n version = Time.now.utc.stamp\r\n file_name = \"#{version}_#{bulk_mode ? BULK_FILENAME_ID : INCREMENT_FILENAME_ID}.yml\"\r\n records = []\r\n\r\n # require 'ruby-debug'\r\n # debugger\r\n\r\n conditions = 'text <> \"dnr\"' # Don't dump out records marked Do Not Resuscitate\r\n conditions << \" AND to_dump\" unless bulk_mode\r\n records = model.find(:all, :conditions => conditions).map {|r| r.attributes}\r\n records.each do |r|\r\n %w(id type facet item_id namespace obsolete table_name from_bundle to_dump).each {|field| r.delete(field)}\r\n end\r\n\r\n if records.empty?\r\n @report << \"No records found, no sense in creating a file\\n\"\r\n return nil, 0\r\n end\r\n\r\n write_file(File.join(translation_base, file_name), records.ya2yaml)\r\n if bulk_mode\r\n model.update_all(['to_dump = ?', false])\r\n #no sence in loading our own bundle later.\r\n #but this is only for bulks because partials are downloaded from site and might not make it to SVN\r\n TranslationBundle.create!(:version => version, :bulk => true)\r\n end\r\n\r\n record_n = records.size \r\n puts \"\\tDumped #{record_n} records into file #{file_name}\"\r\n\r\n if options[:svn]\r\n a = `svn add #{File.join(translation_base, file_name)}`\r\n puts a =~ /^A/ ? \"Added #{file_name} to svn\" : \"Error adding #{file_name} to svn:\\n\\t#{a}\"\r\n end\r\n\r\n return file_name, record_n\r\n end", "def generate(output_io)\n output_hash = {}\n\n model_hash = {}\n tables = @mysql_client.query(\"show tables\")\n tables.each do |tbl|\n tbl.each_value do |tbl_name|\n\n # filter\n unless @limit_tables.nil?\n unless @limit_tables.include? tbl_name\n next\n end\n end\n\n tbl_hash = {}\n\n # fields\n tbl_hash[:fields] = generate_table_fields(tbl_name)\n\n model_hash[tbl_name] = tbl_hash\n end\n end\n output_hash[:models] = model_hash\n\n output_io << output_hash.deep_stringify_keys.to_yaml\n end", "def OLDview_data db, sql, options\n outputfile = options[:output_to]\n formatting = options[:formatting]\n headers = options[:headers]\n #str = db.get_data sql\n rs = db.execute_query sql\n str = rs.content\n columns = rs.columns\n #puts \"SQL: #{sql}.\\nstr: #{str.size}\"\n data = []\n if headers\n data << columns.join(\"\\t\")\n end\n str.each {|line| data << line.join(\"\\t\"); }\n #puts \"Rows: #{data.size}\"\n require 'tempfile'\n tmpfile = Tempfile.new('SQL.XXXXXX')\n filename = tmpfile.path\n filename = Shellwords.escape(filename)\n #puts \"Writing to #{filename}\"\n tmpfile.write(data.join(\"\\n\"))\n tmpfile.close # need to flush, otherwise write is buffered\n headerstr=nil\n if formatting\n headerstr = \"-H\" unless headers\n # sometimes this can be slow, and it can fault on UTF-8 chars\n system(\"cat #{filename} | term-table.rb #{headerstr} | sponge #{filename}\")\n end\n if outputfile\n #puts \"comes here\"\n system(\"cp #{filename} #{outputfile}\")\n filename = outputfile\n end\n system \"wc -l #{filename}\" if $opt_debug\n \n #system \"$EDITOR #{filename}\"\n system \"vim -c ':set nowrap' #{filename}\"\n tmpfile.close\n tmpfile.unlink\nend", "def import()\n # TODO\n end", "def import_show \n end", "def wiki_page_scrap_and_save_to_mongo\n page_infos = wiki_page_scrap\n\n #PUT THE COLLECTED TEXT INTO A MONGO_DB\n mongo = get_mongo\n collection = mongo[$mongo_wiki_scrap_collection_name]\n\n #REMOVE OLD CACHE DATA\n collection.remove\n #PUT NEW SCRAP DATA TO MONGO\n collection.insert page_infos\nend", "def setup\n db = CouchRest.database!(\"http://127.0.0.1:5984/couchdb_test\")\n\n (1..@num_packs).each do |num_pack|\n elems = []\n (1..@num_items).each do |num_item|\n elems << { :name => Faker::Name.name, :tags => random_tags(), :created_at => Time.now() }\n end\n\n response = db.bulk_save(elems)\n puts response\n end\n\n end", "def mongoize\n return if values.blank?\n values.map { |value| value.mongoize }\n end", "def generate_fixture_json(collection:)\n json = JSON.parse(File.read(Rails.root.join(\"spec\", \"fixtures\", \"json_ingest.json\")), symbolize_names: true)\n json[:records][0][:path] = Rails.root.join(\"spec\", \"fixtures\", \"bulk_ingest\", \"991234563506421\", \"vol1\").to_s\n json[:records][1][:path] = Rails.root.join(\"spec\", \"fixtures\", \"bulk_ingest\", \"991234563506421\", \"vol2\").to_s\n json[:records][0][:member_of_collection_ids] = [collection.id.to_s]\n json[:records][1][:member_of_collection_ids] = [collection.id.to_s]\n file = Tempfile.new([\"ingest_test\", \".json\"])\n file.puts(json.to_json)\n file.rewind\n file\n end", "def pretty_print_nds(nds)\n # Change the code below to pretty print the nds with pp\n#nil =>这个是原来存在的,要把这个改了\n pp nds\n #这边也可以是pp directors_database,因为数据在那个DB里面\nend", "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 fetch_and_import!(opts={})\n eve_table = opts[:eve_table]\n dest_table = opts[:dest_table]\n mapping = opts[:mapping]\n dbh = opts[:conn] || @dbh\n comment_label = opts[:label]\n \n # Fetch Data from crpActivities Table\n results = dbh.query(\"SELECT * FROM \"+eve_table)\n # Clear Destination Table to eliminate Redundancy\n dest_table.camelize.constantize.delete_all\n # Do some Meta programming FU magic\n results.each do |row|\n insert_map = {}\n mapping.each do |key,value|\n insert_map[key.to_sym] = row[value]\n end \n dest_table.camelize.constantize.create!(insert_map)\n # Just so you see something when running this script..\n p \"Creating Record for #{dest_table} : \" + row[comment_label].to_s\n end\nend", "def run(limit, offset)\n timestamp = Time.now.utc.iso8601.gsub(/\\W/, '')\n @log = File.open(\"import_#{timestamp}.log\", 'w')\n create_indexes\n load_institutions\n import_objects(limit, offset)\n import_work_items(limit, offset)\n @log.close\n end", "def model_fields(collection)\n records = []\n model = collection.classify.constantize\n document = model.new\n# p document.methods\n document.attribute_names.each do |attribute_name|\n options = model.fields[attribute_name].options\n description = I18n.t(\"helpers.help.#{collection}.#{attribute_name}\")\n description = I18n.t(\"helpers.label.#{collection}.#{attribute_name}\") if description.match('missing:')\n description = attribute_name if description.match('missing:')\n\n records.push( {'collection' => collection, \n 'field' => attribute_name, \n 'type' => options[:type],\n 'description' => description, \n '_default' => options[:default]\n } )\n end\n# embedded documents\n document.embedded_relations.each do |a_embedded|\n embedded = a_embedded.last\n description = I18n.t(\"helpers.help.#{collection}.#{embedded.key}\")\n description = I18n.t(\"helpers.label.#{collection}.#{embedded.key}\") if description.match('missing:')\n description = embedded.key if description.match('missing:')\n\n records.push( {'collection' => collection, \n 'field' => embedded.key, \n 'type' => 'Embedded:' + embedded.class_name,\n 'description' => description\n } )\n end\n#p records\n records\nend", "def mongoize(object_id)\n object_id\n end", "def mongoize(object_id)\n object_id\n end", "def db_prefix\n /mongo_/\n end", "def import_templates\n # Use destination account ID\n @api.account_id = @options[:dst]\n\n puts \"\\n\"\n # Import each ServerTemplate and store the new location\n @server_templates.keys.each do |server_template|\n # Grab ID number from /api/server_templates/:id\n id = @server_templates[server_template]['publication_url'].split('/').last\n response = @api.publications(:id => id).import\n\n puts \"Importing: \\\"#{response.show.name}\\\" to account: #{@options[:dst]}\"\n\n @server_templates[server_template]['new_st_url'] = response.show.href\n end\nend", "def print_b2json(io)\n while not io.eof? do\n bsonobj = BSON.read_bson_document(io)\n Yajl::Encoder.encode(bsonobj, STDOUT)\n STDOUT << \"\\n\"\n end\nend", "def generate(options)\n title = options[:title]\n # leader_names = options[:leader_names]\n column_names = options[:column_names]\n # headings = options[:headings]\n # follower_names = options[:follower_names]\n # headings = options[:headings]\n filename = options[:sql][:filename]\n # header = options[:sql][:header]\n\n @transforms = options[:transforms]\n @converter = options[:converter]\n\n\n max_size = -1\n column_names.each { |cn| max_size = cn.size if cn.size > max_size }\n\n sql_file = File.open(filename.to_s, 'w')\n\n sql_file.puts <<~EOS\n -- ==============================================================\n -- == File: #{filename}\n\n DROP TABLE IF EXISTS #{title.variablize('snake_case')};\n\n CREATE TABLE \"public\".\"#{title.variablize('snake_case')}\" (\n EOS\n\n if add_column? :id\n sql_file.puts %Q[ \"id\" INTEGER DEFAULT nextval('#{title.variablize('snake_case')}_id_seq'::regclass) NOT NULL UNIQUE,]\n end\n\n if add_column? :unique_id\n sql_file.puts %Q[ \"unique_id\" CHARACTER VARYING( 255 ) COLLATE \"pg_catalog\".\"default\",]\n end\n\n sql_file.puts '--'\n column_names.each do |col_name|\n spaces = \" \" * (max_size - col_name.size + 2)\n sql_file.print %Q' \"#{col_name}\" ' + spaces + get_type(col_name)\n # SMELL: must we always mod the source when new additional columns are added after spreadsheet?\n # TODO: need to have some kind of before and after feature for the added columns.\n if !(col_name == column_names.last) ||\n add_column?(:report_date) ||\n add_column?(:created_at) ||\n add_column?(:updated_at)\n sql_file.puts ','\n else\n sql_file.puts\n end\n end\n sql_file.puts '--'\n\n # SNELL: the last column name does not get a comma; but don't know which is last\n\n if add_column? :report_date\n sql_file.print '\"report_date\" Date'\n if add_column?(:created_at) || add_column?(:updated_at)\n sql_file.puts \",\"\n else\n sql_file.puts\n end\n end\n\n\n if add_column? :created_at\n sql_file.print '\"created_at\" Date'\n if add_column?(:updated_at)\n sql_file.puts \",\"\n else\n sql_file.puts\n end\n end\n\n\n if add_column? :updated_at\n sql_file.puts '\"updated_at\" Date'\n end\n\n if add_column? :id\n sql_file.puts ' PRIMARY KEY ( \"id\" )'\n end\n\n sql_file.print \");\\n\\n\"\n\n sql_file.close\n\n\nap @@add_columns if verbose? || debug?\n\n\n end", "def generate_populate_folder\n empty_directory 'db/populate'\n # copy_file \"template_filename\", \"final_directory\" # With this we will copy the file straigh from tempaltes folder to the final destination\n # template \"template_filename\", \"final_directory\" # With this we can pass arguments to the template\n # if option_name ...\n end", "def format_data\n\t\n\t\n\tr = Rserve::Connection.new\n\tr.eval(\"file_path='/home/ruby/appdata/R1/'\")\n\tr.void_eval <<-EOF\n\n\tlibrary(xml2, warn.conflicts = FALSE)\n\tsuppressMessages(library(foreach, warn.conflicts = FALSE))\n\tsuppressMessages(library(doSNOW, warn.conflicts = FALSE))\n\tlibrary(plyr, warn.conflicts = FALSE)\n\tsuppressMessages(library(data.table, warn.conflicts = FALSE))\n\tlibrary(dtplyr, warn.conflicts = FALSE)\n\tlibrary(dplyr, warn.conflicts = FALSE)\n\tlibrary(purrr, warn.conflicts = FALSE)\n\tlibrary(stringr, warn.conflicts = FALSE)\n\tlibrary(pipeR, warn.conflicts = FALSE)\n\tlibrary(rlist, warn.conflicts = FALSE)\n\tlibrary(tidyr)\n\t \n\tdat <- fread(paste(file_path,\"input/input.csv\",sep=\"\"))\n\tdat$統計日期 <- dat$統計日期 %>>% as.Date\n\tdat %>>% group_by(課別名稱,統計日期,商品類別名稱,卡友分群類別名稱) %>>%\n\t summarise(全館消費金額=sum(全館消費金額)) %>>% ungroup %>>%\n\t write.csv(paste(file_path,\"output/output.csv\",sep=\"\"))\n\tEOF\n # r.eval(\"file_path\").to_ruby\n\n end", "def dbDumptoCsv(req,res)\n qs = req.query[\"select\"].split(\",\")\n @dbout = []\n qs.each do |q|\n @dbout = @dbout + @db.all(:url => q)\n end\n \n # Open the output csv file\n @oFile = File.new(\"#{$root_dir}/\" + $config.get_value('burpdotcsv'), 'w')\n \n @dbout.each do |entry|\n @oFile.syswrite(entry.ref + \",\" + entry.url + \"\\n\") if entry.ref.length > 0\n end\n \n @oFile.close\n end", "def fetch_scenarios\n collection = connect_to_mongo\n scenarios = {}\n collection.find.each { |doc| scenarios.merge!(doc) }\n scenarios.delete('_id')\n scenarios\nend", "def cmd_db_import(*args)\n\t\t\treturn unless active?\n\t\t\tif (args.include?(\"-h\") or not (args and args.length > 0))\n\t\t\t\tprint_error(\"Usage: db_import <filename> [file2...]\")\n\t\t\t\tprint_line\n\t\t\t\tprint_line(\"filenames can be globs like *.xml, or **/*.xml which will search recursively\")\n\t\t\t\treturn\n\t\t\tend\n\t\t\targs.each { |glob|\n\t\t\t\tfiles = Dir.glob(File.expand_path(glob))\n\t\t\t\tif files.empty?\n\t\t\t\t\tprint_error(\"No such file #{glob}\")\n\t\t\t\t\tnext\n\t\t\t\tend\n\t\t\t\tfiles.each { |filename|\n\t\t\t\t\tif (not File.readable?(filename))\n\t\t\t\t\t\tprint_error(\"Could not read file #{filename}\")\n\t\t\t\t\t\tnext\n\t\t\t\t\tend\n\t\t\t\t\tbegin\n\t\t\t\t\t\tframework.db.import_file(:filename => filename) do |type,data|\n\t\t\t\t\t\t\tcase type\n\t\t\t\t\t\t\twhen :filetype\n\t\t\t\t\t\t\t\tprint_status(\"Importing '#{data}' data\")\n\t\t\t\t\t\t\twhen :address\n\t\t\t\t\t\t\t\tprint_status(\"Importing host #{data}\")\n\t\t\t\t\t\t\twhen :msfx_loot\n\t\t\t\t\t\t\t\tprint_status(\"Importing loot #{data}\")\n\t\t\t\t\t\t\twhen :msfx_task\n\t\t\t\t\t\t\t\tprint_status(\"Importing task #{data}\")\n\t\t\t\t\t\t\twhen :msft_report\n\t\t\t\t\t\t\t\tprint_status(\"Importing report #{data}\")\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\t\tprint_status(\"Successfully imported #{filename}\")\n\t\t\t\t\trescue DBImportError\n\t\t\t\t\t\tprint_error(\"Failed to import #{filename}: #{$!}\")\n\t\t\t\t\t\telog(\"Failed to import #{filename}: #{$!.class}: #{$!}\")\n\t\t\t\t\t\tdlog(\"Call stack: #{$@.join(\"\\n\")}\", LEV_3)\n\t\t\t\t\t\tnext\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\t}\n\t\tend", "def process_expert_tags_and_save_to_mongo\n wiki_pages = get_scrapped_data_from_mongo\n expert_tag_regex = /<!--\\s*Expert\\s*\\|\\s*(.+)\\s*\\|\\s*(-?\\d+\\.\\d+|-?\\d+)\\s*-->/\n\n # Learn to translate page title to page id\n title_id_hash = {}\n wiki_pages.find.each do |wiki_page|\n title = wiki_page[\"title\"].downcase.gsub(\"_\", \" \")\n title_id_hash[title] = wiki_page[\"_id\"]\n end\n\n # prepare db connection to push data to\n db = get_mongo\n expert_tags_correlations_col = db[$mongo_expert_tags_correlation]\n expert_tags_correlations_col.remove\n\n wiki_pages.find.each do |wiki_page|\n correlations = []\n scan = wiki_page[\"text\"].scan expert_tag_regex\n\n if scan.size>0\n scan.each do |match|\n other_page_title = match[0].downcase.gsub(\"_\", \" \")\n correlation = match[1].to_f\n other_page_id = title_id_hash[other_page_title]\n correlations.push({p: other_page_id, v: correlation}) if other_page_id\n end\n end\n expert_tags_correlations_col.insert({_id:wiki_page[\"_id\"], correlations: correlations})\n end\nend", "def docImportHTML\n sourceDir = Pathname.new pathExports\n destDir = Pathname.new pathDocuments\n \n # Process and copy pages to dest dir.\n n = 0\n docPages().each do |page|\n n = n + 1\n \n sourceFile = sourceDir + pageOriginalFile(page) + \"index.html\"\n destPath = destDir + pageTargetFile(page)\n destFile = destPath + \"index.html\"\n \n puts \"Importing File #{n.to_s}: #{sourceFile} #{destFile}\"\n puts \" \"\n \n destPath.mkpath()\n html = File.open(sourceFile, \"rb\") { |f| f.read }\n html = htmlUpdateLinks(html)\n html = htmlStripTOC(html)\n html = htmlReplaceSyntaxHighlighterTags(html)\n html = htmlReplaceTabsWithSpaces(html)\n html = htmlPrettify(html)\n fileSaveContent(destFile, html)\n end\nend" ]
[ "0.6315777", "0.63128984", "0.5856705", "0.5833997", "0.58271456", "0.5749272", "0.57312155", "0.57312155", "0.57279426", "0.57042867", "0.56055635", "0.55968404", "0.5592614", "0.5576067", "0.5353074", "0.53505224", "0.52975154", "0.5268689", "0.52558255", "0.525003", "0.52494526", "0.5218831", "0.5174848", "0.51630086", "0.5158635", "0.5137461", "0.51118577", "0.51029", "0.50894743", "0.5085964", "0.50498676", "0.50436443", "0.50341934", "0.50199217", "0.50180745", "0.49912912", "0.49845228", "0.49749714", "0.4964055", "0.49621972", "0.4957857", "0.4954765", "0.4952551", "0.49490166", "0.49297094", "0.49087265", "0.4908526", "0.49071023", "0.49071023", "0.49071023", "0.49071023", "0.49071023", "0.49066496", "0.48642927", "0.485028", "0.4845065", "0.4832042", "0.47960085", "0.4792814", "0.4784428", "0.4777164", "0.47713", "0.47698122", "0.4767072", "0.47629204", "0.47629204", "0.47462645", "0.47421685", "0.47421685", "0.47381112", "0.47180662", "0.47158283", "0.47073966", "0.47049305", "0.47037193", "0.47021112", "0.47019392", "0.46983045", "0.4673374", "0.46733424", "0.46718317", "0.46690366", "0.4665048", "0.46546605", "0.46466982", "0.46451867", "0.464335", "0.4642297", "0.46412683", "0.46412683", "0.46385252", "0.4628891", "0.46278542", "0.46153027", "0.46077466", "0.45981926", "0.45957857", "0.45949185", "0.45902455", "0.45862758", "0.45812875" ]
0.0
-1
each "number" card scores as its value
def score_numbers(cards_numbers) cards_numbers.sum { |card| card.value.to_i } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def score\n @cards.map(&:value).inject(:+)\n end", "def possible_scores\n card_values.inject([0]) do |memo, item|\n if ace_value?(item)\n added_one = memo.map { |score| score + 1 }\n added_one << (added_one.last + 10)\n else\n memo.map { |number| number + item.first }\n end\n end\n end", "def card_scores\n card_scores = {\n \"JOKER\" => 13, \"J♠\" => 12, \"J♣\" => 11, \"A♠\" => 10, \"K♠\" => 9, \"Q♠\" => 8,\n \"10♠\" => 7, \"9♠\" => 6, \"8♠\" => 5, \"7♠\" => 4, \"6♠\" => 3, \"5♠\" => 2\n }\n card_scores.default = 0\n\n card_scores\n end", "def get_score (cards)\n\t\tscore = 0\n\t\tcards.each do |card|\n\t\t\tmeasure = card[0]\n\t\t\tscore += @score[measure]\n\t\tend\n\t\tscore\n\tend", "def scores\n return Game.score(self.card_numbers self.user_id), Game.score(self.card_numbers nil)\n end", "def value \r\n value = 0\r\n @cards.each do |card|\r\n value += card.value\r\n end\r\n if value > 21\r\n value = 0\r\n @cards.each do |card|\r\n if card.value == 11\r\n value += 1\r\n else\r\n value += card.value\r\n end\r\n end\r\n end\r\n value\r\n end", "def score\n dealt.inject(0){|sum,card| sum + card.value}\n end", "def calculate_score(values)\n total = 0\n values.each do |card|\n total += card\n if total > 21 && card == 11\n total -= 10\n end\n end\n total\n end", "def possible_scores(cards)\n scores = [0]\n\n cards.each do |card|\n if card.face != 'Ace'\n scores.map! {|score| score + card.value} \n else\n new_scores = Array.new\n scores.each do |score|\n new_scores << score + 1\n new_scores << score + 11\n end\n scores = new_scores\n end\n end\n\n return scores.uniq.select {|score| score < 22}\nend", "def card_value(cards_value, cards)\n cards_value = 0\n players_cards_length = cards.length\n players_cards_info = cards[0 .. cards.length]\n cards.each {|y, x| cards_value = cards_value + x }\n return cards_value\n end", "def score\n score = 0\n aces_count = 0\n @hand_contents.each do |card|\n if card.type == :face\n score += 10\n elsif card.type == :ace\n aces_count += 1\n score += 11\n elsif card.type == :number\n score += card.rank.to_i\n end\n end\n\n while score > 21 && aces_count > 0\n score -= 10\n aces_count -= 1\n end\n score\n end", "def card_values\n @cards.map(&:value)\n end", "def score(cards)\n\nend", "def cards_to_score(cards)\n \n total = 0\n cards_num = []\n\n cards.each { |card| cards_num.push(card % 13) }\n\n cards_num.sort.reverse.each do |num|\n if num >= 9 #9, 10, 11, 12 means 10, J, Q, K\n total = total + 10\n elsif num > 0 #which means 2, 3, 4, 5, 6, 7, 8, 9\n total = total + num + 1\n end\n end\n\n a_count = cards_num.count(0)\n\n total = total + a_count\n\n a_count.times do\n total = total + 10 if total <= 11\n end\n\n return total\nend", "def value\n card_value = @rank\n if @rank == :A\n card_value = 11\n elsif @rank == :K || @rank == :Q || @rank == :J\n card_value = 10\n end\n card_value\n end", "def score\n return 0 unless valid?\n 100 * card_value_decimal * 15 ** 5\n end", "def hand_score\n cards.map {|a| a.value}.sort {|a,b| a <=> b}.last\n end", "def total_score\n total = 0\n @cards.each do |card|\n total += card.value\n end\n\n sorted_cards = @cards.sort\n\n straights = get_straight(sorted_cards).reverse\n straights.each do |straight|\n total += 40\n sorted_cards.slice!(straight[0]..straight[1])\n end\n\n three_cards = get_number_of_a_kind(sorted_cards, 3)\n three_cards.each do |three|\n total += 20\n sorted_cards.slice!(three[0]..three[1])\n end\n\n pairs = get_number_of_a_kind(sorted_cards, 2)\n pairs.each do |pair|\n total += 10\n sorted_cards.slice!(pair[0]..pair[1])\n end\n\n total\n end", "def get_multiples(number)\n cards = []\n\n @cards_by_score.each_key do |card|\n if @card_scores.count(card.score) == number\n cards << card\n end\n end\n\n cards\n\n end", "def hand_value(cards)\n value = 0\n val_arr = []\n cards.each do |sub_array|\n val_arr << sub_array.last\n val_arr.sort!\n end\n val_arr.each do |val|\n if val == 11 && value > 10\n value = value + 1 \n else\n value = value + val\n end\n end\n return value\nend", "def getValue(card_number)\n # get card rank\n rank = case card_number % 13\n when 0, 11, 12 then 10\n when 1 then 11\n else card_number % 13 \n end\n \n return rank\n \nend", "def value()\n sum = 0\n # Partition the array by string and integer then reverse to put aces at back\n @cards.partition{|x| x.is_a? String}.map(&:sort).flatten.reverse_each do |i|\n if [\"Q\", \"J\", \"K\"].include?(i)\n sum += 10\n elsif i == \"A\"\n if sum + 11 > 21\n sum += 1\n else\n sum += 11\n end\n else \n sum += i\n end\n end \n return sum\n end", "def our_values\n result = []\n \n @cards.each do |card|\n result << card.value\n end\n \n result\n end", "def score\n # make a local array that will disappear when not in this method\n tally = []\n # for each of the cards in the hand, add their score to the tally from points\n @hand.each do |card|\n tally.push(@points[card])\n end\n # return the tally of the scores\n return tally.sum\nend", "def game_value(cards)\n sum = 0\n cards.each do |card|\n sum += card.game_value\n end\n sum\nend", "def values\n cards.map(&:value).sort\n end", "def values\n hand = @hand.dup\n\n # Strip away cards' suits\n hand = hand.gsub(/(S|H|D|C)/, '')\n\n # Replace ace through ten cards with their numerical values\n hand = hand.gsub(/[AKQJT]/, 'A'=>'14', 'K'=>'13', 'Q'=>'12', 'J'=>'11', 'T'=>'10')\n\n # Return an array of integer values\n hand.split.map(&:to_i)\n end", "def calculate_score(hand_of_cards)\n card_values = hand_of_cards.map{|card_value| card_value[1]}\n total = 0 \n card_values.each do |card_value| \n if card_value == \"ACE\"\n total+= 11\n elsif card_value.to_i == 0 #For suits ie Jester, Queen\n total+= 10\n else \n total+= card_value.to_i\n end\n end \n\n#adjust for Aces\n card_values.select{|card| card == \"ACE\"}.count.times do \n total-=10 if total > 21\n end \n total\nend", "def card_value_determiner(card)\n string_nums = (2..10).to_a.map { |i| i.to_s}\n if string_nums.include?(card.face)\n card.value = card.face.to_i\n elsif card.face == 'Ace'\n card.value == 11\n else\n card.value = 10\n end\nend", "def score\n suit_score = [\n Suit.spades,\n Suit.clubs,\n Suit.diamonds,\n Suit.hearts,\n Suit.none\n ].index(suit) * 20 + 40\n\n (number - 6) * 100 + suit_score\n end", "def values\n keys = CARD::SYMBOLS\n i = 2\n keys.each do |key|\n @card_vals[key] = i\n i+=1\n end\n end", "def cards_by_score\n scores = {}\n\n @cards.each do |card|\n scores[card] = card.score\n end\n\n Hash[scores.sort_by { |card, score| -score }]\n\n end", "def score(card)\n case card\n when :ace then 11 # assigns value to each symbol, helps with scoring\n when :king then 10\n when :queen then 10\n when :jack then 10\n else card\n end\nend", "def value_of_hand(array_of_cards)\n faces = {\"A\" =>11,\n \"2\" => 2, \n \"3\" => 3,\n \"4\" => 4,\n \"5\" => 5,\n \"6\" => 6,\n \"7\" => 7,\n \"8\" => 8,\n \"9\" => 9,\n \"10\" => 10,\n \"J\" => 10,\n \"Q\" => 10,\n \"K\" => 10\n }\n total_value = 0\n num_aces = 0\n array_of_cards.each do |c|\n #cards are in string format, e.g. \"J of diamonds\"\n face = c.split[0]\n value = faces[face]\n total_value += value\n num_aces += 1 if face == \"A\"\n end\n #correct for Aces -- BORROWED THIS LOGIC FROM TEACHER'S CODE\n num_aces.times do\n total_value -= 10 if total_value > 21\n end\n return total_value\nend", "def get_hand_score\n score = 0\n \n # Add up score of non-aces\n values = hand.map{|card| card.value}\n values.each do |val|\n if Array(2..10).include?(val.to_i)\n score += val.to_i\n elsif [\"J\", \"Q\", \"K\"].include?(val)\n score += 10\n end\n end\n\n # deal with the aces\n values.count(\"A\").times do\n if score + 11 <= 21\n score += 11\n else\n score += 1\n end\n end\n\n return score\n end", "def score\n @score = [straight_flush, four_of_a_kind, full_house, flush, straight, three_of_a_kind, two_pair, one_pair, high_card]\n end", "def getScoreCard()\n\t#create array A to Z\n\tcard = [*('A'..'Z')]\n\t#convert array to Hash\n\tcard = Hash[card.map.with_index.to_a]\n\t#return hash\n\treturn card\nend", "def score\n p_score = player_hand.collect{|x| x.value}.inject(:+)\n c_score = computer_hand.collect{|x| x.value}.inject(:+)\n puts \"You have #{player_hand.collect{|x| \"#{x.face}#{x.suit}\"}.join(\" & \")}, for a total of #{p_score}\"\n puts \"The computer has #{computer_hand.collect{|x| \"#{x.face}#{x.suit}\"}.join(\" & \")}, for a total of #{c_score}\"\n puts \" \"\n end", "def scores\n @raw.map(&:score)\n end", "def calculate_hand_total_value(hand_array)\n total_value = 0\n is_there_an_ace = false\n\n hand_array.each do |card|\n if card[:rank] === \"A\"\n is_there_an_ace = true\n end\n\n card_value = card[:value]\n total_value += card_value\n\n end\n\n if is_there_an_ace\n return [total_value, total_value + 10]\n\n else\n return [total_value, 999]\n\n end\n\nend", "def scores\n {\n 'a' => 1, 'e' => 1, 'i' => 1, 'o' => 1,\n 'u' => 1, 'l' => 1, 'n' => 1, 'r' => 1,\n 's' => 1, 't' => 1, 'd' => 2, 'g' => 2,\n 'b' => 3, 'c' => 3, 'm' => 3, 'p' => 3,\n 'f' => 4, 'h' => 4, 'v' => 4, 'w' => 4,\n 'y' => 4, 'k' => 5, 'j' => 8, 'x' => 8,\n 'q' => 10, 'z' => 10\n }\nend", "def get_hand_value\n cards.reduce(0) { |hand_value, card| hand_value += card.value }\n end", "def add_card_value(all_sums)\n\t\t@cards.each do |card|\n\t\t\tif card.is_a? (Fixnum)\n\t\t\t\tall_sums[0] << card\n\t\t\telsif is_ace?(card) \n\t\t\t\tall_sums[0] << 1\n\t\t\telse\n\t\t\t\tall_sums[0] << 10\n\t\t\tend\n\t\tend\n\tend", "def find_value(hand)\n hand.map do |value|\n card_number = value.first\n if card_number == 'K' || card_number == 'J' || card_number == 'Q'\n card_number = 10\n elsif card_number == 1\n card_number = 11\n end\n card_number\n end\n end", "def hand_value (hand)\n hand_value = 0\n hand.each do |card|\n case card.value\n when /[2-9]|[1][0]/ \n hand_value += card.value.to_i \n when /[JQK]/\n hand_value += 10\n when \"A\"\n hand_value += 11\n if hand_value > 21\n hand_value -= 10 \n end \n end\n end\n hand_value\n end", "def single_card_value(card)\n case card[1].strip\n when \"2\"..\"10\" then card[1].to_i\n when \"J\", \"Q\", \"K\" then 10\n when \"A\" then 11\n end\nend", "def value_of_hand(hand)\n collection_of_card_values = hand.collect {|index| index[1]}\n card_values = collection_of_card_values.inject{|sum,next_card| sum + next_card }\n if collection_of_card_values.include?(1) && card_values < 12\n card_values += 10\n end\n card_values\nend", "def high_card\n valueInt = {\"A\" => 14, \"K\"=> 13, \"Q\"=> 12, \"J\"=> 11}\n results=[]\n\n [@hand1Values, @hand2Values].each do |handV|\n maxValue = 0\n handV.each do |h|\n value = valueInt[h] ? valueInt[h] : h\n maxValue = value.to_i if value.to_i > maxValue \n end\n results << maxValue\n end\n\n results\n end", "def __card_value( card )\n\tnumber = card.split( '' )[ 0 ]\n\n\tif 'T' == number\n\t\tnumber = 10\n\telsif 'J' == number\n\t\tnumber = 11\n\telsif 'Q' == number\n\t\tnumber = 12\n\telsif 'K' == number\n\t\tnumber = 13\n\telsif 'A' == number\n\t\tnumber = 14\n\tend\n\n\treturn number\nend", "def determine_score(deck)\n total = 0\n deck.each do |suit|\n suit[1].each do |card|\n total += score(card)\n end\n end\n total\nend", "def total(cards)\n values = cards.map { |card| card[1] } # this map method iterates through each card ([S, V]) and returns the value of the card from the second spot in the individual card array\n\n sum = 0 # initialize the sum variable that will be used to total the card values\n values.each do |value| # iterate through each value\n if value == \"A\" # if the card is an Ace, add 11 to the sum\n sum += 11\n elsif value.to_i == 0 # if the card's value is 0 when converted to an int, that means it is a face card and should be worth 10\n sum += 10\n else\n sum += value.to_i # otherwise, convert the value to an integer and add that to the sum\n end\n end\n\n # adjust aces if sum is greater than 21\n values.select { |value| value == \"A\" }.count.times do # iterate through the card values array, finding the aces.\n sum -= 10 if sum > MAX_VALUE # If the sum is greater than 21, subtract 10 from each ace, making the aces only worth 1\n end\n\n sum # return the sum\nend", "def card_value(card)\n basic_value = card.to_i\n if card.start_with?(\"A\")\n basic_value = 11\n elsif basic_value == 0\n basic_value = 10\n end\n basic_value\n end", "def hand_value(hand)\n sum = 0\n hand.each do |card|\n sum += card\n end\n sum\n end", "def get_hand_value(hand)\n hand_values = hand.map { |card| card[0]} \n \n total = 0\n #check if there are any Aces\n hand_values.each do |value|\n if value == 'A'\n total += 11\n elsif value.to_i == 0 # this is for J, Q, K\n total += 10\n else\n total += value.to_i\n end\n end\n # To accomodate Aces, subtract 10 from the total per Ace if the total is >21\n hand_values.select{|value| value == \"A\"}.count.times do \n total -= 10 if total >21\n end\n total\nend", "def calculate_totals(cards) \n card_values = cards.map{|card| card[1]}\n total_socre = 0\n card_values.each do |value|\n if value == \"Ace\"\n total_socre += 11\n elsif value.to_i == 0\n total_socre += 10\n else\n total_socre += value.to_i\n end\n end\n#correct for Aces\n card_values.select {|e| e == \"Ace\"}.count.times do\n total_socre -= 10 if total_socre > 21\n end\n total_socre\nend", "def scores\n @scores\n end", "def sum_of_cards(hand)\n card_values = hand.map do |card|\n if card[0] == 1\n card[0] = 11\n elsif card[0] >= 11\n card[0] = 10\n else\n card[0]\n end\n end\n sum = 0\n card_values.each do |card|\n sum += card[0]\n end\n sum\n end", "def calculate_total\n #create a new array card_values to just contain the values of the cards\n card_values = cards.map {|value| value[1]}\n total = 0\n\n #loop through these card values. If the value is an Ace, give it 11, if it is J, Q, or K, give it a value of 10. Otherwise just use the face value\n card_values.each do |card|\n if card == 'Ace'\n total += 11\n elsif card.to_i == 0 \n total = total + 10\n else\n total += card.to_i\n end\n end\n\n #count all the Aces we have using the select and count methods. And then go through the loop the number of times Ace is in the array and subtract 10 each time the total value is over 21.\n\n card_values.select {|e| e == \"A\"}.count.times do\n if total > 21\n total -= 10\n end\n end\n @total = total\n end", "def formulate_score()\n @player_score = @player_score.sort!().reverse!().join().to_i()\n p \"#{@players[0].get_name}'s score is #{@player_score}\"\n check_score()\n end", "def value(card)\n suit = card.to_s.split(//).first\n value = card.to_s.delete(suit)\n if value.to_i == 0\n value == \"A\" ? value = 11 : value = 10\n else\n value = value.to_i\n end\n value\nend", "def calculate_total(cards)\n #create a new array card_values to just contain the values of the cards\n card_values = cards.map {|value| value[1]}\n total = 0\n\n #loop through these card values. If the value is an Ace, give it 11, if it is J, Q, or K, give it a value of 10. Otherwise just use the face value\n card_values.each do |card|\n if card == 'Ace'\n total += 11\n elsif card.to_i == 0 \n total = total + 10\n else\n total += card.to_i\n end\n end\n\n #count all the Aces we have using the select and count methods. And then go through the loop the number of times Ace is in the array and subtract 10 each time the total value is over 21.\n\n card_values.select {|e| e == \"A\"}.count.times do\n if total > 21\n total -= 10\n end\n end\n total\n end", "def values\n return [1,11] if ace?\n return [10] if face_card?\n [@identifier]\n end", "def display_score score, rank\r\n\r\n end", "def card_total(player_or_dealer_array)\n value_array = player_or_dealer_array.map { |v| v[1] }\n card_value_counter = 0\n \n value_array.each do |value|\n if value.is_a? Integer\n card_value_counter += value\n elsif value != 'Ace'\n card_value_counter += 10\n else\n card_value_counter += 11\n end\n end\n \n #decided total based on total number of aces. Will keep adjusting ace value to 1 until the toal is 21 or under\n value_array.select { |v| v == 'Ace'}.count.times do\n card_value_counter -= 10 if card_value_counter > 21\n end\n \n card_value_counter\nend", "def score\n [base_score] + kickers\n end", "def hand_value\n\t\tadd_card_value(all_sums = [[]])\n\t\tconvert_aces(all_sums)\n\t\tall_sums.map! do |value_set|\n\t\t\tvalue_set.inject :+\n\t\tend\n\t\treturn_sum(all_sums)\n\tend", "def player1_score\n player_hand.inject(0){|sum,n| sum + n.value }\n end", "def hand_score(hand)\n\tcards= {\"A\"=>4, \"K\"=>3, \"Q\"=>2, \"J\"=>1}\n \tscore = 0\n \thand.each_char { |char| score += cards[char.upcase] }\n \treturn score\nend", "def card_totals(selected_cards)\n total_value = 0\n selected_cards.each do |card|\n card_value = card[0]\n if card_value.to_i > 0\n total_value += card_value.to_i\n elsif ['J', 'Q', 'K'].include?(card_value)\n total_value += 10\n elsif card_value == \"A\" && total_value > 10\n total_value += 1\n elsif card_value == \"A\" && total_value < 10\n total_value += 11\n end\n end\n total_value\nend", "def update_score!(sum_cards, score)\n if sum_cards[:user] > sum_cards[:dealer]\n score[:user] += 1\n elsif sum_cards[:user] < sum_cards[:dealer]\n score[:dealer] += 1\n end\nend", "def calculate_score(user_id)\n Game.score(self.card_numbers user_id)\n end", "def value(hand)\n ace_count = 0\n hand_value = 0\n\n hand.each do |card|\n if card == :ace\n ace_count += 1\n hand_value += 11\n else\n hand_value += card\n end\n end\n\n # flip aces from being worth 11 to being worth 1 until we get <= 21\n # or we run out of aces\n while hand_value > 21 && ace_count > 0\n hand_value -= 10\n ace_count -= 1\n end\n\n hand_value\nend", "def get_score(num)\n return @game[num]\n end", "def game_score(score)\n end", "def calculate_total(cards) #nested array of [['hearts', '3'], ['spades', '4']]\n\t#We want to create methods for extractable, reusable code\n\t#But the object must be in the same form\n\t#you don't have to explicitly indicate \"return\" when you want to render or puts a value, in ruby, the last line is \n\t#returned implicitly.\n\n\tarr = cards.map{|e| e[1] }\n\n\ttotal = 0\n\tarr.each do |value| \n\t\tif value == \"A\"\n\t\t\ttotal += 11\n\t\telsif value.to_i == 0 #if card value has no integer value (equals 0), add 10\n\t\t\ttotal += 10 #in instances of Jack, Queen, or King\n\t\telse\n\t\t\ttotal += value.to_i #if card has an integer value\n\t\tend\n\tend\n#correct for Aces\narr.select{|e| e == \"A\"}.count.times do\n\ttotal -= 10 if total > 21\t\n\tend\n\ttotal\nend", "def formulate_score()\n @player_score = @player_score.sort!().reverse!().join().to_i()\n p \"#{@players_joined[0]}'s score is #{@player_score}\"\n check_score()\n end", "def decode_quiz_scores(scores)\n\n result = Array.new\n\n scores.each do | key, val |\n q_number = val / 100\n ans = val - (100 * q_number)\n result << {question: q_number, answer: ans, value: 1}\n end\n\n result\n end", "def calculate_total hand\n\ttotal=0\n\tarray = hand.map {|e| e[1]}\n\tarray.each do |card|\n\t\t## face card \n\t\tif card == \"10\" || card ==\"J\" || card ==\"K\" || card ==\"Q\"\n\t\t\ttotal +=10\n\t\t## Ace card\t\n\t\telsif card ==\"A\"\n\t\t\ttotal += 11\n\t\telse \n\t\t\ttotal += card.to_i\n\t\tend\n\tend\n\thand.collect {|e| e[1]}.each do |card|\n\t\tif total >21 && card == \"A\"\n\t\t\ttotal -= 10\n\t\tend\n\tend\n\n\treturn total \nend", "def total\n tot = 0\n for card in @cards\n tot += card.value\n end\n if has_ace and tot < 12\n tot2 = tot + 10\n if @stand\n return tot2\n else\n return [ tot, tot2 ]\n end\n else\n return tot\n end\n end", "def total_score\n\t\t0 + score_one.to_i + score_two.to_i + score_three.to_i + score_four.to_i\n\tend", "def scores\n quiz_entries.collect { |qe| qe.score }\n end", "def total (hand, current_total)\n # cards are nested arrays format like this: [\"H\", \"9\"] and [\"S\", \"9\"]\n # can extract out separate array of values only using .map, ignore suits\n string_values = hand.map { |card| card[1] } \n\n string_values.each do |value|\n current_total += get_int_value(value, current_total)\n end\n current_total\nend", "def determine_hand_value(hand)\n value_hand = hand.map do |x|\n if x.include?(\"Ace\")\n x = 11\n elsif [\"K\", \"Q\", \"J\", \"1\"].include?(x[0])\n x = 10\n else\n x = x[0].to_i\n end\n end\n value_hand = value_hand.inject(0) { |result, element| result + element }\n adjust_value_for_aces(hand, value_hand)\nend", "def initialize(cards)\n raise \"Invalid hand size - #{cards.length}\" unless cards.length == 5\n @cards = cards.map {|c| Card.new(c)}.sort\n @by_value = {}\n @by_suit = {}\n @cards.each do |c|\n @by_value[c.value] ||= []\n @by_suit[c.suit] ||= []\n @by_value[c.value] << c\n @by_suit[c.suit] << c\n end\n\n if @cards[4].value+1 == @cards[3].value &&\n @cards[3].value+1 == @cards[2].value &&\n @cards[2].value+1 == @cards[1].value &&\n @cards[1].value+1 == @cards[0].value\n end\n # Is it a straight\n @straight = true\n @cards.reduce do |p,c|\n if p.value != c.value + 1\n @straight = false\n break\n end\n c\n end\n value = [0]\n if @straight # Is it a straight\n value = [500, @cards.first.value]\n end\n # Is it a flush\n if @flush = @by_suit.find {|k,v| v.length == 5}\n if @straight\n value = [900, @cards.first.value]\n else\n value = [600, @cards.first.value]\n end\n end\n if value[0] < 700\n if (a = @by_value.find {|k,v| v.length == 3 }) &&\n (b = @by_value.find {|k,v| v.length == 2 })\n value = [700, a[0], b[0]]\n elsif a = @by_value.find {|k,v| v.length == 4 }\n value = [800, a[0]] # Is it 4 of a kind\n end\n end\n if value[0] < 500 && (a = @by_value.find {|k,v| v.length == 3 })\n value = [400, a[0]] # Is it 3 of a kind\n end\n if value[0] < 400 \n if (a = @by_value.select {|k,v| v.length == 2}).length > 0\n if a.length == 2\n hi,low = a[a.keys.max], a[a.keys.min]\n high = @cards - hi - low\n value = [300,hi.first.value, low.first.value, high.first.value]\n else\n pair = a[a.keys.first]\n high = (@cards - pair).first\n value = [200,pair.first.value, high.value]\n end\n else\n value = [100, @cards.first.value]\n end\n end\n @value = value\n end", "def dealer_score\n dealer_hand.inject(0){|sum,n| sum + n.value }\n end", "def value\n return @value if @value\n\n return @value = 900 if royal_flush?\n return @value = 800 + high_card_bonus if straight_flush?\n return @value = 700 + high_card_bonus if four_of_a_kind?\n return @value = 600 + high_card_bonus if full_house?\n return @value = 500 + high_card_bonus if flush?\n return @value = 400 + high_card_bonus if straight?\n return @value = 300 + high_card_bonus if three_of_a_kind?\n return @value = 200 + high_card_bonus if two_pairs?\n return @value = 100 + high_card_bonus if pair?\n @value = self.cards.map {|card| card.value}.inject(:+)\n end", "def score\n @scoreTotal = @jogadas[0].down_pin + @jogadas[1].down_pin\n end", "def hand_score(string)\n cards = { A: 4, K: 3, Q: 2, J: 1 }\n score = 0\n string.each_char do |char|\n score += cards[char.upcase.to_sym]\n end\n\n score\nend", "def evaluate(hand) \n value = 0\n numerical_value = hand.map { |card| card[0]} \n numerical_value.each do |x| \n if ['K', 'Q', 'J'].include?(x)\n value += 10\n elsif x == 'A'\n value += 11\n else\n value += x.to_i\n end\n end\n \n hand.select {|x| x[0] == 'A'}.count.times do \n if value > 21\n value -= 10\n end\n end\n value\nend", "def score\n @score\n end", "def get_score()\n score = Hash.new(0)\n players.each {|player| score[player.name] = player.score}\n score\n end", "def count_score(array)\n total = 0\n sorted_hand = array.sort_by { |x| value(x) }\n sorted_hand.each do |x|\n if value(x) == 11 && total >= 11\n total += 1\n else\n total += value(x)\n end\n end\n total\nend", "def calculate_total(cards)\n total = 0\n value_of_cards = cards.map{|e| e[1]}\n value_of_cards.each do |value|\n if value == \"A\"\n total += 11\n elsif value.to_i == 0\n total +=10 # handle J, Q, K\n else\n total += value.to_i\n end\n # corrct Ace condition\n if total > 21\n value_of_cards.select{|e| e == \"A\"}.count.times do\n total -= 10\n end\n end\n end\n total\nend", "def value(hand)\n # Sorting hack to get aces at the very end so we count them last\n hand.sort_by { |c| c.to_i != 0 ? c : c[0] - 81 }.reverse().inject(0) do |total,cur|\n if cur.to_i != 0\n total + cur # 2-10 case\n elsif [\"J\",\"Q\",\"K\"].include? cur\n total + 10 # J,Q, or K\n elsif cur == \"A\"\n if (total+11) > 21\n total + 1 # Count ace as 1\n else\n total+11 # Count ace as 11\n end\n end\n end\n end", "def score(dice)\n hash = Hash.new(0)\n score = 0\n dice.each { |key| hash[key] += 1 }\n hash.each do |key, value|\n if key == 1\n score += 100 * (value % 3)\n score += 1000 * (value / 3)\n elsif key == 5\n score += 50 * (value % 3)\n score += 500 * (value / 3)\n else\n score += key * 100 * (value / 3)\n end\n end\n score\nend", "def blackjack_score(hand)\n allowed_cards = %w[ 2 3 4 5 6 7 8 9 10 Jack Queen King Ace ]\n\n# Validate input\n if hand.length > 5\n raise ArgumentError.new(\"Your hand contains more than 5 cards.\")\n end \n\n result = hand.all? {|card| allowed_cards.include?(card)}\n if !result\n raise ArgumentError.new(\"Invalid card value.\")\n end \n\n# Calculate score \n score = 0\n hand.each do |card|\n if card.length <= 2\n points = card.to_i\n score += points\n elsif card.length == 3 \n score += 1\n else \n score += 10 \n end \n end\n\n if score <= 11 && hand.include?(\"Ace\")\n score += 10\n end\n\n# Validate result\n if score > 21\n raise ArgumentError.new(\"#{score} is greater than 21, you lose!\")\n end\n\n return score \nend", "def score\n\t@score = 0\n\tself.to_array.each do |character|\n\t\t#could also be @score = @score + TILE_VALUES[character]\n\t\t@score += TILE_VALUES[character]\nend\n@score \nend", "def score\n @scores[ result.key ]\n end", "def calculate_team_scorecard(game_matchups, scorecard_template)\n team_scorecard = scorecard_template\n #based on game results, increase appropriate wins/losses/ties values\n game_matchups.each do |game_info|\n home_team = game_info[\"home_team\"]\n away_team = game_info[\"away_team\"]\n home_score = game_info[\"home_score\"].to_i\n away_score = game_info[\"away_score\"].to_i\n if home_score > away_score\n #add 1 win to home_team and add 1 loss to away_team\n team_scorecard[home_team][:wins] += 1\n team_scorecard[away_team][:losses] += 1\n elsif home_score < away_score\n #add 1 win to away_team and add 1 loss to home_team\n team_scorecard[home_team][:losses] += 1\n team_scorecard[away_team][:wins] += 1\n else\n #add 1 tie to both home_team and away_team\n team_scorecard[home_team][:ties] += 1\n team_scorecard[away_team][:ties] += 1\n end\n end\n team_scorecard.to_a\nend", "def calculate_team_scorecard(game_matchups, scorecard_template)\n team_scorecard = scorecard_template\n #based on game results, increase appropriate wins/losses/ties values\n game_matchups.each do |game_info|\n home_team = game_info[\"home_team\"]\n away_team = game_info[\"away_team\"]\n home_score = game_info[\"home_score\"].to_i\n away_score = game_info[\"away_score\"].to_i\n if home_score > away_score\n #add 1 win to home_team and add 1 loss to away_team\n team_scorecard[home_team][:wins] += 1\n team_scorecard[away_team][:losses] += 1\n elsif home_score < away_score\n #add 1 win to away_team and add 1 loss to home_team\n team_scorecard[home_team][:losses] += 1\n team_scorecard[away_team][:wins] += 1\n else\n #add 1 tie to both home_team and away_team\n team_scorecard[home_team][:ties] += 1\n team_scorecard[away_team][:ties] += 1\n end\n end\n team_scorecard.to_a\nend" ]
[ "0.76956964", "0.75683993", "0.7422125", "0.7393633", "0.726646", "0.71756077", "0.70987636", "0.709381", "0.7031035", "0.7025631", "0.70127255", "0.6932173", "0.69259346", "0.6896456", "0.6887969", "0.6864512", "0.68408483", "0.6835614", "0.6831197", "0.6813478", "0.67920417", "0.67790294", "0.67772824", "0.6750763", "0.6742076", "0.6741357", "0.6695736", "0.6692919", "0.66768205", "0.66257036", "0.6619575", "0.66132474", "0.65930593", "0.6580841", "0.6562168", "0.6552859", "0.6532733", "0.65238893", "0.650449", "0.64966553", "0.6472723", "0.6460925", "0.6435325", "0.64263", "0.6422125", "0.64124805", "0.64072585", "0.64062595", "0.63985205", "0.6396556", "0.639303", "0.636321", "0.6332013", "0.63309723", "0.6325514", "0.63247216", "0.63235253", "0.62889117", "0.6287", "0.6285432", "0.6266603", "0.6261049", "0.6251667", "0.62387764", "0.6211361", "0.62092835", "0.61947465", "0.6176055", "0.61727965", "0.6162615", "0.61423355", "0.61280864", "0.61247617", "0.6107125", "0.60899705", "0.6085973", "0.608557", "0.60845727", "0.6074872", "0.60743415", "0.6070941", "0.6067851", "0.60650545", "0.60610163", "0.60558856", "0.6049073", "0.6037262", "0.6031013", "0.6029906", "0.60235775", "0.6013996", "0.59964645", "0.5995475", "0.59858966", "0.5967813", "0.5963636", "0.5962963", "0.5961875", "0.5957953", "0.5957953" ]
0.7665152
1
each "picture" card scores as 10
def score_pictures(cards_pictures) cards_pictures.count * 10 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def score(cards)\n\nend", "def score\n score = 0\n aces_count = 0\n @hand_contents.each do |card|\n if card.type == :face\n score += 10\n elsif card.type == :ace\n aces_count += 1\n score += 11\n elsif card.type == :number\n score += card.rank.to_i\n end\n end\n\n while score > 21 && aces_count > 0\n score -= 10\n aces_count -= 1\n end\n score\n end", "def card_scores\n card_scores = {\n \"JOKER\" => 13, \"J♠\" => 12, \"J♣\" => 11, \"A♠\" => 10, \"K♠\" => 9, \"Q♠\" => 8,\n \"10♠\" => 7, \"9♠\" => 6, \"8♠\" => 5, \"7♠\" => 4, \"6♠\" => 3, \"5♠\" => 2\n }\n card_scores.default = 0\n\n card_scores\n end", "def score\n @cards.map(&:value).inject(:+)\n end", "def get_score (cards)\n\t\tscore = 0\n\t\tcards.each do |card|\n\t\t\tmeasure = card[0]\n\t\t\tscore += @score[measure]\n\t\tend\n\t\tscore\n\tend", "def total_score\n total = 0\n @cards.each do |card|\n total += card.value\n end\n\n sorted_cards = @cards.sort\n\n straights = get_straight(sorted_cards).reverse\n straights.each do |straight|\n total += 40\n sorted_cards.slice!(straight[0]..straight[1])\n end\n\n three_cards = get_number_of_a_kind(sorted_cards, 3)\n three_cards.each do |three|\n total += 20\n sorted_cards.slice!(three[0]..three[1])\n end\n\n pairs = get_number_of_a_kind(sorted_cards, 2)\n pairs.each do |pair|\n total += 10\n sorted_cards.slice!(pair[0]..pair[1])\n end\n\n total\n end", "def possible_scores\n card_values.inject([0]) do |memo, item|\n if ace_value?(item)\n added_one = memo.map { |score| score + 1 }\n added_one << (added_one.last + 10)\n else\n memo.map { |number| number + item.first }\n end\n end\n end", "def cards_to_score(cards)\n \n total = 0\n cards_num = []\n\n cards.each { |card| cards_num.push(card % 13) }\n\n cards_num.sort.reverse.each do |num|\n if num >= 9 #9, 10, 11, 12 means 10, J, Q, K\n total = total + 10\n elsif num > 0 #which means 2, 3, 4, 5, 6, 7, 8, 9\n total = total + num + 1\n end\n end\n\n a_count = cards_num.count(0)\n\n total = total + a_count\n\n a_count.times do\n total = total + 10 if total <= 11\n end\n\n return total\nend", "def scores\n return Game.score(self.card_numbers self.user_id), Game.score(self.card_numbers nil)\n end", "def displayScore()\n puts \"#{name} has #{@hand.length} cards in their deck\"\n end", "def score_numbers(cards_numbers)\n cards_numbers.sum { |card| card.value.to_i }\n end", "def get_multiples(number)\n cards = []\n\n @cards_by_score.each_key do |card|\n if @card_scores.count(card.score) == number\n cards << card\n end\n end\n\n cards\n\n end", "def possible_scores(cards)\n scores = [0]\n\n cards.each do |card|\n if card.face != 'Ace'\n scores.map! {|score| score + card.value} \n else\n new_scores = Array.new\n scores.each do |score|\n new_scores << score + 1\n new_scores << score + 11\n end\n scores = new_scores\n end\n end\n\n return scores.uniq.select {|score| score < 22}\nend", "def hand_score\n cards.map {|a| a.value}.sort {|a,b| a <=> b}.last\n end", "def score\n return 0 unless valid?\n 100 * card_value_decimal * 15 ** 5\n end", "def cards_by_score\n scores = {}\n\n @cards.each do |card|\n scores[card] = card.score\n end\n\n Hash[scores.sort_by { |card, score| -score }]\n\n end", "def calculate_score(values)\n total = 0\n values.each do |card|\n total += card\n if total > 21 && card == 11\n total -= 10\n end\n end\n total\n end", "def score\n # make a local array that will disappear when not in this method\n tally = []\n # for each of the cards in the hand, add their score to the tally from points\n @hand.each do |card|\n tally.push(@points[card])\n end\n # return the tally of the scores\n return tally.sum\nend", "def create_scores\n\tscores = [100]\n\tuntil scores.length >= 8\n\t\tif(scores.length < 5)\n\t\t leader_board(scores)\n\t\tend\n\t\tscores << (100 - 10*scores.length)\n\tend\n\tleader_board(scores)\n\treturn scores\n end", "def score\n (0..9).each do |row|\n if is_strike?(@frame)\n @score += 10 + strike_bonus(@frame)\n @frame += 1\n elsif (is_spare?(@frame))\n @score += 10 + spare_bonus(@frame)\n @frame += 2\n else\n @score += sum(@frame)\n @frame += 2\n end\n end\n return @score\n end", "def score\n @score = [straight_flush, four_of_a_kind, full_house, flush, straight, three_of_a_kind, two_pair, one_pair, high_card]\n end", "def create_scores\r\n scores = Array.new\r\n score = 100\r\n until scores.length == 8\r\n scores << score\r\n score -= 10\r\n if scores.length <= 5\r\n leader_board scores\r\n end\r\n end\r\n scores\r\n end", "def score\n suit_score = [\n Suit.spades,\n Suit.clubs,\n Suit.diamonds,\n Suit.hearts,\n Suit.none\n ].index(suit) * 20 + 40\n\n (number - 6) * 100 + suit_score\n end", "def display_scores\n score_frames, total_values = {}, []\n total_score = total_frames_score.last\n total_frames_score.pop\n total_frames_score.each_with_index do |value, index|\n score_frames[\"frame#{index+1}\"] = value\n end\n score_frames[\"total_score\"] = total_score\n score_frames[\"created_at\"] = Time.now.strftime(\"%d-%m-%Y %I:%M%p\")\n total_values << score_frames if score_frames.present?\n end", "def calculate_team_scorecard(game_matchups, scorecard_template)\n team_scorecard = scorecard_template\n #based on game results, increase appropriate wins/losses/ties values\n game_matchups.each do |game_info|\n home_team = game_info[\"home_team\"]\n away_team = game_info[\"away_team\"]\n home_score = game_info[\"home_score\"].to_i\n away_score = game_info[\"away_score\"].to_i\n if home_score > away_score\n #add 1 win to home_team and add 1 loss to away_team\n team_scorecard[home_team][:wins] += 1\n team_scorecard[away_team][:losses] += 1\n elsif home_score < away_score\n #add 1 win to away_team and add 1 loss to home_team\n team_scorecard[home_team][:losses] += 1\n team_scorecard[away_team][:wins] += 1\n else\n #add 1 tie to both home_team and away_team\n team_scorecard[home_team][:ties] += 1\n team_scorecard[away_team][:ties] += 1\n end\n end\n team_scorecard.to_a\nend", "def calculate_team_scorecard(game_matchups, scorecard_template)\n team_scorecard = scorecard_template\n #based on game results, increase appropriate wins/losses/ties values\n game_matchups.each do |game_info|\n home_team = game_info[\"home_team\"]\n away_team = game_info[\"away_team\"]\n home_score = game_info[\"home_score\"].to_i\n away_score = game_info[\"away_score\"].to_i\n if home_score > away_score\n #add 1 win to home_team and add 1 loss to away_team\n team_scorecard[home_team][:wins] += 1\n team_scorecard[away_team][:losses] += 1\n elsif home_score < away_score\n #add 1 win to away_team and add 1 loss to home_team\n team_scorecard[home_team][:losses] += 1\n team_scorecard[away_team][:wins] += 1\n else\n #add 1 tie to both home_team and away_team\n team_scorecard[home_team][:ties] += 1\n team_scorecard[away_team][:ties] += 1\n end\n end\n team_scorecard.to_a\nend", "def score\n dealt.inject(0){|sum,card| sum + card.value}\n end", "def score\n populate_frames.inject(0) {|a,v| a+ v.frame_total}\n end", "def score(card)\n case card\n when :ace then 11 # assigns value to each symbol, helps with scoring\n when :king then 10\n when :queen then 10\n when :jack then 10\n else card\n end\nend", "def place_cards_to_display\r\n @cards_todisp = []\r\n left_pl1_card = 20 \r\n #top_pl1_card = @canvas_disp.height - (img_card.height + 5)\r\n top_pl1_card = 30\r\n num_img = @cards_img.size - 1\r\n (0..num_img).each do |ix|\r\n img_card = @cards_img[ix]\r\n xoffset = img_card.width + 5\r\n x_fin = left_pl1_card + ix * xoffset\r\n cd = CardGfx.new(self, x_fin, top_pl1_card, img_card, :not_def, 1 )\r\n @cards_todisp << cd\r\n end\r\n end", "def gen_score\n ## Calculate the score here!\n\n total_score = victories + coins/3 + blues + yellows + purples + leaders + blacks\n ## Greens\n greens = [tablets, compasses, gears]\n total_score += (greens.min*7) + greens[0]**2 + greens[1]**2 + greens[2]**2\n self.score = total_score\n end", "def display_score score, rank\r\n\r\n end", "def display_cards(card_array)\n card_images = [[],[],[],[],[]]\n card_array.each do |card|\n card_images.each_index { |index| card_images[index] << make_card_image(card)[index] }\n end\n \n card_images.each do |image_section_of_card|\n puts image_section_of_card.join(\" \")\n end\n end", "def start\n 9.times do |index|\n @score = @score + @frames[index][0].to_i + @frames[index][1].to_i\n @scores[index] = @score\n @score\n end\n @score = @score + @frames[9][0].to_i + @frames[9][1].to_i + @frames[9][2].to_i\n @scores[9] = @score\n end", "def calculate_score(hand_of_cards)\n card_values = hand_of_cards.map{|card_value| card_value[1]}\n total = 0 \n card_values.each do |card_value| \n if card_value == \"ACE\"\n total+= 11\n elsif card_value.to_i == 0 #For suits ie Jester, Queen\n total+= 10\n else \n total+= card_value.to_i\n end\n end \n\n#adjust for Aces\n card_values.select{|card| card == \"ACE\"}.count.times do \n total-=10 if total > 21\n end \n total\nend", "def scorecards\n expose Challenge.scorecards(@oauth_token, params[:challenge_id].strip)\n end", "def score\n p_score = player_hand.collect{|x| x.value}.inject(:+)\n c_score = computer_hand.collect{|x| x.value}.inject(:+)\n puts \"You have #{player_hand.collect{|x| \"#{x.face}#{x.suit}\"}.join(\" & \")}, for a total of #{p_score}\"\n puts \"The computer has #{computer_hand.collect{|x| \"#{x.face}#{x.suit}\"}.join(\" & \")}, for a total of #{c_score}\"\n puts \" \"\n end", "def add_card(aCard)\n @cards << aCard\n @cards.sort!() {|card1, card2| card1.rank <=> card2.rank}\n @rank_histogram[aCard.rank] += 1\n @suit_histogram[aCard.suit] += 1\n @evaluation = nil\n @score = 0\nend", "def score\n 2 * won + drawn + noresult\n end", "def high_ranking_cards\n\n array_high_cards = []\n\n cards.each do |card|\n\n if card.rank >= 11\n array_high_cards << card\n end\n\n end\n\n array_high_cards\n\n end", "def score_game\n self.score = frames.reduce(0) { |sum, frame| sum + score_frame(frame) } \n end", "def game_value(cards)\n sum = 0\n cards.each do |card|\n sum += card.game_value\n end\n sum\nend", "def runner\nwelcome\ncards=initial_round\ncards=hit?(cards)\ndisplay_card_total(cards)\nwhile cards<21\n cards=hit?(cards)\nend\nend_game(cards)\nend", "def percent_high_ranking\n\n count_high = 0\n\n cards.each do |card|\n\n if card.rank >= 11\n count_high += 1\n end\n\n end\n\n\n count_high_f = count_high.to_f\n count_total = cards.length\n count_total_f = count_total.to_f\n\n (100 * (count_high_f/count_total_f)).round(2)\n\n end", "def add_many_score(count, pins)\n count.times do\n @game.add_score(pins)\n end\nend", "def scores\n {\n 'a' => 1, 'e' => 1, 'i' => 1, 'o' => 1,\n 'u' => 1, 'l' => 1, 'n' => 1, 'r' => 1,\n 's' => 1, 't' => 1, 'd' => 2, 'g' => 2,\n 'b' => 3, 'c' => 3, 'm' => 3, 'p' => 3,\n 'f' => 4, 'h' => 4, 'v' => 4, 'w' => 4,\n 'y' => 4, 'k' => 5, 'j' => 8, 'x' => 8,\n 'q' => 10, 'z' => 10\n }\nend", "def get_score(n)\n (1..n).to_a.map { |num| num * 50 }.inject(:+)\nend", "def cards\n\t\t@cards.each do |card|\n\t\t\tputs card.card\n\t\tend\n\tend", "def scoring \n\t\tscore = rand(10)\n\t\tputs \"And the score is #{score}.\"\n\tend", "def formulate_score()\n @player_score = @player_score.sort!().reverse!().join().to_i()\n p \"#{@players[0].get_name}'s score is #{@player_score}\"\n check_score()\n end", "def determine_score(deck)\n total = 0\n deck.each do |suit|\n suit[1].each do |card|\n total += score(card)\n end\n end\n total\nend", "def showPiles\n 3.times { |i| puts i.to_s + \" : \" + $piles[i].count().to_s}\nend", "def scores\n @raw.map(&:score)\n end", "def render_score; end", "def display_quartiles(scores)\r\n\r\n end", "def get_hand_score\n score = 0\n \n # Add up score of non-aces\n values = hand.map{|card| card.value}\n values.each do |val|\n if Array(2..10).include?(val.to_i)\n score += val.to_i\n elsif [\"J\", \"Q\", \"K\"].include?(val)\n score += 10\n end\n end\n\n # deal with the aces\n values.count(\"A\").times do\n if score + 11 <= 21\n score += 11\n else\n score += 1\n end\n end\n\n return score\n end", "def score(for_frames:)\n simple_points(for_frames) + total_bonus(for_frames)\n end", "def show_score\n puts\n @@score.each do |player, score|\n print \"- #{player.capitalize}: #{score} -\"\n end\n puts\n end", "def initialize\n\t\t@cards = (1..52).to_a\n\tend", "def card_value(cards_value, cards)\n cards_value = 0\n players_cards_length = cards.length\n players_cards_info = cards[0 .. cards.length]\n cards.each {|y, x| cards_value = cards_value + x }\n return cards_value\n end", "def printScore\n\t\t\n\t\t# Row with the frame number\n\t\t(1..@lastFrameNumber).each do |f|\n\t\t\tprint \"F\" + f.to_s, \"\\t\"\n\t\tend\n\t\tputs \"\"\n\t\t\n\t\t# Row with the balls rolled\n\t\tindex = 0\n\t\twhile index < @rolls.length\n\t\t\tif @rolls[index] < 10\n\t\t\t\t# In case of spare in the last frame\n\t\t\t\tif index == @rolls.length - 1\n\t\t\t\t\tif @rolls[index] != 10\n\t\t\t\t\t\tprint @rolls[index].to_s, \"\\t\"\n\t\t\t\t\telse\n\t\t\t\t\t\t#In case of strike in the last roll\n\t\t\t\t\t\tprint \"X\\t\"\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tif @rolls[index] + @rolls[index + 1] == 10\n\t\t\t\t\t\tprint @rolls[index].to_s, \"|/\\t\"\n\t\t\t\t\telse\n\t\t\t\t\t\tprint @rolls[index].to_s, \"|\", @rolls[index + 1].to_s, \"\\t\"\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tif index < @rolls.length\n\t\t\t\t\tindex += 2\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tprint \"X\\t\"\n\t\t\t\tindex += 1\n\t\t\tend\n\t\tend\n\t\tputs \"\"\n\t\t\n\t\t#Row with the scores per frame\n\t\t(0...@frameScores.length).each do |f|\n\t\t\tprint @frameScores[f].to_s, \"\\t\"\n\t\tend\n\t\tputs \"\"\n\tend", "def score\n end", "def card_images(card)\n suit = case card[0]\n when \"Clubs\" then 'clubs'\n when \"Diamonds\" then 'diamonds'\n when \"Spades\" then 'spades'\n when \"Hearts\" then 'hearts'\n end\n # Values\n value = card[1]\n if ['J', 'Q', 'K', 'A'].include?(value)\n value = case card[1]\n when \"J\" then 'jack'\n when \"Q\" then 'queen'\n when \"K\" then 'king'\n when \"A\" then 'ace'\n end #ends if\n end #ends value\n \"<img src='/images/cards/#{suit}_#{value}.jpg' class='card_display'>\"\n end", "def score\n [base_score] + kickers\n end", "def high_ranking_cards\n cards.map do |card|\n if card.rank >= 11\n high_cards << card\n end\n end\n high_cards\n end", "def game_score(score)\n end", "def index\n @score_cards = ScoreCard.all\n end", "def ten_recipes_after number\n first_elf_position = 0\n second_elf_position = 1\n scoreboard = Array.new(number+10) # Pre-create array to avoid the cost of growing it\n scoreboard[first_elf_position] = 3\n scoreboard[second_elf_position] = 7\n scoreboard_size = 2\n while scoreboard_size < number + 10\n next_recipe_scores = (scoreboard[first_elf_position] + scoreboard[second_elf_position]).to_s.split('').map(&:to_i)\n next_recipe_scores.each do |new_score|\n scoreboard[scoreboard_size] = new_score\n scoreboard_size += 1\n end\n first_elf_delta = scoreboard[first_elf_position] + 1\n second_elf_delta = scoreboard[second_elf_position] + 1\n first_elf_position = normalize_elf_position(first_elf_position + first_elf_delta, scoreboard_size)\n second_elf_position = normalize_elf_position(second_elf_position + second_elf_delta, scoreboard_size)\n # print_scoreboard first_elf_position, second_elf_position, scoreboard\n # puts scoreboard_size\n end\n scoreboard[number..(number+10-1)].join('')\nend", "def runner\nwelcome\ncard_total = initial_round\nwhile card_total < 21\ncard_total=hit?(card_total)\ndisplay_card_total(card_total)\nend\nend_game(card_total)\nend", "def score_hand\n\n end", "def printscore\n puts \"綠譜平均:#{ @bas_total * 1.0 / @bas_num }\".colorize(:light_green)\n puts \"黃譜平均:#{ @adv_total * 1.0 / @adv_num }\".colorize(:light_yellow)\n puts \"紅譜平均:#{ @ext_total * 1.0 / @ext_num }\".colorize(:light_red)\n puts \"全譜面平均:#{ (@bas_total + @adv_total + @ext_total) * 1.0 / (@bas_num + @adv_num + @ext_num) }\".colorize(:light_white)\n end", "def runner\n welcome\n cards=0\n while cards<21\n cards=initial_round\n cards=hit?(cards)\n display_card_total(cards)\n end\n end_game(cards)\nend", "def calculate_score\n #example of array frames [5, 10, 20 , 35, 58]\n array_frames = generate_frames\n array_frames.reduce(0) {|memo, value| memo + value }\n end", "def score\n\t@score = 0\n\tself.to_array.each do |character|\n\t\t@score += TILE_VALUES[character]\n end\n\t@score\n end", "def print_cards\n for card in @cards_in_play\n puts (@cards_in_play.index(card) + 1).to_s + \". \" + card.to_s + \"\\n\"\n end\nend", "def magic_weight\n binding.pry\n \n @result.arrayofcards.each do |bundle|\n \n end\n end", "def card_in_game\n (2..14).each {|r| (1..4).each { |i| @pack_of_card << [i, r] }}\n @cards = @pack_of_card.shuffle.take(7)\n # @hash_7_card is hash prepared for analyze combinations and the highest combination to win\n $hash_7_card = array_suit_rank\n end", "def scores\n @scores\n end", "def cards\n questions.count + answers.count\n end", "def matrix\n 10.times do |round|\n @score_table.push([])\n rolls\n if round == 9 && @suma == 10\n if @suma == 10\n @roll_three = rand(0..10)\n @score += @roll_three\n llenado(4, round)\n end\n else\n llenado(3, round)\n end\n end\n bonus = Score.new(@score_table)\n bonus.bonus\n end", "def total_cards\n cards.count\n end", "def score\n self.tiles.inject(0){|sum,num| sum+=TileBag.points_for(num)}\n end", "def scores_table\n puts \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n puts \" Scores: \"\n puts \" -Dealer Score: #{@dealers_score}\"\n puts \" -Player Score: #{@players_score}\"\n puts\n puts \" Dealer's Cards: \"\n if player_stands == false\n puts \" (***************)\"\n puts \" (#{@dealer.cards[1].name.upcase} OF #{@dealer.cards[1].suit.upcase})\"\n else\n for card in @dealer.cards\n puts \" (#{card.name.upcase} OF #{card.suit.upcase})\"\n end\n end\n puts\n puts \" Player's Cards: \"\n # For Loop to Display all of the Player's Cards\n for card in @player.cards\n puts \" (#{card.name.upcase} OF #{card.suit.upcase})\"\n end\n puts\n puts \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n \n end", "def test_score_with_no_strikes_or_spares\n test_game = Game.new\n i = 1\n frame_score = 0\n while i <= 10\n frame_score = add_to_frame_score(1, false, frame_score, i)\n frame_score = add_to_frame_score(1, false, frame_score, i)\n i+=1\n end\n assert_equal 20, frame_score\n end", "def runner\n welcome\n cards_counter = initial_round\n\n until cards_counter > 21\n compare = hit?(cards_counter)\n compare == cards_counter ? display_card_total(cards_counter):display_card_total(compare)\n cards_counter = compare\n end\nend_game(cards_counter)\nend", "def round()\n\t\t#array of used cards\n\t\t@used = []\n\t\t#loop through players array\n\t\tfor i in 0...@num_players\n\t\t\t#reset player variables\n\t\t\t@players[i].reset()\t\n\t\t\t#populate hand\n\t\t\t@players[i].populate(@used,52,5)\n\t\t\t#get hand rank\n\t\t\t@players[i].get_rank()\n\t\t\t#add hand to array of used cards\n\t\t\t@used += @players[i].hand\n\t\tend\n\t\t#increment round number\n\t\t@roundnum += 1 \n\tend", "def check_points(cards)\n points = []\n point = 0\n\n cards.each do |card|\n if %w(J K Q).include?(card[:value])\n point += 10\n elsif card[:value] == 'A'\n point += 11\n else\n point += card[:value].to_i\n end\n end\n\n points << point if point <= 21\n\n cards.select { |ele| ele[:value] == 'A' }.count.times do\n point -= 10\n points << point if point <= 21\n end\n\n points\nend", "def printCard\n\t\tputs \"+--------- +\"\n\t\tif @health/10 == 0\n\t\t\tputs \"| hp: #{@currentHealth} |\"\n\t\telse \n\t\t\tputs \"| hp: #{@currentHealth} |\"\n\t\tend\n\t\tputs \"| |\"\n\t\tif @attack/10 == 0\n\t\t\tputs \"| atk: #{@attack} |\"\n\t\telse \n\t\t\tputs \"| atk: #{@attack} |\"\n\t\tend\n\t\tputs \"| |\"\n\t\tputs \"| |\"\n\t\tputs \"+--------- +\"\n\tend", "def prepare_scores\n i = 0\n while @all_rolls[i]\n if(@all_rolls[i] == 10)\n #add empty second roll for strikes\n @all_rolls.insert(i+1, 0)\n end\n\n if(!@all_rolls[i+1])\n #allows for incomplete frames\n f = Frame.new(@all_rolls[i], 0)\n else\n #build frame\n f = Frame.new(@all_rolls[i], @all_rolls[i+1])\n end\n\n @all_frames.push(f)\n i += 2\n end\n \n #cushion to account for out of bounds errors\n @all_frames.push(Frame.new(0, 0))\n @all_frames.push(Frame.new(0, 0))\n end", "def printCard(card_number)\n \n # get card rank\n rank = case card_number % 13\n when 0 then :King\n when 1 then :Ace\n when 11 then :Jack\n when 12 then :Queen\n else card_number % 13 \n end\n \n # get suit\n suit = case (card_number) % 4\n when 0 then :Heart\n when 1 then :Diamond\n when 2 then :Spade\n else :Club\n end\n\n return \"#{rank} of #{suit}\"\n \nend", "def calculate_total(cards)\n #create a new array card_values to just contain the values of the cards\n card_values = cards.map {|value| value[1]}\n total = 0\n\n #loop through these card values. If the value is an Ace, give it 11, if it is J, Q, or K, give it a value of 10. Otherwise just use the face value\n card_values.each do |card|\n if card == 'Ace'\n total += 11\n elsif card.to_i == 0 \n total = total + 10\n else\n total += card.to_i\n end\n end\n\n #count all the Aces we have using the select and count methods. And then go through the loop the number of times Ace is in the array and subtract 10 each time the total value is over 21.\n\n card_values.select {|e| e == \"A\"}.count.times do\n if total > 21\n total -= 10\n end\n end\n total\n end", "def hand_value(cards)\n value = 0\n val_arr = []\n cards.each do |sub_array|\n val_arr << sub_array.last\n val_arr.sort!\n end\n val_arr.each do |val|\n if val == 11 && value > 10\n value = value + 1 \n else\n value = value + val\n end\n end\n return value\nend", "def score_all_frames\n frames.reduce(0) do |total, frame|\n total + frame.total\n end\n end", "def draw_cards(hand)\n card_count = hand.count\n card_count.times do\n print \" ----- \"\n print ' '\n end\n print \"\\n\"\n card_count.times do\n print \"| |\"\n print ' '\n end\n print \"\\n\"\n card_count.times do |i|\n if hand[i][1] == '10'\n print \"| #{hand[i][1]} |\"\n else\n print \"| #{hand[i][1]} |\"\n end\n print ' '\n end\n print \"\\n\"\n card_count.times do |i|\n print \"| #{hand[i][0]} |\"\n print ' '\n end\n print \"\\n\"\n card_count.times do\n print \"| |\"\n print ' '\n end\n print \"\\n\"\n card_count.times do\n print \" ----- \"\n print ' '\n end\n print \"\\n\"\nend", "def score\n result = 0\n tiro_index = 0\n rellenar_vector\n\n 10.times do\n if strike?(tiro_index)\n result += strike_Score(tiro_index)\n tiro_index += 1\n elsif spare?(tiro_index)\n\n result += spare_score(tiro_index)\n tiro_index += 2\n else\n result += cuadro_score(tiro_index)\n tiro_index += 2\n end\n end\n result\n end", "def formulate_score()\n @player_score = @player_score.sort!().reverse!().join().to_i()\n p \"#{@players_joined[0]}'s score is #{@player_score}\"\n check_score()\n end", "def score; end", "def top_10 (matches)\n matches.sort_by! { |match| match['score'] }.reverse[:10]\nend", "def print_card\n \" #{self.rank_for_print} of #{@suit}\"\n end", "def value \r\n value = 0\r\n @cards.each do |card|\r\n value += card.value\r\n end\r\n if value > 21\r\n value = 0\r\n @cards.each do |card|\r\n if card.value == 11\r\n value += 1\r\n else\r\n value += card.value\r\n end\r\n end\r\n end\r\n value\r\n end" ]
[ "0.6931209", "0.6881471", "0.6875299", "0.6792881", "0.6695651", "0.6609313", "0.65657145", "0.65402746", "0.6505792", "0.64568233", "0.64367497", "0.6379364", "0.6326207", "0.6300978", "0.62843573", "0.62837124", "0.62398225", "0.6170008", "0.6141564", "0.6128588", "0.6122183", "0.6119018", "0.611494", "0.6114324", "0.6083679", "0.6083679", "0.6075941", "0.60620254", "0.60248816", "0.6000094", "0.5984418", "0.5971334", "0.59668314", "0.59612006", "0.594709", "0.59243727", "0.5898654", "0.5887973", "0.5885309", "0.5879953", "0.58746564", "0.585396", "0.58433396", "0.5835621", "0.58247405", "0.58235097", "0.5821226", "0.5784801", "0.578128", "0.57762915", "0.5764453", "0.5752114", "0.5747974", "0.5744624", "0.5741842", "0.5733194", "0.5732897", "0.5725331", "0.5699009", "0.56966114", "0.5693078", "0.5690924", "0.56809825", "0.5668689", "0.56601757", "0.56581604", "0.56559473", "0.56508213", "0.56471616", "0.5641653", "0.5634676", "0.5634272", "0.5633945", "0.5618956", "0.5611712", "0.5605212", "0.56023103", "0.5599136", "0.5597977", "0.5591047", "0.5588725", "0.55874836", "0.55860645", "0.55837387", "0.55817485", "0.5580206", "0.5579023", "0.55755216", "0.5572492", "0.5571369", "0.5570847", "0.556812", "0.5567426", "0.5566343", "0.55661803", "0.5560922", "0.55605817", "0.5548612", "0.5547799", "0.5546523" ]
0.81018424
0
each "ace" card can score 11 or 1, depending on what is closer to 21, but not exceeding 21
def score_aces(cards_aces, score_without_aces) # first, assume all "ace" cards score as 1 aces_count = cards_aces.count return 0 if aces_count.zero? # check if we can convert one ace card to 11 if (score_without_aces + aces_count <= 11) 11 + (aces_count - 1) else # all ace cards still score as 1 aces_count end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ace_check\n cards[index_of_11][:points] = 1 if index_of_11 && (total > 21)\n end", "def calculate_score(hand_of_cards)\n card_values = hand_of_cards.map{|card_value| card_value[1]}\n total = 0 \n card_values.each do |card_value| \n if card_value == \"ACE\"\n total+= 11\n elsif card_value.to_i == 0 #For suits ie Jester, Queen\n total+= 10\n else \n total+= card_value.to_i\n end\n end \n\n#adjust for Aces\n card_values.select{|card| card == \"ACE\"}.count.times do \n total-=10 if total > 21\n end \n total\nend", "def score\n score = 0\n aces_count = 0\n @hand_contents.each do |card|\n if card.type == :face\n score += 10\n elsif card.type == :ace\n aces_count += 1\n score += 11\n elsif card.type == :number\n score += card.rank.to_i\n end\n end\n\n while score > 21 && aces_count > 0\n score -= 10\n aces_count -= 1\n end\n score\n end", "def get_optimum_hand_score(hand)\n total = 0\n hand.each do |card|\n total += get_card_value(card)\n end\n\n #Count the number of aces we have\n num_aces = (hand.select{|card| get_card_value(card) == 11}).length\n\n #Account fo aces\n while total > 21 && num_aces > 0 do\n total -= 10\n num_aces -= 1\n end\n return total\nend", "def smart_aces hand\n# Adjusts the value of \"Ace\" elements to be either 1 or 11 depending on the hand total\n\thand_total = hand.reduce :+\n\tif hand_total < 12 && hand_total > 2\n\t\thand.map! do |card|\n\t\t\tif card == 1\n\t\t\t\t11\n\t\t\telse\n\t\t\t\tcard\n\t\t\tend\n\t\tend\n\telsif hand_total > 21\n\t\thand.map! do |card|\n\t\t\tif card == 11\n\t\t\t\t1\n\t\t\telse\n\t\t\t\tcard\n\t\t\tend\n\t\tend\n\telsif hand_total == 2\n\t\thand[0] = 11\n\tend\n\nend", "def get_hand_score\n score = 0\n \n # Add up score of non-aces\n values = hand.map{|card| card.value}\n values.each do |val|\n if Array(2..10).include?(val.to_i)\n score += val.to_i\n elsif [\"J\", \"Q\", \"K\"].include?(val)\n score += 10\n end\n end\n\n # deal with the aces\n values.count(\"A\").times do\n if score + 11 <= 21\n score += 11\n else\n score += 1\n end\n end\n\n return score\n end", "def calculate_score(values)\n total = 0\n values.each do |card|\n total += card\n if total > 21 && card == 11\n total -= 10\n end\n end\n total\n end", "def possible_scores(cards)\n scores = [0]\n\n cards.each do |card|\n if card.face != 'Ace'\n scores.map! {|score| score + card.value} \n else\n new_scores = Array.new\n scores.each do |score|\n new_scores << score + 1\n new_scores << score + 11\n end\n scores = new_scores\n end\n end\n\n return scores.uniq.select {|score| score < 22}\nend", "def cards_to_score(cards)\n \n total = 0\n cards_num = []\n\n cards.each { |card| cards_num.push(card % 13) }\n\n cards_num.sort.reverse.each do |num|\n if num >= 9 #9, 10, 11, 12 means 10, J, Q, K\n total = total + 10\n elsif num > 0 #which means 2, 3, 4, 5, 6, 7, 8, 9\n total = total + num + 1\n end\n end\n\n a_count = cards_num.count(0)\n\n total = total + a_count\n\n a_count.times do\n total = total + 10 if total <= 11\n end\n\n return total\nend", "def adjust_value_for_aces(hand, value)\n aces = [] \n hand.each do |x|\n if x[0..2] == \"Ace\"\n aces.push(x)\n end\n end\n ace_count = aces.length\n if ace_count != 0 && value > 21\n begin\n value -= 10\n ace_count -= 1\n end until value <= 21 || ace_count == 0\n end\n value\nend", "def calc_hand_total(cards)\r\n total = 0\r\n numbers_only_array = cards.map {|g| g[0]}\r\n numbers_only_array.each do |h|\r\n if h == 'ace'\r\n total += 11\r\n elsif h.to_i == 0\r\n total += 10\r\n else\r\n total += h.to_i\r\n end\r\n end\r\n\r\n numbers_only_array.select {|k| k == \"ace\"}.count.times do\r\n total -= 10 if total > 21 \r\n end\r\n\r\n total\r\nend", "def calculate_points(cards_in_hands)\n points = 0\n cards_without_ace = cards_in_hands.select {|card| card[1] != 'A'}\n cards_with_ace = cards_in_hands.select {|card| card[1] == 'A'}\n cards_without_ace.each do |card|\n if card[0].to_i !=0\n points += card[0].to_i\n else\n points += 10\n end\n end\n if cards_with_ace.empty?\n return points\n else\n ace_sets = [11, 1].repeated_permutation(cards_with_ace.length).to_a\n ace_sets_sum_arr = []\n ace_sets.each do |arr|\n arr_sum = 0\n arr.each {|v| arr_sum = arr_sum + v}\n ace_sets_sum_arr.push(arr_sum)\n end\n ace_sets_sum_arr.sort!.uniq!\n ace_sets_sum_arr.map! {|num| num + points}\n if ace_sets_sum_arr.include?(21)\n points = 21\n return points\n else\n lt_21_arr = ace_sets_sum_arr.select {|v| v < 21}\n gt_21_arr= ace_sets_sum_arr.select {|v| v > 21}\n if lt_21_arr.empty?\n points = gt_21_arr.first\n return points\n else\n points = lt_21_arr.last\n return points\n end\n end\n end\nend", "def check_points(cards)\n points = []\n point = 0\n\n cards.each do |card|\n if %w(J K Q).include?(card[:value])\n point += 10\n elsif card[:value] == 'A'\n point += 11\n else\n point += card[:value].to_i\n end\n end\n\n points << point if point <= 21\n\n cards.select { |ele| ele[:value] == 'A' }.count.times do\n point -= 10\n points << point if point <= 21\n end\n\n points\nend", "def score\n return 0 unless valid?\n 100 * card_value_decimal * 15 ** 5\n end", "def possible_scores\n card_values.inject([0]) do |memo, item|\n if ace_value?(item)\n added_one = memo.map { |score| score + 1 }\n added_one << (added_one.last + 10)\n else\n memo.map { |number| number + item.first }\n end\n end\n end", "def calculate_totals(cards) \n card_values = cards.map{|card| card[1]}\n total_socre = 0\n card_values.each do |value|\n if value == \"Ace\"\n total_socre += 11\n elsif value.to_i == 0\n total_socre += 10\n else\n total_socre += value.to_i\n end\n end\n#correct for Aces\n card_values.select {|e| e == \"Ace\"}.count.times do\n total_socre -= 10 if total_socre > 21\n end\n total_socre\nend", "def determine_players_best_total(current_player)\n # @player1_hand = ['ace of spades', '5 of spades', '4 of spades', 'ace of diamonds']\n # @player1_hand = ['3 of spades', 'ace of hearts', '4 of spades', 'ace of clubs']\n # @player1_hand = ['ace of clubs', '2 of clubs', 'ace of hearts', '4 of hearts']\n sum_of_players_hand = 0\n number_of_aces_in_hand = 0\n if current_player == 1 then\n @player1_hand.each {|x| #begin loop adding players hand\n card_value = @deckhash.fetch(x)\n if card_value == 1 then #adjust aces to a value of 11\n card_value = 11\n number_of_aces_in_hand = number_of_aces_in_hand + 1\n end #end of ace adjustment\n sum_of_players_hand = sum_of_players_hand + card_value\n } #end of loop adding players hand\n\n if sum_of_players_hand > 21 then #must set one or more aces back to one\n loop do\n if number_of_aces_in_hand == 0 then break end\n\n sum_of_players_hand = sum_of_players_hand - 10\n\n if sum_of_players_hand < 22 then break end\n number_of_aces_in_hand = number_of_aces_in_hand - 1\n end #end of loop do\n end #end of sum_of_players_hand > 21\n end #end if current player = 1\n\n if current_player == 2 then\n @player2_hand.each {|x| #begin loop adding players hand\n card_value = @deckhash.fetch(x)\n if card_value == 1 then #adjust aces to a value of 11\n card_value = 11\n number_of_aces_in_hand = number_of_aces_in_hand + 1\n end #end of ace adjustment\n sum_of_players_hand = sum_of_players_hand + card_value\n } #end of loop adding players hand\n if sum_of_players_hand > 21 then #must set one or more aces back to one\n loop do\n if number_of_aces_in_hand == 0 then break end\n sum_of_players_hand = sum_of_players_hand - 10\n $stdout.write(\"sum of players hand #{sum_of_players_hand} :\")\n if sum_of_players_hand < 22 then break end\n number_of_aces_in_hand = number_of_aces_in_hand - 1\n end #end of loop do\n end #end of sum_of_players_hand > 21\n end #end if current player = 2\n\n if current_player == 3 then\n @player3_hand.each {|x| #begin loop adding players hand\n card_value = @deckhash.fetch(x)\n if card_value == 1 then #adjust aces to a value of 11\n card_value = 11\n number_of_aces_in_hand = number_of_aces_in_hand + 1\n end #end of ace adjustment\n sum_of_players_hand = sum_of_players_hand + card_value\n } #end of loop adding players hand\n if sum_of_players_hand > 21 then #must set one or more aces back to one\n loop do\n if number_of_aces_in_hand == 0 then break end\n sum_of_players_hand = sum_of_players_hand - 10\n# $stdout.write(\"sum of players hand #{sum_of_players_hand} :\")\n if sum_of_players_hand < 22 then break end\n number_of_aces_in_hand = number_of_aces_in_hand - 1\n end #end of loop do\n end #end of sum_of_players_hand > 21\n end #end if current player = 3\n\n if current_player == 4 then\n @player4_hand.each {|x| #begin loop adding players hand\n card_value = @deckhash.fetch(x)\n if card_value == 1 then #adjust aces to a value of 11\n card_value = 11\n number_of_aces_in_hand = number_of_aces_in_hand + 1\n end #end of ace adjustment\n sum_of_players_hand = sum_of_players_hand + card_value\n } #end of loop adding players hand\n if sum_of_players_hand > 21 then #must set one or more aces back to one\n loop do\n if number_of_aces_in_hand == 0 then break end\n sum_of_players_hand = sum_of_players_hand - 10\n# $stdout.write(\"sum of players hand #{sum_of_players_hand} :\")\n if sum_of_players_hand < 22 then break end\n number_of_aces_in_hand = number_of_aces_in_hand - 1\n end #end of loop do\n end #end of sum_of_players_hand > 21\n end #end if current player = 4\n # ### This method returns sum of player's best hand\n return sum_of_players_hand\n end", "def value_of_hand(array_of_cards)\n faces = {\"A\" =>11,\n \"2\" => 2, \n \"3\" => 3,\n \"4\" => 4,\n \"5\" => 5,\n \"6\" => 6,\n \"7\" => 7,\n \"8\" => 8,\n \"9\" => 9,\n \"10\" => 10,\n \"J\" => 10,\n \"Q\" => 10,\n \"K\" => 10\n }\n total_value = 0\n num_aces = 0\n array_of_cards.each do |c|\n #cards are in string format, e.g. \"J of diamonds\"\n face = c.split[0]\n value = faces[face]\n total_value += value\n num_aces += 1 if face == \"A\"\n end\n #correct for Aces -- BORROWED THIS LOGIC FROM TEACHER'S CODE\n num_aces.times do\n total_value -= 10 if total_value > 21\n end\n return total_value\nend", "def check\n containAce = false\n i = 0\n sum = 0\n while i < @hand.length\n if 1 == num_to_value(@hand[i])\n containAce = true\n end\n sum += num_to_value(@hand[i])\n i += 1\n end\n\n if containAce\n if sum < 7\n @value = sum + 10\n elsif sum < 11\n @value = sum + 10\n @status = \"finished\"\n elsif 11 == sum\n if 2 == @hand.length \n @value = 50 # 50 means it's BLACKJACK\n @status = \"finished\"\n else\n @value = 21\n @status = \"finished\"\n end\n elsif sum < 17\n @value = sum\n else sum <= 21\n @value = sum\n @status = \"finished\"\n end\n else\n if sum < 17\n @value = sum\n else\n @value = sum\n @status = \"finished\"\n end\n end\n end", "def calculate_total\n total = 0\n cards.each {|a_card| total += a_card.value }\n #correct for Aces, if we have blown over 21\n cards.each do |a_card| \n if a_card.face == ACE \n total -= (ACE_VALUE - ACE_ALT_VALUE) if total > BLACKJACK\n end\n end\n total\n end", "def blackjack_score(hand)\n allowed_cards = %w[ 2 3 4 5 6 7 8 9 10 Jack Queen King Ace ]\n\n# Validate input\n if hand.length > 5\n raise ArgumentError.new(\"Your hand contains more than 5 cards.\")\n end \n\n result = hand.all? {|card| allowed_cards.include?(card)}\n if !result\n raise ArgumentError.new(\"Invalid card value.\")\n end \n\n# Calculate score \n score = 0\n hand.each do |card|\n if card.length <= 2\n points = card.to_i\n score += points\n elsif card.length == 3 \n score += 1\n else \n score += 10 \n end \n end\n\n if score <= 11 && hand.include?(\"Ace\")\n score += 10\n end\n\n# Validate result\n if score > 21\n raise ArgumentError.new(\"#{score} is greater than 21, you lose!\")\n end\n\n return score \nend", "def calculate_total(cards)\n #create a new array card_values to just contain the values of the cards\n card_values = cards.map {|value| value[1]}\n total = 0\n\n #loop through these card values. If the value is an Ace, give it 11, if it is J, Q, or K, give it a value of 10. Otherwise just use the face value\n card_values.each do |card|\n if card == 'Ace'\n total += 11\n elsif card.to_i == 0 \n total = total + 10\n else\n total += card.to_i\n end\n end\n\n #count all the Aces we have using the select and count methods. And then go through the loop the number of times Ace is in the array and subtract 10 each time the total value is over 21.\n\n card_values.select {|e| e == \"A\"}.count.times do\n if total > 21\n total -= 10\n end\n end\n total\n end", "def card_value_determiner(card)\n string_nums = (2..10).to_a.map { |i| i.to_s}\n if string_nums.include?(card.face)\n card.value = card.face.to_i\n elsif card.face == 'Ace'\n card.value == 11\n else\n card.value = 10\n end\nend", "def calculate_total(cards)\n arr = cards.map{|e| e[1] }\n\n total = 0 \n arr.each do |value|\n if value == \"Ace\"\n total == 11\n elsif value.to_i == 0 # Jack Queen or King\n total += 10\n else\n total += value.to_i\n end\n end\n\narr.select{|e| e == \"Ace\"}.count.times do\n if total > 21\n total -= 10 \n end\nend\n#if arr.include?(\"Ace\") && total > 21\n #total -= 10 \n total\nend", "def value(hand)\n ace_count = 0\n hand_value = 0\n\n hand.each do |card|\n if card == :ace\n ace_count += 1\n hand_value += 11\n else\n hand_value += card\n end\n end\n\n # flip aces from being worth 11 to being worth 1 until we get <= 21\n # or we run out of aces\n while hand_value > 21 && ace_count > 0\n hand_value -= 10\n ace_count -= 1\n end\n\n hand_value\nend", "def calculate_total\n #create a new array card_values to just contain the values of the cards\n card_values = cards.map {|value| value[1]}\n total = 0\n\n #loop through these card values. If the value is an Ace, give it 11, if it is J, Q, or K, give it a value of 10. Otherwise just use the face value\n card_values.each do |card|\n if card == 'Ace'\n total += 11\n elsif card.to_i == 0 \n total = total + 10\n else\n total += card.to_i\n end\n end\n\n #count all the Aces we have using the select and count methods. And then go through the loop the number of times Ace is in the array and subtract 10 each time the total value is over 21.\n\n card_values.select {|e| e == \"A\"}.count.times do\n if total > 21\n total -= 10\n end\n end\n @total = total\n end", "def scores_update\n # Variable to Hold the Player's Score:\n @players_score = 0\n # Variable to Hold the Dealer's Score:\n @dealers_score = 0\n\n # Player - Different Scenarios for an Ace\n #########################################\n for card in @player.cards\n if card.name == :ace\n # If player's card is an Ace, then increase the player's softhand score by 1.\n @players_softhand += 1\n # If player's card is an Ace and the player's score is greater than 11, then increase the score by 1\n if @players_score >= 11\n @players_score += 1\n\n #Note* Alternatively:\n #@players_score += card.value.last\n else\n # Else increase the score by 11\n @players_score += 11\n #Note* Alternatively:\n #@players_score += card.value.first\n end\n else\n # Else if card isn't an Ace, then increase the value of the score by the cards value.\n @players_score += card.value\n end\n end\n\n # Dealer - Scenario for an Ace\n ##############################\n\n # If player hasn't chosen to stand\n if player_stands == false\n # and If the dealers first card is an Ace\n if @dealer.cards[1].name == :ace\n # then increase the dealer's soft hand score by 1\n @dealers_softhand += 1\n # and increase the dealer's score by 11\n @dealers_score += 11\n else\n # else increase the dealer's score by the value of the card.\n @dealers_score += @dealer.cards[1].value\n end\n\n # Else if Player has chosen to stand, \n else\n # For each of the Dealer's cards\n for card in @dealer.cards\n # If any card is an ace,\n if card.name == :ace\n # Then increase the dealer's softhand score by 1\n @dealers_softhand += 1\n # If player has chosen to stand and if the card is an ace and if the dealer's score is greater than 10,\n if @dealers_score >= 11\n # then increase the dealer's score by one\n @dealers_score += 1\n else\n # else increase the dealer's score by 11.\n @dealers_score += 11\n end\n # Else if the dealer's card is not an Ace, then increase the score by the cards value. \n else\n @dealers_score += card.value\n end\n end\n end\n\n # Dealing with Edge Cases for an Ace Card\n # First 2 Cards are both Aces or one of the first 2 cards is an Ace, but then a resulting value makes the score go over 21\n ######################################\n\n # If player score is greater than 21 and player's softhand is greater than 0, \n if @players_score > 21 && players_softhand > 0\n # then subtract the score by 10 (Difference in value of an Ace.)\n @players_score -= 10\n # and subtract the score of the softhand score by 1.\n @players_softhand -= 1\n end\n\n # If dealer score is greater than 21 and dealer's softhand score is greater than 0, \n if @dealers_score > 21 && dealers_softhand > 0\n # then subtract the dealer's score by 10 (Difference in value of an Ace.)\n @dealers_score -= 10\n # then subtract the dealer's soft hand score by 1.\n @dealers_softhand -= 1\n end\n end", "def card_total(player_or_dealer_array)\n value_array = player_or_dealer_array.map { |v| v[1] }\n card_value_counter = 0\n \n value_array.each do |value|\n if value.is_a? Integer\n card_value_counter += value\n elsif value != 'Ace'\n card_value_counter += 10\n else\n card_value_counter += 11\n end\n end\n \n #decided total based on total number of aces. Will keep adjusting ace value to 1 until the toal is 21 or under\n value_array.select { |v| v == 'Ace'}.count.times do\n card_value_counter -= 10 if card_value_counter > 21\n end\n \n card_value_counter\nend", "def calculatetotal(cards) # calculating the total of the two cards dealt, first to player then to dealer\n array = cards.map {|card| card[0]} # using the map method to lay out all the cards which are like so [[\"A\", \"S\"], [\"5\", \"C\"]]\n # We then only take the first element of the array and initialize that to the total\n total = 0 # total at the outset is zero\n array.each do |value|\n if value == \"A\" # in the event you get an ace card. \"A\" is as is unlike the bottom ones below\n total += 11 # total should now increase to 11\n elsif value.to_i == 0 # this is to cover for getting J, K, Q cards which defaults value to integer is zero\n total += 10\n else\n total += value.to_i\n end\nend # finished the array\n\n# Correcting Aces in case there are more than one. It should convert aces to 1 instead of 11 if total is more than 21\narray.select {|card| card.include?(\"A\")}.count.times do\n total -= 10 if total > 21\nend\ntotal # don't forget to include total here before exiting. IMPORTANT!!\nend", "def cheat\n if @score >= 60 and !@cheating and !@cheating_two\n @cheating = true\n @score -= 60\n end\n end", "def blackjack?\n score == 21\n end", "def determine_dealers_best_total\n # @dealer_hand = ['ace of spades', '5 of spades', '4 of spades', 'ace of diamonds']\n # @player1_hand = ['3 of spades', 'ace of hearts', '4 of spades', 'ace of clubs']\n # @player1_hand = ['ace of clubs', '2 of clubs', 'ace of hearts', '4 of hearts']\n # @dealer_hand = ['king of hearts', '6 of diamonds']\n sum_of_dealers_hand = 0\n number_of_aces_in_hand = 0\n @dealer_hand.each {|x| # begin loop adding dealers hand\n card_value = @deckhash.fetch(x)\n\n if card_value == 1 then # adjust aces to a value of 11\n card_value = 11\n number_of_aces_in_hand = number_of_aces_in_hand + 1\n end\n sum_of_dealers_hand = sum_of_dealers_hand + card_value\n\n } #end of loop adding dealers hand\n\n if sum_of_dealers_hand > 21 then # must set one or more aces back to one\n loop do\n if number_of_aces_in_hand == 0 then break end\n sum_of_dealers_hand = sum_of_dealers_hand - 10\n if sum_of_dealers_hand < 22 then break end\n number_of_aces_in_hand = number_of_aces_in_hand - 1\n end #end of loop do\n end #end of sum_of_dealers_hand > 21\n\n # $stdout.write(\"Showing card and value #{sum_of_dealers_hand}, #{number_of_aces_in_hand} \\n\")\n # ### this method returns of the dealer's best hand'\n\n sum_of_dealers_hand = sum_of_dealers_hand + 0\n\n end", "def score(card)\n case card\n when :ace then 11 # assigns value to each symbol, helps with scoring\n when :king then 10\n when :queen then 10\n when :jack then 10\n else card\n end\nend", "def isAce(card_number)\n return true if (card_number % 13) == 1\nend", "def has_aces\n if @cards.length == 2 and @cards[0].is_ace and @cards[1].is_ace\n return 1\n end\n return nil\n end", "def total(cards)\n values = cards.map { |card| card[1] } # this map method iterates through each card ([S, V]) and returns the value of the card from the second spot in the individual card array\n\n sum = 0 # initialize the sum variable that will be used to total the card values\n values.each do |value| # iterate through each value\n if value == \"A\" # if the card is an Ace, add 11 to the sum\n sum += 11\n elsif value.to_i == 0 # if the card's value is 0 when converted to an int, that means it is a face card and should be worth 10\n sum += 10\n else\n sum += value.to_i # otherwise, convert the value to an integer and add that to the sum\n end\n end\n\n # adjust aces if sum is greater than 21\n values.select { |value| value == \"A\" }.count.times do # iterate through the card values array, finding the aces.\n sum -= 10 if sum > MAX_VALUE # If the sum is greater than 21, subtract 10 from each ace, making the aces only worth 1\n end\n\n sum # return the sum\nend", "def decide(dealer)\n @dealer_card = dealer.visible_card[:value]\n @card_total = hands.last.total\n if values.include?(Ace)\n if (values.include?(2) || values.include?(3)) && [5,6].include?(@dealer_card)\n :doubledown #hit\n elsif values.include?(2) || values.include?(3)\n :hit\n elsif (values.include?(4) || values.include?(5)) && [4,5,6].include?(@dealer_card)\n :doubledown #hit\n elsif values.include?(4) || values.include?(5)\n :hit\n elsif values.include?(6) && [3,4,5,6].include?(@dealer_card)\n :doubledown #hit\n elsif values.include?(6)\n :hit\n elsif values.include?(7) && [2,7,8].include?(@dealer_card)\n elsif values.include?(7) && [3,4,5,6].include?(@dealer_card)\n :doubledown #stand\n elsif values.include?(7)\n :hit\n elsif values.include?(8) || values.include?(9)\n :stand\n elsif values.first == values.last\n :split\n end\n elsif values.first == values.last\n if [2,3,7].include?(values.first) && @dealer_card <= 7\n :split\n elsif [2,3,7].include?(values.first)\n :hit\n elsif values.first == 4 && [5,6].include?(@dealer_card)\n :split\n elsif values.first == 4\n :hit\n elsif values.first == 5 && #dealer_card <= 9\n :doubledown #hit\n elsif values.first == 5 \n :hit\n elsif values.first == 6 && @dealer_card <= 6\n :split\n elsif values.first == 6\n :hit\n elsif values.first == 8\n :split\n elsif values.first == 9 && [2,3,4,5,6,8,9].include?(@dealer_card)\n :split\n elsif values.first == 9\n :stand\n elsif values.first.to_i == 10\n :split\n end\n else\n if (5...8).include?(@card_total)\n :hit\n elsif @card_total == 9 && (3...6).include?(@dealer_card)\n :doubledown #hit\n elsif @card_total == 9\n :hit\n elsif @card_total == 10 && (2...9).include?(@dealer_card)\n :doubledown #hit\n elsif @card_total == 10\n :hit\n elsif @card_total == 11 && ((2...10)+[Jack, Queen, King]).include?(@dealer_card)\n :doubledown #hit\n elsif @card_total == 11\n :hit\n elsif @card_total == 12 && [4,5,6].include?(@dealer_card)\n :stand\n elsif @card_total == 12\n :hit\n elsif (13...16).include?(@card_total) && @dealear_card <= 6\n :stand\n elsif (13...16).include?(@card_total) && (@dealer_card >= 7 || @dealer_card.is_a?(Ace))\n :hit\n elsif @card_total == 17\n :stand\n end\n end\n end", "def calculate_total(cards)\n\tarr = cards.map { |e| e[1] }\n\n\ttotal = 0\n\tarr.each do |value|\n\t\tif value == 'A'\n\t\t\ttotal += 11\n\t\telsif value.to_i == 0 #only works for J, Q, K\n\t\t\ttotal += 10\n\t\telse\n\t\t\ttotal += value.to_i\n\t\tend\n\tend\n\t#Code to make Aces work\n\tarr.select{|e| e == \"A\"}.count.times do\n\t\ttotal -=10 if total > 21\n\tend\n\n\tif arr.include?(\"A\") && total > 21\n\t\ttotal -= 10\n\tend\n\n\ttotal\nend", "def check4aces num\n \tnum.each do |x|\n\t\tif x == 11\n\t\t\t@pScore.delete(11)\n\t\t\t@pScore << 1\n\t\tend\n\tend\n end", "def evaluate(hand) \n value = 0\n numerical_value = hand.map { |card| card[0]} \n numerical_value.each do |x| \n if ['K', 'Q', 'J'].include?(x)\n value += 10\n elsif x == 'A'\n value += 11\n else\n value += x.to_i\n end\n end\n \n hand.select {|x| x[0] == 'A'}.count.times do \n if value > 21\n value -= 10\n end\n end\n value\nend", "def hit\n new_card = @deck.cards.pop\n @current_hand << new_card\n @total += new_card.value\n puts \"drew #{@current_hand[-1].card_id}\"\n\n @current_hand.each do |card|\n if @total > 21\n if card.value == 11 && card.ace_low == false\n @total -= 10\n card.ace_low = true\n end\n end\n end\n end", "def calculate_total(cards)\r\n\ttotal = 0\r\n\tarr = cards.map {|e| e[1]}\r\n\tarr.each do |val|\r\n\t\tif val == 'A'\r\n\t\t\ttotal += 11\r\n\t\telsif val.to_i == 0 # J,Q,K\r\n\t\t\ttotal += 10\r\n\t\telse \r\n\t\t\ttotal += val.to_i\r\n\t\tend\r\n\tend\r\n\r\n\t#correct for aces\r\n\tarr.select {|e| e=='A'}.count.times do\r\n\t\ttotal -= 10 if total > 21\r\n\tend\r\n\r\n\ttotal\r\nend", "def runner\n welcome\n cards_counter = initial_round\n\n until cards_counter > 21\n compare = hit?(cards_counter)\n compare == cards_counter ? display_card_total(cards_counter):display_card_total(compare)\n cards_counter = compare\n end\nend_game(cards_counter)\nend", "def blackjack?; value == 21 && @cards.length == 2; end", "def calculate_total(cards)\n total = 0\n value_of_cards = cards.map{|e| e[1]}\n value_of_cards.each do |value|\n if value == \"A\"\n total += 11\n elsif value.to_i == 0\n total +=10 # handle J, Q, K\n else\n total += value.to_i\n end\n # corrct Ace condition\n if total > 21\n value_of_cards.select{|e| e == \"A\"}.count.times do\n total -= 10\n end\n end\n end\n total\nend", "def total_score\n total = 0\n @cards.each do |card|\n total += card.value\n end\n\n sorted_cards = @cards.sort\n\n straights = get_straight(sorted_cards).reverse\n straights.each do |straight|\n total += 40\n sorted_cards.slice!(straight[0]..straight[1])\n end\n\n three_cards = get_number_of_a_kind(sorted_cards, 3)\n three_cards.each do |three|\n total += 20\n sorted_cards.slice!(three[0]..three[1])\n end\n\n pairs = get_number_of_a_kind(sorted_cards, 2)\n pairs.each do |pair|\n total += 10\n sorted_cards.slice!(pair[0]..pair[1])\n end\n\n total\n end", "def score\n handscore = possible_scores.sort.reverse\n handscore.detect { |value| value <= 21 } or handscore.last\n end", "def handle_ace(hand,sum)\n\t\tputs \"inside handleace #{sum} and #{hand}\"\n\t\tif sum > 21 && hand.include?(21)\n\t\t\thand.each { |x| \n\t\t\t\tif x==\"A21\" \n\t\t\t\tx=\"A1\" \n\t\t\t\tend}\n\t\t\treturn hand\n\t\tend\n\tend", "def runner\nwelcome\ncard_total = initial_round\nwhile card_total < 21\ncard_total=hit?(card_total)\ndisplay_card_total(card_total)\nend\nend_game(card_total)\nend", "def score\n suit_score = [\n Suit.spades,\n Suit.clubs,\n Suit.diamonds,\n Suit.hearts,\n Suit.none\n ].index(suit) * 20 + 40\n\n (number - 6) * 100 + suit_score\n end", "def runner\n welcome\ncard_total =0\nuntil card_total >= 21\ninitial_round\nhit?(card_total)\nend\nend_game\n\nend", "def check\n curhand = \"hand ##{@cur+1} contains: \"\n containAce = false;\n sum = 0\n i = 0\n while i<@hands[@cur].length\n if 1 == num_to_value(@hands[@cur][i])\n containAce = true\n end\n sum += num_to_value(@hands[@cur][i])\n curhand += num_to_rank(@hands[@cur][i]) + \" \"\n i += 1\n end\n\n puts \"---------------------------------------------------------\"\n puts curhand\n\n if containAce\n if sum < 11\n puts \"hand ##{@cur+1} value: #{sum}/#{sum+10}\"\n @values[@cur] = sum + 10 # store the higher value which benefits the player\n elsif 11 == sum \n if 2 == @hands[@cur].length && 1 == @hands.length # a blackjack!! no split and only contain two cards\n puts \"hand ##{@cur+1} value: BLACKJACK!!\"\n @hands_status[@cur] = \"finished\"\n @values[@cur] = 50 # use 50 to represent a blackjack\n else\n puts \"hand ##{@cur+1} value: 21\"\n @values[@cur] = 21\n @hands_status[@cur] = \"finished\"\n end\n elsif sum < 21\n puts \"hand ##{@cur+1} value: #{sum}\"\n @values[@cur] = sum\n elsif 21 == sum\n puts \"hand ##{@cur+1} value: 21\"\n @hands_status[@cur] = \"finished\"\n @values[@cur] = 21\n else\n puts \"hand ##{@cur+1} value: #{sum} busted!\"\n @hands_status[@cur] = \"finished\"\n @values[@cur] = sum \n end\n else\n if sum < 21\n puts \"hand ##{@cur+1} value: #{sum}\"\n @values[@cur] = sum\n elsif 21 == sum\n puts \"hand ##{@cur+1} value: 21\"\n @hands_status[@cur] = \"finished\"\n @values[@cur] = 21\n else\n puts \"hand ##{@cur+1} value: #{sum} busted!\"\n @hands_status[@cur] = \"finished\"\n @values[@cur] = sum\n end\n end\n\n\n puts \"bets for hand ##{@cur+1}: #{@bets[@cur]}\"\n puts \"---------------------------------------------------------\"\n\n if \"finished\" == @hands_status[@cur] \n puts \"hand ##{@cur+1} finished\"\n puts \"\"\n if @cur < @hands.length - 1\n @cur += 1 \n self.check # this recursion is to output the information about newly splitted hand's initial status\n end\n end\n\n end", "def total\n total = 0\n aces = 0\n @hand.each do |card|\n case card[0]\n when 2..10 then total += card[0]\n when 'A' then aces += 1\n else total += 10\n end\n end\n total += add_aces(total, aces)\n total\n end", "def calculate_total(cards) \n # [['Hearts', '2'], ['Spades', 'Jack'], ...]\n total = 0\n arr = cards.map { |e| e[1] }\n\n arr.each do |card|\n if card == \"Ace\"\n total += 11\n elsif card.to_i == 0 # Jack, Queen, King\n total += 10\n else\n total += card.to_i\n end\n end\n\n # correct for Aces\n arr.select { |e| e == \"Ace\" }.count.times do\n total -= 10 if total > 21\n end\n\n total\nend", "def runner\nwelcome\ncards=initial_round\ncards=hit?(cards)\ndisplay_card_total(cards)\nwhile cards<21\n cards=hit?(cards)\nend\nend_game(cards)\nend", "def card_total array\r\n i = 0\r\n total = 0\r\n\tace_value = 0\r\n\tace_array = []\r\n\tarray_test = []\r\n\ttotal = (array_num_total array) + (face_card_total array)\r\n\tace_array = array.select { |item| item[0] == 'A' }\r\n\tarray_test = array.each { |item| item[0] }\r\n\tif (ace_array.length == 1) && (total == 10) \r\n\t total = 21\r\n\t\treturn total\r\n\tend\r\n\tif ace_array.eql?(array_test)\r\n\t total = 10 + ace_array.length\r\n\t\treturn total\r\n\tend\r\n\t while i < ace_array.length\r\n\t\t if total + 11 >= 21\r\n\t\t\t ace_value = 1\r\n\t\t\telse\r\n\t\t\t ace_value = 11\r\n\t\t\tend\r\n total = total + ace_value \r\n\t\t\ti = i + 1\r\n\t\tend\r\n total\r\nend", "def runner\n welcome\n sum_cards=initial_round\n until sum_cards >21 do \n sum_cards = hit?(sum_cards)\n end\n end_game(sum_cards)\nend", "def get_hand_value(hand)\n hand_values = hand.map { |card| card[0]} \n \n total = 0\n #check if there are any Aces\n hand_values.each do |value|\n if value == 'A'\n total += 11\n elsif value.to_i == 0 # this is for J, Q, K\n total += 10\n else\n total += value.to_i\n end\n end\n # To accomodate Aces, subtract 10 from the total per Ace if the total is >21\n hand_values.select{|value| value == \"A\"}.count.times do \n total -= 10 if total >21\n end\n total\nend", "def runner\nwelcome\ncurrent_sum=hit?(initial_round)\ndisplay_card_total(current_sum)\n until current_sum>=21 do\n current_sum=hit?(current_sum)\n end\n end_game(current_sum)\n \n\nend", "def compute_sum_for player\r\n if player == nil || player[:cards] == nil || player[:cards].length == 0\r\n return 0\r\n end\r\n \r\n #Compute initial points\r\n sum = 0\r\n i = 0\r\n \r\n while i < player[:cards].length\r\n card = player[:cards][i]\r\n sum = sum + (card[:face] > 10 ? 10 : ((card[:face] == 1)? 11 : card[:face]))\r\n\ti = i + 1\r\n end\r\n \r\n #Fix the sum if possible, when the points is larger than 21\r\n j = player[:cards].length - 1\r\n while sum > 21 && j >= 0\r\n\tcard = player[:cards][j]\r\n\tif card[:face] == 1 #There is an Ace\r\n\t sum = sum - 11 + 1\r\n\tend\r\n\tj = j - 1\r\n end\r\n\t\r\n sum\r\nend", "def card_scores\n card_scores = {\n \"JOKER\" => 13, \"J♠\" => 12, \"J♣\" => 11, \"A♠\" => 10, \"K♠\" => 9, \"Q♠\" => 8,\n \"10♠\" => 7, \"9♠\" => 6, \"8♠\" => 5, \"7♠\" => 4, \"6♠\" => 3, \"5♠\" => 2\n }\n card_scores.default = 0\n\n card_scores\n end", "def runner\nwelcome\ncard_total = initial_round\nwhile card_total < 21\ncard_total = hit?(card_total)\ndisplay_card_total(card_total)\nend\nend_game(card_total)\nend", "def call_cheat\n if (@score >= 100 and !@cheat)\n @score -= 100\n @cheat = true\n end\n end", "def cheat_on\n if @score >= 100 and @cheat == false\n @cheat = true\n @score -= 100\n end\n end", "def total\n tot = 0\n for card in @cards\n tot += card.value\n end\n if has_ace and tot < 12\n tot2 = tot + 10\n if tot2 > 17\n return tot2\n elsif tot2 == 17\n unless @hit_soft_17\n return tot2\n end\n end\n end\n return tot\n end", "def check_card\r\n double_every_other\r\n @double_array.inject(0) { |initial, number| initial + number.to_i } % 10 == 0\r\n end", "def runner\n welcome\n card_total = initial_round\n while card_total < 21 do\n card_total = hit?(card_total)\n if card_total > 21\n display_card_total(card_total)\n end_game(card_total)\n end\n end\nend", "def hit?(card_total)\n # code hit? here\n\n \nend", "def two_aces\n if player1_score == 22 && cards.value == 11\n puts \"Would you like for Ace to equal 1? Yes or No\"\n userinput == gets.chomp.downcase\n if userinput == \"yes\"\n player1_score - 10\n elsif userinput == \"no\"\n puts \"You busted.\"\n play_again\n else\n puts \"You must pick a a number.\"\n end\n end\n end", "def get_score\n flush = is_flush?\n straight = is_straight?\n pairs = pairs?\n\n return 45 if pairs.size == 1 && pairs[0][1] == 5\n return 44 if flush && straight\n return 31 + pairs[0][0] - 2 if pairs.size == 1 && pairs[0][1] == 4\n return 30 if pairs.size == 2 && (pairs[0][1] + pairs[1][1]) == 5\n return 29 if flush\n return 28 if straight\n return 15 + pairs[0][0] - 2 if pairs.size == 1 && pairs[0][1] == 3\n return 14 if pairs.size == 2\n return 1 + pairs[0][0] - 2 if pairs.size == 1\n -14 + high_card #high card return\n end", "def play_as_master_first\r\n @pending_points = 0\r\n w_cards = []\r\n curr_points_me = @team_mates.inject(0){ |result, name_pl| result + @points_segno[name_pl] }\r\n @cards_on_hand.each do |card_lbl|\r\n card_s = card_lbl.to_s # something like '_Ab'\r\n segno = card_s[2,1] # character with index 2 and string len 1\r\n is_card_lbl_briscola = card_s[2] == @briscola.to_s[2] \r\n curr_w = 0\r\n curr_w += 70 if is_card_lbl_briscola\r\n # check if it is an asso or 3\r\n curr_w += 220 if card_s[1] == \"A\"[0]\r\n curr_w += 200 if card_s[1] == \"3\"[0] \r\n if card_s =~ /[24567]/\r\n # liscio value\r\n lisc_val = (card_s[1] - '0'[0]).to_i\r\n curr_w += 50 + lisc_val\r\n end\r\n curr_w += 60 if card_s[1] == \"F\"[0]\r\n # check horse and king cards\r\n if card_s[1] == \"C\"[0]\r\n if is_mariazz_possible?(segno)\r\n curr_w += 90 + 70\r\n else\r\n curr_w += 30\r\n end\r\n end \r\n if card_s[1] == \"R\"[0]\r\n if is_mariazz_possible?(segno)\r\n curr_w += 100 + 70\r\n else\r\n curr_w += 20\r\n end\r\n end\r\n # penalty for cards wich are not stroz free\r\n curr_w += 10 * @strozzi_on_suite[segno].size\r\n if (curr_points_me + @deck_info.get_card_info(card_lbl)[:points]) > @target_points\r\n curr_w -= (@deck_info.get_card_info(card_lbl)[:points] + 100)\r\n curr_w -= 200 if is_card_lbl_briscola\r\n curr_w -= 1000 if is_card_lbl_briscola and card_s[1] == \"A\"[0]\r\n end\r\n \r\n w_cards << [card_lbl, curr_w ] \r\n end\r\n # find a minimum\r\n #p w_cards\r\n min_list = w_cards.min{|a,b| a[1]<=>b[1]}\r\n @log.debug(\"Play as first: best card#{min_list[0]}, (w_cards = #{w_cards.inspect})\")\r\n return min_list[0]\r\n end", "def decide(hand)\n value(hand) >= 17 && :stand || :hit\nend", "def card_total(hand)\n total = 0\n ace = hand.select {|x| x[0] == 'A'}\n # Calculation of hand without aces.\n if ace == []\n hand.each do |x|\n x = x[0..-2].to_i\n x == 0? total += 10 : total += x\n end\n total\n else\n # Calculation of hand with ace(s)\n # Delete aces from hand array\n ace.each do |a|\n hand.each {|x| hand.delete(a) if x == a}\n end\n # Calculate hand without aces\n hand.each do |x|\n x = x[0..-2].to_i\n x == 0? total += 10 : total += x\n end\n ace.each {|a| hand << a}\n # Add the value of ace(s) to the current total\n nr_ace = ace.length\n case nr_ace\n when 1\n total <= 10? total += 11 : total += 1\n when 2\n total <= 9? total += 12 : total += 2\n when 3\n total <= 8? total += 13 : total += 3\n else\n total <= 7? total += 14 : total += 4\n end\n total \n end\nend", "def runner\n welcome\n total_of_cards = initial_round\n until total_of_cards > 21\n total_of_cards = hit?(total_of_cards)\n display_card_total(total_of_cards)\n end\n end_game(total_of_cards)\nend", "def verify_score(score)\n decimal = (score * 60) % 1\n [decimal, 1 - decimal].min < 0.03\nend", "def calculate_total(cards)\n arr = cards.map{|e| e[1]}\n \n total = 0 \n arr.each do |value|\n if value == \"A\"\n total += 11\n elsif value.to_i == 0\n total += 10 \n else \n total += value.to_i\n end \n end \n \n # Modified the Ace value \n arr.select{|e| e = \"A\"}.count.times do \n total -= 10 if total > 21 \n end \n \n total \nend", "def get_score (cards)\n\t\tscore = 0\n\t\tcards.each do |card|\n\t\t\tmeasure = card[0]\n\t\t\tscore += @score[measure]\n\t\tend\n\t\tscore\n\tend", "def checkforAce(card)\n if card.value = 1\n return true\n else\n return false\n end\n end", "def checkforAce(card)\n if card.value = 1\n return true\n else\n return false\n end\n end", "def value_of_hand(hand)\n collection_of_card_values = hand.collect {|index| index[1]}\n card_values = collection_of_card_values.inject{|sum,next_card| sum + next_card }\n if collection_of_card_values.include?(1) && card_values < 12\n card_values += 10\n end\n card_values\nend", "def determine_hand_value(hand)\n value_hand = hand.map do |x|\n if x.include?(\"Ace\")\n x = 11\n elsif [\"K\", \"Q\", \"J\", \"1\"].include?(x[0])\n x = 10\n else\n x = x[0].to_i\n end\n end\n value_hand = value_hand.inject(0) { |result, element| result + element }\n adjust_value_for_aces(hand, value_hand)\nend", "def runner\n welcome\n card_total=initial_round\n until card_total>21\n card_total=hit?(card_total)\n display_card_total(card_total)\n end\n end_game(card_total)\nend", "def runner\n welcome\n users_hand = initial_round\n card_total = users_hand\n \n until card_total >= 21\n card_total = hit?(card_total)\n display_card_total(card_total)\nend \nend_game(card_total)\nend", "def runner\n welcome\n card_total = initial_round\n until card_total > 21\n card_total =+ hit?(card_total)\n display_card_total(card_total)\n end\n end_game(card_total)\nend", "def runner\nwelcome\ncard_total = initial_round\nuntil card_total >21\n card_total = hit?(card_total)\n display_card_total(card_total)\nend\n end_game(card_total)\nend", "def value \r\n value = 0\r\n @cards.each do |card|\r\n value += card.value\r\n end\r\n if value > 21\r\n value = 0\r\n @cards.each do |card|\r\n if card.value == 11\r\n value += 1\r\n else\r\n value += card.value\r\n end\r\n end\r\n end\r\n value\r\n end", "def runner\n welcome\n current_total = initial_round\n \n \n until current_total >21\n current_total=hit?(current_total)\n display_card_total(current_total)\nend\n end_game(current_total)\n\n end", "def runner\n welcome\n card_sum = initial_round\n \n while card_sum <= 21\n card_sum = hit?(card_sum)\n display_card_total(card_sum)\n end\n \nend_game(card_sum)\n \nend", "def score\n @cards.map(&:value).inject(:+)\n end", "def get_new_card\n \n #Assign a random number between 1 and 13 as the value of the card being \n #created\n card = 1 + rand(13)\n \n #A value of 1 is an ace, so reassign the card a value of 11\n return 11 if card == 1 \n\n #A value of 10 or more equals a face card so reassign the card a value\n #of 10 \n return 10 if card >= 10\n \n return card #Return the value assigned to the new card\n \n end", "def blackjack_rules\n if get_hand_value(@player_hand) > 21\n puts \"Sorry Sir, Your BUST! THE HOUSE WINS\".colorize(:red)\n elsif get_hand_value(@dealer_hand) > 21\n puts \"CONGRATULATIONS HOUSE BUSTED YOU WIN\".colorize(:yellow)\n elsif get_hand_value(@player_hand) == 21\n puts \"BLACKJACK BABY\".colorize(:light_blue)\n elsif get_hand_value(@dealer_hand) == 21\n puts \"BLACKJACK FOR THE HOUSE\".colorize(:red)\n return\n end\n\n if get_hand_value(@player_hand) == get_hand_value(@dealer_hand)\n puts \"THATS A REDRAW, HERE IS YOUR MONEY BACK\".colorize.(:red)\n elsif get_hand_value(@player_hand) > get_hand_value(@dealer_hand)\n puts \"YOU WON HOUSE LOSES, SECURITY THIS GUY IS COUNTING CARDS\".colorize(:magenta)\n elsif get_hand_value(@player_hand) < get_hand_value(@dealer_hand) \n puts \"YOU HAVE LOST AGAIN! GIVE ME THAT MULLAY PLUS A TIP PLEASE\".colorize(:red)\n else\n puts \"Sorry im not sure what happened\".colorize(:red)\n return\n end \nend", "def determine_score\n point1 = @player1.points\n point2 = @player2.points\n\n if point1 > 2 and point2 > 2\n if point1 == point2\n @player1.deuce = true\n @player2.deuce = true\n elsif point1 > point2\n @player1.advantage = true\n elsif point2 > point1\n @player2.advantage = true\n end\n end\n end", "def canAfford?(cost, character)\n return cost <= character.gp\n end", "def has_ace\n for card in @cards\n return 1 if card.is_ace\n end\n return nil\n end", "def runner\n welcome\n cards_total = initial_round\n until cards_total > 21\n cards_total = hit?(cards_total)\n display_card_total(cards_total)\n end\n end_game(cards_total)\nend", "def runner\n welcome\n card_total = initial_round\n while card_total < 21\n card_total = hit?(card_total)\n display_card_total(card_total)\n end\n end_game(card_total)\nend", "def runner\n welcome\n total_cards = initial_round\n until total_cards > 21 do\n total_cards = hit?(total_cards)\n display_card_total(total_cards)\n end\n end_game(total_cards)\nend", "def shouldHit\n # If 17 or above, lock the hand so it cannot receive any more cards\n \tif @hands[0].checkHand > 16 or @hands[0].checkHand < 0\n \t @hands[0].lock\n \tend\n \t@hands[0].canGetCards\n end", "def runner\n welcome\n initial_total = initial_round # prints and returns sum of two cards\n curr_total = hit?(initial_total)\n display_card_total(curr_total)\n until curr_total > 21\n hit?(curr_total)\n curr_total = hit?(curr_total)\n display_card_total(curr_total)\n end\n end_game(curr_total)\nend", "def score_spare\n @total_score += 10 + @rolls[@current_roll + 2]\n @current_roll += 2\n end" ]
[ "0.78671134", "0.75782806", "0.75747365", "0.7501459", "0.7448186", "0.7339252", "0.72493607", "0.7155661", "0.70416915", "0.7010129", "0.69990826", "0.696954", "0.69459033", "0.69375", "0.69259953", "0.69159365", "0.6891451", "0.68762803", "0.6831305", "0.6802142", "0.67605233", "0.6747065", "0.6735769", "0.6720072", "0.67159474", "0.67104304", "0.6645124", "0.66346467", "0.66076404", "0.6598854", "0.6594085", "0.65879893", "0.6583959", "0.65783334", "0.6555743", "0.6535722", "0.65268004", "0.6501822", "0.6494545", "0.64882445", "0.64844674", "0.6481644", "0.64700735", "0.64580745", "0.6453558", "0.6453387", "0.6447075", "0.6446304", "0.6426851", "0.6402496", "0.63938046", "0.6391553", "0.6389078", "0.6384979", "0.63707626", "0.63676286", "0.6359781", "0.63439286", "0.63310695", "0.63304824", "0.632395", "0.6291105", "0.6284856", "0.6284839", "0.6284073", "0.62786007", "0.6269242", "0.6265786", "0.62630206", "0.62523556", "0.6251286", "0.6250946", "0.6246129", "0.62425673", "0.6239237", "0.6236895", "0.6227044", "0.6217418", "0.6217418", "0.6215068", "0.62077546", "0.62074685", "0.6196537", "0.619077", "0.6189762", "0.617463", "0.6174442", "0.61716545", "0.6169358", "0.6164554", "0.61617565", "0.61535156", "0.6143755", "0.61431503", "0.61375153", "0.6136649", "0.6127217", "0.6125317", "0.6124947", "0.61186564" ]
0.77168137
1
GET /dvds/1 GET /dvds/1.xml
def show @dvd = Dvd.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @dvd } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @rdv = Rdv.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rdv }\n end\n end", "def index\n @dvds = Dvd.all\n end", "def show\n @dlog = Dlog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @dlog }\n end\n end", "def index\n @dvrs = Dvr.all\n end", "def index\n @dosages = @drug.dosages\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @dosages }\n end\n end", "def xml(id)\n http.get(\"/nfse/#{id}/xml\") do |response|\n response.headers.fetch(\"Location\") { \"\" }\n end\n end", "def show\n @vehicle_daily = VehicleDaily.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vehicle_daily }\n end\n end", "def dataone_xml_query(vin)\n path = ::File.join(Lynr.root, 'views/admin/vehicle/dataone_request')\n Sly::View::Erb.new(path, data: { vin: vin }).result\n end", "def show\n @dosage = Dosage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @dosage }\n end\n end", "def show\r\n @dcf = Dcf.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @dcf }\r\n end\r\n end", "def show\n @derivative = Derivative.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @derivative }\n end\n end", "def get_datastream( pid, dsID )\n pid.include?(\"druid\") ? pid = pid : pid = \"druid:#{pid}\"\n uri = URI.parse(@fedora + '/objects/' + pid + '/datastreams/' + dsID + '/content') \n RestClient.get(uri.to_s)\n rescue => e\n e.response \n end", "def show\n @dbs_deposit = DbsDeposit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @dbs_deposit }\n end\n end", "def show\n @daily_grr = DailyGrr.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @daily_grr }\n end\n end", "def show\n @etd = Etd.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @etd }\n end\n end", "def show\n @drives = Drives.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @drives }\n end\n end", "def show\n @service_version = ServiceVersion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @service_version }\n end\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 @dl_type = DlType.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @dl_type }\n end\n end", "def show\n @dailyreport = Dailyreport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @dailyreport }\n end\n end", "def show\n @dataset = Dataset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @dataset }\n end\n end", "def show\n @dataset = Dataset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @dataset }\n end\n end", "def show\n @direccion = Direccion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @direccion }\n end\n end", "def get_vdc(vdcId)\n params = {\n 'method' => :get,\n 'command' => \"/vdc/#{vdcId}\"\n }\n\n response, headers = send_request(params)\n description = response.css(\"Description\").first\n description = description.text unless description.nil?\n\n vapps = {}\n response.css(\"ResourceEntity[type='application/vnd.vmware.vcloud.vApp+xml']\").each do |item|\n vapps[item['name']] = item['href'].gsub(\"#{@api_url}/vApp/vapp-\", \"\")\n end\n\n networks = {}\n response.css(\"Network[type='application/vnd.vmware.vcloud.network+xml']\").each do |item|\n networks[item['name']] = item['href'].gsub(\"#{@api_url}/network/\", \"\")\n end\n { :description => description, :vapps => vapps, :networks => networks }\n end", "def show\n @discovery = Discovery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @discovery }\n end\n end", "def show\n @diabetes_consultation = DiabetesConsultation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @diabetes_consultation }\n end\n end", "def index\n @network_dvrs = NetworkDvr.all\n end", "def show\n @docent = Docent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @docent }\n end\n end", "def download_xml\n\t\turi = URI.parse(\"http://www.esmadrid.com/opendata/tiendas_v1_es.xml\")\n\t\tresponse = Net::HTTP.get_response(uri)\n\t\tcontent = response.body\n\n\t\txml = REXML::Document.new(content)\n\n\t\treturn xml\n\tend", "def show\n @tv = Tv.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tv }\n end\n end", "def show\n @domain = Domain.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @domain }\n end\n end", "def show\n @vendedor = Vendedor.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vendedor }\n end\n end", "def show\n @vendedor = Vendedor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vendedor }\n end\n end", "def show\n @download = Download.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @download }\n end\n end", "def show\n @download = Download.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @download }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => current_vurl }\n end\n end", "def show\n\t\t@directory = Directory.find(params[:id])\n\t\t@days = params[:days].blank? ? 31 : params[:days].to_i\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml\t{ render :xml => @directory }\n\t\tend\n\tend", "def show\n @pdig = Pdig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pdig }\n end\n end", "def new\n @dvd = Dvd.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dvd }\n end\n end", "def show\n @dl_attachment = DlAttachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @dl_attachment }\n end\n end", "def show\n @drug = Drug.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @drug }\n end\n end", "def show\n @visit_stat = VisitStat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @visit_stat }\n end\n end", "def show\n @dvd = Dvd.find(params[:id])\n\t\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dvd }\n end\n end", "def show\n @index = SHDM::Index.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @index }\n end\n end", "def show\n @dokter = Dokter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @dokter }\n end\n end", "def api_xml(path,method=:get,options={})\n xml_message(amee,\"/data\"+path,method,options)\n end", "def index\n @dvds = current_user.dvds.order(id: :asc)\n end", "def show\n @department = Department.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @department }\n end\n end", "def show\n @department = Department.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @department }\n end\n end", "def get_vdc(vdc_id,auth=nil, cert=nil)\n\t\trest_get(\"#{@base_url}/vdc/#{vdc_id}\", auth.nil? ? @auth_token : auth, cert.nil? ? @verify_cert : cert)\n\tend", "def show\n @dvd = Dvd.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dvd }\n end\n end", "def show\n @inpatientdailyreport = Inpatientdailyreport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @inpatientdailyreport }\n end\n end", "def show\n @diet = Diet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @diet }\n end\n end", "def show\n\t\t@direccion = Direccion.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml { render :xml => @direccion }\n\t\tend\n\tend", "def show\n @odc_r = OdcR.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @odc_r }\n end\n end", "def show\n @district = District.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @district }\n end\n end", "def show\n @visaapp = Visaapp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @visaapp }\n end\n end", "def show\n @prd_etc = PrdEtc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @prd_etc }\n end\n end", "def show\n @visarequest = Visarequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @visarequest }\n end\n end", "def show\n @budget_src = BudgetSrc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @budget_src }\n end\n end", "def show\n @page_title = \"Data Points\"\n @data_point = DataPoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @data_point }\n end\n end", "def read(id=nil)\r\n request = Net::HTTP.new(@uri.host, @uri.port)\r\n if id.nil?\r\n response = request.get(\"#{@uri.path}.xml\") \r\n else\r\n response = request.get(\"#{@uri.path}/#{id}.xml\") \r\n end\r\n response.body\r\n end", "def show\n @doco = Doco.find(params[:id].to_s)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @doco }\n end\n end", "def show\n @datafeed = Datafeed.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @datafeed }\n end\n end", "def show\r\n Connection.switch_data(params[:connection], \"daily\")\r\n @connections = Connection.find(params[:id])\r\n respond_to do |format|\r\n format.html #show.html.erb\r\n format.xml { render :xml => @connections.to_xml(:root => 'records', :children => 'record', :dasherize => false) }\r\n end\r\n end", "def show\n @velocity_event = VelocityEvent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @velocity_event }\n end\n end", "def show\n @segment_detail = SegmentDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @segment_detail }\n end\n end", "def show\n @bdig = Bdig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bdig }\n end\n end", "def show\n @domino = Domino.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @domino }\n end\n end", "def show\n @cdspp = Cdspp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cdspp }\n end\n end", "def show\n @data_file = DataFile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @data_file }\n end\n end", "def show\n @directory = Directory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @directory }\n \n end\n end", "def show\n @estudio = Estudio.find(params[:id])\n\n respond_to do |format|\n format.xml { render :xml => @estudio }\n end\n end", "def show\r\n @department = Department.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @department }\r\n end\r\n end", "def show\n @draught = Draught.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @draught }\n end\n end", "def show\n @doc = Doc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @doc }\n end\n end", "def show\n @doc = Doc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @doc }\n end\n end", "def show\n @gtd = Gtd.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @gtd }\n end\n end", "def show\n @patient_vaccination = PatientVaccination.find(params[:id]) \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @patient_vaccination }\n end\n end", "def show\n @tm_dev1 = TmDev1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tm_dev1 }\n end\n end", "def show\n @v_netweight = VNetweight.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @v_netweight }\n end\n end", "def show\n @directory = Directory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @directory }\n end\n end", "def show\n @dataed = Dataed.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @dataed }\n format.json { render :json => @dataed }\n end\n end", "def rd2xrds(rdurl)\n r = agent.get_xrds(rdurl)\n validate_response(r)\n Document.new(r.read)\n end", "def show\n @pfs_consultation = PfsConsultation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pfs_consultation }\n end\n end", "def show\n @vlan = Vlan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @vlan }\n end\n end", "def show\n @drive_fixed = DriveFixed.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @drive_fixed }\n end\n end", "def pacscl_xml\n document = Blacklight.default_index.search(q: \"id:#{params[:id]}\")&.dig(\"response\", \"docs\")&.first\n document = SolrDocument.new(document)\n document.suppress_xml_containers!\n respond_to do |format|\n format.xml do\n render xml: document.export_as_xml\n end\n end\n end", "def show\n @detour = Detour.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @detour }\n end\n end", "def show\n @dato = Dato.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @dato }\n end\n end", "def show\n @dato = Dato.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @dato }\n end\n end", "def show\n @consultation = Consultation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @consultation }\n end\n end", "def index\n @eversions = Eversion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @eversions }\n end\n end", "def show\n @distribuidora = Distribuidora.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @distribuidora }\n end\n end", "def ead_download\n _, @document = search_service.fetch(params[:id])\n send_file(\n ead_file_path,\n filename: \"#{params[:id]}.xml\",\n disposition: 'inline',\n type: 'text/xml'\n )\n end", "def show\n @lookup_drugunit = LookupDrugunit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lookup_drugunit }\n end\n end", "def show\n @domicile_type = DomicileType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @domicile_type }\n end\n end", "def show\n @descriptor_especifico = DescriptorEspecifico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @descriptor_especifico }\n end\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 @staffd = Staffd.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @staffd }\n end\n end" ]
[ "0.6586219", "0.6527771", "0.61583924", "0.60927486", "0.60396004", "0.6035867", "0.60275626", "0.6026148", "0.5991765", "0.59882224", "0.5980108", "0.59005886", "0.58782876", "0.58414924", "0.5800586", "0.57904243", "0.5771207", "0.57632154", "0.5751171", "0.57442474", "0.57395774", "0.57395774", "0.5738355", "0.57248604", "0.5711816", "0.5702853", "0.5697906", "0.56932724", "0.56909275", "0.56874484", "0.5678046", "0.5668955", "0.56687343", "0.565933", "0.565933", "0.5654433", "0.5654335", "0.5647729", "0.5644573", "0.5639341", "0.5611713", "0.56058323", "0.559937", "0.5595017", "0.55947274", "0.5593384", "0.55888414", "0.5574455", "0.5574455", "0.5573778", "0.55666614", "0.55499756", "0.5549559", "0.55400026", "0.5535315", "0.5530209", "0.55164665", "0.55120236", "0.5509618", "0.55064774", "0.5506168", "0.55035245", "0.5500451", "0.5500282", "0.5489187", "0.5488239", "0.5486865", "0.54842883", "0.5476153", "0.5474434", "0.5470594", "0.546342", "0.5462121", "0.5461154", "0.54579926", "0.5453022", "0.5453022", "0.5450982", "0.5449573", "0.54454005", "0.54427075", "0.54404294", "0.54360133", "0.5432584", "0.5431532", "0.54301715", "0.5429767", "0.54285294", "0.54233813", "0.54233086", "0.54233086", "0.5422424", "0.5417567", "0.54086435", "0.5408386", "0.53999376", "0.53993577", "0.5396939", "0.5393609", "0.5387714" ]
0.6424875
2
GET /dvds/new GET /dvds/new.xml
def new @dvd = Dvd.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @dvd } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end", "def new\n @pdig = Pdig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pdig }\n end\n end", "def new\n @dbs_deposit = DbsDeposit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dbs_deposit }\n end\n end", "def new\n @dlog = Dlog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dlog }\n end\n end", "def new\n @dossier = Dossier.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dossier }\n end\n end", "def new\r\n @dcf = Dcf.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @dcf }\r\n end\r\n end", "def new\n @dosage = Dosage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dosage }\n end\n end", "def new\n @vendedor = Vendedor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vendedor }\n end\n end", "def new\n @vendedor = Vendedor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vendedor }\n end\n end", "def new\n @tv = Tv.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tv }\n end\n end", "def new\n @etd = Etd.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @etd }\n end\n end", "def new\n @domain = Domain.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @domain }\n end\n end", "def new\n @dl_type = DlType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dl_type }\n end\n end", "def new\n @derivative = Derivative.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @derivative }\n end\n end", "def new\n @vehicle_daily = VehicleDaily.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vehicle_daily }\n end\n end", "def new\n @prd_etc = PrdEtc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prd_etc }\n end\n end", "def new\n @service_version = ServiceVersion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @service_version }\n end\n end", "def new\n @test = TkdTest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @test }\n end\n end", "def new\n @direccion = Direccion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @direccion }\n end\n end", "def new\n @docent = Docent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @docent }\n end\n end", "def new\n @diet = Diet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @diet }\n end\n end", "def new\n @draught = Draught.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @draught }\n end\n end", "def new\n @drug = Drug.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @drug }\n end\n end", "def new_rest\n @instrument_version = InstrumentVersion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instrument_version }\n end\n end", "def new\n @query = Query.new\n @discActions = DiscoveryActions.new\n $DATA_SERVICES ||= @discActions.getDataServices\n @services = $DATA_SERVICES\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @query }\n end\n end", "def new\n @domino = Domino.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @domino }\n end\n end", "def new\n @dokter = Dokter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dokter }\n end\n end", "def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "def new\n @daily_grr = DailyGrr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @daily_grr }\n end\n end", "def new\n @discovery = Discovery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @discovery }\n end\n end", "def new\n @district = District.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @district }\n end\n end", "def new\n @visarequest = Visarequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @visarequest }\n end\n end", "def new\n @bdig = Bdig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bdig }\n end\n end", "def new\n @drives = Drives.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @drives }\n end\n end", "def new\n @vtodo = Vtodo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vtodo }\n end\n end", "def new\n @visaapp = Visaapp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @visaapp }\n end\n end", "def new\n @rdv = Rdv.new\n if(!params[:patient_id].nil?)\n @rdv.patient = Patient.find(params[:patient_id])\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rdv }\n end\n end", "def new\n @department = Department.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @department }\n end\n end", "def new\n @department = Department.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @department }\n end\n end", "def new\n @dailyreport = Dailyreport.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dailyreport }\n end\n end", "def new\n @datafeed = Datafeed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @datafeed }\n end\n end", "def new\n @segment = Segment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @segment }\n end\n end", "def new\n @dato = Dato.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dato }\n end\n end", "def new\n @dato = Dato.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dato }\n end\n end", "def new\n @entity_datum = EntityDatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entity_datum }\n end\n end", "def new\n @lookup_drugunit = LookupDrugunit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_drugunit }\n end\n end", "def new\n @domain = DOMAIN.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @domain }\n end\n end", "def new\n @ptid = Ptid.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ptid }\n end\n end", "def new\n @doc = Doc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @doc }\n end\n end", "def new\n respond_to do |format|\n format.html\n format.xml\n end\n end", "def new\n @dogpark = Dogpark.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dogpark }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml \n end\n end", "def new\n @segment_detail = SegmentDetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @segment_detail }\n end\n end", "def new\n @download = Download.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @download }\n end\n end", "def new\n @download = Download.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @download }\n end\n end", "def create\n @rdv = Rdv.new(params[:rdv])\n\n respond_to do |format|\n if @rdv.save\n format.html { redirect_to(@rdv, :notice => 'Rendez-vous créé') }\n format.xml { render :xml => @rdv, :status => :created, :location => @rdv }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @rdv.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @directory = Directory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @directory }\n end\n end", "def new\n @directory = Directory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @directory }\n end\n end", "def new\n @data_set = DataSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @data_set }\n end\n end", "def new\n @cdspp = Cdspp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cdspp }\n end\n end", "def new\n @dataset = Dataset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dataset }\n end\n end", "def new\n @dataset = Dataset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dataset }\n end\n end", "def new\n @design_detail_data_point = DesignDetailDataPoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @design_detail_data_point }\n end\n end", "def new\n @pfs_consultation = PfsConsultation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pfs_consultation }\n end\n end", "def new\n @nad = Nad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nad }\n end\n end", "def new\n @ep = Ep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ep }\n end\n end", "def new\n @visit_stat = VisitStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @visit_stat }\n end\n end", "def new\n @dvd = Dvd.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dvd }\n end\n end", "def new\n @gtd = Gtd.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @gtd }\n end\n end", "def new\n @novel = Novel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @novel }\n end\n end", "def new\n @tdoc = Tdoc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tdoc }\n end\n end", "def new\n @novidade = Novidade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @novidade }\n end\n end", "def new\n @prd_threshold = PrdThreshold.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prd_threshold }\n end\n end", "def new\n @vegetable = Vegetable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vegetable }\n end\n end", "def new\n @vlan = Vlan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @vlan }\n end\n end", "def new\n @v_netweight = VNetweight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @v_netweight }\n end\n end", "def new\n logger.debug 'new_some interesting information'\n @comdty = Comdty.new\n setvariables\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comdty }\n end\n end", "def new\n @service = Service.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml\n end\n end", "def new\n @diabetes_consultation = DiabetesConsultation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @diabetes_consultation }\n end\n end", "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @software }\n end\n end", "def new\n @odc_r = OdcR.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @odc_r }\n end\n end", "def new\n @distribuidora = Distribuidora.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @distribuidora }\n end\n end", "def new\n @revendedor = Revendedor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @revendedor }\n end\n end", "def new\n @url_migration = UrlMigration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @url_migration }\n end\n end", "def new\n @fixed_deposit = FixedDeposit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @fixed_deposit }\n end\n end", "def new\n @cd_page = CdPage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cd_page }\n end\n end", "def new\n @diaper_change = DiaperChange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @diaper_change }\n end\n end", "def new\n @tstat = Tstat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tstat }\n end\n end", "def new\n @vlan_detail = VlanDetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vlan_detail }\n end\n end", "def new\n @old_point_tag = OldPointTag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @old_point_tag }\n end\n end", "def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "def new\n @tso = Tso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tso }\n end\n end", "def new\n @consultation = Consultation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @consultation }\n end\n end", "def new\n @domicile_type = DomicileType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @domicile_type }\n end\n end", "def new\n @nossos_servico = NossosServico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nossos_servico }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @show }\n end\n end", "def new\n @segmento = Segmento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @segmento }\n end\n end", "def new\n\t\t@direccion = Direccion.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml { render :xml => @direccion }\n\t\tend\n\tend", "def new\n @rede = Rede.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rede }\n end\n end" ]
[ "0.7429372", "0.6814892", "0.6732278", "0.6720067", "0.6705508", "0.6691929", "0.668242", "0.66818345", "0.66818345", "0.6681061", "0.66394335", "0.66275203", "0.6624707", "0.66233355", "0.65573037", "0.6549791", "0.65289134", "0.6521459", "0.65106595", "0.6474533", "0.64609617", "0.6459839", "0.64585435", "0.6446482", "0.64364725", "0.64328945", "0.6428097", "0.64240783", "0.6424059", "0.64233065", "0.6413036", "0.64118016", "0.63978696", "0.6393739", "0.6389668", "0.63866735", "0.63775784", "0.6376969", "0.6376969", "0.63736635", "0.6371078", "0.63694376", "0.6368618", "0.6368618", "0.63564134", "0.63502777", "0.6345107", "0.6334437", "0.63327193", "0.6330148", "0.63217926", "0.6320521", "0.6319557", "0.6309701", "0.6309701", "0.6307483", "0.6303712", "0.6303712", "0.6302259", "0.62968844", "0.629653", "0.629653", "0.6285806", "0.6281836", "0.6281381", "0.62813276", "0.62812096", "0.626704", "0.626613", "0.6264707", "0.62624264", "0.6262208", "0.6257586", "0.62557864", "0.6253304", "0.62520945", "0.625005", "0.6249072", "0.62477946", "0.6238405", "0.62383866", "0.62317866", "0.62306046", "0.62266874", "0.6224941", "0.6219436", "0.621846", "0.62099755", "0.62086564", "0.62061274", "0.62039423", "0.62039423", "0.6201545", "0.61997575", "0.6197011", "0.61949307", "0.61887527", "0.61825824", "0.6180341", "0.6177696" ]
0.7042849
1
POST /dvds POST /dvds.xml
def create @dvd = Dvd.new(params[:dvd]) @dvd.userid = "" @dvd.verliehen = 0 respond_to do |format| if @dvd.save format.html { redirect_to(@dvd, :notice => 'Dvd erfolgreich erstellt.') } format.xml { render :xml => @dvd, :status => :created, :location => @dvd } else format.html { render :action => "new" } format.xml { render :xml => @dvd.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end", "def create\n @dvr = Dvr.new(dvr_params)\n\n respond_to do |format|\n if @dvr.save\n format.html { redirect_to @dvr, notice: 'Dvr was successfully created.' }\n format.json { render :show, status: :created, location: @dvr }\n else\n format.html { render :new }\n format.json { render json: @dvr.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ddc = Ddc.new(ddc_params)\n\n respond_to do |format|\n if @ddc.save\n format.html { redirect_to @ddc, notice: 'Ddc was successfully created.' }\n format.json { render :show, status: :created, location: @ddc }\n else\n format.html { render :new }\n format.json { render json: @ddc.errors, status: :unprocessable_entity }\n end\n end\n end", "def ddc_params\n params.require(:ddc).permit(:name, :description, :reference_url, :json, :examples)\n end", "def create\n @dn = Dn.new(dn_params)\n\n respond_to do |format|\n if @dn.save\n format.html { redirect_to @dn, notice: 'Dn was successfully created.' }\n format.json { render :show, status: :created, location: @dn }\n else\n format.html { render :new }\n format.json { render json: @dn.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @dvds = Dvd.all\n end", "def create\n @rdv = Rdv.new(params[:rdv])\n\n respond_to do |format|\n if @rdv.save\n format.html { redirect_to(@rdv, :notice => 'Rendez-vous créé') }\n format.xml { render :xml => @rdv, :status => :created, :location => @rdv }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @rdv.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post_xml(url, ls_data)\n uri = URI.parse(url)\n request = Net::HTTP::Post.new(uri.request_uri, HEADER_XML)\n request.body = ls_data\n request.basic_auth(@nsx_user, @nsx_password)\n response = Net::HTTP.start(uri.host, uri.port, :use_ssl => true,\n :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |https|\n https.request(request)\n end\n return response.body if check_response(response, 201)\n end", "def dvr_params\n params.require(:dvr).permit(:modelo, :canais, :cameras, :entradas, :saidas)\n end", "def create\n @etd = Etd.new(params[:etd])\n\n respond_to do |format|\n if @etd.save\n flash[:notice] = 'Etd was successfully created.'\n format.html { redirect_to(@etd) }\n format.xml { render :xml => @etd, :status => :created, :location => @etd }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @etd.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @network_dvr = NetworkDvr.new(network_dvr_params)\n\n respond_to do |format|\n if @network_dvr.save\n format.html { redirect_to @network_dvr, notice: 'Network dvr was successfully created.' }\n format.json { render :show, status: :created, location: @network_dvr }\n else\n format.html { render :new }\n format.json { render json: @network_dvr.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dovetest = Dovetest.new(dovetest_params)\n\n respond_to do |format|\n if @dovetest.save\n format.html { redirect_to @dovetest, notice: 'Dovetest was successfully created.' }\n format.json { render :show, status: :created, location: @dovetest }\n else\n format.html { render :new }\n format.json { render json: @dovetest.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ssd = Ssd.new(ssd_params)\n\n respond_to do |format|\n if @ssd.save\n format.html { redirect_to ssds_url }\n else\n format.html { render :new }\n end\n end\n end", "def create\n @dte = Dte.new(dte_params)\n\n respond_to do |format|\n if @dte.save\n format.html { redirect_to @dte, notice: 'Dte was successfully created.' }\n format.json { render :show, status: :created, location: @dte }\n else\n format.html { render :new }\n format.json { render json: @dte.errors, status: :unprocessable_entity }\n end\n end\n end", "def solicitar_lista_entregas_pdd pdd,kind,start_time,end_time\n require \"rubygems\"\n require 'json'\n require \"net/http\"\n require 'yaml'\n \n \n uri=URI( 'http://162.243.215.24/PDV/PDD_list_deliveries')\n \n resp = Net::HTTP.post_form(uri,'pddid'=>pdd,'kind'=>kind,'startime'=>start_time,'endtime'=>end_time,'token'=>\"mentira\")\n @record=JSON.parse(resp.body)\n @record\n #função ok\n \n end", "def create\r\n @dcf = Dcf.new(params[:dcf])\r\n\r\n respond_to do |format|\r\n if @dcf.save\r\n flash[:notice] = 'Dcf was successfully created.'\r\n format.html { redirect_to(@dcf) }\r\n format.xml { render :xml => @dcf, :status => :created, :location => @dcf }\r\n else\r\n format.html { render :action => \"new\" }\r\n format.xml { render :xml => @dcf.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @dvd = Dvd.new(params[:dvd])\n\n respond_to do |format|\n if @dvd.save\n format.html { redirect_to @dvd, notice: 'Dvd was successfully created.' }\n format.json { render json: @dvd, status: :created, location: @dvd }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dvd.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dvd = Dvd.new(params[:dvd])\n\n respond_to do |format|\n if @dvd.save\n format.html { redirect_to @dvd, notice: 'Dvd was successfully created.' }\n format.json { render json: @dvd, status: :created, location: @dvd }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dvd.errors, status: :unprocessable_entity }\n end\n end\n end", "def to_wddx\n s = WDDX::Serializer::Serializer.new \n s.add_var self\n s.to_xml\n end", "def create_dvs(switch_name, pnics, mtu=1500)\n # Prepare spec for DVS creation\n spec = RbVmomi::VIM::DVSCreateSpec.new\n spec.configSpec = RbVmomi::VIM::VMwareDVSConfigSpec.new\n spec.configSpec.name = switch_name\n\n # Specify number of uplinks port for dpg\n if pnics\n pnics = pnics.split(\",\")\n if !pnics.empty?\n spec.configSpec.uplinkPortPolicy = RbVmomi::VIM::DVSNameArrayUplinkPortPolicy.new\n spec.configSpec.uplinkPortPolicy.uplinkPortName = []\n (0..pnics.size-1).each { |index|\n spec.configSpec.uplinkPortPolicy.uplinkPortName[index]=\"dvUplink#{index+1}\"\n }\n end\n end\n\n #Set maximum MTU\n spec.configSpec.maxMtu = mtu\n\n # The DVS must be created in the networkFolder of the datacenter\n begin\n dvs_creation_task = @item.networkFolder.CreateDVS_Task(:spec => spec)\n dvs_creation_task.wait_for_completion\n\n # If task finished successfuly we rename the uplink portgroup\n dvs = nil\n if dvs_creation_task.info.state == 'success'\n dvs = dvs_creation_task.info.result\n dvs.config.uplinkPortgroup[0].Rename_Task(:newName => \"#{switch_name}-uplink-pg\").wait_for_completion\n else\n raise \"The Distributed vSwitch #{switch_name} could not be created. \"\n end\n rescue Exception => e\n raise e\n end\n\n @net_rollback << {:action => :delete_dvs, :dvs => dvs, :name => switch_name}\n\n return VCenterDriver::DistributedVirtualSwitch.new(dvs, @vi_client)\n end", "def new\n @dvd = Dvd.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dvd }\n end\n end", "def create\n @vendedor = Vendedor.new(params[:vendedor])\n respond_to do |format|\n if @vendedor.save\n flash[:notice] = 'Vendedor was successfully created.'\n format.html { redirect_to(@vendedor) }\n format.xml { render :xml => @vendedor, :status => :created, :location => @vendedor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @vendedor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @vendedor = Vendedor.new(params[:vendedor])\n\n respond_to do |format|\n if @vendedor.save\n flash[:notice] = 'Vendedor was successfully created.'\n format.html { redirect_to(@vendedor) }\n format.xml { render :xml => @vendedor, :status => :created, :location => @vendedor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @vendedor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def delete_vdid_with_http_info(dtid, vdid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: WhitelistingApi.delete_vdid ...\"\n end\n # verify the required parameter 'dtid' is set\n fail ArgumentError, \"Missing the required parameter 'dtid' when calling WhitelistingApi.delete_vdid\" if dtid.nil?\n # verify the required parameter 'vdid' is set\n fail ArgumentError, \"Missing the required parameter 'vdid' when calling WhitelistingApi.delete_vdid\" if vdid.nil?\n # resource path\n local_var_path = \"/devicetypes/{dtid}/whitelist/{vdid}\".sub('{format}','json').sub('{' + 'dtid' + '}', dtid.to_s).sub('{' + 'vdid' + '}', vdid.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['artikcloud_oauth']\n data, status_code, headers = @api_client.call_api(:DELETE, 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 => 'WhitelistEnvelope')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: WhitelistingApi#delete_vdid\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @dbs_deposit = DbsDeposit.new(params[:dbs_deposit])\n\n respond_to do |format|\n if @dbs_deposit.save\n format.html { redirect_to(@dbs_deposit, :notice => 'DbsDeposit was successfully created.') }\n format.xml { render :xml => @dbs_deposit, :status => :created, :location => @dbs_deposit }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @dbs_deposit.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post\n response = HTTParty.post(servlet_url,\n :body => to_xml,\n :headers => { 'Content-Type' => 'application/xml' }\n ).response\n\n return Dhl::Shipment::Response.new(response.body)\n rescue Exception => e\n request_xml = if @to_xml.to_s.size>0\n @to_xml\n else\n '<not generated at time of error>'\n end\n\n response_body = if (response && response.body && response.body.to_s.size > 0)\n response.body\n else\n '<not received at time of error>'\n end\n\n log_level = if e.respond_to?(:log_level)\n e.log_level\n else\n :critical\n end\n\n log_request_and_response_xml(log_level, e, request_xml, response_body )\n raise e\n end", "def solicitar_lista_vendas_cell_pdv pdv,start_time,end_time\n require \"rubygems\"\n require 'json'\n require \"net/http\"\n require 'yaml'\n \n uri=URI( 'http://162.243.215.24/PDV/PDV_get_cell_sales')\n \n resp = Net::HTTP.post_form(uri,'pdvid'=>pdv,'starttime'=>start_time,'endtime'=>end_time,'token'=>\"mentira\")\n @record=JSON.parse(resp.body)\n @record\n #função ok\n \n end", "def put_datastream(pid, dsID, xml)\n uri = URI.parse(@fedora + '/objects/' + pid + '/datastreams/' + dsID ) \n RestClient.put(uri.to_s, xml, :content_type => \"application/xml\")\n rescue => e\n e.response \n end", "def create\n @pdig = Pdig.new(params[:pdig])\n\n respond_to do |format|\n if @pdig.save\n flash[:notice] = 'Pdig was successfully created.'\n format.html { redirect_to(@pdig) }\n format.xml { render :xml => @pdig, :status => :created, :location => @pdig }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @pdig.errors, :status => :unprocessable_entity }\n end\n end\n end", "def postEntityDocument( entity_id, name, filedata)\n params = Hash.new\n params['entity_id'] = entity_id\n params['name'] = name\n params['filedata'] = filedata\n return doCurl(\"post\",\"/entity/document\",params)\n end", "def dvd_result_params\n params.fetch(:dvd_result, {}).permit(:id, :form, :form_name, :openid, :created_at, :updated_at, :data_type, :entry => {})\n end", "def post_query( xml )\n url = URI.parse( self.url )\n response = self.http.post_form( url, { \"query\" => xml } )\n return response.body\n end", "def post(uri, xml)\r\n req = Net::HTTP::Post.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def post(url_variables:, body:)\n ensure_service_document\n\n end", "def POST; end", "def dte_params\n params.require(:dte).permit(:folio, :rut_receptor, :rut_emisor, :msg_type, :setdte_id, :dte_type, :fecha_emision, :fecha_recepcion, :account_id, :message_id)\n end", "def create\n @dlog = Dlog.new(params[:dlog])\n\n respond_to do |format|\n if @dlog.save\n format.html { redirect_to(@dlog, :notice => 'Dlog was successfully created.') }\n format.xml { render :xml => @dlog, :status => :created, :location => @dlog }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @dlog.errors, :status => :unprocessable_entity }\n end\n end\n end", "def destroy\n @dvd = Dvd.find(params[:id])\n @dvd.destroy\n\n respond_to do |format|\n format.html { redirect_to(dvds_url) }\n format.xml { head :ok }\n end\n end", "def dnc_params\n params.require(:dnc).permit(:terrid, :number, :street, :name, :publisher, :date, :notes, :terrtype, :redirid)\n end", "def create\n @dex = Dex.new(dex_params)\n\n respond_to do |format|\n if @dex.save\n format.html { redirect_to @dex, notice: 'Dex was successfully created.' }\n format.json { render :show, status: :created, location: @dex }\n else\n format.html { render :new }\n format.json { render json: @dex.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dapi = Dapi.new(dapi_params)\n\n respond_to do |format|\n if @dapi.save\n format.html { redirect_to @dapi, notice: 'Dapi was successfully created.' }\n format.json { render :show, status: :created, location: @dapi }\n else\n format.html { render :new }\n format.json { render json: @dapi.errors, status: :unprocessable_entity }\n end\n end\n end", "def to_sdd_xml\n # Take care of a few global configs before generating the xml:\n # generate constructions from library ids\n generate_constructions\n\n # generate SHW references on spaces\n connect_shw\n\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.send(:SDDXML) do\n xml.send(:Proj) do\n self.class.xml_fields.each do |field|\n xml.send(:\"#{field[:xml_field_name]}\", self[field[:db_field_name]]) if self[field[:db_field_name]]\n end\n\n # set some hard coded values which are not fields\n xml.send(:CreateDate, created_at.to_i)\n\n # Don't default these as they raise warnings and will stop the cbecc engine from producing the compliance report\n # xml.send(:ExcptCondFanPress, 'No')\n # xml.send(:ExcptCondWCC, 'No')\n xml.send(:AutoHardSize, 1)\n xml.send(:AutoEffInput, 1)\n\n # TODO: need to include analysis type and software version here too? (required per SDD inputs)\n\n # go through children if they have something to add, call their methods\n kids = self.class.children_models\n unless kids.nil? || kids.empty?\n kids.each do |k|\n if k[:model_name] == 'building'\n unless building.nil?\n building.to_sdd_xml(k, xml)\n end\n else\n models = send(k[:model_name].pluralize)\n models.each do |m|\n m.to_sdd_xml(k, xml)\n end\n end\n end\n end\n end\n end\n end\n builder.to_xml\n end", "def create\n @dte_direction = DteDirection.new(dte_direction_params)\n\n respond_to do |format|\n if @dte_direction.save\n format.html { redirect_to @dte_direction, notice: 'Dte direction was successfully created.' }\n format.json { render :show, status: :created, location: @dte_direction }\n else\n format.html { render :new }\n format.json { render json: @dte_direction.errors, status: :unprocessable_entity }\n end\n end\n end", "def dhcpd\n ensure_authenticated!\n allow :put\n\n unless request.content_type == 'application/json'\n raise UnsupportedMediaType, request.content_type\n end\n\n if params[:vlan].nil? || params[:vlan][:action].nil? ||\n (params[:vlan][:action] != 'start' &&\n params[:vlan][:action] != 'stop')\n raise UnprocessableEntity, \"An action ('start' or 'stop') should be provided\"\n end\n\n @kavlan.dhcpd(params[:id], params[:vlan])\n\n render plain: '',\n status: 204\n end", "def create\n @dj = Dj.new(dj_params)\n if @dj.save\n respond_with @dj, status: :created\n else\n respond_with @dj, status: :unprocessable_entity\n end\n end", "def post_request(path, params={}, options={})\n request(:post, path, params, options)\n end", "def dvar()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::Dvar::DvarRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def post endpoint, data\n do_request :post, endpoint, data\n end", "def create\n @drives = Drives.new(params[:drives])\n\n respond_to do |format|\n if @drives.save\n flash[:notice] = 'Drives was successfully created.'\n format.html { redirect_to(@drives) }\n format.xml { render :xml => @drives, :status => :created, :location => @drives }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @drives.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_dvr\n @dvr = Dvr.find(params[:id])\n end", "def create\n @dosage = Dosage.new(params[:dosage])\n\n respond_to do |format|\n if @dosage.save\n format.html { redirect_to(@dosage, :notice => 'Dosage was successfully created.') }\n format.xml { render :xml => @dosage, :status => :created, :location => @dosage }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @dosage.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @derp = Derp.new(derp_params)\n\n respond_to do |format|\n if @derp.save\n format.html { redirect_to @derp, notice: 'Derp was successfully created.' }\n format.json { render :show, status: :created, location: @derp }\n else\n format.html { render :new }\n format.json { render json: @derp.errors, status: :unprocessable_entity }\n end\n end\n end", "def post #:doc:\n end", "def dvar_p()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::DvarP::DvarPRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def dvd_params\n params.require(:dvd).permit(:format)\n end", "def rd2xrds(rdurl)\n r = agent.get_xrds(rdurl)\n validate_response(r)\n Document.new(r.read)\n end", "def submit_dispute_evidence_with_http_info(dispute_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DisputesApi.submit_dispute_evidence ...'\n end\n # verify the required parameter 'dispute_id' is set\n if @api_client.config.client_side_validation && dispute_id.nil?\n fail ArgumentError, \"Missing the required parameter 'dispute_id' when calling DisputesApi.submit_dispute_evidence\"\n end\n pattern = Regexp.new(/^(dsp)_(\\w{26})$/)\n if @api_client.config.client_side_validation && dispute_id !~ pattern\n fail ArgumentError, \"invalid value for 'dispute_id' when calling DisputesApi.submit_dispute_evidence, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/disputes/{dispute_id}/evidence'.sub('{' + 'dispute_id' + '}', CGI.escape(dispute_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type]\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['ApiSecretKey']\n\n new_options = opts.merge(\n :operation => :\"DisputesApi.submit_dispute_evidence\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DisputesApi#submit_dispute_evidence\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create(name=\"Default Name\", age=\"50\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <name>#{name}</name>\r\n <age>#{age}</age>\r\n </person>\"\r\n \r\n request = Net::HTTP::Post.new(@url)\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n \r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n response.body \r\n end", "def download_xml\n\t\turi = URI.parse(\"http://www.esmadrid.com/opendata/tiendas_v1_es.xml\")\n\t\tresponse = Net::HTTP.get_response(uri)\n\t\tcontent = response.body\n\n\t\txml = REXML::Document.new(content)\n\n\t\treturn xml\n\tend", "def set_dovetest\n @dovetest = Dovetest.find(params[:id])\n end", "def create\n @estado_dc = EstadoDc.new(estado_dc_params)\n\n respond_to do |format|\n if @estado_dc.save\n format.html { redirect_to @estado_dc, notice: 'Estado dc was successfully created.' }\n format.json { render :show, status: :created, location: @estado_dc }\n else\n format.html { render :new }\n format.json { render json: @estado_dc.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @deed = Deed.create(deed_params)\n\n if @deed.save\n render json: @deed, status: :created, location: @deed\n else\n render json: @deed.errors, status: :unprocessable_entity\n end\n end", "def depense_params\n params.require(:depense).permit(:title, :value, :date, :checked)\n end", "def post(url, post_vars={})\n send_request url, post_vars, 'POST'\n end", "def update_dvs(dvs, pnics, mtu)\n # Prepare spec for DVS creation\n spec = RbVmomi::VIM::VMwareDVSConfigSpec.new\n changed = false\n\n orig_spec = RbVmomi::VIM::VMwareDVSConfigSpec.new\n orig_spec.maxMtu = dvs['config.maxMtu']\n orig_spec.uplinkPortPolicy = RbVmomi::VIM::DVSNameArrayUplinkPortPolicy.new\n orig_spec.uplinkPortPolicy.uplinkPortName = []\n (0..dvs['config.uplinkPortgroup'].length-1).each { |index|\n orig_spec.uplinkPortPolicy.uplinkPortName[index]=\"dvUplink#{index+1}\"\n }\n\n # Add more uplinks to default uplink port group according to number of pnics\n if pnics\n pnics = pnics.split(\",\")\n if !pnics.empty? && dvs['config.uplinkPortgroup'].length != pnics.size\n spec.uplinkPortPolicy = RbVmomi::VIM::DVSNameArrayUplinkPortPolicy.new\n spec.uplinkPortPolicy.uplinkPortName = []\n (dvs['config.uplinkPortgroup'].length..num_pnics-1).each { |index|\n spec.uplinkPortPolicy.uplinkPortName[index]=\"dvUplink#{index+1}\"\n }\n changed = true\n end\n end\n\n #Set maximum MTU\n if mtu != dvs['config.maxMtu']\n spec.maxMtu = mtu\n changed = true\n end\n\n # The DVS must be created in the networkFolder of the datacenter\n if changed\n spec.configVersion = dvs['config.configVersion']\n\n begin\n dvs.item.ReconfigureDvs_Task(:spec => spec).wait_for_completion\n rescue Exception => e\n raise \"The Distributed switch #{dvs['name']} could not be updated. \"\\\n \"Reason: #{e.message}\"\n end\n\n @net_rollback << {:action => :update_dvs, :dvs => dvs.item, :name => dvs['name'], :spec => orig_spec}\n end\n end", "def post_config(url_prefix, xml)\n post_data(url_prefix, xml, 'application/xml;charset=UTF-8')\n end", "def derp_params\n params.require(:derp).permit(:title, :derp)\n end", "def ems_datum_params\n params.require(:ems_datum).permit(:tagname, :value, :group)\n end", "def do_submission(path, xml = nil)\n if xml.nil?\n form = create(:form, question_types: %w(integer integer))\n form.publish!\n xml = build_odk_submission(form)\n end\n\n # write xml to file\n require 'fileutils'\n FileUtils.mkpath('test/fixtures')\n fixture_file = Rails.root.join('test/fixtures/', ODK_XML_FILE)\n File.open(fixture_file.to_s, 'w') { |f| f.write(xml) }\n\n # Upload and do request.\n uploaded = fixture_file_upload(fixture_file, 'text/xml')\n post(path, {:xml_submission_file => uploaded, :format => 'xml'}, 'HTTP_AUTHORIZATION' => encode_credentials(@user.login, 'password'))\n assigns(:response)\n end", "def create\n @dvd = Dvd.new(dvd_params)\n @dvd.user = current_user\n\n respond_to do |format|\n if @dvd.save\n format.html { redirect_to dvds_path, notice: 'Medium was successfully created.' }\n format.json { render :show, status: :created, location: @dvd }\n else\n format.html { render :new }\n format.json { render json: @dvd.errors, status: :unprocessable_entity }\n end # End if @dvd.save\n end # End respond_to do\n end", "def index\n @dosages = @drug.dosages\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @dosages }\n end\n end", "def new\n @pdig = Pdig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pdig }\n end\n end", "def create\n @method_sdm = MethodSdm.new(method_sdm_params)\n\n respond_to do |format|\n if @method_sdm.save\n format.html { redirect_to @method_sdm, notice: 'Method sdm was successfully created.' }\n format.json { render :show, status: :created, location: @method_sdm }\n else\n format.html { render :new }\n format.json { render json: @method_sdm.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(path, params={})\n signature_params = params.values.any?{|value| value.respond_to?(:to_io)} ? {} : params\n request(:post, path, params.to_xml, signature_params)\n end", "def new\r\n @dcf = Dcf.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @dcf }\r\n end\r\n end", "def index\n @dvrs = Dvr.all\n end", "def dataone_xml_query(vin)\n path = ::File.join(Lynr.root, 'views/admin/vehicle/dataone_request')\n Sly::View::Erb.new(path, data: { vin: vin }).result\n end", "def create\n @district = District.new(params[:district])\n\n respond_to do |format|\n if @district.save\n flash[:notice] = 'District was successfully created.'\n format.html { redirect_to(@district) }\n format.xml { render :xml => @district, :status => :created, :location => @district }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @district.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_dte\n @dte = Dte.find(params[:id])\n end", "def post(path, options={})\n request :post, path, options\n end", "def dst_dev_p()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::DstDevP::DstDevPRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def create\n @dokter = Dokter.new(params[:dokter])\n\n respond_to do |format|\n if @dokter.save\n format.html { redirect_to(:action => \"index\", :notice => CREATE_MSG) }\n format.xml { render :xml => @dokter, :status => :created, :location => @dokter }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @dokter.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post(method, params = {})\n url = make_url method, params\n query = url.query\n url.query = nil\n\n req = Net::HTTP::Post.new url.path\n req.body = query\n req.content_type = 'application/x-www-form-urlencoded'\n\n res = Net::HTTP.start url.host, url.port do |http|\n http.request req\n end\n\n xml = Nokogiri::XML(res.body, nil, nil, 0)\n\n check_error xml\n\n parse_response xml\n rescue SystemCallError, SocketError, Timeout::Error, IOError,\n Nokogiri::XML::SyntaxError => e\n raise CommunicationError.new(e)\n rescue Net::HTTPError => e\n xml = Nokogiri::XML(e.res.body) { |cfg| cfg.strict }\n check_error xml\n raise CommunicationError.new(e)\n end", "def create\n @test = TkdTest.new(params[:tkd_test])\n\n respond_to do |format|\n if @test.save\n format.html { redirect_to(:back, :notice => 'Test was successfully created.') }\n format.xml { render :xml => @test, :status => :created, :location => @test }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @test.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def rsvp_post(options = {})\n\n #add access token if it exists\n url = \"\"\n if options[:access_token]\n #url = \"https://api.meetup.com/2/rsvp?access_token=#{options[:access_token]}\"\n url = \"https://api.meetup.com/2/rsvp.json\"\n\n else\n url = \"https://api.meetup.com/2/rsvp\"\n end\n\n puts \"url posting is #{url}\"\n\n response = post_response(url,options)\n\n if response == \"OK\"\n puts \"rsvp ok\"\n else\n puts response.to_yaml\n end\n end", "def create\n @cdspp = Cdspp.new(params[:cdspp])\n\n respond_to do |format|\n if @cdspp.save\n format.html { redirect_to(@cdspp, :notice => 'Cdspp was successfully created.') }\n format.xml { render :xml => @cdspp, :status => :created, :location => @cdspp }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @cdspp.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @dtest = Dtest.new(params[:dtest])\n\n respond_to do |format|\n if @dtest.save\n format.html { redirect_to @dtest, notice: t(:notise_test) }\n format.json { render json: @dtest, status: :created, location: @dtest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dtest.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(uri, options = T.unsafe(nil)); end", "def update\n respond_to do |format|\n if @dvr.update(dvr_params)\n format.html { redirect_to @dvr, notice: 'Dvr was successfully updated.' }\n format.json { render :show, status: :ok, location: @dvr }\n else\n format.html { render :edit }\n format.json { render json: @dvr.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @district = city.districts.build(params[:district])\n\n respond_to do |format|\n if @district.save\n format.html { redirect_to(admin_city_district_url(city, @district), :notice => 'District was successfully created.') }\n #format.xml { render :xml => @district, :status => :created, :location => @district }\n else\n format.html { render :action => \"new\" }\n #format.xml { render :xml => @district.errors, :status => :unprocessable_entity }\n end\n end\n end", "def destroy\n @rdv = Rdv.find(params[:id])\n @rdv.destroy\n\n respond_to do |format|\n format.html { redirect_to(rdvs_url) }\n format.xml { head :ok }\n end\n end", "def devolution_params\n params.require(:devolution).permit(:carrier_id, :driver_id, :billing_client_id, :place, :place_horse, :place_cart_1, :date_entry, :time_entry, :date_receipt, :date_closing, :date_scheduled, :time_scheduled, :motive_scheduled, :palletized, :quantity_pallets, :weight, :volume, :value_ton, :value_kg, :value_total, :charge_discharge, :shipment, :team,\n :dock, :hangar, :container, :place_confirmed, :start_time_discharge, :finish_time_discharge, :started_user_id, :charge_type_delivery, :date_start_avaria, :date_finish_avaria, :time_start_avaria, :time_finish_avaria, :status, :user_id, :received_user_id, :breakdown_user_id, :observation, :text)\n end", "def dst_dev()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::DstDev::DstDevRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def create\n @vdm = Vdm.new(vdm_params)\n\n if @vdm.save\n render json: @vdm, status: :created, location: @vdm\n else\n render json: @vdm.errors, status: :unprocessable_entity\n end\n end", "def create\n @kingdom = Kingdom.new(params[:kingdom])\n\n respond_to do |format|\n if @kingdom.save\n flash[:notice] = 'Kingdom was successfully created.'\n format.html { redirect_to(@kingdom) }\n format.xml { render :xml => @kingdom, :status => :created, :location => @kingdom }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @kingdom.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @etd = Etd.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @etd }\n end\n end", "def denunciation_params\n params.require(:denunciation).permit(:survivor_id, :sender_id)\n end", "def post(uri, doc = nil, options = {})\n execute(uri, :post, options, doc)\n end", "def post_xml_64(xml=:example_response)\n post \"/auth/saml/callback\", {'SAMLResponse' => load_xml_64(xml)}\nend" ]
[ "0.5802217", "0.57882345", "0.5465859", "0.54078716", "0.5396476", "0.5380217", "0.5371849", "0.5353407", "0.5341229", "0.53405243", "0.53110164", "0.5263182", "0.52207303", "0.52128935", "0.5210233", "0.5194966", "0.5172442", "0.5172442", "0.5156328", "0.5155316", "0.50703204", "0.5061819", "0.5059888", "0.50590557", "0.504649", "0.5030811", "0.5001102", "0.4987002", "0.49655664", "0.49588668", "0.49545288", "0.4953516", "0.49427962", "0.49186444", "0.49134964", "0.48984024", "0.4897356", "0.4876662", "0.48657197", "0.4862716", "0.48588538", "0.48585248", "0.48568487", "0.48498198", "0.48427194", "0.4829751", "0.4827499", "0.48274565", "0.48089778", "0.48061725", "0.48023158", "0.4798986", "0.47952545", "0.47915718", "0.4786332", "0.47795886", "0.47761053", "0.4768462", "0.47673827", "0.4767113", "0.47641203", "0.47612157", "0.4759942", "0.47596425", "0.47583622", "0.47571465", "0.4754704", "0.47536397", "0.475354", "0.47525465", "0.47430435", "0.47382087", "0.47321808", "0.47273502", "0.47255132", "0.47254598", "0.4720914", "0.4711585", "0.47108498", "0.47090867", "0.47090694", "0.47073615", "0.47055164", "0.46995953", "0.46966997", "0.46961498", "0.46907192", "0.46884444", "0.4685282", "0.4680895", "0.46807623", "0.46784252", "0.46774426", "0.467446", "0.46720505", "0.4667322", "0.46620786", "0.4660813", "0.465447", "0.4654422" ]
0.54197085
3
PUT /dvds/1 PUT /dvds/1.xml
def update @dvd = Dvd.find(params[:id]) @dvdusers = @dvd.userid.split(', ') @x = 0 while @x < @dvdusers.size if @dvdusers[@x] == current_user.id.to_s alreadylent = true end @x = @x + 1 end if user_signed_in? if alreadylent != true @dvd.verliehen = @dvd.verliehen + 1 if @dvd.userid == "" @dvd.userid = "#{current_user.id}" else @dvd.userid = "#{@dvd.userid}, #{current_user.id}" end respond_to do |format| if @dvd.update_attributes(params[:dvd]) format.html { redirect_to(@dvd, :notice => 'Dvd wurde erfolgreich ausgeliehen.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @dvd.errors, :status => :unprocessable_entity } end end else # @x = 0 # @dvd.userid = "" # @dvd.verliehen = @dvd.verliehen - 1 # while @x < @dvdusers.size # if current_user.id.to_s == @dvdusers[@x] # @dvdusers.delete(@x) # elsif @dvd.userid = "" # @dvd.userid = "#{@dvdusers[@x]}" # else # @dvd.userid = "#{@dvd.userid}, #{@dvdusers[@x]}" # end # @x = @x + 1 # end respond_to do |format| if @dvd.update_attributes(params[:dvd]) format.html { redirect_to(@dvd, :notice => 'DVD wurde schon von ihnen ausgeliehen') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @dvd.errors, :status => :unprocessable_entity } end end end else respond_to do |format| if @dvd.update_attributes(params[:dvd]) format.html { redirect_to(@dvd, :notice => 'Log In notwendig, um DVDs auszuleihen!') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @dvd.errors, :status => :unprocessable_entity } end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put_datastream(pid, dsID, xml)\n uri = URI.parse(@fedora + '/objects/' + pid + '/datastreams/' + dsID ) \n RestClient.put(uri.to_s, xml, :content_type => \"application/xml\")\n rescue => e\n e.response \n end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def update\n respond_to do |format|\n if @dvr.update(dvr_params)\n format.html { redirect_to @dvr, notice: 'Dvr was successfully updated.' }\n format.json { render :show, status: :ok, location: @dvr }\n else\n format.html { render :edit }\n format.json { render json: @dvr.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @vendor_doc = VendorDoc.find(params[:id])\n\t@vdocs_requirement = @vendor_doc.vdocs_requirement\n\n respond_to do |format|\n if @vendor_doc.update_attributes(params[:vendor_doc])\n flash[:notice] = 'VendorDoc was successfully updated.'\n format.html { redirect_to(@vendor_doc) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vendor_doc.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @rdv = Rdv.find(params[:id])\n\n respond_to do |format|\n if @rdv.update_attributes(params[:rdv])\n format.html { redirect_to(@rdv, :notice => 'Rendez-vous mis à jour.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rdv.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end", "def update\n @etd = Etd.find(params[:id])\n\n respond_to do |format|\n if @etd.update_attributes(params[:etd])\n flash[:notice] = 'Etd was successfully updated.'\n format.html { redirect_to(@etd) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @etd.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @vdm = Vdm.find(params[:id])\n\n if @vdm.update(vdm_params)\n head :no_content\n else\n render json: @vdm.errors, status: :unprocessable_entity\n end\n end", "def update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end", "def update\n @dvd = Dvd.find(params[:id])\n\n respond_to do |format|\n if @dvd.update_attributes(params[:dvd])\n format.html { redirect_to @dvd, notice: 'Dvd was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dvd.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @dvd = Dvd.find(params[:id])\n\n respond_to do |format|\n if @dvd.update_attributes(params[:dvd])\n format.html { redirect_to @dvd, notice: 'Dvd was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dvd.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ovode = Ovode.find_by_url(params[:id])\n\n respond_to do |format|\n if @ovode.update_attributes(params[:ovode])\n format.html { redirect_to @ovode, notice: 'ovode was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ovode.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_rest\n @instrument_version = InstrumentVersion.find(params[:id])\n\n respond_to do |format|\n if @instrument_version.update_attributes(params[:instrument_version])\n flash[:notice] = 'InstrumentVersion was successfully updated.'\n format.html { redirect_to(@instrument_version) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @instrument_version.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @tv = Tv.find(params[:id])\n\n respond_to do |format|\n if @tv.update_attributes(params[:tv])\n flash[:notice] = 'Tv was successfully updated.'\n format.html { redirect_to(@tv) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tv.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @vdocs_requirement = VdocsRequirement.find(params[:id])\n\t@contract = @vdocs_requirement.contract\n\n respond_to do |format|\n if @vdocs_requirement.update_attributes(params[:vdocs_requirement])\n flash[:notice] = 'VdocsRequirement was successfully updated.'\n format.html { redirect_to(@vdocs_requirement) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vdocs_requirement.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\r\n @dcf = Dcf.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @dcf.update_attributes(params[:dcf])\r\n flash[:notice] = 'Dcf was successfully updated.'\r\n format.html { redirect_to(@dcf) }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @dcf.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @dosage = Dosage.find(params[:id])\n\n respond_to do |format|\n if @dosage.update_attributes(params[:dosage])\n format.html { redirect_to(@dosage, :notice => 'Dosage was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @dosage.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @docent = Docent.find(params[:id])\n\n respond_to do |format|\n if @docent.update_attributes(params[:docent])\n format.html { redirect_to(@docent, :notice => 'Docent was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @docent.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @vendedor = Vendedor.find(params[:id])\n respond_to do |format|\n if @vendedor.update_attributes(params[:vendedor])\n flash[:notice] = 'Vendedor was successfully updated.'\n format.html { redirect_to(@vendedor) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vendedor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @vendedor = Vendedor.find(params[:id])\n\n respond_to do |format|\n if @vendedor.update_attributes(params[:vendedor])\n flash[:notice] = 'Vendedor was successfully updated.'\n format.html { redirect_to(@vendedor) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vendedor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @dossier = Dossier.find(params[:id])\n\n respond_to do |format|\n if @dossier.update_attributes(params[:dossier])\n flash[:notice] = 'Dossier was successfully updated.'\n format.html { redirect_to(@dossier) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @dossier.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @dokter = Dokter.find(params[:id])\n\n respond_to do |format|\n if @dokter.update_attributes(params[:dokter])\n format.html { redirect_to(:action => \"index\", :notice => UPDATE_MSG) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @dokter.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update\n respond_to do |format|\n if @ssd.update(ssd_params)\n format.html { redirect_to ssds_url }\n else\n format.html { render :edit }\n end\n end\n end", "def update\n @segment = Segment.find(params[:id])\n\n respond_to do |format|\n if @segment.update_attributes(params[:segment])\n flash[:notice] = 'Segment was successfully updated.'\n format.html { redirect_to(@segment) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @segment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n @segment_detail = SegmentDetail.find(params[:id])\n\n respond_to do |format|\n if @segment_detail.update_attributes(params[:segment_detail])\n flash[:notice] = 'SegmentDetail was successfully updated.'\n format.html { redirect_to(@segment_detail) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @segment_detail.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @rdv.update(rdv_params)\n format.html { redirect_to @rdv, notice: 'Rdv was successfully updated.' }\n format.json { render :show, status: :ok, location: @rdv }\n else\n format.html { render :edit }\n format.json { render json: @rdv.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @dataset = Dataset.find(params[:id])\n\n respond_to do |format|\n if @dataset.update_attributes(params[:dataset])\n format.html { redirect_to(@dataset, :notice => 'Dataset was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @dataset.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @dataset.update_attributes(params[:dataset])\n format.html { redirect_to(@dataset, :notice => 'Dataset was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @dataset.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @dbs_deposit = DbsDeposit.find(params[:id])\n\n respond_to do |format|\n if @dbs_deposit.update_attributes(params[:dbs_deposit])\n format.html { redirect_to(@dbs_deposit, :notice => 'DbsDeposit was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @dbs_deposit.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @dovetest.update(dovetest_params)\n format.html { redirect_to @dovetest, notice: 'Dovetest was successfully updated.' }\n format.json { render :show, status: :ok, location: @dovetest }\n else\n format.html { render :edit }\n format.json { render json: @dovetest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @drives = Drives.find(params[:id])\n\n respond_to do |format|\n if @drives.update_attributes(params[:drives])\n flash[:notice] = 'Drives was successfully updated.'\n format.html { redirect_to(@drives) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @drives.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_dvr\n @dvr = Dvr.find(params[:id])\n end", "def update\n @velocity_event = VelocityEvent.find(params[:id])\n\n respond_to do |format|\n if @velocity_event.update_attributes(params[:velocity_event])\n format.html { redirect_to(@velocity_event, :notice => 'Velocity event was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @velocity_event.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @kingdom = Kingdom.find(params[:id])\n\n respond_to do |format|\n if @kingdom.update_attributes(params[:kingdom])\n flash[:notice] = 'Kingdom was successfully updated.'\n format.html { redirect_to(@kingdom) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @kingdom.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @dn.update(dn_params)\n format.html { redirect_to @dn, notice: 'Dn was successfully updated.' }\n format.json { render :show, status: :ok, location: @dn }\n else\n format.html { render :edit }\n format.json { render json: @dn.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @dataset = Dataset.find(params[:id])\n\n respond_to do |format|\n if @dataset.update_attributes(params[:dataset])\n flash[:notice] = 'Dataset was successfully updated.'\n format.html { redirect_to dataset_url(@dataset) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @dataset.errors.to_xml }\n end\n end\n end", "def update\n @visaapp = Visaapp.find(params[:id])\n\n respond_to do |format|\n if @visaapp.update_attributes(params[:visaapp])\n flash[:notice] = 'Visaapp was successfully updated.'\n format.html { redirect_to(@visaapp) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @visaapp.errors, :status => :unprocessable_entity }\n end\n end\n end", "def destroy\n @dvd = Dvd.find(params[:id])\n @dvd.destroy\n\n respond_to do |format|\n format.html { redirect_to(dvds_url) }\n format.xml { head :ok }\n end\n end", "def update\n @visarequest = Visarequest.find(params[:id])\n\n respond_to do |format|\n if @visarequest.update_attributes(params[:visarequest])\n flash[:notice] = 'Visarequest was successfully updated.'\n format.html { redirect_to(@visarequest) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @visarequest.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @domino = Domino.find(params[:id])\n\n respond_to do |format|\n if @domino.update_attributes(params[:domino])\n flash[:notice] = 'Domino was successfully updated.'\n format.html { redirect_to(@domino) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @domino.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @dtest = Dtest.find(params[:id])\n\n respond_to do |format|\n if @dtest.update_attributes(params[:dtest])\n format.html { redirect_to @dtest, notice: t(:upd_test)}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dtest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @vtodo = Vtodo.find(params[:id])\n\n respond_to do |format|\n if @vtodo.update_attributes(params[:vtodo])\n flash[:notice] = 'Vtodo was successfully updated.'\n format.html { redirect_to(@vtodo) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vtodo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n redirect_to action: \"latest\"\n @davis = Davis.find(params[:id])\n\n #respond_to do |format|\n # if @davis.update_attributes(davi_params)\n # format.html { redirect_to @davis, notice: 'Davis was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render action: \"edit\" }\n # format.json { render json: @davis.errors, status: :unprocessable_entity }\n # end\n #end\n end", "def update\n id = params[:id]\n @datacenter = Datacenter.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @datacenter.attributes = params[:datacenter]\n @datacenter.audits << Audit.new(source: 'controller', action: 'update', admin_user: current_user)\n respond_to do |format|\n if @datacenter.save\n format.html { redirect_to @datacenter, notice: 'Datacenter was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @datacenter.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @variate = Variate.find(params[:id])\n\n respond_to do |format|\n if @variate.update_attributes(params[:variate])\n flash[:notice] = 'Variate was successfully updated.'\n format.html { redirect_to variate_url(@variate) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @variate.errors.to_xml }\n end\n end\n end", "def update\n @vdisk = Vdisk.find(params[:id])\n\n respond_to do |format|\n if @vdisk.update_attributes(params[:vdisk])\n format.html { redirect_to @vdisk, notice: 'Vdisk was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vdisk.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.save!\n\n respond_to do |format|\n if @config_xml.update_attributes(params[:config_xml])\n flash[:notice] = 'ConfigXml was successfully updated.'\n format.html { redirect_to(@config_xml) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @config_xml.errors, :status => :unprocessable_entity }\n end\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end", "def update\n @datastore = Datastore.find(params[:id])\n\n respond_to do |format|\n if @datastore.update_attributes(params[:datastore])\n format.html { redirect_to @datastore, notice: 'Datastore was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @datastore.errors, status: :unprocessable_entity }\n end\n end\n end", "def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend", "def update\n if @vat.update(vat_params)\n head :no_content\n else\n render json: @vat.errors, status: :unprocessable_entity\n end\n end", "def update\n @page_title = \"Data Points\"\n @data_point = DataPoint.find(params[:id])\n\n respond_to do |format|\n if @data_point.update_attributes(params[:data_point])\n flash[:notice] = 'DataPoint was successfully updated.'\n format.html { redirect_to(@data_point) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @data_point.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @dapi.update(dapi_params)\n format.html { redirect_to @dapi, notice: 'Dapi was successfully updated.' }\n format.json { render :show, status: :ok, location: @dapi }\n else\n format.html { render :edit }\n format.json { render json: @dapi.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @segmento = Segmento.find(params[:id])\n\n respond_to do |format|\n if @segmento.update_attributes(params[:segmento])\n flash[:notice] = 'Segmento was successfully updated.'\n format.html { redirect_to(@segmento) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @segmento.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @dlog = Dlog.find(params[:id])\n\n respond_to do |format|\n if @dlog.update_attributes(params[:dlog])\n format.html { redirect_to(@dlog, :notice => 'Dlog was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @dlog.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @dl_type = DlType.find(params[:id])\n\n respond_to do |format|\n if @dl_type.update_attributes(params[:dl_type])\n format.html { redirect_to(downloads_admin_dl_type_path(@dl_type), :notice => 'Dl type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @dl_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\tDesignDetailDataPoint.save_data_point_info(params[:study_id], params)\n\t#DesignDetailDataPoint.save_data_point_totals(params[:study_id], params)\n respond_to do |format|\n end\n end", "def update\n # raise(\"boobies!\")\n @dataset = Dataset.find(params[:id])\n # raise(params[:dataset][:dataset_variables_attributes][\"0\"].class.to_s)\n respond_to do |format|\n if @dataset.update_attributes(params[:dataset])\n flash[:notice] = 'Dataset was successfully updated.'\n format.html { redirect_to(@dataset) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @dataset.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 @test = TkdTest.find(params[:id])\n\n respond_to do |format|\n if @test.update_attributes(params[:tkd_test])\n format.html { redirect_to(@test, :notice => 'Test was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @test.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @dataed = Dataed.find(params[:id])\n\n respond_to do |format|\n if @dataed.update_attributes(params[:dataed])\n format.html { redirect_to(@dataed, :notice => 'Dataed was successfully updated.') }\n format.xml { head :ok }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @dataed.errors, :status => :unprocessable_entity }\n format.json { render :json => @dataed.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n params.permit!\n @vehicle_daily = VehicleDaily.find(params[:id])\n\n respond_to do |format|\n if @vehicle_daily.update_attributes(params[:vehicle_daily])\n format.html { redirect_to(@vehicle_daily, :notice => 'Vehicle daily was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vehicle_daily.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vet_doctor.update(vet_doctor_params)\n format.html { redirect_to @vet_doctor, notice: 'Vet doctor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vet_doctor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n prep_dataset_form\n @dataset.update_attributes!(params[:dataset])\n publish_press_item(\"Dataset updated: #{@dataset.title}\") if attachments_updated?\n \n respond_to do |wants|\n flash[:notice] = 'Dataset was successfully updated.'\n wants.html { redirect_to(@dataset) }\n wants.xml { head :ok }\n end\n end", "def destroy\n @rdv = Rdv.find(params[:id])\n @rdv.destroy\n\n respond_to do |format|\n format.html { redirect_to(rdvs_url) }\n format.xml { head :ok }\n end\n end", "def update_document index, id, document\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}/_update\")\n req = Net::HTTP::Post.new(uri)\n req.body = { \"doc\": document }.to_json\n run(uri, req)\n end", "def update\n @vet = Vet.find(params[:id])\n\n respond_to do |format|\n if @vet.update_attributes(params[:vet])\n format.html { redirect_to @vet, notice: 'Vet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @discovery = Discovery.find(params[:id])\n\n respond_to do |format|\n if @discovery.update_attributes(params[:discovery])\n flash[:notice] = 'Discovery was successfully updated.'\n format.html { redirect_to(@discovery) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @discovery.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n enforce_permissions!('update', params[:id])\n\n param = params[:xml].presence || params[:metadata_file].presence\n\n if param\n xml_ds = XmlDatastream.new\n xml_ds.load_xml(param)\n else\n flash[:notice] = t('dri.flash.notice.specify_valid_file')\n redirect_to controller: 'catalog', action: 'show', id: params[:id]\n return\n end\n\n @object = retrieve_object!(params[:id])\n @errors = nil\n\n unless can? :update, @object\n raise Hydra::AccessDenied.new(t('dri.flash.alert.edit_permission'), :edit, '')\n end\n\n @object.update_metadata xml_ds.xml\n if @object.valid?\n checksum_metadata(@object)\n warn_if_has_duplicates(@object)\n\n begin\n raise DRI::Exceptions::InternalError unless @object.attached_files[:descMetadata].save\n rescue RuntimeError => e\n logger.error \"Could not save descMetadata for object #{@object.id}: #{e.message}\"\n raise DRI::Exceptions::InternalError\n end\n\n begin\n raise DRI::Exceptions::InternalError unless @object.save\n\n version_and_record_committer(@object, current_user)\n flash[:notice] = t('dri.flash.notice.metadata_updated')\n rescue RuntimeError => e\n logger.error \"Could not save object #{@object.id}: #{e.message}\"\n raise DRI::Exceptions::InternalError\n end\n else\n flash[:alert] = t('dri.flash.alert.invalid_object', error: @object.errors.full_messages.inspect)\n @errors = @object.errors.full_messages.inspect\n end\n\n @object.object_version ||= '1'\n @object.increment_version\n\n begin\n raise DRI::Exceptions::InternalError unless @object.save\n\n # Do the preservation actions\n preservation = Preservation::Preservator.new(@object)\n preservation.preserve(false, false, ['descMetadata','properties'])\n\n version_and_record_committer(@object, current_user)\n flash[:notice] = t('dri.flash.notice.metadata_updated')\n rescue RuntimeError => e\n logger.error \"Could not save object #{@object.id}: #{e.message}\"\n raise DRI::Exceptions::InternalError\n end\n\n respond_to do |format|\n format.html { redirect_to controller: 'my_collections', action: 'show', id: params[:id] }\n format.json { render json: @object }\n format.text do\n response = if @errors\n t('dri.flash.alert.invalid_object', error: @errors)\n else\n t('dri.flash.notice.metadata_updated')\n end\n\n render text: response\n end\n end\n end", "def update\n respond_to do |format|\n if @dte.update(dte_params)\n format.html { redirect_to @dte, notice: 'Dte was successfully updated.' }\n format.json { render :show, status: :ok, location: @dte }\n else\n format.html { render :edit }\n format.json { render json: @dte.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_rdv\n @rdv = Rdv.find(params[:id])\n end", "def update\n @district = District.find(params[:id])\n\n respond_to do |format|\n if @district.update_attributes(params[:district])\n flash[:notice] = 'District was successfully updated.'\n format.html { redirect_to(@district) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @district.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @tdoc = Tdoc.find(params[:id])\n\n respond_to do |format|\n if @tdoc.update_attributes(params[:tdoc])\n format.html { redirect_to(@tdoc, :notice => 'Tdoc was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tdoc.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @service_version = ServiceVersion.find(params[:id])\n\n respond_to do |format|\n if @service_version.update_attributes(params[:service_version])\n flash[:notice] = 'ServiceVersion was successfully updated.'\n format.html { redirect_to(@service_version) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @service_version.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance/{tenantId}\"\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 @district = District.find(params[:id])\n\n respond_to do |format|\n if @district.update_attributes(params[:district])\n format.html { redirect_to(admin_city_district_url(city, @district), :notice => 'District was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n #format.xml { render :xml => @district.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_dovetest\n @dovetest = Dovetest.find(params[:id])\n end", "def put_document index, id, document\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}\")\n req = Net::HTTP::Put.new(uri)\n req.body = document.to_json\n run(uri, req)\n end", "def update\n @dossier = Dossier.find(params[:id])\n\n respond_to do |format|\n if @dossier.update_attributes(params[:dossier])\n format.html { redirect_to @dossier, notice: 'Dossier was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dossier.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @expense_tag = ExpenseTag.find(params[:id])\n\n respond_to do |format|\n if @expense_tag.update_attributes(params[:expense_tag])\n flash[:notice] = 'ExpenseTag was successfully updated.'\n format.html { redirect_to(@expense_tag) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @expense_tag.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 putEntityserve( entity_id, country, event_type, domain, path)\n params = Hash.new\n params['entity_id'] = entity_id\n params['country'] = country\n params['event_type'] = event_type\n params['domain'] = domain\n params['path'] = path\n return doCurl(\"put\",\"/entityserve\",params)\n end", "def update\n @xsbg_tt_datum = XsbgTtDatum.find(params[:id])\n\n respond_to do |format|\n if @xsbg_tt_datum.update_attributes(params[:xsbg_tt_datum])\n format.html { redirect_to @xsbg_tt_datum, notice: 'Xsbg tt datum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @xsbg_tt_datum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @old_point_tag = OldPointTag.find(params[:id])\n\n respond_to do |format|\n if @old_point_tag.update_attributes(params[:old_point_tag])\n format.html { redirect_to(@old_point_tag, :notice => 'Old point tag was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @old_point_tag.errors, :status => :unprocessable_entity }\n end\n end\n end", "def xml(id)\n http.get(\"/nfse/#{id}/xml\") do |response|\n response.headers.fetch(\"Location\") { \"\" }\n end\n end", "def update\n keystone.update_tenant({:id=>params[:id],:name=>params[:name],:description=>params[:description],:enabled=>params[:enabled]})\n respond_to do |format|\n format.html { redirect_to tenants_path, :notice => 'Tenant was successfully updated.' }\n format.json { head :ok }\n end\n end", "def update\n @draft_investment = DraftInvestment.find(params[:id])\n\n respond_to do |format|\n if @draft_investment.update_attributes(params[:investment])\n\n format.xml \n else\n\n format.xml { render :xml => @draft_investment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}/volumes\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.request_uri)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n\n end", "def update\n respond_to do |format|\n if @vod.update(vod_params)\n format.html { redirect_to @vod, notice: 'Vod was successfully updated.' }\n format.json { render :show, status: :ok, location: @vod }\n else\n format.html { render :edit }\n format.json { render json: @vod.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @dream_definition = DreamDefinition.find(params[:id])\n\n respond_to do |format|\n if @dream_definition.update_attributes(params[:dream_definition])\n format.html { redirect_to(@dream_definition, :notice => 'Dream definition was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @dream_definition.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_put_expenses_1_xml\n @parameters = {:expense => {:description => 'NewDescription'}}\n if ActiveRecord::VERSION::MAJOR < 4\n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/expenses/1.xml',\n {:expense => {:description => 'NewDescription'}},\n {:success_code => :ok})\n end\n\n assert_no_difference('Expense.count') do\n put '/expenses/1.xml', @parameters, credentials('admin')\n end\n\n expense = Expense.find(1)\n assert_equal \"NewDescription\", expense.description\n end", "def update\n @pdig = Pdig.find(params[:id])\n\n respond_to do |format|\n if @pdig.update_attributes(params[:pdig])\n flash[:notice] = 'Pdig was successfully updated.'\n format.html { redirect_to(@pdig) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @pdig.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @xml_sample = XmlSample.find(params[:id])\n \n respond_to do |format|\n format.html do\n @xml_sample = XmlSample.update_attributes(params[:xml_sample])\n if @xml_sample.save\n return redirect_to @xml_sample, notice: 'Xml sample was successfully updated.'\n else\n return render action: \"new\"\n end\n end\n format.xml do\n rexml = REXML::Document.new(params[\"xml\"])\n attr = Hash.from_xml(rexml.to_s)\n if @xml_sample.update_attributes(attr[\"xmlsample\"])\n xml = {msg: \"complete\", status: \"OK\"}.to_xml\n else\n xml = {msg: \"failed\", status: \"NG\"}.to_xml\n end\n return render xml: xml\n end\n end\n end", "def update\n respond_to do |format|\n if @ddc.update(ddc_params)\n format.html { redirect_to @ddc, notice: 'Ddc was successfully updated.' }\n format.json { render :show, status: :ok, location: @ddc }\n else\n format.html { render :edit }\n format.json { render json: @ddc.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @idd.update(idd_params)\n format.html { redirect_to @idd, notice: 'Idd was successfully updated.' }\n format.json { render :show, status: :ok, location: @idd }\n else\n format.html { render :edit }\n format.json { render json: @idd.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @data_file = DataFile.find(params[:id])\n\n respond_to do |format|\n if @data_file.update_attributes(params[:data_file])\n flash[:notice] = 'DataFile was successfully updated.'\n format.html { redirect_to(@data_file) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @data_file.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @vehicle = Vehicle.find(params[:id])\n respond_to do |format|\n if @vehicle.update_attributes(params[:vehicle])\n format.html { redirect_to([@vehicle.fleet,@vehicle], :notice => 'Vehicle was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vehicle.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @novidade = Novidade.find(params[:id])\n\n respond_to do |format|\n if @novidade.update_attributes(params[:novidade])\n flash[:notice] = 'Novidade was successfully updated.'\n format.html { redirect_to(@novidade) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @novidade.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @tv = Tv.find(params[:id])\n\n respond_to do |format|\n if @tv.update_attributes(params[:tv])\n format.html { redirect_to @tv, notice: 'Tv was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tv.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6386783", "0.6221852", "0.5694655", "0.56694293", "0.56669784", "0.5653485", "0.5586856", "0.5582915", "0.5544645", "0.55345666", "0.5532589", "0.5484315", "0.5470777", "0.5467352", "0.54661566", "0.5455095", "0.54465663", "0.54303336", "0.541763", "0.54076564", "0.54027486", "0.5389311", "0.5389094", "0.538311", "0.537588", "0.53596944", "0.5353991", "0.53513485", "0.53354216", "0.53171235", "0.53152454", "0.53108704", "0.5307095", "0.53049254", "0.5303951", "0.5300242", "0.52917653", "0.5291253", "0.5277899", "0.5275761", "0.52738696", "0.5271577", "0.52702445", "0.5260585", "0.5256569", "0.52557844", "0.52498645", "0.5242836", "0.52355015", "0.5221769", "0.5215394", "0.52152777", "0.5213874", "0.5206176", "0.5198636", "0.519371", "0.5190587", "0.51902133", "0.5184976", "0.5182941", "0.518", "0.51734084", "0.5168717", "0.51682365", "0.51653284", "0.5163097", "0.5161776", "0.5159989", "0.5158485", "0.5154496", "0.5153151", "0.514705", "0.5138117", "0.513212", "0.5125921", "0.5125362", "0.5122453", "0.51220834", "0.51198286", "0.5118117", "0.5112493", "0.51044166", "0.51028794", "0.50989497", "0.50972337", "0.5093184", "0.50922376", "0.5091012", "0.5088371", "0.50868106", "0.5079361", "0.5078837", "0.5078111", "0.5073608", "0.5068701", "0.506733", "0.5063136", "0.5055424", "0.5055235", "0.5053942", "0.5053635" ]
0.0
-1
DELETE /dvds/1 DELETE /dvds/1.xml
def destroy @dvd = Dvd.find(params[:id]) @dvd.destroy respond_to do |format| format.html { redirect_to(dvds_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @rdv = Rdv.find(params[:id])\n @rdv.destroy\n\n respond_to do |format|\n format.html { redirect_to(rdvs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @dcf = Dcf.find(params[:id])\r\n @dcf.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(dcfs_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end", "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end", "def destroy\n @dlog = Dlog.find(params[:id])\n @dlog.destroy\n\n respond_to do |format|\n format.html { redirect_to(dlogs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @etd = Etd.find(params[:id])\n @etd.destroy\n\n respond_to do |format|\n format.html { redirect_to(etds_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @dossier = Dossier.find(params[:id])\n @dossier.destroy\n\n respond_to do |format|\n format.html { redirect_to(\"/\") }\n format.xml { head :ok }\n end\n end", "def destroy\n @dbs_deposit = DbsDeposit.find(params[:id])\n @dbs_deposit.destroy\n\n respond_to do |format|\n format.html { redirect_to(dbs_deposits_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @direccion = Direccion.find(params[:id])\n @direccion.destroy\n\n respond_to do |format|\n format.html { redirect_to(direccions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @dossier = Dossier.find(params[:id])\n @dossier.destroy\n\n respond_to do |format|\n format.html { redirect_to(dossiers_url) }\n format.xml { head :ok }\n end\n end", "def delete(id)\n request = Net::HTTP::Delete.new(\"#{@url}/#{id}.xml\")\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end", "def destroy\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end", "def delete(vmname)\n uri = @uri + \"/#{vmname}?api-version=#{api_version}\"\n uri\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @vdm.destroy\n\n head :no_content\n end", "def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end", "def delete\n eadid = (params[\"eadid\"] || \"\").strip\n if eadid == \"\"\n log_error(\"Cannot delete EAD. No ID was provided.\")\n flash[:alert] = \"No EAD ID was provided.\"\n redirect_to upload_list_url()\n return\n end\n\n filename = ENV[\"EAD_XML_PENDING_FILES_PATH\"] + \"/\" + eadid + \".xml\"\n if !File.exist?(filename)\n log_error(\"Cannot delete EAD. File was not found: #{filename}\")\n flash[:alert] = \"Source file not found for finding aid: #{eadid}.\"\n redirect_to upload_list_url()\n return\n end\n\n target = ENV[\"EAD_XML_DELETED_FILES_PATH\"] + \"/\" + eadid + \".xml\"\n FileUtils.mv(filename, target)\n\n if !File.exist?(target)\n log_error(\"File delete failed: #{filename}\")\n flash[:alert] = \"Could not delete finding aid #{eadid}.\"\n redirect_to upload_list_url()\n return\n end\n\n Rails.logger.info(\"Findind aid #{eadid} has been deleted\")\n flash[:notice] = \"Findind aid #{eadid} has been deleted\"\n redirect_to upload_list_url()\n rescue => ex\n render_error(\"delete\", ex, current_user)\n end", "def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"#{uri_prefix}/virtual_dns/#{id}\")\n end", "def delete_by_id id, opts = {}\n update opts.merge(:data => xml.delete_by_id(id))\n end", "def destroy\n @docent = Docent.find(params[:id])\n @docent.destroy\n\n respond_to do |format|\n format.html { redirect_to(docents_url) }\n format.xml { head :ok }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @drives = Drives.find(params[:id])\n @drives.destroy\n\n respond_to do |format|\n format.html { redirect_to(drives_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @staffd = Staffd.find(params[:id])\n @staffd.destroy\n\n respond_to do |format|\n format.html { redirect_to(staffds_url) }\n format.xml { head :ok }\n end\n end", "def delete(id)\r\n connection.delete(\"/#{@doctype}[@ino:id=#{id}]\")\r\n end", "def destroy\n @segment_detail = SegmentDetail.find(params[:id])\n @segment_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to(segment_details_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @prd_etc = PrdEtc.find(params[:id])\n @prd_etc.destroy\n\n respond_to do |format|\n format.html { redirect_to(prd_etcs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @dosage = Dosage.find(params[:id])\n @dosage.destroy\n\n respond_to do |format|\n format.html { redirect_to(dosages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @pdig = Pdig.find(params[:id])\n @pdig.destroy\n\n respond_to do |format|\n format.html { redirect_to(pdigs_url) }\n format.xml { head :ok }\n end\n end", "def delete\n start { |connection| connection.request http :Delete }\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n @vehicle_daily = VehicleDaily.find(params[:id])\n @vehicle_daily.destroy\n\n respond_to do |format|\n format.html { redirect_to(vehicle_dailies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @domino = Domino.find(params[:id])\n @domino.destroy\n\n respond_to do |format|\n format.html { redirect_to(dominos_url) }\n format.xml { head :ok }\n end\n end", "def delete(dn)\n @conn.delete :dn => dn\n end", "def destroy\n @diagram = Diagram.find(params[:id])\n @diagram.destroy\n\n respond_to do |format|\n format.html { redirect_to(diagrams_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @test = TkdTest.find(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to(:action => :index) }\n format.xml { head :ok }\n end\n end", "def delete\n end", "def destroy\n @derivative = Derivative.find(params[:id])\n @derivative.destroy\n\n respond_to do |format|\n format.html { redirect_to(derivatives_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @capd = Capd.find(params[:id])\n @capd.destroy\n\n respond_to do |format|\n format.html { redirect_to(capds_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @bdig = Bdig.find(params[:id])\n @bdig.destroy\n\n respond_to do |format|\n format.html { redirect_to(bdigs_url) }\n format.xml { head :ok }\n end\n end", "def delete(options={})\n connection.delete(\"/\", @name)\n end", "def delete\n request(:delete)\n end", "def delete_gdom_disk(options)\n gdom_dir = $ldom_base_dir+\"/\"+options['name']\n client_disk = gdom_dir+\"/vdisk0\"\n message = \"Information:\\tRemoving disk \"+client_disk\n command = \"rm #{client_disk}\"\n execute_command(options,message,command)\n return\nend", "def destroy\n @dvd = Dvd.find(params[:id])\n @dvd.destroy\n\n respond_to do |format|\n format.html { redirect_to dvds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tv = Tv.find(params[:id])\n @tv.destroy\n\n respond_to do |format|\n format.html { redirect_to(tvs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @segmento = Segmento.find(params[:id])\n @segmento.destroy\n\n respond_to do |format|\n format.html { redirect_to(segmentos_url) }\n format.xml { head :ok }\n end\n end", "def delete\n\n end", "def deleteResource(doc, msg_from)\n \n \n begin\n\n puts \"Deleting\"\n\n path = \"\"\n params = {}\n headers = {}\n \n context, path = findContext(doc, path) \n \n # Deleting member from group\n if context == :user_group_member\n params = {}\n else\n raise Exception.new(\"No context given!\")\n end\n \n httpAndNotify(path, params, msg_from, :delete)\n \n rescue Exception => e\n puts \"Problem in parsing data (CREATE) from xml or sending http request to the VR server: \" + e\n puts \" -- line: #{e.backtrace[0].to_s}\"\n end\n \n end", "def destroy\n @data_file = DataFile.find(params[:id])\n @data_file.destroy\n\n respond_to do |format|\n format.html { redirect_to(data_files_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @service_version = ServiceVersion.find(params[:id])\n @service_version.destroy\n\n respond_to do |format|\n format.html { redirect_to(service_versions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @dato = Dato.find(params[:id])\n @dato.destroy\n\n respond_to do |format|\n format.html { redirect_to(datos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @dato = Dato.find(params[:id])\n @dato.destroy\n\n respond_to do |format|\n format.html { redirect_to(datos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @visaapp = Visaapp.find(params[:id])\n @visaapp.destroy\n\n respond_to do |format|\n format.html { redirect_to(visaapps_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @design_detail_data_point = DesignDetailDataPoint.find(params[:id])\n @design_detail_data_point.destroy\n\n respond_to do |format|\n format.html { redirect_to(design_detail_data_points_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @tm_dev1 = TmDev1.find(params[:id])\n @tm_dev1.destroy\n\n respond_to do |format|\n format.html { redirect_to(tm_dev1s_url) }\n format.xml { head :ok }\n end\n end", "def delete_data\n response = WebPay.client.delete([path, 'data'].join('/'))\n response['deleted']\n end", "def destroy\n @dataset = Dataset.find(params[:id])\n @dataset.destroy\n\n respond_to do |format|\n format.html { redirect_to datasets_url }\n format.xml { head :ok }\n end\n end", "def web_dav_delete(*args, &block)\n args = web_dav_args args\n map_method :delete, args, &block\n end", "def delete_document index, id\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}\")\n req = Net::HTTP::Delete.new(uri)\n run(uri, req)\n end", "def destroy\n @diabetes_consultation = DiabetesConsultation.find(params[:id])\n @diabetes_consultation.destroy\n\n respond_to do |format|\n format.html { redirect_to(diabetes_consultations_url) }\n format.xml { head :ok }\n end\n end", "def report_delete(id)\r\n\t\tpost= { \"token\" => @token, \"report\" => id } \r\n\t\tdocxml=nessus_request('report/delete', post)\r\n\t\treturn docxml\r\n\tend", "def destroy\n @doc = Doc.find(params[:id])\n @doc.destroy\n\n respond_to do |format|\n format.html { redirect_to(docs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @doc = Doc.find(params[:id])\n @doc.destroy\n\n respond_to do |format|\n format.html { redirect_to(docs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @vdocs_requirement = VdocsRequirement.find(params[:id])\n @vdocs_requirement.destroy\n\n respond_to do |format|\n format.html { redirect_to(vdocs_requirements_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @dl_type = DlType.find(params[:id])\n @dl_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(downloads_admin_dl_types_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @segment = Segment.find(params[:id])\n @segment.destroy\n\n respond_to do |format|\n format.html { redirect_to(worldreach_segments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user_testcase_xref = UserTestcaseXref.find(params[:id])\n @user_testcase_xref.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_testcase_xrefs_url) }\n format.xml { head :ok }\n end\n end", "def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end", "def destroy\n @feefile = Feefile.find(params[:id])\n directory= \"uploads\"\n path =File.join(directory,@feefile.feefilename)\n File.delete(path)\n @feefile.destroy\n \n\n respond_to do |format|\n format.html { redirect_to(feefiles_url) }\n format.xml { head :ok }\n end\n end", "def delete\n\n\tend", "def destroy\n @dataset = Dataset.find(params[:id])\n @dataset.destroy\n\n respond_to do |format|\n format.html { redirect_to(datasets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @dataset = Dataset.find(params[:id])\n @dataset.destroy\n\n respond_to do |format|\n format.html { redirect_to(datasets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @visarequest = Visarequest.find(params[:id])\n @visarequest.destroy\n\n respond_to do |format|\n format.html { redirect_to(visarequests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @dataset.destroy\n\n respond_to do |format|\n format.html { redirect_to(datasets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @documento = @externo.documentos.find(params[:id])\n @documento.destroy\n\n respond_to do |format|\n format.html { redirect_to(documentos_url(@externo)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @district = District.find(params[:id])\n @district.destroy\n\n respond_to do |format|\n format.html { redirect_to(districts_url) }\n format.xml { head :ok }\n end\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def destroy\n @dataed = Dataed.find(params[:id])\n @dataed.destroy\n\n respond_to do |format|\n format.html { redirect_to(dataeds_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end", "def destroy\n @vtodo = Vtodo.find(params[:id])\n @vtodo.destroy\n\n respond_to do |format|\n format.html { redirect_to(vtodos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @rdv.destroy\n respond_to do |format|\n format.html { redirect_to rdvs_url, notice: 'Rdv was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @vendor_doc = VendorDoc.find(params[:id])\n @vendor_doc.destroy\n\n respond_to do |format|\n format.html { redirect_to(contract_vdocs_requirements_url(@vendor_doc.vdocs_requirement.contract)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @drug = Drug.find(params[:id])\n @drug.destroy\n\n respond_to do |format|\n format.html { redirect_to(drugs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @pdv = Pdv.find(params[:id])\r\n @pdv.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to pdvs_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @dvr.destroy\n respond_to do |format|\n format.html { redirect_to dvrs_url, notice: 'Dvr was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @gtd = Gtd.find(params[:id])\n @gtd.destroy\n\n respond_to do |format|\n format.html { redirect_to(gtds_url) }\n format.xml { head :ok }\n end\n end", "def delete\n @res = DialResult.find(params[:id])\n\t@res.destroy\n respond_to do |format|\n format.html { redirect_to :action => 'index' }\n format.xml { head :ok }\n end\n end", "def destroy\n @dailyreport = Dailyreport.find(params[:id])\n @dailyreport.destroy\n\n respond_to do |format|\n format.html { redirect_to(dailyreports_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @child_dupa2 = ChildDupa2.find(params[:id])\n @child_dupa2.destroy\n\n respond_to do |format|\n format.html { redirect_to(child_dupa2s_url) }\n format.xml { head :ok }\n end\n end", "def deleteEntityDocument( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/document\",params)\n end", "def destroy\n @consulta = Consulta.find(params[:id])\n @consulta.destroy\n\n respond_to do |format|\n format.html { redirect_to(consultas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @consulta = Consulta.find(params[:id])\n @consulta.destroy\n\n respond_to do |format|\n format.html { redirect_to(consultas_url) }\n format.xml { head :ok }\n end\n end" ]
[ "0.6729065", "0.6678106", "0.6599096", "0.65213645", "0.64879185", "0.64695346", "0.639679", "0.6383926", "0.63635933", "0.6357291", "0.6327999", "0.62914777", "0.62910974", "0.62866396", "0.6248221", "0.62423587", "0.62402815", "0.6238557", "0.62075335", "0.6204866", "0.6198656", "0.61858356", "0.61840105", "0.6177974", "0.6166139", "0.615235", "0.61501604", "0.6141576", "0.6140094", "0.6133943", "0.6127189", "0.6125783", "0.6123614", "0.6099955", "0.60947573", "0.6091048", "0.6090108", "0.60810184", "0.60798585", "0.607711", "0.60749495", "0.6070749", "0.6068592", "0.6064705", "0.6064423", "0.60610485", "0.6058178", "0.605664", "0.6049574", "0.6047601", "0.60471326", "0.6041983", "0.6041983", "0.6037959", "0.60363775", "0.6032229", "0.6027459", "0.60238916", "0.60220873", "0.6021422", "0.6021226", "0.6009339", "0.60086995", "0.60086995", "0.600717", "0.6006918", "0.60045713", "0.6002907", "0.6000075", "0.5997404", "0.5997195", "0.599273", "0.599273", "0.5992675", "0.5987974", "0.5987962", "0.5987053", "0.59818786", "0.59818786", "0.59818786", "0.59818786", "0.59818786", "0.59818786", "0.59818786", "0.59800196", "0.5973194", "0.5967969", "0.5964677", "0.59590375", "0.595232", "0.5947439", "0.5946064", "0.5941992", "0.5937915", "0.5935721", "0.5935295", "0.5933433", "0.59309435", "0.5927692", "0.5927692" ]
0.67309105
0
Here we want to make a method add_song that takes in an argument of a song and associates that song with the artist by telling the song that it belongs to that artist.
def add_song(song) # We want to tell the song_name passed in that it belongs to the instance # of Artist for which this method is called on aka self. song.artist = self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_song(song) # Third, we create 'add_song' to associate a song name with a particular artist.\n song.artist = self # When we call 'song.artist', we set the result equal to 'self', or the artist on which we are calling the method.\n end", "def add_song(song)\n @songs << song #add songs by sheveling song into the @song instance\n song.artist = self #add artists name of the songs\n end", "def add_song(song)\n #associates a song to the artist's collection\n @songs << song\n song.artist = self\n end", "def add_song(song)\n # song.artist = self # assigns the current artist to the song's 'artist' property (song belongs to artist)\n #@songs << song #adds the song to the current artist's 'songs' collection \n ##does not assign the artist if the song already has an artist\n if song.artist == self\n song.artist\n else\n song.artist = self\n end \n # does not add the song to the current artist's collection of songs if it already exists therein\n if songs.include?(song)\n song\n else\n songs << song\n end \n songs\n end", "def add_song(song) ### arg is song instance ###\n\t\tsong.artist = self\n\t\tsong.artist.songs << song\n\tend", "def add_song(song)\n song.artist = self #associate the song with this artist\n end", "def add_song(song)\n if song.artist == nil #does not assign the song if the song already has an artist\n song.artist = self #assigns current artist to songs artist property\n else\n nil\n end\n if @songs.include?(song)\n nil\n else\n @songs << song #adds song, does not add the song if already exists\n end\n song\n end", "def add_song(song) #=> we found out by looking at the test that the argument is a song instance\n # the following code tells the current artist calling the method what new song it has:\n self.songs << song\n # but the test is asking us for the inverse of this - instead of telling artist \n # about its songs, we need to tell song about its artist:\n song.artist = self\n # inside the Artist instance scope, Self refers to the artist object calling the add_song method\n end", "def add_song(song)\n song.artist = self\n @songs << song\n end", "def add_song(song)\n song.artist = self\n @songs << song\n end", "def add_song(song)\n self.songs << song\n new_song = Song.new(song)\n new_song.artist = self\n end", "def add_song(song)\n @@songs << song\n song.artist = self\n end", "def add_song(song)\n song.artist = self\n end", "def add_song(song)\n song.artist = self\n end", "def add_song(song)\n song.artist = self\n end", "def add_song(song)\n song.artist = self\n end", "def add_song(song)\n song.artist = self\n end", "def add_song(song)\n song.artist = self\n end", "def add_song(song)\n # Add song to @songs if it doesn't already exist\n @songs << song if !@songs.include?(song)\n # Add artist if not already assigned\n song.artist = self if song.artist ==nil\n save\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song)\n song.artist = self \n end", "def add_song(song)\n @songs << song\n song.artist = self\n\n end", "def add_song(song)\r\n @songs << song\r\n song.artist = self\r\n end", "def add_song(song)\n song.artist = self\n end", "def add_song(song)\n song.artist = self\n end", "def add_song(song)\n song.artist = self\n end", "def add_song(song)\n if self.songs.include?(song) == false\n @songs << song\n end\n\n if song.artist.nil? || song.artist == false\n song.artist = self\n end\n\n end", "def add_song(song)\n if song.artist!=self\n song.artist = self\n elsif !@songs.include?(song)\n @songs << song\n end\n end", "def add_song(song)\n song.artist = self\n end", "def add_song(song)\n @songs << song\n song.artist = self\nend", "def add_song(song)\n @song = song\n @songs << song\n\n @@song_count = @@song_count + 1\n song.artist = self\n end", "def add_song(song)\n if(!song.artist)\n song.artist = self\n end\n \n if(!self.songs.include?song)\n self.songs << song\n end\n end", "def add_song(song)\n song.artist = self #instead of @songs << song\n \n # - TEST -\n # hello = Song.new(\"Hello\")\n # adele.add_song(hello)\n # expect(adele.songs).to include(hello)\n # expect(hello.artist).to eq(adele) \n end", "def add_song(song)\n song.artist = self unless song.artist == self #the song's artist property here\n @songs << song unless @songs.include?(song)\n end", "def add_song(song)\n song.artist= self\n @songs << song\n end", "def add_song_by_name(song_name)\n # Create a new song called \"song\" with argument passed in.\n song = Song.new(song_name)\n # Associate it with the artist\n song.artist = self\n end", "def add_song(song)\n song.artist = self unless song.artist == self\n @songs << song unless @songs.include? song\n end", "def add_song(song)\n @@song_count += 1\n @songs << song\n song.artist = self #self refers to Artist\n\n end", "def add_song(song) #Add the instance of the song to the @songs array (but do NOT add duplicated)\n if @songs.include?(song) == false #So, check first to see if it has been added yet or not.\n @songs << song #Push the song into the array if it has not been added yet\n song.artist = self if song.artist == nil #If no artist (nil) then the Song's artist is self (this instance of the song/artist) Associates the two. else nil #If else (i.e. song is already included in the array, do not add it.)\n end\n end", "def add_song(song_title)\n #adds the song to the current artist's 'songs' collection = @songs\n #does not add the song to the current artist's collection of songs if it already exists therein\n songs << song_title if !songs.detect{|song| song == song_title}\n\n\n #assigns the current artist to the song's 'artist' property (song belongs to artist)\n #does not assign the artist if the song already has an artist\n\n song_title.artist = self if song_title.artist == nil\n end", "def add_song(song)\n songs << song\n end", "def add_song(song)\n song.artist = self \n #binding.pry\n end", "def add_song_by_name(name) #takes in argument name of (song)\n song = Song.new(name) #creating a new instance of a song\n song.artist = self #Right here all we're doing is associating the objects its that simple\n end", "def add_song_by_name(name)\nartist = Song.new(name)\nadd_song(artist)\nend", "def add_song(song)\n songs << song\n end", "def add_song(song)\n @songs << song\n song.artist = self\n @@sounds_count += 1\n\n end", "def add_song(song_to_be_added)\n @songs << song_to_be_added\n end", "def add_song(song) #song = #<Song:0x007fc75eb94420 @genre=#<Genre:0x007fc75eb94498 @name=\"rap\", @songs=[]>, @name=\"99 Problems\">\n\n self.songs << song\n end", "def add_song(song)\n @songs << song\n #here we use the self keyword to refer to the artist on which we are calling this method. We call the =artist method onto the song that is being passed as an argument and set that to self (the artist)\n song.artist = self\n#once we add a new song we want to increase the class array song count\n @@song_count +=1\n end", "def add_song(song)\n @songs << song\n end", "def add_song(song)\n @songs << song\n end", "def add_song(song)\n @songs << song\n end", "def add_song(song)\n @songs << song\n end", "def add_song(song)\n @songs << song\n end", "def add_song(song)\n @songs << song\n end", "def add_song(song_name)\n songs << song_name\n end", "def add_song(song)\n @songs << song \n end", "def add_song(song)\n\t\t@songs <<(song)\n\t\t\n\tend", "def add_song(song)\n @songs << song\nend", "def add_song(x)\n \t@songs << x\n end", "def add_song_by_name(title)\n new_song = Song.new(title)\n #tell the song it belongs to a specific artist\n add_song(new_song) #invoking previously written method\n end", "def add_song_by_name(name)\n\t\tSong.new(name).artist = self \n\tend", "def add_song_by_name(song_name)\n song = Song.new(song_name)\n @@songs << song\n song.artist = self\n end", "def add_song_by_name(song_name)\n song = Song.new(song_name)\n song.artist = self\n @songs << song\n end", "def add_song_and_artist(library_hash, artist, song)\n library_hash[artist] = song\n return library_hash\nend", "def add_song(song)\n @songs.push(song)\n end", "def artist_name=(name)\n self.artist = Artist.find_or_create_by_name(name)\n #return the new song instance\n artist.add_song(self)\n end", "def add_song(song)\n if(!songs.include?song)\n songs.add(song)\n end\n end", "def artist= (artist)\n @artist = artist\n artist.add_song(self)\n end", "def add_song_by_name(name)\n song = Song.new(name)\n @songs << song\n song.artist = self\n end", "def add_song_by_name(name)\n song = Song.new(name)\n @songs << song\n song.artist = self\n end", "def artist=(artist)\n @artist = artist\n artist.add_song(self)\n end", "def artist=(artist)\n @artist = artist\n artist.add_song(self)\n end", "def artist=(artist)\n @artist = artist\n artist.add_song(self)\n end", "def add_song_by_name(song_title) #enter string title\n song = Song.new(song_title) # initialize new song by title\n self.add_song(song)\t# call add_song method to\n\tend", "def add_song(song_instance)\n songs << song_instance\n end", "def add_song(song)\n @song_list.push(song)\n end", "def artist=(artist)\n @artist = artist\n @artist.add_song(self)\n end", "def add_song_by_name(name)\n song = Song.new(name)\n song.artist = self\n end", "def add_song_by_name(name)\n song = Song.new(name)\n song.artist = self\n end", "def add_song(song)\n #@song << song\n #song.artist = self \n self.songs << song \n \n # self.songs << song \n #binding.pry \n end", "def add_song(song)\n # I hava class varaible @@all in Song class\n # the song is adding to self (refering to the \n # Artist)\n # adds that song to the artist's collection\n # HOW??? \n @song << song # without it\n song.artist = self \n #binding.pry\n end", "def add_song(song)\n return if Song.find_by_id(song).nil?\n songs << song\n end", "def add_song(song)\n song.genre = self unless song.genre\n @songs << song unless @songs.include?(song)\n end", "def artist=(artist)\n @artist = artist\n artist.add_song(self)\n end", "def artist_name=(name)\n #object attr\n self.artist = Artist.find_or_create_by_name(name)\n\n artist.add_song(self)\n\n end", "def artist=(artist) #assigns an artist to the song (song belongs to artist)\n @artist = artist #artist is reading from Song class artist method(reader)\n artist.add_song(self) #invokes Artist#add_song to add itself to the artist's collection of songs (artist has many songs)\n end", "def artist=(the_artist)\n @artist = the_artist\n if @artist \n @artist.add_song(self)\n end\n @artist\n end", "def add_a_song(song)\n @list_of_songs.push(song)\n end", "def add_artist_to_album!(album_object, artist_name)\n if ((!album_object.artist) || album_object.artist.name != artist_name)\n if(artist_object_blank?(artist_name))\n artist = create_artist_object_with_name!(artist_name)\n else\n artist = find_artist_object_by_name(artist_name)\n end\n\n album_object.artist_id = artist.id\n end\n end" ]
[ "0.9042165", "0.8549802", "0.84904087", "0.8483025", "0.84642076", "0.84505314", "0.8435702", "0.8414457", "0.84127015", "0.84127015", "0.8391136", "0.8389795", "0.838415", "0.838415", "0.838415", "0.838415", "0.838415", "0.838415", "0.83786017", "0.8346484", "0.8346484", "0.8346484", "0.8346484", "0.8346484", "0.8346484", "0.8346484", "0.8346484", "0.8346484", "0.8346484", "0.8346484", "0.83285755", "0.8308063", "0.8303972", "0.82807386", "0.82807386", "0.82807386", "0.82532984", "0.8242897", "0.823441", "0.82256055", "0.8187814", "0.8166545", "0.81553155", "0.8132296", "0.81250465", "0.80975455", "0.80943555", "0.8083054", "0.80400753", "0.79954046", "0.79332113", "0.79189104", "0.7905826", "0.7875247", "0.7869707", "0.784602", "0.7827291", "0.7801997", "0.77851725", "0.7759985", "0.7759985", "0.7759985", "0.7759985", "0.7759985", "0.7759985", "0.7750515", "0.77446437", "0.77391595", "0.7586386", "0.7571503", "0.75708777", "0.7565569", "0.7488898", "0.7446405", "0.7437624", "0.7412391", "0.73810947", "0.7373043", "0.7370299", "0.736711", "0.7347553", "0.73263824", "0.73263824", "0.73263824", "0.7313183", "0.73110014", "0.7303812", "0.7290471", "0.7282314", "0.7282314", "0.72817284", "0.72680205", "0.7263483", "0.72449887", "0.72277546", "0.71919394", "0.7191172", "0.7178057", "0.7171289", "0.7105207" ]
0.86801213
1
Here we make a method add_song_by_name that takes in an argument of a song name, creates a new song with it, and associates the song and artist.
def add_song_by_name(song_name) # Create a new song called "song" with argument passed in. song = Song.new(song_name) # Associate it with the artist song.artist = self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_song_by_name(song_name)\n song = Song.new(song_name)\n song.artist = self\n @songs << song\n end", "def add_song_by_name(name) #takes in argument name of (song)\n song = Song.new(name) #creating a new instance of a song\n song.artist = self #Right here all we're doing is associating the objects its that simple\n end", "def add_song_by_name(name)\n song = Song.new(name)\n @songs << song\n song.artist = self\n end", "def add_song_by_name(name)\n song = Song.new(name)\n @songs << song\n song.artist = self\n end", "def add_song_by_name(song_name)\n song = Song.new(song_name)\n @@songs << song\n song.artist = self\n end", "def add_song_by_name(name)\n song = Song.new(name)\n song.artist = self\n end", "def add_song_by_name(name)\n song = Song.new(name)\n song.artist = self\n end", "def add_song_by_name(name)\n song = Song.new(name)\n song.artist = self\n @songs << song\n @@song_count += 1\n end", "def add_song_by_name(song_name)\n Song.new(song_name, self)\n end", "def add_song_by_name(name)\n song = Song.new(name)\n add_song(song)\n \n # -TEST-\n # adele.add_song_by_name(\"Rolling in the Deep\")\n # expect(adele.songs.last.name).to eq(\"Rolling in the Deep\")\n # expect(adele.songs.last.artist).to eq(adele)\n end", "def add_song_by_name(song)\n @name = song\n\n new_instance = Song.new(@name)\n add_song(new_instance)\n\n end", "def add_song_by_name(name)\n\t\tSong.new(name).artist = self \n\tend", "def add_song_by_name(name)\nartist = Song.new(name)\nadd_song(artist)\nend", "def add_song_by_name(name)\n song = Song.new(name)\n @songs << song\n song.artist = self\n @@sounds_count += 1\n end", "def add_song_by_name(title)\n new_song = Song.new(title)\n #tell the song it belongs to a specific artist\n add_song(new_song) #invoking previously written method\n end", "def add_song_by_name(song_title) #enter string title\n song = Song.new(song_title) # initialize new song by title\n self.add_song(song)\t# call add_song method to\n\tend", "def add_song(song_name)\n songs << song_name\n end", "def artist_name=(name)\n self.artist = Artist.find_or_create_by_name(name)\n #return the new song instance\n artist.add_song(self)\n end", "def artist_name=(name)\n self.artist =Artist.find_or_create_by_name(name)\n artist.add_song(self)\n end", "def artist_name=(name)\n @artist = Artist.find_or_create_by_name(name)\n artist.add_song(self)\n end", "def artist_name=(name)\n self.artist = Artist.find_or_create_by_name(name)\n artist.add_song(self)\n end", "def artist_name=(name)\n self.artist = Artist.find_or_create_by_name(name)\n artist.add_song(self)\n end", "def artist_name=(name)\n self.artist = Artist.find_or_create_by_name(name)\n artist.add_song(self)\n end", "def artist_name=(name)\n self.artist = Artist.find_or_create_by_name(name)\n artist.add_song(self)\n end", "def artist_name=(name)\n self.artist = Artist.find_or_create_by_name(name)\n artist.add_song(self)\n end", "def artist_name=(name)\n self.artist = Artist.find_or_create_by_name(name)\n artist.add_song(self)\n end", "def artist_name=(name)\n artist = Artist.find_or_create_by_name(name)\n artist.add_song(self)\n self.artist = artist\n end", "def artist_name=(name)\n #object attr\n self.artist = Artist.find_or_create_by_name(name)\n\n artist.add_song(self)\n\n end", "def add_song(song) # Third, we create 'add_song' to associate a song name with a particular artist.\n song.artist = self # When we call 'song.artist', we set the result equal to 'self', or the artist on which we are calling the method.\n end", "def add_song(song)\n @songs << song #add songs by sheveling song into the @song instance\n song.artist = self #add artists name of the songs\n end", "def artist_name=(artist_name)\n self.artist = Artist.find_or_create_by_name(artist_name)\n self.artist.add_song(self)\n end", "def artist_name=(name)\n # binding.pry\n if (self.artist.nil?)\n self.artist = Artist.find_or_create_by_name(name)\n self.artist.add_song(self) \n end\n \n end", "def add_song(song)\n # We want to tell the song_name passed in that it belongs to the instance\n # of Artist for which this method is called on aka self.\n song.artist = self\n end", "def artist_name=(name)\n # The actual assignment of the artist \"michael jackson\"\n # to the Song instance variable occurs in the .add_song \n # method in the Artist class.\n Artist.find_or_create_by_name(name).add_song(self)\n end", "def artist_name=(name)\n self.artist = Artist.find_or_create_by_name(name)\n artist.add_song(self)\n binding.pry\n end", "def add_song(song)\n self.songs << song\n new_song = Song.new(song)\n new_song.artist = self\n end", "def add_song(song)\n # Add song to @songs if it doesn't already exist\n @songs << song if !@songs.include?(song)\n # Add artist if not already assigned\n song.artist = self if song.artist ==nil\n save\n end", "def add_song(song)\n if song.artist == nil #does not assign the song if the song already has an artist\n song.artist = self #assigns current artist to songs artist property\n else\n nil\n end\n if @songs.include?(song)\n nil\n else\n @songs << song #adds song, does not add the song if already exists\n end\n song\n end", "def new_song(name, artist)\n Song.new(name, artist, self)\n end", "def new_song(name, artist)\n Song.new(name, artist, self)\n end", "def new_song(name, artist)\n Song.new(name, artist, self)\n end", "def add_song(song)\n songs << song\n end", "def add_song(song)\n songs << song\n end", "def artist_name=(name)\n # Get the instance of the Artist class that represents that artist.\n self.artist = Artist.find_or_create_by_name(name)\n\n # Assign the song to the artist (Since an artist has many songs, we'll want to make this association\n # Now that we have the artist instance,\n # we'll want to again collaborate with the Artist class by calling on the Artist#add_song(some_song) method.\n self.artist.add_song(self)\n\n end", "def add_song(song)\n @song = song\n @songs << song\n\n @@song_count = @@song_count + 1\n song.artist = self\n end", "def add_song(song)\n # song.artist = self # assigns the current artist to the song's 'artist' property (song belongs to artist)\n #@songs << song #adds the song to the current artist's 'songs' collection \n ##does not assign the artist if the song already has an artist\n if song.artist == self\n song.artist\n else\n song.artist = self\n end \n # does not add the song to the current artist's collection of songs if it already exists therein\n if songs.include?(song)\n song\n else\n songs << song\n end \n songs\n end", "def add_song(song)\n song.artist = self\n @songs << song\n end", "def add_song(song)\n song.artist = self\n @songs << song\n end", "def add_song(song)\n @@song_count += 1\n @songs << song\n song.artist = self #self refers to Artist\n\n end", "def artist_name=(name)\n self.artist = Artist.find_or_create_by(name: name)\n end", "def artist_name=(name)\n self.artist = Artist.find_or_create_by(name: name)\n end", "def artist_name=(name)\n self.artist = Artist.find_or_create_by(name: name)\n end", "def artist_name=(name)\n self.artist = Artist.find_or_create_by(name: name)\n end", "def add_song(song)\n @@songs << song\n song.artist = self\n end", "def artist_name=(name)\n self.artist = Artist.find_or_create_by(name: name)\n end", "def artist_name=(name)\n self.artist = Artist.find_or_create_by(name: name)\n end", "def add_artist_to_album!(album_object, artist_name)\n if ((!album_object.artist) || album_object.artist.name != artist_name)\n if(artist_object_blank?(artist_name))\n artist = create_artist_object_with_name!(artist_name)\n else\n artist = find_artist_object_by_name(artist_name)\n end\n\n album_object.artist_id = artist.id\n end\n end", "def add_song(song)\r\n @songs << song\r\n song.artist = self\r\n end", "def add_song(song)\n #associates a song to the artist's collection\n @songs << song\n song.artist = self\n end", "def add_song(song) #song = #<Song:0x007fc75eb94420 @genre=#<Genre:0x007fc75eb94498 @name=\"rap\", @songs=[]>, @name=\"99 Problems\">\n\n self.songs << song\n end", "def add_song(song_title)\n #adds the song to the current artist's 'songs' collection = @songs\n #does not add the song to the current artist's collection of songs if it already exists therein\n songs << song_title if !songs.detect{|song| song == song_title}\n\n\n #assigns the current artist to the song's 'artist' property (song belongs to artist)\n #does not assign the artist if the song already has an artist\n\n song_title.artist = self if song_title.artist == nil\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song) ### arg is song instance ###\n\t\tsong.artist = self\n\t\tsong.artist.songs << song\n\tend", "def add_song(song)\n\t\t@songs <<(song)\n\t\t\n\tend", "def artist_name=(name)\n self.artist = Artist.find_or_create_by(name: name)\n self.artist = artist\n end", "def initialize(name) # 1. #initialize with #name accepts name for artist\n @name = name # 1. initialize with #name accepts name for artist\n @songs = [] # #3. songs keeps track of artist's songs\n end", "def add_song(song)\n @songs << song\n end", "def add_song(song)\n @songs << song\n end", "def add_song(song)\n @songs << song\n end", "def add_song(song)\n @songs << song\n end", "def add_song(song)\n @songs << song\n end", "def add_song(song)\n @songs << song\n end", "def artist_name=(name)\n self.artist = Artist.find_or_create_by_name(name)\n end", "def artist_name=(name)\n self.artist = Artist.find_or_create_by_name(name)\n end", "def artist_name=(name)\n artist = Artist.find_or_create_by(name: name)\n self.artist = artist\n end", "def initialize(name)\n @name = name\n @songs = [ ]\n #peter.song = (\"pit\") How to attribute song to the artist after the artist is create.\n end", "def add_song(song)\n if(!song.artist)\n song.artist = self\n end\n \n if(!self.songs.include?song)\n self.songs << song\n end\n end", "def add_song(song) #=> we found out by looking at the test that the argument is a song instance\n # the following code tells the current artist calling the method what new song it has:\n self.songs << song\n # but the test is asking us for the inverse of this - instead of telling artist \n # about its songs, we need to tell song about its artist:\n song.artist = self\n # inside the Artist instance scope, Self refers to the artist object calling the add_song method\n end", "def add_song(song_to_be_added)\n @songs << song_to_be_added\n end", "def new_song(name, genre)\n song = Song.new(name, self, genre)\n @songs << song\n song\n end", "def add_song(song)\n if song.artist!=self\n song.artist = self\n elsif !@songs.include?(song)\n @songs << song\n end\n end", "def initialize(name)\n @name = name \n @artist = artist \n\n Song.all << self \n end", "def add_song(song)\n @songs << song\n song.artist = self\n\n end", "def add_song(song) #Add the instance of the song to the @songs array (but do NOT add duplicated)\n if @songs.include?(song) == false #So, check first to see if it has been added yet or not.\n @songs << song #Push the song into the array if it has not been added yet\n song.artist = self if song.artist == nil #If no artist (nil) then the Song's artist is self (this instance of the song/artist) Associates the two. else nil #If else (i.e. song is already included in the array, do not add it.)\n end\n end", "def artist_name=(name)\n # When instantiating, set the .artist attribute to what is input in name\n self.artist = Artist.find_or_create_by(name: name)\n\n end", "def add_song(song)\n if self.songs.include?(song) == false\n @songs << song\n end\n\n if song.artist.nil? || song.artist == false\n song.artist = self\n end\n\n end", "def add_song(song)\n song.artist = self #associate the song with this artist\n end", "def add_song(song)\n @songs.push(song)\n end", "def add_song(song)\n @songs << song\n song.artist = self\n @@sounds_count += 1\n\n end", "def add_song(song)\n @songs << song \n end" ]
[ "0.8796029", "0.8791209", "0.87682277", "0.8764704", "0.876115", "0.87141365", "0.87141365", "0.8692366", "0.8617347", "0.8602969", "0.85712034", "0.85517794", "0.853808", "0.8475339", "0.8433028", "0.8133378", "0.8076293", "0.80304086", "0.7768808", "0.7701056", "0.7688671", "0.7688671", "0.7688671", "0.7688671", "0.7627183", "0.7627183", "0.757671", "0.74790776", "0.74492496", "0.7385082", "0.7371282", "0.73239", "0.728354", "0.72803205", "0.7253182", "0.7187103", "0.7159392", "0.71217346", "0.7112788", "0.7112788", "0.7112788", "0.7083784", "0.7059276", "0.70480955", "0.7015034", "0.6992716", "0.6979434", "0.6979434", "0.6964511", "0.6944198", "0.6944198", "0.6944198", "0.6944198", "0.69439566", "0.6941172", "0.6941172", "0.69282347", "0.692403", "0.6918677", "0.6914319", "0.690485", "0.68928075", "0.68928075", "0.68928075", "0.68928075", "0.68928075", "0.68928075", "0.68928075", "0.68928075", "0.68928075", "0.68928075", "0.68928075", "0.6877718", "0.68571603", "0.6856968", "0.6855425", "0.68549", "0.68549", "0.68549", "0.68549", "0.68549", "0.68549", "0.6848355", "0.6848355", "0.68368965", "0.68213576", "0.681967", "0.68161917", "0.68148035", "0.68119836", "0.6806126", "0.6803064", "0.6776203", "0.6768435", "0.67682654", "0.67663914", "0.67584264", "0.673454", "0.6727111", "0.67235446" ]
0.90073407
0
This method will make it so each Artist is able to HAVE MANY songs!
def songs # Select each song and set the artist value for it equal to the instance # of Artist that this method is being called on (self). Song.all.select do |song| song.artist == self end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def artists(artist)\n if song.artist = nil || !Artist.find_by_name(name)\n song.artist = artist \n Artist.all << artist \n end \n end", "def initialize(name) # an Artist instance is initialized w a name\n @name = name\n @songs = [] # each Artist instance will have many songs and this array will hold those songs\n end", "def initialize\n # @@artists << self\n super\n @songs = []\n end", "def add_song(song)\n # song.artist = self # assigns the current artist to the song's 'artist' property (song belongs to artist)\n #@songs << song #adds the song to the current artist's 'songs' collection \n ##does not assign the artist if the song already has an artist\n if song.artist == self\n song.artist\n else\n song.artist = self\n end \n # does not add the song to the current artist's collection of songs if it already exists therein\n if songs.include?(song)\n song\n else\n songs << song\n end \n songs\n end", "def add_song(song)\n @songs << song\n song.artist = self\n @@sounds_count += 1\n\n end", "def initialize\n @@artists << self #artists will be stored at @@artists\n @songs = [] #its empty waiting for to be initilized throu attr_reader\n end", "def test_add_song_to_playlist()\n assert_equal(0, @room_1.playlist_count())\n @room_1.add_song_to_playlist(@song_1)\n assert_equal(1, @room_1.playlist_count())\n @room_1.add_song_to_playlist(@song_2)\n assert_equal(2, @room_1.playlist_count())\n end", "def initialize(name) #everytime an Artist instance is created, this method is called. Everything inside the block is its properties\n @name = name\n @songs = []\n\n @@all << self\n end", "def songs # to entre the Song class then within the song class take the class variable all to use to select and go thought the songs listed in that array\n Song.all.select { |song| song.artist == self } # use the .select to gather the information we want from the all array in songs - go thought and assign each song artist to this current instance\n end", "def initialize\n #@@artists << self #push the instance (self) of the class into the @@all class variable, on which they are being called\n super\n @songs = [] #variable of instence; empty\n end", "def add_songs(songs)\n songs.each { |song| add_song(song) }\n end", "def add_songs(songs)\n songs.each { |song| add_song(song) }\n end", "def add_songs(songs)\n songs.each { |song| add_song(song) }\n end", "def test_check_for_songs_added_to_list\n song = Song.new({title: \"Dancing Queen\"})\n assert_equal(0, @room1.song_list_length())\n end", "def test_add_two_song_to_song_list\n song1 = Song.new({title: \"Dancing Queen\", artist: \"ABBA\"})\n song2 = Song.new({title: \"Parklife\", Artist: \"Blur\"})\n # song2 = Song.new({title: \"Parklife\"})\n @room1.song_list(song1)\n @room1.song_list(song2)\n assert_equal(2, @room1.song_list_length())\n end", "def artists # it looks like a reader but it's more complicated\n # a has many through\n @songs.collect{|song| song.artist}.uniq #=> This is called a <<has-many-through>>\n end", "def add_song(song)\n song.artist= self\n @songs << song\n end", "def songs\n #use select to iterate thru songs\n Song.all.select{|song| song.artist == self}\n end", "def initialize\n super\n @songs = []\n end", "def initialize\n super\n @songs = []\n end", "def artists\n songs.collect do |song|\n song.artist\n end\n .uniq #does not return duplicate artists if the genre has more than one song by a particular artist (genre has many artists through songs)\n end", "def add_song(song)\n @songs << song\n #here we use the self keyword to refer to the artist on which we are calling this method. We call the =artist method onto the song that is being passed as an argument and set that to self (the artist)\n song.artist = self\n#once we add a new song we want to increase the class array song count\n @@song_count +=1\n end", "def initialize\n @@songs << self #intilized songs will be added to @@songs\n end", "def initialize #initializes songs belonging to artist\r\n @song = artist\r\n end", "def add_song(song)\n if self.songs.include?(song) == false\n @songs << song\n end\n\n if song.artist.nil? || song.artist == false\n song.artist = self\n end\n\n end", "def initialize\n ARTISTS << self\n self.song = []\n self.genre = []\n end", "def add_song(song)\n #associates a song to the artist's collection\n @songs << song\n song.artist = self\n end", "def add_song(song)\n @@song_count += 1\n @songs << song\n song.artist = self #self refers to Artist\n\n end", "def all_songs\n end", "def mutual_songs (user_id)\n User.exists?(user_id) ? (self.my_songs & User.find(user_id).my_songs).size : 0\n end", "def add_song(song)\n @songs << song\n song.artist = self\nend", "def songs\n Song.all.select {|song| song.artist = self}\n end", "def test_add_song_to_song_list\n song1 = Song.new({title: \"Dancing Queen\"})\n @room1.song_list(song1)\n assert_equal(1, @room1.song_list_length())\n end", "def artists\n # - this method will show the connection between songs and artists \n self.songs.collect do |f| \n f.artist\n end\n end", "def add_song(song)\n song.artist = self unless song.artist == self #the song's artist property here\n @songs << song unless @songs.include?(song)\n end", "def add_song(song)\n song.artist = self unless song.artist == self\n @songs << song unless @songs.include? song\n end", "def valid_songs(songs)\n song_ids & songs\nend", "def initialize(name, artist = nil, genre = nil) #sets name on initialization\n @name= name #sets property correctly\n @songs= []\n artist.add_song(self) if artist\n genre.add_song(self) if genre\n end", "def songs\n\t\t@musician = User.find_by_id(current_user.id)\n\tend", "def artists\n artists = []\n self.songs.each do |song|\n artists << song.artist\n end\n artists.uniq\n end", "def initialize(name)\n @name = name #the artist's name\n @songs = [] #the artist's collection of songs\n end", "def add_song(song)\n @songs << song\n song.artist = self\n\n end", "def songs\n Song.all.select do |song| \n song.artist == self\n end \n end", "def songs\n Song.all.select{|song| song.artist == self}\n end", "def add_song(song)\n if song.artist!=self\n song.artist = self\n elsif !@songs.include?(song)\n @songs << song\n end\n end", "def artists\n genre_artists = []\n Song.all.each {|song|\n if song.genre == self &&\n !genre_artists.include?(song.artist)\n genre_artists << song.artist\n end\n }\n genre_artists\n end", "def songs\n Song.all.select{|song|song.artist == self}\n end", "def songs\n Song.all.select {|song| song.artist == self }\n end", "def add_song(song)\n @songs << song #add songs by sheveling song into the @song instance\n song.artist = self #add artists name of the songs\n end", "def add_song(song) #Add the instance of the song to the @songs array (but do NOT add duplicated)\n if @songs.include?(song) == false #So, check first to see if it has been added yet or not.\n @songs << song #Push the song into the array if it has not been added yet\n song.artist = self if song.artist == nil #If no artist (nil) then the Song's artist is self (this instance of the song/artist) Associates the two. else nil #If else (i.e. song is already included in the array, do not add it.)\n end\n end", "def songs\n Song.all.select do |song_instance|\n song_instance.artist == self \n end\n end", "def initialize\n @songs = []\n end", "def initialize\n @songs = []\n end", "def songs\n Song.all.select do |song_instance|\n song_instance.artist == self\n end\n end", "def initialize\n @songs = []\n end", "def n_artists\n if ! @n_artists_found\n @n_artists_found = songs_found\n .group_by{ |s| s[IDX_ARTIST_ID] }\n .length\n end\n return @n_artists_found\n end", "def initialize(name)\n @name = name\n @songs = [] #artist's collection of songs\n end", "def songs\n Song.all.select {|song| song.artist == self}\n end", "def songs\n Song.all.select {|song| song.artist == self}\n end", "def initialize(name) #accepts a name for the new artist\n @name = name\n @songs = [] #initialize a songs property set to an empty array\n end", "def add_song(song) ### arg is song instance ###\n\t\tsong.artist = self\n\t\tsong.artist.songs << song\n\tend", "def initialize(name=\"\", artist=\"\", genre=\"\")\n @name = name\n @artist = artist\n @genre = genre\n @@all_songs << self\n\n end", "def songs\n Song.all.select {|song| song.artist == self}\n end", "def number_of_artists\n return @artists.length\n end", "def number_of_artists\n return @artists.length\n end", "def initialize(name) #give them a name and songs array right off the bat. They will have many songs\n @name = name\n @songs = []\n end", "def test_song_already_added_to_playlist()\n @room_1.add_song_to_playlist(@song_1)\n @room_1.add_song_to_playlist(@song_1)\n assert_equal(1, @room_1.playlist_count())\n end", "def songs\n Song.all_by_artist(self)\n end", "def number_of_songs()\n return songs.length\n end", "def number_of_songs()\n return songs.length\n end", "def related_songs\n unless self.spotify_track_id.nil?\n related_artists = self.spotify_track.artists.first.related_artists\n\n related_artists.shuffle[0..4].map do |artist|\n artist.top_tracks('IE').shuffle.first\n end.flatten\n else\n Array.new\n end\n\n\n end", "def initialize(name)\n @name = name\n @songs = [ ]\n #peter.song = (\"pit\") How to attribute song to the artist after the artist is create.\n end", "def songs\n Song.all.select{|song| song.artist == self}\n end", "def initialize(name) #Creates new instance\n @name = name #Sets instance variable name to name\n @songs = [] #Creates new instance variable array for new Artist\n @@all << self #Adds artist to class variable @@all\n end", "def add_song(song)\n if song.artist == nil #does not assign the song if the song already has an artist\n song.artist = self #assigns current artist to songs artist property\n else\n nil\n end\n if @songs.include?(song)\n nil\n else\n @songs << song #adds song, does not add the song if already exists\n end\n song\n end", "def add_song(song)\r\n @songs << song\r\n song.artist = self\r\n end", "def build\n PlaylistTrack.delete_all\n #Track.delete_all\n #Album.delete_all\n #Artist.delete_all\n\n spotify_playlists = fetch_all_playlists_from_spotify\n spotify_playlists.each do |spot_playlist|\n next if spot_playlist.owner.id != @current_user.spotify_user.id\n build_playlist(spot_playlist)\n end\n end", "def songs\n Song.all.select do |song|\n song.artist == self \n end \n end", "def song_ids=(ids)\n ids.each do |id|\n if !id.blank?\n song = Song.find(id)\n \n self.songs << song\n end \n end\n end", "def songs\n Song.all.select {|songs|songs.artist == self}\n end", "def add_song(song)\n # Add song to @songs if it doesn't already exist\n @songs << song if !@songs.include?(song)\n # Add artist if not already assigned\n song.artist = self if song.artist ==nil\n save\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song)\n @@songs << song\n song.artist = self\n end", "def initialize(name)\n @name = name # has a name\n @@all << self #all artist instances push into @@all\n @songs = []\n end", "def add_song(song)\n song.artist = self\n @songs << song\n end", "def add_song(song)\n song.artist = self\n @songs << song\n end", "def initialize(name) # 1. #initialize with #name accepts name for artist\n @name = name # 1. initialize with #name accepts name for artist\n @songs = [] # #3. songs keeps track of artist's songs\n end", "def songs\n Song.all.select {|song| song.artist == self}\n end", "def add_song(song_title)\n #adds the song to the current artist's 'songs' collection = @songs\n #does not add the song to the current artist's collection of songs if it already exists therein\n songs << song_title if !songs.detect{|song| song == song_title}\n\n\n #assigns the current artist to the song's 'artist' property (song belongs to artist)\n #does not assign the artist if the song already has an artist\n\n song_title.artist = self if song_title.artist == nil\n end", "def add_song(song)\n @songs << song \n end" ]
[ "0.62946147", "0.62897307", "0.61904734", "0.61540633", "0.6139414", "0.60718596", "0.6057385", "0.604872", "0.6015701", "0.6012161", "0.5999761", "0.5999761", "0.5999761", "0.5978175", "0.5977909", "0.59746736", "0.59712315", "0.5956654", "0.5953144", "0.5953144", "0.59435666", "0.5933959", "0.59289193", "0.5913055", "0.59003264", "0.5899393", "0.5894093", "0.5887332", "0.5884269", "0.58835447", "0.58810794", "0.5875786", "0.5859488", "0.58575743", "0.5855723", "0.585423", "0.5805983", "0.5780873", "0.5780092", "0.57764894", "0.5770891", "0.57653946", "0.5759043", "0.5758126", "0.5755208", "0.57449085", "0.5737375", "0.57271177", "0.57269716", "0.5726251", "0.57254326", "0.57245946", "0.57245946", "0.5721643", "0.57164073", "0.57144505", "0.571409", "0.57125366", "0.57125366", "0.57053334", "0.57014436", "0.5700971", "0.57006115", "0.5697667", "0.5697667", "0.5694304", "0.568796", "0.568383", "0.5682499", "0.5682499", "0.56822187", "0.5672179", "0.56713486", "0.5670203", "0.5667126", "0.5660659", "0.5650447", "0.56491053", "0.5641931", "0.5641723", "0.5640225", "0.5633804", "0.5633804", "0.5633804", "0.5633804", "0.5633804", "0.5633804", "0.5633804", "0.5633804", "0.5633804", "0.5633804", "0.5633804", "0.5631664", "0.56308913", "0.56253517", "0.56253517", "0.56180286", "0.5616254", "0.5614811", "0.5611963" ]
0.5935858
21
TODO: Use accepts_nested_attributes instead of something like this
def update_features(feature_ids=[]) existing_ad_features = self.ad_features existing_ad_features.select{|ad_feature| !feature_ids.include?(ad_feature.feature_id)}.each &:destroy feature_ids.each do |feature_id| ad_feature = existing_ad_features.find_by_feature_id(feature_id) ad_feature ||= self.ad_features.create(feature_id: feature_id) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def accepts_nested_attributes_for(name)\n attribute name, Array\n end", "def has_attributes?; end", "def nested_attributes\n []\n end", "def valid_attributes\n attributes_for :post\n end", "def valid_attributes\n {\n title: \"My Title\",\n committee_id: committee.id\n }\n end", "def valid_attributes\n {}\n end", "def valid_attributes\n {}\n end", "def valid_attributes\n {}\n end", "def valid_attributes\n {}\n end", "def valid_attributes\n {}\n end", "def valid_attributes\n {}\n end", "def valid_attributes\n {}\n end", "def valid_attributes\n {}\n end", "def accepts_nested_attributes_for(*attr_names)\n options = attr_names.extract_options!\n options[:reject_if] = PARA_REJECT_ALL_BLANK_PROC if options[:reject_if] == :all_blank\n super(*attr_names, options)\n end", "def accepts_nested_attributes_for(*args)\n options = args.extract_options!.dup\n options[:autosave] = true if options[:autosave].nil?\n\n options[:reject_if] = REJECT_ALL_BLANK_PROC if options[:reject_if] == :all_blank\n args.each do |name|\n meth = \"#{name}_attributes=\"\n self.nested_attributes[\"#{name}_attributes\"] = meth\n association = relations[name.to_s]\n raise Errors::NestedAttributesMetadataNotFound.new(self, name) unless association\n autosave_nested_attributes(association) if options[:autosave]\n\n re_define_method(meth) do |attrs|\n _assigning do\n if association.polymorphic? and association.inverse_type\n options = options.merge!(:class_name => self.send(association.inverse_type))\n end\n association.nested_builder(attrs, options).build(self)\n end\n end\n end\n end", "def data_attributes\n end", "def valid_attributes\n { }\n end", "def valid_attributes\n { }\n end", "def valid_attributes\n { }\n end", "def valid_attributes\n {\n :title => 'Test Title',\n :user_id => 1\n }\n end", "def valid_attributes\n { comment: \"hi\"}\n end", "def nestedform_params\n params.require(:nestedform).permit(:title, contents_attributes: [:name])\n end", "def copyable_attributes; end", "def include_attributes\n @include_attributes\n end", "def valid_attributes\n {\n :content => 'test content',\n :author_id => 1,\n :page_id => 1\n }\n end", "def valid_attributes\n {\"name\"=>'Magasin', \"organism_id\"=>@o.id.to_s}\n end", "def form_attributes\n attributes - read_only_attributes\n end", "def instance_attributes; end", "def check_for_hidden_nested_attributes(name, value)\n name_sym = name.to_sym\n\n reflection = self.class.reflect_on_association(name_sym)\n\n if reflection\n if reflection.has_many? && value.is_a?(Array)\n hash = {}\n value.each_with_index do |_value, index|\n hash[index.to_s] = _value\n end\n value = hash\n end\n name = \"#{name}_attributes\"\n end\n\n [name, value]\n end", "def valid_attributes\n attributes_for(:announcement)\n end", "def input_attributes\n super || default_attributes\n end", "def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end", "def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end", "def custom_data\n super.attributes\n end", "def valid_attributes\n {name: \"Businesses\"}\n end", "def required_attributes\n self.class.required_attributes\n end", "def attributes\n @build['attributes']\n end", "def valid_attributes\n @vendor.attributes\n end", "def valid_attributes\n { name: \"Expert\" }\n end", "def valid_attributes?\n true\n end", "def permitted_attributes\n klass.properties.keys.map(&:to_sym) + %i[id edit_users edit_groups read_groups visibility work_members_attributes]\n end", "def dynamic_attributes\n []\n end", "def nested_params\n\n params.require(:company).permit( :name, :credit_terms, :PO_required, :active, :bookkeeping_number, :line_of_business, :url, \n address_attributes: [:addressable_id, :addressable_type, :street_address, :city, :state, :post_code, :map_reference, :longitude, :latitude],\n identifier_attributes: [:id, :identifiable_id, :identifiable_type, :name, :value, :rank]\n )\n #params.require(:portrait_tag).permit(:id, :addressable_id => [])\n #person: [ :id, :people_id ] \n end", "def valid_attributes\n {title: \"atitle\"}\n end", "def user_params\n params.require(:user).permit(:name,\n :user => [:id, :start_date,\n children_attributes => [:id, :age, :gender, :user_id],\n location_attributes => [:address_one, :address_two, :city, :state, :zip, :latitude, :longitude, :user_id]\n ])\n end", "def nested_attributes_tags\n self.nested_attributes_options.keys.map(&:to_s)\n end", "def setup_object_attributes; end", "def valid_attributes\n { notes: \"hello\" }\n end", "def creation_attributes\n { }\n end", "def valid_attributes\n { \"name\" => \"Band\", \"creation_year\" => 2008 }\n end", "def permitted_params\n super() + [:tree_type, :leaf_position, :leaf_structure, :leaf_type]\n end", "def set_attributes(data_attributes)\n parent = data_attributes.delete(:parent)\n super\n self.parent = parent if parent\n end", "def dirty_attributes\n embedded_attributes = {}\n\n each_embedment do |name, target|\n case (embedment = embedments[name])\n when Embedments::OneToMany::Relationship\n target.each do |resource|\n if resource.dirty?\n embedded_attributes[embedment] ||= []\n embedded_attributes[embedment] << resource.dirty_attributes\n end\n end\n when Embedments::OneToOne::Relationship\n # Relationship target is a single resource.\n if target.dirty?\n embedded_attributes[embedment] = target.dirty_attributes\n end\n end\n end\n\n super.merge(embedded_attributes)\n end", "def valid_attributes\n {\n company_id: company.id\n }\n end", "def valid_attributes\n { name: 'do this' }\n end", "def create_attributes\n {}\n end", "def accept_all_attributes\n accept_attributes Object\n end", "def attr_params\n params[:attr].permit(:name, :type, :value, :foreign_key, :ordinal, :group, :visible, :editable, :required, :input)\n end", "def valid_attributes\n {\"contenders_attributes\" => {\n \"0\"=> {\n \"side\"=>\"0\",\n \"user_id\"=>\"4ebdf7ca34017011e4000004\",\n \"set1\"=>\"1\",\n \"set2\"=>\"6\",\n \"set3\"=>\"6\"},\n \"1\"=> {\n \"side\"=>\"1\",\n \"user_id\"=>\"4ebf533b34017004dc000009\",\n \"set1\"=>\"6\",\n \"set2\"=>\"2\",\n \"set3\"=>\"3\"}\n },\n \"competition_id\" => test_competition.id\n }\n end", "def parent_params\n params.require(:parent).permit(:mom_fname, :mom_lname, :dad_fname, :dad_lname, :email_id, :contact, :login_id, :password,students_attributes: [:id,:first_name, :last_name, :dob, :emergency_contact, :address_line1, :address_line2, :city, :zip, :state, :country])\n \n end", "def valid_attributes\n FactoryBot.attributes_for(:create_type)\n end", "def permitted_attributes\n [:completed, :title, :phase_id, :position]\n end", "def accessible_attributes\n\t [:name, :code ]\n\tend", "def merge_attributes(child, parent_attributes); end", "def attributes\n %i[id name description type placeholder parent_id]\n end", "def nested_attributes_update(meta, obj, attributes)\n nested_attributes_update_attributes(meta, obj, attributes)\n delay_validate_associated_object(meta[:reflection], obj)\n # Don't need to validate the object twice if :validate association option is not false\n # and don't want to validate it at all if it is false.\n after_save_hook{obj.save_changes(:validate=>false)}\n obj\n end", "def edit\n nested_resource_pre_build\n nested_resource_build\n end", "def validates_associated_post_records; end", "def validates_associated_post_records; end", "def permitted_attributes\n [:user_id, :code, :name, :status_id, :group_id, :contact_id, :body,\n :address, :hours, :notes, :live_date, :website, :rss, :twitter, :wiki,\n :logo,\n contact_attributes: %i[id name hidden email phone notes user_id _destroy]]\n end", "def valid_attributes\n {:name => 'Test it!', \n :deck_id => 1}\n end", "def your_attributes_valid\n do_validate_attributes('your')\n end", "def assign_nested_attributes_for_one_to_one_association(association_name, attributes)\n return if attributes.nil?\n\n super\n end", "def nested_attributes_create(meta, attributes)\n reflection = meta[:reflection]\n obj = reflection.associated_class.new\n nested_attributes_set_attributes(meta, obj, attributes)\n delay_validate_associated_object(reflection, obj)\n if reflection.returns_array?\n send(reflection[:name]) << obj\n after_save_hook{send(reflection.add_method, obj)}\n else\n associations[reflection[:name]] = obj\n\n # Because we are modifying the associations cache manually before the\n # setter is called, we still want to run the setter code even though\n # the cached value will be the same as the given value.\n @set_associated_object_if_same = true\n\n # Don't need to validate the object twice if :validate association option is not false\n # and don't want to validate it at all if it is false.\n if reflection[:type] == :many_to_one \n before_save_hook{send(reflection.setter_method, obj.save(:validate=>false))}\n else\n after_save_hook{send(reflection.setter_method, obj)}\n end\n end\n add_reciprocal_object(reflection, obj)\n obj\n end", "def export_attributes\n attributes.to_nested_hash\n end", "def export_attributes\n attributes.to_nested_hash\n end", "def export_attributes\n attributes.to_nested_hash\n end", "def tax_code_params\n params.require(:tax_code).permit(TaxCode.accessible_attributes.to_a)\n end", "def updatable_attributes\n [:name]\n end", "def valid_attributes\n {\n :tag_id => FactoryGirl.create(:tag),\n :start_time => Time.now,\n :user_id => @user.id\n }\n end", "def form_field_data\n @attributes[:form_field_data]\n end", "def valid_attributes\n {\n name: \"Event Name\"\n }\n end", "def user_requirement_params \n params.require(:user_requirement).permit(:user_id, :room_id, :furniture, user_requirement_styles_attributes: [:image, :content], user_requirement_goals_attributes: [:content] ) \n end", "def category_value_params\n# http://stackoverflow.com/questions/15919761/rails-4-nested-attributes-unpermitted-parameters \n params.require(:category_value).permit(:title, :category_type_id, :public, image_attributes: [\"file\", \"@original_filename\", \"@content_type\", \"@headers\"])\n # params.require(:category_value).permit!\n end", "def additional_fields; self.class.additional_fields end", "def additional_fields; self.class.additional_fields end", "def additional_fields; self.class.additional_fields end", "def _attributes_\n @_attributes_ ||= self.class.attributes.dup\n end", "def model_attributes\n raise NotImplementedError\n end", "def set_attributes\n attributes :all\n end", "def valid_attributes\n { judge_type_id: 1,\n user_id: @user.id }\n end", "def new\n nested_resource_pre_build\n nested_resource_build\n end", "def parent_child_params\n\t \tparams.require(:parent_child).permit(:child_id,:parent_id,:parent_email,:child_email,:parent_name,:child_name)\n\tend", "def valid_attributes\n { 'user_id' => subject.current_user.id, 'title' => 'El título', 'url' => 'La URL' }\n end", "def required_attributes\n self.class::REQUIRED_ATTRIBUTES\n end", "def class_attributes; end", "def essential_attributes\n [\"is_transient\",\"id\"]\n end", "def nested_object_fields\n @nested_object_fields\n end", "def form_fields\n @item_fields = @model.typus_fields_for('form')\n @item_has_many = @model.typus_relationships_for('has_many')\n @item_has_and_belongs_to_many = @model.typus_relationships_for('has_and_belongs_to_many')\n end", "def new\n # @resource = parent.medical_records.build\n # @resource.medical_record_images.build\n # @resource.laboratory_examination_images.build\n # @resource.imaging_examination_images.build\n super\n end", "def nested_attributes_update_attributes(meta, obj, attributes)\n nested_attributes_check_key_modifications(meta, obj) do\n nested_attributes_set_attributes(meta, obj, attributes)\n end\n end" ]
[ "0.7110692", "0.6701567", "0.6568755", "0.63059485", "0.6165946", "0.615746", "0.615746", "0.615746", "0.615746", "0.615746", "0.615746", "0.615746", "0.615746", "0.6075855", "0.60683256", "0.6058168", "0.605127", "0.5969936", "0.5969936", "0.59377205", "0.59155977", "0.5908057", "0.5903557", "0.5898885", "0.58981544", "0.58730584", "0.58698565", "0.58644605", "0.5823822", "0.57796735", "0.5775205", "0.5770527", "0.5770527", "0.5742309", "0.57359064", "0.57274026", "0.57260376", "0.5707487", "0.5668175", "0.5664906", "0.56570554", "0.5651188", "0.5648281", "0.5646521", "0.5631371", "0.5616748", "0.5612138", "0.5603912", "0.55985075", "0.55756944", "0.5575431", "0.55749935", "0.55728656", "0.5559857", "0.55584174", "0.55522174", "0.55448425", "0.5541285", "0.55387855", "0.5528084", "0.55274665", "0.5517958", "0.54977137", "0.54970413", "0.5494002", "0.5484576", "0.5479836", "0.5477759", "0.5477759", "0.54724413", "0.54724085", "0.54677176", "0.5466928", "0.54626703", "0.54535633", "0.54535633", "0.54535633", "0.5453466", "0.5450268", "0.54490006", "0.54450303", "0.54335743", "0.54223156", "0.5421044", "0.54202825", "0.54202825", "0.54202825", "0.54201674", "0.54198474", "0.5419619", "0.5407361", "0.5404032", "0.5403068", "0.5402125", "0.53983825", "0.53822196", "0.537102", "0.5369518", "0.5366566", "0.5364292", "0.53632545" ]
0.0
-1
delegate :decode, :to => :backend
def decode(json) @backend.decode(json) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode; end", "def decode; end", "def decode\n raise NotImplementedError\n end", "def decode\n transform :decode\n end", "def decode=(_arg0); end", "def decode=(_arg0); end", "def converter; end", "def decode(text); end", "def backend; end", "def backend=(backend); end", "def encoder; end", "def encoder; end", "def bdecode\n BEncode.load(self)\n end", "def backend=(backend)\n @backend = backend&.to_sym\n set_encoder\n end", "def converter\n end", "def decode(value)\n self.class.decode(value)\n end", "def decode(value)\n self.class.decode(value)\n end", "def decode(bytes)\n raise NotImplementedError, \"#{self.class.name}\\#decode\"\n end", "def encode!; end", "def he_decode(text); self.class.he_decode text; end", "def encoder=(_arg0); end", "def coder; end", "def decode_string(str)\n\nend", "def external_encoding()\n #This is a stub, used for indexing\n end", "def encode\n transform :encode \n end", "def encode_with(coder); end", "def decode(packet)\n proc.call packet\n end", "def delegate_method; end", "def converter\n\n end", "def set_decode\n @decode = Decode.find(params[:id])\n end", "def relay_from_backend(name, data)\r\n data = @on_response.call(name, data)\r\n send_data data unless data.nil?\r\n end", "def encode\n raise NotImplementedError\n end", "def internal_encoding()\n #This is a stub, used for indexing\n end", "def decode_frame\n raise NotImplementedError\n end", "def addon\n\t\tsuper.deserialize\n\tend", "def convert\n end", "def convert\n end", "def from_bencode\n BEncode.load(self)\n end", "def converters; end", "def converters; end", "def converters; end", "def decode data, encoding = nil\n if encoding.nil? || encoding == :plain\n data\n else\n send \"decode_#{encoding}\", data\n end\n end", "def acrostic_decoder(coded_message)\n # write code here \nend", "def delegate_object; end", "def decode(token)\n \n end", "def encode(*); self; end", "def convert!; end", "def encodings; end", "def protocol; end", "def protocol; end", "def protocol; end", "def protocol; end", "def set_decoder\n @decoder = Decoder.find(params[:id])\n end", "def default_stream_handler(broadcasting, coder:); end", "def encode(_)\n raise NotImplementedError\n end", "def encoding(encoding); end", "def next\n raise NotImplementedError, \"you should use subclasses of Backend\"\n end", "def acrostic_decoder!(coded_message)\n # write code here \nend", "def delegating_method; end", "def convert\n raise NotImplementedError\n end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def exchange_code; end", "def encoding=(_arg0); end", "def encoding=(_arg0); end", "def encoding=(_arg0); end", "def encoding=(_arg0); end", "def encoding=(_arg0); end", "def encoding=(_arg0); end", "def encoding=(_arg0); end", "def stream_handler(broadcasting, user_handler, coder: T.unsafe(nil)); end", "def set_backend(val)\n end", "def encode!(*); self; end", "def convert_response(_response)\r\n raise NotImplementedError, 'This method needs\r\n to be implemented in a child class.'\r\n end", "def url_decode\n Rack::Utils.unescape self\n end", "def proxy; end", "def proxy; end", "def proxy; end", "def encode(*args)\n self.class.new super\n end", "def decoder_stub(state)\n\t\tstate.key = \"\"\n\t\tstate.decoder_key_size = 0\n\t\tRex::Encoder::NonUpper::gen_decoder()\n\tend", "def serializer; end", "def decode(input_, opts_={})\n Coder.new(opts_).decode(input_)\n end", "def decode(input_, opts_={})\n Coder.new(opts_).decode(input_)\n end", "def decode\n Flurry::Feed.new(@raw_data)\n end", "def content_encoding_hooks; end", "def content_encoding_hooks; end", "def cast_sinks; end" ]
[ "0.7154991", "0.7154991", "0.7037167", "0.70368564", "0.6615661", "0.6615661", "0.61292225", "0.6124752", "0.6063119", "0.60568804", "0.6055541", "0.6055541", "0.59939563", "0.59871614", "0.59697354", "0.59680986", "0.59680986", "0.5948041", "0.5902332", "0.58718055", "0.5855886", "0.5832082", "0.5830224", "0.5770655", "0.57671714", "0.5697524", "0.5632566", "0.56285965", "0.5620794", "0.5588082", "0.55750245", "0.5571333", "0.5571063", "0.5563224", "0.55569607", "0.552406", "0.552406", "0.55098635", "0.54890716", "0.54890716", "0.54890716", "0.546255", "0.54205275", "0.54128367", "0.5397155", "0.538667", "0.53847265", "0.5383804", "0.5379256", "0.5379256", "0.5379256", "0.5379256", "0.53740734", "0.5370541", "0.537016", "0.5366085", "0.53624445", "0.53621036", "0.5360155", "0.5351904", "0.5348694", "0.5348694", "0.5348694", "0.5348694", "0.5348694", "0.5348694", "0.5348694", "0.5348694", "0.5348694", "0.5348694", "0.5348694", "0.5348694", "0.5348694", "0.5348694", "0.5348694", "0.5337432", "0.5334205", "0.5334205", "0.5333523", "0.5333523", "0.5333523", "0.5333523", "0.5333523", "0.5328275", "0.5327232", "0.5306684", "0.53055376", "0.5297491", "0.5282834", "0.5282834", "0.5282834", "0.527052", "0.52666676", "0.5261476", "0.52588594", "0.52588594", "0.5245716", "0.5244253", "0.5244253", "0.52427286" ]
0.61555845
6
making the 'or_else' function accessible in views
def title base_title = "My Site" unless @title.nil? "#{base_title} | #{@title}" else base_title end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conditionally(*) end", "def conditionally(*) end", "def or_else(&blk)\n yield value\n end", "def or_b\n end", "def render_or_false(to_check, view)\n if to_check.present?\n render_json view\n else\n render json: false, status: 200\n end\n end", "def or_d\n end", "def or_c\n end", "def or_l\n end", "def or_e\n end", "def or_a\n end", "def or( *args ); { $or => args } end", "def virtual_or(&block)\n virtualize_keyword(:or, @or_rewriter, block)\n end", "def yes_or_no(model, method, current_value)\r\n case current_value\r\n when true\r\n get('yes_' + model.to_s + method.to_s)\r\n else\r\n get('no_' + model.to_s + method.to_s)\r\n end\r\n end", "def get_or_else(val_or_lam = nil, &blk)\n v_or_f = val_or_lam || blk\n if either_value.right? then either_value.right_value else (v_or_f.respond_to?(:call) ? v_or_f.call : v_or_f) end\n end", "def or_else(*args, &block)\n Utils.assert_arg_or_block!(\"or_else\", *args, &block)\n super.tap do |result|\n Utils.assert_type!(result, left_class, right_class)\n end\n end", "def yeah_or_booh boolean\n boolean && 'yeah' || 'booh'\nend", "def admin_or_staff?\n admin? || staff?\n end", "def on_or(ast_node, context)\n left, right = *ast_node\n\n return on_call_boolean(context, left) || on_call_boolean(context, right)\n end", "def or(argument1, argument2)\n argument1 || argument2\n end", "def get_or_else(val_or_lam = nil, &blk)\n v_or_f = val_or_lam || blk\n if !empty? then value else (v_or_f.respond_to?(:call) ? v_or_f.call : v_or_f) end\n end", "def show?\n user_is_owner_or_admin? || user_is_professional?\n end", "def get_or_else(val_or_lam = nil, &blk)\n v_or_f = val_or_lam || blk\n if either_value.left? then either_value.left_value else (v_or_f.respond_to?(:call) ? v_or_f.call : v_or_f) end\n end", "def rewrite_or(expression)\n first = expression[1]\n second = expression[2]\n\n VirtualKeywords.call_operator_replacement(:call_or, first, second)\n end", "def on_or(node)\n a, b = node.children.map { |c| @truth.fetch(c, process(c)) }\n\n if a == :true || b == :true\n :true\n elsif a == :false && b == :false\n :false\n else\n nil\n end\n end", "def or_nil\n get_or_else(nil)\n end", "def or_h\n end", "def or\n @options[:conditional_operator] = \"OR\"\n self\n end", "def getOrElse *args\n @val\n end", "def check_dog\n if @vaccinated && @wormed\n \"#{@name} can be accepted\"\n elsif @vaccinated || @wormed\n \"#{@name} can only be accepted by itself\"\n else\n \"#{@name} can not be accepted\"\n end\nend", "def compose_or(first_condition, second_condition)\n validate_condition(first_condition)\n validate_condition(second_condition)\n first_condition.or(second_condition)\n end", "def ood_or_even(number)\n if number.odd?\n 'the number is odd'\n else\n 'the number is even'\n end\nend", "def expr\n or_expr\n end", "def if_proc=(_arg0); end", "def login_required\nauthorized? || access_denied\nend", "def if_proc; end", "def staff?\n admin || moderator\n end", "def fn_or(*conditions)\n {\n \"Fn::Or\" => conditions\n }\n end", "def vowels_with_ternary_operator(letter)\n (vowels.include? letter) ? true : false # this only seems to work when I put the conditional in parenthesis\nend", "def fn_or(value)\n result = value.map do |val|\n apply_condition(val)\n end\n if result.to_s.include?(RUNTIME_MODIFIED)\n UNKNOWN_RUNTIME_RESULT\n else\n result.any?\n end\n end", "def or_hl\n end", "def even_or_odd(number)\n number.even? ? 'That number is even ' : 'That number is odd'\nend", "def maybe; end", "def or_op(left, right, result) #method\n left = get_dir(left)\n right = get_dir(right)\n @current_context[result] = get_value(left) || get_value(right)\n end", "def or(other)\n if self && !self.nil?\n self\n else\n other\n end\n end", "def not_if(val) val ? :not_to : :to end", "def maybe so, maybe: self\n maybe\n end", "def odd_or_even(number)\n number.odd? ? \"The number is odd\" : \"The number is even\"\nend", "def even_or_odd(number)\n number.even? ? \"Even\" : \"Odd\"\nend", "def odd_or_even(number)\n if number.odd?\n \"odd\"\n else\n \"even\"\n end\nend", "def even_or_odd (num)\n if num.even? == true\n \"#{num} is even.\"\n else\n \"#{num} is odd.\"\n end \nend", "def or(*others)\n self.class.or(self, *others)\n end", "def allows?(action, user)\n case action.to_sym\n when :view then user.may_edit or user == self\n when :edit then user.may_authorize or user == self\n else false\n end\n end", "def process_or(exp)\n lhs = process exp.shift\n rhs = process exp.shift\n\n return \"#{lhs} || #{rhs}\"\n end", "def or(other)\n other\n end", "def op_or(t_sym, f_sym, num)\n chars = num.split('')\n is_true = 0\n chars.each do |c|\n if c == \"1\"\n is_true = 1\n break\n end\n end\n if is_true == 1\n return t_sym\n else\n return f_sym\n end\nend", "def or *guards, &block\n if guards.empty? \n return self if self\n else\n guards.each do |cond|\n return self if send_as_function(cond)\n end\n end\n\n block_given? ? yield_or_eval(&block) : self\n end", "def maybe so, maybe: self\n so\n end", "def exclusive_or(num1, num2)\r\n\t# your code here\r\nend", "def show?\n user.try(:admin?) || record.has_member?(user) \n end", "def even_or_odd num\n if num%2 == 0\n \"#{num} is even\"\n else\n \"#{num} is odd\"\n end\nend", "def select_view\n #redirect_to :action => params[:selection]\n if (SELECTABLE_ACTIONS_ADMIN.include? params[:selection].to_sym) || (SELECTABLE_ACTIONS.include? params[:selection].to_sym)\n redirect_to :action => params[:selection]\n else\n redirect_to :action => 'home'\n end\n end", "def even_or_odd(number)\n (number % 2 == 0) ? \"Even\": \"Odd\"\nend", "def user_or_org\n self.is_user? ? 'user' : 'organization'\n end", "def even_or_odd(num)\n num.even? ? \"That is an even number\" : \"That number is not even\"\nend", "def or(other_rule)\n ValidateMyRoutes::ValidationRules.or(self, other_rule)\n end", "def odd_or_even(number)\n if number.odd?\n 'That number is odd'\n else\n 'that number is even'\n end\nend", "def viewable?\n published? || created? || editing?\n end", "def if_condition; end", "def yeah_or_boo( a,b )\n (a > b) && 'yeah' || 'boo'\nend", "def | other\n call_enum \"boolean\", other, :or\n end", "def odd_or_even(number)\n if number.odd?\n \"That number is odd\"\n else\n \"Even\"\n end\nend", "def either_only(number)\n if number % 3 == 0 && number % 5 != 0\n return \"true\"\n elsif number % 3 != 0 && number % 5 == 0\n return \"true\"\n else\n return \"false\"\n end\nend", "def call_or(caller_object, first, second)\n or_lambda = lambda_or_raise(caller_object, :or)\n or_lambda.call(first, second)\n end", "def or_filters_provided?\n true\n end", "def show?\n user.admin? || user.po? || record.user == user\n end", "def else(&fn)\n raise Qo::Exceptions::MultipleElseClauses if @else\n\n @else = fn || Qo::IDENTITY\n end", "def odd_or_even(number)\n if number.odd?\n \"That number is odd\"\n else\n \"That number is even\"\n end\nend", "def Boolean(operation, val1, val2)\n puts operation\n case operation\n when \"AND\"\n return val1 && val2\n when \"OR\"\n return val1 || val2\n else\n puts \"WHAT?\"\n end\n return false\n end", "def doctor_or_admin_view\n if !((current_user.is_a? Doctor) || (current_user.is_a? Admin) || (current_user.is_a? AdminAssistant))\n flash[:error] = \"You are not authorized to view this page.\"\n redirect_to :root\n # Explictly tell the caller that this check failed\n return false\n else\n # Explictly tell the caller that this check was successful\n return true\n end\n end", "def special_access_for_cfo_or_treasurer?(state)\n (current_user.cfo? && state == 'approval') ||\n (current_user.treasurer? && ['execution', 'executed'].include?(state)) ||\n (cfo_as_treasurer? && ['approval', 'execution', 'executed'].include?(state))\n end", "def edit_basic?\n edit_publication_status? || edit_subject_areas? || edit_grade_levels?\n end", "def or(policy, *others)\n __factory_method__(Or, policy, others)\n end", "def link_to_function_if(condition, *link_to_function_args)\n if condition\n link_to_function *link_to_function_args\n else\n content_tag :span, link_to_function_args.first\n end\n end", "def fb_else(&proc)\n content = capture(&proc) \n concat(content_tag(\"fb:else\",content),proc.binding)\n end", "def odd_or_even (number)\n if number % 2 == 0\n \"even\"\n elsif number % 2 == 1\n \"odd\"\n end\nend", "def new_or_edit\nend", "def officer?\n self.admin? or\n self.position == \"chair\"\n end", "def admin_or_curator?\n self.admin? || self.curator?\n end", "def logical_or\n expr = logical_and\n\n while match?(:or)\n operator = previous\n right = logical_and\n expr = Ringo::Logical.new(expr, operator, right)\n end\n\n expr\n end", "def maybe! so, maybe: -> {}\n so.call\n end", "def bill_or_act(title)\n return :act if title.include? \"Act\"\n :bill\nend", "def even_or_odd(number)\n if number % 2 == 0\n return \"Even\"\n else\n return \"Odd\"\n end\n\nend", "def process_or(exp)\n a = exp.shift\n b = exp.shift\n\n res = without_result do\n want_expression do\n with_temporary_variable do |tmp|\n @local_variables_need_no_initialization.add(tmp)\n \"(#{tmp}=#{process(a)}, (#{tmp}!==false&&#{tmp}!==nil) ? #{tmp} : (#{process(b)}))\"\n end\n end\n end\n\n return resultify(res)\n end", "def returns_something?; @return_type || !@returned_arguments.empty? end", "def staff_member?\n admin? || staff?\n end", "def ensure_is_authorized_to_view\n @is_member_of_company = (@relation == :company_admin_own_site || @relation == :company_employee || @relation == :rentog_admin_own_site)\n\n # ALLOWED\n return if @relation == :rentog_admin ||\n @relation == :rentog_admin_own_site ||\n @relation == :domain_supervisor ||\n @relation == :company_admin_own_site\n\n\n # NOT ALLOWED\n # with error message\n flash[:error] = t(\"listing_events.you_have_to_be_company_member\")\n redirect_to root\n return false\n end", "def complex_condition?(condition); end", "def any &blk\n @condition_blocks << ConditionGroup.new(model, \"OR\", binding, @from, path, &blk)\n @condition_blocks.last\n end", "def func_if(args)\n p1 = car(args)\n p2 = car(cdr(args))\n p3 = cdr(cdr(args))\n\n if _eval(p1) != @o_man.nil\n return _eval(p2)\n end\n\n return func_progn(p3)\n end", "def one_two_or_three(n)\n if n == 1\n return 'one'\n elsif n == 2\n return 'two'\n else\n return 'three'\n end\nend", "def render_output_of_ternary(ternary_arr, df_data)\n value_for_field_name(ternary_arr[0], df_data).present? ? ternary_arr[1] : ternary_arr[2]\n end" ]
[ "0.63499355", "0.63499355", "0.63428926", "0.6233453", "0.6225068", "0.6158224", "0.612252", "0.61073035", "0.6034948", "0.600363", "0.59588253", "0.5958782", "0.59271395", "0.59177643", "0.5884888", "0.583738", "0.5826465", "0.5769662", "0.57511574", "0.574841", "0.57457155", "0.57356274", "0.5692874", "0.56814337", "0.5654873", "0.5613682", "0.55693096", "0.5482578", "0.54726136", "0.54459983", "0.54439694", "0.54393685", "0.5434143", "0.5417753", "0.53937745", "0.5389916", "0.53872234", "0.5368521", "0.5367141", "0.5362694", "0.53593725", "0.5354592", "0.5353175", "0.5345638", "0.5337597", "0.53370965", "0.5335041", "0.533196", "0.5324638", "0.5320139", "0.53171957", "0.5315002", "0.53133994", "0.53087115", "0.5308238", "0.52986115", "0.52966297", "0.52935183", "0.5271619", "0.526108", "0.5248364", "0.5242111", "0.5229692", "0.5225093", "0.5222091", "0.5219628", "0.52185553", "0.52180344", "0.52120817", "0.52064806", "0.5187506", "0.51843834", "0.51805705", "0.5177308", "0.5170195", "0.5169771", "0.5168875", "0.5167749", "0.51657605", "0.5158359", "0.5151893", "0.51487315", "0.5144803", "0.5143326", "0.5142731", "0.5142655", "0.5139733", "0.51391435", "0.51329887", "0.51233107", "0.5117984", "0.51066333", "0.5096143", "0.5092651", "0.5089783", "0.5078867", "0.5075746", "0.50756705", "0.5075113", "0.50704414", "0.5065814" ]
0.0
-1
returns the facebook profile name or nothing
def facebook_profile @network = current_user.network ||= Network.new (@network.facebook.nil?) ? "" : @network.facebook end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name\n if facebook_authentication && facebook_authentication.display_name\n return facebook_authentication.display_name\n end\n return username\n end", "def get_fb_user_name\n return self.facebook_user.now_profile.first_name unless self.facebook_user.nil? || self.facebook_user.now_profile.nil? \n return Event::NOW_BOT_NAME \n end", "def full_name\n json[\"entry_data\"][\"ProfilePage\"].first[\"graphql\"][\"user\"][\"full_name\"]\n end", "def display_name\n @json['profile']['displayName'] rescue nil\n end", "def full_name\n return '' unless profile\n profile.full_name\n end", "def profile_name\n name.present? ? name : identifier\n end", "def full_name\n \"#{user_profile.first_name} #{user_profile.last_name}\" unless user_profile.blank?\n end", "def name\n @json['profile']['name']['formatted'] rescue nil\n end", "def get_display_name\n return self.has_profile? ?\n self.profile.first_name + \" \" + self.profile.last_name :\n self.email\n end", "def get_name\n name = Koala::Facebook::API.new(oauth_token).get_object('me?fields=name')['name']\n update(name: name)\n name\n rescue Koala::Facebook::AuthenticationError\n # Do nothing.\n end", "def profile_name\n return self.profile.name\n end", "def name\n \"#{@profile[:first_name]} #{@profile[:last_name]}\"\n end", "def full_name\n if self.profile.present?\n \"#{self.profile.first_name.capitalize} #{self.profile.last_name.capitalize}\"\n else\n \"#{username.capitalize}\"\n end\n end", "def display_name\n self.display_name = self.profile.nickname? ? self.profile.nickname : self.username\n end", "def name\n profile.user.name\n end", "def user_name(uid)\n deter_lab.get_profile(uid).try(:[], \"name\")\n end", "def welcome_name\n if profile.nil? or (profile.user_first_name.nil? and profile.user_last_name.nil?)\n email \n else\n self.full_name\n end\n end", "def display_name\n display_name = @current_profile.display_name\n end", "def facebookProfilePicURL\n # https://www.facebook.com/user_name\n if facebook_url\n return \"https://graph.facebook.com/[PROFILE_ID]/picture\"\n else\n None\n end\n end", "def name\n\t\tn = names\n\t\treturn n[:fullname] if n[:fullname]\n\t\treturn n[:username] if n[:username]\n\t\treturn I18n.translate(\"user.name.unknown\")\n\tend", "def get_username(graph)\n graph.get_object('me')['name']\n end", "def profileName \n \"profileName\" \n end", "def get_realname\n response = get_current_user_meta('realname')\n realname = response['query']['userinfo']['realname']\n return if realname == ''\n\n realname\n end", "def first_name\r\n @profile[:name].split(/ /).first\r\n end", "def last_name\r\n @profile[:name].split(/ /).last\r\n end", "def username\n json[\"entry_data\"][\"ProfilePage\"].first[\"graphql\"][\"user\"][\"username\"]\n end", "def forum_name\n if social_profile\n social_profile.public_nickname\n else\n SocialProfile.get_anonymous_name(email)\n end\n end", "def username\n profile['Username']\n end", "def username\n @json['profile']['preferredUsername'] rescue nil\n end", "def get_nickname(user_info)\n return user_info[\"screen_name\"]\n end", "def name\n\t\tif name_source.present?\n\t\t\tproviders = [\"twitter\",\"facebook\",\"google_oauth2\",\"lastfm\",\"vimeo\"]\n\t\t\tp,v = name_source.split(\"::\",2)\n\t\t\treturn name_source unless p.in? providers\n\t\t\tl = self.links.find_by(provider: p)\n\t\t\tif l\n\t\t\t\tnames = l.names\n\t\t\t\treturn names[v.to_sym] if names.is_a? Hash and v and names[v.to_sym]\n\t\t\tend\n\t\tend\n\t\t\n\t\treturn custom_name if custom_name.present?\n\t\treturn email.split('@')[0].titleize if email.present?\n\t\tUser.default_name\n\tend", "def get_name()\n return @me.uname if @me.brother.nil?\n return @me.brother.full_name\n end", "def display_name\n if name.blank?\n github_username\n else\n name\n end\n end", "def get_current_user_name\n return @name if @name\n name = get_current_user_meta\n name = name['query']['userinfo']['name'] if name\n\n name\n end", "def profile_picture\n if facebook_authentication && facebook_authentication.profile_picture\n return facebook_authentication.profile_picture\n end\n return '/images/unknown_user.png'\n end", "def profile_picture\n profile_picture_file_name\n end", "def hubssolib_get_user_name\n user = self.hubssolib_current_user\n user ? user.user_real_name : nil\n end", "def full_name\n \tif !self.first_name.nil? && !self.last_name.nil?\n\t\t\"#{self.first_name.titleize} #{self.last_name.titleize}\"\n\telsif !self.oauth_user_name.nil?\n\t\tself.oauth_user_name\n\telse\n\tend\n end", "def has_facebook_profile?\n fb_userid.present?\n end", "def get_random_profile_name\n @profiles_data[rand(0...@profiles_data.count)][:name]\n end", "def fb_profile_url\n \"http://www.facebook.com/profile.php?id=#{fb_user_id}\"\n end", "def my_full_name\n \"#{self.profile.first_name} #{self.profile.last_name}\"\n end", "def owner_fname\n \towner.profile.fname\n end", "def get_name(user_info)\n return user_info[\"name\"]\n end", "def get_user_name_not_null\n user = User.first(:id => self.user_id )\n return user.login if user\n return \"anon\"\n end", "def full_name\n (@session[:current_user_details] || {})[:description]\n end", "def full_name\n full_name = object.first_name + \" \" + object.last_name\n if object.profile.try(:search_engine_privacy).present?\n display_name = object.profile.try(:search_engine_privacy) == \"Show my full name\" ? full_name : object.first_name + \" \" + object.last_name.chr\n else\n display_name = full_name\n end\n return display_name \n end", "def social_profile(provider)\n social_profiles.select{ |sp| sp.provider == provider.to_s }.first\n end", "def name\n if first_name.present? || last_name.present?\n [first_name, last_name].join(\" \").strip\n else\n username\n end\n end", "def get_displayname(user)\n make_request(:get, \"/profile/#{user}/displayname\")['displayname']\n rescue NotFoundError => e\n raise UserNotFoundError.new(user, e.error),\n 'The specified user could not be found'\n end", "def simple_username\n return user.firstname + ' ' + user.lastname.first + '.' if !user.nil?\n name\n end", "def profile(profile_name:)\n claim_url = \"#{@@profile_service_url}/profile/#{profile_name}/next\"\n response = Faraday.get claim_url\n profile = JSON.parse(response.body)\n raise \"No profile available for #{profile_name}\" unless profile\n profile\n end", "def _profile\n @link['profile']\n end", "def display_name\n #self.email.split('@')[0]\n self.username\n end", "def get_user_profile(access_token)\n options = { query: { access_token: access_token, fields: 'name,email' } }\n response = self.class.get('/me', options)\n # Something went wrong most propably beacuse of the connection.\n unless response.success?\n Rails.logger.error 'Omniauth::Facebook.get_user_profile Failed'\n fail Omniauth::ResponseError, 'errors.auth.facebook.user_profile'\n end\n response.parsed_response\n end", "def facebook_profile?\n @network = current_user.network ||= Network.new\n !(@network.facebook.nil? || @network.facebook.blank?)\n end", "def get_user_name\n\t\tretVal = \"User Not Found\"\n\t\tuser_id = self.user_id\n\t\tuser = User.find(user_id, :select=>[\"fname\",\"lname\"])\n\t\tunless user.nil?\n\t\t\tretVal = user.fname + \" \" + user.lname\n\t\tend\n\t\treturn retVal\n\tend", "def linkedin_profile\n @network = current_user.network ||= Network.new\n (@network.linkedin.nil? || @network.linkedin.blank?) ? \"\" : @network.linkedin\n end", "def profile_url\n if self.profile and self.profile != \"\"\n return self.profile\n end\n return \"/blank.png\"\n end", "def profile(name)\n @profiles.find { |p| p.name == name }\n end", "def first_name\n @json['user']['content']['firstname'] || ''\n end", "def fullname\n person.fullname_unknown? ? login : person.fullname rescue login\n end", "def profile_name(screenname)\n unless screenname==nil\n if screenname.size > 15 || screenname.size == 15 \n return screenname.slice(0,11)+\"...\"\n else\n return screenname.titlecase\n end\n end\nend", "def facebook_name_field(value=nil)\n rw_config(:facebook_name_field, value, :name)\n end", "def try_display_name\n [display_name, username].find(&:present?)\n end", "def user_name\n if /(.*)-\\d{8}-\\d{6}$/ =~ perma_link\n return $1\n else\n return \"unknown\"\n end\n end", "def get_user_name\n if first_name.blank?\n return email.split('@').first.capitalize unless email.blank? \n else\n return first_name.capitalize + \" \" + last_name.capitalize\n end \n return ''\n end", "def facebook_username_field(value=nil)\n rw_config(:facebook_username_field, value, :facebook_username)\n end", "def full_name\n \treturn \"#{first_name} #{last_name}\".strip if(first_name || last_name) \n \t\"Anonymous\"\n end", "def last_name\n @json['user']['content']['lastname'] || ''\n end", "def full_user_name\n formatedName=first_name[0].upcase+first_name[1,first_name.size].downcase+\" \"+last_name[0].upcase+last_name[1,last_name.size].downcase\n return formatedName.strip if (first_name || last_name)\n return \"Anonymous\"\n end", "def name\n auth[:info][:name] || auth[:info][:display_name] rescue nil\n end", "def get_profile_name(uri)\n uri.host + uri.path\n end", "def user_display_name\n @attributes[:user_display_name]\n end", "def get_profile\n begin\n client.profile(fields: PROFILE_FIELDS)\n rescue Exception => e\n logger.error \"Linkedin #get_profile error #{e}\"\n end\n end", "def profile_picture\n\t\tFbGraph::User.me(self.oauth_token).fetch.picture(width: 150, height: 200)\n\tend", "def screen_name\n name || nickname\n end", "def display_name\n return attributes['display_name'] unless attributes['display_name'].blank?\n return \"#{attributes['first_name']} #{attributes['last_name']}\" unless attributes['first_name'].blank? && attributes['last_name'].blank?\n return '(unknown)'\n end", "def user_full_name\n if user\n user.first_name + ' ' + user.last_name\n else\n 'Anonymous'\n end\n end", "def nickname\n user_info['nickname']\n end", "def user_full_name\n @user[\"name\"]\n end", "def user_name\n read_attribute('user_name') || \"anonymous\"\n end", "def full_name\n if user_data\n \"#{user_data['first_name']&.downcase&.capitalize} #{user_data['last_name']&.downcase&.capitalize}\"\n end\n end", "def display_name\n entry = JSON.parse(self.entry)\n user = User.find(user_id)\n \"#{user.display_name} #{entry['text']}\"\n end", "def current_user_screen_name\n session[:user_info][\"nickname\"]\n end", "def user_display_name\n return @user_display_name\n end", "def user_display_name\n return @user_display_name\n end", "def user_display_name\n return @user_display_name\n end", "def find_profile_user(full_name)\n name = split_phrase(full_name)\n profile = Profile.find_by_first_name_and_last_name(name.first, name.last)\n user = profile.user unless profile.blank?\n user\n end", "def provider_name\n @json['profile']['providerName'] rescue nil\n end", "def get_user_profile_description\n get_profile_description(\"Users\")\n end", "def display_name\n username\n end", "def fetch_details_from_facebook\n graph = Koala::Facebook::API.new(self.token)\n facebook_data = graph.get_object(\"me\")\n self.username = facebook_data['username']\n self.save\n end", "def profile_url\n @data[:profile_url]\n end", "def get_display_name\n @display_name ||= self.user.display_name\n end", "def personal_name\n data[:personal_name]\n end", "def title\n if self.username != \"\" && !self.username.nil?\n self.username\n elsif self.first_name != \"\" && !self.first_name.nil?\n self.first_name\n else\n \"Anonymous\"\n end\n\n end", "def display_name\n self.name.blank? ? self.username : self.name\n end", "def full_name\n name = `finger $USER 2> /dev/null | grep Login | colrm 1 46`.chomp\n name.empty? ? \"John Doe\" : name.squish\n end", "def profile_url\n nil\n end" ]
[ "0.81749", "0.79702437", "0.76902616", "0.7680518", "0.7657331", "0.76006883", "0.75406325", "0.7537982", "0.75058943", "0.74871516", "0.746452", "0.7459048", "0.744484", "0.73043185", "0.726662", "0.7253938", "0.72537565", "0.7197072", "0.7169443", "0.71677405", "0.716763", "0.7144917", "0.7095719", "0.70729613", "0.70482355", "0.69890845", "0.69280946", "0.6915553", "0.6905107", "0.6837181", "0.6829807", "0.6824927", "0.67681926", "0.6740575", "0.6712818", "0.6707807", "0.6664333", "0.6654139", "0.66532284", "0.6649623", "0.6646851", "0.6634769", "0.6611923", "0.6607938", "0.6605801", "0.6605716", "0.6590345", "0.6574624", "0.6570424", "0.6564218", "0.6521362", "0.65116173", "0.65057606", "0.6503432", "0.64872855", "0.6487134", "0.6472488", "0.6437591", "0.6434119", "0.641996", "0.641908", "0.64170235", "0.6416519", "0.64146787", "0.6410934", "0.63974476", "0.6384319", "0.63842624", "0.6380857", "0.6375333", "0.63740027", "0.6373173", "0.636849", "0.6367416", "0.63656247", "0.63593227", "0.63432485", "0.6340499", "0.6339941", "0.6338218", "0.63317144", "0.63300306", "0.63283604", "0.6326131", "0.6318703", "0.63152593", "0.63152593", "0.63152593", "0.6315085", "0.6303616", "0.6294734", "0.62933266", "0.6285079", "0.6283395", "0.62819195", "0.6281749", "0.6277938", "0.62737674", "0.62719166", "0.6266976" ]
0.7903896
2
returns true if current_user has a facebook profile
def facebook_profile? @network = current_user.network ||= Network.new !(@network.facebook.nil? || @network.facebook.blank?) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_facebook_profile?\n fb_userid.present?\n end", "def has_profile?\n return self.profile.present?\n end", "def connected_to_facebook?\n fb_uid && fb_access_token\n end", "def is_current_profile?(profile)\n if current_user.present?\n @current_profile = current_user.profile\n return profile.id == @current_profile.id\n else\n return false\n end\n end", "def fb_connected?\n fb_user_id.present?\n end", "def facebook?\n provider_name == 'Facebook'\n end", "def source_facebook?\n omniauth_access? && identities.collect{|i| i.provider}.include?('facebook')\n end", "def belongs_to_current_profile_user?\n !!(@current_user.id == @user.id)\n end", "def belongs_to_current_profile_user?\n !!(@current_user.id == @user.id)\n end", "def facebook?\n self.provider == 'facebook'\n end", "def facebook?\n type == 'Facebook'\n end", "def is_follow_this_profile?(profile)\n # return current_user.profile.follows?(profile)\n\n @current_profile = current_user.profile\n return @current_profile.follows?(profile)\n# return profile.id == @current_profile.id\n\n end", "def connected_to_facebook?\n !self.facebook_id.blank?\n end", "def following_profile?(profile)\n return favorites.streams.where(favable_id: profile.stream_ids).count > 0\n end", "def friend_of_current_user?\n current_user.friends.pluck(:id).include?(@profile.user.id) ? \n current_user.friendships.find_by_friend_id(@profile.user.id) : false\n end", "def checked_in_facebook?\n if user_signed_in?\n identity = Identity.where(user_id: current_user.id)\n return true if identity.count == 1\n end\n false\n end", "def facebook?\n self.kind == 'facebook'\n end", "def check_facebook \n return unless Facebooker.api_key\n if logged_in? and facebook_session and not current_user.has_facebook?\n return if facebook_session.user.uid == 55714215 and current_user.id != 1 # this is jim, don't add his facebook to everyone's account!\n @user = User.find(current_user.id)\n if not @user.update_with_facebook(facebook_session)\n return\n end\n if not @user.activated?\n @user.activate!\n end \n @current_user = User.find(current_user.id)\n flash.now[:notice] = t('facebook.synced', :government_name => current_government.name)\n end \n end", "def logged_in?\n current_profile != nil\n end", "def linkedin_profile?\n @network = current_user.network ||= Network.new\n !(@network.linkedin.nil? || @network.linkedin.blank?)\n end", "def fb_authorized?\n self.access_token.present? \n end", "def facebook_profile\n @network = current_user.network ||= Network.new\n (@network.facebook.nil?) ? \"\" : @network.facebook\n end", "def has_profile?\n first_name.present? && last_name.present?\n end", "def authenticating_with_facebook?\n !skip_facebook_authentication && !authenticating_with_unauthorized_record? && attempted_record.nil? && facebook_session?\n end", "def profile?\n instance.options[:profile]\n end", "def added_fb_account?\n !self.external_user_id.nil?\n end", "def twitter_profile?\n @network = current_user.network ||= Network.new\n !(@network.twitter.nil? || @network.twitter.blank?)\n end", "def has_profile?(*profiles)\r\n@has_profiles ||= {}\r\nprofile = profiles.shift\r\nreturn true if self.new_record? && profile == 'Not Logged'\r\n@has_profiles[profile] = case profile\r\nwhen nil\r\n false\r\nwhen Fixnum\r\n self.profile_ids.include?(profile)\r\nwhen String\r\n self.profiles.where(:name => profile).select('id').first\r\nwhen Profile\r\n self.profiles.where(:id => profile).select('id').first\r\nend unless @has_profiles.has_key?(profile)\r\nreturn @has_profiles[profile] || profiles.find{|t| self.has_profile?(t) }\r\nend", "def facebook_connect_user?\n facebook_user? and password.blank?\n end", "def has_profilepic?\n profile_pic != nil\n end", "def authenticating_with_facebook?\n if controller.respond_to?(:controller) && controller.controller.respond_to?(:set_facebook_session)\n controller.set_facebook_session\n !authenticating_with_unauthorized_record? && controller.facebook_session?\n end\n end", "def other_user_profile?\n !is_owner\n end", "def authenticating_with_facebook?\n !authenticating_with_unauthorized_record? &&\n !self.class.facebook_api_key.blank? &&\n !self.class.facebook_secret_key.blank?\n end", "def ensure_user_has_profile\n bounce_user unless current_user and current_user.profile\n end", "def has_basic_profile_info?\n return false if name.blank? || email.blank?\n return true\n end", "def me?(id)\n id == @profile.id\n end", "def me?(id)\n id == @profile.id\n end", "def authenticating_with_facebook?\n !authenticating_with_unauthorized_record? && self.facebook_api_keys_provided? && self.raw_cookie\n end", "def me?(id)\n\t\tid == @profile.id\n\tend", "def exists?(id)\n profile(id) ? true : false\n end", "def facebook_connectable?\n return false unless options.facebook\n options.facebook && ENV['WARS_FB_APP_ID'] && ENV['WARS_FB_SECRET']\n end", "def facebook_register_enabled?\n Figaro.env.respond_to?(:facebook_key) && Figaro.env.respond_to?(:facebook_secret)\n end", "def has_avatar?\n key = 'profile_pic_url'\n user[key].present? && [user[key], user[key], user[key], user[key]].uniq.one?\n end", "def has_avatar?\n avatar.present? or read_attribute(:fb_avatar)\n end", "def find_for_facebook_oauth(auth, current_user = nil)\n if current_user && current_user.accounts.facebook.where(uid: auth['uid']).exists?\n current_user\n else\n includes(:accounts)\n .where(accounts: {type: Accounts::Facebook, uid: auth['uid']})\n .first\n end\n end", "def profile_complete?\n\t\tself.contact_phone && self.bio && self.first_name\n\tend", "def has_social_links?\n tauth = self.authorizations.where(:provider => 'Twitter')\n fauth = self.authorizations.where(:provider => 'Facebook')\n if tauth.present? || fauth.present?\n return true # Return true if true\n end\n false # Otherwise, return false\n end", "def current_user_exists?\n return false if config.current_user.nil?\n return true\n end", "def has_public_profile?\n is_visible? && (show_profile == Visibility::PUBLIC)\n end", "def profile?(profile=RC.current_profile)\n self.profile == (profile || 'default').to_s\n end", "def youtube_profile?\n @network = current_user.network ||= Network.new\n !(@network.youtube.nil? || @network.youtube.blank?)\n end", "def is_me?\n return self.user.email == session[:email]\n end", "def facebook\n @fb_user ||= FbGraph::User.me(self.authentications.find_by_provider('facebook').token)\n @fb_user.fetch\n end", "def facebook_url_exists?\n return false if facebook == \"\" || twitter == nil\n return true\n end", "def omniauth?\n provider? && uid?\n end", "def has_profile_pic?\n !default_profile_pic.new_record?\n end", "def has_private_profile?\n self.private\n end", "def app_authorized?\n user_info=JSON.parse(base64_url_decode(params[:signed_request].split('.')[1]))\n user_info.has_key?('user_id') && (@current_user ||= User.find_by_fb_id(user_info['user_id']))\n end", "def facebook\n @fb_user ||= FbGraph::User.me( self.authentications.find_by_provider('facebook').token)\n end", "def exists?(profile)\n @repository_xml.root.elements[\"profile[@id='#{profile}']\"]\n end", "def from_omniauth?\n uid.present? && provider.present?\n end", "def log_in_with_facebook?\n return false if %w[all facebook].include? ENV[\"DISABLE_LOG_INS\"]\n return true unless params[:log_in_with]\n return %w[any facebook].include? params[:log_in_with]\n end", "def has_user?\n !user.nil?\n end", "def profile_is_viewable?(other_user = nil, public_key = nil)\n return false unless other_user\n return true if self == other_user\n return !(self.respond_to?(\"private_profile\") && self.private_profile) || self.has_contact?(other_user) || self.public_key == public_key\n end", "def profile_show_page?\n controller_name == \"profiles\"\n end", "def profile_show_page?\n controller_name == \"profiles\"\n end", "def verify_user!\n @profile = current_user.profile\n end", "def verify_user!\n @profile = current_user.profile\n end", "def has_profile?\n vips_image.get_fields.include?('icc-profile-data')\n end", "def friend_signed_in?\n user_signed_in? && (current_user.type==\"Friend\") \n end", "def has_profile_image?\n branding_settings.try(:profile_image).present?\n end", "def has_followers?\n\t self.followers_count > 0\n\tend", "def ensure_user_has_profile(user)\n unless user.person && user.person.profile.present?\n account = Account.to_adapter.get!(user.id)\n update_status = account.update_with_password({ \"name\" => user.username })\n end\n end", "def user_present?\n current_user.present?\n end", "def user_exists?\n return (session[:user_id] && User.find(session[:user_id])) ? true : false\n end", "def friend_of?(user)\n relation = self.facebook_friends.include?(user)\n end", "def session_valid?\n get(profile_url).uri.to_s == profile_url\n end", "def profile_has_not_atleast_1_pic?\n current_user.profile.has_atleast_1_pic?\n end", "def can_i_access_your_profile(is_friend)\n \n if is_friend == true\n \treturn \"yes\"\n else \n \treturn \"no\"\n end\nend", "def social?\n @data['social'] != {}\n end", "def acquaintance_rights?(user_to_display)\n allowed_to_view_profile = false\n\n if current_user\n if current_user.id==user_to_display.id || current_user.has_system_role('moderator')\n allowed_to_view_profile = true\n else\n #check if both current user and user to display are facebook users in order to use the friends system\n if current_user.facebook_user? && user_to_display.facebook_user?\n current_fb_user = Facebooker::User.new(current_user.fb_user_id)\n if current_fb_user.friends_with?(user_to_display.fb_user_id)\n allowed_to_view_profile = true\n end\n end\n end\n end\n\n return allowed_to_view_profile\n end", "def has_fb_permission\n get_fb_permissions.detect { |e| \"publish_actions\" == e[\"permission\"] } ? true : false\n end", "def facebook\n @user = User.find_for_facebook_oauth(request.env[\"omniauth.auth\"], current_user)\n\n if @user.persisted?\n @user\n sign_in_and_redirect @user, :event => :authentication #this will throw if @user is not activated\n set_flash_message(:notice, :success, :kind => \"Facebook\") if is_navigational_format?\n else\n request.env[\"omniauth.auth\"]\n session[\"devise.facebook_data\"] = request.env[\"omniauth.auth\"]\n redirect_to new_user_registration_url\n end\n end", "def user_exists?(user)\n return !get_user(user).nil?\n end", "def user_present?\n user_token_present? && User.find_by(auth_token: user_token)\n end", "def user_exists?\n\t !User.find_by_email(email).nil? ? true : false\n\tend", "def lastfm_user?(user)\n lastfm_users.any? { |lastfm| lastfm.user_id == user.try(:id) }\n end", "def has_valid_wepay_access_token?\n\t if self.wepay_access_token.nil?\n\t return false\n\t end\n\t response = WEPAY.call(\"/user\", self.wepay_access_token)\n\t response && response[\"user_id\"] ? true : false\n\tend", "def current_bot?\n @bot.profile.id == @id\n end", "def has_user?(member)\n self[:users].member? member\n end", "def can_create_showing?\n profile.valid? && valid_credit_card? && !blocked?\n end", "def user_exists?(public_key)\n User.all(public_key: public_key).count > 0\n end", "def following?\n user.present?\n end", "def profile_filled?\n !((created_at.to_s == updated_at.to_s) && provider)\n end", "def is_owner?(account)\n attachable == account.profile\n end", "def has_userinfo?\n ImpURI.has_userinfo?(@uri)\n end", "def new_profile?\n @profile = Profile.new(params[:profile])\n @profile.user = current_user\n @profile.email = current_user.email\n end", "def following_user?(other_user)\n following_users.include?(other_user)\n end", "def has_profile\n if current_user && current_user.is_caterer? && CatererInformation.find_by(user_id: current_user.id) == nil\n redirect_to new_caterer_information_path, notice: \"Must create a Profile first\"\n end\n end", "def is_visible?\n is_public? && ProfileStatus::VISIBLE.include?(profile_status)\n end" ]
[ "0.87015873", "0.76989144", "0.7509506", "0.74241304", "0.7413598", "0.7387876", "0.7323472", "0.7251311", "0.7251311", "0.7223152", "0.71958345", "0.71569824", "0.7134959", "0.70727354", "0.7048229", "0.7044053", "0.7040191", "0.6987692", "0.6985623", "0.6981677", "0.6973202", "0.69551", "0.692447", "0.6865338", "0.68356144", "0.6804118", "0.6797714", "0.6769484", "0.67656785", "0.6765063", "0.67487013", "0.6747777", "0.67274463", "0.6691148", "0.66895825", "0.66837615", "0.66837615", "0.66550493", "0.6645661", "0.65835065", "0.6571233", "0.6566651", "0.6562589", "0.65608823", "0.6556831", "0.65519416", "0.65457916", "0.6507782", "0.6486214", "0.64860946", "0.64752364", "0.64728963", "0.64487195", "0.64484394", "0.64206195", "0.63939816", "0.6391806", "0.635582", "0.6347154", "0.6341935", "0.6340021", "0.6326735", "0.6313992", "0.6288419", "0.62843853", "0.6283738", "0.6278579", "0.6278579", "0.62749475", "0.6274176", "0.62626505", "0.62568045", "0.6246505", "0.6231985", "0.6224834", "0.6223219", "0.62066585", "0.62020373", "0.62005377", "0.61832094", "0.61778414", "0.6173105", "0.6163965", "0.6160795", "0.61441946", "0.61414057", "0.6136557", "0.6132998", "0.6117683", "0.61027116", "0.6100721", "0.60980105", "0.60946625", "0.6090104", "0.6085323", "0.6079959", "0.6064993", "0.6060354", "0.60547334", "0.60509366" ]
0.84910864
1
returns the facebook profile name or nothing
def twitter_profile @network = current_user.network ||= Network.new (@network.twitter.nil?) ? "" : @network.twitter end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name\n if facebook_authentication && facebook_authentication.display_name\n return facebook_authentication.display_name\n end\n return username\n end", "def get_fb_user_name\n return self.facebook_user.now_profile.first_name unless self.facebook_user.nil? || self.facebook_user.now_profile.nil? \n return Event::NOW_BOT_NAME \n end", "def facebook_profile\n @network = current_user.network ||= Network.new\n (@network.facebook.nil?) ? \"\" : @network.facebook\n end", "def full_name\n json[\"entry_data\"][\"ProfilePage\"].first[\"graphql\"][\"user\"][\"full_name\"]\n end", "def display_name\n @json['profile']['displayName'] rescue nil\n end", "def full_name\n return '' unless profile\n profile.full_name\n end", "def profile_name\n name.present? ? name : identifier\n end", "def full_name\n \"#{user_profile.first_name} #{user_profile.last_name}\" unless user_profile.blank?\n end", "def name\n @json['profile']['name']['formatted'] rescue nil\n end", "def get_display_name\n return self.has_profile? ?\n self.profile.first_name + \" \" + self.profile.last_name :\n self.email\n end", "def get_name\n name = Koala::Facebook::API.new(oauth_token).get_object('me?fields=name')['name']\n update(name: name)\n name\n rescue Koala::Facebook::AuthenticationError\n # Do nothing.\n end", "def profile_name\n return self.profile.name\n end", "def name\n \"#{@profile[:first_name]} #{@profile[:last_name]}\"\n end", "def full_name\n if self.profile.present?\n \"#{self.profile.first_name.capitalize} #{self.profile.last_name.capitalize}\"\n else\n \"#{username.capitalize}\"\n end\n end", "def display_name\n self.display_name = self.profile.nickname? ? self.profile.nickname : self.username\n end", "def name\n profile.user.name\n end", "def user_name(uid)\n deter_lab.get_profile(uid).try(:[], \"name\")\n end", "def welcome_name\n if profile.nil? or (profile.user_first_name.nil? and profile.user_last_name.nil?)\n email \n else\n self.full_name\n end\n end", "def display_name\n display_name = @current_profile.display_name\n end", "def facebookProfilePicURL\n # https://www.facebook.com/user_name\n if facebook_url\n return \"https://graph.facebook.com/[PROFILE_ID]/picture\"\n else\n None\n end\n end", "def name\n\t\tn = names\n\t\treturn n[:fullname] if n[:fullname]\n\t\treturn n[:username] if n[:username]\n\t\treturn I18n.translate(\"user.name.unknown\")\n\tend", "def get_username(graph)\n graph.get_object('me')['name']\n end", "def profileName \n \"profileName\" \n end", "def get_realname\n response = get_current_user_meta('realname')\n realname = response['query']['userinfo']['realname']\n return if realname == ''\n\n realname\n end", "def first_name\r\n @profile[:name].split(/ /).first\r\n end", "def last_name\r\n @profile[:name].split(/ /).last\r\n end", "def username\n json[\"entry_data\"][\"ProfilePage\"].first[\"graphql\"][\"user\"][\"username\"]\n end", "def forum_name\n if social_profile\n social_profile.public_nickname\n else\n SocialProfile.get_anonymous_name(email)\n end\n end", "def username\n profile['Username']\n end", "def username\n @json['profile']['preferredUsername'] rescue nil\n end", "def get_nickname(user_info)\n return user_info[\"screen_name\"]\n end", "def name\n\t\tif name_source.present?\n\t\t\tproviders = [\"twitter\",\"facebook\",\"google_oauth2\",\"lastfm\",\"vimeo\"]\n\t\t\tp,v = name_source.split(\"::\",2)\n\t\t\treturn name_source unless p.in? providers\n\t\t\tl = self.links.find_by(provider: p)\n\t\t\tif l\n\t\t\t\tnames = l.names\n\t\t\t\treturn names[v.to_sym] if names.is_a? Hash and v and names[v.to_sym]\n\t\t\tend\n\t\tend\n\t\t\n\t\treturn custom_name if custom_name.present?\n\t\treturn email.split('@')[0].titleize if email.present?\n\t\tUser.default_name\n\tend", "def get_name()\n return @me.uname if @me.brother.nil?\n return @me.brother.full_name\n end", "def display_name\n if name.blank?\n github_username\n else\n name\n end\n end", "def get_current_user_name\n return @name if @name\n name = get_current_user_meta\n name = name['query']['userinfo']['name'] if name\n\n name\n end", "def profile_picture\n if facebook_authentication && facebook_authentication.profile_picture\n return facebook_authentication.profile_picture\n end\n return '/images/unknown_user.png'\n end", "def profile_picture\n profile_picture_file_name\n end", "def hubssolib_get_user_name\n user = self.hubssolib_current_user\n user ? user.user_real_name : nil\n end", "def has_facebook_profile?\n fb_userid.present?\n end", "def full_name\n \tif !self.first_name.nil? && !self.last_name.nil?\n\t\t\"#{self.first_name.titleize} #{self.last_name.titleize}\"\n\telsif !self.oauth_user_name.nil?\n\t\tself.oauth_user_name\n\telse\n\tend\n end", "def get_random_profile_name\n @profiles_data[rand(0...@profiles_data.count)][:name]\n end", "def fb_profile_url\n \"http://www.facebook.com/profile.php?id=#{fb_user_id}\"\n end", "def my_full_name\n \"#{self.profile.first_name} #{self.profile.last_name}\"\n end", "def owner_fname\n \towner.profile.fname\n end", "def get_name(user_info)\n return user_info[\"name\"]\n end", "def get_user_name_not_null\n user = User.first(:id => self.user_id )\n return user.login if user\n return \"anon\"\n end", "def full_name\n (@session[:current_user_details] || {})[:description]\n end", "def full_name\n full_name = object.first_name + \" \" + object.last_name\n if object.profile.try(:search_engine_privacy).present?\n display_name = object.profile.try(:search_engine_privacy) == \"Show my full name\" ? full_name : object.first_name + \" \" + object.last_name.chr\n else\n display_name = full_name\n end\n return display_name \n end", "def social_profile(provider)\n social_profiles.select{ |sp| sp.provider == provider.to_s }.first\n end", "def name\n if first_name.present? || last_name.present?\n [first_name, last_name].join(\" \").strip\n else\n username\n end\n end", "def get_displayname(user)\n make_request(:get, \"/profile/#{user}/displayname\")['displayname']\n rescue NotFoundError => e\n raise UserNotFoundError.new(user, e.error),\n 'The specified user could not be found'\n end", "def simple_username\n return user.firstname + ' ' + user.lastname.first + '.' if !user.nil?\n name\n end", "def profile(profile_name:)\n claim_url = \"#{@@profile_service_url}/profile/#{profile_name}/next\"\n response = Faraday.get claim_url\n profile = JSON.parse(response.body)\n raise \"No profile available for #{profile_name}\" unless profile\n profile\n end", "def _profile\n @link['profile']\n end", "def display_name\n #self.email.split('@')[0]\n self.username\n end", "def facebook_profile?\n @network = current_user.network ||= Network.new\n !(@network.facebook.nil? || @network.facebook.blank?)\n end", "def get_user_profile(access_token)\n options = { query: { access_token: access_token, fields: 'name,email' } }\n response = self.class.get('/me', options)\n # Something went wrong most propably beacuse of the connection.\n unless response.success?\n Rails.logger.error 'Omniauth::Facebook.get_user_profile Failed'\n fail Omniauth::ResponseError, 'errors.auth.facebook.user_profile'\n end\n response.parsed_response\n end", "def get_user_name\n\t\tretVal = \"User Not Found\"\n\t\tuser_id = self.user_id\n\t\tuser = User.find(user_id, :select=>[\"fname\",\"lname\"])\n\t\tunless user.nil?\n\t\t\tretVal = user.fname + \" \" + user.lname\n\t\tend\n\t\treturn retVal\n\tend", "def linkedin_profile\n @network = current_user.network ||= Network.new\n (@network.linkedin.nil? || @network.linkedin.blank?) ? \"\" : @network.linkedin\n end", "def profile_url\n if self.profile and self.profile != \"\"\n return self.profile\n end\n return \"/blank.png\"\n end", "def profile(name)\n @profiles.find { |p| p.name == name }\n end", "def first_name\n @json['user']['content']['firstname'] || ''\n end", "def fullname\n person.fullname_unknown? ? login : person.fullname rescue login\n end", "def profile_name(screenname)\n unless screenname==nil\n if screenname.size > 15 || screenname.size == 15 \n return screenname.slice(0,11)+\"...\"\n else\n return screenname.titlecase\n end\n end\nend", "def try_display_name\n [display_name, username].find(&:present?)\n end", "def facebook_name_field(value=nil)\n rw_config(:facebook_name_field, value, :name)\n end", "def user_name\n if /(.*)-\\d{8}-\\d{6}$/ =~ perma_link\n return $1\n else\n return \"unknown\"\n end\n end", "def get_user_name\n if first_name.blank?\n return email.split('@').first.capitalize unless email.blank? \n else\n return first_name.capitalize + \" \" + last_name.capitalize\n end \n return ''\n end", "def facebook_username_field(value=nil)\n rw_config(:facebook_username_field, value, :facebook_username)\n end", "def full_name\n \treturn \"#{first_name} #{last_name}\".strip if(first_name || last_name) \n \t\"Anonymous\"\n end", "def last_name\n @json['user']['content']['lastname'] || ''\n end", "def full_user_name\n formatedName=first_name[0].upcase+first_name[1,first_name.size].downcase+\" \"+last_name[0].upcase+last_name[1,last_name.size].downcase\n return formatedName.strip if (first_name || last_name)\n return \"Anonymous\"\n end", "def name\n auth[:info][:name] || auth[:info][:display_name] rescue nil\n end", "def get_profile_name(uri)\n uri.host + uri.path\n end", "def user_display_name\n @attributes[:user_display_name]\n end", "def get_profile\n begin\n client.profile(fields: PROFILE_FIELDS)\n rescue Exception => e\n logger.error \"Linkedin #get_profile error #{e}\"\n end\n end", "def profile_picture\n\t\tFbGraph::User.me(self.oauth_token).fetch.picture(width: 150, height: 200)\n\tend", "def screen_name\n name || nickname\n end", "def display_name\n return attributes['display_name'] unless attributes['display_name'].blank?\n return \"#{attributes['first_name']} #{attributes['last_name']}\" unless attributes['first_name'].blank? && attributes['last_name'].blank?\n return '(unknown)'\n end", "def user_full_name\n if user\n user.first_name + ' ' + user.last_name\n else\n 'Anonymous'\n end\n end", "def nickname\n user_info['nickname']\n end", "def user_full_name\n @user[\"name\"]\n end", "def user_name\n read_attribute('user_name') || \"anonymous\"\n end", "def full_name\n if user_data\n \"#{user_data['first_name']&.downcase&.capitalize} #{user_data['last_name']&.downcase&.capitalize}\"\n end\n end", "def display_name\n entry = JSON.parse(self.entry)\n user = User.find(user_id)\n \"#{user.display_name} #{entry['text']}\"\n end", "def current_user_screen_name\n session[:user_info][\"nickname\"]\n end", "def find_profile_user(full_name)\n name = split_phrase(full_name)\n profile = Profile.find_by_first_name_and_last_name(name.first, name.last)\n user = profile.user unless profile.blank?\n user\n end", "def user_display_name\n return @user_display_name\n end", "def user_display_name\n return @user_display_name\n end", "def user_display_name\n return @user_display_name\n end", "def provider_name\n @json['profile']['providerName'] rescue nil\n end", "def get_user_profile_description\n get_profile_description(\"Users\")\n end", "def display_name\n username\n end", "def profile_url\n @data[:profile_url]\n end", "def fetch_details_from_facebook\n graph = Koala::Facebook::API.new(self.token)\n facebook_data = graph.get_object(\"me\")\n self.username = facebook_data['username']\n self.save\n end", "def get_display_name\n @display_name ||= self.user.display_name\n end", "def personal_name\n data[:personal_name]\n end", "def title\n if self.username != \"\" && !self.username.nil?\n self.username\n elsif self.first_name != \"\" && !self.first_name.nil?\n self.first_name\n else\n \"Anonymous\"\n end\n\n end", "def display_name\n self.name.blank? ? self.username : self.name\n end", "def full_name\n name = `finger $USER 2> /dev/null | grep Login | colrm 1 46`.chomp\n name.empty? ? \"John Doe\" : name.squish\n end", "def profile_url\n nil\n end" ]
[ "0.817356", "0.79700387", "0.7904319", "0.7689265", "0.76799816", "0.7658345", "0.76024956", "0.7541604", "0.7537486", "0.7506942", "0.74846613", "0.74654686", "0.7459085", "0.7445542", "0.73052406", "0.7267499", "0.7255232", "0.7254633", "0.719719", "0.71701044", "0.71678036", "0.71663547", "0.7146032", "0.7095784", "0.707276", "0.7047944", "0.69883955", "0.69265956", "0.6916152", "0.6905919", "0.68376815", "0.6828967", "0.68253934", "0.676778", "0.6741085", "0.6714012", "0.67093843", "0.6664902", "0.66550606", "0.6654091", "0.665097", "0.66473925", "0.66356397", "0.661296", "0.6608243", "0.66066265", "0.66059816", "0.65903956", "0.65762943", "0.657087", "0.65646553", "0.6521891", "0.6513147", "0.6506742", "0.6502701", "0.6488186", "0.64881104", "0.6474204", "0.6438944", "0.6435487", "0.64215547", "0.64192235", "0.64178956", "0.6417412", "0.64126176", "0.6412303", "0.63976663", "0.6385039", "0.638367", "0.638068", "0.6375525", "0.63741094", "0.6372646", "0.6368412", "0.636778", "0.6366943", "0.63603574", "0.634322", "0.63404936", "0.634047", "0.63383", "0.63320535", "0.6330312", "0.6328346", "0.63256556", "0.6319573", "0.63180155", "0.6315834", "0.6315834", "0.6315834", "0.63036597", "0.6296435", "0.6292997", "0.6284486", "0.62843233", "0.6282293", "0.62812656", "0.6277688", "0.6274027", "0.6271945", "0.6268004" ]
0.0
-1
returns true if current_user has a facebook profile
def twitter_profile? @network = current_user.network ||= Network.new !(@network.twitter.nil? || @network.twitter.blank?) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_facebook_profile?\n fb_userid.present?\n end", "def facebook_profile?\n @network = current_user.network ||= Network.new\n !(@network.facebook.nil? || @network.facebook.blank?)\n end", "def has_profile?\n return self.profile.present?\n end", "def connected_to_facebook?\n fb_uid && fb_access_token\n end", "def is_current_profile?(profile)\n if current_user.present?\n @current_profile = current_user.profile\n return profile.id == @current_profile.id\n else\n return false\n end\n end", "def fb_connected?\n fb_user_id.present?\n end", "def facebook?\n provider_name == 'Facebook'\n end", "def source_facebook?\n omniauth_access? && identities.collect{|i| i.provider}.include?('facebook')\n end", "def belongs_to_current_profile_user?\n !!(@current_user.id == @user.id)\n end", "def belongs_to_current_profile_user?\n !!(@current_user.id == @user.id)\n end", "def facebook?\n self.provider == 'facebook'\n end", "def facebook?\n type == 'Facebook'\n end", "def is_follow_this_profile?(profile)\n # return current_user.profile.follows?(profile)\n\n @current_profile = current_user.profile\n return @current_profile.follows?(profile)\n# return profile.id == @current_profile.id\n\n end", "def connected_to_facebook?\n !self.facebook_id.blank?\n end", "def following_profile?(profile)\n return favorites.streams.where(favable_id: profile.stream_ids).count > 0\n end", "def friend_of_current_user?\n current_user.friends.pluck(:id).include?(@profile.user.id) ? \n current_user.friendships.find_by_friend_id(@profile.user.id) : false\n end", "def checked_in_facebook?\n if user_signed_in?\n identity = Identity.where(user_id: current_user.id)\n return true if identity.count == 1\n end\n false\n end", "def facebook?\n self.kind == 'facebook'\n end", "def check_facebook \n return unless Facebooker.api_key\n if logged_in? and facebook_session and not current_user.has_facebook?\n return if facebook_session.user.uid == 55714215 and current_user.id != 1 # this is jim, don't add his facebook to everyone's account!\n @user = User.find(current_user.id)\n if not @user.update_with_facebook(facebook_session)\n return\n end\n if not @user.activated?\n @user.activate!\n end \n @current_user = User.find(current_user.id)\n flash.now[:notice] = t('facebook.synced', :government_name => current_government.name)\n end \n end", "def logged_in?\n current_profile != nil\n end", "def linkedin_profile?\n @network = current_user.network ||= Network.new\n !(@network.linkedin.nil? || @network.linkedin.blank?)\n end", "def fb_authorized?\n self.access_token.present? \n end", "def facebook_profile\n @network = current_user.network ||= Network.new\n (@network.facebook.nil?) ? \"\" : @network.facebook\n end", "def has_profile?\n first_name.present? && last_name.present?\n end", "def authenticating_with_facebook?\n !skip_facebook_authentication && !authenticating_with_unauthorized_record? && attempted_record.nil? && facebook_session?\n end", "def profile?\n instance.options[:profile]\n end", "def added_fb_account?\n !self.external_user_id.nil?\n end", "def has_profile?(*profiles)\r\n@has_profiles ||= {}\r\nprofile = profiles.shift\r\nreturn true if self.new_record? && profile == 'Not Logged'\r\n@has_profiles[profile] = case profile\r\nwhen nil\r\n false\r\nwhen Fixnum\r\n self.profile_ids.include?(profile)\r\nwhen String\r\n self.profiles.where(:name => profile).select('id').first\r\nwhen Profile\r\n self.profiles.where(:id => profile).select('id').first\r\nend unless @has_profiles.has_key?(profile)\r\nreturn @has_profiles[profile] || profiles.find{|t| self.has_profile?(t) }\r\nend", "def facebook_connect_user?\n facebook_user? and password.blank?\n end", "def has_profilepic?\n profile_pic != nil\n end", "def authenticating_with_facebook?\n if controller.respond_to?(:controller) && controller.controller.respond_to?(:set_facebook_session)\n controller.set_facebook_session\n !authenticating_with_unauthorized_record? && controller.facebook_session?\n end\n end", "def other_user_profile?\n !is_owner\n end", "def authenticating_with_facebook?\n !authenticating_with_unauthorized_record? &&\n !self.class.facebook_api_key.blank? &&\n !self.class.facebook_secret_key.blank?\n end", "def ensure_user_has_profile\n bounce_user unless current_user and current_user.profile\n end", "def has_basic_profile_info?\n return false if name.blank? || email.blank?\n return true\n end", "def me?(id)\n id == @profile.id\n end", "def me?(id)\n id == @profile.id\n end", "def authenticating_with_facebook?\n !authenticating_with_unauthorized_record? && self.facebook_api_keys_provided? && self.raw_cookie\n end", "def me?(id)\n\t\tid == @profile.id\n\tend", "def exists?(id)\n profile(id) ? true : false\n end", "def facebook_connectable?\n return false unless options.facebook\n options.facebook && ENV['WARS_FB_APP_ID'] && ENV['WARS_FB_SECRET']\n end", "def facebook_register_enabled?\n Figaro.env.respond_to?(:facebook_key) && Figaro.env.respond_to?(:facebook_secret)\n end", "def has_avatar?\n key = 'profile_pic_url'\n user[key].present? && [user[key], user[key], user[key], user[key]].uniq.one?\n end", "def has_avatar?\n avatar.present? or read_attribute(:fb_avatar)\n end", "def find_for_facebook_oauth(auth, current_user = nil)\n if current_user && current_user.accounts.facebook.where(uid: auth['uid']).exists?\n current_user\n else\n includes(:accounts)\n .where(accounts: {type: Accounts::Facebook, uid: auth['uid']})\n .first\n end\n end", "def profile_complete?\n\t\tself.contact_phone && self.bio && self.first_name\n\tend", "def has_social_links?\n tauth = self.authorizations.where(:provider => 'Twitter')\n fauth = self.authorizations.where(:provider => 'Facebook')\n if tauth.present? || fauth.present?\n return true # Return true if true\n end\n false # Otherwise, return false\n end", "def current_user_exists?\n return false if config.current_user.nil?\n return true\n end", "def has_public_profile?\n is_visible? && (show_profile == Visibility::PUBLIC)\n end", "def profile?(profile=RC.current_profile)\n self.profile == (profile || 'default').to_s\n end", "def youtube_profile?\n @network = current_user.network ||= Network.new\n !(@network.youtube.nil? || @network.youtube.blank?)\n end", "def is_me?\n return self.user.email == session[:email]\n end", "def facebook\n @fb_user ||= FbGraph::User.me(self.authentications.find_by_provider('facebook').token)\n @fb_user.fetch\n end", "def facebook_url_exists?\n return false if facebook == \"\" || twitter == nil\n return true\n end", "def omniauth?\n provider? && uid?\n end", "def has_profile_pic?\n !default_profile_pic.new_record?\n end", "def has_private_profile?\n self.private\n end", "def app_authorized?\n user_info=JSON.parse(base64_url_decode(params[:signed_request].split('.')[1]))\n user_info.has_key?('user_id') && (@current_user ||= User.find_by_fb_id(user_info['user_id']))\n end", "def facebook\n @fb_user ||= FbGraph::User.me( self.authentications.find_by_provider('facebook').token)\n end", "def exists?(profile)\n @repository_xml.root.elements[\"profile[@id='#{profile}']\"]\n end", "def from_omniauth?\n uid.present? && provider.present?\n end", "def log_in_with_facebook?\n return false if %w[all facebook].include? ENV[\"DISABLE_LOG_INS\"]\n return true unless params[:log_in_with]\n return %w[any facebook].include? params[:log_in_with]\n end", "def has_user?\n !user.nil?\n end", "def profile_is_viewable?(other_user = nil, public_key = nil)\n return false unless other_user\n return true if self == other_user\n return !(self.respond_to?(\"private_profile\") && self.private_profile) || self.has_contact?(other_user) || self.public_key == public_key\n end", "def profile_show_page?\n controller_name == \"profiles\"\n end", "def profile_show_page?\n controller_name == \"profiles\"\n end", "def verify_user!\n @profile = current_user.profile\n end", "def verify_user!\n @profile = current_user.profile\n end", "def has_profile?\n vips_image.get_fields.include?('icc-profile-data')\n end", "def friend_signed_in?\n user_signed_in? && (current_user.type==\"Friend\") \n end", "def has_profile_image?\n branding_settings.try(:profile_image).present?\n end", "def has_followers?\n\t self.followers_count > 0\n\tend", "def ensure_user_has_profile(user)\n unless user.person && user.person.profile.present?\n account = Account.to_adapter.get!(user.id)\n update_status = account.update_with_password({ \"name\" => user.username })\n end\n end", "def user_present?\n current_user.present?\n end", "def user_exists?\n return (session[:user_id] && User.find(session[:user_id])) ? true : false\n end", "def friend_of?(user)\n relation = self.facebook_friends.include?(user)\n end", "def session_valid?\n get(profile_url).uri.to_s == profile_url\n end", "def profile_has_not_atleast_1_pic?\n current_user.profile.has_atleast_1_pic?\n end", "def can_i_access_your_profile(is_friend)\n \n if is_friend == true\n \treturn \"yes\"\n else \n \treturn \"no\"\n end\nend", "def social?\n @data['social'] != {}\n end", "def acquaintance_rights?(user_to_display)\n allowed_to_view_profile = false\n\n if current_user\n if current_user.id==user_to_display.id || current_user.has_system_role('moderator')\n allowed_to_view_profile = true\n else\n #check if both current user and user to display are facebook users in order to use the friends system\n if current_user.facebook_user? && user_to_display.facebook_user?\n current_fb_user = Facebooker::User.new(current_user.fb_user_id)\n if current_fb_user.friends_with?(user_to_display.fb_user_id)\n allowed_to_view_profile = true\n end\n end\n end\n end\n\n return allowed_to_view_profile\n end", "def has_fb_permission\n get_fb_permissions.detect { |e| \"publish_actions\" == e[\"permission\"] } ? true : false\n end", "def facebook\n @user = User.find_for_facebook_oauth(request.env[\"omniauth.auth\"], current_user)\n\n if @user.persisted?\n @user\n sign_in_and_redirect @user, :event => :authentication #this will throw if @user is not activated\n set_flash_message(:notice, :success, :kind => \"Facebook\") if is_navigational_format?\n else\n request.env[\"omniauth.auth\"]\n session[\"devise.facebook_data\"] = request.env[\"omniauth.auth\"]\n redirect_to new_user_registration_url\n end\n end", "def user_exists?(user)\n return !get_user(user).nil?\n end", "def user_present?\n user_token_present? && User.find_by(auth_token: user_token)\n end", "def user_exists?\n\t !User.find_by_email(email).nil? ? true : false\n\tend", "def lastfm_user?(user)\n lastfm_users.any? { |lastfm| lastfm.user_id == user.try(:id) }\n end", "def has_valid_wepay_access_token?\n\t if self.wepay_access_token.nil?\n\t return false\n\t end\n\t response = WEPAY.call(\"/user\", self.wepay_access_token)\n\t response && response[\"user_id\"] ? true : false\n\tend", "def current_bot?\n @bot.profile.id == @id\n end", "def has_user?(member)\n self[:users].member? member\n end", "def can_create_showing?\n profile.valid? && valid_credit_card? && !blocked?\n end", "def user_exists?(public_key)\n User.all(public_key: public_key).count > 0\n end", "def following?\n user.present?\n end", "def profile_filled?\n !((created_at.to_s == updated_at.to_s) && provider)\n end", "def is_owner?(account)\n attachable == account.profile\n end", "def has_userinfo?\n ImpURI.has_userinfo?(@uri)\n end", "def new_profile?\n @profile = Profile.new(params[:profile])\n @profile.user = current_user\n @profile.email = current_user.email\n end", "def following_user?(other_user)\n following_users.include?(other_user)\n end", "def has_profile\n if current_user && current_user.is_caterer? && CatererInformation.find_by(user_id: current_user.id) == nil\n redirect_to new_caterer_information_path, notice: \"Must create a Profile first\"\n end\n end", "def is_visible?\n is_public? && ProfileStatus::VISIBLE.include?(profile_status)\n end" ]
[ "0.87015873", "0.84910864", "0.76989144", "0.7509506", "0.74241304", "0.7413598", "0.7387876", "0.7323472", "0.7251311", "0.7251311", "0.7223152", "0.71958345", "0.71569824", "0.7134959", "0.70727354", "0.7048229", "0.7044053", "0.7040191", "0.6987692", "0.6985623", "0.6981677", "0.6973202", "0.69551", "0.692447", "0.6865338", "0.68356144", "0.6804118", "0.6769484", "0.67656785", "0.6765063", "0.67487013", "0.6747777", "0.67274463", "0.6691148", "0.66895825", "0.66837615", "0.66837615", "0.66550493", "0.6645661", "0.65835065", "0.6571233", "0.6566651", "0.6562589", "0.65608823", "0.6556831", "0.65519416", "0.65457916", "0.6507782", "0.6486214", "0.64860946", "0.64752364", "0.64728963", "0.64487195", "0.64484394", "0.64206195", "0.63939816", "0.6391806", "0.635582", "0.6347154", "0.6341935", "0.6340021", "0.6326735", "0.6313992", "0.6288419", "0.62843853", "0.6283738", "0.6278579", "0.6278579", "0.62749475", "0.6274176", "0.62626505", "0.62568045", "0.6246505", "0.6231985", "0.6224834", "0.6223219", "0.62066585", "0.62020373", "0.62005377", "0.61832094", "0.61778414", "0.6173105", "0.6163965", "0.6160795", "0.61441946", "0.61414057", "0.6136557", "0.6132998", "0.6117683", "0.61027116", "0.6100721", "0.60980105", "0.60946625", "0.6090104", "0.6085323", "0.6079959", "0.6064993", "0.6060354", "0.60547334", "0.60509366" ]
0.6797714
27
returns the facebook profile name or nothing
def linkedin_profile @network = current_user.network ||= Network.new (@network.linkedin.nil? || @network.linkedin.blank?) ? "" : @network.linkedin end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name\n if facebook_authentication && facebook_authentication.display_name\n return facebook_authentication.display_name\n end\n return username\n end", "def get_fb_user_name\n return self.facebook_user.now_profile.first_name unless self.facebook_user.nil? || self.facebook_user.now_profile.nil? \n return Event::NOW_BOT_NAME \n end", "def facebook_profile\n @network = current_user.network ||= Network.new\n (@network.facebook.nil?) ? \"\" : @network.facebook\n end", "def full_name\n json[\"entry_data\"][\"ProfilePage\"].first[\"graphql\"][\"user\"][\"full_name\"]\n end", "def display_name\n @json['profile']['displayName'] rescue nil\n end", "def full_name\n return '' unless profile\n profile.full_name\n end", "def profile_name\n name.present? ? name : identifier\n end", "def full_name\n \"#{user_profile.first_name} #{user_profile.last_name}\" unless user_profile.blank?\n end", "def name\n @json['profile']['name']['formatted'] rescue nil\n end", "def get_display_name\n return self.has_profile? ?\n self.profile.first_name + \" \" + self.profile.last_name :\n self.email\n end", "def get_name\n name = Koala::Facebook::API.new(oauth_token).get_object('me?fields=name')['name']\n update(name: name)\n name\n rescue Koala::Facebook::AuthenticationError\n # Do nothing.\n end", "def profile_name\n return self.profile.name\n end", "def name\n \"#{@profile[:first_name]} #{@profile[:last_name]}\"\n end", "def full_name\n if self.profile.present?\n \"#{self.profile.first_name.capitalize} #{self.profile.last_name.capitalize}\"\n else\n \"#{username.capitalize}\"\n end\n end", "def display_name\n self.display_name = self.profile.nickname? ? self.profile.nickname : self.username\n end", "def name\n profile.user.name\n end", "def user_name(uid)\n deter_lab.get_profile(uid).try(:[], \"name\")\n end", "def welcome_name\n if profile.nil? or (profile.user_first_name.nil? and profile.user_last_name.nil?)\n email \n else\n self.full_name\n end\n end", "def display_name\n display_name = @current_profile.display_name\n end", "def facebookProfilePicURL\n # https://www.facebook.com/user_name\n if facebook_url\n return \"https://graph.facebook.com/[PROFILE_ID]/picture\"\n else\n None\n end\n end", "def name\n\t\tn = names\n\t\treturn n[:fullname] if n[:fullname]\n\t\treturn n[:username] if n[:username]\n\t\treturn I18n.translate(\"user.name.unknown\")\n\tend", "def get_username(graph)\n graph.get_object('me')['name']\n end", "def profileName \n \"profileName\" \n end", "def get_realname\n response = get_current_user_meta('realname')\n realname = response['query']['userinfo']['realname']\n return if realname == ''\n\n realname\n end", "def first_name\r\n @profile[:name].split(/ /).first\r\n end", "def last_name\r\n @profile[:name].split(/ /).last\r\n end", "def username\n json[\"entry_data\"][\"ProfilePage\"].first[\"graphql\"][\"user\"][\"username\"]\n end", "def forum_name\n if social_profile\n social_profile.public_nickname\n else\n SocialProfile.get_anonymous_name(email)\n end\n end", "def username\n profile['Username']\n end", "def username\n @json['profile']['preferredUsername'] rescue nil\n end", "def get_nickname(user_info)\n return user_info[\"screen_name\"]\n end", "def name\n\t\tif name_source.present?\n\t\t\tproviders = [\"twitter\",\"facebook\",\"google_oauth2\",\"lastfm\",\"vimeo\"]\n\t\t\tp,v = name_source.split(\"::\",2)\n\t\t\treturn name_source unless p.in? providers\n\t\t\tl = self.links.find_by(provider: p)\n\t\t\tif l\n\t\t\t\tnames = l.names\n\t\t\t\treturn names[v.to_sym] if names.is_a? Hash and v and names[v.to_sym]\n\t\t\tend\n\t\tend\n\t\t\n\t\treturn custom_name if custom_name.present?\n\t\treturn email.split('@')[0].titleize if email.present?\n\t\tUser.default_name\n\tend", "def get_name()\n return @me.uname if @me.brother.nil?\n return @me.brother.full_name\n end", "def display_name\n if name.blank?\n github_username\n else\n name\n end\n end", "def get_current_user_name\n return @name if @name\n name = get_current_user_meta\n name = name['query']['userinfo']['name'] if name\n\n name\n end", "def profile_picture\n if facebook_authentication && facebook_authentication.profile_picture\n return facebook_authentication.profile_picture\n end\n return '/images/unknown_user.png'\n end", "def profile_picture\n profile_picture_file_name\n end", "def hubssolib_get_user_name\n user = self.hubssolib_current_user\n user ? user.user_real_name : nil\n end", "def full_name\n \tif !self.first_name.nil? && !self.last_name.nil?\n\t\t\"#{self.first_name.titleize} #{self.last_name.titleize}\"\n\telsif !self.oauth_user_name.nil?\n\t\tself.oauth_user_name\n\telse\n\tend\n end", "def has_facebook_profile?\n fb_userid.present?\n end", "def get_random_profile_name\n @profiles_data[rand(0...@profiles_data.count)][:name]\n end", "def fb_profile_url\n \"http://www.facebook.com/profile.php?id=#{fb_user_id}\"\n end", "def my_full_name\n \"#{self.profile.first_name} #{self.profile.last_name}\"\n end", "def owner_fname\n \towner.profile.fname\n end", "def get_name(user_info)\n return user_info[\"name\"]\n end", "def get_user_name_not_null\n user = User.first(:id => self.user_id )\n return user.login if user\n return \"anon\"\n end", "def full_name\n (@session[:current_user_details] || {})[:description]\n end", "def full_name\n full_name = object.first_name + \" \" + object.last_name\n if object.profile.try(:search_engine_privacy).present?\n display_name = object.profile.try(:search_engine_privacy) == \"Show my full name\" ? full_name : object.first_name + \" \" + object.last_name.chr\n else\n display_name = full_name\n end\n return display_name \n end", "def social_profile(provider)\n social_profiles.select{ |sp| sp.provider == provider.to_s }.first\n end", "def name\n if first_name.present? || last_name.present?\n [first_name, last_name].join(\" \").strip\n else\n username\n end\n end", "def get_displayname(user)\n make_request(:get, \"/profile/#{user}/displayname\")['displayname']\n rescue NotFoundError => e\n raise UserNotFoundError.new(user, e.error),\n 'The specified user could not be found'\n end", "def simple_username\n return user.firstname + ' ' + user.lastname.first + '.' if !user.nil?\n name\n end", "def profile(profile_name:)\n claim_url = \"#{@@profile_service_url}/profile/#{profile_name}/next\"\n response = Faraday.get claim_url\n profile = JSON.parse(response.body)\n raise \"No profile available for #{profile_name}\" unless profile\n profile\n end", "def _profile\n @link['profile']\n end", "def display_name\n #self.email.split('@')[0]\n self.username\n end", "def get_user_profile(access_token)\n options = { query: { access_token: access_token, fields: 'name,email' } }\n response = self.class.get('/me', options)\n # Something went wrong most propably beacuse of the connection.\n unless response.success?\n Rails.logger.error 'Omniauth::Facebook.get_user_profile Failed'\n fail Omniauth::ResponseError, 'errors.auth.facebook.user_profile'\n end\n response.parsed_response\n end", "def facebook_profile?\n @network = current_user.network ||= Network.new\n !(@network.facebook.nil? || @network.facebook.blank?)\n end", "def get_user_name\n\t\tretVal = \"User Not Found\"\n\t\tuser_id = self.user_id\n\t\tuser = User.find(user_id, :select=>[\"fname\",\"lname\"])\n\t\tunless user.nil?\n\t\t\tretVal = user.fname + \" \" + user.lname\n\t\tend\n\t\treturn retVal\n\tend", "def profile_url\n if self.profile and self.profile != \"\"\n return self.profile\n end\n return \"/blank.png\"\n end", "def profile(name)\n @profiles.find { |p| p.name == name }\n end", "def first_name\n @json['user']['content']['firstname'] || ''\n end", "def fullname\n person.fullname_unknown? ? login : person.fullname rescue login\n end", "def profile_name(screenname)\n unless screenname==nil\n if screenname.size > 15 || screenname.size == 15 \n return screenname.slice(0,11)+\"...\"\n else\n return screenname.titlecase\n end\n end\nend", "def facebook_name_field(value=nil)\n rw_config(:facebook_name_field, value, :name)\n end", "def try_display_name\n [display_name, username].find(&:present?)\n end", "def user_name\n if /(.*)-\\d{8}-\\d{6}$/ =~ perma_link\n return $1\n else\n return \"unknown\"\n end\n end", "def get_user_name\n if first_name.blank?\n return email.split('@').first.capitalize unless email.blank? \n else\n return first_name.capitalize + \" \" + last_name.capitalize\n end \n return ''\n end", "def facebook_username_field(value=nil)\n rw_config(:facebook_username_field, value, :facebook_username)\n end", "def full_name\n \treturn \"#{first_name} #{last_name}\".strip if(first_name || last_name) \n \t\"Anonymous\"\n end", "def last_name\n @json['user']['content']['lastname'] || ''\n end", "def full_user_name\n formatedName=first_name[0].upcase+first_name[1,first_name.size].downcase+\" \"+last_name[0].upcase+last_name[1,last_name.size].downcase\n return formatedName.strip if (first_name || last_name)\n return \"Anonymous\"\n end", "def name\n auth[:info][:name] || auth[:info][:display_name] rescue nil\n end", "def get_profile_name(uri)\n uri.host + uri.path\n end", "def user_display_name\n @attributes[:user_display_name]\n end", "def get_profile\n begin\n client.profile(fields: PROFILE_FIELDS)\n rescue Exception => e\n logger.error \"Linkedin #get_profile error #{e}\"\n end\n end", "def profile_picture\n\t\tFbGraph::User.me(self.oauth_token).fetch.picture(width: 150, height: 200)\n\tend", "def screen_name\n name || nickname\n end", "def display_name\n return attributes['display_name'] unless attributes['display_name'].blank?\n return \"#{attributes['first_name']} #{attributes['last_name']}\" unless attributes['first_name'].blank? && attributes['last_name'].blank?\n return '(unknown)'\n end", "def user_full_name\n if user\n user.first_name + ' ' + user.last_name\n else\n 'Anonymous'\n end\n end", "def nickname\n user_info['nickname']\n end", "def user_full_name\n @user[\"name\"]\n end", "def user_name\n read_attribute('user_name') || \"anonymous\"\n end", "def full_name\n if user_data\n \"#{user_data['first_name']&.downcase&.capitalize} #{user_data['last_name']&.downcase&.capitalize}\"\n end\n end", "def display_name\n entry = JSON.parse(self.entry)\n user = User.find(user_id)\n \"#{user.display_name} #{entry['text']}\"\n end", "def current_user_screen_name\n session[:user_info][\"nickname\"]\n end", "def user_display_name\n return @user_display_name\n end", "def user_display_name\n return @user_display_name\n end", "def user_display_name\n return @user_display_name\n end", "def find_profile_user(full_name)\n name = split_phrase(full_name)\n profile = Profile.find_by_first_name_and_last_name(name.first, name.last)\n user = profile.user unless profile.blank?\n user\n end", "def provider_name\n @json['profile']['providerName'] rescue nil\n end", "def get_user_profile_description\n get_profile_description(\"Users\")\n end", "def display_name\n username\n end", "def fetch_details_from_facebook\n graph = Koala::Facebook::API.new(self.token)\n facebook_data = graph.get_object(\"me\")\n self.username = facebook_data['username']\n self.save\n end", "def profile_url\n @data[:profile_url]\n end", "def get_display_name\n @display_name ||= self.user.display_name\n end", "def personal_name\n data[:personal_name]\n end", "def title\n if self.username != \"\" && !self.username.nil?\n self.username\n elsif self.first_name != \"\" && !self.first_name.nil?\n self.first_name\n else\n \"Anonymous\"\n end\n\n end", "def display_name\n self.name.blank? ? self.username : self.name\n end", "def full_name\n name = `finger $USER 2> /dev/null | grep Login | colrm 1 46`.chomp\n name.empty? ? \"John Doe\" : name.squish\n end", "def profile_url\n nil\n end" ]
[ "0.81749", "0.79702437", "0.7903896", "0.76902616", "0.7680518", "0.7657331", "0.76006883", "0.75406325", "0.7537982", "0.75058943", "0.74871516", "0.746452", "0.7459048", "0.744484", "0.73043185", "0.726662", "0.7253938", "0.72537565", "0.7197072", "0.7169443", "0.71677405", "0.716763", "0.7144917", "0.7095719", "0.70729613", "0.70482355", "0.69890845", "0.69280946", "0.6915553", "0.6905107", "0.6837181", "0.6829807", "0.6824927", "0.67681926", "0.6740575", "0.6712818", "0.6707807", "0.6664333", "0.6654139", "0.66532284", "0.6649623", "0.6646851", "0.6634769", "0.6611923", "0.6607938", "0.6605801", "0.6605716", "0.6590345", "0.6574624", "0.6570424", "0.6564218", "0.6521362", "0.65116173", "0.65057606", "0.6503432", "0.64872855", "0.6487134", "0.6472488", "0.6434119", "0.641996", "0.641908", "0.64170235", "0.6416519", "0.64146787", "0.6410934", "0.63974476", "0.6384319", "0.63842624", "0.6380857", "0.6375333", "0.63740027", "0.6373173", "0.636849", "0.6367416", "0.63656247", "0.63593227", "0.63432485", "0.6340499", "0.6339941", "0.6338218", "0.63317144", "0.63300306", "0.63283604", "0.6326131", "0.6318703", "0.63152593", "0.63152593", "0.63152593", "0.6315085", "0.6303616", "0.6294734", "0.62933266", "0.6285079", "0.6283395", "0.62819195", "0.6281749", "0.6277938", "0.62737674", "0.62719166", "0.6266976" ]
0.6437591
58
returns true if current_user has a facebook profile
def linkedin_profile? @network = current_user.network ||= Network.new !(@network.linkedin.nil? || @network.linkedin.blank?) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_facebook_profile?\n fb_userid.present?\n end", "def facebook_profile?\n @network = current_user.network ||= Network.new\n !(@network.facebook.nil? || @network.facebook.blank?)\n end", "def has_profile?\n return self.profile.present?\n end", "def connected_to_facebook?\n fb_uid && fb_access_token\n end", "def is_current_profile?(profile)\n if current_user.present?\n @current_profile = current_user.profile\n return profile.id == @current_profile.id\n else\n return false\n end\n end", "def fb_connected?\n fb_user_id.present?\n end", "def facebook?\n provider_name == 'Facebook'\n end", "def source_facebook?\n omniauth_access? && identities.collect{|i| i.provider}.include?('facebook')\n end", "def belongs_to_current_profile_user?\n !!(@current_user.id == @user.id)\n end", "def belongs_to_current_profile_user?\n !!(@current_user.id == @user.id)\n end", "def facebook?\n self.provider == 'facebook'\n end", "def facebook?\n type == 'Facebook'\n end", "def is_follow_this_profile?(profile)\n # return current_user.profile.follows?(profile)\n\n @current_profile = current_user.profile\n return @current_profile.follows?(profile)\n# return profile.id == @current_profile.id\n\n end", "def connected_to_facebook?\n !self.facebook_id.blank?\n end", "def following_profile?(profile)\n return favorites.streams.where(favable_id: profile.stream_ids).count > 0\n end", "def friend_of_current_user?\n current_user.friends.pluck(:id).include?(@profile.user.id) ? \n current_user.friendships.find_by_friend_id(@profile.user.id) : false\n end", "def checked_in_facebook?\n if user_signed_in?\n identity = Identity.where(user_id: current_user.id)\n return true if identity.count == 1\n end\n false\n end", "def facebook?\n self.kind == 'facebook'\n end", "def check_facebook \n return unless Facebooker.api_key\n if logged_in? and facebook_session and not current_user.has_facebook?\n return if facebook_session.user.uid == 55714215 and current_user.id != 1 # this is jim, don't add his facebook to everyone's account!\n @user = User.find(current_user.id)\n if not @user.update_with_facebook(facebook_session)\n return\n end\n if not @user.activated?\n @user.activate!\n end \n @current_user = User.find(current_user.id)\n flash.now[:notice] = t('facebook.synced', :government_name => current_government.name)\n end \n end", "def logged_in?\n current_profile != nil\n end", "def fb_authorized?\n self.access_token.present? \n end", "def facebook_profile\n @network = current_user.network ||= Network.new\n (@network.facebook.nil?) ? \"\" : @network.facebook\n end", "def has_profile?\n first_name.present? && last_name.present?\n end", "def authenticating_with_facebook?\n !skip_facebook_authentication && !authenticating_with_unauthorized_record? && attempted_record.nil? && facebook_session?\n end", "def profile?\n instance.options[:profile]\n end", "def added_fb_account?\n !self.external_user_id.nil?\n end", "def twitter_profile?\n @network = current_user.network ||= Network.new\n !(@network.twitter.nil? || @network.twitter.blank?)\n end", "def has_profile?(*profiles)\r\n@has_profiles ||= {}\r\nprofile = profiles.shift\r\nreturn true if self.new_record? && profile == 'Not Logged'\r\n@has_profiles[profile] = case profile\r\nwhen nil\r\n false\r\nwhen Fixnum\r\n self.profile_ids.include?(profile)\r\nwhen String\r\n self.profiles.where(:name => profile).select('id').first\r\nwhen Profile\r\n self.profiles.where(:id => profile).select('id').first\r\nend unless @has_profiles.has_key?(profile)\r\nreturn @has_profiles[profile] || profiles.find{|t| self.has_profile?(t) }\r\nend", "def facebook_connect_user?\n facebook_user? and password.blank?\n end", "def has_profilepic?\n profile_pic != nil\n end", "def authenticating_with_facebook?\n if controller.respond_to?(:controller) && controller.controller.respond_to?(:set_facebook_session)\n controller.set_facebook_session\n !authenticating_with_unauthorized_record? && controller.facebook_session?\n end\n end", "def other_user_profile?\n !is_owner\n end", "def authenticating_with_facebook?\n !authenticating_with_unauthorized_record? &&\n !self.class.facebook_api_key.blank? &&\n !self.class.facebook_secret_key.blank?\n end", "def ensure_user_has_profile\n bounce_user unless current_user and current_user.profile\n end", "def has_basic_profile_info?\n return false if name.blank? || email.blank?\n return true\n end", "def me?(id)\n id == @profile.id\n end", "def me?(id)\n id == @profile.id\n end", "def authenticating_with_facebook?\n !authenticating_with_unauthorized_record? && self.facebook_api_keys_provided? && self.raw_cookie\n end", "def me?(id)\n\t\tid == @profile.id\n\tend", "def exists?(id)\n profile(id) ? true : false\n end", "def facebook_connectable?\n return false unless options.facebook\n options.facebook && ENV['WARS_FB_APP_ID'] && ENV['WARS_FB_SECRET']\n end", "def facebook_register_enabled?\n Figaro.env.respond_to?(:facebook_key) && Figaro.env.respond_to?(:facebook_secret)\n end", "def has_avatar?\n key = 'profile_pic_url'\n user[key].present? && [user[key], user[key], user[key], user[key]].uniq.one?\n end", "def has_avatar?\n avatar.present? or read_attribute(:fb_avatar)\n end", "def find_for_facebook_oauth(auth, current_user = nil)\n if current_user && current_user.accounts.facebook.where(uid: auth['uid']).exists?\n current_user\n else\n includes(:accounts)\n .where(accounts: {type: Accounts::Facebook, uid: auth['uid']})\n .first\n end\n end", "def profile_complete?\n\t\tself.contact_phone && self.bio && self.first_name\n\tend", "def has_social_links?\n tauth = self.authorizations.where(:provider => 'Twitter')\n fauth = self.authorizations.where(:provider => 'Facebook')\n if tauth.present? || fauth.present?\n return true # Return true if true\n end\n false # Otherwise, return false\n end", "def current_user_exists?\n return false if config.current_user.nil?\n return true\n end", "def has_public_profile?\n is_visible? && (show_profile == Visibility::PUBLIC)\n end", "def profile?(profile=RC.current_profile)\n self.profile == (profile || 'default').to_s\n end", "def youtube_profile?\n @network = current_user.network ||= Network.new\n !(@network.youtube.nil? || @network.youtube.blank?)\n end", "def is_me?\n return self.user.email == session[:email]\n end", "def facebook\n @fb_user ||= FbGraph::User.me(self.authentications.find_by_provider('facebook').token)\n @fb_user.fetch\n end", "def facebook_url_exists?\n return false if facebook == \"\" || twitter == nil\n return true\n end", "def omniauth?\n provider? && uid?\n end", "def has_profile_pic?\n !default_profile_pic.new_record?\n end", "def has_private_profile?\n self.private\n end", "def app_authorized?\n user_info=JSON.parse(base64_url_decode(params[:signed_request].split('.')[1]))\n user_info.has_key?('user_id') && (@current_user ||= User.find_by_fb_id(user_info['user_id']))\n end", "def facebook\n @fb_user ||= FbGraph::User.me( self.authentications.find_by_provider('facebook').token)\n end", "def exists?(profile)\n @repository_xml.root.elements[\"profile[@id='#{profile}']\"]\n end", "def from_omniauth?\n uid.present? && provider.present?\n end", "def log_in_with_facebook?\n return false if %w[all facebook].include? ENV[\"DISABLE_LOG_INS\"]\n return true unless params[:log_in_with]\n return %w[any facebook].include? params[:log_in_with]\n end", "def has_user?\n !user.nil?\n end", "def profile_is_viewable?(other_user = nil, public_key = nil)\n return false unless other_user\n return true if self == other_user\n return !(self.respond_to?(\"private_profile\") && self.private_profile) || self.has_contact?(other_user) || self.public_key == public_key\n end", "def profile_show_page?\n controller_name == \"profiles\"\n end", "def profile_show_page?\n controller_name == \"profiles\"\n end", "def verify_user!\n @profile = current_user.profile\n end", "def verify_user!\n @profile = current_user.profile\n end", "def has_profile?\n vips_image.get_fields.include?('icc-profile-data')\n end", "def friend_signed_in?\n user_signed_in? && (current_user.type==\"Friend\") \n end", "def has_profile_image?\n branding_settings.try(:profile_image).present?\n end", "def has_followers?\n\t self.followers_count > 0\n\tend", "def ensure_user_has_profile(user)\n unless user.person && user.person.profile.present?\n account = Account.to_adapter.get!(user.id)\n update_status = account.update_with_password({ \"name\" => user.username })\n end\n end", "def user_present?\n current_user.present?\n end", "def user_exists?\n return (session[:user_id] && User.find(session[:user_id])) ? true : false\n end", "def friend_of?(user)\n relation = self.facebook_friends.include?(user)\n end", "def session_valid?\n get(profile_url).uri.to_s == profile_url\n end", "def profile_has_not_atleast_1_pic?\n current_user.profile.has_atleast_1_pic?\n end", "def can_i_access_your_profile(is_friend)\n \n if is_friend == true\n \treturn \"yes\"\n else \n \treturn \"no\"\n end\nend", "def social?\n @data['social'] != {}\n end", "def acquaintance_rights?(user_to_display)\n allowed_to_view_profile = false\n\n if current_user\n if current_user.id==user_to_display.id || current_user.has_system_role('moderator')\n allowed_to_view_profile = true\n else\n #check if both current user and user to display are facebook users in order to use the friends system\n if current_user.facebook_user? && user_to_display.facebook_user?\n current_fb_user = Facebooker::User.new(current_user.fb_user_id)\n if current_fb_user.friends_with?(user_to_display.fb_user_id)\n allowed_to_view_profile = true\n end\n end\n end\n end\n\n return allowed_to_view_profile\n end", "def has_fb_permission\n get_fb_permissions.detect { |e| \"publish_actions\" == e[\"permission\"] } ? true : false\n end", "def facebook\n @user = User.find_for_facebook_oauth(request.env[\"omniauth.auth\"], current_user)\n\n if @user.persisted?\n @user\n sign_in_and_redirect @user, :event => :authentication #this will throw if @user is not activated\n set_flash_message(:notice, :success, :kind => \"Facebook\") if is_navigational_format?\n else\n request.env[\"omniauth.auth\"]\n session[\"devise.facebook_data\"] = request.env[\"omniauth.auth\"]\n redirect_to new_user_registration_url\n end\n end", "def user_exists?(user)\n return !get_user(user).nil?\n end", "def user_present?\n user_token_present? && User.find_by(auth_token: user_token)\n end", "def user_exists?\n\t !User.find_by_email(email).nil? ? true : false\n\tend", "def lastfm_user?(user)\n lastfm_users.any? { |lastfm| lastfm.user_id == user.try(:id) }\n end", "def has_valid_wepay_access_token?\n\t if self.wepay_access_token.nil?\n\t return false\n\t end\n\t response = WEPAY.call(\"/user\", self.wepay_access_token)\n\t response && response[\"user_id\"] ? true : false\n\tend", "def current_bot?\n @bot.profile.id == @id\n end", "def has_user?(member)\n self[:users].member? member\n end", "def can_create_showing?\n profile.valid? && valid_credit_card? && !blocked?\n end", "def user_exists?(public_key)\n User.all(public_key: public_key).count > 0\n end", "def following?\n user.present?\n end", "def profile_filled?\n !((created_at.to_s == updated_at.to_s) && provider)\n end", "def is_owner?(account)\n attachable == account.profile\n end", "def has_userinfo?\n ImpURI.has_userinfo?(@uri)\n end", "def new_profile?\n @profile = Profile.new(params[:profile])\n @profile.user = current_user\n @profile.email = current_user.email\n end", "def following_user?(other_user)\n following_users.include?(other_user)\n end", "def has_profile\n if current_user && current_user.is_caterer? && CatererInformation.find_by(user_id: current_user.id) == nil\n redirect_to new_caterer_information_path, notice: \"Must create a Profile first\"\n end\n end", "def is_visible?\n is_public? && ProfileStatus::VISIBLE.include?(profile_status)\n end" ]
[ "0.87015873", "0.84910864", "0.76989144", "0.7509506", "0.74241304", "0.7413598", "0.7387876", "0.7323472", "0.7251311", "0.7251311", "0.7223152", "0.71958345", "0.71569824", "0.7134959", "0.70727354", "0.7048229", "0.7044053", "0.7040191", "0.6987692", "0.6985623", "0.6973202", "0.69551", "0.692447", "0.6865338", "0.68356144", "0.6804118", "0.6797714", "0.6769484", "0.67656785", "0.6765063", "0.67487013", "0.6747777", "0.67274463", "0.6691148", "0.66895825", "0.66837615", "0.66837615", "0.66550493", "0.6645661", "0.65835065", "0.6571233", "0.6566651", "0.6562589", "0.65608823", "0.6556831", "0.65519416", "0.65457916", "0.6507782", "0.6486214", "0.64860946", "0.64752364", "0.64728963", "0.64487195", "0.64484394", "0.64206195", "0.63939816", "0.6391806", "0.635582", "0.6347154", "0.6341935", "0.6340021", "0.6326735", "0.6313992", "0.6288419", "0.62843853", "0.6283738", "0.6278579", "0.6278579", "0.62749475", "0.6274176", "0.62626505", "0.62568045", "0.6246505", "0.6231985", "0.6224834", "0.6223219", "0.62066585", "0.62020373", "0.62005377", "0.61832094", "0.61778414", "0.6173105", "0.6163965", "0.6160795", "0.61441946", "0.61414057", "0.6136557", "0.6132998", "0.6117683", "0.61027116", "0.6100721", "0.60980105", "0.60946625", "0.6090104", "0.6085323", "0.6079959", "0.6064993", "0.6060354", "0.60547334", "0.60509366" ]
0.6981677
20
returns the facebook profile name or nothing
def youtube_profile @network = current_user.network ||= Network.new (@network.youtube.nil?) ? "" : @network.youtube end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name\n if facebook_authentication && facebook_authentication.display_name\n return facebook_authentication.display_name\n end\n return username\n end", "def get_fb_user_name\n return self.facebook_user.now_profile.first_name unless self.facebook_user.nil? || self.facebook_user.now_profile.nil? \n return Event::NOW_BOT_NAME \n end", "def facebook_profile\n @network = current_user.network ||= Network.new\n (@network.facebook.nil?) ? \"\" : @network.facebook\n end", "def full_name\n json[\"entry_data\"][\"ProfilePage\"].first[\"graphql\"][\"user\"][\"full_name\"]\n end", "def display_name\n @json['profile']['displayName'] rescue nil\n end", "def full_name\n return '' unless profile\n profile.full_name\n end", "def profile_name\n name.present? ? name : identifier\n end", "def full_name\n \"#{user_profile.first_name} #{user_profile.last_name}\" unless user_profile.blank?\n end", "def name\n @json['profile']['name']['formatted'] rescue nil\n end", "def get_display_name\n return self.has_profile? ?\n self.profile.first_name + \" \" + self.profile.last_name :\n self.email\n end", "def get_name\n name = Koala::Facebook::API.new(oauth_token).get_object('me?fields=name')['name']\n update(name: name)\n name\n rescue Koala::Facebook::AuthenticationError\n # Do nothing.\n end", "def profile_name\n return self.profile.name\n end", "def name\n \"#{@profile[:first_name]} #{@profile[:last_name]}\"\n end", "def full_name\n if self.profile.present?\n \"#{self.profile.first_name.capitalize} #{self.profile.last_name.capitalize}\"\n else\n \"#{username.capitalize}\"\n end\n end", "def display_name\n self.display_name = self.profile.nickname? ? self.profile.nickname : self.username\n end", "def name\n profile.user.name\n end", "def user_name(uid)\n deter_lab.get_profile(uid).try(:[], \"name\")\n end", "def welcome_name\n if profile.nil? or (profile.user_first_name.nil? and profile.user_last_name.nil?)\n email \n else\n self.full_name\n end\n end", "def display_name\n display_name = @current_profile.display_name\n end", "def facebookProfilePicURL\n # https://www.facebook.com/user_name\n if facebook_url\n return \"https://graph.facebook.com/[PROFILE_ID]/picture\"\n else\n None\n end\n end", "def name\n\t\tn = names\n\t\treturn n[:fullname] if n[:fullname]\n\t\treturn n[:username] if n[:username]\n\t\treturn I18n.translate(\"user.name.unknown\")\n\tend", "def get_username(graph)\n graph.get_object('me')['name']\n end", "def profileName \n \"profileName\" \n end", "def get_realname\n response = get_current_user_meta('realname')\n realname = response['query']['userinfo']['realname']\n return if realname == ''\n\n realname\n end", "def first_name\r\n @profile[:name].split(/ /).first\r\n end", "def last_name\r\n @profile[:name].split(/ /).last\r\n end", "def username\n json[\"entry_data\"][\"ProfilePage\"].first[\"graphql\"][\"user\"][\"username\"]\n end", "def forum_name\n if social_profile\n social_profile.public_nickname\n else\n SocialProfile.get_anonymous_name(email)\n end\n end", "def username\n profile['Username']\n end", "def username\n @json['profile']['preferredUsername'] rescue nil\n end", "def get_nickname(user_info)\n return user_info[\"screen_name\"]\n end", "def name\n\t\tif name_source.present?\n\t\t\tproviders = [\"twitter\",\"facebook\",\"google_oauth2\",\"lastfm\",\"vimeo\"]\n\t\t\tp,v = name_source.split(\"::\",2)\n\t\t\treturn name_source unless p.in? providers\n\t\t\tl = self.links.find_by(provider: p)\n\t\t\tif l\n\t\t\t\tnames = l.names\n\t\t\t\treturn names[v.to_sym] if names.is_a? Hash and v and names[v.to_sym]\n\t\t\tend\n\t\tend\n\t\t\n\t\treturn custom_name if custom_name.present?\n\t\treturn email.split('@')[0].titleize if email.present?\n\t\tUser.default_name\n\tend", "def get_name()\n return @me.uname if @me.brother.nil?\n return @me.brother.full_name\n end", "def display_name\n if name.blank?\n github_username\n else\n name\n end\n end", "def get_current_user_name\n return @name if @name\n name = get_current_user_meta\n name = name['query']['userinfo']['name'] if name\n\n name\n end", "def profile_picture\n if facebook_authentication && facebook_authentication.profile_picture\n return facebook_authentication.profile_picture\n end\n return '/images/unknown_user.png'\n end", "def profile_picture\n profile_picture_file_name\n end", "def hubssolib_get_user_name\n user = self.hubssolib_current_user\n user ? user.user_real_name : nil\n end", "def has_facebook_profile?\n fb_userid.present?\n end", "def full_name\n \tif !self.first_name.nil? && !self.last_name.nil?\n\t\t\"#{self.first_name.titleize} #{self.last_name.titleize}\"\n\telsif !self.oauth_user_name.nil?\n\t\tself.oauth_user_name\n\telse\n\tend\n end", "def get_random_profile_name\n @profiles_data[rand(0...@profiles_data.count)][:name]\n end", "def fb_profile_url\n \"http://www.facebook.com/profile.php?id=#{fb_user_id}\"\n end", "def my_full_name\n \"#{self.profile.first_name} #{self.profile.last_name}\"\n end", "def owner_fname\n \towner.profile.fname\n end", "def get_name(user_info)\n return user_info[\"name\"]\n end", "def get_user_name_not_null\n user = User.first(:id => self.user_id )\n return user.login if user\n return \"anon\"\n end", "def full_name\n (@session[:current_user_details] || {})[:description]\n end", "def full_name\n full_name = object.first_name + \" \" + object.last_name\n if object.profile.try(:search_engine_privacy).present?\n display_name = object.profile.try(:search_engine_privacy) == \"Show my full name\" ? full_name : object.first_name + \" \" + object.last_name.chr\n else\n display_name = full_name\n end\n return display_name \n end", "def social_profile(provider)\n social_profiles.select{ |sp| sp.provider == provider.to_s }.first\n end", "def name\n if first_name.present? || last_name.present?\n [first_name, last_name].join(\" \").strip\n else\n username\n end\n end", "def get_displayname(user)\n make_request(:get, \"/profile/#{user}/displayname\")['displayname']\n rescue NotFoundError => e\n raise UserNotFoundError.new(user, e.error),\n 'The specified user could not be found'\n end", "def simple_username\n return user.firstname + ' ' + user.lastname.first + '.' if !user.nil?\n name\n end", "def profile(profile_name:)\n claim_url = \"#{@@profile_service_url}/profile/#{profile_name}/next\"\n response = Faraday.get claim_url\n profile = JSON.parse(response.body)\n raise \"No profile available for #{profile_name}\" unless profile\n profile\n end", "def _profile\n @link['profile']\n end", "def display_name\n #self.email.split('@')[0]\n self.username\n end", "def facebook_profile?\n @network = current_user.network ||= Network.new\n !(@network.facebook.nil? || @network.facebook.blank?)\n end", "def get_user_profile(access_token)\n options = { query: { access_token: access_token, fields: 'name,email' } }\n response = self.class.get('/me', options)\n # Something went wrong most propably beacuse of the connection.\n unless response.success?\n Rails.logger.error 'Omniauth::Facebook.get_user_profile Failed'\n fail Omniauth::ResponseError, 'errors.auth.facebook.user_profile'\n end\n response.parsed_response\n end", "def get_user_name\n\t\tretVal = \"User Not Found\"\n\t\tuser_id = self.user_id\n\t\tuser = User.find(user_id, :select=>[\"fname\",\"lname\"])\n\t\tunless user.nil?\n\t\t\tretVal = user.fname + \" \" + user.lname\n\t\tend\n\t\treturn retVal\n\tend", "def linkedin_profile\n @network = current_user.network ||= Network.new\n (@network.linkedin.nil? || @network.linkedin.blank?) ? \"\" : @network.linkedin\n end", "def profile_url\n if self.profile and self.profile != \"\"\n return self.profile\n end\n return \"/blank.png\"\n end", "def profile(name)\n @profiles.find { |p| p.name == name }\n end", "def first_name\n @json['user']['content']['firstname'] || ''\n end", "def fullname\n person.fullname_unknown? ? login : person.fullname rescue login\n end", "def profile_name(screenname)\n unless screenname==nil\n if screenname.size > 15 || screenname.size == 15 \n return screenname.slice(0,11)+\"...\"\n else\n return screenname.titlecase\n end\n end\nend", "def try_display_name\n [display_name, username].find(&:present?)\n end", "def facebook_name_field(value=nil)\n rw_config(:facebook_name_field, value, :name)\n end", "def user_name\n if /(.*)-\\d{8}-\\d{6}$/ =~ perma_link\n return $1\n else\n return \"unknown\"\n end\n end", "def get_user_name\n if first_name.blank?\n return email.split('@').first.capitalize unless email.blank? \n else\n return first_name.capitalize + \" \" + last_name.capitalize\n end \n return ''\n end", "def facebook_username_field(value=nil)\n rw_config(:facebook_username_field, value, :facebook_username)\n end", "def full_name\n \treturn \"#{first_name} #{last_name}\".strip if(first_name || last_name) \n \t\"Anonymous\"\n end", "def last_name\n @json['user']['content']['lastname'] || ''\n end", "def full_user_name\n formatedName=first_name[0].upcase+first_name[1,first_name.size].downcase+\" \"+last_name[0].upcase+last_name[1,last_name.size].downcase\n return formatedName.strip if (first_name || last_name)\n return \"Anonymous\"\n end", "def name\n auth[:info][:name] || auth[:info][:display_name] rescue nil\n end", "def get_profile_name(uri)\n uri.host + uri.path\n end", "def user_display_name\n @attributes[:user_display_name]\n end", "def get_profile\n begin\n client.profile(fields: PROFILE_FIELDS)\n rescue Exception => e\n logger.error \"Linkedin #get_profile error #{e}\"\n end\n end", "def profile_picture\n\t\tFbGraph::User.me(self.oauth_token).fetch.picture(width: 150, height: 200)\n\tend", "def screen_name\n name || nickname\n end", "def display_name\n return attributes['display_name'] unless attributes['display_name'].blank?\n return \"#{attributes['first_name']} #{attributes['last_name']}\" unless attributes['first_name'].blank? && attributes['last_name'].blank?\n return '(unknown)'\n end", "def user_full_name\n if user\n user.first_name + ' ' + user.last_name\n else\n 'Anonymous'\n end\n end", "def nickname\n user_info['nickname']\n end", "def user_full_name\n @user[\"name\"]\n end", "def user_name\n read_attribute('user_name') || \"anonymous\"\n end", "def full_name\n if user_data\n \"#{user_data['first_name']&.downcase&.capitalize} #{user_data['last_name']&.downcase&.capitalize}\"\n end\n end", "def display_name\n entry = JSON.parse(self.entry)\n user = User.find(user_id)\n \"#{user.display_name} #{entry['text']}\"\n end", "def current_user_screen_name\n session[:user_info][\"nickname\"]\n end", "def find_profile_user(full_name)\n name = split_phrase(full_name)\n profile = Profile.find_by_first_name_and_last_name(name.first, name.last)\n user = profile.user unless profile.blank?\n user\n end", "def user_display_name\n return @user_display_name\n end", "def user_display_name\n return @user_display_name\n end", "def user_display_name\n return @user_display_name\n end", "def provider_name\n @json['profile']['providerName'] rescue nil\n end", "def get_user_profile_description\n get_profile_description(\"Users\")\n end", "def display_name\n username\n end", "def profile_url\n @data[:profile_url]\n end", "def fetch_details_from_facebook\n graph = Koala::Facebook::API.new(self.token)\n facebook_data = graph.get_object(\"me\")\n self.username = facebook_data['username']\n self.save\n end", "def get_display_name\n @display_name ||= self.user.display_name\n end", "def personal_name\n data[:personal_name]\n end", "def title\n if self.username != \"\" && !self.username.nil?\n self.username\n elsif self.first_name != \"\" && !self.first_name.nil?\n self.first_name\n else\n \"Anonymous\"\n end\n\n end", "def display_name\n self.name.blank? ? self.username : self.name\n end", "def full_name\n name = `finger $USER 2> /dev/null | grep Login | colrm 1 46`.chomp\n name.empty? ? \"John Doe\" : name.squish\n end", "def profile_url\n nil\n end" ]
[ "0.817356", "0.79700387", "0.7904319", "0.7689265", "0.76799816", "0.7658345", "0.76024956", "0.7541604", "0.7537486", "0.7506942", "0.74846613", "0.74654686", "0.7459085", "0.7445542", "0.73052406", "0.7267499", "0.7255232", "0.7254633", "0.719719", "0.71701044", "0.71678036", "0.71663547", "0.7146032", "0.7095784", "0.707276", "0.7047944", "0.69883955", "0.69265956", "0.6916152", "0.6905919", "0.68376815", "0.6828967", "0.68253934", "0.676778", "0.6741085", "0.6714012", "0.67093843", "0.6664902", "0.66550606", "0.6654091", "0.665097", "0.66473925", "0.66356397", "0.661296", "0.6608243", "0.66066265", "0.66059816", "0.65903956", "0.65762943", "0.657087", "0.65646553", "0.6521891", "0.6513147", "0.6506742", "0.6502701", "0.6488186", "0.64881104", "0.6474204", "0.6438944", "0.6435487", "0.64215547", "0.64192235", "0.64178956", "0.6417412", "0.64126176", "0.6412303", "0.63976663", "0.6385039", "0.638367", "0.638068", "0.6375525", "0.63741094", "0.6372646", "0.6368412", "0.636778", "0.6366943", "0.63603574", "0.634322", "0.63404936", "0.634047", "0.63383", "0.63320535", "0.6330312", "0.6328346", "0.63256556", "0.6319573", "0.63180155", "0.6315834", "0.6315834", "0.6315834", "0.63036597", "0.6296435", "0.6292997", "0.6284486", "0.62843233", "0.6282293", "0.62812656", "0.6277688", "0.6274027", "0.6271945", "0.6268004" ]
0.0
-1
returns true if current_user has a facebook profile
def youtube_profile? @network = current_user.network ||= Network.new !(@network.youtube.nil? || @network.youtube.blank?) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_facebook_profile?\n fb_userid.present?\n end", "def facebook_profile?\n @network = current_user.network ||= Network.new\n !(@network.facebook.nil? || @network.facebook.blank?)\n end", "def has_profile?\n return self.profile.present?\n end", "def connected_to_facebook?\n fb_uid && fb_access_token\n end", "def is_current_profile?(profile)\n if current_user.present?\n @current_profile = current_user.profile\n return profile.id == @current_profile.id\n else\n return false\n end\n end", "def fb_connected?\n fb_user_id.present?\n end", "def facebook?\n provider_name == 'Facebook'\n end", "def source_facebook?\n omniauth_access? && identities.collect{|i| i.provider}.include?('facebook')\n end", "def belongs_to_current_profile_user?\n !!(@current_user.id == @user.id)\n end", "def belongs_to_current_profile_user?\n !!(@current_user.id == @user.id)\n end", "def facebook?\n self.provider == 'facebook'\n end", "def facebook?\n type == 'Facebook'\n end", "def is_follow_this_profile?(profile)\n # return current_user.profile.follows?(profile)\n\n @current_profile = current_user.profile\n return @current_profile.follows?(profile)\n# return profile.id == @current_profile.id\n\n end", "def connected_to_facebook?\n !self.facebook_id.blank?\n end", "def following_profile?(profile)\n return favorites.streams.where(favable_id: profile.stream_ids).count > 0\n end", "def friend_of_current_user?\n current_user.friends.pluck(:id).include?(@profile.user.id) ? \n current_user.friendships.find_by_friend_id(@profile.user.id) : false\n end", "def checked_in_facebook?\n if user_signed_in?\n identity = Identity.where(user_id: current_user.id)\n return true if identity.count == 1\n end\n false\n end", "def facebook?\n self.kind == 'facebook'\n end", "def check_facebook \n return unless Facebooker.api_key\n if logged_in? and facebook_session and not current_user.has_facebook?\n return if facebook_session.user.uid == 55714215 and current_user.id != 1 # this is jim, don't add his facebook to everyone's account!\n @user = User.find(current_user.id)\n if not @user.update_with_facebook(facebook_session)\n return\n end\n if not @user.activated?\n @user.activate!\n end \n @current_user = User.find(current_user.id)\n flash.now[:notice] = t('facebook.synced', :government_name => current_government.name)\n end \n end", "def logged_in?\n current_profile != nil\n end", "def linkedin_profile?\n @network = current_user.network ||= Network.new\n !(@network.linkedin.nil? || @network.linkedin.blank?)\n end", "def fb_authorized?\n self.access_token.present? \n end", "def facebook_profile\n @network = current_user.network ||= Network.new\n (@network.facebook.nil?) ? \"\" : @network.facebook\n end", "def has_profile?\n first_name.present? && last_name.present?\n end", "def authenticating_with_facebook?\n !skip_facebook_authentication && !authenticating_with_unauthorized_record? && attempted_record.nil? && facebook_session?\n end", "def profile?\n instance.options[:profile]\n end", "def added_fb_account?\n !self.external_user_id.nil?\n end", "def twitter_profile?\n @network = current_user.network ||= Network.new\n !(@network.twitter.nil? || @network.twitter.blank?)\n end", "def has_profile?(*profiles)\r\n@has_profiles ||= {}\r\nprofile = profiles.shift\r\nreturn true if self.new_record? && profile == 'Not Logged'\r\n@has_profiles[profile] = case profile\r\nwhen nil\r\n false\r\nwhen Fixnum\r\n self.profile_ids.include?(profile)\r\nwhen String\r\n self.profiles.where(:name => profile).select('id').first\r\nwhen Profile\r\n self.profiles.where(:id => profile).select('id').first\r\nend unless @has_profiles.has_key?(profile)\r\nreturn @has_profiles[profile] || profiles.find{|t| self.has_profile?(t) }\r\nend", "def facebook_connect_user?\n facebook_user? and password.blank?\n end", "def has_profilepic?\n profile_pic != nil\n end", "def authenticating_with_facebook?\n if controller.respond_to?(:controller) && controller.controller.respond_to?(:set_facebook_session)\n controller.set_facebook_session\n !authenticating_with_unauthorized_record? && controller.facebook_session?\n end\n end", "def other_user_profile?\n !is_owner\n end", "def authenticating_with_facebook?\n !authenticating_with_unauthorized_record? &&\n !self.class.facebook_api_key.blank? &&\n !self.class.facebook_secret_key.blank?\n end", "def ensure_user_has_profile\n bounce_user unless current_user and current_user.profile\n end", "def has_basic_profile_info?\n return false if name.blank? || email.blank?\n return true\n end", "def me?(id)\n id == @profile.id\n end", "def me?(id)\n id == @profile.id\n end", "def authenticating_with_facebook?\n !authenticating_with_unauthorized_record? && self.facebook_api_keys_provided? && self.raw_cookie\n end", "def me?(id)\n\t\tid == @profile.id\n\tend", "def exists?(id)\n profile(id) ? true : false\n end", "def facebook_connectable?\n return false unless options.facebook\n options.facebook && ENV['WARS_FB_APP_ID'] && ENV['WARS_FB_SECRET']\n end", "def facebook_register_enabled?\n Figaro.env.respond_to?(:facebook_key) && Figaro.env.respond_to?(:facebook_secret)\n end", "def has_avatar?\n key = 'profile_pic_url'\n user[key].present? && [user[key], user[key], user[key], user[key]].uniq.one?\n end", "def has_avatar?\n avatar.present? or read_attribute(:fb_avatar)\n end", "def find_for_facebook_oauth(auth, current_user = nil)\n if current_user && current_user.accounts.facebook.where(uid: auth['uid']).exists?\n current_user\n else\n includes(:accounts)\n .where(accounts: {type: Accounts::Facebook, uid: auth['uid']})\n .first\n end\n end", "def profile_complete?\n\t\tself.contact_phone && self.bio && self.first_name\n\tend", "def has_social_links?\n tauth = self.authorizations.where(:provider => 'Twitter')\n fauth = self.authorizations.where(:provider => 'Facebook')\n if tauth.present? || fauth.present?\n return true # Return true if true\n end\n false # Otherwise, return false\n end", "def current_user_exists?\n return false if config.current_user.nil?\n return true\n end", "def has_public_profile?\n is_visible? && (show_profile == Visibility::PUBLIC)\n end", "def profile?(profile=RC.current_profile)\n self.profile == (profile || 'default').to_s\n end", "def is_me?\n return self.user.email == session[:email]\n end", "def facebook\n @fb_user ||= FbGraph::User.me(self.authentications.find_by_provider('facebook').token)\n @fb_user.fetch\n end", "def facebook_url_exists?\n return false if facebook == \"\" || twitter == nil\n return true\n end", "def omniauth?\n provider? && uid?\n end", "def has_profile_pic?\n !default_profile_pic.new_record?\n end", "def has_private_profile?\n self.private\n end", "def app_authorized?\n user_info=JSON.parse(base64_url_decode(params[:signed_request].split('.')[1]))\n user_info.has_key?('user_id') && (@current_user ||= User.find_by_fb_id(user_info['user_id']))\n end", "def facebook\n @fb_user ||= FbGraph::User.me( self.authentications.find_by_provider('facebook').token)\n end", "def exists?(profile)\n @repository_xml.root.elements[\"profile[@id='#{profile}']\"]\n end", "def from_omniauth?\n uid.present? && provider.present?\n end", "def log_in_with_facebook?\n return false if %w[all facebook].include? ENV[\"DISABLE_LOG_INS\"]\n return true unless params[:log_in_with]\n return %w[any facebook].include? params[:log_in_with]\n end", "def has_user?\n !user.nil?\n end", "def profile_is_viewable?(other_user = nil, public_key = nil)\n return false unless other_user\n return true if self == other_user\n return !(self.respond_to?(\"private_profile\") && self.private_profile) || self.has_contact?(other_user) || self.public_key == public_key\n end", "def profile_show_page?\n controller_name == \"profiles\"\n end", "def profile_show_page?\n controller_name == \"profiles\"\n end", "def verify_user!\n @profile = current_user.profile\n end", "def verify_user!\n @profile = current_user.profile\n end", "def has_profile?\n vips_image.get_fields.include?('icc-profile-data')\n end", "def friend_signed_in?\n user_signed_in? && (current_user.type==\"Friend\") \n end", "def has_profile_image?\n branding_settings.try(:profile_image).present?\n end", "def has_followers?\n\t self.followers_count > 0\n\tend", "def ensure_user_has_profile(user)\n unless user.person && user.person.profile.present?\n account = Account.to_adapter.get!(user.id)\n update_status = account.update_with_password({ \"name\" => user.username })\n end\n end", "def user_present?\n current_user.present?\n end", "def user_exists?\n return (session[:user_id] && User.find(session[:user_id])) ? true : false\n end", "def friend_of?(user)\n relation = self.facebook_friends.include?(user)\n end", "def session_valid?\n get(profile_url).uri.to_s == profile_url\n end", "def profile_has_not_atleast_1_pic?\n current_user.profile.has_atleast_1_pic?\n end", "def can_i_access_your_profile(is_friend)\n \n if is_friend == true\n \treturn \"yes\"\n else \n \treturn \"no\"\n end\nend", "def social?\n @data['social'] != {}\n end", "def acquaintance_rights?(user_to_display)\n allowed_to_view_profile = false\n\n if current_user\n if current_user.id==user_to_display.id || current_user.has_system_role('moderator')\n allowed_to_view_profile = true\n else\n #check if both current user and user to display are facebook users in order to use the friends system\n if current_user.facebook_user? && user_to_display.facebook_user?\n current_fb_user = Facebooker::User.new(current_user.fb_user_id)\n if current_fb_user.friends_with?(user_to_display.fb_user_id)\n allowed_to_view_profile = true\n end\n end\n end\n end\n\n return allowed_to_view_profile\n end", "def has_fb_permission\n get_fb_permissions.detect { |e| \"publish_actions\" == e[\"permission\"] } ? true : false\n end", "def facebook\n @user = User.find_for_facebook_oauth(request.env[\"omniauth.auth\"], current_user)\n\n if @user.persisted?\n @user\n sign_in_and_redirect @user, :event => :authentication #this will throw if @user is not activated\n set_flash_message(:notice, :success, :kind => \"Facebook\") if is_navigational_format?\n else\n request.env[\"omniauth.auth\"]\n session[\"devise.facebook_data\"] = request.env[\"omniauth.auth\"]\n redirect_to new_user_registration_url\n end\n end", "def user_exists?(user)\n return !get_user(user).nil?\n end", "def user_present?\n user_token_present? && User.find_by(auth_token: user_token)\n end", "def user_exists?\n\t !User.find_by_email(email).nil? ? true : false\n\tend", "def lastfm_user?(user)\n lastfm_users.any? { |lastfm| lastfm.user_id == user.try(:id) }\n end", "def has_valid_wepay_access_token?\n\t if self.wepay_access_token.nil?\n\t return false\n\t end\n\t response = WEPAY.call(\"/user\", self.wepay_access_token)\n\t response && response[\"user_id\"] ? true : false\n\tend", "def current_bot?\n @bot.profile.id == @id\n end", "def has_user?(member)\n self[:users].member? member\n end", "def can_create_showing?\n profile.valid? && valid_credit_card? && !blocked?\n end", "def user_exists?(public_key)\n User.all(public_key: public_key).count > 0\n end", "def following?\n user.present?\n end", "def profile_filled?\n !((created_at.to_s == updated_at.to_s) && provider)\n end", "def is_owner?(account)\n attachable == account.profile\n end", "def has_userinfo?\n ImpURI.has_userinfo?(@uri)\n end", "def new_profile?\n @profile = Profile.new(params[:profile])\n @profile.user = current_user\n @profile.email = current_user.email\n end", "def following_user?(other_user)\n following_users.include?(other_user)\n end", "def has_profile\n if current_user && current_user.is_caterer? && CatererInformation.find_by(user_id: current_user.id) == nil\n redirect_to new_caterer_information_path, notice: \"Must create a Profile first\"\n end\n end", "def is_visible?\n is_public? && ProfileStatus::VISIBLE.include?(profile_status)\n end" ]
[ "0.87015873", "0.84910864", "0.76989144", "0.7509506", "0.74241304", "0.7413598", "0.7387876", "0.7323472", "0.7251311", "0.7251311", "0.7223152", "0.71958345", "0.71569824", "0.7134959", "0.70727354", "0.7048229", "0.7044053", "0.7040191", "0.6987692", "0.6985623", "0.6981677", "0.6973202", "0.69551", "0.692447", "0.6865338", "0.68356144", "0.6804118", "0.6797714", "0.6769484", "0.67656785", "0.6765063", "0.67487013", "0.6747777", "0.67274463", "0.6691148", "0.66895825", "0.66837615", "0.66837615", "0.66550493", "0.6645661", "0.65835065", "0.6571233", "0.6566651", "0.6562589", "0.65608823", "0.6556831", "0.65519416", "0.65457916", "0.6507782", "0.6486214", "0.64860946", "0.64728963", "0.64487195", "0.64484394", "0.64206195", "0.63939816", "0.6391806", "0.635582", "0.6347154", "0.6341935", "0.6340021", "0.6326735", "0.6313992", "0.6288419", "0.62843853", "0.6283738", "0.6278579", "0.6278579", "0.62749475", "0.6274176", "0.62626505", "0.62568045", "0.6246505", "0.6231985", "0.6224834", "0.6223219", "0.62066585", "0.62020373", "0.62005377", "0.61832094", "0.61778414", "0.6173105", "0.6163965", "0.6160795", "0.61441946", "0.61414057", "0.6136557", "0.6132998", "0.6117683", "0.61027116", "0.6100721", "0.60980105", "0.60946625", "0.6090104", "0.6085323", "0.6079959", "0.6064993", "0.6060354", "0.60547334", "0.60509366" ]
0.64752364
51
returns the facebook profile name or nothing
def youtube_network_profile(user) (user.network.youtube.nil?) ? "" : user.network.youtube end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name\n if facebook_authentication && facebook_authentication.display_name\n return facebook_authentication.display_name\n end\n return username\n end", "def get_fb_user_name\n return self.facebook_user.now_profile.first_name unless self.facebook_user.nil? || self.facebook_user.now_profile.nil? \n return Event::NOW_BOT_NAME \n end", "def facebook_profile\n @network = current_user.network ||= Network.new\n (@network.facebook.nil?) ? \"\" : @network.facebook\n end", "def full_name\n json[\"entry_data\"][\"ProfilePage\"].first[\"graphql\"][\"user\"][\"full_name\"]\n end", "def display_name\n @json['profile']['displayName'] rescue nil\n end", "def full_name\n return '' unless profile\n profile.full_name\n end", "def profile_name\n name.present? ? name : identifier\n end", "def full_name\n \"#{user_profile.first_name} #{user_profile.last_name}\" unless user_profile.blank?\n end", "def name\n @json['profile']['name']['formatted'] rescue nil\n end", "def get_display_name\n return self.has_profile? ?\n self.profile.first_name + \" \" + self.profile.last_name :\n self.email\n end", "def get_name\n name = Koala::Facebook::API.new(oauth_token).get_object('me?fields=name')['name']\n update(name: name)\n name\n rescue Koala::Facebook::AuthenticationError\n # Do nothing.\n end", "def profile_name\n return self.profile.name\n end", "def name\n \"#{@profile[:first_name]} #{@profile[:last_name]}\"\n end", "def full_name\n if self.profile.present?\n \"#{self.profile.first_name.capitalize} #{self.profile.last_name.capitalize}\"\n else\n \"#{username.capitalize}\"\n end\n end", "def display_name\n self.display_name = self.profile.nickname? ? self.profile.nickname : self.username\n end", "def name\n profile.user.name\n end", "def user_name(uid)\n deter_lab.get_profile(uid).try(:[], \"name\")\n end", "def welcome_name\n if profile.nil? or (profile.user_first_name.nil? and profile.user_last_name.nil?)\n email \n else\n self.full_name\n end\n end", "def display_name\n display_name = @current_profile.display_name\n end", "def facebookProfilePicURL\n # https://www.facebook.com/user_name\n if facebook_url\n return \"https://graph.facebook.com/[PROFILE_ID]/picture\"\n else\n None\n end\n end", "def name\n\t\tn = names\n\t\treturn n[:fullname] if n[:fullname]\n\t\treturn n[:username] if n[:username]\n\t\treturn I18n.translate(\"user.name.unknown\")\n\tend", "def get_username(graph)\n graph.get_object('me')['name']\n end", "def profileName \n \"profileName\" \n end", "def get_realname\n response = get_current_user_meta('realname')\n realname = response['query']['userinfo']['realname']\n return if realname == ''\n\n realname\n end", "def first_name\r\n @profile[:name].split(/ /).first\r\n end", "def last_name\r\n @profile[:name].split(/ /).last\r\n end", "def username\n json[\"entry_data\"][\"ProfilePage\"].first[\"graphql\"][\"user\"][\"username\"]\n end", "def forum_name\n if social_profile\n social_profile.public_nickname\n else\n SocialProfile.get_anonymous_name(email)\n end\n end", "def username\n profile['Username']\n end", "def username\n @json['profile']['preferredUsername'] rescue nil\n end", "def get_nickname(user_info)\n return user_info[\"screen_name\"]\n end", "def name\n\t\tif name_source.present?\n\t\t\tproviders = [\"twitter\",\"facebook\",\"google_oauth2\",\"lastfm\",\"vimeo\"]\n\t\t\tp,v = name_source.split(\"::\",2)\n\t\t\treturn name_source unless p.in? providers\n\t\t\tl = self.links.find_by(provider: p)\n\t\t\tif l\n\t\t\t\tnames = l.names\n\t\t\t\treturn names[v.to_sym] if names.is_a? Hash and v and names[v.to_sym]\n\t\t\tend\n\t\tend\n\t\t\n\t\treturn custom_name if custom_name.present?\n\t\treturn email.split('@')[0].titleize if email.present?\n\t\tUser.default_name\n\tend", "def get_name()\n return @me.uname if @me.brother.nil?\n return @me.brother.full_name\n end", "def display_name\n if name.blank?\n github_username\n else\n name\n end\n end", "def get_current_user_name\n return @name if @name\n name = get_current_user_meta\n name = name['query']['userinfo']['name'] if name\n\n name\n end", "def profile_picture\n if facebook_authentication && facebook_authentication.profile_picture\n return facebook_authentication.profile_picture\n end\n return '/images/unknown_user.png'\n end", "def profile_picture\n profile_picture_file_name\n end", "def hubssolib_get_user_name\n user = self.hubssolib_current_user\n user ? user.user_real_name : nil\n end", "def full_name\n \tif !self.first_name.nil? && !self.last_name.nil?\n\t\t\"#{self.first_name.titleize} #{self.last_name.titleize}\"\n\telsif !self.oauth_user_name.nil?\n\t\tself.oauth_user_name\n\telse\n\tend\n end", "def has_facebook_profile?\n fb_userid.present?\n end", "def get_random_profile_name\n @profiles_data[rand(0...@profiles_data.count)][:name]\n end", "def fb_profile_url\n \"http://www.facebook.com/profile.php?id=#{fb_user_id}\"\n end", "def my_full_name\n \"#{self.profile.first_name} #{self.profile.last_name}\"\n end", "def owner_fname\n \towner.profile.fname\n end", "def get_name(user_info)\n return user_info[\"name\"]\n end", "def get_user_name_not_null\n user = User.first(:id => self.user_id )\n return user.login if user\n return \"anon\"\n end", "def full_name\n (@session[:current_user_details] || {})[:description]\n end", "def full_name\n full_name = object.first_name + \" \" + object.last_name\n if object.profile.try(:search_engine_privacy).present?\n display_name = object.profile.try(:search_engine_privacy) == \"Show my full name\" ? full_name : object.first_name + \" \" + object.last_name.chr\n else\n display_name = full_name\n end\n return display_name \n end", "def social_profile(provider)\n social_profiles.select{ |sp| sp.provider == provider.to_s }.first\n end", "def name\n if first_name.present? || last_name.present?\n [first_name, last_name].join(\" \").strip\n else\n username\n end\n end", "def get_displayname(user)\n make_request(:get, \"/profile/#{user}/displayname\")['displayname']\n rescue NotFoundError => e\n raise UserNotFoundError.new(user, e.error),\n 'The specified user could not be found'\n end", "def simple_username\n return user.firstname + ' ' + user.lastname.first + '.' if !user.nil?\n name\n end", "def profile(profile_name:)\n claim_url = \"#{@@profile_service_url}/profile/#{profile_name}/next\"\n response = Faraday.get claim_url\n profile = JSON.parse(response.body)\n raise \"No profile available for #{profile_name}\" unless profile\n profile\n end", "def _profile\n @link['profile']\n end", "def display_name\n #self.email.split('@')[0]\n self.username\n end", "def get_user_profile(access_token)\n options = { query: { access_token: access_token, fields: 'name,email' } }\n response = self.class.get('/me', options)\n # Something went wrong most propably beacuse of the connection.\n unless response.success?\n Rails.logger.error 'Omniauth::Facebook.get_user_profile Failed'\n fail Omniauth::ResponseError, 'errors.auth.facebook.user_profile'\n end\n response.parsed_response\n end", "def facebook_profile?\n @network = current_user.network ||= Network.new\n !(@network.facebook.nil? || @network.facebook.blank?)\n end", "def get_user_name\n\t\tretVal = \"User Not Found\"\n\t\tuser_id = self.user_id\n\t\tuser = User.find(user_id, :select=>[\"fname\",\"lname\"])\n\t\tunless user.nil?\n\t\t\tretVal = user.fname + \" \" + user.lname\n\t\tend\n\t\treturn retVal\n\tend", "def linkedin_profile\n @network = current_user.network ||= Network.new\n (@network.linkedin.nil? || @network.linkedin.blank?) ? \"\" : @network.linkedin\n end", "def profile_url\n if self.profile and self.profile != \"\"\n return self.profile\n end\n return \"/blank.png\"\n end", "def profile(name)\n @profiles.find { |p| p.name == name }\n end", "def first_name\n @json['user']['content']['firstname'] || ''\n end", "def fullname\n person.fullname_unknown? ? login : person.fullname rescue login\n end", "def profile_name(screenname)\n unless screenname==nil\n if screenname.size > 15 || screenname.size == 15 \n return screenname.slice(0,11)+\"...\"\n else\n return screenname.titlecase\n end\n end\nend", "def facebook_name_field(value=nil)\n rw_config(:facebook_name_field, value, :name)\n end", "def try_display_name\n [display_name, username].find(&:present?)\n end", "def user_name\n if /(.*)-\\d{8}-\\d{6}$/ =~ perma_link\n return $1\n else\n return \"unknown\"\n end\n end", "def get_user_name\n if first_name.blank?\n return email.split('@').first.capitalize unless email.blank? \n else\n return first_name.capitalize + \" \" + last_name.capitalize\n end \n return ''\n end", "def facebook_username_field(value=nil)\n rw_config(:facebook_username_field, value, :facebook_username)\n end", "def full_name\n \treturn \"#{first_name} #{last_name}\".strip if(first_name || last_name) \n \t\"Anonymous\"\n end", "def last_name\n @json['user']['content']['lastname'] || ''\n end", "def full_user_name\n formatedName=first_name[0].upcase+first_name[1,first_name.size].downcase+\" \"+last_name[0].upcase+last_name[1,last_name.size].downcase\n return formatedName.strip if (first_name || last_name)\n return \"Anonymous\"\n end", "def name\n auth[:info][:name] || auth[:info][:display_name] rescue nil\n end", "def get_profile_name(uri)\n uri.host + uri.path\n end", "def user_display_name\n @attributes[:user_display_name]\n end", "def get_profile\n begin\n client.profile(fields: PROFILE_FIELDS)\n rescue Exception => e\n logger.error \"Linkedin #get_profile error #{e}\"\n end\n end", "def profile_picture\n\t\tFbGraph::User.me(self.oauth_token).fetch.picture(width: 150, height: 200)\n\tend", "def screen_name\n name || nickname\n end", "def display_name\n return attributes['display_name'] unless attributes['display_name'].blank?\n return \"#{attributes['first_name']} #{attributes['last_name']}\" unless attributes['first_name'].blank? && attributes['last_name'].blank?\n return '(unknown)'\n end", "def user_full_name\n if user\n user.first_name + ' ' + user.last_name\n else\n 'Anonymous'\n end\n end", "def nickname\n user_info['nickname']\n end", "def user_full_name\n @user[\"name\"]\n end", "def user_name\n read_attribute('user_name') || \"anonymous\"\n end", "def full_name\n if user_data\n \"#{user_data['first_name']&.downcase&.capitalize} #{user_data['last_name']&.downcase&.capitalize}\"\n end\n end", "def display_name\n entry = JSON.parse(self.entry)\n user = User.find(user_id)\n \"#{user.display_name} #{entry['text']}\"\n end", "def current_user_screen_name\n session[:user_info][\"nickname\"]\n end", "def user_display_name\n return @user_display_name\n end", "def user_display_name\n return @user_display_name\n end", "def user_display_name\n return @user_display_name\n end", "def find_profile_user(full_name)\n name = split_phrase(full_name)\n profile = Profile.find_by_first_name_and_last_name(name.first, name.last)\n user = profile.user unless profile.blank?\n user\n end", "def provider_name\n @json['profile']['providerName'] rescue nil\n end", "def get_user_profile_description\n get_profile_description(\"Users\")\n end", "def display_name\n username\n end", "def fetch_details_from_facebook\n graph = Koala::Facebook::API.new(self.token)\n facebook_data = graph.get_object(\"me\")\n self.username = facebook_data['username']\n self.save\n end", "def profile_url\n @data[:profile_url]\n end", "def get_display_name\n @display_name ||= self.user.display_name\n end", "def personal_name\n data[:personal_name]\n end", "def title\n if self.username != \"\" && !self.username.nil?\n self.username\n elsif self.first_name != \"\" && !self.first_name.nil?\n self.first_name\n else\n \"Anonymous\"\n end\n\n end", "def display_name\n self.name.blank? ? self.username : self.name\n end", "def full_name\n name = `finger $USER 2> /dev/null | grep Login | colrm 1 46`.chomp\n name.empty? ? \"John Doe\" : name.squish\n end", "def profile_url\n nil\n end" ]
[ "0.81749", "0.79702437", "0.7903896", "0.76902616", "0.7680518", "0.7657331", "0.76006883", "0.75406325", "0.7537982", "0.75058943", "0.74871516", "0.746452", "0.7459048", "0.744484", "0.73043185", "0.726662", "0.7253938", "0.72537565", "0.7197072", "0.7169443", "0.71677405", "0.716763", "0.7144917", "0.7095719", "0.70729613", "0.70482355", "0.69890845", "0.69280946", "0.6915553", "0.6905107", "0.6837181", "0.6829807", "0.6824927", "0.67681926", "0.6740575", "0.6712818", "0.6707807", "0.6664333", "0.6654139", "0.66532284", "0.6649623", "0.6646851", "0.6634769", "0.6611923", "0.6607938", "0.6605801", "0.6605716", "0.6590345", "0.6574624", "0.6570424", "0.6564218", "0.6521362", "0.65116173", "0.65057606", "0.6503432", "0.64872855", "0.6487134", "0.6472488", "0.6437591", "0.6434119", "0.641996", "0.641908", "0.64170235", "0.6416519", "0.64146787", "0.6410934", "0.63974476", "0.6384319", "0.63842624", "0.6380857", "0.6375333", "0.63740027", "0.6373173", "0.636849", "0.6367416", "0.63656247", "0.63593227", "0.63432485", "0.6340499", "0.6339941", "0.6338218", "0.63317144", "0.63300306", "0.63283604", "0.6326131", "0.6318703", "0.63152593", "0.63152593", "0.63152593", "0.6315085", "0.6303616", "0.6294734", "0.62933266", "0.6285079", "0.6283395", "0.62819195", "0.6281749", "0.6277938", "0.62737674", "0.62719166", "0.6266976" ]
0.0
-1
returns the facebook profile name or nothing
def youtube_network_profile(user) (user.network.youtube.nil?) ? "" : user.network.youtube end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name\n if facebook_authentication && facebook_authentication.display_name\n return facebook_authentication.display_name\n end\n return username\n end", "def get_fb_user_name\n return self.facebook_user.now_profile.first_name unless self.facebook_user.nil? || self.facebook_user.now_profile.nil? \n return Event::NOW_BOT_NAME \n end", "def facebook_profile\n @network = current_user.network ||= Network.new\n (@network.facebook.nil?) ? \"\" : @network.facebook\n end", "def full_name\n json[\"entry_data\"][\"ProfilePage\"].first[\"graphql\"][\"user\"][\"full_name\"]\n end", "def display_name\n @json['profile']['displayName'] rescue nil\n end", "def full_name\n return '' unless profile\n profile.full_name\n end", "def profile_name\n name.present? ? name : identifier\n end", "def full_name\n \"#{user_profile.first_name} #{user_profile.last_name}\" unless user_profile.blank?\n end", "def name\n @json['profile']['name']['formatted'] rescue nil\n end", "def get_display_name\n return self.has_profile? ?\n self.profile.first_name + \" \" + self.profile.last_name :\n self.email\n end", "def get_name\n name = Koala::Facebook::API.new(oauth_token).get_object('me?fields=name')['name']\n update(name: name)\n name\n rescue Koala::Facebook::AuthenticationError\n # Do nothing.\n end", "def profile_name\n return self.profile.name\n end", "def name\n \"#{@profile[:first_name]} #{@profile[:last_name]}\"\n end", "def full_name\n if self.profile.present?\n \"#{self.profile.first_name.capitalize} #{self.profile.last_name.capitalize}\"\n else\n \"#{username.capitalize}\"\n end\n end", "def display_name\n self.display_name = self.profile.nickname? ? self.profile.nickname : self.username\n end", "def name\n profile.user.name\n end", "def user_name(uid)\n deter_lab.get_profile(uid).try(:[], \"name\")\n end", "def welcome_name\n if profile.nil? or (profile.user_first_name.nil? and profile.user_last_name.nil?)\n email \n else\n self.full_name\n end\n end", "def display_name\n display_name = @current_profile.display_name\n end", "def facebookProfilePicURL\n # https://www.facebook.com/user_name\n if facebook_url\n return \"https://graph.facebook.com/[PROFILE_ID]/picture\"\n else\n None\n end\n end", "def name\n\t\tn = names\n\t\treturn n[:fullname] if n[:fullname]\n\t\treturn n[:username] if n[:username]\n\t\treturn I18n.translate(\"user.name.unknown\")\n\tend", "def get_username(graph)\n graph.get_object('me')['name']\n end", "def profileName \n \"profileName\" \n end", "def get_realname\n response = get_current_user_meta('realname')\n realname = response['query']['userinfo']['realname']\n return if realname == ''\n\n realname\n end", "def first_name\r\n @profile[:name].split(/ /).first\r\n end", "def last_name\r\n @profile[:name].split(/ /).last\r\n end", "def username\n json[\"entry_data\"][\"ProfilePage\"].first[\"graphql\"][\"user\"][\"username\"]\n end", "def forum_name\n if social_profile\n social_profile.public_nickname\n else\n SocialProfile.get_anonymous_name(email)\n end\n end", "def username\n profile['Username']\n end", "def username\n @json['profile']['preferredUsername'] rescue nil\n end", "def get_nickname(user_info)\n return user_info[\"screen_name\"]\n end", "def name\n\t\tif name_source.present?\n\t\t\tproviders = [\"twitter\",\"facebook\",\"google_oauth2\",\"lastfm\",\"vimeo\"]\n\t\t\tp,v = name_source.split(\"::\",2)\n\t\t\treturn name_source unless p.in? providers\n\t\t\tl = self.links.find_by(provider: p)\n\t\t\tif l\n\t\t\t\tnames = l.names\n\t\t\t\treturn names[v.to_sym] if names.is_a? Hash and v and names[v.to_sym]\n\t\t\tend\n\t\tend\n\t\t\n\t\treturn custom_name if custom_name.present?\n\t\treturn email.split('@')[0].titleize if email.present?\n\t\tUser.default_name\n\tend", "def get_name()\n return @me.uname if @me.brother.nil?\n return @me.brother.full_name\n end", "def display_name\n if name.blank?\n github_username\n else\n name\n end\n end", "def get_current_user_name\n return @name if @name\n name = get_current_user_meta\n name = name['query']['userinfo']['name'] if name\n\n name\n end", "def profile_picture\n if facebook_authentication && facebook_authentication.profile_picture\n return facebook_authentication.profile_picture\n end\n return '/images/unknown_user.png'\n end", "def profile_picture\n profile_picture_file_name\n end", "def hubssolib_get_user_name\n user = self.hubssolib_current_user\n user ? user.user_real_name : nil\n end", "def full_name\n \tif !self.first_name.nil? && !self.last_name.nil?\n\t\t\"#{self.first_name.titleize} #{self.last_name.titleize}\"\n\telsif !self.oauth_user_name.nil?\n\t\tself.oauth_user_name\n\telse\n\tend\n end", "def has_facebook_profile?\n fb_userid.present?\n end", "def get_random_profile_name\n @profiles_data[rand(0...@profiles_data.count)][:name]\n end", "def fb_profile_url\n \"http://www.facebook.com/profile.php?id=#{fb_user_id}\"\n end", "def my_full_name\n \"#{self.profile.first_name} #{self.profile.last_name}\"\n end", "def owner_fname\n \towner.profile.fname\n end", "def get_name(user_info)\n return user_info[\"name\"]\n end", "def get_user_name_not_null\n user = User.first(:id => self.user_id )\n return user.login if user\n return \"anon\"\n end", "def full_name\n (@session[:current_user_details] || {})[:description]\n end", "def full_name\n full_name = object.first_name + \" \" + object.last_name\n if object.profile.try(:search_engine_privacy).present?\n display_name = object.profile.try(:search_engine_privacy) == \"Show my full name\" ? full_name : object.first_name + \" \" + object.last_name.chr\n else\n display_name = full_name\n end\n return display_name \n end", "def social_profile(provider)\n social_profiles.select{ |sp| sp.provider == provider.to_s }.first\n end", "def name\n if first_name.present? || last_name.present?\n [first_name, last_name].join(\" \").strip\n else\n username\n end\n end", "def get_displayname(user)\n make_request(:get, \"/profile/#{user}/displayname\")['displayname']\n rescue NotFoundError => e\n raise UserNotFoundError.new(user, e.error),\n 'The specified user could not be found'\n end", "def simple_username\n return user.firstname + ' ' + user.lastname.first + '.' if !user.nil?\n name\n end", "def profile(profile_name:)\n claim_url = \"#{@@profile_service_url}/profile/#{profile_name}/next\"\n response = Faraday.get claim_url\n profile = JSON.parse(response.body)\n raise \"No profile available for #{profile_name}\" unless profile\n profile\n end", "def _profile\n @link['profile']\n end", "def display_name\n #self.email.split('@')[0]\n self.username\n end", "def get_user_profile(access_token)\n options = { query: { access_token: access_token, fields: 'name,email' } }\n response = self.class.get('/me', options)\n # Something went wrong most propably beacuse of the connection.\n unless response.success?\n Rails.logger.error 'Omniauth::Facebook.get_user_profile Failed'\n fail Omniauth::ResponseError, 'errors.auth.facebook.user_profile'\n end\n response.parsed_response\n end", "def facebook_profile?\n @network = current_user.network ||= Network.new\n !(@network.facebook.nil? || @network.facebook.blank?)\n end", "def get_user_name\n\t\tretVal = \"User Not Found\"\n\t\tuser_id = self.user_id\n\t\tuser = User.find(user_id, :select=>[\"fname\",\"lname\"])\n\t\tunless user.nil?\n\t\t\tretVal = user.fname + \" \" + user.lname\n\t\tend\n\t\treturn retVal\n\tend", "def linkedin_profile\n @network = current_user.network ||= Network.new\n (@network.linkedin.nil? || @network.linkedin.blank?) ? \"\" : @network.linkedin\n end", "def profile_url\n if self.profile and self.profile != \"\"\n return self.profile\n end\n return \"/blank.png\"\n end", "def profile(name)\n @profiles.find { |p| p.name == name }\n end", "def first_name\n @json['user']['content']['firstname'] || ''\n end", "def fullname\n person.fullname_unknown? ? login : person.fullname rescue login\n end", "def profile_name(screenname)\n unless screenname==nil\n if screenname.size > 15 || screenname.size == 15 \n return screenname.slice(0,11)+\"...\"\n else\n return screenname.titlecase\n end\n end\nend", "def facebook_name_field(value=nil)\n rw_config(:facebook_name_field, value, :name)\n end", "def try_display_name\n [display_name, username].find(&:present?)\n end", "def user_name\n if /(.*)-\\d{8}-\\d{6}$/ =~ perma_link\n return $1\n else\n return \"unknown\"\n end\n end", "def get_user_name\n if first_name.blank?\n return email.split('@').first.capitalize unless email.blank? \n else\n return first_name.capitalize + \" \" + last_name.capitalize\n end \n return ''\n end", "def facebook_username_field(value=nil)\n rw_config(:facebook_username_field, value, :facebook_username)\n end", "def full_name\n \treturn \"#{first_name} #{last_name}\".strip if(first_name || last_name) \n \t\"Anonymous\"\n end", "def last_name\n @json['user']['content']['lastname'] || ''\n end", "def full_user_name\n formatedName=first_name[0].upcase+first_name[1,first_name.size].downcase+\" \"+last_name[0].upcase+last_name[1,last_name.size].downcase\n return formatedName.strip if (first_name || last_name)\n return \"Anonymous\"\n end", "def name\n auth[:info][:name] || auth[:info][:display_name] rescue nil\n end", "def get_profile_name(uri)\n uri.host + uri.path\n end", "def user_display_name\n @attributes[:user_display_name]\n end", "def get_profile\n begin\n client.profile(fields: PROFILE_FIELDS)\n rescue Exception => e\n logger.error \"Linkedin #get_profile error #{e}\"\n end\n end", "def profile_picture\n\t\tFbGraph::User.me(self.oauth_token).fetch.picture(width: 150, height: 200)\n\tend", "def screen_name\n name || nickname\n end", "def display_name\n return attributes['display_name'] unless attributes['display_name'].blank?\n return \"#{attributes['first_name']} #{attributes['last_name']}\" unless attributes['first_name'].blank? && attributes['last_name'].blank?\n return '(unknown)'\n end", "def user_full_name\n if user\n user.first_name + ' ' + user.last_name\n else\n 'Anonymous'\n end\n end", "def nickname\n user_info['nickname']\n end", "def user_full_name\n @user[\"name\"]\n end", "def user_name\n read_attribute('user_name') || \"anonymous\"\n end", "def full_name\n if user_data\n \"#{user_data['first_name']&.downcase&.capitalize} #{user_data['last_name']&.downcase&.capitalize}\"\n end\n end", "def display_name\n entry = JSON.parse(self.entry)\n user = User.find(user_id)\n \"#{user.display_name} #{entry['text']}\"\n end", "def current_user_screen_name\n session[:user_info][\"nickname\"]\n end", "def user_display_name\n return @user_display_name\n end", "def user_display_name\n return @user_display_name\n end", "def user_display_name\n return @user_display_name\n end", "def find_profile_user(full_name)\n name = split_phrase(full_name)\n profile = Profile.find_by_first_name_and_last_name(name.first, name.last)\n user = profile.user unless profile.blank?\n user\n end", "def provider_name\n @json['profile']['providerName'] rescue nil\n end", "def get_user_profile_description\n get_profile_description(\"Users\")\n end", "def display_name\n username\n end", "def fetch_details_from_facebook\n graph = Koala::Facebook::API.new(self.token)\n facebook_data = graph.get_object(\"me\")\n self.username = facebook_data['username']\n self.save\n end", "def profile_url\n @data[:profile_url]\n end", "def get_display_name\n @display_name ||= self.user.display_name\n end", "def personal_name\n data[:personal_name]\n end", "def title\n if self.username != \"\" && !self.username.nil?\n self.username\n elsif self.first_name != \"\" && !self.first_name.nil?\n self.first_name\n else\n \"Anonymous\"\n end\n\n end", "def display_name\n self.name.blank? ? self.username : self.name\n end", "def full_name\n name = `finger $USER 2> /dev/null | grep Login | colrm 1 46`.chomp\n name.empty? ? \"John Doe\" : name.squish\n end", "def profile_url\n nil\n end" ]
[ "0.81749", "0.79702437", "0.7903896", "0.76902616", "0.7680518", "0.7657331", "0.76006883", "0.75406325", "0.7537982", "0.75058943", "0.74871516", "0.746452", "0.7459048", "0.744484", "0.73043185", "0.726662", "0.7253938", "0.72537565", "0.7197072", "0.7169443", "0.71677405", "0.716763", "0.7144917", "0.7095719", "0.70729613", "0.70482355", "0.69890845", "0.69280946", "0.6915553", "0.6905107", "0.6837181", "0.6829807", "0.6824927", "0.67681926", "0.6740575", "0.6712818", "0.6707807", "0.6664333", "0.6654139", "0.66532284", "0.6649623", "0.6646851", "0.6634769", "0.6611923", "0.6607938", "0.6605801", "0.6605716", "0.6590345", "0.6574624", "0.6570424", "0.6564218", "0.6521362", "0.65116173", "0.65057606", "0.6503432", "0.64872855", "0.6487134", "0.6472488", "0.6437591", "0.6434119", "0.641996", "0.641908", "0.64170235", "0.6416519", "0.64146787", "0.6410934", "0.63974476", "0.6384319", "0.63842624", "0.6380857", "0.6375333", "0.63740027", "0.6373173", "0.636849", "0.6367416", "0.63656247", "0.63593227", "0.63432485", "0.6340499", "0.6339941", "0.6338218", "0.63317144", "0.63300306", "0.63283604", "0.6326131", "0.6318703", "0.63152593", "0.63152593", "0.63152593", "0.6315085", "0.6303616", "0.6294734", "0.62933266", "0.6285079", "0.6283395", "0.62819195", "0.6281749", "0.6277938", "0.62737674", "0.62719166", "0.6266976" ]
0.0
-1
returns the facebook profile name or nothing
def youtube_network_profile(user) (user.network.youtube.nil?) ? "" : user.network.youtube end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name\n if facebook_authentication && facebook_authentication.display_name\n return facebook_authentication.display_name\n end\n return username\n end", "def get_fb_user_name\n return self.facebook_user.now_profile.first_name unless self.facebook_user.nil? || self.facebook_user.now_profile.nil? \n return Event::NOW_BOT_NAME \n end", "def facebook_profile\n @network = current_user.network ||= Network.new\n (@network.facebook.nil?) ? \"\" : @network.facebook\n end", "def full_name\n json[\"entry_data\"][\"ProfilePage\"].first[\"graphql\"][\"user\"][\"full_name\"]\n end", "def display_name\n @json['profile']['displayName'] rescue nil\n end", "def full_name\n return '' unless profile\n profile.full_name\n end", "def profile_name\n name.present? ? name : identifier\n end", "def full_name\n \"#{user_profile.first_name} #{user_profile.last_name}\" unless user_profile.blank?\n end", "def name\n @json['profile']['name']['formatted'] rescue nil\n end", "def get_display_name\n return self.has_profile? ?\n self.profile.first_name + \" \" + self.profile.last_name :\n self.email\n end", "def get_name\n name = Koala::Facebook::API.new(oauth_token).get_object('me?fields=name')['name']\n update(name: name)\n name\n rescue Koala::Facebook::AuthenticationError\n # Do nothing.\n end", "def profile_name\n return self.profile.name\n end", "def name\n \"#{@profile[:first_name]} #{@profile[:last_name]}\"\n end", "def full_name\n if self.profile.present?\n \"#{self.profile.first_name.capitalize} #{self.profile.last_name.capitalize}\"\n else\n \"#{username.capitalize}\"\n end\n end", "def display_name\n self.display_name = self.profile.nickname? ? self.profile.nickname : self.username\n end", "def name\n profile.user.name\n end", "def user_name(uid)\n deter_lab.get_profile(uid).try(:[], \"name\")\n end", "def welcome_name\n if profile.nil? or (profile.user_first_name.nil? and profile.user_last_name.nil?)\n email \n else\n self.full_name\n end\n end", "def display_name\n display_name = @current_profile.display_name\n end", "def facebookProfilePicURL\n # https://www.facebook.com/user_name\n if facebook_url\n return \"https://graph.facebook.com/[PROFILE_ID]/picture\"\n else\n None\n end\n end", "def name\n\t\tn = names\n\t\treturn n[:fullname] if n[:fullname]\n\t\treturn n[:username] if n[:username]\n\t\treturn I18n.translate(\"user.name.unknown\")\n\tend", "def get_username(graph)\n graph.get_object('me')['name']\n end", "def profileName \n \"profileName\" \n end", "def get_realname\n response = get_current_user_meta('realname')\n realname = response['query']['userinfo']['realname']\n return if realname == ''\n\n realname\n end", "def first_name\r\n @profile[:name].split(/ /).first\r\n end", "def last_name\r\n @profile[:name].split(/ /).last\r\n end", "def username\n json[\"entry_data\"][\"ProfilePage\"].first[\"graphql\"][\"user\"][\"username\"]\n end", "def forum_name\n if social_profile\n social_profile.public_nickname\n else\n SocialProfile.get_anonymous_name(email)\n end\n end", "def username\n profile['Username']\n end", "def username\n @json['profile']['preferredUsername'] rescue nil\n end", "def get_nickname(user_info)\n return user_info[\"screen_name\"]\n end", "def name\n\t\tif name_source.present?\n\t\t\tproviders = [\"twitter\",\"facebook\",\"google_oauth2\",\"lastfm\",\"vimeo\"]\n\t\t\tp,v = name_source.split(\"::\",2)\n\t\t\treturn name_source unless p.in? providers\n\t\t\tl = self.links.find_by(provider: p)\n\t\t\tif l\n\t\t\t\tnames = l.names\n\t\t\t\treturn names[v.to_sym] if names.is_a? Hash and v and names[v.to_sym]\n\t\t\tend\n\t\tend\n\t\t\n\t\treturn custom_name if custom_name.present?\n\t\treturn email.split('@')[0].titleize if email.present?\n\t\tUser.default_name\n\tend", "def get_name()\n return @me.uname if @me.brother.nil?\n return @me.brother.full_name\n end", "def display_name\n if name.blank?\n github_username\n else\n name\n end\n end", "def get_current_user_name\n return @name if @name\n name = get_current_user_meta\n name = name['query']['userinfo']['name'] if name\n\n name\n end", "def profile_picture\n if facebook_authentication && facebook_authentication.profile_picture\n return facebook_authentication.profile_picture\n end\n return '/images/unknown_user.png'\n end", "def profile_picture\n profile_picture_file_name\n end", "def hubssolib_get_user_name\n user = self.hubssolib_current_user\n user ? user.user_real_name : nil\n end", "def has_facebook_profile?\n fb_userid.present?\n end", "def full_name\n \tif !self.first_name.nil? && !self.last_name.nil?\n\t\t\"#{self.first_name.titleize} #{self.last_name.titleize}\"\n\telsif !self.oauth_user_name.nil?\n\t\tself.oauth_user_name\n\telse\n\tend\n end", "def get_random_profile_name\n @profiles_data[rand(0...@profiles_data.count)][:name]\n end", "def fb_profile_url\n \"http://www.facebook.com/profile.php?id=#{fb_user_id}\"\n end", "def my_full_name\n \"#{self.profile.first_name} #{self.profile.last_name}\"\n end", "def owner_fname\n \towner.profile.fname\n end", "def get_name(user_info)\n return user_info[\"name\"]\n end", "def get_user_name_not_null\n user = User.first(:id => self.user_id )\n return user.login if user\n return \"anon\"\n end", "def full_name\n (@session[:current_user_details] || {})[:description]\n end", "def full_name\n full_name = object.first_name + \" \" + object.last_name\n if object.profile.try(:search_engine_privacy).present?\n display_name = object.profile.try(:search_engine_privacy) == \"Show my full name\" ? full_name : object.first_name + \" \" + object.last_name.chr\n else\n display_name = full_name\n end\n return display_name \n end", "def social_profile(provider)\n social_profiles.select{ |sp| sp.provider == provider.to_s }.first\n end", "def name\n if first_name.present? || last_name.present?\n [first_name, last_name].join(\" \").strip\n else\n username\n end\n end", "def get_displayname(user)\n make_request(:get, \"/profile/#{user}/displayname\")['displayname']\n rescue NotFoundError => e\n raise UserNotFoundError.new(user, e.error),\n 'The specified user could not be found'\n end", "def simple_username\n return user.firstname + ' ' + user.lastname.first + '.' if !user.nil?\n name\n end", "def profile(profile_name:)\n claim_url = \"#{@@profile_service_url}/profile/#{profile_name}/next\"\n response = Faraday.get claim_url\n profile = JSON.parse(response.body)\n raise \"No profile available for #{profile_name}\" unless profile\n profile\n end", "def _profile\n @link['profile']\n end", "def display_name\n #self.email.split('@')[0]\n self.username\n end", "def facebook_profile?\n @network = current_user.network ||= Network.new\n !(@network.facebook.nil? || @network.facebook.blank?)\n end", "def get_user_profile(access_token)\n options = { query: { access_token: access_token, fields: 'name,email' } }\n response = self.class.get('/me', options)\n # Something went wrong most propably beacuse of the connection.\n unless response.success?\n Rails.logger.error 'Omniauth::Facebook.get_user_profile Failed'\n fail Omniauth::ResponseError, 'errors.auth.facebook.user_profile'\n end\n response.parsed_response\n end", "def get_user_name\n\t\tretVal = \"User Not Found\"\n\t\tuser_id = self.user_id\n\t\tuser = User.find(user_id, :select=>[\"fname\",\"lname\"])\n\t\tunless user.nil?\n\t\t\tretVal = user.fname + \" \" + user.lname\n\t\tend\n\t\treturn retVal\n\tend", "def linkedin_profile\n @network = current_user.network ||= Network.new\n (@network.linkedin.nil? || @network.linkedin.blank?) ? \"\" : @network.linkedin\n end", "def profile_url\n if self.profile and self.profile != \"\"\n return self.profile\n end\n return \"/blank.png\"\n end", "def profile(name)\n @profiles.find { |p| p.name == name }\n end", "def first_name\n @json['user']['content']['firstname'] || ''\n end", "def fullname\n person.fullname_unknown? ? login : person.fullname rescue login\n end", "def profile_name(screenname)\n unless screenname==nil\n if screenname.size > 15 || screenname.size == 15 \n return screenname.slice(0,11)+\"...\"\n else\n return screenname.titlecase\n end\n end\nend", "def try_display_name\n [display_name, username].find(&:present?)\n end", "def facebook_name_field(value=nil)\n rw_config(:facebook_name_field, value, :name)\n end", "def user_name\n if /(.*)-\\d{8}-\\d{6}$/ =~ perma_link\n return $1\n else\n return \"unknown\"\n end\n end", "def get_user_name\n if first_name.blank?\n return email.split('@').first.capitalize unless email.blank? \n else\n return first_name.capitalize + \" \" + last_name.capitalize\n end \n return ''\n end", "def facebook_username_field(value=nil)\n rw_config(:facebook_username_field, value, :facebook_username)\n end", "def full_name\n \treturn \"#{first_name} #{last_name}\".strip if(first_name || last_name) \n \t\"Anonymous\"\n end", "def last_name\n @json['user']['content']['lastname'] || ''\n end", "def full_user_name\n formatedName=first_name[0].upcase+first_name[1,first_name.size].downcase+\" \"+last_name[0].upcase+last_name[1,last_name.size].downcase\n return formatedName.strip if (first_name || last_name)\n return \"Anonymous\"\n end", "def name\n auth[:info][:name] || auth[:info][:display_name] rescue nil\n end", "def get_profile_name(uri)\n uri.host + uri.path\n end", "def user_display_name\n @attributes[:user_display_name]\n end", "def get_profile\n begin\n client.profile(fields: PROFILE_FIELDS)\n rescue Exception => e\n logger.error \"Linkedin #get_profile error #{e}\"\n end\n end", "def profile_picture\n\t\tFbGraph::User.me(self.oauth_token).fetch.picture(width: 150, height: 200)\n\tend", "def screen_name\n name || nickname\n end", "def display_name\n return attributes['display_name'] unless attributes['display_name'].blank?\n return \"#{attributes['first_name']} #{attributes['last_name']}\" unless attributes['first_name'].blank? && attributes['last_name'].blank?\n return '(unknown)'\n end", "def user_full_name\n if user\n user.first_name + ' ' + user.last_name\n else\n 'Anonymous'\n end\n end", "def nickname\n user_info['nickname']\n end", "def user_full_name\n @user[\"name\"]\n end", "def user_name\n read_attribute('user_name') || \"anonymous\"\n end", "def full_name\n if user_data\n \"#{user_data['first_name']&.downcase&.capitalize} #{user_data['last_name']&.downcase&.capitalize}\"\n end\n end", "def display_name\n entry = JSON.parse(self.entry)\n user = User.find(user_id)\n \"#{user.display_name} #{entry['text']}\"\n end", "def current_user_screen_name\n session[:user_info][\"nickname\"]\n end", "def find_profile_user(full_name)\n name = split_phrase(full_name)\n profile = Profile.find_by_first_name_and_last_name(name.first, name.last)\n user = profile.user unless profile.blank?\n user\n end", "def user_display_name\n return @user_display_name\n end", "def user_display_name\n return @user_display_name\n end", "def user_display_name\n return @user_display_name\n end", "def provider_name\n @json['profile']['providerName'] rescue nil\n end", "def get_user_profile_description\n get_profile_description(\"Users\")\n end", "def display_name\n username\n end", "def profile_url\n @data[:profile_url]\n end", "def fetch_details_from_facebook\n graph = Koala::Facebook::API.new(self.token)\n facebook_data = graph.get_object(\"me\")\n self.username = facebook_data['username']\n self.save\n end", "def get_display_name\n @display_name ||= self.user.display_name\n end", "def personal_name\n data[:personal_name]\n end", "def title\n if self.username != \"\" && !self.username.nil?\n self.username\n elsif self.first_name != \"\" && !self.first_name.nil?\n self.first_name\n else\n \"Anonymous\"\n end\n\n end", "def display_name\n self.name.blank? ? self.username : self.name\n end", "def full_name\n name = `finger $USER 2> /dev/null | grep Login | colrm 1 46`.chomp\n name.empty? ? \"John Doe\" : name.squish\n end", "def profile_url\n nil\n end" ]
[ "0.817356", "0.79700387", "0.7904319", "0.7689265", "0.76799816", "0.7658345", "0.76024956", "0.7541604", "0.7537486", "0.7506942", "0.74846613", "0.74654686", "0.7459085", "0.7445542", "0.73052406", "0.7267499", "0.7255232", "0.7254633", "0.719719", "0.71701044", "0.71678036", "0.71663547", "0.7146032", "0.7095784", "0.707276", "0.7047944", "0.69883955", "0.69265956", "0.6916152", "0.6905919", "0.68376815", "0.6828967", "0.68253934", "0.676778", "0.6741085", "0.6714012", "0.67093843", "0.6664902", "0.66550606", "0.6654091", "0.665097", "0.66473925", "0.66356397", "0.661296", "0.6608243", "0.66066265", "0.66059816", "0.65903956", "0.65762943", "0.657087", "0.65646553", "0.6521891", "0.6513147", "0.6506742", "0.6502701", "0.6488186", "0.64881104", "0.6474204", "0.6438944", "0.6435487", "0.64215547", "0.64192235", "0.64178956", "0.6417412", "0.64126176", "0.6412303", "0.63976663", "0.6385039", "0.638367", "0.638068", "0.6375525", "0.63741094", "0.6372646", "0.6368412", "0.636778", "0.6366943", "0.63603574", "0.634322", "0.63404936", "0.634047", "0.63383", "0.63320535", "0.6330312", "0.6328346", "0.63256556", "0.6319573", "0.63180155", "0.6315834", "0.6315834", "0.6315834", "0.63036597", "0.6296435", "0.6292997", "0.6284486", "0.62843233", "0.6282293", "0.62812656", "0.6277688", "0.6274027", "0.6271945", "0.6268004" ]
0.0
-1
^ necessary bc, in App Controller we `before_action :require_login` '/'
def welcome end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def require_login\n redirect_to root_path unless logged_in?\n end", "def require_login\n redirect_to root_path unless logged_in?\n end", "def require_login\n if !current_user\n redirect_to \"/\"\n end\n end", "def require_login\n if !current_user\n flash[:error] = \"You must be logged in to access this section\"\n redirect_to main_app.root_path # halts request cycle\n end\n \n end", "def login_required\n if !logged_in?\n redirect \"/login?#{env[\"REQUEST_PATH\"]}\"\n end\n end", "def require_login\n if current_user.nil? then\n redirect_to root_path\n end\n end", "def require_login\n if !current_user\n flash[:error] = \"You must be logged in to access this section\"\n redirect_to main_app.root_path # halts request cycle\n end\n end", "def require_login\n if !current_user\n flash[:error] = \"You must be logged in to access this section\"\n redirect_to main_app.root_path # halts request cycle\n end\n end", "def require_logged_in\n redirect_to root_path unless logged_in?\n end", "def login_required! \n if ! is_logged_in? \n redirect '/login' \n end \n end", "def require_login\n unless logged_in?\n redirect url(:admin_login)\n throw :halt\n end\n end", "def require_login\n redirect_to login_path if !user_logged?\n end", "def require_login\n redirect_to '/' if session[:user_id] == nil\n end", "def login_required\n redirect_to login_path unless logged_in?\n end", "def require_login\n redirect R(:login) unless logged_in?\n end", "def require_login\n redirect_to login_path unless logged_in?\n end", "def login_checkpoint\n redirect to '/' if !logged_in?\n end", "def require_login\n redirect_to(root_path, alert: t('application_controller.login_required_html')) and return unless user_signed_in?\n end", "def login_required\n redirect_to(login_url) unless logged_in? && authorized?\n end", "def require_login\n unless logged_in?\n redirect_to login_path\n end\n end", "def authorized_user!\n unless user_logged_in?\n redirect_to root_path\n end\n end", "def login_required\n redirect_to login_path unless logged_in?\n end", "def must_be_authenticated!\n unless current_admin\n redirect_to :controller => 'home', :action => 'index'\n end\n end", "def require_login\n redirect_to root_path unless session.include?(:user_id)\n end", "def req_login\n unless curr_user\n flash[:danger] = \"Login to view this content\"\n redirect_to login_url\n end\n end", "def requires_login\n unless user_logged_in?\n return redirect_to login_index_path, notice: \"You must login to view that page.\"\n end\n end", "def index\n redirect_to(:action => 'login') unless logged_in? \n end", "def require_login\n return head(:forbidden) unless current_user\n end", "def login_required\n \t\t redirect_to(root_url, notice: 'You have to be signed in to do that! Top right ~') unless current_user\n \tend", "def authorize!\n redirect '/' unless logged_in?\n end", "def require_logged_in\n \treturn true if current_user\n\n \treturn redirect_to root_path\n\n end", "def require_login\n if current_user.nil?\n flash[:alert] = \"Please sign in to see this content.\"\n redirect_to :root\n end\n end", "def require_login\n return head(:forbidden) unless current_user\n end", "def before_request\n self.login if require_login? && !@authenticating\n end", "def must_be_logged_in\n redirect_to root_path unless logged_in?\n end", "def require_login\n end", "def require_login\n if !is_logged_in\n return render_404\n end\n end", "def login_required\n if logged_in?\n return true\n else\n redirect_to(:controller => '/user', :action => 'index')\n return false\n end\n end", "def enforce_login\n redirect_to welcome_path if @user.nil?\n end", "def require_login\n redirect_to new_api_v1_session_url unless logged_in?\n end", "def require_login\n unless @current_account\n redirect_to root_path\n end\n end", "def verify_logged_in\n redirect_to root_path unless logged_in?\n end", "def authorized\n redirect_to \"/login\" unless logged_in? \n end", "def logged_in_user\n unless logged_in?\n redirect_to root_url\n end\n end", "def require_login\n if !current_user\n if request.url =~ %r|/accounts/| # chatter controller\n # /chatter controllers have their own error handler for unauthenticated scenarios because none of the actions\n # refresh the page and thus the redirect will disappear in the XHR or hidden iframe.\n if request.xhr?\n render :text => 'You are not authenticated', :status => '401', :content_type => 'application/json'\n else\n render :render_404, :layout => false\n end\n else\n store_target_location\n flash[:notice] = \"Hey friend, please log in first.\"\n redirect_to root_url\n end\n return false\n else # we have a current user\n setup_api_client\n end\n end", "def authentication_required\n if !logged_in?\n redirect_to login_path\n end\n end", "def not_authenticated\n # Make sure that we reference the route from the main app.\n redirect_to main_app.log_in_path\n end", "def authorized\n redirect_to :controller => 'home', :action => 'index' unless logged_in?\n end", "def require_login\n if session[:user_id].blank?\n redirect_to root_url, notice: \"Login is required to perform this action!\"\n end\n end", "def require_login\n if session[:user_id].blank?\n redirect_to root_url, notice: \"Login is required to perform this action!\"\n end\n end", "def require_login\n redirect_to '/login' unless session[:name]\n end", "def authorized\n redirect_to '/welcome' unless logged_in?\n end", "def user_root\r\n if logged_in?\r\n redirect_to current_user\r\n else\r\n redirect_to login_path\r\n end\r\n end", "def require_login\n redirect_to login_path, notice: 'The requested action requires you to log in' unless session[:user_id]\n end", "def require_user\n redirect_to '/login' unless current_user\n end", "def require_user\n redirect_to '/login' unless current_user\n end", "def require_user \n redirect_to '/login' unless current_user \n end", "def require_user \n redirect_to '/login' unless current_user \n end", "def require_login\n\t\tunless current_user\n\t\t\tredirect_to login_url\n\t\tend\n\tend", "def require_login\n redirect_to '/sessions/new' unless current_user\n end", "def check_login\n head :forbidden unless self.current_user\n end", "def user_logged\n \tif !current_user\n \t\treturn redirect_to '/'\n \tend\n end", "def must_login\n redirect_to login_path unless logged_in?\n end", "def login\n redirect_to lato_core.root_path if core_controlSession\n end", "def check_for_login\n #if not, back home with you!\n redirect_to root_path unless @current_user.present?\n end", "def logged_in_user\n unless current_user \n redirect_to root_path\n end\n end", "def user_authorized\n redirect_to \"/\" unless session[:user_id]\n end", "def require_auth\n redirect_to login_path unless authenticated?\n end", "def require_login\n if logged_in? or authorized?\n # Let them pass\n else\n flash[:warning] = \"You must be logged in to view that page\"\n redirect_to login_path(:redirect => request.url)\n end\n end", "def ensure_logged_in\n redirect_to api_session_url unless logged_in?\n end", "def require_login \n # puts \"#{@@count}\" \n # @@count+=1; \n if !(session[:user_id])\n # puts \"#{@@count} require_login method of application controller found no user logged in: \", session[:user_id]\n redirect_to '/main'\n # else\n # puts \"#{@@count} using require_login private method: Someone is already logged in: \", session[:user_id]\n # current_user = User.find(session[:user_id])\n #return current_user\n end\n end", "def require_login\n unless @current_user\n \tredirect_to root_url, :notice => \"You must be logged in to access this section\"\n end\n end", "def require_user\n\t\tredirect_to \"/login\" unless current_user\n\tend", "def require_login\n unless current_user\n redirect_to signin_path\n end\n end", "def check_login\n redirect_to root_url, alert: \"You must login to view this page.\" if current_user.nil?\n end", "def require_user\n return if current_uid\n\n store_location\n flash[:notice] = 'You must be logged in to access the page you requested'\n ret = url_for_with_proto({ controller: 'user_sessions', action: 'guest_login' })\n redirect_to(ret) && return\n end", "def redirect_if_not_logged_in\n\t\tredirect_to '/' if !logged_in?\n\tend", "def admin_required\n if not admin?\n redirect \"/login?#{env[\"REQUEST_PATH\"]}\"\n end\n end", "def home\n if !view_context.signed_in?\n redirect_to '/'\n end\n end", "def require_authentication\n\n # No matter what the app does a user can always login, forgot\n # password and register. The controllers provided by this\n # plugin alreaddy have these controllers/actions on an\n # exception list but this prevents a mistake an overridden\n # controller from preventing the normal login behavior.\n %w(session password user).each do |c|\n \t %w(new create).each do |a|\n return if (controller_name == c) && (action_name == a)\n end\n \t end\n\n # If we cannot get the current user store the requested page\n # and send them to the login page.\n if current_user.nil? or current_user.anonymous?\n redirect_to login_url(:return_to => request.url) and false\n end\n end", "def require_login\n\t\tunless signed_in_user?\n\t\t\tflash[:error] = \"Not authorized, please sign in!\"\n\t\t\tredirect_to root_url\n\t\tend\n\tend", "def require_login\n unless current_admin\n session[:return_to] ||= request.referer\n if request.xhr?\n render json: fail_update_response(\"LOGOUT\")\n else\n redirect_to login_url\n end\n end\n end", "def require_login\n if @current_user\n # Do nothing\n else\n puts \"No session\"\n render json: {error: \"Not logged in\"}, status: :unauthorized\n end\n end", "def require_login\n unless current_user\n flash[:danger] = \"You must be logged in to do that.\"\n redirect_to root_path and return\n end\n end", "def require_admin\n redirect_to root_path unless admin_logged_in?\n end", "def login_required\n unless session[:user_id].present?\n redirect_to login_user_index_path\n end\n end", "def login_required\n not_authorized unless current_user\n end", "def require_login\n authorize_request || render_unathorized(\"Access denied\")\n end", "def require_signin\n\t\tunless current_user\n\t\t\t# session[:intended_url] = request.url\n\t\t\t# redirect_to new_session_url, alert: \"Please sign in first\"\n\t\t\trender nothing: true, status: :unauthorized\n\t\tend\n\tend", "def not_authenticated\n redirect_to root_path\n end", "def not_authenticated\n redirect_to root_landing_url\n end", "def login_required?\n\n # check for user session\n if current_user and user_signed_in? then\n bootstrap current_user, :name => :current_user\n return false\n end\n\n # don't redirect when trying to login\n return false if params[\"controller\"] == \"sessions\" && (params[\"action\"] == \"index\" || params[\"action\"] == \"create\")\n\n # render a response directly\n if request.xhr? or request.format != \"text/html\" then\n # return an error response instead\n return render :text => \"not logged in\", :status => 401\n end\n\n u = URI.parse(request.url)\n s = u.path\n s += \"?\" + u.query if u.query\n session[:return_to] = s\n\n qp = params.clone\n qp.delete(:controller)\n qp.delete(:action)\n path = params[:i].blank? ? login_index_path : login_index_path(qp)\n\n redirect_to path\n end", "def redirect_if_logged_in\n redirect_to root_path if logged_in?\n end", "def logged_in?\n redirect_to(root_path, notice: 'Unauthorized access!') unless current_user\n end", "def logged_in_user\n unless logged_in?\n redirect_to '/login'\n end\n end", "def ensure_current_user\n unless current_user\n redirect_to root_path\n # otherwise redirect somewhere root_path\n end\n end", "def Usuario_noLogueado\n redirect_to(root_url) unless logged_in?\n end", "def auth_user\n if !current_user\n redirect_to root_url\n end\n end", "def auth_user\n if !current_user\n redirect_to root_url\n end\n end", "def auth_user\n if !current_user\n redirect_to root_url\n end\n end", "def require_login\n unless current_user\n return admin_login_path\n end\n end" ]
[ "0.76762307", "0.76762307", "0.7632807", "0.76071453", "0.7596361", "0.75547576", "0.7424636", "0.7424636", "0.7423367", "0.73578566", "0.73342437", "0.7304159", "0.72936404", "0.7193835", "0.71849567", "0.71783984", "0.71689326", "0.7160785", "0.7144828", "0.71428394", "0.7137393", "0.71314085", "0.7131145", "0.7129369", "0.71254885", "0.7116926", "0.7111416", "0.71032405", "0.7102258", "0.7090727", "0.70732003", "0.7072135", "0.70713526", "0.70696306", "0.7068807", "0.70675755", "0.7065183", "0.7062173", "0.705548", "0.7051234", "0.7049206", "0.70451784", "0.7043348", "0.70362353", "0.7033408", "0.70273757", "0.70269364", "0.7008125", "0.6999784", "0.6999784", "0.6996994", "0.69947916", "0.69892013", "0.6983728", "0.6970851", "0.6970851", "0.6967633", "0.6967633", "0.6962486", "0.69584817", "0.6957951", "0.69447017", "0.6937294", "0.693011", "0.69177395", "0.691343", "0.6910798", "0.6895341", "0.68814886", "0.6881423", "0.6865616", "0.6864137", "0.6861464", "0.68555236", "0.68553656", "0.68506086", "0.6845893", "0.68405515", "0.68364084", "0.6834074", "0.6831269", "0.6828129", "0.6826437", "0.68248355", "0.6815948", "0.68151087", "0.6810186", "0.6809316", "0.68062854", "0.68016875", "0.67972803", "0.67944735", "0.6791097", "0.6790918", "0.67831063", "0.6779138", "0.6777136", "0.67755544", "0.67755544", "0.67755544", "0.6766438" ]
0.0
-1
3rd Party API authentication
def omniauth if params[:provider] == 'github' @user = User.find_or_create_by_github_omniauth(auth) else @user = User.find_or_create_by_google_omniauth(auth) end session[:user_id] = @user.id redirect_to user_path(@user) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_auth\n # output the APIkey from the header\n # puts request.headers[\"X-APIkey\"];\n creator = Creator.find_by(creator: request.headers[:creator])\n if creator && creator.authenticate(request.headers[:password])\n render json: { auth_token: encodeJWT(creator), id: creator.id}\n else\n render json: { error: 'Invalid username or password' }, status: :unauthorized\n end\n end", "def api_auth\n\t\tauth ::UApi\n\tend", "def http_auth?; end", "def api_auth\n creator = Creator.find_by(username: request.headers[:username])\n if creator && creator.authenticate(request.headers[:password])\n render json: { auth_token: encodeJWT(creator) }\n else\n render json: { error: 'Invalid username or password' }, status: :unauthorized\n end\n end", "def api_authenticate\n unless params[:api_key] == \"oz\" || api_user\n render :json => {:error => \"API key not found\"}, :status => :unauthorized\n end\n end", "def oauth_authentication; end", "def api_auth\n api_response(403, \"Invalid Authorization header\") unless api_user\n end", "def authenticate_by_api_key_in_http_auth\n authenticate_or_request_with_http_basic do |api_key, _|\n return User.where(:api_key => api_key).first\n end\n nil\n end", "def auth\n end", "def auth\n end", "def http_auth_login\n # FIXME: Implement\n end", "def authenticate_with_api_key!\n \t\t@current_bearer = authenticate_or_request_with_http_token &method(:authenticator)\n \tend", "def http_auth_hash; end", "def api_auth \n # output the APIkey from the header\n # puts request.headers[\"X-APIkey\"]; \n user = User.find_by(email: params[:email].downcase)\n if user && user.authenticate(params[:password])\n render json: { auth_token: encodeJWT(user) }\n else\n render json: { error: 'Invalid username or password' }, status: :unauthorized\n end\n end", "def authenticate!\n error!(\"401 Unauthorized\", 401) unless check_auth_token \n end", "def authenticate\n @apikey = request.headers[:apikey]\n if @apikey==nil || @apikey!= APIKEY\n json_response={\n error: 'autorization error'\n }\n respond_with json_response, location: nil\n end\n end", "def authenticate!\n token = Configuration.authentication_token\n secret = Configuration.authentication_secret\n creds = {token => params[token], secret => params[secret]}\n\n response = HTTPClient.get(Configuration.authentication_endpoint, creds)\n\n unless response.ok?\n halt(403, \"Authentication failed: #{response.body}\")\n end\n end", "def tokenizing\n authenticate_api || unauthorized_api\n end", "def authenticate\n api_token = request.headers[\"ApiToken\"]\n apiUser = ApiUser.where(api_token: api_token).first\n\n if !apiUser.nil?\n user =\n AuthenticateUser.new(auth_params[:email], auth_params[:password],apiUser.id, true).call\n\n render json: user\n else\n json_response({ message: Message.invalid_api_token }, 422)\n end \n end", "def auth_param; end", "def authenticate_knox_api_key!\n authenticate_for ApiKey\n end", "def auth\r\n OAuth2\r\n end", "def authenticate\n raise Rackspace::NotInitialized unless self.initialized?\n headers = RestClient::Request.execute(:method => :get, :url => \"#{AUTH_URL}/#{self.api_version}\", :headers => {\"X-Auth-User\" => self.api_user, \"X-Auth-Key\" => self.api_key}, :raw_response => true).headers\n {:auth_token => headers[:x_auth_token], :storage_url => headers[:x_storage_url], :server_management_url => headers[:x_server_management_url], :cdn_management_url => headers[:x_cdn_management_url]}\n end", "def authenticate!\n # if the authentication header is an acceptible value\n if @env['HTTP_X_MY_API'] == 'foobar'\n user = { :id => 1, :name => \"some user\" }\n # warden doesn't care what the user is, so long as it's not nil.\n success! user, \"success\"\n end\n end", "def authenticate(uri)\n request = Net::HTTP::Get.new(uri)\n request['Accept'] = 'application/json'\n request['Authorization'] = \"Bearer #{@session_token}\"\n request\n end", "def authenticate_api!\n Rails.logger.info(\"Enter Authenticate Api\")\n \n # just to test we are using HTTP_HOST in test mode as HTTP_ORIGIN cant be set\n Rails.env == \"test\" ? origin = request.env['HTTP_HOST'] : origin = request.env['HTTP_ORIGIN']\n\n if !params[\"token\"].blank? and origin.blank? # API Access\n\n account_id = AccountsCache.access_token(params[\"token\"])\n\n raise et(\"application.unauthorized\") if account_id.blank?\n \n # set account_id in params\n if params[:controller] == \"accounts\" and current_account\n params[:id] = current_account._id.to_s if params[:id].blank?\n else\n params[:account_id] = current_account._id.to_s if params[:account_id].blank?\n end\n\n # set the request type\n params[:request_type] = AppConstants.request_type_api\n\n # mark already authenticated\n set_authenticated\n\n # make api request synchronous as of now\n make_sync_request\n end\n rescue => e \n Rails.logger.error(\"**** ERROR **** #{er(e)}\")\n head :unauthorized\n end", "def authenticate_api!\n find_case\n return true if @case&.public? || current_user\n\n render json: { reason: 'Unauthorized!' },\n status: :unauthorized\n end", "def authenticate!\n\t\t@current_user = AuthorizeApiRequest.call(request.headers).result\n\t\t# If unauthorized return an error to the front end\n\t\trender json: {error: 'Not Authorized'}, status: 401 unless @current_user\n\tend", "def authenticate\n end", "def auth(value); end", "def authenticate_with_api_key!\n if @current_user.nil? && !request.headers['Authorization'].nil?\n @current_user = authenticate_or_request_with_http_token(&method(:authenticator))\n end\n end", "def authenticate_with_api_key\n\t @current_bearer = authenticate_with_http_token &method(:authenticator)\n\t end", "def authenticate_with_api_key\n if @current_user.nil? && request.headers['Authorization'].nil?\n @current_user = authenticate_with_http_token(&method(:authenticator))\n end\n end", "def authenticate\n @shoonga = authenticate_or_request_with_http_basic do |username, password|\n username == \"4vght\" && password == \"we8vds\"\n end\nend", "def authenticate_user\n @current_user = User.find_by_api_key(params[:api_key])\n end", "def authenticate_with_basic_auth\n name, token = ActionController::HttpAuthentication::Basic.user_name_and_password(request)\n @api_client = ApiClient.find_by(name: name)\n\n render(json: { errors: [{ detail: \"Access Denied\" }] }, status: 401) unless valid_key(token)\n end", "def authorize_api!\n http_basic_authorize!('API', api_username, api_password)\n end", "def authorize_api!\n http_basic_authorize!('API', api_username, api_password)\n end", "def apiAuth\n\t\tsignature = \"version=#{$CONFIG[:api_version]}&path=#{$CONFIG[:api_path]}&app_key=#{$CONFIG[:app_key]}&app_secret=#{$CONFIG[:app_secret]}&timestamp=#{$CONFIG[:timestamp]}\"\n\t\tsignature_hash = Digest::SHA2.new << signature\n\t\turl = \"#{$CONFIG[:api_url]}#{$CONFIG[:api_version]}#{$CONFIG[:api_path]}?app_key=#{$CONFIG[:app_key]}&timestamp=#{$CONFIG[:timestamp]}&signature=#{signature_hash}\"\n\t\n\t\turl\n\tend", "def authenticate\n response = post('login')\n @access_token = response['access-token']\n @client_id = response['client-id']\n end", "def basic_auth(*args, &block); end", "def api_authentication_required\n unauthorized unless current_user?\n end", "def authenticate(email, api)\nuri = URI('https://device.pcloudy.com/api/access')\n\nNet::HTTP.start(uri.host, uri.port,\n :use_ssl => uri.scheme == 'https', \n :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|\n request = Net::HTTP::Get.new uri.request_uri\n request.basic_auth email,api\n response = http.request request # Net::HTTPResponse object\n #puts response\n #puts response.body\n authresponce = JSON.parse(response.body)\n token = authresponce[\"result\"][\"token\"]\n puts token\n return token\nend \nend", "def authenticate_request\n auth_header_token = request.headers[\"Authorization\"]\n @current_user = AuthorizeApiRequest.new(auth_header_token).call\n render json: { error: \"Not Authorized\" }, status: 401 unless @current_user\n end", "def setup_api\n if white_listed?(path)\n @api = Api.new\n return\n end\n\n email, password = http_basic_auth_info\n\n if !email.blank? and !password.blank?\n user = User.find_by_email(email)\n if user.password == password\n @api = Api.new(user)\n else\n render(:nothing => true, :status => :unauthorized)\n return\n end\n else\n begin\n if current_user\n @api = Api.new(current_user)\n else\n render(:nothing => true, :status => :unauthorized)\n end\n rescue NameError\n @api = Api.new\n end\n end\n end", "def token_auth(*args, &block); end", "def authenticate_api_key!\n return if current_auth_api_key.present?\n\n render nothing: true, status: :unauthorized\n end", "def authenticate\n authenticate_or_request_with_http_basic do |username, password|\n username == ENV['USERNAMEV'] && password == ENV['PASSWORDV'] \n end \n end", "def authenticate\n authenticate_or_request_with_http_basic do |user_name, password|\n # Change these to username and password required\n user_name == \"shitlister\" && password == \"letmein\"\n end\n end", "def require_api_user_or_token\n case auth_mechanism\n when :system\n authenticate_with_system_token(request.headers[HttpHeaders::MIQ_TOKEN])\n when :token\n authenticate_with_user_token(request.headers[HttpHeaders::AUTH_TOKEN])\n when :ui_session\n raise AuthenticationError unless valid_ui_session?\n auth_user(session[:userid])\n when :jwt\n authenticate_with_jwt(jwt_token)\n when :basic, :basic_async, nil\n success = authenticate_with_http_basic do |u, p|\n begin\n timeout = ::Settings.api.authentication_timeout.to_i_with_method\n\n if oidc_configuration?\n # Basic auth, user/password but configured against OpenIDC.\n # Let's authenticate as such and get a JWT for that user.\n #\n user_jwt = get_jwt_token(u, p)\n token_info = validate_jwt_token(user_jwt)\n user_data, membership = user_details_from_jwt(token_info)\n define_jwt_request_headers(user_data, membership)\n end\n user = User.authenticate(u, p, request, :require_user => true, :timeout => timeout)\n auth_user(user.userid)\n rescue MiqException::MiqEVMLoginError => e\n raise AuthenticationError, e.message\n end\n end\n raise AuthenticationError unless success\n end\n log_api_auth\n rescue AuthenticationError => e\n api_log_error(\"AuthenticationError: #{e.message}\")\n response.headers[\"Content-Type\"] = \"application/json\"\n case auth_mechanism\n when :jwt, :system, :token, :ui_session, :basic_async\n render :status => 401, :json => ErrorSerializer.new(:unauthorized, e).serialize(true).to_json\n when :basic, nil\n request_http_basic_authentication(\"Application\", ErrorSerializer.new(:unauthorized, e).serialize(true).to_json)\n end\n log_api_response\n end", "def basic_auth(opts); end", "def valid_for_http_auth?; end", "def authenticate\n res = HTTParty.post(\n authenticate_url,\n body: body.to_json,\n headers: { 'Content-Type' => 'application/json' }\n )\n\n check_for_error(res)\n\n res.parsed_response\n end", "def token\n\n authenticate_with_http_basic do |email, password|\n user = User.find_by(email: email)\n if user && user.authenticate(password) \n render json: { token: user.api_token }\n else\n render json: { error: 'Incorrect credentials' }, status: 401\n end\n\n end\n end", "def auth\n {}\n end", "def authenticate_client\r\n client_id = request.headers['client-id']\r\n client_secret = request.headers['client-secret']\r\n\r\n unless client_id == Rails.application.secrets.api_key && client_secret == Rails.application.secrets.api_secret\r\n render json: ErrorResponse.new(\r\n code: 401, message: 'Unauthorized Request'\r\n ), adapter: :json, status: :unauthorized\r\n nil\r\n end\r\n\r\n end", "def developer_key_authentication\n authenticate_or_request_with_http_token do |token|\n Api.exists?(key: token)\n end\n end", "def authenticate\n authenticate_or_request_with_http_token do |token _options|\n @current_user = User.find_by token: token\n end\n end", "def authenticate\n# byebug\n return true if public_action?\n if request.format.json?\n authenticate_token || render_json_unauthorized\n else\n authenticate_user!\n end\n end", "def capable_login_auth?; end", "def authenticate\n api_key = parse_auth_token(request.headers['HTTP_AUTHORIZATION'])\n return user_not_authorized if api_key.nil?\n @real_user = User.find_by(api_key: parse_auth_token(request.headers['HTTP_AUTHORIZATION']))\n user_not_authorized if @real_user.nil?\n end", "def api\n # Should return an instance of the API instantiated \n # with the credentials passed into the initialized.\n # Raise an error to warn it isn't implemented.\n raise NotImplementedError.new \n end", "def authenticate_request\n @current_user = AuthorizeApiRequest.call(request.headers).result\n render json: { error: 'Not Authorized' }, status: 401 unless @current_user\n end", "def authenticate\n json_response(\n auth_token: AuthenticateUser.new(\n auth_params[:username],\n auth_params[:password]\n ).call\n )\n end", "def authenticate!\n # Do nothing yet\n end", "def authenticate\n token = params['api_key']\n return if token.nil?\n\n @visitor = Visitor.find_by_api_key(token)\n return if @visitor.present?\n\n response_json = { status: Visitor::INVALID_API_KEY }\n respond_with :api, :v1, response_json, status: :unauthorized\n end", "def login_0\n\n #definde needed header\n headers = {'Authorization' => \"Basic \" + @base_user_string}\n\n #Login\n response = request({:method => \"POST\", :url => @host + \"login\", :headers => headers})\n\n #Get organisation link\n @org_link = parse_content(response.body, '//Org')[0].attribute('href').to_s\n\n #Get authentication header key\n @auth_key = response.headers[:x_vcloud_authorization]\n\n end", "def authenticate\n RestClient.post @apiurl + \"authenticate\", \n :username => @username, \n :password => @password\n rescue RestClient::RequestFailed\n handle_error($!)\n return false\n end", "def authenticate_token \n\t\tauthenticate_with_http_token do | token, options| \n\t\t\tUser.find_by(auth_token: token)\n\t\tend\n\tend", "def auth_methods; end", "def authenticate\n authenticate_or_request_with_http_basic(\"algo\") do |username, password|\n username == \"dupa\" && password == \"dupa\"\n end\n end", "def capable_plain_auth?; end", "def authenticate_user_from_token!\n\t\t@api_token = ApiToken.find_by_token(params[:token])\n @user = @api_token.try(:user)\n if @user.nil?\n render json: { error: 'Not authorized' }, status: 401\n end\n end", "def http_auth_header?; end", "def authenticate_by_api_key_in_params\n if api_key = params[:api_key]\n User.where(:api_key => api_key).first\n end\n end", "def auth\n {:basic_auth => {:username => id, :password => password}}\n end", "def http_authenticatable?; end", "def authenticate\n authenticate_or_request_with_http_basic('Administration') do |username, password|\n username == 'igp' && password == 'ehkra!Q2w#e'\n end\n end", "def credentials\n authenticating_with_api? ? {:api_key => api_key} : super\n end", "def host_authorization; end", "def host_authorization; end", "def params_auth_hash; end", "def authenticate\n # return if unauthorized?\n\n # render json: {\n # message: I18n.t('api.v1.error_messages.unauthorized')\n # }, status: :unauthorized\n end", "def authenticate\n \t# get token from header\n \tauthentication_token = request.headers['token']\n \t@user = User.find_by_authentication_token authentication_token if authentication_token\n \t\n \tunless @user\n \t\trender json: {success: false, message: I18n.t('unauthorized'), data: {}}, status: :unauthorized\n \t\treturn false\n \tend\n end", "def userauth_request(username, next_service, auth_method, *others); end", "def authenticate_client_access!\n return if api_key_from_params.nil?\n\n return require_api_client if access_from_localhost?\n return require_api_client if access_from_preview_hosting? && restricted_api_access_mode?\n return require_api_client if access_from_production_hosting?\n return require_api_client if access_from_public_hosting?\n\n true # Do not halt otherwise\n end", "def call_authorization_api(params)\n return call_api(\"/api/auth/authorization\", {\n \"parameters\" => URI.encode_www_form(params)\n })\nend", "def authenticate_with_api_key(api_key)\n self.api_key == api_key\n end", "def authenticate\n RestClient::Request.execute(:method => :post,\n :url => @oauth_request,\n :headers => {\n \"Content-Type\" => \"application/json; charset=UTF8\",\n \"X-Accept\" => \"application/json\"\n },\n :payload => {\n :consumer_key => ENV['POCKET_CONSUMER_KEY'],\n :redirect_uri => ENV['REDIRECT_URI']\n })\n end", "def credentials(authorization, request); end", "def authenticate!\n api_key = request.headers[\"x-access-token\"] || params.delete(:api_key)\n\n if api_key.nil?\n self.current_advertiser = self.current_publisher = nil\n else\n self.current_advertiser = Trac::Advertiser.find_by(advertiser_api_key: api_key)\n logger.info \"Advertiser [#{current_advertiser.name}] logged in.\" if current_advertiser\n\n self.current_publisher = current_advertiser.nil? ? Trac::Publisher.find_by(publisher_api_key: api_key) : nil\n logger.info \"Publisher [#{current_publisher.name}] logged in.\" if current_publisher\n end\n\n render status: :unauthorized, json: { message: \"Wrong API token!\" } if current_advertiser.nil? && current_publisher.nil?\n end", "def auth\n if configuration.api_key\n { :key => configuration.api_key, :sign => 'true' }\n elsif configuration.access_token\n { :access_token => configuration.access_token }\n end\n end", "def authenticate\n\t\tusername = \"akiro.nakamura@pronto-hw.com\" \n\t\tpassword = \"1234\"\n\t\t\n\t\toauth = 'http://localhost:9001/rest/oauth/token?client_id=mobile_android&client_secret=secret&grant_type=password&username=' + username + '&password=' + password\n\t\tclient = RestClient::Resource.new(oauth,:verify_ssl => OpenSSL::SSL::VERIFY_NONE)\n\t\tresponse = client.get();\n\t\t@doc = Nokogiri::XML(response)\n\t\ttoken = \"Bearer \" + @doc.at_css(\"access__token\").content\n\n\tend", "def authenticate(request)\n return unless request['Authorization'].nil?\n\n confkey = credential_config_key\n\n token = config(\"#{confkey}.token\")\n user = config(\"#{confkey}.user\")\n pass = config(\"#{confkey}.password\")\n\n if token\n request['Authorization'] = \"token #{token}\"\n elsif user\n begin\n if $stdin.tty?\n pass = ask(\"Enter your password for #{api_url}: \") { |q| q.echo = '*' } if !pass\n else\n $stderr.puts \"STDIN not a TTY - cannot query for missing password.\"\n $stderr.puts \"Please add #{confkey}.password or #{confkey}.token to your gitconfig\"\n exit 1\n end\n rescue Interrupt\n warn \"attempting connection without authorization..\"\n return\n end\n request.basic_auth(user, pass)\n else\n $stderr.puts \"No currently configured username/password or token set for this API Provider.\"\n exit 1 unless $stdin.tty? && setup_credentials\n authenticate(request)\n end\n end", "def Authentication\n call('', '')\n end", "def authenticate\n auth_token =\n AuthenticateUser.new(auth_params[:email], auth_params[:password]).call\n json_response(auth_token: auth_token)\n end", "def authenticate\n auth.call(:authenticate)\n end", "def api_authenticate\n if request.headers[\"Authorization\"].present?\n # Take the last part in The header (ignore Bearer)\n auth_header = request.headers['Authorization'].split(' ').last\n # Are we feeling alright!?\n @token_payload = decodeJWT auth_header.strip\n if !@token_payload\n render json: { error: 'The provided token wasn´t correct' }, status: :bad_request\n end\n else\n render json: { error: 'Need to include the Authorization header' }, status: :forbidden # The header isn´t present\n end\n end", "def admin_auth\n authenticate_or_request_with_http_basic do |username, password|\n username == \"ga\" && password == \"ga\"\n end\n end", "def authenticate\n #Hace el llamado de la clase AuthenticaUser, manda los parametros de :username y :password\n #Realiza el metodo call para obtener el Token del user_id\n #Arroja el token como Json_response\n auth_token = AuthenticateUser.new(auth_params[:username], auth_params[:password]).call \n json_response(auth_token: auth_token)\n end", "def authenticate\n self.get && true\n end" ]
[ "0.7542506", "0.7407642", "0.73714185", "0.73508185", "0.734789", "0.7343505", "0.7331537", "0.73241913", "0.73095644", "0.73095644", "0.7290699", "0.72262955", "0.7197101", "0.71726876", "0.7153163", "0.7110424", "0.7074053", "0.70686835", "0.7064648", "0.7062985", "0.70300287", "0.702788", "0.70241296", "0.70216864", "0.70120686", "0.6976528", "0.69765097", "0.6975883", "0.6969369", "0.6953053", "0.6947764", "0.6945519", "0.6942595", "0.6921686", "0.6921306", "0.69060177", "0.68819", "0.68819", "0.68780637", "0.68696713", "0.68591166", "0.68531966", "0.6851331", "0.6846675", "0.68429375", "0.68394566", "0.68353766", "0.683238", "0.68267035", "0.6826093", "0.68231714", "0.6819332", "0.6810972", "0.67913115", "0.6773551", "0.67621297", "0.6741936", "0.67356664", "0.67305285", "0.6727597", "0.6717601", "0.6713461", "0.67076296", "0.6697602", "0.66951466", "0.6691268", "0.6687687", "0.6683043", "0.66734546", "0.6671188", "0.6669069", "0.6658036", "0.6652697", "0.66451", "0.66423583", "0.6632398", "0.66291964", "0.6627705", "0.6627393", "0.66268384", "0.66268384", "0.6615127", "0.6614954", "0.66141474", "0.6608999", "0.66006005", "0.6598508", "0.65975386", "0.65891457", "0.65875775", "0.6586856", "0.6584615", "0.65823185", "0.65763986", "0.65762335", "0.6574626", "0.6573133", "0.6570993", "0.6564127", "0.656241", "0.65604585" ]
0.0
-1
returns omniauth user hash
def auth request.env['omniauth.auth'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_hash\n @user_hash ||= MultiJson.decode(@access_token.get('/services/api/json/1.2.2/?method=smugmug.auth.checkAccessToken').body)['Auth']['User']\n end", "def identity_hash\n request.env['omniauth.auth']\n end", "def hash_from_omniauth(omniauth)\n {\n :provider => omniauth['provider'],\n :uid => omniauth['uid'],\n :token => (omniauth['credentials']['token'] rescue nil),\n :secret => (omniauth['credentials']['secret'] rescue nil),\n :screenname => (omniauth['user_info']['nickname'] rescue nil)\n }\n end", "def omniauth\n Hashie::Mash.new auth_hash\n end", "def user_info\n auth_hash['user_info']\n end", "def hash\n Digest::SHA2.hexdigest(self.id.to_s + self.password_hash.to_s + self.email.to_s).slice(0,10)\n end", "def auth_hash\n request.env['omniauth.auth']\n end", "def auth_hash\n request.env['omniauth.auth']\n end", "def auth_hash\n request.env['omniauth.auth']\n end", "def auth_hash\n request.env['omniauth.auth']\n end", "def auth_hash\n request.env['omniauth.auth']\n end", "def auth_hash\n request.env['omniauth.auth']\n end", "def user_hash(message)\n return Digest::MD5.hexdigest(message.user).to_i(16) + Digest::MD5.hexdigest(message.host).to_i(16)\nend", "def user_hash(user_id)\n secret = APP_CONFIG.admin_intercom_secure_mode_secret\n OpenSSL::HMAC.hexdigest('sha256', secret, user_id) if secret.present?\n end", "def user_hash\n @user_hash ||= MultiJson.decode(@access_token.get('https://api.trademe.co.nz/v1/MyTradeMe/Summary.json').body)\n end", "def to_s\n \"#{user}:#{digest}\"\n end", "def calculate_auth_string( salt, user )\n return hash( salt, @creds[user] )\n end", "def get_hash_sha1(user)\n begin\n guid = user['generateduid'][0].to_ruby\n password_hash = nil\n password_hash_file = \"#{@@password_hash_dir}/#{guid}\"\n if File.exists?(password_hash_file) and File.file?(password_hash_file)\n fail(\"Could not read password hash file at #{password_hash_file}\") if not File.readable?(password_hash_file)\n f = File.new(password_hash_file)\n password_hash = f.read\n f.close\n end\n password_hash\n rescue\n return String,new\n end\n end", "def build_user_hash\n user = {id: self.id.to_s,\n first_name: self.first_name,\n last_name: self.last_name,\n email: self.email,\n user_name: self.user_name,\n pin: self.pin,\n created_at: self.created_at\n }\n user[:normal_avatar] = self.avatar.url || \"res://avatardefault\"\n user[:thumb_avatar] = self.avatar.thumb.url || \"res://avatardefault\"\n user[:like_count] = self.likes.count if self.likes\n return user\n end", "def auth_hash\n @auth_hash ||= request.env['omniauth.auth']\n end", "def omniauth_credentials\n if omniauth_hash = request.env['omniauth.auth']\n {\n provider: omniauth_hash['provider'],\n uid: omniauth_hash['uid'],\n email: omniauth_hash['info']['email'],\n name: omniauth_hash['info']['name'],\n }\n else\n nil\n end\n end", "def auth_hash\n # raise request.env['omniauth.auth'].to_yaml\n request.env[\"omniauth.auth\"]\n end", "def auth_hash\n @auth_hash ||= request.env['omniauth.auth']\n end", "def auth_hash\n OmniAuth::Utils.deep_merge(super(), {\n 'uid' => @client_id,\n 'user_info' => {\n 'user_hash' => user_data,\n }\n })\n end", "def create_hash(user_pw)\n return Digest::SHA1.hexdigest(user_pw)\nend", "def mock_auth_hash(user)\n return {\n provider: user.oauth_provider,\n uid: user.oauth_uid,\n info: {\n name: user.name,\n email: user.email\n },\n credentials: {\n token: SecureRandom.base64(128),\n refresh_token: SecureRandom.base64(64),\n expires_at: Time.now + 8.hours\n }\n }\n end", "def mock_auth_hash(user)\n return {\n provider: user.oauth_provider,\n uid: user.oauth_uid,\n info: {\n name: user.name,\n email: user.email\n },\n credentials: {\n token: SecureRandom.base64(128),\n refresh_token: SecureRandom.base64(64),\n expires_at: Time.now + 8.hours\n }\n }\n end", "def hash_username\n charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'\n Digest::SHA1.hexdigest(email + created_at.usec.to_s)\n .chars\n .each_slice(2)\n .map(&:join)\n .map { |hex| hex.to_i(16) }\n .map { |i| charset[i % charset.length] }\n .join\n .slice(0, 6)\n end", "def auth_hash\n request.env['omniauth.auth'].symbolize_keys!\n end", "def user_info\n {\n 'nickname' => user_hash['NickName'],\n 'name' => user_hash['NickName']\n }\n end", "def auth_hash\n OmniAuth::Utils.deep_merge(super(), {\n 'uid' => @uid,\n 'user_info' => {\n 'name' => @username\n }\n })\n end", "def user_info\n {\n 'uid' => user_hash['feed']['author'][0]['email']['$t'],\n 'nickname' => user_hash['feed']['author'][0]['name']['$t'],\n }\n end", "def user_info\n {\n 'uid' => user_hash['feed']['author'][0]['email']['$t'],\n 'nickname' => user_hash['feed']['author'][0]['name']['$t']\n }\n end", "def user_hash\n response_hash.key?(:user) ? response_hash[:user] : {}\n end", "def make_auth_hash\n self.auth_hash = Digest::SHA1.hexdigest(self.object_id.to_s + Time.now.to_i.to_s + self.name.to_s)\n end", "def get_hash\n return(uniquehash) if (uniquehash and uniquehash.length > 0)\n uniquehash = ApplicationController::random_password(10)\n self.save\n return uniquehash\n end", "def session_hash(user)\n {\n username: user.username,\n authentication_token: user.authentication_token\n }\n end", "def http_auth_hash; end", "def extract_info_from_omniauth(omniauth)\n if omniauth.has_key?('extra') && omniauth['extra'].has_key?('user_hash')\n self.info = omniauth['user_info'].merge(omniauth['extra']['user_hash']).symbolize_keys\n else\n self.info = omniauth['user_info'].symbolize_keys\n end\n end", "def password\n @hash.to_s\n end", "def hashed_password\n @hashed_password ||= Digest::SHA1.hexdigest(password).upcase\n end", "def digest_hash(_realm, username)\n @sequel.fetch(\"SELECT digesta1 FROM #{@table_name} WHERE username=?\", username) do |row|\n return row[:digesta1]\n end\n nil\n end", "def user_information\n { \"username\": @user.username, \"email\": @user.email, \"id\": @user.id }\n end", "def normalized_userinfo\n normalized_user + (password ? \":#{normalized_password}\" : \"\") if userinfo\n end", "def oauth_state\n org = retrieve_organization\n state = \"#{org.name}:#{org.salt}:#{org.owner_email}\"\n Base64.urlsafe_encode64(Digest::SHA256.digest(state))\n end", "def calc_sha256 (secret)\n return nil if dummy_user?\n if provider == 'facebook'\n # uid cannot be used as global id for fb users. different uid f\n sha256_input = \"#{secret},#{self.api_profile_picture_url}/#{self.provider},#{self.user_name}\"\n else\n sha256_input = \"#{secret},#{self.uid}/#{self.provider},#{self.user_name}\"\n end\n Base64.encode64(Digest::SHA256.digest(sha256_input)).gsub(/\\n$/,'') # remove last /n - used as hash key in JS\n end", "def hash\n fullname.hash\n end", "def hashed_email\n @hashed_email ||= Digest::MD5.hexdigest(email.downcase.gsub(/\\s/, ''))\n end", "def get_user_email\n unless auth_hash\n return nil if recaptcha_enabled? && !verify_recaptcha\n return params['email']\n end\n\n case auth_hash.provider\n when 'twitter'\n auth_hash.info.nickname\n when 'github'\n check_user_github_organizations ? auth_hash.info.email : nil\n else\n auth_hash.info.email\n end\n end", "def secret_username\n return nil if gml_uniquekey_hash.blank?\n \"anon-\"+gml_uniquekey_hash[-5..-1]\n end", "def hash_user_password\n self.password = sha1_digest(self.user_password, self.salt)\n self.user_password = nil\n end", "def hash\n [ name, database, password ].hash\n end", "def new_user_hash\n # source: https://github.com/tapster/omniauth-meetup\n {\n \"provider\"=>\"meetup\",\n \"uid\"=>12345,\n \"info\"=> {\n \"id\"=>12345,\n \"name\"=>\"elvis\",\n \"photo_url\"=>\"http://photos3.meetupstatic.com/photos/member_pic_111.jpeg\"\n },\n \"credentials\"=> {\n \"token\"=>\"abc123...\", # OAuth 2.0 access_token, which you may wish to store\n \"refresh_token\"=>\"bcd234...\", # This token can be used to refresh your access_token later\n \"expires_at\"=>1324720198, # when the access token expires (Meetup tokens expire in 1 hour)\n \"expires\"=>true\n },\n \"extra\"=> {\n \"raw_info\"=> {\n \"lon\"=>-90.027181,\n \"link\"=>\"http://www.meetup.com/members/111\",\n \"lang\"=>\"en_US\",\n \"photo\"=> {\n \"photo_link\"=> \"http://photos3.meetupstatic.com/photos/member_pic_111.jpeg\",\n \"highres_link\"=> \"http://photos1.meetupstatic.com/photos/member_pic_111_hires.jpeg\",\n \"thumb_link\"=> \"http://photos1.meetupstatic.com/photos/member_pic_111_thumb.jpeg\",\n \"photo_id\"=>111\n },\n \"city\"=>\"Memphis\",\n \"state\" => \"TN\",\n \"country\"=>\"us\",\n \"visited\"=>1325001005000,\n \"id\"=>12345,\n \"topics\"=>[],\n \"joined\"=>1147652858000,\n \"name\"=>\"elvis\",\n \"other_services\"=> {\"twitter\"=>{\"identifier\"=>\"@elvis\"}},\n \"lat\"=>35.046677\n }\n }\n }\n end", "def userinfo\n if @user.nil?\n nil\n elsif @password.nil?\n @user\n else\n @user + ':' + @password\n end\n end", "def omniauth_params\n request.env['omniauth.auth'].to_hash\n end", "def omniauth_params\n request.env['omniauth.auth'].to_hash\n end", "def generate_onetime_login_hash(email)\n begin\n JSON.parse(RestClient.get construct_url(\"user/generate_one_time_hash/#{email}\"))\n rescue RestClient::BadRequest => e\n @last_error = e.http_body\n @last_error_code = e.http_code\n false\n end\n end", "def username\n @digest_parts['username']\n end", "def sign_user_token(email, salt)\n Digest::MD5.hexdigest(\"#{email}:#{salt}\")\n end", "def getUserDetails\n\t\tuser = java.util.HashMap.new()\n\t\t# user name\n\t\tuser.put(KEY_NAME, @pref.getString(KEY_NAME, nil))\n\t\t\n\t\t# user email id\n\t\tuser.put(KEY_EMAIL, @pref.getString(KEY_EMAIL, nil))\n\t\t\n\t\t# return user\n\t\treturn user;\n\tend", "def user_to_hash(user)\n { \"id\" => user[\"_id\"].to_s, \"uid\" => user[\"uid\"], \"name\" => user[\"name\"], \"email\" => user[\"email\"] }\nend", "def user_to_hash(user)\n { \"id\" => user[\"_id\"].to_s, \"uid\" => user[\"uid\"], \"name\" => user[\"name\"], \"email\" => user[\"email\"] }\nend", "def auth_user_id\n auth[:user_id]\n end", "def user_info\n @user_info ||= raw_info\n end", "def m\n @m ||= sha256_hex(n_xor_g_long, login_hash, @user.salt.to_s(16), aa, bb, k)\n end", "def get_hash(input)\n return $hasher.reset.update(input).to_s\nend", "def hash!\n\t\t@@email.downcase!\n\t\thash = Digest::MD5.hexdigest(@@email)\n\t\treturn hash\n\tend", "def get_user_info\n get(\"/api/v1/oauth_user_info.json\")\n end", "def user\n hash = {\n provider: 'josh_id',\n id: current_user.id.to_s,\n info: {\n email: current_user.email,\n username: current_user.username,\n #first_name: current_user.first_name,\n }\n }\n\n render json: hash.to_json\n end", "def hash\n [uri, parameters, username, password, verify_mode].hash\n end", "def omniauth\n request.env[\"omniauth.auth\"]\n end", "def get_hash\n\t\treturn { name: self.name, email: self.email }\n\tend", "def user_data\n {\n user_id: @user.id,\n email: @user.email\n }\n end", "def hash\n guid.hash\n end", "def digest(string)\n User.digest(string, self.password_salt)\n end", "def hash_string(value)\n return case password_hash_type\n when 'md5' then Digest::MD5.hexdigest(value + self.password_salt)\n end\n end", "def get_user_from_ethereum\n user_id = Md5UserExtendedDetail.get_user_id(@client_id, @ethereum_address)\n @user = User.get_from_memcache(user_id)\n end", "def hubssolib_get_user_address\n user = self.hubssolib_current_user\n user ? user.user_email : nil\n end", "def user_info\n @user_info ||= raw_info.nil? ? {} : raw_info\n end", "def user_info\n @user_info ||= raw_info.nil? ? {} : raw_info\n end", "def omniauth\n request.env['omniauth.auth']\n end", "def omniauth\n request.env['omniauth.auth']\n end", "def omniauth\n request.env['omniauth.auth']\n end", "def to_s\n user_key\n end", "def to_s\n user_key\n end", "def hashed_password\n @hashed_password ||= Digest::MD5.hexdigest(\"#{name}:mongo:#{password}\")\n end", "def get_password_hash\n if account_password_hash_column\n account![account_password_hash_column]\n elsif use_database_authentication_functions?\n db.get(Sequel.function(function_name(:rodauth_get_salt), account ? account_id : session_value))\n else\n # :nocov:\n password_hash_ds.get(password_hash_column)\n # :nocov:\n end\n end", "def sha\n result_hash['sha']\n end", "def get_user_info()\n return_map = nil\n if session[:google_unique] != nil && user_credentials.access_token != nil\n return_map = {}\n return_map['email'] = session[:googleemail]\n return_map['sub'] = session[:google_unique]\n return_map['useralias'] = session[:useralias]\n end\n return return_map\nend", "def user_token\n google_account.id.to_s\n end", "def hash\n [type, page_access_token, app_id, app_secret, account_sid, auth_token, phone_number_sid, token, channel_access_token, encoding_aes_key, from_address, certificate, password, auto_update_badge, server_key, sender_id, consumer_key, consumer_secret, access_token_key, access_token_secret].hash\n end", "def get_user_info\n userTokenInfo = request.env['oauth.token']\n @user = userTokenInfo.user\n end", "def authorization_hash\n Base64.encode64(\"#{BASIC_AUTH.fetch(:username)}:#{BASIC_AUTH.fetch(:password)}\").strip\n end", "def user_key\n retval = nil\n retval = self.email if self.email.present?\n if retval.blank? && self.nickname.present?\n retval = self.nickname\n end\n if retval.blank? && self.first_name.present?\n\n retval = self.first_name\n if self.last_name.present?\n retval = retval + self.last_name\n end\n end\n if retval.blank? && self.name.present?\n retval = self.name\n end\n retval\n end", "def info\n {\n email: username\n }\n end", "def digest\n Digest::MD5.hexdigest(id.to_s+Interactiff::Application.config.secret_token).to_i(16).to_s[3,8]\n end", "def unique_hash\n\t\tif self.unique_token.blank?\n\t\t\tupdate_attribute(:unique_token, Devise.friendly_token[0,50].to_s)\n\t\tend\n\t\tDigest::SHA2.hexdigest(self.unique_token + id.to_s)\n\tend", "def hash\n [grant_type, code, refresh_token, redirect_uri, client_id, client_secret].hash\n end", "def token_hash(auth_code = T.unsafe(nil), headers = T.unsafe(nil)); end", "def user_from_omniauth\n IdentifierScheme.for_users.each do |scheme|\n omniauth_hash = session.fetch(\"devise.#{scheme.name}_data\", {})\n next if omniauth_hash.empty?\n\n return ::User.from_omniauth(scheme_name: scheme.name, omniauth_hash: omniauth_hash)\n end\n nil\n end", "def create_from_omniauth(omniauth_hash)\n info_hash = omniauth_hash['info']\n return nil unless email = info_hash && info_hash['email']\n user = User.new\n user.credentials << Credentials::Email.new(email: email, verified: true)\n user.save!\n user\n end" ]
[ "0.73344475", "0.71055675", "0.69837326", "0.69754326", "0.6938071", "0.6927372", "0.6882496", "0.6882496", "0.6882496", "0.6882496", "0.6882496", "0.6882496", "0.6793636", "0.67863935", "0.6696307", "0.6679914", "0.65857804", "0.656548", "0.65444183", "0.64659125", "0.64569956", "0.645401", "0.6446326", "0.6446126", "0.6437662", "0.6427693", "0.6427693", "0.64229214", "0.6362767", "0.6355366", "0.6340299", "0.632038", "0.63077587", "0.6285269", "0.62544245", "0.6249942", "0.62002856", "0.6178432", "0.61554724", "0.6133607", "0.61226857", "0.6115636", "0.61043483", "0.6097249", "0.6093794", "0.6088957", "0.6088376", "0.60792035", "0.6048508", "0.6041383", "0.6039575", "0.6032325", "0.6019398", "0.6012312", "0.59994686", "0.59994686", "0.598029", "0.597265", "0.59726393", "0.59722155", "0.59690344", "0.59690344", "0.5966757", "0.5965647", "0.59595644", "0.5954384", "0.5951157", "0.59392893", "0.59358615", "0.59339917", "0.5930721", "0.5924339", "0.59236306", "0.5919263", "0.59084815", "0.5895851", "0.5895236", "0.58931106", "0.58893085", "0.58893085", "0.5888862", "0.5888862", "0.5888544", "0.5887333", "0.5887333", "0.58858347", "0.58839905", "0.5883265", "0.58822805", "0.58809704", "0.58678013", "0.58644235", "0.58400744", "0.5839715", "0.5836778", "0.5828111", "0.58179283", "0.58102655", "0.5810196", "0.5806405", "0.5801939" ]
0.0
-1
Go to index if signed out
def home if !view_context.signed_in? redirect_to '/' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n redirect_to(:action => 'login') #unless logged_in? || User.count > 0\n end", "def index_corruption?; end", "def index\n redirect_to(:action => 'login') unless logged_in? \n end", "def index\n # if !user_signed_in?\n # redirect_to new_user_session_path\n # end\n end", "def index\n redirect_to disabled_path\n # unless logged_in?\n # redirect_to tour_path\n # else\n # @current_item = \"my_hsa\"\n # end\n end", "def redirect_to_index\n redirect_to :action => 'index' unless current_user\n @user = current_user\n end", "def index\n # Reset the session enduser\n session[:enduser] = '0'\n\tend", "def index\n if session[:user_id] != nil \n redirect_to '/home'\n end\n end", "def index\n if session[:user_id] != nil \n redirect_to '/home'\n end\n end", "def index\n redirect_to(:action => 'login') and return unless logged_in?\n \n @user = current_user\n end", "def index\n # Never show a hacker list.\n redirect_to entries_path\n end", "def index\n redirect_to @current_user if current_user\n end", "def index\n head :unauthorized\n end", "def index\n if user_signed_in?\n redirect_to home_path\n end\n end", "def index\n if user_signed_in?\n redirect_to home_path\n end\n end", "def index?; end", "def index\n redirect_to after_sign_in_path_for current_user if current_user\n end", "def index\n redirect_to after_sign_in_path_for current_user if current_user\n end", "def index\n redirect_to(:action => 'signup') unless logged_in? || User.count > 0\n end", "def index\n redirect_to(:action => 'signup') unless logged_in? || User.count > 0\n end", "def index\n redirect_to(:action => 'signup') unless logged_in? || User.count > 0\n end", "def index\n redirect_back_or_default \"/\"\n end", "def index\n redirect_to current_user\n end", "def index\n # Handle bookmarked or otherwise incorrect GETs to the login action\n if request.method == :get\n redirect_to login_path\n else\n redirect_to vault_dashboard_path\n end\n end", "def index\n redirect_to(:action => 'signup') unless logged_in? or User.count > 0\n end", "def index\n redirect_to(:action => 'signup') unless logged_in? or User.count > 0\n end", "def index\n redirect_to accounts_path, notice:'Entries can only be accsessed through Accounts'\n end", "def index\r\n redirect_to :action => :login\r\n end", "def index\n session[ :current_user_id ] = nil\n end", "def index\n redirect_to user_path(current_user)\n end", "def index?\n user.present?\n end", "def index\n # Handle bookmarked or otherwise incorrect GETs to the login action\n if request.method == :get\n redirect_to login_path\n else\n redirect_to member_home_path\n end\n end", "def index\n if signed_in?\n redirect_to current_user\n else\n redirect_to new_user_path\n end\n end", "def index\n # If someone is signed in on the browser\n if signed_in?\n # Take the user to their profile page\n redirect_to \"/#{@current_user.name}\"\n # Abort execution\n return\n end\n \n # Don't use an application layout.\n render layout: false\n end", "def index\n if !user_signed_in?\n redirect_to home_path\n elsif current_user.admin?\n redirect_to admin_portal_path\n else\n redirect_to portal_path\n end\n end", "def index\n controversial\n end", "def index\n if !session[:token].nil?\n if (session[:user_id] == 'superadmin')\n redirect_to admin_companies_path\n else\n redirect_to dashboard_path\n end\n else\n render layout: false\n end\n end", "def index\n\t\tif signed_in?\n \t\t user=User.find(session[:user_id])\n \t\tcase user.role\n \twhen \"s\"\n \t\tredirect_to supervisor_index_path and return\n \twhen \"a\"\n \t redirect_to receptionnist_index_path and return\n \tend\t\n \tend\n\tend", "def index\n # Insert ruby code...\n redirect_to home_path if current_user\n end", "def index\n if is_logged_in\n redirect_to(:action=>'list')\n end\n #all logic in login_redirect_logic\n end", "def redirect_to_404_if_not_authorized\n\n # Admin should not be allowed to act like a regular user, i.e. view personal accounts, transactions, etc.\n redirect_to_login_if_admin\n\n # If the user calls the index for their account, it's a GET request identifying the user by the session, hence not no need for further authentication\n unless(params.has_key?(:account_id))\n return\n end\n\n # Authentication for transactions for a specific account, authentication needs to be done\n unless(params.has_key?(:account_id) && Account.exists?(params[:account_id]) && Account.find(params[:account_id]).user_id == current_user.id)\n redirect_to_404 # Render 404 page\n end\n end", "def index\n session[:arr_instr_info] = []\n session[:submiss_title] = ''\n redirect_to(:action => 'signup') unless logged_in? || User.count > 0\n end", "def index; redirect_to '/'; end", "def index?\n false\n end", "def index?\n false\n end", "def index?\n false\n end", "def index\n if not current_user.role? :admin\n redirect_to root_path\n end\n end", "def index\n @current_user = current_user if signed_in?\n end", "def index\n redirect_to not_found_path\n end", "def index\n redirect_to root_path\n end", "def index\n redirect_to :action => \"edit\" and return\n end", "def authorized\n redirect_to :controller => 'home', :action => 'index' unless logged_in?\n end", "def index\n prevent_non_admin\n end", "def delete\n if (session['logged_in'] != 1) \n redirect_to url_for(:controller => :user, :action => :index_not_logged_in) and return\n end\n end", "def index\n\n #Make sure only logged in admins can manipulate users\n\n if @loggedinuser && @loggedinuser.authorizationlevel >= 4\n else \n redirect_to '/'\n end\n end", "def signed_user_unnecessary_pages\n if signed_in?\n redirect_to(root_path)\n end\n end", "def index\n redirect_to :nieuw if current_user\n end", "def index\n if user_signed_in?\n redirect_to dashboard_path\n else\n render :index\n #redirect_to new_user_session_url(subdomain: ENV[\"SUBDOMAIN\"])\n end\n end", "def index\n if logged_in\n redirect_to profile_path\n end\n end", "def index\n redirect_to root_path\n end", "def index\n redirect_to :back\n rescue ActionController::RedirectBackError\n redirect_to root_path\n end", "def show\n if current_user.access == 2\n redirect_to \"/users/indexU\"\n end\n end", "def index\n redirect_to root_path\n end", "def index\n redirect_to root_path\n end", "def index\n redirect_to root_path\n end", "def index\n redirect_to root_path\n end", "def index\n redirect_to root_path\n end", "def index\n # set_user, is the only action taken here\n end", "def index\n # set_user, is the only action taken here\n end", "def index\n redirect_to user_path(@user)\n end", "def index\n redirect_to \"/\"\n end", "def index\n redirect_to \"/\"\n end", "def index\n redirect_to \"/\"\n end", "def index\n \t\n end", "def index\n \t\n end", "def index\n @pagina_principals = PaginaPrincipal.all\n def index\n if( !(session[:cafe] != nil && session[:cafe] != '') )\n redirect_to '/'\n end\n end\n end", "def index\n \n end", "def index\n \tif current_user\n\t\tredirect_to home_profile_path\n\tend\n end", "def index\n @role = session[:role]\n @househunters = Househunter.all\n if session[:role] != \"admin\"\n redirect_to login_path, notice: \"You are not allowed to access that url\"\n end\n end", "def index ; @index ; end", "def index\n # No one should be here\n redirect_to root_url\n end", "def index\n redirect_to '/'\n end", "def index\n # The hook below can access controller's instance variables.\n if current_user\n if current_user.role?:livia_admin\n redirect_to companies_url\n elsif is_secretary_or_team_manager?\n redirect_to \"/wfm/notes\"\n elsif current_user.end_user\n redirect_to physical_clientservices_home_index_path\n elsif is_client\n redirect_to matter_clients_url\n elsif current_user.role?:lawfirm_admin\n redirect_to lawfirm_admins_url\n return\n end\n else\n flash[:error] = t(:flash_DB_error)\n redirect_to login_url\n end\n end", "def index_user\n p \"*\" * 50\n p \"index_user\"\n if current_user.status == \"teacher\" || current_user.admin?# && !current_user?(user)\n user_id = current_user.id\n @user = User.find(user_id)\n @exercises = Exercise.where(user_id: @user.id)\n elsif current_user.status == \"student\"\n redirect_to(current_user)\n end\n \n end", "def index\n session[:current_user_id] = ''\n render 'layouts/application'\n\n end", "def index\n redirect_to root_url\n end", "def index\n redirect_to root_url\n end", "def index\n redirect_to root_url\n end", "def show\n if not signed_in?\n redirect_back_or signin_path\n end\n end", "def index\n if can?(:>=, \"5\")\n else\n redirect_to main_app.unauthorized_url\n end\n end", "def index\n\t\tredirect_to dashboard_users_path if current_user\n\tend", "def index\n if current_user\n @user = current_user\n @stacks = current_user.stacks\n authorize @stacks\n #set up stack for user to go back to when he click 'back'\n @default_stack = current_user.stacks.where(default: true).first\n else\n flash[:notice] = \"You can not view this page.\"\n redirect_to new_user_session_path\n end\n end", "def index\n redirect_to(new_session_path)\n end", "def index\n\t\tif SITE_LOCKED && !logged_in?\n\t\t\trender \"site_lock\"\n\t\tend\n\tend", "def index_redirect(**opt, &blk)\n opt[:user] = find_user(opt[:user] || current_user || @user)\n opt[:dst] = opt[:user]&.administrator? ? :list_all : :show\n super(**opt, &blk)\n end", "def index\n # so the login form can capture it and pass it on, so we can\n # return there.\n @referer = params[:referer] || request.referer\n end", "def index\n if logged_in?\n redirect_to :controller => 'account', :action => 'mypage'\n else\n if User.count > 0\n redirect_to :controller => 'account', :action => 'signup'\n else\n redirect_to :controller => 'recommend', :action => 'question'\n end\n end\n end", "def index?\n true\n end", "def index?\n true\n end", "def index?\n true\n end", "def index?\n true\n end" ]
[ "0.6618343", "0.6537232", "0.6519096", "0.6436865", "0.63356555", "0.63183683", "0.6230366", "0.6205425", "0.6205425", "0.61788887", "0.611416", "0.61067694", "0.6098385", "0.6061535", "0.6061535", "0.6059238", "0.6006852", "0.6006852", "0.59912", "0.59912", "0.59912", "0.59840477", "0.5980877", "0.5978886", "0.596872", "0.596872", "0.5951199", "0.5950722", "0.5943134", "0.5934579", "0.59190494", "0.5917935", "0.5905444", "0.58904654", "0.5889366", "0.5874922", "0.58617777", "0.58603835", "0.58577657", "0.5844175", "0.5830381", "0.5822408", "0.58165747", "0.5801137", "0.5800962", "0.5800962", "0.5797001", "0.5795506", "0.5785739", "0.5780715", "0.57776195", "0.5770852", "0.5769859", "0.5765057", "0.5758508", "0.57515675", "0.5739178", "0.5726436", "0.572048", "0.5708345", "0.56994945", "0.5698314", "0.56948507", "0.56948507", "0.56948507", "0.56948507", "0.56948507", "0.56946015", "0.56946015", "0.5671465", "0.56654006", "0.56654006", "0.56654006", "0.56641144", "0.56641144", "0.5661303", "0.5657509", "0.5648585", "0.56369567", "0.5635539", "0.56242514", "0.561818", "0.56111187", "0.56101435", "0.5610018", "0.5607959", "0.5607959", "0.5607959", "0.5606724", "0.5604061", "0.55947316", "0.5593897", "0.5592979", "0.55906564", "0.5589561", "0.5585718", "0.5585453", "0.5573068", "0.5573068", "0.5573068", "0.5573068" ]
0.0
-1
def record_not_found head :not_found end
def error(status, code, message) render :json => {:response_type => "ERROR", :response_code => code, :message => message}.to_json, :status => status end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def not_found; end", "def record_not_found\n render 'shared/not_found' # Assuming you have a template named 'record_not_found'\n end", "def record_not_found!\n render partial: 'errors/404', status: 404 && return\n end", "def record_not_found\n render file: 'public/404.zh-TW.html', stats: :not_found\n end", "def record_not_found\n render json: { error: { message: 'Record not found.' }}, status: :not_found\n end", "def record_not_found\n render json: {\n error: 'Record not found.'\n }, status: :not_found\n end", "def record_not_found\n render json: \"Record not found\", status: 404\n end", "def not_found\n\n render_error( :not_found )\n\n end", "def not_found\n render status: :not_found\n end", "def record_not_found\n redirect_to four_oh_four_url\n end", "def record_not_found\n render json: {error: I18n.t('errors.not_found')}.to_json, status: 404\n end", "def record_not_found\n \t\trender :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n \tend", "def record_not_found\n render json: {error: \"Record not found\"}.to_json, status: 404\n end", "def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end", "def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end", "def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end", "def record_not_found\n ActiveRecord::RecordNotFound\n end", "def record_not_found\n render :json => {:success=>false, :error_code => 404, :error_msg=>\"Record not Found\"}\n end", "def create_record_for_not_found_response; end", "def record_not_found\n render file: \"#{Rails.root}/public/404.html\", layout: false, status: :not_found\n end", "def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end", "def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end", "def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end", "def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end", "def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end", "def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end", "def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end", "def record_not_found\n redirect_to(\"#{BASE_DOMAIN}/infos/lost/\")\n end", "def not_found\n render plain: \"not found\"\n end", "def record_not_found\n render json: ErrorSerializer.serialize({ record: \"Record not found.\" }), status: :not_found\n end", "def record_not_found\n render :file => File.join(::Rails.root.to_s, 'public', '404.html'), :status => 404\n end", "def record_not_found(exception)\n log_error(exception, request.fullpath)\n render \"errors/record_not_found\"\n end", "def not_found\n render_error status: :not_found, body: 'page not found'\n end", "def record_not_found(error)\n render json: {\n success: false,\n message: error.message\n }, status: :record_not_found\n end", "def not_found\n render nothing: true, status: 404\n end", "def not_found\n\t\tself.status = 404\n\t\tself.headers = {}\n\t\tself.content = [\"Nothing Found\"]\n\t\tself\n\tend", "def record_not_found\n raise ActiveRecord::RecordNotFound\n end", "def not_found\n render :nothing => true, :status => 404\n end", "def render_record_not_found\n render :template => \"error/404\", :status => 404\n end", "def record_not_found\n render :file => Rails.root.join('public','404.html'), :status => \"404 Not Found\", layout: false\n end", "def not_found\n respond_not_found\n end", "def record_not_found\n render :partial => \"shared/error\", :layout => \"one_box\", :status => 404, :locals => {:error_title => 'No hemos encontrado lo que buscabas', :error_message => 'Puedes haber tecleado mal la dirección o la página puede haber sido movida.'}\n end", "def not_found\n status 404\n body \"not found\\n\"\n end", "def not_found\n status 404\n body \"not found\\n\"\n end", "def not_found\n status 404\n body \"not found\\n\"\n end", "def not_found\n render json: nil, status: :not_found\n end", "def not_found\n respond_with 404\n end", "def show_not_found\n controller.show_not_found\n end", "def record_not_found\n flash[:danger] = 'Record Not Found'\n redirect_to (request.referrer || root_path)\n end", "def blank; render :plain => \"Not Found.\", :status => 404 end", "def not_found\n self.status = 404\n return unless body.empty?\n self.body = \"Not found: #{request.path}\"\n headers['Content-Type'] = 'text/plain'\n headers['X-Cascade'] = 'pass'\n headers['Cache-Control'] = 'nocache'\n end", "def page_not_found\n render_404\n end", "def record_not_found\n flash[:error] = \"You don't have this record.\"\n redirect_to '/'\n end", "def return_not_found\n return_error(error_code: 404, message: 'Not Found')\n end", "def render_record_not_found_message\n render json: {error: \"Student not found\"}, status: :not_found\n end", "def render_404\n render template: '/shared/record_not_found', layout: false, status: :not_found\n end", "def not_found\n render :status => 404\n end", "def render_record_not_found\n record_name = !controller_name.blank? ? controller_name.singularize.titleize : \"Record\"\n respond_with(nil, :status => {:msg => \"#{record_name} not found\", :code => 404})\n end", "def show_not_found\n render_json_error(code: :show_not_found, status: :not_found)\n end", "def not_found\n response_error(code: 404, message: 'Object not found.')\n end", "def record_not_found(error)\n render(\n json:{\n errors:[{\n type: error.class.to_s,\n message:error.message\n }]\n }\n )\n end", "def not_found!\n [404, {\"Content-Type\" => \"text/plain\"}, [\"Jsus doesn't know anything about this entity\"]]\n end", "def record_not_found\n puts \"RecordNotFound\"\n redirect_to request.referrer || root_path\n end", "def not_found\n respond_with 404\n end", "def not_found\n res = {\n error: 'ost_page_not_found',\n error_display_text: 'Page not found',\n http_code: GlobalConstant::ErrorCode.not_found\n }\n @response = Result::Base.error(res)\n render_error_response_for(@response)\n end", "def not_found\n res = {\n error: 'ost_page_not_found',\n error_display_text: 'Page not found',\n http_code: GlobalConstant::ErrorCode.not_found\n }\n @response = Result::Base.error(res)\n render_error_response_for(@response)\n end", "def not_found\n res = {\n error: 'ost_page_not_found',\n error_display_text: 'Page not found',\n http_code: GlobalConstant::ErrorCode.not_found\n }\n @response = Result::Base.error(res)\n render_error_response_for(@response)\n end", "def record_not_found\r\n if %w{m mobile}.any? {|subdomain| subdomain == request.subdomain}\r\n render 'welcome/mobile/404', :layout => 'mobile', :status => 404\r\n return\r\n end\r\n render :file => File.join(Rails.root, 'public', '404.html'), :status => 404\r\n end", "def not_found\n\n r = Result::Base.error(\n {\n internal_id: 'ac_1',\n general_error_identifier: 'resource_not_found',\n http_code: GlobalConstant::ErrorCode.not_found\n }\n )\n\n return render_api_response(r)\n\n end", "def rescue_not_found\n render nothing: true, status: 404\n end", "def check_404\n end", "def record_not_found\n yield\n rescue ActiveRecord::RecordNotFound\n redirect_to posts_path, :flash => { :alert => \"Record not found.\" }\n end", "def not_found\n render(\n json: {\n errors: [{\n type: \"Not Found\"\n }]\n },\n status: :not_found #alias for 404 in rails\n )\n end", "def response_not_found\n render status: 404,\n json: {\n source: {\n pointer: request.original_url\n },\n errors: [ { message: \"Not Found\" } ]\n }\n end", "def handle_not_found(exception)\n raise exception\n end", "def not_found\n render json: { error: { message: 'There was nothing found at this address.' }}, status: :not_found\n end", "def document_not_found\n render \"common/document_not_found\"\n end", "def not_found\n logger.error \"404 from #{request.referer}\"\n render :template => 'errors/404', :status => 404\n end", "def not_found\n render :template => \"shared/rescues/not_found\", :status => 404 \n end", "def page_not_found\n respond_to do |format|\n\t format.html { render template: 'errors/not_found_error', layout: 'layouts/application', status: 404 }\n\t format.all { render nothing: true, status: 404 }\n\t end\n end", "def catch_not_found\n yield\n rescue ActiveRecord::RecordNotFound\n flash[:notice] = \"Hittades inte\"\n redirect_to root_url\n end", "def show_404\n show_error 'Page Not Found', :not_found\n end", "def record_not_found\n\t\tflash[:alert] = \"Cannot find record number \" + params[:id] + \". Displaying all records.\"\n\t\tredirect_to root_path \n\tend", "def object_not_found\n render json: 'Object not found', status: :not_found\n end", "def record_not_found_error\n if Rails.env == 'development'\n render # will give us the stack trace\n else\n flash[:notice] = I18n.t('blacklight.search.errors.invalid_solr_id')\n params.delete(:id)\n index\n render 'index', :status => 404\n end\n end", "def handle_resource_not_found(msg = 'Not found.')\r\n flash.now[:notice] = msg\r\n @web_analytics.page_stack = ['Admin', 'Resource Not Found']\r\n @web_analytics.error_page = true\r\n @left_rail_ad_pixels = -1 # make sure no ads are shown\r\n render :template => 'common/resource_not_found', :status => 404, :layout => 'application'\r\n false\r\n end", "def not_found generator, req, res, message = nil\n message ||= \"The page <kbd>#{ERB::Util.h req.path}</kbd> was not found\"\n res.body = generator.generate_servlet_not_found message\n res.status = 404\n end", "def not_found\n render :format => :html\n end", "def not_found(&block)\n error 404, &block\n end", "def not_found(body = nil)\n error(404, body)\n end", "def not_found\n render(status: :not_found, json: { errors: [{\n status: '404', code: :not_found, title: 'Not Found'\n }]})\n # render jsonapi: nil, code: 404, title: 'Invalid Path', detail: params[:path], status: :not_found\n end", "def not_found\n rescue_404(ActionController::RoutingError.new(\"No route matches #{request.request_method} #{request.path}\"))\n end", "def render_not_found\n\t\tflash[:notice] = 'The object you tried to access does not exist!'\n\t\tredirect_to root_path\n\tend", "def catch_not_found\n yield\n rescue ActiveRecord::RecordNotFound\n redirect_to root_url, :flash => { :error => \"Nº de protocolo inexistente!\" }\n end", "def not_found\n content_type(\"text/plain\")\n @headers << \"HTTP/1.1 404 Not Found\\r\\nServer: Rsws/0.1.0\\r\\n\"\n puts \"#{@method} #{@path} 404 Not Found\"\n send\n end", "def not_found\n @not_found = yield\n end", "def render_404\n redirect_to not_found_path\n end", "def status_not_found\n @status = 404\n @e.error 'The requested page does not exist.', 404\n throw :exit\n end", "def error_route_not_found\n render 'errors/route_not_found', status: :not_found rescue last_chance\n end", "def not_found(options={}, &b)\n error NotFound, options, &b\n end", "def not_found\n #render :file => \"#{RAILS_ROOT}/public/404.html\"\n render_optional_error_file(404)\n return false\n end" ]
[ "0.84997445", "0.8062281", "0.7952498", "0.7915873", "0.7879534", "0.78600055", "0.78586394", "0.7848627", "0.78346914", "0.7783232", "0.76712215", "0.76682985", "0.7618748", "0.76056796", "0.76056796", "0.76056796", "0.7598709", "0.7591212", "0.75892204", "0.75778055", "0.75745165", "0.75745165", "0.75745165", "0.75745165", "0.75745165", "0.75745165", "0.75745165", "0.75742733", "0.7571", "0.75600404", "0.75591797", "0.75466037", "0.75355273", "0.75172925", "0.7502398", "0.7501393", "0.74824697", "0.74783987", "0.7473988", "0.7468873", "0.7468554", "0.74556446", "0.73936796", "0.73936796", "0.73936796", "0.73900783", "0.7379064", "0.734081", "0.7340419", "0.7334441", "0.7321182", "0.72896373", "0.72708446", "0.72683287", "0.72475433", "0.7246187", "0.7239989", "0.72397804", "0.7225338", "0.7223393", "0.72170484", "0.721596", "0.72001517", "0.7194691", "0.7163237", "0.7163237", "0.7163237", "0.7160436", "0.71416485", "0.7141308", "0.71410406", "0.71175075", "0.711614", "0.70974404", "0.7056655", "0.7043358", "0.7040461", "0.7028282", "0.7026955", "0.70206714", "0.7008224", "0.70019317", "0.69985473", "0.6992229", "0.69740987", "0.69675684", "0.69652134", "0.6963435", "0.695637", "0.6943365", "0.6928635", "0.69208664", "0.69159836", "0.69150853", "0.6899741", "0.6887122", "0.68775636", "0.6876568", "0.6823053", "0.6810621", "0.68081796" ]
0.0
-1