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
Finds the proper spec command to use. Precendence is set in the lazilyevaluated method spec_commands. Alias + Override that in ~/.autotest to provide a different spec command then the default paths provided.
def spec_command(separator=File::ALT_SEPARATOR) unless defined? @spec_command then @spec_command = spec_commands.find { |cmd| File.exists? cmd } raise RspecCommandError, "No spec command could be found!" unless @spec_command @spec_command.gsub! File::SEPARATOR, separator if separator end @spec_command end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spec_commands\n [File.join(Config::CONFIG['bindir'], 'spec'), 'spec']\n end", "def spec_commands\n [File.join(Config::CONFIG['bindir'], 'spec'), 'spec']\n end", "def spec_commands\n [File.join(Config::CONFIG['bindir'], 'spec'), 'spec']\n end", "def spec_commands\n [\n File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'bin', 'spec')),\n File.join(Config::CONFIG['bindir'], 'spec')\n ]\n end", "def spec_command(separator=File::ALT_SEPARATOR)\n unless defined?(@spec_command)\n @spec_command = spec_commands.find { |cmd| File.exists?(cmd) }\n\n raise RspecCommandError, \"No spec command could be found\" unless @spec_command\n\n @spec_command.gsub!(File::SEPARATOR, separator) if separator\n end\n @spec_command\n end", "def spec_command(separator=File::ALT_SEPARATOR)\n unless defined?(@spec_command)\n @spec_command = spec_commands.find { |cmd| File.exists?(cmd) }\n\n raise RspecCommandError, \"No spec command could be found\" unless @spec_command\n\n @spec_command.gsub!(File::SEPARATOR, separator) if separator\n end\n @spec_command\n end", "def spec_command(separator=File::ALT_SEPARATOR)\n unless defined?(@spec_command)\n @spec_command = spec_commands.find { |cmd| File.exists?(cmd) }\n\n raise RspecCommandError, \"No spec command could be found\" unless @spec_command\n\n @spec_command.gsub!(File::SEPARATOR, separator) if separator\n end\n @spec_command\n end", "def setup_spec(t)\n t.spec_opts = ['--options', \"\\\"#{RIGHT_BOT_ROOT}/spec/spec.opts\\\"\"]\n t.spec_files = FileList[\"#{RIGHT_BOT_ROOT}/**/spec/**/*_spec.rb\"]\n t\nend", "def command log\n test_command=\"\"\n\n log.scan(/^.*#([^\\n]*)\\n.*\\#\\ \\.([^\\n]*)\\:/m).each do |data|\n test_command+=\"spec \" if test_command.empty? \n test_command+=\".#{data[1]},\"\n end\n\n log.scan(/^.*#(\\w+)\\s?\\[(.*)\\]/).each do |data|\n test_command+=\"ruby -Itest #{data[0]} -n #{data[1]};\"\n end\n\n test_command\n end", "def test_automatically_provides_command_name_to_superclass\n assert_equal( 'asdoc', @cmd.command )\n end", "def create_spec(command)\n if command.kind_of? CommandSpec then\n command\n elsif command.kind_of? Command then\n command.to_command_spec\n elsif command.kind_of? Hash then\n CommandSpec.new(command)\n elsif command.kind_of? String then\n CommandSpec.from_json(command)\n elsif command.kind_of? Fixnum then\n Command.find(command).to_command_spec\n else\n command\n end\n end", "def test_run_with_help_command_and_explicit_command_name\n schema = Heroics::Schema.new(SAMPLE_SCHEMA)\n client = Heroics::client_from_schema(schema, 'https://example.com')\n output = StringIO.new\n command1 = Heroics::Command.new(\n 'cli', schema.resource('resource').link('list'), client, output)\n command2 = Heroics::Command.new(\n 'cli', schema.resource('resource').link('info'), client, output)\n cli = Heroics::CLI.new('cli', {'resource:list' => command1,\n 'resource:info' => command2}, output)\n cli.run('help', 'resource:info')\n expected = <<-USAGE\nUsage: cli resource:info <uuid_field>\n\nDescription:\n Show a sample resource\nUSAGE\n assert_equal(expected, output.string)\n end", "def spec_for(match, kind)\n File.join(\"spec\", kind + 's', \"#{match}_spec.rb\")\n end", "def component_test_full_commands(cmp)\n component_build_vars(cmp)['TEST_FULL_CMDS']\nend", "def spec_for(file)\n base = File.basename(file)\n extension = File.extname(base)\n dir = File.dirname(file)\n dir_array = dir.split('/')\n if extension == '.rb' and dir_array.first=='spec'\n return file\n end\n if extension == '.rb'\n base_without_extension = base[0, base.size - extension.size]\n spec_file = base_without_extension + '_spec' + extension\n else\n spec_file = base + '_spec.rb'\n end\n dir_array[0]='spec'\n spec_dir = dir_array.join('/')\n return File.join(spec_dir, spec_file)\n end", "def test_automatically_provides_command_name_to_superclass\n assert_equal( 'compc', @cmd.command )\n end", "def which(cmd); end", "def which(cmd); end", "def which(cmd); end", "def test_run_specific_directive\n with_fixture do\n out = capture_subprocess_io { system \"dotrun sample\" }\n assert !out.join.include?(\"default result\")\n assert_includes out.join, \"sample result\"\n end\n end", "def test_to_cmd_is_formatted_appropriately\n cmd = @cmd.to_cmd\n assert_match( /^asdoc\\s/, cmd )\n assert( cmd.include?( '-output=build/docs' ), 'Could not find output argument in to_cmd' )\n assert( cmd.include?( '-source-path+=test/fixtures/target,libs/src' ), 'Could not find source-path argument in to_cmd' )\n assert( cmd.include?( '-library-path+=libs/bin' ), 'Could not find library-path argument in to_cmd' )\n assert( cmd.include?( '-doc-sources=test/fixtures/target' ), 'Could not find doc-sources argument in to_cmd' )\n assert( cmd.include?( '-main-title=\"Testing API Documentation\"' ), 'Could not find main-title argument in to_cmd' )\n assert( cmd.include?( '-window-title=\"Testing API Documentation\"' ), 'Could not find window-title argument in to_cmd' )\n end", "def to_command_spec\n attrs = self.attributes\n attrs[\"repo\"] = File.basename(repo.path) # 'vendor' or '0001_test' etc\n attrs[\"bundle\"] = bundle.path\n return Bixby::CommandSpec.new(attrs)\n end", "def test_run_with_dashed_command_name\n schema = Heroics::Schema.new(SAMPLE_SCHEMA)\n client = Heroics::client_from_schema(schema, 'https://example.com')\n output = StringIO.new\n command = Heroics::Command.new(\n 'cli', schema.resource('resource').link('identify_resource'), client,\n output)\n cli = Heroics::CLI.new('cli', {'resource:identify-resource' => command},\n output)\n\n uuid = '1ab1c589-df46-40aa-b786-60e83b1efb10'\n Excon.stub(method: :get) do |request|\n assert_equal(\"/resource/#{uuid}\", request[:path])\n Excon.stubs.pop\n {status: 200}\n end\n\n cli.run('resource:identify-resource', uuid)\n assert_equal('', output.string)\n end", "def _resolve_command opts, cmd\n return cmd if opts.include? cmd\n matches = opts.grep Regexp.new(\"^#{cmd}\")\n end", "def spec\n File.join root, 'spec'\n end", "def spec\n File.join root, 'spec'\n end", "def cmd(c)\n @tpath = ''\n case File.basename(Dir.pwd)\n when 'bwkfanboy'\n # test probably is executed from the Rakefile\n @tpath = 'test/'\n 'bin/' + c\n when 'test'\n # we are probably in the test directory\n '../bin/' + c\n else\n # tests were invoked by 'gem check -t bwkfanboy'\n begin\n Dir.chdir(Bwkfanboy::Utils.gem_dir_system + '/../../test')\n '../bin/' + c\n rescue\n raise \"running tests from '#{Dir.pwd}' isn't supported: #{$!}\"\n end\n end\nend", "def test_command_should_default_to_default_command\n assert_equal \"git\", @source.command\n @source.local { assert_equal \"git\", @source.command }\n end", "def command\n case first\n when '\\?' then Command::HelpCommand\n when '\\config' then Command::PrintConfigCommand\n else\n puts \"Unknown command: #{buffer}\"\n end\n end", "def test_command_checks_for_binaries_each_time\n provider = newprovider\n\n provider.commands :testing => \"/no/such/path\"\n\n provider.stubs(:which).returns \"/no/such/path\"\n\n provider.command(:testing)\n assert_equal(\"/no/such/path\", provider.command(:testing), \"Did not return correct binary path\")\n end", "def binary(options = {})\n if Env.gem?('rspec', '< 2', options)\n 'spec'\n else\n 'rspec'\n end\n end", "def specification\n { selector: find_command, db_name: database.name, read: read }\n end", "def run_spec(chapter,problem)\n ch = \"#{File.dirname(__FILE__)}/ch#{chapter}\"\n if ENV['solved']\n problem_dir = \"#{ch}/solved/#{problem}.rb\"\n else\n problem_dir = Dir[\"#{ch}/challenge/#{problem}_*\"].first\n end \n sh \"ruby -c #{problem_dir}\" # check syntax\n sh \"rspec -cr #{problem_dir} -r enumerator #{ch}/spec/#{problem}.rb\" # run spec (c for colour, r to require the files, enumerator required for 1.8.6 compatibility)\nend", "def generate\n `rspec --init`\n end", "def rspec\n\tsystem('rspec --init')\nend", "def determine_facts_command\n facter_version = component_version(@facter_executable)\n\n if facter_version.match?(%r{^[0-2]\\.})\n [@facter_executable, '-p', '--json']\n elsif facter_version.match?(%r{^3\\.})\n [@facter_executable, '-p', '--json', '--show-legacy']\n else\n # facter 4\n determine_command_for_facter4\n end\n end", "def spec\n File.join root, 'spec'\n end", "def specfile\n Dir[\"#{@path}/[Ss]pecfile\"].first\n end", "def spec_name\n @@spec_names[__name__]\n end", "def run_specs(globs, spec_cmd='spec', run_opts = \"-c -f s\")\n require \"optparse\"\n require \"spec\"\n globs = globs.is_a?(Array) ? globs : [globs]\n examples, failures, errors, pending = 0, 0, 0, 0\n\n time = Benchmark.measure do\n globs.each do |glob|\n Dir[glob].each do |spec|\n response = Open3.popen3(\"#{spec_cmd} #{File.expand_path(spec)} #{run_opts}\") do |i,o,e|\n while out = o.gets\n STDOUT.puts out\n STDOUT.flush\n if out =~ /\\d+ example/\n e, f, p = out.match(/(\\d+) examples?, (\\d+) failures?(?:, (\\d+) pending?)?/)[1..-1]\n examples += e.to_i; failures += f.to_i; pending += p.to_i\n end\n end\n errors += 1 if e.is_a?(IO)\n STDOUT.puts e.read if e.is_a?(IO)\n end\n end\n end\n end\n\n puts\n puts \"*** TOTALS ***\"\n if failures == 0\n print \"\\e[32m\"\n else\n print \"\\e[31m\"\n end\n puts \"#{examples} examples, #{failures} failures, #{errors} errors, #{pending} pending, #{sprintf(\"suite run in %3.3f seconds\", time.real)}\"\n # TODO: we need to report pending examples all together\n print \"\\e[0m\"\nend", "def requireCMD(cmd_name, extraHelp = nil)\n if cmd_name.start_with?('./') || File.exist?(cmd_name)\n # Skip relative paths\n return\n end\n\n unless which(cmd_name).nil?\n # Command found\n return\n end\n\n # Windows specific checks\n if OS.windows?\n # There are a bunch of inbuilt stuff that aren't files so ignore them here\n case cmd_name\n when 'call'\n return\n when 'start'\n return\n when 'mklink'\n return\n end\n end\n\n # Print current search path\n puts ''\n info 'The following paths were searched for ' +\n pathExtsAsArray.map { |i| \"'#{cmd_name}#{i}'\" }.join(' or ') + \" but it wasn't found:\"\n\n pathAsArray.each do |p|\n puts p\n end\n\n onError \"Required program / tool '#{cmd_name}' is not installed or missing from path.\\n\" \\\n 'Please install it and make sure it is in path, then try again. ' \\\n '(path is printed above for reference)' + (\n extraHelp ? ' ' + extraHelp : '')\nend", "def requireCMD(cmdName, extraHelp = nil)\n\n if(cmdName.start_with? \"./\" or File.exists? cmdName)\n # Skip relative paths\n return\n end\n\n if which(cmdName) != nil\n # Command found\n return\n end\n\n # Windows specific checks\n if OS.windows?\n # There are a bunch of inbuilt stuff that aren't files so ignore them here\n case cmdName\n when \"call\"\n return\n when \"start\"\n return\n when \"mklink\"\n return\n end\n end\n\n # Print current search path\n puts \"\"\n info \"The following paths were searched for \" +\n pathExtsAsArray.map{|i| \"'#{cmdName}#{i}'\"}.join(' or ') + \" but it wasn't found:\"\n\n pathAsArray.each{|p|\n puts p\n }\n \n onError \"Required program / tool '#{cmdName}' is not installed or missing from path.\\n\" +\n \"Please install it and make sure it is in path, then try again. \" +\n \"(path is printed above for reference)\" + (\n if extraHelp then \" \" + extraHelp else \"\" end) \n \nend", "def spec(name)\n specs = if Gem::Specification.respond_to?(:each)\n Gem::Specification.find_all_by_name(name)\n else\n Gem.source_index.find_name(name)\n end\n\n spec = specs.sort_by{ |spec| Gem::Version.new(spec.version) }.first\n\n spec or raise CommandError, \"Gem `#{name}` not found\"\n end", "def define\n lib_path = @libs.join(File::PATH_SEPARATOR)\n desc \"Run specs\" + (@name==:spec ? \"\" : \" for #{@name}\")\n task @name do\n specs = file_list\n raise \"No spec files found.\" if specs.empty?\n \n spec = File.expand_path(File.dirname(__FILE__) + '/../../../bin/spec')\n file_prefix = @rcov ? \" -- \" : \"\"\n interpreter = @rcov ? \"rcov\" : \"ruby\"\n redirect = @out.nil? ? \"\" : \" > #{@out}\"\n\n @ruby_opts.unshift( \"-I#{lib_path}\" )\n @ruby_opts.unshift( \"-w\" ) if @warning\n @ruby_opts.unshift( '--exclude \"lib\\/spec\\/.*\"' ) if @rcov\n begin\n run interpreter, @ruby_opts.join(\" \") +\n \" \\\"#{spec}\\\" \" +\n \" #{@spec_opts.join(' ')} \" +\n file_prefix +\n specs.collect { |fn| \"\\\"#{fn}\\\"\" }.join(' ') +\n redirect\n rescue => e\n raise e if @fail_on_error\n end\n end\n self\n end", "def get_commands\n %w{ testchoose testnumberedmenu testdisplay_list testdisplay_text testdir saveas1 }\n end", "def test_run_default_directive\n with_fixture do\n out = capture_subprocess_io { system \"dotrun\" }\n assert_includes out.join, \"default result\"\n assert !out.join.include?(\"sample result\")\n end\n end", "def setup_rspec\n template('.rspec.tt', '.rspec')\n template('Rakefile.tt', 'Rakefile')\n template('spec/lib/versioned/version_spec.rb.tt', \"spec/#{version_path.sub(/\\.rb$/, '_spec.rb')}\")\n template('spec/lib/versioned_spec.rb.tt', \"spec/lib/#{namespaced_path}_spec.rb\")\n template('spec/spec_helper.rb.tt', 'spec/spec_helper.rb')\n end", "def create_test_command\n command :test do\n syntax = 'test [options] <file>'\n description = 'test description'\n example 'description', 'command'\n example 'description 2', 'command 2'\n option '-v', '--verbose', 'verbose description'\n when_called do |args, _options|\n format('test %s', args.join)\n end\n end\n @command = command :test\n\n\tcommand :nested do\n\t\tcommand :test do\n\t\tend\t\n\tend\n\t@nested_command = command :nested\nend", "def configure_command(cmd)\n end", "def which(cmd, opts = {})\n unless $awestruct_cmd.nil? || opts[:clear_cache]\n return $awestruct_cmd\n end\n\n $awestruct_cmd = nil\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n candidate = File.join path, \"#{cmd}#{ext}\"\n if File.executable? candidate\n $awestruct_cmd = candidate\n return $awestruct_cmd\n end\n end\n end\n return $awestruct_cmd\nend", "def cmd_path\n return @cmd_path unless @cmd_path.nil?\n\n @cmd_path = File.join(context.root_path, 'bin', cmd)\n # Return the path to the command if it exists on disk, or we have a gemfile (i.e. Bundled install)\n # The Bundle may be created after the prepare_invoke so if the file doesn't exist, it may not be an error\n return @cmd_path if PDK::Util::Filesystem.exist?(@cmd_path) || !PDK::Util::Bundler::BundleHelper.new.gemfile.nil?\n\n # But if there is no Gemfile AND cmd doesn't exist in the default path, we need to go searching...\n @cmd_path = alternate_bin_paths.map { |alternate_path| File.join(alternate_path, cmd) }\n .find { |path| PDK::Util::Filesystem.exist?(path) }\n return @cmd_path unless @cmd_path.nil?\n\n # If we can't find it anywhere, just let the OS find it\n @cmd_path = cmd\n end", "def determine_command_for_facter4\n puppet_version = component_version(@puppet_executable)\n\n if puppet_version.match?(%r{^6\\.})\n # puppet 6 with facter 4\n [@facter_executable, '--json', '--show-legacy']\n else\n # puppet 7 with facter 4\n [@puppet_executable, 'facts', 'show', '--show-legacy']\n end\n end", "def [](idx)\n result = specs[idx]\n result.is_a?(Array) ? PathSpec.new.tap {|p| p.specs = result} : result\n end", "def run_serverspec(target_specdir)\n $log.debug 'Running serverspec'\n cmd = \"cd #{target_specdir} && sudo rake spec\"\n $log.debug \"cmd=#{cmd}\"\n result = `#{cmd}`\n puts result\n end", "def test_run_with_help_command\n schema = Heroics::Schema.new(SAMPLE_SCHEMA)\n client = Heroics::client_from_schema(schema, 'https://example.com')\n output = StringIO.new\n command1 = Heroics::Command.new(\n 'cli', schema.resource('resource').link('list'), client, output)\n command2 = Heroics::Command.new(\n 'cli', schema.resource('resource').link('info'), client, output)\n cli = Heroics::CLI.new('cli', {'resource:list' => command1,\n 'resource:info' => command2}, output)\n cli.run('help')\n expected = <<-USAGE\nUsage: cli <command> [<parameter> [...]] [<body>]\n\nHelp topics, type \"cli help <topic>\" for more details:\n\n resource:info Show a sample resource\n resource:list Show all sample resources\nUSAGE\n assert_equal(expected, output.string)\n end", "def spec_short_name\n return self.spec.to_s.sub(\"#{ModMap.specs}::\", '')\n end", "def detect_command\n command = ENV['EDITOR_KICKER']\n return command if command\n bin = '/Applications/TextMate.app/Contents/Resources/mate'\n return \"#{bin} -l %s '%s'\" if test(?f, bin)\n return \"emacsclient -n +%s '%s'\"\n end", "def find(spec, options = {})\n get_path(path_to_find(spec), options)\n end", "def specs_with_shared_example(shared_example, path)\n command = \"grep -lrE 'it_should_behave_like .(#{shared_example}).' #{path}\"\n `#{command}`.split\n end", "def get_commands\n %w{ testchoosedir testchoosefile testnumberedmenu testdisplay_list testdisplay_text testdir }\n end", "def spec_name\n \"#{full_name}.gemspec\"\n end", "def spec\r\n @spec ||=\r\n begin\r\n require 'rubygems/specification'\r\n data = File.read('ruby-batch.gemspec')\r\n spec = nil\r\n Thread.new { spec = eval(\"$SAFE = 3\\n#{data}\") }.join\r\n spec\r\n end\r\nend", "def standard_commands\n {\n 'C' => Commands::ClearImageBuffer,\n 'T' => Commands::Feed,\n 'XS' => Commands::Issue\n }\n end", "def specification_path(name, version)\n path = specs_dir + name + version.to_s\n specification_path = path + \"#{name}.podspec.json\"\n unless specification_path.exist?\n specification_path = path + \"#{name}.podspec\"\n end\n unless specification_path.exist?\n raise StandardError, \"Unable to find the specification #{name} \" \\\n \"(#{version}) in the #{name} source.\"\n end\n spec\n end", "def kak_spec_program\n $kak_spec_program ||= ENV[\"KAK_SPEC_PROGRAM\"]\nend", "def find_patch(spec, options = {})\n get_path(path_to_patch(spec), options)\n end", "def spec_file\n @spec_file ||= File.join spec_dir, \"#{full_name}.gemspec\"\n end", "def define_specs_task\n require 'active_record/version'\n\n if ActiveRecord::VERSION::MAJOR > 2\n # rspec 2\n require \"rspec/core/rake_task\"\n RSpec::Core::RakeTask.new(:specs) do |spec|\n spec.pattern = \"spec/*_spec.rb\"\n end\n else\n # rspec 1\n require 'spec/rake/spectask'\n Spec::Rake::SpecTask.new(:specs) do |spec|\n spec.libs << 'lib' << 'spec'\n spec.spec_files = FileList['spec/**/*_spec.rb']\n end\n end\nend", "def command_name\n @command_name ||= SimpleCov.command_name\n end", "def command_name\n @command_name ||= SimpleCov.command_name\n end", "def command_name\n @command_name ||= SimpleCov.command_name\n end", "def find options = {}\n init_specification options, CANONICAL_OPTIONS do \n finish_specification_initialization\n end\n result = do_find_pointcuts unless noop\n unset_specification\n result \n end", "def spec # :nodoc:\n @spec ||=\n begin\n tuple = Gem::NameTuple.new @name, @version, @platform\n\n @source.fetch_spec tuple\n end\n end", "def gemspec\n @gemspec ||= begin\n raise Error.new(\"Unable to automatically determine gem name from specs in #{base}. Please set the gem name via #{self.class.name}.install_tasks(gem_name: 'name')\") unless gem_name\n g = Bundler.load_gemspec(File.join(base, gem_name+'.gemspec'))\n # This is returning the path it would be in if installed normally,\n # override so we get the local path. Also for reasons that are entirely\n # beyond me, #tap makes Gem::Specification flip out so do it old-school.\n g.full_gem_path = base\n g\n end\n end", "def test_defun_command_2\n##### [my_command2]\n defun(:my_command2,\n :interactive => \"d\", :docstring => \"description...\") { |point|\n insert_string(\"Current point is #{point}.\"); newline\n }\n##### [/my_command2]\n assert_equal(\"d\", nth(1, commandp(:my_command2)))\n assert_equal(\"description...\", documentation(:my_command2))\n assert_equal(\"Current point is 1.\\n\",\n with_temp_buffer_string{ call_interactively(:my_command2) })\n end", "def spec\n # NOTE the idea here is that the local spec will be used if it exists, or\n # an image_spec lookup will happen based on mounted_as\n local_spec.presence || \n\n spec_dimensions.present? && self ||\n \n @floating_spec ||= begin\n if mounted_as.present?\n # first we try to find the exact spec based on mounted record and mount \n # name (e.g. user#avatar)\n ImageSpec.find_by_identifier(mounted_as) ||\n\n # If that fails we'll look for a more general spec based solely on\n # the mount association name (e.g. avatar)\n mounted_association && ImageSpec.find_by_identifier(mounted_association)\n end\n end\n end", "def sh_test_options\n {\n :cmd_pattern => '% ',\n :cmd => '2>&1 ',\n :indents => true,\n :env => {\n 'TAPFILE' => nil,\n 'TAP_GEMS' => nil, \n 'TAP_PATH' => nil,\n 'TAPENV' => nil,\n 'TAPRC' => nil,\n 'TAP_DEBUG' => nil\n },\n :replace_env => false\n }\n end", "def default_command\n commands.find { |c| c.default }\n end", "def setup_auto_test\n ENV['RSPEC'] = 'true' # allows autotest to discover rspec\n ENV['AUTOTEST'] = 'true' # allows autotest to run w/ color on linux\n# $:.push(File.join(File.dirname(__FILE__), 'spec'))\n system((RUBY_PLATFORM =~ /mswin|mingw/ ? 'autotest.bat' : 'autotest'), *ARGV) ||\n $stderr.puts('Unable to find autotest. Please install ZenTest or fix your PATH') && false\nend", "def run(opts)\n dest = opts[:n].name\n cmd = opts[:c]\n\n ssh = RSpec.configuration.rspec_storage[:nodes][dest][:ssh]\n ssh_exec!(ssh, \"cd /tmp && sudo sh -c #{shellescape(cmd)}\")\n end", "def get_spec(node)\n spec = @@spec[node]\n if spec.nil?\n # raise \"Unknown node [#{node}], add to conf/nemsis_spec.yml?\"\n # puts \"Unknown node [#{node}], add to conf/nemsis_spec.yml?\"\n end\n spec\n end", "def specs(s = nil, options = {})\n options = {\n type: nil,\n sub_type: nil,\n mode: current_mode.nil? ? nil : current_mode.name,\n spec: nil,\n symbol: false,\n creating_spec: false\n }.update(options || {})\n _specs\n if s.nil?\n show_specs(options)\n elsif s.is_a? Hash\n # no spec was passed but some option was passed\n options.update(s)\n show_specs(options)\n else\n # a spec was passed\n options[:spec] = s\n show_specs(options)\n end\n end", "def search_command(command, macroname, force, abort)\n path = @macros[macroname]\n\n if (!path) or path == '' or force\n if path = File .which(command)\n\t@macros[macroname] = path\n end\n end\n\n if path and File .executable?(path)\n print \"#{command} is .. #{path}\\n\"\n else\n search_abort(command, macroname) if abort\n return nil\n end\n end", "def spec *specs, &block\n o = Module.new.extend Spec, Spec::Defs, *specs\n o.module_exec &block\n o\n end", "def spec *specs, &block\n o = Module.new.extend Spec, Spec::Defs, *specs\n o.module_exec &block\n o\n end", "def interact(prompt_id, default, dir = @test_case.folder, &block)\n if @test_case.interactive?\n relative_path = Pathname.new(dir).relative_path_from(Pathname.new(Dir.pwd))\n print \"\\nIn test case: #{relative_path}\"\n return SassSpec::Interactor.interact_with_memory(@@interaction_memory, prompt_id, &block)\n else\n return default\n end\n end", "def invoke_repositext_command(main_command, command_spec, options)\n method_name = \"#{ main_command }_#{ command_spec }\"\n if respond_to?(method_name, true)\n with_timer do\n self.send(method_name, options)\n end\n else\n raise(\"The command you entered is not implemented. Missing method: #{ method_name.inspect }\")\n end\n end", "def default_command(command)\n @@default_command = command.to_sym\n end", "def spec_dir\n @spec_dir ||= File.join base_dir, \"specifications\"\n end", "def default_command(meth = nil)\n if meth\n @default_command = meth == :none ? \"help\" : meth.to_s\n else\n @default_command ||= from_superclass(:default_command, \"help\")\n end\n end", "def run_command(cmd, options={})\n FudgeMatchers::Run.new cmd, options\nend", "def test_found_returns_false_for_commands_not_found_in_path\n Crd::Flex::Command.new 'madeupcommandname' do |s|\n assert_equal( false, s.found? )\n end\n end", "def find_subcommand(name)\n subcommands_for_command_lookup.find { |sc| sc.command == name }\n end", "def test_run_with_unknown_name\n schema = Heroics::Schema.new(SAMPLE_SCHEMA)\n client = Heroics::client_from_schema(schema, 'https://example.com')\n output = StringIO.new\n command = Heroics::Command.new(\n 'cli', schema.resource('resource').link('list'), client, output)\n cli = Heroics::CLI.new('cli', {'resource:list' => command}, output)\n cli.run('unknown:command')\n assert_equal(\"There is no command called 'unknown:command'.\\n\",\n output.string)\n end", "def define_command name, opts = nil, &blk\n opts = _take_doc(opts)\n # $stderr.puts \"@target = #{@target.inspect}\"\n # $stderr.puts \"define_command #{name.inspect}, #{opts.inspect}\"\n\n cmd = _command_manager.define_command(name, opts, &blk)\n\n cmd._defined_in = @plugin\n\n @plugin.commands << cmd\n\n cmd\n end", "def rspec?\n $PROGRAM_NAME.end_with?(RSPEC_PROGRAM_NAME)\n end", "def stub_command(name, **options, &block)\n bin.join(name).write(<<~SCRIPT).mk_executable\n #!#{RbConfig::CONFIG[\"bindir\"]}/ruby\n require \\\"bundler/setup\\\"\n require \\\"#{__FILE__}\\\"\n\n MockExecutablesHelper::Client.run($0, ARGV)\n SCRIPT\n\n to_match = { sudo: false }.merge(options)\n\n allow(registry).to receive(name, &block).with(\n an_object_having_attributes(to_match)\n )\n end", "def display_help\n puts 'Usage:'\n puts ' xrerun path/to/some_spec.rb browser_name'\n exit\nend", "def show_specs(options = {})\n options = {\n mode: nil,\n spec: nil,\n type: nil,\n sub_type: nil,\n specs_to_be_shown: SpecArray.new,\n owner: nil,\n symbol: false,\n creating_spec: false\n }.update(options)\n options[:symbol] ? symbol = options.delete(:spec) : symbol = nil\n specs_to_be_shown = options[:specs_to_be_shown]\n filter_hash(_specs, options[:spec]).each do |_spec, hash|\n filter_hash(hash, options[:mode]).each do |_mode, hash_|\n filter_hash(hash_, options[:type]).each do |_type, hash__|\n filter_hash(hash__, options[:sub_type]).each do |_sub_type, spec|\n if symbol\n if spec.symbol && (spec.symbol.gsub(/<.*?>/, '').downcase.to_sym == symbol)\n specs_to_be_shown << spec\n end\n else\n specs_to_be_shown << spec\n end\n end\n end\n end\n end\n # If no specs were found must check the possibility another search\n # should be started with mode set to :local or :global\n if specs_to_be_shown.empty?\n # Don't want to re-call this method if the callee is trying to create a spec and just wants to know\n # if there is a spec with the exact same options\n if options[:creating_spec] == false\n # Doesn't make sense to recall the method however if the mode is already set to :global or :local\n unless [:global, :local, nil].include?(options[:mode])\n # Need to check if there are :global or :local specs that match the filter(s) as well\n if self == Origen.top_level\n options[:mode] = :global\n else\n options[:mode] = :local\n end\n options[:specs_to_be_shown] = specs_to_be_shown\n Origen.log.debug \"re-calling show_specs with options #{options}\"\n return show_specs(options)\n end\n end\n Origen.log.debug \"Returning no specs for options #{options}\"\n nil\n elsif specs_to_be_shown.size == 1\n print_to_console(specs_to_be_shown) if options[:verbose] == true\n Origen.log.debug \"returning one spec #{specs_to_be_shown.first.name}\"\n specs_to_be_shown.first\n else\n Origen.log.debug \"returning an array of specs during initial search: #{specs_to_be_shown}\"\n specs_to_be_shown\n end\n end", "def spec= s \n if ENV['PLATFORM'] =~ /win32/\n s.files = s.files.reject! {|f| f =~ /extconf\\.rb/}\n else\n s.files = s.files.reject! {|f| f =~ /win\\//}\n end\n @spec = s\n end" ]
[ "0.7567217", "0.7567217", "0.7567217", "0.7554606", "0.6723829", "0.6723829", "0.6723829", "0.59270173", "0.57842547", "0.57092667", "0.5638387", "0.5584095", "0.55048895", "0.54625285", "0.53773063", "0.5363766", "0.53505045", "0.53505045", "0.53505045", "0.53239864", "0.5305493", "0.527971", "0.5275607", "0.52387464", "0.5234194", "0.5234194", "0.5232541", "0.52227813", "0.52224547", "0.5191516", "0.5162958", "0.5123283", "0.5120681", "0.5118857", "0.51175344", "0.5083368", "0.50819826", "0.5081062", "0.5077716", "0.50747633", "0.507386", "0.5054942", "0.5052915", "0.5048549", "0.50385207", "0.50283736", "0.5014604", "0.501038", "0.5006291", "0.49982154", "0.49928045", "0.49917063", "0.49824026", "0.49716756", "0.49621883", "0.49409822", "0.49242824", "0.49236318", "0.49209782", "0.4920441", "0.4919814", "0.48905146", "0.48822552", "0.48801562", "0.48750284", "0.48738772", "0.4873055", "0.48560297", "0.48506162", "0.48506162", "0.48506162", "0.4833758", "0.48269233", "0.4822911", "0.48172697", "0.4810154", "0.48040706", "0.4801267", "0.47969294", "0.4788754", "0.47829968", "0.4780141", "0.47759622", "0.47715196", "0.47715196", "0.47713953", "0.47656754", "0.47599003", "0.47436798", "0.47354436", "0.47327197", "0.4728745", "0.4726295", "0.47259665", "0.47232914", "0.47227734", "0.4720593", "0.47201252", "0.47078076", "0.46998718" ]
0.6712126
7
Autotest will look for spec commands in the following locations, in this order: bin/spec default spec bin/loader installed in Rubygems
def spec_commands [ File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'bin', 'spec')), File.join(Config::CONFIG['bindir'], 'spec') ] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spec_commands\n [File.join(Config::CONFIG['bindir'], 'spec'), 'spec']\n end", "def spec_commands\n [File.join(Config::CONFIG['bindir'], 'spec'), 'spec']\n end", "def spec_commands\n [File.join(Config::CONFIG['bindir'], 'spec'), 'spec']\n end", "def setup_auto_test\n ENV['RSPEC'] = 'true' # allows autotest to discover rspec\n ENV['AUTOTEST'] = 'true' # allows autotest to run w/ color on linux\n# $:.push(File.join(File.dirname(__FILE__), 'spec'))\n system((RUBY_PLATFORM =~ /mswin|mingw/ ? 'autotest.bat' : 'autotest'), *ARGV) ||\n $stderr.puts('Unable to find autotest. Please install ZenTest or fix your PATH') && false\nend", "def rspec\n\tsystem('rspec --init')\nend", "def setup_spec(t)\n t.spec_opts = ['--options', \"\\\"#{RIGHT_BOT_ROOT}/spec/spec.opts\\\"\"]\n t.spec_files = FileList[\"#{RIGHT_BOT_ROOT}/**/spec/**/*_spec.rb\"]\n t\nend", "def generate\n `rspec --init`\n end", "def setup_rspec\n template('.rspec.tt', '.rspec')\n template('Rakefile.tt', 'Rakefile')\n template('spec/lib/versioned/version_spec.rb.tt', \"spec/#{version_path.sub(/\\.rb$/, '_spec.rb')}\")\n template('spec/lib/versioned_spec.rb.tt', \"spec/lib/#{namespaced_path}_spec.rb\")\n template('spec/spec_helper.rb.tt', 'spec/spec_helper.rb')\n end", "def run_tests\n system(\"bundle exec rspec #{rspec_arguments.join(' ')}\")\n end", "def spec\n File.join root, 'spec'\n end", "def spec\n File.join root, 'spec'\n end", "def spec\n File.join root, 'spec'\n end", "def bundle_install(name)\n Dir.chdir(name)\n system(\"bundle install\")\n system(\"rspec --init\")\nend", "def all_spec_files\n 'spec/**/*_spec.rb'\nend", "def specs\n checkout\n\n return [] unless install_dir\n\n Dir.chdir install_dir do\n Dir['{,*,*/*}.gemspec'].map do |spec_file|\n directory = File.dirname spec_file\n file = File.basename spec_file\n\n Dir.chdir directory do\n spec = Gem::Specification.load file\n if spec\n spec.base_dir = base_dir\n\n spec.extension_dir =\n File.join base_dir, 'extensions', Gem::Platform.local.to_s,\n Gem.extension_api_version, \"#{name}-#{dir_shortref}\"\n\n spec.full_gem_path = File.dirname spec.loaded_from if spec\n end\n spec\n end\n end.compact\n end\n end", "def define\n lib_path = @libs.join(File::PATH_SEPARATOR)\n desc \"Run specs\" + (@name==:spec ? \"\" : \" for #{@name}\")\n task @name do\n specs = file_list\n raise \"No spec files found.\" if specs.empty?\n \n spec = File.expand_path(File.dirname(__FILE__) + '/../../../bin/spec')\n file_prefix = @rcov ? \" -- \" : \"\"\n interpreter = @rcov ? \"rcov\" : \"ruby\"\n redirect = @out.nil? ? \"\" : \" > #{@out}\"\n\n @ruby_opts.unshift( \"-I#{lib_path}\" )\n @ruby_opts.unshift( \"-w\" ) if @warning\n @ruby_opts.unshift( '--exclude \"lib\\/spec\\/.*\"' ) if @rcov\n begin\n run interpreter, @ruby_opts.join(\" \") +\n \" \\\"#{spec}\\\" \" +\n \" #{@spec_opts.join(' ')} \" +\n file_prefix +\n specs.collect { |fn| \"\\\"#{fn}\\\"\" }.join(' ') +\n redirect\n rescue => e\n raise e if @fail_on_error\n end\n end\n self\n end", "def installed_spec_directories; end", "def cmd(c)\n @tpath = ''\n case File.basename(Dir.pwd)\n when 'bwkfanboy'\n # test probably is executed from the Rakefile\n @tpath = 'test/'\n 'bin/' + c\n when 'test'\n # we are probably in the test directory\n '../bin/' + c\n else\n # tests were invoked by 'gem check -t bwkfanboy'\n begin\n Dir.chdir(Bwkfanboy::Utils.gem_dir_system + '/../../test')\n '../bin/' + c\n rescue\n raise \"running tests from '#{Dir.pwd}' isn't supported: #{$!}\"\n end\n end\nend", "def run_serverspec(target_specdir)\n $log.debug 'Running serverspec'\n cmd = \"cd #{target_specdir} && sudo rake spec\"\n $log.debug \"cmd=#{cmd}\"\n result = `#{cmd}`\n puts result\n end", "def test(*args)\n gemfile = File.join(Dir.pwd, \"/Gemfile\")\n rspec_options = args.join(\" \")\n\n exec \"BUNDLE_GEMFILE=#{gemfile} bundle exec rspec #{rspec_options}\"\n end", "def test_script\n spec_directory = @config_manager['test_pack.spec_directory']\n spec_file = File.join(spec_directory, \"#{@name}_spec.rb\")\n @logger.info(\"Starting spec '#{spec_file}'...\")\n RSpec::Core::Runner.run([spec_file])\n end", "def test_relative_loadpath2_idotdotlib\n with_fixture 'relloadpath2' do\n cd 'src' do\n assert system('ruby', '-I', '../lib', ocra, 'relloadpath2.rb', *DefaultArgs)\n assert File.exist?('relloadpath2.exe')\n assert system('relloadpath2.exe')\n end\n end\n end", "def test_relative_loadpath_idotlib\n with_fixture 'relloadpath1' do\n assert system('ruby', '-I', './lib', ocra, 'relloadpath1.rb', *DefaultArgs)\n assert File.exist?('relloadpath1.exe')\n assert system('relloadpath1.exe')\n end\n end", "def testing_gems\n gem 'rake'\n gem 'rspec', '~> 3.0.0'\n gem 'rspec-wait'\n gem 'cucumber'\n gem 'simplecov'\n gem 'bundler', '~> 1.6'\n gem 'bunny', '~> 1.4'\n gem 'database_cleaner'\n gem 'racatt'\n gem 'codacy-coverage', :require => false\nend", "def test_relloadpath4\n with_fixture 'relloadpath4' do\n cd 'src' do\n assert system('ruby', ocra, 'relloadpath4.rb', *DefaultArgs)\n assert File.exist?('relloadpath4.exe')\n assert system('relloadpath4.exe')\n end\n end\n end", "def test_relative_loadpath_rubylibdotlib\n with_fixture 'relloadpath1' do\n with_env 'RUBYLIB' => './lib' do\n assert system('ruby', ocra, 'relloadpath1.rb', *DefaultArgs)\n assert File.exist?('relloadpath1.exe')\n assert system('relloadpath1.exe')\n end\n end\n end", "def test_autoload_missing\n with_fixture 'autoloadmissing' do\n args = DefaultArgs.dup\n args.push '--no-warnings'\n assert system(\"ruby\", ocra, \"autoloadmissing.rb\", *args)\n assert File.exist?(\"autoloadmissing.exe\")\n assert system(\"autoloadmissing.exe\")\n end\n end", "def run_module_spec(module_name)\n\n puts '-' * 80\n puts \"Running rspec tests for module #{module_name}\"\n puts '-' * 80\n\n Dir.chdir(\"modules/#{module_name}\") do\n # The following is a customized replacement for 'spec_prep'.\n # We do not want to use upstream modules which are usually installed\n # using `rake spec_prep`, instead we symlink to our own modules.\n directory_name = \"spec/fixtures\"\n Dir.mkdir(directory_name) unless File.exists?(directory_name)\n link_name = \"spec/fixtures/modules\"\n system(\"ln -s ../../../../modules #{link_name}\") unless File.exists?(link_name)\n\n # We also need to create an empty site.pp file in the manifests dir.\n directory_name = \"spec/fixtures/manifests\"\n Dir.mkdir(directory_name) unless File.exists?(directory_name)\n site_file_name = \"spec/fixtures/manifests/site.pp\"\n system(\"touch #{site_file_name}\") unless File.exists?(site_file_name)\n\n puts \"Invoking tests on module #{module_name}\"\n system('rake spec_standalone')\n end\nend", "def all_spec_files\n Dir['spec/**/*_spec.rb']\nend", "def all_spec_files\n Dir['spec/**/*_spec.rb']\nend", "def all_spec_files\n Dir['spec/**/*_spec.rb']\nend", "def all_spec_files\n Dir['spec/**/*_spec.rb']\nend", "def setup_test_suite\n announce \"Installing Test Suite\"\n system \"bundle exec rails g rspec:install\"\n copy_spec_folder\n copy_guardfile\n git add: '.'\n git commit: %Q{ -m \"Setup core TDD and debugging suite using RSpec, Capybara, Guard, and FactoryBot\" }\nend", "def spec_dirs; end", "def test_relative_loadpath_rubyliblib\n with_fixture 'relloadpath1' do\n with_env 'RUBYLIB' => 'lib' do\n assert system('ruby', ocra, 'relloadpath1.rb', *DefaultArgs)\n assert File.exist?('relloadpath1.exe')\n assert system('relloadpath1.exe')\n end\n end\n end", "def command log\n test_command=\"\"\n\n log.scan(/^.*#([^\\n]*)\\n.*\\#\\ \\.([^\\n]*)\\:/m).each do |data|\n test_command+=\"spec \" if test_command.empty? \n test_command+=\".#{data[1]},\"\n end\n\n log.scan(/^.*#(\\w+)\\s?\\[(.*)\\]/).each do |data|\n test_command+=\"ruby -Itest #{data[0]} -n #{data[1]};\"\n end\n\n test_command\n end", "def test_relative_loadpath1_ilib\n with_fixture 'relloadpath1' do\n assert system('ruby', '-I', 'lib', ocra, 'relloadpath1.rb', *DefaultArgs)\n assert File.exist?('relloadpath1.exe')\n assert system('relloadpath1.exe')\n end\n end", "def ruby_spec_path\n File.join(RAILS_ROOT, 'vendor/gems/ruby/specifications')\n end", "def run_specs(globs, spec_cmd='spec', run_opts = \"-c -f s\")\n require \"optparse\"\n require \"spec\"\n globs = globs.is_a?(Array) ? globs : [globs]\n examples, failures, errors, pending = 0, 0, 0, 0\n\n time = Benchmark.measure do\n globs.each do |glob|\n Dir[glob].each do |spec|\n response = Open3.popen3(\"#{spec_cmd} #{File.expand_path(spec)} #{run_opts}\") do |i,o,e|\n while out = o.gets\n STDOUT.puts out\n STDOUT.flush\n if out =~ /\\d+ example/\n e, f, p = out.match(/(\\d+) examples?, (\\d+) failures?(?:, (\\d+) pending?)?/)[1..-1]\n examples += e.to_i; failures += f.to_i; pending += p.to_i\n end\n end\n errors += 1 if e.is_a?(IO)\n STDOUT.puts e.read if e.is_a?(IO)\n end\n end\n end\n end\n\n puts\n puts \"*** TOTALS ***\"\n if failures == 0\n print \"\\e[32m\"\n else\n print \"\\e[31m\"\n end\n puts \"#{examples} examples, #{failures} failures, #{errors} errors, #{pending} pending, #{sprintf(\"suite run in %3.3f seconds\", time.real)}\"\n # TODO: we need to report pending examples all together\n print \"\\e[0m\"\nend", "def samples\n home = File.expand_path('../..', __FILE__)\n Dir.glob(\"#{home}/spec/samples/*.ooc\")\nend", "def test_it_should_know_its_gem_path_with_a_default_location\n ENV.delete \"INSPEC_CONFIG_DIR\"\n ENV[\"HOME\"] = File.join(@config_dir_path, \"fakehome\")\n expected = File.join(ENV[\"HOME\"], \".inspec\", \"gems\", @ruby_abi_version)\n assert_equal expected, @installer.gem_path\n end", "def gemspecs; end", "def load_gems_in(*spec_dirs); end", "def define_specs_task\n require 'active_record/version'\n\n if ActiveRecord::VERSION::MAJOR > 2\n # rspec 2\n require \"rspec/core/rake_task\"\n RSpec::Core::RakeTask.new(:specs) do |spec|\n spec.pattern = \"spec/*_spec.rb\"\n end\n else\n # rspec 1\n require 'spec/rake/spectask'\n Spec::Rake::SpecTask.new(:specs) do |spec|\n spec.libs << 'lib' << 'spec'\n spec.spec_files = FileList['spec/**/*_spec.rb']\n end\n end\nend", "def spec(argv=ARGV)\n # disable autorun in case the user left it in spec_helper.rb\n RSpec::Core::Runner.disable_autorun!\n exit RSpec::Core::Runner.run(argv)\n end", "def run_all\n passed = Runner.run(['spec'], cli)\n if passed\n Formatter.notify \"How cool, all works!\", :image => :success\n else\n Formatter.notify \"Failing... not there yet.\", :image => :failed\n end\n end", "def test_automatically_sets_library_path_argument\n assert_equal( [ 'libs/bin' ], @cmd.library_path )\n end", "def test_automatically_sets_library_path_argument\n assert_equal( [ 'libs/bin' ], @cmd.library_path )\n end", "def define_test_tasks\n default_tasks = []\n\n if File.directory? \"test\" then\n desc 'Run the test suite. Use FILTER or TESTOPTS to add flags/args.'\n task :test do\n ruby make_test_cmd\n end\n\n desc 'Run the test suite using multiruby.'\n task :multi do\n ruby make_test_cmd(:multi)\n end\n\n desc 'Show which test files fail when run alone.'\n task :test_deps do\n tests = Dir[\"test/**/test_*.rb\"] + Dir[\"test/**/*_test.rb\"]\n\n paths = ['bin', 'lib', 'test'].join(File::PATH_SEPARATOR)\n null_dev = Hoe::WINDOZE ? '> NUL 2>&1' : '&> /dev/null'\n\n tests.each do |test|\n if not system \"ruby -I#{paths} #{test} #{null_dev}\" then\n puts \"Dependency Issues: #{test}\"\n end\n end\n end\n\n default_tasks << :test\n end\n\n if File.directory? \"spec\" then\n begin\n require 'spec/rake/spectask'\n\n desc \"Run all specifications\"\n Spec::Rake::SpecTask.new(:spec) do |t|\n t.libs = self.rspec_dirs\n t.spec_opts = self.rspec_options\n end\n rescue LoadError\n # do nothing\n end\n default_tasks << :spec\n end\n\n desc 'Run the default task(s).'\n task :default => default_tasks\n\n desc 'Run ZenTest against the package.'\n task :audit do\n libs = %w(lib test ext).join(File::PATH_SEPARATOR)\n sh \"zentest -I=#{libs} #{spec.files.grep(/^(lib|test)/).join(' ')}\"\n end\n end", "def setup\n Inspec::Plugin::V2::Loader.new.load_all\n end", "def binary(options = {})\n if Env.gem?('rspec', '< 2', options)\n 'spec'\n else\n 'rspec'\n end\n end", "def copy_rspec_files\n directory('rspec', 'spec') if options[:test_engine] == 'rspec'\n end", "def shell_command(files, options={})\n loadpath = options[:loadpath]\n requires = options[:requires]\n\n cmd = []\n cmd << \"ruby\" # \"bundle exec ruby\"\n cmd << loadpath.map{ |i| %{-I\"#{i}\"} }.join(' ') unless loadpath.empty?\n cmd << requires.map{ |r| %{-r\"#{r}\"} }.join(' ') unless requires.empty?\n #cmd << \"-r minitest/unit\"\n cmd.concat(files)\n cmd << \"| tapout\"\n cmd << \"-t #{trace}\" if @trace\n cmd << \"--no-ansi\" unless @ansi\n cmd << @format\n cmd = cmd.join(' ')\n\n return cmd\n\n #puts cmd if $DEBUG\n #system cmd\n end", "def test_gems\n gem 'tef-worker'\n gem 'tef-manager'\n gem 'tef-keeper'\n gem 'tef'\n gem 'tef-development'\nend", "def component_test_full_commands(cmp)\n component_build_vars(cmp)['TEST_FULL_CMDS']\nend", "def manifest_task\n # Load all the gem's files using \"git ls-files\"\n repository_files = `#{git} ls-files`.split(\"\\n\")\n test_files = Dir[test_pattern] + Dir[spec_pattern]\n\n update_gemspec(:files, repository_files)\n update_gemspec(:test_files, repository_files & test_files)\n end", "def test_relative_require\n with_fixture 'relativerequire' do\n assert system(\"ruby\", ocra, \"relativerequire.rb\", *DefaultArgs)\n assert File.exist?(\"relativerequire.exe\")\n system(\"relativerequire.exe\")\n assert_equal 160, $?.exitstatus\n end\n end", "def run_spec(chapter,problem)\n ch = \"#{File.dirname(__FILE__)}/ch#{chapter}\"\n if ENV['solved']\n problem_dir = \"#{ch}/solved/#{problem}.rb\"\n else\n problem_dir = Dir[\"#{ch}/challenge/#{problem}_*\"].first\n end \n sh \"ruby -c #{problem_dir}\" # check syntax\n sh \"rspec -cr #{problem_dir} -r enumerator #{ch}/spec/#{problem}.rb\" # run spec (c for colour, r to require the files, enumerator required for 1.8.6 compatibility)\nend", "def spec_files\n glob_files(@root_dir, 'spec', '**/*_spec.rb')\n end", "def sync_spec_puppet_module\n copy_skel_files\n install_fixtures\n install_spec_helper\n\n # ONLY install init_spec.rb if no spec files already exist in spec/classes.\n # These files are otherwise not managed from here.\n unless @config[@origin].has_key?('no_init_spec')\n if (Dir.entries('spec/classes') - %w{. .. .gitkeep readme_spec.rb}).empty?\n install_template(\n [\"#{@templates}/init_spec.rb\"], 'spec/classes/init_spec.rb')\n end\n end\n end", "def spec_support_dir\n @spec_support_dir ||= File.expand_path(File.dirname(__FILE__))\nend", "def check_if_bundle_needed\n if `bundle exec #{rspec_command} -v` == `#{rspec_command} -v`\n @bundle = \"\"\n else\n @bundle = \"bundle exec \"\n end\n end", "def gemspec_helper; end", "def gemspec_helper; end", "def gemspec_helper; end", "def gemspec_helper; end", "def gemspec_helper; end", "def gemspec_helper; end", "def test_relloadpath3\n with_fixture 'relloadpath3' do\n assert system('ruby', ocra, 'relloadpath3.rb', *DefaultArgs)\n assert File.exist?('relloadpath3.exe')\n assert system('relloadpath3.exe')\n end\n end", "def spec_name\n \"#{full_name}.gemspec\"\n end", "def run\n cd File.dirname(__FILE__) do\n # Set these values to what you want installed.\n bins = glob(%w[bin/facter])\n libs = glob(%w[lib/**/*.rb lib/facter/fixtures/* lib/facter/os_hierarchy.json\n lib/facter/fact_groups.conf lib/facter/templates/*])\n man = glob(%w{man/man[0-9]/*})\n\n prepare_installation\n\n do_bins(bins, InstallOptions.bin_dir)\n do_libs(libs)\n do_man(man) unless windows?\n end\n end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def installed_spec_directories\n Gem.path.collect { |dir| File.join(dir, \"specifications\") }\n end", "def test_metrics_add_on_with_rspec\n run_hoboken(:generate, test_framework: 'rspec') do\n bin_path = File.expand_path('../../bin/hoboken', __dir__)\n execute(\"#{bin_path} add:metrics\")\n assert_file('Gemfile', /flog/, /flay/, /simplecov/)\n assert_file('tasks/metrics.rake')\n\n assert_file('spec/spec_helper.rb', <<~CODE\n require 'simplecov'\n SimpleCov.start do\n add_filter '/bin/'\n add_filter '/config/'\n add_filter '/db/migrate/'\n add_filter '/spec/'\n coverage_dir 'tmp/coverage'\n end\n\n CODE\n )\n end\n end", "def test_command_checks_for_binaries_each_time\n provider = newprovider\n\n provider.commands :testing => \"/no/such/path\"\n\n provider.stubs(:which).returns \"/no/such/path\"\n\n provider.command(:testing)\n assert_equal(\"/no/such/path\", provider.command(:testing), \"Did not return correct binary path\")\n end", "def install_spec_helper\n stubbed_facts = String.new\n if @config[@origin].has_key?('stubbed_facts')\n @config[@origin]['stubbed_facts'].keys.each do |k|\n stubbed_facts += \" :#{k} => '#{@config[@origin]['stubbed_facts'][k]}',\\n\"\n end\n end\n\n code_coverage = String.new\n if @config[@origin].has_key?('code_coverage')\n percent = @config[@origin]['code_coverage']\n code_coverage = \" c.after(:suite) do\n RSpec::Puppet::Coverage.report!(#{percent})\n end\"\n end\n\n subs = {\n '##STUBBED_FACTS##' => stubbed_facts,\n '##CODE_COVERAGE##' => code_coverage,\n }\n\n install_template([\"#{@templates}/spec_helper.rb\"], 'spec/spec_helper.rb', subs)\n end", "def add_testing\n setup_rspec\n setup_rspec_generators\n setup_rails_helper\n setup_factories_file\nend", "def common_test_pods\n pod 'Quick'\n pod 'Nimble'\nend", "def test_helloworld\n with_fixture 'helloworld' do\n assert system(\"ruby\", ocra, \"helloworld.rb\", *DefaultArgs)\n assert File.exist?(\"helloworld.exe\")\n assert system(\"helloworld.exe\")\n end\n end", "def spec_command(separator=File::ALT_SEPARATOR)\n unless defined? @spec_command then\n @spec_command = spec_commands.find { |cmd| File.exists? cmd }\n\n raise RspecCommandError, \"No spec command could be found!\" unless @spec_command\n\n @spec_command.gsub! File::SEPARATOR, separator if separator\n end\n @spec_command\n end", "def setup_test_app\n gemfile_path = if CORE_GEMS.include?(self.name)\n ROOT_GEMFILE\n else\n './Gemfile'\n end\n\n system(\"bundle exec --gemfile=#{gemfile_path} rake test_app \") || raise('Failed to setup the test app')\n end", "def spec\r\n @spec ||=\r\n begin\r\n require 'rubygems/specification'\r\n data = File.read('ruby-batch.gemspec')\r\n spec = nil\r\n Thread.new { spec = eval(\"$SAFE = 3\\n#{data}\") }.join\r\n spec\r\n end\r\nend", "def run_test(component)\n test_path = File.expand_path __dir__\n IO.popen(\"ruby #{test_path}/#{component}_spec.rb\") do |data|\n while line = data.gets\n puts line\n end\n end\n $?.exitstatus\nend", "def skip_bundler_option?\n RSpec::Mate::Options['--skip-bundler']\nend", "def test_pods\n pod \"Quick\"\n pod \"Nimble\"\n pod \"Nimble-Snapshots\"\nend", "def test_pods\n pod \"Quick\"\n pod \"Nimble\"\n pod \"Nimble-Snapshots\"\nend", "def bundler_option?\n RSpec::Mate::Options['--bundler']\nend", "def make_test_cmd multi = false # :nodoc:\n framework = SUPPORTED_TEST_FRAMEWORKS[testlib]\n raise \"unsupported test framework #{testlib}\" unless framework\n\n tests = [\"rubygems\", framework] +\n test_globs.map { |g| Dir.glob(g) }.flatten\n tests.map! {|f| %(require \"#{f}\")}\n\n cmd = \"#{Hoe::RUBY_FLAGS} -e '#{tests.join(\"; \")}' #{FILTER}\"\n\n if multi then\n ENV['EXCLUDED_VERSIONS'] = multiruby_skip.join \":\"\n cmd = \"-S multiruby #{cmd}\"\n end\n\n cmd\n end", "def run_tests(spec, rake_path)\n pwd = FileUtils.pwd\n\n FileUtils.chdir(spec.full_gem_path)\n\n output = \"\"\n exit_status = nil\n\n if spec.files.include?(\".gemtest\")\n Open3.popen3(rake_path, \"test\", '--trace') do |stdin, stdout, stderr, thr|\n loop do\n if stdout.eof? and stderr.eof?\n break\n end\n\n buf = \"\"\n\n handles, _, _ = IO.select([stdout, stderr].reject { |x| x.closed? || x.eof? }, nil, nil, 0.1)\n\n begin\n handles.each { |io| io.readpartial(16384, buf) } if handles\n rescue EOFError, IOError\n next\n end\n\n output += buf\n\n print buf\n end\n\n exit_status = thr.value\n end\n\n if config[\"upload_results\"] or\n (!config.has_key?(\"upload_results\") and ask_yes_no \"Upload these results to rubygems.org?\")\n\n upload_results(gather_results(spec, output, exit_status.exitstatus == 0))\n end\n\n if exit_status.exitstatus != 0\n alert_error \"Tests did not pass. Examine the output and report it to the author!\"\n\n FileUtils.chdir(pwd)\n\n raise Gem::TestError\n end\n else\n puts\n puts \"This gem has no tests! Please contact the author to gain testing and reporting!\"\n puts\n end\n\n FileUtils.chdir(pwd)\n end", "def testBasicBinary\n execTest('Applications/Basic', [], 'ReleaseInfo_Exe.rb', :ExpectCalls => [\n [ 'system',\n {\n :Dir => /^.*$/,\n :Cmd => /^exerb\\.bat --version$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new { true } }\n ],\n [ 'system',\n {\n :Dir => /^.*\\/Releases\\/#{RUBY_PLATFORM}\\/UnnamedVersion\\/Normal\\/\\d\\d\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d\\/Release$/,\n :Cmd => /^exerb\\.bat -o ExeName.exe .*\\/EXE_windows_Gen\\.rb$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new { true } }\n ],\n [ 'system',\n {\n :Dir => /^.*$/,\n :Cmd => /^.*\\/edicon\\.exe .*\\/Releases\\/#{RUBY_PLATFORM}\\/UnnamedVersion\\/Normal\\/\\d\\d\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d\\/Release\\/ExeName.exe .*\\/Icon\\.ico$/\n },\n { :Execute => $RBPTest_ExternalTools ? true : Proc.new {\n FileUtils::touch \"#{Dir.glob(\"Releases/#{RUBY_PLATFORM}/*/*/*\")[0]}/Release/ExeName.exe\"\n true\n } }\n ]\n ]) do |iReleaseDir, iReleaseInfo|\n checkReleaseInfo(iReleaseDir, iReleaseInfo)\n checkReleaseNotes(iReleaseDir, iReleaseInfo)\n lExeFileName = \"#{iReleaseDir}/Release/ExeName.exe\"\n assert(File.exists?(lExeFileName))\n # Unless the Executable file can contain other rb files (please Crate come faster !), files are still present.\n assert(File.exists?(\"#{iReleaseDir}/Release/Main.rb\"))\n if $RBPTest_ExternalTools\n # Test it in Ruby's environment\n assert_equal(\"#{getRubySignature}\nRuby found in environment. Using it directly.\n> start rubyw -w \\\"#{iReleaseDir}/Release/Main.rb\\\" \\n\", runExe(lExeFileName))\n # TODO: Test it without Ruby's environment\n end\n end\n end", "def test\n return\n # TODO\n # skips test framework, but we can probably just bastardize the options in the same way as with :skip_bundle\n # either make `test` build the actual directories etc., or use a script\n # either way, this method is stupid.\n end", "def test\n return\n # TODO\n # skips test framework, but we can probably just bastardize the options in the same way as with :skip_bundle\n # either make `test` build the actual directories etc., or use a script\n # either way, this method is stupid.\n end", "def gemspec\n @gemspec ||= begin\n raise Error.new(\"Unable to automatically determine gem name from specs in #{base}. Please set the gem name via #{self.class.name}.install_tasks(gem_name: 'name')\") unless gem_name\n g = Bundler.load_gemspec(File.join(base, gem_name+'.gemspec'))\n # This is returning the path it would be in if installed normally,\n # override so we get the local path. Also for reasons that are entirely\n # beyond me, #tap makes Gem::Specification flip out so do it old-school.\n g.full_gem_path = base\n g\n end\n end" ]
[ "0.7678369", "0.7678369", "0.7678369", "0.68583155", "0.65796", "0.6557628", "0.6321307", "0.62469125", "0.621284", "0.61861", "0.61861", "0.6170495", "0.61602753", "0.60869324", "0.6081475", "0.6057148", "0.60191387", "0.6014289", "0.6014236", "0.6011074", "0.60078967", "0.59940314", "0.59875447", "0.598517", "0.5952662", "0.59440464", "0.5888443", "0.5859393", "0.5846826", "0.5846826", "0.5846826", "0.5846826", "0.5807759", "0.57875687", "0.5781606", "0.5761611", "0.5755837", "0.5752969", "0.5742667", "0.5733714", "0.5728769", "0.5727844", "0.5705", "0.5698424", "0.5684607", "0.567734", "0.566278", "0.566278", "0.5661185", "0.5657646", "0.5656621", "0.56551135", "0.56513256", "0.5647021", "0.5644072", "0.563452", "0.5632184", "0.56108403", "0.5607761", "0.5604483", "0.56034213", "0.5598283", "0.5587428", "0.5587428", "0.5587428", "0.5587428", "0.5587428", "0.5587428", "0.55841327", "0.5578011", "0.554377", "0.55398774", "0.55398774", "0.55398774", "0.55398774", "0.55398774", "0.55398774", "0.55398774", "0.55398774", "0.5525302", "0.55230045", "0.552089", "0.55146366", "0.5506962", "0.55055505", "0.5492527", "0.5487702", "0.54831207", "0.547667", "0.5471071", "0.54644555", "0.5464255", "0.5464255", "0.54618853", "0.5455685", "0.5441965", "0.5440826", "0.54365873", "0.54365873", "0.543165" ]
0.78004867
0
Multiply times conversion factor to get metric version of height and weight
def convert_inches_to_cm length in_to_cm = 2.54 length * in_to_cm end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_to_metric(measurement, conversion_factor)\n measurement * conversion_factor\nend", "def convert_to_metric(measurement, conversion_factor)\n measurement * conversion_factor\nend", "def calculate_bmi weight, height\n (weight.to_f / (height.to_f * height.to_f)) * 703\nend", "def convert_to_measured\n converter = 1\n case self.cost_unit\n when \"tsp\"\n converter = 0.16667 # convert to us_fl_oz \n self.cost_unit = \"us_fl_oz\"\n when \"tbsp\"\n converter = 0.5 # convert to us_fl_oz \n self.cost_unit = \"us_fl_oz\"\n when \"cup\"\n converter = 8 # convert to us_fl_oz \n self.cost_unit = \"us_fl_oz\"\n end\n self.cost_size *= converter\n end", "def metric\n weight = get_weight(\"kg\")\n height = get_height(\"m\")\n\n bmi = \"#{weight / (height * height)}\"\n puts \"Your BMI is: #{bmi}\"\n return bmi\nend", "def bmi\n ( weight.to_f / ( (height.to_f)**2 ) ) * 703.0\n end", "def bmi_calc height, weight\n return (weight / height**2).to_i\nend", "def calculate(height, weight)\n bmi = (weight / height) / height.to_f;\nend", "def measurement_weight\n [\n ['ounce'],\n ['pounds']\n ]\n end", "def convert_to_metric(metric, conversion_factor)\n return (metric * conversion_factor).to_s\nend", "def convert_imperial_to_metric(measurement, conversion_factor)\n measurement * conversion_factor\nend", "def convert_lbs_to_kg(weight)\n weight * 0.45\nend", "def calculate_bmi(height,weight)\n ( weight / ( (height/100) * (height/100) ) )\n end", "def convert_to_metric(amount, conversion_factor)\n puts \"converting...\"\n amount * conversion_factor\nend", "def rate_scale; end", "def weight; end", "def measure() @measure ||= (nb_weight == 0.0 ? 0.0 : sum_weight / nb_weight) end", "def malt_color_units\n weight * fermentable.color\n end", "def how_high\n energy * energy\nend", "def weight r, h\n len_r = r.magnitude\n\n if len_r.xbetween? 0, h\n 315.0 / (64 * Math::PI * h**9) * (h**2 - len_r**2)**3\n else\n 0.0\n end\n end", "def battery_weight; end", "def gear_inches\n\tratio * (rim + (tire * 2))\nend", "def bmi_kg(weight_kg,height_mi)\n\t \tputs \"Weight should be in Kilos and Height should be in meters\"\n\t \t#puts \"Weight = 10kgs ; height = 6 meters\"\n\t @bmi_calac_kg = (weight_kg / (height_mi * height_mi)).round(2)\n\t end", "def imperialize(params)\n self.weight = (params[:weight].to_f * 0.00220462).round(2)\n self.height = (params[:height].to_f / 2.54).round(2)\n self.depth = (params[:depth].to_f / 2.54).round(2)\n self.width = (params[:width].to_f / 2.54).round(2)\n end", "def choose_metric(r, params)\n params == \"water_collected\" ? r.water_collected :\n params == \"water_used\" ? r.water_used :\n params == \"amount_overflown\" ? r.amount_overflown :\n params == \"ph\" ? r.ph : r.tds\n end", "def bmi weight , height\n total = (weight.to_f / (height.to_f ** 2)) * 10000\n\n puts \"--> Your BMI is... #{total}\"\nend", "def weight\n return data.weight\n end", "def to_metric(value)\n go = (value/1000000000).floor\n mo = ((value - go*1000000000)/1000000).floor\n ko = ((value - go*1000000000 - mo*1000000)/1000).floor\n o = (value - go*1000000000 - mo*1000000 - ko*1000).floor\n\n return(\"#{go}..#{mo}.g\") if (go != 0)\n return(\"#{mo}...#{ko}.m\") if (mo != 0)\n return(\"#{ko}...#{o}).k\") if (ko != 0)\n return(o)\n end", "def mass(weight)\n return weight / FREE_FALL_ACCELERATION\n end", "def to_pixel_per_meter(**options) = convert_to('pixel-per-meter', **options)", "def how_high(energy)\n energy * energy\nend", "def height_cm\n return nil unless source_record['300']\n\n if source_record['300']['c'] =~ /(\\d{1,4}) ?cm(?:[\\. ]|\\Z)/\n return $1\n elsif source_record['300']['c'] =~ /(\\d{1,4}) ?in\\./\n # inches? why not convert to cm\n return $1.to_i * 2.5\n end\n\n return nil\n end", "def convert_lbs_to_kg(lbs_weight, kg_conversion)\n lbs_weight * kg_conversion\nend", "def weight_in_stones\n\t\t((@weight * 2.20462) / 14).to_i\n\tend", "def metal_values value, metal, credits\n\tmetal = (credits.to_f/value.to_f).to_f\n\treturn metal\nend", "def unit_weight\n (unit_area * product_thickness * 2.5).round(2)\n end", "def calcTier(length, height, width)\n\t\t\t((length.to_f * height.to_f * width.to_f)/1728.0).round(4)\n\t\tend", "def weighted_score\n score * metric.weight\n end", "def wei_conversion_factor\n BigDecimal.new(10 ** 18)\n end", "def rh_factor; end", "def convert_weight(weight)\n\t\tpounds = weight[2, 3] #Pulls the 3rd (X), 4th (Y) and 5th (Z) digit from the format 00XYZdddd where 'd' is the decimal portion of the eVS weight convention\n\t\tounces = ((('0.' + weight[5, 4]).to_f)*16).round(1).to_s\n\t\tounces = ounces.to_f.round().to_s.rjust(3, ' ') if ounces.size > 3\n\t\treturn pounds, ounces\n\tend", "def kmh\n values = speed_values\n return nil unless values and values.any?\n \n avg = sum = 0.0\n values.each { |value| sum += value.to_f }\n avg = sum / values.size\n end", "def to_metric_ton(**options) = convert_to('metric-ton', **options)", "def calcTier(length, height, width)\n\t\treturn ((length.to_f * height.to_f * width.to_f)/1728.0).round(4)\n\tend", "def molecular_weight\n @mw ||= begin\n mass = WATER_MASS\n each_aa do |aa|\n mass += AVERAGE_MASS[aa.to_sym]\n end\n (mass * 10).floor().to_f / 10\n end\n end", "def metric_height(amount: T.unsafe(nil)); end", "def bmi_lb(weight_lb,height_in)\n\t \tputs \"Weight should be in Pounds and Height in Inches \"\n\t \t#puts \"Weight = 10lbs ; height = 160 Inches , 1 Foot = 12 Inches\"\n\t #@bmi_calac_lb = ( (weight_lb / (height_in * height_in)).round(2) ) * 703\n\t \t@bmi_calac_lb = ( (weight_lb) / (height_in * height_in).round(2) ) * 703.06957964\n\t end", "def hz_to_ghz i\n (i / 10000.0).round / 100.0\nend", "def prefer_metric_weight\n data[:prefer_metric_weight]\n end", "def metrics\n standard.unit.convert_to_metric imperials\n end", "def metric_power\n metric_prefixes.map.with_index { |_item, index| (1000**(index + 1)).to_i }\nend", "def bsa\n Math.sqrt( height.to_f * weight.to_f / 3131.0 )\n end", "def to_metric(value)\n go = (value/1000000000).floor\n mo = ((value - go*1000000000)/1000000).floor\n ko = ((value - go*1000000000 - mo*1000000)/1000).floor\n o = (value - go*1000000000 - mo*1000000 - ko*1000).floor\n\n return(\"#{go}..#{mo}.g\") if (go != 0)\n return(\"#{mo}...#{ko}.m\") if (mo != 0)\n return(\"#{ko}...#{o}).k\") if (ko != 0)\n return o\n end", "def weight_in_to_lbs(weight, lbs)\n return weight.to_f * lbs\nend", "def weight\n product_weight * quantity\n end", "def weight\n product_weight * quantity\n end", "def weight_watchers(hash)\n calories_count = 0\n hash.each do |k, v|\n calories_count = v * CALORIES[k] + calories_count\n end\n return calories_count\nend", "def bmi_calculator(height, weight)\n\tbegin\n\t\tweight / (height * height)\n\trescue\t\t\t\t\t\t\t\t\t#防呆機制\n\t\t# wrong\n\t\t' wrong '\n\tend\nend", "def fortnights ; Duration[self * 1209600] ; 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 weight\n 0\n end", "def update_heights\n\t\t@height = @tile.attributes[\"height\"]\n\t\t@waterlevel = @tile.agents.length * HEIGHT_MOD \n\tend", "def coord_time(i)\n i.to_f / 24 * @width\nend", "def product_weight\n price_calculator.weight\n end", "def gear_inches\n ratio * wheel.diameter\nend", "def calc_carbon_savings_from_chp_heat(val1= chp_salable_heat, val2= 1.1, val3= 0.272)\n\t\t(val1 * val2 * val3).round 2\n\tend", "def mHz\n (self * 1000_000).Hz\n end", "def capacity_to_demand_multiplier\n 8760.0\n end", "def rate_scale=(_arg0); end", "def weight\n 2 # ounces\n end", "def convert_lbs_to_kg(lbs_weight, kg_conversion)\n\tlbs_weight * kg_conversion\nend", "def gear_inches\n\tratio * diameter\nend", "def flamegraph_sample_rate; end", "def height_multiplier\n @height_multiplier || 1\n end", "def temperature_metrics\n super\n end", "def byte_rate\n Rational(size,duration)\n end", "def gear_inches\n ratio * diameter\nend", "def from_hms\n nums = split(':')\n\n nums[-1] = nums[-1].to_f if nums[-1] =~ /\\d+\\.\\d+/ # convert fractional seconds to a float\n nums.map! { |n| n.is_a?(String) ? n.to_i : n } # convert the rest to integers\n\n nums_and_units = nums.reverse.zip %w[seconds minutes hours days]\n nums_and_units.map { |num, units| num.send(units) }.sum\n end", "def from_hms\n nums = split(':')\n\n nums[-1] = nums[-1].to_f if nums[-1] =~ /\\d+\\.\\d+/ # convert fractional seconds to a float\n nums.map! { |n| n.is_a?(String) ? n.to_i : n } # convert the rest to integers\n\n nums_and_units = nums.reverse.zip %w[seconds minutes hours days]\n nums_and_units.map { |num, units| num.send(units) }.sum\n end", "def normalized_weighting\n BigDecimal(weight.to_s) / ReputationRule.sum('weight')\n end", "def capacity_to_demand_multiplier\n 3600.0\n end", "def original_weight\n @original_weight ||= (1.0 / (wrapper1.render.length * wrapper2.render.length))\n end", "def get_cost_for_duration(resource, duration) ; 1.0 end", "def tenure_mth\n self.tenure*12\n end", "def calc_total_weight\n 0\n end", "def mph\n \"#{(self * 1.15077945).round(1)} mph\"\n end", "def meal_weight_watchers(hash)\n calories_count = 0\n hash.each do |k, v|\n v.each do |key, value|\n calories_count = value * CALORIES[key] + calories_count\n end\n end\n return calories_count\nend", "def theCost\n # calculate the energy in kWh used in 24 hours at this power level\n # using (24x60x60 secs/day)/(1000x60x60 J/kWh) = 0.024 (kWh/day)/W\n kWh_per_day = 0.024*power\n # convert to an equivalent cost in cents\n return kWh_per_day*ATHOME['energy_cost']\n end", "def convert( temp_in_farenheit)\n (temp_in_farenheit.to_f - 32) * 5/9\nend", "def to_meter_per_second(**options) = convert_to('meter-per-second', **options)", "def geometric_factor\n hourly_beam_radiation_on_tilted_surface / hourly_beam_radiation_on_horizontal_surface\n end", "def totalMeters\n (self.floor_width*self.floor_length)\n end", "def to_revolution_per_meter(**options) = convert_to('revolution-per-meter', **options)", "def %(pitch) to_hz / pitch.to_hz end", "def time_conversion_factor\n @time_conversion_factor ||= dut_version < '0.8.0' ? 1 : 1000\n end", "def chp_usable_heat(val1 = total_mwh_ch4, val2 = 0.5)\n\t\t(val1 * val2).round 2\n\tend", "def body_math_index\n weight / (height * height)\n end", "def set_height_float\n h, f = height.split(\"-\")\n f = f.to_f/12\n h = h.to_f\n val = h+f\n self.update_attributes(height_float:val) \n end" ]
[ "0.6600409", "0.6600409", "0.6567237", "0.6251231", "0.62279135", "0.620538", "0.6165563", "0.61167747", "0.6103922", "0.60933155", "0.60524374", "0.5947633", "0.5933576", "0.587633", "0.5843534", "0.5796541", "0.57235616", "0.5709218", "0.5694761", "0.5650069", "0.5641966", "0.5619411", "0.56128216", "0.558865", "0.5585126", "0.5565692", "0.5562589", "0.55389094", "0.55296665", "0.5523472", "0.55198765", "0.55081403", "0.5499689", "0.5494423", "0.54867524", "0.54815793", "0.54711074", "0.54559594", "0.5444356", "0.5442343", "0.5442329", "0.5439959", "0.5437334", "0.543343", "0.5429729", "0.5424394", "0.5397668", "0.53940713", "0.5392368", "0.53906155", "0.5386096", "0.53651434", "0.53640217", "0.53566754", "0.53514934", "0.53514934", "0.5346245", "0.53448", "0.53370833", "0.5336023", "0.5336018", "0.5332697", "0.53290904", "0.5314469", "0.52964455", "0.5295187", "0.52899617", "0.5281812", "0.52807075", "0.52639776", "0.5258056", "0.5254933", "0.5252902", "0.52525455", "0.5249455", "0.52470696", "0.52436024", "0.5232144", "0.5232144", "0.52300936", "0.52285707", "0.52269775", "0.5224836", "0.5224372", "0.5221717", "0.52196884", "0.5217689", "0.52087605", "0.5201862", "0.51996505", "0.5185072", "0.5184149", "0.51814944", "0.5181103", "0.5180107", "0.5179597", "0.51780987", "0.5174753" ]
0.5396153
49
FIXME remove this dependency
def card_deck CardDeck.new(card: @subject) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def implementation; end", "def implementation; end", "def refutal()\n end", "def wrapper; end", "def probers; end", "def internal; end", "def schubert; end", "def custom; end", "def custom; end", "def weber; end", "def private_method\n end", "def ext; end", "def ext; end", "def init; end", "def init; end", "def init; end", "def init; end", "def external; end", "def reflector; end", "def reflector; end", "def initialize\n\n end", "def initialize\n\n end", "def isolated; end", "def isolated; end", "def extra; end", "def resolver; end", "def berlioz; end", "def implemented_in; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def init\n\n end", "def from; end", "def from; end", "def from; end", "def from; end", "def spec; end", "def spec; end", "def initialize() end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def handle; end", "def terpene; end", "def initialize\n super()\n end", "def initialize\r\n\r\n end" ]
[ "0.8048372", "0.6577844", "0.6577844", "0.6577844", "0.6577844", "0.6575336", "0.6575336", "0.646177", "0.6450023", "0.64455163", "0.6367529", "0.6237018", "0.61316365", "0.61316365", "0.6027642", "0.60081863", "0.6000104", "0.6000104", "0.59816575", "0.59816575", "0.59816575", "0.59816575", "0.5967584", "0.59396636", "0.59396636", "0.5916277", "0.5916277", "0.5860891", "0.5860891", "0.58581996", "0.58537364", "0.58430976", "0.58284414", "0.58192325", "0.58192325", "0.58192325", "0.58192325", "0.58192325", "0.58192325", "0.58192325", "0.58192325", "0.58192325", "0.58192325", "0.58192325", "0.5815703", "0.58083993", "0.58083993", "0.58083993", "0.58083993", "0.5806873", "0.5806873", "0.5792762", "0.5783955", "0.5783955", "0.5783955", "0.5783955", "0.5783955", "0.5783955", "0.5783955", "0.5783955", "0.5783955", "0.5783955", "0.57792675", "0.57792675", "0.57792675", "0.57792675", "0.5774914", "0.5774914", "0.5774914", "0.5774914", "0.5774914", "0.5774914", "0.5774914", "0.5774914", "0.5774914", "0.57748765", "0.57748765", "0.57748765", "0.57748765", "0.57748765", "0.57748765", "0.57748765", "0.57748765", "0.57748765", "0.57748765", "0.57748765", "0.57748765", "0.57748765", "0.57748765", "0.57748765", "0.57748765", "0.57748765", "0.57748765", "0.57748765", "0.57748765", "0.57748765", "0.57748765", "0.5772716", "0.5768215", "0.5766264", "0.5759491" ]
0.0
-1
FIXME remove this dependency
def avaiable_decks Deck.all.map { |d| [d.name, d.id] } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def implementation; end", "def implementation; end", "def refutal()\n end", "def wrapper; end", "def probers; end", "def internal; end", "def schubert; end", "def custom; end", "def custom; end", "def weber; end", "def private_method\n end", "def ext; end", "def ext; end", "def init; end", "def init; end", "def init; end", "def init; end", "def external; end", "def reflector; end", "def reflector; end", "def initialize\n\n end", "def initialize\n\n end", "def isolated; end", "def isolated; end", "def extra; end", "def resolver; end", "def berlioz; end", "def implemented_in; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def init\n\n end", "def from; end", "def from; end", "def from; end", "def from; end", "def spec; end", "def spec; end", "def initialize() end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def handle; end", "def terpene; end", "def initialize\n super()\n end", "def initialize\r\n\r\n end" ]
[ "0.8048372", "0.6577844", "0.6577844", "0.6577844", "0.6577844", "0.6575336", "0.6575336", "0.646177", "0.6450023", "0.64455163", "0.6367529", "0.6237018", "0.61316365", "0.61316365", "0.6027642", "0.60081863", "0.6000104", "0.6000104", "0.59816575", "0.59816575", "0.59816575", "0.59816575", "0.5967584", "0.59396636", "0.59396636", "0.5916277", "0.5916277", "0.5860891", "0.5860891", "0.58581996", "0.58537364", "0.58430976", "0.58284414", "0.58192325", "0.58192325", "0.58192325", "0.58192325", "0.58192325", "0.58192325", "0.58192325", "0.58192325", "0.58192325", "0.58192325", "0.58192325", "0.5815703", "0.58083993", "0.58083993", "0.58083993", "0.58083993", "0.5806873", "0.5806873", "0.5792762", "0.5783955", "0.5783955", "0.5783955", "0.5783955", "0.5783955", "0.5783955", "0.5783955", "0.5783955", "0.5783955", "0.5783955", "0.57792675", "0.57792675", "0.57792675", "0.57792675", "0.5774914", "0.5774914", "0.5774914", "0.5774914", "0.5774914", "0.5774914", "0.5774914", "0.5774914", "0.5774914", "0.57748765", "0.57748765", "0.57748765", "0.57748765", "0.57748765", "0.57748765", "0.57748765", "0.57748765", "0.57748765", "0.57748765", "0.57748765", "0.57748765", "0.57748765", "0.57748765", "0.57748765", "0.57748765", "0.57748765", "0.57748765", "0.57748765", "0.57748765", "0.57748765", "0.57748765", "0.5772716", "0.5768215", "0.5766264", "0.5759491" ]
0.0
-1
TODO: move this to an observer on KillEvent instead?
def send_death_notice(event) player = event.target_player if player.user.notify_death? notice = if (event.period.phase == :night) build_message(:death_villager_am) else # game.night? build_message("death_#{player.type}_pm") end GameBot.messages.dm(player.user.login, notice) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kill() end", "def kill!() end", "def kill\n sig :KILL\n end", "def kill\n send(:kill)\n end", "def stopKill\n self.stop_d\n return\n end", "def kill\n shutdown\n end", "def kill\n process_event_death\n super\n refresh\n puts \"#{event.id} #{event.name} killed\"\n end", "def kill!\n @kill = true\n end", "def kill\n signal(\"KILL\", scope: :all)\n cleanup\n end", "def kill\n @alive = false\n end", "def do_kill\n\n return kill_when_ended if node_ended?\n #return kill_when_closed if node_closed? # nothing of the sort\n\n kill\n end", "def on_kill\n\n # Commit last changes\n commit(true)\n\n # Join to the delete worker and wait wile it is done\n @thr_del_worker.join unless @thr_del_worker.nil?\n\n $log.info(self) {'Shutting down...'}\n\n # Here the thread is almost shut down\n end", "def kill\n @executor.shutdownNow\n nil\n end", "def destroy\n kill\n reset\n end", "def kill!\n @die = true\n end", "def kill\n @queue << \"kill\"\n end", "def on_quitting\n end", "def kill\n\n close_node\n\n wrap_cancel_children('flavour' => 'kill') +\n wrap_cancelled\n end", "def reaper\n pstate = wait(0.5)\n do_kill(\"KILL\") unless pstate\n end", "def kill\n process_actor_death\n super\n end", "def shutdown!\n _shutdown 'SIGKILL' unless dead?\n end", "def kill\n ck_valid\n Process.kill 9, @pid if running?\n\n invalidate\n end", "def kill_action\n validate :signal, :shellsafe\n validate :pid, /^\\d+$/\n\n killpid(request[:signal], request[:pid].to_i)\n\n if reply.statuscode == 0\n reply[:killed] = 1\n else\n reply[:killed] = 0\n end\n end", "def teardown\n Process.kill('KILL',@pid)\n end", "def on_shutdown\n\t\tend", "def kill_when_ended\n\n [] # no effect\n end", "def stop\n control :kill\n self\n end", "def kill\n\t\tframework.sessions.deregister(self)\n\tend", "def kill\n\t\tframework.sessions.deregister(self)\n\tend", "def track_killed_by?\n false\n end", "def signal; end", "def signal; end", "def kill\n server.kill\n end", "def msg_KILL(source, args)\n return nil\n end", "def on_quit\n end", "def terminate\n \n\tend", "def kill_user *args\r\n puts \"not implemented yet\"\r\n end", "def kill instance, why\n\t\t\tbegin\n\t\t\t\tProcess.kill 15, instance.pid\n\t\t\t\tsleep 0.2\n\t\t\t\tProcess.kill 9, instance.pid\n\t\t\trescue Errno::ESRCH\n\t\t\t\t# We can safely ignore it if the thing has already died.\n\t\t\tend\n\t\t\tinstance.killed! why\n\t\t\treconfigure_rproxies\n\t\tend", "def daemon_stopped?; end", "def terminate() end", "def kill(pid)\n process_kill(9, pid) #SIGKILL\n @pids.delete(pid)\n\n end", "def update_killed\n # deleted killed\n deleted_killed = []\n # iterate through all killed\n $game_system.killed.each_key {|key|\n # decrease respawn counter\n $game_system.killed[key] -= 1\n # if dead enemy has event code to be executed\n if key.execute\n # update interpreter\n key.update\n # if respawn counter reached 0\n elsif $game_system.killed[key] <= 0\n # remove from map\n $game_map.events.delete(key.id)\n # if respawning available\n if $game_system.respawn_time > 0 || key.respawn_point != nil\n # add new enemy on old enemy's place\n $game_map.events[key.id] = respawn_enemy(key)\n end\n # this enemy is not \"killed\" anymore\n deleted_killed.push(key)\n end}\n # remove deleted values\n deleted_killed.each {|key| $game_system.killed.delete(key)}\n end", "def bkg_kill\n reload\n while processing?\n sleep 1\n reload\n end\n if dj\n dj.destroy\n save\n end\n end", "def quit_on_delete!\n on_delete do\n quit\n end\n end", "def wakeup() end", "def kill_on_ctrl_c(pids, options); end", "def stopping; end", "def wakeup; end", "def interrupt()\n Process.kill \"TERM\", *(@@children.pids) rescue nil\n end", "def shutdown; end", "def shutdown; end", "def shutdown; end", "def shutdown; end", "def shutdown; end", "def shutdown; end", "def shutdown; end", "def unwatch; end", "def unwatch; end", "def on_termination_signal( signo )\n\t\tself.log.warn \"Terminated (%p)\" % [ signo ]\n\t\tself.shutdown\n\tend", "def kill(n, c)\n @socket << \"KILL #{n} :#{c}\"\n end", "def handle_kill(message)\n Tangle.logger.info '[faye] kill received'\n user = extract_user message\n return unless (term = TTY[user, message[:data][:id]])\n term.write.close\n end", "def terminate\n end", "def removed_signal(child)\n\t super\n invalidate_task_terminal_flag_if_needed(child)\n\tend", "def request_termination\n @sigterm_timer.cancel if @sigterm_timer\n ::Process.kill('TERM', @pid) rescue nil\n end", "def kill\n stop_propagation\n prevent_default\n end", "def shutdown\n @running = false\n \n super\n \n end", "def kill(signo)\n Process.kill(signo, pid)\n end", "def on_exit\n end", "def kill_and_reap(pids)\n puts \"Sending signals...\"\n sig = :KILL\n pids.each do |pid|\n puts \"== kill #{pid} with #{sig}\"\n Process.kill(sig, -1 * pid.to_i)\n end\n\n pids.each do |pid|\n puts \"=== Waiting for: #{pid} #{Process.waitpid2(pid)}\"\n end\nend", "def stopped?; end", "def stopped?; end", "def stopped?; end", "def stopped?; end", "def signal\n end", "def shutdown?; end", "def signal_received; end", "def on_end_process()\n # subclasses may override this method\n end", "def on_app_stopping(_event)\n setproctitle('stopping')\n end", "def terminate\n self.destroy\n end", "def stop; end", "def stop; end", "def stop; end", "def stop; end", "def stop; end", "def stop; end", "def stop; end", "def do_exit\n log \"caught signal, shutting down\"\n self.class.remove_pid_file\n exit 130\n end", "def kill\n return if @io.nil?\n\n existed = false\n @signals.each do |sig|\n begin\n Process.kill sig, @pid\n existed = true\n rescue Errno::ESRCH, Errno::ENOENT\n return(existed ? nil : true)\n end\n return true unless alive?\n sleep @suspend\n return true unless alive?\n end\n return !alive?\n end", "def terminate\n end", "def shutdown!; end", "def shutdown!; end", "def shutdown!; end", "def removed_signal(child)\n super\n invalidate_task_terminal_flag_if_needed(child)\n end", "def kill\n Window.functions[__method__] ||= AU3_Function.new(\"WinKill\", 'SS', 'L')\n Window.functions[__method__].call(@title.wide, @text.wide)\n nil\n end", "def destroy\n Process.kill(9, pid)\n end", "def kill!\n @die = true\n @died_time = Gosu.milliseconds if !@died_time\n end", "def kill\n unless pid.nil?\n WITH_PBS ? `qdel #{pid}` : Process.kill(\"TERM\", -pid.to_i)\n set_status! :m\n end\n end", "def kill\n Souffle::Log.info \"#{@node.log_prefix} Killing node...\"\n provider.kill([@node])\n end", "def shutdown_execution\n stopped_event.set\n end", "def shutdown\n if self.respond_to?(:before_stop)\n before_stop\n end\n # change the pid file so the original process sees this 'stop' signal \n File.open(_pid_filename, 'a') do |f|\n f.write(\"\\n#{ACTS_AS_SERVICE_SHUTTING_DOWN}\")\n end\n end", "def will_quit\n end" ]
[ "0.7696609", "0.7421442", "0.69308096", "0.6895599", "0.68940264", "0.68204695", "0.679312", "0.6786746", "0.6726199", "0.665944", "0.656929", "0.65375704", "0.6498201", "0.6442205", "0.6391672", "0.6369363", "0.63597107", "0.63446933", "0.63386184", "0.6292023", "0.61830896", "0.6173683", "0.61508197", "0.6140355", "0.61152107", "0.60861284", "0.606592", "0.60307217", "0.6030355", "0.6029856", "0.6018378", "0.6018378", "0.60139096", "0.59824204", "0.59742284", "0.596979", "0.5968076", "0.59561646", "0.59546536", "0.5953948", "0.5938441", "0.5930233", "0.5927643", "0.59221315", "0.59145796", "0.59048784", "0.58938485", "0.5893362", "0.5892865", "0.5890633", "0.5890633", "0.5890633", "0.5890633", "0.5890633", "0.5890633", "0.5890633", "0.5879719", "0.5879719", "0.58775467", "0.5869362", "0.5861515", "0.5856584", "0.5842157", "0.584198", "0.581967", "0.58123904", "0.58035654", "0.579807", "0.57930917", "0.5792963", "0.5792963", "0.5792963", "0.5792963", "0.5786468", "0.578543", "0.5784745", "0.5779439", "0.5776544", "0.5772817", "0.5771011", "0.5771011", "0.5771011", "0.5771011", "0.5771011", "0.5771011", "0.5771011", "0.5757305", "0.5756762", "0.57538855", "0.5748822", "0.5748822", "0.5748822", "0.57471496", "0.5742747", "0.5742564", "0.57357055", "0.5706828", "0.57039", "0.57025534", "0.5699991", "0.5699745" ]
0.0
-1
friends name in it. If a name has exactly 4 letters in it, you can be sure that it has to be a friend of yours! Otherwise, you can be sure he's not... Ex: Input = ["Ryan", "Kieran", "Jason", "Yous"], Output = ["Ryan", "Yous"] Note: keep the original order of the names in the output. def friend(array) b = [] n = array.size for i in (0..n1) do if array[i].size == 4 b << array[i] end end p b end
def friend(array) array.select { |e| e if e.size == 4 } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def friend(friends)\r\n friends_name = []\r\n friends.each {|friend| friends_name.push(friend) if friend.length == 4}\r\n return friends_name\r\nend", "def friend(friends)\n \n friend_array = []\n friends.each { |x| if x.length == 4 then friend_array.push(x) end}\n \nreturn friend_array \n \nend", "def friend(friends)\narr = []\nfriends.each {|x| arr << x if x.length == 4}\narr\nend", "def friend(friends)\n friends.select do |friend|\n friend.length == 4\n end\nend", "def friend(friends)\n friends = [\"Ryan\", \"Kieran\", \"Jason\", \"Mark\"]\n friends.select {|friends| put friends if friends.length = 4}\nend", "def friend(friends)\n \n return [] if friends.empty? \n friends=friends.split(\",\") if (friends.is_a? String)\n friends.select{|friend| friend.length==4 && (friend.is_a? String)}\nend", "def friend(friends)\n x = []\n friends.each {\n |i| puts i.length\n if i.length == 4 \n x.push(i)\n end \n }\n x\nend", "def is_friend?(all_friends, friend_name)\n # loop over each friend in friend array\n # get friend's name\n # if friend's name == friend_name,\n # return true\n # at end of loop, if friend name not found\n # return false\n\nend", "def found_friends(people)\n friends = []\n people.each do |person|\n if (person == \"Don\")\n friends << \"Don\"\n end\n if (person == \"John\")\n friends << \"John\"\n end\n if (person == \"Kent\")\n friends << \"Kent\"\n end\n end\n return friends\nend", "def is_four_letters(arr)\n\tnew_arr = []\n\tarr.each { |x| new_arr << x if x.length == 4}\n\treturn new_arr\nend", "def names_thingy\n arr = %w(John, KB, Oliver, Cory, Matthew, Christopher)\n arr.shuffle!\n for name in arr\n puts name\n end\n arr.reject { |elem| elem.length <= 5 }\nend", "def is_friend(word1, word2)\n\n # Get the difference in length of the words\n difference = (word1.length - word2.length).abs\n \n #If the difference is greater than 1, then the words can't be friends. \n if difference > 1\n return false\n\n # If they are the same word, they can't be friends.\n elsif word1 == word2\n return false\n\n # If the difference in length is 1 or 0 they could potentially be friends.\n elsif difference == 1 or difference == 0\n\n # Boolean to tell if the words are the same length or not\n same_length = (difference == 0)\n\n # Determines which word is longer, and stores it in the appropriate place.\n # If they are the same length, word1 will be the \"longer\" word\n longer_word = (word1.length > word2.length ? word1 : word2)\n shorter_word = (word1.length > word2.length ? word2 : word1)\n\n # Loop through each letter to compare them, with the maximum index being the length of the longer word\n (0..longer_word.length).each do |i|\n # if the letters are the same, move on\n if word1[i] == word2[i]\n next\n\n # If they aren't the same, then they are at least one letter off. \n # Now check to see if they are more than one letter off. \n else\n # If the mismatched words are the same length, the remainder of each word must match for them to be friends. \n if same_length\n word1_remainder = word1[i+1...word1.length]\n word2_remainder = word2[i+1...word2.length]\n\n if word1_remainder == word2_remainder\n return true\n else\n return false\n end\n\n # If the mismatched words are not the same length, then the remainder of the longer word \n # must match the remainder of the shorter word including the letter where the mismatch occured.\n else\n longer_word_remainder = longer_word[i+1...longer_word.length]\n # Note that the beginning index for the shorter word is `i` instead of `i+1`.\n shorter_word_remainder = shorter_word[i...shorter_word.length]\n\n if longer_word_remainder == shorter_word_remainder\n return true\n else\n return false\n end\n end\n end\n end\n end\n\n # This should never be hit, but if it does, return that the two words are not friends. \n return false\nend", "def likes(names)\n result = \"\"\n if names.length == 1\n result = names[0] + \" likes this\"\n elsif names.length == 2\n result = names[0] + \" and \" + names[1] + \" like this\"\n elsif names.length == 3\n result = names[0] + \", \" + names[1] + \" and \" + names[2] + \" like this\"\n elsif names.length >= 4\n result = names[0] + \", \" + names[1] + \" and \" + \"#{names.length - 2}\" + \" others like this\"\n elsif names.empty?\n result = \"No one likes this\"\n end\n return result\nend", "def nombres(arr)\n puts arr.shuffle.join(\" \")\n puts arr.select{ |nombre| nombre.length>5 }.join(\" \")\nend", "def acct(array_of_names)\n\tbig_array = []\n\tarray_of_names.each_slice(5){|names| big_array << names}\n\t\n\tif big_array.any?{|subarray| subarray.length < 5}\n\tsubarray = big_array.select{|subarray| subarray.length < 5}.flatten\n\tbig_array.map do |extras|\n\t\tbreak if subarray.empty?\n\t\textras << subarray.shift\n\t\tend\n\tend\nend", "def likes(names)\n if names.any? == false\n puts \"no one likes this\"\n elsif names.length == 1\n puts names.join(' ') + \" likes this\"\n elsif names.length == 2\n names = names.values_at(0, 1)\n puts names.join(' and ') + \" like this\"\n elsif names.length == 3\n first = names.values_at(0)\n final = names.values_at(1, 2)\n puts first.join('') + \", \" + final.join(' and ') + \" like this\"\n elsif names.length > 3\n first = names.values_at(0, 1)\n puts first.join(', ') + \" and #{names.length - 2} others like this\"\n end\nend", "def likes(names)\n remaining = names.length - 2\n\n if (names.length === 0) \n return \"no one likes this\"\n elsif (names.length === 1) \n return names[0] + \" likes this\"\n elsif (names.length === 2) \n return names[0] + \" and \" + names[1] + \" like this\"\n elsif (names.length === 3) \n return names[0] + \", \" + names[1] + \" and \" + names[2] + \" like this\"\n elsif (names.length > 3) \n return names[0] + \", \" + names[1] + \" and \" + remaining.to_s + \" others like this\"\n end\nend", "def fidder_crabs(names)\n\n # Create empty container for everyone in the group\n everybody = Hash.new\n # Create a counter for group number, defalt to 1\n counter = 1\n\n names.shuffle\n #Mix it up.!!!!!\n\n #while the list is longer than 8 people, put 5 each in a group.\n while names.length >= 8 do\n names_in_group = names[0..4]\n everybody[counter] = names_in_group\n counter +=1\n names = names.drop(5)\n end\n\n #if the remainder is 5, have the last group with 5 people\n if names.length == 5\n names_in_group = names[0..4]\n everybody[counter] = names_in_group\n counter += 1\n names = names.drop(5)\n\n #if the remaiinder group is 7, then we need to split the group into 4 and 3\n elsif names.length == 7\n names_in_group = names[0..3]\n everybody[counter] = names_in_group\n counter += 1\n names = names.drop(4)\n #creating the last group\n names_in_group = names[0..2]\n everybody[counter] = names_in_group\n counter += 1\n names = names.drop(3)\n\n #if the remainder is 6, we can have 2 groups of 3's\n elsif names.length == 6\n names_in_group = names[0..2]\n everybody[counter] = names_in_group\n counter += 1\n names = names.drop(3)\n #creating last group of 3\n names_in_group = names[0..2]\n everybody[counter] = names_in_group\n counter += 1\n names = names.drop(3)\n\n #if there is a remainder of 4 then create 1 group\n elsif names.length == 4\n names_in_group = names[0..3]\n everybody[counter] = names_in_group\n counter += 1\n names = names.drop(4)\n\n #if the remainder is 3, then create the last group with 3\n elsif names.length == 3\n names_in_group = names[0..2]\n everybody[counter] = names_in_group\n counter += 1\n names = names.drop(3)\n else\n names.length < 3\n names_in_group = names[0..1]\n everybody[counter] = names_in_group\n names = names.drop(3)\n end\n\n # since we filter by 8, the highest remainder is 7 and the lowest is 3, only 7 and 6 need to be split into 2 groups, while 3 and 4 could be in 1 group by themselfs.\n everybody\n #Return the hash of everybody in their group number with their names.\nend", "def find_people_with_no_friends(people)\n no_friends_array = []\n for person in people\n if person[:friends].length() == 0\n no_friends_array << person[:name]\n end\n end\n return no_friends_array\nend", "def name_muddler (array)\nvowels = [\"a\",\"e\",\"i\",\"o\",\"u\"]\nconsonants = \"bcdfghjklmnpqrstvwxyz\"\nconsonant_array = consonants.chars \nnew_name = []\nindex = 0\nwhile index < array.length\n if array[index] == \"u\"\n new_name[index] = \"a\"\n elsif vowels.include?(array[index])\n new_name[index] = vowels[vowels.index(array[index]).next]\n elsif array[index] == \"z\"\n new_name[index] = \"b\"\n else new_name[index] = consonant_array[consonant_array.index(array[index]).next]\n end\n index += 1\nend \nreturn new_name\nend", "def no_friends(people)\n no_friends = []\n for person in people\n if person[:friends] == []\n no_friends.push(person[:name])\n end\n end\n return no_friends\nend", "def check_twolast_include name_array, letters\n if name_array.length < 2 # If the name lenght is inferior to two,\n return false # return a negative answer,\n else # or else,\n return name_array.last(2).all? { |char| letters.include? char } # return if the two last characters of the name are from the same group or not.\n end\nend", "def find_no_friends(people)\n no_mates = []\n for person in people\n if person[:friends].length == 0\n no_mates.push(person)\n end\n end\n return no_mates\nend", "def add_friends(friends_array,name)\n friends_array << name\nend", "def likes(names)\n if names.size == 0\n \"no one likes this\"\n elsif names.size == 1\n \"#{names[0]} likes this\"\n elsif names.size == 2\n \"#{names[0]} and #{names[1]} like this\"\n elsif names.size == 3\n \"#{names[0]}, #{names[1]} and #{names[-1]} like this\"\n else\n \"#{names[0]}, #{names[1]} and #{names[2..-1].size} others like this\"\n end\nend", "def loners(people)\n lonely_array = []\n for person in people\n if person[:friends] == []\n lonely_array.push(person[:name])\n end\n end\n return lonely_array\nend", "def likes(names)\n return \"no one likes this\" if names.empty? == true\n return \"#{names[0]} likes this\" if names.count == 1 \n return \"#{names[0]} and #{names[1]} like this\" if names.count == 2 \n return \"#{names[0]}, #{names[1]} and #{names[2]} like this\" if names.count == 3\n return \"#{names[0]}, #{names[1]} and 2 others like this\" if names.count == 4\n return \"#{names[0]}, #{names[1]} and #{names.count - 2} others like this\" if names.count > 4\nend", "def long_planeteer_calls(names)\n names.any? {|name| name.length > 4}\n \nend", "def consonant_checker(array)\n consonant_guide = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n array.map! do |name|\n name_split = name.split('')\n name_split.map! do |char|\n index = 0\n while index < consonant_guide.length\n if char == consonant_guide[index]\n char = consonant_guide[index += 1]\n index += 1\n elsif char == \"z\"\n char = \"b\"\n index += 1\n else\n char\n index += 1\n end\n char\n end\n char\n end\n name_split\n name_join = name_split.join('').capitalize!\n name_join\n end\n p array\nend", "def puzzle_2 \n newArr = []\n arr = [\"John\", \"KB\", \"Oliver\", \"Cory\", \"Matthew\", \"Christoper\"]\n arr.shuffle!\n for i in arr\n puts i\n newArr << i if i.length > 5\n end\n puts newArr\nend", "def likes(names)\n print names.split\nend", "def friends\n output = []\n friendships.each do |f|\n output << f.friend\n end\n output\n end", "def method_people(names, number)\n names_array = names.shuffle.map\n teams = (names.length.to_f / number).ceil\n new_array = Array.new(teams) { Array.new }\n count = 0\n names_array.map do |name|\n new_array[count] << name\n count == (teams - 1) ? (count = 0) : (count += 1)\n end\n new_array\n end", "def short_names\n list_new = []\n @students.each do |student|\n if student[:name].length < 12\n list_new << student\n end\n end\n puts \"These names are shorter than 12 characters in length.\".center(70)\n print(list_new)\nend", "def test4(array)\n\tputs \"Test4: Groups should have 4 members max -> \"\n\tabg_maker(array).any? {|x| x.length > 4} ? false : true\nend", "def got_three? a\n b = a.uniq.sort\n arr = []\n x = 0\n while x < b.count\n c = (b[x].to_s + ' ') * 2 + b[x].to_s\n arr << (a.join(\" \").include? c) \n x = x + 1\n end\n arr.include? true\nend", "def likes(names)\n return 'no one likes this' if names == []\n return \"#{names[0]} likes this\"if names.length == 1\n return \"#{names[0]} and #{names[1]} like this\"if names.length == 2\n return \"#{names[0]}, #{names[1]} and #{names[2]} like this\"if names.length == 3\n return \"#{names[0]}, #{names[1]} and #{names.length - 2} others like this\"if names.length > 3\nend", "def long_planeteer_calls(array)\n array.any? do |word|\n word.size > 4\n end\nend", "def match(array)\n array.keep_if do |string|\n #keep_if is a method that removes anything false and keep only elements that are true\n #binding.pry\n name.split(\"\").sort == string.split(\"\").sort\n #<- name here is being split and then being sorted and checking if it is equal to string element also being splitted and sorted\n #<- once its false, keep_if will remove both of them and only keep the elements that are true.\n end\nend", "def likes(names)\n case names.size\n when 0\n \"no one likes this\"\n when 1\n \"#{names[0]} likes this\"\n when 2\n \"#{names[0]} and #{names[1]} like this\"\n when 3\n \"#{names[0]}, #{names[1]} and #{names[2]} like this\"\n else\n \"#{names[0]}, #{names[1]} and #{names.size - 2} others like this\"\n end\nend", "def likes(names)\n who = case names.size\n when 0\n 'no one'\n when 1\n names[0]\n when 2\n names.join(' and ')\n when 3\n \"#{names[0]}, #{names[1]} and #{names[2]}\"\n else\n \"#{names[0]}, #{names[1]} and #{names.size - 2} others\"\n end\n\n \"#{who} like#{'s' if names.empty? || names.one?} this\"\nend", "def friends_formatted\n uri = self.uri\n query = Ruta::Sparql.select.where(\n [uri, RDF::FOAF.knows, :friend],\n [:friend, RDF::FOAF.name, :realname]\n )\n nfriends = []\n query.each_solution { |sol| nfriends.push({id: sol.friend.as(Member).get_id, realname: sol.realname.to_s}) }\n nfriends\n end", "def long_planeteer_calls(array)\n array.any? { |word| word.length > 4}\nend", "def every_possible_pairing_of_students(array)\n\tn = ['Bob', 'Dave', 'Clive']\n\tn.combination(2)\nend", "def likes(names)\ncounts = names.count - 2\n if names.count == 0 \n return 'no one likes this'\n elsif names.count == 1\n return names[0] +' likes this'\n elsif names.count == 2\n return names[0] + ' and '+ names[1] + ' like this'\n elsif names.count == 3 \n return names[0] + ', ' + names[1] + ' and ' + names[2] + ' like this'\n else \n return names[0] + ', ' + names[1] + ' and ' + counts.to_s + ' others like this'\n end\nend", "def long_planeteer_calls(array)\n array.any? do |word|\n word.length > 4 \n end \nend", "def getDirectFriends(name) \n validate_arguments([name])\n matched_friendships = [] \n registered_friends.each do |friendship_instance|\n (matched_friendships << friendship_instance) if (friendship_instance.include?(name))\n end\n friends_list = []\n matched_friendships.each { instance| friends_list << instance.delete(name)}\n direct_friends = friends_list.uniq.flatten\n return direct_friends\n \n end", "def likes(names)\n return 'no one likes this' if names.empty?\n ending = names.size > 1 ? ' like this' : ' likes this'\n\n namescopy = names.dup\n string = namescopy.shift\n\n case\n when namescopy.size == 1\n string += \" and #{namescopy.shift}\"\n\n when namescopy.size == 2\n string += \", #{namescopy.shift} and #{namescopy.shift}\"\n\n when namescopy.size > 2\n string += \", #{namescopy.shift} and #{namescopy.size} others\"\n end\n string += ending\nend", "def find_socks_in_array(array)\n array.include? \"socks\"\n puts \"Found #{num_socks} socks!\"\nend", "def acct(array_of_names)\n\tarray_of_names.each_slice(5) {|names| p names}\n\t\nend", "def friend_names(reverse_alphabetical: false)\n names = friends.map(&:name).sort\n reverse_alphabetical ? names.reverse : names\n end", "def names\n nameparts = name.split(' ')\n firstinitial = nameparts.second ? \"#{firstname[0, 1]}.\" : ''\n secondname = nameparts.third ? nameparts.second : ''\n secondinitial = nameparts.third ? \"#{secondname[0, 1]}.\" : ''\n middlenames = nameparts.length > 2 ? nameparts.from(1).to(nameparts.from(1).length - 2) : []\n middleinitials = ''\n middlenames.each_with_index do |name, index|\n middleinitials << ' ' if index.positive?\n middleinitials << \"#{name.to_s[0, 1]}.\"\n end\n lastname = nameparts.last\n names = []\n names << full_name # Joseph Aloysius Hansom\n names << \"#{title} #{name}\" if titled? # Sir Joseph Aloysius Hansom\n names += aka # Boz, Charlie Cheese, and Crackers\n names << \"#{title} #{firstinitial} #{middleinitials} #{lastname}\" if titled? && nameparts.length > 2\n names << \"#{title} #{firstinitial} #{lastname}\" if titled? && nameparts.length > 1\n names << name if name != full_name # Joseph Aloysius Hansom\n if name.include? ',' # George Inn, Barcombe\n names << name.split(/,/).first\n return names\n end\n names << \"#{title} #{name.split(/ of /).first}\" if name.include?(' of ') && titled? # King Charles II [of England]\n names << name.split(/ of /).first if name.include?(' of ') # [King] Charles II [of England]\n names << \"#{firstname} #{middleinitials} #{lastname}\" if nameparts.length > 2 # Joseph A[loysius]. R[obert]. Hansom\n names << \"#{firstinitial} #{middleinitials} #{lastname}\" if nameparts.length > 2 # J. A. R. Hansom\n names << \"#{firstname} #{nameparts.second} #{lastname}\" if nameparts.length > 2 # Joseph Aaron Hansom\n names << \"#{firstname} #{secondinitial} #{lastname}\" if nameparts.length > 2 # Joseph A. Hansom\n names << \"#{firstinitial} #{secondname} #{lastname}\" if nameparts.length > 2 # J. Aaron Hansom\n names << \"#{title} #{firstname} #{lastname}\" if nameparts.length > 2 && titled? # Sir Joseph Hansom\n names << \"#{firstname} #{lastname}\" if nameparts.length > 2 # Joseph Hansom\n names << \"#{firstinitial} #{lastname}\" if nameparts.length > 1 # J. Hansom\n names << \"#{title} #{lastname}\" if titled? # Lord Carlisle\n names << \"#{title} #{firstname}\" if titled? # Sir William\n names << firstname if nameparts.length > 1 # Charles\n names << lastname if nameparts.length > 1 # Kitchener\n names.uniq\n end", "def match_hobbies(person)\n\n matched_hobbies = []\n\n hobbies.each{|hobby|\n if(person.hobbies.include?(hobby))\n matched_hobbies.push(hobby)\n # puts(\"Matched hobby: \" + hobby)\n end\n }\n end", "def name_array(array)\n group_size = 2\n # number_of_elements = array.length\n # number_of_arrays = number_of_elements / group_size.to_i\n shuffled = array.shuffle\n sliced = shuffled.each_slice(group_size).to_a\n if shuffled.length % 2 == 1\n sliced[-2] << sliced[-1][0]\n sliced.delete_at(-1)\n else\n sliced\n end\n sliced\nend", "def names_two(names)\n\t\tnames.map{ |i| %Q('#{i}') }.join(',')\n\t\tnames = names.map(&:capitalize)\n\t\tlittle_array = []\n\t\tsets = names.shuffle\n\tif names.length % 2 == 0\n\t\ta = names.length/2\n\t\ta.times do \n\t\tsets_1 = sets.pop(2).to_a\n\t\tlittle_array << sets_1\n\t\tset_1 = 0\n\tend\n\n\telse \n\t\textra = sets.pop\n\t\tb = names.length/2\n\t\tb.times do \n\t\tsets_1 = sets.pop(2).to_a\n\t\tlittle_array << sets_1\n\t\tset_1 = 0\n\tend\n\tlittle_array[0] << extra\nend\nclean_array = clean(little_array)\np clean_array\nend", "def groups(array_of_names)\r\n\r\n\tnum_people = array_of_names.length \t\t#how many people do we have?\r\n\tgroups_5 = num_people % 4 \t#how many groups will have 5\r\n\tgroups_4 = (num_people - (groups_5 * 5)) / 4 # how many groups will have 4\r\n\ttotal_groups = groups_4 + groups_5 \t\t#how many total groups\r\n\r\n\tgroup_hash = Hash.new([])\t#new hash initialized to empty arrays\r\n\t\r\n\tnum_group = 0\r\n\tindex = 0\r\n\r\n\tgroups_5.times do\r\n\t\tpeople_in_group = []\r\n\t\t5.times do\r\n\t\t\tpeople_in_group << array_of_names[index]\r\n\t\t\tindex += 1\r\n\t\tend\r\n\t\tgroup_hash[\"Accountability Group #{num_group}\"] = people_in_group\r\n\t\tnum_group += 1\r\n\tend\r\n\r\n\tgroups_4.times do\r\n\t\tpeople_in_group = []\r\n\t\t4.times do\r\n\t\t\tpeople_in_group << array_of_names[index]\r\n\t\t\tindex += 1\r\n\t\tend\r\n\t\tgroup_hash[\"Accountability Group #{num_group}\"] = people_in_group\r\n\t\tnum_group += 1\r\n\tend\r\n\r\n\treturn group_hash\r\n\r\nend", "def print_A_student(arr_name)\n\tprint(arr_name.select { |name| name[:names].slice(0) == 'A'})\nend", "def is_friends_with?(friend)\n \t friends.include?(friend)\n \t end", "def test4(array)\n\tputs \"Test4: Groups should have 4 members max -> \"\n\tgroupMaker(array).any? {|x| x.length > 4} ? false : true\nend", "def friend_by_last_name\n\t @friend_alphabet.each do |openstruct_letter|\n\t if openstruct_letter.letter.eql?(params[:sort_letter])\n\t openstruct_letter.active_status = true\n\t\t end\n\t end\n\t @friends.delete_if {|individual_user| individual_user.facebook_name.split(' ').last[0,1].upcase.eql?(params[:sort_letter]) == false}\n end", "def vowel_checker(array)\n vowel_guide = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n array.map! do |name|\n name_split = name.split('')\n name_split.map! do |char|\n index = 0\n while index < vowel_guide.length\n if char == vowel_guide[index]\n char = vowel_guide[index += 1]\n index += 1\n elsif char == \"u\"\n char = \"a\"\n index += 1\n else\n char\n index += 1\n end\n char\n end\n char\n end\n name_split\n name_join = name_split.join('')\n name_join\n end\n array\nend", "def select_largo_may_5(names)\n imp= names.select{|nombres|nombres.length >5} \n print \"los nombres que son más largos de 5#{imp} \\n\"\nend", "def getIndirectFriends(name)\n validate_arguments([name])\n direct_friends = self.getDirectFriends(name)\n indirect_firends = [] \n intermediate = direct_friends\n while true do \n intermediate.each { |friend| current_iteration << self.getDirectFriends(friend)}\n break if current_iteration.all? { |friend| indirect_friends.include?(friend) }\n current_iteration.uniq.each { |friend| indirect_firends << friend}\n indirect_firends.uniq!\n intermediate = current_iteration\n current_iteration = [] \n end\n return indirect_firends\n end", "def allowed_friend?(friend)\n @allowed.include? friend.to_s.split('/').first\n end", "def acc_group(names)\n\tnames.shuffle!\n\tgroups = names.each_slice(4).to_a\n\tif names.length % 4 == 1\n\t\tgroups[0] << groups.last[0]\n\t\tgroups.pop\n\telsif names.length % 4 == 2\n\t\tgroups[0] << groups.last[0]\n\t\tgroups[1] << groups.last[1]\n\t\tgroups.pop\n\telsif names.length % 4 == 3\n\t\tgroups[0] << groups.last[0]\n\t\tgroups[1] << groups.last[1]\n\t\tgroups[2] << groups.last[2]\n\t\tgroups.pop\n\tend\n\ti = 1\n\twhile i <= groups.length\n\t\tputs \"Group \" + i.to_s\n\t\tputs groups[i-1]\n\t\ti += 1\n\tend\nend", "def male_name\n\t%w[Aaron Abdul Abe Abel Abraham Abram Adalberto Adam Adan Adolfo Adolph Adrian Agustin Ahmad Ahmed Al Alan Albert Alberto Alden Aldo Alec Alejandro Alex Alexander Alexis Alfonso Alfonzo Alfred Alfredo Ali Allan Allen Alonso Alonzo Alphonse Alphonso Alton Alva Alvaro Alvin Amado Ambrose Amos Anderson Andre Andrea Andreas Andres Andrew Andy Angel Angelo Anibal Anthony Antione Antoine Anton Antone Antonia Antonio Antony Antwan Archie Arden Ariel Arlen Arlie Armand Armando Arnold Arnoldo Arnulfo Aron Arron Art Arthur Arturo Asa Ashley Aubrey August Augustine Augustus Aurelio Austin Avery Barney Barrett Barry Bart Barton Basil Beau Ben Benedict Benito Benjamin Bennett Bennie Benny Benton Bernard Bernardo Bernie Berry Bert Bertram Bill Billie Billy Blaine Blair Blake Bo Bob Bobbie Bobby Booker Boris Boyce Boyd Brad Bradford Bradley Bradly Brady Brain Branden Brandon Brant Brendan Brendon Brent Brenton Bret Brett Brian Brice Britt Brock Broderick Brooks Bruce Bruno Bryan Bryant Bryce Bryon Buck Bud Buddy Buford Burl Burt Burton Buster Byron Caleb Calvin Cameron Carey Carl Carlo Carlos Carlton Carmelo Carmen Carmine Carol Carrol Carroll Carson Carter Cary Casey Cecil Cedric Cedrick Cesar Chad Chadwick Chance Chang Charles Charley Charlie Chas Chase Chauncey Chester Chet Chi Chong Chris Christian Christoper Christopher Chuck Chung Clair Clarence Clark Claud Claude Claudio Clay Clayton Clement Clemente Cleo Cletus Cleveland Cliff Clifford Clifton Clint Clinton Clyde Cody Colby Cole Coleman Colin Collin Colton Columbus Connie Conrad Cordell Corey Cornelius Cornell Cortez Cory Courtney Coy Craig Cristobal Cristopher Cruz Curt Curtis Cyril Cyrus Dale Dallas Dalton Damian Damien Damion Damon Dan Dana Dane Danial Daniel Danilo Dannie Danny Dante Darell Daren Darin Dario Darius Darnell Daron Darrel Darrell Darren Darrick Darrin Darron Darryl Darwin Daryl Dave David Davis Dean Deandre Deangelo Dee Del Delbert Delmar Delmer Demarcus Demetrius Denis Dennis Denny Denver Deon Derek Derick Derrick Deshawn Desmond Devin Devon Dewayne Dewey Dewitt Dexter Dick Diego Dillon Dino Dion Dirk Domenic Domingo Dominic Dominick Dominique Don Donald Dong Donn Donnell Donnie Donny Donovan Donte Dorian Dorsey Doug Douglas Douglass Doyle Drew Duane Dudley Duncan Dustin Dusty Dwain Dwayne Dwight Dylan Earl Earle Earnest Ed Eddie Eddy Edgar Edgardo Edison Edmond Edmund Edmundo Eduardo Edward Edwardo Edwin Efrain Efren Elbert Elden Eldon Eldridge Eli Elias Elijah Eliseo Elisha Elliot Elliott Ellis Ellsworth Elmer Elmo Eloy Elroy Elton Elvin Elvis Elwood Emanuel Emerson Emery Emil Emile Emilio Emmanuel Emmett Emmitt Emory Enoch Enrique Erasmo Eric Erich Erick Erik Erin Ernest Ernesto Ernie Errol Ervin Erwin Esteban Ethan Eugene Eugenio Eusebio Evan Everett Everette Ezekiel Ezequiel Ezra Fabian Faustino Fausto Federico Felipe Felix Felton Ferdinand Fermin Fernando Fidel Filiberto Fletcher Florencio Florentino Floyd Forest Forrest Foster Frances Francesco Francis Francisco Frank Frankie Franklin Franklyn Fred Freddie Freddy Frederic Frederick Fredric Fredrick Freeman Fritz Gabriel Gail Gale Galen Garfield Garland Garret Garrett Garry Garth Gary Gaston Gavin Gayle Gaylord Genaro Gene Geoffrey George Gerald Geraldo Gerard Gerardo German Gerry Gil Gilbert Gilberto Gino Giovanni Giuseppe Glen Glenn Gonzalo Gordon Grady Graham Graig Grant Granville Greg Gregg Gregorio Gregory Grover Guadalupe Guillermo Gus Gustavo Guy Hai Hal Hank Hans Harlan Harland Harley Harold Harris Harrison Harry Harvey Hassan Hayden Haywood Heath Hector Henry Herb Herbert Heriberto Herman Herschel Hershel Hilario Hilton Hipolito Hiram Hobert Hollis Homer Hong Horace Horacio Hosea Houston Howard Hoyt Hubert Huey Hugh Hugo Humberto Hung Hunter Hyman Ian Ignacio Ike Ira Irvin Irving Irwin Isaac Isaiah Isaias Isiah Isidro Ismael Israel Isreal Issac Ivan Ivory Jacinto Jack Jackie Jackson Jacob Jacques Jae Jaime Jake Jamaal Jamal Jamar Jame Jamel James Jamey Jamie Jamison Jan Jared Jarod Jarred Jarrett Jarrod Jarvis Jason Jasper Javier Jay Jayson Jc Jean Jed Jeff Jefferey Jefferson Jeffery Jeffrey Jeffry Jerald Jeramy Jere Jeremiah Jeremy Jermaine Jerold Jerome Jeromy Jerrell Jerrod Jerrold Jerry Jess Jesse Jessie Jesus Jewel Jewell Jim Jimmie Jimmy Joan Joaquin Jody Joe Joel Joesph Joey John Johnathan Johnathon Johnie Johnnie Johnny Johnson Jon Jonah Jonas Jonathan Jonathon Jordan Jordon Jorge Jose Josef Joseph Josh Joshua Josiah Jospeh Josue Juan Jude Judson Jules Julian Julio Julius Junior Justin Kareem Karl Kasey Keenan Keith Kelley Kelly Kelvin Ken Kendall Kendrick Keneth Kenneth Kennith Kenny Kent Kenton Kermit Kerry Keven Kevin Kieth Kim King Kip Kirby Kirk Korey Kory Kraig Kris Kristofer Kristopher Kurt Kurtis Kyle Lacy Lamar Lamont Lance Landon Lane Lanny Larry Lauren Laurence Lavern Laverne Lawerence Lawrence Lazaro Leandro Lee Leif Leigh Leland Lemuel Len Lenard Lenny Leo Leon Leonard Leonardo Leonel Leopoldo Leroy Les Lesley Leslie Lester Levi Lewis Lincoln Lindsay Lindsey Lino Linwood Lionel Lloyd Logan Lon Long Lonnie Lonny Loren Lorenzo Lou Louie Louis Lowell Loyd Lucas Luciano Lucien Lucio Lucius Luigi Luis Luke Lupe Luther Lyle Lyman Lyndon Lynn Lynwood Mac Mack Major Malcolm Malcom Malik Man Manual Manuel Marc Marcel Marcelino Marcellus Marcelo Marco Marcos Marcus Margarito Maria Mariano Mario Marion Mark Markus Marlin Marlon Marquis Marshall Martin Marty Marvin Mary Mason Mathew Matt Matthew Maurice Mauricio Mauro Max Maximo Maxwell Maynard Mckinley Mel Melvin Merle Merlin Merrill Mervin Micah Michael Michal Michale Micheal Michel Mickey Miguel Mike Mikel Milan Miles Milford Millard Milo Milton Minh Miquel Mitch Mitchel Mitchell Modesto Mohamed Mohammad Mohammed Moises Monroe Monte Monty Morgan Morris Morton Mose Moses Moshe Murray Myles Myron Napoleon Nathan Nathanael Nathanial Nathaniel Neal Ned Neil Nelson Nestor Neville Newton Nicholas Nick Nickolas Nicky Nicolas Nigel Noah Noble Noe Noel Nolan Norbert Norberto Norman Normand Norris Numbers Octavio Odell Odis Olen Olin Oliver Ollie Omar Omer Oren Orlando Orval Orville Oscar Osvaldo Oswaldo Otha Otis Otto Owen Ozzie Pablo Palmer Paris Parker Pasquale Pat Patricia Patrick Paul Pedro Percy Perry Pete Peter Phil Philip Phillip Pierre Porfirio Porter Preston Prince Quentin Quincy Quinn Quintin Quinton Rafael Raleigh Ralph Ramiro Ramon Randal Randall Randell Randolph Randy Raphael Rashad Raul Ray Rayford Raymon Raymond Raymundo Reed Refugio Reggie Reginald Reid Reinaldo Renaldo Renato Rene Reuben Rex Rey Reyes Reynaldo Rhett Ricardo Rich Richard Richie Rick Rickey Rickie Ricky Rico Rigoberto Riley Rob Robbie Robby Robert Roberto Robin Robt Rocco Rocky Rod Roderick Rodger Rodney Rodolfo Rodrick Rodrigo Rogelio Roger Roland Rolando Rolf Rolland Roman Romeo Ron Ronald Ronnie Ronny Roosevelt Rory Rosario Roscoe Rosendo Ross Roy Royal Royce Ruben Rubin Rudolf Rudolph Rudy Rueben Rufus Rupert Russ Russel Russell Rusty Ryan Sal Salvador Salvatore Sam Sammie Sammy Samual Samuel Sandy Sanford Sang Santiago Santo Santos Saul Scot Scott Scottie Scotty Sean Sebastian Sergio Seth Seymour Shad Shane Shannon Shaun Shawn Shayne Shelby Sheldon Shelton Sherman Sherwood Shirley Shon Sid Sidney Silas Simon Sol Solomon Son Sonny Spencer Stacey Stacy Stan Stanford Stanley Stanton Stefan Stephan Stephen Sterling Steve Steven Stevie Stewart Stuart Sung Sydney Sylvester Tad Tanner Taylor Ted Teddy Teodoro Terence Terrance Terrell Terrence Terry Thad Thaddeus Thanh Theo Theodore Theron Thomas Thurman Tim Timmy Timothy Titus Tobias Toby Tod Todd Tom Tomas Tommie Tommy Toney Tony Tory Tracey Tracy Travis Trent Trenton Trevor Trey Trinidad Tristan Troy Truman Tuan Ty Tyler Tyree Tyrell Tyron Tyrone Tyson Ulysses Val Valentin Valentine Van Vance Vaughn Vern Vernon Vicente Victor Vince Vincent Vincenzo Virgil Virgilio Vito Von Wade Waldo Walker Wallace Wally Walter Walton Ward Warner Warren Waylon Wayne Weldon Wendell Werner Wes Wesley Weston Whitney Wilber Wilbert Wilbur Wilburn Wiley Wilford Wilfred Wilfredo Will Willard William Williams Willian Willie Willis Willy Wilmer Wilson Wilton Winford Winfred Winston Wm Woodrow Wyatt Xavier Yong Young Zachariah Zachary Zachery Zack Zackary Zane].sample\nend", "def best_friends(name1, name2)\n puts \"#{name1} is best friends with #{name2}.\"\nend", "def no_friends(people)\n result = []\n for person in people\n result << person if person[:friends].empty?\nend\nreturn result\nend", "def two_degrees_away(facebook, name)\n # facebook: key: name, value: array of friends\n # only friends of friends, NOT mutual friend\n\n my_friends = facebook[name]\n # I'm also \"my friend\"\n my_friends << name\n\n their_friends = []\n\n my_friends.each do |my_friend|\n her_friends = facebook[my_friend]\n her_friends.each do |her_friend|\n # if my friends, friend is not a mutual connection\n if !my_friends.include?(her_friend)\n their_friends << her_friend\n end\n end\n end\n their_friends\nend", "def getUserFriendList(user, usersDatabase)\r\n puts \"#{user.fullName} have #{user.friendList.length} friend(s)\"\r\n user.friendList.each do |friendId|\r\n usersDatabase.each do |user|\r\n if user.id == friendId\r\n puts user.fullName\r\n end\r\n end\r\n end\r\n puts\r\nend", "def long_planeteer_calls(array)\n array.any? do\n |word| word.length > 4\n end\nend", "def check_four(arr, player)\n count = 1\n arr.each_with_index { |v,i|\n if count == 4\n true\n elsif v == player && arr[i + 1] == player\n count += 1\n end\n }\n count >= 4\n end", "def match(array)\n array.find_all do |word|\n # split word into arry of letters\n if word.split(\"\").sort == @word.sort\n word\n end\n end\n end", "def fake_name(name)\n\n name_array = name.split('')\n\n name_array.map! do |letter|\n vowels = ['a','e','i','o','u', 'a']\n i = 0\n until i>vowels.length\n if i == 5\n letter = letter.next\n if vowels.include?(letter.downcase)\n letter = letter.next\n end\n break\n elsif letter.downcase == vowels[i]\n letter = vowels[i+1]\n break\n elsif letter.downcase == \" \"\n break\n else\n i += 1 \n end \n end\n letter\n end\n\n p name_array \n\n final_name = name_array.join.split(' ')\n\n final_name.map! do |letter|\n letter.capitalize\n end\n\n final_name2 = final_name.rotate.join(' ')\n\n return final_name2\n\nend", "def create_groups(names)\n groups = []\n names.shuffle.each_slice(4) do |group|\n if group.count == 4\n groups << group\n else\n i = 0\n group.each do |name|\n groups[i] << name\n i += 1\n end\n end\n end\n p groups\nend", "def filter_friends\n inname = DATA_DIR.join('unpacked', 'all-friends-ids.csv')\n rows = open(inname, 'r'){|i| i.readlines }\n hsh = rows.inject(Hash.new{|h, k| h[k] = 0}) do |h, row|\n uname, friend_id = row.strip.split(',')\n h[friend_id] += 1\n h\n end\n\n fhsh = hsh.select{|k, v| v >= MIN_FRIEND_COUNT }\n end", "def print_names_less_than_x_characters\n puts \"Please set the max character length of names to display\"\n number = STDIN.gets.chomp\n match_array = []\n #Will not continue unless input is an integer, and avoided cases in which to_i for a string returns 0, AKA an integer\n while number.to_i.to_s != number\n puts \"Please enter an integer\"\n number = STDIN.gets.chomp\n end\n @students.each_with_index do |student, index|\n if student[:name].length <= number.to_i\n match_array.push(student)\n end\n end\n print(match_array)\n if match_array.length == 1\n puts \"We have found #{match_array.size} student with a name of #{number} characters or less\"\n elsif match_array.length > 1\n puts \"We have found #{match_array.size} students with names of #{number} characters or less\"\n end\nend", "def gemstones(arr)\n common_chars = ('a'..'z').to_a\n arr.each do |a|\n common_chars = common_chars & a.chars\n end\n common_chars.size\nend", "def username_list_helper(array)\n if array.size == 0 or array.size == 1\n return fast_link(display_user_name(array[0]), \"#{array[0].username}\")\n elsif array.size == 2\n return fast_link(display_user_name(array[0]), \"#{array[0].username}\") + \" and \" + fast_link(display_user_name(array[1]), \"#{array[1].username}\")\n else\n index_minus_one = array.size - 2\n s = fast_link(display_user_name(array[0]), \"#{array[0].username}\")\n for i in (1..index_minus_one.to_i)\n s = s + \", \" + fast_link(display_user_name(array[i]), \"#{array[i].username}\")\n end\n s = s + \" and \" + fast_link(display_user_name(array[array.size-1]), \"#{array[array.size-1].username}\")\n \n return s\n end\n end", "def super_fizzbuzz(array)\n length = array.length\n # print length\n i = 0\n while i < length\n if (array[i] % 3 == 0 && array[i] % 5 != 0)\n array[i] = \"Fizz\"\n elsif (array[i] % 5 == 0) && (array[i] % 3 != 0)\n array[i] = \"Buzz\"\n elsif (array[i] % 3 == 0) && (array[i] % 5 == 0)\n array[i] = \"FizzBuzz\"\n\n end\n i += 1\n end\n\n return array\n\nend", "def likes(names)\n case names.size\n when 0\n \"no one likes this\"\n when 1\n \"%s likes this\" % names\n when 2\n \"%s and %s like this\" % names\n when 3\n \"%s, %s and %s like this\" % names\n else\n \"%s, %s and %s others like this\" % [names[0], names[1], names.size - 2]\n end\nend", "def direct_friends_of(i)\n friends_of_current = []\n for j in 0..MATRIX.length-1\n if MATRIX[j][i-1] == 1 || MATRIX[i-1][j] == 1\n friends_of_current << j+1\n end \n end\n return friends_of_current \nend", "def find_social_network(word)\n\n # Sets to hold all the unique friends, friends of friends, etc.\n friends = Set.new\n friends_friends_set = Set.new\n\n friends_friends = {}\n friends_friends_friends = {}\n\n # Array to hold all of the words so we don't need to read from the file multiple times\n word_list = []\n\n # Open the file and store all the words in the array\n f = File.open(\"randomlist.txt\", \"r\")\n f.each_line do |line|\n word_list.push(line.strip)\n end\n f.close\n\n # Loops through the list of words, finds all of the friends, and adds them to the set.\n word_list.each do |compare|\n if is_friend(word, compare)\n friends.add(compare)\n end\n end\n\n # Loops through the list again, and for each friend, find all of its friends, and store these words in a set.\n friends.to_a.sort.each do |w|\n s = Set.new\n word_list.each do |compare|\n \n if is_friend(w, compare)\n s.add(compare)\n friends_friends_set.add(compare)\n end\n\n friends_friends[w] = s\n end\n end\n\n # Loops through the list a final time for the friends of friends to find the friends of friends of friends. \n friends_friends_set.to_a.sort.each do |w|\n s = Set.new\n word_list.each do |compare|\n \n if is_friend(w, compare)\n s.add(compare)\n end \n\n friends_friends_friends[w] = s \n end\n end\n\n # Print the social network\n puts \"Friends:\"\n puts friends.to_a.sort\n puts\n puts\n puts \"Friends of Friends:\"\n friends_friends.each do |k,v|\n puts \"#{k}:\"\n puts friends_friends[k].to_a.sort\n puts\n end\n puts\n puts \"Friends of Friends of Friends:\"\n friends_friends_friends.each do |k,v|\n puts \"#{k}:\"\n puts friends_friends_friends[k].to_a.sort\n puts\n end\nend", "def list(arr)\n return \"\" if arr.empty?\n\n str = []\n\n arr.each do |hsh|\n hsh.each do |k, v|\n str << v\n end\n end\n \n return str[0] if str.length < 2\n\n names = ''\n idx = 0\n\n until idx == str.length - 2\n names << str[idx] + ', '\n idx += 1\n end\n names << str[-2] + ' & '\n names << str[-1]\n \nend", "def match(array)\n ary = []\n array.each do |w| \n if w.split(\"\").sort == @word.sort\n ary << w\n end \n end\n ary\n end", "def print_names_shorter_than_12(students)\n students = students.select { |student| student[:name].size < 12 }\n print(students)\nend", "def is_isogram(word)\n new_word = word.downcase.split('')\n letter_list = []\n for letter in new_word\n if letter_list.include?(letter)\n return false\n else \n letter_list << letter\n end\n end\n return true\nend", "def match\n $people_array.each_with_index do |person, i|\n if person.lname.downcase == $pairs[i].lname.downcase\n return false\n end\n end\n return true\nend", "def mutation(array)\n p first_word = array[0].downcase.chars.sort.join(\" \")\n p second_word = array[1].downcase.chars.sort.join(\" \")\n p first_word.include?(second_word) ? true: false\nend", "def anagram(input)\n array = input.group_by { |element| element.chars.sort }.values\n # finding arrays with more than 1 element returns true\n filtered = array.select { |a| a.size > 1 }\n # puts out each array with more than 1 element\n filtered.each { |a| print a }\nend", "def call_a_consonent(array_split_name)\n\tindex = 0\n\tnew_array =[]\n\n\twhile index < array_split_name.length\n\t\tletter = array_split_name.fetch(index)\n\n\t\tif letter == \"z\"\n\t\t\tletter = \"b\"\n\t\telsif letter == \"d\"\n\t\t\tletter = \"f\"\n\t\telsif letter == \"h\"\n\t\t\tletter = \"j\"\n\t\telsif letter == \"n\"\n\t\t\tletter = \"p\"\n\t\telsif letter == \"t\"\n\t\t\tletter = \"v\"\n\t\telsif letter != \" \"\n\t\t\tletter = letter.next\n\t\tend\n\n\t\tindex += 1\n\t\tnew_array.push(letter)\n\tend\n\n\treturn new_array\nend", "def oompa_loompa(array)\n\t\tarray.reject do |word|\n\t\t\tword.length > 3\n\t\tend\n\tend", "def groupCreator(array)\n\t3.times do\n\t\tarray.shuffle!\n\t\t\tnewArray=array.each_slice(4).to_a\n\t\t\tnewArray.each do |x|\n\t\t\t\tif(x.length<4)\n\t\t\t\t\ti=0\n\t\t\t\t\tuntil x.length<=0\t\n\t\t\t\t\t\tnewArray[i]<<x.pop\n\t\t\t\t\t\ti+=1\n\t\t\t\t\tend\n\t\t\t\t\tnewArray.pop\n\t\t\t\tend\n\t\t\tend\n\t\t\tp newArray\n\tend\nend", "def whats_up (greeting, *friends)\n friends.each {|friend| puts \"#{greeting}, #{friend}.\"}\nend", "def convert_members(friends)\n if new_record?\n members_as_venmoid = Array.new\n names = members.split(', ')\n names.reject! { |n| n.empty? }\n names.each do |n|\n friends.each do |f|\n if f['display_name'] == n\n members_as_venmoid << f['id']\n break\n end\n end\n end\n self.members = members_as_venmoid.to_json\n return true\n else\n return false\n end\n end", "def four_words(text)\n four_words = []\n word_array = text.split(\" \")\n word_array.each do |word|\n if word.length == 4\n four_words << word\n end\n end\n four_words\nend", "def test_7_verify_get_names_from_db\n user_array = get_names()\n names = [[\"Doe, Jen\", \"Fairbanks Jr., Jim Bob\", \"Smith, Joy\", \"Doe, Jill\", \"Langer, Jeff\", \"Smith-Lewis, June\", \"Doe, John\", \"Scott M.D., Jack\", \"\", \"Doe III, Joe\", \"Smith, Jane C.\", \"\"],\n [\"Doe, Jen\", \"Fairbanks Jr., Jim Bob\", \"Smith, Jane C.\", \"Doe, Jill\", \"Langer, Jeff\", \"Smith, Joy\", \"Doe, John\", \"Roberts, Jake\", \"Smith-Lewis, June\", \"Doe III, Joe\", \"Scott M.D., Jack\", \"\"]]\n result = names.include? user_array\n assert_equal(true, result)\n end", "def long_planeteer_calls(array)\n array.each do |element|\n return true unless element.to_s.length <= 4\n end\n return false\nend", "def girl_or_boy array\n dup_array = []\n array.each do |ele|\n if not dup_array.include? ele\n dup_array.push(ele)\n elsif dup_array.include? ele\n return \"boy\"\n end\n end\n return \"girl\"\nend", "def actor_list(array)\n #the variable actors is equal to a new array that only has the key actors in each of the movies\n actor_in_bond = array.map {|movie| movie[:actor]}\n #list variable gives me the array of unique people out of the list of array\n list = actor_in_bond.uniq\n #variable movies per actor is equal to a iterator that will give me a new array of the movie actor from the list and\n #check the number of times the actor's name shows up in the array actor in bond then it will\n #give me an array of the actors name with the number of movie it is in\n movies_per_actor = list.map {|movie| \"#{movie} => #{actor_in_bond.count(movie)}\"}\n #outputs the list of actors with number of movies they are in\n puts movies_per_actor\nend" ]
[ "0.7997624", "0.7544937", "0.74139065", "0.7140822", "0.7140568", "0.7043561", "0.68281835", "0.6640537", "0.6465815", "0.63131136", "0.61951905", "0.6140563", "0.59827524", "0.5890489", "0.57365006", "0.572553", "0.57194", "0.5707065", "0.5669916", "0.56415075", "0.56397325", "0.56389076", "0.56268424", "0.56142753", "0.5578061", "0.55643356", "0.5532986", "0.5522464", "0.5504844", "0.5484326", "0.54650325", "0.54147893", "0.54066736", "0.5399828", "0.5398697", "0.53902656", "0.53818774", "0.5358602", "0.5356861", "0.5350393", "0.53429663", "0.5327216", "0.5323993", "0.5302246", "0.5291172", "0.5266215", "0.52650976", "0.52558166", "0.52547085", "0.5254118", "0.5252307", "0.524439", "0.5235187", "0.5234289", "0.5231921", "0.5230579", "0.5218173", "0.52174085", "0.52087873", "0.5193071", "0.519248", "0.51858777", "0.5185547", "0.5179582", "0.5166277", "0.51616925", "0.5151854", "0.514656", "0.5123664", "0.5116058", "0.51057374", "0.51050425", "0.5104367", "0.51041055", "0.5087864", "0.508566", "0.5080703", "0.50715536", "0.50670284", "0.5063727", "0.5055278", "0.50511867", "0.5051103", "0.5050971", "0.5042765", "0.5042153", "0.5041827", "0.50401443", "0.5037115", "0.5029154", "0.502422", "0.5011816", "0.5009873", "0.5007295", "0.5005854", "0.50041324", "0.49933508", "0.49913093", "0.49777433", "0.49686196" ]
0.71009034
5
before_filter :authorize_controller!, :only => %w(search index show new create edit update destroy)
def autocomplete render :json => end_of_association_chain.ordered.search(params[:term]).limit(params[:limit] || 10).to_autocomplete end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authorize_access\r\n # authorize!(action_name.to_sym, \"#{controller_name}_controller\".camelcase.constantize)\r\n end", "def index\n # @users = User.all\n # authorize @users \n @users = policy_scope(User)\n authorize @users\n end", "def authorize_controller!\n authorize! action_name.to_sym, full_controller_name\n end", "def index\n @users = User.all\n authorize User\n end", "def index\n @details = Detail.all\n authorize @details \n end", "def index\n @articles = Article.all\n authorize @articles\n end", "def authorize\n end", "def authorize\n end", "def show\n # authorize Admin\n end", "def run_filters\n set_user\n authorize\n end", "def index\n @store_details = StoreDetailPolicy::Scope.new(current_user, StoreDetail).resolve \n #@store_details = StoreDetail.order(store_name: :asc)\n #authorize current_user, :index?\n authorize @store_details, :index?\n end", "def index\n authorize Document\n end", "def index\n @users = User.all\n authorize @users\n end", "def index\n #authorize(User.new)\n @users = User.all #policy_scope(User)\n end", "def index\n if current_user.admin? or current_user.editor? #checks if user is admin, if so displays all of the students in database.\n @students = Student.all\n if params[:search]\n @students = Student.search(params[:search]).order(\"created_at DESC\")\n else\n @students = Student.all.order('created_at DESC')\n end\n elsif user_signed_in?\n @students = Student.all.where(:user_id => current_user.id) #Only displays the the users student. \n end\n\n\n authorize @students\n end", "def before_filter; end", "def index\n @questions = Question.all\n authorize @questions\n end", "def index\n @resources = Catalogs::Level.search(params[:search]).order(\"#{sort_column} #{sort_direction}\").paginate(per_page: 11, page: params[:page])\n authorize @resources\n end", "def authorize_users\n authorize :user\n end", "def show\n authorize User\n end", "def show\n authorize User\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def index\n @customer = Customer.all\n authorize! :list, @customer\n end", "def index\n @activist_fronts = ActivistFront.all\n authorize ActivistFront\n end", "def show\n authorize!\n end", "def show\n authorize!\n end", "def show\n authorize!\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def index\n authorize!(:view_configuration_management)\n end", "def index\n @resources = Catalogs::Location.search(params[:search]).order(\"#{sort_column} #{sort_direction}\").paginate(per_page: 11, page: params[:page])\n authorize @resources\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def index\n @articles = Article.order(\"position asc\")\n\n authorize Article\n end", "def authorize_admin!\n authorize! :manage, :all\n end", "def index\n authorize Authentication, :index?\n @authentications = policy_scope(Authentication)\n end", "def index\n @admins = Admin.order(:email)\n authorize @admins\n end", "def index\n index_filter\n end", "def index\n @products = Product.all.page(params[:page]).per(10)\n authorize Product\n end", "def index\n @profiles = Profile.all\n #authorize Profile\n #@profiles = policy_scope(Profile)\n end", "def authorize\n\t\tredirect_to '/login' unless current_user\n\tend", "def authorized\n redirect_to :controller => 'home', :action => 'index' unless logged_in?\n end", "def index\n @albums = Album.all\n authorize @albums\n end", "def index\n @profiles = Profile.all\n authorize Profile\n end", "def authorization_required\n case action_name.to_s\n when /index/, /show/ then list_authorized?\n when /create/ then create_authorized?\n when /update/ then update_authorized?\n when /destroy/ then delete_authorized?\n end\n false\n end", "def show\n authorize! :create, Administrator\n end", "def index\n @resources = Group.search(params[:search]).where(id: current_user.admin_groups).order(\"#{sort_column} #{sort_direction}\").paginate(per_page: 11, page: params[:page])\n authorize @resources\n end", "def load_permissions\n authorize! :manage, :all\n end", "def authorize\n redirect_to('/login') unless @current_user\n end", "def list_filter_authorized?\n authorized_for?(:action => :read)\n end", "def show\n authorize @admin\n end", "def show\n\t\tauthorize! :index, TipoPrivilegio\n end", "def index\n authorize controller_class\n render json: policy_class::Scope.new(current_user, controller_class).editable.order(prepared_params[:sort]),\n include: prepared_params[:include], fields: prepared_params[:fields]\n end", "def filter_object\n # redirect_to(root_url, :notice => \"Do not have permission\") and return\n end", "def index\n @coupons = policy_scope(Coupon.paginate(:page => params[:page], :per_page => 10).order('created_at DESC'))\n authorize @coupons\n end", "def index\n authorize Order\n super\n end", "def authorize_access\n # byebug\n redirect_to root_path, alert: \"Access Denied\" unless can? :modify, Post\n end", "def authorize_user\n # simple authorization: kick out anonymous users from backend actions\n=begin\n if !current_user\n redirect_back_or_default(home_page) and return if action_name =~ /index|edit|update|destroy/\n \n # skip checking permission if user is an admin\n elsif !current_user.has_role?('Admin')\n unless current_user.has_permission?(controller_name, action_name, params)\n flash[:warning] = 'Access Denied'\n redirect_back_or_default(home_page) and return\n end\n end\n=end\n end", "def show\n\n authorize Article\n end", "def authorize\n redirect_to :login unless user_signed_in?\n end", "def authorize\n controller.class_eval do\n define_method name, block\n self.send callback, name.to_sym, only: actions\n end\n end", "def authorize\r\n # check if action is allowed on public projects\r\n if @project.is_public? and Permission.allowed_to_public \"%s/%s\" % [ @params[:controller], @params[:action] ]\r\n return true\r\n end \r\n # if user not logged in, redirect to login form\r\n unless session[:user]\r\n store_location\r\n redirect_to(:controller => \"account\", :action => \"login\")\r\n return false\r\n end\r\n # if logged in, check if authorized \r\n if session[:user].admin? or Permission.allowed_to_role( \"%s/%s\" % [ @params[:controller], @params[:action] ], session[:user].role_for_project(@project.id) ) \r\n return true\t\t\r\n end\t\t\r\n flash[:notice] = \"Acces denied\"\r\n redirect_to(:controller => \"\")\r\n false\r\n end", "def index\n @samples = policy_scope(Sample.all)\n authorize Sample\n end", "def authorize\r\n # check if action is allowed on public projects\r\n if @project.is_public? and Permission.allowed_to_public \"%s/%s\" % [ @params[:controller], @params[:action] ]\r\n return true\r\n end \r\n # if action is not public, force login\r\n return unless require_login \r\n # admin is always authorized\r\n return true if self.logged_in_user.admin?\r\n # if not admin, check membership permission \r\n @user_membership ||= Member.find(:first, :conditions => [\"user_id=? and project_id=?\", self.logged_in_user.id, @project.id]) \r\n if @user_membership and Permission.allowed_to_role( \"%s/%s\" % [ @params[:controller], @params[:action] ], @user_membership.role_id ) \r\n return true\t\t\r\n end\t\t\r\n render :nothing => true, :status => 403\r\n false\r\n end", "def index\n authorize! :creat, Ward\n @hospitals = Hospital.all\n end", "def show\n authorize RoleCutoff\n end", "def pre_authorize_cb; end", "def show\n authorize Title\n end", "def access_control\n \n end", "def authorize_admin\n redirect_to :login unless current_user.permission.manage_app ||\n current_user.permission.manage_attrs ||\n current_user.permission.manage_achievement_categories ||\n current_user.permission.manage_talent_trees ||\n current_user.permission.manage_talents ||\n current_user.permission.manage_quests ||\n current_user.permission.manage_skills ||\n current_user.permission.manage_achievements ||\n current_user.permission.manage_items ||\n current_user.permission.manage_titles\n end", "def show\n skip_authorization\n end", "def show\n # authorize @item\n end", "def show\n authorize @activist_front\n end", "def authorize\n action = {:controller => params[:controller], :action => params[:action]}\n allowed = User.current.allowed_to?(action, project = nil, options={:global => true})\n allowed ? true : deny_access\n end", "def authorize\n action = {:controller => params[:controller], :action => params[:action]}\n allowed = User.current.allowed_to?(action, project = nil, options={:global => true})\n allowed ? true : deny_access\n end", "def index\n @activites = Activite.all\n authorize @activites\n end", "def index\n prevent_non_admin\n end", "def authorize # we can call it anything\n redirect_to '/login' unless current_user # if there is a current user then it will never redirect\n end", "def index\n #@event_users = EventUser.where(event: @event)\n #@event_users = EventUserPolicy::Scope.new(current_user, [:admin, EventUser]).resolve\n @event_users = policy_scope(EventUser.where(event: @event))\n authorize @event_users\n\n add_breadcrumb \"#{@event.code}\", :admin_event_path\n add_breadcrumb \"Usuários\", :admin_event_users_path\n end", "def index\n @esps = policy_scope(@shop.esps)\n authorize @esps\n #binding.pry\n #binding.pry\n end", "def authorized?\n\n return false unless current_user\n\n %w{ show index }.include?(action_name) || current_user.is_admin?\n end", "def authorize!\n redirect '/' unless logged_in?\n end", "def index\n @vehiclepermits = VehiclePermit.all\n if params[:search]\n @vehiclepermits = VehiclePermit.search(params[:search]).order(\"created_at DESC\")\n else\n @vehiclepermits = VehiclePermit.all.order('created_at DESC')\n end\n authorize @vehiclepermits\n end", "def authorize\n redirect_to login_url, alert: \"Not authorized\" if !current_user\n end", "def show\n authorize @user\n end", "def show\n authorize @user\n end", "def show\n authorize @news_log\n end", "def authorize\n redirect_to login_url, alert: \"Not authorized\" if current_user.nil?\n end", "def authorize\n redirect_to login_url, alert: \"Not authorized\" if current_user.nil?\n end", "def authorize\n redirect_to login_url, alert: \"Not authorized\" if current_user.nil?\n end", "def index\n @trainings = student.trainings \n @user_profile = current_user.profile\n # authorize @trainings \n end", "def authorize \n self.make 'authorization' \n end", "def index\n @uploads = policy_scope(@user.uploads)\n authorize @uploads\n end", "def index\n @contracts = Contract.all\n authorize @contracts\n end", "def authorize\n return if current_user\n\n redirect_to login_url\n end", "def index\n authorize! :creat, Administrator\n hospital = Hospital.findn(params[:hospital_id])\n @administrators = hospital.administrators\n end" ]
[ "0.76493895", "0.73639953", "0.7130113", "0.7113632", "0.7071047", "0.7005025", "0.6993887", "0.6993887", "0.69899756", "0.6982364", "0.6921472", "0.691582", "0.69006926", "0.68857956", "0.68557215", "0.68487024", "0.6815257", "0.68129027", "0.68066067", "0.6778177", "0.6778177", "0.6772362", "0.6750732", "0.67465967", "0.674609", "0.674609", "0.674609", "0.67416173", "0.67416173", "0.67416173", "0.67416173", "0.67416173", "0.67416173", "0.67416173", "0.67416173", "0.6734493", "0.67244506", "0.6722594", "0.67195004", "0.67040277", "0.6701053", "0.6696722", "0.66933334", "0.66815525", "0.6677175", "0.66554", "0.66549104", "0.66540515", "0.6632591", "0.663054", "0.66273284", "0.66158754", "0.66076994", "0.6592855", "0.6585917", "0.6580699", "0.6560173", "0.65547377", "0.65453315", "0.65446925", "0.65409684", "0.6525123", "0.6524811", "0.65215147", "0.6521183", "0.6521176", "0.65187305", "0.6516445", "0.650062", "0.6491053", "0.648911", "0.6487623", "0.64773", "0.64747065", "0.6471775", "0.6459937", "0.645853", "0.64484435", "0.64342856", "0.64342856", "0.64282626", "0.64247626", "0.64184415", "0.6408005", "0.64064133", "0.6403918", "0.64023113", "0.639864", "0.63930404", "0.6383175", "0.6383175", "0.63790035", "0.6370279", "0.6370279", "0.6370279", "0.6368973", "0.63583666", "0.63570595", "0.63565534", "0.6355779", "0.6352324" ]
0.0
-1
this code will only ever by executed if the word starts with a consonant
def front_to_back(word, index, how_far) word = string_to_char_array(word) word.rotate(how_far) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def starts_with_consonant?(s)\n return false if s.empty?\n %Q{b c d f g h j k l m q r s t v w x y z}.include? s[0].downcase\nend", "def starts_with_consonant? s\n if s.empty?\n return false\n else\n stopwords = 'AEIOUaeiou0123456789$*~&!@#$%^()-=+/\\?,.'\n stopwords.each_char{|c|\n return false if s.start_with?(c)\n }\n end\n true\nend", "def starts_with_consonant?(s)\n # YOUR CODE HERE\n !!(s[0] =~ /[qzyxwvtsrbcdfghjklmnp]+/i)\nend", "def starts_with_consonant? s\n s !~ /^[AEIOU]/i && s =~ /^\\w/i\nend", "def starts_with_consonant? s\n # YOUR CODE HERE\n if s.start_with?(/[b-df-hj-np-tv-z]/i) \n return true\n end\n \n return false\nend", "def starts_with_consonant? s\n # If empty, return false\n if s.size == 0\n return false\n end\n # Check if first character matches a consonant\n if s[0].match(/[[a-zA-Z]&&[^aeiouAEIOU]]/)\n return true\n else\n return false\n end\nend", "def starts_with_consonant? s\n return false if s.empty?\n return true if s[0] =~ /[^\\Waeiou]/i\n return false\nend", "def starts_with_consonant?(s)\n s.downcase!\n if (s =~ /\\A[b-df-hj-np-tv-z]/) == 0 \n return true\n else\n return false\n end\nend", "def starts_with_consonant?(s)\n\n return false if s.empty?\n s.downcase!\n s[0].match(/\\b([bcdfghjklmnprstvwxyz])+/) ? true : false\n\nend", "def starts_with_consonant?(s)\n return /(?=^[^aiueo_\\d])(?=\\w)/i.match(s) ? true : false \nend", "def starts_with_consonant? s\n cond1 = /[[:alpha:]]/ =~ s\n cond2 = /[^aeiouAEIOU]/ =~ s\n if cond1 != 0 \n return false\n else\n if cond2 == 0\n return true\n else\n return false\n end\n end\n return false\nend", "def starts_with_consonant? (s)\n start = false\n if ((s =~ /\\A(?=[^aeiou])(?=[a-z])/i) == 0)\n start = true\n end\n return start\nend", "def starts_with_consonant? s\n (s[0] =~ /[bcdfghjklmnprstvwxyz]+/i) != nil\nend", "def starts_with_consonant? s\n first = s[0,1].downcase\n vowels = ['a', 'e', 'i', 'o', 'u']\n \n if vowels.include?(first)\n return false\n end\n if first =~ /[[:alpha:]]/\n return true\n end\nend", "def starts_with_consonant? s\n #Uses regular expression to check if the string starts with a consonant\n if /\\A(?=[^aeiou])(?=[a-z])/i.match(s)!=nil then\n return true\n end\n return false\nend", "def starts_with_consonant? s\n !!(s[0] =~ /[bcdfghjklmnprstvwxyz]+/i)\nend", "def starts_with_consonant? s\n !!(s[0] =~ /[bcdfghjklmnprstvwxyz]+/i)\nend", "def starts_with_consonant? s\n !!(s[0] =~ /[^aeiou\\W]/i)\nend", "def starts_with_consonant?(s)\n !!(s =~ /\\A[^aeiou\\W].*/i)\nend", "def starts_with_consonant?(s)\n first_symbol = s[0]\n return false if first_symbol.nil?\n\n if %w(a e i o u A E I O U).include? first_symbol\n false # vowels\n elsif ('a'..'z').include? first_symbol.downcase\n true #consolants\n else\n false #nonletters\n end\nend", "def starts_with_consonant? s\n\n s[0] =~ /[^aeiou\\W]/i\n \nend", "def starts_with_consonant? s\n # if /^[^aeiou\\W]/i.match(s) == nil then false else true end\n /^[^aeiou\\W]/i.match(s)==nil ? false : true\n # !%w(a e i o u).include? s[0].downcase unless s.empty? or /^\\W/.match(s)\n \nend", "def starts_with_consonant?(s)\n # if s.empty?\n \n \n # psj :: !! it's easier to evaluate an array of vowels using #includes? than understand your regular expression\n # vh: agreed but was not passing test on special characters ex. /&%$# \n # this expression works too (s =~ /^(?=[^aeiou])(?=a-z)/i )==0\n # you had it something like this: , so we can add\n # BP : What I noticed on this is that the original way it was written,\n # any tests with numbers or special characters were returning true. ..and emptys and ints threw errors.\n # the other option could be to just test the consonants instead of vowels.. but that isn't very elegent \n vowels = %w(a e i o u)\n consonant =(\"a\"..\"z\").find_all { |letter| !vowels.include? letter}\n #consonant = (\"a\"..\"z\").collect { |letter| !vowels.include? letter}\n if s.is_a?(String) && !s.empty?\n return consonant.include? s[0].downcase\n\n else\n return false\n end\n \n \nend", "def starts_with_consonant? s\n return false if s == ''\n return false if !s[0].match(/^[[:alpha:]]$/)\n s[0] =~ /[AaEeIiOoUu]/ ? false : true\nend", "def starts_with_consonant? s\n return false if s.empty?\n s.downcase!\n if s[0].match(/\\A[bcdfghjklmnpqrstvwxyz]/)\n return true\n else\n false\n end\nend", "def starts_with_consonant?(s)\r\n !!(s[0] =~ /[bcdfghjklmnprstvwxyz]+/i)\r\nend", "def starts_with_consonant? s\n s =~ /^[^aeiou\\W]/i\nend", "def starts_with_consonant?(s)\n if s.empty?\n return false\n elsif ( /[a-z]/ =~ s[0].downcase && /[^aeiou]/ =~ s[0].downcase)\n return true\n elsif ( /[A-Z]/ =~ s[0].upcase && /[^AEIOU]/ =~ s[0].upcase)\n return true\n else\n return false\n end\nend", "def starts_with_consonant? s\n !!(s[0] =~ /[bcdfghjklmnpqrstvwxyz]+/i)\nend", "def starts_with_consonant?(s)\n # YOUR CODE HERE\n /^[b-df-hj-np-tv-z]/i.match(s) != nil\nend", "def starts_with_consonant?(s)\n\tif s.downcase =~ /\\A(?=[^aeiou])(?=[a-z])/i\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend", "def starts_with_consonant? s\n if /^[^aeiouAEIOU\\W]/.match(s) == nil\n return false\n else\n return true\n end\nend", "def starts_with_consonant?(s)\n (/(?=[a-z]+)(?=^([^aeiou]))/i =~ s) == 0\nend", "def starts_with_consonant?(s)\n s.match(/^[b-z&&[^eiou]]/i) != nil\nend", "def starts_with_consonant?(s)\n consonant = /^[^aeiou\\d\\W_]/i\n return true if consonant.match(s)\nend", "def starts_with_consonant? s\n s =~ /\\A(?=[^aeiou])(?=[a-z])/i\nend", "def starts_with_consonant? str\n\treturn (str =~ /\\A(?=[^aeiou])(?=[a-z])/i) == 0 ? true : false\nend", "def starts_with_consonant? s\n s_lower=s.downcase\n if /^[a-z&&[^aeiou]]/.match(s_lower) \n return true\n else \n return false\n end\nend", "def starts_with_consonant? s\n return false if s.empty?\n consonant = 'bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ'\n consonant.each_char{|c|\n return true if s.start_with?(c)\n }\n false\nend", "def starts_with_consonant? s\n return false if s.empty?\n consonant = 'bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ'\n consonant.each_char{|c|\n return true if s.start_with?(c)\n }\n false\nend", "def starts_with_consonant?(s)\n !!(s =~ /^[A-Z&&[^AEIOU]]/i)\nend", "def starts_with_consonant? s\n /^[a-zA-Z&&[^aeiouAEIOU]]/.match s\nend", "def consonant?\n self != 'ㅇ' && kor.chosung?(self)\n end", "def starts_with_consonant?(s)\n regex = /^[AEIOU]/i\n regex2 = /^[BCDFGHJKLMNPQRSTVWXYZ]/i\n (s =~ regex2) != nil\n # regex2 = /^[BCDFGHJKLMNPQRSTVWXYZ]/i\n # if regex2.match(s) == nil\n # \tfalse\n # else true\n # end\nend", "def consonants # :nodoc:\n /^(y|[bcdfghjklmnprstvwxz]+|qu)/\n end", "def conj?\n words.any? { |wor| wor.pos == 'CONJ' }\n end", "def isConsonant letter\n\tvowels = ['a', 'e', 'i', 'o', 'u']\n\treturn !(vowels.include?(letter))\nend", "def consonant_cancel(sentence)\r\n newSentence = []\r\n sentence.split(\" \").each do |word|\r\n newWord = word\r\n while !('aeiou'.include?(newWord[0]))\r\n newWord = newWord[1..-1]\r\n end\r\n newSentence << newWord\r\n end\r\n return newSentence.join(\" \")\r\nend", "def start_of_word; end", "def single_word(word)\n if word[0] =~ /[aeiou]/i\n word + \"way\"\n else\n # nueva condicionante para palabras de puras consonantes sin vocales. ej: by\n if word.split(/([aeiou].*)/).length > 1\n # Parte palabra en 2 y lo mete en un array. 1er elemento es de consonat(es) iniciales, 2o la parte restante de la palabra a partir de e incluyendo la primera vocal\n word.split(/([aeiou].*)/)[1] + word.split(/([aeiou].*)/)[0] + \"ay\"\n else\n word.split(/([aeiou].*)/)[0]\n end\n end\nend", "def initial_consonants\n \n @@sentence.map { |word|\n if word.start_with?('a','e','i','o','u','A','E','I','O','U') \n \"\" \n else \n consonant_blend = word.split /([aeiou].*)/\n consonant_blend[0]\n\n end\n }\n end", "def consonant_cancel(sentence)\n\tarry = sentence.split(\" \")\n \tfinal = []\n \tvowel = \"aeiou\"\n \tarry.each do |word|\n len = word.length\n word.each_char.with_index do |char, i|\n if vowel.include?(char)\n final << word[i..-1]\n break\n end\n end\n end\n return final.join(\" \")\nend", "def next_consonant(char)\n char = char.downcase\n compare = \"bcdfghjklmnpqrstvwxyz\"\n\n # not a consonant, i.e., no instance of the variable\n if compare.count(char) == 0\n # puts \"Not a consonant\"\n return nil\n end\n\n consonant_index = compare.index(char)\n\n if consonant_index == compare.length - 1 # end edge case\n return 'b'\n else\n return compare[consonant_index + 1]\n end\nend", "def next_consonant (last_first)\n last_first.map! do |word|\n word.gsub(/[zdhntbcfgjklmpqrsvwxy]/, 'z' => 'b', 'd' => 'f', 'h' => 'j', 'n' => 'p', 't' => 'v', 'b' => 'c', 'c' => 'd', 'f' => 'g', 'g' => 'h', 'j' => 'k', 'k' => 'l', 'l' => 'm', 'm' => 'n', 'p' => 'q', 'q' => 'r', 'r' => 's', 's' => 't', 'v' => 'w', 'w' => 'x', 'x' => 'y', 'y' => 'z')\n end\nend", "def consonant_cancel(sentence)\n words = sentence.split\n new_words = words.map { |word| remove_starting_consonants(word) }\n return new_words.join(\" \")\nend", "def consonant_cancel(sentence)\n vowel = \"aeiou\"\n new_arr = []\n sentence.split(\" \").each do |word|\n word.each_char.with_index do |char, i|\n if vowel.include?(char)\n new_word = word[i..-1]\n new_arr << new_word\n break\n end\n end\n end\n new_arr.join(\" \")\nend", "def is_possesive? word\n return true if $possesive_words.include? word.downcase\n return false\n end", "def Starts_whit(string1,character)\n return string1[0] == character\nend", "def double_consonants(string)\n doubled_string = ''\n string.chars.each do |char|\n doubled_string << char\n doubled_string << char if consonant?(char.downcase)\n end\n\n doubled_string\nend", "def matching_exactly_one_word\n /WRITE ME/\n end", "def translate_word(word)\n first_letter = word[0].downcase\n \n if word[0..1] == \"qu\"\n return word[2..-1] + word[0..1] + \"ay\"\n end\n if word[0] == \"s\" && word[1..2] == \"qu\"\n \n return word[3..-1] + word[0] + word[1..2] + \"ay\"\n end\n\n if [\"a\", \"e\", \"i\", \"o\", \"u\"].include?(first_letter)\n #translate word that starts with vowel\n \"#{word}ay\"\n else\n #translate word that starts with consonant(s)\n consonants = []\n consonants << word[0]\n\n if[\"a\", \"e\", \"i\", \"o\", \"u\"].include?(word[1]) == false\n consonants << word[1]\n\n if[\"a\", \"e\", \"i\", \"o\", \"u\"].include?(word[2]) == false\n consonants << word[2]\n\n end\n\n end\n \"#{word[consonants.length..-1] + consonants.join + \"ay\"}\"\n end\nend", "def first_word_capitalized_and_ends_with_punctuation?(text)\n if text.match(/^[A-Z].*\\W$/)\n return true\n else false\n end\nend", "def count_consonants\n text.scan(/[bcdfghjklmnpqrstvwxyz]/).length\n end", "def start_codon?(codon)\n @start.include?(codon.downcase)\n end", "def consonant_checker(array)\n consonant_guide = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n array.map! do |name|\n name_split = name.split('')\n name_split.map! do |char|\n index = 0\n while index < consonant_guide.length\n if char == consonant_guide[index]\n char = consonant_guide[index += 1]\n index += 1\n elsif char == \"z\"\n char = \"b\"\n index += 1\n else\n char\n index += 1\n end\n char\n end\n char\n end\n name_split\n name_join = name_split.join('').capitalize!\n name_join\n end\n p array\nend", "def query(word)\n @cosines.include?(word)\n end", "def translate_one_consonant( s )\n\n\t\t# store the letters in an array\n\t\tch_array = s.chars\n\n\t\t# then grab the first letter from the array\n\t\tfirst_letter = ch_array.shift\n\n\t\t# put that letter at the back with push and add 'ay'\n\t\tch_array << first_letter + \"ay\"\n\n\t\t# bring it back together\n\t\tch_array.join\n\n\tend", "def case_q(word,first_letter )\n vowel = [\"a\",\"e\",\"i\",\"o\",\"u\",\"y\"]\n #si le q est la première lettre du mot\n if first_letter\n #si la 2eme lettre n'est pas un 'u', on traite le mot avec translate_consonant\n unless word[1] ==\"u\"\n translate_consonant(word)\n #si la 2eme lettre est un 'u'\n else\n move_and_add(word,2)\n end\n #si il est à la seconde position\n else\n #si la prémière lettre est une voyelle\n if vowel.include?(word[0])\n word+\"ay\"\n #si la prémière lettre n'est pas une voyelle (consonne) et la 3eme, un 'u'\n elsif not vowel.include?(word[0]) && word[2] == \"u\"\n move_and_add(word,3)\n else\n translate_consonant(word)\n end\n end\nend", "def first_word_capitalized_and_ends_with_punctuation?(text)\n text.match(/^[A-Z].+[.!?]$/) ? true : false\nend", "def is_special?\n # Only consonants\n return true if self =~ /^[bcdfghjklmnpqrstvwxz]+$/i\n\n # Not a word\n return false if self =~ /[^\\s]\\s[^\\s]/;\n return false if self.length < 3;\n # Alphanumeric\n return true if self =~ /[0-9]/ && self =~ /[a-z]/i\n # All Caps\n return true if self =~ /[A-Z]{2,}/;\n # Caps Mix\n return true if self =~ /[a-z][A-Z]/;\n # All consonants\n return true if self =~ /^[a-z]$/i && self !~ /[aeiou]/i\n # Dashed word\n return true if self =~ /(^\\w-|-\\w$)/\n # To many consonants (very heuristic)\n if self =~ /([^aeiouy]{3,})/i && !CONSONANTS.include?($1.downcase)\n return true\n end\n\n return false\n end", "def double_consonants(str)\n str.gsub(/([a-z&&[^aeiou]])/i,'\\1\\1')\nend", "def starts_with_a_vowel?(word)\nword.match? (/\\b[aeiou]/i)\n end", "def double_consonants(str)\n str.split(//).map { |chr| chr.match?(/[^aeiou\\d\\W]/i) ? chr + chr : chr }.join\nend", "def letter_in_word?(letter)\n end", "def consonant_advance(letter)\r\nconsonant = \"abcdefghijklmnopqrstuvwxyz\".delete(\"aeiou\")\r\n if letter == \"z\"\r\n letter = \"b\"\r\n else\r\n letter = consonant[consonant.index(letter) +1]\r\n end \r\nend", "def word_has?(letter)\n @word.include? letter\n end", "def check(word)\n if word.downcase =~ /lab/\n puts word\n end\nend", "def double_consonants(str)\nnew_str = \"\"\n\nstr.each_char do |char|\n\tif /[aeiou\\W\\d\\s]/ =~ char \n\t\tnew_str << char\n\telse\n\t\tnew_str << char << char\n\tend\nend\nnew_str\nend", "def count_consonants(str)\n str.chars.map do |letter|\n if consonant? letter\n letter = 1\n else\n letter = 0\n end\n end.reduce(0, :+)\nend", "def double_consonants(string)\n result_string = ''\n string.each_char do |letter|\n (letter =~ /[b-df-hj-np-tv-z]/i) == 0 ? result_string << letter << letter : result_string << letter\n end\n result_string\nend", "def double_consonants(string)\n consonants = %(bcdfghjklmnpqrstvwxyz)\n string.chars.map{ |char| consonants.include?(char.downcase)? char * 2 : char}.join\nend", "def next_consonant(letter)\nconsonant = \"bcdfghjklmnpqrstvwxyz\"\ncurrent_index = consonant.index(letter)\nconsonant[current_index + 1]\n\tif letter == \"z\"\n\t\tprint \"b\"\n\telse letter == \" \"\n\t\tprint \" \"\n\tend\nend", "def phrase_start_with? (phrase, sensitive, ignore, *words)\n\t# #check for longest words, no need to downcase all the long phrase.\n\t# length = 0\n\t# (words + ignore).max {|w,v| w.length <=> v.length}\n\t# phrase_string = phrase.to_s[0, length]\n\tphrase_string = phrase.to_s\n\tif !sensitive\n\t\tphrase_string.downcase!\n\t\twords.each do |word|\n\t\t\tword.downcase!\n\t\tend\n\tend\n\n\treturn words.any? {|word| phrase_string.start_with? (word)} && !ignore.any? {|word| phrase_string.start_with? (word)}\n\n\t# must be a better implementation maybe improving this:\n\t# return words.reject{|w| ignore.include? w}.any? {|w| phrase_string.start_with? w}\nend", "def consonant_cancel(sentence)\n result = []\n arr = sentence.split(\" \")\n\n arr.each do |i|\n cancelled = []\n i.each_char.with_index do |ch, idx|\n if ch == 'a' || ch == \"e\" || ch == \"i\" || ch == \"o\" || ch == \"u\"\n cancelled << i[idx..-1]\n break\n end\n end\n result << cancelled.join\n end\n\n return result.join(\" \")\n\nend", "def word_has?(letter)\r\n @word.include?(letter)\r\n end", "def translateForOneWord(msg)\n aryChar = msg.split(\"\")\n if aryChar[0].match(/a|e|i|o|u/)\n aryChar << \"ay\"\n elsif (not aryChar[0].match(/a|e|i|o|u/)) && aryChar[1] == \"q\" && aryChar[2] == \"u\" # consonant + q and u\n aryChar << aryChar[0]\n aryChar << aryChar[1]\n aryChar << aryChar[2]\n aryChar.shift #this will remove the first character\n aryChar.shift #this will remove the first character\n aryChar.shift #this will remove the first character\n aryChar << \"ay\"\n elsif aryChar[0] == \"q\" && aryChar[1] == \"u\" # q and u\n aryChar << aryChar[0]\n aryChar << aryChar[1]\n aryChar.shift #this will remove the first character\n aryChar.shift #this will remove the first character\n aryChar << \"ay\"\n elsif (not aryChar[0].match(/a|e|i|o|u/)) && (not aryChar[1].match(/a|e|i|o|u/)) && (not aryChar[2].match(/a|e|i|o|u/)) # if 3 consonants\n aryChar << aryChar[0]\n aryChar << aryChar[1]\n aryChar << aryChar[2]\n aryChar.shift #this will remove the first character\n aryChar.shift #this will remove the first character\n aryChar.shift #this will remove the first character\n aryChar << \"ay\"\n elsif (not aryChar[0].match(/a|e|i|o|u/)) && (not aryChar[1].match(/a|e|i|o|u/)) #if it starts with 2 consonants\n aryChar << aryChar[0]\n aryChar << aryChar[1]\n aryChar.shift #this will remove the first character\n aryChar.shift #this will remove the first character\n aryChar << \"ay\"\n\n elsif not aryChar[0].match(/a|e|i|o|u/)\n aryChar << aryChar[0]\n aryChar.shift #this will remove the first character\n aryChar << \"ay\"\n end\n aryChar.join(\"\")\nend", "def is_prefix?(word)\n Constants::PREFIXES.key?(word.downcase)\n end", "def starts_with_a_vowel?(word)\n word.scan(/\\b[aeiou]/i) == true\nend", "def next_consonant(product)\n spot = 0 \n consonants = \"bcdfghjklmnpqrstvwxyz\"\n while spot < product.length\n if product[spot] == \"z\"\n product[spot] = \"b\"\n elsif consonants.split('').include?(product[spot])\n next_spot = consonants.index(product[spot]) + 1 \n product[spot] = consonants[next_spot]\n end\n spot += 1 \n end\n product\nend", "def starts_and_ends_with_same_letter?(word)\nend", "def consonant_cancel(sentence)\n \tnewSentence = \"\"\n\tsentence.split.each do |word|\n \t# puts word\n \tnewSentence = newSentence + \" \" + find_vowel(word)\n end\n \treturn newSentence\nend", "def double_consonants(string)\n result = ''\n string.chars.each do |char|\n result += char\n result += char if char =~ /[a-z]/i && char =~ /[^aeiou]/i\n end\n result\nend", "def double_consonants(string)\n string.gsub(/([b-df-hj-np-tv-z])/i, '\\1\\1')\nend", "def is_valid_start(word)\n is_alpha(word[0]) || is_digit(word[0])\n end", "def update_if_phoneme(word)\n\n\tsingle_phoneme = [\"qu\"]\n\n\tstart_with_phoneme = \"\"\n\n\tsingle_phoneme.each do |phoneme|\n\t\t\n\t\tstart_with_phoneme = phoneme if word.start_with?(phoneme)\n\t\tif(start_with_phoneme == \"\" && !is_vowel(word[0]))\n\t\t\tstart_with_phoneme = word[0] + phoneme if word[1..word.size].start_with?(phoneme)\n\t\tend\n\n\tend\n\n\treturn start_with_phoneme\n\nend", "def has_masters(text)\n result = 0\n if text.include?('M.S.') || text.include?('M.A.') || text.include?('Master of Science') || text.include?(\"Master of Arts\")\n result = 1\n end\n return result\nend", "def consonant(letter)\n alphabet = \"bcdfghjklmnpqrstvwxyz\"\n alphabet2 = alphabet.chars.rotate.join('')\n each_id = alphabet.index(letter.downcase)\n next_consonant = alphabet2[each_id]\n end", "def word_has?(letter)\n @word.include?(letter)\n end", "def consonants(consonants_letter)\r\n consonants = \"bcdefghjklmnpqrstvwxyz\"\r\n current_location = consonants.index(consonants_letter)\r\n new_consonants = current_location + 1\r\n if consonants.index(consonants_letter) == 21\r\n results = \"b\"\r\n else\r\n results = consonants[new_consonants]\r\n end\r\n results\r\nend", "def word(strings)\n if strings[0..-1].capitalize! # strings[0].capitalize! ; strings[1..-1]\n # only if cap first letter # strings[0..-1]\n\n puts \"no #{strings} does not have capitalized first letter :-( )\"\n # ternary -- KOOL!!!!!\n puts strings[0..-1] == capitalize(strings) ? \"only first \" : \"not first\"\nelse\n puts \"yes #{strings} has capitalized first letter :-) \"\n\nend\nend", "def coinc?( word, base )\r\n\t# output: nil - no coincedence, 0 - from beginning, >0 - prefix exists\r\n\treturn word.index(base)\r\nend" ]
[ "0.8215397", "0.818642", "0.8042217", "0.7927891", "0.7877118", "0.7868221", "0.78401625", "0.7828041", "0.78177667", "0.7807915", "0.7782248", "0.7780567", "0.7773701", "0.7747902", "0.774192", "0.7734011", "0.7734011", "0.7730482", "0.77289766", "0.7693774", "0.76930624", "0.7681975", "0.7679619", "0.76721895", "0.7658329", "0.76561356", "0.7631966", "0.7630184", "0.76297325", "0.76293325", "0.7618375", "0.757163", "0.75701684", "0.75609666", "0.75574785", "0.75538003", "0.7504536", "0.7493907", "0.7477322", "0.7477322", "0.74243796", "0.7256652", "0.71187973", "0.7096529", "0.69393873", "0.6858126", "0.6829432", "0.6692427", "0.6595423", "0.6585776", "0.6563091", "0.64141136", "0.6369959", "0.6332461", "0.6295521", "0.6287136", "0.6272937", "0.6229105", "0.62092763", "0.62023336", "0.6197776", "0.6194287", "0.6168431", "0.6166547", "0.616482", "0.613468", "0.6126957", "0.61240536", "0.6098128", "0.6090955", "0.60737646", "0.6059226", "0.6057634", "0.60556495", "0.6053812", "0.60520434", "0.6039305", "0.6038421", "0.60381824", "0.6033983", "0.60212713", "0.6019853", "0.6011577", "0.60015595", "0.59907085", "0.5986876", "0.59850705", "0.59800714", "0.59752595", "0.597514", "0.597404", "0.5971054", "0.596546", "0.5962205", "0.5959482", "0.5952816", "0.5948216", "0.5945842", "0.59306866", "0.5929568", "0.5929274" ]
0.0
-1
begin main translate method
def translate(words) split_words = words.split split_words.each_with_index do |word, i| # check if first letter is a vowel if word[0].include? VOWELS.join word = add_ay(word) # add ay to the back of the word split_words[i] = word elsif word[0].include? CONSONANTS find_phoneme(word) elsif (word[0].include? CONSONANTS) && (word[1].include? CONSONANTS) find_phoneme(word) elsif (word[0].include? CONSONANTS) && (word[1].include? CONSONANTS) && (word[2].include? CONSONANTS) # the word has a consonant at the beginning with # no special conditions else word = one_cons_at_beginning(word) word = add_ay(word) split_words[i] = word end end split_words.join end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate()\n\nend", "def translate()\n\nend", "def translate()\n\nend", "def translate()\n\nend", "def translate()\n\nend", "def translate()\n\nend", "def translate()\n\nend", "def translate()\n\nend", "def translate(*args, **opts); end", "def translate(settings); end", "def translate(text,dictonary)\nend", "def translate(eng_word) # here call to Max's ending code\n Multitran.translate(eng_word)\n end", "def init_translations; end", "def translate!( *args )\n super( *args )\n reset_positions_inside\n end", "def translations; end", "def translate\n translate_matches\n add_meta_charset\n set_encoding\n end", "def transl8 (input,lang) #method to translate incoming text\n translate = Google::Cloud::Translate.new\n detection = translate.detect input.to_s\n #puts input + \"Looks like you're speak in #{detection.language}\"\n #puts \"Confidence: #{detection.confidence}\"\n #translation = translate.translate \"Hello world!\", to: \"la\"\n translation = translate.translate input.to_s, to: lang.to_s\n return \"In #{lang} that's \" + translation\nend", "def translate(input_text, src_lang, target_lang)\n raise \"Not Implemented. Class #{self.class.name} doesn't implement translate\"\n end", "def boston_translator()\n\n\tscript_exit = false\n\n\tsystem \"clear\"\n\n\tputs \"Welcome to Boston. We can be a little hahd to undahstand, \\nso I figgahed I'd help you out.\"\n\n\twhile script_exit == false\n\t\tputs \"-------------------------------------------\"\n\t\tputs \"Whaddaya wanna do?\"\n\t\tputs \"'Lookup' a word or 'translate' somethin?\\n'Help' if you're not sure what I can do.\\nOr if you wanna leave, 'gtfo.'\"\n\t\tchoice = gets.chomp.downcase\n\n\t\tcase choice\n\n\t\twhen \"gtfo\"\n\t\t\tputs \"See ya!\"\n\t\t\tscript_exit = true\n\n\t\t\tnext\n\n\t\twhen \"translate\"\n\t\t\tputs \"-------------------------------------------\"\n\t\t\tputs \"Alright, what didja say?\"\n\t\t\toriginal_text = gets.chomp\n\t\t\t\n\t\t\tputs \"Gimme a sec...\" + \"\\n\"\n\n\t\t\toriginal_text_array = make_list(original_text)\n\t\t\t# puts original_text_array\n\n\t\t\tcapitals_array = find_store_capitals(original_text_array)\n\t\t\t# puts capitals_array\n\n\t\t\tdown_text_array = original_text_array.each {|word| word.downcase!}\n\t\t\t# puts down_text_array\n\n\t\t\tpunct_hash, bare_text = find_store_punctuation(down_text_array)[0], find_store_punctuation(down_text_array)[1]\n\t\t\t# puts punct_hash\n\t\t\t# puts bare_text\n\n\t\t\ttrans_text = word_search_replace(bare_text, $single_word_dictionary)\n\n\t\t\tfinal_text = restore_punct(restore_capitals(trans_text, capitals_array), punct_hash)\n\n\t\t\tputs \"You said: \" + back_to_string(final_text) + \"\\n\"\n\n\t\t\tnext\n\n\t\twhen \"lookup\"\n\t\t\tputs \"-------------------------------------------\"\n\t\t\tputs \"Whaddaya wanna lookup?\"\n\n\t\t\tboston_word = gets.chomp.downcase\n\t\t\t\n\t\t\tputs \"Gimme a sec...\" + \"\\n\"\n\t\t\tboston_word_singleton = boston_word.split\n\t\t\t\n\t\t\tfinal_word = word_search_replace(boston_word_singleton, $single_word_dictionary)\n\n\t\t\tif back_to_string(final_word) == boston_word\n\t\t\t\tputs \"I've nevah heard the word #{boston_word} befoah. Heh. Must not exist.\"\n\t\t\telse\n\t\t\t\tputs \"That means: \" + back_to_string(final_word)\n\t\t\tend\n\n\t\t\t\n\t\t\tnext\n\n\t\twhen \"help\"\n\t\t\tputs \"\\n\"\n\t\t\tputs \"So I'm a pretty smaht translatah. I know most of the most common English words\\nas a Bostonian would say them. \\nBasic spelling rules: ar, re, er, => ah.\\nI also know some of the words from Universal hub,\\nlike grindah, jimmies, and wicked.\\nSo test me out, and see what I know.\"\n\t\t\tputs \"\\n\"\n\n\t\telse\n\t\t\tputs \"Don't be fresh. That's not an option. Try again\" + \"\\n\"\n\n\t\t\tnext\n\n\t\tend\n\n\n\t\t\n\tend\n\t\nend", "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 translate(word)\n\n @word_to_translate = word.split(/ /)\n @whole_sentence = []\n @vowels = \"aeiouy\"\n @output = \"\"\n\n#Première boucle pour récupérer tous les mots dans un array\n @word_to_translate.each do |x|\n @whole_sentence << x\n end\n\n#Ensuite je boucle sur chaque mot de cet array\n#Et j'effectue des tests sur les premières lettres\n\n# Plusieurs cas\n# 1- le mot commence par une voyelle donc\n# on rajoute juste ay à la fin\n# 2 - La 1ère lettre est un Q suivi de U\n#2bis ou SQU alors je considère également le tout comme une consonne\n# 3 - Trois consonnes\n# 4 - Deux consonnes\n# 5 - Une consonne\n\n#C'est très compliqué pour rien\n#Il aurait mieux fallu faire des cas\n\n\n@whole_sentence.each do |word_to_translate|\n\n @first_char = word_to_translate[0]\n @second_char = word_to_translate[1]\n @third_char = word_to_translate[2]\n @text_length = word_to_translate.length\n @new_word = word_to_translate\n @qu = @first_char + @second_char + @third_char\n if @vowels.include?(@first_char)\n #Ici on commence par une voyelle\n\n elsif @qu.include?(\"qu\")\n @new_word[@text_length] = @first_char\n @new_word[@text_length+1] = @second_char\n\n @index = @new_word.index(\"q\")\n if @index >=1\n @new_word[@text_length+2] = @third_char\n @new_word = @new_word[@index+2..-1]\n else\n @new_word = @new_word[@index+2..-1]\n end\n\n\n elsif !(@vowels.include?(@first_char) || @vowels.include?(@second_char)|| @vowels.include?(@third_char))\n\n#Ici on commence par trois consonnes\n @new_word[@text_length] = @first_char\n @new_word[@text_length+1] = @second_char\n @new_word[@text_length+2] = @third_char\n @new_word = @new_word[3..-1]\n\n elsif !(@vowels.include?(@first_char) || @vowels.include?(@second_char))\n\n#Ici on commence par deux consonnes\n @new_word[@text_length] = @first_char\n @new_word[@text_length+1] = @second_char\n @new_word = @new_word[2..-1]\n\n\nelse\n @new_word[@text_length] = @first_char\n @new_word = @new_word[1..-1]\n #Ici on commence par une consonne\n\nend\n\n@new_word += \"ay\"\n@output += @new_word + \" \"\nend\n\nreturn @output.chomp(\" \")\n#return @index\nend", "def _lex_trans_actions; end", "def _lex_trans_actions; end", "def _lex_trans_actions; end", "def _lex_trans_actions; end", "def _lex_trans_actions=(_arg0); end", "def _lex_trans_actions=(_arg0); end", "def _lex_trans_actions=(_arg0); end", "def _lex_trans_actions=(_arg0); end", "def translate_input_text\n if self.language\n self.output_text = self.language.translate(self.input_text)\n else\n self.output_text = self.input_text\n end\n end", "def translate\n self.translations.destroy\n\n if auto_translate\n google_translate\n bing_translate\n end\n end", "def translate(response)\n end", "def _lex_trans_targs; end", "def _lex_trans_targs; end", "def _lex_trans_targs; end", "def _lex_trans_targs; end", "def translate(text)\n\nvowels = [\"a\", \"e\", \"i\", \"o\", \"u\"] #create array of vowels\nwords = text.split(\" \") #create array of individual words from text \ntranslation = [] #create empty array to receive the individually translated words\n\n words.each do |word| #for each individual word in the array\n \n #create loop to continue while first letter is not a vowel.\n while vowels.include?(word[0].downcase) == false #check index 0 (first letter) in word is NOT a vowel\n \n if word[0..1] == \"qu\" #create exceptional case for 'qu'\n word = word [2..-1] + word[0..1] #splice the first two letters to the end of the word\n else\n word = word [1..-1] + word[0] #push the first letter in the word (index [0]) to the end of the array\n end \n \n end\n \n word = word + \"ay\"\n translation.push(word) #push the word to the end of the final array\n\n end\n \ntranslation.join(\" \")\n \nend", "def translate(item)\n @progress.setMainStatusAndLogIt('Translating')\n text = get_original_text(item)\n return nil if text.empty?\n\n translated = ms_translate(text)\n super(item, translated) unless translated.nil? || translated.empty?\n end", "def _lex_trans_targs=(_arg0); end", "def _lex_trans_targs=(_arg0); end", "def _lex_trans_targs=(_arg0); end", "def _lex_trans_targs=(_arg0); end", "def translate\n @new_phrase = []\n words\n @phrase.each do |word|\n @new_phrase << changer(word)\n end\n end", "def translate(x, y, &rendering_code); end", "def translate(args)\n Config.instance.translate(args.first)\n end", "def translate text\n split_arr = text.split(\" \")\n split_arr_trans = split_arr.map { |word| \n (@@found_dict.key? word) ? @@found_dict[word] : (@@found_dict[word]=process_word(word); @@found_dict[word])\n }\n return split_arr_trans.join(\" \")\n end", "def myDeepl_translate(text, source_lang, target_lang)\n begin\n source = source_lang.to_s.upcase\n target = target_lang.to_s.upcase\n ret = DeepL.translate(text, source, target).to_s\n ret.chomp!(\".\") # Українська translation has often a dot in the end\n ret.sub!(/\"/, \"\") # Українська translation has sometimes double quote in the beginning\n ret.sub!(/。/, \"\") # one time seen, 日本語 translation added japanese dot in the end\n # puts \"translate #{source} \\”#{text}\\\" -> #{target} \\\"#{ret}\\\"\"\n return ret\n rescue DeepL::Exceptions::Error => exc\n puts \"DeepL translation failed #{exc.class} #{exc.message}\"\n end\n return nil\n end", "def StartTransform\n\t\tout('q');\n\tend", "def show\n @translate\n @uploaded_text = ''\n translation_map = []\n end", "def gettext(username, password, input_text, output_code)\r\n default_src = 'en'\r\n default_action = 'translateREST'\r\n new_text = ''\r\n new_text = input_text\r\n new_text.gsub!(\"(\",\"<(\")\r\n new_text.gsub!(\")\",\")>\")\r\n new_array = new_text.split(/[<>]/)\r\n chash = Hash.new\r\n for i in 0..new_array.length-1\r\n if new_array[i][0..0] == \"(\"\r\n old_value = new_array[i]\r\n new_array[i] = \"!\"+i.to_s+\"!\"\r\n chash[new_array[i]] = old_value\r\n end\r\n end\r\n input_text = new_array.join\r\n # added new logic to split the file\r\n if input_text.length > 500 and not input_text.index(\"$-\")\r\n for i in 0..input_text.length/500-1\r\n x = input_text[0..500*(i+1)].rindex(/\\n/)\r\n input_text.insert(x+1, '$-')\r\n end\r\n end \r\n input_text = URI.escape(input_text)\r\n input_array = Array.new\r\n if input_text.index(\"$-\")\r\n input_array = input_text.split(\"$-\")\r\n else\r\n input_array[0] = input_text\r\n end\r\n # end of splitter logic\r\n result_all = \"\"\r\n for i in 0..input_array.length-1\r\n begin\r\n sleep 3 if i > 0\r\n raise UnSupportedLanguage unless SUPPORTED_LANG_CODES.include?(output_code)\r\n site_url = 'www.syslang.com'\r\n uri_method = '/frengly/controller?'\r\n uri_string = 'action='+default_action+'&src='+default_src+'&dest='+output_code+'&text='+input_array[i]+'&username='+username+'&password='+password\r\n response = Net::HTTP.get_response(site_url, uri_method + uri_string)\r\n if response.code == \"200\"\r\n xml_data = response.body\r\n data = XmlSimple.xml_in(xml_data)\r\n result = data[\"translation\"][0]\r\n chash.each {|key, value| result.gsub!(key, value) }\r\n result_all << result\r\n else\r\n puts response.body\r\n raise StandardError, response.body\r\n end\r\n rescue UnSupportedLanguage\r\n raise UnSupportedLanguage.new\r\n rescue => err_msg\r\n puts \"#{err_msg}\"\r\n end\r\n end\r\n result_all\r\n end", "def translate\n api = ENV['API']\n url = 'https://translation.googleapis.com/language/translate/v2?key='\n target_language = self.phrasebook.language.abbr\n input = self.phrase.input\n # byebug\n\n request = HTTParty.get(url + api + '&q=' + input + '&source=en' + '&target=' + target_language)\n response = JSON.parse(request.body)\n translation = response['data']['translations'][0]['translatedText']\n end", "def run(items)\n return nil if super(items).nil?\n\n url = 'https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to='\n @uri = URI.parse(url + @langs.key(@settings['translation_language']))\n @headers = { 'Ocp-Apim-Subscription-Key' => @settings['api_key'] }\n ['Content-Type', 'Accept'].each { |k| @headers[k] = 'application/json' }\n progress_dialog\n end", "def run_and_transform; end", "def _lex_trans_keys=(_arg0); end", "def _lex_trans_keys=(_arg0); end", "def _lex_trans_keys=(_arg0); end", "def _lex_trans_keys=(_arg0); end", "def _lex_eof_trans=(_arg0); end", "def _lex_eof_trans=(_arg0); end", "def _lex_eof_trans=(_arg0); end", "def _lex_eof_trans=(_arg0); end", "def check_starting(_lang_result)\n end", "def translate(input)\n #outStr = input.downcase\n outStr = input\n\n # replace words\n # still need to add punctuation and missing words\n outStr = single_words(outStr)\n\n # prepend and append\n outStr = prepend_and_append(outStr)\n\n # punctuation\n #outStr = punctuation(outStr)\n\n # change tags like &god or &bodypart, etc\n outStr = change_tags(outStr)\n\n\n puts outStr\n end", "def pig_latin_translator\n input = nil\n until input == 'quit' || input == 'exit'\n print \"Translate > \"\n input = gets.chomp\n input.strip == '' ? redo : nil\n puts format_sentence(sentence_to_pig_latin(input))\n end\nend", "def lex_en_interp_words=(_arg0); end", "def lex_en_interp_words=(_arg0); end", "def lex_en_interp_words=(_arg0); end", "def translate(word)\n\tary = Array.new\n\tary << word.split(\"\")\n\tputs \"Hello World\"\n\tputs word[0]\n\tputs \"Hey there\"\n\tif (ary[0] == \"a\")\n\t\tputs \"hello world\"\n\t\tputs \"This word starts with a vowel\"\n\tend\nend", "def translated_msg(translate, message, src_lang, target_lang)\n return message unless translate \n use_src = nil \n if (src_lang.nil? || src_lang.empty?)\n # We don't need to infer again and again\n begin\n @inferred_src_lang ||= infer_languages.first\n rescue StandardError => e \n raise LangDetectionFailureException.new(\"Failed to infer language due to #{e.message}\")\n end\n use_src = @inferred_src_lang\n else\n use_src = src_lang\n end\n return message if use_src.eql?(target_lang)\n @translator.translate(message, use_src, target_lang)\n end", "def translate_utf8 text, index\n @dict.each { |word| \n key, eng = word[0], word[1][TABLE[index]] \n text.gsub!(key, eng)\n }\n text\n end", "def translate(str)\n\n\n\n # Vowels to consider\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n \n # Special cases to consider\n two_letter_consonants = [\"ch\", \"sh\", \"qu\", \"th\", \"br\"]\n three_letter_consonants = [\"thr\", \"sch\", \"squ\"]\n\n words = str.split(\" \")\n result = []\n\n words.each do |word|\n if vowels.include?(word[0])\n result.push word << \"ay\"\n else \n if three_letter_consonants.include? (word[0] + word[1] + word[2])\n first_three_letters = word.slice!(0,3)\n \n # Add letters to end of word with 'ay'\n result.push word << first_three_letters << 'ay'\n elsif two_letter_consonants.include?(word[0] + word[1])\n first_two_letters = word.slice!(0,2)\n result.push word << first_two_letters << \"ay\"\n else \n first_letter = word.slice!(0)\n \n # Add first letter to end of word with 'ay'\n result.push word << first_letter << 'ay'\n end #End of special consonant check\n end \n end \n return result.join(\" \")\nend", "def transact; end", "def translate!(key, **options); end", "def initialize(eng_sentence, rus_sentence)\n eng_sentence.each { |word| word.downcase!.force_encoding(Encoding::UTF_8) }\n rus_sentence.each { |word| word.downcase!.force_encoding(Encoding::UTF_8) }\n @eng_sentence = eng_sentence\n @rus_sentence = rus_sentence\n\n # TODO: add words\n @useless_eng_words = %w(a the an on in by is are am were was be been have has had to i you he she it we they)\n @useless_rus_words = %w(а б бы в во на я ты он она оно мы вы они)\n\n @rus_endings = %w(am ax cm ex а ам ами ас ая е ев ей ем еми емя ею её и ие ий им ими ит ите их ишь ию ия иям иями иях м ми мя о ов ого ое ой ом ому ою оё у ум умя ут ух ую ют шь ю я ям ями ях ёй ёт ёте ёх ёшь)\n\n delete_useless!\n\n @used_rus = Array.new(@rus_sentence.length, false)\n @used_eng = Array.new(@eng_sentence.length, false)\n\n @translation_eng_to_rus = Array.new(@eng_sentence.length)\n\n @rus_infinitives = get_infinitives(@rus_sentence)\n @rus_sentence = delete_endings(@rus_sentence)\n\n @all_translations = {}\n @part_of_speech = {}\n # Parallel code\n eng_leng = @eng_sentence.size\n block = 10\n (0..eng_leng/block).each { |block_num|\n\n eng_sentence_ = []\n (0..block-1).each { |j|\n if block*block_num + j < eng_leng\n eng_sentence_ << @eng_sentence[block*block_num + j]\n end\n }\n threads = []\n\n eng_sentence_.each do |eng_word|\n threads << Thread.new do\n Thread.current['eng'] = eng_word\n translations = translate(eng_word)\n Thread.current['rus'] = translations.map { |t| t[0] }\n Thread.current['parts_of_speech'] = translations.map { |t| t[1] }\n end\n end\n\n\n threads.each do |t|\n t.join\n @all_translations[t['eng']] = t['rus']\n t['parts_of_speech'].size.times { |i| @part_of_speech[t['rus'][i]] = t['parts_of_speech'][i] }\n end\n }\n\n puts 'all translations have been loaded!'\n end", "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 translator\n # Greet your user in the language of their people.\n puts [\"SUP KID? \",\n \t \"What didja say? \",\n \t \"How ya doan? \",\n \t \"How ahrya?\",\n \t \"How 'bout them Sox? \",\n \t \"How 'bout them Pats? \"].sample\n\n # Get their response and lop off the carriage return, Massachusetts Left style.\n phrase = gets.chomp.to_s\n\n # Now we're going to award the user points based on density of Boston-specific\n # diction, aka their Beantown Points(tm).\n i = 0\n beantown_points = 0\n wicked_boston_words = [\"bubblah\",\n \"wicked\",\n \"reveah\",\n \"the dot\",\n \"medfid\",\n \"broons\",\n \"barrel\",\n \"digga\",\n \"southie\",\n \"eastie\",\n \"rotary\",\n \"pissah\",\n \"jp\",\n \"fried\",\n \"directional\",\n \"beantown\",\n \"red sox\",\n \"common\",\n \"dunkin donuts\",\n \"patriots\",\n \"celtics\",\n \"green monster\",\n \"dirty watah\",\n \"packie\"\n ]\n\n searchable_phrase = phrase.downcase\n\n wicked_boston_words.each do |i|\n \tif searchable_phrase.include?(i)\n \t\tbeantown_points += 1\n \tend\n end\n\n ########################################################################################################\n # A-Z dictionary of specific gsubs for targeted replacement. This is about to get wicked awesome, bro! #\n ########################################################################################################\n\n # A\n phrase.gsub!(/\\bacross the rivah?\\b/i, 'on the other side of the Charles River') # across the rivah (other side of the charles)\n phrase.gsub!(/\\b(a)dvahtisin'?g?\\b/i, '\\1dvertising') # advahtisin'(g)\n phrase.gsub!(/\\b(a)dvisah?\\b/i, '\\1dviser') # advisah\n phrase.gsub!(/\\b(a)doah\\b/i, '\\1dore') # adoah\n phrase.gsub!(/(a)ftah/i, '\\1fter') # aftah (aftahwahds, raftah, & other containing words)\n phrase.gsub!(/\\bah(h)?(?=\\s[a-z]+in('|g))?\\b/i, 'are') # ah (usually \"are\" if a word ending in \"ing is after\")\n phrase.gsub!(/\\b(the)? Ahbs\\b/i, '\\1 Arboretum') # the ahbs is a fun place to hang out\n phrase.gsub!(/\\b(a)hm\\b/i, '\\1rm') # curt schilling's gotta good ahm\n phrase.gsub!(/(f|w|h|al|ch|fore)ahm(s?)/i, '\\1arm\\2') # ahm at the end of words\n phrase.gsub!(/\\bahr\\b/i, 'are') # ahr\n phrase.gsub!(/\\bahrya\\b/i, 'are you') # how ahrya?!\n phrase.gsub!(/\\b(a)hnt\\b/i, '\\1unt') # ya ahnt is comin' to Christmas\n phrase.gsub!(/\\ball set\\b/i, 'all done') # all set with my dinnah, thank you\n phrase.gsub!(/\\bAllston Christmas\\b/i, 'The last weekend in August when all the students move out and leave their furniture behind in Allston') # Gonna need a biggah cah\n phrase.gsub!(/\\b(a)mbassad(oah|ah)(s)/i, '\\1ambassad\\2\\3') # ambassadoah/dah\n\n # B\n phrase.gsub!(/\\b(b)ah\\b/i, '\\1ar') # bah (let's get a beeah at the bah)\n phrase.gsub!(/\\b(cross|crow|de|dis|draw|handle|iso|sand|side)bah(s)\\b/i, '\\1bar\\2') # \"bah\" (words ending in bah)\n phrase.gsub!(/\\bbahnie\\b/i, 'smart geek') # bahnie\n phrase.gsub!(/\\bbang a left\\b/i, 'take a left') # bang a left...but do it before the oncoming turns green!\n phrase.gsub!(/\\b(b)ankin/i, 'hillside') # watch the game from the bankin\n phrase.gsub!(/\\bbarrel/i, 'trash can') # throw that yankees jersey in the barrel\n phrase.gsub!(/\\bbazo\\b/i, 'drunk') # bazo on the weekendddd\n phrase.gsub!(/\\bbeantown\\b/i, 'Boston') # beantown\n phrase.gsub!(/\\b(b)eeah(s)?\\b/i, '\\1eer') # lemme buy ya a beeah (sam adams please)\n phrase.gsub!(/\\b(b)ettah\\b/i, '\\1etter') # bettah (than you)\n phrase.gsub!(/\\bbig(-|\\s)ball bowling?/i, '10-pin bowling') # big ball bowlin'\n phrase.gsub!(/\\bBig Dig\\b/i, 'the most expensive highway project in U.S. History') # the big dig, depress that central ahtery\n phrase.gsub!(/\\bb(ill-)?ricka/i, 'Billerica') # Billerica\n phrase.gsub!(/\\bboahded\\b/i, 'dibs') # boahded\n phrase.gsub!(/\\bbobos\\b/i, 'boat shoes') # bobos\n phrase.gsub!(/\\bBostonian\\b/i, 'resident of Boston') # Bostonian\n phrase.gsub!(/\\bbook(ed|in)? outta theah\\b/i, 'took off') # bookin' it\n phrase.gsub!(/\\b(b)r(a|u)h\\b/i, '\\1ro') # brah/bruh\n phrase.gsub!(/\\bbrahmin\\b/i, 'WASP-y type') # Brahmin\n phrase.gsub!(/\\bbreakdown lane\\b/i, 'highway shoulder') # breakdown lane at rush hoah, jeez\n phrase.gsub!(/\\bBroons\\b/i, 'Bruins') # Da Broons!\n phrase.gsub!(/\\bbubblah\\b/i, 'water fountain') # bubblah\n\n # C\n phrase.gsub!(/\\b(c)ahds\\b/i, '\\1ards') # cahds\n phrase.gsub!(/\\b(c|ced|chedd|sc|sidec|tramc|supahc|vic)ah(s)?\\b/i, '\\1ar\\2') # cah(s) and 6 containing words that are most common.\n phrase.gsub!(/\\b(c)alendah(s)?\\b/i, '\\1alendar\\2') # calendah (the sawx got theyah openin' day on theah!)\n phrase.gsub!(/\\bcalm ya liva(a|h)?/i, 'relax') # calm ya livah, I didn't eat ya dinnah\n phrase.gsub!(/\\b(c)an't get\\b/i, '\\1an get') # can't get (no satifaction...but plenty of double negatives up for grabs, so)\n phrase.gsub!(/\\bThe Cape\\b/i, 'Cape Code, Massachusetts') # goin' to the Cape this summah\n phrase.gsub!(/\\bcarriage\\b/i, 'grocery cart') # carriage (for ya lobstahs and beeahs)\n phrase.gsub!(/\\b(c)awna\\b/i, '\\1orner') # coolidge cawna\n phrase.gsub!(/\\b(c)ella(h)\\b?/i, 'basement') # go down cella\n phrase.gsub!(/\\b(c)howdah\\b/i, '\\1howder') # chowdah (clam or lobstah, take ya pick at sullivan's!)\n phrase.gsub!(/\\b(coffee|small|medium|lahge) regulah\\b/i, 'coffee with cream and two sugars') # coffee, regulah\n phrase.gsub!(/\\bCochihchewit\\b/i, 'Cochituate') # Co-CHIH-chew-it\n phrase.gsub!(/\\b(c)onsidah\\b/i, '\\1onsider') # considah\n phrase.gsub!(/\\b(c)orridoah(s)\\b/i, '\\1orridor\\2') # corridor\n phrase.gsub!(/\\b(c)umbie(s|'s)/i, 'Cumberland Farms Mini-Mart') # cumbie's\n\n # D\n phrase.gsub!(/\\b(Mon|Tues|Wed|Thurs|Fri|Sun)diz/i, '\\1days') # plural days of the week, less Saturday which can have a couple pronunciations\n phrase.gsub!(/\\b(d)ecoah\\b/i, '\\1ecor') # decoah (in ya apahtment!) -- most frequently used word ending in \"cor\"\n phrase.gsub!(/\\bdecked\\b/i, 'punched') # he got decked at the sox game\n phrase.gsub!(/\\bdecked\\sout\\b/i, 'dressed up') # he's all decked out for his date!\n phrase.gsub!(/\\b(d)idja\\b/i, '\\1id you') # didja\n phrase.gsub!(/\\bdirty watah\\b/i, 'the Charles River') # love that dirty watah\n phrase.gsub!(/\\bdiggah?\\b/i, 'fall') # fell on some ice and took a diggah\n phrase.gsub!(/\\b(d|fl|ind|p|outd)oah\\b/i, '\\1oor') # oah words ending in oor\n phrase.gsub!(/\\b(direc|doc)tah\\b/i, '\\1tor') # doctah/directah\n phrase.gsub!(/\\bdirectional\\b/i, 'turn signal') # put on ya directional before you take turn\n phrase.gsub!(/\\bDot Ave\\b/i, 'Dorchester Avenue') # Dot Ave\n phrase.gsub!(/\\bDot Rat(s)?/i, 'resident\\1 of Dorchester') # Dot Rats\n phrase.gsub!(/\\bthe Dot\\b/i, 'Dorchester') # the dot\n phrase.gsub!(/\\bdunki(n'?s'?|n|es)(\\sdonuts)?\\b/i, 'Dunkin\\' Donuts') # dunkies, dunkins, dunkin, dunkin's, & dunkin's!\n phrase.gsub!(/\\bdrawring\\b/i, 'drawing') # drawring\n\n # E\n phrase.gsub!(/\\bEastie\\b/i, 'East Boston') # Eastie\n phrase.gsub!(/\\belastic(s)?\\b/i, 'rubber band\\1') # elastics\n phrase.gsub!(/(e)ntah\\b/i, '\\1nter') # entah (come in heah!)\n phrase.gsub!(/\\b(e)ntiah\\b/i, 'entire') # entiah (I've lived in Boston my entiah life)\n phrase.gsub!(/(n)?(e)vah\\b/i, '\\1\\2ver') # evah (or forevahevah! or nevah. that too.)\n\n # F\n phrase.gsub!(/\\bfahr\\b/i, 'for') # fahr (ready fahr spring after this wintah!)\n phrase.gsub!(/\\bfactah\\b/i, 'factor') # factah\n phrase.gsub!(/\\b(af|insof|ovahf|f)ah\\b/i, '\\1ar') # fah (neah, fah, wheahevah you ahhhhh)\n phrase.gsub!(/(f)ahkin'?/i, '\\1*!king') # I mean, it's not very polite but you have to admit it is a distinctive part of a true Boston accent!\n phrase.gsub!(/(f)ahk?/i, '\\1*!k') # I mean, it's not very polite but you have to admit it is a distinctive part of a true Boston accent!\n phrase.gsub!(/\\b(airf|cahf|thoughroughf|welf|wahf|f)ayah\\b/i, '\\1are') # fayah (wahfayah, aihfayah)\n phrase.gsub!(/\\bfawr\\b/i, 'for') # fawr\n phrase.gsub!(/(af|bef|f)oah\\b/i, '\\1ore') # foah (fore & variants)\n phrase.gsub!(/\\bfoddy\\b/i, 'fourty') # foddy\n phrase.gsub!(/\\bfrappe\\b/i, 'a milkshake/malted (ice cream, milk, & syrup blended)') # frappe\n phrase.gsub!(/\\b(frickin|friggin)'?(?!\\z|\\s)/i, 'freaking') # the G-rated version of Boston's favorite adjective\n phrase.gsub!(/\\bfried\\b/i, 'weird') # fried\n phrase.gsub!(/\\bFudgicle\\b/i, 'Fudgsicle') # a fudgsicle that lost the \"s\"\n\n # G\n phrase.gsub!(/\\b(g)ahbidge\\b/i, '\\1arbage') # Wednesdiz is gahbidge day\n phrase.gsub!(/\\b(gawrls|gahls|gawhls)/i, 'girls') # gawrls just wanna...learn to code and change the girl to dave ratio, actually.\n phrase.gsub!(/(g)awd\\b/i, '\\1od') # oh my gawd\n phrase.gsub!(/\\b(g)ovahment\\b/i, '\\1overnment') # Govahment Centah! It's wheah Boston Cawllin' always is!\n phrase.gsub!(/\\b(ci|beg|vul|sug|vine)gah(s)?\\b/i, '\\1gar\\2') # gah --> sugah, cigah, etc.\n phrase.gsub!(/\\b(g)oah\\b/i, '\\1ore') # goah (Melissa-Leigh Goah, like Al Goah, he invented the intahnet)\n phrase.gsub!(/\\bg(o|a)tta\\b/i, 'have to') # gotta\n phrase.gsub!(/\\b(g)rammah\\b/i, '\\1rammar') # grammah\n phrase.gsub!(/\\bgrindah?(s)?\\b/i, 'sub\\1') # grindahs\n phrase.gsub!(/\\b(g)uitah\\b/i, '\\1uitar') # guitah (what's that game the kids ah playin? guitah hero?!)\n\n # H\n phrase.gsub!(/\\b(Hahvahd|Havahd|Havid|Hahvid)/i, 'Harvard') # Let's go to Hahvid and sit outside the Widenah Library\n phrase.gsub!(/\\b(hang|hook) a right\\b/i, 'take a right') # hang/hook a right\n phrase.gsub!(/\\bhamburg\\b/i, 'ground beef') # my grammy's go to dinnah was hamburg thingies..aka ground beef patties with mustard cooked on one side of a hamburger bun (this is an actual true story from the writer of this program, haha)\n phrase.gsub!(/\\b(heahd|heid)\\b/i, 'heard') # ya nevah heahd about that?\n phrase.gsub!(/heah/i, 'here') # heah, wheah, theah (wait, who's on first?!) -- this matches on at least 300 english words containing \"here\"\n #hahbah (no taxation without representation, ya dig?) covered under \"lahbah\"\n phrase.gsub!(/\\bHub\\b/i, 'Boston') # the Hub\n\n # I\n phrase.gsub!(/\\b(i)dear\\b/i, '\\1dea') # idear (so THAT'S where all those \"r\"'s went!')\n phrase.gsub!(/\\b(i)ntahfeah\\b/i, '\\1nterfere') # doan wanna intahfeah, ya know?\n\n # J\n phrase.gsub!(/\\b(a)?(j)ah\\b/i, '\\1\\2ar') # jah and ajah, like jams and doahs, but not doahjahms. well, maybe.\n phrase.gsub!(/\\bjimmies\\b/i, 'chocolate sprinkles') # jimmies, just be careful asking for these in NJ\n phrase.gsub!(/\\bJP\\b/, 'Jamaica Plain') # JP, fastest gentrifying neighbahood\n\n # K\n phrase.gsub!(/\\b(k)eggah?(s)\\b/i, '\\1eg party\\2') # kegga, aka something you throw at ya new apahtment in college\n phrase.gsub!(/\\b(k)inda\\b/i, '\\1ind of') #\n\n # L\n phrase.gsub!(/(chancel|council|sail|counsel|tai|pah|bache|co|sett)lah\\b/i, '\\1lor') # lah (words ending in lah are usually \"ler\", so this looks for the most common ones that should actually be \"lor\" first)\n phrase.gsub!(/([a-z])+ahbah\\b/i, '\\1abor') # lahbah (workin' hahd!) also covers hahbah (no taxation without representation, ya dig?!) and other bor words -- targeted rule so general rule doesn't make this \"laber\"\n phrase.gsub!(/\\b(l)abradoah(s)\\b/i, '\\1abrador\\2') # labradoah retrievah\n phrase.gsub!(/\\bLe(ay|i)?stuh\\b/i, 'Leicester') # Leicester\n phrase.gsub!(/\\bLem(o|i)nstah\\b/i, 'Leominster') # Leominster\n phrase.gsub!(/\\bLight Dawns ovah? Mahblehead\\b/i, 'Oh, DUH.') # light dawns ovah mahblehead\n phrase.gsub!(/\\b(l)iquah\\b/i, '\\1iquor') # liquah stoah...aka a packie, tbh\n phrase.gsub!(/\\blotta\\b/i, 'lot of') # lotta\n\n # M\n phrase.gsub!(/(ah|gla|hu|ru|tre|tu)mah\\b/i, 'mor') # words ending in mah, like rumah, humah (targeted gsub bc most are \"mer\")\n phrase.gsub!(/\\b(m)ajah\\b/i, '\\1ajor') # majah league baseball\n phrase.gsub!(/\\bmasshole\\b/i, 'a proud jerk from Massachusetts') # massholes :)\n phrase.gsub!(/\\b(m)ayah\\b/i, '\\1ayor') # Mayah Menino was the best mayah evah. (RIP)\n phrase.gsub!(/\\b(Mehfuh|Meffid|Medfid)\\b/i, 'Medford') # Meffid. Next to Somerville, home to Tufts\n phrase.gsub(/ministah\\b/i, 'minister') # ministah (the religious kind, but also administer, etc)\n\n # N\n phrase.gsub!(/\\b(nawht|naht)\\b/, 'not') # naht/nawt\n phrase.gsub!(/\\bnooyawka\\b/i, 'New Yorker') # Nooyawka, just the kind of person you don't want to meet at Fenway\n phrase.gsub!(/(semi|so|lu)nah\\b/i, '\\1nar') # \"nah\" ending words that aren't \"ner\"...seminah, solah\n phrase.gsub!(/(na-ah|nuh-uh|nuh-ah)/i, 'no way') # nah-ah\n phrase.gsub!(/\\bneighbahood\\b/i, 'neighborhood') # neighbahood\n\n # O\n phrase.gsub!(/\\b(o)ah\\b/, '\\1ur') # oah (this is ah (our) city!)\n phrase.gsub!(/(o)ffah/i, '\\1ffer') # offah\n phrase.gsub!(/onna(-|\\s)?conna/i, 'on account of') # onna-conna I gotta help my ma\n phrase.gsub!(/\\bopen ai(r|h)\\b/i, 'drive in movie') # open air (drive in movie theatre)\n phrase.gsub!(/(o)thah/i, '\\1ther') # othah (and also containing words like anothah or brothah)\n phrase.gsub!(/(o)vah/i, '\\1ver') # ovah (and also containing words like covah (at the bah!) rovah or ovahpass)\n phrase.gsub!(/(o)wah\\b/i, '\\1wer') # owah (all words ending in \"ower\", powah, flowah, etc)\n\n # P\n phrase.gsub!(/\\bpackie\\b/i, 'liquor store') # packie\n phrase.gsub!(/\\bpeab('dee|dee|ody)\\b/i, 'Peabody') # Peabody\n phrase.gsub!(/\\b(p)lenny\\b/i, '\\1lenty') # plenny ah beahs in the fridge\n phrase.gsub!(/\\bpissah?\\b/i, 'cool') # wicked pissah\n phrase.gsub!(/\\b(Ptown|P-Town|P Town)/i, 'Provincetown') # at the endah tha cape\n\n # Q\n phrase.gsub!(/\\bquality\\b/i, 'worthless') # sarcasm at its finest\n phrase.gsub!(/\\bQuinzee\\b/i, 'Quincy') # Quincy\n\n # R\n phrase.gsub!(/\\b(r)adah?\\b/i, '\\1adar') # radah (cops runnin the radah around to cawnah)\n phrase.gsub!(/\\brahya\\b/i, 'rare') # rahya (wicked rahya steak)\n phrase.gsub!(/\\b(r)apshah?\\b/i, '\\1apture') # rapsha (Jesus and/or Red Sox championship parades, either way)\n phrase.gsub!(/\\b(r)awregg\\b/i, '\\1aw egg') # rawregg can give ya salmonella\n phrase.gsub!(/\\b(r)eahview\\b/i, '\\1earview') # reahview (mirror)\n phrase.gsub!(/\\b(r)emembah\\b/i, '\\1emember') # remembah (when govahment centah was open?)\n phrase.gsub!(/\\breveah\\b/i, 'Revere') # Reveah (as in, Paul. or the beach. or from, kid!)\n phrase.gsub!(/\\brotary\\b/i, 'traffic circle') # second left on tha rotary\n\n # S\n phrase.gsub!(/\\bsangwich\\b/i, 'sandwich') # sangwich\n phrase.gsub!(/\\bsa(dda|ti|tih|ta|tah|tuh)d(ay|ee)\\b/i, 'Saturday') # Satahday\n phrase.gsub!(/\\bsat(a|i)hdiz\\b/i, 'Saturdays') # Satahdays\n phrase.gsub!(/\\bskeeve(s|d)/i, 'grossed out') # skeeved out by hair in food, lemme tell ya\n phrase.gsub!(/soah\\b/i, 'sore') # wicked soah from gettin swole at the gym, bro\n phrase.gsub!(/\\b(s)o do(an|n'?t) i\\b/i, '\\1o do I') # So do(a)n't I!\n phrase.gsub!(/\\bsouthie\\b/i, 'South Boston') # Southie\n phrase.gsub!(/\\bspa\\b/i, 'convenience store (family-owned, usually)') # spa (let's go get an italian ice!)\n phrase.gsub!(/\\b(co|lode|mega|supah|)?stah\\b/i, 'star') # stah (ben affleck/matt damon, need I say moah?)\n phrase.gsub!(/\\bsuppah?\\b/i, 'dinner') # suppah\n phrase.gsub!(/\\bsweet caroline\\b/i, 'Sweet Caroline (BUM BUM BUM)') # GOOD TIMES NEVER SEEMED SO GOOOODD\n\n # T\n phrase.gsub!(/\\bthe T\\b/i, 'subway') # after this winter, it's a wonder I didn't replace this one with \"unusable death trap\"\n # \"theah\" is covered under \"h\" in the heah substitution\n phrase.gsub!(/\\btah\\b/i, 'to') # tah (ready tah go!)\n phrase.gsub!(/\\btawnic\\b/i, 'tonic (soda)') # get a tawnic outta the fridge foh ya fahtah\n phrase.gsub!(/\\btempasha(h)?\\b/i, 'temperature') # David Epstein says the tempasha should go back up tomarrah.\n phrase.gsub!(/\\b(t)ha\\b/i, '\\1he') # tha\n phrase.gsub!(/thah?\\b/i, 'ther') # brothah, fathah, mothah, etc. (matches on 92 english words ending in \"ther\")\n phrase.gsub!(/\\bthi(h)?d\\b/i, 'third') # stealin' thihd\n phrase.gsub!(/\\bthree deckah?\\b/i, 'three story house') # usually three units\n phrase.gsub!(/(pic|ven|lec|cap|adven|sculp|frac|scrip|punc|conjec|rap)sha/i, '\\1ture') # sha sound on end of certain \"ture\" ending words\n\n # U\n phrase.gsub!(/(u)ndah/i, '\\1nder') # undah (including all the words it is a prefix of like undahweah, undahcovah, undahahm, plus bonus containing words like thunder)\n phrase.gsub!(/\\b(u)ey\\b/i, '\\1-turn') # U-turn\n\n # V\n phrase.gsub!(/\\b(v)endah(s)\\b/i, '\\1endor') # vendah(s) (fenway franks, anybody?)\n phrase.gsub!(/\\bvin(yihd|yahd)\\b/i, 'Martha\\'s Vineyard') # mahtha's vinyihd\n phrase.gsub!(/\\b(fahv|fehv|flav|sav|surviv)ah\\b/i, '\\1or') # \"vah\" words that are \"vor\"\n\n # W\n phrase.gsub!(/\\b(w)atah\\b/i, '\\1ater') # watah (as in \"love that dirty\")\n phrase.gsub!(/\\bwah\\b/i, 'war') # wah\n phrase.gsub!(/\\bWal(ltham|thumb)\\b/i, 'Waltham') # home of Brandeis\n phrase.gsub!(/\\bwanna go\\?\\b/i, 'let\\'s fight outside') # wanna go?\n phrase.gsub!(/\\b(w)e(eahd|eid|ahd|eihd)\\b/i, '\\1eird') # weeid\n # wheah is covered under \"t\"...theah/wheah (as in, dude wheah's my car...oh, under a snowbank where I left it in January 2015!)\n phrase.gsub!(/\\bwhole nothah?\\b/i, 'a complete replacement') # I gotta whole notha cah\n phrase.gsub!(/\\bweah\\b/i, 'were') # wheah weah ya?\n phrase.gsub!(/\\b(w)eathah\\b/i, '\\1eather') # wetheah (some weah havin!)\n phrase.gsub!(/\\bwicked\\b/i, 'really') # wicked (wicked weeid kid)\n phrase.gsub!(/\\bwuhst(u|a)h\\b/i, 'Worcester') # Worcester\n\n # X\n\n # Y\n phrase.gsub!(/\\b(y)a\\b/i, '\\1ou') # ya goin to the game?\n phrase.gsub!(/\\b(y)ar(?=\\s?i)/i, '\\1eah ') # yarit's awesome -> yeah it's awesome\n phrase.gsub!(/\\b(y)oah\\b/i, '\\1our') # yoah\n\n # Z\n\n # Last, we're gonna do some broad pickoffs for general sounds common to the Boston accent.\n # This will help translate commonly used words and broadly applicable use-cases. They are\n # a little dangerous without the targeted gsubs above, but with them in place as a filter for\n # uncommon/edge cases, you should get good results.\n\n phrase.gsub!(/atah(s)?\\b/i, 'ator\\1') # \"atah\" (words ending in \"ator\"...decoratah, delegatah)\n phrase.gsub!(/(a)wl(l)?/i, '\\1l\\2') # \"awl\" (going to the mawll, fawllin' down, cawll ya mothah etc)\n phrase.gsub!(/bah(s)?\\b/i, 'ber\\1') # \"bah\" (words ending in bah...bahbah). Works b/c only 30ish words in English end in ber, & targeted gsubs are used above for them.\n phrase.gsub!(/cah(s)?\\b/i, 'cer\\1') # \"cah\" (words ending in cer are more common than car or cor, targeted gsubs for the latter two are above)\n phrase.gsub!(/dah(s)?\\b/i, 'der\\1') # \"dah\" (words ending in dah...chowdah?).\n phrase.gsub!(/eah(s)?\\b/i, 'ear\\1') # \"eah\" (words ending in eah...yeah, cleah)\n phrase.gsub!(/fah(s)?\\b/i, 'fer\\1') # \"fah\" (words ending in fer...offah?).\n phrase.gsub!(/gah(s)?\\b/i, 'ger\\1') # \"gah\" (words ending in ger...swaggah?).\n phrase.gsub!(/ha(h)?(s)?\\b/i, 'her\\2') # \"gah\" (words ending in ger...swaggah?).\n phrase.gsub!(/iah(d)?/i, 'ire\\1') # \"iahd\" (words ending in ire...tiahd, wiahd or ired...fiahd)\n phrase.gsub!(/in'(?=\\z|\\s)/i, 'ing') # \"in'\" (words ending in ing...bring back the g!).\n phrase.gsub!(/kah(s)?\\b/i, 'ker\\1') # \"kah\" (words ending in ker...smokah)\n phrase.gsub!(/lah(s)?\\b/i, 'lar\\1') # \"lah\" (words ending in lar...molah, pillah)\n phrase.gsub!(/mah(s)?\\b/i, 'mer\\1') # \"mah\" (words ending in mer...swimmah, homah)\n phrase.gsub!(/nah(s)?\\b/i, 'ner\\1') # \"nah\" (words ending in ner...gonah, runnah)\n phrase.gsub!(/layah(s)?\\b/i, 'lare\\1') # \"layah\" (words ending in lare..flayah, declayah)\n phrase.gsub!(/(o)ah(s)?/i, '\\1re\\2') # \"oah\" (stoah, moah)\n phrase.gsub!(/pah(s)?\\b/i, 'per\\1') # \"pah\" (words ending in \"pah\"...helpah, peppah, whispah, developah...which I am totally going to be after I win this contest and become...a launchah!)\n phrase.gsub!(/sah(s)?\\b/i, 'ser\\1') # \"sah\" (words ending in ser...think about ya usah in the browsah)\n phrase.gsub!(/tah(s)?\\b/i, 'ter\\1') # \"tah\" (words ending in ter...watah)\n phrase.gsub!(/uahd(s)?\\b/i, 'ured\\1') # \"uahd\" (words ending in ured...figuahd, injuahd)\n phrase.gsub!(/vah(s)?\\b/i, 'ver\\1') # \"vah\" (words ending in ver...ovah, rivah)\n phrase.gsub!(/wah(s)?\\b/i, 'wer\\1') # \"wah\" (words ending in wer...lawnmowah, towah)\n phrase.gsub!(/xah(s)?\\b/i, 'xer\\1') # \"xah\" (words ending in xer...boxah, mixah)\n phrase.gsub!(/yah(s)?\\b/i, 'yer\\1') # \"yah\" (words ending in yer...foyah, lawyah)\n phrase.gsub!(/zah(s)?\\b/i, 'zer\\1') # \"zah\" (words ending in zer...organizah, seltzah)\n\n phrase.gsub!(/aw/i, 'o') # this one is super broad...tawnic/gawd/etc\n phrase.gsub!(/ah(?!\\b)+/, 'ar') # this one should always run last because it's so broad, but it will clean and cover a ton more cases than can be thought up individually\n\n\n # Finally, there is some stuff we just will NOT abide by in the Beantown Translation Machine.\n\n phrase.gsub!(/\\b(A-Rod|Eli Manning|Peyton Manning|the Jets|Bill Buckner|snow|disabled train|severe delays in service|parking ban|commuter rail)\\b/i, '[REDACTED]') # Redact it like the FBI releasing an embarrassing document, okay?\n phrase.gsub!(/\\bYankees\\b/i, 'Yankees (suck!)') # Yankees suck okay?\n phrase.gsub!(/\\bJohnny Damon\\b/i, 'He who shall not be named') # Looks like Jesus, talks like Judas, throws like...someone who can't throw because that's just rude to Mary.\n\n puts \"They said: \" + phrase\n\n # Special \"How Boston Are YOU?\" Beantown Points score for experts! Only shows up for users who earn at least two points.\n\n if beantown_points >= 15\n \tputs \"How Boston Are YOU?: WICKED LEGIT! Ah you from Reveah, kid?! You're as Boston as baked beans and clam chowdah without tomatoes. Hit up that packie, it's time for a toast!\"\n elsif beantown_points < 15 && beantown_points >= 10\n \tputs \"How Boston Are YOU?: Solid work! You probably yell \\\"Yankees Suck\\\" at sporting events where the Yankees aren't even playing. You drink your watah from a bubblah. We salute you.\"\n elsif beantown_points < 10 && beantown_points >= 5\n \tputs \"How Boston Are YOU?: Alright, now we're getting somewhere. This is pretty Boston, we'll admit. Just don't try to pahk ya cah in Hahvahd Yahd, or you'll get towed, alright?\"\n elsif beantown_points >=2 && beantown_points < 5\n \tputs \"How Boston are YOU?: Solid effort, but you need to hit the Pike and go back wheah ya came from, kid.\"\n end\n\n play_again\n\nend", "def auto_translate\n return unless MuckContents.configuration.enable_auto_translations\n begin\n translate(false)\n rescue => ex\n #TODO figure out a way to bubble up the error\n puts ex\n debugger\n # Translations failed, but update the default language\n translation = translation_for(self.locale)\n translation.update_attributes!(:title => self.title, :body => self.body) unless translation.blank?\n end\n end", "def translate(key, **options); end", "def translate(key, **options); end", "def command_translate\n command :translate do |c|\n c.syntax = 'budik translate [options]'\n c.summary = @str_translate.summary\n c.description = @str_translate.description\n c.action { |args, _opts| Command.new(:translate, args) }\n end\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 translate code, translation = \"\"\n\n # recursion base case:\n #\n # return an array containing the translation if the code has\n # a size of 0\n return [translation.downcase] if code.size.zero?\n\n words = []\n\n # check all possible matches to the code\n LETTERS.each do |letter|\n if code[letter.pattern]\n\n # recurse on untranslated portion of the code\n # and new translation\n # add results to our array at this level of recursion\n words += translate code.sub(letter.pattern,''),translation+letter.letter\n end\n end\n\n return words\n\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(string)\n output = Array.new \n\n # turn our string into an array\n words = string.split(' ')\n\n # run each element in the array through our single-world translator method\n words.each do |single_word|\n output << translate_single_word(single_word)\n end\n\n return output.join(\" \")\nend", "def translate(locale, key, options = T.unsafe(nil)); end", "def label_translation; end", "def create_translations\n end", "def transformations; end", "def translate(text:, from: nil, to:, **opts) # rubocop:disable Lint/UnusedMethodArgument, Metrics/LineLength\n raise NotImplementedError\n end", "def translate_into_lang_code(lang_code)\n unless lang_code.nil?\n # if the text is a speaking business card don't translate\n if original_text.text.start_with?('BEGIN:VCARD')\n text = original_text.text\n add_translation(text, lang_code)\n else\n require 'bing_translator'\n\n original_translation_code = TranslationsHelper.cut_country original_text.lang_code\n to_translation_code = TranslationsHelper.cut_country lang_code\n\n translator = BingTranslator.new(BING_CLIENT_ID_DEV, BING_CLIENT_SECRET_DEV)\n\n text = translator.translate original_text.text, :from => original_translation_code, :to => to_translation_code\n add_translation(text, lang_code)\n end\n\n return text\n end\n end", "def translate(source_copy)\n sentences = source_copy.split(\".\")\n words = sentences.map { |s| s.split(\" \") }\n currency_indexes = words.flatten.each_with_index.select { |w, i| w.match(/[#{currencies}]/) }.map { |_, i| i }\n to_return = if words.flatten.count == 1\n pseudo_word\n elsif sentences.count == 1\n pseudo_phrase(words.flatten.count)\n else\n pseudo_paragraph(words.map { |s| s.count })\n end\n add_currencies(to_return, currency_indexes)\n end", "def _lex_eof_trans; end", "def _lex_eof_trans; end", "def _lex_eof_trans; end", "def _lex_eof_trans; end", "def translate(sentence)\n #we .split that sentence. Because we do not give a limit, the sentence is automaticly split along the spaces.\n #we .map the result of the .split to make every word in the array a variable= word.\n sentence.split.map do |word|\n #We define what the first vowel of the word is by a different method (first_vowel) and assign it as variable v\n v = first_vowel(word)\n # we slice of the first vowel and the letter preceding that. then we add the first letter of the word at the end, and add +ay\n word.slice(v..-1) + word[0,v] + \"ay\"\n #We end the function and join the retunring array with spaces in between.\n end.join(\" \")\n end", "def transformation\n end", "def finish_preparations\n munge\n @document.attributes['alternative_language_counter'] = @counter + 1\n @listing_text = @listing.convert\n @colist_text = @colist&.convert\n end", "def transform!\n state = inc_current_state\n print_by_line transform_message if state == 1\n\n self\n end", "def translate word\n\n\tsplit = word.split(\" \")\n\tlatin = \"\"\n\tvowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n\t\n\n\n\tsplit.each do |string|\n\n\t\ta = 0\n\t\tconsts = 0\n\n\t\twhile vowels.include?(string[a]) === false\n\t\t\tconsts = consts + 1\n\t\t\ta = a + 1\n\t\tend\n\n\t\tif string[consts -1] === \"q\"\n\t\t\tif string[consts] === \"u\"\n\t\t\t\tconsts = consts + 1\n\t\t\tend\n\t\tend\n\n\t\tb = string[0, consts]\n\n\t\t\n\t\tif consts === 1\n\t\t\tlatin = latin + string[consts, string.length-1] + string[0] + \"ay\"\n\t\telsif\tconsts > 1\n\t\t\tlatin = latin + string[consts, string.length-1] + b + \"ay\"\n\t\telse\n\t\t\tlatin = latin + string + \"ay\"\n\t\tend\n\n\tlatin = latin + \" \"\n\n\tend\n\n\tlatin.strip\n\t\nend" ]
[ "0.72906065", "0.72906065", "0.72906065", "0.72906065", "0.72906065", "0.72906065", "0.72906065", "0.72906065", "0.7136828", "0.69542295", "0.68306696", "0.6810086", "0.6702626", "0.6689552", "0.64810085", "0.6422103", "0.632119", "0.62911314", "0.62776816", "0.6265369", "0.6257542", "0.6241066", "0.6241066", "0.6241066", "0.6241066", "0.6196286", "0.6196286", "0.6196286", "0.6196286", "0.6188485", "0.615429", "0.6141283", "0.61022633", "0.61022633", "0.61022633", "0.61022633", "0.6080022", "0.60388786", "0.5972244", "0.5972244", "0.5972244", "0.5972244", "0.59699476", "0.59318715", "0.59270656", "0.59151936", "0.5912262", "0.58998775", "0.5879037", "0.5873246", "0.5870328", "0.5869015", "0.5854085", "0.5846492", "0.5846492", "0.5846492", "0.5846492", "0.58134156", "0.58134156", "0.58134156", "0.58134156", "0.5804019", "0.57780635", "0.5767235", "0.57574487", "0.57574487", "0.57574487", "0.5734482", "0.5717269", "0.57150567", "0.5714434", "0.5704122", "0.570104", "0.56971294", "0.5692872", "0.5691622", "0.56879944", "0.5674066", "0.5674066", "0.56718063", "0.56715673", "0.5671513", "0.5650049", "0.5635823", "0.5625223", "0.5619237", "0.5616772", "0.5605931", "0.5592301", "0.55895203", "0.5585999", "0.5583977", "0.5583977", "0.5583977", "0.5583977", "0.5573713", "0.5572253", "0.55548245", "0.55425024", "0.5541244" ]
0.56910837
76
Called to perform modifications on the packet before writing the data
def write_data(data) # read the APID from the packet apid = BinaryAccessor.read(@apid_bit_offset, @apid_bit_size, :UINT, data, @endianness) # if the key does not yet exist in the hash (ie, this is the first time # this packet has been sent), add an entry to the hash if(!@sent_seqcnts.key?(apid)) @sent_seqcnts[apid] = 0 # otherwise, increment the key that already exists else @sent_seqcnts[apid] += 1; end # use the value from the hash seqcnt = @sent_seqcnts[apid] # make sure the value will fit in the bits allocated for it # wraps value if too large seqcnt = @sent_seqcnts[apid] % ( 2 ** @seqcnt_bit_size -1) # write the APID into the packet BinaryAccessor.write(seqcnt, @seqcnt_bit_offset, @seqcnt_bit_size, :UINT, data, @endianness, :ERROR) return data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(raw_data)\n if @policy_type == :buffer\n if @buffer.size != @buffer_size\n @buffer << raw_data\n end\n elsif @policy_type == :data\n @buffer = [raw_data]\n else\n raise \"port policy #{@policy_type} is not supported by #{self.class}\"\n end\n end", "def write(data)\n # black hole, because we don't actually care about what gets written\n end", "def send_packet(payload); end", "def packet_out(packet)\n packet.from_mac = @mac_address\n Log.puts \"#{@host.name}/#{@name} sending #{packet}\" if @trace\n @out_chan << packet if @out_chan\n end", "def before_write_content(_path, node, data, modified)\n return true unless node.is_a?(ICard)\n\n validate_v_card(data, modified)\n true # Do not break chain\n end", "def record_write bytes\n @reader.record_write bytes, @state\n end", "def _wire_write(sock, data)\n # p [ \"debug_01\", @protocol, @usecrlf ]\n if @protocol >= Stomp::SPL_12 && @usecrlf\n wiredata = \"#{data}#{Stomp::CR}#{Stomp::LF}\"\n # p [ \"wiredataout_01:\", wiredata ]\n sock.write(wiredata)\n else\n # p [ \"wiredataout_02:\", \"#{data}\\n\" ]\n sock.puts data\n end\n end", "def write(chunk)\n # dummy\n end", "def write(data); end", "def write(data); end", "def write(data); end", "def write(data); end", "def put_trans_data(pkt, len: 0, param: '', data: '', noPad: false)\n pkt['Payload'].v['ParamOffset'] = 0\n pkt['Payload'].v['DataOffset'] = 0\n\n # SMB header: 32 bytes\n # WordCount: 1 bytes\n # ByteCount: 2 bytes\n #offset = 32 + 1 + len + 2 #len(pkt['Parameters']) + 2\n len = pkt.to_s.length - 4\n param = param.b\n data = data.b\n offset = len\n\n transData = ''\n if param != ''\n padLen = if noPad then 0 else (4 - offset % 4 ) % 4 end\n pkt['Payload'].v['ParamOffset'] = offset + padLen\n transData = (\"\\x00\" * padLen) + param\n offset += padLen + param.length\n end\n\n if data != ''\n padLen = if noPad then 0 else (4 - offset % 4 ) % 4 end\n pkt['Payload'].v['DataOffset'] = offset + padLen\n transData += (\"\\x00\" * padLen) + data\n end\n\n pkt['Payload'].v['Payload'] = transData\n pkt\n end", "def increment(packet_length); end", "def enqueue_packet(payload); end", "def before_write\n end", "def write(data)\n end", "def update(bytes)\n # Do nothing.\n end", "def record_write bytes, state=nil\n begin\n do_record_write bytes, state\n rescue\n nil\n end\n end", "def write(bytes)\r\n end", "def write_local(buf) \n\t\t\tdlog(\"PassiveX:#{self} Writing #{buf.length} to local side\", 'core', LEV_3)\n\n\t\t\trsock.put(buf)\n\t\tend", "def send_packet(op_code, data)\n if @encoding == :etf\n send_etf_packet(op_code, data)\n else\n send_json_packet(op_code, data)\n end\n end", "def flush\n return @transport.flush unless @write\n\n out = [@wbuf.length].pack('N')\n out << @wbuf\n @transport.write(out)\n @transport.flush\n @wbuf = ''\n end", "def flush\n return @transport.flush unless @write\n\n out = [@wbuf.length].pack('N')\n out << @wbuf\n @transport.write(out)\n @transport.flush\n @wbuf = ''\n end", "def push packet\n begin\n @socket_server.write packet\n rescue Errno::ECONNRESET => e\n p e.message\n close\n reset_connection\n rescue Errno::EPIPE => e\n p e.message\n close\n reset_connection\n rescue Errno::ECONNREFUSED => e\n p e.message\n close\n reset_connection\n end\n end", "def push(packet); end", "def xmit\n if @lag.zero?\n if @to_server\n $fake_server_port.on_packet_receive(CONNECTION_ID, @data, @channel)\n else\n $fake_client_conn.on_packet(@data, @channel)\n end\n true\n else\n @lag -= 1\n false\n end\n end", "def send_packet(data_packet)\n connect if @socket.nil? || @socket.closed?\n\n super\n end", "def flush\n if !@write\n return @transport.flush\n end\n\n out = [@wbuf.length].pack('N')\n out << @wbuf\n @transport.write(out)\n @transport.flush\n @wbuf = ''\n end", "def write\n write_data\n end", "def dissamble_packet(packet)\n packet_bytes = packet.bytes.to_a\n # debugger\n @thermo_address = packet_bytes[0] & 0b01111111\n @host_or_reply = packet_bytes[0][7]\n @message_type = packet_bytes[1] & 0b1111\n @data_length = (packet_bytes[1] & 0b11110000) / 0b10000\n @data = packet[2,@data_length]\n @checksum = packet[packet.length-1]\n @valid = validate_packet(packet)\n end", "def on_writable\n @being_written = nil\n return unless res = responses.first\n if res.finished?\n responses.shift\n if res.last \n FFI::connection_schedule_close(self) \n return\n end\n end \n write\n end", "def write data\n _data[:out].write data\n _data[:out].flush\n end", "def send_extended_data_packet( type, data )\n # overhead is\n # ( byte.length + id.length + type.length + strlen.length ) = 13\n data, data_to_return = split_data_for_packet( data.to_s, 13 )\n @window_size -= data.length\n\n msg = @buffers.writer\n msg.write_byte CHANNEL_EXTENDED_DATA\n msg.write_long @remote_id\n msg.write_long type\n msg.write_string data\n @connection.send_message msg\n\n data_to_return\n end", "def store_field(data)\n @io.write [data.size].pack(\"V\") \n offset = @io.pos\n @io.write data\n @io.write \"\\0\"\n offset \n end", "def blocking_write( data )\r\n raise RuntimeError, \"CONN_UDP: blocking_write: Not connected!\" unless connected?\r\n begin\r\n @sock.send(data, 0)\r\n rescue\r\n destroy_connection\r\n raise RuntimeError, \"CONN_UDP: blocking_write: Couldn't write to socket! (#{$!})\"\r\n end\r\n end", "def perform_write(command)\n @tcp_socket.send(command.to_bytes.pack('C*'), 0)\n end", "def write(buf); end", "def write!\n @dev = File.open(@device, \"w\") if (@dev.nil? || @dev.closed?)\n @dev.write @bytes.pack(\"c*\")\n @dev.flush\n end", "def add_data(packets)\n @buffer.keys.each { |k| @buffer[k].concat extract_packets(packets, k) }\n trim_data\n end", "def packet(pkt)\n super(pkt)\n \n # Only process packets with length right now\n return nil unless pkt.udp_data.length > 0\n \n # Determine the packet's direction (up == src -> dst)\n dir = pkt.src.to_i < pkt.dst.to_i ? :up : :down\n\n # First, identify if this is a new stream or part of one on which we are\n # already keeping state.\n state = identify_state(pkt, :udp, false)\n state.udp_init(pkt, @event_collector) unless state.layer_4\n @protos.parse(pkt.udp_data, state, dir)\n end", "def plug\n return self if plugged?\n verify!\n can_apply? && unsafe_mode_set.Write(data)\n self\n end", "def write!(_)\n raise NotImplementedError, 'Implement #write! in child class'\n end", "def write; end", "def write; end", "def send_raw(data)\n # puts \"Sending data\"\n # puts_data(data)\n write(data)\n end", "def set_data_at(index,raw_data)\n $test_logger.log(\"Set data at location #{index}\")\n @data[index] = BioPacket.swap_dword(raw_data)\n build_cmd\n end", "def packets; end", "def blocking_write( data )\n raise RuntimeError, \"RAWIP: blocking_write: Not connected!\" unless connected?\n begin\n @ssock.send(data, 0, @addr)\n rescue\n destroy_connection\n raise RuntimeError, \"RAWIP: blocking_write: Couldn't write to socket! (#{$!})\"\n end\n end", "def send_data data\n super \"#{data}\\n\"\n Events.dispatch(:raw_out, Message.new(self, data, true))\n\n @lines_sent += 1\n @bytes_sent += data.bytesize + 1\n\n $log.debug(\"IRCConnection.send_data #{@name}\") { data }\n end", "def transmit_packet(packet, options={})\n # Default options\n options = {\n cache: false\n }.merge(options)\n\n packet = packet.as_json.deep_symbolize_keys\n\n if validate_packet(packet, options)\n if options[:cache]==true\n if update_cache(packet)\n transmit packet\n end\n else\n transmit packet\n end\n end\n end", "def report_packet\n self.report('packet_report')\n end", "def write(data)\n begin\n @socket.sync = false\n if data.nil?\n write_timeout([0, 0, @seq].pack(\"CvC\"), @opts[:write_timeout])\n @seq = (@seq + 1) % 256\n else\n data = StringIO.new data if data.is_a? String\n while d = data.read(MAX_PACKET_LENGTH)\n write_timeout([d.length%256, d.length/256, @seq].pack(\"CvC\")+d, @opts[:write_timeout])\n @seq = (@seq + 1) % 256\n end\n end\n @socket.sync = true\n @socket.flush\n rescue Errno::EPIPE\n @socket.close rescue nil\n raise ClientError::ServerGoneError, 'MySQL server has gone away'\n rescue Errno::ETIMEDOUT\n raise ClientError, \"write timeout\"\n end\n end", "def packet(pkt)\n if ((pkt.ip_mf? or pkt.ip_off > 0 ))\n$stderr.puts \"*** Fragmented packet #{@event_collector.pkt_count}\"\n @event_collector.send(:ip_fragmented_packet) do\n { :src_ip => pkt.src, :dst_ip => pkt.dst, :ip_id => pkt.ip_id,\n :ip_proto => pkt.ip_proto, :ip_off => pkt.ip_off,\n :ip_body => pkt.ip_data\n }\n end\n end\n end", "def send_packet( type, data=nil )\n buffer = @buffers.writer\n buffer.write_long( ( data ? data.length : 0 ) + 1 )\n buffer.write_byte type.to_i\n buffer.write data.to_s if data\n @socket.send buffer.to_s, 0\n end", "def unshift_write_buffer data, frame\n @write_mutex.synchronize { @write_buffer.unshift [data, frame] }\n end", "def dio_write_handler( packet, data )\n\n\t\tpeerhost = packet.get_tlv_value( TLV_TYPE_PEER_HOST )\n\t\tpeerport = packet.get_tlv_value( TLV_TYPE_PEER_PORT )\n\n\t\tif( peerhost and peerport )\n\t\t\t@datagrams << [ data, peerhost, peerport ]\n\t\t\treturn true\n\t\tend\n\n\t\treturn false\n\tend", "def write(p0) end", "def flush\n transport.command do |dev|\n interface = \"\"\n portchannel = \"\"\n interface = resource[:interface]\n portchannel = resource[:portchannel]\n resource_reference = resource[:ensure]\n interfaceoperation = resource[:interfaceoperation]\n if portchannel && resource_reference == :absent\n dev.update_portchannel(resource[:name], former_properties, properties, resource[:portchannel], resource[:istrunkforportchannel], resource[:portchanneloperation], resource_reference)\n end\n\n dev.update_vlan(resource[:name], former_properties, properties, resource_reference)\n\n if portchannel && resource_reference == :present\n dev.update_portchannel(resource[:name], former_properties, properties, resource[:portchannel], resource[:istrunkforportchannel], resource[:portchanneloperation], resource_reference)\n end\n end\n super\n end", "def write(p0) end", "def write(p0) end", "def shift_data(buffer,bytes)\n buffer.slice!(0...bytes)\n end", "def write_interface(data)\n\n puts connected?\n write_interface_base(data)\n port = 10 # TC PORT\n\t #Prio SRC DST DP SP RES HXRC\n header = \"%02b%05b%05b%06b%06b00000000\"\n Logger.instance.info(data)\n if data.length > 0\n # Get CSP header and data\n hdr = header % [1, @node.ord, @remote.ord, port, rand(11...64)]\n\n # print(\"con:\", hdr, hex(int(hdr, 2)))\n # print(\"con:\", parse_csp(hex(int(hdr, 2))), data)\n\n # Build CSP message\n hdr_b = hdr.scan(/......../).reverse\n hdr = hdr_b.map { |x| x.to_i(2).chr }\n\n #puts hdr\n # print(\"con:\", hdr_b, [\"{:02x}\".format(int(i, 2)) for i in hdr_b])\n #hdr = bytearray([int(i,2) for i in hdr_b])\n #hdr = hdr_b.join(', ')\n #puts hdr\n #print(\"Node: \", @node.chr, \" Hdr: \", hdr)\n #print(\"Data: \",data)\n\n\n #data_clean=data_cleaner(data)\n msg = [@remote.chr] + hdr + data.split(\"\")\n\n #msg = bytearray([node,]) + hdr + bytearray(data, \"ascii\")\n #print(\"con:\", msg)\n @write_socket.send_string(msg.join)\n\n end\n\n #sleep(0.25)\n end", "def send_data(data)\n logdebug \"send_data:\", :data => data\n attempt_write(data)\n end", "def write(msg)\n\t\t\t\t# object should implement send_data\n\t\t\t\traise \"Abstract method called\"\n\t\t\tend", "def flush\n device.command do |device|\n device.update_vlan(resource[:name], former_properties, properties)\n end\n super\n end", "def prepare!\n @io.seek(@position)\n end", "def open\n @old_packet = XInput.get_state.packet_number\n super\n end", "def read_packet; end", "def like\n n_prop(:pkt).previous_amount = n_prop(:pkt).amount || 0\n n_prop(:pkt).amount = 1\n create\n end", "def request_success(packet); end", "def postprocess\n @position = @position.to_s.rjust(2, '0') if @position.to_s.size == 1\n @size &&= @size.to_i\n @raw = true if @raw == \"true\" unless @raw.is_a?(TrueClass)\n @mounted = (@mounted == \"true\") unless @mounted.is_a?(TrueClass)\n end", "def pending_write?; end", "def added_to_packet(packet)\n return if packet.respond_to? :smb_browser\n\n packet.instance_eval(\"def smb_browser(arg=nil); header(#{self.class}, arg); end\")\n end", "def send_data_packet( data )\n # overhead is ( byte.length + id.length + strlen.length ) = 9\n data, data_to_return = split_data_for_packet( data.to_s, 9 )\n @window_size -= data.length\n\n msg = @buffers.writer\n msg.write_byte CHANNEL_DATA\n msg.write_long @remote_id\n msg.write_string data\n @connection.send_message msg\n\n data_to_return\n end", "def write(file)\n # write the length & header; always write length (int2) as network\n # order (as per GDSII spec)\n file.write [self.byte_size].pack('n')\n file.write [self.type].pack('c')\n file.write [self.data.type].pack('c')\n\n # now write the data...\n @data.write(file)\n end", "def sendData(identKey,srcIP,dstIP,srcPort,dstPort,payload)\n\tudpPacket = udpConstruct(identKey,srcIP,srcPort,$dstIP,dstPort,payload)\n\tudpPacket.to_w # Sent\n\tprint \"Data Sent\\n\"\nend", "def send(packet)\n id = Common.packet_to_id(packet)\n data = [id, [packet.to_a]].to_msgpack\n\n @stream.write Common.encode_u16(data.length)\n @stream.write data\n end", "def save_raw_message\n if @pending_raw_message\n self.size = @pending_raw_message.bytesize\n date = Date.today\n table_name, headers_id, body_id = @database.insert_raw_message(@pending_raw_message, date)\n self.raw_table = table_name\n self.raw_headers_id = headers_id\n self.raw_body_id = body_id\n @raw = nil\n @raw_headers = nil\n @headers = nil\n @mail = nil\n @pending_raw_message = nil\n copy_attributes_from_raw_message\n @database.query(\"UPDATE `#{@database.database_name}`.`raw_message_sizes` SET size = size + #{self.size} WHERE table_name = '#{table_name}'\")\n end\n end", "def packetize_data data\n data = data.chars if data.is_a? String\n data.unshift(0x40.chr).push(0x41.chr)\n end", "def write_data(data)\n \n # need to zero the checksum field in case:\n # its not zero, which would affect the checksum, 0 ^ X = X so zero doesn't affect checksum\n # the checksum has already been set, which would result in zero checksum, X ^ X = 0\n BinaryAccessor.write(0, \n @checksum_byte_offset*8, \n 8, \n :UINT,\n data, \n @endianness, \n :ERROR)\n\n # write the value into the packet\n BinaryAccessor.write(calcChecksum(data), \n @checksum_byte_offset*8, \n 8, \n :UINT,\n data, \n @endianness, \n :ERROR)\n \n return data\n end", "def flush_buffer; self.input_buffer = \"AAAA\"; end", "def handle_packet(packet)\n\t\t\t# Unlike Java, null pointer == won't raise error\n\t\t\tif packet[:Name] == @name\n\t\t\t\tif packet.type == 'ASTA'\n\t\t\t\t\t# Status message\n\t\t\t\t\tlink, value = 0, packet[:Value]\n\t\t\t\t\tbegin\n\t\t\t\t\t\t@joints[link] = value\n\t\t\t\t\t\t# Bizarre but true: how USARPacket encodes duplicate names\n\t\t\t\t\t\tvalue, link = packet[\"Value_#{link}\"], link + 1\n\t\t\t\t\tend while !packet[\"Link_#{link - 1}\"].nil?\n\t\t\t\telsif packet.type == 'CONF' && packet[:Type] == 'Actuator'\n\t\t\t\t\t@conf = @conf || packet.to_h\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def write(*data); end", "def flush\n if @carry_over\n @contents['info']['pieces'] << Digest::SHA1.digest( @carry_over )\n end\n unless @contents['creation date']\n @contents['creation date'] = Time.now.tv_sec\n end\n @io << @contents.bencode\n @io.flush\n self\n end", "def exploit\n connect\n\n # send plain payload\n buf = payload.encoded\n\n #print_status(\"payload space #{payload_space()}...\")\n print_status(\"payload len #{payload.encoded.length}...\")\n print_status(\"total buf len #{buf.length}...\")\n# print_status(\"Trying target #{target.name}...\")\n\n sock.put(buf)\n\n #cleanup\n handler\n disconnect\n end", "def push_write_data(new_bytes = nil)\n @write_thread ||= Thread.current\n if @write_thread != Thread.current\n raise InternalError,\n \"cross-thread access to droby channel: \"\\\n \"from #{@write_thread} to #{Thread.current}\"\n end\n\n @write_buffer.concat(new_bytes) if new_bytes\n written_bytes = io.syswrite(@write_buffer)\n\n @write_buffer = @write_buffer[written_bytes..-1]\n !@write_buffer.empty?\n rescue Errno::EWOULDBLOCK, Errno::EAGAIN\n if @write_buffer.size > max_write_buffer_size\n raise ComError,\n \"droby_channel reached an internal buffer size of \"\\\n \"#{@write_buffer.size}, which is bigger than the limit \"\\\n \"of #{max_write_buffer_size}, bailing out\"\n end\n rescue SystemCallError, IOError\n raise ComError, \"broken communication channel\"\n rescue RuntimeError => e\n # Workaround what seems to be a Ruby bug ...\n if e.message =~ /can.t modify frozen IOError/\n raise ComError, \"broken communication channel\"\n else\n raise\n end\n end", "def send_data p_data\n dump_object(p_data,@lifeline)\n end", "def write\n end", "def send_packet(type, *args); end", "def flush\n\t\t\t\tsyswrite(@write_buffer)\n\t\t\t\t@write_buffer.clear\n\t\t\tend", "def modify_raw(data, decrypted)\n data.sub(/\\+OK \\S+(\\s+\\S+)?/, decrypted)\n end", "def swithOverwrite buffer\n @frames[buffer].switchOverWrite\n end", "def update(value)\n if encrypted?(value)\n Logger.error \"Encrypted bytes from wii device!\"\n raise \"Encrypted bytes from wii device!\"\n end\n\n @data = parse(value)\n end", "def write(data)\n @handle.writeData(data)\n end", "def write(new_contents)\n @unwritten_contents = new_contents\n\n true\n end", "def preprocess_and_save\n process_attrs_before_write(self)\n return self.save()\n end", "def new_line!(number)\n if @preprocessor.line_first\n @packet.send_packet\n @packet.add_line(number.to_i)\n else\n @packet.add_line(number.to_i)\n @packet.send_packet\n end\nend", "def preprocess_and_save\n process_attrs_before_write(self)\n return self.save()\n end", "def write_tag\n file.seek(tag_start, IO::SEEK_SET)\n file.write(raw)\n file.truncate(file.pos)\n @has_tag = true\n end" ]
[ "0.619774", "0.6054573", "0.6039514", "0.59551907", "0.5947687", "0.5823226", "0.5686183", "0.5646165", "0.5637054", "0.5637054", "0.5637054", "0.5637054", "0.5636197", "0.5576441", "0.5562384", "0.5519975", "0.55039036", "0.54982615", "0.5491344", "0.5489904", "0.548493", "0.54757035", "0.5464626", "0.5464626", "0.5450516", "0.54468113", "0.54461527", "0.5429598", "0.5428677", "0.5404644", "0.5399194", "0.5374183", "0.5370573", "0.5360063", "0.5359445", "0.5357408", "0.5348401", "0.53218037", "0.53018755", "0.52920765", "0.5278889", "0.5278556", "0.52665764", "0.524016", "0.524016", "0.5239582", "0.5236835", "0.52342004", "0.52309716", "0.522243", "0.52036864", "0.51841587", "0.5170378", "0.5166569", "0.51631755", "0.5160557", "0.51505274", "0.51375145", "0.51371205", "0.5136266", "0.5136266", "0.5130855", "0.51258785", "0.5123769", "0.5123624", "0.51208365", "0.51189566", "0.5118811", "0.50890905", "0.50748026", "0.507144", "0.50666505", "0.50616217", "0.50598985", "0.5049472", "0.504891", "0.50453925", "0.504325", "0.5041493", "0.50368327", "0.50367874", "0.5034588", "0.503439", "0.50343287", "0.5015591", "0.50077385", "0.50066113", "0.49962598", "0.49938706", "0.4991729", "0.49856496", "0.49803582", "0.49780375", "0.497522", "0.49655837", "0.49641168", "0.49593982", "0.4958683", "0.49579173", "0.49568868" ]
0.49908224
90
GET /Embeddable/open_responses/1 GET /Embeddable/open_responses/1.xml
def show @open_response = Embeddable::OpenResponse.find(params[:id]) if request.xhr? render :partial => 'show', :locals => { :open_response => @open_response } else respond_to do |format| format.html # show.html.haml format.jnlp { render :partial => 'shared/installer', :locals => { :runnable => @open_response } } format.config { render :partial => 'shared/show', :locals => { :runnable => @open_response, :session_id => (params[:session] || request.env["rack.session.options"][:id]) } } format.xml { render :xml => @open_response } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @user_openids = UserOpenid.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @user_openids }\n end\n end", "def show\n @response = Response.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @response }\n end\n end", "def index\n @responses = @survey.responses.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @responses }\n end\n end", "def to_xml\n response\n end", "def show\n @responses = Response.find(params[:id])\n respond_with @response\n end", "def show\n @odc_i = OdcI.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @odc_i }\n end\n end", "def show\n @openmapa = Openmapa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @openmapa }\n end\n end", "def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end", "def generate_response_xml\n builder = Builder::XmlMarkup.new\n builder.instruct!\n\n builder.imsx_POXEnvelopeResponse(\"xmlns\" => \"http://www.imsglobal.org/services/ltiv1p1/xsd/imsoms_v1p0\") do |env|\n env.imsx_POXHeader do |header|\n header.imsx_POXResponseHeaderInfo do |info|\n info.imsx_version \"V1.0\"\n info.imsx_messageIdentifier @message_identifier || IMS::LTI::generate_identifier\n info.imsx_statusInfo do |status|\n status.imsx_codeMajor @code_major\n status.imsx_severity @severity\n status.imsx_description @description\n status.imsx_messageRefIdentifier @message_ref_identifier\n status.imsx_operationRefIdentifier @operation\n end\n end\n end #/header\n env.imsx_POXBody do |body|\n unless unsupported?\n if @operation == OutcomeRequest::READ_REQUEST\n body.tag!(@operation + 'Response') do |request|\n request.result do |res|\n res.resultScore do |res_score|\n res_score.language \"en\" # 'en' represents the format of the number\n res_score.textString @score.to_s\n end\n end #/result\n end\n else\n body.tag!(@operation + 'Response')\n end #/operationResponse\n end\n end #/body\n end\n end", "def show\n @oyoyo = Oyoyo.find(params[:id])\n\n respond_to do |s|\n s.html # show.html.erb\n s.xml { render :xml => @oyoyo }\n end\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @response }\n end\n end", "def show\n @opml_metadata = OpmlMetadata.find(params[:id])\n @OPML = @opml_metadata.db_file.data\n\n respond_to do |format|\n format.html # show.html.erb\n #format.opml { render :opml => @OPML }\n format.xml { render :xml => @OPML }\n end\n end", "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 @offlearn = Offlearn.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @offlearn }\n end\n end", "def ocsp_response\n @ocsp_response ||= if (ocsp_response = @node.at('ocspStapling/ocspResponse'))\n OCSPResponse.new(ocsp_response)\n end\n end", "def responses\n @proposal = current_user.proposals.find(params[:id])\n @responses = @proposal.responses\n\n respond_to do |format|\n format.html # responses.html.erb\n format.xml { render :xml => @responses }\n end\n end", "def opensearch\n respond_to do |format|\n format.xml do\n render :layout => false\n end\n format.json do\n render :json => get_opensearch_response\n end\n end\n end", "def create\n @open_response = Embeddable::OpenResponse.new(params[:open_response])\n cancel = params[:commit] == \"Cancel\"\n if request.xhr?\n if cancel\n redirect_to :index\n elsif @open_response.save\n render :partial => 'new', :locals => { :open_response => @open_response }\n else\n render :xml => @open_response.errors, :status => :unprocessable_entity\n end\n else\n\n respond_to do |format|\n if @open_response.save\n flash[:notice] = 'Embeddable::OpenResponse.was successfully created.'\n format.html { redirect_to(@open_response) }\n format.xml { render :xml => @open_response, :status => :created, :location => @open_response }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @open_response.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @my_badge }\n end\n end", "def show\n @interaction = Interaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @interaction.to_xml }\n end\n end", "def response_xml\r\n @sess.DoRequests(@request_set).ToXMLString\r\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 show\n @replay = Replay.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :text => @replay.xml }\n end\n end", "def update\n cancel = params[:commit] == \"Cancel\"\n @open_response = Embeddable::OpenResponse.find(params[:id])\n if request.xhr?\n if cancel || @open_response.update_attributes(params[:embeddable_open_response])\n render :partial => 'show', :locals => { :open_response => @open_response }\n else\n render :xml => @open_response.errors, :status => :unprocessable_entity\n end\n else\n respond_to do |format|\n if @open_response.update_attributes(params[:embeddable_open_response])\n flash[:notice] = 'Embeddable::OpenResponse.was successfully updated.'\n format.html { redirect_to(@open_response) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @open_response.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def show\n @player = Player.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @player.to_xml(:include => :titles) }\n end\n end", "def show\n @status = @object\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @status.to_xml(:include => convert_includes(includes),\n :dasherize => false) }\n end\n end", "def show\n @socioeconomic_ocupation = SocioeconomicOcupation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @socioeconomic_ocupation }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @helppage }\n end\n end", "def opensearch\n respond_to do |format|\n format.xml do\n render :layout => false\n end\n format.json do\n render :json => get_opensearch_response\n end\n end\n end", "def show\n @user_openid = UserOpenid.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user_openid }\n end\n end", "def index\n \t @responses = Response.all\n end", "def index\n @junction_embeds = JunctionEmbed.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @junction_embeds }\n end\n end", "def show\n @patient_encounter = PatientEncounter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @patient_encounter }\n end\n end", "def show\n @envelope = Envelope.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @envelope }\n end\n end", "def show\n @respuestum = Respuestum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @respuestum }\n end\n end", "def destroy\n @open_response = Embeddable::OpenResponse.find(params[:id])\n respond_to do |format|\n format.html { redirect_to(open_responses_url) }\n format.xml { head :ok }\n format.js\n end\n # TODO: We should move this logic into the model!\n @open_response.page_elements.each do |pe|\n pe.destroy\n end\n @open_response.destroy\n\n end", "def show\n respond_to do |format|\n format.xml { }\n format.html { render 'show' }\n end\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 show\n @appointment_request = AppointmentRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @appointment_request }\n end\n end", "def fetch_opendap_urls\n ous_response = fetch_ous_response(params)\n\n # TODO: Render errors after OUS is moved to CMR and supports error responses\n render json: ous_response.fetch('items', []), layout: false\n end", "def show\n\n active_doc = site_account.api_docs_services.published.find_by_id_or_system_name! params[:id]\n\n json = if active_doc.specification.swagger_2_0?\n active_doc.specification.as_json\n else\n ThreeScale::Swagger::Translator.translate! active_doc.body\n end\n\n respond_with json\n end", "def api_xml(path,method=:get,options={})\n xml_message(amee,\"/data\"+path,method,options)\n end", "def show\n @junction_embed = JunctionEmbed.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @junction_embed }\n end\n end", "def show\n @encounter_event = EncounterEvent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @encounter_event }\n end\n end", "def show\n @response = Response.new\n @responses = @ticket.responses\n end", "def show\n @ocupation = Ocupation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ocupation }\n end\n end", "def show\n @page_id = \"opinions\"\n @opinion = Opinion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @opinion }\n end\n end", "def index\n @help_offers = @job_request.help_offers\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @help_offers }\n end\n end", "def show\n @olark = Olark.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @olark }\n end\n end", "def show\n respond_with Official.find(params[:id])\n end", "def index\n @responses = Response.all\n end", "def index\n @responses = Response.all\n end", "def index\n @responses = Response.all\n end", "def index\n @responses = Response.all\n end", "def index\n @responses = Response.all\n end", "def render_opensearch_response_metadata\n render :partial => 'catalog/opensearch_response_metadata'\n end", "def show\n @corporate_health_package_child = CorporateHealthPackageChild.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @corporate_health_package_child }\n end\n end", "def show\n @response = Response.find(params[:id])\n\n respond_with(@response)\n end", "def show\n @po = Po.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @po }\n end\n end", "def show\n @add_on = AddOn.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @add_on }\n end\n end", "def show\n respond_with DisGenericMonograph.find(params[:id])\n end", "def show\n @encounter_enemy = EncounterEnemy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @encounter_enemy }\n end\n end", "def show\n @payable_action = PayableAction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @payable_action }\n end\n end", "def show\n @encounter_reason = EncounterReason.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @encounter_reason }\n end\n end", "def show\r\n @evaluation = Evaluation.find(params[:id])\r\n @responses = Response.find_all_by_Evaluation_id params[:id]\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @evaluation }\r\n end\r\n end", "def show\n @available_off = AvailableOff.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @available_off }\n end\n end", "def show\n @plays_on = PlaysOn.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @plays_on }\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 @req_breakdown = ReqBreakdown.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @req_breakdown }\n end\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @issued }\n end\n end", "def show\n @encounter_type = EncounterType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @encounter_type }\n end\n end", "def show\n @oa_sent_document = Oa::SentDocument.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @oa_sent_document }\n end\n end", "def show\n @Roc = Roc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @Roc }\n end\n end", "def show\n @league_item = LeagueItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @league_item }\n end\n end", "def show\n @outfit_pair = OutfitPair.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @outfit_pair }\n end\n end", "def show\n @outdoor = Outdoor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @outdoor }\n end\n end", "def resource_details\n @encounter = Encounter.find(params[:id])\n\t#render :layout => \"layouts/popup\"\n respond_to do |format|\n format.html # writeup.html.erb\n format.xml { render :xml => @encounter }\n end\n end", "def to_xml\n http.body\n end", "def show\n @documentation = Documentation.find(params[:id])\n @documentations = Documentation.find(:all)\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @documentation }\n end\n end", "def show\n @oligo_order = OligoOrder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @oligo_order }\n end\n end", "def show\n @library_objective = LibraryObjective.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @library_objective }\n end\n end", "def show\n @click_to_talk = ClickToTalk.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @click_to_talk }\n end\n end", "def show\n clear_checkid_request\n\n respond_to do |format|\n format.html do\n if openid_request.is_a?(OpenID::Server::CheckIDRequest)\n handle_checkid_request\n elsif openid_request\n handle_non_checkid_request\n else\n render text: t('openid.this_is_openid_not_a_human_ressource')\n end\n end\n\n format.xrds\n end\n end", "def show\n @lr70 = Lr70.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lr70 }\n end\n end", "def show\n @inquiry = Inquiry.find(params[:id])\n\n respond_to do |format|\n format.html { render 'show'}\n format.xml { render :xml => @inquiry }\n end\n end", "def show\n respond_with DisIndication.find(params[:id])\n end", "def to_xml\n @object.marshal_dump.to_xml(:root => :response)\n end", "def response\n\t\t@response\n\tend", "def disp_xml_rq\n body= File.open(\"public/OTA/OTA_HotelAvailRQ100.xml\").read\n render :xml => body\n end", "def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html\n format.xml {render :xml => @question}\n end\n end", "def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html\n format.xml {render :xml => @question}\n end\n end", "def show\n @help_offer = HelpOffer.find(params[:id])\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @help_offer }\n end\n end", "def list\n @oyoyos = Oyoyo.find (:all)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @oyoyo }\n end\n \nend", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @chronopay_link }\n end\n end", "def index\n @requests = Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @requests }\n end\n end", "def dummy_data_fuse_response_xml\n path=\"#{Rails.root}/test/data_fuse_example.xml\"\n File.open(path, \"rb\").read\n end", "def show\n @intelligence = Intelligence.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @intelligence }\n end\n end", "def show\n @poem = Poem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @poem }\n end\n end", "def show\n @poem = Poem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @poem }\n end\n end", "def index\n @patient_encounters = PatientEncounter.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @patient_encounters }\n end\n end" ]
[ "0.608897", "0.6075171", "0.5915318", "0.5871443", "0.5867999", "0.5866636", "0.5804312", "0.5762687", "0.5761617", "0.5742818", "0.5735696", "0.5703224", "0.56950384", "0.5685316", "0.56615794", "0.5660818", "0.56452525", "0.5633318", "0.56174076", "0.5613713", "0.560558", "0.5596931", "0.5595059", "0.5572436", "0.55523443", "0.5515572", "0.5512243", "0.5512186", "0.55058914", "0.55011576", "0.54976964", "0.5496269", "0.54945", "0.5478516", "0.5476958", "0.5469068", "0.546278", "0.54596144", "0.5450416", "0.544911", "0.54479825", "0.54472363", "0.54472023", "0.54443955", "0.5440131", "0.54392046", "0.54390097", "0.54323155", "0.5429328", "0.54067755", "0.54041314", "0.54041314", "0.54041314", "0.54041314", "0.54041314", "0.5402", "0.53943866", "0.5393978", "0.53895956", "0.53879976", "0.5387434", "0.538699", "0.538183", "0.53761005", "0.537556", "0.5373148", "0.53708977", "0.5367766", "0.536605", "0.53603387", "0.5355784", "0.5351982", "0.53496397", "0.5339523", "0.53310704", "0.5324664", "0.53241664", "0.5321873", "0.5321852", "0.53195894", "0.5316671", "0.5316218", "0.53156024", "0.53084105", "0.53059393", "0.53050685", "0.5304491", "0.5302235", "0.5301434", "0.529972", "0.529972", "0.5294264", "0.52926874", "0.528992", "0.5287834", "0.5285751", "0.5281496", "0.52777094", "0.52777094", "0.5277629" ]
0.6319006
0
GET /Embeddable/open_responses/new GET /Embeddable/open_responses/new.xml
def new @open_response = Embeddable::OpenResponse.new if request.xhr? render :partial => 'remote_form', :locals => { :open_response => @open_response } else respond_to do |format| format.html { render :partial=>'open_response', :locals => { :open_response => @open_response }, :layout=>false } format.xml { render :xml => @open_response } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @resp = Response.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resp }\n end\n end", "def new\n @response = Response.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @response }\n end\n end", "def new\n @opml_metadata = OpmlMetadata.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @opml_metadata }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ontology }\n end\n end", "def new\n @response = Response.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @response }\n end\n end", "def new\n @omatsuri = Omatsuri.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @omatsuri }\n end\n end", "def create\n @open_response = Embeddable::OpenResponse.new(params[:open_response])\n cancel = params[:commit] == \"Cancel\"\n if request.xhr?\n if cancel\n redirect_to :index\n elsif @open_response.save\n render :partial => 'new', :locals => { :open_response => @open_response }\n else\n render :xml => @open_response.errors, :status => :unprocessable_entity\n end\n else\n\n respond_to do |format|\n if @open_response.save\n flash[:notice] = 'Embeddable::OpenResponse.was successfully created.'\n format.html { redirect_to(@open_response) }\n format.xml { render :xml => @open_response, :status => :created, :location => @open_response }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @open_response.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def new\n @openmapa = Openmapa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @openmapa }\n end\n end", "def new\n @add_on = AddOn.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @add_on }\n end\n end", "def new\n @odc_i = OdcI.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @odc_i }\n end\n end", "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 @click_to_talk = ClickToTalk.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @click_to_talk }\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 @po = Po.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @po }\n end\n end", "def new\n @definition = Definition.new\n\n respond_to do |wants|\n wants.html # new.html.erb\n wants.xml { render :xml => @definition }\n end\n end", "def new\n @olark = Olark.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @olark }\n end\n end", "def new_rest\n @question_localized = QuestionLocalized.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @question_localized }\n end\n end", "def new\n @appointment_request = AppointmentRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @appointment_request }\n end\n end", "def new \n @how_to = HowTo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @how_to }\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 respond_to do |format|\n format.html\n format.xml\n end\n end", "def new\n @howto = Howto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @howto }\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 @encounter_type = EncounterType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @encounter_type }\n end\n end", "def new_rest\n @answer_localized = AnswerLocalized.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @answer_localized }\n end\n end", "def new\n @Roc = Roc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @Roc }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @chronopay_link }\n end\n end", "def new\n @reqinfo = Reqinfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @reqinfo }\n end\n end", "def new\n @user_openid = UserOpenid.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user_openid }\n end\n end", "def new_rest\n @entry_instrument = EntryInstrument.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry_instrument }\n end\n end", "def new\n @req_breakdown = ReqBreakdown.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @req_breakdown }\n end\n end", "def new\n @os_type = OsType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @os_type }\n end\n end", "def new\n @document = Document.new\n\n respond_to do |wants|\n wants.html # new.html.erb\n wants.xml { render :xml => @document }\n end\n end", "def new\n @page_id = \"opinions\"\n @opinion = Opinion.new\n @agents = Agent.all.collect {|item| [ item.name, item.id ]}\n @services = Service.find(:all).collect {|item| [ item.name, item.id ]}\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @opinion }\n end\n end", "def new\n @documentation = Documentation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @documentation }\n end\n end", "def new\n @offlearn = Offlearn.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @offlearn }\n end\n end", "def new\n @replay = Replay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @replay }\n end\n end", "def new\n @page = Page.new\n\n respond_to do |wants|\n wants.html # new.html.erb\n wants.xml { render :xml => @page }\n end\n end", "def new\n @poi_type = PoiType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @poi_type }\n end\n end", "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end", "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end", "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end", "def new\n @lookup_pettracer = LookupPettracer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_pettracer }\n end\n end", "def new\n @lookup_pettracer = LookupPettracer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_pettracer }\n end\n end", "def new\n @hack_tag_follow = HackTagFollow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @hack_tag_follow }\n end\n end", "def new\n @payable_action = PayableAction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @payable_action }\n end\n end", "def new\n @encounter_reason = EncounterReason.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @encounter_reason }\n end\n end", "def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resource }\n end\n end", "def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resource }\n end\n end", "def new\n @quest_template = QuestTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @quest_template }\n end\n end", "def new\n @openingstockentrymaster = Openingstockentrymaster.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @openingstockentrymaster }\n end\n end", "def new\n @request = Request.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end", "def new\n @envelope = Envelope.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @envelope }\n end\n end", "def new_rest\n @entry_answer = EntryAnswer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry_answer }\n end\n end", "def new\n @echo = Echo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @echo }\n end\n end", "def new\n @noun = Noun.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @noun }\n end\n end", "def new\n @question = @keyword.question_sheet.elements.new\n\n respond_to do |wants|\n wants.html # new.html.erb\n wants.xml { render :xml => @question }\n end\n end", "def new\n @protocol = Protocol.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @protocol }\n end\n end", "def new\n @thing = Thing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thing }\n end\n end", "def new\n @specification = Specification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @specification }\n end\n end", "def new\n @plays_on = PlaysOn.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @plays_on }\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 @incident = Incident.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @incident }\n end\n end", "def new\n @incident = Incident.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @incident }\n end\n end", "def new\n @resource = Resource.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resource }\n end\n end", "def new\n @response_format = ResponseFormat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @response_format }\n end\n end", "def new\n @poem = Poem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @poem }\n end\n end", "def new\n @poem = Poem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @poem }\n end\n end", "def new\n @gene_ontology = GeneOntology.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @gene_ontology }\n end\n end", "def new\n @monkey = Monkey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @monkey }\n end\n end", "def new\n @incident = Incident.new\n \n @title = \"New Incident\" \n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @incident }\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 @issued = Issued.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @issued }\n end\n end", "def new\n @junction_embed = JunctionEmbed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @junction_embed }\n end\n end", "def new\n @want = Want.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @want }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @infraction_type }\n end\n end", "def new\n @quest = Quest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @quest }\n end\n end", "def new\n @what_custom = WhatCustom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @what_custom }\n end\n end", "def new\n respond_to do |format|\n\t\t\tformat.html # new.html.erb\n format.xml { render :xml => @interface }\n end\n end", "def new\n @resolved = Resolved.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resolved }\n end\n end", "def new\n @outdoor = Outdoor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @outdoor }\n end\n end", "def new\n @counterparty = Counterparty.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @counterparty }\n end\n end", "def new\n respond_to do |format|\n format.html { render :layout => 'application' }\n format.xml { render :xml => @recommand }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @game }\n end\n end", "def new\n @quirk = Quirk.new()\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @quirk }\n end\n end", "def new\n @lookup_eligibilityoutcome = LookupEligibilityoutcome.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_eligibilityoutcome }\n end\n end", "def new\n @api = Api.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @api }\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 @document_status = DocumentStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @document_status }\n end\n end", "def new\n @available_off = AvailableOff.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @available_off }\n end\n end", "def new\n @lookup_set = LookupSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_set }\n end\n end", "def new\n @event = IndrelEvent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @event }\n end\n end", "def new\n @exposure = Exposure.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @exposure }\n end\n end", "def new\n @ref = Ref.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ref }\n end\n end", "def new\n @association = Association.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @association }\n end\n end", "def new\n @lr70 = Lr70.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lr70 }\n end\n end", "def new\n @presentation = Presentation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @presentation }\n end\n end", "def new\n @housing = Housing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @housing }\n end\n end", "def new\n @chirp = Chirp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @chirp }\n end\n end", "def new\n @published_document = PublishedDocument.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @published_document }\n end\n end" ]
[ "0.69099444", "0.6806349", "0.67905694", "0.6755162", "0.6711176", "0.6635485", "0.6586161", "0.65834004", "0.6541293", "0.65114963", "0.6486276", "0.6478211", "0.64716774", "0.646312", "0.644731", "0.6441864", "0.6438742", "0.6414927", "0.6414438", "0.6409791", "0.6392238", "0.63778377", "0.6376967", "0.63768077", "0.63754463", "0.6357639", "0.635342", "0.63517547", "0.6318263", "0.63015074", "0.6293993", "0.62896675", "0.62863606", "0.62785965", "0.62773114", "0.6276261", "0.6275785", "0.6272237", "0.6265415", "0.6264783", "0.6264783", "0.6264783", "0.6260509", "0.6260154", "0.6253043", "0.62491584", "0.62433547", "0.62432927", "0.62432927", "0.6231534", "0.6230921", "0.6229097", "0.62282515", "0.6223745", "0.622373", "0.6221388", "0.6220848", "0.6217974", "0.6217744", "0.6215431", "0.6213517", "0.62128675", "0.6212459", "0.6212459", "0.620472", "0.6204127", "0.6200186", "0.6200186", "0.6198078", "0.6191944", "0.61892134", "0.61872214", "0.61857486", "0.61851346", "0.6181894", "0.6180964", "0.61807007", "0.61755204", "0.6174066", "0.6173689", "0.61726946", "0.61725044", "0.61716855", "0.6168184", "0.61639595", "0.6153328", "0.61527956", "0.6150654", "0.61481756", "0.6143435", "0.61416686", "0.6141216", "0.6138767", "0.6133102", "0.6131619", "0.613143", "0.61293346", "0.61292726", "0.6126287", "0.6122672" ]
0.634024
28
POST /Embeddable/open_responses POST /Embeddable/open_responses.xml
def create @open_response = Embeddable::OpenResponse.new(params[:open_response]) cancel = params[:commit] == "Cancel" if request.xhr? if cancel redirect_to :index elsif @open_response.save render :partial => 'new', :locals => { :open_response => @open_response } else render :xml => @open_response.errors, :status => :unprocessable_entity end else respond_to do |format| if @open_response.save flash[:notice] = 'Embeddable::OpenResponse.was successfully created.' format.html { redirect_to(@open_response) } format.xml { render :xml => @open_response, :status => :created, :location => @open_response } else format.html { render :action => "new" } format.xml { render :xml => @open_response.errors, :status => :unprocessable_entity } end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @open_response = Embeddable::OpenResponse.find(params[:id])\n respond_to do |format|\n format.html { redirect_to(open_responses_url) }\n format.xml { head :ok }\n format.js\n end\n # TODO: We should move this logic into the model!\n @open_response.page_elements.each do |pe|\n pe.destroy\n end\n @open_response.destroy\n\n end", "def ocsp_response\n @ocsp_response ||= if (ocsp_response = @node.at('ocspStapling/ocspResponse'))\n OCSPResponse.new(ocsp_response)\n end\n end", "def update\n cancel = params[:commit] == \"Cancel\"\n @open_response = Embeddable::OpenResponse.find(params[:id])\n if request.xhr?\n if cancel || @open_response.update_attributes(params[:embeddable_open_response])\n render :partial => 'show', :locals => { :open_response => @open_response }\n else\n render :xml => @open_response.errors, :status => :unprocessable_entity\n end\n else\n respond_to do |format|\n if @open_response.update_attributes(params[:embeddable_open_response])\n flash[:notice] = 'Embeddable::OpenResponse.was successfully updated.'\n format.html { redirect_to(@open_response) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @open_response.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def generate_response_xml\n builder = Builder::XmlMarkup.new\n builder.instruct!\n\n builder.imsx_POXEnvelopeResponse(\"xmlns\" => \"http://www.imsglobal.org/services/ltiv1p1/xsd/imsoms_v1p0\") do |env|\n env.imsx_POXHeader do |header|\n header.imsx_POXResponseHeaderInfo do |info|\n info.imsx_version \"V1.0\"\n info.imsx_messageIdentifier @message_identifier || IMS::LTI::generate_identifier\n info.imsx_statusInfo do |status|\n status.imsx_codeMajor @code_major\n status.imsx_severity @severity\n status.imsx_description @description\n status.imsx_messageRefIdentifier @message_ref_identifier\n status.imsx_operationRefIdentifier @operation\n end\n end\n end #/header\n env.imsx_POXBody do |body|\n unless unsupported?\n if @operation == OutcomeRequest::READ_REQUEST\n body.tag!(@operation + 'Response') do |request|\n request.result do |res|\n res.resultScore do |res_score|\n res_score.language \"en\" # 'en' represents the format of the number\n res_score.textString @score.to_s\n end\n end #/result\n end\n else\n body.tag!(@operation + 'Response')\n end #/operationResponse\n end\n end #/body\n end\n end", "def responses\n @proposal = current_user.proposals.find(params[:id])\n @responses = @proposal.responses\n\n respond_to do |format|\n format.html # responses.html.erb\n format.xml { render :xml => @responses }\n end\n end", "def new\n @open_response = Embeddable::OpenResponse.new\n if request.xhr?\n render :partial => 'remote_form', :locals => { :open_response => @open_response }\n else\n respond_to do |format|\n format.html { render :partial=>'open_response', :locals => { :open_response => @open_response }, :layout=>false }\n format.xml { render :xml => @open_response }\n end\n end\n end", "def show\n @open_response = Embeddable::OpenResponse.find(params[:id])\n if request.xhr?\n render :partial => 'show', :locals => { :open_response => @open_response }\n else\n respond_to do |format|\n format.html # show.html.haml\n format.jnlp { render :partial => 'shared/installer', :locals => { :runnable => @open_response } }\n format.config { render :partial => 'shared/show', :locals => { :runnable => @open_response, :session_id => (params[:session] || request.env[\"rack.session.options\"][:id]) } }\n format.xml { render :xml => @open_response }\n end\n end\n end", "def open\n respond_to do |format|\n @scrachpad.update_attributes(:is_opened=> true);\n format.json { head :no_content }\n end\n end", "def response(code, example=nil, options={}) #:doc:\n return unless Apipie.active_dsl?\n _apipie_dsl_data[:responses] << [code, example, options]\n end", "def post_save xml, options={:mapping=>:_default}\n # using REXML's element namespace method doesn't seem to set the namespace correctly...?\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\")\n xml.root.add_namespace \"xsi\", \"http://www.w3.org/2001/XMLSchema-instance\"\n xml.root.add_namespace \"xsd\", \"http://www.w3.org/2001/XMLSchema\"\n # for challengeResponses/response\n xml.each_element(\"//response\") do |x|\n x.add_namespace \"v11\", \"http://schema.intuit.com/platform/fdatafeed/challenge/v1\"\n x.name = \"v11:response\"\n end\n # for challengeResponses root\n xml.each_element(\"//challengeResponses\") do |x|\n x.add_namespace \"v1\", \"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\"\n x.name = \"challengeResponses\"\n end\n end", "def post_save xml, options={:mapping=>:_default}\n # using REXML's element namespace method doesn't seem to set the namespace correctly...?\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\")\n xml.root.add_namespace \"xsi\", \"http://www.w3.org/2001/XMLSchema-instance\"\n xml.root.add_namespace \"xsd\", \"http://www.w3.org/2001/XMLSchema\"\n # for challengeResponses/response\n xml.each_element(\"//response\") do |x| \n x.add_namespace \"v11\", \"http://schema.intuit.com/platform/fdatafeed/challenge/v1\"\n x.name = \"v11:response\"\n end\n # for challengeResponses root\n xml.each_element(\"//challengeResponses\") do |x| \n x.add_namespace \"v1\", \"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\"\n x.name = \"challengeResponses\"\n end\n end", "def create\n @response = Response.new(params[:response])\n\n respond_to do |format|\n if @resp.save\n flash[:notice] = 'Response was successfully created.'\n format.html { redirect_to(response_url(@questionnaire, @resp)) }\n format.xml { render :xml => @resp, :status => :created, :location => @resp }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @resp.errors, :status => :unprocessable_entity }\n end\n end\n end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response\n\t\t@response\n\tend", "def index\n @responses = @survey.responses.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @responses }\n end\n end", "def post_outcome_request\n raise IMS::LTI::InvalidLTIConfigError, \"\" unless has_required_attributes?\n\n res = post_service_request(@lis_outcome_service_url,\n 'application/xml',\n generate_request_xml)\n\n @outcome_response = extend_outcome_response(OutcomeResponse.new)\n @outcome_response.process_post_response(res)\n end", "def create\n @response = Response.new(params[:response])\n @response.ip_address = request.remote_ip\n @response.survey_id = @survey.id\n @response.user_id = current_user\n \n for param in params do\n if param[0] =~ /^question_id_/\n # handle all question parameters\n # $' represents the value of the question_id\n if param[1].is_a? Hash\n # Valid keys include country, option, year, month, day and numeric option_id\n if param[1].has_key? \"year\" && \"month\" && \"day\"\n # concat year, month and day into one answer\n @response.answers.build(:question_id => $', :answer => Date.new(param[1][\"year\"].to_i, param[1][\"month\"].to_i, param[1][\"day\"].to_i) )\n elsif param[1].has_key? \"option\"\n # look up option id for radio & select questions and build answer\n option_id = Option.find_by_label_and_question_id(param[1][\"option\"], $').id\n @response.answers.build(:question_id => $', :answer => param[1][\"option\"], :option_id => option_id)\n elsif param[1].has_key? \"country\"\n # build country answer\n @response.answers.build(:question_id => $', :answer => param[1][\"country\"])\n else\n # build checkbox and likert answers\n param[1].each do |key, value|\n @response.answers.build(:question_id => $', :answer => value, :option_id => key) unless value == \"0\"\n end\n end\n else\n # build answer without option ie text, textarea\n @response.answers.build(:question_id => $', :answer => param[1] ) #unless param[1].blank?\n end \n end\n if param[0] == 'token'\n @response.survey.update_invitation(param[1])\n end\n end\n\n respond_to do |format|\n if @response.save!\n flash[:notice] = 'Response was successfully created.'\n format.html { redirect_to([@survey, @response]) }\n format.xml { render :xml => @response, :status => :created, :location => @response }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @response.errors, :status => :unprocessable_entity }\n end\n end\n rescue ActiveRecord::RecordInvalid => invalid\n render :action => \"new\"\n end", "def respond(response)\n @publisher.publish(response)\n end", "def response\n self\n end", "def on_open\n\t\t# response.close\n\t\t# false\n\tend", "def response_xml\r\n @sess.DoRequests(@request_set).ToXMLString\r\n end", "def post_xml_64(xml=:example_response)\n post \"/auth/saml/callback\", {'SAMLResponse' => load_xml_64(xml)}\nend", "def to_xml(xml=Builder::XmlMarkup.new)\n attributes = {'ID' => id, 'Version' => version, 'IssueInstant' => issue_instant.in_time_zone.xmlschema}\n attributes['InResponseTo'] = in_response_to unless in_response_to.nil?\n attributes['Destination'] = destination unless destination.nil?\n attributes['Consent'] = consent unless consent.nil?\n attributes = add_xmlns(attributes)\n xml.tag!('samlp:Response', attributes) {\n xml << issuer.to_xml unless issuer.nil?\n xml << signature.to_xml unless signature.nil?\n # TODO: add extensions support\n xml << status.to_xml unless status.nil?\n assertions.each { |assertion| xml << assertion.to_xml }\n encrypted_assertions.each { |encrypted_assertion| xml << encrypted_assertion.to_xml }\n }\n end", "def show\n @responses = Response.find(params[:id])\n respond_with @response\n end", "def add_response(graph_original, sollutions)\n\t\t\t@responses << ResponseSolution.new(graph_original, sollutions)\t\t\n\t\tend", "def to_xml\n response\n end", "def responses\n question=Question.find(params[:questionId])\n render :json=> question.response\n end", "def embed_action(options) #:doc:\n embedded_logging(options) do\n response = embedded_response(options, true)\n render_for_text(response.body, response.headers[\"Status\"])\n end\n end", "def index\n \t @responses = Response.all\n end", "def update\n @response = Response.find(params[:id])\n\n respond_to do |format|\n if @response.update_attributes(params[:response])\n if @response.run && @response.run.return_url\n # send the data back to the portal\n data = [{\n \"type\" => \"open_response\",\n \"question_id\" => \"1\",\n \"answer\" => params[:response][:answer]\n }]\n bearer_token = 'Bearer %s' % current_user.token\n HTTParty.post(@response.run.return_url, :body => data.to_json, :headers => {\"Authorization\" => bearer_token, \"Content-Type\" => 'application/json'})\n end\n format.html { redirect_to @response, notice: 'Response was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @response.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @response = Response.new\n @responses = @ticket.responses\n end", "def open_response_report\n @portal_learner = Portal::Learner.find(params[:id])\n \n respond_to do |format|\n format.html # report.html.haml\n end\n end", "def create( options )\n\t\t\topt = { :transaction_id => nil, \n\t\t\t\t:in_response_to => nil,\n\t\t\t\t:status => \"urn:oasis:names:tc:SAML:2.0:status:Success\", \n\t\t\t\t:extra_parameters => nil }.merge(options)\n\t\t\treturn nil if opt[:transaction_id].nil?\n\t\t\t@response = REXML::Document.new\n\t\t\t@response.context[:attribute_quote] = :quote\n\t\t\tuuid = \"_\" + UUID.new.generate\n\t\t\ttime = Time.now.utc.strftime(\"%Y-%m-%dT%H:%M:%SZ\")\n\t\t\troot = @response.add_element \"saml2p:LogoutResponse\", { \"xmlns:saml2p\" => PROTOCOL }\n\t\t\troot.attributes['ID'] = uuid\n\t\t\troot.attributes['IssueInstant'] = time\n\t\t\troot.attributes['Version'] = \"2.0\"\n\t\t\t# Just convenient naming to accept both names as InResponseTo\n\t\t\tif opt[:transaction_id] \n\t\t\t\troot.attributes['InResponseTo'] = opt[:transaction_id]\n\t\t\telsif opt[:in_response_to]\n\t\t\t\troot.attributes['InResponseTo'] = opt[:in_response_to]\n\t\t\tend\n\t\t\tif opt[:status]\n\t\t\t\tstatus = root.add_element \"saml2p:Status\"\n\t\t\t\tstatus_code = status.add_element \"saml2p:StatusCode\", {\n\t\t\t\t\t\t\"Value\" => opt[:status]\n\t\t\t\t}\n\t\t\tend\n\t\t\tif @settings && @settings.issuer\n\t\t\t\tissuer = root.add_element \"saml:Issuer\", {\n\t\t\t\t\t\"xmlns:saml\" => \"urn:oasis:names:tc:SAML:2.0:assertion\"\n\t\t\t\t}\n\t\t\t\tissuer.text = @settings.issuer\n\t\t\tend\n\t\t\tmeta = Metadata.new( @settings )\n\t\t\tLogging.debug \"Created LogoutResponse:\\n#{@response}\"\n\t\t\treturn meta.create_slo_response( to_s, opt[:extra_parameters] )\n\t\t\t\n\t\t\t#root.attributes['Destination'] = action\n\t\t\t\n\t\tend", "def response\n self.textual_response\n end", "def create\n @response = Response.new(response_params)\n\n respond_to do |format|\n if @response.save\n format.html { redirect_to survey_responses_path(@survey), notice: 'Thanks for your response!' }\n format.json { render :show, status: :created, location: @response }\n else\n format.html { render :new }\n format.json { render json: @response.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @assessment_olympiad = AssessmentOlympiad.new(params[:assessment_olympiad])\n respond_to do |format|\n if@assessment_olympiad.save\n #if@assessment_olympiad.rb.status == 1\n Content.send_message_to_est(false,current_user,@assessment_olympiad)\n #end\n format.html { redirect_to@assessment_olympiad, notice: 'AssessmentOlympiad was successfully created.' }\n format.json { render json:@assessment_olympiad, status: :created, location:@assessment_olympiad }\n else\n format.html { render action: \"new\" }\n format.json { render json:@assessment_olympiad.errors, status: :unprocessable_entity }\n end\n end\n end", "def build_response(connection, request); end", "def response\n @response\n end", "def response\n @response\n end", "def response\n return launch_response if @echo_request.launch_request?\n return end_session_response if @echo_request.session_ended_request?\n\n ResponseFactory.new(@echo_request, @echo_response).response\n # SessionFactory.new(@echo_request, @echo_response).response\n end", "def index\n @responses = Response.all\n end", "def index\n @responses = Response.all\n end", "def index\n @responses = Response.all\n end", "def index\n @responses = Response.all\n end", "def index\n @responses = Response.all\n end", "def serveOAI\n content_type 'text/xml;charset=utf-8'\n provider = EscholProvider.new\n provider.process_request(params)\n end", "def to_xml\n @object.marshal_dump.to_xml(:root => :response)\n end", "def new\n @openmapa = Openmapa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @openmapa }\n end\n end", "def response\n connection.send(request_method) do |req|\n req.url path\n req.headers['LicenseID'] = client.license_id\n req.headers['Host'] = client.host\n req.headers['Connection'] = 'Keep-Alive'\n req.headers['Expect'] = '100-continue'\n req.headers['Content-Type'] = 'text/xml'\n req.body = body\n end\n end", "def new_response\n {:success => true}\n end", "def render_response\n response.headers['Content-Type'] = 'charset=utf-8'\n @resp = server.encode_response(@resp)\n return render_xml_response if is_xml_request?\n case @resp.code\n when OpenID::Server::HTTP_OK\n render :text => @resp.body, :status => 200\n when OpenID::Server::HTTP_REDIRECT\n redirect_to @resp.redirect_url\n else\n render :text => @resp.body, :status => 400\n end \n end", "def open_response_report\n # PUNDIT_REVIEW_AUTHORIZE\n # PUNDIT_CHOOSE_AUTHORIZE\n # no authorization needed ...\n # authorize Portal::Learner\n # authorize @learner\n # authorize Portal::Learner, :new_or_create?\n # authorize @learner, :update_edit_or_destroy?\n @portal_learner = Portal::Learner.find(params[:id])\n \n respond_to do |format|\n format.html # report.html.haml\n end\n end", "def resource_details\n @encounter = Encounter.find(params[:id])\n\t#render :layout => \"layouts/popup\"\n respond_to do |format|\n format.html # writeup.html.erb\n format.xml { render :xml => @encounter }\n end\n end", "def http_post(request, response)\n path = request.path\n\n # Only handling xml\n content_type = request.header('Content-Type')\n return nil unless content_type.index('application/xml') || content_type.index('text/xml')\n\n # Making sure the node exists\n begin\n node = @server.tree.node_for_path(path)\n rescue Dav::Exception::NotFound\n return nil\n end\n\n request_body = request.body_as_string\n\n # If this request handler could not deal with this POST request, it\n # will return 'null' and other plugins get a chance to handle the\n # request.\n #\n # However, we already requested the full body. This is a problem,\n # because a body can only be read once. This is why we preemptively\n # re-populated the request body with the existing data.\n request.body = request_body\n\n document_type_box = Box.new('')\n message = @server.xml.parse(request_body, request.url, document_type_box)\n document_type = document_type_box.value\n\n case document_type\n # Dealing with the 'share' document, which modified invitees on a\n # calendar.\n when \"{#{Plugin::NS_CALENDARSERVER}}share\"\n # We can only deal with IShareableCalendar objects\n return true unless node.is_a?(IShareableCalendar)\n\n @server.transaction_type = 'post-calendar-share'\n\n # Getting ACL info\n acl = @server.plugin('acl')\n\n # If there's no ACL support, we allow everything\n acl.check_privileges(path, '{DAV:}write') if acl\n\n node.update_shares(message.set, message.remove)\n\n response.status = 200\n # Adding this because sending a response body may cause issues,\n # and I wanted some type of indicator the response was handled.\n response.update_header('X-Sabre-Status', 'everything-went-well')\n\n # Breaking the event chain\n return false\n # The invite-reply document is sent when the user replies to an\n # invitation of a calendar share.\n when \"{#{Plugin::NS_CALENDARSERVER}}invite-reply\"\n\n # This only works on the calendar-home-root node.\n return true unless node.is_a?(CalendarHome)\n\n @server.transaction_type = 'post-invite-reply'\n\n # Getting ACL info\n acl = @server.plugin('acl')\n\n # If there's no ACL support, we allow everything\n acl.check_privileges(path, '{DAV:}write') if acl\n\n url = node.share_reply(\n message.href,\n message.status,\n message.calendar_uri,\n message.in_reply_to,\n message.summary\n )\n\n response.status = 200\n # Adding this because sending a response body may cause issues,\n # and I wanted some type of indicator the response was handled.\n response.update_header('X-Sabre-Status', 'everything-went-well')\n\n if url\n writer = @server.xml.writer\n writer.open_memory\n writer.start_document\n writer.start_element(\"{#{Plugin::NS_CALENDARSERVER}}shared-as\")\n writer.write(Dav::Xml::Property::Href.new(url))\n writer.end_element\n response.update_header('Content-Type', 'application/xml')\n response.body = writer.output_memory\n end\n\n # Breaking the event chain\n return false\n when \"{#{Plugin::NS_CALENDARSERVER}}publish-calendar\"\n # We can only deal with IShareableCalendar objects\n return true unless node.is_a?(IShareableCalendar)\n\n @server.transaction_type = 'post-publish-calendar'\n\n # Getting ACL info\n acl = @server.plugin('acl')\n\n # If there's no ACL support, we allow everything\n acl.check_privileges(path, '{DAV:}write') if acl\n\n node.publish_status = true\n\n # iCloud sends back the 202, so we will too.\n response.status = 202\n\n # Adding this because sending a response body may cause issues,\n # and I wanted some type of indicator the response was handled.\n response.update_header('X-Sabre-Status', 'everything-went-well')\n\n # Breaking the event chain\n return false\n when \"{#{Plugin::NS_CALENDARSERVER}}unpublish-calendar\"\n # We can only deal with IShareableCalendar objects\n return true unless node.is_a?(IShareableCalendar)\n\n @server.transaction_type = 'post-unpublish-calendar'\n\n # Getting ACL info\n acl = @server.plugin('acl')\n\n # If there's no ACL support, we allow everything\n acl.check_privileges(path, '{DAV:}write') if acl\n\n node.publish_status = false\n\n response.status = 200\n\n # Adding this because sending a response body may cause issues,\n # and I wanted some type of indicator the response was handled.\n response.update_header('X-Sabre-Status', 'everything-went-well')\n\n # Breaking the event chain\n return false\n end\n end", "def list_noresponse_paperproof_records\n doc = Hpricot::XML(request.raw_post)\n doc = doc.to_s.gsub(\"&amp;\",\"&\")\n doc = Hpricot::XML(doc)\n @orders = Artwork::ArtworkCrud.list_noresponse_paperproof_records(doc)\n # render :xml=>@orders[0].xmlcol\n render :xml=>'<encoded>'+Base64.encode64(Zlib::Deflate.deflate(@orders[0].xmlcol))+'</encoded>'\n end", "def execute\n @responses = []\n @end_date = end_date\n @end_date = TimeTools.increase_by_duration(start_date, protocol.duration) if @end_date.blank?\n schedule_responses\n # Return at most ten responses\n @responses.sort_by! { |response| response[:open_from] }\n @responses[0...MAX_PREVIEW_RESPONSE_COUNT]\n end", "def oai\n options = params.delete_if { |k,v| %w{controller action}.include?(k) }\n render :text => oai_provider.process_request(options), :content_type => 'text/xml' \n end", "def post\n Salesforce.set_http(session[:accesstoken], session[:accessurl])\n \t@response = Salesforce.create_post(params)\n \trespond_to do |format|\n format.json { render :json => @response.to_json}\n # example of multiple reponses mapped to one object\n # format.json { render :json => {:data => @response, :meta => @describe}.to_json}\n \tend\n end", "def build_result(action)\n xml = ''\n doc = Builder::XmlMarkup.new(:target => xml)\n doc.tag!(\"#{action}Response\", :xmlns => \"http://sdb.amazonaws.com/doc/2007-11-07\") do\n if block_given?\n yield doc\n end\n \n doc.ResponseMetadata do\n doc.RequestId \"1234\"\n doc.BoxUsage \"0\"\n end\n end\n \n xml\n end", "def response_params\n params.require(:response).permit(:user_id, :issue_id, :answer, :timestamp)\n end", "def response\r\n @response\r\n end", "def response_params\n params.require(:response).permit(\n :ip, \n :survey_id, \n :answers_attributes => [\n :id, \n :answer, \n {:resp => []}, \n :survey_id, \n :question_id, \n :response_id, \n :user_id \n ])\n end", "def response; return @response end", "def update\n\n respond_to do |format|\n if @response.update_attributes(params[:response])\n flash[:notice] = 'Response was successfully updated.'\n format.html { redirect_to([@survey, @response]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @response.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n \n respond_to do |format|\n \n if !params[:questions].nil? \n params[:questions].each {\n |q| \n type = Question.find_by_id(q[0]).question_type\n answer = (type == 2 ? Answer.find_by_id(q[1]).correct : nil)\n Response.new( \n {\n \"question_id\" => q[0],\n \"answer_id\" => type == 2 ? q[1] : nil,\n \"text\" => type == 1 ? q[1] : nil,\n \"user_id\" => current_user.id,\n \"question_group_id\" => params[:response][:question_group_id],\n \"correct\" => answer\n }\n ).save\n }\n format.html { redirect_to '/responses', notice: 'Your responses were successfully saved.' }\n else\n @response = Response.new(params[:response])\n if @response.save\n format.html { redirect_to @response, notice: 'Response was successfully created.' }\n format.json { render json: @response, status: :created, location: @response }\n end\n end\n end\n end", "def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/loan/v1\")\n end", "def respond\n end", "def respond(io, action=:DUNNO, message=nil)\n io.print(:'action=', action)\n io.print(:' ', message) if !message.nil?\n 2.times { io.puts }\n log(\"Response #{@request[:instance]} #{@request[:recipient]}: #{action} #{message}\") if $config[:debug]\n end", "def survey_question_response_params\n params.require(:survey_question_response).permit(:observation_id, :survey_question_id, :response)\n end", "def create\n @response = current_user.responses.build(response_params)\n\n respond_to do |format|\n if @response.save\n format.html { redirect_to session.delete(:return_to), notice: 'Response was successfully created.' }\n else\n format.html { redirect_to requests_path, notice: 'Response was not saved.' }\n end\n end\n end", "def response_to(input)\nend", "def new\n @junction_embed = JunctionEmbed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @junction_embed }\n end\n end", "def create_questionnaire_response(data)\n attrs = data.to_h.with_indifferent_access\n response = questionnaire_response_service.create(attrs)\n\n response.tap do |resp|\n if resp.response[:code] == SUCCESS_STATUS\n questionnaire_response.tap do |qr|\n qr.user_uuid = user.uuid\n qr.user_account = user.user_account\n qr.appointment_id = attrs.dig(:appointment, :id)\n qr.questionnaire_response_id = resp.resource.id\n qr.user = user\n qr.questionnaire_response_data = data\n\n qr.save\n end\n end\n end\n end", "def response_params\n params.require(:response).permit(:survey_id,\n :answers_attributes => [:id, :answer, :question_id]\n )\n end", "def create\n @response = Admin::Response.new(params[:admin_response])\n\n respond_to do |format|\n if @response.save\n format.html { redirect_to @response, notice: 'Response was successfully created.' }\n format.json { render json: @response, status: :created, location: @response }\n else\n format.html { render action: \"new\" }\n format.json { render json: @response.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @response = Response.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @response }\n end\n end", "def show\n @submission = Submission.new\n @submission.responses.build\n @response = Response.new\n\n end", "def response\r\n submit.ResponseList.GetAt(0).Detail\r\n end", "def index\n @user_openids = UserOpenid.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @user_openids }\n end\n end", "def responses\n @responses\n end", "def responses\n object.questions.map do |q|\n Embedded::ResponseSerializer.new(q.filtered_responses.first,root: false)\n end\n end", "def response_params\n params.require(:response).permit(:user, :questionnaire_id, answers_attributes: [:id, :content, :question_id])\n end", "def get_response_for(data)\n xander.respond_to(data.text, data.user, data.channel, data.subtype)\n end", "def response_params\n params.require(:response).permit(:subjnum, :dyad, :whichtest, :condition, :date, :photo, :code, :response, :judgement, :coder)\n end", "def build_response(sender, options={}, force=false)\n self.responses.build(response_options(sender, options)) if force || allows_response?(sender)\n end", "def _send_response response_payload, stream\n _write response_payload, stream\n end", "def respond\n DEFAULT_RESPONSE\n end", "def build_response(options={})\n\t\t\n\t\tresponses = []\n\n\t\tone_response = ''\n\n\t\tputs \"sample ids are:\"\n\t\tputs self.sample_ids\n\n\t\treturn responses unless sample_ids\n\n\t\tself.sample_ids.each_with_index {|sid,key|\n\t\t\tputs \"doing sample id: #{sid}\"\n\t\t\t## tests are got from the requisitions hash.\n\t\t\ttests = get_tests(sid)\n\t\t\tputs \"tests are: #{tests}\"\n\t\t\t## default sequence number is 0 (THIS MAY LEAD TO PROBLEMS.)\n\t\t\tsequence_number = \"#{key.to_s}\"\n\n\t\t\t## default patient id:\n\t\t\tpatient_id = \"abcde#{Time.now.to_i.to_s}\"\n\t\t\t\n\t\t\tpatient = Patient.new({:sequence_number => sequence_number, :patient_id => patient_id})\n\t\t\t\n\t\t\torder = Order.new({:sequence_number => patient.sequence_number, :specimen_id => sid, :tests => tests, :priority => \"R\"})\n\n\t\t\tresponses << (patient.build_response(options) + order.build_response(options.merge({sequence_number: self.sequence_number, carrier_number: self.carrier_number, position_number: self.position_number, sample_type: self.sample_type, container_type: self.container_type})))\n\n\t\t}\n\n\t\tputs \"responses are:\"\n\t\tputs responses.to_s\n\n\t\treturn responses\n\t\t\n\tend" ]
[ "0.567167", "0.56690717", "0.5621848", "0.56049716", "0.551115", "0.5444393", "0.5381834", "0.5281441", "0.527088", "0.523555", "0.52156264", "0.5182548", "0.5177007", "0.5177007", "0.5177007", "0.5177007", "0.5177007", "0.5177007", "0.5177007", "0.5177007", "0.5177007", "0.5177007", "0.5177007", "0.5177007", "0.5177007", "0.5173524", "0.5171493", "0.51363605", "0.5121247", "0.51037484", "0.5091803", "0.50860846", "0.5076127", "0.5064288", "0.5052936", "0.5044303", "0.5037837", "0.50313425", "0.5022925", "0.5015494", "0.49949017", "0.49925786", "0.498402", "0.4965363", "0.49460217", "0.4927396", "0.4925131", "0.49227458", "0.49197784", "0.49144143", "0.49144143", "0.49065027", "0.48981848", "0.48981848", "0.48981848", "0.48981848", "0.48981848", "0.4886794", "0.4869815", "0.4868225", "0.48611093", "0.48589244", "0.48480934", "0.48447782", "0.48356378", "0.4831151", "0.48308352", "0.4826474", "0.4825901", "0.48204", "0.48050705", "0.4805022", "0.48034224", "0.48034206", "0.47937617", "0.4788535", "0.47874835", "0.47752333", "0.47742063", "0.47706875", "0.47685587", "0.47652566", "0.47608212", "0.47556722", "0.47544658", "0.4752855", "0.47527495", "0.47524938", "0.47521892", "0.47509864", "0.47496328", "0.47485536", "0.47413504", "0.47403157", "0.4734096", "0.4731094", "0.47304574", "0.47269648", "0.47269303", "0.47218952" ]
0.65215564
0
PUT /Embeddable/open_responses/1 PUT /Embeddable/open_responses/1.xml
def update cancel = params[:commit] == "Cancel" @open_response = Embeddable::OpenResponse.find(params[:id]) if request.xhr? if cancel || @open_response.update_attributes(params[:embeddable_open_response]) render :partial => 'show', :locals => { :open_response => @open_response } else render :xml => @open_response.errors, :status => :unprocessable_entity end else respond_to do |format| if @open_response.update_attributes(params[:embeddable_open_response]) flash[:notice] = 'Embeddable::OpenResponse.was successfully updated.' format.html { redirect_to(@open_response) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @open_response.errors, :status => :unprocessable_entity } end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @open_response = Embeddable::OpenResponse.new(params[:open_response])\n cancel = params[:commit] == \"Cancel\"\n if request.xhr?\n if cancel\n redirect_to :index\n elsif @open_response.save\n render :partial => 'new', :locals => { :open_response => @open_response }\n else\n render :xml => @open_response.errors, :status => :unprocessable_entity\n end\n else\n\n respond_to do |format|\n if @open_response.save\n flash[:notice] = 'Embeddable::OpenResponse.was successfully created.'\n format.html { redirect_to(@open_response) }\n format.xml { render :xml => @open_response, :status => :created, :location => @open_response }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @open_response.errors, :status => :unprocessable_entity }\n end\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 destroy\n @open_response = Embeddable::OpenResponse.find(params[:id])\n respond_to do |format|\n format.html { redirect_to(open_responses_url) }\n format.xml { head :ok }\n format.js\n end\n # TODO: We should move this logic into the model!\n @open_response.page_elements.each do |pe|\n pe.destroy\n end\n @open_response.destroy\n\n end", "def open\n respond_to do |format|\n @scrachpad.update_attributes(:is_opened=> true);\n format.json { head :no_content }\n end\n end", "def update\n\n respond_to do |format|\n if @response.update_attributes(params[:response])\n flash[:notice] = 'Response was successfully updated.'\n format.html { redirect_to([@survey, @response]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @response.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @opml_metadata = OpmlMetadata.find(params[:id])\n\n respond_to do |format|\n if @opml_metadata.update_attributes(params[:opml_metadata])\n flash[:notice] = 'OpmlMetadata was successfully updated.'\n format.html { redirect_to(@opml_metadata) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @opml_metadata.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @simple_responses = args[:simple_responses] if args.key?(:simple_responses)\n end", "def update!(**args)\n @simple_responses = args[:simple_responses] if args.key?(:simple_responses)\n end", "def show\n @open_response = Embeddable::OpenResponse.find(params[:id])\n if request.xhr?\n render :partial => 'show', :locals => { :open_response => @open_response }\n else\n respond_to do |format|\n format.html # show.html.haml\n format.jnlp { render :partial => 'shared/installer', :locals => { :runnable => @open_response } }\n format.config { render :partial => 'shared/show', :locals => { :runnable => @open_response, :session_id => (params[:session] || request.env[\"rack.session.options\"][:id]) } }\n format.xml { render :xml => @open_response }\n end\n end\n end", "def update\n @response = Response.find(params[:id])\n\n respond_to do |format|\n if @response.update_attributes(params[:response])\n format.html { redirect_to(@response, notice: 'Response was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render action: 'edit' }\n format.xml { render xml: @response.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @response = Response.find(params[:id])\n\n respond_to do |format|\n if @response.update_attributes(params[:response])\n if @response.run && @response.run.return_url\n # send the data back to the portal\n data = [{\n \"type\" => \"open_response\",\n \"question_id\" => \"1\",\n \"answer\" => params[:response][:answer]\n }]\n bearer_token = 'Bearer %s' % current_user.token\n HTTParty.post(@response.run.return_url, :body => data.to_json, :headers => {\"Authorization\" => bearer_token, \"Content-Type\" => 'application/json'})\n end\n format.html { redirect_to @response, notice: 'Response was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @response.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit_dimension_opinions_open\n dimension_id = BSON::ObjectID.from_string(params[:id])\n dimension = @current_knowledge.get_dimension_by_id(dimension_id)\n raise \"***** error #{dimension_id.inspect} == #{dimension.inspect}\" unless dimension\n render :update do |page|\n page.replace_html(\"div_dimension_extra_#{dimension.id}\", :partial => \"/knowledges/dimension_opinions\", :locals => { :dimension => dimension })\n end\n end", "def update\n @response = Response.find(params[:id])\n @problem_set = ProblemSet.find(params[:problem_set_id])\n @question = Question.find(params[:question_id])\n\n respond_to do |format|\n if @response.update_attributes(params[:response])\n format.html { redirect_to(@response, :notice => 'Response was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @response.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n # returning connection.put(element_path(prefix_options), to_xml, self.class.headers) do |response|\n returning connection.put(element_path(prefix_options), to_ssj, self.class.headers) do |response|\n load_attributes_from_response(response)\n end\n end", "def test_putpoi_update_valid\n nd = create(:node)\n cs_id = nd.changeset.id\n user = nd.changeset.user\n amf_content \"putpoi\", \"/1\", [\"#{user.email}:test\", cs_id, nd.version, nd.id, nd.lon, nd.lat, nd.tags, nd.visible]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal nd.id, result[2]\n assert_equal nd.id, result[3]\n assert_equal nd.version + 1, result[4]\n\n # Now try to update again, with a different lat/lon, using the updated version number\n lat = nd.lat + 0.1\n lon = nd.lon - 0.1\n amf_content \"putpoi\", \"/2\", [\"#{user.email}:test\", cs_id, nd.version + 1, nd.id, lon, lat, nd.tags, nd.visible]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/2\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal nd.id, result[2]\n assert_equal nd.id, result[3]\n assert_equal nd.version + 2, result[4]\n end", "def update\n respond_to do |format|\n if @ingest_response.update(ingest_response_params)\n format.html { redirect_to @ingest_response, notice: 'Ingest response was successfully updated.' }\n format.json { render :show, status: :ok, location: @ingest_response }\n else\n format.html { render :edit }\n format.json { render json: @ingest_response.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ontology = SYMPH::Ontology.find(params[:id])\n\n respond_to do |format|\n if @ontology.update_attributes(params[:ontology])\n flash[:notice] = 'Ontology was successfully updated.'\n format.html { redirect_to(ontologies_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ontology.errors, :status => :unprocessable_entity }\n end\n end\n\t\n end", "def update\n @open_shoot = OpenShoot.find(params[:id])\n\n respond_to do |format|\n if @open_shoot.update_attributes(params[:open_shoot])\n format.html { redirect_to @open_shoot, notice: 'Open shoot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @open_shoot.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n respond_with(@sicoss_location)\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 respond_with []\n end", "def update\n @openmapa = Openmapa.find(params[:id])\n\n respond_to do |format|\n if @openmapa.update_attributes(params[:openmapa])\n flash[:notice] = 'Openmapa was successfully updated.'\n format.html { redirect_to(@openmapa) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @openmapa.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @master_spec = Master::Spec.find(params[:id])\n\n respond_to do |format|\n if @master_spec.update_attributes(params[:master_spec])\n format.html { redirect_to(@master_spec, :notice => 'Spec was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @master_spec.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @outside_request = OutsideRequest.find(params[:id])\n\n respond_to do |format|\n if @outside_request.update_attributes(params[:outside_request])\n format.html { redirect_to @outside_request, notice: 'Outside request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \\\"edit\\\" }\n format.json { render json: @outside_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @request = Request.find_by_id(params[:request_id])\n @response = @request.responses.find(params[:id])\n respond_to do |format|\n if @response.update_attributes(response_params)\n format.html { redirect_to session.delete(:return_to), notice: 'Response was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end", "def update\n respond_to do |format|\n if @hopen.update(hopen_params)\n format.html { redirect_to @hopen, notice: 'Hopen was successfully updated.' }\n format.json { render :show, status: :ok, location: @hopen }\n else\n format.html { render :edit }\n format.json { render json: @hopen.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @junction_embed = JunctionEmbed.find(params[:id])\n\n respond_to do |format|\n if @junction_embed.update_attributes(params[:junction_embed])\n format.html { redirect_to(@junction_embed, :notice => 'Junction embed was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @junction_embed.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 @envelope = Envelope.find(params[:id])\n\n respond_to do |format|\n if @envelope.update_attributes(params[:envelope])\n flash[:notice] = 'Envelope was successfully updated.'\n format.html { redirect_to(@envelope) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @envelope.errors, :status => :unprocessable_entity }\n end\n end\n end", "def override\n document_id = params[:document_id]\n document = params[:document]\n document_type = params[:document_type]\n ticket = Document.ticket(Alfresco::Document::ALFRESCO_USER, Alfresco::Document::ALFRESCO_PASSWORD)\n\n builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|\n xml.entry(:xmlns => \"http://www.w3.org/2005/Atom\",\n \"xmlns:cmisra\" => \"http://docs.oasis-open.org/ns/cmis/restatom/200908/\",\n \"xmlns:cmis\" => \"http://docs.oasis-open.org/ns/cmis/core/200908/\") {\n xml.title document.original_filename if document\n xml.summary document_type\n if document\n xml.content(:type => document.content_type) {\n xml.text Base64.encode64(document.read)\n }\n end\n }\n end\n\n url = Document::PATH + \"cmis/i/#{document_id}?alf_ticket=\" + ticket\n\n begin\n RestClient.put url, builder.to_xml, {:content_type => 'application/atom+xml;type=entry'}\n rescue => e\n Rails.logger.info \"#\"*50\n Rails.logger.info \"Error updating file\"\n Rails.logger.info e.message\n Rails.logger.info \"#\"*50\n end\n\n redirect_to :controller => 'related_service_requests', :action => 'show', :anchor => 'documents', :service_request_id => params[:friendly_id], :id => params[:ssr_id]\n end", "def update\n respond_to do |wants|\n if @definition.update_attributes(params[:definition])\n flash[:notice] = 'Definition was successfully updated.'\n wants.html { redirect_to(@definition) }\n wants.xml { head :ok }\n else\n wants.html { render :action => \"edit\" }\n wants.xml { render :xml => @definition.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_should_update_link_via_API_XML\r\n get \"/logout\"\r\n put \"/links/1.xml\", :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response 401\r\n end", "def update\n respond_to do |format|\n if @envelope.update_attributes(params[:envelope])\n format.html { redirect_to @envelope, notice: 'Envelope was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @envelope.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 @interaction = Interaction.find(params[:id])\n @opportunity = @interaction.opportunity\n\n respond_to do |format|\n if @interaction.update_attributes(params[:interaction])\n flash[:notice] = 'Interação foi atualizada com sucesso.'\n format.html { redirect_to(@opportunity) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @interaction.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_should_update_invite_via_API_XML\r\n get \"/logout\"\r\n put \"/invites/1.xml\", :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => 'test@email.com',\r\n :user_id => 1 }\r\n assert_response 401\r\n end", "def open\n @job = Job.find(params[:id])\n @job.status = \"open\"\n @job.save\n\n\t\tflash[:notice] = 'Job Proposal is now open.'\n\n respond_to do |format|\n format.html { redirect_to(@job) }\n format.xml { head :ok }\n end\n end", "def render_put\n respond_to do |wants| \n wants.html {render :to_xml => 'PUT.xml.builder', :layout => false, :status => 200}\n wants.json {render :to_json => 'PUT.xml.builder', :status => 200}\n wants.xml {render :to_xml => 'PUT.xml.builder', :layout => false, :status => 200}\n wants.yaml {render :to_yaml => 'PUT.xml.builder', :status => 200}\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 @open_hour.update(open_hour_params)\n format.html { redirect_to [:admin, @open_hour], notice: 'Open hour was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @open_hour.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 @add_on = AddOn.find(params[:id])\n\n respond_to do |format|\n if @add_on.update_attributes(params[:add_on])\n format.html { redirect_to(@add_on, :notice => 'Add on was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @add_on.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_rest\n @question_localized = QuestionLocalized.find(params[:id])\n\n respond_to do |format|\n if @question_localized.update_attributes(params[:question_localized])\n flash[:notice] = 'QuestionLocalized was successfully updated.'\n format.html { redirect_to(@question_localized) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question_localized.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n @event.update(status: \"Pending\")\n else\n @reopen = true\n format.json { render json: @event.errors, status: :unprocessable_entity }\n format.html { render :show }\n end\n end\n end", "def update\n respond_to do |format|\n if @solexame.update(solexame_params)\n flash[:notice] = 'Solicitação foi alterada com sucesso.'\n format.html { redirect_to(@solexame) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @solexame.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put_xml(obj = nil, status = 200, append_response = false)\n @performed_render = true\n \n obj.set_pretty_print(true)\n text = obj.to_xml\n \n response.content_type = 'text/xml'\n response.status = status\n \n if append_response\n response.body ||= ''\n response.body << text.to_s\n else\n response.body = case text\n when Proc then text\n when nil then \" \" # Safari doesn't pass the headers of the return if the response is zero length\n else \n text.to_s\n end\n end\n end", "def update\n @inquiry = Inquiry.find(params[:id])\n\n respond_to do |format|\n if @inquiry.update_attributes(params[:inquiry])\n format.html { redirect_to(@inquiry, :notice => 'Inquiry was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @inquiry.errors, :status => :unprocessable_entity }\n end\n end\n end", "def open_api_spec\r\n OpenAPISpecController.instance\r\n end", "def create_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}\")\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.path)\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 end", "def update\n @response = Admin::Response.find(params[:id])\n\n respond_to do |format|\n if @response.update_attributes(params[:admin_response])\n format.html { redirect_to @response, notice: 'Response was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @response.errors, status: :unprocessable_entity }\n end\n end\n end", "def mark_close\n respond_to do |format|\n if @ticket.update({status: Ticket::STATUS[:closed]})\n format.html { redirect_to @ticket, notice: 'Ticket was successfully marked as close.' }\n format.json { render json: {status: :ok}, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @response.update(response_params)\n format.html { redirect_to survey_response_path(params[:survey_id], @response.id), notice: 'Response was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @response.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 ocsp_response\n @ocsp_response ||= if (ocsp_response = @node.at('ocspStapling/ocspResponse'))\n OCSPResponse.new(ocsp_response)\n end\n end", "def save\n @client.patch(@endpoint, :content=>@changed)\n return nil\n end", "def update\n @definition = Definition.find(params[:id])\n @definition.update_attributes(params[:definition])\n respond_with @definition\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 test_put_invoices_1_xml\n @parameters = {:invoice => {:number => 'NewNumber'}}\n \n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/invoices/1.xml',\n {:invoice => {:number => 'NewNumber'}},\n {:success_code => :ok})\n \n assert_no_difference('Invoice.count') do\n put '/invoices/1.xml', @parameters, credentials('admin')\n end\n \n invoice = Invoice.find(1)\n assert_equal \"NewNumber\", invoice.number\n \n end", "def update\n\n respond_to do |format|\n format.all { render_501 }\n end\n end", "def update\n @doc = Doc.find(params[:id])\n \n respond_to do |format|\n if @doc.update_attributes(params[:doc])\n save_object_relationship\n format.html { redirect_to(@doc, :notice => 'Doc was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @doc.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @response = Response.find(params[:id])\n\n respond_to do |format|\n if @response.update_attributes(params[:response])\n format.html { redirect_to @response, notice: 'Response was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @response.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @openrec = Openrec.find(params[:id])\n respond_to do |format|\n if @openrec.update(openrec_params)\n format.html { redirect_to openrec_path(@openrec), notice: '更新に成功しました。' }\n format.json { render :show, status: :ok, location: @openrec }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @openrec.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @inv_x_ref = InvXRef.find(params[:id])\n\n respond_to do |format|\n if @inv_x_ref.update_attributes(params[:inv_x_ref])\n format.html { redirect_to @inv_x_ref, notice: 'Inv x ref was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inv_x_ref.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_rest\n @answer_localized = AnswerLocalized.find(params[:id])\n\n respond_to do |format|\n if @answer_localized.update_attributes(params[:answer_localized])\n flash[:notice] = 'AnswerLocalized was successfully updated.'\n format.html { redirect_to(@answer_localized) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @answer_localized.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @server_rack = ServerRack.find(params[:id])\n\n respond_to do |format|\n if @server_rack.update_attributes(params[:server_rack])\n format.html { redirect_to(@server_rack, :notice => 'Server rack was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @server_rack.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @oyoyo = Oyoyo.find(params[:id])\n\n respond_to do |format|\n if @oyoyo.update_attributes(params[:oyoyo])\n flash[:notice] = 'Oyoyo was successfully updated.'\n format.html { redirect_to(@oyoyo) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @oyoyo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @q_response = QResponse.find(params[:id])\n\n respond_to do |format|\n if @q_response.update_attributes(params[:q_response])\n format.html { redirect_to @q_response, notice: 'Q response was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @q_response.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @close_type = CloseType.find(params[:id])\n\n respond_to do |format|\n if @close_type.update_attributes(params[:close_type])\n format.html { redirect_to @close_type, notice: 'Close type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @close_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @incident = Incident.find(params[:id])\n\n respond_to do |format|\n if @incident.update_attributes(params[:incident])\n format.html { redirect_to(@incident) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @incident.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\r\n @survey_response = SurveyResponse.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @survey_response.update_attributes(params[:survey_response])\r\n format.html { redirect_to @survey_response, notice: 'Survey response 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: @survey_response.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @oid_model.update(oid_model_params)\n format.html { redirect_to @oid_model, notice: 'Oid model was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @oid_model.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(close_offering_request_id, options)\n end_point_url = 'https://sandbox.fundamerica.com/api/test_mode/close_offering_requests/' + close_offering_request_id\n API::request(:patch, end_point_url, options)\n end", "def update\n @opinion = Opinion.find(params[:id])\n\n respond_to do |format|\n if @opinion.update_attributes(params[:opinion])\n format.html { redirect_to(@opinion, :notice => 'Opinion was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @opinion.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |wants|\n if @question.update_attributes(params[:question])\n flash[:notice] = 'Question was successfully updated.'\n wants.html { redirect_to(@question) }\n wants.xml { head :ok }\n else\n wants.html { render :action => \"edit\" }\n wants.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @response.update(response_params)\n format.html { redirect_to @response, notice: 'Response was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @response.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @response.update(response_params)\n format.html { redirect_to @response, notice: 'Response was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @response.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @app.update(app_params)\n format.html { redirect_to apps_path, notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @app }\n else\n format.html { render :edit }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n\n Services::OpenIdConnectionService.new(@app).update \n end", "def update\n respond_to do |format|\n if @has_ocupation.update(has_ocupation_params)\n format.html { redirect_to @has_ocupation, notice: 'Has ocupation was successfully updated.' }\n format.json { render :show, status: :ok, location: @has_ocupation }\n else\n format.html { render :edit }\n format.json { render json: @has_ocupation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |wants|\n if @document.update_attributes(params[:document])\n flash[:notice] = 'Document was successfully updated.'\n wants.html { redirect_to(@document) }\n wants.xml { head :ok }\n else\n wants.html { render :action => \"edit\" }\n wants.xml { render :xml => @document.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @question_response = QuestionResponse.find(params[:id])\n\n respond_to do |format|\n if @question_response.update_attributes(params[:question_response])\n format.html { redirect_to @question_response, notice: 'Question response was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question_response.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @response.update(response_params)\n format.html { redirect_to @response }\n format.json { render :show, status: :ok, location: @response }\n else\n format.html { render :edit }\n format.json { render json: @response.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n begin\n send(rest_xact_handler) do\n @target.attributes = @request_resource\n @target.save!\n end\n rescue ActiveRecord::UnknownAttributeError => e\n # Ugly heuristic, but didn't find anything better\n field_name = $1 if e.message =~ /unknown attribute: (.*)/\n raise BadRequest.new(e.message,\n :per_field_msgs => { field_name => 'Is not defined' },\n :retry_possible => false)\n rescue ActiveRecord::RecordInvalid => e\n raise UnprocessableEntity.new(e.message,\n :per_field_msgs => target.errors.inject({}) { |h, (k, v)| h[k] = v; h },\n :retry_possible => false)\n rescue ActiveRecord::RecordNotSaved => e\n raise UnprocessableEntity.new(e.message,\n :retry_possible => false)\n end\n\n if is_true?(params[:_suppress_response])\n render :nothing => true\n else\n find_target\n respond_with(@target) do |format|\n yield(format) if block_given?\n end\n end\n end", "def update\n respond_to do |format|\n if @osm.update(osm_params)\n format.html { redirect_to @osm, notice: 'Osm was successfully updated.' }\n format.json { render :show, status: :ok, location: @osm }\n else\n format.html { render :edit }\n format.json { render json: @osm.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @office.update(office_params)\n head :no_content\n end", "def update\n respond_to do |format|\n if @socio_spc.update(socio_spc_params)\n format.html { redirect_to @socio_spc, notice: 'Socio spc was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @socio_spc.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n super\n response.status = :unprocessable_entity if resource&.errors&.any?\n end", "def update\n @poi_type = PoiType.find(params[:id])\n\n respond_to do |format|\n if @poi_type.update_attributes(params[:poi_type])\n format.html { redirect_to(@poi_type, :notice => 'Poi type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @poi_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @opening_skill.update(opening_skill_params)\n format.html { redirect_to @opening_skill, notice: 'Opening skill was successfully updated.' }\n format.json { render :show, status: :ok, location: @opening_skill }\n else\n format.html { render :edit }\n format.json { render json: @opening_skill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @xaction = Xaction.find(params[:id])\n\n respond_to do |format|\n if @xaction.update_attributes(params[:xaction])\n format.html { redirect_to @xaction, notice: 'Xaction was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @xaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @odc_i = OdcI.find(params[:id])\n\n respond_to do |format|\n if @odc_i.update_attributes(params[:odc_i])\n format.html { redirect_to(@odc_i, :notice => 'Odc i was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @odc_i.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\n @documentable = @document.documentable\n\n respond_to do |format|\n if @document.update(document_params)\n notify_user(:notice, 'Document was successfully updated.')\n format.html { redirect_to get_resource_url(@documentable) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @responses = Response.find(params[:id])\n respond_with @response\n end", "def update\n @openingstockentrymaster = Openingstockentrymaster.find(params[:id])\n\n respond_to do |format|\n if @openingstockentrymaster.update_attributes(params[:openingstockentrymaster])\n format.html { redirect_to(@openingstockentrymaster, :notice => 'Openingstockentrymaster was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @openingstockentrymaster.errors, :status => :unprocessable_entity }\n end\n end\n end", "def embed_action(options) #:doc:\n embedded_logging(options) do\n response = embedded_response(options, true)\n render_for_text(response.body, response.headers[\"Status\"])\n end\n end", "def update\n # actions\n path = URI(@endpoint).path\n action = URI(@req.request_uri).path.sub(path, '').split('/')\n action -= ['']\n if action.include?('_history')\n @actions = [action[0], '_history']\n else\n @actions = [action[0]]\n end\n\n # search param\n req_query = URI(@req.request_uri).query\n unless req_query.nil?\n @req_params = URI::decode_www_form(req_query).to_h\n end\n\n # requst method\n if @req.request_method == \"GET\" and @actions.include? '_history'\n @req_method = 'vread'\n elsif @req.request_method == \"GET\" and @req_params != nil\n @req_method = 'search-type'\n elsif @req.request_method == \"PUT\"\n @req_method = 'update'\n elsif @req.request_method == \"POST\"\n @req_method = 'create'\n else\n @req_method = 'read'\n end\n\n # interaction\n int1 = Interaction.last type: @actions[0], code: @req_method\n if int1.nil?\n @present = 0\n else\n @present = int1.id\n @intCode = int1.valueCode\n end\n end", "def update\n @appointment_request = AppointmentRequest.find(params[:id])\n\n respond_to do |format|\n if @appointment_request.update_attributes(params[:appointment_request])\n flash[:notice] = 'AppointmentRequest was successfully updated.'\n format.html { redirect_to(@appointment_request) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @appointment_request.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @user_openids = UserOpenid.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @user_openids }\n end\n end", "def show\n\n active_doc = site_account.api_docs_services.published.find_by_id_or_system_name! params[:id]\n\n json = if active_doc.specification.swagger_2_0?\n active_doc.specification.as_json\n else\n ThreeScale::Swagger::Translator.translate! active_doc.body\n end\n\n respond_with json\n end", "def after_update_response(success)\n respond_to do |format|\n if success\n flash[:notice] = t('muck.services.oai_endpoint_successfully_updated')\n format.html { redirect_to oai_endpoint_path(@oai_endpoint) }\n format.xml { head :ok }\n else\n format.html { render :template => \"oai_endpoints/edit\" }\n format.xml { render :xml => @oai_endpoint.errors.to_xml }\n end\n end\n end", "def update\n update_resource_response(@headline, headline_params)\n end" ]
[ "0.57641286", "0.5665278", "0.55735976", "0.55076814", "0.5501253", "0.54921687", "0.5480575", "0.54805607", "0.5436062", "0.53067553", "0.5296444", "0.52292", "0.52272546", "0.5188145", "0.5163034", "0.5149911", "0.5143354", "0.5141434", "0.5137631", "0.5130713", "0.51269764", "0.5123012", "0.51220804", "0.51112235", "0.51093227", "0.5108964", "0.5097021", "0.5078301", "0.5078196", "0.5072102", "0.5056507", "0.50546247", "0.5037711", "0.5031753", "0.50288343", "0.5025685", "0.5024499", "0.50235903", "0.50159967", "0.50129545", "0.50078106", "0.5006755", "0.4996355", "0.49952215", "0.4986722", "0.49853194", "0.49768475", "0.49762255", "0.49758542", "0.49719402", "0.49714538", "0.49711245", "0.49688417", "0.49649626", "0.49610028", "0.4941054", "0.4940686", "0.493084", "0.4916052", "0.49098906", "0.49055296", "0.4904187", "0.490345", "0.48987556", "0.48974675", "0.48965177", "0.4894109", "0.4892326", "0.48851842", "0.48844242", "0.4883745", "0.48819107", "0.48800984", "0.48730215", "0.48711786", "0.48711786", "0.48704326", "0.48645392", "0.48559487", "0.48548433", "0.48539227", "0.48534414", "0.4851167", "0.4846956", "0.48449165", "0.48431274", "0.4839655", "0.48389885", "0.4832504", "0.48244485", "0.48140335", "0.48126608", "0.4811938", "0.48102134", "0.48093003", "0.48075733", "0.4807441", "0.48033795", "0.48019946", "0.47903293" ]
0.65986556
0
DELETE /Embeddable/open_responses/1 DELETE /Embeddable/open_responses/1.xml
def destroy @open_response = Embeddable::OpenResponse.find(params[:id]) respond_to do |format| format.html { redirect_to(open_responses_url) } format.xml { head :ok } format.js end # TODO: We should move this logic into the model! @open_response.page_elements.each do |pe| pe.destroy end @open_response.destroy end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\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 destroy\n @response = Response.find(params[:id])\n @response.destroy\n\n respond_to do |format|\n format.html { redirect_to(responses_url) }\n format.xml { head :ok }\n end\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 response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n @opml_metadata = OpmlMetadata.find(params[:id])\n @opml_metadata.destroy\n\n respond_to do |format|\n format.html { redirect_to(opml_metadatas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @response.destroy\n\n respond_to do |format|\n format.html { redirect_to(survey_responses_url(@survey)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @absence_request = AbsenceRequest.find(params[:id])\n @absence_request.destroy\n\n respond_to do |format|\n format.html { redirect_to(absence_requests_url) }\n format.xml { head :ok }\n end\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 @definition.destroy\n\n respond_to do |wants|\n wants.html { redirect_to(:back) }\n wants.xml { head :ok }\n end\n end", "def destroy\n @appointment_request = AppointmentRequest.find(params[:id])\n @appointment_request.destroy\n\n respond_to do |format|\n format.html { redirect_to(appointment_requests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @oa_sent_document = Oa::SentDocument.find(params[:id])\n @oa_sent_document.destroy\n\n respond_to do |format|\n format.html { redirect_to oa_sent_documents_url }\n format.json { head :ok }\n end\n end", "def destroy\n @envelope = Envelope.find(params[:id])\n @envelope.destroy\n\n respond_to do |format|\n format.html { redirect_to(envelopes_url) }\n format.xml { head :ok }\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 delete\n client.delete(\"/#{id}\")\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 @resp.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.xml { head :ok }\n end\n end", "def destroy\n @openmapa = Openmapa.find(params[:id])\n @openmapa.destroy\n\n respond_to do |format|\n format.html { redirect_to(openmapas_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 @verb.destroy\n\n head :no_content\n end", "def destroy\n @xml_sample = XmlSample.find(params[:id])\n @xml_sample.destroy\n\n respond_to do |format|\n format.html { redirect_to xml_samples_url }\n format.xml do\n xml = {msg: \"complete\", status: \"OK\"}.to_xml\n return render xml: xml\n end\n end\n end", "def destroy\n client = Connection::MarkLogic.new.client\n client.send_corona_request(\"/v1/documents?uri=/amandments/amandment_#{@amandment.id}.xml\", :delete)\n @amandment.destroy\n respond_to do |format|\n format.html { redirect_to home_meeting_path, notice: 'Amandman was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reqinfo = Reqinfo.find(params[:id])\n @reqinfo.destroy\n\n respond_to do |format|\n format.html { redirect_to(reqinfos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @respuestum.destroy\n\n respond_to do |format|\n format.html { redirect_to(:back) }\n format.xml { head :ok }\n end\n end", "def destroy\n @correspondence = Correspondence.find(params[:id])\n @correspondence.destroy\n\n respond_to do |format|\n format.html { redirect_to(correspondences_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @request = Request.find(params[:id])\n @request_items = @request.request_items\n @request_items.each do |ri|\n ri.destroy\n end\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to(requests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @odc_i = OdcI.find(params[:id])\n @odc_i.destroy\n\n respond_to do |format|\n format.html { redirect_to(odc_is_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n openrec = Openrec.find(params[:id])\n openrec.destroy\n respond_to do |format|\n format.html { redirect_to openrecs_path(@openrec), notice: '削除に成功しました。' }\n format.json { head :no_content }\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 destroy\n @odc_r = OdcR.find(params[:id])\n @odc_r.destroy\n\n respond_to do |format|\n format.html { redirect_to(odc_rs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @envelope.destroy\n\n respond_to do |format|\n format.html { redirect_to :root }\n format.json { head :ok }\n end\n end", "def destroy\n @omatsuri = Omatsuri.find(params[:id])\n @omatsuri.destroy\n\n respond_to do |format|\n format.html { redirect_to(omatsuris_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @quirk = Quirk.accessible_by(current_ability).find(params[:id])\n @quirk.destroy\n\n respond_to do |format|\n format.html { redirect_to(quirks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @Roc = Roc.find(params[:id])\n @Roc.destroy\n\n respond_to do |format|\n format.html { redirect_to(Rocs_url) }\n format.xml { head :ok }\n end\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "def destroy\n @inv_x_ref = InvXRef.find(params[:id])\n @inv_x_ref.destroy\n\n respond_to do |format|\n format.html { redirect_to inv_x_refs_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def destroy\n @payable_action = PayableAction.find(params[:id])\n @payable_action.destroy\n\n respond_to do |format|\n format.html { redirect_to(payable_actions_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 @inquiry = Inquiry.find(params[:id])\n @inquiry.destroy\n\n respond_to do |format|\n format.html { redirect_to(inquiries_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @inquiry = Inquiry.find(params[:id])\n @inquiry.destroy\n\n respond_to do |format|\n format.html { redirect_to(inquiries_url) }\n format.xml { head :ok }\n end\n end", "def delete\n request(:delete)\n end", "def delete\n ruta = \"/actions/#{action_id}\"\n client.delete(ruta)\n end", "def destroy\n @lob.destroy\n\n head :no_content\n end", "def destroy\n @response = Admin::Response.find(params[:id])\n @response.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_responses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @add_on = AddOn.find(params[:id])\n @add_on.destroy\n\n respond_to do |format|\n format.html { redirect_to(add_ons_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 @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 official = Official.find(params[:id])\n official.destroy\n head 204\n end", "def destroy\n @upload_file = UploadFile.find(params[:id])\n doc_no=@upload_file.doc_no\n @upload_file.destroy\n\n respond_to do |format|\n format.html { redirect_to upload_files_url(:doc_no=>doc_no) }\n format.xml { head :ok }\n end\n end", "def destroy\n @aplicacion = Aplicacion.find(params[:id])\n @aplicacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(aplicacions_url) }\n format.xml { head :ok }\n end\n end", "def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end", "def deleteRequest\n\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def destroy\n @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 @aspect = Aspect.find(params[:id])\n @aspect.destroy\n\n respond_to do |format|\n format.html { redirect_to(aspects_url) }\n format.xml { head :ok }\n end\n end", "def delete\n @client.delete_document(@path)\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 @xaction = Xaction.find(params[:id])\n @xaction.destroy\n\n respond_to do |format|\n format.html { redirect_to xactions_url }\n format.json { head :no_content }\n end\n end", "def delete; rest_delete(link('self')); end", "def delete; rest_delete(link('self')); end", "def destroy_rest\n @question_localized = QuestionLocalized.find(params[:id])\n @question_localized.destroy\n\n respond_to do |format|\n format.html { redirect_to(question_localizeds_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @qx = Qx.find(params[:id])\n @qx.destroy\n\n respond_to do |format|\n format.html { redirect_to(qxes_url) }\n format.xml { head :ok }\n end\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 destroy\n @gstr_advance_receipts = GstrAdvanceReceipt.find_by_id_and_company_id(params[:id], @company.id)\n @gstr_advance_receipts.delete_gstr_one_entry \n @gstr_advance_receipts.delete\n respond_to do |format|\n @gstr_advance_receipts.register_delete_action(request.remote_ip, @current_user, 'deleted')\n format.html { redirect_to(gstr_advance_receipts_url, :notice =>\"Gstr Advance Receipt has been succesfully deleted\") }\n format.xml {head :ok}\n \n end\n end", "def destroy\n @alfresco = Alfresco.find(params[:id])\n @alfresco.destroy\n\n respond_to do |format|\n format.html { redirect_to(alfrescos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @server_rack = ServerRack.find(params[:id])\n @server_rack.destroy\n\n respond_to do |format|\n format.html { redirect_to(server_racks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to(requests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to(requests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to(requests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @documentation = Documentation.find(params[:id])\n @documentation.destroy\n\n respond_to do |format|\n format.html { redirect_to(documentations_url) }\n format.xml { head :ok }\n end\n end", "def destroy_rest\n @answer_localized = AnswerLocalized.find(params[:id])\n @answer_localized.destroy\n\n respond_to do |format|\n format.html { redirect_to(answer_localizeds_url) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @ph_specified = PhSpecified.find(params[:id])\r\n @ph_specified.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(ph_specifieds_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def destroy\n @document.destroy\n\n respond_to do |wants|\n wants.html { redirect_to(documents_url) }\n wants.xml { head :ok }\n end\n end", "def destroy\n @documento = Documento.find(params[:id])\n @documento.destroy\n\n respond_to do |format|\n format.html { redirect_to(documentos_url) }\n format.xml { head :ok }\n end\n end", "def delete\n Iterable.request(conf, base_path).delete\n end", "def deletepublish\n @question = Publishquiz.find(:all, :conditions=>\"question_id=\"+params[:question]+\" and quiz_id=\"+session[:quizid])\n @question[0].destroy\n\n respond_to do |format|\n format.html { redirect_to(questions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @responsavel.destroy\n\n head :no_content\n end", "def destroy\n @junction_embed = JunctionEmbed.find(params[:id])\n @junction_embed.destroy\n\n respond_to do |format|\n format.html { redirect_to(junction_embeds_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @genbank_file.destroy\n\n respond_to do |format|\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def destroy_rest\n @entry_instrument = EntryInstrument.find(params[:id])\n @entry_instrument.destroy\n\n respond_to do |format|\n format.html { redirect_to(entry_instruments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @service_request = ServiceRequest.find(params[:id])\n @service_request.destroy\n\n respond_to do |format|\n format.html { redirect_to(service_requests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @replay = Replay.find(params[:id])\n @replay.destroy\n\n respond_to do |format|\n format.html { redirect_to(replays_url) }\n format.xml { head :ok }\n end\n end", "def delete(slide)\n # ./_rels/presentation.xml.rels\n # Update Relationship ids\n # Insert a new one slideRef\n @doc.edit_xml @doc.presentation.rels.path do |xml|\n # Calucate the next id\n # next_id = xml.xpath('//xmlns:Relationship[@Id]').map{ |n| n['Id'] }.sort.last.succ\n # TODO - Figure out how to make this more MS idiomatic up 9->10 instead of incrementing\n # the character....\n # Insert that into the slide and crakc open the presentation.xml file\n\n target = slide.path.relative_path_from(@doc.presentation.path.dirname)\n relationship = xml.at_xpath(\"/xmlns:Relationships/xmlns:Relationship[@Type='#{Slide::REL_TYPE}' and @Target='#{target}']\")\n # ./presentation.xml\n # Update attr\n # p:notesMasterId\n # Insert attr\n # p:sldId, increment, etc.\n @doc.edit_xml '/ppt/presentation.xml' do |xml|\n xml.at_xpath(\"/p:presentation/p:sldIdLst/p:sldId[@r:id='#{relationship['Id']}']\").remove\n end\n relationship.remove\n end\n\n # Delete slide link and slideNotes link from ./[Content-Types].xml \n @doc.edit_xml @doc.content_types.path do |xml|\n xml.at_xpath(\"/xmlns:Types/xmlns:Override[@ContentType='#{Slide::CONTENT_TYPE}' and @PartName='#{slide.path}']\").remove\n xml.at_xpath(\"/xmlns:Types/xmlns:Override[@ContentType='#{Notes::CONTENT_TYPE}' and @PartName='#{slide.notes.path}']\").remove\n end\n\n # Update ./ppt\n # !!! DESTROY !!!\n # ./slides\n # Delete files\n # ./_rels/notesSlide(\\d+).xml.rels\n @doc.delete slide.notes.rels.path\n # ./notesSlide(\\d+).xml file\n @doc.delete slide.notes.path\n # ./_rels/slide(\\d+).xml.rels\n @doc.delete slide.rels.path\n # ./slide(\\d+).xml file\n @doc.delete slide.path\n # ./notesSlides\n # Delete files\n\n # Hooray! We're done! Ummm, what should we return though? can't be the slide since\n # its destroyed and there's no practical way to keep it around in memory.\n end", "def destroy\r\n @survey_response = SurveyResponse.find(params[:id])\r\n @survey_response.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to survey_responses_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @expectation_stem = RiGse::ExpectationStem.find(params[:id])\n @expectation_stem.destroy\n\n respond_to do |format|\n format.html { redirect_to(expectation_stems_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n#status_url(Status.find_by_survey_id(protocol.access_code)\n #@p = ResponseSet.where(:user_id => current_user)\n #@protocol = user_id.find_by_survey_id(protocol.access_code)\n #@p = ResponseSet.where(:question_id => @title_questions).first.string_value\n p= ResponseSet.where(:access_code => params[:id])\n p.first.destroy\n \n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "def destroy\n @normal_example = NormalExample.find(params[:id])\n @normal_example.destroy\n\n respond_to do |format|\n format.html { redirect_to(normal_examples_url) }\n format.xml { head :ok }\n end\n end", "def destroy \n @promotion = Promotion.find(params[:id])\n @client_id = @promotion.client.id\n @promotion.destroy\n\n respond_to do |format|\n format.html { redirect_to(promotions_url(:client_id => @client_id)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @oyoyo = Oyoyo.find(params[:id])\n @oyoyo.destroy\n\n respond_to do |format|\n format.html { redirect_to(oyoyos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ocupation = Ocupation.find(params[:id])\n @ocupation.destroy\n\n respond_to do |format|\n format.html { redirect_to(ocupations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @helocagree = Helocagree.find(params[:id])\n @helocagree.destroy\n\n respond_to do |format|\n format.html { redirect_to(helocagrees_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @problem_set = ProblemSet.find(params[:problem_set_id])\n @question = Question.find(params[:question_id])\n @response = Response.find(params[:id])\n @response.destroy\n\n respond_to do |format|\n format.html { redirect_to(problem_set_question_responses_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @expectation = RiGse::Expectation.find(params[:id])\n @expectation.destroy\n\n respond_to do |format|\n format.html { redirect_to(expectations_url) }\n format.xml { head :ok }\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" ]
[ "0.7012579", "0.6651561", "0.65560836", "0.65465456", "0.65258634", "0.65165734", "0.6482845", "0.6429739", "0.6411512", "0.63764036", "0.6356658", "0.63456875", "0.6345088", "0.6328726", "0.63209045", "0.63144433", "0.62959623", "0.62645596", "0.6258221", "0.6238944", "0.6237601", "0.62275934", "0.62260336", "0.62207115", "0.621223", "0.61998177", "0.619865", "0.6196467", "0.6195435", "0.61881894", "0.6170252", "0.6167264", "0.6167263", "0.61664546", "0.616524", "0.616524", "0.616524", "0.616524", "0.61602706", "0.6158738", "0.6157057", "0.6156604", "0.6134764", "0.61230487", "0.61230487", "0.61160207", "0.6114058", "0.6107972", "0.6107563", "0.6102345", "0.6098226", "0.6098226", "0.60944825", "0.6093803", "0.60911345", "0.60908335", "0.6090304", "0.6088841", "0.6088841", "0.60881466", "0.60832196", "0.6081653", "0.6080549", "0.60788304", "0.60781944", "0.60781944", "0.6071582", "0.60711473", "0.6069859", "0.6069606", "0.60615724", "0.60614413", "0.6061105", "0.6061105", "0.6061105", "0.605932", "0.6046376", "0.604602", "0.60407615", "0.6039448", "0.60378236", "0.6035683", "0.60305375", "0.602734", "0.6026866", "0.6025025", "0.6024279", "0.6023261", "0.60230726", "0.60230494", "0.6022558", "0.60208404", "0.60207945", "0.60198927", "0.60180515", "0.60156596", "0.60155416", "0.6015535", "0.6015133", "0.60140806" ]
0.7056803
0
This method is not available in has_secure_token
def invalidate_token update_columns(token: '') touch(:token_created_at) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def token_secret; end", "def token_secret; end", "def token_secret; end", "def verify_authenticity_token; end", "def assign_secure_token\n self.secure_token = SecureRandom.hex\n end", "def request_authenticity_tokens; end", "def any_authenticity_token_valid?; end", "def secure_token token=nil\n generated = Crypt.sha1(request.ip)\n return generated == token if token\n generated\n end", "def valid_authenticity_token?(session, encoded_masked_token); end", "def token\n authenticated\n end", "def token(request)\n end", "def token_secret\n config_method_not_implemented\n end", "def token_secret; config[:token_secret]; end", "def validate_token_hash; end", "def auth_token\n (protect_against_forgery? ? form_authenticity_token : nil)\n end", "def token_secret=(_arg0); end", "def token_secret=(_arg0); end", "def token_secret=(_arg0); end", "def verify_authenticity_token\n if auth_token_param.present?\n verify_valid_auth_token!\n else\n super\n end\n end", "def ensure_session_token\n self.token ||= SecureRandom.hex\n end", "def check_token\n end", "def masked_authenticity_token(session, form_options: T.unsafe(nil)); end", "def capable_plain_auth?; end", "def new_token\n SecureRandom.urlsafe_base64\nend", "def form_authenticity_token(form_options: T.unsafe(nil)); end", "def token_auth(*args, &block); end", "def rfc_2045_token; end", "def auth_token\n return token if token.present?\n\n false\n # raise(CustomException::MissingToken, 'token is missing')\n end", "def remember_token; end", "def authenticate_token(token)\n Devise.secure_compare(self.authentication_token, token)\n end", "def new_token\n \t SecureRandom.urlsafe_base64\n \tend", "def authenticate_user!\n token, options = ActionController::HttpAuthentication::Token.token_and_options(request)\n\n super unless token == 'rbMmEeoH8RxRDyN24PQv'\n end", "def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end", "def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end", "def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end", "def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end", "def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end", "def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end", "def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end", "def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end", "def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end", "def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end", "def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end", "def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end", "def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end", "def generate_secure_token_string\n SecureRandom.urlsafe_base64(25).tr('lIO0', 'sxyz')\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def auth_token_for(key)\n @username_auth_tokens[secure_auth_token_key(key)]\n end", "def protect_against_forgery?; end", "def token?\n @session_token\n end", "def generate_token\n SecureRandom.hex(64)\nend", "def token\n authenticate_username_password || render_unauthorized\n end", "def security_token(params = {})\n @params = params.stringify_keys\n @params.update({'crop' => @params['crop'] ? 'crop' : nil})\n Digest::SHA1.hexdigest(secured_params)[0..15]\n end", "def check_magic_token\n params[:magic_token] == Rails.application.secrets.calendly_magic_token\n end", "def check_magic_token\n params[:magic_token] == Rails.application.secrets.salesforce_magic_token\n end", "def token(auth_code = T.unsafe(nil), headers = T.unsafe(nil)); end", "def require_api_token\n end", "def form_authenticity_token() 'token' end", "def secure?\n true\n end", "def ensure_session_token \n self.session_token ||= SecureRandom::urlsafe_base64\n end", "def correct_login_token?(given_token)\n false\n end", "def ensure_session_token\n self.token ||= self.class.random_string\n end", "def valid_for_http_auth?; end", "def random_token\n SecureRandom.urlsafe_base64\n end", "def verify_csrf_token?\n false\n end", "def ensure_authentication_token\n self.authentication_token = rand(72**8).to_s(36)\n end", "def protect_against_forgery?\n end", "def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end", "def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end", "def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end", "def valid_token?\n env['HTTP_TOKEN']\n end", "def valid_key(token)\n @api_client && ActiveSupport::SecurityUtils.secure_compare(@api_client&.key, Digest::SHA512.hexdigest(token))\n end", "def verified_request?\n\t\tsuper || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n\tend", "def new_token\n \t\tSecureRandom.urlsafe_base64\n \tend", "def get_token\n session[:token] if authorized?\n end", "def setup_token\n token = SecureRandom.hex(16)\n @token = token\n token\n end", "def protect_against_forgery?\n\n end", "def token\n authenticate_username_password || render_unauthorized\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def token\n end", "def rest_token_endpoint; end", "def capable_login_auth?; end", "def ensure_authentication_token! \n reset_authentication_token! if authentication_token.blank? \n end", "def authenticatable_salt\n \"#{super}#{session_token}\"\n end", "def authenticatable_salt\n \"#{super}#{session_token}\"\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 init_token\n self.token = SecureRandom.hex(64) if self.token.blank?\n end", "def generate_security_token\n self.security_token = Digest::SHA1.hexdigest(\"--#{Time.now.to_s}--#{email}--#{salt}--\")\n end", "def verify_iat; end", "def verify_iat; end", "def ensure_session_token\n self.session_token ||= SecureRandom.urlsafe_base64(16)\n end", "def get_token\r\n render :text => form_authenticity_token\r\n end", "def token\n Pillowfort::Helpers::DeprecationHelper.warn(self.class.name, :token, :secret)\n send(:secret)\n end", "def login_by_token\n\n end", "def is_secure?\n isSecure == 'T'\n end", "def ensure_session_token\n self.session_token ||= User.generate_session_token\nend", "def token_authenticated?\n !!@access_token\n end", "def token_authenticated?\n !!@access_token\n end", "def verification_token\n JWT.encode({ iat: Time.now.to_i }, config.secret, JWT_ALG)\n end" ]
[ "0.71224666", "0.71224666", "0.71224666", "0.7050125", "0.70109504", "0.69412667", "0.68999", "0.67537653", "0.6724007", "0.66240644", "0.65942496", "0.6579124", "0.6573008", "0.65630305", "0.6540127", "0.6498106", "0.6498106", "0.6498106", "0.649739", "0.6485234", "0.6474157", "0.6473746", "0.64534676", "0.64487386", "0.64332724", "0.6397864", "0.6393917", "0.63753676", "0.6361731", "0.6314732", "0.6304381", "0.6302784", "0.6281229", "0.6281229", "0.6281229", "0.6281229", "0.6281229", "0.6281229", "0.6281229", "0.6281229", "0.6281229", "0.6281229", "0.6281229", "0.6281229", "0.6281229", "0.62622654", "0.62442553", "0.62442553", "0.62442553", "0.6233056", "0.6230014", "0.62264717", "0.6221169", "0.6211781", "0.61875254", "0.61832994", "0.6182391", "0.6167012", "0.61669546", "0.6161232", "0.61510485", "0.6148655", "0.6147878", "0.61429816", "0.6141013", "0.6131153", "0.61280686", "0.6128028", "0.61138886", "0.61132604", "0.61132604", "0.61132604", "0.6101948", "0.6100155", "0.6088641", "0.6080901", "0.6074047", "0.60732603", "0.6063596", "0.60590935", "0.6048363", "0.60442215", "0.6039807", "0.60357046", "0.60306954", "0.6026364", "0.6026364", "0.6025738", "0.60246664", "0.60221416", "0.6021027", "0.6021027", "0.6017005", "0.601383", "0.60117894", "0.6008445", "0.6005893", "0.6000359", "0.5999705", "0.5999705", "0.5994052" ]
0.0
-1
The same code from part 1, slightly modified to return more. We have to return a more complex result than in part 1 in order to add the value of each node.
def size_of_children(arr) children_count = arr[0] metadata_count = arr[1] if children_count == 0 # the value is simply the sum of child nodes value = arr[2..(metadata_count+1)].sum $metadata_total += value return {size: (2 + metadata_count), value: value} elsif children_count >= 1 total_children_size = 0 child_nodes_values = [ nil ] # we need a dummy item at index 0 children_count.times do |index| kiddo_report = size_of_children(arr[2+total_children_size..-1]) total_children_size += kiddo_report[:size] child_nodes_values << kiddo_report[:value] end metadata_nodes = arr[(2 + total_children_size)..(1 + total_children_size + metadata_count)] $metadata_total += metadata_nodes.sum # Value is more complicated when the node has child nodes. Value is the sum # of the values of child nodes referred to, but we have to be careful since # arrays are 0-indexed and references to child nodes are 1-indexed. If the # child node doesn't actually exist, the value is 0. total_value = 0 metadata_nodes.each do |node| total_value += child_nodes_values.fetch(node, 0) end return {size: (2 + total_children_size + metadata_count), value: total_value} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_40(val, _values, result)\n case val[0]\n when 'even'\n result = Node.new(:NTH, ['2','n','+','0'])\n when 'odd'\n result = Node.new(:NTH, ['2','n','+','1'])\n when 'n'\n result = Node.new(:NTH, ['1','n','+','0'])\n else\n # non-standard to support custom functions:\n # assert_xpath(\"//a[foo(., @href)]\", @parser.parse('a:foo(@href)'))\n # assert_xpath(\"//a[foo(., @a, b)]\", @parser.parse('a:foo(@a, b)'))\n # assert_xpath(\"//a[foo(., a, 10)]\", @parser.parse('a:foo(a, 10)'))\n result = val\n end\n\n result\nend", "def _reduce_195(val, _values, result)\n result = self.node_assign val[0], val[2]\n \n result\nend", "def _reduce_195(val, _values, result)\n result = self.node_assign val[0], val[2]\n \n result\nend", "def _reduce_195(val, _values, result)\n result = self.node_assign val[0], val[2]\n \n result\nend", "def _reduce_195(val, _values, result)\n result = self.node_assign val[0], val[2]\n \n result\nend", "def _reduce_195(val, _values, result)\n result = self.node_assign val[0], val[2]\n \n result\nend", "def _reduce_45(val, _values, result)\n case val[0]\n when 'even'\n result = Node.new(:NTH, ['2','n','+','0'])\n when 'odd'\n result = Node.new(:NTH, ['2','n','+','1'])\n when 'n'\n result = Node.new(:NTH, ['1','n','+','0'])\n else\n result = val\n end\n\n result\nend", "def _reduce_197(val, _values, result)\n result = self.node_assign val[0], val[2]\n \n result\nend", "def _reduce_197(val, _values, result)\n result = self.node_assign val[0], val[2]\n \n result\nend", "def sum_lists_direct(a, b)\n sum = ll_to_i(a) + ll_to_i(b)\n\n res = nil\n\n while sum > 0 do\n res = LLNode.new(sum % 10, res)\n sum = sum / 10\n end\n\n res\nend", "def _reduce_174(val, _values, result)\n result = node_assign val[0], val[2]\n \n result\nend", "def _reduce_54(val, _values, result)\n result = Node.new(:COMBINATOR, val)\n\n result\nend", "def add\r\n node = mul()\r\n\r\n loop do\r\n if consume(\"+\")\r\n node = new_binary(ND_ADD, node, mul())\r\n elsif consume(\"-\")\r\n node = new_binary(ND_SUB, node, mul())\r\n else\r\n return node\r\n end\r\n end\r\nend", "def get_all_vals(node, arr)\n # add the value of the node to the array\n arr << node.val\n \n # using a ternary operator, check if there is another node in the list\n # if so, recursively run the function again\n # if not, return the array\n return node.next ? get_all_vals(node.next, arr) : arr\n end", "def sum_metadata(numbers)\n num_children, num_metadata = numbers.shift(2)\n children_sum = num_children.times.map {|c| sum_metadata(numbers)}.reduce(&:+) || 0\n current_sum = numbers.shift(num_metadata).reduce(&:+)\n children_sum + current_sum\nend", "def parse_value(nodes); end", "def _reduce_48(val, _values, result)\n result = Node.new(:COMBINATOR, val)\n\n result\nend", "def concat(nodes); end", "def sum_lists(list1, list2)\n num = 0\n factor = 1\n\n list1_node = list1.head.next\n list2_node = list2.head.next\n\n while list1_node.value\n num += (list1_node.value * factor)\n num += (list2_node.value * factor)\n list1_node = list1_node.next\n list2_node = list2_node.next\n factor *= 10\n end\n\n string_num = num.to_s\n new_list = LinkedList.new\n\n (string_num.length - 1).downto(0).each do |idx|\n new_node = Node.new(string_num[idx].to_i)\n new_list.append(new_node)\n end\n\n new_list\nend", "def tree_sum(head, target)\n @res = 0\n helper(head, target, 0, {0=> true})\n return @res\nend", "def count_all\n # map all nodes into enumerable\n # then add them all together (reduce :+)\n self.map { |node| node.count }.reduce(:+)\n end", "def add_two_numbers(l1, l2)\n l1_str = to_reverse_string(l1)\n l2_str = to_reverse_string(l2)\n\n head = nil\n node = nil\n\n yield_digits(l1_str.to_i + l2_str.to_i) do |i| \n if node.nil?\n node = ListNode.new\n head = node \n else \n node.next = ListNode.new\n node = node.next\n end\n\n node.val = i\n end\n\n head\nend", "def returns_from(node); end", "def returns_from(node); end", "def sum_lists(node1, node2)\n carry = 0\n total = LinkedList.new\n until node1.nil? && node2.nil?\n # If the numbers do not have the same number of digits, consider this digit\n # to be zero\n val1 = node1.nil? ? 0 : node1.data\n val2 = node2.nil? ? 0 : node2.data\n\n # Keep track of the carry value so that it may be used in calculating the\n # next digit\n sum = val1 + val2 + carry\n total.append(sum % 10)\n carry = sum / 10\n\n # Move to the next larger digit\n node1 = node1.next unless node1.nil?\n node2 = node2.next unless node2.nil?\n end\n # There may be an additional carry value left over\n total.append(carry) if carry.positive?\n total\nend", "def list_to_i(list_node)\n result_s = \"\"\n until list_node.nil?\n result_s = list_node.val.to_s + result_s\n list_node = list_node.next \n end\n result_s.to_i\nend", "def paths_with_sum(head_node, value, array_values = [], num_sums = 0)\n num_sums = check_sum(array_values, target) if head_node.children.empty?\n\nend", "def sum(n1, n2, overflow=false)\n return nil if n1.nil? and n2.nil? and not overflow\n digit_sum = overflow ? 1 : 0 \n if n1 and n2\n digit_sum+= n1.data + n2.data\n elsif n1 or n2\n digit_sum+= (n1||n2).data\n end\n result = Node.new (digit_sum%10)\n overflow = digit_sum>=10 ? true : false\n\n result.set_next(sum( (n1 || Node.new(nil) ).next, (n2 || Node.new(nil) ).next, overflow))\n result\nend", "def get_values_for_verification\n \t@intermediate_nodes = self.get_intermediate_nodes\n @array = []\n\n @intermediate_nodes.each do |node|\n @array << node.sha.to_s\n if node.is_right_child\n @array << \"rchild\"\n else\n @array << \"lchild\"\n end\n end\n\n \t@array << Node.get_root_node.sha.to_s\n @array << \"root\"\n\n \treturn @array\n #return @intermediate_nodes\n end", "def find_weights(node_name,node_hash)\n node = node_hash[node_name]\n if(node[\"children\"])\n node[\"total_weight\"] = node[\"weight\"] + node[\"children\"].map{|c| find_weights(c,node_hash)}.inject(:+)\n else\n node[\"total_weight\"] = node[\"weight\"]\n end\n node[\"total_weight\"]\nend", "def visit_node(n); end", "def returnList\n\t\telements = []\n\t\tcurrent = @head\n\t\twhile current != nil\n\t\t\telements << current.value\n\t\t\tcurrent = current.nnode\n\t\tend\n\t\treturn elements\n\tend", "def sum_lists(list1, list2)\n return list1 unless list2\n return list2 unless list1\n\n sum = sum_lists_helper(list1, list1.count, list2, list2.count)\n\n if sum.value >= 10\n sum.value -= 10\n return LinkedListNode.new(1, sum)\n else\n return sum\n end\nend", "def sum_lists_helper(list1, length1, list2, length2)\n # Base case\n return LinkedListNode.new(list1.value + list2.value) if length1 == 1\n\n sum = nil\n if length1 > length2\n sum = sum_lists_helper(list1.next, length1 - 1, list2, length2)\n elsif length2 > length1\n sum = sum_lists_helper(list1, length1, list2.next, length2 - 1)\n else\n sum = sum_lists_helper(list1.next, length1 - 1, list2.next, length2 - 1)\n end\n\n digit_sum = 0\n if length1 >= length2\n digit_sum += list1.value\n end\n\n if length2 >= length1\n digit_sum += list2.value\n end\n\n if sum.value >= 10\n sum.value -= 10\n return LinkedListNode.new(1 + digit_sum, sum)\n else\n return LinkedListNode.new(digit_sum, sum)\n end\nend", "def return_list\n entries = []\n current_node = @head\n\n while current_node.next != nil\n entries << current_node.value\n current_node = current_node.next\n end\n entries << current_node.value\n end", "def _reduce_7(val, _values, result)\n return val[0] + val[1] \n result\nend", "def sum_numbers(root)\n return 0 if root.nil?\n nums = []\n inner_sum_numbers(root, 0, nums)\n nums.reduce(:+) #OR (&:+)\n#(5..10).reduce(:+) => 45\n# Same using a block and inject (5..10).inject { |sum, n| sum + n } => 45\n# Multiply some numbers(5..10).reduce(1, :*) => 151200\nend", "def sum_lists(linked_list1, linked_list2)\n arr1 = []\n arr2 = []\n linked_list1.each do |node|\n arr1 << node.val.to_s\n end\n linked_list2.each do |node|\n arr2 << node.val.to_s\n end\n sum = arr1.join(\"\").reverse.to_i + arr2.join.reverse.to_i\n sum_arr = sum.to_s.split(\",\")\n\n new_list = LinkedList.new\n sum_arr.each do |num|\n new_list.append(nil, num)\n end\n new_list.to_s\nend", "def sum_lists(head1, head2)\n # Numbers are forward e.g. 5->2->1 turns into 125\n number1 = list_to_string(head1)\n number2 = list_to_string(head2)\n\n result = (number1.to_i + number2.to_i).to_s\n head = Node.new(result[-1].to_i)\n tail = head\n\n # Loop through all numbers except the head from the end of the list to the beginning\n # in order to reverse the result e.g. '125' turns into 5->2->1\n (result.size - 2).downto(0) do |x|\n tail.next = Node.new(result[x].to_i)\n tail = tail.next\n end\n head\nend", "def _reduce_1(val, _values, result)\n result = Root.new(val[1], val[2]) \n result\nend", "def sumLists(list1,list2)\n first = list1.head\n second = list2.head\n remainder = 0\n answer = LinkedList.new()\n\n while first && second\n temp = first.value += second.value += remainder\n if temp > 9\n remainder = 1\n temp -= 10\n else\n remainder = 0\n end\n answer.add_node_back(temp)\n first = first.next\n second = second.next\n end\n answer.add_node_back(remainder) if remainder > 0\n return answer\nend", "def to_s\n return @nodes.values.map{|node| node.to_s}.join\n #return @nodes.values.reduce(''){|sum, node| sum + node.to_s}\n end", "def children_sumtrees\n children.each_with_object({}) do |child, sum|\n sum[child.name] = child.total_weight\n end\n end", "def sum_lists_forward(node1, node2)\n # Determine lengths and pad shorter list\n length1 = list_length(node1)\n length2 = list_length(node2)\n node1 = pad_list(node1, length2 - length1) if length2 > length1\n node2 = pad_list(node2, length1 - length2) if length1 > length2\n\n # Result includes the partial sum and possibly a carry value\n result = recursive_add(node1, node2)\n sum = result[:partial_sum]\n\n # If there's a remaining carry value, insert it at the beginning of the list\n if result[:carry].positive?\n carry_node = LinkedList::Node.new(result[:carry])\n carry_node.next = sum\n sum = carry_node\n end\n\n # The partial sum is now the total\n sum\nend", "def _reduce_58(val, _values, result)\n result = Node.new(:ID, [unescape_css_identifier(val.first)])\n result\nend", "def _reduce_78(val, _values, result)\n result << val[1]\n result\nend", "def add_two_number(l1, l2)\n m, n = l1, l2\n result = ListNode.new(0)\n curr = result\n carry = 0\n while(!m.nil? || !n.nil?)\n x = m.nil? ? 0 : m.val\n y = n.nil? ? 0 : n.val\n sum = x + y + carry\n curr.next = ListNode.new(sum % 10)\n carry = sum / 10\n curr = curr.next\n m = m.next if !m.nil?\n n = n.next if !n.nil?\n end\n curr.next = ListNode.new(carry) if (carry > 0)\n result.next\nend", "def add_two_numbers(l1, l2)\n \n curr = try = ListNode.new()\n sum = 0\n\n while l1 || l2 || sum > 0\n # puts l1.val\n if l1\n sum += l1.val\n l1 = l1.next\n end\n if l2\n sum += l2.val\n l2 = l2.next\n end\n \n curr.next = ListNode.new(sum % 10)\n curr = curr.next\n sum /= 10\n end\n \n try.next\n \nend", "def path_sum(root, sum)\n return [] if root.nil?\n result = []\n helper(root, sum, result)\n result\nend", "def on_call_sum(context, expression)\n nodes = process(expression, context)\n sum = 0.0\n\n unless nodes.is_a?(XML::NodeSet)\n raise TypeError, 'sum() can only operate on NodeSet instances'\n end\n\n nodes.each do |node|\n sum += node.text.to_f\n end\n\n return sum\n end", "def _reduce_15(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend", "def _reduce_15(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend", "def _reduce_15(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend", "def _reduce_15(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend", "def _reduce_15(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend", "def _reduce_15(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend", "def _reduce_15(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend", "def _reduce_15(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend", "def _reduce_15(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend", "def _reduce_15(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend", "def _reduce_15(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend", "def _reduce_15(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend", "def _reduce_15(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend", "def _reduce_15(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend", "def _reduce_15(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend", "def add(node, value)\n tree_navigator.descendents(node).each do |descendent|\n values[descendent] += value\n end\n end", "def _reduce_378(val, _values, result)\n result = val[0].concat(val[2]).concat(val[3])\n \n result\nend", "def total(list)\n\n p list.reduce(:+)\n \nend", "def path_sum(root, sum)\n return [] unless root\n res = []\n path_sum_helper(root, sum, [], res)\n res\nend", "def value\n ret=\"\"\n for c in @children\n ret+=c.value\n end\n return ret\n end", "def add_two_numbers(head1, head2)\n result_dummy = ListNode.new(nil)\n current, current1, current2 = result_dummy, head1, head2\n tens = 0\n\n while current1 && current2\n sum = current1.val + current2.val + tens\n tens = sum > 9 ? 1 : 0\n current.next = ListNode.new(sum % 10)\n current, current1, current2 = current.next, current1.next, current2.next\n end\n\n while current1\n sum = current1.val + tens\n current.next = ListNode.new(sum % 10)\n tens = sum > 9 ? 1 : 0\n current, current1 = current.next, current1.next\n end\n \n while current2\n sum = current2.val + tens\n current.next = ListNode.new(sum % 10)\n tens = sum > 9 ? 1 : 0\n current, current2 = current.next, current2.next\n end\n\n if tens == 1\n current.next = ListNode.new(1)\n end\n\n result_dummy.next\nend", "def reduce(nodes)\n for node in nodes\n if node.class==ActiveSupport::HashWithIndifferentAccess && node['data']\n data_array = Array.new\n node['data'].map{|element| data_array << element[1]}\n node['data'] = data_array\n end\n\n if node.class==Array || node.class == ActiveSupport::HashWithIndifferentAccess\n reduce (node)\n end\n end\n end", "def _reduce_109(val, _values, result)\n result << val[1]\n result\nend", "def max_path_sum_util(root, res)\n return 0 if root.nil?\n return root.value if root.left.nil? && root.right.nil?\n\n ls = max_path_sum_util(root.left, res)\n rs = max_path_sum_util(root.right, res)\n puts \"root - #{root.value}, ls- #{ls}, rs- #{rs}, #{res[0]}\"\n\n\n #If both left and right children exist\n if (root.left && root.right)\n #Update result if needed\n res[0] = [res[0], ls + rs + root.value].max\n\n # Return maxium possible value for root being on one side\n return [ls, rs].max + root.value\n end\n\n # If any of the two children is empty, return root sum for root being on one side\n return root.left ? ls + root.value : rs + root.value\nend", "def valorenergetico\n acumulador1 = 0\n nodo = @head\n while nodo != @tail\n acumulador1 = acumulador1 + nodo.value.valor_energetico\n nodo = nodo.next\n end\n acumulador1\n end", "def _reduce_2(val, _values, result)\n result.append val[1]\n result\nend", "def total\n object.nodes.size\n end", "def _reduce_7(val, _values, result)\n result = block_append val[0], val[2]\n \n result\nend", "def _reduce_7(val, _values, result)\n result = block_append val[0], val[2]\n \n result\nend", "def _reduce_7(val, _values, result)\n result = block_append val[0], val[2]\n \n result\nend", "def nodes; end", "def nodes; end", "def nodes; end", "def add(v)\n case\n when v < @value1\n if is_leaf\n return Node.new(@value1, Node.new(v), Node.new(@value2)), true if @type == 3\n @type, @value1, @value2 = 3, v, @value1\n return self, true\n end\n child, inc_count = @left.add(v)\n return self, inc_count if child == @left\n return Node.new(@value1, child, Node.new(@value2,@mid,@right)), true if @type == 3\n shift_right\n @type, @left, @value1, @mid = 3, child.left, child.value1, child.mid\n return self, true\n when v == @value1\n @value1 = v\n return self, false\n when @type == 2\n if is_leaf\n @type, @value2 = 3, v\n return self, true\n end\n child, inc_count = @mid.add(v)\n if child != @mid\n @type, @mid, @value2, @right = 3, child.left, child.value1, child.mid\n end\n return self, inc_count\n when v < @value2\n if is_leaf\n return Node.new(v, Node.new(@value1), Node.new(@value2)), true\n end\n child, inc_count = @mid.add(v)\n return self, inc_count if child == @mid\n return Node.new(child.value1, Node.new(@value1,@left,child.left),\n Node.new(@value2,child.mid,@right)), true\n when v == @value2\n @value2 = v\n return self, false\n else # v > @value2\n if is_leaf\n return Node.new(@value2, Node.new(@value1), Node.new(v)), true\n end\n child, inc_count = @right.add(v)\n return self, inc_count if child == @right\n return Node.new(@value2, Node.new(@value1, @left, @mid), child), true\n end\n end", "def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend", "def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend", "def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend", "def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend", "def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend", "def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend", "def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend", "def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend", "def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend", "def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend", "def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend", "def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend", "def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend", "def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend", "def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend", "def path_sum(root, sum)\n res = []\n dfs(root, res, [], sum)\n res\nend" ]
[ "0.6624061", "0.6392328", "0.6392328", "0.6392328", "0.6392328", "0.6392328", "0.63158906", "0.6291644", "0.6291644", "0.6284407", "0.627129", "0.6266496", "0.61419046", "0.612403", "0.6108381", "0.61068374", "0.60629153", "0.6048005", "0.6033568", "0.60155606", "0.59733504", "0.59555316", "0.5952441", "0.5952441", "0.5936548", "0.5935971", "0.5920118", "0.5892887", "0.5892786", "0.5876093", "0.58725536", "0.5866756", "0.58630157", "0.58541965", "0.5849226", "0.58035654", "0.58033735", "0.576024", "0.5738568", "0.5731058", "0.5729336", "0.57075965", "0.56991696", "0.56983036", "0.5689601", "0.567856", "0.5676541", "0.5658475", "0.565629", "0.56557506", "0.56373316", "0.56373316", "0.56373316", "0.56373316", "0.56373316", "0.56373316", "0.56373316", "0.56373316", "0.56373316", "0.56373316", "0.56373316", "0.56373316", "0.56373316", "0.56373316", "0.56373316", "0.563196", "0.5627642", "0.56240374", "0.5623678", "0.5619429", "0.56167805", "0.56127596", "0.5602986", "0.55943555", "0.55941063", "0.55938244", "0.559196", "0.55914307", "0.55914307", "0.55914307", "0.5586072", "0.5586072", "0.5586072", "0.55810827", "0.5577744", "0.5577744", "0.5577744", "0.5577744", "0.5577744", "0.5577744", "0.5577744", "0.5577744", "0.5577744", "0.5577744", "0.5577744", "0.5577744", "0.5577744", "0.5577744", "0.5577744", "0.5573182" ]
0.59450746
24
This is a form to save a summary of attendances for several contracts filtered by month and provider
def attendances # nothing here, everything is asked to JSON API # this action should render initial template only. end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def summary_attendance_params\n params.require(:summary_attendance).permit(:attendace_date, :check_in_at, :check_out_at, :worked_hours, :contracted_hours, :difference, :delay, :permission, :medical_licence, :employee_id, :branch_office_id)\n end", "def new\n @attendance = Attendance.new\n @payheads = @company.payheads.where(:optional => true)\n year = (params[:month].to_i>Time.zone.now.month) ? (Time.zone.now.year-1) : Time.zone.now.year\n @month = Date.new(year, params[:month].to_i, 1)\n @users = @company.users.this_month_processable(@month)\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @attendance }\n end\n end", "def attendance_params\n params.require(:attendance).permit(:month_date, :reason, :forenoon, :afternoon, :student_id, :batch_id)\n end", "def set_summary_attendance\n @summary_attendance = SummaryAttendance.find(params[:id])\n end", "def recordAttendance\n @provider = Provider.find(params[:provider_id])\n @children = @provider.children.order('lName')\n @date = params[:date] \n @date = Date.parse(\"#{params[:date]['day']}-#{params[:date]['month']}-#{params[:date]['year']}\") if params[:date]\n @date ||= Date.current\nend", "def index\n if params[:standard_id] && params[:division] && params[:date] && params[:subject]\n @attendance = Attendance.where(:standard_id => params[:standard_id],\n :division_id => params[:division],\n :date => params[:date], :subject_id => params[:subject]).limit(1).last\n @standard = Standard.find(params[:standard_id])\n @division = Division.find(params[:division])\n @students = @division.students.where(is_enquiry: false)\n else\n @attendances = Attendance.all\n end\n end", "def new\n @schedule_entry = ScheduleEntry.new\n handled_sections_id = current_user.sections.map {|section| section.id}\n @students = Student.where(:section_id => handled_sections_id).page(params[:page])\n @interview_types = InterviewType.all\n @period = Period.find(params[:period_id])\n end", "def update\n @is_save = false\n @attendance = Attendance.find(params[:id])\n #respond_to do |format|\n if !params[:attendance].blank? && @attendance.update_attributes(params[:attendance])\n flash[:success] = \"Attendance updated successfully\"\n redirect_to \"/attendances/show?month=#{params[:month]}\"\n @if_save = true\n else\n @if_save = false\n flash[:error] = \"Attendance can't be blank\"\n render :action => \"edit\"\n end\n #end\n end", "def index\n @expense_trackers = ExpenseTracker.all\n \n #Create a hash to keep track of total expenses per month\n #Keys for this hash will be \"Month- value specified from form\"\n @total_expense = Hash.new\n @savings = Hash.new\n \n #Loop through each row in expense tracker (per month)\n @expense_trackers.each do |expense_tracker|\n @total_expense[expense_tracker.month] = 0\n if(expense_tracker.grocery != NIL)\n @total_expense[expense_tracker.month] += expense_tracker.grocery\n end\n if(expense_tracker.mortgage != NIL)\n @total_expense[expense_tracker.month] += expense_tracker.mortgage\n end\n if(expense_tracker.gas != NIL)\n @total_expense[expense_tracker.month] += expense_tracker.gas\n end\n if(expense_tracker.shopping != NIL)\n @total_expense[expense_tracker.month] += expense_tracker.shopping\n end\n if(expense_tracker.restaurant != NIL)\n @total_expense[expense_tracker.month] += expense_tracker.restaurant\n end\n if(expense_tracker.utilities != NIL)\n @total_expense[expense_tracker.month] += expense_tracker.utilities\n end\n if(expense_tracker.other != NIL)\n @total_expense[expense_tracker.month] += expense_tracker.other\n end\n @savings[expense_tracker.month] = expense_tracker.income - @total_expense[expense_tracker.month]\n end\n \n end", "def show\n\n # define month and year\n @year= @cashflow.accounting_date.year\n @month= @cashflow.accounting_date.month\n @cashflow.year=@year\n @cashflow.month = @month\n\n\n\n # get widrawals and lodgement where the month and the year is the same as the and year of the current cashflow\n @cash_injection = Withdrawal.where(year: @year, month: @month).sum(:amount)\n @saving_lodgement = Lodgement.where(year: @year, month: @month).sum(:amount)\n # Only retieve inflows and outflows where the cashflow id belongs to the current cashflow\n @ref = @cashflow.id\n\n\n\n # inflow outflow tabels\n @inflows = Inflow.where(cashflow_id: @ref).order(\"date_posted DESC\")\n @outflows = Outflow.where(cashflow_id: @ref).order(\"date_posted DESC\")\n @transaction = Transaction.where(cashflow_id: @ref).order(\"date_posted DESC\")\n\n # reconciliation calc\n\n @recons = CashflowRecon.where(cashflow_id: @ref).sum(:correction_amount)\n\n # rent management\n @month_rent = RentManagement.where(year: @year, month: @month).sum(:amount)\n\n\n\n\n\n # savings dashboard\n @savings = Saving.where(year: @year).sum(:balance)\n\n # budget balance\n @budgets = Budget.where(year: @year, month: @month).sum(:balance)\n # Cashflow number\n @cashflow_number = (@cashflow.id + 10000 )\n @cashflow.cashflow_number = @cashflow_number\n\n #save whatever can be saved on the table\n @cashflow.save\n\n\n\n\n # Income and Expense accounts/ types\n\n @inflowtypes = Inflowtype.all.order(\"name ASC\")\n @outflowtypes = Outflowtype.all.order(\"name ASC\")\n\n # totals\n\n @totalinflow = Inflow.where(cashflow_id: @ref).sum(:amount)\n @totaloutflow = Outflow.where(cashflow_id: @ref).sum(:amount)\n\n # transaction from pettycash\n\n @transactions = Transaction.where(cashflow_id: @ref )\n @transactions_amount = Transaction.where(cashflow_id:@ref).sum(:amount)\n\n\n # balance calculation\n @i = 0\n @balance = ((((@totalinflow - @saving_lodgement)- @totaloutflow) + @cash_injection) + @recons)-@transactions_amount\n @cashflow.balance= @balance\n\n @cashflow.save\n\n @inflow_fu_count = Inflow.where(cashflow_id: @ref, follow_up: true).count\n @outflow_fu_count = Outflow.where(cashflow_id: @ref,follow_up: true).count\n\n @inflow_follow_up = Inflow.where(cashflow_id: @ref,follow_up: true).order(\"date_posted DESC\")\n @outflow_follow_up = Outflow.where(cashflow_id: @ref,follow_up: true).order(\"date_posted DESC\")\n\n if @inflow_follow_up.empty?\n @message_for_empty1 = \"There are no transactions to follow-up!\"\n end\n if @outflow_follow_up.empty?\n @message_for_empty2 = \"There are no transactions to follow-up!\"\n end\n end", "def attendance_other_params\n params.require(:attendance_other).permit(:summary, :start_time, :end_time, :over_time, :holiday_time, :midnight_time,:break_time, :kouzyo_time, :work_time, :remarks, :user_id, :year, :month)\n end", "def create\n unless params[:attendance][:student_id].blank?\n lastpayment = Payment.find(:first,:conditions => [\"student_id = ? and program_id = ?\",params[:attendance][:student_id].to_i,params[:attendance][:program_id]])\n end\n unless lastpayment.nil?\n params[:attendance][:level_id] = lastpayment.level_id\n end \n @attendance = Attendance.new(params[:attendance])\n save_stat = @attendance.save \n respond_to do |format|\n \tif (save_stat)\n \t @attendances = Attendance.find(:all)\n format.html {render :action => \"index\"}\n else\n @validates = Array.new\n @attendance.errors.messages.each do |m|\n \t @validates << m \n end\n @students = Student.order(\"lastname\").find(:all)\n @programs = Program.order(\"name\").find(:all)\n @levels = Level.find(:all)\n format.html { render :action => \"new\" }\n format.json { render :json => @attendance.errors, :status => :unprocessable_entity }\n end\n end\n end", "def attendance_params\n params.require(:attendance).permit(:clock_in_time, :clock_out_time, :date, :division)\n end", "def attendance_params\n params.require(:attendance).permit(:checkin, :checkout, :user_id, :attendance_date)\n end", "def index\n @action_name = \"all\"\n @attendances = current_employee.attendances\n filter_params = params[:date]\n if filter_params\n @d = Date.civil(filter_params[:year].to_i || DateTime.now.year, filter_params[:month].to_i || DateTime.now.month, filter_params[:day].to_i || DateTime.now.day)\n if filter_params[:scope] == \"month\"\n @status = \"monthly\"\n @old_day = @d.beginning_of_month\n @new_day = @d.end_of_month\n else\n @status = \"weekly\"\n @old_day = @d.beginning_of_week\n @new_day = @d.end_of_week\n end\n else\n @status = \"weekly\"\n @old_day = DateTime.now.beginning_of_week\n @new_day = DateTime.now\n end\n @d ||= Date.today\n end", "def edit_multiple\n @studentattendance_ids = params[:student_attendance_ids]\n unless @studentattendance_ids.blank? \n @studentattendances = StudentAttendance.find(@studentattendance_ids)\n @studentattendances_group = @studentattendances.group_by{|x|x.student_id} \n @time_slot_main_count = @studentattendances.group_by{|u|u.weeklytimetable_detail.get_time_slot}.count\n @studentattendances_group.each do |s,sa|\n @time_slot_each_count = sa.group_by{|u|u.weeklytimetable_detail.get_time_slot}.count \n if @time_slot_each_count != @time_slot_main_count\n @time_slot_match =\"no\"\n end\n end\n \n if ((@studentattendances.count % @studentattendances_group.count) == 0) \n if (@time_slot_match ==\"no\")\n flash[:notice] = I18n.t('student_attendance.same_class')\n redirect_to student_attendances_path\n else\n if @time_slot_main_count > 3\n flash[:notice] = I18n.t('student_attendance.max_time_slot')\n redirect_to student_attendances_path\n else\n @student_count = @studentattendances.map(&:student_id).uniq.count\n @edit_type = params[:student_attendance_submit_button] \n end\n end\n else \n flash[:notice] = I18n.t('student_attendance.student_must_identical')\n redirect_to student_attendances_path\n end\n else \n flash[:notice] = I18n.t('student_attendance.select_one')\n redirect_to student_attendances_path\n end\n end", "def add\n @date = Date.parse(params[\"date\"])\n Style.active.each do |style|\n params[\"attendance_#{style.id}\"].each do |attendance|\n count = attendance[\"count\"].to_i\n a = Attendance.where(date: @date, person_id: attendance[\"person\"], style: style).first_or_initialize\n if count > 0\n a.date = @date\n a.person_id = attendance[\"person\"]\n a.count = count\n a.save\n elsif a.count\n # remove the old attendance entry, don't want any with class count of zero\n a.delete\n end\n end\n end\n flash[:notice] = 'Attendance Saved'\n render :index\n end", "def attendance_params\n params.require(:attendance).permit(:attendance_date, :explain,\n student_attendances_attributes:[:id,:student_id,:attendance_id,:description,:status_morning,:status_afternoon,:status_evening])\n end", "def attendance_params\r\n params.require(:attendance).permit(:customer_id, :user_id, :status,\r\n scheduled_for: [:date, :time],\r\n items_attributes: [:id, :service_id, :started_at, :finished_at, :_destroy])\r\n end", "def create\n monthly = flash[:monthly]\n @attendance = Attendance.new(params[:attendance])\n @attendance.date = Date.new(monthly.year, monthly.month, params[:day_of_date].to_i)\n\n # Change date of in and out.\n @attendance.in = Time.local(\n @attendance.date.year, @attendance.date.month, @attendance.date.day,\n @attendance.in.hour, @attendance.in.min, @attendance.in.sec)\n @attendance.out = Time.local(\n @attendance.date.year, @attendance.date.month, @attendance.date.day,\n @attendance.out.hour, @attendance.out.min, @attendance.out.sec)\n\n respond_to do |format|\n if monthly.attendances.push @attendance\n format.html { redirect_to :action => 'index', :monthly_id => monthly.id }\n format.json { render json: @attendance, status: :created, location: @attendance }\n else\n @monthly = monthly\n format.html { render action: \"new\" }\n format.json { render json: @attendance.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @audit = current_user.audits.new(params[:audit])\n audit = params[:audit]\n start_date = DateTime.new(params[\"audit\"][\"start_date(1i)\"].to_i, params[\"audit\"][\"start_date(2i)\"].to_i,params[\"audit\"][\"start_date(3i)\"].to_i,\n params[\"audit\"][\"start_date(4i)\"].to_i,params[\"audit\"][\"start_date(5i)\"].to_i)\n \n end_date = DateTime.new(params[\"audit\"][\"end_date(1i)\"].to_i, params[\"audit\"][\"end_date(2i)\"].to_i,params[\"audit\"][\"end_date(3i)\"].to_i,\n params[\"audit\"][\"end_date(4i)\"].to_i,params[\"audit\"][\"end_date(5i)\"].to_i)\n @all_audits = Audit.where(\"auditor_email = ? or auditee_email = ?\",params[:audit][:auditor_email], params[:audit][:auditee_email])\n \n @all_audits.each do |audit|\n if (audit.start_date.to_i..audit.end_date.to_i).include?(start_date.to_i||end_date.to_i)\n @audit.errors[:base] << \"Auditor or auditee is already assigned, please select another date \"\n break\n end\n end\n \n respond_to do |format|\n if @audit.errors.any?\n format.html { render action: \"new\" }\n format.json { render json: @audit.errors, status: :unprocessable_entity }\n elsif @audit.save\n UserMailer.assign_audit(@audit,@audit.auditor_email,current_user).deliver\n UserMailer.assign_auditee(@audit,@audit.auditee_email,current_user).deliver\n format.html { redirect_to audits_path, notice: 'Audit was successfully created.' }\n format.json { render json: @audit, status: :created, location: @audit }\n else\n format.html { render action: \"new\" }\n format.json { render json: @audit.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @attendance = Attendance.find(params[:id])\n respond_to do |format|\n if @attendance.update_attributes(params[:attendance])\n @attendances = Attendance.find(:all)\n format.html {render :action => \"index\"}\n else\n @validates = Array.new\n @attendance.errors.messages.each do |m|\n \t @validates << m \n end\n @students = Student.order(\"lastname\").find(:all)\n @programs = Program.order(\"name\").find(:all)\n @levels = Level.find(:all)\n @history = Attendance.find(:all, :conditions => \"student_id = #{@attendance.student_id} and program_id = #{@attendance.program_id} \" )\n @total_hours = 0\n @program = Program.find(\"#{@attendance.program_id}\") \t \n @history.each do |h|\n @total_hours = @total_hours + h.hours\n end\n format.html { render :action => \"edit\" }\n format.json { render :json => @attendance.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @transactions = if @employee\n @employee.transactions\n else\n Transaction.all\n end\n\n if params[:card_type_id].present?\n @transactions = @transactions.joins(card: :card_type).where(\"card_types.id IN (?)\", params[:card_type_id])\n end\n\n date_range = FormDateRange.new(params[:duration])\n if date_range.present?\n @transactions = @transactions.where(transaction_at: date_range.time_range)\n end\n\n @transactions_count = @transactions.count\n\n if params[:group_by].present?\n @transactions = @transactions.group_by { |m| m.transaction_at.beginning_of_month }\n end\n end", "def student_fees_structure\n\n month_date\n @student = Student.find(params[:id])\n @components = @student.get_fee_strucure_elements\n\n end", "def index\n @total_price_events = 0\n Attendance.all.each do |att|\n @total_price_events += att.event.price\n end\n\n @events_pending = Event.all.where(validated: false)\n @events_pending = [] if @events_pending.nil?\n end", "def monthly_summary_params\n params.require(:monthly_summary).permit(:year, :month, :begin_at, :end_at, :carryover_amount, :this_month_amount, :amount, :customer_id)\n end", "def index\n @contract_forms = ContractForm.all\n end", "def create\n #@attendance = Attendance.new(params[:attendance])\n \n if Membership.exists?(params[:membership])\n membership=Membership.find(params[:membership])\n @attendance=Attendance.new(:member_id=>membership.member.id)\n @attendance.save\n #@attendances = Attendance.find(:all, :conditions=>['created_at > ? AND created_at < ?', Date.today, Date.today+1], :order=>'created_at DESC')\n\t @attendances = Attendance.where('created_at > ? AND created_at < ?', Date.today, Date.today+1).order('created_at DESC')\n session[:from_results] = params[:from_results] ? true : false\n else\n jimmy_says(\"No hay ning&uacute;n miembro con ese n&uacute;mero\")\n end \n end", "def index\n\n @attendences = Attendence.where(datee: Date.today)\n @attendence = Attendence.new\n\n end", "def view_attendance\n\t\t@semester_events = Event.this_semester\n\t\t@current_cms = Member.current_members\n\t\t# event_member_join = Event.join(curr)\n\t\tevent_members = EventMember.all\n\t\t# @attended_dict = \n\n\t\t@mappings_dict = Hash.new\n\t\t@current_cms.each do |cm|\n\t\t\t@mappings_dict[cm.id] = cm.attendance_mapping(@semester_events)\n\t\tend\n\tend", "def attendance_params\n params.require(:attendance).permit(:date, :subject_id, :standard_id, :division_id, :academic_year_id, :teacher_id, :att_data => [].to_h)\n end", "def new\n @monthly = flash[:monthly]\n flash[:monthly] = @monthly\n\n now = Time.now\n @attendance = Attendance.new\n @attendance.in = Time.local(@monthly.year, @monthly.month, now.day, 9)\n @attendance.out = Time.local(@monthly.year, @monthly.month, now.day, 17, 30)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attendance }\n end\n end", "def find_employee_attendence\n\n # @attendences = Attendence.where('extract(month from datee)') == params[:month]\n @attendences = Attendence.where(\"extract(month from datee) = ?\",params[:month]).order('datee').all\n @attendences = @attendences.where(\"extract(year from datee) = ?\",params[:year]).order('datee').all\n\n # @attendences = Attendence.where(\"('%m',datee)) = ?\",params[:month]).order('datee').all\n\n # @attendences = Attendence.where(\"extract(strftime('%m',datee) as int) = ? \", params[:month]).order('datee ').all\n # # @attendences = Attendence.where(\"cast(strftime('%m',datee) as int) = ? \", params[:month]).order('datee ').all\n # @attendences = @attendences.where(\"(strftime('%Y',datee) as int) = ? \", params[:year]).order('datee ASC').all\n\n end", "def attendance_params\n params.fetch(:attendance, {}).permit(:enrollment_id, :course_id, :status, :obs, :status, :attendance_date)\n end", "def update\n @subject = Subject.all\n @classes = Classes.all\n @student = Student.find_by(id: params[:id])\n @attendance = Attend.new\n if @attendance.present != true\n @attendance.present = true\n @attendance.student_id = params[:id] \n @attendance.date = Date.today\n @attendance.classes_id = params[:classes_id]\n @attendance.save\n redirect_back(fallback_location: root_path)\n end\n end", "def set_attendance\n @attendance = Attendance.find(attendance_params[:id])\n @course = @attendance.course\n end", "def create\n # @attendance_record = AttendanceRecord.new(attendance_record_params)\n #\n # respond_to do |format|\n # if @attendance_record.save\n # format.html { redirect_to @attendance_record, notice: 'Attendance record was successfully created.' }\n # format.json { render :show, status: :created, location: @attendance_record }\n # else\n # format.html { render :new }\n # format.json { render json: @attendance_record.errors, status: :unprocessable_entity }\n # end\n # end\n enrollments = Enrollment.where(section_id: params[:section_id])\n enrollments.each do |e|\n if (params[\"ar_p-#{e.student_id}\"])\n primary = params[\"ar_p-#{e.student_id}\"]\n secondary = params[\"ar_s-#{e.student_id}\"] ? params[\"ar_s-#{e.student_id}\"] : nil\n ar_params = {}\n ar_params[:student_id] = e.student_id\n ar_params[:section_id] = params['section_id']\n ar_params[:primary] = primary\n ar_params[:secondary] = secondary\n ar_params[:attendance_date] = Date.today\n AttendanceRecord.create(ar_params)\n end\n end\n end", "def show\n year = (params[:month].to_i>Time.zone.now.month) ? (Time.zone.now.year-1) : Time.zone.now.year\n @month = Date.new(year, params[:month].to_i, 1)\n @payroll_detail = PayrollDetail.where(\"company_id=? and month between ? and ? \", @company.id, @month, @month.end_of_month).first\n @attendances = Attendance.where(:company_id => @company.id, :month => @payroll_detail.month)\n @users = User.where(:company_id => @company).this_month_payroll_participation(@month)\n @payroll_execution_job = PayrollExecutionJob.where(\"company_id=? and payroll_detail_id=?\", @company.id, @payroll_detail.id ).first\n @payroll_accounts_details = SalaryComputationResult.where(:company_id => @company.id, :month => @month.beginning_of_month..@month.end_of_month)\n @payroll_accounts_details_status = @payroll_accounts_details.first.status unless @payroll_accounts_details.blank?\n \n if @payroll_accounts_details.blank?\n @payroll_accounts_details = Salary.where(:company_id => @company.id, :month => @month.beginning_of_month..@month.end_of_month)\n @payroll_accounts_details_status = 1\n end\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def create\n @account = current_account\n @expense_report = ExpenseReport.new(expense_report_params)\n @expense_report.account_id = @account.id\n @expense_report.estimate2 =(@expense_report.Flight + @expense_report.Hotel + @expense_report.Transportation + @expense_report.Other)\n \n @travel_forms = TravelForm.all\n @expense_reports = ExpenseReport.all\n @expense_reports.each do |expense_report|\n @travel_forms.each do |travel_form|\n @travel_form = @travel_forms.find(@expense_report.travel_forms_id)\n if @expense_report.estimate2 > @travel_form.estimate\n @expense_report.update_attributes(:status => \"Denied\")\n end\n end\n end\n respond_to do |format|\n if @expense_report.save\n format.html { redirect_to employee_path(current_account.accountable_id), notice: 'Expense report was successfully created.' }\n format.json { render :show, status: :created, location: @expense_report }\n else\n format.html { render :new }\n format.json { render json: @expense_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @create_type = params[:new_submit] \n if @create_type == I18n.t('create') #create single record \n @new_type = \"1\"\n @student_attendance = StudentAttendance.new(params[:student_attendance])\n respond_to do |format|\n if @student_attendance.save\n format.html { redirect_to(@student_attendance, :notice => t('student_attendance.title')+\" \"+t('created')) }\n format.xml { render :xml => @student_attendance, :status => :created, :location => @student_attendance }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student_attendance.errors, :status => :unprocessable_entity }\n end\n end\n elsif @create_type == I18n.t('student_attendance.create_class_schedule') #create multiple record (by class)\n @new_type = \"2\"\n @student_attendances_all = params[:student_attendances] \n @student_attendances = params[:student_attendances].values.collect {|student_attendance| StudentAttendance.new(student_attendance) }\n if @student_attendances.all?(&:valid?) \n @student_attendances.each(&:save!) # ref: to retrieve each value of @exammarks --> http://railsforum.com/viewtopic.php?id=11557 (Dazen2 007-10-07 05:27:42) \n flash[:notice] = I18n.t(\"saved_all_records\")\n redirect_to :action => 'index'\n else \n flash[:error] = I18n.t('student_attendance.data_invalid')\n render :action => 'new'\n flash.discard\n end \n elsif @create_type == I18n.t('student_attendance.create_intake') #create multiple record (by intake)\n @new_type = \"3\"\n @student_attendances_all = params[:student_attendances] \n @student_attendances = params[:student_attendances].values.collect {|student_attendance| StudentAttendance.new(student_attendance) }\n if @student_attendances.all?(&:valid?) \n @student_attendances.each(&:save!) # ref: to retrieve each value of @exammarks --> http://railsforum.com/viewtopic.php?id=11557 (Dazen2 007-10-07 05:27:42) \n #flash[:notice] = 'Successfully saved all records'\n #params[:student_attendance_ids] = [82,83,84,85,86,87] -testing OK\n flash[:notice] = I18n.t('student_attendance.confirm_complete_attendance')\n params[:student_attendance_ids] = @student_attendances.map(&:id)\n render :action => \"edit_multiple_intake\"\n flash.discard\n else \n flash[:error] = 'Data supplied was invalid.'\n render :action => 'new'\n flash.discard\n end\n end\n end", "def create_attendances(course)\n if(course.enrollments.length > 0) \n course.enrollments.first.attendances.each() {|attendance|\n self.attendances.create(record_date: attendance.record_date)\n }\n end\n end", "def update_multiple\n submit_val = params[:applychange]\n @studentattendance_ids = params[:student_attendance_ids]\t\n @attends = params[:attends] \n @reasons = params[:reasons]\n @actions = params[:actions]\n @statuss = params[:statuss]\n @remarks = params[:remarks]\n @weeklytimetable_details_ids = params[:weeklytimetable_details_ids]\n @studentattendances = StudentAttendance.find(@studentattendance_ids) \n @studentattendances_group = @studentattendances.group_by{|x|x.student_id} \n \n if submit_val == I18n.t('student_attendance.apply_class_schedule')\n if @weeklytimetable_details_ids != nil\n @studentattendances_group.each do |student_id, studentattendances| \n studentattendances.each_with_index do |studentattendance, no|\n studentattendance.weeklytimetable_details_id = @weeklytimetable_details_ids[no.to_s]\n studentattendance.save\n end\n end\n end\n\n respond_to do |format|\n flash[:notice] = \"<b>#{(t 'student_attendance.class_schedule')}</b> #{(t 'student_attendance.selected_may_print')} <b>#{(t 'student_attendance.attendance_form')}</b>#{t('student_attendance.cw_date_timeslot')}<br>#{t('student_attendance.to_update')}<b>#{t('student_attendance.title').downcase}</b>#{t('student_attendance.check_uncheck_click')}<b>#{t('submit')}</b>.\"\n format.html {render :action => \"edit_multiple_intake\"}\n format.xml { head :ok }\n flash.discard\n end\n else\n #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n #start-for edit_multiple.html.erb--------\n if !@weeklytimetable_details_ids\n @next2 = 0\n @sa_sort_then_group = @studentattendances.sort_by{|y|y.student.name}.group_by{|x|x.student_id} \n @sa_sort_then_group.each do |student_id, studentattendances| \n studentattendances.sort_by{|u|u.weeklytimetable_detail.get_time_slot}.each_with_index do |studentattendance, no2|\n if @attends && @attends[(no2+@next2).to_s]!=nil\n studentattendance.attend = true\n else\n studentattendance.attend = false\n if @reasons && @reasons[(no2+@next2).to_s] != nil\n studentattendance.reason = @reasons[(no2+@next2).to_s]\n studentattendance.action = @actions[(no2+@next2).to_s]\n studentattendance.status = @statuss[(no2+@next2).to_s]\n studentattendance.remark = @remarks[(no2+@next2).to_s]\n end\n end\n studentattendance.save \n if no2 == studentattendances.count-1 #2 \n @next2 = @next2+no2+1 \n end\n end \n end\n end\n #end-for edit_multiple.html.erb--------\n #start-for edit_multiple_intake.html.erb--------\n @next = 0\n if @weeklytimetable_details_ids != nil\n @studentattendances_group.each do |student_id, studentattendances| \n studentattendances.each_with_index do |studentattendance, no|\n studentattendance.weeklytimetable_details_id = @weeklytimetable_details_ids[no.to_s]\n if @attends && @attends[(no+@next).to_s]!=nil #if @attends && @attends[no.to_s]!=nil\n studentattendance.attend = true\n else\n studentattendance.attend = false\n end\n studentattendance.save \n if no == studentattendances.count-1 #2 \n @next = @next+no+1 \n end \n end\n end\n end\n #end-for edit_multiple_intake.html.erb--------\n \n flash[:notice] = I18n.t('student_attendance.updated_attendance')\n redirect_to student_attendances_path\n #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n end\n end", "def create\n\n student_totals_asc = StudentTotal.all.order('date ASC')\n student_totals_desc = StudentTotal.all.order('date DESC')\n\n start_date = Date.parse params[:date]\n total_at_year_start = 0\n total_at_year_end = student_totals_asc.last.lives_improved\n\n student_totals_asc.each do |i|\n if i.date < start_date\n total_at_year_start = i.lives_improved\n end\n end\n\n student_totals_desc.each do |i|\n if i.date > start_date\n total_at_year_end = i.lives_improved\n end\n end\n\n extra_months_total = (total_at_year_end - total_at_year_start) * (start_date.month / 12.0)\n\n @person_lives_improved = student_totals_asc.last.lives_improved - (total_at_year_start + extra_months_total)\n\n end", "def attendance_params\n params.require(:attendance).permit(:user_id, :for_date, :in_time, :out_time, :forced_leave, :leave_granted, :hours_worked, :break_hours)\n end", "def attendance_entry_params\n params.require(:attendance_entry).permit(:first_name, :nickname, :last_name, :upi, :netid, :email, :college_name, :college_abbreviation, :class_year, :school, :telephone, :address, :event_id)\n end", "def investment_params\n params.require(:investment).permit(:month, :amount, :total_inv)\n end", "def attendance_collection\n attendance_table_rows = select_table(ATTENDANCE_TITLE, 1)\n\n attendance = attendance_table_rows.map do |attendee_row|\n attendance_builder(attendee_row)\n end\n\n {\n council: attendance.map(&:first),\n public_service: attendance.map(&:last).reject(&:empty?)\n }\n end", "def new\n hide_date_flag_array = []\n hide_date_flag_array = (current_user.hide_date_flag_array).split(' ').map(&:to_i)\n @hide_page_flag = 'N'\n if hide_date_flag_array.count > 0\n @hide_page_flag = 'Y'\n end\n @current_tab = \"neuropsyches\"\n @neuropsych = Neuropsych.new\n vgroup_id = params[:id]\n @vgroup = Vgroup.find(vgroup_id)\n @enumbers = @vgroup.enrollments\n params[:new_appointment_vgroup_id] = vgroup_id\n @appointment = Appointment.new\n @appointment.vgroup_id = vgroup_id\n @appointment.appointment_date = (Vgroup.find(vgroup_id)).vgroup_date\n @appointment.appointment_type ='blood_draw'\n # @appointment.save --- save in create step\n @neuropsych.appointment_id = @appointment.id\n sp_list = @vgroup.scan_procedures.collect {|sp| sp.id}.join(\",\")\n sp_array =[]\n sp_array = sp_list.split(',').map(&:to_i)\n\n @q_forms = Questionform.where(\"current_tab in (?)\",@current_tab).where(\"status_flag in (?)\",\"Y\").where(\"questionforms.id not in (select questionform_id from questionform_scan_procedures)\n or (questionforms.id in \n (select questionform_id from questionform_scan_procedures where include_exclude ='include' and scan_procedure_id in (\"+sp_array.join(',')+\"))\n and\n questionforms.id not in \n (select questionform_id from questionform_scan_procedures where include_exclude ='exclude' and scan_procedure_id in (\"+sp_array.join(',')+\")))\")\n \n @q_form_default = @q_forms.where(\"tab_default_yn='Y'\")\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @neuropsych }\n end\n end", "def calendar\n\t\t@course = Course.find(params[:id])\n\t\t@date = params[:month] ? Date.parse(params[:month]) : Date.today\n\t\t@assignments = @course.assignments.where(\"due_date\")\n\tend", "def index\n if params[:commit] == '검색'\n if !params[:search].blank?\n @admin_contracts = Contract.search_by_user_type(params[:search], params[:category])\n elsif !(params[:start_date].blank? && params[:end_date].blank?)\n @admin_contracts = Contract.where('manage_start_at > ? AND manage_start_at <= ?', params[:start_date], params[:end_date])\n elsif !params[:step].blank?\n case params[:step]\n when \"1\"\n @admin_contracts = Contract.with_hospital\n when \"2\"\n @admin_contracts = Contract.with_studio\n end\n\n else\n @admin_contracts = Contract.all\n end\n\n else\n @admin_contracts = Contract.all\n end\n\n end", "def fetch_attendance\n Attendance.where(:course_id => teaching.course.id, :enrollment_id => enrollments).order(:attendance_date).group_by(&:attendance_date)\n end", "def attendance_params\n params.require(:attendance).permit(:student_id, :event_id, :comment)\n end", "def index\n @attendances = current_company.attendances.where.not(work_stopped_at: nil).page(params[:page]).per(20).reverse_order\n @attendances_for_csv = current_company.attendances.all\n end", "def show_measures_form\n\t\t@ocde_id = params[:ocde_id]\n\t\t@subgroup_id = params[:subgroup_id]\n\t\t@project_id = params[:project_id]\n\t\tocde = OutcomeDataEntry.find(@ocde_id)\n\t\t@timepoint_id = params[:timepoint_id]\n\t\toutcome_type = params[:outcome_type]\n\t\toutcome_type = outcome_type == \"Time to Event\" ? \"survival\" : outcome_type\n\t\tif @project_id == 427 || @project_id == 553\n\t\t\t@all_measures = DefaultCevgMeasure.find(:all, :conditions=>[\"outcome_type = ? AND results_type=?\",outcome_type, 0])\n\t\telse\n\t\t\t@all_measures = DefaultOutcomeMeasure.find(:all,:conditions=>[\"outcome_type = ? AND measure_type <> ?\", outcome_type.downcase, 0])\t\t\n\t\tend\n\t\t@selected_measures = ocde.get_measures(outcome_type)\n\t\t@all_user_defined_measures = ocde.get_all_user_defined_measures\n\t\t@selected_timepoints = params[:selected_timepoints] #indicates the timepoint in the dropdown\n\t\t@show_measures_for = \"Outcome\"\n\tend", "def pain_assessment_params\n params.require(:pain_assessment).permit(:date, :business_id, :author_id, :resident_id)\n end", "def show\n @vaccines = Vaccine.where(:emp_id => @employee.employee_id)\n @diseases = Disease.where(:emp_id => @employee.employee_id)\n if(@employee.have_exam == \"true\" && @employee.department == \"Warehouse\" && (@employee.emp_date-2.day).month == Date.today.month && (@employee.emp_date-2.day).day == Date.today.day)\n @medical_exams = \"Enzyme, Respiratory, PFT\"\n end\n if(@employee.have_exam == \"true\" && @employee.department == \"Fabric Care\" && (@employee.emp_date-2.day).month == Date.today.month && (@employee.emp_date-2.day).day == Date.today.day)\n @medical_exams = \"Hearing, Enzyme, Respiratory, PFT, Chest Xray\"\n end\n if(@employee.have_exam == \"true\" && @employee.department == \"FemCare\" && (@employee.emp_date-2.day).month == Date.today.month && (@employee.emp_date-2.day).day == Date.today.day && ((@employee.emp_date-2.day).year == Date.today.year-1 || (@employee.emp_date-2.day).year == Date.today.year-2 || (@employee.emp_date-2.day).year == Date.today.year-3)) \n @medical_exams = \"PFT\"\n end\n if(@employee.have_exam == \"true\" && @employee.department == \"FemCare\" && (@employee.emp_date-2.day).month == Date.today.month && (@employee.emp_date-2.day).day == Date.today.day && ((@employee.emp_date-2.day).year%2 == Date.today.year%2))\n @medical_exams = \"Respiratory\"\n end\n if(@employee.have_exam == \"true\" && @employee.department == \"FemCare\" && (@employee.emp_date-2.day).month == Date.today.month && (@employee.emp_date-2.day).day == Date.today.day && ((@employee.emp_date).year+10 == Date.today.year || ((Date.today.year-(@employee.emp_date-2.day).year)%5==0 && Date.today.year > (@employee.emp_date-2.day).year+10)))\n @medical_exams = \"Chest Xray\"\n end\n if(@employee.have_exam == \"true\" && (@employee.deptType == \"Bar Soap\" || @employee.department == \"Home Care\") && (@employee.emp_date-2.day).month == Date.today.month && (@employee.emp_date-2.day).day == Date.today.day)\n @medical_exams = \"Hearing\"\n end\n if(@employee.have_exam == \"true\" && @employee.special == \"FirstAid\" && (@employee.emp_date-2.day).month == Date.today.month && (@employee.emp_date-2.day).day == Date.today.day)\n @medical_exams = \"Hearing, Enzyme, Respiratory, PFT, General Examination & Fitness\"\n end\n if(@employee.have_exam == \"true\" && @employee.special == \"FirstAid\" && (@employee.emp_date-2.day).month == Date.today.month && (@employee.emp_date-2.day).day == Date.today.day && (( (Date.today.year - (@employee.emp_date-2.day).year == 20) || Date.today.year - (@employee.emp_date-2.day).year == 25 || Date.today.year - (@employee.emp_date-2.day).year == 30 || Date.today.year - (@employee.emp_date-2.day).year == 33 || Date.today.year - (@employee.emp_date-2.day).year == 36 || Date.today.year - (@employee.emp_date-2.day).year == 39 || Date.today.year - (@employee.emp_date-2.day).year >= 40)))\n @medical_exams = \"ECG\"\n end\n\n\n end", "def export\n @paystub = Paystub.find(params[:id])\n name = \"#{@paystub.doctor.lname}_#{Date::MONTHNAMES[@paystub.month]}_#{@paystub.year}\"\n @sdate = Date.new(@paystub.year, @paystub.month)\n @edate = 1.month.since(@sdate)\n\n @claims = Claim.joins(:services).where(provider_no: @paystub.doctor.provider_no).where(date_paid: (@sdate..@edate)).group('services.svc_date,pmt_pgm').pluck(:svc_date,Arel.sql('count(distinct claims.id),count(*), pmt_pgm, SUM(amt_subm)/100.0, SUM(amt_paid)/100.0'))\n\n @paystub.update_attribute(:filename, name+'.pdf')\n\n pdf = build_paystub( @paystub,@claims )\n pdf.render_file @paystub.filespec\n redirect_to paystubs_path, alert: \"New paystub created for Dr. #{@paystub.doctor.lname}\"\n end", "def emp_report\n \n end", "def index\n \t@veterinary_appointments = VeterinaryAppointment.where(\"status = 0 \") \n \t@date = params[:month] ? Date.parse(params[:month]) : Date.today\n \t@veterinary_appointment = VeterinaryAppointment.new\n end", "def bulk_attendance_params\n params.require(:bulk_attendance).permit(:title, :date, { :attendees => [] }, :desc)\n end", "def absence_params\n params.permit(:status, :justif, :date, :student_id, :cour_id)\n end", "def summit_params\n params.require(:summit).permit(:name, :deadline, :application_link, :location_city, :location_state, :location_country, :language, :date_start, :date_end, :cost, :currency, :fields, :idea_stage, :planning_stage, :implementation_stage, :operating_stage, :description, :requirements, :contact_website, :contact_email, :admin_email, :admin_url)\n end", "def create\n @absence = AttendanceRecord.find(params[:excuse][:attendance_record_id])\n @excuse = Excuse.new(excuse_params)\n @excuse.attendance_record = @absence\n @excuse.save\n redirect_to excuses_my_absences_path\n end", "def caloric_params\n params.require(:caloric).permit(:date, :number)\n end", "def admission_params\n params.require(:admission).permit(:startdate, :enddate, :sclass_id, :subject_id, :totalfee, :feestructure).merge(user_id: current_user.id)\n end", "def contract_saved contract\n\t\t@contract = contract\n\t\t@semesters = @contract.semesters\n\t\t# Prices\n\t\t@application_fee = Prices::application_fee\n\t\t@deposit = Prices::deposit(@semesters)\n\t\t@early_bird = Prices::early_bird(@semesters, Date.today)\n\t\t@rent = Prices::rent(@semesters)\n\t\t@parking = Prices::parking_price(@contract.parking_type, @semesters)\n\t\t@multiple_semesters = Prices::multiple_semester_discounts @semesters\n\n\t\t# Calculations\n\t\t@parking_price = 0\n\t\t@parking.each do |park|\n\t\t\t@parking_price += park\n\t\tend\n\t\t@early_bird_sum = 0\n\t\t@early_bird.each do |early|\n\t\t\t@early_bird_sum += early\n\t\tend\n\t\t@multiple_semesters_sum = 0\n\t\t@multiple_semesters.each do |discount|\n\t\t\t@multiple_semesters_sum += discount\n\t\tend\n\n\t\t@euro = 0\n\t\t@euro = 50 unless @contract.euro.empty?\n\t\t@discounts_total = @early_bird_sum + @multiple_semesters_sum + @euro\n\n\t\t@rent_sum = 0\n\t\t@rent.each do |rent|\n\t\t\t@rent_sum += rent\n\t\tend\n\t\t@total = @application_fee + @deposit + @rent_sum + @parking_price - @discounts_total\n\n\t\tmail to: ['managers@windsormanor.net', @contract.email],\n\t\t\tsubject: 'Your Receipt for Windsor Manor'\n\tend", "def add_by_session\n @date = Date.parse(params[\"date\"])\n Session.for_day(@date.cwday).each do |session|\n params[\"attendance_#{session.id}\"].each do |attendance|\n count = attendance[\"count\"].to_i\n a = Attendance.where(date: @date, person_id: attendance[\"person\"], session: session).first_or_initialize\n if count > 0\n a.count = count\n a.style = session.style\n a.save\n elsif a.count\n # remove the old attendance entry, don't want any with class count of zero\n a.delete\n end\n end\n end\n flash[:notice] = 'Attendance Saved'\n render :index\n end", "def index\n @from_date = Date.today\n @to_date = Date.today\n \n ### late comers for today\n @late_attendances = Attendance.where(forced_leave: true, for_date: DateTime.now.to_date).order(:in_time).page params[:page]\n \n ### late comers for today\n @today_attendances = Attendance.where(for_date: DateTime.now.to_date).order(:in_time).page params[:page]\n \n ### late comers for today\n @habitual_late_comers = User.joins(:attendance).group(\"users.id\").having(\"count(attendances.forced_leave) > ?\",5)\n # params[:page]\n \n if (params.has_key?(:from) && params.has_key?(:upto))\n @from_date = Date.new(params[:from][:year].to_i, params[:from][:month].to_i,params[:from][:day].to_i) \n @to_date = Date.new(params[:upto][:year].to_i, params[:upto][:month].to_i, params[:upto][:day].to_i)\n @attendances = Attendance.where(\"for_date >= ? and for_date <= ?\", @from_date, @to_date)\n .order(:in_time).page params[:page]\n else\n @attendances = Attendance.all.order(:in_time).page params[:page]\n end\n \n end", "def create\r\n @account_plan = AccountPlan.new(account_plan_params)\r\n \r\n \r\n\r\n respond_to do |format|\r\n if @account_plan.save\r\n @name3=@account_plan.id\r\n ##########################################################################################################\r\n @anho=AccountingYear.find_by_sql(\"SELECT accounting_years.estado AS estado from accounting_years where accounting_years.account_plan_id='#{@name3}'\") \r\n @anho.each do |a|\r\n if a.estado == \"Vigente\" \r\n @asiento=AccountingEntry.new\r\n @detalle_asiento=AccountXEntry.new\r\n @asiento.numero=1\r\n @asiento.fecha=Time.now.strftime(\"%d-%m-%Y\")\r\n @asiento.iva=10\r\n @asiento.debe=0\r\n @asiento.auto=0\r\n @asiento.haber=0\r\n @asiento.save\r\n @detalle_asiento.monto=0\r\n @detalle_asiento.observacion=\"Apertura Ejercicio\"\r\n @detalle_asiento.account=\"Caja\"\r\n @detalle_asiento.accounting_entry_id=@asiento.id\r\n @detalle_asiento.accounting_account_id=2\r\n @detalle_asiento.tipo= \"D\"\r\n @detalle_asiento.save\r\n\r\n @asiento=AccountingEntry.new\r\n @detalle_asiento=AccountXEntry.new\r\n @asiento.numero=1\r\n @asiento.fecha=Time.now.strftime(\"%d-%m-%Y\")\r\n @asiento.iva=10\r\n @asiento.debe=0\r\n @asiento.auto=0\r\n @asiento.haber=0\r\n @asiento.save\r\n @detalle_asiento.monto=0\r\n @detalle_asiento.observacion=\"Apertura Ejercicio\"\r\n @detalle_asiento.account=\"Equipo de oficina\"\r\n @detalle_asiento.accounting_entry_id=@asiento.id\r\n @detalle_asiento.accounting_account_id=3\r\n @detalle_asiento.tipo= \"D\"\r\n @detalle_asiento.save\r\n\r\n @asiento=AccountingEntry.new\r\n @detalle_asiento=AccountXEntry.new\r\n @asiento.numero=1\r\n @asiento.fecha=Time.now.strftime(\"%d-%m-%Y\")\r\n @asiento.iva=0\r\n @asiento.debe=0\r\n @asiento.auto=0\r\n @asiento.haber=0\r\n @asiento.save\r\n @detalle_asiento.monto=0\r\n @detalle_asiento.observacion=\"Apertura Ejercicio\"\r\n @detalle_asiento.account=\"Banco\"\r\n @detalle_asiento.accounting_entry_id=@asiento.id\r\n @detalle_asiento.accounting_account_id=4\r\n @detalle_asiento.tipo= \"D\"\r\n @detalle_asiento.save\r\n\r\n @asiento=AccountingEntry.new\r\n @detalle_asiento=AccountXEntry.new\r\n @asiento.numero=1\r\n @asiento.fecha=Time.now.strftime(\"%d-%m-%Y\")\r\n @asiento.iva=10\r\n @asiento.debe=0\r\n @asiento.auto=0\r\n @asiento.save\r\n @detalle_asiento.monto=0\r\n @detalle_asiento.observacion=\"Acreedores\"\r\n @detalle_asiento.account=\"Proveedores\"\r\n @detalle_asiento.accounting_entry_id=@asiento.id\r\n @detalle_asiento.accounting_account_id=6\r\n @detalle_asiento.tipo= \"A\"\r\n @detalle_asiento.save\r\n\r\n @asiento=AccountingEntry.new\r\n @detalle_asiento=AccountXEntry.new\r\n @asiento.numero=1\r\n @asiento.fecha=Time.now.strftime(\"%d-%m-%Y\")\r\n @asiento.iva=10\r\n @asiento.debe=0\r\n @asiento.auto=0\r\n @asiento.haber=0\r\n @asiento.save\r\n @detalle_asiento.monto=0\r\n @detalle_asiento.observacion=\"Acreedores\"\r\n @detalle_asiento.account=\"Capital personas\"\r\n @detalle_asiento.accounting_entry_id=@asiento.id\r\n @detalle_asiento.accounting_account_id=7\r\n @detalle_asiento.tipo= \"A\"\r\n @detalle_asiento.save\r\n end\r\n end \r\n##########################################################################################################\r\n format.html { redirect_to account_plans_path, notice: 'El plan ha sido agregado con exito' }\r\n format.json { render :show, status: :created, location: @account_plan }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @account_plan.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def admin_aircraft_report\n return unless has_permission :can_do_billing\n @page_title = \"Billing Report\"\n @earliest = FlightRecord.find(:first, :order => \"flight_date\")\n if @earliest.nil? or params[:date].nil? then return end\n\n @start_date = Time.local(params[:date][:year].to_i, params[:date][:month].to_i)\n @end_date = @start_date.months_since params[:date][:range].to_i \n @page_title = \"Billing Report for \" + @start_date.strftime(\"%b %Y\") + \" to \" + @end_date.strftime(\"%b %Y\")\n\n @solo = FlightRecord.sum('hobbs_end-hobbs_start',:group=>:aircraft,\n :conditions=>['aircraft_id is not NULL and instructor_id is NULL and flight_date>=? and flight_date<?',@start_date,@end_date])\n @dual = FlightRecord.sum('hobbs_end-hobbs_start',:group=>:aircraft,\n :conditions=>['aircraft_id is not NULL and instructor_id is not NULL and flight_date>=? and flight_date<?',@start_date,@end_date])\n @charges = FlightRecord.sum('charge_amount',:group=>:aircraft,\n :conditions=>['aircraft_id is not NULL and flight_date>=? and flight_date<?',@start_date,@end_date])\n @aircrafts = Aircraft.find(:all,:conditions=>['deleted=false'],:order=>'identifier')\n \n @solo_total = @solo.inject(0){|s,e| s = s + e[1].to_f}\n @dual_total = @dual.inject(0){|s,e| s = s + e[1].to_f}\n @time_total = @solo_total + @dual_total\n @charges_total = @charges.inject(0){|s,e| s = s + e[1].to_f} \nend", "def update\r\n respond_to do |format|\r\n if @account_plan.update(account_plan_params)\r\n @name3=@account_plan.id\r\n ##########################################################################################################\r\n @anho=AccountingYear.find_by_sql(\"SELECT accounting_years.estado AS estado from accounting_years where accounting_years.account_plan_id='#{@name3}'\") \r\n @anho.each do |a|\r\n if a.estado == \"Vigente\" \r\n @asiento=AccountingEntry.new\r\n @detalle_asiento=AccountXEntry.new\r\n @asiento.numero=1\r\n @asiento.fecha=Time.now.strftime(\"%d-%m-%Y\")\r\n @asiento.iva=10\r\n @asiento.debe=0\r\n @asiento.auto=0\r\n @asiento.haber=0\r\n @asiento.save\r\n @detalle_asiento.monto=0\r\n @detalle_asiento.observacion=\"Apertura Ejercicio\"\r\n @detalle_asiento.account=\"Caja\"\r\n @detalle_asiento.accounting_entry_id=@asiento.id\r\n @detalle_asiento.accounting_account_id=2\r\n @detalle_asiento.tipo= \"D\"\r\n @detalle_asiento.save\r\n\r\n @asiento=AccountingEntry.new\r\n @detalle_asiento=AccountXEntry.new\r\n @asiento.numero=1\r\n @asiento.fecha=Time.now.strftime(\"%d-%m-%Y\")\r\n @asiento.iva=10\r\n @asiento.debe=0\r\n @asiento.auto=0\r\n @asiento.haber=0\r\n @asiento.save\r\n @detalle_asiento.monto=0\r\n @detalle_asiento.observacion=\"Apertura Ejercicio\"\r\n @detalle_asiento.account=\"Equipo de oficina\"\r\n @detalle_asiento.accounting_entry_id=@asiento.id\r\n @detalle_asiento.accounting_account_id=3\r\n @detalle_asiento.tipo= \"D\"\r\n @detalle_asiento.save\r\n\r\n @asiento=AccountingEntry.new\r\n @detalle_asiento=AccountXEntry.new\r\n @asiento.numero=1\r\n @asiento.fecha=Time.now.strftime(\"%d-%m-%Y\")\r\n @asiento.iva=10\r\n @asiento.debe=0\r\n @asiento.haber=0\r\n @asiento.auto=0\r\n @asiento.save\r\n @detalle_asiento.monto=0\r\n @detalle_asiento.observacion=\"Apertura Ejercicio\"\r\n @detalle_asiento.account=\"Banco\"\r\n @detalle_asiento.accounting_entry_id=@asiento.id\r\n @detalle_asiento.accounting_account_id=4\r\n @detalle_asiento.tipo= \"D\"\r\n @detalle_asiento.save\r\n\r\n @asiento=AccountingEntry.new\r\n @detalle_asiento=AccountXEntry.new\r\n @asiento.numero=1\r\n @asiento.fecha=Time.now.strftime(\"%d-%m-%Y\")\r\n @asiento.iva=10\r\n @asiento.debe=0\r\n @asiento.auto=0\r\n @asiento.save\r\n @detalle_asiento.monto=0\r\n @detalle_asiento.observacion=\"Acreedores\"\r\n @detalle_asiento.account=\"Proveedores\"\r\n @detalle_asiento.accounting_entry_id=@asiento.id\r\n @detalle_asiento.accounting_account_id=6\r\n @detalle_asiento.tipo= \"A\"\r\n @detalle_asiento.save\r\n\r\n @asiento=AccountingEntry.new\r\n @detalle_asiento=AccountXEntry.new\r\n @asiento.numero=1\r\n @asiento.fecha=Time.now.strftime(\"%d-%m-%Y\")\r\n @asiento.iva=10\r\n @asiento.debe=0\r\n @asiento.auto=0\r\n @asiento.haber=0\r\n @asiento.save\r\n @detalle_asiento.monto=0\r\n @detalle_asiento.observacion=\"Acreedores\"\r\n @detalle_asiento.account=\"Capital personas\"\r\n @detalle_asiento.accounting_entry_id=@asiento.id\r\n @detalle_asiento.accounting_account_id=7\r\n @detalle_asiento.tipo= \"A\"\r\n @detalle_asiento.save\r\n end\r\n end \r\n format.html { redirect_to account_plans_path, notice: 'El plan de cuentas ha sido actualizado.' }\r\n format.json { render :show, status: :ok, location: @account_plan }\r\n\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @account_plan.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def index\n @event_attendances = EventAttendance.all\n end", "def course_wise_collection_report\n if validate_date\n\n filter_by_account, account_id = account_filter\n\n if filter_by_account\n ft_joins = [{:finance_transactions => :finance_transaction_receipt_record}]\n filter_conditions = \"AND finance_transaction_receipt_records.fee_account_id #{account_id == nil ? 'IS' : '='} ?\"\n filter_values = [account_id]\n filter_select = \", finance_transaction_receipt_records.fee_account_id AS account_id\"\n else\n ft_joins = [:finance_transactions]\n filter_conditions = \"\"\n filter_values = []\n filter_select = \"\"\n end\n\n @fee_collection = FinanceFeeCollection.find(params[:id])\n @target_action = \"course_wise_collection_report\"\n @grand_total = FinanceFee.all(:select => \"amount #{filter_select}\", :joins => ft_joins,\n :conditions => [\"(finance_transactions.transaction_date BETWEEN ? AND ?) AND\n finance_fees.fee_collection_id = ? #{filter_conditions}\",\n @start_date.to_s, @end_date.to_s, params[:id]] + filter_values).map { |x| x.amount.to_f }.sum\n\n @course_ids = FinanceFee.paginate(:page => params[:page], :per_page => 10,\n :joins => [{:batch => :course}, ft_joins],\n :conditions => [\"(finance_transactions.transaction_date BETWEEN ? AND ?) AND\n finance_fees.fee_collection_id = ? #{filter_conditions}\",\n @start_date, @end_date, params[:id]] + filter_values,\n :group => \"finance_fees.batch_id\",\n :select => \"SUM(finance_transactions.amount) AS amount,courses.course_name AS course_name,\n courses.id AS course_id,batches.id AS batch_id,batches.name AS batch_name,\n finance_fees.batch_id AS batch_fees_id #{filter_select}\")\n @grouped_course_ids = @course_ids.group_by(&:course_id)\n\n if request.xhr?\n render(:update) do |page|\n page.replace_html \"fee_report_div\", :partial => \"course_wise_collection_report_partial\"\n end\n end\n else\n render_date_error_partial\n end\n end", "def save\n response = send_calendar_request(\"/\", :post, {:summary => @summary}.to_json) \n update_after_save(response)\n end", "def calorie_consumption_params\n params.require(:calorie_consumption).permit(:name, :amount, :date)\n end", "def update\n monthly = flash[:monthly]\n @attendance = monthly.attendances.find(params[:id])\n\n respond_to do |format|\n if @attendance.update_attributes(params[:attendance])\n format.html { redirect_to :action => 'index', :monthly_id => monthly.id }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @attendance.errors, status: :unprocessable_entity }\n end\n end\n end", "def monthly_income_params\n params.require(:monthly_income).permit(:contact_form_id, :year, :month, :date, :total, :main, :extra)\n end", "def attendance_params\n params.require(:attendance).permit(:student_id, :lesson_id, :created_at, :updated_at)\n end", "def idsr_monthly_report_summary\n date = params[:year_month].split('-')\n @start_date = Date.new(date[0].to_i,date[1].to_i)\n\n @end_date = @start_date + 1.month - 1.day\n @disaggregated_diagnosis = {}\n\n idsr_monthly_set = ConceptName.where([\"name IN (?)\",[\"Idsr Monthly Summary\"]]).map(&:concept_id)\n\n\n idsr_monthly_set_members = ConceptSet.where([\"concept_set IN (?)\",idsr_monthly_set]).map(&:concept_id)\n\n concept_ids = ConceptName.where([\"concept_name.concept_id IN (?)\",\n idsr_monthly_set_members]).map(&:concept_id)\n\n observation = Observation.where([\"obs.obs_datetime >= ? AND obs.obs_datetime <= ?\n AND obs.value_coded IN (?)\",@start_date, @end_date,concept_ids]).includes({:person=>{}})\n\n observation.each do | obs|\n next if obs.person.blank?\n next if obs.answer_concept.blank?\n previous_date = obs.obs_datetime.strftime('%Y-%m-%d').to_date\n sex = obs.person.gender\n age = PatientService.age(obs.person, previous_date)\n diagnosis_name = obs.answer_concept.fullname rescue ''\n\n @disaggregated_diagnosis[diagnosis_name]={\n \"=<4\" =>0,\n \"=>5\" =>0\n }\n\n # if @disaggregated_diagnosis[diagnosis_name] != nil\n if age.to_i < 5\n @disaggregated_diagnosis[diagnosis_name][\"=<4\"]+=1\n else\n @disaggregated_diagnosis[diagnosis_name][\"=>5\"]+=1\n end\n # end\n # end\n @diaggregated_paginated = []\n @disaggregated_diagnosis.each { | diag, value |\n @diaggregated_paginated << [diag, value]\n }\n end\n #raise @diaggregated_paginated.inspect\n render :json=> @diaggregated_paginated\n end", "def attendance_params\n params.require(:attendance).permit(:id, :user, :event)\n end", "def accounting_report_params\n params.require(:accounting_report).permit(:committee_id, :type, :period_start, :period_end, :ammendment, :cash_year_start, :cash_period_start, :contributions_itemized, :contributions_itemized_ytd, :contributions_unitemized, :contributions_unitemized_ytd, :expenditures_itemized, :expenditures_unitemized, :expenditures_itemized_ytd, :expenditures_unitemized_ytd, :debts_owed_to, :debts_owed_by, :signed_at, :source_url)\n end", "def et_report_params\n params.require(:et_report).permit(:reporting_date, :student_class, :student_number, :student_id, :job_category, :office_name, :job_vote_number, :introduction_number, :test_day, :postal_code, :street_address, :examination_hall, :examinees_count_man, :examinees_count_woman, :selection_method, :s_method_writing, :s_method_appropriate, :s_method_interview, :s_method_composition, :s_method_physical, :s_method_other, :t_subject_japanese, :t_subject_math, :t_subject_society, :t_subject_science, :t_subject_english, :t_subject_other_name, :t_subject_other_time, :t_subject_general, :t_subject_aptitude, :i_method_one, :i_method_count, :judge_count, :i_time, :i_other, :i_contents, :i_image, :composition_title, :c_sheet_count, :writing_test_contents, :other_coment,:approval_flg)\n end", "def claim_datum_params\n params.require(:claim_datum).permit(:provider_full_name, :provider_id, :date_of_service, :client_full_name, :service, :duration)\n end", "def dashboard\n if signed_in?\n \t @provider = current_provider\n else\n redirect_to root_url\n end\n \n @pending_appointments = @provider.appointments.where(\"accepted = 0\").where(['time_start >= ?', DateTime.now]).order(\"time_start asc\")\n @confirmed_appointments = @provider.appointments.where(\"accepted = 1\").where(['time_start >= ?', DateTime.now]).order(\"time_start asc\")\n @past_appointments = @provider.appointments.where(['time_start < ?', DateTime.now]).order(\"time_start desc\")\n @denied_appointments = @provider.appointments.where(\"accepted = 2\").where(['time_start >= ?', DateTime.now]).order(\"time_start desc\")\n \n require 'date'\n end", "def update_attendance\n unless params[:attendees_ids].blank?\n EventAttendee.update_event_invitee_presence(params[:event_id],params[:attendees_ids])\n EventAttendee.update_event_invitee_absence(params[:event_id],params[:attendees_ids])\n else\n EventAttendee.update_all_event_invitee_absence(params[:event_id])\n end\n flash[:notice] = \"The attendance of the members for the Event '#{params[:event_name]}' has been updated successfully.\"\n redirect_to \"/events/attendees_list?event_id=#{params[:event_id]}\"\n end", "def attendance_record_params\n params.require(:attendance_record).permit(:student_id, :section_id,\n :attendance_date, :primary, :secondary )\n end", "def show\n @att_data = @attendance.att_data\n end", "def format_self_submit_attendance(user)\n if object.self_submit_attendance\n attendance = Attendance.where(user_id: user.id, event_id: object.id)\n if attendance.count > 0\n if attendance.first.present == true\n 'You attended this event'\n else\n h.render partial: 'attendance/attendances/self_report',\n locals: { attendance: attendance.first }\n end\n end\n else\n 'You may not submit your own attendance for this event.'\n end\n end", "def show\n @events = Event.includes(:activities).where('activities.customer_id = ?', @customer.id).where('activities.attendance_type = 1').references(:activities)\n if params[:event_date_gteq].present? || params[:event_date_lteq].present?\n @q = @events.where('event_date >= :event_date_gteq AND event_date <= :event_date_lteq', event_date_gteq: params[:event_date_gteq], event_date_lteq: params[:event_date_lteq])\n @events = @q\n end\n respond_to do |format|\n format.html\n format.csv do\n send_data render_to_string(template: \"customers/show.csv.ruby\"), filename: \"customer_#{@customer.name}_rank#{@customer.rank}.csv\", type: :csv\n end\n end\n @advisor = Advisor.new\n @person = Person.find_by(customer_id: @customer.id)\n if @person.present?\n @existing_advisor = Advisor.find(@person&.advisor_id)\n if @existing_advisor.present?\n @advisor_id = @existing_advisor&.id\n end\n end\n end", "def assistance_params\n params.require(:assitance).permit(:date, :student, :email, :rut, :course)\n end", "def ee_report_params\n params.require(:ee_report).permit(:reporting_date, :student_class, :student_number, :student_id, :school_name, :s_faculty_name, :s_department_name, :s_course_name, :test_day, :postal_code, :street_address, :examination_hall, :result_publication_date, :entrance_form, :recommended_group,:t_subject_japanese,:t_subject_math,:t_subject_society,:t_subject_science,:t_subject_english,:t_subject_other,:t_subject_other_time,:g_q_contents,:g_q_image,:g_impressions,:recommended_form,:i_q_contents,:i_q_images,:e_contents,:w_contents,:r_impression,:approval_flg)\n end", "def multiple_dates_occupation_detail(month, year)\n\n date_from = Date.civil(year, month, 1)\n date_to = Date.civil(year, month, -1)\n result = {}\n\n # Get planned activities\n condition = Conditions::JoinComparison.new('$and',\n [Conditions::Comparison.new(:date,'$gte', date_from),\n Conditions::Comparison.new(:date,'$lte', date_to)\n ])\n planned_activities = condition.build_datamapper(::Yito::Model::Booking::PlannedActivity).all(\n :order => [:date, :time, :activity_code]\n )\n\n # Build the structure\n activities = ::Yito::Model::Booking::Activity.all(#:active => true,\n :occurence => :multiple_dates,\n 'activity_dates.date_from.gte'.to_sym => date_from,\n 'activity_dates.date_from.lte'.to_sym => date_to)\n\n activities.each do |activity|\n\n # Build item prices hash\n item_prices = {}\n if activity.number_of_item_price > 0\n (1..activity.number_of_item_price).each do |item_price|\n item_prices.store(item_price, 0)\n end\n end\n\n # Fill with the activity turns\n activity_detail = {}\n activity.multiple_dates_timetable.each do |turn|\n # Build days hash\n days = {}\n (1..(date_to.day)).each do |day|\n date = Date.civil(year, month, day)\n modified_capacity = planned_activities.select do |item|\n item.date.strftime('%Y-%m-%d') == date.strftime('%Y-%m-%d') and\n item.time == turn and\n item.activity_code == activity.code\n end\n real_capacity = modified_capacity.size > 0 ? modified_capacity.first.capacity : activity.capacity\n\n if activity.start_date?(date)\n days.store(day, {quantity: (item_prices.empty? ? 0 : item_prices.clone),\n pending_confirmation: (item_prices.empty? ? 0 : item_prices.clone),\n capacity: real_capacity,\n planned: true})\n else\n days.store(day, {quantity: '-',\n pending_confirmation: (item_prices.empty? ? 0 : item_prices.clone),\n capacity: real_capacity,\n planned: false})\n end\n end\n activity_detail.store(turn, days)\n end\n\n # Store the item\n result.store(activity.code, {name: activity.name,\n capacity: activity.capacity,\n price_literals: activity.price_definition_detail,\n number_of_item_price: activity.number_of_item_price,\n occupation: activity_detail})\n end\n\n sql =<<-SQL\n select o_i.item_id, o_i.date, o_i.time, o_i.item_price_type, CAST (o_i.status AS UNSIGNED) as status, sum(quantity) as quantity\n from orderds_order_items o_i\n join orderds_orders o on o.id = o_i.order_id\n join bookds_activities a on a.code = o_i.item_id \n where o.status NOT IN (3) and o_i.date >= ? and o_i.date <= ? and \n a.occurence IN (2)\n group by o_i.item_id, o_i.date, o_i.time, o_i.item_price_type, o_i.status\n SQL\n\n # Fill with the orders\n\n orders = repository.adapter.select(sql, date_from, date_to)\n\n orders.each do |order|\n if result[order.item_id] and\n result[order.item_id][:occupation] and\n result[order.item_id][:occupation][order.time] and\n result[order.item_id][:occupation][order.time][order.date.day] and\n result[order.item_id][:occupation][order.time][order.date.day][:quantity][order.item_price_type] and\n result[order.item_id][:occupation][order.time][order.date.day][:pending_confirmation][order.item_price_type]\n result[order.item_id][:occupation][order.time][order.date.day][:pending_confirmation][order.item_price_type] += order.quantity if order.status == 1\n result[order.item_id][:occupation][order.time][order.date.day][:quantity][order.item_price_type] += order.quantity if order.status == 2\n end\n end\n\n return result\n\n end", "def index\n @attendances = Attendance.all\n end", "def index\n @attendances = Attendance.all\n end", "def index\n @attendances = Attendance.all\n end", "def index\n @attendances = Attendance.all\n end", "def create\n respond_to do |format|\n year = params[:year]\n month = params[:month]\n day = params[:day]\n\n @key = get_cache(key: \"#{params['key']}-#{day}-#{month}-#{year}\")\n @enable_save = true\n if @key == nil\n #@enable_save = true\n else\n #if (DateTime.current.to_i - @key[\"id\"].to_i) < 10\n # @enable_save = false\n #else\n # @enable_save = true\n #end\n end\n\n format.html {\n mutex = Mutex.new\n mutex.synchronize do\n @doctor = Doctor.find_by_id(params['key'])\n quotum_doctor = QuotumDoctor.where(year: year, month: month, day: day, doctor: @doctor, status: Status.on).first\n records_accepted = Record.where(year: year, month: month, day: day, doctor: @doctor, flag: Flag.accepted)\n records_awaiting = Record.where(year: year, month: month, day: day, doctor: @doctor, flag: Flag.awaiting)\n @records = Record.where(year: year, month: month, day: day, doctor: @doctor, flag: Flag.accepted)\n @date_s = year + \"/\" + month + \"/\" + day\n @empty_records_count = quotum_doctor ? quotum_doctor.full - ((records_accepted ? records_accepted.count : 0) + (records_awaiting ? records_awaiting.count : 0)) : 0\n @external_records = []\n @internal_records = []\n @records.each do |record|\n if record.account.role == Role.receptionist\n @internal_records << record\n else\n @external_records << record\n end\n end\n save_cache(key: \"#{params['key']}-#{day}-#{month}-#{year}\", value: { id: DateTime.current.to_i }) if @enable_save\n end\n render partial: 'internal_records/edit_internal_records_for_selected_date'\n }\n format.json {\n account_receptionist = Account.find_by_id(Account::GENERAL_RECEPTIONIST_ID)\n parsed_json_records = ActiveSupport::JSON.decode(params[:records])\n doctor = Doctor.find_by_id(parsed_json_records['doctor'])\n day = parsed_json_records['day']\n month = parsed_json_records['month']\n year = parsed_json_records['year']\n\n Record.delete_all(year: year, month: month, day: day, doctor: doctor, account: account_receptionist)\n # records = Record.where(year: date.year, month: date.month, day: date.day, doctor: doctor)\n # records.each { |record| record.delete if record.account.role == Role.receptionist }\n parsed_json_records['list'].each do |record_hash|\n next if record_hash['write'].empty?\n record = Record.new\n record.account = account_receptionist\n record.surname = 'none'\n record.name = 'none'\n record.card = 'none'\n record.doctor = doctor\n record.description = record_hash['write']\n record.year = year\n record.month = month\n record.day = day\n record.flag = Flag.accepted\n record.save\n end\n delete_cache(key: \"#{params['key']}-#{day}-#{month}-#{year}\")\n\n render json: { status: \"Ok\" }\n }\n end\n end", "def new\n @attendance = Attendance.new\n @students = Student.order(\"lastname\").find(:all)\n @programs = Program.order(\"name\").find(:all)\n @levels = Level.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @attendance }\n end\n end", "def cashflow_params\n params.require(:cashflow).permit(:month, :year, :accounting_date, :name,:user_id, inflows_attributes:[ :id,:rationale,:follow_up,:bankaccount_id,:date_posted,:bank_record_date,:monthtitle_id,:yeartitle_id,:inflowtype_id, :person_id,:owner,\n :amount, :details, :flow_type, :user_id,:month,:year ,:_destroy], outflows_attributes:[:id,:rationale,:follow_up,:date_posted,:bankaccount_id,:bank_record_date,:monthtitle_id,:yeartitle_id,:outflowtype_id,:person_id,:owner,\n :amount, :details, :flow_type, :user_id,\n :month,:year ,:_destroy],\n comments_attributes:[:id, :commentary, :user_id, :_destroy])\n end", "def new\n\t\t@pagenumber=72\n\t\tsession[:current_time_entry] = nil\n\t\t@current_user = nil\n\t\t@time_entry = current_company.time_entries.new\n\t\t@expense_entry = Physical::Timeandexpenses::ExpenseEntry.new\n\t\tget_receiver_and_provider\n\t\t@time_entry.performer = @receiver\n\t\t@time_entry.created_by = @provider\n\t\t@expense_entry.performer = @receiver\n\t\t@expense_entry.created_by = @provider\n\t\tget_unexpired_matters(params[:time_entry_date],@receiver.id)\t\t\t\n\t\tget_all_contacts\n\t\tget_saved_entries\n\t\tget_expense_entries\n\n #Feature 11298\n #to get the time and expense entry for all status\n get_total_hours_for_all_status\n get_expense_details_for_status\n get_total_billable_time_amount_status\n @grand_total_open = @total_amount_open + @total_expenses_open\n @grand_total_approved = @total_amount_approved + @total_expenses_approved\n @grand_total_billed = @total_amount_billed + @total_expenses_billed\n @total_hours = @total_hours_open + @total_hours_approved + @total_hours_billed\n @total_amount = @total_amount_open + @total_amount_approved + @total_amount_billed\n @grand_total_expense = @total_expenses_open + @total_expenses_approved + @total_expenses_billed\n @grand_total = @grand_total_open + @grand_total_approved + @grand_total_billed\n\t\n\t\tadd_breadcrumb \"Time and Expense Entries\", :new_physical_timeandexpenses_time_and_expense_path\n\tend", "def summary_params\n params.require(:summary).permit(:sales, :services, :cash, :unpaid_bills, :bills_paid, :employees)\n end" ]
[ "0.60042334", "0.5828292", "0.5772841", "0.55618495", "0.55509925", "0.5535964", "0.5531104", "0.5491961", "0.5491161", "0.5480118", "0.5479395", "0.5452949", "0.5445107", "0.5437388", "0.53795683", "0.53760535", "0.5372274", "0.537032", "0.53569835", "0.5349649", "0.53265053", "0.53226423", "0.52886415", "0.5274293", "0.52716136", "0.52462447", "0.523556", "0.522721", "0.52251583", "0.52206665", "0.5217101", "0.5209024", "0.5206979", "0.5201094", "0.519661", "0.5193334", "0.5185242", "0.5181631", "0.51495606", "0.5139371", "0.5131257", "0.5105697", "0.5085063", "0.5072442", "0.50723284", "0.50632083", "0.5058297", "0.50483793", "0.50474536", "0.50467825", "0.504504", "0.50360173", "0.50331265", "0.5028509", "0.5028379", "0.50261337", "0.5023549", "0.5021855", "0.50217855", "0.50194997", "0.50182104", "0.50172305", "0.50043094", "0.5003515", "0.4996436", "0.49946696", "0.4989284", "0.49864727", "0.49851346", "0.49826494", "0.49815986", "0.49814975", "0.4981132", "0.49786264", "0.4961256", "0.49591145", "0.49553862", "0.4955025", "0.49531963", "0.49530935", "0.49495694", "0.49413872", "0.49358508", "0.4935719", "0.49338973", "0.4929276", "0.49276355", "0.49272186", "0.49258763", "0.49223417", "0.49182704", "0.49138612", "0.49094167", "0.49094167", "0.49094167", "0.49094167", "0.49059957", "0.49058995", "0.4905729", "0.4903236", "0.4898475" ]
0.0
-1
Did not know that ActiveRecord .where could accept a symbol
def all_tags=(names) self.tags = names.split(",").map do |name| Tag.where(name: name.strip).first_or_create! end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def special_character_records column_name\n @model_name.where(column_name.to_sym => SPECIAL_CHARACTER_LISTS)\n end", "def where_exp(input, variable, expression); end", "def where(*args, &b)\n set_parameters(args, false, &b)\n end", "def where!(args={})\n scope.where!(args)\n self\n end", "def where_clause\n \"\"\n end", "def where_sql\n named.or(taxon_name_named).to_sql\n end", "def query_symbols(query); end", "def query_symbols(query); end", "def where(field_name, operation)\n data_subject.df.where(data_subject.df[field_name.symbolize(data_subject.field_symbolizer)].recode { |v| operation.call(v) })\n end", "def filter_expr(expr)\n case expr\n when Hash\n SQL::BooleanExpression.from_value_pairs(expr)\n when Array\n if String === expr[0]\n filter_expr(expr.shift.gsub(QUESTION_MARK){literal(expr.shift)}.lit)\n else\n SQL::BooleanExpression.from_value_pairs(expr)\n end\n when Proc\n expr.to_sql(self).lit\n when SQL::NumericExpression, SQL::StringExpression\n raise(Error, \"Invalid SQL Expression type: #{expr.inspect}\") \n when Symbol, SQL::Expression\n expr\n when String\n \"(#{expr})\".lit\n else\n raise(Error, 'Invalid filter argument')\n end\n end", "def sanitize_params\n # @where[/\\w*=\\'(.*)\\'/].gsub(/\\'/, \"''\")\n # @where.sub!(/\\w*=\\'(.*)\\'/, { |s| puts s })\n end", "def to_sql_contains\n \"%#{to_sql_escaped_for_like}%\"\n end", "def where(input, property, value); end", "def default_where(klass)\n sql = ''\n arel_nodes = klass.scoped.with_default_scope.where_values.grep(Arel::Nodes::Equality)\n string_nodes = klass.scoped.with_default_scope.where_values.grep(String)\n\n unless arel_nodes.empty?\n sql += arel_nodes.inject(arel_nodes[0]) do |arel, equality|\n arel = arel.and(equality); arel\n end.to_sql\n end\n\n unless string_nodes.empty?\n sql += ' AND ' + string_nodes.map { |node| \"(#{node})\"}.join(' AND ')\n end\n\n sql\n end", "def criteria_from_string(sql) # :nodoc:\n XGen::SQL::Parser.parse_where(sql, true)\n end", "def query(keyword)\n return unless keyword\n\n where(\"title ILIKE '%?%'\", keyword)\n end", "def where_func(func) # :nodoc:\n func ? {:$where => func} : {}\n end", "def search_asqs_by_column(column_name, search_string)\n Asq.where(\"#{column_name} ~* ?\", \"(#{search_string.tr(' ', '|')})\")\n end", "def attr_predicate(symbol)\n define_method(\"#{symbol}?\") do\n ::ActiveRecord::ConnectionAdapters::Column.value_to_boolean(instance_variable_get(\"@#{symbol}\")) == true\n end\n end", "def search(passed_scope)\n passed_scope.where(\"#{condition_string}\", *parameters)\n end", "def results_query_where\n \"\"\n end", "def where(hash)\n scope = self\n hash.each { |key,value|\n scope = scope.filter(key, '=', value)\n }\n scope\n end", "def cost_query_where\n \"\"\n end", "def add_string_scopes(col)\n if self.column_names.include?(col.to_s)\n politely_add_named_scope :\"#{col}_contains\", lambda { |str| where( \"#{col} LIKE ?\", \"%#{str}%\" ) }\n politely_add_named_scope :\"#{col}_starts_with\", lambda { |str| where( \"#{col} LIKE ?\", \"#{str}%\" ) }\n politely_add_named_scope :\"#{col}_ends_with\", lambda { |str| where( \"#{col} LIKE ?\", \"%#{str}\" ) }\n politely_add_named_scope :\"#{col}_is\", lambda { |str| where( :\"#{col}\" => str ) }\n add_order_scopes(col)\n end\n end", "def scoped_name_is(name)\n name = SqlHelper::escapeWildcards(name)\n where do\n first_name.op('||', ' ').op('||', last_name).like(name) | \n first_name.op('||', last_name).like(name) \n end\n end", "def where(search, operator)\n\t\twhere_clause=[]\n\t\tfor i in 0..search.count-1\n\t\t\tif search.values[i].is_a? String\n\t\t\t\twhere_clause.push(\"#{search.keys[i]}#{operator}'#{search.values[i]}'\")\n\t\t\telse\n\t\t\t\twhere_clause.push(\"#{search.keys[i]}#{operator}#{search.values[i]}\")\n\t\t\tend\n\t\tend\n\t\twhere_clause = where_clause.join(\" AND \")\n\t\tresults = DATA.execute(\"SELECT * FROM #{@table} WHERE #{where_clause}\")\n\t\treturn results\n\tend", "def potential(sym)\n @sep_map.each_index.select { |i| @sep_map[i].from_all.include? sym }\n end", "def sql_wildcard\n \"%#{self}%\"\n end", "def k_where!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 53 )\n\n\n\n type = K_WHERE\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 465:4: 'where'\n match( \"where\" )\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__, 53 )\n\n\n end", "def where(*args)\n @rarray.where(*args)\n end", "def where_ignore_case(table, column, value, and_or=\"and\")\n if and_or == \"and\"\n and_exp(@builder.equal(@builder.lower(@alias[table].get(column)),value.downcase))\n else # or\n or_exp(@builder.equal(@builder.lower(@alias[table].get(column)),value.downcase))\n end\n self\n end", "def test_where_hash_relation\n params = ActionController::Parameters.new({store_id: {value: 10, boost: 2}})\n error = assert_raises(TypeError) do\n Product.search(\"product\").where(store_id: params[:store_id]).to_a\n end\n assert_equal error.message, \"can't cast ActionController::Parameters\"\n end", "def get(method_id_or_predicate)\n return nil unless where_key = @@wheres.keys.\n sort {|a,b| b.length <=> a.length}.\n detect {|n| method_id_or_predicate.to_s.match(/#{n}=?$/)}\n where = @@wheres[where_key]\n where = @@wheres[where] if where.is_a?(String)\n where\n end", "def select_by(how, what); end", "def where(column_name, column_id)\n results = CONNECTION.execute(\"SELECT * FROM #{table_name} WHERE #{column_name} = #{column_id};\")\n results_as_objects(results)\n end", "def add_string_scopes(col)\n if self.column_names.include?(col.to_s)\n politely_add_named_scope :\"#{col}_contains\", lambda { |str| { :conditions => [\"#{col} LIKE ?\", \"%#{str}%\"] } }\n politely_add_named_scope :\"#{col}_starts_with\", lambda { |str| { :conditions => [\"#{col} LIKE ?\", \"#{str}%\"] } }\n politely_add_named_scope :\"#{col}_ends_with\", lambda { |str| { :conditions => [\"#{col} LIKE ?\", \"%#{str}\"] } }\n politely_add_named_scope :\"#{col}_is\", lambda { |str| { :conditions => { :\"#{col}\" => str } } }\n add_order_scopes(col)\n end\n end", "def find_by(**args)\n where(**args).first\n end", "def searchby(criteria, value, lib)\r\n\t#clear unnecessary apostrophes, and return to int if that was the intention\r\n\tvalue = value.to_s.gsub(\"'\"){\"''\"}\r\n\t#run a sligtly different search if value.class = int...\r\n\tif value.to_i == 0\t\r\n\t\t#if value is a string, then we add '' around the value\r\n\t\treturn lib.execute(\"Select * from books join authors on books.author_id = authors.id WHERE #{criteria} = '#{value}'\")\r\n\telse#if value is a string, we pass it in without ''.\r\n\t\treturn lib.execute(\"Select * from books join authors on books.author_id = authors.id WHERE #{criteria} = #{value}\")\r\n\tend\r\n\r\nend", "def where_operator(field, operator, *args, **options)\n arel = arel_node(field).send(operator, *args, **options)\n where(arel)\n end", "def q(str)\n str.class == String ? ActiveRecord::Base.connection.quote_string(str) : str\n end", "def where(condition)\n repository.where(self, condition.stringify_keys)\n end", "def select(opts = {})\n return @data.select { |row| row[opts[:where]] =~ /#{opts[:like]}/ } if opts[:like]\n return @data.select { |row| row[opts[:where]] !~ /#{opts[:not_like]}/ } if opts[:not_like]\n\n @data.select { |row| row[opts[:where]] == opts[:equals] }\n end", "def where\n return [] unless has_where?\n if @options[:where].size == 2 and @options[:where][0].class == String\n return [ @options[:where] ]\n end\n @options[:where]\n end", "def resources_filter_matches(columns)\n return lambda do |v|\n conditions = Array.wrap(columns).reduce(nil) do |acc, column|\n column = arel_table[column] unless column.is_a?(Arel::Attributes::Attribute)\n matcher = if type_for_attribute(column.name).type == :integer\n column.eq(v)\n else\n pattern = \"%#{v}%\"\n column.matches(pattern)\n end\n acc.nil? ? matcher : acc.or(matcher)\n end\n where(conditions)\n end\n end", "def where_operator(field, operator, *args, **options)\n if field.is_a?(Arel::Nodes::Node)\n node = field\n elsif has_attribute?(field)\n node = arel_table[field]\n else\n node = Arel.sql(field.to_s)\n end\n\n arel = node.send(operator, *args, **options)\n where(arel)\n end", "def where(matcher)\n matcher_class = matcher.class.name.underscore\n send(\"where_using_#{matcher_class}\", matcher)\n rescue NoMethodError\n respond_to?(:where_using_default, true) ? where_using_default(matcher) :\n raise(InvalidWhereQuery, matcher_class)\n end", "def where(attributes)\n # (class method) think about how to loop through hashes\n # try looping thru a test ruby file or within irb\n end", "def filter\n @filter_params.each do |key, val|\n # Strip empty values from the array if the given value is an array.\n val.select!{ |val| !val.to_s.empty? } if val.is_a?(Array)\n\n # Convert key if it starts with a column name.\n key = key.slice(@model_method_name.length + 1, key.length) if key.start_with?(\"#{@model_method_name}_\")\n\n if @force_filter_for && @force_filter_for.include?(key)\n ret = @args[:filter].call(:key => key, :val => val, :query => @query)\n @query = ret if ret\n elsif @model.column_names.include?(key)\n if val.is_a?(Array) && val.empty?\n # Ignore.\n else\n @query = @query.where(key => val)\n end\n elsif match = key.to_s.match(/^(.+)_like$/) and @model.column_names.include?(match[1])\n next if val.blank?\n table = @model.arel_table\n \n val.to_s.strip.split(/\\s+/).each do |str|\n @query = @query.where(table[match[1].to_sym].matches(\"%#{escape(str)}%\"))\n end\n elsif @args[:filter]\n ret = @args[:filter].call(:key => key, :val => val, :query => @query)\n @query = ret if ret\n else\n raise \"Dont know what to do regarding filter with key: '#{key}'.\"\n end\n end\n end", "def find_by!(arg, *args)\n where(arg, *args).take!\n end", "def where(options = {})\n all.select do |record|\n options.all? { |key, value| record.send(key) == value }\n end\n end", "def query(letter)\n \n end", "def myfind (str)\n if str.match(/^[[:graph:]]+$/)\n Provider.where(\"lower(name) like ?\", \"%#{str}%\")\n end\n end", "def where(table, column, value, and_or=\"and\", ignore_case=false)\n if ignore_case\n return where_ignore_case(table, column, value, and_or)\n end\n if and_or == \"and\"\n and_exp(@builder.equal(@alias[table].get(column),value))\n else # or\n or_exp(@builder.equal(@alias[table].get(column),value))\n end\n self\n end", "def for(name, obj = nil)\n on(obj).where(:name => name.to_s.downcase)\n end", "def find_by_symbol(symbol)\n fetch([name, symbol.to_s]) do\n where(symbol: symbol).first\n end\n end", "def where( expression )\n dup.use do |result|\n if expression.is_a?(Hash) then\n found = expression.keys.select{|k| @fields.member?(k.to_s)}\n assert(found.length == expression.length, \"where set references non-existent fields\")\n\n comparisons = expression.collect do |k, v|\n field = @fields[k.to_s]\n create_comparison(field, create_literal(field.type_info, v))\n end\n\n result.and_where!(create_and(comparisons))\n else\n result.and_where!(expression)\n end\n \n Schemaform.debug.dump(result, \"AFTER WHERE: \")\n end\n end", "def where(condition, *params)\n raise 'Invalid params count in where clause!' unless condition.count('?') == params.count\n\n params.each do |param|\n condition.sub!('?', param.to_s)\n end\n\n conditions = condition.gsub(/\\s+/, ' ').split(/and/i)\n\n conditions.each do |condition|\n attribute, operator, value = condition.split(' ')\n\n raise 'Invalid attribute in where clause!' unless model.attributes.keys.include?(attribute)\n raise 'Invalid operator in where clause!' unless self.class.where_mapping.keys.include?(operator)\n raise 'Parameter in where clause is not an integer!' if !(value =~ /\\A[-+]?[0-9]+\\z/)\n\n method_name = \"#{model.filterable_attributes[attribute]}__#{self.class.where_mapping[operator]}\"\n parameters[method_name] = value\n end\n\n self\n end", "def has_where?\n !@options[:where].blank?\n end", "def find_by_query_columns\n raise \"override in model as find_by_query_columns, e.g. return ['name', 'description']\"\n end", "def hstore_has_key(column, key)\n where(\"#{connection.quote_column_name(column)} ? :key\", :key => key) \n end", "def test_like_search_condition\n search_conditions = [[\"Wes\", :like]]\n query_fields = {'some_table.first_name' => :string} \n conditions = build_query(search_conditions, query_fields) \n \n assert_equal '(some_table.first_name LIKE :keyword_0)', conditions.first\n assert_equal '%Wes%', conditions.last[:keyword_0]\n end", "def where()\n \"#{@location}-#{@op}\"\n end", "def where(condition, true_t = nil, false_t = nil, name: nil)\n _op(:where, condition, true_t, false_t, name: name)\n end", "def where(&condition)\n map do |result|\n # if condition.call(*result)\n if PropCheck::Helper.call_splatted(result, &condition)\n result\n else\n :\"_PropCheck.filter_me\"\n end\n end\n end", "def where(**mapping)\n lists = mapping.select { |v| Array.wrap(v).length > 1 }\n scalars = mapping.reject { |k, v| lists.key?(k) }\n\n render(STANDARD, **scalars) + render(DISJUNCTION, **lists)\n end", "def find_by_sql(sql)\n raise \"not implemented\"\n end", "def where_clause_from(options)\n return nil unless options\n query = String.new()\n query = sanitize_wql(options)\n puts \"NOW, we'll execute this: #{query}\"\n return query\n end", "def filter(expr); end", "def filter(expr); end", "def find_cool(col)\n col.select do |arr|\n arr[:temperature] == \"cool\"\n end\nend", "def query(column)\n @posts = Post.where(\"#{column} = 't'\")\n end", "def to_conditions(value)\n [\"#{column_sql} SOUNDS LIKE ?\", value]\n end", "def normalize_pending_arguments(arguments)\n if arguments.empty?\n self.where = \"dbagile\"\n else\n self.where = valid_argument_list!(arguments, String)\n end\n end", "def match?(column_name, search_query=(as || name))\n return false if column_name.nil?\n\n downcased_column_name = column_name.downcase\n underscored_column_name = downcased_column_name.gsub(/\\s+/, '_')\n\n case search_query\n when Symbol\n underscored_column_name == search_query.to_s\n when String\n downcased_column_name == search_query.downcase\n when Regexp\n column_name =~ search_query\n when Array\n search_query.any? { |query| match?(column_name, query) }\n else\n raise Error, \"Invalid `as`. Should be a Symbol, String, Regexp or Array - was #{as.inspect}\"\n end\n end", "def selection_is_qualified?(c)\n case c\n when Symbol\n Sequel.split_symbol(c)[0]\n when Sequel::SQL::QualifiedIdentifier\n true\n when Sequel::SQL::AliasedExpression\n selection_is_qualified?(c.expression)\n else\n false\n end\n end", "def primary_where_clause\n raise StandardError, 'To use #totalise_query, you must implement #primary_where_clause'\n end", "def where(opts, *rest)\n return super(opts, *rest) unless opts.is_a? Hash\n encrypted_opts = opts.reduce({}) do |hash, (key, value)|\n hash[key] = opts.delete(key) if attribute_encrypted? key\n hash\n end\n query = super(opts, *rest)\n encrypted_opts.present? ? query.encrypted_where(encrypted_opts) : query\n end", "def find_by_case_insensitive_token(token)\n return if token.nil?\n where(\"lower(#{token_with_table_name}) = ?\", token.downcase).first\n end", "def find_by()\n\n end", "def sql(bindings, type = :find)\n statement, bind_values = build_statement(type)\n statement.gsub('?') { eval_bound_value(bind_values.shift, connection, bindings) }\n end", "def where(condition, true_t = nil, false_t = nil, name: nil)\n _op(:where, true_t, false_t, pred: condition, name: name)\n end", "def whereable_deparse(hash)\n raise FilterInvalid, \"Invalid hash #{hash}\" if hash.size > 1\n\n key, value = hash.first\n\n case key\n when :and, :or\n arel = whereable_deparse(value.first)\n value[1..-1].each do |o|\n arel = arel.public_send(key, whereable_deparse(o))\n end\n arel\n when :eq, :not_eq, :gt, :gteq, :lt, :lteq\n column = whereable_valid_column(value[:column])\n literal = whereable_valid_literal(column, value[:literal])\n arel_table[column].public_send(key, literal)\n when :between\n column = whereable_valid_column(value[:column])\n literals = value[:literals]\n raise(FilterInvalid, \"Invalid operation for #{column}\") if defined_enums.key?(column)\n\n arel_table[column].between(literals)\n when :in\n column = whereable_valid_column(value[:column])\n literals = value[:literals].map { |l| whereable_valid_literal(column, l) }\n\n arel_table[column].in(literals)\n else\n raise FilterInvalid, \"Invalid hash #{hash}\"\n end\n end", "def where(forall, obj)\n do_add = true\n\n unless forall.where.nil?\n expression = forall.where.clone\n replace_placeholder_string(expression, forall.variable, obj.instance_name)\n bla = evaluate_expression(expression)\n do_add &&= eval(bla)\n end\n do_add\n end", "def query_clause(type, key, value)\n \"_query_:\\\"{!#{type} f=#{key}}#{value.gsub('\"', '\\\"')}\\\"\"\n end", "def query_clause(type, key, value)\n \"_query_:\\\"{!#{type} f=#{key}}#{value.gsub('\"', '\\\"')}\\\"\"\n end", "def value_conditions(field_name, val)\n val.blank? ? nil : \"CAST(#{field_name} as CHAR(50)) LIKE '#{val.gsub(\"'\",\"''\")}%'\".tr_s('%*', '%')\n end", "def query_clause(type, key, value)\n \"_query_:\\\"{!#{type} f=#{key}}#{value.gsub('\"', '\\\"')}\\\"\"\n end", "def check_column column, table, col_types\n unless column.is_a? Symbol\n raise ArgumentError, \"#{column.inspect} not a Symbol\"\n end\n unless col_types[column]\n raise ArgumentError, \"#{column.inspect} is not a column in #{table}\"\n end\n end", "def search(records, field, criteria)\n records.where(\"#{field} = ?\", encrypt(criteria))\n end", "def where(*params, &block)\n @where << ComparisonExpression.new(*params, &block)\n self\n end", "def where!(*cond, &block)\n where(nil, *cond, &block)\n end", "def myfind (str)\n if str.match(/^[[:digit:]]+/)\n Chart.where(\"patient_id::varchar like ?\", \"#{str}%\" )\n elsif str.match(/^[[:graph:]]+$/)\n Chart.joins(:patient).where(\"upper(lname) like ?\", \"%#{str.upcase}%\")\n else\n []\n end\n end", "def filtered_by_key(key)\n where(key: key)\n end", "def where_table(*args, &b)\n set_parameters(args, true, &b)\n end", "def build_column_search_condition (column_name, search_value)\n full_column_name = \"#{@model_klass.table_name}.#{column}\"\n\n case Utils.column_type(@model_klass, column_name)\n when :string\n \"#{full_column_name} ILIKE '%#{search_value}%'\"\n when :integer, :float, :decimal\n if Utils.is_numeric?(search_value)\n \"#{full_column_name} = #{search_value}\"\n end\n else\n # TODO Support more data types in column search conditions\n nil\n end\n end", "def where_column_equal(col, value)\n # substitue in virtual col fn if it exists\n vcol_info = ((DB_REL_DEF[model_name] || {})[:virtual_columns] || {})[col]\n return where(col => value) unless vcol_info\n fail Error.new(\"virtual column #{col} cannot appear in where clause unless it has a fn def\") unless vcol_info[:sql_fn]\n where(vcol_info[:sql_fn] => value)\n end", "def where_this_parameter_in_another_table(class_name, this_parameter, other_field_name)\n class_name.where_match(other_field_name, this_parameter, \"==\")\n end", "def where(args)\n rule = clone\n rule.rulespec = args\n rule\n end", "def where(column_name, value)\n table_name = self.to_s.pluralize.underscore\n results = CONNECTION.execute(\"SELECT * FROM #{table_name} WHERE #{column_name} = ?;\", value)\n results_as_objects = []\n results.each do |results_hash|\n results_as_objects << self.new(results_hash)\n end\n \n return results_as_objects\n end", "def find_by_species(species)\n self.animals.select do |animal|\n #binding.pry\n animal.species == species \n end\n end", "def clean_filter(value)\n value = @filters[value] if value.is_a? Symbol\n ActiveRecord::Type::Boolean.new.cast(value)\n end" ]
[ "0.6449637", "0.63082874", "0.5940474", "0.58660173", "0.58439094", "0.57750857", "0.5693066", "0.5693066", "0.5661023", "0.5628119", "0.5607416", "0.5607045", "0.5603239", "0.55822563", "0.55734974", "0.5572078", "0.5568918", "0.55394703", "0.55359226", "0.55224687", "0.5508422", "0.5472603", "0.54671514", "0.54514945", "0.54497665", "0.5415229", "0.54137397", "0.5376027", "0.53730667", "0.5372038", "0.5354093", "0.53522503", "0.5349426", "0.53387094", "0.5325044", "0.5322221", "0.53168917", "0.53147286", "0.5311807", "0.5307529", "0.52976733", "0.5278059", "0.52693075", "0.5267483", "0.52407587", "0.5231156", "0.5229882", "0.52223754", "0.5215456", "0.5214729", "0.52137476", "0.5205563", "0.5202337", "0.5201421", "0.520114", "0.5196299", "0.5193207", "0.5193063", "0.5190851", "0.51818055", "0.51742744", "0.517189", "0.51685464", "0.5167345", "0.5156525", "0.5153833", "0.51456", "0.5142391", "0.5142391", "0.51374614", "0.5134142", "0.5123604", "0.5108308", "0.5106557", "0.5090183", "0.50887114", "0.5084194", "0.50717396", "0.50703716", "0.5065369", "0.5063103", "0.5057455", "0.50573766", "0.50535226", "0.5052935", "0.5044432", "0.5037952", "0.5035007", "0.5034696", "0.5033835", "0.50164956", "0.50149834", "0.5010861", "0.50025785", "0.499034", "0.4984275", "0.49839985", "0.49837327", "0.49834678", "0.49796006", "0.49785426" ]
0.0
-1
return the number of matches in the file. Don't read the entire file into memory; read it only (num_lines_per_batch) lines at a time
def num_matches_in_file(fname, match_regexp) num_lines_per_batch = 5000 num_matched = 0 if File.exist? fname File.open(fname, "r") do |f| # use an enumerator to read just (num_lines_per_batch) lines at a time f.lazy.each_slice(num_lines_per_batch) do |lines| num_matched += lines.select { |line| line.match(match_regexp) }.count end end else num_matched = 0 end num_matched end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_lines(all_lines_from_file)\n all_lines_from_file.lines.count\nend", "def n_lines(filename)\n File.foreach(filename).reduce(0) { |acc, _elem| acc + 1 }\n end", "def n_lines(filename); end", "def count_lines()\n start_time = Time.now\n @file_lines = 0 \n last_block_position = 0\n prev_block_position = -1\n Rula.log(Logger::DEBUG,\"Reading file #{@filename} lines count\",self)\n file_handle = File.open(@filename,'rb')\n while data = file_handle.read(@@BLOCK_SIZE)\n original_size = data.length\n last_occurence = data.rindex(Rula.options[:line_separator])\n difference_in_size = original_size - last_occurence\n\n if data.length==1 then\n break\n end\n\n if !last_occurence.nil? then\n data = data[0..last_occurence]\n file_handle.pos -= difference_in_size\n end\n @file_lines += data.scan(/([^|#{Rula.options[:line_separator]}].*)#{Rula.options[:line_separator]}/).length\n \n (0...@@BUFFERS).each {|i| \n @buffers[i].add_hash(last_block_position, prev_block_position, file_handle.pos, @file_lines)\n }\n prev_block_position = last_block_position \n last_block_position = file_handle.pos\n end\n Rula.log(Logger::DEBUG,\"Counted #{@file_lines} lines for file #{@filename}\",self)\n ensure\n Rula.log(Logger::DEBUG,\"Counting lines ran #{(Time.now - start_time) * 1000} ms\",self)\n file_handle.close()\n load_buffer_data(0)\n end", "def linecount(fname)\n File.open(fname, \"r\") do |f|\n f.readlines.length\n end\nend", "def count_lines(file)\n n = 0\n while file.gets\n n += 1\n end\n n\n end", "def file_line_count(file_name)\n line_count = `wc -l < #{file_name}`.to_i\n LoggerHelper.print_to_log(\"Count of lines in '#{file_name}' is #{line_count}\")\n line_count\n end", "def word_count_a_file(file_path)\n word_count = 0\n f = File.open(file_path, \"r\")\n f.each_line {|line|\n word_count += line.to_s.split.size\n }\n word_count\nend", "def count_lines\n linecount = 0\n\n @output_buffer.each do |line|\n linecount += line.scan(/\\n/).count\n end\n\n linecount - 1\n end", "def word_count(all_lines_from_file)\n all_lines_from_file.split.length\nend", "def total_count(file)\n file_obj = File.new(file,'r')\n file_obj.readlines.size\n end", "def word_count_a_file(file_path)\n total = 0\n file = File.new(file_path, \"r\")\n file.readlines.each do |x|\n total += x.split.size\n end\n total\nend", "def paragraph_count(all_lines_from_file)\n all_lines_from_file.split(/\\n\\n/).length\nend", "def count\n Jhead.call(\"-c\", @match, @pattern).split(\"\\n\").size\n end", "def count\n `wc -l < #{filepath}`.to_i - 1\n end", "def lines_counter\n f = File.open('peliculas.txt', 'r')\n print f.readlines.length\n f.close\nend", "def flay_count filename\n count = `flay #{filename}|grep #{filename}|wc -l`\n return count.chomp.to_i\n end", "def line_count(file_list)\n file_list.empty? ?\n nil :\n %x{wc -l #{file_list.join(' ')} | awk 'END {print $1}'}.to_i\n end", "def process_file(filename)\n puts \"Processing: #{filename}\"\n total = 0\n matched = 0\n File.open(filename) do |file|\n Zlib::GzipReader.wrap(file) do |gzip|\n CSV.new(gzip).each do |row|\n time = Time.parse(row[3])\n matched += 1 if time > MINIMUM_TIME\n total += 1\n end\n end\n end\n\n {total: total, matched: matched}\nend", "def word_count_a_file(file_path)\n IO.read(file_path).split.length\nend", "def count_paragraphs(some_file)\n file_content = open(some_file).read()\n count = 0\n file_content_split = file_content.split('')\n\n file_content_split.each_index do |index|\n count += 1 if file_content_split[index] == \"\\n\" && file_content_split[index + 1] == \"\\n\"\n end\n return count\nend", "def line_count\n `wc -l public/HelloWorld.txt`.to_i\n end", "def line_count(file)\n\t\tf = File.new(file)\n\t\tnum_newlines = 0\n\t\twhile (c = f.getc) != nil\n\t\t\tnum_newlines += 1 if c == $/\n\t\tend\n\t\tnum_newlines\n\tend", "def word_count_a_file(file_path)\nend", "def num_lines() @line_indices.length + 1 end", "def line_count\n\t\tlines.size\n\tend", "def line_count\n\t\tlines.size\n\tend", "def word_count_a_file(file_path)\n\tfile = File.new(file_path,'r')\n\tfile.read.count(\" \")+1 \nend", "def count_sentences(some_file)\n file_content = open(some_file).read()\n count = 0\n\n file_content.each_char do |c|\n count += 1 if c == \",\" || c == \"?\" || c == \"!\"\n end\n return count\nend", "def countlines\n file = File.open('peliculas.txt', 'r')\n data = file.readlines\n file.close\n puts data.length\nend", "def sentence_count(all_lines_from_file)\n all_lines_from_file.split(/\\.|\\?|\\!/).length\nend", "def line_number\n lines_read.length\n end", "def lines\n repository.files.map do |file|\n repository.read(file).to_s.lines.count\n end.sum\n end", "def word_count_a_file(file_path)\n File.read(file_path).split(' ').length\n # had to create the file, text taken from https://www.lipsum.com/feed/html\nend", "def get_file_lines_of_code!(f)\n count = 0;\n File.foreach(f) {count+=1}\n #print(\"#{count}\")\n count\n end", "def count_characters(all_lines_from_file)\n all_lines_from_file.gsub(/\\n+/,\"\").length\nend", "def num_lines\n load_data unless @num_lines\n @num_lines\n end", "def line_count\n entries.inject(0) do |count, entry|\n count + (entry.dir? ? 0 : entry.lines.size)\n end\n end", "def count_total_lines files\n files.each do |f, k|\n lines_output = `wc -l #{f.to_s}`\n if $? != 0 then\n raise 'Error in counting total lines.'\n end\n lines_count = lines_output.strip.split(' ')[0].to_i\n k['total_lines'] = lines_count\n end\n return files\n end", "def line_count\n\t\t\treturn @contents.nil? ? 0 : @contents.count\n\t\tend", "def _check_nseq(file)\n\t\t`grep \"^>\" #{file} | wc -l`.to_i\n\tend", "def count_with_file(filename)\n return if ::ServiceMock.disable_stubs\n yield self if block_given?\n content = File.open(filename, 'rb') { |file| file.read }\n count(content)\n end", "def getNumLines()\n contents.split(\"\\n\").length - 1\n end", "def find_number_lines(opened_file)\n start_time = Time.now.to_i\n total_file_lines = opened_file.each_line.inject(0) { |total, _amount| total + 1 }\n opened_file.rewind\n if Rails.env.development?\n end_time = Time.now.to_i\n puts(\"1. Lines ==> #{total_file_lines} in #{((end_time - start_time) / 60).round(2)}\")\n end\n total_file_lines\n end", "def covered_lines\n covered_lines = 0\n @files.select { |f|\n @file_whitelist.include? f.filename\n }.each do |file|\n original_result[file.filename].each do |line_result|\n covered_lines += 1 if line_result and line_result > 0\n end\n end\n covered_lines\n end", "def size_in_lines(filepath)\n f = File.new(filepath)\n f.readlines[-1]\n count = f.lineno.to_s\n puts \"The link check report contains #{count} lines.\".blue\n puts \"To see the report, open the #{filepath} file.\".blue\n end", "def comma_count\n text = @file.content\n text.count(\",\")\n end", "def process_file(offset = 0)\n batch = Array.new\n idx = 0\n IO.readlines(@logfile).each do |line|\n if (idx += 1) <= offset\n next\n end\n\n m = line.match(@regex)\n if !m\n $stderr.puts \"Dropping logline '#{line}' because it does not match the parsing regex: #{@regex}\"\n next\n end\n\n if batch.size >= @batch_size\n enqueue_batch(batch.dup)\n batch.clear()\n end\n\n batch.push(m)\n end\n\n if batch.size > 0\n enqueue_batch(batch)\n end\n\n return idx\n end", "def process_file\n @line_lengths = []\n @total_lines = 0\n\n Rails.logger.info(\"Begin processing file: #{@file_path}\" )\n\n time = Benchmark.realtime do\n File.open(@file_path, \"r\") do |file|\n loop do\n line = file.gets(\"\\n\")\n break if line.nil?\n @line_lengths[@total_lines] = line.length\n @total_lines += 1\n end\n end\n end\n\n Rails.logger.info(\"File processing done, duration: #{time}\" )\n end", "def record_count\n pair = text_blocks.each_cons(2)\n .select { |cons| cons[1] == \"Record Count:\" }.first\n pair && pair[0].to_i\n end", "def lines_count(str)\n i = 0\n str.each_line { i += 1 }\n i\n end", "def num_commits(lines)\n numCommits = 0\n lines.each{ |line| numCommits += 1 if line.start_with?(\"commit \") }\n return numCommits\nend", "def matched_count\n @results[MATCHED_COUNT]\n end", "def check_file\n # Read dictionary\n @word_list = File.open(@infile)\n @word_list.each do |word|\n w = Word.new(word.chop)\n # Check each token from word\n w.get_tokens.each do |seq|\n if check_sequence(seq) # Returns true if unique so far\n # Add to sequences array\n @found_sequences[seq] = word.chop\n @seq_count = @seq_count + 1\n end\n end\n end\n return @seq_count\n end", "def test_file_must_contain_contains()\n\t\tCfruby::FileEdit.file_must_contain(@multilinefilename, \"second line\")\n\t\tFile.open(@multilinefilename, File::RDONLY) { |fp|\n\t\t\tlines = fp.readlines()\n\t\t\tassert_equal(@multilinefilecontents.split(\"\\n\").length, lines.length)\n\t\t}\n\tend", "def number_of_documents_from_caseflow\n count = Document.where(file_number: veteran_file_number).size\n (count != 0) ? count : number_of_documents\n end", "def file_count(path, ext = 'scss')\n file_list(path, ext).length\n end", "def search(list)\n count = 0\n list.each_line do |string|\n count += 1 if is_a_nice_string?(string)\n end\n count\nend", "def num_open_cells(file)\n open_cells = 0\n\n while line = file.gets \n if line == nil then return end\n\n if line[0...4] != \"path\"\n x, y, ds, w = line.split(/\\s/,4)\n ds = ds.chars\n if(ds.length() == 4)\n open_cells+=1\n end\n end\n end\n return open_cells\nend", "def find_file_lines(file)\n file.open { |f| find_number_lines(f) }\n end", "def egrep(pattern, *options)\n matched = 0\n each do |fn|\n begin\n File.open(fn, \"r\", *options) do |inf|\n count = 0\n inf.each do |line|\n count += 1\n if pattern.match(line)\n matched += 1\n if block_given?\n yield fn, count, line\n else\n puts \"#{fn}:#{count}:#{line}\"\n end\n end\n end\n end\n rescue StandardError => ex\n $stderr.puts \"Error while processing '#{fn}': #{ex}\"\n end\n end\n matched\n end", "def file_reader file_name\n @words_count = {}\n File.read(file_name).each_line{ |line| count_words( line.split(',')[2] ) }\n hash_to_file(@words_count, file_name)\nend", "def missed_lines\n missed_lines = 0\n @files.select { |f|\n @file_whitelist.include? f.filename\n }.each do |file|\n original_result[file.filename].each do |line_result|\n missed_lines += 1 if line_result == 0\n end\n end\n missed_lines\n end", "def count\n cnt = 0\n begin\n if block_given?\n scanner = htable.getScanner(filtered_scan)\n scanner.each do |result|\n cnt += 1 if yield(Result.send(:new, result))\n end\n else\n scanner = htable.getScanner(filtered_scan_minimum)\n scanner.each { cnt += 1 }\n end\n ensure\n scanner.close if scanner\n end\n cnt\n end", "def total_lines(csv_file_name,rb='rb',options={})\n\t\tf = CSV.open(csv_file_name, rb, {}.merge(options))\n\t\ttotal_lines = f.readlines.size # includes header, but so does f.lineno\n\t\tf.close\n\t\ttotal_lines\n\tend", "def num_commits(lines)\n num = 0 \n lines.each { |line|\n words = line.split\n if words[0] == \"commit\" then num+= 1 end\n }\n num\nend", "def return_count\n return @matchedCount\n 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 ruby_lines\n repository.files(:pattern => /.rb/).map do |file|\n repository.read(file).to_s.lines.count\n end.sum\n end", "def checkEachLineCount(matrix)\n n = sum(matrix[0])\n # Raises an exception if lines contain different number of ratings \n matrix.each{|line|raise \"Line count != #{n} (n value).\" if sum(line) !=n}\n n # The number of ratings\nend", "def lines_count\n @lines_count ||= lines.count\nend", "def count_danger_dave_faults\n danger_dave_es = '/Users/michael/Desktop/language_files/danger_dave_inflection_freqs/content/2016/es/es_full.txt'\n bw_count = File.new('./bw_count.txt', 'w+')\n not_found_count = File.new('./not_found_count.txt', 'w+')\n File.readlines(danger_dave_es).each do |word_n_freq|\n if $. == 100\n break\n end\n word_n_freq_arr = word_n_freq.split(' ')\n word = word_n_freq_arr[0]\n hit_count = word_n_freq_arr[1]\n bw_exists = BaseWord.find_by(base_word: word)\n # headers for bw_count file: base_word, hit_count, (inflection), base_word_id\n # headers for not_found_count file: inflection, hit_count\n if bw_exists\n bw_count.puts word + ' ' + hit_count + ' ' + '(' + word + ')' + ' ' + bw_exists.id\n else\n inflection_exists = Inflection.find_by(word: word)\n if inflection_exists\n bw_id = inflection_exists.base_word_id\n bw = BaseWord.find(bw_id).base_word\n bw_count.puts base_word + ' ' + hit_count + ' ' + '(' + word + ')' + ' ' + bw_id\n else\n not_found_count.puts word + ' ' + hit_count\n end\n end\n end\nend", "def find_number_of_rows\n row_array = []\n CSV.foreach('testdata.csv', {headers: true}) {|row| row_array << row[1]} \n row_array.uniq.size\nend", "def send_count\n repository.files.map do |file|\n content = repository.read(file)\n content.to_s.scan(/send/).size\n end.sum\n end", "def count_multiline_comments(buff, regexp)\n unless regexp.is_a?(Array) then regexp = [regexp] end\n\n regexp.reduce(0) do |acc, regexp|\n acc + buff.reduce(''){|acc,x| acc + x}.scan(regexp).map { |x|\n x.map{|y| y.lines.count}.reduce(0){|acc,y| acc + y}\n }.reduce(0){|acc, x| acc + x}\n end\n end", "def count_multiline_comments(buff, regexp)\n unless regexp.is_a?(Array) then regexp = [regexp] end\n\n regexp.reduce(0) do |acc, regexp|\n acc + buff.reduce(''){|acc,x| acc + x}.scan(regexp).map { |x|\n x.map{|y| y.lines.count}.reduce(0){|acc,y| acc + y}\n }.reduce(0){|acc, x| acc + x}\n end\n end", "def file_statistics(filename)\n line_count = 0; loc_count = 0;\n \n File.new(filename, 'r').each_line do |line|\n line.strip!\n line_count += 1\n \n # don't count blank lines or comment lines in LOC\n loc_count += 1 if line.gsub(/[\\/\\*\\s]/i, \"\").length > 1 && line.match(/^\\/\\//).nil?\n end\n \n {:line_count => line_count, :loc_count => loc_count}\n end", "def calc_result(input_file_location)\n result = 0\n File.readlines(input_file_location).each do |line|\n int = Integer(line)\n result += int\n end\n result\nend", "def number_of_lines_in_first_chunk\n end_method_line = last_method_source_location.last\n\n end_method_line - line\n end", "def _match_count (substr, text)\n return 0 if (!text || !substr)\n\n count = 0\n offset = 0\n while (result = text.index(substr, offset))\n count += 1\n offset = result + 1\n end\n count\n end", "def word_count(file_name, line)\n #file_array = []\n count_words_hash = {}\n line_index = 0\n\n while line_index <= line\n line_text = rio(\"hamlet.txt\").lines[line_index]\n line_array_index0 = line_text[0]\n words_array = line_array_index0.split(\" \")\n\n #puts \"Line array string: #{line_array_index0}\"\n words_array.each do |word|\n #puts \"Line text: #{line_text}, word: #{word}, index: #{line_index}\"\n if !count_words_hash.has_key?(word)\n count_words_hash[word] = 0\n end\n count_words_hash[word] += 1\n end #end array each loop\n line_index += 1\n end #end while loop\n puts \"Final hash: #{count_words_hash}\"\n\n return count_words_hash\n\nend", "def exact_match_count\n (0..3).inject(0) do |count, index|\n count + (exact_match?(index) ? 1 : 0)\n end\n end", "def check_csv(db,tbl)\n csv = \"/opt/tucdocs/MDB/#{db}_#{tbl}.csv\"\n puts \"csv: #{csv}\"\n num_csv = %x! wc -l #{csv} !.chomp.to_s.to_i\nend", "def count_errors files\n ActiveRecord::Base.connection_pool.with_connection do \n @repo.code_reviews.each do |review|\n if files.has_key?(review.file_path)\n files[review.file_path]['total_errors'] += 1\n error_lines = (review.line_end - review.line_begin) + 1\n files[review.file_path]['lines_with_error'] += error_lines\n review.code_category.each do |category|\n files[review.file_path]['categories'][category.name]['total_errors'] += 1\n files[review.file_path]['categories'][category.name]['lines_with_error'] += error_lines\n end\n end\n end\n end\n return files\n end", "def loc(filename)\n\tFile.readlines(filename).map {|l| l.strip.length==0?nil:l}.compact.length\nend", "def count_characters_no_spaces(all_lines_from_file)\n all_lines_from_file.gsub(/\\s+/, \"\").length\nend", "def src_lines(pr)\n count_lines(src_files(pr))\n end", "def word_count(file)\n wc = Hash.new(0)\n File.open(file, 'r') do |f|\n f.each_line do |line|\n line.split.each do |word|\n word = word.gsub(/[^a-zA-Z]/, '').downcase\n wc[word.to_sym] += 1\n end\n end\n end\n wc\nend", "def count\n\t\t@input_ary.each_with_index { |line,i|\n\t\t\tif line =~ /^COUNT=([0-9]*)\\s*/\n\t\t\t\t@fileinfo[:count] = $1.to_i \n\t\t\t\tat = i+1\n\t\t\tend\n\t\t}\n\t\traise DTA_ReaderErr, \"Cannot define number of elements!\" unless @fileinfo[:count]\n\t\traise DTA_ReaderErr, \"Error parsing elements count :: #{@input_file}:#{at} :: COUNT=\" + $1.inspect if @fileinfo[:count] == 0\n\tend", "def index_for(file, line_number)\n diff_for_file(file).fetch(:diff_chunks).\n reduce(0) do |index, position:, size:, diff:|\n # Unless we are processing the target chunk\n unless line_number.between?(position, position + size)\n next index + 1 + diff.lines.count\n end\n\n position -= 1 # rebase position on first line of chunk\n index_in_chunk = diff.lines.find_index do |line|\n position += 1 unless line.first == '-'\n position == line_number\n end\n\n return index + 1 + index_in_chunk\n end\n\n nil # if this line number is not in diff\n end", "def count_single_line_comments(buff, comment_regexp)\n a = buff.select { |l|\n not l.match(comment_regexp).nil?\n }.size\n a\n end", "def count_single_line_comments(buff, comment_regexp)\n a = buff.select { |l|\n not l.match(comment_regexp).nil?\n }.size\n a\n end", "def total_count #:nodoc:\n total == 1 && !@group.nil? && @group['matches'] > 1 ? @group['matches'] : total\n end", "def find_valid_data filename\n start = 0\n dbfile = File.new(filename)\n s = dbfile.gets\n while s[0] == ?# or s[0]==?\\n\n start+= s.size\n s = dbfile.gets\n end\n dbfile.seek(-128, File::SEEK_END)\n s = dbfile.read(128).chomp;\n last = s.rindex(\"\\n\");\n dbfile.close\n return [start-1,File.size(filename) - last]\nend", "def productsCount\r\n rows = CSV.parse(open(self.data_file.path).read, :col_sep => separatorChar)\r\n\t\t\t#rows = CSV.parse(open(self.data_file.url).read, :col_sep => \",\", :quote_char => \"'\")\r\n return rows.count\r\n end", "def instance_count\n repository.files(:pattern => /.rb/).map do |file|\n content = repository.read(file)\n count_calls(:def,content)\n end.sum\n end", "def test_file_must_nofuzzy()\n\t\tCfruby::FileEdit.file_must_contain(@multilinefilename, \" first line\", :fuzzymatch => false)\n\t\tFile.open(@multilinefilename, File::RDONLY) { |fp|\n\t\t\tlines = fp.readlines()\n\t\t\tassert(lines.length == @multilinefilecontents.split(\"\\n\").length + 1)\n\t\t\tfirstcount = 0\n\t\t\tlines.each() { |line|\n\t\t\t\tif(line =~ /first/)\n\t\t\t\t\tfirstcount = firstcount + 1\n\t\t\t\tend\n\t\t\t}\n\t\t\tassert_equal(2, firstcount)\n\t\t}\n\t\t\n\t\tCfruby::FileEdit.file_must_not_contain(@multilinefilename, \" first line\", :fuzzymatch => false)\n\t\tFile.open(@multilinefilename, File::RDONLY) { |fp|\n\t\t\tlines = fp.readlines()\n\t\t\tassert(lines.length == @multilinefilecontents.split(\"\\n\").length)\n\t\t\tfirstcount = 0\n\t\t\tlines.each() { |line|\n\t\t\t\tif(line =~ /first/)\n\t\t\t\t\tfirstcount = firstcount + 1\n\t\t\t\tend\n\t\t\t}\n\t\t\tassert_equal(1, firstcount)\n\t\t}\n\tend", "def test_lines(pr)\n count_lines(test_files(pr))\n end", "def contar_lineas\n line = read_alumnos\n contador = line.count\n contador\nend", "def file_count\n return unless exists?\n Dir.glob(folder_pathname.join(\"**\")).count do |file|\n File.file?(file)\n end\n end" ]
[ "0.68329793", "0.6793775", "0.6727576", "0.6684314", "0.66674596", "0.665338", "0.66107076", "0.6572488", "0.649866", "0.649313", "0.6434707", "0.64026797", "0.6375943", "0.6369467", "0.63271815", "0.62666637", "0.6243256", "0.6243017", "0.61899006", "0.61893433", "0.618073", "0.6157816", "0.6138253", "0.61304903", "0.6124078", "0.6105708", "0.6105708", "0.6080675", "0.60596406", "0.6053514", "0.604874", "0.6016392", "0.59943914", "0.59694856", "0.59470814", "0.59147215", "0.5828664", "0.578587", "0.57808226", "0.57570475", "0.5745884", "0.5742391", "0.5707145", "0.56715345", "0.56691504", "0.56578344", "0.56436914", "0.5636497", "0.5624089", "0.56141174", "0.5597941", "0.55893856", "0.5589385", "0.5571746", "0.55600065", "0.5559246", "0.55462074", "0.5541561", "0.55254793", "0.55058646", "0.5499049", "0.54957795", "0.5485413", "0.5481834", "0.54739326", "0.5458359", "0.5456702", "0.543701", "0.543418", "0.5429487", "0.54164", "0.53991514", "0.5376733", "0.53650665", "0.53649545", "0.53649545", "0.53408", "0.5329634", "0.53157663", "0.5313463", "0.52884704", "0.5284417", "0.52798426", "0.52691156", "0.5262333", "0.5259628", "0.5249374", "0.52491736", "0.5246277", "0.5244823", "0.5235438", "0.5235438", "0.5231122", "0.5217648", "0.5207493", "0.52002704", "0.5198071", "0.5189521", "0.5182079", "0.51768595" ]
0.82626873
0
The session_key is returned by auth.session.key
def love(session_key) doc = Hpricot::XML(self.class.connection.post("track.love", true, {:track => @name, :artist => @artist, :sk => session_key})) doc.at("lfm")["status"] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def session_key\n @session_key\n end", "def session_id_key\n @session_id_key\n end", "def session_key\n if self.new_record?\n @session_key\n else\n ActiveRecord::Base.session_keys[session_key_id]\n end\n end", "def session_key=(key)\n @session_key = key\n end", "def session_key\n MfaLog.get_mfa_session_key(self.admin_id, self.ip_address)\n end", "def session_key(value = nil)\n if value.nil?\n read_inheritable_attribute(:session_key) || session_key(cookie_key)\n else\n write_inheritable_attribute(:session_key, value)\n end\n end", "def facebook_session_key\n @json['sessionKey']\n end", "def rails_app_session_key\n Rails.application.config.session_options[:key]\nend", "def sessionkey(value)\n merge(sessionkey: value.to_s)\n end", "def session_key\n \"#{bot.username}:#{chat['id']}:#{from['id']}\" if chat && from\n end", "def session_id; end", "def session_id; end", "def session_id; end", "def rucaptcha_sesion_key_key\n warning_when_session_invalid if rucaptcha_session_id.blank?\n\n # With https://github.com/rack/rack/commit/7fecaee81f59926b6e1913511c90650e76673b38\n # to protected session_id into secret\n session_id_digest = Digest::SHA256.hexdigest(rucaptcha_session_id.inspect)\n [\"rucaptcha-session\", session_id_digest].join(\":\")\n end", "def session_key\n\t\treturn \"voters\"\n\tend", "def cache_key(id)\n \"_session_id:#{id}\"\n end", "def update_session_key\n @parameters['sessionKey'] = get_session_key\n end", "def [](key)\r\n session[key]\r\n end", "def get_session_key\n action = 'uam'\n\n url_params = {\n 'action' => action,\n 'rssuserid' => @parameters['RSSAdminUserID'],\n 'rssurl' => @parameters['RSSURL'],\n 'rssdsn' => @parameters['RSSDSN'],\n 'packetuser' => @parameters['PacketUser'],\n 'assignedby' => @parameters['RSSAdminUserID'],\n 'tssurl' => @parameters['TSSURL']\n }\n\n response_body = get_request(url_params).body\n \n key = response_body.match(/sessionKey = '(.*?)';/)[1]\n if key.nil?\n raise StandardError, \"Session key not found\"\n else\n return key\n end\n end", "def secret_key\n ActionController::Base.session_options[:secret]\n end", "def session_api_key\n api_keys.active.session.create\n end", "def session_id\n @session_id ||= \"#{chip_api.redis_session_prefix}_#{token.claims_token.api_id}\"\n end", "def session_id\n @session.nil? ? '' : @session.session_id\n end", "def set_session_key(key) \n if self.new_record?\n @session_key=key\n else\n ActiveRecord::Base.session_keys[session_key_id]=key\n end\n decrypt_attributes if self.class.include? Encrypted #if respond_to?(:decrypt_attributes)\n \n end", "def [](key)\n sess_hash[key.to_sym]\n end", "def session_id\n @options[:session_id]\n end", "def session_id\n request.session_options[:id]\n end", "def session_key\n\t\treturn \"elections\"\n\tend", "def get_session_key\n\t\tres = RestClient.get 'https://secure.techfortesco.com/groceryapi_b1/restservice.aspx', {:params => {:command => 'LOGIN', :email => 'bwhtmn@gmail.com', :password => 'stokfridge', :developerkey => 'OULdsDZaBmGE47M7SWK2', :applicationkey => '04291BA250D2B7D6A01D'}}\n\t\tres = JSON.parse(res)\n\t\tres['SessionKey']\n\tend", "def user_key\n send(Devise.authentication_keys.first)\n end", "def user_key\n send(Devise.authentication_keys.first)\n end", "def current_client_id\n @session[@session_key]\n end", "def get_registration_key(session_id)\n reverse_key = [owner_id, job_id, server].join(\"_\")\n Cache.get(\"#{session_id}_#{reverse_key}\")\n end", "def session_id\n @session_id ||= begin\n response = authenticate\n response.body[:authenticate_response][:return]\n end\n end", "def session_id\n super\n end", "def session_id\n super\n end", "def set_session_key(key) \n @session_key=key\n self.decrypt_attributes if self.class.include? Encrypted\n end", "def session_key\n\t\treturn \"candidates\"\n\tend", "def sessionkey(*values)\n values.inject(self) { |res, val| res._sessionkey(val) }\n end", "def id\n response_hash[:session_id]\n end", "def refresh_key\n refresh_session_token unless token_valid?\n @key = Digest::MD5.hexdigest( Digest::MD5.hexdigest(@toodle_password) + Babar::Base.toodle_app_token + @session_token)\n end", "def session_id\n @driver.session_id\n end", "def session_id\n session.transport.algorithms.session_id\n end", "def current_session_id(env)\n env[ENV_SESSION_OPTIONS_KEY][:id]\n end", "def get_logged_in_user(session_key)\n\t\t\t\t\tSession.first(:key => session_key).user\n\t\t\t\tend", "def auth_token_for(key)\n @username_auth_tokens[secure_auth_token_key(key)]\n end", "def key\n @key\n end", "def key\n @key\n end", "def fetch_session_key(&blk)\n doc = last_fm_web_service(\"method\" => \"auth.gettoken\")\n request_token = doc.value_at(\"//token\")\n\n yield \"http://www.last.fm/api/auth/?api_key=#{api_key}&token=#{request_token}\"\n\n doc = last_fm_web_service(\"method\" => \"auth.getsession\", \"token\" => request_token)\n\n @session_key = doc.value_at(\"//key\")\n @user = doc.value_at(\"//name\")\n\n @session_key\n end", "def store_session(session_key)\n if self.session_key != session_key\n update_attribute(:session_key, session_key)\n end\n end", "def key\n @key\n end", "def key\n @key\n end", "def key\n\t\t\tself.class.key(user)\n\t\tend", "def logged_in_user_id\n session[:user_id]\n end", "def get_session\n session = Session.create!(key: Random.rand(0xFFFFFFFF).to_s)\n render json: { id: session.id, key: session.key }\n end", "def two_factor_auth_cookie_key\n 'two_factor_auth_credentials'\n end", "def token_key\n @token_key\n end", "def userid\n \treturn session[:userid]\n \tend", "def session_cookie_value\n cookies[_session_id_key]\n end", "def key_id\n return @key_id\n end", "def key_id\n return @key_id\n end", "def key_id\n return @key_id\n end", "def key\n refresh_key unless key_valid?\n @key\n end", "def merchant_session_key\n http_call(:post, \"merchant-session-keys\", Opayo::Struct::MerchantSessionKey, nil, {\"vendorName\" => Opayo.config.vendor_name})\n end", "def key\n return \"#{user}\"\n end", "def auth_user_id\n session[:current_user_id] unless session[:current_user_id].nil?\n end", "def authenticatable_salt\n session_id.presence || reset_session_id!\n end", "def private_key\n @key\n end", "def cracker_session_id\n @session_id ||= ::Rex::Text.rand_text_alphanumeric(8)\n end", "def extract_session_id(env)\n request = Rack::Request.new(env)\n sid = request.cookies[@key]\n sid ||= request.params[@key] unless @cookie_only\n sid\n end", "def login_with_key(key)\n login(:key, key)\n end", "def valid_session\n { \"warden.user.user.key\" => session[\"warden.user.user.key\"] }\n end", "def user_key\n uid\n end", "def current_id\n session[:user_id]\n end", "def key\n return @key\n end", "def key\n return @key\n end", "def token_encryption_key_id\n return @token_encryption_key_id\n end", "def session_key\n return File.read(SESSION_FILE) if File.exist? SESSION_FILE\n\n url = URI(FONTELLO_URL)\n boundary = '----WebKitFormREQUEST_BOUNDARY7MA4YWxkTrZu0gW'\n\n # Setup a http connection with Fontello\n http = Net::HTTP.new url.host, url.port\n\n # Construct the request to get a session key\n request = Net::HTTP::Post.new url\n request['Content-Type'] = \"multipart/form-data; REQUEST_BOUNDARY=#{boundary}\"\n request['Content-Disposition'] = 'multipart/form-data'\n request['Cache-Control'] = 'no-cache'\n request.body = \"--#{boundary}\\r\\nContent-Disposition: form-data; name=\\\"config\\\"; filename=\\\"#{@config_file}\\\"\\r\\nContent-Type: application/json\\r\\n\\r\\n#{@fontello_config}\\r\\n\\r\\n\\r\\n--#{boundary}\"\n\n # Send the request to Fontello\n response = http.request(request)\n\n # Store the session key for later use\n File.write(SESSION_FILE, response.read_body)\n return response.read_body\n end", "def extract_session_id\n self.session_id = (@env[\"rack.session\"] ? @env[\"rack.session\"][\"session_id\"] : nil) || @request.ip\n end", "def session; @session; end", "def session; @session; end", "def session; @session; end", "def current_user_id\n session[:user_id]\n end", "def any_session!\n unless @session_token.present?\n _active_session = active_sessions(restricted: false, order: :updated_at.desc).first\n self.session_token = _active_session.session_token if _active_session.present?\n end\n @session_token\n end", "def authenticatable_salt\n \"#{super}#{session_token}\"\n end", "def authenticatable_salt\n \"#{super}#{session_token}\"\n end", "def to_param\n session_id\n end", "def key_id\n metadata[\"keyid\"]\n end", "def get_key\n @key = Base64.decode64('MzRlZTc5ODMtNWVlNi00MTQ3LWFhODYtNDQzZWEwNjJhYmY3NzQ0OTNkNmEtMmExNS00M2ZlLWFhY2UtZTc4NTY2OTI3NTg1Cg==')\n end", "def access_key_id\n credentials['access_key']\n end", "def valid_session\n {\"warden.user.user.key\" => session[\"warden.user.user.key\"]}\n end", "def secure!\n session_id_column = if self.class.columns_hash['sessid']\n :sessid\n else\n :session_id\n end\n raw_session_id = read_attribute(session_id_column)\n if ActionDispatch::Session::ActiveRecordStore.private_session_id?(raw_session_id)\n # is already private, nothing to do\n else\n session_id_object = Rack::Session::SessionId.new(raw_session_id)\n update_column(session_id_column, session_id_object.private_id)\n end\n end", "def session_hash(user)\n {\n username: user.username,\n authentication_token: user.authentication_token\n }\n end", "def username\n \treturn session[:username]\n \tend", "def session_token\n refresh_session_token unless token_valid?\n return @session_token\n end", "def key_id; end", "def yii_session_id(sid)\n Digest::MD5.hexdigest(::YiiRedisStore.session_digest).first(5) +\n Digest::MD5.hexdigest(['yii\\redis\\Session', sid].to_json)\n end", "def ensure_session_token\n self.session_token ||= generate_session_token\n end", "def private_key\n return self.authentication.private_key\n end", "def private_key\n return self.authentication.private_key\n end", "def key\n self.class._key\n end" ]
[ "0.8800732", "0.8371106", "0.80399156", "0.7695349", "0.7604878", "0.7512027", "0.7436687", "0.73977613", "0.7364958", "0.73039484", "0.7211072", "0.7211072", "0.7211072", "0.71681225", "0.715959", "0.7113635", "0.70376873", "0.7009792", "0.7009212", "0.6986573", "0.69512033", "0.6950032", "0.68718904", "0.6869257", "0.6859689", "0.683547", "0.6831788", "0.68124944", "0.67598355", "0.6752518", "0.6752518", "0.67449105", "0.6744241", "0.6685464", "0.6638962", "0.6638962", "0.66320854", "0.6631533", "0.66205764", "0.6607758", "0.66027075", "0.6600368", "0.6554577", "0.6547028", "0.6531919", "0.6503489", "0.6485662", "0.6485662", "0.6473413", "0.6430151", "0.6427158", "0.6427158", "0.6425268", "0.63897794", "0.638729", "0.63822", "0.637938", "0.6367458", "0.63505495", "0.63503647", "0.63503647", "0.63503647", "0.6337416", "0.63314027", "0.6326718", "0.63240397", "0.62983465", "0.62962586", "0.62872773", "0.6273199", "0.62577814", "0.62394375", "0.6231599", "0.6227989", "0.6227532", "0.6227532", "0.622072", "0.61986274", "0.6195124", "0.61882955", "0.61882955", "0.61882955", "0.6159962", "0.6159084", "0.61584836", "0.61584836", "0.61547667", "0.6152809", "0.61521727", "0.61455405", "0.6142793", "0.6139883", "0.61341137", "0.61322033", "0.61158806", "0.6101582", "0.6101537", "0.60958844", "0.60912985", "0.60912985", "0.60911286" ]
0.0
-1
| F M T + F | F F F M | F M M T | F M T
def test_and assert_false F & F, 'F & F' assert_false F & M, 'F & M' assert_false F & T, 'F & T' assert_false M & F, 'M & F' assert_maybe M & M, 'M & M' assert_maybe M & T, 'M & T' assert_false T & F, 'T & F' assert_maybe T & M, 'T & M' assert_true T & T, 'T & T' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def f\n self.g + self.h\n end", "def reducer; end", "def factions\n \n end", "def field_m(op)\n (op & 0xfc000000) >> 26\nend", "def fours\r\n left, right = self.pops self.size/3\r\n left.twos + right.twos\r\n end", "def fml (m)\n\tend", "def termsig(*) end", "def f\n end", "def term\n factor\n operations = ['*', '/']\n while (operations.any? { |op| @look == op })\n emit_ln 'MOVE D0, -(SP)'\n case @look\n when '*': multiply\n when '/': divide\n else expected('Mulop')\n end\n end\nend", "def next_f\n raise \"implement in subclass\"\n end", "def op; end", "def f\n g\n end", "def sha1_ft(t, b, c, d)\n return (b & c) | ((~b) & d) if(t < 20) \n return b ^ c ^ d if(t < 40)\n return (b & c) | (b & d) | (c & d) if(t < 60)\n return b ^ c ^ d;\n end", "def sha1_ft(t, b, c, d)\n return (b & c) | ((~b) & d) if t < 20\n return b ^ c ^ d if t < 40\n return (b & c) | (b & d) | (c & d) if t < 60\n b ^ c ^ d\n end", "def f6; return *['a','b'] &['a','Y','Z'] end", "def ftoc f\n (f - 32)*5/9\nend", "def m3; 3 end", "def * f\n result = Factorization.new(@factorbase)\n @factors.each do |b,e|\n result.add(b,e)\n end\n f.factors.each do |b,e|\n result.add(b,e)\n end\n result\n end", "def femto\n big_self * FEMTO\n end", "def getsimm(op)\n o = field_o(op);\n m = 1 << (16 - 1);\n\n (o ^ m) - m;\nend", "def m(x) x end", "def fed\n ( p p )\n p?a a?p\n\n q= p q =p\n p %%.....%% q\n dne end", "def gifts_given_and_received\n gifts_given + gifts_received\n end", "def bfs\n\n\n end", "def _reduce_377(val, _values, result); end", "def union! newFA\n end", "def star(reg)\n return opt(plus(reg))\nend", "def ftoc(temp)\n return (temp-32)*5/9\nend", "def my_func(f)\n\t(f - 32) * 5/9\nend", "def bfs\n\n end", "def union! newFA\ns0 = new_state\ns1 = new_state\nadd_transition(s0, @start, \"\")\nadd_transition(s0, newFA.get_start, \"\")\n# reset the final states of the current object\nkeys = @final.keys\ni = 0\nwhile i < keys.size\nadd_transition(keys[i], s1, \"\")\nset_final(keys[i], false)\ni = i + 1\nend\n# set the final states of the other object\nkeys = newFA.get_final\ni = 0\nwhile i < keys.size\nadd_transition(keys[i], s1, \"\")\ni = i + 1\nend\n# copy over the states\nkeys = newFA.get_state\ni = 0\nwhile i < keys.size\nadd_state(keys[i])\ni = i + 1\nend\n# copy over the transitions\nnewFA.get_trans_hash.keys.sort.each { |v1|\nnewFA.get_trans_hash[v1].keys.sort.each { |x|\nv2 = newFA.get_transition(v1,x)\ni = 0\nwhile i < v2.size\nadd_transition(v1, v2[i], x)\ni = i + 1\nend\n}\n}\nset_start(s0)\nset_final(s1, true)\n# copy over the alphabets\nnewFA.get_alpha.each{|a|\nif @alphabet.include?(a) == false\n@alphabet.push(a)\nend\n}\nend", "def ftoc(f)\n c = (f - 32.0) * 5.0 / 9.0\nend", "def ftoc(tempF)\n (tempF - 32.0) * (5.0 / 9.0)\nend", "def ftoc(temp)\n\t(temp - 32) * 5/9.0\nend", "def q(t)\n \n end", "def f\n F_COND()\n end", "def term\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 25 )\n __MULTIPLICATIONDIVISIONOPERATORS12__ = nil\n\n begin\n # at line 751:5: factor ( MULTIPLICATIONDIVISIONOPERATORS factor )*\n @state.following.push( TOKENS_FOLLOWING_factor_IN_term_1181 )\n factor\n @state.following.pop\n # at line 751:12: ( MULTIPLICATIONDIVISIONOPERATORS factor )*\n while true # decision 28\n alt_28 = 2\n look_28_0 = @input.peek( 1 )\n\n if ( look_28_0 == MULTIPLICATIONDIVISIONOPERATORS )\n alt_28 = 1\n\n end\n case alt_28\n when 1\n # at line 751:13: MULTIPLICATIONDIVISIONOPERATORS factor\n __MULTIPLICATIONDIVISIONOPERATORS12__ = match( MULTIPLICATIONDIVISIONOPERATORS, TOKENS_FOLLOWING_MULTIPLICATIONDIVISIONOPERATORS_IN_term_1184 )\n # --> action\n #Regla 3 GC\n \t\t @stack_operators.push(__MULTIPLICATIONDIVISIONOPERATORS12__.text)\n \t\t \n # <-- action\n @state.following.push( TOKENS_FOLLOWING_factor_IN_term_1211 )\n factor\n @state.following.pop\n # --> action\n #Regla 5 GC / VS\n \t\t if(@stack_operators.last == '*' or\n \t\t @stack_operators.last == '/' or\n \t\t @stack_operators.last == '&&') then\n \t\t operator = @stack_operators.pop\n \t\t operand_b = @stack_operands.pop\n \t\t operand_a = @stack_operands.pop\n \t\t result = get_avail\n \t\t generate(operator, operand_a, operand_b, result)\n \t\t free_avail(operand_a)\n \t\t free_avail(operand_b)\n free_avail_const(operand_a)\n free_avail_const(operand_b)\n \t\t @stack_operands.push(result)\n \t\t @stack_types.push(resulting_type(@stack_types.pop, @stack_types.pop, operator))\n \t\t end\n \t\t \n # <-- action\n\n else\n break # out of loop for decision 28\n end\n end # loop for decision 28\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__, 25 )\n\n end\n \n return \n end", "def alg; end", "def ftoc(tempF)\n (tempF - 32.0)*5.0/9.0\nend", "def star; end", "def ftoc(temp)\n\t(temp - 32) * 5.0/9.0\nend", "def bfs\n # raise NotImplementedError\n end", "def g_(acc,elt)\n elt/acc\nend", "def _reduce_76(val, _values, result); end", "def _reduce_76(val, _values, result); end", "def cops; end", "def cops; end", "def cops; end", "def formation; end", "def term\n factor\n while MULOPS.include?($lookahead)\n emitln \"movl %eax, -(0x8*#{$stackdepth})(%rsp)\"\n case $lookahead\n when \"*\"\n multiply\n when \"/\"\n divide\n else\n expected \"mulop\"\n end\n end\nend", "def op_nand(t_sym, f_sym, num_and)\n if num_and == t_sym\n return f_sym\n elsif num_and == f_sym\n return t_sym\n end\nend", "def make_fm2(f1, f2, f3, f4, p1, p2, p3, p4)\n Fm2.new(f1, f2, f3, f4, p1, p2, p3, p4)\nend", "def plus(reg)\n return lambda do |pos|\n statelist = reg.call(pos)\n curpos = pos + statelist.size\n endstate = { '' => Set.new( [pos, curpos + 1] ) }\n statelist << endstate\n return statelist\n end\nend", "def f\n 0\n end", "def f\n 0\n end", "def b_f_s(queue)\n queue.shift\n end", "def lagfib_step!(state, m)\n state << (state[0] + state[1]) % m\n state.shift\nend", "def q9_fibonacci(num)\n f1 = 0\n f2 = 1\n (num-1).times {|_|\n tmp = f2\n f2 += f1 \n f1 = tmp\n }\n f2\nend", "def *(other)\n\t\tif other.respond_to?(\"d\")\n return Fraccion.new(@n*other.n, @d*other.d)\n else\n return Fraccion.new(other*@n,@d)\n end\n\tend", "def ftoc(f)\n\tf = f.to_f\n\t(f - 32) * 5.0/9.0 \nend", "def tribonacci(signature,n)\n res = []\n n.times {\n res.push(signature.count > 0 ? signature.shift : res[-3..-1].reduce(:+))\n }\n res\nend", "def tr(p0, p1) end", "def F(i,j)\n\tif i == j\n\t\treturn i\n\tend\n\tif i > j\n\t\treturn F(i-j,j)\n\telse \n\t\treturn F(i,j-i)\n\tend\nend", "def _reduce_36(val, _values, result)\n result = logop(:and, val[0], val[2])\n \n result\nend", "def f\n 1\n end", "def Farenheit(intemp, inunit)\n if inunit == 'c'\n ((intemp * C_TO_F_CONVERSION1) + C_TO_F_CONVERSION2)\n elsif inunit == 'k'\n ((intemp * K_TO_F_CONVERSION1) - K_TO_F_CONVERSION2)\n elsif inunit == 'r'\n intemp - R_TO_F_CONVERSION\n end\n end", "def union! newFA\n \n ustart = new_state\n uend = new_state\n \n add_transition(ustart, @start, \"\")\n add_transition(ustart, newFA.start, \"\")\n set_start(ustart)\n\n @transition.merge!(newFA.transition)\n @state.merge!(newFA.state)\n\n @final.keys.each { |key| add_transition(key, uend, \"\")}\n newFA.final.keys.each { |key| add_transition(key, uend, \"\")}\n\n \n @final.keys.each { |key| set_final(key, false)}\n set_final(uend, true)\n \n newFA.alphabet.each{|letter|\n if !@alphabet.include?(letter)\n @alphabet.push(letter)\n end\n } \n\n\n end", "def do_plus s; a = mega_pop(s); b = mega_pop(s); s[:stack].push(a+b); end", "def calculate_fcost(p)\n\t\t@hcosts[p] + @gcosts[p]\n\tend", "def testTaskShiftedByFarSuccessor\n executeSimpleTest(\n [ [ 'T1', 'R2', 800, 2, ['T2'], ' =='],\n [ 'T2', 'R1', 1000, 2, [], ' =='],\n [ 'T3', 'R1', 200, 4, ['T2'], '===='],\n [ 'T4', 'R2', 900, 2, ['T5'], '=='],\n [ 'T5', 'R1', 850, 2, [], ' =='] ] )\n end", "def fold f,g\n case self\n when Left then f.(get)\n when Right then g.(get)\n end\n end", "def multiply(m)\n t = super(m)\n t.flip!\n end", "def ftoc(f)\n\tc = (f - 32).to_f * (5.0 / 9.0)\n\treturn c\nend", "def handle_times_divide(tokens)\n# puts \"HTD called with tokens #{tokens}\"\n result = [tokens[0]]\n pending_op = nil\n tokens[1..-1].each do |token|\n case token\n when '+', '-'\n result.push(token)\n when '*', '/'\n pending_op = token\n else\n case pending_op\n when '*'\n result[-1] *= token\n when '/'\n result[-1] /= token\n else\n result.push(token)\n end\n pending_op = nil\n end\n end\n result\nend", "def ct(t,w) u=t.length;r=w-(l=w/2-u/2)-u;' '*l+t+' '*r end", "def f\n 0\n end", "def test_proper_stack\n stack = TokenStack.new\n stack.push('4')\n stack.push('3')\n stack.push('*')\n terp = Interpreter.new(false, true)\n\n result = terp.binary_operation(0, stack)\n assert_equal 12, result\n end", "def right; end", "def right; end", "def fdist(n1, n2, f); 1.0 - q_f(n1, n2, f); end", "def for(operation); end", "def _reduce_516(val, _values, result)\n result = \"*#{value(val[1])}\".to_sym\n \n result\nend", "def too_complex; end", "def _reduce_551(val, _values, result)\n result = \"*#{value(val[1])}\".to_sym\n \n result\nend", "def phase_shift? ; false ; end", "def tribonacci(signature, n)\n return signature.shift(n) if n < 4\n 0.upto(n - 4) do |i|\n signature << signature[i] + signature[i + 1] + signature[i + 2]\n end\n signature\nend", "def _reduce_7(val, _values, result)\n return val[0] + val[1] \n result\nend", "def left_tri(tri)\n\nend", "def transmogrifier (a, b, c)\n ((a * b) ** c)\nend", "def bfs\n raise NotImplementedError\n end", "def bfs\n raise NotImplementedError\n end", "def bfs\n raise NotImplementedError\n end", "def bfs\n raise NotImplementedError\n end", "def bfs\n raise NotImplementedError\n end", "def bfs\n raise NotImplementedError\n end", "def bfs\n raise NotImplementedError\n end", "def bfs\n raise NotImplementedError\n end", "def bfs\n raise NotImplementedError\n end", "def bfs\n raise NotImplementedError\n end", "def bfs\n raise NotImplementedError\n end" ]
[ "0.5592755", "0.5502622", "0.51993346", "0.51813745", "0.51637113", "0.5139257", "0.51377285", "0.5120009", "0.5109711", "0.50951487", "0.5081847", "0.5056017", "0.50472075", "0.5005441", "0.49969888", "0.49959838", "0.49908784", "0.4988285", "0.49774465", "0.49756435", "0.4973108", "0.49539855", "0.4943605", "0.49313864", "0.49272415", "0.49218142", "0.49210006", "0.48907554", "0.48822433", "0.4861464", "0.4835779", "0.48346275", "0.4830948", "0.48276097", "0.48132914", "0.48085427", "0.4789375", "0.47867757", "0.47864062", "0.47855777", "0.47848225", "0.47811553", "0.47718877", "0.47649565", "0.47649565", "0.47606885", "0.47606885", "0.47606885", "0.4756394", "0.47514477", "0.47463086", "0.47409186", "0.47377005", "0.47311312", "0.47311312", "0.4728847", "0.47274795", "0.4721533", "0.47198218", "0.47181693", "0.47167102", "0.47047246", "0.47028872", "0.46985692", "0.46853897", "0.46780863", "0.46761075", "0.4662603", "0.46593118", "0.46530393", "0.46514112", "0.4650476", "0.4649237", "0.46455523", "0.46361566", "0.46323532", "0.462459", "0.46242985", "0.46242985", "0.46232352", "0.46216854", "0.461463", "0.46090358", "0.4606736", "0.460461", "0.46043873", "0.45975572", "0.45956782", "0.45948482", "0.45824146", "0.45824146", "0.45824146", "0.45824146", "0.45824146", "0.45824146", "0.45824146", "0.45824146", "0.45824146", "0.45824146", "0.45824146" ]
0.49495316
22
| F M T + F | F M T M | M M T T | T T T
def test_or assert_false F | F, 'F | F' assert_maybe F | M, 'F | M' assert_true F | T, 'F | T' assert_maybe M | F, 'M | F' assert_maybe M | M, 'M | M' assert_true M | T, 'M | T' assert_true T | F, 'T | F' assert_true T | M, 'T | M' assert_true T | T, 'T | T' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def f\n self.g + self.h\n end", "def reducer; end", "def field_m(op)\n (op & 0xfc000000) >> 26\nend", "def fml (m)\n\tend", "def f\n end", "def termsig(*) end", "def op; end", "def m(x) x end", "def m3; 3 end", "def f\n g\n end", "def test_and\n assert_false F & F, 'F & F'\n assert_false F & M, 'F & M'\n assert_false F & T, 'F & T'\n\n assert_false M & F, 'M & F'\n assert_maybe M & M, 'M & M'\n assert_maybe M & T, 'M & T'\n\n assert_false T & F, 'T & F'\n assert_maybe T & M, 'T & M'\n assert_true T & T, 'T & T'\n end", "def term\n factor\n operations = ['*', '/']\n while (operations.any? { |op| @look == op })\n emit_ln 'MOVE D0, -(SP)'\n case @look\n when '*': multiply\n when '/': divide\n else expected('Mulop')\n end\n end\nend", "def factions\n \n end", "def getsimm(op)\n o = field_o(op);\n m = 1 << (16 - 1);\n\n (o ^ m) - m;\nend", "def star(reg)\n return opt(plus(reg))\nend", "def sha1_ft(t, b, c, d)\n return (b & c) | ((~b) & d) if(t < 20) \n return b ^ c ^ d if(t < 40)\n return (b & c) | (b & d) | (c & d) if(t < 60)\n return b ^ c ^ d;\n end", "def * f\n result = Factorization.new(@factorbase)\n @factors.each do |b,e|\n result.add(b,e)\n end\n f.factors.each do |b,e|\n result.add(b,e)\n end\n result\n end", "def sha1_ft(t, b, c, d)\n return (b & c) | ((~b) & d) if t < 20\n return b ^ c ^ d if t < 40\n return (b & c) | (b & d) | (c & d) if t < 60\n b ^ c ^ d\n end", "def next_f\n raise \"implement in subclass\"\n end", "def _reduce_377(val, _values, result); end", "def gifts_given_and_received\n gifts_given + gifts_received\n end", "def union! newFA\n end", "def fours\r\n left, right = self.pops self.size/3\r\n left.twos + right.twos\r\n end", "def my_func(f)\n\t(f - 32) * 5/9\nend", "def femto\n big_self * FEMTO\n end", "def fed\n ( p p )\n p?a a?p\n\n q= p q =p\n p %%.....%% q\n dne end", "def f\n F_COND()\n end", "def make_fm2(f1, f2, f3, f4, p1, p2, p3, p4)\n Fm2.new(f1, f2, f3, f4, p1, p2, p3, p4)\nend", "def q(t)\n \n end", "def transmogrifier (a, b, c)\n ((a * b) ** c)\nend", "def f6; return *['a','b'] &['a','Y','Z'] end", "def ftoc f\n (f - 32)*5/9\nend", "def term\n factor\n while MULOPS.include?($lookahead)\n emitln \"movl %eax, -(0x8*#{$stackdepth})(%rsp)\"\n case $lookahead\n when \"*\"\n multiply\n when \"/\"\n divide\n else\n expected \"mulop\"\n end\n end\nend", "def multiply(m)\n t = super(m)\n t.flip!\n end", "def too_complex; end", "def f\n 0\n end", "def f\n 0\n end", "def f\n 1\n end", "def _reduce_76(val, _values, result); end", "def _reduce_76(val, _values, result); end", "def ftoc(temp)\n return (temp-32)*5/9\nend", "def term\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 25 )\n __MULTIPLICATIONDIVISIONOPERATORS12__ = nil\n\n begin\n # at line 751:5: factor ( MULTIPLICATIONDIVISIONOPERATORS factor )*\n @state.following.push( TOKENS_FOLLOWING_factor_IN_term_1181 )\n factor\n @state.following.pop\n # at line 751:12: ( MULTIPLICATIONDIVISIONOPERATORS factor )*\n while true # decision 28\n alt_28 = 2\n look_28_0 = @input.peek( 1 )\n\n if ( look_28_0 == MULTIPLICATIONDIVISIONOPERATORS )\n alt_28 = 1\n\n end\n case alt_28\n when 1\n # at line 751:13: MULTIPLICATIONDIVISIONOPERATORS factor\n __MULTIPLICATIONDIVISIONOPERATORS12__ = match( MULTIPLICATIONDIVISIONOPERATORS, TOKENS_FOLLOWING_MULTIPLICATIONDIVISIONOPERATORS_IN_term_1184 )\n # --> action\n #Regla 3 GC\n \t\t @stack_operators.push(__MULTIPLICATIONDIVISIONOPERATORS12__.text)\n \t\t \n # <-- action\n @state.following.push( TOKENS_FOLLOWING_factor_IN_term_1211 )\n factor\n @state.following.pop\n # --> action\n #Regla 5 GC / VS\n \t\t if(@stack_operators.last == '*' or\n \t\t @stack_operators.last == '/' or\n \t\t @stack_operators.last == '&&') then\n \t\t operator = @stack_operators.pop\n \t\t operand_b = @stack_operands.pop\n \t\t operand_a = @stack_operands.pop\n \t\t result = get_avail\n \t\t generate(operator, operand_a, operand_b, result)\n \t\t free_avail(operand_a)\n \t\t free_avail(operand_b)\n free_avail_const(operand_a)\n free_avail_const(operand_b)\n \t\t @stack_operands.push(result)\n \t\t @stack_types.push(resulting_type(@stack_types.pop, @stack_types.pop, operator))\n \t\t end\n \t\t \n # <-- action\n\n else\n break # out of loop for decision 28\n end\n end # loop for decision 28\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__, 25 )\n\n end\n \n return \n end", "def op_nand(t_sym, f_sym, num_and)\n if num_and == t_sym\n return f_sym\n elsif num_and == f_sym\n return t_sym\n end\nend", "def *(other)\n\t\tif other.respond_to?(\"d\")\n return Fraccion.new(@n*other.n, @d*other.d)\n else\n return Fraccion.new(other*@n,@d)\n end\n\tend", "def union! newFA\ns0 = new_state\ns1 = new_state\nadd_transition(s0, @start, \"\")\nadd_transition(s0, newFA.get_start, \"\")\n# reset the final states of the current object\nkeys = @final.keys\ni = 0\nwhile i < keys.size\nadd_transition(keys[i], s1, \"\")\nset_final(keys[i], false)\ni = i + 1\nend\n# set the final states of the other object\nkeys = newFA.get_final\ni = 0\nwhile i < keys.size\nadd_transition(keys[i], s1, \"\")\ni = i + 1\nend\n# copy over the states\nkeys = newFA.get_state\ni = 0\nwhile i < keys.size\nadd_state(keys[i])\ni = i + 1\nend\n# copy over the transitions\nnewFA.get_trans_hash.keys.sort.each { |v1|\nnewFA.get_trans_hash[v1].keys.sort.each { |x|\nv2 = newFA.get_transition(v1,x)\ni = 0\nwhile i < v2.size\nadd_transition(v1, v2[i], x)\ni = i + 1\nend\n}\n}\nset_start(s0)\nset_final(s1, true)\n# copy over the alphabets\nnewFA.get_alpha.each{|a|\nif @alphabet.include?(a) == false\n@alphabet.push(a)\nend\n}\nend", "def cops; end", "def cops; end", "def cops; end", "def f\n 0\n end", "def update_transition(method)\n m = method\n return if (d = instance_variable_get(\"@trans_d_#{m}\")).nil? || d==0\n return if (t = instance_variable_get(\"@trans_t_#{m}\")) > d\n b = instance_variable_get(\"@trans_b_#{m}\")\n c = instance_variable_get(\"@trans_c_#{m}\")\n f = instance_variable_get(\"@trans_f_#{m}\")\n f = Easing::FUNCTIONS[f]\n v = t==0 ? b : t==d ? b + c : b + c*f[t/d]\n instance_variable_set(\"@trans_t_#{m}\", t + 1)\n method(\"#{m}=\")[v]\n end", "def transmogrifier(a, b, c)\n # (a * b).pow(c)\n (a * b) ** c\nend", "def ftoc(tempF)\n (tempF - 32.0) * (5.0 / 9.0)\nend", "def ftoc(f)\n c = (f - 32.0) * 5.0 / 9.0\nend", "def fold f,g\n case self\n when Left then f.(get)\n when Right then g.(get)\n end\n end", "def alg; end", "def f() 1 end", "def transmogrifier(a, b, c)\n p (a * b) ** c\nend", "def tr(p0, p1) end", "def +(other)\n\t\tif other.respond_to?(\"d\")\n\t\t\treturn Fraccion.new(((mcm(@d, other.d) / @d)*@n) + ((mcm(@d, other.d) / other.d)*other.n),mcm(@d, other.d))\n\t\telse\n\t\t\treturn Fraccion.new( ((other*@d) + @n), @d)\n\t\tend\t\n\tend", "def _reduce_36(val, _values, result)\n result = logop(:and, val[0], val[2])\n \n result\nend", "def fdist(n1, n2, f); 1.0 - q_f(n1, n2, f); end", "def test_xor\n assert_false F ^ F, 'F ^ F'\n assert_maybe F ^ M, 'F ^ M'\n assert_true F ^ T, 'F ^ T'\n\n assert_maybe M ^ F, 'M ^ F'\n assert_maybe M ^ M, 'M ^ M'\n assert_maybe M ^ T, 'M ^ T'\n\n assert_true T ^ F, 'T ^ F'\n assert_maybe T ^ M, 'T ^ M'\n assert_false T ^ T, 'T ^ T'\n end", "def g_(acc,elt)\n elt/acc\nend", "def q9_fibonacci(num)\n f1 = 0\n f2 = 1\n (num-1).times {|_|\n tmp = f2\n f2 += f1 \n f1 = tmp\n }\n f2\nend", "def ftoc(temp)\n\t(temp - 32) * 5/9.0\nend", "def m1\n\t\t\t\t\tsuper * 2 \t\t\t\t\t\t\t\t\t\t\t# second override to #m1 \n\t\t\t\tend", "def Farenheit(intemp, inunit)\n if inunit == 'c'\n ((intemp * C_TO_F_CONVERSION1) + C_TO_F_CONVERSION2)\n elsif inunit == 'k'\n ((intemp * K_TO_F_CONVERSION1) - K_TO_F_CONVERSION2)\n elsif inunit == 'r'\n intemp - R_TO_F_CONVERSION\n end\n end", "def do_plus s; a = mega_pop(s); b = mega_pop(s); s[:stack].push(a+b); end", "def ftoc(tempF)\n (tempF - 32.0)*5.0/9.0\nend", "def F(i,j)\n\tif i == j\n\t\treturn i\n\tend\n\tif i > j\n\t\treturn F(i-j,j)\n\telse \n\t\treturn F(i,j-i)\n\tend\nend", "def formation; end", "def _reduce_7(val, _values, result)\n return val[0] + val[1] \n result\nend", "def square_of_sum\n end", "def star; end", "def _reduce_5(val, _values)\n AST::True.new true \nend", "def right; end", "def right; end", "def g(x)\n -> (y) { f(x, y) }\nend", "def ops(node)\n if node.left.nil? || node.right.nil?\n return 1 if /[\\+\\-\\*\\%\\/\\.]/.match(node.value)\n else\n return (ops(node.left) + ops(node.right))\n end\nend", "def e2w(n, m)\n# n = (n+0.938272)*(n+0.938272) - n*n\n n+m\nend", "def test_proper_stack\n stack = TokenStack.new\n stack.push('4')\n stack.push('3')\n stack.push('*')\n terp = Interpreter.new(false, true)\n\n result = terp.binary_operation(0, stack)\n assert_equal 12, result\n end", "def multiply!(m)\n super().flip!\n end", "def bfs\n\n\n end", "def add(term1, term2)\n return term1 + term2\nend", "def ftoc(temp)\n\t(temp - 32) * 5.0/9.0\nend", "def sum; end", "def f(i, j)\n i + j\n end", "def testTaskShiftedByFarSuccessor\n executeSimpleTest(\n [ [ 'T1', 'R2', 800, 2, ['T2'], ' =='],\n [ 'T2', 'R1', 1000, 2, [], ' =='],\n [ 'T3', 'R1', 200, 4, ['T2'], '===='],\n [ 'T4', 'R2', 900, 2, ['T5'], '=='],\n [ 'T5', 'R1', 850, 2, [], ' =='] ] )\n end", "def add_m(a,b)\n \"#{a} + #{b} so: #{a + b}\"\nend", "def union! newFA\n \n ustart = new_state\n uend = new_state\n \n add_transition(ustart, @start, \"\")\n add_transition(ustart, newFA.start, \"\")\n set_start(ustart)\n\n @transition.merge!(newFA.transition)\n @state.merge!(newFA.state)\n\n @final.keys.each { |key| add_transition(key, uend, \"\")}\n newFA.final.keys.each { |key| add_transition(key, uend, \"\")}\n\n \n @final.keys.each { |key| set_final(key, false)}\n set_final(uend, true)\n \n newFA.alphabet.each{|letter|\n if !@alphabet.include?(letter)\n @alphabet.push(letter)\n end\n } \n\n\n end", "def tribonacci(signature,n)\n res = []\n n.times {\n res.push(signature.count > 0 ? signature.shift : res[-3..-1].reduce(:+))\n }\n res\nend", "def transmogrifier (a,b,c)\n (a*b)^c\n end", "def _reduce_37(val, _values, result); end", "def _reduce_37(val, _values, result); end", "def times_three_and_plus_five(number)\n number * 3 + 5\n end", "def handle_times_divide(tokens)\n# puts \"HTD called with tokens #{tokens}\"\n result = [tokens[0]]\n pending_op = nil\n tokens[1..-1].each do |token|\n case token\n when '+', '-'\n result.push(token)\n when '*', '/'\n pending_op = token\n else\n case pending_op\n when '*'\n result[-1] *= token\n when '/'\n result[-1] /= token\n else\n result.push(token)\n end\n pending_op = nil\n end\n end\n result\nend", "def m1(a,b,c,d)\n return (((a+(M-b)+(M-c))%M)^(d%M))%M # mix/power mod\n end", "def always_three_method(number)\n\t(((number+5)*2 -4)/2 - number)\nend", "def m\nend", "def m\nend" ]
[ "0.5603548", "0.5327163", "0.51566607", "0.5147912", "0.5144576", "0.51122254", "0.51009554", "0.50868076", "0.50845224", "0.5070233", "0.50523746", "0.5048417", "0.5045751", "0.50297564", "0.5025227", "0.5009734", "0.49996307", "0.4990968", "0.49835384", "0.49809727", "0.49755365", "0.49397415", "0.49334183", "0.49233097", "0.48967156", "0.4891336", "0.48551977", "0.4839682", "0.4817296", "0.48134917", "0.4799407", "0.4798847", "0.47836262", "0.47619808", "0.47540572", "0.47478762", "0.47478762", "0.47449616", "0.47420946", "0.47420946", "0.47394708", "0.4731466", "0.47099903", "0.47087383", "0.47029412", "0.4687776", "0.4687776", "0.4687776", "0.46803775", "0.4672377", "0.46695772", "0.46695057", "0.466887", "0.4666979", "0.46632338", "0.46561724", "0.46482345", "0.4647355", "0.46433178", "0.46412256", "0.4637557", "0.4623207", "0.46212354", "0.46145543", "0.46140435", "0.46138403", "0.46119085", "0.46113485", "0.4610923", "0.4610324", "0.46081463", "0.46052796", "0.45978495", "0.45970106", "0.45952582", "0.45937538", "0.45937538", "0.45936075", "0.4591375", "0.45882094", "0.4585114", "0.45779485", "0.45776454", "0.457655", "0.45737165", "0.45710036", "0.4569237", "0.45667934", "0.45647347", "0.45630512", "0.45601574", "0.455926", "0.45584202", "0.45584202", "0.45506316", "0.45504442", "0.45502225", "0.4549568", "0.45461994", "0.45461994" ]
0.45496485
97
| F M T + F | F M T M | M M M T | T M F
def test_xor assert_false F ^ F, 'F ^ F' assert_maybe F ^ M, 'F ^ M' assert_true F ^ T, 'F ^ T' assert_maybe M ^ F, 'M ^ F' assert_maybe M ^ M, 'M ^ M' assert_maybe M ^ T, 'M ^ T' assert_true T ^ F, 'T ^ F' assert_maybe T ^ M, 'T ^ M' assert_false T ^ T, 'T ^ T' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def f\n self.g + self.h\n end", "def reducer; end", "def field_m(op)\n (op & 0xfc000000) >> 26\nend", "def fml (m)\n\tend", "def m3; 3 end", "def fours\r\n left, right = self.pops self.size/3\r\n left.twos + right.twos\r\n end", "def f\n end", "def factions\n \n end", "def m(x) x end", "def getsimm(op)\n o = field_o(op);\n m = 1 << (16 - 1);\n\n (o ^ m) - m;\nend", "def termsig(*) end", "def ftoc f\n (f - 32)*5/9\nend", "def sha1_ft(t, b, c, d)\n return (b & c) | ((~b) & d) if(t < 20) \n return b ^ c ^ d if(t < 40)\n return (b & c) | (b & d) | (c & d) if(t < 60)\n return b ^ c ^ d;\n end", "def f\n g\n end", "def term\n factor\n operations = ['*', '/']\n while (operations.any? { |op| @look == op })\n emit_ln 'MOVE D0, -(SP)'\n case @look\n when '*': multiply\n when '/': divide\n else expected('Mulop')\n end\n end\nend", "def op; end", "def sha1_ft(t, b, c, d)\n return (b & c) | ((~b) & d) if t < 20\n return b ^ c ^ d if t < 40\n return (b & c) | (b & d) | (c & d) if t < 60\n b ^ c ^ d\n end", "def femto\n big_self * FEMTO\n end", "def next_f\n raise \"implement in subclass\"\n end", "def * f\n result = Factorization.new(@factorbase)\n @factors.each do |b,e|\n result.add(b,e)\n end\n f.factors.each do |b,e|\n result.add(b,e)\n end\n result\n end", "def gifts_given_and_received\n gifts_given + gifts_received\n end", "def fed\n ( p p )\n p?a a?p\n\n q= p q =p\n p %%.....%% q\n dne end", "def test_and\n assert_false F & F, 'F & F'\n assert_false F & M, 'F & M'\n assert_false F & T, 'F & T'\n\n assert_false M & F, 'M & F'\n assert_maybe M & M, 'M & M'\n assert_maybe M & T, 'M & T'\n\n assert_false T & F, 'T & F'\n assert_maybe T & M, 'T & M'\n assert_true T & T, 'T & T'\n end", "def _reduce_377(val, _values, result); end", "def my_func(f)\n\t(f - 32) * 5/9\nend", "def f6; return *['a','b'] &['a','Y','Z'] end", "def ftoc(temp)\n return (temp-32)*5/9\nend", "def alg; end", "def make_fm2(f1, f2, f3, f4, p1, p2, p3, p4)\n Fm2.new(f1, f2, f3, f4, p1, p2, p3, p4)\nend", "def ftoc(temp)\n\t(temp - 32) * 5/9.0\nend", "def bfs\n\n\n end", "def ftoc(f)\n c = (f - 32.0) * 5.0 / 9.0\nend", "def ftoc(tempF)\n (tempF - 32.0) * (5.0 / 9.0)\nend", "def ftoc(temp)\n\t(temp - 32) * 5.0/9.0\nend", "def term\n factor\n while MULOPS.include?($lookahead)\n emitln \"movl %eax, -(0x8*#{$stackdepth})(%rsp)\"\n case $lookahead\n when \"*\"\n multiply\n when \"/\"\n divide\n else\n expected \"mulop\"\n end\n end\nend", "def e2w(n, m)\n# n = (n+0.938272)*(n+0.938272) - n*n\n n+m\nend", "def f\n 0\n end", "def f\n 0\n end", "def ftoc(tempF)\n (tempF - 32.0)*5.0/9.0\nend", "def union! newFA\n end", "def bfs\n\n end", "def formation; end", "def F(i,j)\n\tif i == j\n\t\treturn i\n\tend\n\tif i > j\n\t\treturn F(i-j,j)\n\telse \n\t\treturn F(i,j-i)\n\tend\nend", "def ct(t,w) u=t.length;r=w-(l=w/2-u/2)-u;' '*l+t+' '*r end", "def cops; end", "def cops; end", "def cops; end", "def star; end", "def m1(a,b,c,d)\n return (((a+(M-b)+(M-c))%M)^(d%M))%M # mix/power mod\n end", "def star(reg)\n return opt(plus(reg))\nend", "def _reduce_76(val, _values, result); end", "def _reduce_76(val, _values, result); end", "def union! newFA\ns0 = new_state\ns1 = new_state\nadd_transition(s0, @start, \"\")\nadd_transition(s0, newFA.get_start, \"\")\n# reset the final states of the current object\nkeys = @final.keys\ni = 0\nwhile i < keys.size\nadd_transition(keys[i], s1, \"\")\nset_final(keys[i], false)\ni = i + 1\nend\n# set the final states of the other object\nkeys = newFA.get_final\ni = 0\nwhile i < keys.size\nadd_transition(keys[i], s1, \"\")\ni = i + 1\nend\n# copy over the states\nkeys = newFA.get_state\ni = 0\nwhile i < keys.size\nadd_state(keys[i])\ni = i + 1\nend\n# copy over the transitions\nnewFA.get_trans_hash.keys.sort.each { |v1|\nnewFA.get_trans_hash[v1].keys.sort.each { |x|\nv2 = newFA.get_transition(v1,x)\ni = 0\nwhile i < v2.size\nadd_transition(v1, v2[i], x)\ni = i + 1\nend\n}\n}\nset_start(s0)\nset_final(s1, true)\n# copy over the alphabets\nnewFA.get_alpha.each{|a|\nif @alphabet.include?(a) == false\n@alphabet.push(a)\nend\n}\nend", "def q(t)\n \n end", "def term\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 25 )\n __MULTIPLICATIONDIVISIONOPERATORS12__ = nil\n\n begin\n # at line 751:5: factor ( MULTIPLICATIONDIVISIONOPERATORS factor )*\n @state.following.push( TOKENS_FOLLOWING_factor_IN_term_1181 )\n factor\n @state.following.pop\n # at line 751:12: ( MULTIPLICATIONDIVISIONOPERATORS factor )*\n while true # decision 28\n alt_28 = 2\n look_28_0 = @input.peek( 1 )\n\n if ( look_28_0 == MULTIPLICATIONDIVISIONOPERATORS )\n alt_28 = 1\n\n end\n case alt_28\n when 1\n # at line 751:13: MULTIPLICATIONDIVISIONOPERATORS factor\n __MULTIPLICATIONDIVISIONOPERATORS12__ = match( MULTIPLICATIONDIVISIONOPERATORS, TOKENS_FOLLOWING_MULTIPLICATIONDIVISIONOPERATORS_IN_term_1184 )\n # --> action\n #Regla 3 GC\n \t\t @stack_operators.push(__MULTIPLICATIONDIVISIONOPERATORS12__.text)\n \t\t \n # <-- action\n @state.following.push( TOKENS_FOLLOWING_factor_IN_term_1211 )\n factor\n @state.following.pop\n # --> action\n #Regla 5 GC / VS\n \t\t if(@stack_operators.last == '*' or\n \t\t @stack_operators.last == '/' or\n \t\t @stack_operators.last == '&&') then\n \t\t operator = @stack_operators.pop\n \t\t operand_b = @stack_operands.pop\n \t\t operand_a = @stack_operands.pop\n \t\t result = get_avail\n \t\t generate(operator, operand_a, operand_b, result)\n \t\t free_avail(operand_a)\n \t\t free_avail(operand_b)\n free_avail_const(operand_a)\n free_avail_const(operand_b)\n \t\t @stack_operands.push(result)\n \t\t @stack_types.push(resulting_type(@stack_types.pop, @stack_types.pop, operator))\n \t\t end\n \t\t \n # <-- action\n\n else\n break # out of loop for decision 28\n end\n end # loop for decision 28\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__, 25 )\n\n end\n \n return \n end", "def ftoc(f)\n\tf = f.to_f\n\t(f - 32) * 5.0/9.0 \nend", "def f\n F_COND()\n end", "def Farenheit(intemp, inunit)\n if inunit == 'c'\n ((intemp * C_TO_F_CONVERSION1) + C_TO_F_CONVERSION2)\n elsif inunit == 'k'\n ((intemp * K_TO_F_CONVERSION1) - K_TO_F_CONVERSION2)\n elsif inunit == 'r'\n intemp - R_TO_F_CONVERSION\n end\n end", "def transmogrifier (a, b, c)\n ((a * b) ** c)\nend", "def multiply(m)\n t = super(m)\n t.flip!\n end", "def testTaskShiftedByFarSuccessor\n executeSimpleTest(\n [ [ 'T1', 'R2', 800, 2, ['T2'], ' =='],\n [ 'T2', 'R1', 1000, 2, [], ' =='],\n [ 'T3', 'R1', 200, 4, ['T2'], '===='],\n [ 'T4', 'R2', 900, 2, ['T5'], '=='],\n [ 'T5', 'R1', 850, 2, [], ' =='] ] )\n end", "def f\n 1\n end", "def f\n 0\n end", "def lagfib_step!(state, m)\n state << (state[0] + state[1]) % m\n state.shift\nend", "def m1(a,b,c,d)\n (((a+(M-b)+(M-c))%M)^(d%M))%M # mix/power mod\n end", "def ftoc(f)\n\tc = (f - 32).to_f * (5.0 / 9.0)\n\treturn c\nend", "def f size\n\t\tmasks = (size-1).downto(0).map{|s|\n\t\t\t2 ** s \n\t\t}\n\t\t(2 ** size).times.map{|x|\n\t\t\tmasks.map{|mask|(x & mask)==0}\n\t\t\t}\n\tend", "def too_complex; end", "def m1\n\t\t\t\t\tsuper * 2 \t\t\t\t\t\t\t\t\t\t\t# second override to #m1 \n\t\t\t\tend", "def *(other)\n\t\tif other.respond_to?(\"d\")\n return Fraccion.new(@n*other.n, @d*other.d)\n else\n return Fraccion.new(other*@n,@d)\n end\n\tend", "def _reduce_36(val, _values, result)\n result = logop(:and, val[0], val[2])\n \n result\nend", "def fdist(n1, n2, f); 1.0 - q_f(n1, n2, f); end", "def q9_fibonacci(num)\n f1 = 0\n f2 = 1\n (num-1).times {|_|\n tmp = f2\n f2 += f1 \n f1 = tmp\n }\n f2\nend", "def bfs\n # raise NotImplementedError\n end", "def recessive k, m, n\n all = k + m + n\n mix = m + n\n total = 4.0 * triangle(all) # 2 * squareish all = 2 * 2 * triangle all\n\n lhs = triangle n\n mid = n * mix - n\n rhs = triangle mix\n\n 1 - (lhs+mid+rhs) / total\n end", "def ways(s,m)\n CALLS[0] += 1\n return 1 if s == 0\n return 0 if m == 0\n return 1 if m == 1\n WAYS[[s,m]] ||= ways(s,m-1) + ways(s-m,[s-m,m].min)\nend", "def calculate_fcost(p)\n\t\t@hcosts[p] + @gcosts[p]\n\tend", "def tribonacci(signature,n)\n res = []\n n.times {\n res.push(signature.count > 0 ? signature.shift : res[-3..-1].reduce(:+))\n }\n res\nend", "def gf2_element_times(a, b)\n if (a == 0 || b == 0)\n return 0\n else\n logA = LOG_TABLE[a & 0xFF]\n logB = LOG_TABLE[b & 0xFF]\n logResult = logA + logB\n return EXP_TABLE[logResult]\n end\nend", "def right; end", "def right; end", "def b_f_s(queue)\n queue.shift\n end", "def m\nend", "def m\nend", "def cantor_pairing(n, m)\n (n + m) * (n + m + 1) / 2 + m\nend", "def tr(p0, p1) end", "def op_nand(t_sym, f_sym, num_and)\n if num_and == t_sym\n return f_sym\n elsif num_and == f_sym\n return t_sym\n end\nend", "def hamming(n)\n base, seen, twos, threes, fives = 0, [1], [], [], []\n m = 1\n\n until n == 1\n twos << seen[base] * 2\n threes << seen[base] * 3\n fives << seen[base] * 5\n\n o = m\n until m != o\n m = [twos, threes, fives].min_by(&:first).shift\n end\n\n n -= 1\n base += 1\n seen << m\n end\n\n m\nend", "def g_(acc,elt)\n elt/acc\nend", "def handle_times_divide(tokens)\n# puts \"HTD called with tokens #{tokens}\"\n result = [tokens[0]]\n pending_op = nil\n tokens[1..-1].each do |token|\n case token\n when '+', '-'\n result.push(token)\n when '*', '/'\n pending_op = token\n else\n case pending_op\n when '*'\n result[-1] *= token\n when '/'\n result[-1] /= token\n else\n result.push(token)\n end\n pending_op = nil\n end\n end\n result\nend", "def update_transition(method)\n m = method\n return if (d = instance_variable_get(\"@trans_d_#{m}\")).nil? || d==0\n return if (t = instance_variable_get(\"@trans_t_#{m}\")) > d\n b = instance_variable_get(\"@trans_b_#{m}\")\n c = instance_variable_get(\"@trans_c_#{m}\")\n f = instance_variable_get(\"@trans_f_#{m}\")\n f = Easing::FUNCTIONS[f]\n v = t==0 ? b : t==d ? b + c : b + c*f[t/d]\n instance_variable_set(\"@trans_t_#{m}\", t + 1)\n method(\"#{m}=\")[v]\n end", "def multiply!(m)\n super().flip!\n end", "def _reduce_516(val, _values, result)\n result = \"*#{value(val[1])}\".to_sym\n \n result\nend", "def primordial; end", "def fold f,g\n case self\n when Left then f.(get)\n when Right then g.(get)\n end\n end", "def transmogrifier(a, b, c)\n p (a * b) ** c\nend", "def transmogrifier(a, b, c)\n # (a * b).pow(c)\n (a * b) ** c\nend", "def _reduce_551(val, _values, result)\n result = \"*#{value(val[1])}\".to_sym\n \n result\nend", "def union! newFA\n \n ustart = new_state\n uend = new_state\n \n add_transition(ustart, @start, \"\")\n add_transition(ustart, newFA.start, \"\")\n set_start(ustart)\n\n @transition.merge!(newFA.transition)\n @state.merge!(newFA.state)\n\n @final.keys.each { |key| add_transition(key, uend, \"\")}\n newFA.final.keys.each { |key| add_transition(key, uend, \"\")}\n\n \n @final.keys.each { |key| set_final(key, false)}\n set_final(uend, true)\n \n newFA.alphabet.each{|letter|\n if !@alphabet.include?(letter)\n @alphabet.push(letter)\n end\n } \n\n\n end", "def tribonacci(signature, n)\n return signature.shift(n) if n < 4\n 0.upto(n - 4) do |i|\n signature << signature[i] + signature[i + 1] + signature[i + 2]\n end\n signature\nend", "def _reduce_7(val, _values, result)\n return val[0] + val[1] \n result\nend" ]
[ "0.5541351", "0.54421735", "0.52573425", "0.5251038", "0.51902086", "0.5183739", "0.5097668", "0.5096984", "0.505781", "0.50424546", "0.50211966", "0.50094885", "0.5009476", "0.50056964", "0.5005122", "0.5001263", "0.49776042", "0.4974213", "0.49547005", "0.49363297", "0.49295232", "0.49136564", "0.49105486", "0.49039063", "0.4900862", "0.4881258", "0.48703998", "0.4847739", "0.4820142", "0.4803301", "0.47927982", "0.4772579", "0.47605675", "0.47541", "0.4752717", "0.47511137", "0.4749343", "0.4749343", "0.47396672", "0.4737491", "0.4732859", "0.47303185", "0.47300878", "0.4728383", "0.4728278", "0.4728278", "0.4728278", "0.47279003", "0.47264728", "0.4726144", "0.47229233", "0.47229233", "0.4718609", "0.47180164", "0.47171104", "0.46987048", "0.46825814", "0.46786648", "0.4676087", "0.46756527", "0.46748635", "0.46745834", "0.46656364", "0.466295", "0.46564013", "0.4653801", "0.46507454", "0.4642987", "0.46381474", "0.4638111", "0.46371746", "0.46297574", "0.4627218", "0.46241263", "0.46158326", "0.4609799", "0.46070454", "0.46015185", "0.45940733", "0.45816788", "0.45816788", "0.45810503", "0.4580717", "0.4580717", "0.45761865", "0.45717603", "0.45702466", "0.45639536", "0.45625222", "0.45599386", "0.4554122", "0.45539203", "0.45522127", "0.45486552", "0.45482117", "0.4548056", "0.45443153", "0.45389605", "0.45382106", "0.45368105", "0.45366773" ]
0.0
-1
Creates a new DB models: the list of Welo::Resource models to use (i.e., classes)
def initialize(models, params={}) @models = models @extensions = params[:extensions] || ['.json'] @identifying_sym = params[:identifying_sym] || :flat_db build! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_models\n @name = name.singularize.downcase\n @name_plural = @name.pluralize\n @attributes = attributes\n template(\"./templates/model.erb\", \"./models/#{@name}.rb\")\n end", "def load_models\n url = Configuration::PROPERTIES.get_property :url\n url_get_records = Configuration::PROPERTIES.get_property :url_get_models\n\n url_get_records = url_get_records.gsub '{csk}', URI::encode(@credential[:csk])\n url_get_records = url_get_records.gsub '{aci}', URI::encode(@credential[:aci])\n\n response = DynamicService::ServiceCaller.call_service url + url_get_records, {}, 'get'\n\n json = JSON.parse(response)\n unless json['status'] == 200\n raise json['message']\n end\n\n models = []\n array = json['models']\n array.each do |item|\n model = Dynamicloud::API::Model::RecordModel.new item['id'].to_i\n model.name = item['name']\n model.description = item['description']\n\n models.push model\n end\n\n models\n end", "def create_models\n @target_prefix = target.blank? ? '' : (target.camelize + '::')\n models = options[:models] || MODELS\n model_names = options[:names] || MODELS\n models.zip(model_names).each do |original_name, new_name|\n @model_name = new_name.camelize\n template \"#{original_name}.rb\",\n \"app/models/#{target}/#{@model_name.underscore}.rb\"\n end\n end", "def generate_models\n (translation.tables + translation.polymorphic_tables).each do |table|\n build_model(table)\n end\n end", "def all\n properties = get_properties\n create_models(properties)\n end", "def load_models\n @models = []\n # Load Models and Schema for corresponding orm\n re = /^.*\\/(.*).rb$/\n Dir[\"#{ROOT}/models/#{@orm.to_s}/*\"].each { |c| \n require c \n match = c.match(re)\n @models << Extlib::Inflection.constantize(Extlib::Inflection.camelize(match[1])) if match\n }\n end", "def generate_models\n if options[:namespace]\n empty_directory(\"app/models/#{options[:namespace].downcase}\")\n generate_base_namespaced_model\n end\n discovered_tables.each do |table_name|\n @model_name = model_name_from_table_name table_name\n @model_file_name = model_file_name_from_table_name table_name\n @columns = connection.columns(table_name)\n @indexes = connection.indexes(table_name)\n @associations = detected_associations(table_name, @columns)\n template 'model.rb', \"app/models/#{options[:namespace] ? options[:namespace]+'/' : ''}#{@model_file_name}.rb\"\n end\n puts %Q(config.autoload_paths += %W(\\#{config.root}/app/models/#{options[:namespace].downcase})) if options[:namespace]\n end", "def models\n @models ||= Prepares.models\n end", "def generate_model m\n # Model class, unit test, and fixtures.\n m.template 'model.rb', File.join('app/models', class_path, \"#{file_name}.rb\")\n m.template 'unit_test.rb', File.join('test/unit', class_path, \"#{file_name}_test.rb\")\n \n unless options[:skip_fixture] \n m.template 'fixtures.yml', File.join('test/fixtures', \"#{table_name}.yml\")\n end\n \n unless options[:skip_migration]\n m.migration_template 'migration.rb', 'db/migrate', :assigns => {\n :migration_name => \"Create#{class_name.pluralize.gsub(/::/, '')}\"\n }, :migration_file_name => \"create_#{file_path.gsub(/\\//, '_').pluralize}\"\n end\n \n # add has_many to referenced\n attributes.find_all{|a| a.type.to_s == \"references\"}.each do |parent|\n gsub_file \"app/models/#{parent.name}.rb\", \"class #{parent.name.camelize} < ActiveRecord::Base\" do |match|\n \"#{match}\\n has_many :#{table_name}\"\n end\n end\n end", "def seed\n @data = {}\n\n SEEDED_MODELS.each do |model_name|\n pluralized_model_name = model_name.underscore + 's'\n\n filename = \"app/data/#{pluralized_model_name}.yml\"\n\n # Load data as an array of objects\n models_data = YAML.safe_load(File.read(filename)).deep_symbolize_keys\n\n # Constantize model klass\n model_klass = Class.const_get(\"CodeWars::#{model_name}\")\n\n # Map models data to new Instances\n models_data.each_with_index do |model_data, i|\n model = model_klass.new\n\n model.load_attributes(model_data || {})\n\n model.indexed_at = i\n\n # Push to DataStore memory\n\n @data[pluralized_model_name.to_sym] ||= []\n @data[pluralized_model_name.to_sym] << model\n end\n end\n end", "def each_model(options = {}, &block)\n WingedCouch::Model.subclasses.each do |klass|\n if options[:raise_exceptions] and not klass.database.exist?\n raise %Q{Database for model #{klass.name} doesn't exist, run rake winged_couch:db:create}\n end\n block.call(klass)\n end\n end", "def models\n @models ||= self.model_names.map {|x| x.constantize}\n end", "def initialize\n self.models = Hash[\n MongoMapper::Document.descendants.select { |c| c.name }.map { |c|\n [c.name.tableize, c]\n }\n ]\n end", "def create(resources)\n #resources[0].model.last_query = resources\n counter = 0\n resources.each do |resource|\n fm_params = prepare_fmp_attributes(resource.dirty_attributes)\n rslt = layout(resource.model).create(fm_params)\n merge_fmp_response(resource, rslt[0])\n counter +=1\n end\n counter\n end", "def model_to_create(attributes)\n Sufia.config.model_to_create.call(attributes)\n end", "def models!\n # load '../db/schema.rb'\n \n models = Object.constants.map {|c| Object.const_get(c)}.select {|c| c.is_a?(Class) && c.superclass == ActiveRecord::Base}\n models = models.map(&:to_s)\n \n # This erases the class definitions, as long as nothing ELSE is holding onto a ref -- possibly controllers?\n models.each do |c|\n Object.instance_eval {remove_const c}\n end\n \n # Allow Kernel.require to re-load these models when references to them crop up\n # \"tableize.singularize\" is effective, but not airtight\n models.each do |c|\n $\".reject! {|x| x =~ /app\\/models\\/#{c.tableize.singularize}/}\n end\n \n # Hopefully the auto-loader can do the rest of the work for us\n \n # TODO: What about those pesky namespaced models and controllers?\n end", "def create(resources)\n resources.each do |resource|\n model = resource.model\n identity_field = model.identity_field\n attributes = resource.dirty_attributes\n\n properties = []\n bind_values = []\n\n # make the order of the properties consistent\n model.properties(name).each do |property|\n next unless attributes.key?(property)\n\n bind_value = attributes[property]\n\n next if property.eql?(identity_field) && bind_value.nil?\n\n properties << property\n bind_values << bind_value\n end\n\n statement = insert_statement(model, properties, identity_field)\n result = execute(statement, *bind_values)\n\n if result.to_i == 1\n if identity_field\n identity_field.set!(resource, result.insert_id)\n end\n end\n end\n end", "def set_model\n\n # check credentials and handle OpenStack Keystone\n # TODO: check expiration dates on Keystone tokens\n raise \"You are not authorized to use this endpoint!\" unless check_authn\n\n #\n model = get('/-/')\n @model = Occi::Model.new(model)\n\n @mixins = {\n :os_tpl => [],\n :resource_tpl => []\n }\n\n #\n get_os_templates.each do |os_tpl|\n unless os_tpl.nil? || os_tpl.type_identifier.nil?\n tid = os_tpl.type_identifier.strip\n @mixins[:os_tpl] << tid unless tid.empty?\n end\n end\n\n #\n get_resource_templates.each do |res_tpl|\n unless res_tpl.nil? || res_tpl.type_identifier.nil?\n tid = res_tpl.type_identifier.strip\n @mixins[:resource_tpl] << tid unless tid.empty?\n end\n end\n\n model\n end", "def generate_objective_c_classes\n @classes = []\n resources_from_schema.collect do |resource_hash|\n Resource.new(resource_hash).tap do |resource|\n # Generate the query classes first\n resource.queries.each do |query|\n # Query objects do not get cached in core data\n to_objective_c_class node:query[\"type\"], cached:false\n end\n # Generate the resource classes next\n klass = to_objective_c_class node:resource.hash[:type], cached:resource.cached?\n # Mark this class as being a REST resource\n klass.resource = resource\n end\n end\n end", "def models\n @models ||= {}\n end", "def create_model_files\n template 'model.rb', File.join('app/models/mokio', class_path, \"#{file_name}.rb\")\n end", "def generate_model\n\t\tclasses = CartesianClassifier.get_classes(Sample.find_all_by_classname(params[:classnames].split(',')))\n\t\tclassmodel = ClassModel.new({\n\t\t\t:classnames => params[:classnames], # split and join again for validation?\n\t\t\t:modelstring => ActiveSupport::JSON.encode(classes),\n\t\t\t:author => params[:author],\n\t\t\t:notes => params[:notes]\n\t\t})\n\t\tclassmodel.save\n\t\tredirect_to \"/\"\n end", "def generate_nested_resources option\n @generated_models = []\n case option\n when :before\n\n when :after\n relationships.each do |nested_resource_hash|\n target_class_name = nested_resource_hash.first[0].to_s\n target_class = target_class_name.humanize.constantize\n case nested_resource_hash.first[1]\n when Array\n nested_resource_hash.first[1].each do |element|\n @generated_model = target_class.new(element)\n @generated_model.save!\n send(\"#{target_class_name.downcase}<<\",@generated_model)\n end\n when Hash\n @generated_model = Profile.create(nested_resource_hash.first[1])\n @generated_model.save!\n send(\"#{target_class_name.downcase}=\",@generated_model)\n @generated_models << @generated_model\n end\n end\n end\n rescue ActiveRecord::RecordInvalid, ActiveRecord::RecordNotSaved => e\n destroy\n raise JSONAPI::Exceptions::CustomValidationErrors.new(e)\n end", "def create(resources)\n created = 0\n resources.each do |resource|\n model = resource.model\n serial = model.serial\n class_name = class_name(model)\n @log.debug(\"About to create #{model} backed by #{class_name} using #{resource.attributes}\")\n\n begin\n create_url = build_create_url(class_name)\n page = @agent.get(create_url) \n form_id = build_form_id(class_name.to_sym, :create_form_id)\n the_form = page.form_with(:id => form_id)\n the_properties = resource.attributes(key_on=:field).reject{|p,v| v.nil? }\n create_form = fill_form(the_form, the_properties, class_name)\n @log.debug(\"Create form is #{create_form.inspect}\")\n response = @agent.submit(create_form)\n @log.debug(\"Result of actual create call is #{response.code}\")\n if response.code.to_i == 302\n redirect_location = response.header['location']\n @log.debug(\"Redirect location is #{redirect_location}\")\n id = redirect_location.split('/').last.to_i #TODO: proper cast\n @log.debug(\"Newly created instance id is #{id}\")\n unless id.nil?\n serial.set(resource,id)\n created += 1\n end\n end\n rescue => e\n trace = e.backtrace.join(\"\\n\")\n @log.error(\"Failed to create resource: #{e.message}\") \n @log.error(trace) \n end\n end\n created\n end", "def preload_models \n ActiveRecord::Base.connection.tables.each do |model| \n begin \n \"#{model.classify}\".constantize \n rescue Exception \n end \n end \n end", "def create_database_schema!\n \n if file_format.class.const_defined?('Database')\n @orm_module = file_format.class.const_get('Database')\n else\n @orm_module = file_format.class.const_set('Database', Module.new)\n end\n\n create_request_table_and_class\n create_warning_table_and_class\n \n file_format.line_definitions.each do |name, definition|\n create_database_table(name, definition)\n create_activerecord_class(name, definition)\n end\n end", "def create_resources(operator)\n iterate(operator.state) do |model, attrs|\n obj = model.new(name: attrs[:tags][:Name], # , instance_id: attrs[:id],\n # ami: attrs[:ami], public_ip: attrs[:public_ip], arn: attrs[:arn],\n config: attrs,\n provider: Provider.first, runtime: Runtime.first,\n provider_name: Provider.first.name, runtime_name: Runtime.first.name,\n )\n if obj.valid?\n obj.save\n else\n Cnfs.logger.warn(obj.errors)\n end\n # binding.pry\n end\n end", "def models\n @models ||= []\n end", "def create(resources)\n adapter.create(resources)\n end", "def create(resources)\n adapter.create(resources)\n end", "def create_all(name, table)\n table.hashes.map do |attributes|\n Utils.model(name).new(attributes).tap do |document|\n document.save\n end\n end\n end", "def make_and_model; end", "def load_models\n puts \"=> Loading models\"\n Dir.glob(File.join(app_path,'app/models/*.rb')).each { | model | \n require model \n }\n end", "def create_model(name, &block)\n name = name.to_s.tableize\n raise \"Model name '#{name}' is not unique\" if site.model_types.key?(name)\n \n # create a new instance of model\n child = self.class.new(site)\n child.name = name.camelcase.singularize\n child.parent = self\n \n # inherited fields\n fields.each do |name, field|\n child.set(name, get(name)) if field.inherited?\n end\n \n # insert the model in to the site models list\n class_name = name.classify\n site.model_types[name] = child.id\n site.model_plural_names[class_name] = name\n site.save\n \n # append the model to ancestor descendant lists (these are used in queries to\n # restrict the type of records returned, e.g pages.all => _model: ['Page', ...]\n child.tap do |child|\n child.add_descendant(child)\n child.instance_exec(child, &block) if block_given?\n child.save\n end\n end", "def initialize_db\n create_indexes_for_all_models\n end", "def all(model)\n store.all(table: table_name).map {|data| model.new data}\n end", "def build(data_list)\n @models = []\n\n data_list.each do |data|\n @models << @klass.new(data)\n end\n end", "def create_fedora_objects(model, attributes)\n ::Importer::Factory.for(model.to_s).new(attributes, @files_directory, files(attributes)).run\n end", "def generate_model\n invoke \"active_record:model\", [name], :migration => false unless model_exists? && behavior == :invoke\n if store_in == 'active_record'\n invoke \"active_record:model\", [ACTIVE_RECORDABLE], :migration => false unless active_recordable_exists? && behavior == :invoke\n end\n end", "def model_classes\n ModelClassCollector.new(configuration, mode_map.keys).collect\n end", "def build_model(table)\n model = Mongify::Mongoid::Model.new(class_name: table.name.classify, table_name: table.name)\n model.polymorphic_as = table.polymorphic_as if table.polymorphic?\n #TODO: Might need to check that model doesn't already exist in @models\n @models[table.name.downcase.to_sym] = model\n model\n end", "def models\n work_classes + collection_classes\n end", "def dbs_init\n @dbs_hash = Dir[\"#{dbs_store}/*.db\"]\n .map do |dbfile|\n File.open(dbfile){|f| JSON.parse(f.read, symbolize_names: true)}\n end\n .inject({}) do |h, db|\n h.update({\n db[:name].to_sym => LaPack::const_get(db[:clazz]).new(self, db[:params])\n })\n end\n end", "def create_default_resources\n resources = [:timber, :iron, :gold, :copper, :diamond, :clay, :marble,\n :coal, :oil, :gas, :water, :uranium]\n @resources = []\n resources.each do |r|\n @resources << Resource.new(r, 1000)\n end\n end", "def load_all_models\n return if @models_loaded\n load_models_from File.join(RAILS_ROOT, 'app', 'models', '**', '*.rb') if(defined? RAILS_ROOT)\n load_models_from File.join(TALIA_CODE_ROOT, 'lib', 'talia_core', 'source_types', '**', '*.rb'), 'TaliaCore::SourceTypes::'\n TaliaCore::Source\n TaliaCore::Collection\n\n @models_loaded = true\n end", "def create(resources)\n connect if @persevere.nil?\n created = 0\n \n check_schemas\n \n resources.each do |resource|\n resource = Persevere.enhance(resource)\n serial = resource.model.serial(self.name)\n path = \"/#{resource.model.storage_name}/\"\n # Invoke to_json_hash with a boolean to indicate this is a create\n # We might want to make this a post-to_json_hash cleanup instead\n payload = resource.to_json_hash.delete_if{|key,value| value.nil? }\n DataMapper.logger.debug(\"(Create) PATH/PAYLOAD: #{path} #{payload.inspect}\")\n response = @persevere.create(path, payload)\n\n # Check the response, this needs to be more robust and raise\n # exceptions when there's a problem\n if response.code == \"201\"# good:\n rsrc_hash = JSON.parse(response.body)\n # Typecast attributes, DM expects them properly cast\n resource.model.properties.each do |prop|\n value = rsrc_hash[prop.field.to_s]\n rsrc_hash[prop.field.to_s] = prop.typecast(value) unless value.nil?\n # Shift date/time objects to the correct timezone because persevere is UTC\n case prop \n when DateTime then rsrc_hash[prop.field.to_s] = value.new_offset(Rational(Time.now.getlocal.gmt_offset/3600, 24))\n when Time then rsrc_hash[prop.field.to_s] = value.getlocal\n end\n end\n \n serial.set!(resource, rsrc_hash[\"id\"]) unless serial.nil?\n\n created += 1\n else\n return false\n end\n end\n\n # Return the number of resources created in persevere.\n return created\n end", "def model_classes\n @opts[:models]\n end", "def new_model(auto_migrate = true, &block)\n DB.create_table! :foo do\n primary_key :id\n column :state, :string\n end if auto_migrate\n model = Class.new(Sequel::Model(:foo)) do\n self.raise_on_save_failure = false\n def self.name; 'SequelTest::Foo'; end\n end\n model.plugin(:validation_class_methods) if model.respond_to?(:plugin)\n model.plugin(:hook_class_methods) if model.respond_to?(:plugin)\n model.class_eval(&block) if block_given?\n model\n end", "def setup_db\n ActiveRecord::Schema.define(:version => 1) do\n create_table :labels do |t|\n t.string :type, :limit => 255\n t.string :system_label, :limit => 255\n t.string :label, :limit => 255\n \n t.timestamps\n end\n \n create_table :frameworks do |t|\n t.string :system_name, :limit => 255\n t.string :name, :limit => 255\n \n t.timestamps\n end\n end\n \n Role.create!({ :system_label => \"SUPERUSER\", :label => \"Admin\" })\n Role.create!({ :system_label => \"EMPLOYEE\", :label => \"Employee\" })\n Role.create!({ :system_label => \"GUEST\", :label => \"Guest\" })\n \n BillingFrequency.create!({ :system_label => \"MONTHLY\", :label => \"Monthly\" })\n BillingFrequency.create!({ :system_label => \"QUARTERLY\", :label => \"Quarterly\" })\n BillingFrequency.create!({ :system_label => \"YEARLY\", :label => \"Yearly\" })\n \n TaxFrequency.create!({ :system_label => \"MONTHLY\", :label => \"Monthly\" })\n TaxFrequency.create!({ :system_label => \"QUARTERLY\", :label => \"Quarterly\" })\n TaxFrequency.create!({ :system_label => \"YEARLY\", :label => \"Yearly\" })\n \n Framework.create!({ :system_name => \"RUBY_ON_RAILS\", :name => \"Rails\" })\n Framework.create!({ :system_name => \"DJANGO\", :name => \"Django\" })\nend", "def load_model(model_class)\n begin\n file_content = File.read(model_class.db_filename)\n json_data = JSON.parse(file_content)\n rescue Errno::ENOENT\n # The file does not exists\n json_data = []\n end\n json_data.each do |data_hash|\n new_object = model_class.from_hash(data_hash)\n new_object.save\n end\nend", "def load_model(model_class)\n begin\n file_content = File.read(model_class.db_filename)\n json_data = JSON.parse(file_content)\n rescue Errno::ENOENT\n # The file does not exists\n json_data = []\n end\n json_data.each do |data_hash|\n new_object = model_class.from_hash(data_hash)\n new_object.save\n end\nend", "def create_model(*)\n create_magic_properties\n set_timestamps\n create_magic_properties\n properties = convert_properties_to :db, props\n node = _create_node(properties)\n init_on_load(node, node.props)\n send_props(@relationship_props) if @relationship_props\n @relationship_props = nil\n # Neo4j::IdentityMap.add(node, self)\n # write_changed_relationships\n true\n end", "def create_model(*)\n create_magic_properties\n set_timestamps\n create_magic_properties\n properties = convert_properties_to :db, props\n node = _create_node(properties)\n init_on_load(node, node.props)\n send_props(@relationship_props) if @relationship_props\n @relationship_props = nil\n # Neo4j::IdentityMap.add(node, self)\n # write_changed_relationships\n true\n end", "def setup_database\n Hanami::Model.load!\n end", "def create_model\n template 'model.rb', \"app/models/#{model_path}.rb\" unless @skip_model\n end", "def couchrest_model\n ## TODO - deprecate this method\n return if self.term.nil? || instance_database.nil? || self.vocabulary.nil?\n \n write_attribute(:instance_class_name, self.term.singularize.camelize)\n\n if Object.const_defined?(self.instance_class_name.intern)\n klass = Object.const_get(self.instance_class_name.intern)\n else\n db = instance_database\n prop_list = self.vocabulary.properties.inject([]) {|plist, p| plist << p}\n type_list = self.vocabulary.types.inject([]) {|tlist, t| tlist << t} \n \n klass = Object.const_set(self.instance_class_name.intern, \n Class.new(CouchRest::Model::Base) do\n use_database db\n prop_list.each {|p| property p.term.to_sym}\n property :serial_number\n property :data_source_id\n timestamps!\n\n # type_list.each |t| do\n # property t.to_sym do\n # t.properties.each {|tp| property tp.term.to_sym}\n # end\n # end\n # \n design do\n view :by_serial_number\n view :by_data_source_id\n end\n \n end\n )\n end\n klass\n end", "def create_tables\n create_mirrors\n create_users\n create_user_tokens\n create_products\n create_users_products\n create_versions\n create_dependencies\n create_access_keys\n end", "def create_model\n app = options[:app]\n return unless valid_model_for?(app)\n\n include_component_module_for(:test)\n migration_name = \"create_#{name.pluralize.underscore}\"\n apply_default_fields fields\n create_model_file(name, :fields => fields, :app => app)\n generate_model_test(name) if test?\n create_model_migration(migration_name, name, fields) unless options[:skip_migration]\n end", "def load_models!\n require \"models\"\n end", "def add_model_to_list(m)\n tn = implementation_model_name\n self.class.models[tn] = m\n logger.info \"Added new model #{tn}\"\n self.class.model_names << tn unless self.class.model_names.include? tn\n Resources::Models.add(m)\n end", "def load_models(app)\n ::Mongoid.load_models(app.config.paths[\"app/models\"].expanded)\n end", "def new_model(name = :foo, &block)\n table_name = \"#{name}_#{rand(1000000)}\"\n @table_names ||= []\n @table_names << table_name\n\n model = Class.new do\n (class << self; self; end).class_eval do\n define_method(:name) { \"MongoidTest::#{name.to_s.capitalize}\" }\n define_method(:to_s) { self.name }\n end\n end\n\n model.class_eval do\n include Mongoid::Document\n store_in collection: table_name\n\n field :state, :type => String\n end\n model.class_eval(&block) if block_given?\n model\n end", "def load_models(dirs)\n dirs.each do |base|\n Dir[\"#{base}**/*.rb\"].each do |file|\n model_name = file.gsub(/^#{base}([\\w_\\/\\\\]+)\\.rb/, '\\1')\n next if model_name.nil?\n next if ::ActiveRecord::Base.send(:subclasses).detect { |model| model.name == model_name }\n begin\n model_name.camelize.constantize\n rescue LoadError\n model_name.gsub!(/.*[\\/\\\\]/, '').nil? ? next : retry\n rescue NameError\n next\n end\n end\n end\n end", "def create(name, attributes)\n attributes = attributes.dup\n\n # Add the objectclasses\n attributes[\"objectClass\"] = objectclasses.collect { |o| o.to_s }\n attributes[\"objectClass\"] << \"top\" unless attributes[\"objectClass\"].include?(\"top\")\n\n attributes[rdn.to_s] = [name]\n\n # Generate any new values we might need.\n generate(attributes)\n\n # And create our resource.\n connect { |conn| conn.add dn(name), attributes }\n end", "def create(model={})\n create_new_model(model, :create)\n end", "def many(model, sql, params={})\n sql_query(sql, params).map { |h| model.new(h) }\n end", "def retrieve_models(env)\n # Parse either the \"MODEL\" environment variable or the \"MODELS\"\n # environment variable, with \"MODEL\" taking precedence.\n models_env = env['MODEL'] || env['MODELS']\n\n # If there was a use models environment variable, split it and\n # convert the given model string (e.g. \"User\") to an actual\n # model constant (e.g. User).\n #\n # If a models environment variable was not given, use descendants of\n # ActiveRecord::Base as the target set of models. This should be all\n # model classes in the project.\n models = if models_env\n models_env.split(',')\n .collect {|x| x.strip.underscore.singularize.camelize.constantize }\n else\n ActiveRecord::Base.descendants\n end\n\n\n # Filter the set of models to exclude:\n # - The ActiveRecord::SchemaMigration model which is internal to Rails\n # and should not be part of the dumped data.\n # - Models that don't have a corresponding table in the database.\n # - Models whose corresponding database tables are empty.\n filtered_models = models.select do |model|\n !ACTIVE_RECORD_INTERNAL_MODELS.include?(model.to_s) && \\\n model.table_exists? && \\\n model.exists?\n end\n end", "def load_models(app)\n app.config.paths[\"app/models\"].expanded.each do |path|\n preload = ::Mongoid.preload_models\n if preload.resizable?\n files = preload.map { |model| \"#{path}/#{model.underscore}.rb\" }\n else\n files = Dir.glob(\"#{path}/**/*.rb\")\n end\n\n files.sort.each do |file|\n load_model(file.gsub(\"#{path}/\" , \"\").gsub(\".rb\", \"\"))\n end\n end\n end", "def load_all_models\n Dir[\"#{Rails.root}/app/models/**/*.rb\"].each { |file_path| require file_path rescue nil }\n end", "def create_types\n @types.each do |type|\n create_type(type) unless Type.where(name: type['name']).first\n end\n end", "def init_objects\n Rho::RhoConfig::sources.each do |classname,source|\n unless Object::const_defined?(classname.intern)\n Object::const_set(classname.intern, \n Class::new do\n include Rhom::RhomObject\n extend Rhom::RhomObject\n \n def initialize(obj=nil)\n if obj\n # create a temp id for the create type\n # TODO: This is duplicative of get_new_obj\n temp_objid = djb_hash(obj.values.to_s, 10).to_s\n self.send 'object'.to_sym, \"#{temp_objid}\"\n self.send 'source_id'.to_sym, obj['source_id'].to_s\n self.send 'update_type'.to_sym, 'create'\n obj.each do |key,value|\n\t\t\t\t\t val = self.inst_strip_braces(value)\n self.send key, val\n end\n end\n \n end\n\t\t \n class << self\n \n def get_source_id\n Rho::RhoConfig::sources[self.name.to_s]['source_id'].to_s\n end\n # retrieve a single record if object id provided, otherwise return\n # full list corresponding to factory's source id\n def find(*args)\n list = []\n if args.first == :all\n result = Rhom::RhomDbAdapter::select_from_table(Rhom::TABLE_NAME,\n '*',\n {\"source_id\"=>get_source_id,\"update_type\"=>'query'},\n {\"order by\"=>'object'})\n else\n obj = strip_braces(args.first.to_s)\n result = Rhom::RhomDbAdapter::select_from_table(Rhom::TABLE_NAME,\n '*',\n {\"object\"=>obj})\n end\n list = get_list(result)\n if list.length == 1\n return list[0]\n end\n list\n end\n \n def find_by(*args)\n # TODO: implement\n end\n\n # returns an array of objects based on an existing array\n def get_list(objs)\n new_list = []\n if objs and defined? Rho::RhoConfig::sources[self.name.to_s]\n attrib_length = Rho::RhoConfig::sources[self.name.to_s]['attribs'].length\n list_length = 0\n list_length = (objs.length / attrib_length) unless attrib_length == 0\n new_obj = nil\n # iterate over the array and determine object\n # structure based on attribute/value pairs\n list_length.times do |i|\n new_obj = get_new_obj(objs[i*attrib_length])\n attrib_length.times do |j|\n # setup index and assign accessors\n idx = i*attrib_length+j\n begin\n # only update attributes if they belong\n # to the current object\n if objs[idx]['object'] == strip_braces((new_obj.send 'object'.to_sym))\n attrib = objs[idx]['attrib'].to_s\n value = objs[idx]['value'].to_s\n new_obj.send attrib.to_sym, value\n end\n rescue\n puts \"failed to reference objs[#{idx}]...\"\n end\n end\n new_list << new_obj\n end\n else\n # source attributes are not initialized, \n # try again\n RhomObjectFactory::init_sources\n end\n new_list\n end\n \n # returns new model instance with a temp object id\n def get_new_obj(obj, type='query')\n tmp_obj = self.new\n tmp_obj.send 'object'.to_sym, \"{#{obj['object'].to_s}}\"\n tmp_obj.send 'source_id'.to_sym, get_source_id\n tmp_obj.send 'update_type'.to_sym, type\n tmp_obj\n end\n end #class methods\n\t\n # deletes the record from the viewable list as well as\n # adding a delete record to the list of sync operations\n def destroy\n result = nil\n obj = self.inst_strip_braces(self.object)\n if obj\n # first delete the record from viewable list\n result = Rhom::RhomDbAdapter::delete_from_table(Rhom::TABLE_NAME,\n {\"object\"=>obj})\n # now add delete operation\n result = Rhom::RhomDbAdapter::insert_into_table(Rhom::TABLE_NAME,\n {\"source_id\"=>self.get_inst_source_id,\n \"object\"=>obj,\n \"update_type\"=>'delete'})\n end\n result\n end\n\t\t\n # saves the current object to the database as a create type\n def save\n result = nil\n # iterate over each instance variable and insert create row to table\n\t\t\t\t obj = self.inst_strip_braces(self.object)\n self.instance_variables.each do |method|\n method = method.to_s.gsub(/@/,\"\")\n # Don't save objects with braces to database\n val = self.send(method.to_sym)\n # add rows excluding object, source_id and update_type\n unless self.method_name_reserved?(method) or val.nil?\n result = Rhom::RhomDbAdapter::insert_into_table(Rhom::TABLE_NAME,\n {\"source_id\"=>self.get_inst_source_id,\n \"object\"=>obj,\n \"attrib\"=>method,\n \"value\"=>val,\n \"update_type\"=>'create'})\n end\n end\n # Create a temporary query record to display in the list\n Rho::RhoConfig::sources[self.class.name.to_s]['attribs'].each do |attrib|\n result = Rhom::RhomDbAdapter::insert_into_table(Rhom::TABLE_NAME,\n {\"source_id\"=>self.get_inst_source_id,\n \"object\"=>obj,\n \"attrib\"=>attrib['attrib'],\n \"value\"=>self.send(attrib['attrib'].to_sym),\n \"update_type\"=>'query'})\n end\n result\n end\n \n # updates the current record in the viewable list and adds\n # a sync operation to update\n def update_attributes(attrs)\n result = nil\n obj = self.strip_braces(self.object)\n self.instance_variables.each do |method|\n method = method.to_s.gsub(/@/,\"\")\n val = self.send method.to_sym\n # Don't save objects with braces to database\n new_val = attrs[method]\n # if the object's value doesn't match the database record\n # then we procede with update\n if new_val and val != new_val\n unless self.method_name_reserved?(method) or new_val.length == 0\n # update viewable list\n result = Rhom::RhomDbAdapter::update_into_table(Rhom::TABLE_NAME,\n {\"value\"=>new_val},\n {\"object\"=>obj, \"attrib\"=>method})\n # update sync list\n result = Rhom::RhomDbAdapter::insert_into_table(Rhom::TABLE_NAME,\n {\"source_id\"=>self.get_inst_source_id,\n \"object\"=>obj,\n \"attrib\"=>method,\n \"value\"=>new_val,\n \"update_type\"=>'update'})\n end\n end\n end\n result\n end\n\t\n def get_inst_source_id\n Rho::RhoConfig::sources[self.class.name.to_s]['source_id'].to_s\n end\n \n def inst_strip_braces(str=nil)\n str ? str.gsub(/\\{/,\"\").gsub(/\\}/,\"\") : nil\n end\n \n def method_name_reserved?(method)\n method =~ /object|source_id|update_type/\n end\n end)\n end\n end\n end", "def generate_model\n invoke \"active_record:model\", [name], :migration => false unless model_exists? && behavior == :invoke\n end", "def create_dynamic_model\n raise FphsException, 'no fields specified to create dynamic model' unless field_list.present?\n\n schema_name, table_name = schema_and_table_name\n category = self.category || self.class.default_category\n\n name = table_name.singularize\n\n default_options = {\n _comments: {\n table: table_comment_config,\n fields: comments\n },\n _data_dictionary: data_dictionary_config,\n _db_columns: db_columns,\n default: {\n field_options: field_options,\n caption_before: caption_before,\n labels: labels,\n show_if_condition_strings: show_if_condition_strings\n }\n }.deep_stringify_keys!\n\n options = YAML.dump default_options\n\n fla = field_list.split\n if fla.include?('master_id')\n foreign_key_name = 'master_id'\n @field_list = fla.select { |f| f != 'master_id' }.join(' ')\n end\n\n if dynamic_model\n @dynamic_model = dynamic_model\n dynamic_model.update! current_admin: current_admin,\n field_list: field_list,\n options: options,\n allow_migrations: true,\n foreign_key_name: foreign_key_name\n else\n @dynamic_model = DynamicModel.create! current_admin: current_admin,\n name: name,\n table_name: table_name,\n primary_key_name: :id,\n foreign_key_name: foreign_key_name,\n category: category,\n field_list: field_list,\n options: options,\n schema_name: schema_name,\n allow_migrations: true\n end\n\n # Force delayed job to update with the new definition\n AppControl.restart_delayed_job\n\n @dynamic_model\n end", "def create!(attributes)\n new_attributes = map_to_keys(attributes)\n\n new_attributes = new_attributes.merge(\n RecordTypeManager::FIELD_NAME => klass.record_type_id\n ) if klass.record_type_id\n\n client.create!(klass.object_name, new_attributes)\n end", "def load_models\n Dir[File.dirname(__FILE__) + \"#{File::SEPARATOR}models#{File::SEPARATOR}*.rb\"].each do |file|\n load file\n end\n end", "def define_models_getters\n self.class::SEEDED_MODELS.each do |seed_model|\n seed_model_name = seed_model.underscore.pluralize.to_sym\n define_singleton_method(seed_model_name) do\n @data[seed_model_name]\n end\n end\n end", "def load_models(hash, namespaces = [])\n models = []\n\n # first handle all normal models\n if models_hash = hash[\"models\"]\n models_hash.each_pair do |model_name, model_properties|\n models << Model::Base.new(model_name, model_properties, :namespaces => namespaces, :reader => self)\n end\n end\n \n # go into recursion to handle the models under a namespace\n if found_namespaces = hash[\"namespaces\"]\n found_namespaces.each_pair do |namespace, models_under_namespace|\n models += load_models(models_under_namespace, namespaces + [namespace])\n end\n end\n\n models\n end", "def create_openstudio_model_new(runner = nil)\n beginning_time = Time.now\n\n end_time = Time.now\n BTAP::runner_register(\"Info\", \"Time elapsed #{(end_time - beginning_time)*1000} milliseconds\",runner)\n model = OpenStudio::Model::Model.new()\n #add All Materials\n # find_all_commands( \"Materials\" ).each do |doe_material|\n # end\n #\n # find_all_commands( \"Constructions\" ).each do |doe_cons|\n # end\n\n #this block will create OS story objects in the OS model. \n BTAP::runner_register(\"Info\", \"Exporting DOE FLOORS to OS\",runner)\n find_all_commands(\"FLOOR\").each do |doe_floor|\n doe_floor.convert_to_openstudio(model)\n end\n BTAP::runner_register(\"Info\", OpenStudio::Model::getBuildingStorys(model).size.to_s + \" floors created\",runner)\n\n #this block will create OS space objects in the OS model. \n BTAP::runner_register(\"Info\", \"Exporting DOE SPACES to OS\",runner)\n find_all_commands(\"SPACE\").each do |doe_space|\n doe_space.convert_to_openstudio(model)\n end\n BTAP::runner_register(\"Info\", OpenStudio::Model::getSpaces(model).size.to_s + \" spaces created\",runner)\n \n #this block will create OS space objects in the OS model. \n BTAP::runner_register(\"Info\", \"Exporting DOE ZONES to OS\",runner)\n find_all_commands(\"ZONE\").each do |doe_zone|\n doe_zone.convert_to_openstudio(model)\n end\n BTAP::runner_register(\"Info\", OpenStudio::Model::getThermalZones(model).size.to_s + \" zones created\",runner)\n \n #this block will create OS surface objects in the OS model.\n BTAP::runner_register(\"Info\", \"Exporting DOE Surfaces to OS\",runner)\n get_all_surfaces().each do |doe_surface|\n doe_surface.convert_to_openstudio(model)\n end\n BTAP::runner_register(\"Info\", OpenStudio::Model::getSurfaces(model).size.to_s + \" surfaces created\",runner)\n BTAP::runner_register(\"Info\", OpenStudio::Model::getSubSurfaces(model).size.to_s + \" sub_surfaces created\",runner)\n BTAP::runner_register(\"Info\", \"Setting Boundary Conditions for surfaces\",runner)\n BTAP::Geometry::match_surfaces(model)\n \n x_scale = y_scale = z_scale = 0.3048\n BTAP::runner_register(\"Info\", \"scaling model from feet to meters\",runner)\n model.getPlanarSurfaces.each do |surface|\n new_vertices = OpenStudio::Point3dVector.new\n surface.vertices.each do |vertex|\n new_vertices << OpenStudio::Point3d.new(vertex.x * x_scale, vertex.y * y_scale, vertex.z * z_scale)\n end \n surface.setVertices(new_vertices)\n end\n \n model.getPlanarSurfaceGroups.each do |surface_group|\n transformation = surface_group.transformation\n translation = transformation.translation\n euler_angles = transformation.eulerAngles\n new_translation = OpenStudio::Vector3d.new(translation.x * x_scale, translation.y * y_scale, translation.z * z_scale)\n #TODO these might be in the wrong order\n new_transformation = OpenStudio::createRotation(euler_angles) * OpenStudio::createTranslation(new_translation) \n surface_group.setTransformation(new_transformation)\n end\n BTAP::runner_register(\"Info\", \"DOE2.2 -> OS Geometry Conversion Complete\",runner)\n BTAP::runner_register(\"Info\", \"Summary of Conversion\",runner)\n BTAP::runner_register(\"Info\", OpenStudio::Model::getBuildingStorys(model).size.to_s + \" floors created\",runner)\n BTAP::runner_register(\"Info\", OpenStudio::Model::getSpaces(model).size.to_s + \" spaces created\",runner)\n BTAP::runner_register(\"Info\", OpenStudio::Model::getThermalZones(model).size.to_s + \" thermal zones created\",runner)\n BTAP::runner_register(\"Info\", OpenStudio::Model::getSurfaces(model).size.to_s + \" surfaces created\",runner)\n BTAP::runner_register(\"Info\", OpenStudio::Model::getSubSurfaces(model).size.to_s + \" sub_surfaces created\",runner)\n BTAP::runner_register(\"Info\", \"No Contruction were converted.\",runner)\n BTAP::runner_register(\"Info\", \"No Materials were converted\",runner)\n BTAP::runner_register(\"Info\", \"No HVAC components were converted\",runner)\n BTAP::runner_register(\"Info\", \"No Environment or Simulation setting were converted.\",runner)\n\n end_time = Time.now\n BTAP::runner_register(\"Info\", \"Time elapsed #{(end_time - beginning_time)} seconds\",runner)\n return model\n end", "def create_fedora_objects(attributes)\n fc = factory_class(model)\n f = fc.new(attributes, files_directory)\n f.run\n end", "def load_into_database(options={})\n # necessary to make multiple invocations possible in a single test\n # case possible\n ActiveRecord::Fixtures.reset_cache\n\n # Filter down the models to load if specified\n the_tables = if options.has_key?(:only)\n self.table_names.select {|x| Array(options[:only]).map(&:to_s).include?(x) }\n elsif options.has_key?(:except)\n self.table_names.select {|x| !Array(options[:except]).map(&:to_s).include?(x) }\n else\n self.table_names\n end\n raise \"No models to load, relax your :only or :except filters (or don't bother calling this method)\" if the_tables.empty?\n\n\n #This wraps all the inserts into a single transaction allowing the constraint check to happen at the end.\n ActiveRecord::Base.transaction do\n\n the_tables.each do |table_name|\n class_name = if self.table_name_to_model_name_hash.kind_of?(Hash)\n self.table_name_to_model_name_hash[table_name]\n else\n ActiveSupport::Deprecation.warn \"your fe_manifest.yml does not contain a table_name_to_model_name_hash (as found in 1.0.0 or earlier). Version 2.0.0 will require this. See test cases for how to manually jigger your fe_manifest.ymls to function.\"\n nil\n end\n if options[:map].nil?\n # Vanilla create_fixtures will work fine when no mapping is being used\n ActiveRecord::Fixtures.create_fixtures(self.target_path, table_name)\n else\n # Map table_name via a function (great for prefixing)\n new_table_name = if options[:map].kind_of?(Proc)\n options[:map].call(table_name)\n # Map table_name via a Hash table name mapping\n elsif options[:map][table_name].kind_of? String\n options[:map][table_name]\n else\n table_name # No mapping for this table name\n end\n fixtures = ActiveRecord::Fixtures.new( ActiveRecord::Base.connection,\n new_table_name,\n class_name,\n ::File.join(self.target_path, table_name))\n fixtures.table_rows.each do |the_table_name,rows|\n rows.each do |row|\n ActiveRecord::Base.connection.insert_fixture(row, the_table_name)\n end\n end\n end\n # FIXME: The right way to do this is to fork the oracle enhanced adapter\n # and implement a reset_pk_sequence! method, this is what ActiveRecord::Fixtures\n # calls. aka this code should be eliminated/live elsewhere.\n case ActiveRecord::Base.connection.adapter_name\n when /oracle/i\n model = class_name.constantize\n if model.column_names.include? \"id\"\n sequence_name = model.sequence_name.to_s\n max_id = model.maximum(:id)\n next_id = max_id.nil? ? 1 : max_id.to_i + 1\n begin\n ActiveRecord::Base.connection.execute(\"drop sequence #{sequence_name}\")\n rescue\n puts \"[Iron Fixture Extractor] WARNING: couldnt drop the sequence #{sequence_name}, (but who cares!)\"\n end\n begin\n q=\"create sequence #{sequence_name} increment by 1 start with #{next_id}\"\n ActiveRecord::Base.connection.execute(q)\n rescue\n puts \"[Iron Fixture Extractor] WARNING: couldnt create the sequence #{sequence_name}\"\n end\n end\n else\n # Do nothing, only oracle adapters need this\n end\n end\n end # End transaction\n end", "def generate!\n table_attributes = resource.table_attributes\n model_attributes = resource.model_attributes\n\n table_keys = table_attributes.keys\n model_keys = model_attributes.keys\n\n # Create table\n if table_keys.blank?\n Rails.logger.info \"effective_developer migrate #{resource.plural_name}: create table\"\n return rails_migrate(\"create_#{resource.plural_name}\", model_attributes)\n end\n\n # Fields are not in database, but present in model.rb\n if(add_keys = (model_keys - table_keys)).present?\n Rails.logger.info \"effective_developer migrate #{resource.plural_name}: add #{add_keys.to_sentence}\"\n rails_migrate(\"add_ATTRIBUTES_to_#{resource.plural_name}\", model_attributes.slice(*add_keys))\n end\n\n # Fields are in database, but no longer in our effective_resource do block\n if (remove_keys = (table_keys - model_keys)).present?\n Rails.logger.info \"effective_developer migrate #{resource.plural_name}: remove #{remove_keys.to_sentence}\"\n rails_migrate(\"remove_ATTRIBUTES_from_#{resource.plural_name}\", table_attributes.slice(*remove_keys))\n end\n end", "def models\r\n\r\n end", "def create\n begin\n puts \"Creating...\"\n ActiveRecord::Schema.define do\n #create_table :test_relations do |table|\n # table.column :test_case_id, :integer\n # table.column :test_collection_id, :integer\n #end\n create_table :defaults do |table|\n table.column :configuration_id, :integer\n end\n\n\n # Project configuration\n create_table :configurations do |table|\n table.column :name, :string\n table.column :server, :string\n table.column :devkey, :string\n table.column :smtp_host, :string\n table.column :smtp_recipient, :string\n table.column :project, :string # aka prefix\n table.column :vm_user, :string\n table.column :vm_password, :string\n table.column :ssh_key_path, :string\n table.column :ssh_key_pw, :string\n table.column :base_path, :string\n table.column :output_path, :string\n table.column :public_options, :string\n end\n\n\n # A test collection is a collection of test, defined by project, testplan and build\n create_table :test_collections do |table|\n table.column :project, :string\n table.column :project_id, :string\n table.column :plan, :string\n table.column :plan_id, :string\n #table.column :build, :string\n #table.column :testrun_id, :string\n #table.column :test_cases, :string\n end\n\n create_table :test_cases do |table|\n table.column :urgency, :string\n table.column :name, :string\n table.column :file, :string\n table.column :external_id, :string\n table.column :platform_id, :string\n table.column :test_collection_id, :string\n\n end\n\n end\n\n rescue ActiveRecord::StatementInvalid\n # Table already created\n puts \"Setup already done. Destroy tables first before creating\"\n end\n\n\n end", "def reload\n klasses = if @reflection.polymorphic?\n @reflection.active_record.distinct.order(reflection.foreign_type).pluck(reflection.foreign_type).map(&:safe_constantize)\n else\n [@reflection.klass]\n end\n @models = klasses.map { |k| @dump.model_for(k) }\n end", "def load_models(app)\n return unless ::Mongoid.preload_models\n app.config.paths[\"app/models\"].each do |path|\n Dir.glob(\"#{path}/**/*.rb\").sort.each do |file|\n load_model(file.gsub(\"#{path}/\" , \"\").gsub(\".rb\", \"\"))\n end\n end\n end", "def get_model\n return model_classes[item_type].new()\n end", "def new_model\n unless @model\n @model = create_model\n attach_model\n end\n @model\n end", "def createTables \n createUserTable\n createTaskTable\n createProjectTable\n end", "def get_models\n eval \"@#{controller_name} = #{controller_name.singular.camelcase}.all\"\n end", "def create_model_class(name, columns={}, &class_body)\n if name.is_a?(Hash) && name.size == 1\n class_name, superclass_name = *name.to_a.flatten\n else\n class_name, superclass_name = name, 'ActiveRecord::Base'\n end\n need_table = superclass_name.to_s == 'ActiveRecord::Base'\n\n table_name = class_name.to_s.underscore.pluralize\n if need_table\n ActiveRecord::Base.connection.create_table(table_name) do |table|\n columns.each do |column_name, column_type|\n table.send column_type, column_name\n end\n end\n end\n klass = Class.new(superclass_name.to_s.constantize, &class_body)\n Object.const_set(class_name, klass)\n end", "def instantiate_models(model_class, source)\n return nil if source.nil?\n\n source = prepare_source model_class, source\n\n case source\n when Array\n source.map { |entry| instantiate_models model_class, entry }\n when Hash\n instantiate_model_from_attributes_hash model_class, source\n else\n raise ArgumentError, \"#{model_class}: can't instantiate from a source of type #{source.class}\"\n end\n end", "def bind_models\n @model = @release.get_template_model_by_name(@name)\n\n if @model.nil?\n raise DeploymentUnknownTemplate, \"Can't find job '#{@name}'\"\n end\n\n @package_models = @model.package_names.map do |name|\n @release.get_package_model_by_name(name)\n end\n end", "def create_indexes_for_all_models\n required_types.values.each do |required_type_class_object|\n required_type_class_object.send(:create_indexes)\n end\n end", "def records_base(_options = {})\n _model_class.all\n end", "def create(attributes = {})\n resource = repository.scope { model.create(default_attributes.update(attributes)) }\n self << resource unless resource.new_record?\n resource\n end", "def create_everything\n create_users\n create_user_keys\n create_comments\n create_filters\n create_columns\n create_organizations\n create_approvals\n create_whitelists\n create_user_key_columns\n create_user_key_organizations\n end", "def build_tables\n @db.exec(%q[\n CREATE TABLE IF NOT EXISTS breeds(\n id serial NOT NULL PRIMARY KEY,\n breed varchar(30),\n price integer\n )])\n\n @db.exec(%q[\n CREATE TABLE IF NOT EXISTS puppies(\n id serial NOT NULL PRIMARY KEY,\n breed varchar(30),\n name varchar(30),\n age integer,\n created_at timestamp NOT NULL DEFAULT current_timestamp\n )])\n\n @db.exec(%q[\n CREATE TABLE IF NOT EXISTS requests(\n id serial NOT NULL PRIMARY KEY,\n breed text,\n status text,\n created_at timestamp NOT NULL DEFAULT current_timestamp\n )])\n end", "def require_models\n model_files.each { |model| require_item(model, @model_path) }\n end", "def load_objects\n instance_variable_set(\"@#{model_name.underscore.pluralize}\", (@instances = model.where(params || {}) rescue nil))\n end", "def import_resources\n # for each resource type, look for a file of measurement data\n Report.plugin_matrix.each do |resource_name, measurements|\n model = Object.const_get((resource_name + 'Resource').camelcase(:upper))\n model.unrestrict_primary_key\n iterate_lines(@directory + resource_name + '.json') do |idx, line|\n print \"\\rImporting #{resource_name}: #{idx}...\"\n\n resource = JSON.parse(line)\n resource.each do |key, value|\n value = update_date(value, @date_offset)\n resource[key] = value unless value.nil?\n end\n model.create(resource)\n end\n model.restrict_primary_key\n print \"Done\\n\"\n import_measurements(measurements)\n end\n end" ]
[ "0.67588514", "0.6662535", "0.65796", "0.64164066", "0.6340818", "0.6177394", "0.61436856", "0.6109524", "0.608631", "0.6058302", "0.6039142", "0.602916", "0.60204", "0.6007532", "0.59676856", "0.59626514", "0.5953869", "0.594368", "0.5905357", "0.5887946", "0.58519286", "0.58328646", "0.58283854", "0.5824002", "0.5820889", "0.58198017", "0.58129513", "0.5811932", "0.58113825", "0.58113825", "0.58080536", "0.57834053", "0.57533586", "0.57314545", "0.57292134", "0.5717282", "0.5715038", "0.5697611", "0.5677016", "0.5669718", "0.56595635", "0.56589824", "0.56524616", "0.5645237", "0.5638134", "0.5621019", "0.56107426", "0.5597383", "0.5594767", "0.55883473", "0.55883473", "0.55878985", "0.55878985", "0.5584839", "0.55715144", "0.5552206", "0.55495954", "0.55342805", "0.5530352", "0.5527997", "0.55231005", "0.55174834", "0.55145085", "0.5510803", "0.55013347", "0.5499022", "0.5496138", "0.5465813", "0.54519856", "0.5445641", "0.5442258", "0.5431006", "0.542106", "0.53968525", "0.53882915", "0.5385996", "0.53802425", "0.53687", "0.53578085", "0.5352625", "0.53401643", "0.5338209", "0.53377485", "0.53323954", "0.53237915", "0.532095", "0.5297696", "0.52890456", "0.5285559", "0.52847636", "0.52835464", "0.5278868", "0.5266751", "0.52603805", "0.5257504", "0.5256061", "0.5246685", "0.5240742", "0.523945", "0.52261376" ]
0.56265414
45
creates the tree to map the DB structure to classes paths does not register the model because it uses existing one
def build! models.each do |model| build_route_for_model(model) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_tree(father,tree)\n tree.each do |name|\n n = Meta::create_class(father, name[0], name[1])\n create_tree(n, name[2])\n end\nend", "def build_tree(model)\n # inflate the node id to test id wrap around edge cases\n ENV[\"NODES\"].to_i.times { model.create!.destroy } if ENV[\"NODES\"]\n\n n1 = model.create!\n n2 = model.create!(:parent => n1)\n n3 = model.create!(:parent => n2)\n n4 = model.create!(:parent => n2)\n n5 = model.create!(:parent => n1)\n n6 = model.create!(:parent => n5)\n\n puts \"create: #{n1.id}..#{n6.id}\" if ENV[\"NODES\"]\n [n1, n2, n3, n4, n5, n6]\n end", "def fill_model(classnode = ::ObjectBrowser::create_class_tree(), parent = nil)\n node = insert_node(parent, :class, classnode.klass.to_s, \"#<#{classnode.klass.id.to_s(16)}>\", classnode.klass)\n classnode.objects.each do | object |\n insert_node(node, :object, \"#<#{object.id.to_s(16)}>\", \"#<#{object.id.to_s(16)}>\", object)\n end\n classnode.subclasses.to_a.sort_by{|k,s| k.to_s}.each do | klass, subclass | fill_model(subclass, node) end\n end", "def generate_model_parents_children\n generate \"model\", \"#{@connection} user:references parent:references child:references\"\n from_file = \"app/models/#{@connection}.rb\"\n from = \" belongs_to :parent\"\n to = \" belongs_to :parent_#{@beta}, class_name: '#{@beta.camelcase}', foreign_key: 'parent_id'\"\n gsub_file from_file, from, to\n from_file = \"app/models/#{@connection}.rb\"\n from = \" belongs_to :child\"\n to = \" belongs_to :child_#{@beta}, class_name: '#{@beta.camelcase}', foreign_key: 'child_id'\"\n gsub_file from_file, from, to\n end", "def generate_models\n if options[:namespace]\n empty_directory(\"app/models/#{options[:namespace].downcase}\")\n generate_base_namespaced_model\n end\n discovered_tables.each do |table_name|\n @model_name = model_name_from_table_name table_name\n @model_file_name = model_file_name_from_table_name table_name\n @columns = connection.columns(table_name)\n @indexes = connection.indexes(table_name)\n @associations = detected_associations(table_name, @columns)\n template 'model.rb', \"app/models/#{options[:namespace] ? options[:namespace]+'/' : ''}#{@model_file_name}.rb\"\n end\n puts %Q(config.autoload_paths += %W(\\#{config.root}/app/models/#{options[:namespace].downcase})) if options[:namespace]\n end", "def build_nodes\n # Create a Hash[Class => Node] for each table/class\n nodes = {}\n @table_names.each do |path|\n table_name = path.tr \"/\", \"_\"\n class_name = @class_names[table_name.to_sym] || table_name.classify\n klass = class_name.constantize\n nodes[klass] = Node.new(path, class_name, klass)\n end\n\n # First iniitalize dependencies from polymorphic associations that we\n # explicitly found in the yaml files.\n @polymorphic_associations.each do |klass, associations|\n associations.each do |association|\n node = nodes[klass]\n next unless node\n next unless nodes.key?(association)\n\n node.dependencies << association\n end\n end\n\n # Compute dependencies between nodes/classes by reflecting on their\n # ActiveRecord associations.\n nodes.each do |_, node|\n klass = node.klass\n klass.reflect_on_all_associations.each do |assoc|\n # We can't handle polymorphic associations, but the concrete types\n # should have been deduced from the yaml files contents\n next if assoc.polymorphic?\n\n # Don't add a dependency if the class is not in the given table names\n next unless nodes.key?(assoc.klass)\n\n # A class might depend on itself, but we don't add it as a dependency\n # because otherwise we'll never make it (the class can probably be created\n # just fine and these dependencies are optional/nilable)\n next if klass == assoc.klass\n\n case assoc.macro\n when :belongs_to\n node.dependencies << assoc.klass\n when :has_one, :has_many\n # Skip `through` association becuase it will be already computed\n # for the related `has_one`/`has_many` association\n next if assoc.options[:through]\n\n nodes[assoc.klass].dependencies << klass\n end\n end\n end\n\n # Finally sort all values by name for consistent results\n nodes.values.sort_by { |node| node.klass.name }\n end", "def class_tree\n @class_tree ||= generate_class_tree\n end", "def generate_model m\n # Model class, unit test, and fixtures.\n m.template 'model.rb', File.join('app/models', class_path, \"#{file_name}.rb\")\n m.template 'unit_test.rb', File.join('test/unit', class_path, \"#{file_name}_test.rb\")\n \n unless options[:skip_fixture] \n m.template 'fixtures.yml', File.join('test/fixtures', \"#{table_name}.yml\")\n end\n \n unless options[:skip_migration]\n m.migration_template 'migration.rb', 'db/migrate', :assigns => {\n :migration_name => \"Create#{class_name.pluralize.gsub(/::/, '')}\"\n }, :migration_file_name => \"create_#{file_path.gsub(/\\//, '_').pluralize}\"\n end\n \n # add has_many to referenced\n attributes.find_all{|a| a.type.to_s == \"references\"}.each do |parent|\n gsub_file \"app/models/#{parent.name}.rb\", \"class #{parent.name.camelize} < ActiveRecord::Base\" do |match|\n \"#{match}\\n has_many :#{table_name}\"\n end\n end\n end", "def map_nested_models\n end", "def map_nested_models\n end", "def model_classes(classes = Map.model_classes)\n nested_hash = classes.each_with_object({}) do |klass, hash|\n hash[klass] = Node.new(klass)\n end\n nested_hash.each do |klass, node|\n node.parent = parent = nested_hash[klass.superclass]\n parent.children << node if parent\n end\n nested_hash.values.select { |v| v.parent.nil? }\n end", "def initialize\n self.models = Hash[\n MongoMapper::Document.descendants.select { |c| c.name }.map { |c|\n [c.name.tableize, c]\n }\n ]\n end", "def model(name, model_klass)\n @root = [name, model_klass]\n end", "def generate_models\n (translation.tables + translation.polymorphic_tables).each do |table|\n build_model(table)\n end\n end", "def generate_class_tree\n debug_msg \"Generating class tree\"\n tree = generate_class_tree_level\n debug_msg \" writing class tree to %s\" % TREE_FILE\n File.open(TREE_FILE, \"w\", 0644) do |f|\n f.write('var tree = '); f.write(tree.to_json(:max_nesting => 0))\n end unless $dryrun\nend", "def create_model(name, &block)\n name = name.to_s.tableize\n raise \"Model name '#{name}' is not unique\" if site.model_types.key?(name)\n \n # create a new instance of model\n child = self.class.new(site)\n child.name = name.camelcase.singularize\n child.parent = self\n \n # inherited fields\n fields.each do |name, field|\n child.set(name, get(name)) if field.inherited?\n end\n \n # insert the model in to the site models list\n class_name = name.classify\n site.model_types[name] = child.id\n site.model_plural_names[class_name] = name\n site.save\n \n # append the model to ancestor descendant lists (these are used in queries to\n # restrict the type of records returned, e.g pages.all => _model: ['Page', ...]\n child.tap do |child|\n child.add_descendant(child)\n child.instance_exec(child, &block) if block_given?\n child.save\n end\n end", "def generate_class_tree_level(parent='')\n $all.map { |klass|\n if parent == klass['parentname']\n [\n klass['name'],\n \"classes/#{klass['fullname']}.html\", # klass.path, \n '',\n generate_class_tree_level(klass['fullname'])\n ]\n else\n nil\n end\n }.compact\nend", "def makena_classes\n Rails.application.eager_load!\n pass = ActiveRecord::Base.descendants.map{|a| a.to_s}\n pass.shift\n pass\n end", "def create_branch\n @tree_class.new\n end", "def parse\r\n raise \"directory #{@config[:model_dir]} not exists\" unless File.directory? @config[:model_dir]\r\n Dir[\"#{@config[:model_dir]}/*.rb\"].each do |file|\r\n crt_model = Model.new\r\n model_attrs_ = Hash.new\r\n in_public = true\r\n File.open(file, 'r:utf-8').each do |line|\r\n line.chomp!\r\n\r\n # erd_tag and attr\r\n if /^[\\#\\s]*erd_tag\\:?\\s*(?<tag_>[\\w\\.]+)/ =~ line\r\n crt_model.tag = tag_ \r\n crt_model.attrs = @config[:tags][tag_]\r\n end\r\n\r\n # catch class definition\r\n if /^\\s*class\\s+(?<name_>\\w+)/ =~ line\r\n crt_model.name = name_.underscore \r\n self.parse_erd crt_model, line\r\n if /^\\s*class\\s+\\w+\\s+\\<\\s+(?<parent_>\\w+)/ =~ line\r\n crt_model.parent = parent_.underscore if parent_\r\n end\r\n end\r\n \r\n # catch functions\r\n in_public = true if /public\\:/ =~ line\r\n in_public = false if /private\\:/ =~ line\r\n\r\n if /^\\s*def\\s+(?<func_>[^#]+)\\s*/ =~ line\r\n field_ = Fields.new\r\n field_.name, field_.type = func_, 'function'\r\n self.parse_erd field_, line # parse erd attr and label\r\n # arbitrage link\r\n if /\\-\\>\\s*(?<name_>\\w+)(\\{(?<attrs_>.+)\\})?/ =~ line\r\n attrs = {}\r\n attrs = YAML.load(attrs_) if attrs_\r\n field_.edge = [name_, '', attrs]\r\n end\r\n crt_model.fields << field_ \r\n end\r\n\r\n # catch field\r\n if /^\\s*field\\s+\\:(?<name_>\\w+)\\s*\\,.*\\:?type\\:?\\s*(?<type_>[A-Za-z_0-9\\:]+)/ =~ line\r\n field_ = Fields.new\r\n field_.name, field_.type = name_, type_\r\n self.parse_erd field_, line # parse erd attr and label\r\n # arbitrage link\r\n if /\\-\\>\\s*(?<name_>\\w+)(\\{(?<attrs_>.+)\\})?/ =~ line\r\n attrs = {}\r\n attrs = YAML.load(attrs_) if attrs_\r\n field_.edge = [name_, '', attrs]\r\n end\r\n crt_model.fields << field_ \r\n end\r\n\r\n # catch relations\r\n if /^\\s*(?<rel_>embeds_many|embeds_one|has_many|has_one|belongs_to|embedded_in)\\s+\\:(?<name_>\\w+)\\s*(\\,.*\\:?as\\:?\\s*(?<as_>\\w+))?/ =~ line\r\n field_ = Fields.new\r\n field_.name, field_.type = rel_, name_\r\n field_.name = \"#{rel_} (as #{as_})\" if as_\r\n self.parse_erd field_, line # parse erd attr and label\r\n crt_model.fields << field_ \r\n #if %w[belongs_to embedded_in embeds_one has_one].include? rel_\r\n field_.edge = [name_, '', {label: rel_, arrowhead: 'normal'}]\r\n #end\r\n end\r\n \r\n # common extension field\r\n if /^\\s*symbolize\\s+\\:(?<name>\\w+)\\s*\\,.*\\:?in\\:?.*(?<in_>\\[.+\\])/ =~ line\r\n field_ = Fields.new\r\n field_.name, field_.type = name_, \"symbolized in #{in_}\"\r\n self.parse_erd field_, line # parse erd attr and label\r\n crt_model.fields << field_ \r\n end\r\n\r\n if /^\\s*state_machine\\s+\\:(?<state_>\\w+)/ =~ line\r\n field_ = Fields.new\r\n field_.name = state_ == \"initial\" ? \"state\" : state_\r\n field_.type = \"state_machine\"\r\n self.parse_erd field_, line # parse erd attr and label\r\n crt_model.fields << field_ \r\n end\r\n\r\n if /\\s*as_enum\\s+\\:(?<name_>\\w+)\\s*\\,\\s*(?<enum_>[^#]+)/ =~ line\r\n field_ = Fields.new\r\n field_.name = name_\r\n field_.type = \"[ENUM] \" + enum_ \r\n self.parse_erd field_, line # parse erd attr and label\r\n crt_model.fields << field_ \r\n end\r\n\r\n end # open and parse one file\r\n\r\n # assign attributes at the last moment\r\n crt_model.attrs.merge! model_attrs_\r\n\r\n # if config.include/tag, default to exclude_it = true\r\n if @config[:include].size > 0 or @config[:tag].size > 0\r\n include_it = false\r\n else\r\n include_it = true\r\n end\r\n\r\n # if in the include list, include it\r\n include_it = true if @config[:include] and @config[:include].include? crt_model.name\r\n @config[:tag].each do |t|\r\n include_it = true if t == crt_model.tag or /^#{t}(\\..+)?/.match(crt_model.tag)\r\n end\r\n\r\n include_it = false if @config[:exclude].include? crt_model.name\r\n @models[crt_model.name] = crt_model if include_it\r\n end # open directory\r\n self\r\n end", "def create_model(*)\n create_magic_properties\n set_timestamps\n create_magic_properties\n properties = convert_properties_to :db, props\n node = _create_node(properties)\n init_on_load(node, node.props)\n send_props(@relationship_props) if @relationship_props\n @relationship_props = nil\n # Neo4j::IdentityMap.add(node, self)\n # write_changed_relationships\n true\n end", "def create_model(*)\n create_magic_properties\n set_timestamps\n create_magic_properties\n properties = convert_properties_to :db, props\n node = _create_node(properties)\n init_on_load(node, node.props)\n send_props(@relationship_props) if @relationship_props\n @relationship_props = nil\n # Neo4j::IdentityMap.add(node, self)\n # write_changed_relationships\n true\n end", "def build_db_tree( parent_id, zone ) \n sub_root = nil\n connect_for( zone ) do |con|\n root = Node.make_node( \"home\" )\n sub_root = Node.new( parent_id, zone )\n \n root << sub_root\n \n count = 0\n data = { :dyna => true }\n database_names( con ).each do |db_name|\n db = con.db( db_name, :strict => true )\n cltns = collection_names( db ).size \n node = Node.new( \"#{zone}_#{count}\", \"#{db_name}(#{cltns})\", data.clone )\n sub_root << node\n count += 1\n end\n end\n sub_root\n end", "def new_model\n model_class.new(name: 'root',\n next: model_class.new(name: 'old-tail'))\n end", "def load_models\n @models = []\n # Load Models and Schema for corresponding orm\n re = /^.*\\/(.*).rb$/\n Dir[\"#{ROOT}/models/#{@orm.to_s}/*\"].each { |c| \n require c \n match = c.match(re)\n @models << Extlib::Inflection.constantize(Extlib::Inflection.camelize(match[1])) if match\n }\n end", "def make_and_model; end", "def initialize(attrs = {})\n @nested_model_instances = {}\n \n self._nested_models.each do |model|\n model_class = model.to_s.classify.constantize\n \n if attrs.include?(model)\n @nested_model_instances[model] = initialize_nested_model(model_class, attrs[model])\n else\n @nested_model_instances[model] = initialize_nested_model(model_class)\n end\n end\n \n self._dependencies.each do |from, tos|\n tos.each do |to|\n @nested_model_instances[from].public_send(\"#{to.to_s}=\", @nested_model_instances[to])\n end\n end\n end", "def create_class_tree(classtree = ClassTreeNode.new(Kernel),\n ignore = [ClassTreeNode, ObjectDescriber, ObjectBrowser, ObjectBrowser::UI, ObjectBrowser::UI::DescriptionFactory])\n ObjectSpace.each_object do | x |\n classnode = classtree\n x.class.ancestors.reverse[1..-1].inject(classtree){ | classnode, klass | classnode.add_class(klass) }.add_object(x)\n end \n classtree\n end", "def populate_inheritance_heirarchy\n apps_and_templates = appTemplates + templates\n apps_and_templates.each do |temp| \n temp.attributes[:parent].to_s != '' ? app_or_temp = temp.attributes[:parent] :\n temp.attributes[:template].to_s != '' ? app_or_temp = temp.attributes[:template]:\n next\n next if app_or_temp == \"what the fuck?\"\n # if temp.attributes[:parent].is_a? String or temp.attributes[:template].is_a? String\n if not app_or_temp.empty?\n parent_template = self.templates.find { |template| template.name.downcase == app_or_temp.downcase }\n temp.child_of << parent_template\n parent_template.parent_of << temp\n end\n end \n end", "def build(klazz_name)\n klazz_underscore = klazz_name.underscore\n klazzes = @repositories.map { |r| r.class_descriptors.filter(:rb_klazz => klazz_name).first }.compact\n raise StandardError if klazzes.empty?\n klazz = klazzes[-1] # keep the last one\n table = klazz.table\n if table.nil?\n raise ArgumentError # Fix this\n end\n string = %{\n$LOAD_PATH << Dir.pwd unless $LOAD_PATH.include? Dir.pwd\nrequire 'connection'\n\n}\n\n string = add_mapping_constants(klazz, klazz_name, string)\n string += string_methods(klazz_name)\n\n string << %{\n#{table}__#{klazz_name} = DB[:#{table}]\n#{table}__#{klazz_name}.identifier_input_method = :#{klazz_underscore}_db_in\n#{table}__#{klazz_name}.identifier_output_method = :#{klazz_underscore}_db_out\n}\n\n string << \"class #{klazz_name} < Sequel::Model\\n\"\n\n string << \" set_dataset #{table}__#{klazz_name}\\n\\n\"\n string = add_primary_keys(klazz, string)\n string = add_references(klazz, string)\n string = add_collections(klazz, string)\n string = add_ojb_entry(klazz, string)\n\n string << \"end\\n\"\n\n string << <<DEFN\nclass #{klazz_name}\n Definition = \"#{string}\"\n\n def self.definition\n OJBequel::Utils.less Definition\n end\nend\nDEFN\n\n #string << add_definition(klazz_name, string)\n string\n end", "def create_models\n @name = name.singularize.downcase\n @name_plural = @name.pluralize\n @attributes = attributes\n template(\"./templates/model.erb\", \"./models/#{@name}.rb\")\n end", "def create_models\n @target_prefix = target.blank? ? '' : (target.camelize + '::')\n models = options[:models] || MODELS\n model_names = options[:names] || MODELS\n models.zip(model_names).each do |original_name, new_name|\n @model_name = new_name.camelize\n template \"#{original_name}.rb\",\n \"app/models/#{target}/#{@model_name.underscore}.rb\"\n end\n end", "def register_model(klass)\n table_name = klass.table_name\n self.models[klass] = table_name\n self.object_map[table_name] = {}\n\n self.class_eval do\n # Define accessors for the fixtures for this new model.\n define_method(table_name) do |name|\n self.object_map[table_name][name.to_sym]\n end\n end\n end", "def models!\n # load '../db/schema.rb'\n \n models = Object.constants.map {|c| Object.const_get(c)}.select {|c| c.is_a?(Class) && c.superclass == ActiveRecord::Base}\n models = models.map(&:to_s)\n \n # This erases the class definitions, as long as nothing ELSE is holding onto a ref -- possibly controllers?\n models.each do |c|\n Object.instance_eval {remove_const c}\n end\n \n # Allow Kernel.require to re-load these models when references to them crop up\n # \"tableize.singularize\" is effective, but not airtight\n models.each do |c|\n $\".reject! {|x| x =~ /app\\/models\\/#{c.tableize.singularize}/}\n end\n \n # Hopefully the auto-loader can do the rest of the work for us\n \n # TODO: What about those pesky namespaced models and controllers?\n end", "def generate_view_models\n file_name = class_name.underscore\n \n create_model class_name, file_name\n \n create_views file_name if options.views.present?\n end", "def create_model\n template 'model.rb', \"app/models/#{model_path}.rb\" unless @skip_model\n end", "def build_model(table)\n model = Mongify::Mongoid::Model.new(class_name: table.name.classify, table_name: table.name)\n model.polymorphic_as = table.polymorphic_as if table.polymorphic?\n #TODO: Might need to check that model doesn't already exist in @models\n @models[table.name.downcase.to_sym] = model\n model\n end", "def fix_model_loading\n # TODO: trying a new fix upon the init.rb\n # if doesn't work, uncomment this line\n # Dir.new(File.join(RAILS_ROOT, 'app', 'models')).each { |s| require s if s =~ /\\.rb$/ }\n end", "def generate_content_paths\n\n # This code for updating the uid field with the id (primary key)\n self.update_attributes(:uid => self.id)\n\n # The first entry with the self parent\n first = ContentPath.new\n first.ancestor = self.id\n first.descendant = self.id\n first.depth = 0\n first.save\n\n # Getting the parent id of the content\n parent_id = ContentData.get_parent_id(self.id)\n\n # If a parent is found then putting all the Content Path Entries\n if parent_id > 0\n\n # Getting the parent id data\n parent = Content.find(parent_id)\n # Getting all the parents of the parent (NOTE: This also contains the current parent id)\n parent_parents = parent.parents\n if(parent_parents.length > 0)\n parent_parents.each do |p|\n\n # Creating the new content paths\n path = ContentPath.new\n path.ancestor = p[\"ancestor\"]\n path.descendant = self.id\n path.depth = p[\"depth\"]+1\n path.save\n end\n end\n end\n\n end", "def new_xcdatamodeld(path, sub_group_path = nil)\n path = Pathname.new(path)\n ref = project.new(XCVersionGroup)\n ref.path = path.to_s\n ref.source_tree = '<group>'\n ref.version_group_type = 'wrapper.xcdatamodel'\n\n last_child_ref = nil\n xccurrentversion = nil\n if path.exist?\n path.children.each do |child_path|\n if File.extname(child_path) == '.xcdatamodel'\n child_ref = ref.new_file_reference(File.basename(child_path))\n child_ref.source_tree = '<group>'\n last_child_ref = child_ref\n elsif File.basename(child_path) == '.xccurrentversion'\n xccurrentversion = Xcodeproj.read_plist(child_path)['_XCCurrentVersionName']\n end\n end\n ref.current_version = ref.children.select { |obj| obj.path == xccurrentversion }.first if xccurrentversion\n ref.current_version = last_child_ref unless xccurrentversion\n end\n\n parent_group = find_subpath(sub_group_path, true)\n parent_group.children << ref\n set_file_refenrece_name_if_needed(ref, parent_group)\n ref\n end", "def tree\n Tree.new(self)\n end", "def init_simple_tree\n @root_org = Org.create(name: 'root')\n @lv1_child_org = Org.create(name: 'lv1')\n @lv1_child_org2 = Org.create(name: 'lv1-2')\n @lv2_child_org = Org.create(name: 'lv2')\n @lv2_child_org2 = Org.create(name: 'lv2-2')\n @lv2_child_org3 = Org.create(name: 'lv2-3')\n @lv2_child_org4 = Org.create(name: 'lv2-4')\n @lv3_child_org = Org.create(name: 'lv3')\n @lv3_child_org2 = Org.create(name: 'lv3-2')\n @lv4_child_org = Org.create(name: 'lv4')\n @lv4_child_org2 = Org.create(name: 'lv4-2')\n @lv5_child_org = Org.create(name: 'lv5')\n @lv5_child_org2 = Org.create(name: 'lv5-2')\n\n current_time = Time.now\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @root_org.id,\n distance: 0,\n start_time: 10.minutes.ago(current_time),\n end_time: 1000.years.from_now,\n scope_name: 'default'\n )\n\n # 10 minutes ago\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv2_child_org.id,\n distance: 1,\n start_time: 10.minutes.ago(current_time),\n end_time: current_time,\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv1_child_org.id,\n distance: 2,\n start_time: 10.minutes.ago(current_time),\n end_time: current_time,\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org.id,\n child_id: @lv1_child_org.id,\n distance: 1,\n start_time: 10.minutes.ago(current_time),\n end_time: current_time,\n scope_name: 'default'\n )\n\n # now\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv1_child_org.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv1_child_org2.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv2_child_org.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv2_child_org.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv2_child_org2.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv2_child_org2.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv2_child_org3.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org2.id,\n child_id: @lv2_child_org3.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv2_child_org4.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org2.id,\n child_id: @lv2_child_org4.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv3_child_org.id,\n distance: 3,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv3_child_org.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org.id,\n child_id: @lv3_child_org.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv4_child_org.id,\n distance: 4,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv4_child_org.id,\n distance: 3,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org.id,\n child_id: @lv4_child_org.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv3_child_org.id,\n child_id: @lv4_child_org.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv5_child_org.id,\n distance: 5,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv5_child_org.id,\n distance: 4,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org.id,\n child_id: @lv5_child_org.id,\n distance: 3,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv3_child_org.id,\n child_id: @lv5_child_org.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv4_child_org.id,\n child_id: @lv5_child_org.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv3_child_org2.id,\n distance: 3,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv3_child_org2.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org2.id,\n child_id: @lv3_child_org2.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv4_child_org2.id,\n distance: 4,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv4_child_org2.id,\n distance: 3,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org2.id,\n child_id: @lv4_child_org2.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv3_child_org2.id,\n child_id: @lv4_child_org2.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv5_child_org2.id,\n distance: 5,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv5_child_org2.id,\n distance: 4,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org2.id,\n child_id: @lv5_child_org2.id,\n distance: 3,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv3_child_org2.id,\n child_id: @lv5_child_org2.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv4_child_org2.id,\n child_id: @lv5_child_org2.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\nend", "def finalize_model\n\t\t\t@model.setReadOnly(true)\n\t\t\t@model.setFilter(Qt::Dir::NoDotAndDotDot | Qt::Dir::AllDirs)\n\t\t\t@model.setRootPath(Qt::Dir.rootPath)\n\t\t\t\n\t\t\tself.setModel(@model)\n\t\tend", "def load_tree\n\t\t\twtree = Tree.new(\"ROOT_TREE\")\n\n\t\t\tif selected_host == nil\n\t\t\t\tprint_error(\"Target not selected\")\n\t\t\telse\n\t\t\t\tframework.db.each_request_target do |req|\n\t\t\t\t\ttarray = req.path.to_s.split(WMAP_PATH)\n\t\t\t\t\ttarray.delete(\"\")\n\t\t\t\t\ttpath = Pathname.new(WMAP_PATH)\n\n\t\t\t\t\ttarray.each do |df|\n\t\t\t\t\t\twtree.add_at_path(tpath.to_s,df)\n\t\t\t\t\t\ttpath = tpath + Pathname.new(df.to_s)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\treturn wtree\n\t\tend", "def copy_model(relative_model_path)\n model_path = File.expand_path(\"../../dummy_activerecord/app/models/#{relative_model_path}.rb\", __FILE__)\n if (path_ary = relative_model_path.split('/')) && path_ary.size > 1\n destination = File.join(destination_root, \"app\", \"models\",*path_ary[0..-2])\n else\n destination = File.join(destination_root, \"app\", \"models\")\n end\n\n FileUtils.mkdir_p(destination)\n FileUtils.cp model_path, destination\n \n # Replace class name\n class_name = path_ary.map(&:capitalize).join(\"::\")\n full_path = File.join(destination,\"#{path_ary[-1]}.rb\")\n text = File.read(full_path)\n replace = text.gsub(\"class #{class_name} < ActiveRecord::Base\", \"class #{class_name}\\ninclude Mongoid::Document\\n\")\n File.open(full_path, \"w\") {|file| file.puts replace}\n end", "def generate_model_alpha_beta\n generate \"model\", \"#{@connection} user:references #{@alpha}:references #{@beta}:references\"\n from_file = \"app/models/#{@connection}.rb\"\n from = \" belongs_to :parent\"\n to = \" belongs_to :parent_#{@beta}, class_name: '#{@beta.camelcase}', foreign_key: 'parent_id'\"\n gsub_file from_file, from, to\n from_file = \"app/models/#{@connection}.rb\"\n from = \" belongs_to :child\"\n to = \" belongs_to :child_#{@beta}, class_name: '#{@beta.camelcase}', foreign_key: 'child_id'\"\n gsub_file from_file, from, to\n end", "def reload\n klasses = if @reflection.polymorphic?\n @reflection.active_record.distinct.order(reflection.foreign_type).pluck(reflection.foreign_type).map(&:safe_constantize)\n else\n [@reflection.klass]\n end\n @models = klasses.map { |k| @dump.model_for(k) }\n end", "def create_model_files\n template 'model.rb', File.join('app/models/mokio', class_path, \"#{file_name}.rb\")\n end", "def path_to_model(path)\n path_to_class(path, ActiveRecord::Base)\nend", "def model_classes\n ModelClassCollector.new(configuration, mode_map.keys).collect\n end", "def tree\n @tree ||= build_tree\n end", "def new_model(auto_migrate = true, &block)\n DB.create_table! :foo do\n primary_key :id\n column :state, :string\n end if auto_migrate\n model = Class.new(Sequel::Model(:foo)) do\n self.raise_on_save_failure = false\n def self.name; 'SequelTest::Foo'; end\n end\n model.plugin(:validation_class_methods) if model.respond_to?(:plugin)\n model.plugin(:hook_class_methods) if model.respond_to?(:plugin)\n model.class_eval(&block) if block_given?\n model\n end", "def generate_model\n\t\tclasses = CartesianClassifier.get_classes(Sample.find_all_by_classname(params[:classnames].split(',')))\n\t\tclassmodel = ClassModel.new({\n\t\t\t:classnames => params[:classnames], # split and join again for validation?\n\t\t\t:modelstring => ActiveSupport::JSON.encode(classes),\n\t\t\t:author => params[:author],\n\t\t\t:notes => params[:notes]\n\t\t})\n\t\tclassmodel.save\n\t\tredirect_to \"/\"\n end", "def path_model(ident=:default, prefix='')\n self.class.path_model(ident, prefix)\n end", "def with_model_class(name, columns={})\n create_model_class(name, columns)\n yield\n ensure\n destroy_model_class(name)\n end", "def load_models(hash, namespaces = [])\n models = []\n\n # first handle all normal models\n if models_hash = hash[\"models\"]\n models_hash.each_pair do |model_name, model_properties|\n models << Model::Base.new(model_name, model_properties, :namespaces => namespaces, :reader => self)\n end\n end\n \n # go into recursion to handle the models under a namespace\n if found_namespaces = hash[\"namespaces\"]\n found_namespaces.each_pair do |namespace, models_under_namespace|\n models += load_models(models_under_namespace, namespaces + [namespace])\n end\n end\n\n models\n end", "def root_model\n node = @model\n\n loop do\n parent = node.parent\n if parent\n node = parent\n else\n break\n end\n end\n\n node\n end", "def root_model\n node = @model\n\n loop do\n parent = node.parent\n if parent\n node = parent\n else\n break\n end\n end\n\n node\n end", "def seed\n @data = {}\n\n SEEDED_MODELS.each do |model_name|\n pluralized_model_name = model_name.underscore + 's'\n\n filename = \"app/data/#{pluralized_model_name}.yml\"\n\n # Load data as an array of objects\n models_data = YAML.safe_load(File.read(filename)).deep_symbolize_keys\n\n # Constantize model klass\n model_klass = Class.const_get(\"CodeWars::#{model_name}\")\n\n # Map models data to new Instances\n models_data.each_with_index do |model_data, i|\n model = model_klass.new\n\n model.load_attributes(model_data || {})\n\n model.indexed_at = i\n\n # Push to DataStore memory\n\n @data[pluralized_model_name.to_sym] ||= []\n @data[pluralized_model_name.to_sym] << model\n end\n end\n end", "def create_children_from_sdd_json(meta, h)\n # Go through the children\n self_model = meta[:model_name].camelcase(:upper).constantize\n kids = self_model.children_models\n unless kids.nil? || kids.empty?\n kids.each do |k|\n # check if the kids have a json object at this level\n if h[k[:xml_name]]\n logger.debug \"XML child is #{k[:xml_name]}\"\n logger.debug \"Model name is #{k[:model_name]}\"\n if h[k[:xml_name]].is_a? Array\n logger.debug \"#{k[:xml_name]} is an array, will add all the objects\"\n h[k[:xml_name]].each do |h_instance|\n klass = k[:model_name].camelcase(:upper).constantize\n if klass.respond_to? :from_sdd_json\n model = klass.from_sdd_json(k, h_instance)\n\n # Assign the foreign key on the object\n model[\"#{meta[:model_name]}_id\"] = id\n model.save!\n else\n logger.warn \"Class #{klass} does not have instance method 'from_sdd_json'\"\n end\n end\n elsif h[k[:xml_name]].is_a? Hash\n logger.debug \"#{k[:xml_name]} is a single object, will add only one\"\n klass = k[:model_name].camelcase(:upper).constantize\n if klass.respond_to? :from_sdd_json\n model = klass.from_sdd_json(k, h[k[:xml_name]])\n\n # Assign the foreign key on the object\n model[\"#{meta[:model_name]}_id\"] = id\n model.save!\n else\n logger.warn \"Class #{klass} does not have instance method 'from_sdd_json'\"\n end\n end\n end\n end\n end\n end", "def create_children_from_sdd_json(meta, h)\n # Go through the children\n self_model = meta[:model_name].camelcase(:upper).constantize\n kids = self_model.children_models\n unless kids.nil? || kids.empty?\n kids.each do |k|\n # check if the kids have a json object at this level\n if h[k[:xml_name]]\n logger.debug \"XML child is #{k[:xml_name]}\"\n logger.debug \"Model name is #{k[:model_name]}\"\n if h[k[:xml_name]].is_a? Array\n logger.debug \"#{k[:xml_name]} is an array, will add all the objects\"\n h[k[:xml_name]].each do |h_instance|\n klass = k[:model_name].camelcase(:upper).constantize\n if klass.respond_to? :from_sdd_json\n model = klass.from_sdd_json(k, h_instance)\n\n # Assign the foreign key on the object\n model[\"#{meta[:model_name]}_id\"] = id\n model.save!\n else\n logger.warn \"Class #{klass} does not have instance method 'from_sdd_json'\"\n end\n end\n elsif h[k[:xml_name]].is_a? Hash\n logger.debug \"#{k[:xml_name]} is a single object, will add only one\"\n klass = k[:model_name].camelcase(:upper).constantize\n if klass.respond_to? :from_sdd_json\n model = klass.from_sdd_json(k, h[k[:xml_name]])\n\n # Assign the foreign key on the object\n model[\"#{meta[:model_name]}_id\"] = id\n model.save!\n else\n logger.warn \"Class #{klass} does not have instance method 'from_sdd_json'\"\n end\n end\n end\n end\n end\n end", "def create_children_from_sdd_json(meta, h)\n # Go through the children\n self_model = meta[:model_name].camelcase(:upper).constantize\n kids = self_model.children_models\n unless kids.nil? || kids.empty?\n kids.each do |k|\n # check if the kids have a json object at this level\n if h[k[:xml_name]]\n logger.debug \"XML child is #{k[:xml_name]}\"\n logger.debug \"Model name is #{k[:model_name]}\"\n if h[k[:xml_name]].is_a? Array\n logger.debug \"#{k[:xml_name]} is an array, will add all the objects\"\n h[k[:xml_name]].each do |h_instance|\n klass = k[:model_name].camelcase(:upper).constantize\n if klass.respond_to? :from_sdd_json\n model = klass.from_sdd_json(k, h_instance)\n\n # Assign the foreign key on the object\n model[\"#{meta[:model_name]}_id\"] = id\n model.save!\n else\n logger.warn \"Class #{klass} does not have instance method 'from_sdd_json'\"\n end\n end\n elsif h[k[:xml_name]].is_a? Hash\n logger.debug \"#{k[:xml_name]} is a single object, will add only one\"\n klass = k[:model_name].camelcase(:upper).constantize\n if klass.respond_to? :from_sdd_json\n model = klass.from_sdd_json(k, h[k[:xml_name]])\n\n # Assign the foreign key on the object\n model[\"#{meta[:model_name]}_id\"] = id\n model.save!\n else\n logger.warn \"Class #{klass} does not have instance method 'from_sdd_json'\"\n end\n end\n end\n end\n end\n end", "def create_children_from_sdd_json(meta, h)\n # Go through the children\n self_model = meta[:model_name].camelcase(:upper).constantize\n kids = self_model.children_models\n unless kids.nil? || kids.empty?\n kids.each do |k|\n # check if the kids have a json object at this level\n if h[k[:xml_name]]\n logger.debug \"XML child is #{k[:xml_name]}\"\n logger.debug \"Model name is #{k[:model_name]}\"\n if h[k[:xml_name]].is_a? Array\n logger.debug \"#{k[:xml_name]} is an array, will add all the objects\"\n h[k[:xml_name]].each do |h_instance|\n klass = k[:model_name].camelcase(:upper).constantize\n if klass.respond_to? :from_sdd_json\n model = klass.from_sdd_json(k, h_instance)\n\n # Assign the foreign key on the object\n model[\"#{meta[:model_name]}_id\"] = id\n model.save!\n else\n logger.warn \"Class #{klass} does not have instance method 'from_sdd_json'\"\n end\n end\n elsif h[k[:xml_name]].is_a? Hash\n logger.debug \"#{k[:xml_name]} is a single object, will add only one\"\n klass = k[:model_name].camelcase(:upper).constantize\n if klass.respond_to? :from_sdd_json\n model = klass.from_sdd_json(k, h[k[:xml_name]])\n\n # Assign the foreign key on the object\n model[\"#{meta[:model_name]}_id\"] = id\n model.save!\n else\n logger.warn \"Class #{klass} does not have instance method 'from_sdd_json'\"\n end\n end\n end\n end\n end\n end", "def create_children_from_sdd_json(meta, h)\n # Go through the children\n self_model = meta[:model_name].camelcase(:upper).constantize\n kids = self_model.children_models\n unless kids.nil? || kids.empty?\n kids.each do |k|\n # check if the kids have a json object at this level\n if h[k[:xml_name]]\n logger.debug \"XML child is #{k[:xml_name]}\"\n logger.debug \"Model name is #{k[:model_name]}\"\n if h[k[:xml_name]].is_a? Array\n logger.debug \"#{k[:xml_name]} is an array, will add all the objects\"\n h[k[:xml_name]].each do |h_instance|\n klass = k[:model_name].camelcase(:upper).constantize\n if klass.respond_to? :from_sdd_json\n model = klass.from_sdd_json(k, h_instance)\n\n # Assign the foreign key on the object\n model[\"#{meta[:model_name]}_id\"] = id\n model.save!\n else\n logger.warn \"Class #{klass} does not have instance method 'from_sdd_json'\"\n end\n end\n elsif h[k[:xml_name]].is_a? Hash\n logger.debug \"#{k[:xml_name]} is a single object, will add only one\"\n klass = k[:model_name].camelcase(:upper).constantize\n if klass.respond_to? :from_sdd_json\n model = klass.from_sdd_json(k, h[k[:xml_name]])\n\n # Assign the foreign key on the object\n model[\"#{meta[:model_name]}_id\"] = id\n model.save!\n else\n logger.warn \"Class #{klass} does not have instance method 'from_sdd_json'\"\n end\n end\n end\n end\n end\n end", "def create_children_from_sdd_json(meta, h)\n # Go through the children\n self_model = meta[:model_name].camelcase(:upper).constantize\n kids = self_model.children_models\n unless kids.nil? || kids.empty?\n kids.each do |k|\n # check if the kids have a json object at this level\n if h[k[:xml_name]]\n logger.debug \"XML child is #{k[:xml_name]}\"\n logger.debug \"Model name is #{k[:model_name]}\"\n if h[k[:xml_name]].is_a? Array\n logger.debug \"#{k[:xml_name]} is an array, will add all the objects\"\n h[k[:xml_name]].each do |h_instance|\n klass = k[:model_name].camelcase(:upper).constantize\n if klass.respond_to? :from_sdd_json\n model = klass.from_sdd_json(k, h_instance)\n\n # Assign the foreign key on the object\n model[\"#{meta[:model_name]}_id\"] = id\n model.save!\n else\n logger.warn \"Class #{klass} does not have instance method 'from_sdd_json'\"\n end\n end\n elsif h[k[:xml_name]].is_a? Hash\n logger.debug \"#{k[:xml_name]} is a single object, will add only one\"\n klass = k[:model_name].camelcase(:upper).constantize\n if klass.respond_to? :from_sdd_json\n model = klass.from_sdd_json(k, h[k[:xml_name]])\n\n # Assign the foreign key on the object\n model[\"#{meta[:model_name]}_id\"] = id\n model.save!\n else\n logger.warn \"Class #{klass} does not have instance method 'from_sdd_json'\"\n end\n end\n end\n end\n end\n end", "def orm_xml\n template_xml = '<?xml version=\"1.0\" encoding=\"utf-8\"?>\n <ormRoot:ORM2 xmlns:orm=\"http://schemas.neumont.edu/ORM/2006-04/ORMCore\" xmlns:ormDiagram=\"http://schemas.neumont.edu/ORM/2006-04/ORMDiagram\" xmlns:ormRoot=\"http://schemas.neumont.edu/ORM/2006-04/ORMRoot\"></ormRoot:ORM2>'\n \n builder = Nokogiri::XML::Builder.with(Nokogiri::XML(template_xml).at('/ormRoot:ORM2')) do |xml|\n attributes = ActiveSupport::OrderedHash.new\n attributes[:id] = serialize_uuid(model.uuid)\n attributes[:Name] = model.name\n \n xml['orm'].ORMModel(attributes) do\n object_types(xml)\n fact_types(xml)\n constraints(xml)\n data_types(xml) unless model.data_types.blank?\n model_notes(xml) unless model.model_notes.blank?\n model_errors(xml) unless model.model_errors.blank?\n reference_mode_kinds(xml) unless model.reference_mode_kinds.blank?\n end\n end\n \n builder.to_xml\n end", "def trees\n @trees ||= ApiFactory.new 'GitData::Trees'\n end", "def build_model\n \n return if skip_method(__method__)\n\n filename = singular_table_name + '.rb'\n \n template = File.read(template(\"rails/model.erb\"))\n text = Erubis::Eruby.new(template).evaluate( self )\n\n path = File.join(\"app\",\"models\",filename) \n puts \"build Rails model for #{model_name} in #{path}\"\n write_artifact(path,text)\n\n end", "def local_model(parent_model, name)\n Roby::Distributed::DRobyModel.anon_model_factory(parent_model, name)\n end", "def create_children_from_sdd_json(meta, h)\n # Go through the children\n self_model = meta[:model_name].camelcase(:upper).constantize\n kids = self_model.children_models\n unless kids.nil? || kids.empty?\n kids.each do |k|\n # check if the kids have a json object at this level\n if h[k[:xml_name]]\n logger.debug \"XML child is #{k[:xml_name]}\"\n logger.debug \"Model name is #{k[:model_name]}\"\n next if k[:xml_name] == 'ConsAssm'\n\n if h[k[:xml_name]].is_a? Array\n logger.debug \"#{k[:xml_name]} is an array, will add all the objects\"\n h[k[:xml_name]].each do |h_instance|\n klass = k[:model_name].camelcase(:upper).constantize\n if klass.respond_to? :from_sdd_json\n model = klass.from_sdd_json(k, h_instance)\n\n # Assign the foreign key on the object\n model[\"#{meta[:model_name]}_id\"] = id\n model.save!\n else\n logger.warn \"Class #{klass} does not have instance method 'from_sdd_json'\"\n end\n end\n elsif h[k[:xml_name]].is_a? Hash\n logger.debug \"#{k[:xml_name]} is a single object, will add only one\"\n klass = k[:model_name].camelcase(:upper).constantize\n if klass.respond_to? :from_sdd_json\n model = klass.from_sdd_json(k, h[k[:xml_name]])\n\n # Assign the foreign key on the object\n model[\"#{meta[:model_name]}_id\"] = id\n model.save!\n else\n logger.warn \"Class #{klass} does not have instance method 'from_sdd_json'\"\n end\n end\n end\n end\n end\n end", "def models\n children = []\n Mongoid.models.each do |model|\n children << model.to_s\n model.descendants.each do |child|\n inh = [child.to_s]\n sk = child.superclass\n while sk != model\n inh << sk.to_s\n sk = sk.superclass\n raise '!' if sk == Object\n end\n\n children << ' ' + inh.reverse.join(' < ')\n end\n end\n children\nend", "def write_model model_name, class_name\n puts model_name\n ret=\"\"\n model = Model.new(model_name,class_name) \n data_types= model.get_datatypes\n #build hash\n model.get_rows.each do |item|\n line = Hash.new\n subline = Hash.new\n #and now add all mapping-attributes\n remove =Array.new\n model.model_attributes.each do |k,v|\n # if k.to_s.include?(\"->\")\n if v.to_s.include?(\"*\") || v.to_s[0..9]==\"new_model(\"\n\n remove.push(k.to_s) unless remove.index(k.to_s)\n m_class,field=v.to_s.split(\"*\")\n ref_pred,ref_model=k.to_s.split\"->\"\n if v.to_s[0..5]==\"MODEL(\"\n m_class.gsub!(\"MODEL(\",\"Model.new(\")\n submodel= eval(m_class.to_s).get_rows\n else\n submodel= eval(\"item.#{m_class.to_s.downcase}\")\n end\n submodel.each do |subitem|\n subline[:id] = eval(\"item.#{model.get_key}\")\n subline[k] = eval(\"subitem.#{field}\")\n #extract_id_line(m.model_attributes, subline, subitem, Array.new)\n ret<<make_triples(subline, class_name, false,Array.new,false )\n subline.clear\n end\n else\n write_line = true;\n if v.to_s.include? \".\"\n write_line = nil unless eval(\"item.\"+v.to_s.downcase.split(\".\")[0])\n end\n begin\n if v.to_s[0..5]==\"CONST(\"\n line[k.to_s],data_types[k.to_s]= model.get_const(v)\n #datatype to uri format\n if data_types[k.to_s]==\"LINK\"\n line[k.to_s] =uri line[k.to_s]\n data_types.delete k.to_s\n @object_properties[k.to_s]=\"t\"\n else\n data_types[k.to_s] = uri(data_types[k.to_s])\n end\n else\n line[k.to_s]=eval(\"item.\"+v.to_s) if write_line\n end\n rescue Exception => ex\n line[k.to_s]=v.to_s if write_line\n end\n end\n # end\n end\n extract_id_line(model.model_attributes, line, item,data_types)\n remove.each { |rem_attrib| line.delete(rem_attrib) }\n #get triples of row\n ret<<make_triples(line, class_name , \"\", data_types)\n #render :text => t.make_triples(c1, controller , \"\", t.dbd_types)\n end\n ret\n end", "def generate_model\n invoke \"active_record:model\", [name], :migration => false unless model_exists? && behavior == :invoke\n if store_in == 'active_record'\n invoke \"active_record:model\", [ACTIVE_RECORDABLE], :migration => false unless active_recordable_exists? && behavior == :invoke\n end\n end", "def tree(treeish = 'master', paths = [])\n raise InvalidDbError if @stale\n super\n end", "def create_model class_name, file_name\n # ViewModels\n #\n create_file \"app/view_models/#{file_name}.rb\", <<-FILE\nclass ViewModels::#{class_name} < ViewModels::Project\n\n# model_reader :icon, :filter_through => [:h]\n\nend\n FILE\n\n # Specs\n #\n \n create_file \"spec/view_models/#{file_name}_spec.rb\", <<-FILE\nrequire 'spec_helper'\n\ndescribe ViewModels::#{class_name} do\n\nend\n FILE\n\n end", "def check_foreing_models\n parent_ids.each do |attr|\n next if attr !~ /(.*)_id$/\n k= $1.camelize\n begin; foreing_models[attr]= k.singularize.constantize\n rescue\n end\n end\n end", "def model(name, model_klass)\n @root = Elem.new(name, model_klass, nil)\n end", "def set_tree\n @tree = Tree\n .where(:root_uri => params[:root_uri])\n .first_or_create(:root_uri => params[:root_uri])\n end", "def models\n @models ||= {}\n end", "def generate_model\n invoke \"active_record:model\", [name], :migration => false unless model_exists? && behavior == :invoke\n end", "def _write_class_code\n cname = @table.to_s.split('_').map(&:capitalize).join\n klass = Taupe::Model.const_set cname, Class.new(Taupe::Model::Table)\n klass._cname = cname\n klass._table = @table\n klass._columns = @_column_stack\n end", "def load_models(app)\n app.config.paths[\"app/models\"].expanded.each do |path|\n preload = ::Mongoid.preload_models\n if preload.resizable?\n files = preload.map { |model| \"#{path}/#{model.underscore}.rb\" }\n else\n files = Dir.glob(\"#{path}/**/*.rb\")\n end\n\n files.sort.each do |file|\n load_model(file.gsub(\"#{path}/\" , \"\").gsub(\".rb\", \"\"))\n end\n end\n end", "def children_table; end", "def load_models_from(dir, prefix='')\n # Appends a file system directory separator to the directory if needed.\n dir = File.join(dir, '')\n Dir[File.join(dir, '**', '*.rb')].each do |f| \n # For every rb file we try to gues and instantiate the contained class.\n model_name = f.gsub(/#{dir}|\\.rb/, '')\n begin\n (prefix + model_name).camelize.constantize\n rescue Exception => e\n # Errors at this point could be ignored, as there may be files that do not contain classes.\n TaliaCore.logger.warn \"Could not load class #{(prefix + model_name).camelize}: #{e.message}\"\n end\n end\n end", "def code_tree\n kids = j_instance.getChildren\n\n kids.each_with_object([]) do |kid, acc|\n data = { type: kid.getType, parent_type: j_instance.getType, token: kid.toString }\n subtree = self.class.new(kid).code_tree\n data[:children] = subtree unless subtree.empty?\n acc << data\n end\n end", "def gen_tree\n new_tree = {}\n node_list = {}\n @json_tree.each do |k, v|\n if v['child_of'].nil?\n # top\n new_tree[k] = v\n node_list[k] = new_tree[k]\n else\n parent = v['child_of']\n if v['condition'] == 'and'\n node_list[parent]['and'] ||= {}\n node_list[parent]['and'][k] = v\n node_list[k] = node_list[parent]['and'][k]\n elsif v['condition'] == 'or'\n node_list[parent]['or'] ||= {}\n node_list[parent]['or'][k] = v\n node_list[k] = node_list[parent]['or'][k]\n else\n # TODO: sink?\n node_list[parent]['or'] ||= {}\n node_list[parent]['or'][k] = v\n node_list[k] = node_list[parent]['or'][k]\n end\n end\n end\n\n @json_tree_type = 'tree'\n @json_tree = new_tree\n end", "def build_ranked_tree(model)\n # inflate the node id to test id wrap around edge cases\n # NODES=4..9 seem like edge cases\n ENV[\"NODES\"].to_i.times { model.create!.destroy } if ENV[\"NODES\"]\n\n n1 = model.create!(:rank => 0)\n n2 = model.create!(:rank => 1)\n n3 = model.create!(:rank => 3, :parent => n1)\n n4 = model.create!(:rank => 0, :parent => n2)\n n5 = model.create!(:rank => 0, :parent => n1)\n n6 = model.create!(:rank => 1, :parent => n2)\n\n puts \"create: #{n1.id}..#{n6.id}\" if ENV[\"NODES\"]\n [n1, n2, n3, n4, n5, n6]\n end", "def build_node_from_model( n )\n return {\n 'id' => n['key'].to_i,\n 'parent_id' => n['parent'].to_i,\n 'children' => [],\n 'weight' => n['weight'].to_i / 100.0,\n 'operation' => n['name'],\n 'metric' => n['dataname']\n }\n end", "def build_tree\n t = RDTree.new\n t.add_node(0, DummyRoot)\n root = root_node_of\n t.add_edge(0, root.attributes[\"ID\"])\n do_build_tree(root, 1, t) \n t\n end", "def load_all_models\n return if @models_loaded\n load_models_from File.join(RAILS_ROOT, 'app', 'models', '**', '*.rb') if(defined? RAILS_ROOT)\n load_models_from File.join(TALIA_CODE_ROOT, 'lib', 'talia_core', 'source_types', '**', '*.rb'), 'TaliaCore::SourceTypes::'\n TaliaCore::Source\n TaliaCore::Collection\n\n @models_loaded = true\n end", "def class_hierarchy\n @class_hierarchy ||= process_ontology_hierarchy\n end", "def load_model(model_class)\n begin\n file_content = File.read(model_class.db_filename)\n json_data = JSON.parse(file_content)\n rescue Errno::ENOENT\n # The file does not exists\n json_data = []\n end\n json_data.each do |data_hash|\n new_object = model_class.from_hash(data_hash)\n new_object.save\n end\nend", "def load_model(model_class)\n begin\n file_content = File.read(model_class.db_filename)\n json_data = JSON.parse(file_content)\n rescue Errno::ENOENT\n # The file does not exists\n json_data = []\n end\n json_data.each do |data_hash|\n new_object = model_class.from_hash(data_hash)\n new_object.save\n end\nend", "def build_automate_tree(type)\n tree_name = \"#{type}_tree\".to_sym\n\n # build the ae tree to show the tree select box for entry point\n if x_active_tree == tree_name && @edit && @edit[:new][:fqname]\n nodes = @edit[:new][:fqname].split(\"/\")\n @open_nodes = []\n # if there are more than one nested namespaces\n nodes.each_with_index do |_node, i|\n if i == nodes.length - 1\n # check if @cls is there, to make sure the class/instance still exists in Automate db\n inst = @cls ? MiqAeInstance.find_by(:class_id => @cls.id, :name => nodes[i]) : nil\n # show this as selected/expanded node when tree loads\n if inst\n @open_nodes.push(\"aei-#{inst.id}\")\n @active_node = \"aei-#{inst.id}\"\n end\n elsif i == nodes.length - 2\n @cls = MiqAeClass.find_by(:namespace_id => @ns.id, :name => nodes[i])\n @open_nodes.push(\"aec-#{@cls.id}\") if @cls\n else\n @ns = MiqAeNamespace.find_by(:name => nodes[i])\n @open_nodes.push(\"aen-#{@ns.id}\") if @ns\n end\n end\n end\n\n klass = case type\n when :automate\n TreeBuilderAutomate\n when :automate_catalog\n TreeBuilderAutomateCatalog\n end\n\n @automate_tree = klass.new(tree_name, @sb)\n end", "def initialize(name,belongs_to)\n @name = name\n @belongs_to = belongs_to\n\t\t@domain = belongs_to.domain \n\t\t@plant = belongs_to.plant\n @attributes = {}\n @child_of = []\n @parent_of = []\n\t\t@runtime_config = {}\n end", "def location_tree\n #@locations = Location.all\n # puts \"location_tree\"\n @locations = Location.where(ancestry: nil).order(location_type: :desc)\n #@locations = Location.where(id: 1)\n end", "def set_model\n\n # check credentials and handle OpenStack Keystone\n # TODO: check expiration dates on Keystone tokens\n raise \"You are not authorized to use this endpoint!\" unless check_authn\n\n #\n model = get('/-/')\n @model = Occi::Model.new(model)\n\n @mixins = {\n :os_tpl => [],\n :resource_tpl => []\n }\n\n #\n get_os_templates.each do |os_tpl|\n unless os_tpl.nil? || os_tpl.type_identifier.nil?\n tid = os_tpl.type_identifier.strip\n @mixins[:os_tpl] << tid unless tid.empty?\n end\n end\n\n #\n get_resource_templates.each do |res_tpl|\n unless res_tpl.nil? || res_tpl.type_identifier.nil?\n tid = res_tpl.type_identifier.strip\n @mixins[:resource_tpl] << tid unless tid.empty?\n end\n end\n\n model\n end", "def config_model\n source = \"#{Dir.pwd}/app/models/#{@scaffold_name}.rb\"\n modify_content(source, 'Model', \"#{model_class}\") \n modify_content(source, '@model', \"@#{@scaffold_name}\")\n end", "def path_tree\n @path_tree ||= if File.exists?(DATA_STORE)\n Item.load JSON.parse(File.read(DATA_STORE))\n else\n Item.new 'plan'\n end\n end", "def create_container_model(name)\n ModelKit::Types.validate_typename(name)\n container_model = ContainerType.new_submodel\n container_model.name = name\n register_container_model(container_model)\n container_model\n end", "def initialize()\n @models = {}\n @path = Settings.get[\"trxml\"][\"path\"]\n @xmls = Settings.get[\"trxml\"][\"xmls\"]\n\n create_models\n end" ]
[ "0.646908", "0.64071745", "0.6404166", "0.63962555", "0.63305557", "0.6310598", "0.6305534", "0.6231644", "0.6229337", "0.6229337", "0.61901736", "0.6111154", "0.6086127", "0.6011625", "0.60019916", "0.5940184", "0.58853716", "0.58023334", "0.57760537", "0.5752064", "0.57196933", "0.57196933", "0.5695957", "0.5617699", "0.5608634", "0.55976677", "0.5597135", "0.55622923", "0.55337524", "0.5528939", "0.5523405", "0.5518674", "0.55109245", "0.5505331", "0.5489502", "0.54510385", "0.5432563", "0.54172647", "0.5414276", "0.53957844", "0.53940773", "0.5389334", "0.53874093", "0.5381859", "0.53756756", "0.53673124", "0.5355179", "0.5345329", "0.5344972", "0.5317149", "0.53044206", "0.5296739", "0.5296378", "0.5280431", "0.5280357", "0.52733463", "0.5270852", "0.5270852", "0.527006", "0.5269211", "0.5269211", "0.5269211", "0.5269211", "0.5269211", "0.5269211", "0.5260336", "0.525652", "0.5255071", "0.5250043", "0.5248003", "0.5243245", "0.5239615", "0.52335304", "0.52330613", "0.5228428", "0.52227306", "0.5216361", "0.51926833", "0.51900005", "0.51882523", "0.5186964", "0.5180214", "0.5175486", "0.51745826", "0.51682425", "0.5165221", "0.5164744", "0.51645315", "0.51589537", "0.5154066", "0.5148437", "0.5148272", "0.5148272", "0.51365995", "0.5134489", "0.5133762", "0.5133459", "0.5131629", "0.51315254", "0.51252025", "0.5121419" ]
0.0
-1
Registers a model on a derailleur node at its path_model Does not modify self.models
def build_route_for_model(model) path = File.join(model.path_model(identifying_sym), ':filename') node = build_route(path) node.content = model end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_model(model)\n raise ArgumentError, \"already know this model\" if models.include?(model)\n models << model\n build_route_for_model(model)\n end", "def model_path=(path)\n @model_path = path\n end", "def save\n @model = register_model\n end", "def register_model(name, identifier)\n models[name] = identifier\n end", "def configure_model\n configure base_uri: base_uri\n Ladder::Config.register_model self unless Ladder::Config.models.include? self\n end", "def model(model)\n if @resource_config[:model]\n raise DefinitionError, \"model already declared in #{self}\"\n end\n @resource_config[:model] = model\n end", "def register_model(model)\n model_dao_name, primary_key = keys_from_model(model, action: :register)\n return self unless model_dao_name.present? && primary_key.present?\n\n log \"register model #{model_dao_name}:#{primary_key}\"\n\n @identity_map[model_dao_name] ||= {}\n @identity_map[model_dao_name][primary_key] = model\n\n self\n end", "def model=(value)\n @model = value\n end", "def model_paths=(paths)\n @model_paths = paths\n end", "def model(name, model_klass)\n @root = [name, model_klass]\n end", "def register_model(klass)\n LOCK.synchronize do\n models.push(klass) unless models.include?(klass)\n end\n end", "def register domain_model_instnace\n\t\t@domain_model_instnaces.push domain_model_instnace\n\tend", "def set_model\n @model = Info\n end", "def model=(model)\n @model = model\n end", "def model=(value)\n @model = value\n end", "def model=(value)\n @model = value\n end", "def model=(value)\n @xml, @extracted_value = nil, nil\n @model = value\n attach_model\n @model\n end", "def set_model\n @model=Info\n end", "def path_model(ident=:default, prefix='')\n self.class.path_model(ident, prefix)\n end", "def model(name, &block)\n @model_registry.model name, &block\n end", "def add_model_to_list(m)\n tn = implementation_model_name\n self.class.models[tn] = m\n logger.info \"Added new model #{tn}\"\n self.class.model_names << tn unless self.class.model_names.include? tn\n Resources::Models.add(m)\n end", "def add_bridge_model(body={}, headers=default_headers)\n @logger.info(\"Adding the \\\"#{body['name']}\\\" Bridge Model and Mappings.\")\n post(\"#{@api_url}/models\", body, headers)\n end", "def add_concrete_model(model)\n return if @concrete_models.include?(model)\n @concrete_models << model \n end", "def deredisize_model\n Redisable.enqueue(:deredisize_model_metas, self.model_name.name)\n end", "def add(model)\n self[model.primary_key] = model\n end", "def register_submodel(klass)\n if !klass.definition_location\n klass.definition_location = call_stack\n end\n\n if klass.name && !klass.permanent_model?\n begin\n if constant(\"::#{klass.name}\") == klass\n klass.permanent_model = true\n end\n rescue NameError\n end\n end\n\n submodels << klass\n if m = supermodel\n m.register_submodel(klass)\n end\n end", "def create_model(name, &block)\n name = name.to_s.tableize\n raise \"Model name '#{name}' is not unique\" if site.model_types.key?(name)\n \n # create a new instance of model\n child = self.class.new(site)\n child.name = name.camelcase.singularize\n child.parent = self\n \n # inherited fields\n fields.each do |name, field|\n child.set(name, get(name)) if field.inherited?\n end\n \n # insert the model in to the site models list\n class_name = name.classify\n site.model_types[name] = child.id\n site.model_plural_names[class_name] = name\n site.save\n \n # append the model to ancestor descendant lists (these are used in queries to\n # restrict the type of records returned, e.g pages.all => _model: ['Page', ...]\n child.tap do |child|\n child.add_descendant(child)\n child.instance_exec(child, &block) if block_given?\n child.save\n end\n end", "def register_submodel(klass)\n if !klass.definition_location\n klass.definition_location = call_stack\n end\n\n submodels << klass\n if m = supermodel\n m.register_submodel(klass)\n end\n end", "def model(klass)\n @eager_loaders.model = klass\n self\n end", "def get_loaded_model_by_path(model_path); end", "def store(model)\n model\n end", "def set_model\n @model = Model.find(params[:id])\n end", "def set_model\n @model = Model.find(params[:id])\n end", "def set_model\n @model = Model.find(params[:id])\n end", "def set_model\n @model = Model.find(params[:id])\n end", "def set_model\n @model = Model.find(params[:id])\n end", "def set_model\n @model = Model.find(params[:id])\n end", "def new_model\n unless @model\n @model = create_model\n attach_model\n end\n @model\n end", "def set_model\r\n @model = Model.find(params[:id])\r\n end", "def set_model\n @model = Model.find(params[:id])\n end", "def set_model\n @model = Model.find(params[:id])\n end", "def set_Model(value)\n set_input(\"Model\", value)\n end", "def set_Model(value)\n set_input(\"Model\", value)\n end", "def set_model\n @model = Request.find(params[:id])\n end", "def model(name, model_klass)\n @root = Elem.new(name, model_klass, nil)\n end", "def load(path)\n @model = self.class.superclass.load(path)\n end", "def relaxed_models=(value)\n @relaxed_models = value\n end", "def create_model\n template 'model.rb', \"app/models/#{model_path}.rb\" unless @skip_model\n end", "def <<(model)\n if model.cur.is_a?(Model)\n # Set the new path\n model.cur.options = @options.merge(path: @options[:path] + [:[]])\n else\n model = wrap_values([model]).first\n end\n\n super(model)\n\n @persistor.added(model, @array.size-1) if @persistor\n end", "def add_model_to_mongo(model, manufacture_id, manufacture_name, device_type, description, note)\n model = {\n model: model,\n ManufacturerID: manufacture_id,\n ManufacturerNAME: manufacture_name,\n device_type: device_type,\n description: description,\n note: note,\n created: DateTime.now\n }\n mongo_client.imei_insert_model(model)\n end", "def local_model(parent_model, name)\n Roby::Distributed::DRobyModel.anon_model_factory(parent_model, name)\n end", "def record_path(*args, **options)\n super args, options.merge(model: params[:model])\n end", "def register_submodel(klass)\n if klass.singleton_class?\n raise ArgumentError, \"cannot register a singleton class\"\n end\n\n if !klass.definition_location\n klass.definition_location = \n if MetaRuby.keep_definition_location?\n caller_locations\n else Array.new\n end\n end\n\n submodels << WeakRef.new(klass)\n if m = supermodel\n m.register_submodel(klass)\n end\n end", "def new_model(name, template = nil)\n template_ole = template ? template.ole_obj : app.ole_obj.ActiveDesignFile.DefaultModelReference\n el = app.ole_obj.ActiveDesignFile.Models.Add(template_ole, name, \"Added \")\n model_from_ole(el).activate\n end", "def register_model(klass)\n table_name = klass.table_name\n self.models[klass] = table_name\n self.object_map[table_name] = {}\n\n self.class_eval do\n # Define accessors for the fixtures for this new model.\n define_method(table_name) do |name|\n self.object_map[table_name][name.to_sym]\n end\n end\n end", "def init_with_adapter(model_path, adapter = nil, logger: Logger.new($stdout))\n m = new_model(model_path)\n init_with_model_and_adapter(m, adapter, logger: logger)\n\n self.model_path = model_path\n end", "def create_node!\n node.save\n end", "def enable_model(model_class)\n enabled_for_model(model_class, true)\n end", "def setup_model(opts, current_account:, **)\n opts['model'] = current_account\n end", "def register_relation(klass)\n boot.register_relation(klass) if boot\n end", "def set_model_type\n @model_type = ModelType.friendly.find(params[:id])\n end", "def set_linear_model\n @linear_model = LinearModel.find(params[:id])\n end", "def path_to_model(path)\n path_to_class(path, ActiveRecord::Base)\nend", "def configure_models(model)\n model_queue.each do |o|\n o.each do |k, v|\n model.add_model k, v\n end unless o.nil?\n end\n end", "def add_model_to_list\n Resources::Models.add self unless abstract_class || instance_methods.include?(:add_model_to_list)\n end", "def set_model_type\n @model_type = ModelType.find(params[:id])\n end", "def set_model(new_model)\n old_model = model\n\n @props[:model] = new_model\n\n on_model_changed(new_model: new_model, old_model: old_model)\n end", "def node_to_model(node)\n\t\tlog(\"node_to_model #{node.class}\")\n\t\tinstance = @factory.instantiate_transformed(node)\n\t\tmetaclass = instance.class\n\t\tmetaclass.ecore.eAllAttributes.each do |attr|\n\t\t\tpopulate_attr(node,attr,instance)\n\t\tend\n\t\tmetaclass.ecore.eAllReferences.each do |ref|\n\t\t\tpopulate_ref(node,ref,instance)\n\t\tend\n\t\tinstance\n\tend", "def create(parent, args)\n link_path = instance_path(parent.path, @true_class.ident(args))\n raise ProxyItemError.new(\"Invalid ProxyItem path: #{link_path}\") if \\\n (not link_path) || (link_path.empty?)\n\n path = args[:path]\n raise ProxyItemError.new('Invalid ModelItem path') if (not path) || \\\n (path.empty?)\n\n # write path to ModelItem into link file at 'instance path'\n args[:fs] ? parent.model.add_fs_item(link_path, path.to_s + \"\\n\") \\\n : parent.model.add_item(link_path, path.to_s + \"\\n\")\n end", "def set_node\n @node = Node.find(params[:id])\n end", "def set_node\r\n @node = Node.find(params[:id])\r\n end", "def set_device_model\n @device_model = DeviceModel.find(params[:id])\n end", "def model(model_type, name, attributes = {})\n if model_exists?(model_type, name)\n get_model(model_type, name)\n else\n put_model(model_type, name, attributes)\n end\n end", "def add_model(model_name)\n # look for a model with same same\n model = @models.find { |m| m.name == model_name }\n if model.nil?\n # not found, new model\n model = CameraModel.new(model_name)\n @models << model\n end\n # return model\n model\n end", "def add(klass)\n @models << klass\n end", "def push_node_by_path_to_frontend(path:)\n {\n method: \"DOM.pushNodeByPathToFrontend\",\n params: { path: path }.compact\n }\n end", "def load_model model_name=nil\n get_schema.load_model(self.get_instance, model_name)\n end", "def add_to_managed_engines_registry(params)\n tn = managed_engines_type_registry(params)\n tb = match_node_keys(tn, params, [:parent_engine])#, params[:parent_engine])\n unless tb.is_a?(Tree::TreeNode)\n tb = Tree::TreeNode.new(params[:parent_engine], params[:parent_engine])\n tn << tb\n end\n tn = tb\n add_to_tp_tree_path(tn, params, params[:type_path], params[:service_handle])\n end", "def new_model\n model_class.new(name: 'root',\n next: model_class.new(name: 'old-tail'))\n end", "def <<(model)\n if model.cur.is_a?(Model)\n # Set the new path\n model.cur.options = @options.merge(path: @options[:path] + [:[]])\n else\n model = wrap_values([model]).first\n end\n\n super(model)\n\n @persistor.added(model, @array.size-1) if @persistor\n\n return model\n end", "def set_node\n @node = Node.find(params[:id])\n end", "def set_node\n @node = Node.find(params[:id])\n end", "def set_node\n @node = Node.find(params[:id])\n end", "def set_newnode\n @newnode = Newnode.find(params[:id])\n end", "def setup(model_class); end", "def setup(model_class); end", "def create_model(*)\n create_magic_properties\n set_timestamps\n create_magic_properties\n properties = convert_properties_to :db, props\n node = _create_node(properties)\n init_on_load(node, node.props)\n send_props(@relationship_props) if @relationship_props\n @relationship_props = nil\n # Neo4j::IdentityMap.add(node, self)\n # write_changed_relationships\n true\n end", "def create_model(*)\n create_magic_properties\n set_timestamps\n create_magic_properties\n properties = convert_properties_to :db, props\n node = _create_node(properties)\n init_on_load(node, node.props)\n send_props(@relationship_props) if @relationship_props\n @relationship_props = nil\n # Neo4j::IdentityMap.add(node, self)\n # write_changed_relationships\n true\n end", "def model\n @model ||= if self.class.path_to_model\n m = eval(self.class.path_to_model)\n if m\n if m.respond_to?(:_controller=)\n m.send(:_controller=, self)\n end\n else\n fail \"No model object found at path: #{self.class.path_to_model}\"\n end\n m\n end\n end", "def set_node\n @node = ::Node::Node.find(params[:id])\n end", "def register\n ModelAdapter.adapters ||= []\n ModelAdapter.adapters << Kernel.const_get(self.to_s)\n end", "def set_object\n set_model_instance(MODEL_CLASS.find(params[:id]))\n end", "def set_system_model\n @system_model = SystemModel.find(params[:id])\n end", "def set_model_name\n @model_name = ModelName.find(params[:id])\n end", "def set_modeltype\n @modeltype = Modeltype.find(params[:id])\n end", "def register_node\n @registered = @registry.register_node(system)\n end", "def device_model=(value)\n @device_model = value\n end", "def device_model=(value)\n @device_model = value\n end", "def attach\n if @attach_as\n @__parent_struct, @__parent_name = @attach_as\n @attach_as = nil\n __parent_struct.attach_child(__parent_name, self)\n @model&.attach\n end\n end", "def added(model, index)\n root_model.persistor.save_all\n end" ]
[ "0.6628567", "0.6483159", "0.64712816", "0.61988133", "0.60350406", "0.5896773", "0.58530676", "0.5813492", "0.5723738", "0.5708985", "0.5706797", "0.57045555", "0.56941134", "0.5689497", "0.5678482", "0.5678482", "0.5606499", "0.55813754", "0.5565822", "0.5548728", "0.55302", "0.55269206", "0.55166566", "0.5489011", "0.5469251", "0.5465746", "0.54478186", "0.54280204", "0.5416532", "0.5407065", "0.539109", "0.53794056", "0.53794056", "0.53794056", "0.53794056", "0.53794056", "0.53794056", "0.5341198", "0.53377223", "0.53083473", "0.53083473", "0.53025734", "0.53025734", "0.5297741", "0.52749205", "0.52178967", "0.51774895", "0.5166692", "0.5144481", "0.51281935", "0.51237845", "0.51217186", "0.5112556", "0.51033133", "0.5099382", "0.5095419", "0.5090799", "0.5083669", "0.50737387", "0.50710976", "0.5062002", "0.50607735", "0.5046595", "0.50304246", "0.5026149", "0.50105864", "0.4990728", "0.49827668", "0.49743795", "0.49569505", "0.49564558", "0.49256122", "0.49150613", "0.49080527", "0.4903285", "0.4900828", "0.48992127", "0.489349", "0.48730505", "0.48711956", "0.48665547", "0.48665547", "0.48665547", "0.4859157", "0.485876", "0.485876", "0.4851867", "0.4851867", "0.48426887", "0.48396865", "0.48318502", "0.4831188", "0.48282087", "0.48192814", "0.4810765", "0.47967052", "0.47926688", "0.47926688", "0.47925797", "0.4790756" ]
0.5129606
49
Updates self.models and build a route for the model raise an error if the model is already known
def register_model(model) raise ArgumentError, "already know this model" if models.include?(model) models << model build_route_for_model(model) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build!\n models.each do |model|\n build_route_for_model(model)\n end\n end", "def setup_routes\n if prefix\n pre = prefix.to_s[1..-1] + '/'\n end\n model_regexp = Regexp.union(models.keys.map{|m| Regexp.escape(m)})\n controller = @controller.name.sub(/Controller\\z/, '').underscore\n ::Rails.application.routes.prepend do\n match \"#{pre}:autoforme_model/:autoforme_action(/:id)\" , :controller=>controller, :action=>'autoforme', :via=>[:get, :post],\n :constraints=>{:autoforme_model=>model_regexp, :autoforme_action=>ALL_SUPPORTED_ACTIONS_REGEXP}\n end\n ::Rails.application.reload_routes!\n end", "def refresh\n # re-download the model from the server\n set_model\n end", "def assign_route_to_train\n return assign_route_to_train_template('create_train') if @trains.empty?\n return assign_route_to_train_template('create_route') if @routes.empty?\n\n assign_route_to_train_core\n end", "def configure_model\n configure base_uri: base_uri\n Ladder::Config.register_model self unless Ladder::Config.models.include? self\n end", "def add_model_to_list\n Resources::Models.add self unless abstract_class || instance_methods.include?(:add_model_to_list)\n end", "def update\n if exists?\n if id\n if cache && !cache.includes?(self.class, id)\n msg = \"#{__FILE__}[#{__LINE__}] : #{model.class} : expected model with id #{id} to be in cache - cannot update\"\n Robe.logger.error(msg)\n raise DBError, msg\n end\n # TODO: unwind associations if update fails\n save_associations.to_promise_then do\n self.class.db.update_document_by_id(self.class.collection_name, to_db_hash)\n end.to_promise_then do\n cache.update(self) if cache\n self.to_promise\n end\n else\n msg = \"#{__FILE__}[#{__LINE__}] : #{model.class} : expected model from db to have id set - cannot update\"\n Robe.logger.error(msg)\n raise DBError, msg\n end\n else\n msg = \"#{__FILE__}[#{__LINE__}] : #{model.class} : cannot update model not loaded from db - it should be inserted\"\n Robe.logger.error(msg)\n raise DBError, msg\n end\n end", "def prepare_routes\n return if Rails.configuration.eager_load || Rails.env == \"test\" \n begin\n Rails.application.routes_reloader.reload! \n rescue SystemStackError\n # NOP -- Supressing Stack Level Too deep error\n # caused by models being loaded lazily during development mode.\n end\n end", "def refresh\n if new_model?\n return WscSdk::Errors.model_does_not_exist(self.endpoint)\n else\n return self.endpoint.refresh(self)\n end\n end", "def add_model_to_list(m)\n tn = implementation_model_name\n self.class.models[tn] = m\n logger.info \"Added new model #{tn}\"\n self.class.model_names << tn unless self.class.model_names.include? tn\n Resources::Models.add(m)\n end", "def build_route_for_model(model)\n path = File.join(model.path_model(identifying_sym), ':filename')\n node = build_route(path)\n node.content = model\n end", "def touch_place_route\n return if self.route_id.nil?\n route.save\n route.place.save unless route.place_id.nil?\n end", "def build_model\n self.model = nil # set up the model\n end", "def update\n Model.test_for_invalid_status(:update, @model_status)\n\n clear_alerts; run_validation(:update)\n interface.update(@model_id, map_to_interface) unless @model_status == :error\n\n unless interface.id_ai\n @model_id = instance_variable_get( \"@#{interface.id_fld}\".to_sym )\n end\n\n self\n rescue Pod4::WeakError\n add_alert(:error, $!)\n self\n end", "def save\n @model = register_model\n end", "def configure_models(model)\n model_queue.each do |o|\n o.each do |k, v|\n model.add_model k, v\n end unless o.nil?\n end\n end", "def update\n begin\n @check_route.update(check_route_params)\n #TODO dedup\n @check_route.assets<< Asset.find(params[:asset_id]) if (!params[:asset_id].nil?)\n render template: 'check_routes/show', status: :ok\n rescue Exception => e\n render json: {:message=> e.to_s}.to_json, status: :internal_server_error\n end\n end", "def model(model)\n if @resource_config[:model]\n raise DefinitionError, \"model already declared in #{self}\"\n end\n @resource_config[:model] = model\n end", "def update!(**args)\n @model = args[:model] if args.key?(:model)\n end", "def method_missing(method, *args, &block)\n if model.respond_to?(method)\n delegate_to_model(method, *args, &block)\n elsif relationship = relationships[method] || relationships[method.to_s.singular.to_sym]\n delegate_to_relationship(relationship, *args)\n else\n super\n end\n end", "def relation_user_route event\n return if event.nil? or event.route.nil?\n\n self.user.routes << event.route\n event.route.save\n end", "def update\n Rails.logger.info('👻 Disraptor: Updating route.')\n\n route_id = params.require(:route_id)\n payload = params.require('disraptor/route')\n source_path = normalize_path(payload['sourcePath'])\n target_url = normalize_uri(payload['targetUrl'])\n request_method = normalize_request_method(payload['requestMethod'])\n\n if !@@allowed_methods.include?(request_method)\n error_message = \"Route request method was #{request_method} but expected one of these: #{@@allowed_methods.join(', ')}.\"\n Rails.logger.error('❌ Disraptor: Error: ' + error_message)\n\n return render json: { error: error_message }, status: 400\n end\n\n if source_path != '/' and source_path.end_with?('/')\n error_message = \"Route source path was #{source_path} but it must not end in a slash.\"\n Rails.logger.error('❌ Disraptor: Error: ' + error_message)\n\n return render json: { error: error_message }, status: 400\n end\n\n route = Disraptor::Route.edit(route_id, source_path, target_url, request_method)\n\n Rails.application.reload_routes!\n\n render json: { 'disraptor/route': route }\n end", "def record_path(*args, **options)\n super args, options.merge(model: params[:model])\n end", "def manage_stations_in_route\n return manage_stations_in_route_core unless @routes.empty?\n\n show_info_for_action('managing Stations in Routes')\n\n create_route_advanced\n manage_stations_in_route\n end", "def post_route(route, message)\n raise TypeError unless route.is_a? Route\n @changeset = @api.create_changeset(message, tags={'created_by'=>'ITCR'})\n ways_list = []\n nodes_list = create_node_list(route.path)\n\n until nodes_list.empty? # For node's maximum limit of a way\n way_nodes = nodes_list.take(MAX_NODES)\n nodes_list = nodes_list.drop(MAX_NODES)\n way_id = create_way(way_nodes)\n ways_list << way_id\n end\n\n relation = create_relation(ways_list) # Link ways to relation\n relation = add_stops(relation, route.stops) # Add bus stops to relation\n\n @api.save(relation, @changeset) # Save relation using the API\n puts 'Relation created succesfuly.'\n @api.close_changeset(@changeset)\n @changeset.id\n end", "def manage_routes_add_route\n @ui.manage_routes_add_route_msg(routes, stations)\n station_one_name = gets.chomp\n station_two_name = gets.chomp\n manage_routes_add_route_adding(station_one_name, station_two_name)\n rescue RuntimeError => e\n puts e.inspect\n @attempt += 1\n if @attempt < 3\n puts @ui.wrong_input_msg\n retry\n end\n @attempt = 0\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def reload\n model = self.class.find(to_remote)\n\n if model.errors?\n add_errors(model.errors)\n else\n copy_from(model)\n persist!\n end\n\n self\n end", "def assign_route_to_train\n if @routes.empty? || @trains.empty?\n routes_or_trains_void\n else\n request = [\"Enter route name [#{@routes.keys.join(', ')}]: \"]\n route = getting(request, :approve_route_selection, :select_route)\n request = [\"Enter train number [#{@trains.keys.join(', ')}]: \"]\n train = getting(request, :approve_train_for_assign, :select_train)\n train.assign_route(route)\n end\n end", "def new_model\n unless @model\n @model = create_model\n attach_model\n end\n @model\n end", "def model_path=(path)\n @model_path = path\n end", "def set_model\n @model = Request.find(params[:id])\n end", "def register\n @index = Router.routes.size\n Router.routes << self\n self\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_model\n @model = Model.find(params[:id])\n end", "def set_model\n @model = Model.find(params[:id])\n end", "def set_model\n @model = Model.find(params[:id])\n end", "def set_model\n @model = Model.find(params[:id])\n end", "def set_model\n @model = Model.find(params[:id])\n end", "def set_model\n @model = Model.find(params[:id])\n end", "def update_bridge_model(name, body={}, headers=default_headers)\n @logger.info(\"Updating the \\\"#{name}\\\" Bridge Model.\")\n put(\"#{@api_url}/models/#{encode(name)}\", body, headers)\n end", "def relate\n model_to_relate = params[:related].singularize.camelize.constantize\n @model.find(params[:id]).send(params[:related]) << model_to_relate.find(params[:model_id_to_relate][:related_id])\n flash[:success] = \"#{model_to_relate.to_s.titleize} added to #{@model.to_s.titleize}.\"\n redirect_to :action => 'edit', :id => params[:id]\n end", "def model_path(options = current_instance, pluralize = false)\n method_name = \"#{pluralize ? model_name.pluralize : model_name}_path\"\n if options\n self.send(method_name, options) rescue nil\n else\n self.send(method_name) rescue nil\n end\n end", "def set_route_instance\n @route_instance = RouteInstance.find(params[:id])\n end", "def model_verbs_and_routes(model)\n routes = Daylight::Documentation.routes.routes.select {|route| route.path.spec.to_s.include? \"/#{model.name.underscore.pluralize}\" }\n\n routes.each do |route|\n yield route_verb(route), route.path.spec, route.defaults\n end\n end", "def add_model(model_name)\n # look for a model with same same\n model = @models.find { |m| m.name == model_name }\n if model.nil?\n # not found, new model\n model = CameraModel.new(model_name)\n @models << model\n end\n # return model\n model\n end", "def add_bridge_model(body={}, headers=default_headers)\n @logger.info(\"Adding the \\\"#{body['name']}\\\" Bridge Model and Mappings.\")\n post(\"#{@api_url}/models\", body, headers)\n end", "def change_model(name)\n model = find_model(name)\n\n return unless model\n\n model.activate\n end", "def route(t_obj, value)\n if self.class.common_route\n route_id = @routes.detect{|r| r.name == value}.try(:id)\n t_obj.pickup_route_id = route_id\n t_obj.drop_route_id = route_id\n end\n end", "def ensure_route(route)\n unless self.routes.member?(route) or route.blank?\n self.routes << route\n end\n end", "def manage_routes_add_station\n @ui.manage_routes_add_station_msg(routes, stations)\n route_name = gets.chomp\n station_name = gets.chomp\n validate_route_for_add_station!\n manage_routes_add_stations_adding(station_name, route_name)\n rescue RuntimeError => e\n puts e.inspect\n @attempt += 1\n if @attempt < 3\n puts @ui.wrong_input_msg\n retry\n end\n @attempt = 0\n end", "def set_model\n @model = Info\n end", "def set_model\r\n @model = Model.find(params[:id])\r\n end", "def generate_routes!\n Router.new(self).generate(@app)\n end", "def requested_model_to_model(requested_model)\n #move \"cases\" to mpr_model_steps.\n case requested_model\n when /^Site[s]?$/i, /^PhosphorylationSite[s]?$/i\n return StySiteAbstractGene\n when /^(.+)[(](.+)[)]$/ #handle model(with associations), model(for scene a)\n return requested_model_to_model($1)\n else\n possible_model_name = requested_model.singularize.underscore.classify\n #Note Ping class exists, so check for PingActivity first.\n return \"#{possible_model_name}Activity\".constantize rescue nil\n return possible_model_name.constantize rescue nil\n end\n\n raise \"Requested Model (#{requested_model}, as #{possible_model_name}) is not supported.\"\nend", "def model_path(model, options = {})\n if model.is_a? Link\n dynamic_link_path(model, options)\n else\n eval \"#{model_name(model)}_path(model, options)\"\n end\n end", "def reload!\n ensure_service!\n @gapi_json = service.get_model dataset_id, model_id\n @reference = nil\n @exists = nil\n self\n end", "def method_missing(symbol, *args, &block)\n safe_symbol = \"safer_#{symbol}\"\n if respond_to?(safe_symbol)\n model = find_model_argument(*args)\n defer_model_change(model) {\n send(safe_symbol, *args, &block)\n }\n else\n super\n end\n end", "def reload_routes!; end", "def reload_routes!; end", "def set_model\n @model = Model.find(params[:id])\n end", "def set_model\n @model = Model.find(params[:id])\n end", "def model(model_type, name, attributes = {})\n if model_exists?(model_type, name)\n get_model(model_type, name)\n else\n put_model(model_type, name, attributes)\n end\n end", "def set_model\n @model=Info\n end", "def update!(**args)\n @endpoint = args[:endpoint] if args.key?(:endpoint)\n @model_display_name = args[:model_display_name] if args.key?(:model_display_name)\n @model_version = args[:model_version] if args.key?(:model_version)\n end", "def model_route\n @model_name.to_s\n end", "def restful(model: nil, route_prefix: nil, actions: :all)\n class_attribute :model_name, :class_name, :route_prefix,\n instance_writer: false\n\n self.model_name = model\n self.class_name = class_from_name\n self.route_prefix = route_prefix\n\n include InstanceMethods\n include Restful::Actions\n\n setup_actions actions unless actions == :all\n\n if respond_to?(:helper_method)\n helper_method :collection, :resource, :resource_class,\n :edit_resource_path, :edit_resource_url, :new_resource_path,\n :new_resource_url, :collection_path, :collection_url\n\n end\n end", "def set_linear_model\n @linear_model = LinearModel.find(params[:id])\n end", "def relate\n resource_class = params[:related][:model].typus_constantize\n association_name = params[:related][:association_name].tableize\n\n if @item.send(association_name) << resource_class.find(params[:related][:id])\n notice = Typus::I18n.t(\"%{model} successfully updated.\", :model => @resource.model_name.human)\n end\n\n redirect_to :back, :notice => notice\n end", "def update!(**args)\n @supported_routes = args[:supported_routes] if args.key?(:supported_routes)\n end", "def update_bridge_model_mapping(model_name, mapping_name, body={}, headers=default_headers)\n @logger.info(\"Updating the \\\"#{model_name} - #{mapping_name}\\\" Bridge Model Mapping.\")\n put(\"#{@api_url}/models/#{encode(model_name)}/mappings/#{encode(mapping_name)}\", body, headers)\n end", "def _routes; end", "def resolve_model(a_name)\n name = a_name.to_s.singularize.to_sym\n if m = find_model(name)\n return m\n end\n model(name) { no_controller }\n end", "def run\n\t\tsuper\n\n\t begin\n\t\t\tif @object.kind_of?(Device)\n\t\t\t\tif @object.name\n\t\t\t\t\tbegin\n\t\t\t\t\t\tresolved_address = Resolv.new.getaddress(@object.name)\n\t\t\t\t\t\t@object.name = resolved_address\n\t\t\t\t\trescue Exception => e\n\t\t\t\t\t puts e\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\traise \"Error, object has no name to look up! Try a reverse lookup!\"\n\t\t\t\tend\n\n\t\t\t\t## Attach Mail Servers?\n\n\t\t\t\t## Other Records?\n\t\t\t\t\n\t\t\telsif @object.kind_of?(Domain)\n\t\t\t\tbegin\n\t\t\t\t\tif @object.name\n\t\t\t\t\t\tbegin\n\t\t\t\t\t\t\tresolved_address = Resolv.getaddress(@object.name)\n\t\t\t\t\t\t\th = create_object Device, { :ip_address => resolved_address }\n\t\t\t\t\t\t\th.domains << @object\n\t\t\t\t\t\trescue Exception => e\n\t\t\t\t\t\t puts e\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\traise \"Error, object has no name to look up! Try a reverse lookup!\"\n\t\t\t\t\tend\n\t\t\t\trescue \n\t\t\t\t\treturn\n\t\t\t\tend\n\t\t\t\t\n\t\t\tend\n\t\t\t\n\t\trescue Exception => e\n\t\t\tputs e.to_s\n\t\tend\n\t\t\n\t\n\t\t\n\t\t@object.save!\n nil\n\tend", "def add_routes(&block)\n @router ||= Routes.new\n @router.define(&block)\n url.router = @router\n end", "def link!\n # add to cache with pluralized key\n (row.cache[model.cache_key(pluralize: true)] ||= []) << self\n\n # add to cache with singular key (for convenience)\n row.cache[model.cache_key(pluralize: false)] = self\n end", "def wrap(modelJson)\n return unless self.class.respond_to?(:wrapper)\n\n self.class.wrapper[:fields].each do |online, local|\n if modelJson.respond_to?(\"key?\") && modelJson.key?(\"#{online}\")\n self.send(\"#{local}=\", modelJson[online])\n end\n end\n\n if self.class.wrapper[:relations].present?\n self.class.wrapper[:relations].each do |relation|\n if modelJson.respond_to?(\"key?\") && modelJson.key?(\"#{relation}\") && modelJson[\"#{relation}\"].present?\n relationJson = modelJson[relation]\n if relationJson.is_a?(Hash) && relationJson.has_key?(\"type\") && relationJson.has_key?(relationJson['type']) && relationJson[relationJson['type']].present?\n klass = Object.const_get(relationJson['type'].to_s.singularize.camelize)\n newRelation = klass.updateModels(relationJson[relationJson['type']])\n if newRelation.is_a?(Array)\n newRelation.each do |newRel|\n self.send(\"#{relationJson['type']}\").send(\"<<\", newRel) rescue NoMethodError # not correct implemented in MotionModel\n end\n else\n self.send(\"#{relationJson['type']}=\", newRelation) rescue NoMethodError # not correct implemented in MotionModel\n end\n else\n klass = Object.const_get(relation.to_s.singularize.camelize)\n newRelation = klass.updateModels(modelJson[\"#{relation}\"])\n if newRelation.is_a?(Array)\n newRelation.each do |newRel|\n self.send(\"#{relation}\").send(\"<<\", newRel) rescue NoMethodError # not correct implemented in MotionModel\n end\n else\n self.send(\"#{relation}\", newRelation) rescue NoMethodError # not correct implemented in MotionModel\n end\n end\n end\n end\n end\n\n true\n end", "def update_path!\n update_path(:force => true)\n end", "def initialize\n super\n\n # if not set, use controller classname\n qualified_controller_name = self.class.name.chomp('Controller')\n @model_class = self.model_class || qualified_controller_name.split('::').last.singularize.constantize\n\n raise \"#{self.class.name} failed to initialize. self.model_class was nil in #{self} which shouldn't happen!\" if @model_class.nil?\n raise \"#{self.class.name} assumes that #{self.model_class} extends ActiveRecord::Base, but it didn't. Please fix, or remove this constraint.\" unless @model_class.ancestors.include?(ActiveRecord::Base)\n\n @model_singular_name = self.model_singular_name || self.model_class.name.underscore\n @model_plural_name = self.model_plural_name || @model_singular_name.pluralize\n @model_at_plural_name_sym = \"@#{@model_plural_name}\".to_sym\n @model_at_singular_name_sym = \"@#{@model_singular_name}\".to_sym\n \n # next 3 are for vanilla strong_parameters\n @model_singular_name_params_sym = \"#{@model_singular_name}_params\".to_sym\n @create_model_singular_name_params_sym = \"create_#{@model_singular_name}_params\".to_sym\n @update_model_singular_name_params_sym = \"update_#{@model_singular_name}_params\".to_sym\n\n underscored_modules_and_underscored_plural_model_name = qualified_controller_name.gsub('::','_').underscore\n\n # This is a workaround for controllers that are in a different module than the model only works if the controller's base part of the unqualified name in the plural model name.\n # If the model name is different than the controller name, you will need to define methods to return the right urls.\n class_eval \"def #{@model_plural_name}_url;#{underscored_modules_and_underscored_plural_model_name}_url;end\" unless @model_plural_name == underscored_modules_and_underscored_plural_model_name\n singularized_underscored_modules_and_underscored_plural_model_name = underscored_modules_and_underscored_plural_model_name\n class_eval \"def #{@model_singular_name}_url(record);#{singularized_underscored_modules_and_underscored_plural_model_name}_url(record);end\" unless @model_singular_name == singularized_underscored_modules_and_underscored_plural_model_name\n end", "def model_path(model, options = {})\n if model.is_a? Link\n dynamic_link_path(model, options)\n elsif model.is_a?(String) && is_admin?\n \"/admin/#{@model}\"\n else\n eval \"#{model_name(model)}_path(model, options)\"\n end\n end", "def update\n logger.debug \"#{params[:action].to_s} called in #{self.class}: model=#{@model_class}, request.format=#{request.format}, request.content_type=#{request.content_type}, params=#{params.inspect}\" if self.debug\n if self.use_permitters\n# authorize! :update, @model_class\n allowed_params = permitted_params\n elsif respond_to? @create_model_singular_name_params_sym\n allowed_params = send(@update_model_singular_name_params_sym)\n elsif respond_to? @model_singular_name_params_sym\n allowed_params = send(@model_singular_name_params_sym)\n else\n allowed_params = params\n\n end\n # to_s as safety measure for vulnerabilities similar to CVE-2013-1854\n @value = @model_class.where(id: params[:id].to_s).first # don't raise exception\n authorize! :update, @value\n @value.update_attributes(allowed_params) unless @value.nil?\n instance_variable_set(@model_at_singular_name_sym, @value)\n render_or_respond(true, @value.nil? ? :not_found : :ok)\n rescue self.rescue_class => e\n handle_or_raise(e)\n end", "def assign_route\n if link_type == 1\n #need to sanitise url if it contains an anchor (as is the case with the home page links)\n url = link_url.dup\n url[/#\\w+/] = '' unless link_url.blank? || link_url[/#\\w+/].nil?\n #\n r = ActionController::Routing::Routes\n r = r.recognize_path(url)\n #\n self.controller = r[:controller]\n self.action = r[:action]\n elsif link_type == 2\n self.controller = 'pages'\n self.action = 'view'\n else\n self.controller = ''\n self.action = ''\n end\n end", "def update_model(params)\n return false if @errors.any?\n if @model.present?\n if @model.update(params)\n return true\n else\n @errors += @model.errors.full_messages\n return false\n end\n else\n @errors << self.class.model_not_found\n return false\n end\n end", "def update_model(wbs)\n f = File.new(\"#{wbs.railsbase}/app/models/#{singular_name}.rb\",'r+')\n fa = f.readlines\n new_array = prepare_model_changes(fa, wbs)\n f.rewind\n new_array.each {|line| f.puts(line)}\n end", "def refresh_route_tables!\n @route_tables = init_route_tables\n end" ]
[ "0.66855085", "0.58033574", "0.553516", "0.548542", "0.5375248", "0.5286758", "0.5268972", "0.51702493", "0.515043", "0.5144157", "0.5143855", "0.50868946", "0.50835633", "0.5081802", "0.5057851", "0.504427", "0.49987757", "0.4946716", "0.49271715", "0.49091372", "0.48773256", "0.4854089", "0.48518443", "0.48361695", "0.4826224", "0.48242208", "0.4790631", "0.4790631", "0.4790631", "0.4784901", "0.47821975", "0.47813994", "0.4780205", "0.47381857", "0.47314584", "0.47270378", "0.47229698", "0.47229698", "0.47229698", "0.47229698", "0.47229698", "0.47229698", "0.47229698", "0.47229698", "0.47229698", "0.47229698", "0.47229698", "0.47229698", "0.47229698", "0.47175205", "0.47175205", "0.47175205", "0.47175205", "0.47175205", "0.47175205", "0.47128174", "0.47097015", "0.4702718", "0.46943712", "0.46921173", "0.46908915", "0.46878076", "0.4681635", "0.46796605", "0.4676586", "0.46638227", "0.46592522", "0.4658174", "0.4656505", "0.46517718", "0.4643341", "0.46359745", "0.46338743", "0.46321562", "0.46321562", "0.46168292", "0.46168292", "0.46138224", "0.46059185", "0.4601049", "0.4600057", "0.45931762", "0.45854053", "0.4584748", "0.4583887", "0.45802385", "0.4577551", "0.45747048", "0.4571364", "0.45656174", "0.45651096", "0.4560312", "0.45597905", "0.45580697", "0.4545298", "0.45416334", "0.45414504", "0.45294312", "0.4527573", "0.45245326" ]
0.6183743
1
Loads the file at path and turn it to a ruby object based on the file extension. If the file extension is not supported, will raise an error. uses JSON.parse(File.read(path)) and YAML.load_file(path) for '.json' and '.yaml' otherwise, will forward the handling such that '.foobaar' maps to :read_foobar(path)
def read_file(path) raise ArgumentError, "don't know extension #{ext}, use from [#{extensions.join(', ')}]" unless understands_ext?(path) ext = File.extname(path) case ext when '.json' JSON.parse(File.read(path)) when '.yaml' YAML.load_file(path) else self.send "read_#{ext.tr('.','')}", path end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_config_file config_path\n File.open(config_path, \"r\") do |file|\n case File.extname(file).delete(\".\")\n when \"json\" then JSON.parse(file.read)\n when \"yml\" then YAML.load_file(file)\n else\n file.close\n raise LoadError, \"Type of file is not supported.\"\n end\n end\n end", "def load_from_file(path)\n return unless File.exist?(path)\n json_data = File.read(path)\n load_raw_json(json_data)\n end", "def load(file_path); end", "def load(file_path); end", "def load(path); end", "def load_from_file!(file_path)\n raise IOError, \"File #{file_path} not exist\" unless File.exist?(file_path)\n raw_data = IO.read(file_path)\n load_from_json!(raw_data)\n end", "def load!(path)\n settings = YAML.safe_load(ERB.new(File.new(path).read).result)['api']\n from_hash(settings) if settings.is_a? Hash\n end", "def load_file(path)\n load(path)\n end", "def read_and_parse_file(path)\n json = JSON.parse(File.read(path))\n recursive_symbolize_keys!(json)\n end", "def load(file); end", "def load_extension path\n instance_eval(File.read(File.join(File.dirname(__FILE__), path)))\n end", "def from_file path\n run File.read(path) if File.exists? path\n end", "def read(path)\n m = mime(path)\n return read_json(path) if m.content_type == 'application/json'\n return read_binary(path) if m.binary?\n read_text(path)\n end", "def load(path_or_io)\n case path_or_io\n when String, Pathname\n path = Pathname.new(path_or_io)\n path = path.join('*.{yaml,yml}') if path.directory?\n\n Dir.glob(path).each { |f| load(File.new(f)) }\n else\n update(YAML.load(path_or_io))\n end\n end", "def parse(file_path)\n format = File.extname(file_path)\n parsed_config = case format\n when '.json'\n JSON.parse(File.read(file_path))\n when '.yml'\n YAML.load_file(file_path)\n else\n raise UnsupportedFileFormatError, \"format #{format} is unsupported\"\n end\n\n DDSL::SchemaParser.new.parse!(parsed_config)\n end", "def load_file(file); end", "def load_data(filename=nil)\n filename=data_file(filename)\n return unless File.exist?(filename)\n case File.extname(filename).downcase\n when \".yaml\",\".yml\"\n YAML.load(File.open(filename))\n when \".json\"\n JSON.parse(File.read(filename))\n else\n File.read(filename)\n end\n end", "def load_source\n case File.extname(config[:source])\n when '.json'\n Yajl.load(File.open(config[:source]))\n when '.yml'\n YAML.load(File.open(config[:source]))\n else\n raise 'unknown source file extension'\n end\n end", "def read\n return nil unless File.file?(\"./#{filename}\")\n JSON.parse(IO.read(filename))\n end", "def reader(filepath, *args)\n if filepath.respond_to? :to_str or filepath.respond_to? :to_path\n ext = File.extname(filepath)\n if registered = readers.find{|r| r[1].include?(ext)}\n registered[2].new(filepath.to_s, *args)\n else\n raise \"No registered reader for #{ext} (#{filepath})\"\n end\n elsif args.empty? \n coerce(filepath)\n else\n raise ArgumentError, \"Unable to return a reader for #{filepath} and #{args}\" \n end\n end", "def load_file!(file)\n if File.file?(file)\n yaml = %w{.yaml .yml}.include?(File.extname(file))\n text = File.read(file)\n if yaml or /\\A---/ =~ text\n #text = ERB.new(text).result(Object.new.instance_eval{binding})\n data = YAML.load(text)\n data.each do |k,v|\n __send__(\"#{k}=\", v)\n end\n else\n # TODO: Should we really do this here?\n instance_eval(text, file, 0)\n end\n end\n end", "def parse_file(path, **options)\n parse(::File.read(path), **options)\n end", "def read\n raise Errors::FileMissing, @pathname unless @pathname.exist?\n\n JSON.parse(\n @pathname.read,\n symbolize_names: true\n )\n rescue JSON::ParserError => e\n raise Errors::ParserError, e\n end", "def load\n return unless @file_path && File.exist?(@file_path)\n File.open(@file_path, 'rb') do |file|\n return Marshal.load(file)\n end\n end", "def load_file(definition)\n paths = definition.file\n\n paths.each do |path|\n ext = file_module.extname(path).strip.downcase[1..-1]\n parse_method = \"parse_#{ext}\"\n unless respond_to?(parse_method)\n fail \"extension (#{ext}), for (#{definition.key}: #{path}) \" +\n \"is not valid, only yaml and json are supported\"\n end\n\n if file_module.exists?(path)\n config = public_send(parse_method, path)\n unless config.is_a?(Hash)\n fail \"[config #{parse_method}] config must be a hash\"\n end\n config.deep_symbolize_keys!\n return config[definition.key]\n end\n end\n\n list = paths.join(',')\n fail \"none of :#{definition.key} config files exist at (#{list})\"\n end", "def loadRepositoryObject(path)\n #puts \"loadRepositoryObject :: #{path}\"\n if File.exist?(\"#{path}.obj\")\n loadeOb = File.open(\"#{path}.obj\").read\n repObj = YAML::load(loadeOb)\n return repObj\n else\n return nil\n end\n end", "def parse(path)\n YAML.load(File.read(path))\n end", "def new_from_json_file(path)\n json = ::File.read(path)\n new_from_json_string(json)\n end", "def load_file(filename); end", "def load_file(filename); end", "def load filepath\n require 'zip'\n\n ::Zip::File.open filepath do |zip|\n entry = zip.entries.first\n entry_path = path entry.name\n entry.extract entry_path\n\n serializer = serializers.resolve entry.name\n serializer.load entry_path\n end\n end", "def read_file(file)\n extension = file.split('.').last\n\n raise \"Models file should be of the format yml or xmi. The given file '#{file}' has an '#{extension}' extension.\" unless extension =~ /yml|xmi/\n\n begin\n @original_hash = extension == \"xmi\" ? XmiReader.new(file).to_h : YAML::load_file(file) \n HashWithIndifferentAccess.new(original_hash).symbolize_keys!\n\n rescue StandardError => e\n raise \"Models file '#{file}' could not be loaded: #{e}\"\n end\n end", "def load_file(path, recurse=false, &block)\n return load_file(path, recurse, &DEFAULT_LOAD) if recurse && !block_given?\n base = File.directory?(path) ? {} : (YAML.load_file(path) || {})\n \n if recurse\n # determine the files/dirs to load recursively\n # and add them to paths by key (ie the base\n # name of the path, minus any extname)\n paths = {}\n files, dirs = Dir.glob(\"#{path.chomp(File.extname(path))}/*\").partition do |sub_path|\n File.file?(sub_path)\n end\n\n # directories are added to paths first so they can be\n # overridden by the files (appropriate since the file\n # will recursively load the directory if it exists)\n dirs.each do |dir|\n paths[File.basename(dir)] = dir\n end\n\n # when adding files, check that no two files map to\n # the same key (ex a.yml, a.yaml).\n files.each do |filepath|\n key = File.basename(filepath).chomp(File.extname(filepath))\n if existing = paths[key]\n if File.file?(existing)\n confict = [File.basename(paths[key]), File.basename(filepath)].sort\n raise \"multiple files load the same key: #{confict.inspect}\"\n end\n end\n\n paths[key] = filepath\n end\n\n # recursively load each file and reverse merge\n # the result into the base\n paths.each_pair do |key, recursive_path|\n value = load_file(recursive_path, true, &block)\n yield(base, key, value)\n end\n end\n\n base\n end", "def read_file(path)\r\n YAML::load( File.open(path) )\r\n end", "def load\n if File.file?(@file_name)\n File.open(@file_name, 'r') do |file|\n YAML::load(file)\n end\n else\n default\n end\n end", "def load_json(filename); end", "def load!\n JSON.load(File.read(@name))\n rescue JSON::ParserError => e\n raise LogFile::LoadError, e.message\n end", "def load(path)\n if File.file? path\n load_file path\n elsif File.directory? path\n Dir.foreach(path) do |file|\n file = \"#{path}/#{file}\"\n next unless File.stat(file).file?\n load_file file\n end\n else\n $stderr.puts \"#{path} not a file or directory.\"\n exit 1\n end\n self\n end", "def load_file(path)\n load_string(File.binread(path))\n end", "def load_from_file(dir, file=\"/specs.def\")\n JSON.parse(IO.read(File.join(dir, file))) rescue raise ArgumentError\n end", "def parse(path, opts = {})\n opts = default_opts(opts)\n\n # Read JSON\n cont = path\n 12.times do\n cont = File.read(path)\n break unless cont.empty?\n sleep 1 # Wait up to 12 seconds for racing processes (iff empty file)\n end unless opts[:contents]\n raise \"Empty descriptor: #{opts[:contents] ? \"''\" : path}\" if cont.empty?\n\n # Parse JSON\n params = {\n symbolize_names: opts[:symbolize],\n create_additions: opts[:additions]\n }\n y = JSON.parse(cont, params)\n\n # Add defaults\n unless opts[:default].nil?\n opts[:default] = parse(opts[:default]) if opts[:default].is_a? String\n y.each { |k, v| opts[:default][k] = v }\n y = opts[:default]\n end\n\n # Return\n y\n end", "def load(filename, force = false)\n if data_types[filename] || (!force and data_types[class_name(filename)])\n class_name(filename)\n elsif filename =~ /#./ and self.current_schema\n inline_schema(filename)\n elsif files[filename]\n files[filename]\n else\n files[filename] = class_name(filename)\n parse_file(filename)\n end\n rescue Errno::ENOENT => error\n if force and data_types[class_name(filename)]\n logger.error error.message\n class_name(filename)\n else\n raise error\n end\n end", "def load(file)\n data = File.read(file)\n JSONL.parse(data)\n end", "def load_options(path)\n path = File.expand_path path\n if File.exists? path\n JSON.parse(File.read path)\n else\n {}\n end\nend", "def read_from_json\n JSON.parse File.new(@filepath).read\n end", "def read_json_file(path)\n JSON.parse(File.open(path){ |f| f.read })\nend", "def readfile filename\n if filename.index(\".json\")\n require 'json'\n str = File.read(filename)\n hash = JSON.parse(str)\n elsif filename.index \".yml\"\n require 'yaml'\n hash = YAML::load( File.open( filename ) )\n else\n $stderr.puts color(\"#{$0}: Don't know how to handle #{filename}, pass either .json or .yml\", \"red\")\n exit 1\n end\n puts \"==> readfile: imdbid=\" + hash[\"imdbID\"] if $opt_verbose\n return hash\nend", "def read ( file, trace_dir )\n extension = File.extname(file)\n case extension\n when '.csv' then read_csv(file)\n when '.bag' then read_bag(file,trace_dir)\n else abort(\"file extension #{extension} not supported\")\n end\nend", "def load_from_file(file_path)\n require \"erb\"\n opts = YAML.load(ERB.new(File.read(file_path)).result) || {}\n symbolize_keys(opts)\n end", "def read_file(path)\n eval(File.read(path), binding, path)\n end", "def parse_file(filename)\n klass = class_name(filename)\n read_file(filename) do |data|\n data = JSON.parse(data, :object_class => Types::Base, :max_nesting => 100)\n store_schema(data) do\n if data.resources # discovery format\n parse_resource(data)\n else\n data_types[klass] = {}\n data_types[klass] = parse_object(data)\n end\n end\n end\n klass\n end", "def load(filename)\n end", "def load_json(filename)\n begin\n File.open(filename, \"r\" ) do |f|\n JSON.load(f)\n end\n rescue Errno::ENOENT, TypeError => e\n puts \"You must supply a valid filename: #{e.message}\"\n exit\n end\nend", "def load_rb(filename); end", "def parse_file(path, options={})\n path = Pathname.new(path.to_str) unless Pathname === path\n parse(path, options)\n end", "def parse_config_file(file)\n return {} unless File.exist?(file)\n\n case File.extname(file)\n when /\\.conf$/i\n parse_conf_file(file)\n when /\\.json$/i\n Oj.load_file(file, mode: :strict, symbol_keys: true)\n when /\\.ya?ml$/i\n begin\n require 'safe_yaml/load'\n SafeYAML.load_file(file) || {}\n rescue LoadError\n # Re-raise with a more descriptive message. This should generally\n # abort the configuration loading.\n raise LoadError.new(%{Could not load the requested resource. Please install the 'safe_yaml' gem via\nBundler or directly, and try loading again.\n})\n end\n end\n end", "def read\n file = File.read(@filename)\n JSON.parse(file)\n end", "def parse(file)\n erb = ERB.new(File.read(file)).result\n if File.extname(file) == '.json'\n @parse = JSON.parse(erb, :symbolize_names => true) || {}\n else\n @parse = YAML.load(erb) || {}\n end\n end", "def load_one(path)\n if path.directory?\n load_directory(path)\n else\n load_file(path)\n end\n end", "def import!(file)\n if File.directory?(file)\n # ...\n else\n case File.extname(file)\n when '.yaml', '.yml'\n merge!(YAML.load(File.new(file)))\n else\n text = File.read(file)\n if /\\A---/ =~ text\n name = File.basename(file)\n self[name] = YAML.load(text)\n else\n name = File.basename(file)\n self[name] = text.strip\n end\n end\n end\n end", "def yml_file_to_object(options={})\n content = read_file_content(options)\n YAML.load(content)\nend", "def load_object (path)\n\n o = YAML.load_file(path)\n File.delete(path)\n o\n end", "def read(path)\n @file_data = ::JSON.parse(open(path).read)\n @json = @file_data\n self\n end", "def _load(path)\n path = Pathname.new(path)\n @loader.load(path)\n end", "def parse_file path\n self.filename = path\n open path do |f|\n parse f.read\n end\n end", "def parse_file path\n self.filename = path\n open path do |f|\n parse f.read\n end\n end", "def parse_file path\n self.filename = path\n open path do |f|\n parse f.read\n end\n end", "def parse_file path\n self.filename = path\n open path do |f|\n parse f.read\n end\n end", "def parse_file path\n self.filename = path\n open path do |f|\n parse f.read\n end\n end", "def parse_file path\n self.filename = path\n open path do |f|\n parse f.read\n end\n end", "def from_file(path)\n\t\t\t\told_eval_path,@current_eval_path = @current_eval_path,path\n\t\t\t\tinstance_eval path.read, path.to_s\n\t\t\tensure\n\t\t\t\t@current_eval_path = old_eval_path\n\t\t\tend", "def instance\n @instance ||= if File.exists?(path) && File.readable?(path)\n new(JSON.parse(File.read(path)))\n else\n new\n end\n end", "def load(file)\n File.open(path(file)).read\n end", "def json(file_path)\n raise(format(ERROR_EXT_NOT_JSON, file_path)) unless json?(file_path)\n\n content = read_file(file_path)\n JSON.parse(content)\n end", "def load( filepath )\n unserialize( IO.read( filepath ) )\n end", "def read_file(path, key)\n file = IO.read(path)\n JSON.parse(file)[key]\n end", "def read\n @metadata = {}\n @content = File.read(path)\n\n if @content =~ /^(---\\s*\\n.*?\\n?)^(---\\s*$\\n?)/m\n @content = $POSTMATCH\n\n begin\n @metadata = YAML.load($1)\n raise unless @metadata.is_a? Hash\n rescue => ex\n $stderr.puts \"#{File.basename($PROGRAM_NAME)}: #{ex.to_s}\"\n $stderr.puts \"WARNING: Couldn't load metadata.\"\n @metadata = {}\n end\n\n @metadata.symbolize_keys!\n import_metadata\n end\n end", "def load(filename)\n Format.load(filename)\n end", "def ensure_load_json(file_path, def_val, json_params = {})\n if File.exists?(file_path)\n file_data = File.read(file_path).force_encoding('utf-8')\n if file_data.size >= 2 # '[]'\n JSON.parse(file_data, json_params)\n else\n def_val\n end\n else\n def_val\n end\n end", "def load_json(filename)\n File.open(File.expand_path(\"../support/#{filename}\", __FILE__), \"r\") do |json_file|\n JSON.load(json_file)\n end\nend", "def load\n @cache = JSON.parse(File.read(file))\n rescue\n @cache = {}\n end", "def load!\n if(path)\n if(File.directory?(path))\n conf = Dir.glob(File.join(path, '*')).sort.inject(Smash.new) do |memo, file_path|\n memo.deep_merge(load_file(file_path))\n end\n elsif(File.file?(path))\n conf = load_file(path)\n else\n raise Errno::ENOENT.new path\n end\n conf\n end\n end", "def load_file( filename )\n begin\n read_in = File.new( filename, 'r' )\n rescue\n abort \"\\\"#{ filename }\\\" not found\"\n end\nend", "def load\n @models = []\n\n # \n files = \n if File.directory?(config_path) \n files_in_dir = []\n Dir[config_path + \"/*.yml\"].each do |file|\n files_in_dir << file\n end\n files_in_dir\n elsif File.file?(config_path)\n [config_path]\n else\n nil\n end\n\n return nil if files.nil?\n\n # \n @models = files.inject(@models) do |models, file|\n begin\n yaml = YAML.load_file(file)\n rescue => ex\n logger.debug \"failed in reading yaml (#{file})\"\n next\n end\n if yaml.nil?\n logger.debug \"failed in reading yaml (#{file})\"\n next\n end\n models + yaml2models(yaml)\n end.extend(ArrayMethods)\n end", "def get_loaded_model(model_path, file); end", "def load_factories_if_file(path)\n Kernel.load(\"#{path}.rb\") if File.exists?(\"#{path}.rb\")\n end", "def load_from_file(file, options = T.unsafe(nil)); end", "def from_file(filename, &block)\n deserialize(open(filename))\n end", "def parse_file(path)\n if (!File.exists?(path))\n LOGGER.e {\"Unable to open specified file to parse: '#{path}'\"}\n return nil\n end\n \n File.open(path, 'r') do |f|\n parse_stream(f)\n end\n end", "def load_json(dir_path, filename)\n file_path = File.join(dir_path, filename)\n JSON.parse(File.read(file_path))\n end", "def load( path )\n @content = File.read( path )\n load_listener.on_load( self, path ) if load_listener\n end", "def load_hash(file_path) \n file=File.read(file_path)\n JSON.parse(file)\n end", "def load_hash(file_path) \n file=File.read(file_path)\n JSON.parse(file)\n end", "def load_data_from_file(default=json_default)\n KiJSONFile.load_json(path, default)\n end", "def l(filename)\n load \"#{filename}.rb\"\nend", "def read\n if File.exist? path\n File.open(path) do |file|\n Marshal.load(file)\n end\n else\n self.write({})\n self.read\n end\n end", "def read_json(path)\n return JSON.parse(File.read(path).rstrip)\nend", "def read_json(path)\n return JSON.parse(File.read(path).rstrip)\nend", "def load(name); end", "def json_file_fixture(path)\n return JSON.parse(File.read(file_fixture(path)), symbolize_names: true)\n end" ]
[ "0.67945975", "0.6717681", "0.6596083", "0.6596083", "0.65618277", "0.65604895", "0.6492246", "0.63893735", "0.63614494", "0.6229783", "0.6198518", "0.61499316", "0.6127462", "0.61159956", "0.6115513", "0.6110049", "0.60965884", "0.6092773", "0.6075345", "0.6067231", "0.6063299", "0.6063174", "0.6059553", "0.6058718", "0.60199475", "0.60147536", "0.60074115", "0.6003386", "0.5986775", "0.5986775", "0.598425", "0.5980132", "0.59602565", "0.59564316", "0.59556913", "0.5951361", "0.594783", "0.5940903", "0.593479", "0.59233814", "0.5898943", "0.5890595", "0.5884213", "0.588386", "0.5882207", "0.5881722", "0.5880265", "0.58730483", "0.5866639", "0.58530754", "0.5830983", "0.58290935", "0.58274084", "0.5814564", "0.58139855", "0.58096915", "0.5807388", "0.5805693", "0.5804877", "0.5792973", "0.57848483", "0.57696897", "0.57231206", "0.5711246", "0.5709178", "0.5709178", "0.5709178", "0.5709178", "0.5709178", "0.5709178", "0.5695743", "0.5687619", "0.56867266", "0.5686086", "0.56607515", "0.56055725", "0.5605238", "0.5594445", "0.5582373", "0.5582023", "0.5579394", "0.55764824", "0.5568336", "0.5566422", "0.5566206", "0.55309933", "0.5530352", "0.552674", "0.55218464", "0.55204743", "0.5519831", "0.5516382", "0.5516382", "0.55129457", "0.55050015", "0.55029994", "0.5502482", "0.5502482", "0.5491071", "0.54840887" ]
0.8175572
0
Wether or not this DB understands the extension of the file at path.
def understands_ext?(path) extensions.find{|ext| ext == File.extname(path)} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def proper_ext?(raw_path)\n path = raw_path.is_a?(Pathname) ? raw_path : Pathname.new(raw_path)\n LokaliseRails.file_ext_regexp.match? path.extname\n end", "def uses_extension?\n @format =~ /\\.[^\\.]+$/\n end", "def supported_file?(path)\n ext = File.extname(path)\n return true if ext.empty?\n ext =~ /\\.rbc\\Z/\n end", "def file_has_valid_extension?\n file_extension = File.extname(@filename)\n ACCEPTED_FILE_EXTENSIONS.include? file_extension\n end", "def extname? path\n (last_dot_idx = path.rindex '.') && !(path.index '/', last_dot_idx)\n end", "def visit_ext?(path)\n @ext_rules.accept?(File.extname(path)[1..-1])\n end", "def extension?\n @extension != \"\"\n end", "def is_supported? filename\n a = filename.split('.')\n $extensions.each do |e|\n return true if e == a.last.downcase\n end\n return false\n end", "def looks_a_sqlite_file?(f)\n return false unless Path.like?(f)\n path = Path(f)\n path.parent.directory? and ['db', 'sqlite', 'sqlite3'].include?(path.ext)\n end", "def is_supported_file_type?(filename)\n type = filename.split('.')[1]\n return VALID_EXTENSIONS.include?(type)\nend", "def check_file_extname(path, extnames)\n case extnames\n when Array\n raise \"Extension is not #{extnames}: #{path}\" unless extnames.include?(File.extname(path))\n when File.extname(path)\n true\n else\n raise \"Extension is not #{extnames}: #{path}\"\n end\n end", "def valid_file_format?\n VALID_FILE_FORMAT. include? uri_extension\n end", "def valid_file?(path)\n case path\n when %r|/abcdef$|, %r|^\\./tmp/db/\\w+?/database.yml$|\n return false\n end\n return true\n end", "def has_ext?(path, *exts)\n exts.include? Pa.ext2(get(path))\n end", "def file?(path)\n ::File.file?(prefixed(path))\n end", "def file?(s)\n s.include? '.'\nend", "def file?\n (@typeflag == \"0\" || @typeflag == \"\\0\") && !@name.end_with?(\"/\")\n end", "def ebook?(filepath)\n ['.epub', '.mobi'].include? File.extname(filepath).downcase\n end", "def file?(path)\n ftype(path) == 'file' rescue false\n end", "def has_archive_extension?\n self.class.has_archive_extension? stored_file\n end", "def checkFileExtension(file, extensions)\n name = file.original_filename\n ext = getFileExt(name)\n \n if(extensions.include?(ext.downcase))\n return true\n end\n end", "def extension?\n !@arg[:extension].nil?\n end", "def formatted?(path)\n MARKUPS.values.any? { |exts| exts.include?(File.extname(path)) }\n end", "def known_extension?(f)\n f = \".#{f}\" unless f[0,1] == '.'\n EXTENSION_TO_FORMAT[f]\n end", "def invalid_extname?\n return if File.extname(file.original_filename).downcase == '.csv'\n\n @error = I18n.t('csv.errors.invalid_ext')\n end", "def user_path?(file); end", "def check_file(name, extension, type)\n file = \"#{name}#{extension}\"\n return false unless loadable? file\n\n @type = type\n @feature = file\n @file_path = file\n @load_path = file\n\n return true\n end", "def extension\n @ext ||= ( ( e = File.extname( path ) ).empty? ? nil : e )\n end", "def edgarj_file?(col)\n @record.class.edgarj_file?(col)\n end", "def check_file_ext(file)\n status = nil\n ext = file.extname\n name = file.basename\n if ext == '.atp'\n status = 'atp'\n elsif ext == '.avc'\n status = 'avc'\n elsif ext == '.gz'\n # Ensure we have a .atp.gz or .avc.gz\n sub_ext = name.to_s.split('.')[-2]\n if sub_ext == 'atp'\n status = 'atp'\n end\n elsif ext == '.list'\n status = 'list'\n end\n status\n end", "def has_file_format?\n @file_format\n end", "def ignored_file?(path); end", "def opendocument?\n OPENDOCUMENT_EXTENSIONS.include? file_extension.upcase\n end", "def known_file_type fileName\r\n fileKnown = false\r\n fileType = fileName.split('.')[-1]\r\n FILE_TYPES.each { |ft| fileKnown |= fileType.eql? ft}\r\n return fileKnown\r\n end", "def get_extension filename\n unless filename.nil?\n filename.to_s.scan(/\\.([\\w+-]+)$/).flatten\n else\n false\n end\n end", "def file?(path)\n raise NotImplemented\n end", "def is_file?(path)\n ::File.file? abspath(path)\n end", "def db_path?( path )\n path.split( \"|\" ).size == 3\n end", "def contain?(filename); end", "def ignored?(file)\n return true if File.extname(file) == \".tmp\"\n return true if file.match(/___$/)\n return true if File.basename(file) == \".DS_Store\"\n return false\n end", "def formatted_like?(path,markup)\n MARKUPS[markup].include?(File.extname(path))\n end", "def is_file?\n !file_type.empty?\n end", "def extname() File.extname(@path) end", "def file?(path)\n File.file?(path_of(path))\n end", "def file_extension; end", "def file_extension; end", "def file_extension; end", "def validate_import_file(data)\n\t\tbegin\n\t\t\timport_filetype_detect(data)\n\t\trescue DBImportError\n\t\t\treturn false\n\t\tend\n\t\treturn true\n\tend", "def yaml_file?\n YAML_FILE_EXTS.include?(extname)\n end", "def mp3?\n File.extname(@path).downcase.eql?('.mp3')\n end", "def fileType path\n\t\tif File.ftype(path) == 'file'\n\t\t\ttrue\n\t\telse\n\t\t\tputs \"The given path isn't file.\"\n\t\t\texit\n\t\tend\n\tend", "def has_current_version_for?(path)\n file_with_any_ext_exists_for?(non_versioned_path(path))\n end", "def available_extension?(extension)\n %w[png svg json jpg jpeg].include?(extension)\n end", "def matches?(filename)\n filename = filename.downcase\n @extensions.any? { |ext| filename.end_with?(ext) }\n end", "def file_specification(file_path)\n file_name = File.basename (\"#{file_path}\").downcase\n file_extension = File.extname (file_name).downcase\n accepted_extensions = [\".tif\", \".xls\", \".doc\", \".pdf\", \".docx\", \".txt\", \".rtf\", \".xlsx\", \".ppt\", \".odt\", \".ods\", \".odp\", \".bmp\", \".gif\", \".jpg\", \".png\"]\n if accepted_extensions.include?(file_extension)\n return \"application/#{file_extension}\", file_name\n else\n return false\n end\n end", "def file_extension(extension = T.unsafe(nil)); end", "def file?() end", "def valid_ext?(file, ext_include, ext_exclude = nil)\n ext = File.extname(file).trim('.', '').downcase\n\n is_excluded_ext = false\n is_excluded_ext = ext_exclude.include?(ext) unless ext_exclude.blank?\n\n ext_include.include?(ext) && !is_excluded_ext\n end", "def spoofed?\n has_extension? and media_type_mismatch?\n end", "def matches(_ext)\n true\n end", "def extname() File.extname(path) end", "def hasImageFileExtension?(file)\n extensions = %w(cr2 jpg jpeg nef nrw dng)\n extensions.each { |extension|\n if file.downcase.include?(extension)\n return true\n end\n }\n return false\n end", "def file?\n original_filename.present?\n end", "def virtual_file?(name); end", "def image?\n IMAGE_EXTENSIONS.include? File.extname(filename)[1..-1]\n end", "def ext\n @ext ||= File.extname(path)\n end", "def target_file_path_active_record?\n target_file_path =~ /gems\\/activerecord/\n end", "def file?\n case type\n when T_REGULAR then true\n when T_UNKNOWN then nil\n else false\n end\n end", "def relevant_file?(file)\n file.end_with?('_spec.rb')\n end", "def file_matches_criteria?(full_path)\n full_path.file? && proper_ext?(full_path) &&\n !LokaliseRails.skip_file_export.call(full_path)\n end", "def supported_format?\n !(@file_set.mime_type & self.class.supported_formats).empty? || preservation_file&.original_filename&.first&.downcase&.include?(\".wav\")\n end", "def file?\n type == :file\n end", "def precompiled?\n @extname ||= File.extname(self.filepath)[1..-1]\n PRECOMPILED_FILE_TYPES.include?(@extname)\n end", "def has_extension?(template, extension)\n comparison_length = extension.size + 1 # account for the separator `.`\n template[-comparison_length, comparison_length] == \".#{extension}\"\n end", "def file?(f)\n File.file? f\n end", "def busted?(filename)\n f = File.basename(filename)\n /\\A(.*\\/)?[a-z0-9]{6}_[a-zA-Z0-9\\-_]+\\.[a-zA-Z0-9]+\\z/.match?(f)\n end", "def file_extension\n self::FILE_EXTENSION\n end", "def get_file_ext(file_string, type)\n filename = sanitize_filename(file_string)\n ext = filename.to_s.split(\".\").last\n if ext.downcase != type.downcase\n flash[:notice] = _('File_type_not_match')+ \" : #{type.to_s}\"\n return false\n else\n return true\n end\n end", "def ExtFs(fs)\n fs == :ext2 || fs == :ext3 || fs == :ext4\n end", "def ext\n file.extension.downcase\n end", "def format_extension\n extensions.reverse.detect { |ext|\n @environment.mime_types(ext) && !@environment.engines(ext)\n }\n end", "def file_extension\n FILE_EXTENSION\n end", "def maybe_hidden_file?(path); end", "def maybe_hidden_file?(path); end", "def json?(file_path)\n File.extname(file_path).delete('.').downcase.eql?(EXT_JSON)\n end", "def xcode_file?\n ['.nib', '.xcworkspacedata', '.xcuserstate'].include?(extname)\n end", "def exclude_file?(path)\n EXCLUDE_EXTS.include?(File.extname(path).sub(\".\", \"\").downcase)\n end", "def all_formats_encoded?\n self.webm_file.path && self.mp4_file.path && self.ogg_file.path ? true : false\n end", "def file?(file_path)\n nlst(file_path)[0] == file_path\n end", "def ext_of(filename)\n filename =~ extension_regex ? $2 : ''\n end", "def is_mp3?\n if filename != nil\n filename.ends_with?('.mp3')\n else\n false\n end\nend", "def image?\n %w(jpg jpeg gif png).include?(file_ext.downcase)\n end", "def filetype(path)\n path = File.extname(path)\n if Audio::EXTENSION_WHITE_LIST.include?(path[1, path.length])\n return 'audio'\n elsif Video::EXTENSION_WHITE_LIST.include?(path[1, path.length])\n return 'video'\n elsif Image::EXTENSION_WHITE_LIST.include?(path[1, path.length])\n return 'image'\n else\n return nil\n end\n end", "def file?(name)\n File.file?(path(name))\n end", "def check_path(directory, name, extension, type)\n file = \"#{name}#{extension}\"\n path = \"#{directory}/#{file}\"\n return false unless loadable? path\n\n @type = type\n @feature = file\n @load_path = path\n if qualified_path? path\n @file_path = path\n else\n @file_path = \"./#{path}\"\n end\n\n return true\n end", "def file_type file_name \n\t\tFile.extname( file_name ).gsub /^\\./, '' \n\tend", "def file?\n not identifier.blank?\n end", "def is_file?\n path = self.to_abs_path\n ((File.exist?(path)) &&\n (File.readable?(path)))\n end", "def is_valid_chef_component_file? filename\n extension = File.extname(filename)\n CHEF_FILE_EXTENSIONS.each do |validExtension|\n if extension.casecmp(validExtension) == 0\n return true\n end\n end\n return false\n end", "def extension? name\n @extensions.include? name\n end" ]
[ "0.7515566", "0.7483509", "0.7469188", "0.7319592", "0.7267296", "0.7261778", "0.72025883", "0.70653576", "0.7035526", "0.6792193", "0.67615813", "0.6758422", "0.67477065", "0.6728807", "0.6724527", "0.67084503", "0.6705728", "0.6670553", "0.6629256", "0.6621808", "0.65945596", "0.6594175", "0.65920055", "0.65850323", "0.6568498", "0.65570396", "0.6547243", "0.65379316", "0.6533334", "0.65265644", "0.6522442", "0.6515337", "0.65063924", "0.64917386", "0.64838994", "0.6465377", "0.6459244", "0.6456578", "0.64232075", "0.64131814", "0.64126676", "0.6412639", "0.64047456", "0.6402425", "0.6397116", "0.6397116", "0.6397116", "0.6396528", "0.63900125", "0.638839", "0.6383752", "0.63820773", "0.6366509", "0.6359583", "0.6353838", "0.6339063", "0.6315021", "0.6307852", "0.630675", "0.63054043", "0.63036346", "0.6289991", "0.62876666", "0.6287407", "0.6281552", "0.62651944", "0.6264028", "0.62573045", "0.625057", "0.62402666", "0.62343204", "0.6233591", "0.62292767", "0.6226308", "0.62242156", "0.62160003", "0.6201326", "0.6189522", "0.6176538", "0.6166222", "0.6158016", "0.6154956", "0.61537856", "0.61537856", "0.61488384", "0.6143334", "0.6132718", "0.61321235", "0.6130767", "0.6116896", "0.6111175", "0.6109019", "0.6106851", "0.6103029", "0.60907924", "0.6083001", "0.6075253", "0.6074465", "0.60732615", "0.6072513" ]
0.7767626
0
Returns the main name of a path, i.e., the basename without the extension main_name('/a/b/c/foo.bar') => 'foo'
def main_name(path) File.basename(path).sub(/\.[^\.]+$/,'') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path_name\n return unless @basename\n\n parts = @basename.split('.')\n parts.pop if parts.length > 1 && parts.last =~ /^\\w+$/\n parts.pop if parts.last =~ /^\\d+$/\n parts.join('.')\n end", "def file_name_from_path(path)\n path.split(\"/\")[-1]\n end", "def basename\n File.basename(@path, '.*')\n end", "def basename_of(filename)\n filename.sub(/(\\.[a-z]+)*$/, '')\n end", "def get_name(path)\n return path[/^.*\\/(.+?)\\/?$/, 1]\n end", "def real_main_file_name\n @real_main_file_name ||= File.basename( main_file_path )\n end", "def basename\n if extension\n basename = filename.split('.')\n basename.pop\n basename.join('.')\n else\n filename\n end\n end", "def rootname filename\n if (last_dot_idx = filename.rindex '.')\n (filename.index '/', last_dot_idx) ? filename : (filename.slice 0, last_dot_idx)\n else\n filename\n end\n end", "def basename(file_path)\n filename = File.basename(file_path)\n return filename.split('.')[0].to_sym if file_path\n end", "def name\n name = nil\n if root?\n name = path.to_s\n else\n name = @path.basename.to_s\n end\n return name\n end", "def basename\n File.basename(path)\n end", "def basename_of(filename)\n filename.sub(extension_regex, '')\n end", "def basename\n s = name\n (i = s.rindex('::')) and (s = s.right(-i-2)) unless s.blank?\n s\n end", "def basename\n File.basename( fullpath, ext )\n end", "def extract_name(file_path)\n if file_path[-1, 1] == \"/\"\n return nil\n end\n\n # File.basename is too eager to please and will return the last\n # component of the path even if it ends with a directory separator.\n ::File.basename(file_path)\n end", "def basename(name)\n if name =~ /.*\\/(.*)/\n name = $1\n end\n name\n end", "def basename(path)\n path.chomp(\"/\")\nend", "def file_name(at_path = nil)\n at_path ||= @full_path\n File.basename at_path, '.*'\n end", "def file_name(at_path = nil)\n at_path ||= @full_path\n File.basename at_path, '.*'\n end", "def filename\n File.basename(path)\n end", "def basename(fn)\n split_filename(fn).last\n end", "def basename\n filename.chomp(extname)\n end", "def get_basename(file_path)\n File.basename file_path\n end", "def basename(fn)\n split_filename(fn).last\n end", "def file_name name\n File.basename(name).sub(/\\.[^\\.]*/, '')\n end", "def file_name name\n File.basename(name).sub(/\\.[^\\.]*/, '')\n end", "def extract_basename(input)\n input.to_s.gsub(/^.*\\/([^\\/\\?]+).*$/, '\\1')\n end", "def basename_without_ext; end", "def name\n file.partition(base).last.gsub(/[_\\/]/, \" \").strip\n end", "def name\n File.basename(path)\n end", "def normalised_name(path)\n path == '/' ? '/' : File.basename(path)\n end", "def name\n ::File.basename(path)\n end", "def basename( fn )\n ::File.basename(fn, '.*')\n end", "def name\n File.basename(@path)\n end", "def name\n File.basename(@path)\n end", "def name\n File.basename(@path)\n end", "def basename_without_ext\n @basename_without_ext ||= File.basename(path, \".*\")\n end", "def basename\n @basename ||= File.basename(path)\n end", "def get_file_name_without_ext(full_name)\n return File.basename(full_name, File.extname(full_name))\n rescue Exception => exc\n puts exc\n return full_name\n end", "def getFileName( path )\n re = path.match(/(\\/?[[^\\/]+\\/]+)?\\/(\\w*)(\\.\\w+$)?/)\n if re.nil?\n # No match, the file path must be the name as well. Try and remove\n # a file extension, if one is present\n if File.extname( path ).empty?\n # No file extension, file path IS the name\n return path\n else\n extMatch = path.match(/(\\w+)\\./)\n if extMatch.nil?\n raise \"Failed to find file name of #{path}. Detected file extension, but could not parse\"\n else\n # Return the content of the first capture (the file name, with extension removed)\n return extMatch.captures[ 0 ]\n end\n end\n else\n # We matched, return the file name (2nd capture, array[1])\n return re.captures[ 1 ]\n end\nend", "def basename( path )\r\n File.basename( path )\r\n end", "def basename(path)\n File.basename(path)\n end", "def path_and_name(path)\n match = path.match(/(.+)\\/(.+$)/)\n [match[1], match[2].split('.').max_by(&:length).underscore.humanize.titlecase]\n end", "def basename\n return self.name.downcase.gsub(/^.*::/, '')\n end", "def file_name\n File.basename @path\n end", "def to_name\n basename.to_s.sub extname, ''\n end", "def find_partial_name(file_path)\n return name = file_path.split('/').last.to_sym;\n end", "def manifest_name(name, type)\n return name if File.extname(name.to_s).empty?\n\n File.basename(name, type)\n end", "def basename\n suffixed? ? name.sub(/\\.#{Regexp.escape(template.name)}$/, '') : name\n end", "def name\n path.gsub(/\\./,'_').gsub(%r{/}, '.').gsub(%r{(^\\.|\\.$)},'')\n end", "def name\n $0.split(\"/\").last\n end", "def file_name\n \"/\" + current_file.path.split('/').pop\n end", "def filename\n File.basename( fullpath )\n end", "def basename_without_extension(file)\n return File::basename(file.to_s, File::extname(file.to_s))\n end", "def file_name\n File.basename(file_path)\n end", "def default_name\n path.dirname.basename.to_s\n end", "def basename(*args) Path::Name.new(File.basename(path, *args)) end", "def base_name\n File.basename @absolute_name\n end", "def basename filename, drop_ext = nil\n if drop_ext\n ::File.basename filename, (drop_ext == true ? (extname filename) : drop_ext)\n else\n ::File.basename filename\n end\n end", "def base_name\n File.basename(file_name)\n end", "def base file, ext; return File.basename file, ext end", "def base file, ext; return File.basename file, ext end", "def basename(filename)\n value = filename\n known_extensions.each do |str|\n value = value.gsub(/\\.#{str}$/, '')\n end\n value\n end", "def basename\n File.basename(filename)\n end", "def fname(path)\n path.split(\"/\").last\n end", "def filename_base\n return '_'+basename if is_type_partial?\n basename\n end", "def chop_basename(path)\n base = File.basename(path)\n if base.empty? or base == '/'\n return nil\n else\n return path[0, path.rindex(base)], base\n end\n end", "def name\n File.basename(absolute_path)\n end", "def printable_part(pathname)\r\n if (!@rl_filename_completion_desired) # don't need to do anything\r\n return (pathname)\r\n end\r\n\r\n temp = pathname.rindex('/')\r\n return pathname if temp.nil?\r\n File.basename(pathname)\r\n end", "def base()\n sub_ext('').basename.to_s\n end", "def base\n File.basename @filename, extension_with_delimiter\n end", "def base_name\n File.basename @relative_name\n end", "def basename(file)\n File.basename(file, \".*\")\n end", "def name\n @name ||= path.split('/').last\n end", "def get_filename\n File.basename(url)[/(?:(?!\\?|#).)*/] || File.basename(url)\n end", "def final_path_component(path)\n path.split(PATH_SEPARATOR)[-1].split[0]\n end", "def name\n File.basename(self.path)\n end", "def short_filename\n return $1 if @filename =~ %r{.*/(.*/[^/]+)$}\n return @filename\n end", "def short_filename\n return $1 if @filename =~ %r{.*/(.*/[^/]+)$}\n return @filename\n end", "def path\n name.split(\"::\").join(\"/\").downcase\n end", "def basename_without_ext\n if not @basename_without_ext\n @basename_without_ext = File.basename(path, '.*')\n if not @is_default_language\n @basename_without_ext ['.' + @language] = ''\n end\n end\n @basename_without_ext\n end", "def get_code_name\n code_name = $0\n code_name = Pathname.new(code_name)\n code_name = code_name.basename.to_s\n return code_name\nend", "def partialize_path(path)\n if path.basename.to_s !~ /\\A_/\n Pathname.new path.to_s.sub(/([^\\/]+)\\Z/, '_\\1')\n end\n end", "def partialize_path(path)\n if path.basename.to_s !~ /\\A_/\n Pathname.new path.to_s.sub(/([^\\/]+)\\Z/, '_\\1')\n end\n end", "def name\n File.basename(@root)\n end", "def name()\n basename.to_s\n end", "def name\n @name ||= File.basename(path)\n end", "def name\n @name ||= File.basename(path)\n end", "def original_filename\n unless defined? @original_filename\n @original_filename =\n unless original_path.blank?\n if original_path =~ /^(?:.*[:\\\\\\/])?(.*)/m\n $1\n else\n File.basename original_path\n end\n end\n end\n @original_filename\n end", "def extension\n File.basename(root_path)\n end", "def get_filename(file)\n File.basename(file)\n end", "def filename\n path.split(File::Separator).join(\"_\")\n end", "def directory_basename\n File.basename(@directory)\n end", "def name\n @name ||= File.basename(path)\n end", "def name_without_extension\n tmp = name\n i = tmp.index('.')\n i ? tmp[0...i] : tmp\n end", "def output_filename_for(filename)\n raise \"Filename not given\" unless filename\n extension = File.extname(filename)[1..-1]\n parser = self.class.for_extension(extension).last\n return filename unless parser\n Pathname.new(\"#{File.dirname(filename)}/#{File.basename(filename, \".*\")}.#{parser.finished_extension}\").cleanpath.to_s\n rescue => e\n filename\n end", "def base_part_of(file_name)\n name = File.basename(file_name)\n name.gsub(/[^\\w._-]/, '')\n end", "def base_part_of(file_name)\n name = File.basename(file_name)\n name.gsub(/[^\\w._-]/, '')\n end", "def chop_basename(path)\n base = File.basename(path)\n if /\\A#{SEPARATOR_PAT}?\\z/o =~ base\n return nil\n else\n return path[0, path.rindex(base)], base\n end\n end", "def program_name\n File.basename($0)\n end" ]
[ "0.77965236", "0.73246247", "0.72832626", "0.7261556", "0.7219874", "0.71804863", "0.71052563", "0.7101444", "0.7081108", "0.70793754", "0.7016282", "0.6999164", "0.6997734", "0.6960618", "0.69556105", "0.69405204", "0.6929045", "0.68773997", "0.68773997", "0.68622255", "0.6840081", "0.6839329", "0.6830697", "0.6829851", "0.6807854", "0.6807854", "0.6802765", "0.68006206", "0.67789614", "0.6778722", "0.6744542", "0.67329544", "0.6697924", "0.66938597", "0.66938597", "0.66938597", "0.6682956", "0.6672972", "0.66687804", "0.66561615", "0.6652068", "0.6642063", "0.6621906", "0.66218626", "0.66209495", "0.6599781", "0.65933186", "0.6582697", "0.65806466", "0.65670145", "0.6561596", "0.6557497", "0.65549016", "0.6548942", "0.65462446", "0.6530547", "0.6528738", "0.6509239", "0.6502639", "0.6501922", "0.65017855", "0.65017855", "0.6498667", "0.64960605", "0.6488457", "0.6484763", "0.6483608", "0.6477097", "0.64757204", "0.6439047", "0.64052534", "0.6399531", "0.63927674", "0.63886726", "0.6387731", "0.6379893", "0.63766205", "0.63708836", "0.63708836", "0.6367545", "0.63671523", "0.6360733", "0.6349483", "0.6349483", "0.6341532", "0.6339142", "0.6311718", "0.6311718", "0.6285722", "0.62824845", "0.6275602", "0.62680346", "0.62617517", "0.6253736", "0.62536037", "0.62497306", "0.624732", "0.624732", "0.6247217", "0.62442833" ]
0.8626803
0
Returns the perspective name and extension name (a 2 items array) for the given path. By default the blobs for resources content are stored in files named 'resource' with ext starting with a dot
def persp_and_ext_for_basename(path) [main_name(path).sub('resource-epo-',''), File.extname(path)] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path\n name + extension\n end", "def file_title(path)\n filename_from_path(path).split(\".\")[0]\n end", "def split_path(path)\n m = CHEF_OBJECT_RE.match(path)\n unless m\n warn \"Skipping '#{path}' -- it doesn't look like '*cookbooks/**/*', '*roles/*.{rb,json}', '*environments/*.{rb,json}' or '*data_bags/*.{rb,json}'\"\n return\n else\n parent_seg, child_seg = m.captures\n child_seg.gsub!(/\\.(rb|json)$/, \"\")\n extension = $1\n [parent_seg, child_seg, extension]\n end\n end", "def extname() File.extname(path) end", "def path_and_name(path)\n match = path.match(/(.+)\\/(.+$)/)\n [match[1], match[2].split('.').max_by(&:length).underscore.humanize.titlecase]\n end", "def get_name_feature_from_path(path)\n folder_path_array = path.split('/')\n folder_path_array[folder_path_array.count - 1]\nend", "def file_name_from_path(path)\n path.split(\"/\")[-1]\n end", "def split_to_filename_and_extension path\n extension = File.extname(path).gsub('.', '')\n filename = File.basename(path, '.' + extension)\n return filename, extension\n end", "def plugin_name(path)\r\n File.basename(path)\r\n end", "def extname() File.extname(@path) end", "def name\n File.basename(path)\n end", "def extension\n path.split('.').last\n end", "def extname(path)\n File.extname(path)\n end", "def filename\n File.basename(path)\n end", "def name\n ::File.basename(path)\n end", "def splitname(path)\n [dirname(path), filename(path), extname(path)]\n end", "def split_extensions(path)\n filename = path.split('/').last\n (filename =~ %r|.+\\.([a-z,A-Z]+)$|) ? $1 : nil\n end", "def extension_from_path(path)\n @extensions.find {|e| e.path == path}\n end", "def get_extension(path)\n return path[/^.+(\\.[a-z0-9]+)$/i, 1]\n end", "def ext\n File.extname(path)\n end", "def read_platform_from_file(path:)\n path.basename.to_s.split('.').first\n end", "def name\n File.basename(@path)\n end", "def name\n File.basename(@path)\n end", "def name\n File.basename(@path)\n end", "def path_and_extension(template_path)\n template_path_without_extension = template_path.sub(/\\.(\\w+)$/, '')\n [template_path_without_extension, $1]\n end", "def extension\n File.basename(root_path)\n end", "def file_name\n File.basename @path\n end", "def split_filename(path)\n pathname = Pathname.new(path.value)\n list(quoted_string(pathname.dirname.to_s),\n quoted_string(pathname.basename(pathname.extname).to_s),\n quoted_string(pathname.extname.to_s),\n :space)\n end", "def ext\n File.extname(@path)\n end", "def filetype(path)\n path = File.extname(path)\n if Audio::EXTENSION_WHITE_LIST.include?(path[1, path.length])\n return 'audio'\n elsif Video::EXTENSION_WHITE_LIST.include?(path[1, path.length])\n return 'video'\n elsif Image::EXTENSION_WHITE_LIST.include?(path[1, path.length])\n return 'image'\n else\n return nil\n end\n end", "def ext_path\n \"/#{@file.bucket}/#{@file.name}\"\n end", "def filename\n path && File.basename(path)\n end", "def path(name,ext=nil)\n a,filename = File.split(ext.nil? ? super(name) : super(name,ext))\n a,b = File.split(a)\n File.join(a,'catalog_cm_guard',filename)\n end", "def get_name(path)\n return path[/^.*\\/(.+?)\\/?$/, 1]\n end", "def basename_for_persp_and_ext(persp, ext)\n \"resource-epo-#{persp}#{ext}\"\n end", "def file_info(path)\n if manifest_entry # have we loaded our manifest yet? if so, use that sucker\n result = [manifest_entry[path], manifest_entry.flags[path]]\n if result[0].nil?\n return [NULL_ID, '']\n else\n return result\n end\n end\n if manifest_delta || files[path] # check if it's in the delta... i dunno\n if manifest_delta[path]\n return [manifest_delta[path], manifest_delta.flags[path]]\n end\n end\n # Give us, just look it up the long way in the manifest. not fun. slow.\n node, flag = @repo.manifest.find(raw_changeset[0], path)\n if node.nil?\n return [NULL_ID, '']\n end\n return [node, flag]\n end", "def name\n @name ||= File.basename(path)\n end", "def name\n @name ||= File.basename(path)\n end", "def name\n @name ||= File.basename(path)\n end", "def paperclip_path\n record = resourceable\n case record\n when Thinkspace::Casespace::Phase\n assignment = record.thinkspace_casespace_assignment\n space = assignment.thinkspace_common_space\n \"spaces/#{space.id}/assignments/#{assignment.id}/phases/#{record.id}/:filename\"\n when Thinkspace::Casespace::Assignment\n space = record.thinkspace_common_space\n \"spaces/#{space.id}/assignments/#{record.id}/:filename\"\n when Thinkspace::Common::Space\n \"spaces/#{record.id}/:filename\"\n else\n \"spaces/system/resource/:filename\"\n end\n end", "def title\n @blob.basename.split(\".\").first.capitalize\n end", "def path\n @filename\n end", "def inspect\n File.basename @__path\n end", "def fs(path)\n OodAppkit.files.url(path: path).to_s\n end", "def getFileName( path )\n re = path.match(/(\\/?[[^\\/]+\\/]+)?\\/(\\w*)(\\.\\w+$)?/)\n if re.nil?\n # No match, the file path must be the name as well. Try and remove\n # a file extension, if one is present\n if File.extname( path ).empty?\n # No file extension, file path IS the name\n return path\n else\n extMatch = path.match(/(\\w+)\\./)\n if extMatch.nil?\n raise \"Failed to find file name of #{path}. Detected file extension, but could not parse\"\n else\n # Return the content of the first capture (the file name, with extension removed)\n return extMatch.captures[ 0 ]\n end\n end\n else\n # We matched, return the file name (2nd capture, array[1])\n return re.captures[ 1 ]\n end\nend", "def main_name(path)\n File.basename(path).sub(/\\.[^\\.]+$/,'')\n end", "def extension\n begin\n @file_data.original_filename.split(\".\").last\n rescue\n @file_data.path.split(\".\").last\n end\n end", "def ext\n File.extname( fullpath )\n end", "def ext\n @ext ||= File.extname(path)\n end", "def plugin_name_from_path(path)\n path = Pathname.new(path).expand_path.cleanpath\n each do |plugin|\n if path.to_s =~ /^#{plugin.root}/\n return plugin.name\n end\n end\n nil\n end", "def extname\n\t\treturn nil unless src\n\n\t\tFile.extname url.path\n\tend", "def fname(path)\n path.split(\"/\").last\n end", "def base file, ext; return File.basename file, ext end", "def base file, ext; return File.basename file, ext end", "def file_base_type(path)\r\n \t\tfile_name = File.basename(path)\r\n \t\textension = File.extname(file_name)\r\n \t\tfile_name = file_name[0, file_name.length - extension.length]\r\n \t\t(File.extname(file_name)[1..-1]).to_sym\r\n end", "def file_name\n File.basename(file_path)\n end", "def name\n @name ||= ::File.basename(@path)\n end", "def asset_output_filename(path, processed_extensions)\n path = Pathname.new(path) if path.is_a?(String)\n\n return path if path.basename.to_s.split('.').length == 2\n\n extension = path.extname\n processed_extensions.map! { |ext| (ext[0] != '.' ? '.' : '') + ext }\n\n if processed_extensions.include?(extension)\n asset_output_filename(path.to_s.sub(/#{extension}\\Z/, ''), processed_extensions)\n else\n path\n end\n end", "def name\n path.gsub(/\\./,'_').gsub(%r{/}, '.').gsub(%r{(^\\.|\\.$)},'')\n end", "def basename\n File.basename(path)\n end", "def file_desc\n \"Files (#{file_ext(',')})\"\n end", "def filename_from_path(name, content_type)\n return \"#{Time.now.to_i}_#{name}\" if content_type.empty?\n\n extension = content_type.split('/').last\n filename = name.split('/').last\n alternative_name = extension.empty? ? \"#{Time.now.to_i}_#{filename}\" : \"#{Time.now.to_i}_#{filename}.#{extension}\"\n filename = File.extname(filename).empty? ? alternative_name : filename\n CGI.unescape(filename) if filename\n end", "def file_ext\n case variant\n when :preview, :\"180x180\", :\"360x360\"\n \"jpg\"\n when :\"720x720\"\n \"webp\"\n when :sample\n media_asset.is_ugoira? ? \"webm\" : \"jpg\"\n when :original\n media_asset.file_ext\n end\n end", "def path\n path = @file.sub(File.expand_path(root_path), '')\n\n # if xx.haml (but not xx.html.haml), \n if tilt?\n path = path.sub(/\\.[^\\.]*$/, \"\")\n path += \".#{default_ext}\" unless File.basename(path).include?('.')\n end\n\n path\n end", "def path\n [name]\n end", "def preview(path, opts = {})\n optional_inputs = opts\n input_json = {\n path: path,\n path_revision: optional_inputs[:path_revision],\n }\n response = @session.do_content_endpoint(\"/#{ @namespace }/preview\", input_json)\n file, metadata = Dropbox::API::HTTP.parse_content_response(response)\n return file, Dropbox::API::File.from_json(metadata)\n end", "def name\n File.basename(self.path)\n end", "def get_image_name_list(path)\n image_name_list = []\n Dir.glob(path + '*' + FILE_SUFFIX).each do |file|\n image_name_list << file\n end\n image_name_list\n end", "def part\n \"#{path.chomp('.part')}.part\"\n end", "def path\n @bundle_filename\n end", "def filename\n path.split(File::Separator).join(\"_\")\n end", "def filename_extension # required\n if manifest_property.is_a? Array\n manifest_property # eg [ \".c\", \".h\" ]\n else\n [ manifest_property ] # eg \".py\"\n end\n end", "def filename\n @basename + PAGE_FILE_EXT\n end", "def routing_path_and_extension\n @routing_path_and_extension ||= begin\n path = raw_path_info\n extension = nil\n\n if @app.config[:media_type_extensions] && (match = EXTENSION_REGEXP.match(path))\n path = match.pre_match\n extension = match[1]\n end\n\n [path, extension]\n end\n end", "def get_lang_from_path\n case File.extname(@path).downcase\n when '.rb'\n 'ruby'\n when '.js'\n 'javascript'\n when '.php'\n 'php'\n else\n nil\n end\n end", "def split() File.split(path).map {|f| Path::Name.new(f) } end", "def infer_name_from_contents(obj, opts={})\n begin\n File.split(obj).last.split('.')[0..-2].join('.').titleize\n rescue\n nil\n end\n end", "def representative_file\n file_key = metadata.keys.find { |k| k.to_s =~ /(representative_)?files?/i }\n return [] if file_key.nil?\n\n metadata.fetch(file_key, [])\n end", "def contents(path)\n puts \"#contents(#{path})\" if DEBUG\n results = []\n root_path = zk_path(path)\n zk.find(root_path) do |z_path|\n if (z_path != root_path)\n z_basename = z_path.split('/').last\n stats = zk.stat(z_path)\n results << \"#{z_basename}\" if stats.numChildren > 0\n results << \"#{z_basename}.contents\" if zk.stat(z_path).dataLength > 0\n ZK::Find.prune\n end\n end\n results\n end", "def get_name(path_name)\n resume_file_name = path_name.downcase.split('/').last\n # Replace 'resume' with whatever comes after the name in that folder\n end_index = resume_file_name.index('resume')\n # This is for the nonanalytics folder\n # first_index = resume_file_name.index(\"_\")\n # end_index = resume_file_name.index('_', first_index + 1)\n name = resume_file_name[0, end_index - 1]\n return name\nend", "def name\n @name ||= path.split('/').last\n end", "def inspect\n \"File: #{@name} #{@ext}\"\n end", "def ext\n file.extension.downcase\n end", "def get_child_paths(challenge)\n challenge.fetch('children').map {|challenge_name| \"#{challenge_name}.yaml\" }\n end", "def path_name\n return unless @basename\n\n parts = @basename.split('.')\n parts.pop if parts.length > 1 && parts.last =~ /^\\w+$/\n parts.pop if parts.last =~ /^\\d+$/\n parts.join('.')\n end", "def name()\n basename.to_s\n end", "def title_for( path_names )\n tokens = path_names.split( \"|\" )\n buff = case tokens.size\n when 2 \n \"zone\"\n when 3 \n \"database\"\n else \n \"collection\"\n end\n db = tokens.size > 3 ? \"<span class=\\\"ctx\\\">#{tokens[2]}</span>.\" : \"\"\n \"<p class=\\\"ctx\\\" style=\\\"text-align:center;font-size:0.8em\\\">#{db}#{tokens.last}</p>\"\n end", "def find_available_name(path)\n return path unless bucket.objects[path].exists?\n ext = File.extname(path)\n base = path[0..-ext.size-1] + \"-1\"\n loop do\n path = base + ext\n return path unless bucket.objects[path].exists?\n base = base.next\n end\n end", "def filename\n pn = Pathname.new(@source.filename)\n pn.basename(pn.extname).to_s.tap do |s|\n s << \"_\" << @aspect unless @aspect.nil?\n s << \".\" << mime_type.to_sym.to_s\n end\n end", "def process_content(path)\n case path.extname\n when '.htm', '.md'\n read_split_content(path.to_s, symbolize_keys: true)\n # when '.md'\n # body, data = read_split_content(path.to_s, symbolize_keys: true)\n # [Kramdown::Document.new(body).to_html, data]\n when '.yml'\n [nil, YAML.load(File.read(path.to_s), symbolize_names: true)]\n end\n end", "def name\n filename\n end", "def name\n filename\n end", "def paths\n Hash[ (formats + self.class::VERSION_FORMATS.keys).map{ |f| [f, path(f)] } ]\n end", "def upload_name_for_path(full_path)\n require \"#{ENV['TM_SUPPORT_PATH']}/lib/escape.rb\"\n\n # WordPress automatically places files into dated paths\n prefix = mode == 'wp' ? '' : Time.now.strftime('%F_')\n file = File.basename(full_path)\n\n if ENV['TM_MODIFIER_FLAGS'] =~ /OPTION/\n\n suggested_name = prefix + file.gsub(/[ ]+/, '-')\n result = TextMate.input_box('Upload Image', 'Name to use for uploaded file:', suggested_name, 'Upload')\n TextMate.exit_discard if result.nil?\n\n alt = result.sub(/\\.[^.]+\\z/, '').gsub(/[_-]/, ' ').capitalize.gsub(/\\w{4,}/) { |m| m.capitalize }\n [ result, alt ]\n\n else\n\n base = file.sub(/\\.[^.]+\\z/, '')\n ext = file[(base.length)..-1]\n suggested_alt = base.gsub(/[_-]/, ' ').gsub(/[a-z](?=[A-Z0-9])/, '\\0 ').capitalize.gsub(/\\w{4,}/) { |m| m.capitalize }\n\n result = TextMate.input_box('Upload Image', 'Image description (a filename will be derived from it):', suggested_alt, 'Upload')\n TextMate.exit_discard if result.nil?\n\n require \"iconv\"\n name = Iconv.new('ASCII//TRANSLIT', 'UTF-8').iconv(result.dup)\n\n name.gsub!(/[^-_ \\/\\w]/, '') # remove strange stuff\n name.gsub!(/[-_ \\/]+/, '_') # collapse word separators into one underscore\n name.downcase!\n [ prefix + name + ext, result ]\n\n end\n end", "def possible_sample_name(filename)\n\t\tfilename.split('/').last.split('.').first\n\tend", "def get_image_name_list(path)\n image_name_list = []\n Dir.glob(path + '*' + JPG_FILE_SUFFIX).each do |file|\n image_name_list << file\n end\n image_name_list\n end", "def page_title\n \"which fileset for #{path}\"\n end", "def name\n name = nil\n if root?\n name = path.to_s\n else\n name = @path.basename.to_s\n end\n return name\n end", "def title\n #Flip off the part after the last dot, including that dot: find the filename without extensions\n fragments = @filename.split('.')\n fragments.pop\n title = fragments.join('.')\n\n return title.gsub(/[_]/, ' ').capitalize\n end", "def paperclip_path\n \"dev/assets/products/:id/:style/:basename.:extension\"\n end" ]
[ "0.6222756", "0.61076194", "0.5940214", "0.59223026", "0.5907372", "0.5900902", "0.57627887", "0.57480156", "0.574314", "0.5740957", "0.5726824", "0.5703643", "0.56914824", "0.56693316", "0.5634907", "0.561513", "0.5581304", "0.55733824", "0.55678064", "0.55049616", "0.5457772", "0.5451155", "0.5451155", "0.5451155", "0.5439348", "0.53990567", "0.53946006", "0.53821677", "0.5372823", "0.5366641", "0.5336816", "0.53188235", "0.53159523", "0.5311231", "0.5310807", "0.5305743", "0.530104", "0.530104", "0.5274175", "0.52448046", "0.5233643", "0.52112603", "0.5203099", "0.52012295", "0.51954573", "0.5188093", "0.5185066", "0.518309", "0.5182995", "0.5174531", "0.51725346", "0.5172315", "0.51560396", "0.51560396", "0.5148677", "0.5137137", "0.51243514", "0.5114293", "0.51088357", "0.51070327", "0.5099923", "0.50907975", "0.50594187", "0.5058044", "0.5052484", "0.50445986", "0.50417507", "0.50335443", "0.5027867", "0.5025533", "0.50235265", "0.5020455", "0.5019828", "0.5017051", "0.5016676", "0.5014621", "0.5012489", "0.499417", "0.4994032", "0.49928242", "0.49851552", "0.497845", "0.49760905", "0.49750262", "0.49729592", "0.4970165", "0.49701002", "0.49632093", "0.49626398", "0.4955653", "0.49532408", "0.49532408", "0.49523953", "0.49498722", "0.49469373", "0.49459854", "0.4937679", "0.49333498", "0.49293897", "0.4927694" ]
0.68448985
0
Returns the basename of a resource blob for a perspective named persp and in a format with extension ext (including the leading dot). see also persp_and_ext_for_basename
def basename_for_persp_and_ext(persp, ext) "resource-epo-#{persp}#{ext}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def persp_and_ext_for_basename(path)\n [main_name(path).sub('resource-epo-',''), File.extname(path)]\n end", "def basename\n File.basename( fullpath, ext )\n end", "def path_name\n return unless @basename\n\n parts = @basename.split('.')\n parts.pop if parts.length > 1 && parts.last =~ /^\\w+$/\n parts.pop if parts.last =~ /^\\d+$/\n parts.join('.')\n end", "def basename\n if extension\n basename = filename.split('.')\n basename.pop\n basename.join('.')\n else\n filename\n end\n end", "def basename\n filename.chomp(extname)\n end", "def basename(fn)\n split_filename(fn).last\n end", "def basename_of(filename)\n filename.sub(/(\\.[a-z]+)*$/, '')\n end", "def basename(fn)\n split_filename(fn).last\n end", "def basename\n File.basename(filename)\n end", "def basename\n suffixed? ? name.sub(/\\.#{Regexp.escape(template.name)}$/, '') : name\n end", "def basename_of(filename)\n filename.sub(extension_regex, '')\n end", "def basename\n File.basename(path)\n end", "def basename\n @basename ||= File.basename(path)\n end", "def base file, ext; return File.basename file, ext end", "def base file, ext; return File.basename file, ext end", "def basename\n s = name\n (i = s.rindex('::')) and (s = s.right(-i-2)) unless s.blank?\n s\n end", "def name\n file.partition(base).last.gsub(/[_\\/]/, \" \").strip\n end", "def basename\n File.basename(@path, '.*')\n end", "def name()\n basename.to_s\n end", "def filename\n File.basename( fullpath )\n end", "def filename\n File.basename(path)\n end", "def filename\n return unless url\n\n ::File.basename(url.split(\"?\").first)\n end", "def basename_without_ext; end", "def basename(filename)\n value = filename\n known_extensions.each do |str|\n value = value.gsub(/\\.#{str}$/, '')\n end\n value\n end", "def get_basename(file_path)\n File.basename file_path\n end", "def base\n File.basename @filename, extension_with_delimiter\n end", "def basename_tmpl\n ##p @cfg[:filename_tmpl]\n mode=Dyndoc.guess_mode(@cfg[:filename_tmpl])\n ##p [\"mode\",mode,Dyndoc.tmplExt[mode]]\n if mode\n name,ext=@cfg[:filename_tmpl].scan(/^(.*)(?:#{Dyndoc.tmplExt[mode].join(\"|\")})$/).flatten.compact\n else\n name,ext=@cfg[:filename_tmpl].scan(/^(.*)(?:_tmpl(\\..*)|(\\.dyn))$/).flatten.compact\n end\n #p [:name,@cfg[:filename_tmpl],name]\n name\n end", "def basename(file_path)\n filename = File.basename(file_path)\n return filename.split('.')[0].to_sym if file_path\n end", "def file_name\n File.basename(file_path)\n end", "def file_name\n File.basename @path\n end", "def basename\n @basename ||= ''\n end", "def name\n ::File.basename(path)\n end", "def name\n File.basename(path)\n end", "def basename( fn )\n ::File.basename(fn, '.*')\n end", "def basename(name)\n if name =~ /.*\\/(.*)/\n name = $1\n end\n name\n end", "def basename\n File.basename(self.upload.url).split(/\\?/)[0]\n end", "def filename\n return @filename if @filename\n\n if self.uri\n @filename = File.basename(self.uri.path)\n else\n regexps = PRECOMPILED_FILE_TYPES.map { |ext| \"\\.#{ext}\" }.join('|')\n\n @filename = File.basename(self.filepath).gsub(/#{regexps}/, '')\n end\n end", "def basename\n return self.name.downcase.gsub(/^.*::/, '')\n end", "def name\n File.basename(@path)\n end", "def name\n File.basename(@path)\n end", "def name\n File.basename(@path)\n end", "def filename\n path && File.basename(path)\n end", "def get_corresponding_file_base_name\n return File.basename(@URL)\n end", "def get_filename\n File.basename(url)[/(?:(?!\\?|#).)*/] || File.basename(url)\n end", "def basename(suffix = T.unsafe(nil)); end", "def base_name\n File.basename(file_name)\n end", "def basename\n @chart_data.title\n .strip\n .gsub(/\\s+/, '_')\n .downcase\n end", "def base_name(suffix=nil)\n adapter.basename(suffix)\n end", "def printable_part(pathname)\r\n if (!@rl_filename_completion_desired) # don't need to do anything\r\n return (pathname)\r\n end\r\n\r\n temp = pathname.rindex('/')\r\n return pathname if temp.nil?\r\n File.basename(pathname)\r\n end", "def basename filename, drop_ext = nil\n if drop_ext\n ::File.basename filename, (drop_ext == true ? (extname filename) : drop_ext)\n else\n ::File.basename filename\n end\n end", "def get_filename(file)\n File.basename(file)\n end", "def to_name\n basename.to_s.sub extname, ''\n end", "def base_name\n File.basename @absolute_name\n end", "def basename_without_ext\n if not @basename_without_ext\n @basename_without_ext = File.basename(path, '.*')\n if not @is_default_language\n @basename_without_ext ['.' + @language] = ''\n end\n end\n @basename_without_ext\n end", "def filename\n @parts[-1]\n end", "def filename(url)\n uri = URI(url)\n File.basename(uri.path)\n end", "def basename_without_ext\n @basename_without_ext ||= File.basename(path, \".*\")\n end", "def file_name(at_path = nil)\n at_path ||= @full_path\n File.basename at_path, '.*'\n end", "def file_name(at_path = nil)\n at_path ||= @full_path\n File.basename at_path, '.*'\n end", "def wp_basename(path, suffix = '')\n CGI::unescape( File.basename( CGI.escape(path).gsub(/%2F|%5C/, '/'), suffix ))\n end", "def basename(suffix = nil)\n File.basename(filename, suffix || extname)\n end", "def full_filename(filename)\n if filename.include? '.pdf'\n filename.gsub! '.pdf' '.jpg' \n end\n \"thumb_#{filename}\"\n end", "def name\n File.basename(self.path)\n end", "def basename(type = nil)\n type = nil if ['', 'roff'].include?(type.to_s)\n [path_name || @name, path_section || @section, type]\n .compact.join('.')\n end", "def basename( path )\r\n File.basename( path )\r\n end", "def filename\n pn = Pathname.new(@source.filename)\n pn.basename(pn.extname).to_s.tap do |s|\n s << \"_\" << @aspect unless @aspect.nil?\n s << \".\" << mime_type.to_sym.to_s\n end\n end", "def base_part_of(file_name)\n name = File.basename(file_name)\n name.gsub(/[^\\w._-]/, '')\n end", "def base_part_of(file_name)\n name = File.basename(file_name)\n name.gsub(/[^\\w._-]/, '')\n end", "def possible_sample_name(filename)\n\t\tfilename.split('/').last.split('.').first\n\tend", "def get_file_name_without_ext(full_name)\n return File.basename(full_name, File.extname(full_name))\n rescue Exception => exc\n puts exc\n return full_name\n end", "def main_name(path)\n File.basename(path).sub(/\\.[^\\.]+$/,'')\n end", "def extract_basename(input)\n input.to_s.gsub(/^.*\\/([^\\/\\?]+).*$/, '\\1')\n end", "def name\n File.basename(absolute_path)\n end", "def file_name_from_path(path)\n path.split(\"/\")[-1]\n end", "def basename\n without_extension.delete_suffix(WIP_IDENTIFIER)\n .delete_suffix(DEV_IDENTIFIER)\n end", "def basename(path)\n File.basename(path)\n end", "def get_filename(url)\n parts = url.split('/')\n dirname = parts[-2]\n filename = parts[-1].split('.')[0] + \"_ocr.pdf\"\n '990s/' + dirname + '/' + filename\nend", "def file_name\n File.basename(image_src) unless remote? || image_src.nil?\n end", "def filename_base\n return '_'+basename if is_type_partial?\n basename\n end", "def filename\n if url\n url.match(%r{([^\\/]+\\z)})[0]\n else\n nil\n end\n end", "def base_name\n File.basename @relative_name\n end", "def intname\n @basename\n end", "def basename; end", "def basename; end", "def basename; end", "def basename; end", "def possible_sample_name(filename)\n filename.split('/').last.split('.').first\n end", "def getting_attachment_name\n url = self.attachment.url\n \"#{File.basename(url, '.*').truncate(15, :omission => '...')}.#{File.extname(url)}\" if url.present?\n end", "def file_name name\n File.basename(name).sub(/\\.[^\\.]*/, '')\n end", "def file_name name\n File.basename(name).sub(/\\.[^\\.]*/, '')\n end", "def basename(attachment, _style_name)\n File.basename(attachment.original_filename, \".*\")\n end", "def basename(file)\n File.basename(file, \".*\")\n end", "def base()\n sub_ext('').basename.to_s\n end", "def basename(*args) Path::Name.new(File.basename(path, *args)) end", "def file_suffix\n file_name.split('.').last \n end", "def filename\n File.basename(object.asset.path)\n end", "def infer_name_from_contents(obj, opts={})\n begin\n File.split(obj).last.split('.')[0..-2].join('.').titleize\n rescue\n nil\n end\n end", "def chop_basename(path)\n base = File.basename(path)\n if /\\A#{SEPARATOR_PAT}?\\z/o =~ base\n return nil\n else\n return path[0, path.rindex(base)], base\n end\n end", "def extract_name(file_path)\n if file_path[-1, 1] == \"/\"\n return nil\n end\n\n # File.basename is too eager to please and will return the last\n # component of the path even if it ends with a directory separator.\n ::File.basename(file_path)\n end", "def name\n name = nil\n if root?\n name = path.to_s\n else\n name = @path.basename.to_s\n end\n return name\n end" ]
[ "0.71994376", "0.6951703", "0.6906279", "0.68681073", "0.6795129", "0.6772939", "0.6714076", "0.67106754", "0.66917956", "0.6681591", "0.6680807", "0.66445214", "0.66301304", "0.66248095", "0.66248095", "0.6601679", "0.65960187", "0.6552587", "0.65388006", "0.65322244", "0.65145814", "0.6512853", "0.6485459", "0.647303", "0.6467459", "0.6463462", "0.64379", "0.6433431", "0.64259654", "0.64257526", "0.64199805", "0.64075243", "0.64050055", "0.6389723", "0.6384455", "0.63685775", "0.63445324", "0.6342756", "0.6340458", "0.6340458", "0.6340458", "0.632998", "0.6315636", "0.63134164", "0.6292737", "0.6277806", "0.62695074", "0.6265233", "0.62635183", "0.6256452", "0.6233576", "0.62262523", "0.6189684", "0.6187145", "0.61844933", "0.6167524", "0.61662465", "0.6147614", "0.6147614", "0.61464554", "0.61446655", "0.613487", "0.61337006", "0.6129804", "0.61084604", "0.6106734", "0.6104594", "0.6104594", "0.6103747", "0.6102105", "0.61013085", "0.60964566", "0.6096022", "0.60952747", "0.6090891", "0.60831773", "0.60673946", "0.6064291", "0.6063609", "0.605184", "0.60441005", "0.6039554", "0.60361457", "0.60361457", "0.60361457", "0.60361457", "0.6029582", "0.60220075", "0.6017804", "0.6017804", "0.6016712", "0.6014126", "0.6013998", "0.6012744", "0.6005189", "0.60019106", "0.5985607", "0.59804827", "0.5978578", "0.59770924" ]
0.799141
0
Deletes a resource by removing its identifying directory. Beware because this method doesn't care about other files which may coexist in the same filesystem branch.
def delete_completely(root, resource) path = File.join(root, resource.path(identifying_sym)) FileUtils.rm_rf(path) # removes the empty directories upward (resource.identifiers(identifying_sym).size - 1).times do |t| path = File.split(path).first begin FileUtils.rmdir(path) rescue Errno::ENOTEMPTY break end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_resource(resource, version)\n log.debug \"deleting resource #{resource} #{version}\"\n data_file = %W(#{@datadir} #{resource} #{version} #{resource.split('/')[-1]}).join('/')\n # delete either the file or directory from data dir\n File.delete data_file if File.file? data_file\n FileUtils.rm_rf data_file if File.directory? data_file\n end", "def delete\n FileUtils.remove_entry_secure(@directory)\n ObjectSpace.undefine_finalizer(self)\n rescue Errno::ENOENT\n end", "def destroy\n File.unlink(@resource[:path])\n Puppet.debug \"deleted file #{@resource[:path]}\"\n end", "def destroy\n notice \"Removing #{@resource_copy[:path]}\"\n FileUtils.rm_rf(@resource_copy[:path])\n end", "def delete\n FileUtils.rm(self.path) if exists?\n end", "def delete\n if stat.directory?\n FileUtils.rm_rf(file_path)\n else\n ::File.unlink(file_path)\n end\n ::File.unlink(prop_path) if ::File.exist?(prop_path)\n @_prop_hash = nil\n NoContent\n end", "def action_delete\n if (!dir_exists?(@path))\n Chef::Log::info(\"Directory #{ @path } doesn't exist; delete action not taken\")\n else\n converge_by(\"Delete #{ @new_resource }\") do\n @client.delete(@path)\n end\n new_resource.updated_by_last_action(true)\n end\n end", "def rm\n FileUtils.rm path if File.exist?(path)\n end", "def delete\n ::File.unlink(@path)\n end", "def action_delete\n if @current_resource.exist?\n converge_by \"Delete #{r.path}\" do\n backup unless ::File.symlink?(r.path)\n ::File.delete(r.path)\n end\n r.updated_by_last_action(true)\n load_new_resource_state\n r.exist = false\n else\n Chef::Log.debug \"#{r.path} does not exists - nothing to do\"\n end\n end", "def unlink_file\n unless is_placeholder_directory?\n FileUtils.rm path if File.file?(path)\n else\n FileUtils.rmdir path if Dir.entries(path) == [\".\", \"..\"]\n end\n end", "def delete\n File::unlink @path+\".lock\" rescue nil\n File::unlink @path+\".new\" rescue nil\n File::unlink @path rescue Errno::ENOENT\n end", "def action_remove\n app_dir = Chef::Resource::Directory.new(\"#{@current_resource.apps_dir}/#{@current_resource.app}\", run_context)\n app_dir.path(\"#{@current_resource.apps_dir}/#{@current_resource.app}\")\n app_dir.recursive(true)\n app_dir.run_action(:delete)\n new_resource.updated_by_last_action(app_dir.updated_by_last_action?)\n end", "def rm_r\n util.rm_r(path)\n end", "def remove(resource)\n resource.delete\n end", "def delete\n if (exists?)\n list.each do |children|\n children.delete\n end\n factory.system.delete_dir(@path)\n end\n end", "def delete\n File.delete fullpath\n dirname = File.dirname(fullpath)\n while dirname != root\n Dir.rmdir(dirname)\n dirname = File.dirname(dirname)\n end\n rescue Errno::ENOTEMPTY\n end", "def delete!\n exist!\n File.unlink @path\n @path = nil\n end", "def destroy\n FileUtils.rm_r(directory) if exist?\n end", "def delete(id)\n FileUtils.rm_r File.join(DOTDIR, id)\n end", "def delete\n File::unlink @path+\".lock\" rescue nil\n File::unlink @path+\".new\" rescue nil\n File::unlink @path rescue nil\n end", "def unlink!\n FileUtils.rm_rf(directory)\n end", "def delete(id)\n path = path(id)\n path.delete\n clean(path) if clean?\n rescue Errno::ENOENT\n end", "def destroy\n FileUtils.rm_r(@repository.path)\n end", "def remove\n dir = Pathname.new(path)\n syscmd(\"umount -f \\\"#{dir}\\\"\", valid_rcs: [32]) # 32 = not mounted\n File.unlink(readme_path) if File.exist?(readme_path)\n dir.rmdir if dir.exist?\n end", "def remove_resource(doc_path, res_path)\n @content_tree.remove_resource(doc_path, res_path)\n remove_metadata(resource_meta_path(doc_path, res_path), :resource)\n end", "def rm path\n end", "def destroy()\n\n path = self.get_dir\n FileUtils.remove_entry_secure(path, true)\n _clean_dir(File.dirname(path))\n\n super()\n end", "def delete!\n return true unless File.exist?(path)\n FileUtils.rm(path)\n end", "def delete\n FileUtils.rm_rf(to_s)\n self\n end", "def safe_delete\n FileUtils.remove_entry_secure(SafeDeletable.path_for(self).to_s)\n rescue Errno::ENOENT\n # noop\n end", "def unlink\n # Delete the directory\n @cleanup_proc.call\n\n # Undefine the finalizer since we're all cleaned up\n ObjectSpace.undefine_finalizer(self)\n end", "def destroy\n remove_files(@path + \"*\")\n end", "def destroy\n @repo = Repository.find(params[:id])\n\n\t\t#REMOVE FILE FROM FILE SYSTEM AND DO A GIT commit\n\t\tif(FileUtils.rm(params[:path]))\n\t\t\t@git = GitHelper.init(@repo.path, current_user.email, current_user.name)\n\t\t\tGitHelper.commitAll(@git, \"Removed file :: #{params[:path]}\")\n\t\tend\n end", "def delete_file(basepath = MP3_STORAGE_PATH)\n FileUtils.rm_rf(\"#{basepath}/#{id}\")\n end", "def delete\n path = @p.path\n File::unlink path\n end", "def unlink\n self.class.unlink(@path)\n end", "def remove_image_directory\n FileUtils.remove_dir(\"#{Rails.root}/public/uploads/service/image/#{id}\",\n force: true)\n end", "def delete_rdf_file\n public_path = public_rdf_storage_path\n private_path = private_rdf_storage_path\n FileUtils.rm(public_path) if File.exist?(public_path)\n FileUtils.rm(private_path) if File.exist?(private_path)\n end", "def rmdir() Dir.rmdir(path) end", "def delete_directory_or_file(dir_or_file)\n if File.exist?(dir_or_file)\n FileUtils.rm_rf(dir_or_file)\n end\n end", "def delete\n stop\n [ @resource['instances_dir'] + \"/\" + @resource[:name],\n @resource['instances_dir'] + \"/\" + \"_\" + @resource[:name]\n ].each do |dir|\n FileUtils.rm_rf(dir) if File.directory?(dir)\n end\n end", "def destroy(path)\n directory = connection.directories.get(self.bucket)\n directory ||= connection.directories.create(self.permissions.merge(:key => self.bucket))\n\n file = directory.files.get(path)\n file.destroy if file\n end", "def delete\n begin \n # file_assets\n file_assets.each do |file_asset|\n file_asset.delete\n end\n # We now reload the self to update that the child assets have been removed...\n reload()\n # Call ActiveFedora Deleted via super \n super()\n rescue Exception => e\n raise \"There was an error deleting the resource: \" + e.message\n end\n end", "def destroy_resource(resource_name, resource_id)\n must_support! resource_name.to_s.pluralize\n result = connection.delete(\n api_uri([resource_name.to_s.pluralize, resource_id].join('/'))\n )\n result.status.is_no_content?\n end", "def delete_file name\n filename = \"#{RAILS_ROOT}/#{@@dir}/#{name}\" \n File.delete filename if File.exists? filename\n end", "def rm(path)\n FileUtils.rm_rf(path)\n end", "def rmdir\n util.rmdir(path)\n end", "def cleanup\n FileUtils.rm_f(@path)\n delete\n end", "def delete\n if processable? or unset?\n dir.delete\n else\n raise JobError.cannot_delete(@id, state)\n end\n end", "def destroy_resource(resource)\n resource.destroy\n resource\n end", "def remove_directory(path)\n FileUtils.rm_rf(path)\n end", "def remove_directory(path)\n FileUtils.rm_rf(path)\n end", "def destroy\n delete_files_and_empty_parent_directories\n end", "def rm(path)\n remove(path, nil, true, false)\n end", "def remove_file(id)\n\n # Get file name\n file_name = \"#{Repository.data_dir}#{id}.json\"\n\n\t\t# Check if file exists\n\t\tif File.exists?(file_name)\n\t\t\t# if so delete\n\t\t\tFile.delete(file_name)\n\t\telse\n\t\t\tDebug.add(\"[WARNING] #{id}.json not found\")\n\t\tend\n end", "def remove\n base_dir = @spec.base_dir\n\n raise Gem::FilePermissionError, base_dir unless File.writable? base_dir\n\n FileUtils.rm_rf @rdoc_dir\n FileUtils.rm_rf @ri_dir\n end", "def remove\n base_dir = @spec.base_dir\n\n raise Gem::FilePermissionError, base_dir unless File.writable? base_dir\n\n FileUtils.rm_rf @rdoc_dir\n FileUtils.rm_rf @ri_dir\n end", "def destroy_file\n FileUtils.rm full_filename\n # remove directory also if it is now empty\n Dir.rmdir(File.dirname(full_filename)) if (Dir.entries(File.dirname(full_filename))-['.','..']).empty?\n rescue\n logger.info \"Exception destroying #{full_filename.inspect}: [#{$!.class.name}] #{$1.to_s}\"\n logger.warn $!.backtrace.collect { |b| \" > #{b}\" }.join(\"\\n\")\n end", "def destroy!\n FileUtils.rm_rf(self.path)\n end", "def destroy\n FileUtils.rm_rf(target)\n end", "def del\n File.delete(@file)\n end", "def delete_file_and_folder!( file_path )\n FileUtils.rm_f file_path\n boundary = adapter_path + '/'\n loop do\n file_path = File.dirname file_path\n break unless file_path.index boundary\n FileUtils.rmdir file_path\n end\n end", "def unlink(path)\n path = expand_path(path)\n if File.directory?(path)\n\tDir.unlink(path)\n else\n\tIO.unlink(path)\n end\n end", "def remove_from_storage(id)\n\t\traise \"[FATAL] Storage directory not set\" if Repository.data_dir.nil?\n\n\t\tremove_file(id)\n\tend", "def deleteResource(resourceId)\n r = Resource.find_by_id(resourceId)\n if r\n if not r.comments.empty?\n r.comments.each do |comment|\n comment.destroy\n end\n end\n r.destroy\n end\n end", "def rm(path)\n FileUtils.rm_rf(expand path)\n end", "def remove_id_directory\n orig_dir = File.expand_path(\"..\", Rails.root.to_s + \"/public\" + docfile_url)\n FileUtils.rm_rf(orig_dir)\n end", "def unlink!( target = path )\n delete_file_and_folder! target if target\n end", "def delete(path_info)\n @file_store.delete path_info\n\n @bucket.objects[gem_object_name(path_info)].delete\n end", "def delete_resource(type, name, run_context: self.run_context)\n delete_resource!(type, name, run_context: run_context)\n rescue Chef::Exceptions::ResourceNotFound\n nil\n end", "def delete(resource_path, headers: {}, prefix: API_PREFIX)\n request(method: :delete, resource_path: resource_path, headers: headers, prefix: prefix)\n end", "def destroy\n file&.delete\n end", "def delete_file\n File.unlink file\n end", "def delete_file\n File.unlink file\n end", "def destroy(full_path)\n\t\traise \"No.\" if full_path == '/'\n\t\tFileUtils.rm_rf(full_path)\n\trescue Errno::ENOENT\n\t\traise Rush::DoesNotExist, full_path\n\tend", "def unlink\n # keep this order for thread safeness\n begin\n File.unlink(@tmpname) if File.exist?(@tmpname)\n @@cleanlist.delete(@tmpname)\n @data = @tmpname = nil\n ObjectSpace.undefine_finalizer(self)\n rescue Errno::EACCES\n # may not be able to unlink on Windows; just ignore\n end\n end", "def delete_dir_contents(target_dir)\n Find.find(target_dir) do |x|\n if File.file?(x)\n FileUtils.rm(x)\n elsif File.directory?(x) && x != target_dir\n FileUtils.remove_dir(x)\n end\n end\n end", "def remove!\n FileUtils.rm(File.join(remote_path, remote_file))\n end", "def destroy\n run_callbacks :destroy do\n if directory?\n logger.info \"Delete directory at #{absolute_path}\"\n FileUtils.rmdir absolute_path\n else\n logger.info \"Delete file at #{absolute_path}\"\n # TODO if the file has added state (not committed), reset it to HEAD\n if status_file.untracked\n FileUtils.rm absolute_path\n else\n remove\n end\n end\n true\n end\n end", "def remove(path)\n obj = self\n chdir do\n super \n obj.git.rm({}, '-f', '-r', path)\n end\n end", "def delete_files\n return if id.nil?\n return unless File.exist?(directory_path)\n\n FileUtils.rm_rf(directory_path)\n s3_delete_files\n end", "def delete(filename)\n File.delete File.join(@base_path, filename)\n end", "def delete(resource_id)\n @delete_resource_mixin.delete(resource_id)\n end", "def remove_resource(name)\n self.resources.delete(name)\n end", "def cleanup_files(resource)\n remove_public_dir(resource) # where the local manifest file is stored\n remove_s3_data_files(resource)\n rescue StandardError => e\n msg = \"An unexpected error occurred when cleaning up files for resource #{resource.id}: \"\n msg << e.full_message\n logger.warn(msg)\n end", "def remove_file\n\n @source_files_id = params[:source] + '_files'\n @source = TaliaCore::Source.find(N::URI.from_encoded(params[:source]))\n\n TaliaFile.find(params[:talia_file_uri]).destroy\n end", "def rm(path)\n run_via \"rm #{path}\"\n end", "def destroy\n error = nil\n\n if @file.directory_id.nil?\n render_error \"Cannot remove root directory. Delete the project, instead.\"\n else\n begin\n ActiveRecord::Base.transaction do\n delete_file(@file, true);\n render json: \"\", serializer: SuccessSerializer\n end\n rescue\n render_error \"Files could not be deleted.\"\n end\n end\n end", "def destroy_file\n File.delete full_file_path\n rescue\n end", "def remove_file(path)\n FileUtils.rm_f(path)\n end", "def remove_file(path)\n FileUtils.rm_f(path)\n end", "def rmdir_ie path\n rmdir path if File.exist?(path)\n end", "def rm_r(*paths)\n paths.each do |path|\n path = File.expand_path path\n\n prefix = SPEC_TEMP_DIR\n unless path[0, prefix.size] == prefix\n raise ArgumentError, \"#{path} is not prefixed by #{prefix}\"\n end\n\n # File.symlink? needs to be checked first as\n # File.exists? returns false for dangling symlinks\n if File.symlink? path\n File.unlink path\n elsif File.directory? path\n Dir.entries(path).each { |x| rm_r \"#{path}/#{x}\" unless x =~ /^\\.\\.?$/ }\n Dir.rmdir path\n elsif File.exists? path\n File.delete path\n end\n end\n end", "def delete(name)\n File.delete(path(name))\n end", "def destroy_upload_dir\n dir = File.expand_path \"../\", file.path\n FileUtils.rm_rf dir\n end", "def rm(*args)\n helper.glob_to_index(args) do |index, relative_path, realpath|\n index.remove(relative_path.to_s)\n realpath.delete\n end\n\n self\n end", "def rm(path)\n file = scope.get(path)\n return if !file\n file.remove!\n end", "def destroy\n File.delete(temp_path)\n end", "def delete!\n @resource.delete!\n end" ]
[ "0.7220338", "0.7194757", "0.7046599", "0.6910714", "0.68933547", "0.6866147", "0.6803142", "0.6783311", "0.67278063", "0.6675271", "0.66724575", "0.6649787", "0.6591593", "0.6583341", "0.65817636", "0.6566799", "0.65550286", "0.65275675", "0.6526787", "0.65231776", "0.64757174", "0.6452285", "0.6429853", "0.638152", "0.6381095", "0.6364877", "0.63588953", "0.6351506", "0.63433486", "0.6328786", "0.6325084", "0.63201505", "0.63053715", "0.62665796", "0.62619114", "0.6240982", "0.62384933", "0.6231981", "0.6228246", "0.62243766", "0.6215349", "0.621188", "0.6208159", "0.6203167", "0.6186121", "0.61844444", "0.6174704", "0.61508125", "0.6140779", "0.612876", "0.61283356", "0.6127402", "0.6127402", "0.61200625", "0.61142045", "0.61090255", "0.60946417", "0.60946417", "0.6083727", "0.60815865", "0.60700893", "0.60582036", "0.60573786", "0.6038681", "0.6034536", "0.60336286", "0.60258096", "0.6021202", "0.6018696", "0.6017634", "0.6014261", "0.601285", "0.6011139", "0.60095006", "0.60095006", "0.60064393", "0.59985703", "0.59976715", "0.59906316", "0.5989257", "0.59662026", "0.59652215", "0.5961923", "0.59511155", "0.5928401", "0.59253263", "0.5919511", "0.5917549", "0.5913239", "0.591271", "0.5908455", "0.5908455", "0.5895895", "0.58955514", "0.58950007", "0.5894761", "0.5893836", "0.5886674", "0.58864117", "0.58823204" ]
0.6826526
6
Saves one or more resource at the filesystem path given at root This method is mainly an handy helper around batch_save, look at the source and at batch_save's doc
def save(root, resource, perspective=:default, exts=nil) exts ||= extensions batch_save(root, [resource].flatten, [perspective].flatten, [exts].flatten) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch_save(root, resources, persps, exts)\n batch_save_actions(root, resources, persps, exts) do |action|\n action.perform\n end\n end", "def batch_save_actions(root, resources, persps, exts)\n if block_given?\n resources.each do |resource|\n db_path = File.join(root, resource.path(identifying_sym))\n yield PrepareDirAction.new(db_path)\n exts.each do |ext|\n persps.each do |persp|\n basename = basename_for_persp_and_ext(persp, ext)\n resource_path = File.join(db_path, basename) \n yield StoreResourceAction.new(resource_path, resource, persp, ext)\n end\n end\n end\n else\n Enumerator.new(self, :batch_save_actions, root, resources, persps, exts)\n end\n end", "def save_to(path); end", "def save(resource_path, body)\n output_path = \"#{@output}/#{resource_path}\"\n return if File.exists? output_path\n required_dirs = File.dirname(output_path)\n FileUtils.mkdir_p(required_dirs) unless Dir.exists? required_dirs\n File.open(output_path, 'wb') do |fo|\n fo.write body\n end\n end", "def batch_save(batch_client)\n perform_save(batch_client)\n end", "def ar_save_resource\n @resource.save\n end", "def save\n resources = if loaded?\n entries\n else\n head + tail\n end\n\n # FIXME: remove this once the mutator on the child side\n # is used to store the reference to the parent.\n relate_resources(resources)\n\n resources.concat(@orphans.to_a)\n @orphans.clear\n\n resources.all? { |r| r.save }\n end", "def save_resource\n resource.save\n end", "def save_file_batch(files, new_obj_id)\n url = \"#{@base_url}/api/v2/files/#{new_obj_id}/create_batch\"\n resp = api_post_json(url, files.to_json)\n if resp.code != '201'\n @log.write(\"Error saving #{files.count} files #{files[0]['identifier']}...\\n\")\n @log.write(files.inspect)\n @log.write(\"\\n\" + resp.body + \"\\n\")\n #exit(1)\n end\n end", "def resource_save(resource, success_path, failure_path)\n if resource.save\n redirect_to success_path, notice: \"#{resource.class.name} saved successfully!\"\n else\n redirect_to failure_path, alert: resource.errors.full_messages\n end\n end", "def save(attrs=nil)\n raise \"a Hash of attributes to save must be specified\" unless attrs && attrs.is_a?(Hash)\n raise \"folder must be set prior to saving attributes\" unless folder\n\n # merge attributes to asset that contains parent attributes\n @asset.attributes.merge!(attrs)\n\n # load contents of the user folder and merge in attributes passed to save\n # so that we don't save parent attributes\n contents = {}\n if File.exists?(folder)\n contents = load_contents(folder)\n raise \"expected contents to be a hash\" unless contents.is_a?(Hash)\n end\n\n contents = contents.merge!(attrs)\n write_contents(folder, contents)\n end", "def save(bulk = false)\n raise ArgumentError, \"doc.database required for saving\" unless database\n result = database.save_doc self, bulk\n result['ok']\n end", "def bulk_save(docs)\n server.post(\"#{name}/_bulk_docs\", {:docs => docs})\n end", "def save!\n resource.save!\n end", "def save\n all_files.each{ |file| parse_and_save(file) }\n end", "def save_many(collection)\n collection.each do |data|\n save(data)\n end\n end", "def save!; File.write @path, @data end", "def save_paths(result_root, user)\n\tpaths_file = \"/lkp/paths/#{Time.now.strftime('%F')}-#{user}\"\n\n\t# to avoid confusing between .../1 and .../11, etc. when search/remove, etc.\n\tresult_root += '/' unless result_root.end_with?('/')\n\n\tFile.open(paths_file, \"a\") { |f|\n\t\tf.puts(result_root)\n\t}\nend", "def save\n repository.create_contents(path, \"Upload #{path}\", content)\n end", "def save\n # Only save\n if @__mutated__ && !@__mutated__.empty?\n data = Hash[@__mutated__.map { |k| [k, @data[k]] }]\n\n res = put resource_name, id, {resource_name_singular => data}\n\n return res if res.error\n\n res_data = res.__send__(resource_name_singular)\n @data.merge!(res_data)\n @__mutated__.clear\n end\n\n self\n end", "def save(*_)\n end", "def save!(chroot=nil)\n self.root = chroot if chroot\n super\n end", "def save_save_list\n save_list.each do |obj|\n obj.save!\n end\n end", "def after_save\n super rescue nil\n unless (@tempfile_path.nil? || @tempfile_path.empty?)\n stash_path = file_root(true)\n D::mkdir(stash_path) unless F::exist?(stash_path)\n @tempfile_path.each do |k,v|\n url = file_path(k, nil, true)\n destroy_files_for(k, url) # Destroy previously saved files\n FU.move(v, url) # Save the new one\n FU.chmod(0777, url)\n after_stash(k)\n end\n # Reset in case we access two times the entry in the same session\n # Like setting an attachment and destroying it in a row\n # Dummy ex: Model.create(:img => file).update(:img => nil)\n @tempfile_path = nil\n end\n end", "def find_and_save(path=\".\")\n File.directory?(path) || Dir.mkdir(path)\n find.each do |source|\n source[:images].each do |image|\n @@logger.debug(\"Saving #{image[:image]}\")\n open(File.join(path, image[:image].split('/').last), \"wb\") { |file|\n file.write(open(image[:image]).read)\n }\n end\n end\n end", "def save(validate = true)\n return false if validate && ! valid?\n\n if @last_saved_file_path != path && @last_saved_file_path&.file?\n manager.delete_path(@last_saved_file_path)\n end\n\n manager.write(self)\n end", "def save_path_tree\n file = File.open(DATA_STORE, 'w')\n file.write path_tree.dump.to_json\n file.close\n end", "def after_update\r\n\t\t\tself.children.each do |child|\r\n\t\t\t\tchild.path = self.path + '/' + child.filename\r\n\t\t\t\tchild.save\r\n\t\t\tend\r\n\t\tend", "def save(validate = true)\n return false if validate && ! valid?\n\n if @last_saved_file_path != path && @last_saved_file_path.file?\n manager.delete_path(@last_saved_file_path)\n end\n\n manager.write(self)\n end", "def after_update\n\t\t\tself.children.each do |child|\n\t\t\t\tchild.path = self.path + '/' + child.filename\n\t\t\t\tchild.save\n\t\t\tend\n\t\tend", "def save(bulk = false)\n caught = catch(:halt) do\n if self.new?\n _run_save_callbacks do\n save_without_callbacks(bulk)\n end\n else\n update(bulk)\n end\n end\n end", "def save\n file_path = self.class.file_path(@save_id)\n File.open(file_path, 'w') { |file| \n bytes = file.write @items.inspect\n if bytes > 0\n puts \"saved to #{file_path}\"\n else\n puts \"save to #{file_path} failed\"\n end\n }\n end", "def save! target=\"./Albums\"\n dirname = File.join target, @name\n FileUtils.mkdir_p dirname\n\n self.photos{|p| p.save! dirname}\n end", "def save\n on_each_node :save\n end", "def run_after_save\n return if append_id.blank?\n return if post_save_resource.id == append_id\n remove_from_old_parent\n add_to_new_parent\n # Re-save to solr unless it's going to be done by save_all\n persister.save(resource: post_save_resource) unless transaction?\n end", "def _save_to_store\n self._warnings = []\n _commit_externals \n __pack.commit # TODO: need to add some error catching and roll back the external saves where needed\n end", "def perform_save(batch_client)\n check_instance_method_existance!(:save)\n\n if new_record?\n self.class.perform_create(client, batch_client, attributes)\n else\n perform_update(batch_client, attributes)\n end\n end", "def save(dir)\n # Ruta dataset\n dataset_path = \"#{dir}/#{@name}/%s_#{@memory}\"\n\n # Rutas de archivos para el dataset\n sample_file = dataset_path % 'sample'\n summary_file = dataset_path % 'summary'\n count_file = dataset_path % 'count'\n\n # Se prepara el directorio que contendrá resultados, a no ser que exista\n unless File.exists?(\"\")\n status \"Creating directory #{dir}/#{@name}\", \"mkdir -p #{dir}/#{@name}\"\n end\n\n save_sample sample_file \n save_summary summary_file\n save_count count_file\n end", "def persist!\n erase_old_resource\n final_parent << source\n @persisted = true\n end", "def batch_store(uuids)\n body = uuids.to_json\n put(uri: '/files/storage/', content: body)\n end", "def _store_path(root, path, value = nil)\n return if path.nil? || target?(path, root)\n\n value ||= prepare(root, path)\n\n if path.directory?\n _store(Path.rpartition(path, target)[-1], value)\n else\n _store(path, value)\n end\n end", "def save *args\n @save = args.first if args.size > 0\n end", "def save\n self.attributes =\n if persisted?\n PROXY.patch(\"#{resources_name}/#{id}\", attributes)\n else\n @persisted = true\n PROXY.post(resources_name, attributes)\n end\n end", "def save\n files = MyBiaDJ::Table(:files)\n record = files.create(:path => relative_path, :name => name)\n tracks.each do |track|\n track.save(record) if track.mp3?\n end\n end", "def save\n if !persisted? \n if @contents\n gps = EXIFR::JPEG.new(@contents).gps\n @location = Point.new(:lng => gps.longitude, :lat => gps.latitude)\n \n @contents.rewind # Reposition read location to beggining of file\n \n grid_file = Mongo::Grid::File.new(@contents.read, get_description) # Unsaved gridfs file\n\n # Store file to mongo db\n id = self.class.mongo_client.database.fs.insert_one(grid_file)\n\n @id = id.to_s\n end\n else\n file = self.class.mongo_client.database.fs.find(_id: BSON::ObjectId.from_string(@id))\n file.update_one(get_description)\n end\n end", "def save(bulk = false)\n set_unique_id if new_document? && self.respond_to?(:set_unique_id)\n result = database.save_doc(self, bulk)\n result[\"ok\"] == true\n end", "def save_file\n\t\tif file\n\t\t\tdocuments.create({\n\t\t\t\t:uploaded_file => file,\n\t\t\t\t:user_id => user_id\n\t\t\t})\n\t\tend\n\t\t#`cp \"#{file.path}\" \"#{path}\"` if file\n\tend", "def save(options = {})\n save_to(@path, options)\n end", "def save_as(path)\n generate.save_as(path)\n end", "def save_as(path)\n generate.save_as(path)\n end", "def save doc\n if doc['_attachments']\n doc['_attachments'] = encode_attachments(doc['_attachments'])\n end\n if doc['_id']\n slug = CGI.escape(doc['_id'])\n CouchRest.put \"#{@root}/#{slug}\", doc\n else\n CouchRest.post \"#{@root}\", doc\n end\n end", "def save(record)\n track = MyBiaDJ::Table(:files).create(:name => name, :path => relative_path)\n track.add_parent(record)\n track\n end", "def perform_save\n api.bucket_save(self)\n end", "def save_file_array(input_obj_array)\n\tinput_obj_array.each {|each_obj| save_file(each_obj)}\nend", "def save\n @data.map(&:save)\n end", "def save\n objects.each do |object|\n object['request_id'] = request_id\n\n puts \"Processing object #{object}\"\n\n if object['id'].size > 11\n object['id'] = object['id'].split(//).last(11).join\n end\n\n next unless valid_object?(object)\n prepare_objects_before_save(object)\n\n # If an alternate customer email is specified in flow params (should be order flows only)\n # then update to that email and generic customer billing and shipping info\n if use_customer_email_param?\n object[:email] = @config[:quickbooks_customer_email]\n end\n\n # Get rid of empty addresses\n unless payload_key == 'journal'\n [:shipping_address, :billing_address].each do |address_type|\n if object[address_type].nil? || object[address_type].empty?\n object[address_type] = generic_address\n end\n end\n end\n\n if two_phase?\n file = \"#{path.base_name}/#{path.two_phase_pending}/#{payload_key.pluralize}_#{id_of_object(object)}_.json\"\n amazon_s3.export file_name: file, objects: [object]\n generate_inserts_for_two_phase(object, use_customer_email_param?)\n else\n file = \"#{path.base_name}/#{path.pending}/#{payload_key.pluralize}_#{id_of_object(object)}_.json\"\n amazon_s3.export file_name: file, objects: [object]\n end\n generate_extra_objects(object)\n end\n end", "def save_in(root_directory)\n directory = File.absolute_path(directory_path, root_directory)\n path = File.absolute_path(filename, directory)\n # ensure that the file_path is within the root_directory, in case there are '../' portions in the path\n unless path.to_s.match /\\A#{root_directory}/\n raise \"destination file path “#{path}” does not match containing directory #{root_directory}\"\n end\n # ensure the destination directory exists:\n FileUtils.mkdir_p File.dirname(path)\n File.open(path, 'w') do |file|\n file.write(content)\n end\n path\n end", "def save\n load_cache\n\n all_classes_and_modules.each do |klass|\n save_class klass\n\n klass.each_method do |method|\n save_method klass, method\n end\n\n klass.each_attribute do |attribute|\n save_method klass, attribute\n end\n end\n\n all_files.each do |file|\n save_page file\n end\n\n save_cache\n end", "def save(processed_map=ObjectMap.new) # use that in Reform::AR.\n processed_map[self] = true\n\n pre_save = self.class.pre_save_representer.new(self)\n pre_save.to_hash(:include => pre_save.twin_names, :processed_map => processed_map) # #save on nested Twins.\n\n\n\n # what we do right now\n # call save on all nested twins - how does that work with dependencies (eg Album needs Song id)?\n # extract all ORM attributes\n # write to model\n\n sync_attrs = self.class.save_representer.new(self).to_hash\n # puts \"sync> #{sync_attrs.inspect}\"\n # this is ORM-specific:\n model.update_attributes(sync_attrs) # this also does `album: #<Album>`\n\n # FIXME: sync again, here, or just id?\n self.id = model.id\n end", "def create\n # Сохраняем данные из загруженного файла\n # Инициализируем объект Batch с параметрами\n @batch = Batch.new(batch_params)\n # Загруженный файл\n uploaded_io = params[:batch][:batch_file]\n @file_path = \"/public/uploads/#{uploaded_io.original_filename}\"\n @xml_file = File.new(Rails.root.join('public', 'uploads', uploaded_io.original_filename))\n # Создаем новый документ XML. Выбираем интересующие нас элементы по имени/шаблону\n @xml_doc = Document.new(@xml_file)\n @root = @xml_doc.root\n @file_attribute_guid = @root.elements[\"FileAttribute/GUID\"]\n # Берем содержимое ноды\n @batch.guid = @file_attribute_guid.text\n\n # Ищем загруженный файл в базе по GUID\n @existing_batch = Batch.find_batch_by_guid(@batch.guid)\n\n if @existing_batch != nil\n # Если файл существует, не сохраняем его данные\n @guid_error = \"Batch file with GUID provided already exists in database\"\n else\n # Файл не найден в базе, обрабатываем его данные\n @batch_id_data = @root.elements[\"FileData/Batch/BatchID\"]\n @batch.batch_id = @batch_id_data.text\n @batch_creation_date_data = @root.elements[\"FileData/Batch/CreationDate\"]\n @batch.creation_date = @batch_creation_date_data.text\n @batch.batch_file = @file_path\n # Сохраняем данные загруженного файла в базу\n @batch.save\n\n # Для каждой ноды \"Invoice\" внутри \"FileData\" сохраняем её данные в соответствующую таблицу БД\n @root.elements.each(\"FileData/Invoice\") do |invoice|\n @invoice = @batch.invoices.create(\n invoice_operation_number: invoice.elements[\"InvoiceOperation/InvoiceOperationNumber\"].text,\n invoice_operation_date: invoice.elements[\"InvoiceOperation/InvoiceOperationDate\"].text,\n company_code: invoice.elements[\"InvoiceOperation/CompanyCode\"].text,\n )\n # Сохраняем Инвойс\n @invoice.save\n # Теперь повторяем то же самое для каждого товара в инвойсе\n # Выбираем ноды \"InvoiceData\" внутрни инвойса и сохраняем их данные в таблицу invoice_data_items\n invoice.elements.each(\"InvoiceData\") do |invoice_data_item|\n @invoice_data_item = @invoice.invoice_data_items.create(\n parcel_code: invoice_data_item.elements[\"ParcelCode\"].text,\n item_qty: invoice_data_item.elements[\"ItemQty\"].text,\n parcel_price: invoice_data_item.elements[\"ParcelPrice\"].text,\n )\n # Сохраняем данные в БД\n @invoice_data_item.save\n end\n end\n end\n\n respond_to do |format|\n if @existing_batch != nil\n # Если файл с данным GUID уже существует в базе, возвращаемся к списку загрузок и выводим соответствующее предупреждение\n format.html { redirect_to batches_url, alert: @guid_error }\n format.json { head :no_content }\n else\n # Если сохранение объекта Batch прошло удачно, переходим на страницу показа и показываем соответствующее сообщение\n if @batch.save\n format.html { redirect_to @batch, notice: 'Batch was successfully uploaded.' }\n format.json { render :show, status: :created, location: @batch }\n else\n # В противном случае, остаемся на странице загрузки данных и показываем сообщение об ошибке\n format.html { render :new }\n format.json { render json: @batch.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def save *entities\n @commit.save(*entities)\n # Do not save yet\n entities\n end", "def store_in_batch(batch)\n batch.set(firestore_doc_id, serialized_for_firestore)\n end", "def save\n pathname.open('w') { |file| file.write(data) }\n end", "def save!\n no_recursion do\n _sq_around_original_save do\n super if defined?(super)\n end\n\n save_queue.save!\n end\n end", "def save\n valid? && upload and distribute\n end", "def save_shapefiles\n\t\t@files = []\n\n\t\t@shapefiles.each do |file|\n\t\t\tshapefile = file.tempfile.read\n\t\t\tshapefile_name = file.original_filename\n\t\t\t@files << shapefile_name\n\t\t\tFile.open(File.join(Rails.root, 'tmp', shapefile_name), 'wb') { |f| f.write shapefile }\n\t\tend\n\tend", "def cmd_save argv\n setup argv\n e = @hash['elements']\n filepath = @hash['filepath'] || \"config.json\"\n response = @api.save(e, filepath)\n msg response\n return response\n end", "def store(recursive=false)\n files_to_store = new_files(recursive)\n files_to_store.each do |filename|\n file = File.new(filename)\n store_file(file, filename)\n end\n end", "def save(flatten: false)\n tmp_file = SecureRandom.uuid\n save_as(tmp_file, flatten: flatten)\n File.rename tmp_file, @file_path\n end", "def save(file, path)\n file = File.open(file.path)\n\n directory = connection.directories.get(self.bucket)\n directory ||= connection.directories.create(self.permissions.merge(:key => self.bucket))\n\n directory.files.create(self.options(path).merge(self.permissions.merge(:key => path, :body => file)))\n\n file.close\n end", "def save\n generate_archive(generate_content_types, generate_rels, generate_document)\n end", "def save\n self.queue.each do |style, file|\n path = self.path(style)\n self.storage.save(file, path) if file and path\n end\n self.purge.each do |path|\n self.storage.destroy(path)\n end\n @purge = []\n @queue = {}\n end", "def save(path = @path)\n Ops.atomic_write(path) do |io|\n marshalled_package_sets = each_package_set.map do |pkg_set|\n set = pkg_set.to_h.transform_keys(&:to_s)\n set[\"package_set\"] = set[\"name\"]\n set\n end\n marshalled_packages = each_package.map do |pkg|\n pkg.to_h.transform_keys(&:to_s)\n end\n io.write YAML.dump(marshalled_package_sets + marshalled_packages)\n end\n end", "def save\n timeout_retry(3, 3){\n write \"SAVE\\r\\n\"\n status_code_reply\n }\n end", "def save(merge = T.unsafe(nil), file = T.unsafe(nil)); end", "def save(merge = T.unsafe(nil), file = T.unsafe(nil)); end", "def store_files(uuids)\n Uploadcare::FileList.batch_store(uuids)\n end", "def update\n @resource = params[:content]\n\n\t\tif params[:dir_path] == \"/\"\n\t\t\tparams[:dir_path]=\"\"\n\t\tend\n\n\t\tfile_path = \"#{params[:dir_path]}/#{params[:filename]}\"\n\n if File.open(file_path, 'w') {|f| f.write(params[:content]) }\n\t\t\tDir.chdir(params[:dir_path])\n\t\t\t@git = Git.init()\n\t\t\tGitHelper.commitAll(@git, params[\"comment\"])\n\n\t\t\trender json: {success: \"file successfully uploaded\"}\n else\n render json: { error: \"SOMETHING WENT WRONG SAVING RESOURCE\" }\n end\n end", "def save!\n if save\n self\n else\n raise FileNotSaved\n end\n end", "def save\n self.id = (10 + Random.rand(99))\n FileOperations.add(self)\n puts 'Successfully Added'\n end", "def save_resource(data, path=nil)\n\t\tpath ||= File.join(Msf::Config.config_directory, 'msfconsole.rc')\n\n\t\tbegin\n\t\t\trcfd = File.open(path, 'w')\n\t\t\trcfd.write(data)\n\t\t\trcfd.close\n\t\trescue ::Exception\n\t\tend\n\tend", "def save(path, mode = ::File::WRONLY|::File::CREAT|::File::TRUNC, **options)\n\t\t\t\t\tif @body\n\t\t\t\t\t\t::File.open(path, mode, **options) do |file|\n\t\t\t\t\t\t\tself.each do |chunk|\n\t\t\t\t\t\t\t\tfile.write(chunk)\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\tend", "def register_batch(valid: true)\n # TODO: Save dir\n br = BatchRegistries.new(\n user_id: @current_package.user.id,\n dir: @current_package.dir,\n file_name: @current_package.title,\n collection: @current_package.collection.id,\n error: !valid,\n complete: false,\n locked: true\n )\n br.save\n br\n end", "def save(file_or_stream)\n output = file_or_stream\n\n if output.is_a? String\n @root = Pathname.new(File.dirname(File.expand_path(output)))\n output = File.open(output, 'w')\n else\n @root = Pathname.new(File.expand_path(\".\"))\n end\n\n @files.each do |f|\n output.puts(merge(f))\n end\n\n output.close if file_or_stream.is_a? String\n end", "def save_everything\r\n\t\tself.pictures = ImageAsset.where(attachable_id: self.id, attachable_type: \"Product\")\r\n\t\tself.pictures.each do |asset|\r\n\t\t\tasset.product_id = self.id\r\n\t\t\tasset.user_id = self.user.id\r\n\t\t\tasset.save!\r\n\t\tend\r\n\t\tif !self.pictures.empty?\r\n\t\t\tself.product_pic = self.pictures.last\r\n\t\tend\r\n\t\tself.feature_groups.each do |f|\r\n\t\t\tf.product = self\r\n\t\t\tf.product_id = self.id\r\n\t\t\tf.save!\r\n\t\tend\r\n\t\t\r\n\tend", "def puts_to(path,params,opts={},&block) #:nodoc: \n crud_to(:put,path,params,opts,&block)\n end", "def save_file\n if Rails.configuration.file_storage_method == \"fs\"\n FileSaver.save_to_fs annotation.uuid, path, content\n elsif Rails.configuration.file_storage_method == \"s3\"\n FileSaver.save_to_s3 annotation.uuid, path, content\n else\n raise \"Illegal file storage method #{Rails.configuration.file_storage_method}\"\n end\n end", "def save\n if !persisted?\n gps=EXIFR::JPEG.new(@contents).gps\n @location=Point.new(:lng=>gps.longitude,:lat=>gps.latitude)\n @contents.rewind\n\n description = {}\n description[:content_type]='image/jpeg' \n description[:metadata]={:location=>@location.to_hash} \n\n grid_file = Mongo::Grid::File.new(@contents.read,description)\n @id=Photo.mongo_client.database.fs.insert_one(grid_file).to_s\n end \n\tend", "def save(*args, &block)\n super\n # begin\n # require 'restclient'\n # server[\"/instances/#{instance_id}\"].put(to_json)\n # rescue Exception => e\n # Metavirt::Log.error \"cloudkit fail:\\n\\t#{e.inspect}\"\n # end\n self\n end", "def save_game\n Dir.mkdir(\"../saves\") unless Dir.exists?(\"../saves\")\n @@save_count += 1\n binding.pry\n log_saves\n savefile = \"../saves/save_#{@@save_count}.yml\"\n File.open(savefile, 'w') do | file |\n file.write(self.to_yaml)\n end\n end", "def save; end", "def save; end", "def save; end", "def save; end", "def save; end", "def save; end", "def save; end", "def save; end", "def save_objects(objects, request_options = {})\n batch(build_batch('updateObject', objects, true), request_options)\n end", "def save_to_s3(entity_results)\n entity_results.each do |entity, local_path|\n if local_path && !local_path.empty?\n save_data(entity, local_path)\n else\n $log.warn \"No data was returned for entity #{entity.name}.\" unless local_path\n end\n end\n end" ]
[ "0.7635338", "0.66243577", "0.6067034", "0.5931464", "0.5767577", "0.56464463", "0.55878687", "0.55527407", "0.55380166", "0.5491703", "0.5483698", "0.54705024", "0.5463142", "0.54473186", "0.5441242", "0.5434289", "0.54005474", "0.5372312", "0.5358823", "0.5355736", "0.5351905", "0.5347541", "0.5347493", "0.5338926", "0.5312501", "0.5297844", "0.52911305", "0.52885556", "0.5286412", "0.5259177", "0.52494586", "0.5230171", "0.5216566", "0.5212025", "0.52035123", "0.5195436", "0.5183499", "0.5182109", "0.5182018", "0.51701707", "0.51634777", "0.5141688", "0.5135806", "0.51233447", "0.5110013", "0.5105326", "0.5095148", "0.50870955", "0.5085898", "0.5085898", "0.5073591", "0.50643224", "0.5057599", "0.50562346", "0.5047595", "0.5045729", "0.50444794", "0.50392324", "0.50360656", "0.50342023", "0.5017891", "0.500921", "0.5007266", "0.49938777", "0.49724966", "0.49675703", "0.49617928", "0.4935622", "0.4935438", "0.49297404", "0.49148867", "0.4913842", "0.4913103", "0.49026778", "0.4901054", "0.4899934", "0.48988858", "0.48949978", "0.4890279", "0.4886733", "0.48856014", "0.48810992", "0.4873934", "0.4873415", "0.48682925", "0.48588085", "0.48580027", "0.4849257", "0.48481095", "0.48413175", "0.4831378", "0.4831378", "0.4831378", "0.4831378", "0.4831378", "0.4831378", "0.4831378", "0.4831378", "0.48301074", "0.48239362" ]
0.6817243
1
Saves all the resources, under all the perspectives persps, and all format given by extensions exts at the filesystem path root. resources, perps, exts, must respond to :each, like for Enumerable
def batch_save(root, resources, persps, exts) batch_save_actions(root, resources, persps, exts) do |action| action.perform end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch_save_actions(root, resources, persps, exts)\n if block_given?\n resources.each do |resource|\n db_path = File.join(root, resource.path(identifying_sym))\n yield PrepareDirAction.new(db_path)\n exts.each do |ext|\n persps.each do |persp|\n basename = basename_for_persp_and_ext(persp, ext)\n resource_path = File.join(db_path, basename) \n yield StoreResourceAction.new(resource_path, resource, persp, ext)\n end\n end\n end\n else\n Enumerator.new(self, :batch_save_actions, root, resources, persps, exts)\n end\n end", "def save(root, resource, perspective=:default, exts=nil)\n exts ||= extensions\n batch_save(root, [resource].flatten, [perspective].flatten, [exts].flatten)\n end", "def save\n all_files.each{ |file| parse_and_save(file) }\n end", "def save\n load_cache\n\n all_classes_and_modules.each do |klass|\n save_class klass\n\n klass.each_method do |method|\n save_method klass, method\n end\n\n klass.each_attribute do |attribute|\n save_method klass, attribute\n end\n end\n\n all_files.each do |file|\n save_page file\n end\n\n save_cache\n end", "def upload_all_resources\n upload_conformance_resources\n upload_sample_resources\n retry_failed_upload\nend", "def write\n self.mounting_point.content_types.each do |filename, content_type|\n self.output_resource_op content_type\n\n self.open_file(\"app/content_types/#{filename}.yml\") do |file|\n file.write(content_type.to_yaml)\n end\n\n self.output_resource_op_status content_type\n end\n end", "def save\n resources = if loaded?\n entries\n else\n head + tail\n end\n\n # FIXME: remove this once the mutator on the child side\n # is used to store the reference to the parent.\n relate_resources(resources)\n\n resources.concat(@orphans.to_a)\n @orphans.clear\n\n resources.all? { |r| r.save }\n end", "def save_everything\r\n\t\tself.pictures = ImageAsset.where(attachable_id: self.id, attachable_type: \"Product\")\r\n\t\tself.pictures.each do |asset|\r\n\t\t\tasset.product_id = self.id\r\n\t\t\tasset.user_id = self.user.id\r\n\t\t\tasset.save!\r\n\t\tend\r\n\t\tif !self.pictures.empty?\r\n\t\t\tself.product_pic = self.pictures.last\r\n\t\tend\r\n\t\tself.feature_groups.each do |f|\r\n\t\t\tf.product = self\r\n\t\t\tf.product_id = self.id\r\n\t\t\tf.save!\r\n\t\tend\r\n\t\t\r\n\tend", "def submission_files=(files)\n ensure_file_open!\n remove_folder_files(SUBMISSION_PATH)\n\n files.each do |path, file|\n path = Pathname.new(path) unless path.is_a?(Pathname)\n raise ArgumentError, 'Paths must be relative' unless path.relative?\n\n @file.get_output_stream(SUBMISSION_PATH.join(path)) do |stream|\n stream.write(file)\n end\n end\n end", "def store(recursive=false)\n files_to_store = new_files(recursive)\n files_to_store.each do |filename|\n file = File.new(filename)\n store_file(file, filename)\n end\n end", "def add_resources!\n return unless exhibit.published?\n\n add_exhibit_root\n add_pages\n add_resources\n add_browse_categories\n end", "def manage_resources(resources)\n resources.map {|r| manage_resource(r) }\n end", "def manipulate_resource_list(resources)\n resources + options[:targets].map do |t|\n StaticResource.new(\n app.sitemap,\n t[:output]\n ) { \n File.read(File.expand_path(tmp_path(t), app.root))\n }\n end\n end", "def import_resources\n # for each resource type, look for a file of measurement data\n Report.plugin_matrix.each do |resource_name, measurements|\n model = Object.const_get((resource_name + 'Resource').camelcase(:upper))\n model.unrestrict_primary_key\n iterate_lines(@directory + resource_name + '.json') do |idx, line|\n print \"\\rImporting #{resource_name}: #{idx}...\"\n\n resource = JSON.parse(line)\n resource.each do |key, value|\n value = update_date(value, @date_offset)\n resource[key] = value unless value.nil?\n end\n model.create(resource)\n end\n model.restrict_primary_key\n print \"Done\\n\"\n import_measurements(measurements)\n end\n end", "def save_save_list\n save_list.each do |obj|\n obj.save!\n end\n end", "def save\n open @config_path, 'w' do |io|\n io.write({'files' => @files.collect(&:to_hash)}.to_yaml)\n end\n end", "def characterize(save: true)\n [:original_file, :intermediate_file, :preservation_file].each do |type|\n target_file = @file_set.try(type)\n next unless target_file\n @file_object = Valkyrie::StorageAdapter.find_by(id: target_file.file_identifiers[0])\n new_file = target_file.new(file_characterization_attributes.to_h)\n @file_set.file_metadata = @file_set.file_metadata.select { |x| x.id != new_file.id } + [new_file]\n end\n @file_set = persister.save(resource: @file_set) if save\n @file_set\n end", "def sync_languages(languages, save_to = \"#{__dir__}\")\n validate\n languages.each { |language|\n self.sync_language(language, save_to)\n }\n end", "def save_attached_files; end", "def save_attached_files; end", "def save_all\n reports = to_h\n reports.each do |file, report|\n File.write(file, report)\n end\n\n reports.keys\n end", "def write_all\n only = parameters[:only].try(:map) do |name|\n \"#{name}_writer\".camelize\n end.try(:insert, 0, 'SiteWriter')\n\n self.writers.each do |klass|\n next if only && !only.include?(klass.name.demodulize)\n writer = klass.new(self.mounting_point, self)\n writer.prepare\n writer.write\n end\n end", "def add_resources\n exhibit.solr_documents.each do |d|\n sitemap.add sitemap.exhibit_solr_document_path(exhibit, d), priority: 0.25, lastmod: document_last_modified(d)\n end\n end", "def save_many(collection)\n collection.each do |data|\n save(data)\n end\n end", "def rewrite_resources\n replacements = {}\n self.file_mapper.new_names.values.each do |record|\n replacements[record.old_name] = record.name\n end\n self.file_mapper.new_names.values.each do |record|\n record.resave(replacements)\n end\n end", "def writePosts\n\t\t\t@posts.each do |post|\n\t\t\t\tpost.writePostToFile\n\t\t\tend\n\t\tend", "def save(request)\n require 'pp'\n if catalog = request.instance\n catalog.vertices.each do |r|\n if r.exported?\n #TODO: think the following is ways to get the higher level component\n component = calling_class_or_def_name(catalog,r)\n rsc_title = r.title\n content = r.to_pson_data_hash\n pp([\n :calling_save,\n {:resource_title => rsc_title, \n :component => component,\n :content => content\n }])\n p = Thread.current[:exported_resources] ||= Hash.new\n (p[component] ||= Hash.new)[rsc_title] = content \n end\n end\n end\n catalog\n end", "def install_resources\n FileUtils.rm_rf(resources_dir)\n FileUtils.mkdir_p(resources_dir)\n resources.each { |file| install_resource(file, resources_dir) }\n end", "def save_all\n return if @loading_data\n\n json_data = JSON.dump(@model.to_h)\n\n LocalStorage['volt-store'] = json_data\n end", "def save_resource\n resource.save\n end", "def characterize(save: true)\n [:original_file, :intermediate_file, :preservation_file].each do |type|\n target_file = @file_set.try(type)\n next unless target_file\n @file_object = Valkyrie::StorageAdapter.find_by(id: target_file.file_identifiers[0])\n next unless image_valid?\n new_file = target_file.new(file_characterization_attributes.to_h)\n @file_set.file_metadata = @file_set.file_metadata.select { |x| x.id != new_file.id } + [new_file]\n end\n @file_set = persister.save(resource: @file_set) if save\n @file_set\n end", "def collect_resources\n logger.info \"Collecting resources from #{configuration.resource_path}\" do\n Dir.glob(File.join(configuration.resource_path, \"*.rb\")).each do |file|\n @run_context.add_resource_from_file ResourceFile.new(file)\n end\n end\n end", "def write\n @selected_files.each do |file|\n file.write(file.path)\n end\n end", "def build(resources)\n current = [] || YAML.load_file(path)\n\n resources.each do |resource|\n item = {}\n item['path'] = resource\n item['modified'] = File.mtime(resource).to_s\n item['processed'] = Time.now.to_s\n\n current << item\n end\n\n current\n end", "def save_files\n @law_h = [:law, :link, :section]\n @case_h = [:case, :link, :date]\n\n # Parse into hashes\n @single_matches = @single_matches-@double_matches\n case_hash = @double_matches.map{|i| {@case_h[0] => i[0], @case_h[1] => i[1], @case_h[2] => i[2]}}\n law_hash = @single_matches.map{|i| {@law_h[0] => i[0], @law_h[1] => i[1], @law_h[2] => i[2]}}\n \n # Write files\n write_files(case_hash, law_hash)\n end", "def write_posts\n posts.each do |p|\n # TODO allow user to specify which layouts a post should use \n p.render(layouts)\n p.write(File.join(destination_path, \"posts\"))\n end\n end", "def find_and_save(path=\".\")\n File.directory?(path) || Dir.mkdir(path)\n find.each do |source|\n source[:images].each do |image|\n @@logger.debug(\"Saving #{image[:image]}\")\n open(File.join(path, image[:image].split('/').last), \"wb\") { |file|\n file.write(open(image[:image]).read)\n }\n end\n end\n end", "def create(resources)\n #resources[0].model.last_query = resources\n counter = 0\n resources.each do |resource|\n fm_params = prepare_fmp_attributes(resource.dirty_attributes)\n rslt = layout(resource.model).create(fm_params)\n merge_fmp_response(resource, rslt[0])\n counter +=1\n end\n counter\n end", "def store_files(uuids)\n Uploadcare::FileList.batch_store(uuids)\n end", "def manipulate_resource_list(resources)\n\n resources.each do |resource|\n\n #--------------------------------------------------------\n # page_name\n # Make page_name available for each page. This is the\n # file base name. Useful for assigning classes, etc.\n #--------------------------------------------------------\n def resource.page_name\n File.basename( self.url, '.*' )\n end\n\n\n #--------------------------------------------------------\n # page_group\n # Make page_group available for each page. This is\n # the source parent directory (not the request path).\n # Useful for for assigning classes, and/or group\n # conditionals.\n #--------------------------------------------------------\n def resource.page_group\n File.basename(File.split(self.source_file)[0])\n end\n\n\n #--------------------------------------------------------\n # sort_order\n # Returns the page sort order or nil.\n # - If there's an `order` key, use it.\n # - Otherwise if there's a three digit prefix.\n # - Else nil.\n #--------------------------------------------------------\n def resource.sort_order\n if self.data.key?('order')\n self.data['order'].to_i\n elsif self.page_name[0..2].to_i != 0\n self.page_name[0..2].to_i\n else\n nil\n end\n end\n\n\n #--------------------------------------------------------\n # valid_features\n # Returns an array of valid features for this page\n # based on the current target, i.e., features that\n # are true for the current target. These are the\n # only features that can be used with frontmatter\n # :target or :exclude.\n #--------------------------------------------------------\n def resource.valid_features\n options = app.extensions[:Middlemac].options\n options.Targets[options.Target][:Features].select { |k, v| v }.keys\n end\n\n\n #--------------------------------------------------------\n # targeted?\n # Determines if this pages is eligible for inclusion\n # in the current build/server environment based on:\n # - is an HTML file, and\n # - has a sort_order, and\n # - if frontmatter:target is used, the target or\n # feature appears in the frontmatter, and\n # - if frontmatter:exclude is used, the target or\n # enabled feature does NOT appear in the\n # frontmatter.\n #--------------------------------------------------------\n def resource.targeted?\n target_name = app.extensions[:Middlemac].options.Target\n self.ext == '.html' &&\n self.data.key?('title') &&\n !self.sort_order.nil? &&\n ( !self.data['target'] || (self.data['target'].include?(target_name) || (self.data['target'] & self.valid_features).count > 0) ) &&\n ( !self.data['exclude'] || !(self.data['exclude'].include?(target_name) || (self.data['exclude'] & self.valid_features).count > 0) )\n end\n\n\n #--------------------------------------------------------\n # brethren\n # Returns an array of all of the siblings of the\n # specified page, taking into account their\n # eligibility for display.\n # - is not already the current page, and\n # - is targeted for the current build.\n # Returned array will be:\n # - sorted by sort_order.\n #--------------------------------------------------------\n def resource.brethren\n pages = self.siblings.find_all { |p| p.targeted? && p != app.current_page }\n pages.sort_by { |p| p.sort_order }\n end\n\n\n #--------------------------------------------------------\n # brethren_next\n # Returns the next sibling based on order or nil.\n #--------------------------------------------------------\n def resource.brethren_next\n if self.sort_order.nil?\n puts 'NEXT reports no sort order.'\n return nil\n else\n return self.brethren.select { |p| p.sort_order == app.current_page.sort_order + 1 }[0]\n end\n end\n\n\n #--------------------------------------------------------\n # brethren_previous\n # Returns the previous sibling based on order or nil.\n #--------------------------------------------------------\n def resource.brethren_previous\n if self.sort_order.nil?\n puts 'PREV reports no sort order.'\n return nil\n else\n return self.brethren.select { |p| p.sort_order == app.current_page.sort_order - 1 }[0]\n end\n end\n\n\n #--------------------------------------------------------\n # navigator_eligible?\n # Determine whether a page is eligible to include a\n # previous/next page control based on:\n # - the group is set to allow navigation (:navigate)\n # - this page is not excluded from navigation. (:navigator => false)\n # - this page has a sort_order.\n #--------------------------------------------------------\n def resource.navigator_eligible?\n (self.parent && self.parent.data.key?('navigate') && self.parent.data['navigate'] == true) &&\n !(self.data.key?('navigator') && self.data['navigator'] == false) &&\n (!self.sort_order.nil?)\n end\n\n\n #--------------------------------------------------------\n # legitimate_children\n # Returns an array of all of the children of the\n # specified page, taking into account their\n # eligibility for display.\n # - is targeted for the current build.\n # Returned array will be:\n # - sorted by sort_order.\n #--------------------------------------------------------\n def resource.legitimate_children\n pages = self.children.find_all { |p| p.targeted? }\n pages.sort_by { |p| p.sort_order }\n end\n\n\n #--------------------------------------------------------\n # breadcrumbs\n # Returns an array of pages leading to the current\n # page.\n #--------------------------------------------------------\n def resource.breadcrumbs\n hierarchy = [] << self\n hierarchy.unshift hierarchy.first.parent while hierarchy.first.parent\n hierarchy\n end\n\n\n end # .each\n\n resources\nend", "def save!\n FileUtils.mkdir_p File.dirname(self.file)\n\n File.open(self.file, \"w+\") do |f|\n f << %(#{self.namespace}.translations || (#{self.namespace}.translations = {});\\n)\n self.translations.each do |locale, translations_for_locale|\n f << %(#{self.namespace}.translations[\"#{locale}\"] = #{translations_for_locale.to_json};\\n);\n end\n end\n end", "def ar_save_resource\n @resource.save\n end", "def print_saves\n puts 'Current saves:'\n Dir.children(SAVE_FOLDER).each { |file| puts file.delete('.JSON') }\n end", "def scan_resources!\n @resources = @lookups[:_default] = {}\n @resource_arguments = {}\n \n @default_order = []\n Dir[@resource_class.glob].each do |path|\n @default_order << basename = File.basename(path)\n \n @resource_arguments[basename] = resource_arguments = @resource_class.scan_file(path)\n\n instantiate_resource!(basename,resource_arguments)\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 sync_child_pages\n children.each{ |p| p.save! } if full_path_changed?\n end", "def save\n collections = [participants, people,\n contacts, events, instruments,\n response_sets,\n question_response_sets\n ].map { |c| current_for(c).compact }\n\n ActiveRecord::Base.transaction do\n collections.map { |c| save_collection(c) }.all?.tap do |ok|\n if ok\n logger.debug { \"Re-saving response sets\" }\n current_for(response_sets).select { |rs| rs }.each { |rs| rs.target.reload.save }\n logger.info { 'Merge saved' }\n else\n logger.fatal { 'Errors raised during save; rolling back' }\n raise ActiveRecord::Rollback\n end\n end\n end\n end", "def dump\n files = Dir[Rails.root.join(\"config\", \"locales\", \"*.yml\").to_s]\n delete_all unless Interpret.soft\n\n records = []\n files.each do |f|\n ar = YAML.load_file f\n locale = ar.keys.first\n records += parse_hash(ar.first[1], locale)\n end\n\n # TODO: Replace with activerecord-import bulk inserts\n transaction do\n records.each {|x| x.save(:validate => false)}\n end\n end", "def save_all(expressions = {})\n conditions(expressions)\n klass = Parse::Model.find_class self.table\n if klass.blank?\n raise ArgumentError, \"Parse model with class name #{self.table} is not registered.\"\n end\n hash_constraints = constraints(true)\n\n klass.save_all(hash_constraints, &Proc.new) if block_given?\n klass.save_all(hash_constraints)\n end", "def save_by_tags(format, dest)\n # call save_by_tags on all SongFile objects\n @files.each { |mp3| mp3.save_by_tags(format, dest) }\n end", "def save!\n if self.file =~ LOCALE_INTERPOLATOR\n I18n.available_locales.each do |locale|\n write_file(file_for_locale(locale), self.translations.slice(locale))\n end\n else\n write_file\n end\n end", "def save_helps\n log :info, \"Saving all help files.\"\n $help_list.each do |a_help|\n a_help.save_to_file(\"data/help/%s.yml\" % a_help.keyword) # done and done.\n end\nend", "def save\n generate_archive(generate_content_types, generate_rels, generate_document)\n end", "def resources\n resources = []\n\n default_storage = {\n 'swift_zone' => 100,\n 'object_port'=>6000,\n 'container_port'=>6001,\n 'account_port'=>6002,\n 'mountpoints'=> \"1 1\\n2 1\",\n 'weight'=> 100,\n 'types'=>['container', 'object', 'account'],\n }\n\n self[:storages].each do |storage|\n merged_storage = default_storage.merge(storage)\n merged_storage['types'].collect do |type|\n port = merged_storage[\"#{type}_port\"]\n options = {\n :name=>\"#{merged_storage['storage_address']}:#{port}\",\n :mountpoints=>merged_storage['mountpoints'],\n :zone => merged_storage['swift_zone']\n }\n resources += [Puppet::Type.type(\"ring_#{type}_device\".to_sym).new(options)]\n end\n end\n resources\n end", "def save\n files = MyBiaDJ::Table(:files)\n record = files.create(:path => relative_path, :name => name)\n tracks.each do |track|\n track.save(record) if track.mp3?\n end\n end", "def attach_files\n @parent = Work.find_by_friendlier_id!(params[:parent_id])\n authorize! :update, @parent\n\n current_position = @parent.members.maximum(:position) || 0\n\n files_params = (params[:cached_files] || []).\n collect { |s| JSON.parse(s) }.\n sort_by { |h| h && h.dig(\"metadata\", \"filename\")}\n\n files_params.each do |file_data|\n asset = Asset.new()\n\n if derivative_storage_type = params.dig(:storage_type_for, file_data[\"id\"])\n asset.derivative_storage_type = derivative_storage_type\n end\n\n asset.position = (current_position += 1)\n asset.parent_id = @parent.id\n asset.file = file_data\n asset.title = (asset.file&.original_filename || \"Untitled\")\n asset.published = @parent.published\n asset.save!\n end\n\n if @parent.representative_id == nil\n @parent.update(representative: @parent.members.order(:position).first)\n end\n\n redirect_to admin_work_path(@parent.friendlier_id, anchor: \"nav-members\")\n end", "def fix_resources_file_paths\n Project.all.each do |p|\n if p.uuid.nil?\n p.create_uuid\n p.save!\n end\n\n p.resources.each do |r|\n if !r.file_path.nil?\n source = Rails.root.join('app/assets/images', r.file_path)\n dest = Rails.root.join('public/assets/images', r.project.uuid.downcase.parameterize(\"_\"), r.file_path)\n #debugger\n FileUtils.mkdir_p(Rails.root.join('public/assets/images', r.project.uuid.downcase.parameterize(\"_\")))\n FileUtils.mv(source, dest, :force => true) if File.exist?(source)\n r.file_path = File.basename(r.file_path)\n r.save!\n end\n\n end\n end\n \nend", "def upload_text_assets(pages, access)\n asset_store.save_full_text(self, access)\n pages.each do |page|\n asset_store.save_page_text(self, page.page_number, page.text, access)\n end\n end", "def stage_attached_files(publication)\n uploaded_files = []\n publication.publication_files.each do |f|\n temp_file_path = File.join(Rails.root, 'tmp/publishing_staged_uploads', f.key, f.filename.to_s)\n temp_file_directory = File.dirname(temp_file_path)\n FileUtils.mkdir_p(temp_file_directory) unless File.directory?(temp_file_directory)\n File.open(temp_file_path, 'wb') do |file|\n file.write(f.download)\n end\n uploaded_files << { path: temp_file_path, content_type: f.content_type }\n end\n uploaded_files\n end", "def upload\n @db=Database.find(params[:id])\n @files = params[:files]\n @files.each do |file|\n name = file.original_filename\n directory = @db.path\n path = File.join(directory, name)\n File.open(path, \"wb\") { |f| f.write(file.read) }\n end\n flash[:notice] = \"File uploaded\"\n respond_to do |format|\n format.html {redirect_to files_database_url(@db)}\n format.json { render json: @files }\n end\n end", "def resources\n @resources ||= Marshal.load(Marshal.dump(@@resources))\n end", "def register_for_extensions(extensions)\n extensions = [*extensions]\n ExtensionMap.parsers ||= []\n ExtensionMap.parsers << self\n ExtensionMap.extensions_for ||= {}\n ExtensionMap.parsers_for ||= {}\n extensions.each do |extension|\n ExtensionMap.parsers_for[extension] ||= []\n ExtensionMap.parsers_for[extension] << self\n ExtensionMap.extensions_for[self] ||= []\n ExtensionMap.extensions_for[self] << extension\n end\n end", "def save\n self.attributes =\n if persisted?\n PROXY.patch(\"#{resources_name}/#{id}\", attributes)\n else\n @persisted = true\n PROXY.post(resources_name, attributes)\n end\n end", "def store(dir,resume)\n if File.exists?(dir)\n rm(Dir.glob(\"#{dir}/*.yaml\"))\n else\n mkdir(dir)\n end\n File.open(\"#{dir}/resume.yaml\",'w') { |out| YAML::dump(resume.core,out) }\n dump(dir,\"experience\",resume.experience)\n dump(dir,\"education\",resume.education)\n dump(dir,\"reference\",resume.references)\n dump(dir,\"samples\",resume.samples)\n File.open(\"#{dir}/skills.yaml\",'w') { |out| YAML::dump(resume.skills,out) }\n end", "def copy_all_controllers\n filename_pattern = File.join self.class.source_root, \"*.rb\"\n Dir.glob(filename_pattern).map { |f| File.basename f}.each do |f|\n copy_file f, \"app/controllers/dynamic_fieldsets/#{f}\"\n end\n end", "def write\n self.theme_assets_by_priority.each do |asset|\n self.output_resource_op asset\n\n self.open_file(self.target_asset_path(asset), 'wb') do |file|\n content = asset.content\n\n if asset.stylesheet_or_javascript?\n self.replace_asset_urls(content)\n end\n\n file.write(content)\n end\n\n self.output_resource_op_status asset\n end\n end", "def upload_and_update(params)\r\n files = {'container' => 'container.swf'}\r\n locales = CONF[:locales].dup;\r\n locales.delete('en')\r\n locales.each do |l|\r\n files[l] = \"#{l}.mo\"\r\n end\r\n files.each do |k, v|\r\n data = params[k]\r\n unless data.blank?\r\n f = File.new(\"#{RAILS_ROOT}/public/games/#{v}\", 'wb')\r\n f.write(data.read)\r\n f.close\r\n end\r\n end\r\n true\r\n end", "def generate_practitioners\n PDEX::NPPESDataRepo.practitioners.each do |nppes_data|\n PDEX::PractitionerGenerator.new(nppes_data).generate.each do |resource|\n write_resource(resource)\n end\n end\n end", "def write_out\n @all_content.each do |venue_id, venue_content|\n manifest_dir = \"#{@base.deploy_path}\" / \"#{venue_content.sha1_digest}\"\n venue_dir = \"#{@base.deploy_path}\" / \"#{Venue.get!(venue_id).router.identifier}\"\n manifest_file = manifest_dir / \"manifest.json\"\n files_dir = manifest_dir / \"files\"\n venue_content_ln = \"#{venue_dir}\" / \"content\"\n sha1_file = manifest_dir / \"#{venue_content.sha1_digest}.sha1\"\n \n FileUtils.rm(venue_content_ln) if File.exists?(venue_content_ln)\n FileUtils.mkdir_p(venue_dir)\n if File.exists?(sha1_file)\n FileUtils.ln_sf(manifest_dir, venue_content_ln)\n next\n end\n\n FileUtils.mkdir_p(manifest_dir)\n\n open(manifest_file, \"w+\") do |f|\n f << venue_content.manifest.to_json\n end\n\n #FileUtils.mkdir_p(files_dir)\n source_files = venue_content.filelist\n venue_content.filelist.each do |f|\n #UploadManager is using the first 2 bytes of the file digest as directory names.\n #The split('/'[-3..-1].join('') restores the filename to the full digest when it is copied\n #from the upload dir to the deployment dir\n dest = \"#{manifest_dir}\" / \"#{f.split('/')[-3..-1].join('')}\"\n FileUtils.cp(f, dest)\n end\n \n open(sha1_file, \"w+\") do |f|\n f << venue_content.sha1_digest\n end\n \n FileUtils.ln_sf(manifest_dir, venue_content_ln)\n end\n end", "def write_all\n if cached_write?\n then write_cached_assets else write_assets\n end\n end", "def save!\n filepath.dirname.mkpath\n filepath.open( \"w\" ) do |f|\n f << YAML.dump( @entries )\n end\n clear_modified\n true\n end", "def write_meta_files\r\n @files.each do |file|\r\n template = ERB.new(\r\n File.new(File.join(@dirs[:templates],file[:template])).read,\r\n nil, \"%\")\r\n output_file = File.new(file[:path], \"w+\")\r\n output_file.write(template.result(binding))\r\n output_file.close\r\n end\r\n end", "def globalReport(psdFiles, base)\n psdFiles.each do |psdFile|\n name = File.basename(psdFile, \".psd\")\n PSD.open(psdFile) do |psd|\n content = psd.tree.to_hash\n jsonContent = JSON.pretty_generate(content)\n file = File.join(base, \"#{name}.json\")\n File.open(file, \"w\") { |f| f.write(jsonContent) }\n puts \"[create] #{file}\"\n end\n end\nend", "def save_files(links)\n links.each do |link|\n if[\".jpg\",\".gif\",\".png\",\"jpeg\"].include?(File.extname(link)) \n File.open(\"#{@direc}/\" + File.basename(link), 'wb') { |i| i.write(RestClient.get(link)) } \n end\n end\n page_counter\n end", "def process!\n process_previews! if self.class.preview?\n\n versions.each do |name, blk|\n path = File.join(@dir, \"#{name}_#{@filename}\")\n process_version!(path, &blk)\n @paths << path\n end\n\n @paths\n end", "def save\n prepare\n h = {}\n h[:title] = @title\n h[:sequence] = @sequence.map(&:export)\n outfile = File.join(@basedir, \"#{@name}.json\")\n File.open(outfile, 'w') do |f|\n f.write JSON.pretty_generate(h)\n end\n end", "def manipulate_resource_list(resources)\n\n\n index_file = app.index_file\n new_index_path = \"/#{index_file}\"\n\n # for each resource\n resources.each do |resource|\n\n # has custom_url in frontmatter\n if resource.raw_data[:custom_url]\n\n # set path as custom_url\n resource.destination_path = resource.raw_data[:custom_url] + new_index_path\n end\n end\n end", "def save_attachments attachments\n Attachment.add(attachments, self)\n end", "def save\n objects.each do |object|\n object['request_id'] = request_id\n\n puts \"Processing object #{object}\"\n\n if object['id'].size > 11\n object['id'] = object['id'].split(//).last(11).join\n end\n\n next unless valid_object?(object)\n prepare_objects_before_save(object)\n\n # If an alternate customer email is specified in flow params (should be order flows only)\n # then update to that email and generic customer billing and shipping info\n if use_customer_email_param?\n object[:email] = @config[:quickbooks_customer_email]\n end\n\n # Get rid of empty addresses\n unless payload_key == 'journal'\n [:shipping_address, :billing_address].each do |address_type|\n if object[address_type].nil? || object[address_type].empty?\n object[address_type] = generic_address\n end\n end\n end\n\n if two_phase?\n file = \"#{path.base_name}/#{path.two_phase_pending}/#{payload_key.pluralize}_#{id_of_object(object)}_.json\"\n amazon_s3.export file_name: file, objects: [object]\n generate_inserts_for_two_phase(object, use_customer_email_param?)\n else\n file = \"#{path.base_name}/#{path.pending}/#{payload_key.pluralize}_#{id_of_object(object)}_.json\"\n amazon_s3.export file_name: file, objects: [object]\n end\n generate_extra_objects(object)\n end\n end", "def save(opts = {})\n fmts = Array(opts[:format])\n warn 'Must specify format :png and/or :pdf' if fmts.empty?\n opts.delete :format # not needed anymore\n save_png(opts) if fmts.include? :png\n save_pdf(opts) if fmts.include? :pdf\n uns = fmts - [:pdf, :png ]\n unless uns.empty?\n warn \"Unsupported format(s) #{uns} to #{'save'.cyan}()\", uplevel: 1\n end\n self\n end", "def characterize(save: true)\n [:original_file, :intermediate_file, :preservation_file].each do |type|\n @target_file = @file_set.try(type)\n next unless @target_file\n @file_object = Valkyrie::StorageAdapter.find_by(id: @target_file.file_identifiers[0])\n @dataset_path = filename\n unzip_original_file if zip_file?\n new_file = @target_file.new(file_characterization_attributes.to_h)\n @file_set.file_metadata = @file_set.file_metadata.select { |x| x.id != new_file.id } + [new_file]\n clean_up_zip_directory if zip_file?\n end\n @file_set = persister.save(resource: @file_set) if save\n @file_set\n end", "def save_shapefiles\n\t\t@files = []\n\n\t\t@shapefiles.each do |file|\n\t\t\tshapefile = file.tempfile.read\n\t\t\tshapefile_name = file.original_filename\n\t\t\t@files << shapefile_name\n\t\t\tFile.open(File.join(Rails.root, 'tmp', shapefile_name), 'wb') { |f| f.write shapefile }\n\t\tend\n\tend", "def save( directory )\n File.open( \"parsed_data/#{directory}.yaml\", 'w' ) do |f|\n f.write( @pages.to_yaml )\n end\n end", "def upload_images_and_documents\n if params[:project][:images]\n params[:project][:images].each do |project_image|\n @project.images.create(image: project_image, document: false)\n end\n end\n\n if params[:project][:legal_documents]\n params[:project][:legal_documents].each do |project_doc|\n @project.images.create(image: project_doc, document: true)\n end\n end\n end", "def sync\n each_difference(local_resources, true) { |name, diffs| sync_difference(name, diffs) }\n end", "def associate_components \n #associate internals and resources with parts\n @parts.each do |name, data|\n data[:internals] = associate_component(data[:file], @internals)\n data[:resources] = associate_component(data[:file], @resources)\n data.delete(:file) #remove the raw file data as it's no longer needed and would waste space if written to file\n end\n #associate props with internals\n @internals.each do |name, data| \n data[:props] = associate_component(data[:file], @props) \n data.delete(:file) #remove the raw file data\n end\n end", "def resources\n @resources ||= {}\n end", "def save_all_links selected_surveys\n if params[:scripts] != nil\n params[:scripts].each do |script_id|\n link = Link.new\n link.subject = @archive\n link.object = Script.find(script_id)\n link.predicate = \"link\"\n link.user = current_user\n link.save\n end\n end\n #automatically link from the selected datasets/surveys\n selected_surveys.each do |survey_id|\n link = Link.new\n link.subject = @archive\n link.object = Survey.find(survey_id)\n link.predicate = \"link\"\n link.user = current_user\n link.save\n end\n if params[:data_extracts] != nil\n params[:data_extracts].each do |extract_id|\n link = Link.new\n link.subject = @archive\n link.object = Csvarchive.find(extract_id)\n link.predicate = \"link\"\n link.user = current_user\n link.save\n end\n end\n if params[:publications] != nil\n # all_scripts_array = Array.new\n params[:publications].each do |publication_id|\n link = Link.new\n link.subject = @archive\n link.object = Publication.find(publication_id)\n link.predicate = \"link\"\n link.user = current_user\n link.save\n end\n end\n end", "def static_files_to_write\n static_files.select(&:write?)\n end", "def save_game\n Dir.mkdir(\"../saves\") unless Dir.exists?(\"../saves\")\n @@save_count += 1\n binding.pry\n log_saves\n savefile = \"../saves/save_#{@@save_count}.yml\"\n File.open(savefile, 'w') do | file |\n file.write(self.to_yaml)\n end\n end", "def save # save the instance to all\n @@all << self\n end", "def flush_writes\n @queued_for_write.each do |style, file|\n raise FileExists, \"file \\\"#{path(style)}\\\" already exists in your Google Drive\" if exists?(path(style))\n\n name, mime_type = filename_from(style), \"#{ file.content_type }\"\n\n file_metadata = {\n name: name,\n description: 'paperclip file on google drive',\n mimeType: mime_type,\n parents: [find_public_folder]\n }\n\n google_api_client.create_file(\n file_metadata,\n fields: 'id',\n upload_source: file.binmode,\n content_type: file.content_type,\n )\n end\n after_flush_writes\n @queued_for_write = {}\n end", "def save_product_presentations\n product_presentations.each do |product_presentation|\n #the false param, bypasses validation.\n product_presentation.save(false)\n end\n end", "def save(path = @path)\n Ops.atomic_write(path) do |io|\n marshalled_package_sets = each_package_set.map do |pkg_set|\n set = pkg_set.to_h.transform_keys(&:to_s)\n set[\"package_set\"] = set[\"name\"]\n set\n end\n marshalled_packages = each_package.map do |pkg|\n pkg.to_h.transform_keys(&:to_s)\n end\n io.write YAML.dump(marshalled_package_sets + marshalled_packages)\n end\n end", "def path2instances(request, *paths)\n filesets = paths.collect do |path|\n # Filesets support indirector requests as an options collection\n Puppet::FileServing::Fileset.new(path, request)\n end\n\n Puppet::FileServing::Fileset.merge(*filesets).collect do |file, base_path|\n path2instance(request, base_path, :relative_path => file)\n end\n end", "def add_files(*files)\n Rails.logger.info \"Adding #{files.map(&:upload_file_name).join(', ')} to bundle #{self.bundle_type}:#{self.id} in #{self.study.name}\"\n files.each do |file|\n file.update!(study_file_bundle_id: self.id)\n end\n additional_files = StudyFileBundle.generate_file_list(*files)\n self.original_file_list += additional_files\n self.save!\n Rails.logger.info \"File addition to bundle #{self.bundle_type}:#{self.id} successful\"\n end", "def visit_resources(resources)\n visitor = Visitor.new\n\n resources.reject! {|resource| resource.type == 'Stage' || resource.type == 'Class' }\n resources.map(&visitor.method(:visit))\n\n visitor.context.to_dockerfile\n end", "def _save_to_store\n self._warnings = []\n _commit_externals \n __pack.commit # TODO: need to add some error catching and roll back the external saves where needed\n end", "def save_logic( defer=false, mask_exception = true )\n ensure_id\n self[:_attachments] = attachments.pack unless attachments.empty?\n if defer\n database.add_to_bulk_cache( self )\n else\n # clear any bulk saving left over ...\n database.bulk_save if database.bulk_cache.size > 0\n if mask_exception\n save_now\n else\n save_now( false )\n end \n end \n end", "def compile_files(files)\n files.each do |base_path|\n # We do this second glob in case the path provided in the tayfile\n # references a compiled version\n Dir[@base_dir.join('src', base_path + '*')].each do |path|\n path = Pathname.new(path).relative_path_from(@base_dir.join('src'))\n file_in_path = @base_dir.join('src', path)\n file_out_path = asset_output_filename(@output_dir.join(path), @sprockets.engines.keys)\n\n if @sprockets.extensions.include?(path.extname)\n content = @sprockets[file_in_path].to_s\n else\n content = File.read(file_in_path)\n end\n\n FileUtils.mkdir_p(file_out_path.dirname)\n File.open(file_out_path, 'w') do |f|\n f.write content\n end\n end\n end\n end" ]
[ "0.7092153", "0.68857044", "0.612171", "0.5859371", "0.575992", "0.5634296", "0.55421543", "0.5347554", "0.53025943", "0.5282195", "0.5123961", "0.51138026", "0.5113333", "0.50949955", "0.509466", "0.50825787", "0.5018392", "0.50049037", "0.49954116", "0.49954116", "0.4987611", "0.49832144", "0.4971143", "0.49254614", "0.492082", "0.49132606", "0.4913099", "0.49119627", "0.49015927", "0.4900483", "0.48990738", "0.4890355", "0.48873827", "0.48835355", "0.487878", "0.4877103", "0.48700786", "0.4869838", "0.48554096", "0.48521808", "0.4846166", "0.4843168", "0.48402187", "0.48393682", "0.4830375", "0.48200485", "0.48002094", "0.47928855", "0.4790167", "0.4790055", "0.47660458", "0.47652727", "0.47626862", "0.47583205", "0.47569486", "0.47437483", "0.4740311", "0.47381237", "0.47255567", "0.47211537", "0.47191408", "0.47061425", "0.46951023", "0.46919093", "0.4675378", "0.46743688", "0.46661028", "0.46635586", "0.46630704", "0.46585044", "0.4639708", "0.46388346", "0.46345723", "0.46234533", "0.4622568", "0.46141425", "0.4610068", "0.46080557", "0.4607669", "0.46043754", "0.46008036", "0.4595857", "0.45948514", "0.45939314", "0.45909905", "0.4590644", "0.45867932", "0.45858058", "0.45689815", "0.45632067", "0.45621073", "0.45597056", "0.4557649", "0.4551917", "0.45487761", "0.45460895", "0.45441094", "0.45437837", "0.45434552", "0.45391196" ]
0.732681
0
Yields all the action needed to store all the resources at perspectives persps and with formats exts. All actions respond to :perform (it is when they're executed). If no block given, returns an Enumerator with these actions.
def batch_save_actions(root, resources, persps, exts) if block_given? resources.each do |resource| db_path = File.join(root, resource.path(identifying_sym)) yield PrepareDirAction.new(db_path) exts.each do |ext| persps.each do |persp| basename = basename_for_persp_and_ext(persp, ext) resource_path = File.join(db_path, basename) yield StoreResourceAction.new(resource_path, resource, persp, ext) end end end else Enumerator.new(self, :batch_save_actions, root, resources, persps, exts) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_actions\n catch_exceptions do\n @success = if block_given?\n result = yield\n actions.each { |action| results[action] = result }\n !!result\n else\n actions.compact.each { |action| !skip_actions && (results[action] = object.send(action)) }\n results.values.all?\n end\n end\n end", "def run_actions\n catch_exceptions do\n @success = if block_given?\n result = yield\n actions.each {|action| results[action] = result}\n !!result\n else\n actions.compact.each {|action| !skip_actions && results[action] = object.send(action)}\n results.values.all?\n end\n end\n end", "def each &block # :yields: content, options\n self.class.resources_creator.call(content, options).each &block \n end", "def for_actions(*actions)\n self.working_actions = actions\n self\n end", "def batch_save(root, resources, persps, exts)\n batch_save_actions(root, resources, persps, exts) do |action|\n action.perform\n end\n end", "def actions\n playbook.actions\n end", "def action(&block)\n @actions << block\n end", "def bulk_persist\n adapter_class = policy_machine_storage_adapter.class\n\n if adapter_class.respond_to?(:buffering?)\n begin\n adapter_class.clear_buffers!\n adapter_class.start_buffering!\n result = yield\n adapter_class.persist_buffers!\n result\n ensure\n adapter_class.stop_buffering!\n adapter_class.clear_buffers!\n end\n else\n yield\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 each(&block)\n if self.equal?(ShEx::Extension)\n # This is needed since all Semantic Action classes are defined using\n # Ruby's autoloading facility, meaning that `@@subclasses` will be\n # empty until each subclass has been touched or require'd.\n @@subclasses.values.each(&block)\n else\n block.call(self)\n end\n end", "def execute!\n @actions.each do |action|\n action.call\n end\n end", "def actions\n actions = []\n @model.with_each_action_for(self) do |action|\n actions << action\n end\n actions\n end", "def each(&block)\n txactions.each(&block)\n end", "def each (&block)\n\n return unless block\n\n wis = Workitem.find_by_store_name(@store_name)\n\n wis.each { |wi| block.call(wi) }\n end", "def actions\n return self.class.actions_pool if self.params[\"screen\"].blank?\n self.class.actions_pool.select {|action| valid_action?(action, self.params[\"screen\"]) } \n end", "def all\n super | entities | action_instances\n end", "def resources\n @resources ||= Resources.new\n if block_given?\n yield(@resources)\n end\n @resources\n end", "def store_action_items\n return unless self.all_action_items\n\n self.all_action_items.delete :retrieved_file\n\n if self.class.columns_hash[item_actions_field].type == :string\n send \"#{item_actions_field}=\", self.all_action_items.to_json\n else\n send \"#{item_actions_field}=\", self.all_action_items\n end\n end", "def each\n return enum_for :each unless block_given?\n\n # We trust that the field exists and is an Enumerable\n resources.each do |resource|\n resource = @format_resource.call resource if @format_resource\n yield resource\n end\n end", "def resource_actions params={}\n except = params.delete(:except).arrayize.compact\n only = params.delete(:only).arrayize.compact\n\n params[:format] = params.has_key?(:format) ? params[:format].arrayize : [:html,:xml]\n\n # Logic to see if we should add an action\n # It should either be in :only, or :except isn't empty and it's not in :except\n should_add = lambda do |action|\n # Only isn't empty and our action is contained within\n if !only.empty?\n break only.include?(action)\n end\n # Except isn't empty and our action isn't contained therein\n if !except.empty?\n break !except.include?(action)\n end\n # Just add it\n true\n end\n\n # Add each action, if we should\n add :index, params if should_add[:index]\n add :new, params if should_add[:new]\n add :create, params if should_add[:create]\n add :edit, {:id => \"some_id\"}.merge(params) if should_add[:edit]\n add :show, {:id => \"some_id\"}.merge(params) if should_add[:show]\n add :update, {:id => \"some_id\"}.merge(params) if should_add[:update]\n add :destroy, {:id => \"some_id\"}.merge(params) if should_add[:destroy]\n end", "def procedures\n return [] unless databases.any? || archives.any?\n\n [-> { prepare! }, databases, archives,\n -> { package! }, -> { store! }, -> { clean! }]\n end", "def next_actions!\n actions = migrate_actions :mapper\n actions += migrate_actions :reducer\n actions += reduce_actions\n actions += map_actions\n actions += finalize_actions\n actions\n end", "def collect\n raise Errors::ActionMethodNotImplemented.new 'Collect actions must overwrite the collect method.'\n end", "def apply_actions!\n\t @entity.apply_actions!(params[:entity])\n\t\t\tset_async_actions!\n end", "def resources_actions\n @resources_actions ||= []\n end", "def set_resource_actions\n self.actions[:index] = Action.new(self.entity, :index, :collection, :resource => true)\n self.actions[:new] = Action.new(self.entity, :new, :collection, :resource => true)\n self.actions[:edit] = Action.new(self.entity, :edit, :member, :resource => true)\n self.actions[:show] = Action.new(self.entity, :show, :member, :resource => true)\n self.actions[:create] = Action.new(self.entity, :create, :collection, :method => :post, :resource => true)\n self.actions[:update] = Action.new(self.entity, :update, :member, :method => :put, :resource => true)\n self.actions[:delete] = Action.new(self.entity, :delete, :member, :method => :delete, :resource => true)\n end", "def storing\n if block_given?\n yield\n end.tap { persist! if persistible? }\n end", "def procedure(anActionList)\n\t\treturn ActionSequence.new(anActionList)\n\tend", "def actions\n if !@actions\n # make sure we've loaded all the actions we know about\n Dir.glob(File.join(File.dirname(__FILE__), 'ec2-discovery', 'actions', '*.rb')).each do |file|\n req_name = \"ec2-discovery/actions/#{File.basename(file).gsub(/\\.rb^/, '')}\"\n info \"Requiring #{req_name}\"\n require req_name\n end\n\n @actions = []\n action_strs.each do |action_str|\n begin\n action = eval(action_str)\n if action.is_a?(ReframeIt::EC2::Action)\n @actions << action\n info { \"Loaded action #{action.inspect}\" }\n else\n error \"Actions must inherit from ReframeIt::EC2::Action, but #{action.inspect} does not!\"\n end\n rescue Exception => ex\n error \"Error trying to eval #{action_str}\", ex\n end\n end\n end\n\n @actions\n end", "def each(&block)\n retractions.each &block\n end", "def execute(&block)\n\t\t\t\t@controller.refined_http_methods\n\t\t\t\t\t.each do |action, (http_method, action_path)|\n\t\t\t\t\t\tsend(http_method, action_path, action)\n\t\t\t\t\tend\n\t\t\t\tinstance_exec(&block) if block\n\t\t\t\tdefaults\n\t\t\tend", "def batch\n yield if block_given?\n end", "def remote_each\n if(@store)\n yield @store\n else\n @con.request_get(@call_path) do |res|\n res.read_body(@store) do |part|\n @cf.write part if @cf\n yield part\n end\n end\n end\n end", "def actions\n @actions ||= []\n end", "def resource_actions\n @resource_actions ||= []\n end", "def actions\n @actions ||= []\n end", "def map(&block)\n resources.map(*args, &block)\n end", "def each_store (&block) # :yields: regex, store_name, store\n\n return unless block\n\n @stores.each do |v|\n regex, store_name, store = v\n block.call regex, store_name, store\n end\n end", "def manage_resources(resources)\n resources.map {|r| manage_resource(r) }\n end", "def each\n medias.each{ |media| yield media }\n end", "def each\n @body.each do |block|\n yield @resource.send(@encoder, @resource.send(@charsetter, block.to_s))\n end\n end", "def procedures\n Array.new([\n databases, archives, lambda { package! }, compressors,\n encryptors, lambda { split! }, storages\n ])\n end", "def permissions(*actions, &block)\n # Store the permissions block so we can run it in validations\n self.__permissions__ ||= {}\n\n # if no action was specified, assume all actions\n actions += [:create, :read, :update, :delete] if actions.size == 0\n\n actions.each do |action|\n # Add to an array of proc's for each action\n (self.__permissions__[action] ||= []) << block\n end\n\n validate do\n action = new? ? :create : :update\n run_permissions(action)\n end\n end", "def screenActions\n actionobjects = @actionObjects[@action]\n return if actionobjects == nil\n actionobjects.each do |obj|\n if obj['Value'] == \"uploadfile:@step['Parameter1']\"\n p\n end\n waitTime = obj['Wait'].to_s.to_f\n sleep(waitTime)\n objectAction(obj)\n if @skipCurrentStep == true\n break\n end\n end\n end", "def actions\n return @actions if @actions\n @actions = Client.get(\"/organizations/#{id}/actions\").json_into(Action)\n end", "def actions\r\n return @actions\r\n end", "def perform(&block)\n reset\n\n if valid?\n if use_event_attributes? && !block_given?\n each do |transition|\n transition.transient = true\n transition.machine.write(object, :event_transition, transition)\n end\n\n run_actions\n else\n within_transaction do\n catch(:halt) { run_callbacks(&block) }\n rollback unless success?\n end\n end\n end\n\n if actions.length == 1 && results.include?(actions.first)\n results[actions.first]\n else\n success?\n end\n end", "def createParallel(*resources)\n if ! advance? then return self end\n @@logger.debug \"Launching resource(s) in parallel #{resources.join(',')}.\"\n resources.each do |resource|\n resource = @resourcer.get resource_name\n created = @mutator.create(resource_name, resource)\n created.harp_script = @harp_script\n result = {:create => resource_name}\n args = {:action => :create}\n if created.output? (args)\n result[:output] = created.make_output_token(args)\n result[:line] = @current_line\n end\n @events.push(result)\n created.save\n end\n return self\n end", "def resource(*args,&block)\n command(*args) do |cmd|\n # add resource actions\n # TODO: Figure out override/mod/new default action...\n cmd.action(:name=>:sample,:default=>true) { (load_data||[]).sample }\n cmd.action(:name=>:list) { (load_data||[]).map{|l| l.to_s}.join(\"\\n\")}\n cmd.action(:name=>[:add,'+'],:required=>:d) {|msg,d| save_data( (load_data||[]) | [d] )}\n cmd.action(:name=>[:delete,:del,:-],:required=>:d) {|msg,d| debug(\"RESOURCE: - #{load_data.inspect} d: #{d.inspect}\"); save_data( (load_data||[]) - [d] )}\n\n # now run as normal\n block.call(cmd) if block\n end\n end", "def actions\n @actions ||= self.class.registered_actions.inject({}){ |res, name| res.merge(name.to_sym => normalize_action_config(send(ACTION_METHOD_NAME % name))) }\n end", "def selenium_actions(*objs, &block)\n objects = objs.map do |obj|\n Prism::Node === obj ? obj.node.wd : obj\n end\n selenium_action_builder = page.node.driver.action\n selenium_action_builder.instance_exec(*objects, &block)\n selenium_action_builder.perform\n end", "def actions\n return @actions\n end", "def batch_actions_to_display\n @batch_actions.select do |batch_action|\n call_method_or_proc_on(self, batch_action.display_if_block)\n end\n end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def action &block\n if block.nil?\n raise RuntimeError, 'expected a block but none given'\n end\n @actions << block\n end", "def execute_work!\n save_receipts = event_store.with_transaction do\n pending_saves.map(&:call)\n end\n\n @pending_saves = []\n\n save_receipts.each do |reciept|\n message_bus.publish_events(reciept.id, reciept.klass, reciept.events,\n reciept.meta.merge(meta))\n end\n\n self\n end", "def actions\n return self.class.actions_pool if self.params[\"screen\"].blank?\n self.class.actions_pool.select {|action| valid_action?(action)}.uniq {|action| action[:name]}\n end", "def action\n yield\n end", "def action\n yield\n end", "def action\n yield\n end", "def action\n yield\n end", "def action\n yield\n end", "def action\n yield\n end", "def set_actions\n actions :all\n end", "def _actions(action = nil)\n @_actions ||= Mash.new{|h,k| h[k] = ActionManager.new}\n action.nil? ? @_actions : @_actions[action]\n end", "def execute\n yield self if block_given?\n end", "def execute_handlers\n @@handlers.each { |handler| handler.execute }\n end", "def actions(options = {}, &block)\n options = { :defaults => true }.merge(options)\n @default_actions = options[:defaults]\n @other_actions = block\n end", "def actions\n @actions\n end", "def retrieve_action_assets\n action_path = PathInfo.new(\"#{app_path.to_s}/#{@controller}\")\n single_action_path = PathInfo.new(\"#{action_path}/#{@action}.#{asset_extension}\")\n indexed_action_path = PathInfo.new(\"#{action_path}/#{@action}\")\n manifest = nil\n\n manifest = single_action_path if FileTest.exist?(single_action_path)\n\n action_index = \"#{indexed_action_path}/index.#{asset_extension}\"\n manifest = PathInfo.new(action_index) if FileTest.exist?(action_index)\n\n @assets.concat(retrieve_assets_from(manifest)) unless manifest.nil?\n\n if FileTest.exist?(indexed_action_path)\n auto_required_assets = Dir[\"#{action_path}/#{@action}/**/*.#{asset_extension}\"]\n\n @assets.concat(auto_required_assets.map{ |ass| PathInfo.new(ass).rel })\n else\n @assets << manifest.rel unless manifest.nil?\n end\n end", "def resource_actions\n return @resource_actions\n end", "def resource_actions\n return @resource_actions\n end", "def perform(&block)\n within_transaction do\n if before\n persist\n run_actions(&block)\n after\n rollback unless success?\n end\n end\n \n success?\n end", "def write\n self.mounting_point.content_types.each do |filename, content_type|\n self.output_resource_op content_type\n\n self.open_file(\"app/content_types/#{filename}.yml\") do |file|\n file.write(content_type.to_yaml)\n end\n\n self.output_resource_op_status content_type\n end\n end", "def all_actions_for_all_items\n @item_actions\n end", "def build_actions\n base_actions.each do |action|\n action[:count].times do\n @actions << action[:klass].new\n end\n end\n end", "def actions\n @actions || []\n end", "def actions\n res = []\n res << :capture if payment.pending?\n res << :void if payment.completed?\n res\n end", "def actions\n res = []\n res << :capture if payment.pending?\n res << :void if payment.completed?\n res\n end", "def assert_cache_action(*actions)\n fragment_cache_store.clear\n \n yield \n \n actions.each do |action|\n action = { :action => action } unless action.is_a?(Hash)\n assert_block(\"#{@controller.params.inspect} is not cached after executing block. Expected: #{@controller.fragment_cache_key(@controller.params)}\") do\n path = @controller.fragment_cache_key(@controller.params)\n path << 'index' if path.last == '/'\n path << \".#{@controller.params[:format]}\" if @controller.params[:format] && @controller.params[:format] != 'html'\n fragment_cache_store.written?(path)\n end\n end\n \n fragment_cache_store.clear\n end", "def controller_actions(perms)\n application_controller(perms)\n ApplicationController.descendants.each do |c|\n next if c == Peek::ResultsController || c.parent == Blazer # Fix for gems\n next unless c.respond_to?(:permission_definition)\n next if c.permission_definition.nil? || c.permission_definition == {}\n perms << PermissionsGenerator.new(c)\n end\n return perms\nend", "def actions\n children_by_type(:action)\n end", "def perform_action\n action_name = params[:action_name].to_sym\n action = resource.member_actions[action_name]\n if action.is_method_action?\n @record.send(action.method_name)\n end\n if action.is_block_action?\n action.block.call(@record)\n end\n return redirect_to([app_kit, @record])\n end", "def each_statement(&block)\n if block_given?\n unless @processed || @root.nil?\n # Add prefix definitions from host defaults\n @host_defaults[:uri_mappings].each_pair do |prefix, value|\n prefix(prefix, value)\n end\n\n # parse\n parse_whole_document(@doc, RDF::URI(base_uri))\n\n # Look for Embedded RDF/XML\n unless @root.xpath(\"//rdf:RDF\", \"rdf\" => \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\").empty?\n extract_script(@root, @doc, \"application/rdf+xml\", **@options.merge(base_uri: base_uri)) do |statement|\n @repository << statement\n end\n end\n\n # Look for Embedded microdata\n unless @root.xpath(\"//@itemscope\").empty?\n begin\n require 'rdf/microdata'\n add_debug(@doc, \"process microdata\")\n @repository << RDF::Microdata::Reader.new(@doc, **options)\n rescue LoadError\n add_debug(@doc, \"microdata detected, not processed\")\n end\n end\n\n # Perform property copying\n copy_properties(@repository) if @options[:reference_folding]\n\n # Perform vocabulary expansion\n expand(@repository) if @options[:vocab_expansion]\n\n @processed = true\n end\n\n # Return statements in the default graph for\n # statements in the associated named or default graph from the\n # processed repository\n @repository.each do |statement|\n case statement.graph_name\n when nil\n yield statement if @options[:rdfagraph].include?(:output)\n when RDF::RDFA.ProcessorGraph\n yield RDF::Statement.new(*statement.to_triple) if @options[:rdfagraph].include?(:processor)\n end\n end\n\n if validate? && log_statistics[:error]\n raise RDF::ReaderError, \"Errors found during processing\"\n end\n end\n enum_for(:each_statement)\n end", "def execute\n t0 = Time.now\n collect_tem_ids\n \n # Spawn TEM threads.\n @tems.each_index { |i| Thread.new(i) { |i| executor_thread i } }\n \n until @planner.done?\n actions = @planner.next_actions!\n @lock.synchronize do\n actions.each { |action| @thread_queues[action[:with]] << action }\n end\n \n action = @main_queue.pop\n @planner.action_done action\n end\n @timings[:total] = Time.now - t0\n \n return { :result => @outputs[@planner.output_id], :timings => @timings }\n end", "def actions\n self.class.actions\n end", "def each(&block)\n\t\t\t@plugins.each do |k,v|\n\t\t\t\tyield k, v[:instance]\n\t\t\tend\n\t\tend", "def publishing_actions\n\n actions = []\n\n if wf = publishing_workflow\n actions= wf.available_steps(self).map { |step| step.action }\n end\n\n return actions.uniq\n\n end", "def run\n attributes = @adapter.persistence_attributes(self, @attributes)\n\n parents = @adapter.process_belongs_to(self, attributes)\n persisted = persist_object(@meta[:method], attributes)\n @resource.decorate_record(persisted)\n assign_temp_id(persisted, @meta[:temp_id])\n\n associate_parents(persisted, parents)\n\n children = @adapter.process_has_many(self, persisted)\n\n associate_children(persisted, children) unless @meta[:method] == :destroy\n\n post_process(persisted, parents)\n post_process(persisted, children)\n after_graph_persist = -> { @resource.after_graph_persist(persisted, metadata) }\n add_hook(after_graph_persist, :after_graph_persist)\n before_commit = -> { @resource.before_commit(persisted, metadata) }\n add_hook(before_commit, :before_commit)\n after_commit = -> { @resource.after_commit(persisted, metadata) }\n add_hook(after_commit, :after_commit)\n persisted\n end", "def actions\n act = []\n act << 'capture' if can_capture? payment\n act << 'void' if can_void? payment\n act\n end", "def assert_expire_actions(*actions)\n fragment_cache_store.clear\n \n yield *actions\n \n raise NoRequestInBlockError.new(\"no request was send while executing block.\") if @controller.nil?\n \n actions.each do |action|\n action = { :action => action } unless action.is_a?(Hash)\n assert_block(\"#{action.inspect} is not expired after executing block. Cached: #{}\") do\n path = @controller.fragment_cache_key(action)\n path << 'index' if path.last == '/'\n path << \".#{@controller.params[:format]}\" if @controller.params[:format] && @controller.params[:format] != 'html'\n fragment_cache_store.deleted?(path)\n end\n end\n \n fragment_cache_store.clear\n end", "def resource(*resources, &block); end", "def run\n @results = Hash.new\n permutation.each do |options|\n simulation = Simulation.new(options).execute\n if block_given?\n @results[simulation.command] = yield(simulation)\n else\n @results[simulation.command] = simulation\n end\n end\n end", "def index_for_actions object, *action_names, &block\n html_options = action_names.extract_options!\n action_names = [:show, :edit, :destroy] if action_names == [:all]\n\n builder = IndexFor::ActionBuilder.new(object, html_options, self)\n \n content = capture(builder) do |a|\n action_names.map do |action_name|\n a.action_link action_name\n end.join.html_safe\n end\n\n content += capture(builder, &block) if block\n\n content\n end", "def actions\n []\n end", "def each\n @resources.each_pair {|k, v| yield(k, v)}\n end", "def assert_cache_actions(*actions)\n check_options_has_controller(actions) if self.is_a?(ActionController::IntegrationTest)\n \n cache_store.reset\n \n yield *actions\n \n raise NoRequestInBlockError.new(\"no request was send while executing block.\") if @controller.nil?\n \n actions.each do |action|\n if action.is_a?( Hash )\n assert( cache_store.written?( @controller.fragment_cache_key(action) ), \"#{action.inspect} is not cached after executing block\" )\n else\n unless cache_store.written?(@controller.fragment_cache_key(action))\n assert( cache_store.written?(@controller.fragment_cache_key( :action => action) ), \"#{action.inspect} is not cached after executing block, cached things were: #{written_key_list}\")\n end\n end\n end\n end", "def action(name, &block)\n action = Moonrope::Action.new(@controller, name)\n action.dsl.instance_eval(&block) if block_given?\n @controller.actions[name] = action\n action\n end", "def get_actions\n get_document.get_actions_yaml\n end", "def yield\n @eff.yield.perform\n end" ]
[ "0.58765167", "0.587392", "0.5661069", "0.5458024", "0.52771187", "0.5229261", "0.5206296", "0.52009153", "0.5187542", "0.5149291", "0.5110233", "0.50481886", "0.50359124", "0.49605536", "0.4944478", "0.49286473", "0.4918648", "0.4882591", "0.48800528", "0.4869334", "0.482979", "0.48180825", "0.48169968", "0.48146254", "0.48130712", "0.47974128", "0.47954324", "0.47927126", "0.47770137", "0.47638348", "0.47627515", "0.47620207", "0.475453", "0.47515103", "0.4708698", "0.47038108", "0.46985275", "0.46965885", "0.46918172", "0.46903685", "0.46873188", "0.46817663", "0.46779662", "0.46721932", "0.46669614", "0.46660987", "0.46623152", "0.4653006", "0.46453938", "0.4642824", "0.46425402", "0.46264103", "0.46178234", "0.46160847", "0.46119323", "0.4610827", "0.46000057", "0.45914546", "0.45914546", "0.45914546", "0.45914546", "0.45914546", "0.45914546", "0.45688874", "0.45687267", "0.45659977", "0.45651057", "0.45619678", "0.455066", "0.4545064", "0.45428836", "0.45428836", "0.4542768", "0.45399153", "0.4538225", "0.45381635", "0.45332763", "0.45317507", "0.45317507", "0.453169", "0.45263192", "0.45256507", "0.45215797", "0.45211023", "0.4517787", "0.45163077", "0.4515768", "0.45145357", "0.44998944", "0.44924632", "0.44923428", "0.44921952", "0.44871995", "0.44820136", "0.44807565", "0.4479491", "0.44728515", "0.44670713", "0.44670007", "0.44646466" ]
0.70245516
0
Returns a new EPO::Observer for itself
def observer Observer.for_db(self) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_observer\n MockObserver.new self\n end", "def new_observer(model, &block)\n observer = Class.new(Mongoid::Observer) do\n attr_accessor :notifications\n\n def initialize\n super\n @notifications = []\n end\n end\n\n (class << observer; self; end).class_eval do\n define_method(:name) do\n \"#{model.name}Observer\"\n end\n end\n\n observer.observe(model)\n observer.class_eval(&block) if block_given?\n observer\n end", "def observe\n Observable.new(super)\n end", "def add_observer(&block)\n super(Observer.new(block))\n end", "def observe(obj)\n obj.add_observer self\n end", "def initialize( *args )\n\t\t\t@observers = []\n\t\t\tsuper\n\t\tend", "def add_observer(observer)\n end", "def add_observer(observer)\n end", "def add_observer &observer\n observers << observer\n end", "def add_observer!(klass)\n\t\tsuper unless self.class.orbserved?(klass)\n\tend", "def add_observer!(klass)\n super and define_callbacks(klass)\n end", "def observers\n @observers ||= []\n end", "def initialize\n @connector=ConnectionManager.instance\n @connector.add_observer(self)\n end", "def observability\n\t\treturn Observability.observer\n\tend", "def initialize\n Set.new(observed_classes + observed_subclasses).each { |klass| add_observer! klass }\n end", "def add_observer(observer)\n @conductor.observers << observer\n self\n end", "def add_observer(name, obs)\n @observ_list[name] = obs\n end", "def add_observer(&observer)\n\t\t@observers << observer\n\tend", "def election_observer(name, opts={})\n ZK::Election::Observer.new(self, name, opts)\n end", "def instantiate_observers\n return if @observers.blank?\n @observers.each do |observer|\n if observer.respond_to?(:to_sym) # Symbol or String\n observer.to_s.camelize.constantize.instance\n elsif observer.respond_to?(:instance)\n observer.instance\n else\n raise ArgumentError, \"#{observer} must be a lowercase, underscored class name (or an instance of the class itself) responding to the instance method. Example: Person.observers = :big_brother # calls BigBrother.instance\"\n end\n end\n end", "def add_observer(observer) \n unless observer.respond_to? :update\n raise NoMethodError, \"observer, #{observer}, needs to respond to #update\" \n end\n LOG.debug \"#{self} is attempting to add an observer, #{observer}.\"\n @observers << observer\n LOG.debug \"#{observer} is now listening for events on #{self}.\"\n end", "def add_observer(o)\n @cpg.add_observer(o)\n end", "def add_observer(observer)\n @observers << observer\n end", "def inform_obeservers\n\t\t@observers.each { |observer| observer.update(self) }\n\tend", "def modify_observers_on_create\t\t\n\t\t\t\t\t@@observers ||= {}\n\t\t\t\t\t$TRACE.debug 9, \"modify_observers_on_create(before): #{@@observers.inspect}\"\n\t\t\t\t\t\n\t\t\t\t\tobject_id_key = \"#{self.object_id}\"\n\t\t\t\t\t$TRACE.debug 5, \"modify_observers_on_create: for #{object_id_key} and #{self.attributes['id']}\"\n\t\t\t\t\tif @@observers.has_key?(object_id_key) then\n\t\t\t\t\t\tobservers = @@observers[object_id_key]\n\t\t\t\t\t\t$TRACE.debug 9, \"modify_observers_on_create: found key, observers = #{observers.inspect}\"\n\t\t\t\t\t\t@@observers.delete(object_id_key)\n\t\t\t\t\t\t@@observers[self.attributes[\"id\"]] = observers\n\t\t\t\t\tend\n\t\t\t\t\t$TRACE.debug 9, \"modify_observers_on_create(after): #{@@observers.inspect}\"\n\t\t\t\tend", "def toObservable(*args)\n result = super\n\n unless caller.first.match(/toObservable/) || caller.first.match(/observe/)\n result = Observable.new(result)\n end\n\n result\n end", "def observed_class\n if observed_class_name = name[/(.*)Observer/, 1]\n observed_class_name.constantize\n else\n nil\n end\n end", "def initialize\n @conn=MessageDistributor.instance\n @conn.add_observer(self)\n super(@conn)\n end", "def notify_observers(*args, &block)\n notify_to(observers, *args, &block)\n self\n end", "def notify\n puts 'Subject: Notifying observers...'\n @observers.each { |observer| observer.update(self) }\n end", "def on_change(name = nil, recursive = false, &block)\n attach\n name = name.to_s if name\n @observers[name] << Observer.new(recursive, block)\n self\n end", "def to_s\n \"Observer<#{@class_name}>\"\n end", "def observers\n @observer_peers\n end", "def thread\n return @conn.observer_thread(self)\n end", "def observe(event, observer = (default = true; nil))\n if default\n register event, Proc.new\n return self\n end\n return self unless observer\n observer = observer.to_proc\n register event, observer\n return self unless block_given?\n begin\n yield\n ensure\n unobserve event, observer\n end\n self\n end", "def notify_observers\n\t\t@observers.each do |observer|\n\t\t\tobserver.update(self)\n\t\tend\n\tend", "def initialize(obs)\n @obs = obs\n end", "def attach(observer)\n puts 'Subject: Attached an observer'\n @observers << observer\n end", "def with_notifier\n self\n end", "def detach\n Base.instance.delete_observer self\n end", "def attach(observer)\n puts 'Subject: Attached an observer.'\n @observers << observer\n end", "def initialize(*args, &block)\n @observing_procs = {}\n super(*args, &block)\n end", "def initialize_obs\n @observers = []\n self.logger.debug \"Initialized ObservedStore, added observers array\" if not self.logger.nil?\n end", "def toObservable(*args)\n result = super\n\n # Only wrap the outer-most call; otherwise Java gets angry because the class of the\n # returned object won't match the signature when the calls recurse\n unless caller.first.match(/toObservable/) || caller.first.match(/observe/)\n result = Observable.new(result)\n end\n\n result\n end", "def notify\n @observers.each { |observer| observer.update }\nend", "def observe(observed, refine: nil, trigger: ReactiveObservers.configuration.default_trigger, notify: nil, **options)\n self.class.add_observer_to_observable self, observed, options.merge(refine: refine, trigger: trigger, notify: notify)\n end", "def events\n @events ||= RubyEvents::Events.new(self)\n end", "def create_on_completed\n OnCompletedNotification.new\n end", "def add(*observer)\n if observer.respond_to?(:each)\n @observers = observer.each\n else\n @observers << observer\n end\n end", "def with_observer callback, model_class, attributes\n observer = LightningTest::Observer.new(callback, attributes)\n\n # check for find callback, and create the after_find explicitly\n # since active record won't call it otherwise\n if callback.to_s == 'find'\n model_class.send(:define_method, :after_find){}\n end\n\n model_class.add_observer(observer)\n yield\n model_class.delete_observer(observer)\n\n @last_observer = observer\n\n observer.passed?\n end", "def add_observer_to_observable(observer, observed, options)\n ReactiveObservers::Observer::Container.new(observer, observed, options).tap do |observer_container|\n observer_container.observed_klass.register_observer observer_container\n end\n end", "def initialize(attrs=nil)\n super(attrs)\n after_create() if new_object?\n end", "def initialize(base)\n @base = base\n @events = []\n end", "def observe(observable, persistent: true)\n # register for observable updates, and set initial value\n if value = observable.add_observer(self, persistent: persistent)\n debug { \"observe #{observable} => #{value}\" }\n\n add(observable, value)\n else\n debug { \"observe #{observable}...\" }\n\n add(observable)\n end\n end", "def observe(observable, *args)\n options = args.last.is_a?(Hash) ? args.last : {}\n return if observable.nil?\n return if options[:ignore_frozen] && observable.frozen?\n unless observable.is_a?(Observable)\n # TODO refactor code to be more smart/polymorphic/automated and honor open/closed principle (e.g. for SomeClass, search if there is ObservableSomeClass)\n if observable.is_a?(Array)\n observable.extend(ObservableArray)\n elsif observable.is_a?(Hash)\n observable.extend(ObservableHash)\n else\n observable.extend(ObservableModel)\n end\n end\n args = compact_args(args)\n observable.add_observer(self, *args)\n ensure_registration_for!(observable, *args)\n end", "def supports_observers?\n false\n end", "def add_observer_with_history(observer)\n @mutex.synchronize do\n if ready?\n # XXX: this is a bit hacky with both the functional and ivar access\n observer.send(:update, self, value(false), @success)\n else\n add_observer_without_history(observer)\n end\n end\n end", "def dematerialize\n AnonymousObservable.new do |observer|\n\n new_obs = Rx::Observer.configure do |o|\n o.on_next {|x| x.accept observer }\n o.on_error(&observer.method(:on_error))\n o.on_completed(&observer.method(:on_completed))\n end\n\n subscribe new_obs\n end\n end", "def notify\n changed(true)\n notify_observers(self)\n end", "def owner\n class << receiver; self; end\n end", "def event_subscriber\n @event_subscriber ||= EventSubscriber.make!(event: event)\n end", "def call(new_value=nil, *extra_args)\n @observer_block.call(new_value, *extra_args)\n end", "def remove_observer(observer)\n end", "def remove_observer(observer)\n end", "def remove_observer(observer)\n end", "def remove_observer(observer)\n end", "def to_observable(scheduler = ImmediateScheduler.instance)\n AnonymousObservable.new do |observer|\n scheduler.schedule lambda {\n accept observer\n observer.on_completed if on_next?\n }\n end\n end", "def observed(observe)\n observe.call if observe.ready?\n end", "def notifier\n @reactor_notify = if block_given?\n Proc.new\n else\n @reactor_notify_default\n end\n self\n end", "def ignore_elements\n AnonymousObservable.new do |observer|\n new_obs = Rx::Observer.configure do |o|\n o.on_next {|_| }\n o.on_error(&observer.method(:on_error))\n o.on_completed(&observer.method(:on_completed))\n end\n\n subscribe new_obs\n end\n end", "def add_observer(observer)\n super\n \n @observer_queues = {} unless defined? @observer_queues\n @observer_queues[observer]=Queue.new\n \n @observer_threads = {} unless defined? @observer_threads\n @observer_threads[observer]=Thread.new(observer){\n loop do\n arg=@observer_queues[observer].pop\n observer.update(*arg)\n end\n }\n end", "def add_observer object, func = :update\n @sub_lock.synchronize do\n subscribers.fetch(channel) { |k|\n Thread.new {\n start_listener\n unwrap(connection).exec \"LISTEN #{channel}\"\n @observing.release\n }\n subscribers[k] = {}\n }[object] = func\n end\n\n @observing.await\n end", "def add_object_observer(object)\n @object_observers ||= []\n @object_observers.push(object)\n end", "def initialize(options = {})\n @options = options\n @observer_peers = {}\n add_plugins( :extend, options[:extends])\n end", "def notifier\n @notifier ||= MList::Manager::Notifier.new\n end", "def initialize\n @subscribers = []\n end", "def initialize(model = nil, attach_to = nil, attach_name = nil)\n clear\n\n @model = model\n @observers = Hash.new { |h, k| h[k] = [] }\n @filters = {}\n\n if attach_to\n link_to(attach_to, attach_name)\n end\n\n if model\n attach_model\n attach\n end\n end", "def initialize # hook/callback/lifecycle event: because it is a method automatically fired by another method\n self.cry # explicit receiver of self - same as line below\n cry # implicit receiver of self - same as line above\n # Ruby will first check cry as a variable; when that fails, Ruby will assume it is a method on the class itself - implied \"self\"\n @birthdate = Time.now\n @@all << self # How does an object refer to itself? self! stores object ID\n end", "def method_missing(meth, *args)\n return true if meth.to_s =~ /^observe_/\n super(meth, *args)\n end", "def accept(observer)\n observer.on_completed\n end", "def initialize(consumer, channel, exchange_in, exchange_out)\n @consumer, @channel, @exchange_in, @exchange_out = consumer, channel, exchange_in, exchange_out\n @consumer.add_observer(self)\n @consumer.consumer_manager = self\n end", "def notify_and_delete_observers(*args, &block)\n old = clear_observers_and_return_old\n notify_to(old, *args, &block)\n self\n end", "def on subject\n @subject = subject\n self\n end", "def event\n @event ||= build_event\n end", "def event\n @event ||= build_event\n end", "def __delegate\n @o\n end", "def initialize(notifications_engine)\n @notifications_engine = notifications_engine\n end", "def initialize()\n @callbacks = {}\n end", "def remove_observer(o)\n @cpg.remove_observer(o)\n end", "def observe_candidate\n observe { run_candidate }\n end", "def with_exclusive_observation\n previous_observers = Houston.observer.instance_variable_get(:@observers)\n begin\n Houston.observer.clear!\n yield\n ensure\n Houston.observer.instance_variable_set(:@observers, previous_observers)\n end\n end", "def notify_observers(method)\n self.class.observer_instances.inject(true) do |accum, obs|\n obs.update(method, self) && accum\n end\n end", "def initialize entry_uri, options = {}, &blk\n @name = options[:name] || \"0x#{object_id}\"\n # URI for the observer node \n @uri = \"/gom/observer#{entry_uri.sub ':', '/'}/.#{@name}\"\n\n @options = Defaults.merge options\n @entry_uri = entry_uri\n @callback = options[:callback] || blk;\n @operations = (@options[:operations] || []).join ', '\n @uri_regexp = (re = @options[:uri_regexp]) && (Regexp.new re) || nil\n @condition_script = @options[:condition_script]\n end", "def on_change (&block)\n debug \"Somebody bound to me\"\n @change_observers << block\n end", "def set_observer_head\n @observer_head = ObserverHead.find(params[:id])\n end", "def new\n @event = Event.new\n end", "def event\n @event ||= ::Event.find(self.id)\n end", "def create_fake_observable(obj)\n return if !obj.respond_to?(:observables) || obj.observables.present?\n\n Observable.create!(:remote_object_id => obj.cybox_object_id, :remote_object_type=> obj.class)\n obj.reload\n end", "def run\n logger.debug \"observer run start\"\n\n @observable.observe do |value|\n @value = value\n end\n\n logger.debug \"observer run complete with value=#{@value}\"\n\n @value\n end", "def observed_class_inherited(subclass) #:nodoc:\n self.class.observe(observed_classes + [subclass])\n add_observer!(subclass)\n end" ]
[ "0.7416641", "0.6902502", "0.6742458", "0.6701422", "0.65298146", "0.62121093", "0.6184156", "0.6184156", "0.6126644", "0.6088997", "0.5980146", "0.5919738", "0.5909515", "0.5871655", "0.58587646", "0.57926106", "0.5790771", "0.57283914", "0.5713082", "0.5569282", "0.554742", "0.55193204", "0.5517772", "0.5501504", "0.54854065", "0.5445408", "0.5440728", "0.5435374", "0.5421029", "0.53902376", "0.53832567", "0.5363946", "0.53638977", "0.5350981", "0.5290477", "0.5273634", "0.5262679", "0.5235865", "0.5234957", "0.52309227", "0.52307916", "0.5219586", "0.5210998", "0.51971555", "0.5164524", "0.5143794", "0.5117834", "0.5116849", "0.5069091", "0.5055975", "0.50389415", "0.50295293", "0.5026214", "0.5015581", "0.5001937", "0.499615", "0.49941918", "0.49918202", "0.49681154", "0.495608", "0.4955765", "0.49444565", "0.49327162", "0.49327162", "0.49327162", "0.49327162", "0.49271238", "0.49238646", "0.4923326", "0.4919601", "0.4919385", "0.49025863", "0.48744097", "0.4869205", "0.4863393", "0.48477346", "0.48447224", "0.48417038", "0.48410386", "0.48221314", "0.4819284", "0.48110282", "0.47996315", "0.4769565", "0.4769565", "0.4757904", "0.4736718", "0.47266635", "0.47254106", "0.47214633", "0.47023195", "0.46979818", "0.46962675", "0.46959665", "0.46934867", "0.46732092", "0.4656373", "0.46370667", "0.4632635", "0.4619471" ]
0.6469814
5
Iterates on every resource found and understood in the filesystem directory root. If no block is given, returns an iterator.
def each_resource_observation(root) if block_given? xp = observer models.each do |model| xp.on(model) do |obs| yield obs end end xp.read_tree(root) else Enumerator.new(self, :each_resource_observation, root) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def each(&block)\n\t\t\t\treturn to_enum unless block_given?\n\t\t\t\t\n\t\t\t\t::Dir.glob(full_pattern, ::File::FNM_DOTMATCH) do |path|\n\t\t\t\t\t# Ignore `.` and `..` entries.\n\t\t\t\t\tnext if path =~ /\\/..?$/\n\t\t\t\t\t\n\t\t\t\t\tyield Path.new(path, @root)\n\t\t\t\tend\n\t\t\tend", "def each(&block)\n files.each(&block)\n\n directories.each do |subdirectory|\n block.call(subdirectory)\n\n subdirectory.each(&block)\n end\n end", "def iterate resource, &block\n data = YAML.load_file \"#{@path}/#{resource}\" # cached file may be either in YAML or JSON format\n data['items'].each do |i|\n yield(i)\n end\n nil\n end", "def each_file\n return to_enum(__method__) unless block_given?\n\n paths.each do |root|\n stat_tree(root).each do |filename, stat|\n if stat.file?\n yield filename\n end\n end\n end\n\n nil\n end", "def each_file_in_tree\n self.directories_in_tree.find_each do |directory|\n next if directory.nil?\n directory.cfs_files.find_each do |cfs_file|\n next if cfs_file.nil?\n\n yield cfs_file if block_given?\n end\n end\n end", "def foreach(path = nil, *rs)\n path = \".\" unless path\n path = expand_path(path)\n\n if File.directory?(path)\n\tDir.foreach(path){|fn| yield fn}\n else\n\tIO.foreach(path, *rs){|l| yield l}\n end\n end", "def find_files(block)\n files = []\n block.scan(URL_PATTERN).each do |attribute, path|\n if !URI.parse(path).absolute?\n resource = create_resource_file(attribute, path)\n files << resource if resource\n end\n end\n files\n end", "def each_directory(&block)\n @directories.each(&block)\n end", "def foreach(&block)\n ::Dir.foreach(path, &block)\n end", "def each_object_path (path=@basepath, &block)\n\n Find.find(path) do |p|\n\n next unless File.exist?(p)\n next if File.stat(p).directory?\n #next unless OpenWFE::ends_with(p, '.yaml')\n next if p[-5..-1] != '.yaml'\n\n #ldebug { \"each_object_path() considering #{p}\" }\n block.call(p)\n end\n end", "def each_entry(&block) # :yield: p\n Dir.foreach(path) {|f| yield Path::Name.new(f) }\n end", "def each\n Directory.all.each do |node_id|\n yield find node_id\n end\n end", "def each(&block)\n @files.each(&block)\n end", "def each\n @sources.each { |directory, path| yield directory, path }\n end", "def each &block\n return enum_for(:each) unless block_given?\n return if !@root\n @root.each &block\n end", "def files(rootDir)\n Dir.foreach(rootDir) do |dir|\n if dir != \".\" && dir != \"..\"\n puts \"Processing \" + dir\n Dir.foreach(rootDir + \"/\" + dir) do |file|\n if file != \".\" && file != \"..\"\n open(rootDir + \"/\" + dir + \"/\" + file) do |f|\n yield(f)\n end\n end\n end\n end\n end\nend", "def each\n Dir[ path_pattern ].each { |path| yield open(path) }\n end", "def each(&block)\n root.each(&block)\n end", "def each(&block)\n if block_given?\n @fog_wrapper.each do |key|\n yield file(key)\n end\n else\n to_enum(:each)\n end\n end", "def each(&blk)\n Utils::Kernel.Array(self).each do |path|\n blk.call Utils::Kernel.Pathname(path).realpath\n end\n end", "def foreach(path)\n handle = sftp.opendir!(path)\n while entries = sftp.readdir!(handle)\n entries.each { |entry| yield entry }\n end\n return nil\n ensure\n sftp.close!(handle) if handle\n end", "def each(&block)\n\t\tclient.fs.sftp.dir.foreach(self.path, &block)\n\tend", "def dir_contents(path, &b)\n path = Pathname.new(path).cleanpath\n if fs.directory?(path)\n entries = fs.entries(path).map do |entry|\n entry_path = path + entry\n if fs.directory?(entry_path)\n dir_item(entry)\n else\n file_item(entry, fs.get_size(entry_path))\n end\n end\n yield entries\n else\n yield Set.new\n end\n end", "def each_file(&block)\n @files.keys.each do |file|\n yield(file)\n end\n end", "def each(&block)\n SemanticLogger.named_tagged(dirmon_entry: id.to_s) do\n # Case insensitive filename matching\n Pathname.glob(pattern, File::FNM_CASEFOLD).each do |pathname|\n next if pathname.directory?\n pathname = begin\n pathname.realpath\n rescue Errno::ENOENT\n logger.warn(\"Unable to expand the realpath for #{pathname.inspect}. Skipping file.\")\n next\n end\n\n file_name = pathname.to_s\n\n # Skip archive directories\n next if file_name.include?(self.class.default_archive_directory)\n\n # Security check?\n if (whitelist_paths.size > 0) && whitelist_paths.none? { |whitepath| file_name.to_s.start_with?(whitepath) }\n logger.error \"Skipping file: #{file_name} since it is not in any of the whitelisted paths: #{whitelist_paths.join(', ')}\"\n next\n end\n\n # File must be writable so it can be removed after processing\n unless pathname.writable?\n logger.error \"Skipping file: #{file_name} since it is not writable by the current user. Must be able to delete/move the file after queueing the job\"\n next\n end\n block.call(pathname)\n end\n end\n end", "def each(&block)\n root.each(&block)\n end", "def directories(&block)\n return @directories unless block_given?\n\n instance_eval(&block)\n end", "def each_file\n @sftp.dir.foreach(@path.to_s) do |entry|\n filename = entry.name\n yield filename unless directory? filename\n end\n end", "def each( &block )\n\t\tself.valid_dirs.each( &block )\n\tend", "def breadth_first_scan_old(root, &block)\n if root.file?\n yield root\n return\n end\n\n children = Pathname(root).children.sort\n begin\n children.each { |child| yield child } # breadth\n children.each { |child| breadth_first_scan(child, &block) if child.directory? }\n rescue Errno::EACCES, Errno::EPERM => e\n STDERR.puts(\"Error: #{e}\".red)\n end\nend", "def dir_foreach( *args, &block )\n warn \"Path#dir_foreach is obsoleted. Use Path#each_entry.\"\n each_entry( *args, &block )\n end", "def each_file(directory)\n directory_contents(directory).each do |path|\n yield path\n end\n end", "def each\n files.each do |file|\n yield file\n end\n end", "def each_file\n return unless block_given?\n\n loc_path = LokaliseRails.locales_path\n Dir[\"#{loc_path}/**/*\"].sort.each do |f|\n full_path = Pathname.new f\n\n next unless file_matches_criteria? full_path\n\n relative_path = full_path.relative_path_from Pathname.new(loc_path)\n\n yield full_path, relative_path\n end\n end", "def dir_foreach(*args, &block)\n warn \"Path::Name#dir_foreach is obsoleted. Use Path::Name#each_entry.\"\n each_entry(*args, &block)\n end", "def each(&block)\n\t\t\t\tfiles = []\n\n\t\t\t\t@filenames.each do |filename|\n\t\t\t\t\tf = open_file(filename)\n\t\t\t\t\tf.each do |line|\n\t\t\t\t\t\tline.gsub!(\"\\n\",\"\")\n\n\t\t\t\t\t\t# Ignore these lines since they does not contain a\n\t\t\t\t\t\t# filename.\n\t\t\t\t\t\tnext if /^#/.match(line)\n\n\t\t\t\t\t\t# Skip empty lines as well.\n\t\t\t\t\t\tnext if /^\\s*$/.match(line)\n\n\t\t\t\t\t\tline = File.join(@prefix, line) unless @prefix.nil?\n\t\t\t\t\t\tfiles << line\n\t\t\t\t\tend\n\t\t\t\t\tclose_file(f)\n\t\t\t\tend\n\n\t\t\t\tfiles.each(&block)\n\t\t\tend", "def each_object (&block)\n\n each_object_path do |path|\n block.call(load_object(path))\n end\n end", "def enumerate_files search_path\n Enumerator.new do |e|\n Dir\n .glob(search_path)\n .each do |filename|\n if File.file?(filename)\n $stderr.puts \"Reading #{filename}\" if $verbose\n File.open filename do |file|\n e.yield file.read()\n end\n end\n end\n end\nend", "def each_inode(&block)\n return enum_for(:each_inode) unless block_given?\n\n each_inode_list.each do |_name, list|\n list.each do |page|\n page.each_allocated_inode(&block)\n end\n end\n end", "def each(&block)\n each_node([], @root, block)\n end", "def each_statement(&block)\n if block_given?\n unless @processed || @root.nil?\n # Add prefix definitions from host defaults\n @host_defaults[:uri_mappings].each_pair do |prefix, value|\n prefix(prefix, value)\n end\n\n # parse\n parse_whole_document(@doc, RDF::URI(base_uri))\n\n # Look for Embedded RDF/XML\n unless @root.xpath(\"//rdf:RDF\", \"rdf\" => \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\").empty?\n extract_script(@root, @doc, \"application/rdf+xml\", **@options.merge(base_uri: base_uri)) do |statement|\n @repository << statement\n end\n end\n\n # Look for Embedded microdata\n unless @root.xpath(\"//@itemscope\").empty?\n begin\n require 'rdf/microdata'\n add_debug(@doc, \"process microdata\")\n @repository << RDF::Microdata::Reader.new(@doc, **options)\n rescue LoadError\n add_debug(@doc, \"microdata detected, not processed\")\n end\n end\n\n # Perform property copying\n copy_properties(@repository) if @options[:reference_folding]\n\n # Perform vocabulary expansion\n expand(@repository) if @options[:vocab_expansion]\n\n @processed = true\n end\n\n # Return statements in the default graph for\n # statements in the associated named or default graph from the\n # processed repository\n @repository.each do |statement|\n case statement.graph_name\n when nil\n yield statement if @options[:rdfagraph].include?(:output)\n when RDF::RDFA.ProcessorGraph\n yield RDF::Statement.new(*statement.to_triple) if @options[:rdfagraph].include?(:processor)\n end\n end\n\n if validate? && log_statistics[:error]\n raise RDF::ReaderError, \"Errors found during processing\"\n end\n end\n enum_for(:each_statement)\n end", "def test_foreach\n\t\tOle::Storage.open(@io) {\n\t\t\t|zf|\n\n\t\t\tblockCalled = false\n\t\t\tassert_raise(Errno::ENOENT, \"No such file or directory - noSuchDir\") {\n\t\t\t\tzf.dir.foreach(\"noSuchDir\") { |e| blockCalled = true }\n\t\t\t}\n\t\t\tassert(! blockCalled)\n\n\t\t\tassert_raise(Errno::ENOTDIR, \"Not a directory - file1\") {\n\t\t\t\tzf.dir.foreach(\"file1\") { |e| blockCalled = true }\n\t\t\t}\n\t\t\tassert(! blockCalled)\n\n\t\t\tentries = []\n\t\t\tzf.dir.foreach(\".\") { |e| entries << e }\n\t\t\tassert_equal(['.', '..', \"dir1\", \"dir2\", \"file1\"].sort, entries.sort)\n\n\t\t\tentries = []\n\t\t\tzf.dir.foreach(\"dir1\") { |e| entries << e }\n\t\t\tassert_equal(['.', '..', \"dir11\", \"file11\", \"file12\"], entries.sort)\n\t\t}\n\tend", "def each &block\n @root.each(&block)\n end", "def list_files\n Find.find(path) do |element| yield element end\n end", "def each_file(&block)\n each_tailer { |t| t.file }.map(&block)\n end", "def foreach(*args, &block)\n warn \"Path::Name#foreach is obsoleted. Use each_line or each_entry.\"\n if FileTest.directory? path\n # For polymorphism between Dir.foreach and IO.foreach,\n # Path::Name#foreach doesn't yield Path::Name object.\n Dir.foreach(path, *args, &block)\n else\n IO.foreach(path, *args, &block)\n end\n end", "def each(&block)\n File.open(filepath, 'rb') do |io|\n while part = io.read(block_size)\n yield part\n end\n end\n end", "def read_dir(dir, &blk)\n Dir.chdir(dir){\n Dir[\"*\"].each do |folder|\n unless ::File.directory?(folder)\n yield ::File.expand_path(folder)\n else\n read_dir(folder, &blk) unless ::File.symlink?(folder)\n end\n end\n }\n end", "def each\n @roots.each {|cert| yield cert}\n end", "def each\n @roots.each {|cert| yield cert}\n end", "def find_resources(&block)\n found = Varnisher::Urls.new\n\n self.class.resources.each do |resource|\n found += find_resource(resource, &block)\n end\n\n Varnisher.log.debug ''\n Varnisher.log.info \"#{found.length} total resources found.\\n\"\n\n found\n end", "def each(partition=nil, &block)\n if partition.nil?\n index.each do |id, info|\n yield find(id)\n end\n else\n S3Object.stream(File.join(basedir, p), bucket_name) do |f|\n until f.eof?\n yield Marshal.load(f)\n end\n end\n end\n end", "def each(&block)\n @child_path_parts.each do |key, value|\n yield value\n end\n end", "def each_data_dir(path)\n return enum_for(:each_data_dir,path) unless block_given?\n\n each_data_path(path) do |full_path|\n yield(full_path) if File.directory?(full_path)\n end\n end", "def find_source block, uri\n to_check = [block.document.base_dir]\n checked = []\n\n resources = block.document.attr 'resources'\n if resources and not resources.empty?\n begin\n to_check += CSV.parse_line(resources)\n rescue CSV::MalformedCSVError => error\n logger.error message_with_context \"Error loading [resources]: #{error}\",\n :source_location => block.source_location\n end\n end\n\n while (dir = to_check.shift)\n checked << block.normalize_system_path(uri, dir)\n return checked.last if File.readable? checked.last\n next unless Dir.exist?(dir)\n Dir.new(dir).each { |f|\n next if f == '.' || f == '..'\n f = File.join(dir, f)\n to_check << f if File.directory?(f)\n }\n end\n\n # We'll skip images we can't find but we should log something about it so\n # we can fix them.\n logger.warn message_with_context \"can't read image at any of #{checked}\", :source_location => block.source_location\n nil\n end", "def each(&block)\n if block_given?\n current = self\n while current\n coll = current.respond_to?(@key) ? current.send(@key) : _resource\n coll.each(&block)\n break unless current._links[:next]\n\n current = current._links.next\n end\n else\n to_enum(:each)\n end\n end", "def each_lookup(&block)\n Dir.chdir(self.options[:dir]) do\n Dir.new(\".\").each do |filename|\n if filename.include?(LOOKUP_EXTENSIONS[self.options[:format]])\n location_name = filename \\\n .gsub(LOOKUP_EXTENSIONS[self.options[:format]], \"\") \\\n .gsub(self.options[:postfix], \"\")\n\n next if self.options[:unwanted_chars] && location_name =~ self.options[:unwanted_chars]\n\n obj = from_lookup(location_name)\n yield obj, location_name\n end\n end\n end\n end", "def in_each_dir\n dirs.each do |dir|\n Dir.chdir(dir) do\n yield(dir)\n end\n end\n end", "def each_resource(&block)\n Chef::Resource.constants.each do |res_class_name|\n res_class = Chef::Resource.const_get(res_class_name)\n next unless res_class.is_a?(Class) && res_class < Chef::Resource\n res_name = @recipe.convert_to_snake_case(res_class_name.to_s)\n block.call(res_name, res_class)\n end\n end", "def each_directory\n @data[:dirs].each_pair do |name, dir|\n yield Directory::new(name, dir)\n end\n end", "def each_dir\n self.exit_list.each do |e|\n yield e if e\n end\n end", "def each_readable_with_basename basename, &block # :yields: path, parsed_content\n each_existing_readable(\"#{basename}#{FileLoader::make_wildcard_for_extensions(@readers.keys)}\", nil, &block)\n end", "def each_entry( &block ) # :yield: p\n Dir.foreach( expand_tilde ) { |f| yield self.class.new( f ) }\n end", "def find_all(&block)\n @asset.representation_utis.each do |uti|\n find_by_uti(uti) do |rep|\n block.call(rep)\n end\n end\n end", "def traverse(root, callback = nil)\n Dir.glob(root + '/*').each{|entity|\n isFileOrDir = Dir.exists?(entity) ? true : false\n if callback != nil\n callback.call(isFileOrDir, entity)\n end\n self.traverse(entity, callback)\n }\n end", "def each\n return enum_for unless block_given?\n\n while (chunk = read)\n yield chunk\n end\n end", "def each_advisory_path(&block)\n Dir.glob(File.join(@path,'gems','*','*.yml'),&block)\n end", "def each(&block)\n return enum_for(:each) unless block_given?\n \n # if using the block form only, don't \"next\" for internal iteration\n if @block && !@enum\n @block.call Enumerator::Yielder.new(&block)\n else\n rewind\n\n until end?\n yield self.next\n end\n end\n \n self\n end", "def each\n file_rec = next_candidate\n until file_rec.nil?\n yield file_rec\n\n file_rec = next_candidate\n end\n end", "def each(&block)\n @tarreader.each { |entry| yield entry }\n ensure\n @tarreader.rewind\n end", "def breadth_first_scan(root, &block)\n root = slashed(root)\n \n dirs, files = listdir(root)\n path_id = File.lstat(root).ino\n \n if seenpath = $visited[path_id]\n STDERR.puts \"*** WARNING: Already seen #{root.inspect} as #{seenpath.inspect}\".red if $verbose\n else\n $visited[path_id] = root\n \n dirs.each { |f| yield root, f }\n files.each { |f| yield root, f }\n \n for dir in dirs\n breadth_first_scan(root+dir, &block)\n end\n end\nend", "def each_directory_in_tree(include_self: true)\n self.directories_in_tree(include_self: include_self).find_each do |directory|\n yield directory\n end\n end", "def each_file\n files.each { |filename| yield filename }\n end", "def resources &block\n rc = components.collect do |resource_name, component|\n [resource_name.to_s.singularize.to_sym, component[:resource], component.slice(:title, :exclude, :namespace)]\n end\n last = rc.slice!(-1)\n parents = rc.inject(Hash.new){|p, v| p.merge!(v[0]=>v[1])}\n yield(parents, last[0], last[2])\n end", "def each\n changeset.each { |file| yield file }\n end", "def discover_items_via_crawl(root)\n Dir.glob(\"#{root}/**/*\").select { |fname| File.file?(fname) }\n end", "def each_data_file(path)\n return enum_for(:each_data_file,path) unless block_given?\n\n each_data_path(path) do |full_path|\n yield(full_path) if File.file?(full_path)\n end\n end", "def ri_paths &block\n RDoc::RI::Paths.each true, true, true, :all, *@extra_doc_dirs, &block #TODO: pass extra_dirs\n end", "def each(&block)\n find_each(&block)\n end", "def files\n return enum_for(:files) unless block_given?\n\n yield @filename\n end", "def each(&block)\n config.resolver.each(_container, &block)\n end", "def each_filename\n next_descend = path\n while next_descend != PathExpression.EMPTY\n dir, next_descend = PathExpression.descend(path)\n yield dir\n end\n end", "def each_with_id(file_suffix_re=/\\.(md|txt)$/, &block)\n Find.find(@root) do |path|\n if FileTest.directory?(path)\n if File.basename(path)[0] == ?.\n # Don't look any further into this directory.\n Find.prune\n else\n next\n end\n elsif path =~ file_suffix_re\n yield path, LibraryLocator.id_from_path(path)\n end\n end\n end", "def perform(directory_or_iterator)\n iterator = to_iterator(directory_or_iterator)\n next_file = nil\n (1..256).each do # the 256 could be any value > 1, but bigger numbers mean the iterator has to be serialized fewer times.\n next_file = iterator.next_file\n break if next_file.nil? # no more files in the directory!\n AssetProcessor.perform_async(next_file.to_s)\n end\n self.class.perform_async(iterator) if next_file\n end", "def each_file(&bl)\n unpack do |dir|\n Pathname(dir).find do |path|\n next if path.to_s == dir.to_s\n pathstr = path.to_s.gsub(\"#{dir}/\", '')\n bl.call pathstr unless pathstr.blank?\n end\n end\n end", "def each_partition(&block)\n Bucket.objects(bucket_name, :prefix => basedir) do |o|\n f = File.basename(o.key)\n next if f == 'index'\n yield f\n end\n end", "def files(ident_only=false, &block)\n return super if @init_files\n return to_enum(:files, ident_only) if ! block_given?\n\n repo.chdir do\n Dir.glob(child_repo_path(File.join(DIR_FILE, '*'))).each do |f|\n ident = File.basename(f)\n yield ident_only ? ident : file(ident)\n end\n end\n @init_files = true\n end", "def doc_resources(path, &block)\n res = @content_tree.resources(path)\n block.call(res) if block_given?\n res\n end", "def each\n return enum_for :each unless block_given?\n\n # We trust that the field exists and is an Enumerable\n resources.each do |resource|\n resource = @format_resource.call resource if @format_resource\n yield resource\n end\n end", "def each_file(&bl)\n unpack do |dir|\n Pathname.new(dir).find do |path|\n next if path.to_s == dir.to_s\n pathstr = path.to_s.gsub(\"#{dir}/\", '')\n bl.call pathstr unless pathstr.blank?\n end\n end\n end", "def breadth_first_scan(root, &block)\n puts \"=== \".light_black + root.light_cyan + \" ===\".light_black if $verbose\n\n root = slashed(root)\n \n dirs, files = listdir(root)\n path_id = File.lstat(root).ino\n \n if seenpath = $visited[path_id]\n STDERR.puts \"*** WARNING: Already seen #{root.inspect} as #{seenpath.inspect}\".red if $verbose\n else\n $visited[path_id] = root\n \n dirs.each { |f| yield root, f }\n files.each { |f| yield root, f }\n \n for dir in dirs\n breadth_first_scan(root+dir, &block)\n end\n end\nend", "def each(&block)\n return enum_for(:each) unless block_given?\n visit { |node| yield node }\n self\n end", "def foreach\n find_files.each do |file|\n yield(@build_result_dir, file)\n end\n end", "def each(&block)\n if block_given?\n Parallel.each(each_path, in_threads: threads) do |path|\n load_script_from_path path, &block\n end\n else\n self.enum_for :each\n end\n end", "def each_file\n self.files.each_pair do |path, data|\n if not data.empty?\n yield path, StateModule::File::new(path, data)\n end\n end\n end", "def read_all(&block); end", "def each(&block)\n yield self\n children.each {|c| c.each(&block)}\n end", "def each(options={}, &block)\n each_loadpath(&block)\n each_rubygems(&block)\n self\n end", "def each_resource(start_page, *args, params: nil, max_pages: nil, &block)\n each_page(start_page, *args, params: params, max_pages: max_pages) do |page|\n page.each_resource do |resource|\n block.call(resource)\n end\n end\n end", "def each()\n @root.each(\"\") do |k, v|\n yield(k, v)\n end\n end" ]
[ "0.70037407", "0.6722634", "0.67042804", "0.6681511", "0.6579728", "0.6531829", "0.64882153", "0.6474995", "0.6434192", "0.6372756", "0.63610375", "0.6266384", "0.6210932", "0.61989033", "0.6183553", "0.61811864", "0.6175031", "0.61565804", "0.6146548", "0.6128862", "0.6128548", "0.61059004", "0.607577", "0.6075456", "0.60686785", "0.60521364", "0.60513765", "0.60222095", "0.6021484", "0.6008732", "0.60009575", "0.5990338", "0.5981837", "0.59525627", "0.59437937", "0.5940232", "0.5935547", "0.59348303", "0.59238416", "0.5919615", "0.59195906", "0.5886074", "0.588521", "0.5876955", "0.5875104", "0.58556974", "0.5829675", "0.58072805", "0.5783858", "0.5783858", "0.5773361", "0.5773348", "0.57622975", "0.57479364", "0.5743397", "0.5740106", "0.57274026", "0.57249165", "0.57053316", "0.5691054", "0.56859416", "0.56750745", "0.5664667", "0.5657233", "0.56458175", "0.56451756", "0.56416374", "0.5640838", "0.5634787", "0.56212276", "0.56075406", "0.5603825", "0.55902916", "0.55817217", "0.55809534", "0.5577041", "0.5574764", "0.5567909", "0.5565239", "0.5560465", "0.5559712", "0.55359524", "0.5514212", "0.5514032", "0.5507241", "0.5481384", "0.54793197", "0.54791915", "0.54773474", "0.5464552", "0.5463182", "0.5462823", "0.5450104", "0.5442124", "0.5441318", "0.5440896", "0.54314536", "0.5431351", "0.54303706", "0.54234076" ]
0.55679625
77
Use callbacks to share common setup or constraints between actions.
def set_profile @user = User.find(params[:id]) @profile = @user.profile 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_handler\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def 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 action; end", "def action; end", "def action; end", "def action; end", "def action; 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 before_dispatch(env); end", "def process_action(...)\n send_action(...)\n 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 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 setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def action\n end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def config(action, *args); 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 before_action \n end", "def action\n end", "def setup\n # override this if needed\n end", "def matt_custom_action_begin(label); 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 setup_signals; 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 after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def initialize(*args)\n super\n @action = :set\nend", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def lookup_action; end", "def around_hooks; end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def save_action; end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def action_target()\n \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 setup(&blk)\n @setup_block = blk\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 callback_phase\n super\n end", "def advice\n end", "def call\n setup_context\n super\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 duas1(action)\n action.call\n action.call\nend" ]
[ "0.6162554", "0.60452986", "0.5945278", "0.59169763", "0.58877826", "0.5834763", "0.5775349", "0.5704972", "0.5704972", "0.56543803", "0.5621491", "0.5427202", "0.54093206", "0.54093206", "0.54093206", "0.53975695", "0.53776276", "0.53562194", "0.5340594", "0.5337824", "0.5328757", "0.5310255", "0.5300339", "0.5298796", "0.5295774", "0.5256034", "0.5243039", "0.5236007", "0.5235239", "0.5235239", "0.5235239", "0.5235239", "0.5235239", "0.52321917", "0.5227032", "0.52216744", "0.5216349", "0.52161187", "0.5210265", "0.5207244", "0.5177388", "0.5177142", "0.51747334", "0.516293", "0.51629275", "0.5155534", "0.51540613", "0.515197", "0.5151636", "0.5145279", "0.51380795", "0.5135777", "0.5117378", "0.5115066", "0.5115066", "0.5110235", "0.5106418", "0.50917816", "0.50909185", "0.50855017", "0.5082105", "0.506359", "0.5055345", "0.50546116", "0.50523037", "0.50523037", "0.50327307", "0.5024364", "0.5021113", "0.50174654", "0.50163317", "0.5000553", "0.50002855", "0.49991882", "0.49905527", "0.49905527", "0.49849054", "0.4982546", "0.4980941", "0.4979153", "0.49693102", "0.4967172", "0.49594432", "0.49564302", "0.49552485", "0.49533385", "0.49506924", "0.49452737", "0.49442786", "0.49347955", "0.49341312", "0.49295264", "0.49261844", "0.4925649", "0.49251428", "0.4920729", "0.49177617", "0.4916373", "0.49158472", "0.4915794", "0.49156648" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def profile_params params.require(:profile).permit(:name, :bio, :birthday, :twitter) 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
Use callbacks to share common setup or constraints between actions.
def set_point_guard_stat @point_guard_stat = PointGuardStat.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Only allow a trusted parameter "white list" through.
def point_guard_stat_params params.require(:point_guard_stat).permit(:position_name, :shorthand, :sport_id, :position_id, :sport_name, :event, :games_started, :games_played, :win, :loss, :wins, :losses, :minutes_played, :fieldgoals_made, :fieldgoal_attemps, :threepoints_made, :threepoint_attemps, :freethrows_made, :freethrow_attemps, :rebounds, :assists, :steals, :blocks, :points, :score, :opponent_score, :user_id, :stat_id, :sport_id, :position_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def filtered_parameters; end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n [:rating, :review]\n end", "def valid_params?; end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def filter_parameters; end", "def filter_parameters; end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def check_params; true; end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def list_params\n params.permit(:name)\n end", "def check_params\n true\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def additional_permitted_params\n []\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "def allow_params_authentication!; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end", "def quote_params\n params.permit!\n end", "def list_params\n params.permit(:list_name)\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def all_params; end", "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "def source_params\n params.require(:source).permit(all_allowed_params)\n end", "def user_params\n end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end", "def permitted_params\n @wfd_edit_parameters\n end", "def user_params\r\n end", "def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def params_permit\n params.permit(:id)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def filter_params\n params.permit(*resource_filter_permitted_params)\n end", "def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end", "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def argument_params\n params.require(:argument).permit(:name)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def parameters\n nil\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end", "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end" ]
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.63804525", "0.6373396", "0.6360051", "0.6355191", "0.62856233", "0.627813", "0.62451434", "0.6228103", "0.6224965", "0.6222941", "0.6210244", "0.62077755", "0.61762565", "0.61711127", "0.6168448", "0.6160164", "0.61446255", "0.6134175", "0.6120522", "0.6106709", "0.60981655", "0.6076113", "0.60534036", "0.60410434", "0.6034582", "0.6029977", "0.6019861", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.60184896", "0.60157263", "0.6005857", "0.6003803", "0.60012573", "0.59955895", "0.5994598", "0.5993604", "0.5983824", "0.5983166", "0.5977431", "0.597591", "0.5968824", "0.5965953", "0.59647584", "0.59647584", "0.59566855", "0.59506303", "0.5950375", "0.59485626", "0.59440875", "0.5930872", "0.5930206", "0.5925668", "0.59235454", "0.5917905", "0.59164816", "0.5913821", "0.59128743", "0.5906617", "0.59053683", "0.59052664", "0.5901591", "0.58987755", "0.5897456", "0.58970183", "0.58942604" ]
0.0
-1
Private: Initialize Asset wrapper from attributes Hash. Asset wrappers should not be initialized directly, only Environmentfind_asset should vend them. attributes Hash of ivars Returns Asset.
def initialize(attributes = {}) @attributes = attributes @content_type = attributes[:content_type] @filename = attributes[:filename] @id = attributes[:id] @load_path = attributes[:load_path] @logical_path = attributes[:logical_path] @metadata = attributes[:metadata] @name = attributes[:name] @source = attributes[:source] @uri = attributes[:uri] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attributes_for(path)\n AssetAttributes.new(self, path)\n end", "def initialize(asset)\n @asset = asset\n end", "def asset_attributes=(attributes)\n unless asset.new_record?\n asset.attributes = attributes\n end\n end", "def assets\n EnvironmentAssetMethodsFactory.new(self)\n end", "def initialize(attributes)\n super()\n self.identity = attributes[:identity]\n self.identity_type = attributes[:identity_type]\n self.public_key = attributes[:raw_public_key]\n self.scope = attributes[:scope] || Card::APPLICATION\n self.data = attributes[:data]\n self.info = attributes[:info]\n end", "def initialize(asset: nil, environment: nil, directory: nil)\n @asset = asset\n @environment = environment\n @directory = directory\n @target = ::File.join(directory, asset.digest_path)\n setup\n end", "def initialize(attrs={})\n load_attributes!(attrs)\n end", "def initialize(asset, mode, opts = {})\n @asset = asset\n @mode = mode\n @opts = opts\n end", "def initialize(attrs)\n @attributes = IdiomaticRubyWrapper(attrs.clone)\n end", "def initialize(attrs)\n @attributes = IdiomaticRubyWrapper(attrs.clone)\n end", "def initialize(attributes = {})\n\t\t\tload(attributes)\n\t\tend", "def asset_for_el(el)\r\n\t\t@asset_by_el[el] ||= begin\r\n\t\t\tif el['class'] && @class_by_ref[el['class']]\r\n\t\t\t\t@class_by_ref[el['class']].new(self,el)\r\n\t\t\telse\r\n\t\t\t\tapp.metadata.new_instance(self,el)\r\n\t\t\tend\r\n\t\tend\r\n\tend", "def initialize(attrs = {})\n @attributes = attrs\n\n # Set values where we have defined a reader, probably\n @attributes.each do |key, val|\n if respond_to?(key.to_sym)\n instance_variable_set(\"@#{key}\", val)\n end\n end\n end", "def initialize(attributes)\n @id = attributes['id']\n @name = attributes['name']\n @description = attributes['description']\n @equipment_type = attributes['equipmentType']\n @availability = attributes['availability']\n @manufacture_option_name = attributes['manufactureOptionName']\n @manufacture_option_code = attributes['manufactureOptionCode']\n @category = attributes['category']\n @attributes = attributes['attributes']\n @equipment = attributes['equipment']\n end", "def _init_action(action_hash)\n obj = _load_asset(ASSET_TYPE_ACTION, action_hash[:name])\n obj.parameters = action_hash[:parameters]\n obj\n end", "def initialize(attributes = {})\n load(attributes)\n end", "def initialize(attributes = {})\n load(attributes)\n end", "def init\n return unless options.init\n\n Cnfs::Core.asset_names.each do |asset|\n klass = asset.classify.constantize\n klass.init(context) if klass.respond_to?(:init)\n end\n end", "def initialize(**kwargs)\n assert_required_attributes(kwargs)\n assert_no_extra_attributes(kwargs)\n @attributes = Valuables::DeepFreeze.deep_freeze(kwargs)\n @hash = self.class.hash ^ @attributes.hash\n freeze\n end", "def initialize(**attributes)\n @attr = {}\n attributes\n end", "def initialize(attrs = {})\n load_attributes(attrs)\n load_properties(attrs)\n end", "def initialize(attributes)\n @type = attributes['attribute_type']\n @name = attributes['attribute_name']\n @json = attributes\n end", "def initialize(attributes)\n hash = attributes.dup\n @name = hash.delete(:name) or raise ArgumentError\n @lib = hash.delete(:lib) or raise ArgumentError\n # since MethodInspector scrapes arguments from file by default\n @file_parsed_args = true\n INIT_ATTRIBUTES.each do |e|\n instance_variable_set(\"@#{e}\", hash.delete(e)) if hash.key?(e)\n end\n\n after_initialize(hash)\n\n if (args = hash.delete(:args))\n if args.is_a?(Array)\n @args = args\n elsif args.to_s[/^\\d+/]\n @arg_size = args.to_i\n elsif args == '*'\n @args = [['*args']]\n end\n end\n @config = Util.recursive_hash_merge hash, hash.delete(:config) || {}\n end", "def initialize(attributes = nil)\n if attributes.is_a? Hash\n attributes.each do |key, value|\n self.send(key.to_s + \"=\", value)\n end\n end\n end", "def initialize(attributes = nil)\n if attributes.is_a? Hash\n attributes.each do |key, value|\n self.send(key.to_s + \"=\", value)\n end\n end\n end", "def build_from_hash(attributes)\n return nil unless attributes.is_a?(Hash)\n super(attributes)\n LicenseLicenseInfo.openapi_types.each_pair do |key, type|\n if attributes[LicenseLicenseInfo.attribute_map[key]].nil? && LicenseLicenseInfo.openapi_nullable.include?(key)\n self.send(\"#{key}=\", nil)\n elsif type =~ /\\AArray<(.*)>/i\n # check to ensure the input is an array given that the attribute\n # is documented as an array but the input is not\n if attributes[LicenseLicenseInfo.attribute_map[key]].is_a?(Array)\n self.send(\"#{key}=\", attributes[LicenseLicenseInfo.attribute_map[key]].map { |v| _deserialize($1, v) })\n end\n elsif !attributes[LicenseLicenseInfo.attribute_map[key]].nil?\n self.send(\"#{key}=\", _deserialize(type, attributes[LicenseLicenseInfo.attribute_map[key]]))\n end\n end\n\n self\n end", "def initialize attributes = {}\n @attributes = {}\n attributes.each { |attribute, value| set attribute, value }\n end", "def initialize(attributes = {})\n defaults.merge!(attributes).each do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n end", "def initialize(attributes = {})\n defaults.merge!(attributes).each do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n end", "def initialize(attributes = {})\n defaults.merge!(attributes).each do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n end", "def initialize(attributes = {})\n defaults.merge!(attributes).each do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n end", "def initialize(hash={})\n self.init_attrs_from_hash(hash)\n end", "def initialize(*attributes)\n KEYS.each_with_index{ |key, index| self[key] = attributes[index] }\n end", "def initialize(**attributes)\n attributes.map { |(k, v)| public_send(\"#{k}=\", v) }\n end", "def initialize(attrs)\n @attributes = {}\n attrs.each { |k, v| self[k] = v }\n end", "def build_from_hash(attributes)\n return nil unless attributes.is_a?(Hash)\n super(attributes)\n NiatelemetryNiaInventoryFabric.openapi_types.each_pair do |key, type|\n if attributes[NiatelemetryNiaInventoryFabric.attribute_map[key]].nil? && NiatelemetryNiaInventoryFabric.openapi_nullable.include?(key)\n self.send(\"#{key}=\", nil)\n elsif type =~ /\\AArray<(.*)>/i\n # check to ensure the input is an array given that the attribute\n # is documented as an array but the input is not\n if attributes[NiatelemetryNiaInventoryFabric.attribute_map[key]].is_a?(Array)\n self.send(\"#{key}=\", attributes[NiatelemetryNiaInventoryFabric.attribute_map[key]].map { |v| _deserialize($1, v) })\n end\n elsif !attributes[NiatelemetryNiaInventoryFabric.attribute_map[key]].nil?\n self.send(\"#{key}=\", _deserialize(type, attributes[NiatelemetryNiaInventoryFabric.attribute_map[key]]))\n end\n end\n\n self\n end", "def init_with(environment, coder)\n super\n\n @source = coder['source']\n @dependency_digest = coder['dependency_digest']\n\n @required_assets = coder['required_paths'].map { |p|\n p = expand_root_path(p)\n\n unless environment.paths.detect { |path| p[path] }\n raise UnserializeError, \"#{p} isn't in paths\"\n end\n\n p == pathname.to_s ? self : environment.find_asset(p, bundle: false)\n }\n @dependency_paths = coder['dependency_paths'].map { |h|\n DependencyFile.new(expand_root_path(h['path']), h['mtime'], h['digest'])\n }\n end", "def initialize(attrs = {})\n @attrs = attrs || {}\n @attrs.each do |key, value|\n self.class.class_eval { attr_reader key }\n instance_variable_set(\"@#{key}\", value)\n end\n end", "def init_with(environment, coder)\n super\n\n @source = coder['source']\n @dependency_digest = coder['dependency_digest']\n\n @required_assets = coder['required_paths'].map { |p|\n p = expand_root_path(p)\n\n unless environment.paths.detect { |path| p[path] }\n raise UnserializeError, \"#{p} isn't in paths\"\n end\n\n p == pathname.to_s ? self : environment.find_asset(p, :bundle => false)\n }\n @dependency_paths = coder['dependency_paths'].map { |h|\n DependencyFile.new(expand_root_path(h['path']), h['mtime'], h['digest'])\n }\n end", "def build_from_hash(attributes)\n return nil unless attributes.is_a?(Hash)\n AssetDeviceContractInformationAllOf.openapi_types.each_pair do |key, type|\n if attributes[AssetDeviceContractInformationAllOf.attribute_map[key]].nil? && AssetDeviceContractInformationAllOf.openapi_nullable.include?(key)\n self.send(\"#{key}=\", nil)\n elsif type =~ /\\AArray<(.*)>/i\n # check to ensure the input is an array given that the attribute\n # is documented as an array but the input is not\n if attributes[AssetDeviceContractInformationAllOf.attribute_map[key]].is_a?(Array)\n self.send(\"#{key}=\", attributes[AssetDeviceContractInformationAllOf.attribute_map[key]].map { |v| _deserialize($1, v) })\n end\n elsif !attributes[AssetDeviceContractInformationAllOf.attribute_map[key]].nil?\n self.send(\"#{key}=\", _deserialize(type, attributes[AssetDeviceContractInformationAllOf.attribute_map[key]]))\n end\n end\n\n self\n end", "def initialize(attrs={})\n attrs = attrs.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}\n @attrs = attrs\n end", "def initialize (attrs = {})\n @attributes = {}\n @json_attributes = {}\n self.attributes = attrs\n end", "def initialize(attrs={})\n from_hash(attrs)\n end", "def initialize(attributes)\n @environment = (attributes[:environment] || :production).to_sym\n raise TBK::CommerceError, \"Invalid commerce environment\" unless [:production,:test].include? @environment\n\n @id = attributes[:id]\n raise TBK::CommerceError, \"Missing commerce id\" if self.id.nil?\n\n @key = case attributes[:key]\n when String\n OpenSSL::PKey::RSA.new(attributes[:key])\n when OpenSSL::PKey::RSA\n attributes[:key]\n when nil\n TEST_COMMERCE_KEY if self.test?\n end\n\n raise TBK::CommerceError, \"Missing commerce key\" if self.key.nil?\n raise TBK::CommerceError, \"Commerce key must be a RSA private key\" unless self.key.private?\n end", "def initialize( attrs = {} )\n @attributes = self.class.__properties.merge( attrs ).with_indifferent_access\n end", "def initialize(attributes = {}, &block)\n attributes.each do |name, value|\n send(\"#{name}=\", value)\n end\n\n instance_exec(self, &block) if block_given?\n end", "def initialize(hash=nil)\n @attributes = hash\n @attributes ||= {}\n end", "def initialize(*attrs)\n # Sets all attributes as instance variables from the params (note this could also be done easily by using an OpenStruct)\n ATTRS.each do |key|\n instance_variable_set(\"@#{key}\", attrs.first[key])\n end\n end", "def initialize(resource)\n @attributes = OpenStruct.new(resource.attributes.to_hash)\n end", "def initialize(asset, archiver: ZlibArchiver)\n @content_type = asset.content_type\n @source = asset.source\n @charset = asset.charset\n @archiver = archiver\n end", "def initialize(attributes = {})\n attributes = HashWithIndifferentAccess.new(attributes)\n attributes.each_pair do |key, value|\n send(\"#{key}=\", value) if respond_to?(\"#{key}=\")\n end\n end", "def init_attributes(attributes)\n self.attributes = attributes.symbolize_keys\n end", "def init_with(environment, coder)\n super\n\n @source = coder['source']\n\n @required_assets = coder['required_paths'].map { |p|\n unless environment.paths.detect { |path| p[path] }\n raise UnserializeError, \"#{p} isn't in paths\"\n end\n\n p == filename ? self : environment.find_asset(p, bundle: false)\n }\n end", "def initialize(attributes = {})\n super\n self.api_endpoint ||= Orias.configuration.api_endpoint\n self.per_request ||= Orias.configuration.per_request\n self.private_key ||= Orias.configuration.private_key\n end", "def initialize(attributes = {})\n @attributes = defaults.merge!(attributes)\n\n @attributes.each do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n end", "def initialize(attributes = {})\n @attributes = defaults.merge!(attributes)\n\n @attributes.each do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n end", "def initialize(attributes = {})\n @attributes = defaults.merge!(attributes)\n\n @attributes.each do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n end", "def find_or_create_kdi_asset(asset_hash, match_key = nil)\n kdi_initialize unless @assets\n uniq_asset_hash = uniq(asset_hash)\n asset_hash_key = asset_hash.fetch(match_key) unless match_key.nil?\n\n # check to make sure it doesnt exist\n a = if match_key.nil?\n @assets.lazy.find { |asset| uniq(asset) == uniq_asset_hash }\n else\n @assets.lazy.find { |asset| asset[match_key] == asset_hash_key }\n end\n\n # SAnity check to make sure we are pushing data into the correct asset\n unless a\n print_debug \"Unable to find asset #{asset_hash}, creating a new one... \"\n create_kdi_asset(asset_hash, false)\n a = if match_key.nil?\n @assets.lazy.find { |asset| uniq(asset) == uniq_asset_hash }\n else\n @assets.lazy.find { |asset| asset[match_key] == asset_hash_key }\n end\n end\n\n a\n end", "def build_from_hash(attributes)\n return nil unless attributes.is_a?(Hash)\n SoftwarerepositoryCachedImageAllOf.openapi_types.each_pair do |key, type|\n if attributes[SoftwarerepositoryCachedImageAllOf.attribute_map[key]].nil? && SoftwarerepositoryCachedImageAllOf.openapi_nullable.include?(key)\n self.send(\"#{key}=\", nil)\n elsif type =~ /\\AArray<(.*)>/i\n # check to ensure the input is an array given that the attribute\n # is documented as an array but the input is not\n if attributes[SoftwarerepositoryCachedImageAllOf.attribute_map[key]].is_a?(Array)\n self.send(\"#{key}=\", attributes[SoftwarerepositoryCachedImageAllOf.attribute_map[key]].map { |v| _deserialize($1, v) })\n end\n elsif !attributes[SoftwarerepositoryCachedImageAllOf.attribute_map[key]].nil?\n self.send(\"#{key}=\", _deserialize(type, attributes[SoftwarerepositoryCachedImageAllOf.attribute_map[key]]))\n end\n end\n\n self\n end", "def initialize(attributes = {}, &block)\n super\n self.value = attributes.delete(:value) \n self.bucket = attributes.delete(:bucket)\n yield self if block_given?\n end", "def set_asset\n @asset = Asset.find(params[:id])\n end", "def initialize(attributes = {})\n @attributes = defaults.merge!(attributes)\n\n @attributes.each { |key, value| instance_variable_set(\"@#{key}\", value) }\n end", "def initialize(attributes = {})\n attributes.each do |key, value|\n send \"#{key}=\", value\n end\n end", "def initialize_attributes(attributes)\n @_properties = {}\n @_properties_before_type_cast={}\n self.attributes = attributes if attributes\n end", "def initialize(attributes = {})\n defaults.merge!(attributes).each do |key, value|\n instance_variable_set(\"@#{key}\", value || defaults.fetch(key))\n end\n end", "def initialize(attributes = {})\n defaults.merge!(attributes).each do |key, value|\n instance_variable_set(\"@#{key}\", value || defaults.fetch(key))\n end\n end", "def initialize(*attrs)\n set_attributes(attrs.extract_options!)\n end", "def initialize(attributes = {})\n @attributes = {}\n\n unless attributes.blank?\n attributes.each do |attr, value|\n if self.class.method_defined? \"#{attr}=\"\n send \"#{attr}=\", value\n @attributes[attr] = value\n end\n end\n end\n end", "def initialize(attributes = {})\n attributes.each { |key, value| send(\"#{key}=\", value) }\n end", "def initialize(attributes = {})\n attributes.each { |key, value| send(\"#{key}=\", value) }\n end", "def initialize(hash={})\n self.attributes = hash\n end", "def initialize(attributes)\n if attributes.is_a?(Tempfile) || attributes.is_a?(File)\n super({})\n normalize_from_file(attributes)\n else\n super(attributes)\n end\n self\n end", "def initialize(params={})super(params)\n # Define accessor and query methods for each attribute.\n attrs.each do |attribute|\n self.class.send :attr_accessor, attribute\n define_attr_query attribute\n end\n\n # Set instance variables and initialize @attributes with any\n # attribute values that were passed in the params hash.\n @attributes = {}\n params.each do |k,v|\n if attrs.include? k.to_s\n send(\"#{k}=\", v)\n @attributes[k] = v\n end\n end\n end", "def get\n raise_method_not_available(__method__, 'is nested asset') if nested_asset?\n assets = client.get(asset_type)\n assets.map { |data| self.new_from_payload(data) }\n end", "def load(attributes)\n raise ArgumentError, \"expected an attributes Hash, got #{attributes.inspect}\" unless attributes.is_a?(Hash)\n attributes.each do |key, value|\n @attributes[key.to_s] =\n case value\n when Array\n resource = find_or_create_resource_for_collection(key)\n value.map { |attrs| resource.new(attrs) }\n when Hash\n resource = find_or_create_resource_for(key)\n resource.new(value)\n when ActiveResource::Base\n value.class.new(value.attributes, value.prefix_options)\n else\n value.dup rescue value\n end\n end\n self\n end", "def initialize attributes={}\n self.config = attributes[:config]\n end", "def initialize(attributes={})\n self.class.attr_reader *attributes.keys\n @attributes = attributes.with_indifferent_access\n end", "def initialize(attributes = {})\n attributes = ActiveSupport::HashWithIndifferentAccess.new attributes\n\n @config = attributes[:config]\n end", "def initialize(attributes = {})\n @attributes = defaults.merge!(attributes)\n\n @attributes.each do |key, value|\n instance_variable_set(\"@#{key}\", value || defaults.fetch(key))\n end\n end", "def from_hash(attrs)\n object = self.new\n \n attrs.each do |attribute, value|\n object.send(\"#{attribute}=\", value)\n end\n \n object\n end", "def initialize(attributes)\n attributes.each do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n end", "def initialize(attrs = nil)\n @new_record = true\n @attributes ||= {}\n process_attributes(attrs) do\n yield(self) if block_given?\n end\n # run_callbacks(:initialize) unless _initialize_callbacks.empty?\n # raise ::TinyDyno::Errors::MissingHashKey.new(self.name) unless @hash_key.is_a?(Hash)\n end", "def new_asset\n @asset = Asset.new\n end", "def initialize(atts = {})\n reload_attributes(atts)\n end", "def attributes= attributes = {}\n return if attributes.nil?\n attributes.each_pair { |k, v|\n # Parse the nested attributed to instantiate the right model, is applicable\n value = FlightStats::Resource.from_parsed_json(v, k)\n send(\"#{underscore_with_caching(k)}=\", value) rescue nil\n }\n end", "def set_asset\n @asset = Asset.find(params[:id])\n end", "def set_asset\n @asset = Asset.find(params[:id])\n end", "def set_asset\n @asset = Asset.find(params[:id])\n end", "def set_asset\n @asset = Asset.find(params[:id])\n end", "def set_asset\n @asset = Asset.find(params[:id])\n end", "def set_asset\n @asset = Asset.find(params[:id])\n end", "def build_from_hash(attributes)\n return nil unless attributes.is_a?(Hash)\n AssetDeviceConnectionAllOf.openapi_types.each_pair do |key, type|\n if attributes[AssetDeviceConnectionAllOf.attribute_map[key]].nil? && AssetDeviceConnectionAllOf.openapi_nullable.include?(key)\n self.send(\"#{key}=\", nil)\n elsif type =~ /\\AArray<(.*)>/i\n # check to ensure the input is an array given that the attribute\n # is documented as an array but the input is not\n if attributes[AssetDeviceConnectionAllOf.attribute_map[key]].is_a?(Array)\n self.send(\"#{key}=\", attributes[AssetDeviceConnectionAllOf.attribute_map[key]].map { |v| _deserialize($1, v) })\n end\n elsif !attributes[AssetDeviceConnectionAllOf.attribute_map[key]].nil?\n self.send(\"#{key}=\", _deserialize(type, attributes[AssetDeviceConnectionAllOf.attribute_map[key]]))\n end\n end\n\n self\n end", "def initialize_env(named_params)\n _init_attrs(named_params.fetch(:imf))\n @source_path = named_params.fetch(:data)\n im_path = _initialize_ingest_manifest(named_params)\n _initialize_collection_manifest(im_path: im_path, named_params: named_params)\n _initialize_config(ingest_manifest_path: im_path, named_params: named_params)\n end", "def initialize \n @Attributes = Hash.new \n @ConfigurationFilename = \"configuration.txt\" \n load_attributes \n end", "def initialize_attributes(attributes); end", "def initialize(attributes = {})\n attributes.each do |attr, value|\n send(\"#{attr}=\", value) if respond_to?(attr.to_sym)\n end \n end", "def initialize(attrs = { })\n if attrs.present?\n attrs.each do |k, v|\n self.send(:\"#{k}=\", v)\n end\n end\n end", "def initialize(attrs = {})\n run_callbacks :initialize do\n @new_record = true\n @attributes ||= {}\n @associations ||= {}\n @attributes_before_type_cast ||= {}\n\n attrs_with_defaults = self.class.attributes.each_with_object({}) do |(attribute, options), res|\n if attrs.key?(attribute)\n res[attribute] = attrs[attribute]\n elsif options.key?(:default)\n res[attribute] = evaluate_default_value(options[:default])\n end\n end\n\n attrs_virtual = attrs.slice(*(attrs.keys - self.class.attributes.keys))\n\n load(attrs_with_defaults.merge(attrs_virtual))\n end\n end", "def asset_container\n @asset_container ||= asset_container_class.new\n end", "def initialize\n config_hash = Huey::Request.get('config')\n Huey::Bridge::ATTRIBUTES.each do |attribute|\n instance_variable_set(\"@#{attribute}\", config_hash[attribute.to_s])\n end\n end" ]
[ "0.6384016", "0.6257911", "0.61876416", "0.5885055", "0.58094347", "0.58029765", "0.5754426", "0.57473016", "0.5737468", "0.5737468", "0.57296664", "0.57199156", "0.5710735", "0.5685801", "0.56841433", "0.56767154", "0.56767154", "0.56721556", "0.5653311", "0.5601549", "0.5584978", "0.55748564", "0.557084", "0.5566875", "0.5548641", "0.5548278", "0.5545958", "0.55412275", "0.55412275", "0.55412275", "0.55412275", "0.55380493", "0.5533203", "0.55307555", "0.55257046", "0.55248", "0.5524485", "0.5519921", "0.55148065", "0.5511066", "0.5506126", "0.550519", "0.55047727", "0.5494512", "0.549284", "0.5483264", "0.5477906", "0.5473359", "0.54730266", "0.5469381", "0.54677945", "0.54675806", "0.54639363", "0.5460041", "0.5452754", "0.5452754", "0.5452754", "0.543715", "0.5426823", "0.54259425", "0.5419062", "0.5415973", "0.5413215", "0.5399791", "0.53923017", "0.53915846", "0.538373", "0.5383277", "0.5377086", "0.5377086", "0.53720844", "0.5371703", "0.5366049", "0.5362376", "0.5361302", "0.5356153", "0.53508633", "0.5350065", "0.534961", "0.534378", "0.53349036", "0.5334676", "0.5332244", "0.53287107", "0.5327725", "0.5327457", "0.5327457", "0.5327457", "0.5327457", "0.5327457", "0.5326447", "0.53260934", "0.5321582", "0.5317091", "0.5313859", "0.5309747", "0.5307463", "0.530731", "0.5306299", "0.5295974" ]
0.5421494
60
Internal: Return all internal instance variables as a hash. Returns a Hash.
def to_hash @attributes end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def instance_variables_hash\n {}\n end", "def instance_variables_hash\n instance_variables.inject({}) do |acc, iv|\n acc[iv.to_s[1..-1]] = instance_variable_get(iv) unless [:@env, :@top].include?(iv.to_sym)\n acc\n end\n end", "def instance_variables_hash\n instance_variables.inject({}) do |acc, iv|\n acc[iv.to_s[1..-1]] = instance_variable_get(iv)\n acc\n end\n end", "def to_hash\n instance_variables_hash.inject({}) do |acc, data|\n k,v = data\n v = v.to_hash if v.respond_to?(:to_hash)\n acc[k] = v\n acc\n end\n end", "def to_hash\n h = {}\n self.instance_variables.each do |variable|\n h[variable[1..-1].to_sym] = self.instance_variable_get(variable)\n end\n h\n end", "def to_hash\n instance_variables.each_with_object(Hash.new) do |var, h|\n var = var[1..-1]\n unless var.to_s.start_with?(\"__\")\n h[var] = self[var]\n end\n end\n end", "def to_hash\n Hash[instance_variables.map { |name| [name.to_s.gsub(\"@\",\"\").to_sym, instance_variable_get(name)] } ]\n end", "def to_hash\n hash = {}\n instance_variables.each do |i|\n key = i.to_s.delete('@').to_sym\n hash[key] = send(key)\n end\n hash\n end", "def to_hash\n hash = {}\n instance_variables.each {|var| hash[var.to_s.delete(\"@\")] = instance_variable_get(var) }\n hash\n end", "def to_h\n hash = {}\n self.instance_variables.each do |var|\n hash[var.to_s[1..-1]] = self.instance_variable_get(var)\n end\n hash.delete(\"mode\")\n return hash\n end", "def to_hash\n Hash[instance_variables.map { |var| [var[1..-1].to_sym, instance_variable_get(var)]}]\n end", "def to_hash\n hash = {}\n self.instance_variables.each do |var| \n hash[var.to_s.delete(\"@\")] = self.instance_variable_get(var) \n end\n hash\n end", "def to_hash\n hash = {}\n instance_variables.each {|var| hash[var.to_s.delete(\"@\")] = instance_variable_get(var) }\n hash\n end", "def to_hash\n hash = {}\n instance_variables.each do |var|\n hash[var.to_s.delete('@')] = instance_variable_get(var)\n end\n hash\n end", "def to_hash\n hash = {}\n instance_variables.each {|var| hash[var.to_s.delete(\"@\")] = instance_variable_get(var)}\n hash\n end", "def to_hash\n pairs = instance_variables.map do |var|\n [var.to_s.delete('@'), instance_variable_get(var)]\n end\n Hash[pairs]\n end", "def to_hash\n hash = {}\n self.instance_variables.each do |var|\n symbol = var.to_s.gsub(\"@\",\"\").to_sym\n hash[symbol] = send symbol\n end\n return hash\n end", "def to_hash\n hash = {}\n instance_variables.each do |var|\n hash[var.to_s.delete('@')] = instance_variable_get(var)\n end\n hash\n end", "def to_hash\n hash = {}\n instance_variables.each {|var|\n varname = var.to_s.delete(\"@\")\n if SPECIAL_PARAMS.include? varname\n hash[\"$\"+varname] = instance_variable_get(var)\n else\n hash[varname] = instance_variable_get(var)\n end\n }\n hash\n end", "def get_hash\n result = {}\n instance_variables.each { |var|\n if instance_variable_get(var) != \"\" && instance_variable_get(var) != nil\n result.update({var.slice(1..var.length) => instance_variable_get(var)})\n end\n }\n result\n end", "def hash\n instance_variables.map do |var|\n instance_variable_get(var).hash\n end.reduce(:^)\n end", "def convert_to_hash\n\n tmp_hash= {}\n self.class_variables.each do|var|\n tmp_hash[var.to_s.delete(\"@@\")] = self.class_variable_get(var)\n end\n\n return tmp_hash\n\n end", "def to_hash\n hash = {}\n instance_variables = self.instance_variables\n instance_variables.each do |variable|\n hash[\"#{variable.slice(1..-1)}\"] = self.send(\"#{variable.slice(1..-1)}\")\n end\n return hash\n end", "def attributes\n Hash[instance_variables.map { |name| [name, instance_variable_get(name)] }]\n end", "def attribute_hash\n instance_vars = self.send(:instance_variables)\n values = {}\n instance_vars.each do |var|\n values[(var.to_s.delete('@')).to_sym] = self.instance_variable_get(var)\n end\n values\n end", "def hash\n fields.map { |field| instance_variable_get(field[:name]) }.hash\n end", "def to_hash\n attrs = Hash.new\n instance_variables.each do |var|\n str = var.to_s.gsub /^@/, ''\n attrs[str.to_sym] = instance_variable_get(var)\n end\n attrs\n end", "def export\n\t\t\tr={}\n\t\t\tinstance_variables.sort.each do |var|\n\t\t\t\tr[var]=instance_variable_get(var)\n\t\t\tend\n\t\t\tr\n\t\tend", "def create_hash\n hash = {}\n self.instance_variables.each {|var| hash[var.to_s.delete(\"@\")] = self.instance_variable_get(var) }\n return hash\n end", "def to_h\n hash = {}\n self.instance_variables.each do |var|\n hash[var.to_s.gsub( /@/, '' )] = self.instance_variable_get( var )\n end\n hash.merge( 'type' => type )\n end", "def inherited_instance_variables\n {\n :@cache_anonymous_models=>nil,\n :@dataset_method_modules=>:dup,\n :@dataset_module_class=>nil,\n :@db=>nil,\n :@default_set_fields_options=>:dup,\n :@fast_instance_delete_sql=>nil,\n :@fast_pk_lookup_sql=>nil,\n :@plugins=>:dup,\n :@primary_key=>nil,\n :@raise_on_save_failure=>nil,\n :@raise_on_typecast_failure=>nil,\n :@require_modification=>nil,\n :@require_valid_table=>nil,\n :@restrict_primary_key=>nil,\n :@setter_methods=>nil,\n :@simple_pk=>nil,\n :@simple_table=>nil,\n :@strict_param_setting=>nil,\n :@typecast_empty_string_to_nil=>nil,\n :@typecast_on_assignment=>nil,\n :@use_transactions=>nil\n }\n end", "def attr_values\n values = self.instance_variables.collect do |key|\n [key, self.instance_variable_get(key)]\n end\n return Hash[values]\n end", "def attributes\n Hash[instance_variables.map{|attrib| [attrib.to_s[1..attrib.to_s.size], nil]}]\n end", "def to_h\n h = {}\n if self.class.respond_to? :attributes\n attrs = self.class.attributes\n attrs.each{|att| h.store(att, self.send(att))}\n elsif self.respond_to?(:instance_variables) && !self.instance_variables.empty?\n attrs = self.instance_variables\n attrs.each{|att| h[att.to_s.delete(\"@\")] = instance_variable_get(att) }\n elsif self.class == Class\n h[:class] = self.inspect_without_obj_id\n elsif self.respond_to? :inspect\n # remove __id__ info, which is actually the C (void *) to the obj in memory... TMI\n h[:data] = self.inspect_without_obj_id\n else # ok this object is weird. Liquid::Strainer was one of these wiseguys.\n h[:data] = self.class.to_s\n end\n h.delete_if {|k,v| v.respond_to?(:nil?) ? v.nil? : false}\n h\n end", "def as_json\n hash = {}\n instance_variables.each{|var| hash[var.to_s.gsub(/@/, '')] = instance_variable_get var}\n hash\n end", "def hashify\n hash = Hash.new\n self.instance_variables.each { |var| hash[var.to_s.delete(\"@\")] = self.instance_variable_get(var) }\n symbolize_keys(hash)\n end", "def obj_to_hash\n hash = {}\n instance_variables.each do |var|\n hash[var.to_s.delete('@')] = instance_variable_get(var)\n end\n hash\n end", "def instance_variables_to_hash(obj)\n Hash[obj.instance_variables.map{ |var| [\"#{var.to_s.delete('@')}\", obj.instance_variable_get(var.to_s)]}]\n end", "def instance_variables\n get_instance_variables.to_a.collect{ |n| \"@#{n}\".to_sym }\n end", "def create_attr_hash\n data = {}\n self.instance_variables.each do |attr|\n value = self.instance_variable_get(attr)\n key = attr.to_s.sub(%r{^\\@}, '').sub(%r{\\@}, '')\n if @attr_list.include?(key)\n data[key] = value\n end\n end\n\n data\n end", "def to_h\n self.class.list_of_attributes.each_with_object({}) do |key, hash|\n val = instance_variable_get :\"@#{key}\"\n hash[key] = Utils.hashify(val) unless val == Dry::Initializer::UNDEFINED\n end\n end", "def make_hash\n variables = self.instance_variables\n attr_hash = {}\n variables.each do |var|\n attr_hash[\"#{var.slice(1..-1)}\"] = self.send(\"#{var.slice(1..-1)}\")\n end\n\n return attr_hash\n end", "def instance_variables() end", "def instance_variables\n get_instance_variables.to_a.collect{ |n| \"#{n}\".to_sym }\n end", "def inherited_instance_variables\n {\n :@allowed_columns=>:dup, # SEQUEL5: Remove\n :@cache_anonymous_models=>nil,\n :@dataset_method_modules=>:dup,\n :@dataset_module_class=>nil,\n :@db=>nil,\n :@default_set_fields_options=>:dup,\n :@fast_instance_delete_sql=>nil,\n :@fast_pk_lookup_sql=>nil,\n :@finder_loaders=>:dup, # SEQUEL5: Remove\n :@finders=>:dup, # SEQUEL5: Remove\n :@plugins=>:dup,\n :@primary_key=>nil,\n :@raise_on_save_failure=>nil,\n :@raise_on_typecast_failure=>nil,\n :@require_modification=>nil,\n :@require_valid_table=>nil,\n :@restrict_primary_key=>nil,\n :@setter_methods=>nil,\n :@simple_pk=>nil,\n :@simple_table=>nil,\n :@strict_param_setting=>nil,\n :@typecast_empty_string_to_nil=>nil,\n :@typecast_on_assignment=>nil,\n :@use_after_commit_rollback=>nil,\n :@use_transactions=>nil\n }\n end", "def instance_variables\n # Ruby 1.8.x returns string names, convert to symbols\n super.map(&:to_sym) - NON_PROXIED_INSTANCE_VARIABLES.to_a\n end", "def get_hash()\n return @@hash;\n end", "def to_hash\n hash = Hash[instance_variables.map { |var| [var[1..-1].to_sym, instance_variable_get(var)] }]\n hash.delete(:root)\n hash.delete(:nodes)\n hash.delete(:sequences)\n hash\n end", "def attributes\n attributes = {}\n self.instance_variables.each do |i| \n meth = i.gsub(\"@\",\"\")\n attributes[meth.to_sym] = self.send meth\n end\n attributes\n end", "def to_hash\n hash = {}\n\n instance_variables.each do |var|\n key = var.to_s.delete(\"@\").to_sym\n val = instance_variable_get(var)\n\n if authlete_model_simple_attribute?(key) or val.nil?\n hash[key] = val\n elsif TAGGED_VALUE_ARRAY_ATTRIBUTES.include?(key)\n hash[key] = val.map { |element| element.to_hash }\n elsif key == :extension\n # For attributes such as :extension\n hash[key] = val.to_hash\n end\n end\n\n hash\n end", "def instance_variables; end", "def to_h\n a_hash = Hash.new\n keys = instance_variables.map{|var| var.to_s.gsub('@','')}\n keys.each do |key|\n a_hash[key] = send key\n end\n return a_hash\n end", "def __hash\n @hash\n end", "def to_hash\n self.class.attributes.inject({}) { |memo, name| memo[name] = send(name); memo }\n end", "def get_options\n hash = Hash.new\n instance_variables.each do |var|\n hash[var[1..-1].to_sym] = instance_variable_get(var)\n end\n\n return hash\n end", "def to_hash\n self.class.fields.each_with_object({}) do |key, hash|\n val = send(key)\n hash[key] = val if !val.nil?\n end\n end", "def make_hash\n variables = self.instance_variables\n attr_hash = {}\n \n variables.each do |var|\n attr_hash[\"#{var.slice(1..-1)}\"] = self.send(\"#{var.slice(1..-1)}\")\n end\n \n attr_hash\n end", "def to_hash\n attributes\n end", "def hash\n self.class.hash ^ @ns.hash\n end", "def pretty_print_instance_variables\n (instance_variables - pretty_print_ignore).sort\n end", "def to_hash\n @_hash_\n end", "def params\n instance_variables.map do |var|\n normalized_var = var.to_s.gsub(/^@/, '')\n next if BLACKLISTED_INSTANCE_VARIABLES.include?(normalized_var)\n\n [normalized_var, instance_variable_get(var)]\n end.compact.to_h\n end", "def hash()\n {\n \"attributes\" => attributes,\n \"variables\" => variables,\n \"dimensions\" => dimensions,\n \"metadata\" => metadata,\n \"data\" => variable_hash\n }\n end", "def generate_info_hash\n @info_hash = Hash[\n *instance_variables.map { |var|\n [var[1..-1].to_sym, instance_variable_get(var)] if var != '@content_data' && var != '@header_data'\n }.compact.flatten\n ]\n end", "def data_hash\n @data_hash ||= Hashie::Mash.new(sanitize_data(self.data || {}).reverse_merge(built_in_variables))\n end", "def attributes_hash\n self.info.to_hash.symbolize_keys\n end", "def generate_info_hash\n @info_hash = Hash[\n *instance_variables.map { |var|\n [var[1..-1], instance_variable_get(var)] if var != '@content_data' && var != '@header_data'\n }.compact.flatten\n ]\n end", "def to_hash\n @to_hash ||= Util::NonNilHashBuilder.build do |h|\n h.add(:application, application)\n h.add(:class_name, class_name)\n h.add(:file, file)\n h.add(:function, function)\n h.add(:line, line)\n h.add(:module_name, module_name)\n h.add(:vm_pid, vm_pid)\n end\n end", "def as_hash\n @hash\n end", "def hash\n [allow_insecure_certificates, basic_auth, body, body_type, cookies, device_ids, follow_redirects, headers, locations, metadata, public_id, _retry, start_url, variables].hash\n end", "def class_variables() end", "def attributes\n attrs = {}\n instance_variables.each { |instance_variable|\n # Convert the instariable to a string, removing the @ (instance notation), and convert back to a symbol\n attrs[instance_variable.to_s[1..-1].to_sym] = instance_variable_get(instance_variable)\n }\n attrs\n end", "def hash\n { hash: @hash, hashType: @hash_type }\n end", "def to_dict\n @hash\n end", "def to_hash\n out = {}\n self.class.properties.each { |p| out[hash_key(p)] = hash_value(p) }\n out\n end", "def hash\n code = 17\n code = 37 * code\n self.instance_variables.each do |v|\n code += self.instance_variable_get(v).hash\n end\n code\n end", "def to_hash\n hash = {}\n self.attributes.each {|attr| hash[attr.to_sym] = self.send(attr)}\n hash\n end", "def hash\r\n @_hash ||= _hash\r\n end", "def attributes\n self.class._attributes.dup.each_with_object({}) do |name, hash|\n hash[name] = send(name)\n end\n end", "def attributes\n @_attributes ||= Hash.new.with_indifferent_access\n end", "def class_variables; end", "def to_h\n data = {}\n\n self.class.properties.each_key do |prop|\n data[prop] = send(prop)\n end\n\n data\n end", "def to_h\n @_hash.dup\n end", "def hash\n attributes.hash\n end", "def hash\n attributes.hash\n end", "def hash\n attributes.hash\n end", "def hash\n @hash ||= self.to_a.hash\n end", "def procedure_instance_variables\n [:@databases, :@archives, :@encryptors, :@compressors, :@storages, :@notifiers, :@syncers]\n end", "def instance_variable_names; end", "def hash\n [class_id, object_type, accessibility_summary, creation_time, datastore_kind, datastore_status, dsconfig, free_capacity_in_bytes, host_mount_status, is_encrypted, last_access_time, last_modified_time, mount_summary, parent_uuid, site, total_capacity_in_bytes, un_compressed_used_bytes, unshared_used_bytes, uuid, data_protection_peer, src_cluster, tgt_cluster].hash\n end", "def to_hash\n @attributes\n end", "def self_hash\n hash = {}\n hash[\"id\"] = self.send(\"id\")\n database_field_names.each do |var|\n if self.send(var).is_a? ForeignKey\n hash[var] = self.send(var).id\n else\n hash[var] = self.send(var)\n end\n end\n hash\n end", "def export\n to_h.merge('&class' => self.class.to_s).stringify_keys\n end", "def hash\n [self.class, dimension, system, name].hash\n end", "def to_hash\n\t\t\th = {}\n\t\t\tself.class::PublicProperties.each { |p|\n\t\t\t\th[p] = send(p)\n\t\t\t\tif h[p].kind_of? Sequel::Model\n\t\t\t\t\th[p] = h[p].to_hash\n\t\t\t\tend\n\t\t\t}\n\t\t\th\n\t\tend", "def to_hash()\n Hash[\n self.class.settings.map do |key|\n begin\n [key, self[key]]\n rescue ArgumentError\n nil\n end\n end.compact()\n ]\n end", "def to_hash\n @fields\n end", "def to_hash\n @_hash.dup\n end", "def hash\n @attrs\n end", "def hash\n self.class.name.hash\n end" ]
[ "0.8479646", "0.8004027", "0.7989437", "0.79000324", "0.7868705", "0.7801212", "0.77961147", "0.7792911", "0.7782127", "0.77738845", "0.77610475", "0.77347285", "0.77235603", "0.7702196", "0.76905787", "0.7656854", "0.7640762", "0.76116914", "0.7572021", "0.7463685", "0.74462503", "0.74455374", "0.74378175", "0.73662955", "0.736056", "0.72768146", "0.7272969", "0.7267689", "0.7251097", "0.7166605", "0.71630144", "0.7160565", "0.7086729", "0.70840013", "0.70699424", "0.6990155", "0.69841486", "0.69578433", "0.69379777", "0.69286275", "0.6917767", "0.69145864", "0.6869576", "0.6864291", "0.6858696", "0.6822409", "0.68046844", "0.67903966", "0.6778033", "0.6763174", "0.6721967", "0.67130834", "0.6711908", "0.66701597", "0.66260093", "0.6559961", "0.6539512", "0.6531471", "0.6499194", "0.6497096", "0.6481618", "0.647361", "0.64661753", "0.64510083", "0.6439299", "0.6430085", "0.6429956", "0.6428906", "0.6417909", "0.6412153", "0.6409984", "0.6405833", "0.63972783", "0.63816416", "0.6376578", "0.637632", "0.63740957", "0.6370685", "0.6360618", "0.63546246", "0.63538504", "0.6351546", "0.63442355", "0.63421637", "0.63421637", "0.63421637", "0.632908", "0.63256806", "0.6319984", "0.6311836", "0.6307296", "0.63066393", "0.62930894", "0.62915725", "0.6289104", "0.62843597", "0.62751085", "0.62670195", "0.6266095", "0.6265306" ]
0.63113993
90
Public: Return logical path with digest spliced in. "foo/bar37b51d194a7513e45b56f6524f2d51f2.js" Returns String.
def digest_path if DigestUtils.already_digested?(@name) logical_path else logical_path.sub(/\.(\w+)$/) { |ext| "-#{etag}#{ext}" } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def digest_path\n logical_path.sub(/\\.(\\w+)$/) { |ext| \"-#{digest}#{ext}\" }\n end", "def logical_path\n digest_path\n end", "def path_with_fingerprint(digest)\n if Rails.env.development?\n pathname.to_s\n else\n sprockets_path_with_fingerprint(digest)\n end\n end", "def get_path(sha1)\n sha1[0...2] + '/' + sha1[2..40]\n end", "def path\n return @path.sub(/^\\//,'').sub(/^%2F/,'/')\n end", "def path_str\n path.join(\"-\")\n end", "def asset_digest_path(path, options = T.unsafe(nil)); end", "def asset_digest_path(path, options = T.unsafe(nil)); end", "def full_digest_path\n File.join(@load_path, digest_path)\n end", "def path_fingerprint(path)\n path[/-([0-9a-f]{8})\\.[^.]+$/, 1]\n end", "def web_path\n # 47 char is \"/\"\n return path[0] == 47 ? path : \"/\" + path\n end", "def hash_path(path)\n Digest::MD5.hexdigest(path)[0..5]\n end", "def path_fingerprint(path)\n path[/-([0-9a-zA-Z]{7,128})\\.[^.]+\\z/, 1]\n end", "def pretty_path\n if Pathname.new(\"~/.fog\").expand_path == path\n \"~/.fog\"\n else\n path.to_s\n end\n end", "def hexdigest\n self.class.hexdigest_for(path)\n end", "def digest_dirname(file_path)\n slash_path(File.dirname(file_path)).sub(slash_path(source.path), \"\")\n end", "def path_with_digest(filename, file_extension)\n full_filepath = \"#{filename}.#{file_extension}\"\n \"#{filename}-#{Rails.application.assets.find_asset(full_filepath).digest}.#{file_extension}\"\n end", "def to_s\n '/' + @path.map { |part|\n if part.is_a? String\n part\n elsif part.is_a? Symbol\n part.inspect\n else\n fail \"Invalid path part: #{part}\"\n end\n }.join('/')\n end", "def get_path\n BINARY_PATH + \"/\" + sprintf(\"%08x\", self.id )\n end", "def path_from_sha1(sha1)\n raise NotImplementedError, 'Implemented in subclasses. See filesystem_pool for example.'\n end", "def to_s\n @path.dup\n end", "def path\n return nil if self.hash_string.blank?\n File.join(*self.hash_string.scan(/(.)(.)(.*)/).flatten)\n end", "def path\n name + extension\n end", "def digest_key(digest)\n \"asset-uri-digest:#{compressed_path}:#{digest}\"\n end", "def path\n @pathname.to_s\n end", "def to_s\n path\n end", "def compute_asset_path(path, options = {})\n digested = options.delete(:digested)\n digested = true if digested.nil?\n\n if (digest_path = asset_digest_path(path, options))\n path = digest_path if digested && digest_assets\n path += \"?body=1\" if options[:debug]\n File.join(assets_prefix || \"/\", path)\n else\n super\n end\n end", "def full_path; end", "def pathname(prefix=DEFAULT_PREFIX)\n\n root = ENV[\"TMP\"] || ENV[\"TMPDIR\"] || ENV[\"TEMP\"] || \"/tmp\"\n return File.join(root, \"#{prefix}-#{SecureRandom.hex(30)}\")\n end", "def asset_digest(path, options = {})\n return unless digest_assets\n\n if digest_path = asset_digest_path(path, options)\n digest_path[/-(.+)\\./, 1]\n end\n end", "def path\r\n @pathname.to_s\r\n end", "def to_s\n @path\n end", "def full_path\n path\n end", "def path\n \"%s/%s\" % [dirname, filename]\n end", "def path\n real_path = Pathname.new(root).realpath.to_s\n full_path.sub(%r{^#{real_path}/}, '')\n end", "def to_s\n @path\n end", "def to_s\n @path\n end", "def to_s\n path\n end", "def to_s\n @path\n end", "def path_string\n type == :simple_resource_id ? \"\\#{#{resource_names[0]}}\" : pattern.gsub(\"{\", \"\\#{\")\n end", "def unique_path\n unique_name.split(\"/\") rescue [unique_name]\n end", "def asset_digest_path(path, options = {})\n if manifest = assets_manifest\n if digest_path = manifest.assets[path]\n return digest_path\n end\n end\n\n if environment = assets_environment\n if asset = environment[path]\n return asset.digest_path\n end\n end\n end", "def full_path\n File.join(@path, @name)\n end", "def path_to(key)\n key = key.gsub(/[<>:\\\\|?*%]/) {|c| \"%%%03d\" % c.ord}\n File.join(cache_location, key)\n end", "def getRealPath(path) Pathname.new(path).realpath.to_s; end", "def getRealPath(path) Pathname.new(path).realpath.to_s; end", "def final_path_component(path)\n path.split(PATH_SEPARATOR)[-1].split[0]\n end", "def render(context)\n return \"\" unless ENV[\"ENV\"] == \"production\"\n\n full_path = File.join(context[\"site\"][\"__directory\"], @path.strip)\n\n return @prefix + DIGEST_CACHE[full_path] if DIGEST_CACHE[full_path]\n\n digest = Digest::MD5.hexdigest(File.read(full_path))\n DIGEST_CACHE[full_path] = digest\n\n @prefix + digest\n end", "def encoded_daw_return_path\n uri = Rails::VERSION::MAJOR < 3 ? request.request_uri : request.fullpath\n \"&path=#{URI.encode(uri, URI::PATTERN::RESERVED)}\"\n end", "def to_s\n \"#{path} | #{native_revision_identifier}\"\n end", "def to_s\n @path\n end", "def path\n Pathname(@path.respond_to?(:to_path) ? @path.to_path : @path.to_s).expand_path\n end", "def identifying_path_part(ident=:default)\n File.join identify(ident).map{|sym| send(sym).to_s}\n end", "def _uri_path\n \"#{@dir}.#{CGI.escape @reg}/#{CGI.escape @dss}\"\n end", "def tfs_path\n case @path[0]\n when \"$\"\n @path\n when \"/\"\n \"$#{@path}\"\n else\n \"$/#{@path}\"\n end\n end", "def path_string\n \"\\#{#{position}}\"\n end", "def path\n s = ''\n s << '/' if @absolute\n s << @path.join('/')\n s << '/' if @trail\n s << '.' if s.empty?\n s\n end", "def path(ident=:default)\n tail = identifying_path_part(ident)\n if tail.empty?\n base_path\n else\n File.join base_path, tail\n end\n end", "def full_path_for(path)\n path = \"/#{path}\" unless path[0..0] == '/'\n path\n end", "def format_path(entry)\n server_path = entry.path\n if base_path && server_path[0,base_path.length] == base_path\n if server_path == base_path\n return \".\"\n elsif server_path[base_path.length,1] == \"/\"\n return server_path[base_path.length + 1, server_path.length - base_path.length - 1]\n elsif base_path == \"/\" && server_path[0,1] == \"/\"\n return server_path[1, server_path.length - 1]\n end\n end\n server_path\n end", "def path\n @path ||= filters.uri_escape(absolute_url) if absolute_url\n end", "def path\n @path ||= filters.uri_escape(absolute_url) if absolute_url\n end", "def path\n name.split(\"::\").join(\"/\").downcase\n end", "def short_path\n self.path =~ /^(javascripts|stylesheets|fonts)\\/(.*)$/\n $2\n end", "def unify_path(s)\r\n p = s.frozen? ? s.dup : s\r\n p.gsub!( /\\\\/, '/' )\r\n p = \"#{$1.upcase}/#{$POSTMATCH}\" if p =~ REGEX_DISK\r\n if RUBY_PLATFORM =~ REGEX_CYGWIN\r\n\tif p =~ REGEX_CYGDRIVE\r\n\t p = \"/cygdrive/#{$1.upcase}/#{$POSTMATCH}\" \r\n\telse\r\n\t p.sub!( REGEX_DISK2, '/cygdrive/\\1/' ) if @name == 'PATH'\r\n\tend\r\n end\r\n return p\r\n end", "def filename\n tmp_path = self.path\n if self.partial\n tmp_path.gsub(/([^\\/]+)\\z/, '_\\1')\n else\n tmp_path\n end\n end", "def path_without_name_and_ref(path); end", "def hash\n path.hash\n end", "def get_path(fullpath = \"\")\n (fullpath || \"\").scan(/^[\\w+|\\/]+/)[0]\n end", "def raw(path)\n details = ASSETS.fetch(path)\n create_fullpath(path, details[:md5], hashless: details[:hashless])\n rescue KeyError\n \"/#{path}\"\n end", "def path\n ensure_valid\n @path\n end", "def full_path\n container.root.join(path)\n end", "def full_path\n container.root.join(path)\n end", "def format_path(path)\n path[1..-1]\n end", "def pretty_path(path, native_fs_flag = false)\n return path\n end", "def pretty_path(path, native_fs_flag = false)\n return path\n end", "def create_fullpath(path, md5, hashless: false)\n return \"/#{path}\" if CDN.empty?\n\n [CDN, append_md5(path, md5, hashless: hashless)].join('/')\n end", "def path(style = self.default)\n path = self.attached? ? @path.clone : @missing.clone\n path.gsub!(/:name/, name.to_s)\n path.gsub!(/:style/, style.to_s)\n path.gsub!(/:extension/, extension(style).to_s)\n path.gsub!(/:identifier/, identifier(style).to_s)\n return path\n end", "def compiled_path; end", "def path\n \"/\" + @prefix.join(\"/\")\n end", "def sub_path\n \"#{\"%02x\" % (id.to_i % 256)}/#{id}\"\n end", "def to_s\n return \"\" if self.empty?\n @path.join(\":\")\n end", "def path_name\n str = name.dup\n str << '/' if is_dir\n str = parent.path_name + str if parent\n str\n end", "def base_path\n if debug\n \"/#{debug_prefix}/\"\n else\n \"/#{digest_prefix}/\"\n end\n end", "def original_fullpath; end", "def path\n read_attribute(:path).sub(/^[^:]+:/,'').gsub(/^\\/+/,'')\n end", "def path_to(hash = T.unsafe(nil)); end", "def path\n return @path\n end", "def path\n @url ||= begin\n if renderer.is_a?(Renderer::Passthru)\n '/' + @name\n else\n url = [ File.dirname(@name), File.basename(@filename) ]\n url[1] = File.basename(url[1], '.*')\n url[1] = (url[1] + @renderer.default_ext) unless url[1].include?('.')\n '/' + url.join('/')\n end\n end\n end", "def path_expanded path\n end", "def logical_path\n @logical_path[/^([^.]+)/, 0]\n end", "def path_string\n pattern\n end", "def get_Path(initial)\n\tinitial.split(' ',3)[1]\nend", "def inspect\n \"#<Path #{@path}>\"\n end", "def filename(uri)\n \"#{URI.encode_www_form_component(uri)}.cached\"\n end", "def path_of(path)\n File.join(self.path, path)\n end", "def path\n File.join(@base, @name)\n end", "def cache_path_name(controller=:_all,action=:_all)\n controller, action = normalize_request_params(controller,action)\n \n # if we have cached the \n return @cache_path_names[\"#{controller}_#{action}\"] if @cache_path_names[\"#{controller}_#{action}\"]\n \n # let's get the latest revision number of all of the paths provided\n latest_revision_number = paths_for(controller,action).uniq.collect do |p|\n CachedAssetPackager::Base.latest_revision_number(p)\n end.sort.last \n \n #puts paths_for(controller,action).uniq.join(\"\\n\")\n \n file_name = Digest::MD5.hexdigest(paths_for(controller,action).uniq.join(\",\"))\n \n @cache_path_names[\"#{controller}_#{action}\"] = File.join(@base_dir,\"cache_#{file_name}_#{latest_revision_number}#{@extension}\")\n return @cache_path_names[\"#{controller}_#{action}\"]\n end", "def file_digest_key(stat)\n \"file_digest:#{compressed_path}:#{stat}\"\n end", "def public_compute_asset_path(source, options = T.unsafe(nil)); end" ]
[ "0.83635634", "0.7270988", "0.7147128", "0.69809395", "0.6870992", "0.6701046", "0.66437596", "0.66437596", "0.65050864", "0.64633024", "0.6454508", "0.6380829", "0.635202", "0.63293433", "0.6320092", "0.63150233", "0.6289059", "0.6266777", "0.6266221", "0.6236545", "0.62350005", "0.62125844", "0.6207824", "0.61583894", "0.61397743", "0.6119664", "0.6119392", "0.6099866", "0.6091358", "0.6086153", "0.60695404", "0.60683835", "0.6065058", "0.6060498", "0.6046018", "0.6036906", "0.6036906", "0.6014895", "0.5998231", "0.5998037", "0.59948057", "0.59832054", "0.59779197", "0.5968902", "0.59621274", "0.59621274", "0.5958229", "0.59532726", "0.59520495", "0.5940666", "0.5930826", "0.59288186", "0.5924922", "0.59144753", "0.58980614", "0.58902395", "0.5886377", "0.58795375", "0.5875436", "0.5849741", "0.58455193", "0.58455193", "0.58408177", "0.583582", "0.58352244", "0.5833495", "0.58328027", "0.58302754", "0.582938", "0.5827044", "0.58234626", "0.58216846", "0.58216846", "0.58190244", "0.5817968", "0.5817968", "0.5816355", "0.58110565", "0.5799841", "0.57990986", "0.57957655", "0.57902694", "0.5789257", "0.5780385", "0.57801145", "0.5779104", "0.5768693", "0.5768178", "0.5759126", "0.5750098", "0.5748661", "0.5744565", "0.57439363", "0.5742656", "0.5742493", "0.57420987", "0.5731819", "0.57254076", "0.5723576", "0.5715556" ]
0.78965664
1
Public: Return load path + logical path with digest spliced in. Returns String.
def full_digest_path File.join(@load_path, digest_path) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def digest_path\n logical_path.sub(/\\.(\\w+)$/) { |ext| \"-#{digest}#{ext}\" }\n end", "def logical_path\n digest_path\n end", "def digest_path\n if DigestUtils.already_digested?(@name)\n logical_path\n else\n logical_path.sub(/\\.(\\w+)$/) { |ext| \"-#{etag}#{ext}\" }\n end\n end", "def load_path\n paths, file = [\"\"], current_file\n paths << File.dirname(file) if file\n paths + LOAD_PATH\n end", "def load_path\n data[:load_path].nil? ? \"\" : data[:load_path]\n end", "def path_with_fingerprint(digest)\n if Rails.env.development?\n pathname.to_s\n else\n sprockets_path_with_fingerprint(digest)\n end\n end", "def loaded_path; end", "def bits_full_local_path_unpacked\n \"#{bits_full_local_path}.unpacked\"\n end", "def bits_full_local_path_dl\n \"#{bits_full_local_path}.dl\"\n end", "def path\n return nil if self.hash_string.blank?\n File.join(*self.hash_string.scan(/(.)(.)(.*)/).flatten)\n end", "def load_path; end", "def virtual_path\n\t\tself.class.local_file_path_from_hash( Pathname.new('/managed_file_resource_images/'), self.file_hash ).to_s\n end", "def digest_dirname(file_path)\n slash_path(File.dirname(file_path)).sub(slash_path(source.path), \"\")\n end", "def path\n return @path.sub(/^\\//,'').sub(/^%2F/,'/')\n end", "def full_path\n container.root.join(path)\n end", "def full_path\n container.root.join(path)\n end", "def asset_digest_path(path, options = T.unsafe(nil)); end", "def asset_digest_path(path, options = T.unsafe(nil)); end", "def render(context)\n return \"\" unless ENV[\"ENV\"] == \"production\"\n\n full_path = File.join(context[\"site\"][\"__directory\"], @path.strip)\n\n return @prefix + DIGEST_CACHE[full_path] if DIGEST_CACHE[full_path]\n\n digest = Digest::MD5.hexdigest(File.read(full_path))\n DIGEST_CACHE[full_path] = digest\n\n @prefix + digest\n end", "def full_path(relative_filename)\n File.join(@mount_dir, relative_filename)\n end", "def full_path\n File.join(@path, @name)\n end", "def get_path(sha1)\n sha1[0...2] + '/' + sha1[2..40]\n end", "def path\n File.join(@base, @name)\n end", "def compiled_path; end", "def read_path_with_own_path\n File.join(read_path, path)\n end", "def path\n File.join(@base, @name)\n end", "def path(ident=:default)\n tail = identifying_path_part(ident)\n if tail.empty?\n base_path\n else\n File.join base_path, tail\n end\n end", "def path\n \"%s/%s\" % [dirname, filename]\n end", "def path\n real_path = Pathname.new(root).realpath.to_s\n full_path.sub(%r{^#{real_path}/}, '')\n end", "def get_path\n BINARY_PATH + \"/\" + sprintf(\"%08x\", self.id )\n end", "def path_str\n path.join(\"-\")\n end", "def path\n @pathname.to_s\n end", "def readlink() Path::Name.new(File.readlink(path)) end", "def path_with_digest(filename, file_extension)\n full_filepath = \"#{filename}.#{file_extension}\"\n \"#{filename}-#{Rails.application.assets.find_asset(full_filepath).digest}.#{file_extension}\"\n end", "def path\r\n @pathname.to_s\r\n end", "def path\n out_buffer = FFI::MemoryPointer.new(:uchar, 2048)\n io_size = FFI::MemoryPointer.new(:uint32)\n io_size.put_uint32(0, out_buffer.size)\n\n status = Sec.SecKeychainGetPath(self,io_size, out_buffer)\n Sec.check_osstatus(status)\n\n out_buffer.read_string(io_size.get_uint32(0)).force_encoding(Encoding::UTF_8)\n end", "def raw(path)\n details = ASSETS.fetch(path)\n create_fullpath(path, details[:md5], hashless: details[:hashless])\n rescue KeyError\n \"/#{path}\"\n end", "def identifying_path_part(ident=:default)\n File.join identify(ident).map{|sym| send(sym).to_s}\n end", "def to_s\n @parts.join(NATIVE_PATH_SEPARATOR)\n end", "def full_path\n File.dirname(File.expand_path(serialized_filename))\n end", "def digest\n OpenSSL::Digest::SHA256.file(path).hexdigest\n end", "def path\n Rails.root.join(ROOT, type, name, executable).to_s\n end", "def digest\n assert_file!\n Digest::SHA256.hexdigest(@name + Digest::SHA256.file(@path).to_s)\n end", "def full_filename\n File.join(path, self.disk_filename)\n end", "def hexdigest\n self.class.hexdigest_for(path)\n end", "def remote_storage_base_path\n File.join(self.class.model_path_segment(model), dynamic_segment)\n end", "def inspect\n File.basename @__path\n end", "def path\n native.path\n end", "def local_path\n src = if %i(direct repo).include?(new_resource.source)\n package_metadata[:url]\n else\n new_resource.source.to_s\n end\n ::File.join(Chef::Config[:file_cache_path], ::File.basename(src))\n end", "def digest_key(digest)\n \"asset-uri-digest:#{compressed_path}:#{digest}\"\n end", "def compute_asset_path(path, options = {})\n digested = options.delete(:digested)\n digested = true if digested.nil?\n\n if (digest_path = asset_digest_path(path, options))\n path = digest_path if digested && digest_assets\n path += \"?body=1\" if options[:debug]\n File.join(assets_prefix || \"/\", path)\n else\n super\n end\n end", "def base_path\n if debug\n \"/#{debug_prefix}/\"\n else\n \"/#{digest_prefix}/\"\n end\n end", "def absolute_path\n if is_url?\n # Use the last path component without the query string plus the name\n # of the resource in Base64. This should be both mildly readable and\n # also unique per invocation.\n url_part = URI(path).path.split(/\\//).last\n base64_name = Base64.strict_encode64(name).gsub(/\\=/, '')\n ::File.join(Chef::Config[:file_cache_path], \"#{base64_name}_#{url_part}\")\n else\n ::File.expand_path(path, Chef::Config[:file_cache_path])\n end\n end", "def part\n \"#{path.chomp('.part')}.part\"\n end", "def full_key_path\n Pathname.new(spec.key_path).expand_path(@base_dir)\n end", "def asset_digest_path(path, options = {})\n if manifest = assets_manifest\n if digest_path = manifest.assets[path]\n return digest_path\n end\n end\n\n if environment = assets_environment\n if asset = environment[path]\n return asset.digest_path\n end\n end\n end", "def full_path\n path\n end", "def getRealPath(path) Pathname.new(path).realpath.to_s; end", "def getRealPath(path) Pathname.new(path).realpath.to_s; end", "def path\n name + extension\n end", "def path\n Pathname(@path.respond_to?(:to_path) ? @path.to_path : @path.to_s).expand_path\n end", "def path_of(path)\n File.join(self.path, path)\n end", "def effective_path(typed_name, start_index_in_name)\n \"#{File.join(generic_path, typed_name.name_parts)}.rb\"\n end", "def fullname\n @fullname ||= ::File.join(location, loadpath, filename + (extension || ''))\n end", "def local_path\n fetch_path(DevTools.gem_root)\n end", "def to_s\n @path.dup\n end", "def PATH()\n $LOAD_MANAGER.PATH()\n end", "def figure_path(file)\n return file if Pathname.new(file).absolute?\n $LOAD_PATH.each do |path|\n found = File.join(path, file)\n return File.expand_path(found) if File.file?(found)\n end\n file\n end", "def path_from_sha1(sha1)\n raise NotImplementedError, 'Implemented in subclasses. See filesystem_pool for example.'\n end", "def pathname(prefix=DEFAULT_PREFIX)\n\n root = ENV[\"TMP\"] || ENV[\"TMPDIR\"] || ENV[\"TEMP\"] || \"/tmp\"\n return File.join(root, \"#{prefix}-#{SecureRandom.hex(30)}\")\n end", "def path\n File.expand_path File.join(basepath, version_dir, basename)\n end", "def public_compute_asset_path(source, options = T.unsafe(nil)); end", "def hash\n path.hash\n end", "def full_path; end", "def path\n @backend.lib_dir + name_on_disk\n end", "def original_fullpath; end", "def path_from_hoard\n Pathname(path).relative_path_from(Pathname(hoard_path)).to_s\n end", "def to_relative_path\n File.join('.', to.path(identify).to_s)\n end", "def user_load_path\n File.join(Plugins.site.source, Plugins.custom_dir, dir, File.dirname(file)).sub /\\/\\.$/, ''\n end", "def fullpath; end", "def disk_path\n project.full_path\n end", "def path\n (public_path + sitemaps_path + filename).expand_path.to_s\n end", "def full_path\n self.read_attribute(:full_path) || self.assign_full_path\n end", "def path\n @base\n end", "def filename\n self.class.path(hash)\n end", "def asset_digest(path, options = {})\n return unless digest_assets\n\n if digest_path = asset_digest_path(path, options)\n digest_path[/-(.+)\\./, 1]\n end\n end", "def path\n @bundle_filename\n end", "def expanded_path\n relative_path(dependency.berksfile.filepath)\n end", "def local\n return Global.git_repository_directory + @address_digest\n end", "def path_fingerprint(path)\n path[/-([0-9a-f]{8})\\.[^.]+$/, 1]\n end", "def to_s\n out = absolute_prefix\n out += @parts.join(NATIVE_DIRECTORY_SEPARATOR)\n out\n end", "def to_s\n path\n end", "def path\n read_attribute(:path).sub(/^[^:]+:/,'').gsub(/^\\/+/,'')\n end", "def path\n @url ||= begin\n if renderer.is_a?(Renderer::Passthru)\n '/' + @name\n else\n url = [ File.dirname(@name), File.basename(@filename) ]\n url[1] = File.basename(url[1], '.*')\n url[1] = (url[1] + @renderer.default_ext) unless url[1].include?('.')\n '/' + url.join('/')\n end\n end\n end", "def path_to(key)\n key = key.gsub(/[<>:\\\\|?*%]/) {|c| \"%%%03d\" % c.ord}\n File.join(cache_location, key)\n end", "def provider_full_path(userfile) #:nodoc:\n basename = userfile.name\n subid,visid = named_according_to_LORIS_convention!(userfile)\n Pathname.new(remote_dir) + subid + visid\n end", "def read_path\n @read_path ||= self.class.image_read_path.dup\n end", "def storage_path\n File.join(\n SystemConfiguration.first.storage_path,\n url_part)\n end", "def effective_path(typed_name, start_index_in_name)\n # Puppet name to path always skips the name-space as that is part of the generic path\n # i.e. <module>/mymodule/functions/foo.pp is the function mymodule::foo\n parts = typed_name.name_parts\n if start_index_in_name > 0\n return nil if start_index_in_name >= parts.size\n parts = parts[start_index_in_name..-1]\n end\n \"#{File.join(generic_path, parts)}#{extension}\"\n end", "def paths(reload = false)\n thread_local_store.keys(reload).map(&:to_s)\n end" ]
[ "0.71245205", "0.6553707", "0.65431976", "0.64675695", "0.64177436", "0.63957435", "0.6304689", "0.60836434", "0.60177493", "0.59440017", "0.59432095", "0.59061414", "0.5889158", "0.58734107", "0.585569", "0.585569", "0.5831985", "0.5831985", "0.57912415", "0.57864416", "0.5768974", "0.57516766", "0.57356906", "0.5725209", "0.5711782", "0.5695681", "0.56896645", "0.5687915", "0.56864697", "0.5681888", "0.56769764", "0.5652861", "0.5648577", "0.5644302", "0.56349397", "0.5622931", "0.56087387", "0.5602154", "0.55932254", "0.55929637", "0.5585823", "0.5580133", "0.55570155", "0.55490255", "0.5535016", "0.5517361", "0.551723", "0.5504708", "0.55021197", "0.5493963", "0.54923123", "0.5491444", "0.5481766", "0.54789734", "0.54725814", "0.54702413", "0.54601884", "0.54571575", "0.54571575", "0.5452805", "0.54512185", "0.5442769", "0.54406554", "0.5416554", "0.54154944", "0.54132843", "0.5412723", "0.5405501", "0.5403693", "0.53950274", "0.5394881", "0.5393932", "0.5391279", "0.53900075", "0.53752357", "0.5372339", "0.5362803", "0.5362421", "0.53612584", "0.5359988", "0.53589946", "0.5355078", "0.53544474", "0.53472584", "0.53421605", "0.5335264", "0.532708", "0.53269315", "0.5325166", "0.5324865", "0.5316194", "0.5312529", "0.531139", "0.53087926", "0.5308291", "0.5304966", "0.528945", "0.52848446", "0.5283488", "0.5281605" ]
0.7469544
0
Public: Get all externally linked asset filenames from asset. All linked assets should be compiled anytime this asset is. Returns Set of String asset URIs.
def links metadata[:links] || Set.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def asset_paths\n search_path.children.select { |n| Cnfs::Core.asset_names.include?(base_name(n)) }.sort\n end", "def all_urls_external\n ngurls = NG_URL.all(:a_hrefs_external => { :$not => { :$size => 0}})\n urls_external = []\n ngurls.each {|n| urls_external += n.a_hrefs_external }\n urls_external.uniq!.sort!\n end", "def all_image_file_names\n @all_image_file_names ||= find_image_items.map{|i|i['href']}.uniq.compact\n end", "def asset_paths\n paths = @parts.values.map(&:asset_path)\n paths << File.dirname(script) if script\n paths << File.dirname(stylesheet) if stylesheet\n paths.compact.uniq\n end", "def attachment_uris\n Array.wrap(attachments).uniq.delete_if(&:empty?)\n end", "def asset_files\n asset_files = []\n Find.find(assets_path).each do |path|\n next if File.directory?(path)\n next if path.include?(stylesheets_path) || path.include?(images_path)\n asset_files << path.sub(assets_path, 'assets')\n end\n asset_files\n end", "def external_links\n return [] if @links.empty?\n\n links = @links\n .reject { |link| link.relative_link?(host: @url.to_base) }\n .map(&:without_trailing_slash)\n\n Wgit::Utils.process_arr(links)\n end", "def assets\n uniq = {}\n sets = manifests.map(&:assets)\n sets.each do |assets|\n assets.each do |rel_path, abs_path|\n uniq[rel_path] = abs_path unless uniq.key?(rel_path)\n end\n end\n uniq\n end", "def local_compiled_assets \n @manifest.files.keys.map {|f| File.join(@prefix, f)} \n end", "def content_files\n ns = descriptor_doc.find \"//M:file/M:FLocat/@xlink:href\", NS_PREFIX\n (ns.map { |n| URI.unescape n.value }).uniq\n end", "def referenced_files\r\n\t\t(\r\n\t\t\t[file] +\r\n\t\t\t%w[sourcepath importfile].flat_map do |att|\r\n\t\t\t\tfind(att=>/./).flat_map do |asset|\r\n\t\t\t\t\tasset[att].values.compact.map do |path|\r\n\t\t\t\t\t\tpath.sub!(/#.+/,'')\r\n\t\t\t\t\t\tabsolute_path(path) unless path.empty?\r\n\t\t\t\t\tend.compact\r\n\t\t\t\tend\r\n\t\t\tend +\r\n\t\t\tfind.flat_map do |asset|\r\n\t\t\t\tasset.properties.select{ |name,prop| prop.type=='Texture' }.flat_map do |name,prop|\r\n\t\t\t\t\tasset[name].values.compact.uniq.map{ |path| absolute_path(path) }\r\n\t\t\t\tend\r\n\t\t\tend +\r\n\t\t\tfind(_type:'Text').flat_map do |asset|\r\n\t\t\t\tasset['font'].values.compact.map{ |font| absolute_path(font) }\r\n\t\t\tend +\r\n\t\t\t@doc.xpath('/UIP/Project/Classes/*/@sourcepath').map{ |att| absolute_path att.value }\r\n\t\t).uniq\r\n\tend", "def urls\n @sets.collect(&:keys).flatten\n end", "def get_assets asset\n return [] if @crawl_results.empty? # No crawling yet? Return empty search\n\n # The asset parameter can only be images, stylesheets or scripts\n unless %w(images stylesheets scripts).include? asset.to_s\n # Display error message in this case.\n SuperCrawler::Render.error \"`asset` parameter can only be `images`, `stylesheets` or `scripts`\"\n return [] # Return empty array\n end\n\n # Good! Return flatten array of unique assets\n return @crawl_results.map{ |cr| cr[:assets][asset.to_sym] }.flatten.uniq\n end", "def asset_link_filter(asset_array)\n asset_array.select do |asset|\n asset.split(//).last != '/'\n end\n # TODO: also filter out .html endings\n end", "def external_links\n @external_links ||= links.select {|link| URL.new(link).host != host }\n end", "def external_links\n @external_links ||= links.select {|link| host_from_url(link) != host }\n end", "def files\n self.assets.reject{ |asset| asset.image? }\n end", "def public_urls\n urls = []\n self.used_locales.each do |l|\n urls << self.public_url(l)\n end\n urls.flatten.compact.uniq\n end", "def filenames\n files.map(&:filename)\n end", "def filenames\n files.map(&:filename)\n end", "def filenames\n files.map(&:filename)\n end", "def asset_paths\n @asset_paths ||= [prefix] \n end", "def input_paths(asset_module, format)\n asset_module.assets(format).map{|asset| asset.absolute_path}\n end", "def get_images_from_url\n @links = (images_from_img_tag + images_from_link_tag + images_from_extension).uniq\n @handler_link.remove_global_unless_symbols(@links)\n @links\n end", "def documenturls91\n return unless object.documents.attachments\n document_urls = object.documents.map do |adoc| \n URI.join(\n ActionController::Base.asset_host, \n rails_blob_path(adoc))\n end\n end", "def filenames\n @filenames ||= files.map(&:to_s)\n end", "def image_urls\n images.map {|image| image.url}\n end", "def known_assets\n assets = Rails.application.config.assets.digests.to_a.flatten.map do |asset|\n [asset, \"#{asset}.gz\"]\n end.flatten\n assets + %w(manifest.yml sources_manifest.yml)\n end", "def files\n @files ||= full_files.map {|file| relative(file) }\n end", "def urls\n each_url.to_set\n end", "def assets\n @assets ||= []\n end", "def local_images\n @link_collector.local_images\n end", "def assets\r\n\t\t@graph_by_id.map{ |id,graph_element| asset_for_el(graph_element) }\r\n\tend", "def image_urls\n images = []\n\n @document.css('.user-html img').map do |image|\n images << image.attributes['src'].value\n end\n\n # Don't choke on protocol relative URL's.\n images.collect { |image| image.gsub(%r{^//}, 'https://') }\n end", "def files\n file_sets.map(&:original_file)\n end", "def images\n [assets.find_all { |asset| asset.is_a? MDL::BorealisImage }].flatten\n end", "def links\n return @links if @links\n return false unless @source\n @links = @source.scan(HREF_CONTENTS_RE).map do |match|\n # filter some malformed URLS that come in\n # meant to be a loose filter to catch all reasonable HREF attributes.\n link = match[0]\n Link.new(@t.scheme, @t.host, link).path\n end.uniq\n end", "def images\n self.assets.find_all{ |asset| asset.image? }\n end", "def filenames\n @files.collect { |f| f.archive_filename }\n end", "def public_urls\n #Rails.cache.fetch(\"public_urls-#{Globalize.locale}-#{self.cache_key}\") do\n urls = []\n self.used_locales.each do |l|\n urls << self.public_url(l)\n end\n urls.compact.uniq\n #end\n end", "def files\n file_sets.map{|fs| fs.files }.flatten\n end", "def assets\n content_mappings.collect{|mapping| mapping.asset }\n end", "def all\n @all ||= raw.map { |link| URL.absolutify(link, base_url) }.compact.uniq\n end", "def links\n @links ||= parsed_links.map{ |l| URL.absolutify(URL.unrelativize(l, scheme), base_url) }.compact.uniq\n end", "def images_urls\n \timages.map{|image| image.url}\n end", "def paths_from_urls\n urls = []\n parsed_urls.each do |url|\n path = URI(url).path.sub(/^(http(s)?(:)?(\\/)+?(:)?)?((\\/)?www.)?gov.uk/, \"\")\n urls << (path.start_with?(\"/\") ? path : \"/#{path}\")\n end\n urls.uniq\n end", "def file_sets\n @iss_file.file_sets.select {|fs| fs.components.include? name }\n end", "def links\n @links ||= parsed_links.map{ |l| absolutify_url(unrelativize_url(l)) }.compact.uniq\n end", "def find_files(block)\n files = []\n block.scan(URL_PATTERN).each do |attribute, path|\n if !URI.parse(path).absolute?\n resource = create_resource_file(attribute, path)\n files << resource if resource\n end\n end\n files\n end", "def all_files\n return manifest_entry.files\n end", "def file_urls\n return { :original => file.url(:original) } unless image?\n file.styles.keys.inject({}){ |hash, style| hash.merge!(style => file.url(style)) }\n end", "def same_domain_urls\n (css_links + javascript_links + image_links + links).select{|url| \n begin \n URI.parse(url).host == @url.host\n rescue URI::InvalidURIError => e\n puts \"invalid uri \", e \n end\n }.uniq\n end", "def all_urls\n urls = NG_URL.all.collect {|n| n.url}\n urls.sort!\n end", "def images\n @images ||= parsed_images.map{ |i| absolutify_url(i) }\n end", "def remote_images\n @link_collector.remote_images\n end", "def files\n FileUtils.cd(@ruhoh.paths.theme) {\n return Dir[\"**/*\"].select { |filepath|\n next unless self.is_valid_asset?(filepath)\n true\n }\n }\n end", "def filenames\n file_stats.map(&:filename)\n end", "def image_url_list\n list = []\n images.each do |image|\n list << image.url \n end\n list\n end", "def remote_image_filenames(force: false)\n return @remote_image_filenames if defined?(@remote_image_filenames) && !force\n @product = ShopifyAPI::Product.find(product_id) if force\n\n @remote_image_filenames = product.images.map {|i| remote_image_filename(i.src) }\n end", "def urls\n @urls ||= extract_urls('url')\n end", "def assets\n []\n end", "def attachment_urls\n @list.when_list do\n result = call(\"Lists\", \"get_attachment_collection\", \"listName\" => @list.id, \"listItemID\" => @id)\n return result.xpath(\"//sp:Attachment\", NS).map { |att| att.text }\n end\n @list.when_document_library { raise TypeError, \"a document library does not support attachments\" }\n @list.raise_on_unknown_type\n end", "def static_files\n source = File.dirname(assets_path)\n asset_files.map do |file|\n dir = File.dirname(file)\n file_name = File.basename(file)\n Jekyll::StaticFile.new @site, source, dir, file_name\n end\n end", "def urls\n URI.extract(self.script)\n end", "def get_file_absolute_paths path\n get_file_names(path).map { |file| File.join(path, file) }\n end", "def extract_assets\n assets = content.css('img', 'script').map { |i| i['src'] }\n assets |= content.css('video').map { |v| v['poster'] }\n assets |= content.css('link').map { |l| l['href'] }\n\n assets.compact.uniq\n end", "def asset_url name\n host = @app.asset_host_for(name)\n return asset_path(name) if !host\n File.join(host, name)\n end", "def all_unique_imports\n files.map(&:all_imports).flatten.uniq\n end", "def assets\n @assets ||= Dir[File.join(@resources_path, \"assets\", \"*.{js,css,ttf,eot,svg,woff,png,jpeg}\")]\n @assets << Dir[File.join(Emoji.images_path, \"emoji\", \"*.png\")]\n @assets\n end", "def images\n @images ||= parsed_images.map{ |i| URL.absolutify(i, base_url) }\n end", "def artifacts\n data(\"artifacts\").map { |artifact| artifact[\"relativePath\"] }\n end", "def fetch_assets(cached=[])\n return [] if @body.nil?\n\n assets = []\n\n @body.css(\"img\").each do |img|\n assets << img[:src]\n end\n\n @body.css(\"script\").each do |script|\n next if script[:src].nil? or script[:src] == \"\"\n assets << script[:src]\n end\n\n @body.css(\"link\").each do |link|\n next if link[:href].nil? or link[:href] == \"\"\n assets << link[:href]\n end\n\n assets -= cached\n\n start = Time.now\n assets.each do |asset|\n begin\n get asset\n rescue Mechanize::ResponseCodeError, Timeout::Error => ex\n assets -= [asset]\n end\n end\n @stop += (Time.now - start)\n\n return assets\n end", "def extra_asset_links\n lines = []\n if item.attributes.has_key?(:css)\n for stylesheet in item.attributes[:css]\n lines.push(\"<link href='/assets/css/#{stylesheet}.css'\"+\n \" type='text/css' rel='stylesheet'>\")\n end\n end\n if item.attributes.has_key?(:js)\n for script in item.attributes[:js]\n lines.push(\"<script type='text/javascript'\" +\n \" src='/assets/js/#{script}.js'></script>\")\n end\n end\n lines.join(\"\\n\")\nend", "def extra_asset_links\n lines = []\n if item.attributes.has_key?(:css)\n for stylesheet in item.attributes[:css]\n lines.push(\"<link href='/assets/css/#{stylesheet}.css'\"+\n \" type='text/css' rel='stylesheet'>\")\n end\n end\n if item.attributes.has_key?(:js)\n for script in item.attributes[:js]\n lines.push(\"<script type='text/javascript'\" +\n \" src='/assets/js/#{script}.js'></script>\")\n end\n end\n lines.join(\"\\n\")\nend", "def get_all_image_cache_paths\n page_cache_directory = ActionController::Base.page_cache_directory.to_s\n page_cache_directory = page_cache_directory.split('/').join('/')\n paths = Dir.glob(\"#{page_cache_directory}#{GLOBAL_CONFIG[:location_images_cache_dir]}/\" +\n \"#{self.url_directory}/#{self.id}/**/*.*\".gsub('//', '/'))\n return paths.map{|p| p.gsub(/^#{page_cache_directory}/, '')}\n end", "def internal_links\n return [] if @links.empty?\n\n links = @links\n .select { |link| link.is_relative?(host: @url.to_base) }\n .map(&:without_base)\n .map do |link| # We map @url.to_host into / because it's a duplicate.\n link.to_host == @url.to_host ? Wgit::Url.new('/') : link\n end\n\n Wgit::Utils.process_arr(links)\n end", "def paths\n unless @paths\n @paths = []\n @paths << project._(:source, :main, :assets) if File.exist?(project._(:source, :main, :assets))\n end\n @paths\n end", "def urls\n (url.split(\",\") rescue []) + [cran_url]\n end", "def urls\n info.map(&:value).select { |u| u.match %r{\\Ahttps?://} }\n end", "def cl_asset\n self.asset.filename\n end", "def constituent_uris\n Array.wrap(constituents).uniq.delete_if(&:empty?)\n end", "def get_all_image_cache_paths\n page_cache_directory = ActionController::Base.page_cache_directory.to_s\n page_cache_directory = page_cache_directory.split('/').join('/')\n all_irs_keys = IMAGE_RENDER_SIZES.values.map{|v| v.keys}.flatten.uniq.join(',')\n paths = Dir.glob(\"#{page_cache_directory}#{GLOBAL_CONFIG[:coupon_merchant_images_cache_dir]}/\" +\n \"{#{IMAGE_TYPES.join(',')}}/{#{all_irs_keys}}/\" +\n \"#{self.url_directory}/#{self.id}.*\".gsub('//', '/'))\n return paths.map{|p| p.gsub(/^#{page_cache_directory}/, '')}\n end", "def internal_full_links\n links = internal_links\n return [] if links.empty?\n\n links.map { |link| base_url(link: link).concat(link) }\n end", "def sources\n @sources.names\n end", "def files\n Dir.glob(self.path + '**/*.mp3').collect {|file| File.basename(file)}\n end", "def asset_url(file)\n Assets.compute_path(file)\n end", "def files\n entries.map(&:filepath)\n end", "def links\n return @links unless @links.nil?\n @links = []\n return @links if !doc\n\n doc.search(\"//a[@href]\").each do |a|\n next if a['data-method'] && a['data-method'] != 'get'\n u = a['href']\n next if u.nil? or u.empty?\n abs = to_absolute(u) rescue next\n @links << abs if in_domain?(abs)\n end\n @links.uniq!\n @links\n end", "def installed_assets()\n installed = Array.new()\n asset_on_segment_historys.each do |hist|\n if !hist.assets.first.nil?\n asset = Asset.find_by_guid(hist.assets.first.g_u_i_d)\n installed << asset unless asset.asset_on_segment_history.nil?\n end\n end\n return installed\n end", "def links\n @doc.css('a[href]').map do |a|\n parse_element_attribute_uri(a, 'href')\n end.compact.uniq\n end", "def urls\n @gapi.source_uris\n end", "def asset_filenames\n pogo = format('pokemon_icon_%<number>03d_%<asset_id>02d.png',\n number: number, asset_id: asset_id)\n filenames = [pogo]\n\n if form?\n filenames << format('%<number>d-%<form>s.png',\n number: number, form: form.to_s)\n end\n\n filenames << number.to_s + \".png\"\n filenames\n end", "def extract_domain_specific_paths\n links.map do |link|\n uri = Addressable::URI.parse(link.strip)\n if uri.hostname.nil? || uri.hostname == @uri.hostname\n normalize_path uri.path\n end\n end.compact\n end", "def download_paths\n if @download.nil?\n raise \"File must be downloaded\"\n else\n @download.paths\n end\n end", "def urls\n keys\n end", "def file_references\n return unless @command == :download_file_list\n\n @file_references ||= begin\n xml = xml_doc content\n descriptors = xml.css('FileDescriptor')\n descriptors.map { |descriptor| descriptor.at('FileReference').content }\n end\n end", "def resolve_references(manifest)\n manifest.each_value do |entry|\n entry['file'] = prefix_vite_asset(entry['file'])\n entry['css'] = entry['css'].map { |path| prefix_vite_asset(path) } if entry['css']\n entry['imports']&.map! { |name| manifest.fetch(name) }\n end\n end", "def asset_links(lab)\n \"#{github_css_link(lab)} · #{github_html_link(lab)}\"\nend", "def files_on_remote\n @bucket_contents = nil\n bucket_contents.map {|item| File.basename(item['Key']) }.sort\n end", "def urls\n @@urls\n end" ]
[ "0.65789104", "0.6529746", "0.6507517", "0.63165164", "0.62608844", "0.6236724", "0.61528", "0.61167866", "0.6068386", "0.6046189", "0.6037346", "0.603708", "0.60247153", "0.5964529", "0.5951236", "0.5940672", "0.59215367", "0.58697313", "0.5868775", "0.5868775", "0.5868775", "0.5868492", "0.58371973", "0.579055", "0.5790123", "0.5774207", "0.57699084", "0.57616234", "0.5718815", "0.57072115", "0.56956315", "0.56862503", "0.5685094", "0.56730896", "0.56471866", "0.5642763", "0.5629237", "0.5605171", "0.5584941", "0.55742544", "0.55255413", "0.5520425", "0.54961205", "0.549292", "0.5485926", "0.5482857", "0.5468058", "0.5452927", "0.5444954", "0.54333603", "0.54331076", "0.54247767", "0.5422979", "0.5418233", "0.5418213", "0.5398476", "0.5384553", "0.5382911", "0.53823256", "0.53748876", "0.5369049", "0.5366226", "0.53590345", "0.535554", "0.5354399", "0.53476566", "0.5340378", "0.5339011", "0.5335976", "0.5331214", "0.53276604", "0.5326739", "0.53232884", "0.532275", "0.53104", "0.53047186", "0.5300477", "0.52919894", "0.5291259", "0.5283688", "0.52797943", "0.527945", "0.52584434", "0.524676", "0.52460957", "0.52448773", "0.5244072", "0.52419376", "0.52346545", "0.5223397", "0.5214903", "0.52038705", "0.5196955", "0.51929355", "0.51899916", "0.5180643", "0.5179385", "0.5179332", "0.51771235", "0.51752263" ]
0.5285678
79
Public: Return `String` of concatenated source. Returns String.
def source if @source @source else # File is read everytime to avoid memory bloat of large binary files File.binread(filename) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n @source_string || format\n end", "def to_s\n source\n end", "def to_s\n source\n end", "def to_s\n @source\n end", "def to_s\n \"(#{source}-#{target})\"\n end", "def compile_script_string\n @sources.string\n end", "def concat(string); end", "def plain_source\n lines.join\n end", "def plain_source\n lines.join\n end", "def exclude_sources_as_string\n res = \"\"\n res = self.exclude_sources.join(',') if self.exclude_sources.size > 0\n res\n end", "def to_s\n inject(\"\") { |a, b| a + b.to_s }\n end", "def to_s\n inject(\"\") { |a, b| a + b.to_s }\n end", "def to_s\n inject(\"\") { |a, b| a + b.to_s }\n end", "def __joinStrings\n # called from generated code\n str = ''\n n = 0\n siz = self.__size\n while n < siz\n str << self.__at(n).to_s\n n += 1\n end\n str\n end", "def to_s\n @out.join\n end", "def to_s\n return @string if @string\n result = @type + \" \" + to_sWithAliasesIndexes( @join_sources )\n result += @exporter.separator\n result += \"ON \" + @join_on.val.to_s if @join_on\n @string = result\n end", "def to_s\n self.join('')\n end", "def to_s\n self.join('')\n end", "def to_s\n path = rewrite_base_path(source)\n path = rewrite_query(path)\n path\n end", "def to_s\n \"#{tag} #{[@from.source, @to].quoteize.compact.flatten * \" \"}\"\n end", "def to_source; @name.to_s; end", "def to_s\n @out.join\n end", "def to_s\n resolve\n self.join(\" \")\n end", "def to_s\n join\n end", "def concat_head(other)\n StringWrapper.new(other.to_s + to_s)\n end", "def string\n @fragments.join(\" \")\n end", "def to_s\n \"(#{@x.map(&:to_s).join(\" + \")})\"\n end", "def to_s\n l = label ? \" '#{label.to_s}'\" : ''\n \"(#{source}-#{target}#{l})\"\n end", "def to_s\n inject(\"\") { |a, b| a + b.to_s }\n end", "def to_s\n inject(\"\") { |a, b| a + b.to_s }\n end", "def to_s\n self.join\n end", "def to_s\n buf = []\n each { |part| buf << part }\n buf.join\n end", "def to_s\r\n l = label ? \" '#{label.to_s}'\" : ''\r\n \"(#{source}-#{target}#{l})\"\r\n end", "def assemble\n @code.join\n end", "def to_s\n \"#{prefix}#{head}\"\n end", "def concatenator(string1, string2)\n \"#{string1} #{string2}\"\nend", "def to_s\n resolve if @pending\n self.join(' ')\n end", "def assemble_to_string\n #put the strings at the end of the assembled code.\n # adding them will fix their position and make them assemble after\n @string_table.values.each do |data|\n add_block data\n end\n io = StringIO.new\n assemble(io)\n io.string\n end", "def concatenate(strings)\n\nend", "def to_string\n \"#{@source} #{@remote_user} #{@timestamp} #{@http_request} \"\\\n \"#{@http_status} #{@element_size} byte #{@http_referer}\\n#{@user_agent}\"\n end", "def to_s; \"<Operand: #{to_source}>\"; end", "def to_s\n join(\"\\n\")\n end", "def to_s\n join(\" \")\n end", "def to_s\n resolve if @pending\n self.join(' ')\n end", "def to_str() end", "def to_str() end", "def source\n @_source ||= \"#{@rf['directory']}#{base_filename}.#{format}\"\n end", "def concat(filename, mode=:js)\n result = \"\"\n result += filename+\"\\n\" if mode == :jsfiles\n\n JsSplitter.split_file(filename).each do |item|\n case item[:type]\n when :source\n result += item[:value] if mode == :js\n when :requires\n fname = @module_name.resolve(item[:value])\n # skip already required files\n unless @required_files[fname]\n @required_files[fname] = true\n # read CSS and JS files differently\n if fname =~ /\\.css$/\n result += concat_css(fname, mode) if mode == :css || mode == :img\n else\n result += concat(fname, mode)\n end\n end\n end\n end\n\n return result\n end", "def source\n \"5+5+5\"\n end", "def get_source\n raise 'check this!'\n # _reflector = new ReflectionClass($this);\n # $file = _reflector.filename;\n # if (!file_exists($file)) {\n # return;\n # end\n # $source = file($file, FILE_IGNORE_NEW_LINES);\n # array_splice($source, 0, _reflector.getEndLine());\n # $i = 0;\n # while (isset($source[$i]) && '/* */' == substr_replace($source[$i], '', 3, -2)) {\n # $source[$i] = str_replace('*//* ', '*/', substr($source[$i], 3, -2));\n # ++$i;\n # end\n # array_splice($source, $i);\n # return implode(\"\\n\", $source);\n end", "def to_s\n target.to_s\n end", "def to_s\n lines = if @source_lines.nil?\n ''\n else\n # @type [Hash<Symbol, Int>] @source_lines\n \":#{@source_lines.values.uniq.join('-')}\"\n end\n\n message = @message\n message = message.split(\"\\n\").map(&:strip).join(' ') unless @preformatted\n message += \"\\nLog pattern: '#{@pattern}'\" if Logger.debug?\n\n <<~MSG\n #{@source_file}#{lines}: #{@level.to_s.upcase}\n #{message}\n MSG\n end", "def to_s\n\t\tstring = \"(\"\n\t\taux = @head\n\t\twhile(aux != nil) do\n\t\t\tstring += \"#{aux.to_s}\"\n\t\t\t@aux = @aux.next\n\t\tend\t\n\t\tstring += \")\"\n\t\treturn string\n\tend", "def append(value = '')\n @source += value\n end", "def concat(ga1, ga2)\n p \"#{ga1} makes a better ginger ale than #{ga2}\"\nend", "def to_string\n render().join \"\\n\"\n end", "def concat\n content = \"\"\n files = []\n @opts[:files].each do |file|\n files += if single? file\n [\"#{@opts[:input_dir]}/#{file}.#{@opts[:type]}\"]\n else\n expand file\n end\n end\n files.each do |file|\n content << File.read(file)\n content << \"\\n\"\n end\n\n if @opts[:outputs]\n @opts[:outputs].each do |name|\n output = \"#{name}.#{@opts[:type]}\"\n local = content\n local = @opts[:filter].call(output, local) if @opts[:filter]\n File.open(output, \"w\"){ |f| f.write local.strip }\n UI.info \"Concatenated #{output}\"\n end\n else\n content = @opts[:filter].call(@output, content) if @opts[:filter]\n File.open(@output, \"w\"){ |f| f.write content.strip }\n UI.info \"Concatenated #{@output}\"\n end\n end", "def to_s\n \"(#{@op.to_s} #{@first.to_s} #{@second.to_s})\"\n end", "def to_s\n text =\"\"\n {'type'=>@type, 'copy'=>(@copy) ? \":copy\" : nil, 'target'=>@target}.each do |name,item|\n if ['target'].index(name)\n text += \"\\\"#{item}\\\" \" unless item.nil?\n else\n text += \"#{item} \" unless item.nil?\n end\n\n end\n text[text.length-1] = \";\" if text.length > 0\n text\n end", "def source_url\n str = \"#{oer_url}?app_id=#{app_id}\"\n str = \"#{str}&base=#{source}\" unless source == OE_SOURCE\n str = \"#{str}&show_alternative=#{show_alternative}\"\n str = \"#{str}&prettyprint=#{prettyprint}\"\n str = \"#{str}&symbols=#{symbols.join(',')}\" if symbols&.is_a?(Array)\n str\n end", "def to_s\n\t\t\tself.to_a.map {|x| x.to_s}.join\n\t\tend", "def to_s\n\t\t\tself.to_a.map {|x| x.to_s}.join\n\t\tend", "def to_s\n\t\t\tself.to_a.map {|x| x.to_s}.join\n\t\tend", "def to_s\n \"(#{@x.map(&:to_s).join(\" * \")})\"\n end", "def src\n \"#{@cur_method.first.first} | #{@cur_method.map(&:first)[1..-1].join('.')}\"\n end", "def to_s\n @string ||= STR_LEFT_BRACKET + self.to_a.compact.map {|prop| prop.to_s}.join(STR_SEPARATOR) + STR_RIGHT_BRACKET\n end", "def concat(string)\n output_buffer << string\n end", "def to_s\n render().join \"\\n\"\n end", "def to_s\n s = @list.join(command_join_string!)\n s\n end", "def to_s\n to_a.join(SEPARATOR)\n end", "def to_s\n output || content || \"\"\n end", "def inspect\n str = \"#<#{self.class} source=#{source.inspect}\"\n str << \" generated=#{generated}, original=#{original}\"\n str << \" name=#{name.inspect}\" if name\n str << \">\"\n str\n end", "def to_s\n full\n end", "def concat(other)\n %s(do\n (assign ro (callm other __get_raw))\n (assign osize (strlen ro))\n (assign bsize (strlen @buffer))\n (assign size (add bsize osize))\n (assign size (add size 1))\n (assign newb (malloc size))\n (strcpy newb @buffer)\n (strcat newb ro)\n (assign @buffer newb)\n )\n self\n end", "def to_string; end", "def to_string\n @cards.inject(\"\") do |str, card|\n str += card.to_string + \" \"\n end\n end", "def to_s\n\t\tself.to_a.map {|x| x.to_s}.join\n\tend", "def to_s\n \"\"\n end", "def to_s\n \"\"\n end", "def to_s\n self.join \" \"\n end", "def to_s\n self.to_a.map {|x| x.to_s}.join\n end", "def to_s\n self.to_a.map {|x| x.to_s}.join\n end", "def to_s\n statements.collect { |s| s.to_s }.join(\";\\n\")\n end", "def to_s\n \"\"\n end", "def source_path\n sp = []\n\n Tml.session.block_options_queue.each do |opts|\n next unless hash_value(opts, :source)\n sp << hash_value(opts, :source)\n end\n\n sp = sp.reverse\n sp.unshift(Tml.session.current_source)\n\n sp.join(Tml.config.source_separator)\n end", "def to_s\n @string\n end", "def to_s\n @string\n end", "def to_s\n @string\n end", "def to_s\n @string\n end", "def string_concat(name_1, name_2)\n puts \"I went to the concert with \" +name_1 + \" and \" + name_2 + \".\"\nend", "def to_s\n \"#{@first}/#{@last}\"\n end", "def to_s\n @output.inject('') { |r, entry| r << entry.to_s }\n end", "def to_s\n \"Target - #{@name}\"\n end", "def to_str; end", "def to_str; end", "def to_str; end", "def to_str; end", "def to_str; end", "def to_str; end", "def to_str; end", "def to_str; end" ]
[ "0.6919735", "0.6726291", "0.6726291", "0.66409", "0.64276826", "0.6298255", "0.6271127", "0.6219377", "0.61574656", "0.61185443", "0.6115029", "0.6115029", "0.6115029", "0.6103059", "0.60930705", "0.6088341", "0.60883355", "0.60883355", "0.6050377", "0.60121024", "0.59944403", "0.5958206", "0.5957862", "0.5953029", "0.5936963", "0.5930422", "0.59220666", "0.5919801", "0.5907678", "0.5907678", "0.5848973", "0.58453953", "0.5835082", "0.58135504", "0.580808", "0.5795763", "0.5775359", "0.5768455", "0.57060915", "0.56777006", "0.56623197", "0.5651315", "0.5627766", "0.5617911", "0.5610435", "0.5610435", "0.55918646", "0.55827785", "0.55778795", "0.5569377", "0.5556436", "0.55531615", "0.5538591", "0.5532995", "0.5525516", "0.5512189", "0.5510047", "0.5504267", "0.55040675", "0.5489019", "0.5472971", "0.5472971", "0.5472971", "0.5469823", "0.5466985", "0.5461209", "0.5450949", "0.54504573", "0.54501295", "0.5439724", "0.54386556", "0.54378235", "0.5436715", "0.5436698", "0.54335123", "0.54303306", "0.54303205", "0.5426349", "0.5426349", "0.54249936", "0.5423955", "0.5423955", "0.5418584", "0.5404022", "0.5390684", "0.5390389", "0.5390389", "0.5390389", "0.5390389", "0.5383874", "0.5377934", "0.5365708", "0.5364413", "0.53623176", "0.53623176", "0.53623176", "0.53623176", "0.53623176", "0.53623176", "0.53623176", "0.53623176" ]
0.0
-1
Public: Alias for source. Returns String.
def to_s source end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def source_name\n return @source_name\n end", "def name\n source.longname\n end", "def to_source; @name.to_s; end", "def name\n @name ||= source.name\n end", "def source(arg = nil)\n set_or_return(:source, arg, kind_of: [String])\n end", "def source_name\n data_dictionary.source_name\n end", "def source= string\n #This is a stub, used for indexing\n end", "def get_source_name\n raise NotImplementedError\n end", "def table_name\n respond_to?(:first_source_alias) ? first_source_alias : super\n end", "def source_name\n source_node.name\n end", "def source\n ap get_source\n end", "def source\n @source\n end", "def source\n @source\n end", "def source(arg=nil)\n set_or_return(\n :source,\n arg,\n :kind_of => [ String ]\n )\n end", "def to_s\n @source\n end", "def aliased_name; end", "def source\n @source ||= raw_source.split(\"---\\n\")[2]\n end", "def source\n @source ||= raw_source.split(\"---\\n\")[2]\n end", "def source_helper(source_location, name = T.unsafe(nil)); end", "def to_s\n self.alias\n end", "def source_name\n 'Archives & Manuscripts'\n end", "def compute_source_path(source, ext)\n asset_for(source, ext)\n end", "def source(arg = nil)\n set_or_return(:source, arg, kind_of: [String, NilClass], default: nil)\n end", "def source\n return @source\n end", "def source\n return @source\n end", "def source_name=(value)\n @source_name = value\n end", "def table_name\n dataset.first_source_alias\n end", "def table_name\n dataset.first_source_alias\n end", "def source_name_method\n \"#{accession_number} (#{report_date})\"\n end", "def source\n @_source ||= \"#{@rf['directory']}#{base_filename}.#{format}\"\n end", "def target_alias\n decode_string_member(:target_alias)\n end", "def source_credit\n :\"source_credit_#{source}\" if source.present?\n end", "def source\n self\n end", "def source_path\n source[:path]\n end", "def source_path\n Pathname.new(self.config[:source_path])\n end", "def set_source_string(source)\n @source = source\n end", "def source\n @attributes[:source]\n end", "def source\n @attributes[:source]\n end", "def content\n \"alias #{@name}=#{@val}\"\n end", "def source_path\n File.expand_path source unless source.nil?\n end", "def source; end", "def source; end", "def source; end", "def source; end", "def source; end", "def source; end", "def source; end", "def source; end", "def source; end", "def source; end", "def source; end", "def source; end", "def source; end", "def source; end", "def source; end", "def source; end", "def source; end", "def source()\n #This is a stub, used for indexing\n end", "def source(value)\n merge(source: value.to_s)\n end", "def source()\n #This is a stub, used for indexing\n end", "def compute_asset_extname(source, options = T.unsafe(nil)); end", "def source_get\n db_select 'source'\n end", "def source\n self\n end", "def source_path\n Pathname.new(config[:source_path])\n end", "def source_path; end", "def raw_source\n @raw_source\n end", "def raw_source\n @raw_source\n end", "def raw_source\n @raw_source\n end", "def source_object_name\n return @source_object_name\n end", "def source_path(arg=nil)\n set_or_return(\n :source_path,\n arg,\n :kind_of => [ String ]\n )\n end", "def full_source=(_arg0); end", "def source\n result_hash['src']\n end", "def source\n AQL.name_node(input.name)\n end", "def attribute_source_column(source_model, source_name)\n if source_model.column_names.include? source_name\n source_name\n else\n \"#{source_name}*\"\n end\n end", "def to_s\n @source_string || format\n end", "def source() end", "def source filename\n source_hash[filename]\n end", "def source_suffix\n options[:source_suffix]\n end", "def tmp_source\n if admin_user\n @source = admin_user.email || 'Manual keying'\n else\n @source = 'Excell feed'\n end\n @source\n end", "def dmg_package_source\n if %i(direct repo).include?(new_resource.source)\n return package_metadata[:url]\n end\n path = new_resource.source.to_s\n (path.start_with?('/') ? 'file://' : '') + path\n end", "def source\n raise 'implement me in subclass!'\n end", "def to_s\n path = rewrite_base_path(source)\n path = rewrite_query(path)\n path\n end", "def source(arg = nil)\n set_or_return(:source,\n arg,\n kind_of: String,\n default: \"#{app_name}.default.erb\")\n end", "def source\n File.read(source_path)\n end", "def source\n raise NotImplementedError\n end", "def to_alias\n \"-#{@alias}\"\n end", "def source_path\n sp = []\n\n Tml.session.block_options_queue.each do |opts|\n next unless hash_value(opts, :source)\n sp << hash_value(opts, :source)\n end\n\n sp = sp.reverse\n sp.unshift(Tml.session.current_source)\n\n sp.join(Tml.config.source_separator)\n end", "def source\n @data['source']\n end", "def source_file\n return @source_file\n end", "def synthetic_source=(value)\n if value == @defaults['ai.operation.syntheticSource']\n @values.delete 'ai.operation.syntheticSource' if @values.key? 'ai.operation.syntheticSource'\n else\n @values['ai.operation.syntheticSource'] = value\n end\n end", "def source_location()\n #This is a stub, used for indexing\n end", "def source_title\n bib_source_title || get_item_data_by_name('TitleSource')\n end", "def source_file\n @source_location[0]\n end", "def collectible_source decorator, options={}\n if decorator.object.class == Feed\n feed_entries_status decorator.object\n elsif decorator.object.class == List\n 'compiled by '.html_safe + homelink(decorator.object.owner, options)\n elsif (decorator.object.respond_to?(:site) && decorator.object.site)\n 'source: '.html_safe + homelink(decorator.object.site, options)\n end\n end", "def compile_script_string\n @sources.string\n end", "def source(disk)\n \"#{disk.sysds_path}/#{disk.vm_id}/disk.#{disk.id}\"\n end", "def source(override)\n override['source'] || self['source'] || DEFAULTS['source']\n end", "def source(options = {})\r\n end", "def source_location(*); end" ]
[ "0.72151077", "0.71125656", "0.6881194", "0.68185216", "0.6798246", "0.6792208", "0.6790796", "0.67412484", "0.67238414", "0.6605721", "0.65686023", "0.6553067", "0.6553067", "0.6519701", "0.64726955", "0.6406953", "0.64023256", "0.64023256", "0.63935184", "0.6375039", "0.63744396", "0.63549984", "0.63540626", "0.63479495", "0.63479495", "0.63430816", "0.63403785", "0.63403785", "0.6334044", "0.63332444", "0.6331993", "0.62642443", "0.6262623", "0.62522924", "0.62468344", "0.6234212", "0.6232322", "0.6232322", "0.6225443", "0.62202364", "0.62184155", "0.62184155", "0.62184155", "0.62184155", "0.62184155", "0.62184155", "0.62184155", "0.62184155", "0.62184155", "0.62184155", "0.62184155", "0.62184155", "0.62184155", "0.62184155", "0.62184155", "0.62184155", "0.62184155", "0.6215488", "0.61999184", "0.6178982", "0.61772835", "0.61705416", "0.61618817", "0.6144561", "0.61371887", "0.6134312", "0.6134312", "0.6134312", "0.612871", "0.61242455", "0.6108618", "0.60966074", "0.6091114", "0.60624903", "0.6057074", "0.6057063", "0.605218", "0.60439914", "0.6029745", "0.60169286", "0.60123855", "0.5999894", "0.5999541", "0.59994763", "0.5986417", "0.59374356", "0.59361863", "0.5926216", "0.5906791", "0.5877306", "0.58763397", "0.5860287", "0.585845", "0.5850316", "0.58315676", "0.5831357", "0.58253145", "0.5820131", "0.581901" ]
0.634191
27
Public: Get charset of source. Returns a String charset name or nil if binary.
def charset metadata[:charset] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def charset\n match_data = headers['Content-Type']&.match(/charset=(.*);?/)\n return unless match_data\n\n Encoding.find(match_data[1])\n end", "def charset\n if @header\n has_content_type? ? content_type_parameters['charset'] : @charset\n else\n @charset\n end\n end", "def get_charset(locale)\n loc = LocaleTable.find{|v| v[1] == locale.to_win}\n loc = LocaleTable.find{|v| v[1] =~ /^#{locale.language}-/} unless loc\n loc ? loc[2] : \"CP1252\"\n end", "def charset\n #@data.charset ||= CharGuess.guess(document).downcase\n end", "def charset\n # locale parameter is ignored now.\n system.charset\n end", "def get_charset(locale)\n locale.charset || @@default_locale.charset\n end", "def character_set_name\n @charset.name\n end", "def charset\n @charset ||= message.charset.upcase\n end", "def get_charset_name(charset)\n charset.downcase.gsub(/[^0-9a-z]/, \"\")\n end", "def charset_name(name)\n case name.to_s.downcase\n when \"utf-8\"\n \"utf8\"\n when /^iso-8859-[0-9]+$/\n name.to_s.gsub(/^.*?-([0-9]+)$/, \"latin\\\\1\")\n else\n name\n end\n end", "def charset\n type, *parameters = content_type_parse\n if pair = parameters.assoc('charset')\n pair.last.downcase\n elsif block_given?\n yield\n elsif type && %r{\\Atext/} =~ type &&\n @base_uri && @base_uri.scheme == 'http'\n \"iso-8859-1\" # RFC2616 3.7.1\n else\n nil\n end\n end", "def charset\n @charset ||= (charset_from_meta_charset || charset_from_content_type)\n end", "def get_encoding_from_headers(type_header)\n return nil unless type_header\n\n content_type, params = cgi_parse_header(type_header)\n\n if params.include?('charset')\n return params.fetch('charset').gsub(/(\\A[\"']*)|([\"']*\\z)/, '')\n end\n\n nil\n end", "def get_charset(text)\n charset_str = 'charset='\n ind = text.index(charset_str); p \"find charset=\" + ind.to_s\n if ind.nil?; return 'iso-8859-1'; end\n start = ind + charset_str.length#; p start.to_s\n ind2 = text.index('\"', start)#; p ind2.to_s\n if ind2 == start #start with \"\n ind3 = text.index('\"', start+1);\n return text[(ind2+1)...ind3]\n else\n return text[start...ind2]\n end\n end", "def charset\n @@charset\n end", "def charset; end", "def charset; end", "def charset; end", "def _character_set(id)\n Unxls::Biff8::Constants::CHARSETS[id]\n end", "def charset\n 'utf-8'\n end", "def mime_type_charset_detecter(mime_type)\n if type = config[:mime_types][mime_type]\n if detect = type[:charset]\n return detect\n end\n end\n end", "def charset\n 'UTF8'\n end", "def charset\n perform! unless @performed\n content_type = @curl.content_type || ''\n charset = if content_type.match(/charset\\s*=\\s*([a-zA-Z0-9-]+)/ni)\n $1\n elsif ! body_str.nil? and (m = body_str.slice(0,1000).match(%r{<meta.*http-equiv\\s*=\\s*['\"]?Content-Type['\"]?.*?>}mi)) and\n m[0].match(%r{content=['\"]text/html.*?charset=(.*?)['\"]}mi)\n $1\n else\n ''\n end.downcase\n end", "def charset\n @charset ||= (charset_from_meta_charset || charset_from_meta_content_type)\n end", "def extract_charset_from_text(text)\n force_to_utf8(text.to_s&.first(5_000))&.scan(%r{<meta(?!\\s*(?:name|value)\\s*=)[^>]*?charset\\s*=[\\s\"']*([^\\s\"'\\/>]*)})\n &.first\n &.upcase\n &.gsub('-', '_')\n rescue ArgumentError => e\n raise e unless e.to_s.include?('invalid byte')\n\n nil\n end", "def charset\n @j_del.charset().toString()\n end", "def get_char_set(content_type)\n char_set = content_type.match(/charset\\s*=\\W*([\\w\\-]+)/)\n char_set ? boundary[1] : nil\n end", "def z_fix_charset\n Iconv.iconv('UTF-8', 'UTF-8', self).first.to_s\n end", "def detect_charset(path)\n Process.run_command 'uchardet', path\n rescue Errno::ENOENT\n # :nocov:\n Process.run_command('encguess', path).sub(/^.*\\s+/, '')\n # :nocov:\n end", "def charset=(_arg0); end", "def charset_id2name(charset_id)\n #This is a stub, used for indexing\n end", "def find_encoding(encoding); end", "def charset\n show_variable \"character_set_database\"\n end", "def encoding\n if @encoding.blank?\n if !self.http_headers.blank?\n if self.http_headers['content-type'] =~ /charset=([\\w\\d-]+)/\n @encoding = $1.downcase\n else\n @encoding = self.encoding_from_feed_data\n end \n else\n @encoding = self.encoding_from_feed_data\n end\n end\n return @encoding\n end", "def character_set_name\n data[:character_set_name]\n end", "def character_set_name\n data[:character_set_name]\n end", "def found_encoding; end", "def found_encoding; end", "def get_encoding()\n puts @csv_encoding\n end", "def find_enoding\n scmdlog = `file -I #{@file_name}`.strip\n scmdlog[/charset=(.+?)$/, 1]\n end", "def charset=(_); end", "def guess_encoding\n if @mime_type && !@mime_type.binary?\n \"7bit\"\n else\n \"binary\"\n end\n end", "def process_encoding(source)\n source.force_encoding(Encoding::UTF_8)\n end", "def character_set_name\n @dbi.character_set_name\n end", "def character_set_name\n @dbi.character_set_name\n end", "def charset_from_meta_content(string)\n\n charset_match = string.match(/charset\\s*\\=\\s*(.+)/i)\n\n if charset_match\n\n charset_value = charset_match[1]\n\n charset_value[/\\A\\\"(.*)\\\"/, 1] ||\n charset_value[/\\A\\'(.*)\\'/, 1] ||\n charset_value[/(.*)[\\s;]/, 1] ||\n charset_value[/(.*)/, 1]\n else\n nil\n end\n\n end", "def transfer_encoding\n h = header.find('Content-Transfer-Encoding')\n return nil if h.nil?\n\n h[1]\n end", "def get_utf8cstring(string,buffer,bufferSize)\n JavaScriptCore::Lib.JSStringGetUTF8CString(string,buffer,bufferSize)\n end", "def character_set\n @character_set ||= show_variable('character_set_connection') || 'utf8'\n end", "def get_utf8_of(character)\n character.unpack('H*').first.upcase\nend", "def pbGetPlayerCharset(meta,charset,trainer=nil)\n trainer=$Trainer if !trainer\n outfit=trainer ? trainer.outfit : 0\n ret=meta[charset]\n ret=meta[1] if !ret || ret==\"\"\n# if FileTest.image_exist?(\"Graphics/Characters/\"+ret+\"_\"+outfit.to_s)\n if pbResolveBitmap(\"Graphics/Characters/\"+ret+\"_\"+outfit.to_s)\n ret=ret+\"_\"+outfit.to_s\n end\n return ret\nend", "def nchar_character_set_name\n data[:nchar_character_set_name]\n end", "def charset_name2id(charset_name)\n #This is a stub, used for indexing\n end", "def collation\n 'ucs_binary'\n end", "def encoding_from_feed_data\n if @encoding_from_feed_data.blank?\n raw_data = self.feed_data\n return nil if raw_data.nil?\n encoding_from_xml_instruct = \n raw_data.scan(\n /^<\\?xml [^>]*encoding=\"([^\\\"]*)\"[^>]*\\?>/\n ).flatten.first\n unless encoding_from_xml_instruct.blank?\n encoding_from_xml_instruct.downcase!\n end\n if encoding_from_xml_instruct.blank?\n begin\n doc = REXML::Document.new(raw_data)\n encoding_from_xml_instruct = doc.encoding.downcase\n if encoding_from_xml_instruct == \"utf-8\"\n # REXML has a tendency to report utf-8 overzealously, take with\n # grain of salt\n encoding_from_xml_instruct = nil\n end\n rescue\n end\n else\n @encoding_from_feed_data = encoding_from_xml_instruct\n end\n if encoding_from_xml_instruct.blank?\n sniff_table = {\n \"Lo\\247\\224\" => \"ebcdic-cp-us\",\n \"<?xm\" => \"utf-8\"\n }\n sniff = self.feed_data[0..3]\n if sniff_table[sniff] != nil\n @encoding_from_feed_data = sniff_table[sniff].downcase\n end\n else\n @encoding_from_feed_data = encoding_from_xml_instruct\n end\n if @encoding_from_feed_data.blank?\n # Safest assumption\n @encoding_from_feed_data = \"utf-8\"\n end\n end\n return @encoding_from_feed_data\n end", "def charset\n names = []\n 26.times do |i|\n names << (65 + i).chr\n end\n names\nend", "def get()\n i = @source_io.getc\n return EOF if(!i)\n c = i.chr\n return c if (i >= SPACE || i == ?\\n || c.unpack(\"c\") == EOF)\n return \"\\n\" if (i == ?\\r)\n return \" \"\n end", "def getc\n read(1).unpack('c')[0]\n end", "def guess_encoding(guesser = CharDet)\n Encoding.find(guesser.detect(self, :silent => true)[\"encoding\"])\n end", "def getChar\n if @index <= @code.size - 1\n return @code[@index] if !@code[@index].nil?\n end\n # If nil return empty string.\n return nil\n end", "def source\n if @source\n @source\n else\n # File is read everytime to avoid memory bloat of large binary files\n File.binread(filename)\n end\n end", "def file_encoding(file)\n output = %x{file --mime-encoding #{file} 2>&1}.chomp\n regexp = Regexp.new(\"#{file}: (\\\\S+)\")\n matched = output.match(regexp)\n encoding = matched[1] if matched\n encoding = begin Encoding.find(encoding) rescue nil end\n end", "def encoding\n @connection.encoding.to_s\n end", "def getc\n if @c\n c = @c\n @c = nil\n c\n else\n @io.getc\n end\n end", "def fix_charset(object)\n return nil if object.nil?\n\n if object.charset\n object.body.decoded.force_encoding(object.charset.gsub(/utf8/i, \"UTF-8\")).encode(\"UTF-8\").to_s\n else\n object.body.to_s\n end\n rescue\n nil\n end", "def codec_name\n @av_stream[:codec][:codec_name]\n end", "def charset=(value)\n @defaulted_charset = false\n @charset = value\n @header.charset = value\n end", "def check_utf8_encoding\n return nil if self.encoding != Encoding.find('utf-8')\n state = :s0\n n_of_chars = 0\n self.bytes.each do |byte|\n case state\n when :s0\n n_of_chars += 1\n if (0x00..0x7F).include?(byte) then state = :s0\n elsif (0xC2..0xDF).include?(byte) then state = :s1\n elsif 0xE0 == byte then state = :s2\n elsif (0xE1..0xEC).include?(byte) || (0xEE..0xEF).include?(byte) then state = :s3\n elsif 0xED == byte then state = :s4\n elsif 0xF0 == byte then state = :s5\n elsif (0xF1..0xF3).include?(byte) then state = :s7\n elsif 0xF4 == byte then state = :s8\n else return nil end\n when :s1\n if (0x80..0xBF).include?(byte) then state = :s0 \n else return nil end\n when :s2\n if (0xA0..0xBF).include?(byte) then state = :s1\n else return nil end\n when :s3\n if (0x80..0xBF).include?(byte) then state = :s1\n else return nil end\n when :s4\n if (0x80..0x9F).include?(byte) then state = :s1\n else return nil end\n when :s5\n if (0x90..0xBF).include?(byte) then state = :s6\n else return nil end\n when :s6\n if (0x80..0xBF).include?(byte) then state = :s1\n else return nil end\n when :s7\n if (0x80..0xBF).include?(byte) then state = :s6\n else return nil end\n when :s8\n if (0x80..0x8F).include?(byte) then state = :s6\n else return nil end\n end # case\n end # self.bytes.each\n if state == :s0 then return n_of_chars\n else return nil end\n end", "def to_char(c)\n CHARSET.at(to_integer(c))\n end", "def peek()\n lookaheadChar = @source_io.getc\n @source_io.ungetc(lookaheadChar)\n return lookaheadChar.chr\n end", "def get_character(input = T.unsafe(nil)); end", "def _rl_get_char_len(src)\r\n return 0 if src[0,1] == 0.chr || src.length==0\r\n case @encoding\r\n when 'E'\r\n len = src.scan(/./me)[0].to_s.length\r\n when 'S'\r\n len = src.scan(/./ms)[0].to_s.length\r\n when 'U'\r\n len = src.scan(/./mu)[0].to_s.length\r\n when 'X'\r\n src = src.dup.force_encoding(@encoding_name)\r\n len = src.valid_encoding? ? src[0].bytesize : 0\r\n else\r\n len = 1\r\n end\r\n len==0 ? -2 : len\r\n end", "def default_encoding\n Encoding::UTF_8\n end", "def encoding\n\t'ISO-8859-1'\nend", "def untitled_file_name()\n return \"ללא שם\"\n end", "def default_encoding; end", "def default_encoding; end", "def so_encoding(feature)\n if hash = @data[feature]\n if hash[\"encoding\"]\n return hash[\"encoding\"]\n end\n end\n end", "def encoding\n if @connection.respond_to?(:encoding)\n @connection.encoding.to_s\n else\n @connection.execute('PRAGMA encoding')[0]['encoding']\n end\n end", "def cipher_name\n rc, name = Cproton.pn_ssl_get_cipher_name(@impl, 128)\n return name if rc\n nil\n end", "def cfile_for_file path\n _, file, ext = path.match(EXTENSION_REGEX).to_a\n\n if ext && ext != \"\" && compiler = @compilers_by_input[ext]\n get_cfile(path, compiler, ext, compiler[:outputs].first)\n else\n nil\n end\n end", "def codepoint_to_char(codepoint)\n if charset.at(codepoint).nil?\n fail NotInCharset, \"Codepoint #{codepoint} does not exist in charset\"\n end\n charset.at(codepoint)\n end", "def raw_encoding(default = Encoding::ASCII_8BIT)\n if @io.respond_to? :internal_encoding\n @io.internal_encoding || @io.external_encoding\n elsif @io.is_a? StringIO\n @io.string.encoding\n elsif @io.respond_to? :encoding\n @io.encoding\n else\n default\n end\n end", "def utf8_character\n character.chr(Encoding::UTF_8)\n end", "def best_mime_encoding\n if self.is_ascii?\n :none\n elsif self.length > (self.mb_chars.length * 1.1)\n :base64\n else\n :quoted_printable\n end\n end", "def mime_type\n if source.present?\n source.mime_type\n end\n end", "def encoding\n Encoding::UTF_8\n end", "def encoding\n Encoding::UTF_8\n end", "def name\n UnicodeUtils.char_name(@int)\n end", "def collation\n @collation ||= show_variable('collation_connection') || 'utf8_general_ci'\n end", "def to_utf8(src, dest)\n inpath = File.expand_path(src)\n outpath = File.expand_path(dest)\n\n m, src_enc = *@head.match(/encoding=.([a-zA-Z0-9\\-]+)./i)\n\n # ensure the file is actually utf8\n if `isutf8 #{inpath}`.strip == \"\"\n if src_enc.to_s.downcase == \"utf-8\"\n FileUtils.cp(inpath, outpath)\n else\n FileUtils.cp(inpath, outpath)\n `sed -i 's/<?xml.*?>/<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>/' #{outpath}`\n end\n elsif src_enc\n `iconv --from-code=#{src_enc} --to-code=UTF-8 #{inpath} > #{outpath}`\n `sed -i 's/#{src_enc}/UTF-8/' #{outpath}`\n else\n FileUtils.cp(inpath, outpath)\n end\n end", "def charset! charset\n content_type! response['Content-Type'], charset\n end", "def collation\n return @collation\n end", "def country_name_to_code(name: T.unsafe(nil)); end", "def get_cp850_of(character)\n begin\n character.encode('CP850').unpack('H*').first.to_i(16).to_s\n rescue Encoding::InvalidByteSequenceError, Encoding::UndefinedConversionError\n \"\"\n end\nend", "def collation\n nil\n end", "def getbyte\n char = getc\n char ? char.getbyte(0) : nil\n end", "def cstr\n raise EOFError if @io.eof?\n\n @io.each_byte.take_while(&:nonzero?).pack('C*')\n end", "def content_encoding\n\t\treturn self.headers.content_encoding\n\tend", "def content_encoding\n\t\treturn self.headers.content_encoding\n\tend" ]
[ "0.659046", "0.6367566", "0.6229204", "0.61779934", "0.6177169", "0.61548465", "0.6091332", "0.60854757", "0.59697956", "0.594551", "0.5923558", "0.5916024", "0.59149176", "0.58618385", "0.58477885", "0.5847129", "0.5847129", "0.5847129", "0.5831569", "0.58224195", "0.58011943", "0.5793912", "0.578993", "0.5749834", "0.57153136", "0.5689017", "0.5587099", "0.5565991", "0.5538319", "0.5323544", "0.5290775", "0.52896655", "0.5283383", "0.5263723", "0.52554", "0.52554", "0.51309544", "0.51309544", "0.50370896", "0.50356466", "0.5023248", "0.5013195", "0.5006534", "0.4975291", "0.4975291", "0.497209", "0.49596056", "0.49501407", "0.49169552", "0.4889034", "0.48840585", "0.4856393", "0.48128694", "0.4806701", "0.479821", "0.4794085", "0.47928792", "0.47759825", "0.47745633", "0.47694057", "0.46955416", "0.46770993", "0.46490267", "0.4648983", "0.46325353", "0.4632247", "0.4628366", "0.4626546", "0.46235824", "0.4615005", "0.4611318", "0.46109724", "0.4609643", "0.45887837", "0.45879906", "0.4576579", "0.4576579", "0.45667788", "0.45634606", "0.45489684", "0.4547251", "0.45391998", "0.45346865", "0.4532612", "0.45128107", "0.4495891", "0.44834083", "0.44834083", "0.44810298", "0.44749078", "0.44714794", "0.4449848", "0.4443946", "0.44394693", "0.44232905", "0.44113797", "0.44113195", "0.44071656", "0.44022426", "0.44022426" ]
0.6480153
1
Public: Returns Integer length of source.
def length metadata[:length] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def size\n @source_data && @source_data.size || 0\n end", "def length() end", "def length() end", "def length() end", "def length() end", "def length\n length = 0\n each{|s| length += s.bytesize}\n length\n end", "def length\n do_num_bytes\n end", "def length\n do_num_bytes\n end", "def length\n @line.length\n end", "def length; end", "def length; end", "def length; end", "def length; end", "def length; end", "def length; end", "def length; end", "def length\n do_num_bytes\n end", "def length\n return @args[:data].length\n end", "def length\n @length\n end", "def length\n @length\n end", "def length\n @length\n end", "def length\n Integer(connection.write(\"get_length\", false))\n rescue ArgumentError\n 0\n end", "def length\n Integer(connection.write(\"get_length\", false))\n rescue ArgumentError\n 0\n end", "def length\n Integer(connection.write(\"get_length\", false))\n rescue ArgumentError\n 0\n end", "def length; count end", "def length\n @data.length\n end", "def length\n @content.length\n end", "def length()\n return to_s.size\n end", "def length \n io_index.length\n end", "def length\n end", "def length\n @length\n end", "def length\n contents.length\n end", "def length\n\t\t@data.length\n\tend", "def length\n @count\n end", "def target_len; target.size; end", "def length\n to_s.length\n end", "def length\n end", "def length(*) end", "def length(*) end", "def length\n end", "def length\n end", "def length\n end", "def length\n end", "def length\n end", "def length\n self.to_s.length\n end", "def width\n @source.width\n end", "def _rl_get_char_len(src)\r\n return 0 if src[0,1] == 0.chr || src.length==0\r\n case @encoding\r\n when 'E'\r\n len = src.scan(/./me)[0].to_s.length\r\n when 'S'\r\n len = src.scan(/./ms)[0].to_s.length\r\n when 'U'\r\n len = src.scan(/./mu)[0].to_s.length\r\n when 'X'\r\n src = src.dup.force_encoding(@encoding_name)\r\n len = src.valid_encoding? ? src[0].bytesize : 0\r\n else\r\n len = 1\r\n end\r\n len==0 ? -2 : len\r\n end", "def length\n count\n end", "def length\n\t\t@length\n\tend", "def length\n (lines.max_by(&:length) || '').size\n end", "def length\n size\n end", "def length\n size\n end", "def length\n @bin_data.length\n end", "def size\r\n self.data.length\r\n end", "def length\r\n return self.stop - self.start + 1\r\n end", "def length\n @length ||= (count.to_f / @per_chunk).ceil\n end", "def length\n pack.length\n end", "def length\n @end - @start\n end", "def length\n text.length\n end", "def size\n return @args[:data].length\n end", "def length()\n obj_len = internal_object_length - 1\n return obj_len\n end", "def length\n raise NotImplementedError, \"Please implement length\"\n end", "def length\n @rep.length\n end", "def length\n @rep.length\n end", "def length\n length = 1 #@primary\n length += @extlang.length if @extlang\n length += 1 if @script\n length += 1 if @region\n length += @variants.length if @variants\n @extensions.each { |_,e| length += e.length+1 } if @extensions # length += @extenstions.to_a.flatten.length if @extensions\n length += @privateuse.length+1 if @privateuse\n length\n end", "def width\n source_node[:width].to_i\n end", "def packet_length\n self[:ip_len]\n end", "def length\n @lines ? @lines.length : 0\n end", "def length\n @lines ? @lines.length : 0\n end", "def length\n @end - @start + 1\n end", "def length()\n #This is a stub, used for indexing\n end", "def content_length\n if raw? && raw.respond_to?(:length)\n raw.length\n else\n read.try(&:length).to_i\n end\n end", "def actual_length\n @transfer[:actual_length]\n end", "def size\n return @buffer.count\n end", "def length\n len = 0\n @locations.each do |x|\n if x.sequence\n len += x.sequence.size\n else\n len += (x.to - x.from + 1)\n end\n end\n len\n end", "def length\n if !block_given?\n return @j_del.java_method(:length, []).call()\n end\n raise ArgumentError, \"Invalid arguments when calling length()\"\n end", "def length\n count = 0\n each { count += 1 }\n count\n end", "def length\r\n self.count\r\n end", "def long_read_len()\n #This is a stub, used for indexing\n end", "def length\n to_s.length\n end", "def length\n event.length\n end", "def length\n value.length\n end", "def length\n return self.stop - self.start + 1\n end", "def length\n return self.stop - self.start + 1\n end", "def target_len; genomic.len; end", "def seq_length \n if self.source_name == \"ENSEMBLGENE\"\n return self.get_gene.slice.length\n elsif self.source_name == \"ENSEMBLPEP\"\n return self.sequence.length\n else\n return nil\n end \n end", "def length\n return nil if self.nil?\n return @theLines.length\n end", "def length\n return @args[\"data\"].length\n end", "def len()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.Run_len(@handle.ptr)\n result\n end", "def length\n distance(0, 0, 0)\n end", "def length\n raise CannotCallBeforeEnd, \"Cant call length before the end has been reached.\" unless @end\n return @length_cache\n end", "def length\n count = 0 \n return count if @head.nil?\n return length_helper(count, @head)\n end", "def length\n @string.length\n end", "def size\n self.data.length + 4\n end", "def length\n\t\treturn 0 if (!@fp)\n\t\tres=0\n\t\twhile (!@fp.eof)\n\t\t\tMarshal.load(@fp)\n\t\t\tres +=1\n\t\tend\n\t\treturn res\n\tend", "def height\n @source.height\n end", "def arity\n @source.scan('*').count + 1\n end", "def length\n reduce(0) {|sum,_| sum + 1 }\n end", "def length()\n #This is a stub, used for indexing\n end", "def length\n length = 0; each {length += 1}; length\n end" ]
[ "0.7498725", "0.72287357", "0.72287357", "0.72287357", "0.72287357", "0.7199743", "0.71793574", "0.71793574", "0.7176055", "0.71589386", "0.71589386", "0.71589386", "0.71589386", "0.71589386", "0.71589386", "0.71589386", "0.71346253", "0.7075841", "0.7055878", "0.7055878", "0.7055878", "0.7040494", "0.7040494", "0.7040494", "0.70317024", "0.7019551", "0.70173705", "0.6966135", "0.6937821", "0.6935593", "0.69309837", "0.691597", "0.68769705", "0.68666637", "0.68622047", "0.6856974", "0.68535763", "0.6833756", "0.6833756", "0.6824552", "0.6824552", "0.6824552", "0.6824552", "0.6824552", "0.6814585", "0.6813547", "0.67911303", "0.6785708", "0.67781454", "0.6729133", "0.6725504", "0.6718808", "0.6704573", "0.6701372", "0.66993046", "0.66991436", "0.6693252", "0.66914916", "0.6681434", "0.66811806", "0.66793543", "0.6671373", "0.6666039", "0.6666039", "0.6660256", "0.6655234", "0.6653725", "0.6652708", "0.6652708", "0.6651568", "0.66458935", "0.66366786", "0.663506", "0.66319275", "0.6630585", "0.66277456", "0.6617868", "0.661684", "0.66132057", "0.66067135", "0.6601089", "0.65938056", "0.6591243", "0.6591243", "0.6578073", "0.6571705", "0.65682304", "0.656309", "0.65578157", "0.6549259", "0.6541384", "0.65411186", "0.6534148", "0.65252995", "0.6515481", "0.6513326", "0.65029854", "0.6488485", "0.6484123", "0.6471793" ]
0.6706688
52
Public: Returns String byte digest of source.
def digest metadata[:digest] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checksum\n source[digest_type]\n end", "def sha\n Digest::SHA2.new.update(self.source).to_s\n end", "def asset_digest(source)\n asset_paths.digest_for(source)\n end", "def digest\n ''\n end", "def digest\n ''\n end", "def to_str\n digest.to_str\n end", "def hexdigest\n # Read bytes in chunks of the optimal digest size.\n while (chunk = @io.read(@digest.block_length))\n @digest.update(chunk)\n end\n @digest.hexdigest\n end", "def to_s\n digest.to_s\n end", "def hexdigest\n @digest.unpack('H*'.freeze).first\n end", "def digest\n digest = ''\n @entries.each { |entry| digest << entry.digest << ' ' }\n digest\n end", "def hexdigest\n DigestUtils.pack_hexdigest(digest)\n end", "def digest\n decode[:digest]\n end", "def computed_sha(string)\n provider.computed_sha(string)\n end", "def to_s\n @str ||= Base64.encode64(get_digest).gsub(/\\s/, '')\n end", "def digest(string)\n @digest_class.new(string).digest\n end", "def digest\n Digest::SHA1.hexdigest(@pub.to_der)\n end", "def digest\n OpenSSL::Digest::SHA256.file(path).hexdigest\n end", "def digest( str )\n Digest::SHA1.hexdigest( str )\n end", "def checksum\n digest = @digest_klass.new\n buf = ''\n\n File.open(@path, \"rb\") do |f|\n while !f.eof\n begin\n f.readpartial(BUFFER_SIZE, buf)\n digest.update(buf)\n rescue EOFError\n # Although we check for EOF earlier, this seems to happen\n # sometimes anyways [GH-2716].\n break\n end\n end\n end\n\n digest.hexdigest\n end", "def digest\n Digest::MD5.file(file).hexdigest\n end", "def digest\n Digest::SHA1.hexdigest(self)\n end", "def digest_type\n DIGESTS.each do |digest|\n return digest if source.key? digest\n end\n raise ChecksumMissing.new(self)\n end", "def digest\n @digest ||= DEFAULT_DIGEST_PROC\n end", "def digest_key(digest)\n \"asset-uri-digest:#{compressed_path}:#{digest}\"\n end", "def digest(data); end", "def digest\n assert_file!\n Digest::SHA256.hexdigest(@name + Digest::SHA256.file(@path).to_s)\n end", "def hexdigest(string)\n @digest_class.new(string).hexdigest\n end", "def digest\n Digest::SHA2.new\n end", "def digest_str(password)\n raise ArgumentError, \"password must be a String\" unless password.is_a?(String)\n\n result = Util.zeros(STRBYTES)\n\n ok = self.class.pwhash_str(\n result,\n password, password.bytesize,\n @opslimit, @memlimit\n )\n raise CryptoError, \"unknown error in Argon2#digest_str\" unless ok\n\n result.delete(\"\\x00\")\n end", "def digest\n Digest::MD5.digest(blob)\n end", "def sha1\n Digest::SHA1.hexdigest(subject.identification + 0.chr + source)\n end", "def calc_digest input\n Digest::SHA1.hexdigest(input.to_s).\n\n # XXX: surround all digits with alphabets so\n # Maruku doesn't change them into HTML\n gsub(/\\d/, 'z\\&z')\n end", "def digest\n digest = ''\n @elements.each { |element| digest << element.digest << ' '}\n digest\n end", "def digest(string, algorithm)\n Base64.encode64 digester(algorithm).digest(string)\n end", "def digest\n image.ident\n end", "def base64digest\n DigestUtils.pack_base64digest(digest)\n end", "def hexdigest\n self.class.hexdigest_for(path)\n end", "def calculate_checksum\n last_checksum = previous_event&.checksum\n attrs = attributes.except(\"checksum\", \"id\", \"updated_at\").merge(last_checksum: last_checksum)\n cs = Digest::SHA256.hexdigest(attrs.to_s)\n puts \"#{id} calculate_checksum: #{cs} <- #{attrs} \" if Rails.env.development?\n Rails.logger.info(\"#{id} calculate_checksum: #{cs} <- #{attrs} \")\n return cs\n end", "def version_for_cache\n \"download_url:#{source[:url]}|#{digest_type}:#{checksum}\"\n end", "def digest\n @digest ||= Digest::SHA1.new.update(version.to_s)\n @digest.dup\n end", "def calc_digest(password)\n return nil unless password\n algorithm.encode(password)\n end", "def generate_checksum_bytes(payload)\n sum = payload.reduce :+\n sum_hex = ('%04x' % sum).upcase\n\n string_to_ascii_bytes sum_hex\n end", "def hexdigest(value)\n Aws::Checksums.sha256_hexdigest(value)\n end", "def checksum\n Digest::SHA256.file(sample_dmg).hexdigest\nend", "def digest(obj)\n build_digest(obj).digest\n end", "def id(source_file)\n Digest::SHA1.hexdigest(filename(source_file))\n end", "def digest(subject)\n Digest::MD5.hexdigest subject.downcase\n end", "def summary\n [hexdigest, @buffer.size]\n end", "def c_hash\n sha256 = Digest::SHA256.new\n token = @code.token.token\n hashed_token = sha256.digest(token)\n first_half = hashed_token[0...hashed_token.length / 2]\n Base64.urlsafe_encode64(first_half).tr('=', '')\n end", "def id(source_file)\n Digest::SHA1.hexdigest(source_file.filename)\n end", "def checksum(hex)\n hash = hash256(hex) # Hash the data through SHA256 twice\n return hash[0...8] # Return the first 4 bytes (8 characters)\n end", "def digest_filename(filename)\n digest = Digest::SHA256.digest(filename.to_s)\n Base64.urlsafe_encode64(digest, padding: false)\n end", "def checksum\n Digest::SHA256.hexdigest(self.to_smash(:sorted).to_s)\n end", "def digest_name(name)\n Digest::SHA2.hexdigest(short_name(name))[0..24]\n end", "def checksum\n fil_header[:checksum]\n end", "def hexdigest\n @authenticator.unpack(\"H*\").last\n end", "def file_digest_key(stat)\n \"file_digest:#{compressed_path}:#{stat}\"\n end", "def dave(new_str)\r\n new_hash = Digest::SHA256.hexdigest new_str\r\n return new_hash\r\nend", "def digest_class\n Digest::SHA256\n end", "def digest_class\n Digest::SHA256\n end", "def hash\n bytes.hash\n end", "def digest_file( x)\n path = requested_file( x[:request] )\n if File.exist?(path) && !File.directory?(path)\n Digest::MD5.hexdigest(File.read(path))\n else\n nil\n end\n end", "def hexdigest!()\n #This is a stub, used for indexing\n end", "def checksum(hex)\n hash = hash256(hex) # Hash the data through SHA256 twice\n return hash[0...8] # Return the first 4 bytes (8 characters)\nend", "def digest(string)\n User.digest(string, self.password_salt)\n end", "def to_param\n digest\n end", "def digest_byte_code(byte_code)\n abc = ARuby::SWF::ABC.new\n abc.unserialize(ByteBuffer.new(byte_code))\n end", "def generate_digest(message)\n MD4_MAC.new(@key, message).digest\n end", "def extract_digest_from_manifest(manifest)\n # https://docs.docker.com/registry/spec/api/#manifest\n return manifest.headers[:docker_content_digest]\n end", "def digest\n @digest ||= Digest::MD5.hexdigest(self.attributes[self.class.config[:digest]])[0, 8]\n end", "def _hash_digest(key)\n m = Digest::MD5.new\n m.update(key)\n\n # No need to ord each item since ordinary array access\n # of a string in Ruby converts to ordinal value\n return m.digest\n end", "def file_remote_digestsha2(file_name)\n data = read_file(file_name)\n chksum = nil\n if data\n chksum = Digest::SHA256.hexdigest(data)\n end\n return chksum\n end", "def compute_hash( path )\n res = '0'\n autorelease_pool { res = NSData.sha1FromContentsOfFile(path) }\n res\n end", "def digest(string, options = {})\n salt = options[:salt] || SecureRandom.base64\n Digest::SHA1.hexdigest(\"#{salt}--#{string}\")\n end", "def to_str\n bytes\n end", "def to_str\n bytes\n end", "def to_str\n bytes\n end", "def dmg_package_checksum\n case new_resource.source\n when :direct\n package_metadata[:sha256]\n else\n new_resource.checksum\n end\n end", "def checksum(file, digest=nil)\n return nil unless digest\n if FileTest.directory?(file)\n @null_string ||= digester(digest).hexdigest(\"\") # TODO use other means\n else\n digester(digest).hexdigest(File.read(file))\n end\n end", "def digest_hash_function\n decode[:hash_function]\n end", "def to_bytes; @seed; end", "def toString()\n @header[LENGTH - 1] = checksum()\n return @header + @message\n end", "def password_digest(password)\n Authentication::Encryptor.digest(password)\n end", "def calc_checksum\n c0 = c1 = 0\n to_s[2..].unpack('C*').each do |byte|\n c0 += byte\n c1 += c0\n end\n c0 %= 255\n c1 %= 255\n\n x = ((sz - 17) * c0 - c1) % 255\n x += 255 if x <= 0\n y = 255 * 2 - c0 - x\n y -= 255 if y > 255\n self.checksum = (x << 8) | y\n end", "def destination_shasum\n @destination_shasum ||= digest_directory(source_path, :sha256, source_options)\n end", "def cert_digest\n Digest::SHA1.hexdigest(@cert.to_der)\n end", "def result\n @_result ||= Digest::MD5.hexdigest(param_string)\n end", "def digest_length\n check_valid\n md.md_size\n end", "def file_sha256\n Digest::SHA256.file(self).hexdigest\n end", "def hex(string)\n Digest::SHA1.hexdigest(string)\n end", "def create_digest(string, bit_size)\n Digest::SHA1.hexdigest(string).hex.to_s(2).rjust(40*4, '0')[0..bit_size-1].to_i(2)\nend", "def checksum(hex)\n sha256(sha256(hex))[0...8]\n end", "def hex_sha1(s)\n return binb2hex(core_sha1(str2binb(s), s.length * $chrsz))\n end", "def digest\n cost = ActiveModel::SecurePassword.min_cost ? BCrypt::Engine::MIN_COST : BCrypt::Engine.cost\n BCrypt::Password.create(SecureRandom.urlsafe_base64, cost: cost)\n end", "def token_digest( token )\n Crypto.secure_digest( token )\n end", "def checksum_of(origin)\n #noinspection RubyArgCount\n Zlib::crc32(origin).to_s\n end", "def to_hexstr\n Common.unpackbytes(to_s)\n end", "def full_digest_path\n File.join(@load_path, digest_path)\n end", "def hexdigest(value)\n Digest::SHA256.new.update(value).hexdigest\n end", "def block_hash\n\t\tdigest = Digest::SHA2.new\n\n\t\tdigest << '%d' % [ self.index ]\n\t\tdigest << self.timestamp.strftime( '%s%N' )\n\t\tdigest << self.payload\n\t\tdigest << self.payload_hash\n\t\tdigest << self.proof.to_s\n\t\tdigest << self.previous_hash\n\t\t\n\t\treturn digest.hexdigest\n\tend" ]
[ "0.7242832", "0.7078252", "0.70708394", "0.6899616", "0.6899616", "0.67935205", "0.66735333", "0.65877694", "0.6564932", "0.6516899", "0.6494263", "0.63890237", "0.6375513", "0.6354917", "0.6331262", "0.626284", "0.6195013", "0.6186284", "0.61346096", "0.6107745", "0.60934585", "0.6089567", "0.60872406", "0.6021886", "0.600397", "0.6003144", "0.6002114", "0.5989701", "0.5988604", "0.59190714", "0.5892298", "0.58808035", "0.5855892", "0.58417755", "0.5840613", "0.5813167", "0.5812536", "0.57605565", "0.57418805", "0.5739618", "0.5729038", "0.5722854", "0.5707264", "0.56439596", "0.56420106", "0.5636451", "0.563455", "0.56304944", "0.561636", "0.5614577", "0.55974084", "0.5577849", "0.554862", "0.55483395", "0.5544966", "0.5526352", "0.55243343", "0.5495205", "0.5477989", "0.5477989", "0.5475995", "0.5455209", "0.54379433", "0.5432953", "0.5428301", "0.5427633", "0.5421295", "0.54194796", "0.5408813", "0.5401457", "0.5390728", "0.5378353", "0.5363533", "0.5358717", "0.53515285", "0.53515285", "0.53515285", "0.5349199", "0.5348872", "0.5342967", "0.53310496", "0.5326452", "0.5325421", "0.53220284", "0.5320338", "0.5314127", "0.53106326", "0.5300276", "0.5298456", "0.5289467", "0.5282904", "0.52827185", "0.52778554", "0.5276174", "0.52687067", "0.52637655", "0.5262671", "0.5257278", "0.5256721", "0.52561927" ]
0.6059115
23
Private: Return the version of the environment where the asset was generated.
def environment_version metadata[:environment_version] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_version\n\t\tself.dev_stage.blank? ? dev_stage_string = \"\" : dev_stage_string = self.dev_stage + \" \"\n\t\treturn dev_stage_string + self.maj_version.to_s + \".\" + self.min_version.to_s\n\tend", "def current_version\n @version\n end", "def version\n @context[:version]\n end", "def version; env['api.version'] end", "def version\n @version ||= create_version\n end", "def app_version\n return @app_version\n end", "def app_version\n return @app_version\n end", "def application_version\n read('application_version')\n end", "def get_version\n\t\tend", "def version\n unless @version\n\n # Extract version information (if available)\n @version = metadata['bundleShortVersionString'] || metadata['bundleVersion'] rescue nil\n\n # Otherwise, use the filename\n unless @version\n @version = filename[FILENAME_VERSION_REGEX, 1]\n end\n\n end\n\n @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def application_version\n return @application_version\n end", "def application_version\n return @application_version\n end", "def _version\n special_attribute('@version'.freeze)\n end", "def current_deployed_version\n 5\n end", "def engine_version\n stats.version\n end", "def get_version_info\n version_file = Rails.root.join('lib', 'version.json')\n\n File.exist?(version_file) ? read_version_file(version_file) : development_version_info\nend", "def latest_production\n Origen::VersionString.new(origen[:latest_version_prod])\n end", "def current_version\n version_number rev\n end", "def get_version()\n\t\tend", "def version\n return @version if defined?(@version)\n \n @version = JSON.parse(File.read('package.json'))['version']\nend", "def version\n @attributes[:version]\n end", "def version\n @attributes[:version]\n end", "def assets_environment\n Helpers.environment || environment\n end", "def version\n @version\n end", "def original_application_version\n read('original_application_version')\n end", "def full\n @version\n end", "def version\n @version ||= data.version\n end", "def engine_version\n data[:engine_version]\n end", "def engine_version\n data[:engine_version]\n end", "def current_bundle_version\n case lane_context[:PLATFORM_NAME]\n when :android\n get_gradle_version_name(gradle_path: lane_context[:GRADLE_FILE])\n when :ios\n get_info_plist_value(path: 'ios/AllAboutOlaf/Info.plist',\n key: 'CFBundleShortVersionString')\n else\n get_package_key(key: :version)\n end\nend", "def version(app, env)\n response = env == \"staging\" ? \"#{app}-#{env}\" : \"#{app}\"\n #if env == \"staging\"\n #response = \"#{app}-#{env}\"\n #else\n #response = \"#{app}\"\n #end\n \":satellite: [CAP #{app.upcase}] version: https://#{response}.medivo.com/version.html\" unless response.empty?\n end", "def version\n attributes.fetch(:version)\n end", "def version\n attributes.fetch(:version)\n end", "def version\n attributes.fetch(:version)\n end", "def version\n attributes.fetch(:version)\n end", "def version\n attributes.fetch(:version)\n end", "def engine_version\n endpoint.engine_version\n end", "def engine_version\n\t\tAgent.engine_version_for_agent string\n\tend", "def version_file\n version_rb_file = File.dirname(Buildr.application.buildfile.to_s) + '/version.rb'\n return version_rb_file if File.exists?(version_rb_file)\n return Buildr.application.buildfile.to_s\n end", "def version\n path = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__\n dir = File.dirname(path)\n if File.exist?(dir+'/version.stamp')\n version = File.read(dir+'/version.stamp')\n else\n version = \"Unknown version\"\n end\n version\n end", "def version\n build_string\n end", "def version\n @version ||= __determine_version\n end", "def version\n @version_helper.to_s\n end", "def version\n @version_helper.to_s\n end", "def appcache_version_string\n RailsAppcache.config.version\n end", "def version\n return last_version if versionable?\n version_number\n end", "def version\n VERSION\n end", "def latest_development\n Origen::VersionString.new(origen[:latest_version_dev])\n end", "def current_version\n versions.first\n end", "def environment\n @environment\n end", "def version\n read_property 'Version'\n end", "def getVersion\r\n\t\t\t\t\treturn @version\r\n\t\t\t\tend", "def version\n @gemspec.version || @version_helper.to_s\n end", "def version\n VERSION\n end", "def version\n Gem.loaded_specs['image_optim'].version.to_s\n rescue\n 'DEV'\n end", "def version\n version_file = File.join(RAILS_ROOT, \"config\", \"version.ini\")\n current_version = if File.exists? version_file\n File.read(version_file)\n else\n \"0.0.1\"\n end\n current_version.strip\n end", "def koi_version\n version_file_path = self.rails_template[/.*(?=templates)/]\n version_file_path += 'koi/version.rb'\n version_data = open(version_file_path) {|f| f.read }\n\n version = version_data.split(\"\\n\")[1].split('=').last.strip.gsub(/\\\"/, '')\nend", "def system_version\n @system_version ||= File.read(Rails.root.join(\"VERSION\")).strip\n end", "def version\n @version ||= File.read(path('version.txt')).strip\n end", "def current_environment\n read_environment_from_cache\n end", "def version\n @version ||= File.read(path('version.txt')).strip\n end", "def version\n @version ||= config(\"version\", \"0.0.1\")\n end", "def version\n self[:version]\n end", "def current_version\n v = nil\n v = (self.class.name.split(\"::\").first(2).join(\"::\") + '::VERSION').constantize unless defined?((self.class.name.split(\"::\").first(2).join(\"::\") + '::VERSION').constantize.to_s).nil?\n env['tracking'].current_version = v\n return v\n end", "def environment\n Mash.new.tap do |environment|\n environment.update(new_resource.parent_ruby.ruby_environment) if new_resource.parent_ruby\n environment['BUNDLE_GEMFILE'] = new_resource.parent_bundle.gemfile_path if new_resource.parent_bundle\n environment.update(new_resource.environment) if new_resource.environment\n end\n end", "def version\n @version.dup\n end", "def version\n @version.dup\n end", "def version\n resolved_version\n end", "def gem_version; end", "def gem_version; end", "def gem_version; end", "def gem_version; end", "def gem_version; end", "def gem_version; end", "def get_version\n request('getVersion')\n end", "def version\n app = detect_product(GSA) || detect_product(GOOGLEPODCASTS)\n app.version\n end", "def ver\n @values.fetch('ai.application.ver') { \n @values['ai.application.ver'] = nil\n }\n end", "def version\n fetch('vehicle.version')\n end", "def environment\n @_environment\n end", "def environment\n @environment || DEFAULT_ENVIRONMENT\n end", "def version\n\t\treturn @version ||= self.find_version\n\tend", "def version_number\n @version\n end", "def versioned_asset\r\n s=self.sop\r\n s=s.parent if s.class.name.end_with?(\"::Version\")\r\n if version.nil?\r\n s.latest_version\r\n else\r\n s.find_version(sop_version)\r\n end\r\n end", "def version_number\n return @version_number\n end", "def version\n @__version\n end", "def version\n endpoint.config.version\n end", "def version\n VERSION\n end", "def version\n VERSION\n end", "def version\n VERSION\n end", "def version\n data.version\n end", "def asset_environment\n Rails.application.assets\n end" ]
[ "0.69615805", "0.68095315", "0.67515105", "0.6736874", "0.6731159", "0.66549534", "0.66549534", "0.664992", "0.66052073", "0.65853703", "0.6568541", "0.6568541", "0.6568541", "0.6568541", "0.6568541", "0.6568541", "0.6568541", "0.6568541", "0.6568541", "0.6560332", "0.6560332", "0.65403974", "0.6524878", "0.65036345", "0.6501644", "0.6494608", "0.64704543", "0.64589196", "0.6435094", "0.6432794", "0.6432794", "0.6430493", "0.64288783", "0.64189476", "0.6406427", "0.64044774", "0.6389338", "0.6389338", "0.63854444", "0.63836867", "0.6366069", "0.6366069", "0.6366069", "0.6366069", "0.6366069", "0.6363903", "0.6363216", "0.63606536", "0.63523924", "0.63469076", "0.6342293", "0.6339059", "0.6339059", "0.6328881", "0.63260216", "0.6317735", "0.63110787", "0.63042086", "0.62967217", "0.6289219", "0.6285104", "0.6280804", "0.6278609", "0.62721753", "0.62707484", "0.62685806", "0.62670094", "0.62623316", "0.6261518", "0.6259795", "0.62589073", "0.62552655", "0.6254066", "0.6243272", "0.62428844", "0.62428844", "0.6238331", "0.6227136", "0.6227136", "0.6227136", "0.6227136", "0.6227136", "0.6227136", "0.6226032", "0.6223736", "0.62236995", "0.6212631", "0.62068343", "0.6196226", "0.61962247", "0.61913127", "0.6188245", "0.61849564", "0.6183999", "0.6177418", "0.6176994", "0.6176994", "0.6176994", "0.6175986", "0.61757255" ]
0.8182466
0
Public: Returns String hexdigest of source.
def hexdigest DigestUtils.pack_hexdigest(digest) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hexdigest\n @digest.unpack('H*'.freeze).first\n end", "def sha\n Digest::SHA2.new.update(self.source).to_s\n end", "def hexdigest\n # Read bytes in chunks of the optimal digest size.\n while (chunk = @io.read(@digest.block_length))\n @digest.update(chunk)\n end\n @digest.hexdigest\n end", "def hexdigest!()\n #This is a stub, used for indexing\n end", "def to_hexstr\n Common.unpackbytes(to_s)\n end", "def hexdigest(string)\n @digest_class.new(string).hexdigest\n end", "def to_s\n to_hex\n end", "def hexdigest(obj)\n build_digest(obj).hexdigest!\n end", "def hex(string)\n Digest::SHA1.hexdigest(string)\n end", "def hexdigest\n self.class.hexdigest_for(path)\n end", "def hexdigest(value)\n Digest::SHA256.new.update(value).hexdigest\n end", "def to_str\n digest.to_str\n end", "def checksum\n source[digest_type]\n end", "def hexhash\n hash.to_s(16)\n end", "def to_hexified_s\n to_binary_s.scan(/../).join(\" \")\n end", "def digest\n ''\n end", "def digest\n ''\n end", "def hexdigest(value)\n Aws::Checksums.sha256_hexdigest(value)\n end", "def hex_str\n \"##{hex_val}\"\n end", "def hexdigest(*several_variants)\n #This is a stub, used for indexing\n end", "def as_hex\n raise NotImplementedError\n end", "def to_s\n digest.to_s\n end", "def hex() end", "def sha1\n Digest::SHA1.hexdigest(subject.identification + 0.chr + source)\n end", "def to_hex\n @value.unpack(\"H*\").join\n end", "def md5_hash_hex(x)\n h = Digest::MD5.new\n h << x\n return h.to_s # to_s method gives the result in hex\nend", "def to_hex_s\n strings = to_bytes.map do |byte|\n string = byte.to_s(16)\n string = \"0#{string}\" if string.length == 1\n string\n end\n strings.join.upcase\n end", "def to_hex\n Executor.execute(command)\n\n Hex.new(:source => target)\n end", "def hexdigest\n @authenticator.unpack(\"H*\").last\n end", "def asset_digest(source)\n asset_paths.digest_for(source)\n end", "def hex_sha1(s)\n return binb2hex(core_sha1(str2binb(s), s.length * $chrsz))\n end", "def digest\n digest = ''\n @entries.each { |entry| digest << entry.digest << ' ' }\n digest\n end", "def hex2str(hex)\n [hex].pack('H*')\n end", "def hex_digest(data)\n OpenSSL::Digest::SHA512.hexdigest(data)\n end", "def to_s\n \"#{@hex_color}\"\n end", "def to_s\n @str ||= Base64.encode64(get_digest).gsub(/\\s/, '')\n end", "def to_hex\n Dash.to_hex(self)\n end", "def to_hex\n\t\t\tRGB.new(to_rgb).to_hex\n\t\tend", "def get_hex(x)\n val = x.to_i.to_s(16)\n val = \"0#{val}\" if val.length < 2\n val\n end", "def hex_sha1(s)\n binb2hex(core_sha1(str2binb(s), s.length * $chrsz))\n end", "def computed_sha(string)\n provider.computed_sha(string)\n end", "def to_hex\n\t\tr = sprintf(\"%02X\", self.red)\n\t\tg = sprintf(\"%02X\", self.green)\n\t\tb = sprintf(\"%02X\", self.blue)\n\t\treturn (\"#\" + r + g + b).upcase\n\tend", "def to_hex_string(readable = true)\n unpacked = self.unpack('H*').first\n if readable\n unpacked.gsub(/(..)/,'\\1 ').rstrip\n else\n unpacked\n end\n\tend", "def hex_to_string(hex)\n \ttemp = hex.gsub(\"\\s\", \"\");\n ret = []\n (0...temp.size()/2).each{|index| ret[index] = [temp[index*2, 2]].pack(\"H2\")}\n file = String.new\n ret.each { |x| file << x}\n file \n end", "def to_hex_s\n TypeConversion.numeric_byte_array_to_hex_string(to_a)\n end", "def digest\n Digest::SHA1.hexdigest(self)\n end", "def to_hex_string(grouping = false)\n ret = self.unpack('H*').first\n if grouping\n if grouping.is_a?(::Integer) && grouping > 0\n ret.gsub(/(#{'.' * grouping})/,'\\1 ').rstrip\n else\n ret.gsub(/(..)/,'\\1 ').rstrip\n end\n else\n ret\n end\n end", "def id(source_file)\n Digest::SHA1.hexdigest(source_file.filename)\n end", "def sha1_hex\n Digest::SHA1.hexdigest(salted_name)\n end", "def to_hex\n\t\t\tRGB.new(self.to_rgb).to_hex\n\t\tend", "def unpack_hexdigest(hex)\n [hex].pack('H*')\n end", "def unpack_hexdigest(hex)\n [hex].pack('H*')\n end", "def id(source_file)\n Digest::SHA1.hexdigest(filename(source_file))\n end", "def checksum(hex)\n sha256(sha256(hex))[0...8]\n end", "def checksum(hex)\n hash = hash256(hex) # Hash the data through SHA256 twice\n return hash[0...8] # Return the first 4 bytes (8 characters)\n end", "def digest( str )\n Digest::SHA1.hexdigest( str )\n end", "def to_s\n \"#{user}:#{digest}\"\n end", "def toString()\n @header[LENGTH - 1] = checksum()\n return @header + @message\n end", "def hex(placeholder = nil)\n generate(placeholder, HEX_CHARACTERS)\n end", "def calc_digest input\n Digest::SHA1.hexdigest(input.to_s).\n\n # XXX: surround all digits with alphabets so\n # Maruku doesn't change them into HTML\n gsub(/\\d/, 'z\\&z')\n end", "def from_hex(str)\n str.to_s.hex\nend", "def to_hex(s); s && s.unpack('H*').first; end", "def checksum(hex)\n hash = hash256(hex) # Hash the data through SHA256 twice\n return hash[0...8] # Return the first 4 bytes (8 characters)\nend", "def calculate_checksum\n last_checksum = previous_event&.checksum\n attrs = attributes.except(\"checksum\", \"id\", \"updated_at\").merge(last_checksum: last_checksum)\n cs = Digest::SHA256.hexdigest(attrs.to_s)\n puts \"#{id} calculate_checksum: #{cs} <- #{attrs} \" if Rails.env.development?\n Rails.logger.info(\"#{id} calculate_checksum: #{cs} <- #{attrs} \")\n return cs\n end", "def hex\n @hex = DatatypeConverter.printHexBinary(build.unsafeBitcoinSerialize());\n end", "def pack_hexdigest(bin)\n bin.unpack('H*'.freeze).first\n end", "def pack_hexdigest(bin)\n bin.unpack('H*'.freeze).first\n end", "def hex\n to_i.to_s(16)\n end", "def hex\n @hex ||= to_i.to_s(16)\n end", "def tns_hexify\n self.each_byte.map do |byte|\n (HEXCHARS[(byte >> 4)] + HEXCHARS[(byte & 0xf )])\n end.join()\n end", "def digest_str(password)\n raise ArgumentError, \"password must be a String\" unless password.is_a?(String)\n\n result = Util.zeros(STRBYTES)\n\n ok = self.class.pwhash_str(\n result,\n password, password.bytesize,\n @opslimit, @memlimit\n )\n raise CryptoError, \"unknown error in Argon2#digest_str\" unless ok\n\n result.delete(\"\\x00\")\n end", "def str_to_hex(s)\n s.bytes.map{ |b| \"%02x\" % b }.join\nend", "def in_hex\n Bases.val(self).in_hex\n end", "def dave(new_str)\r\n new_hash = Digest::SHA256.hexdigest new_str\r\n return new_hash\r\nend", "def rmd160(hex)\n\t\tDigest::RMD160.hexdigest([hex].pack(\"H*\"))\n\tend", "def checksum(hex)\n sha256(sha256(hex))[0...8]\nend", "def digest\n Digest::SHA1.hexdigest(@pub.to_der)\n end", "def hexdigest_integrity_uri(hexdigest)\n integrity_uri(unpack_hexdigest(hexdigest))\n end", "def hexdigest_integrity_uri(hexdigest)\n integrity_uri(unpack_hexdigest(hexdigest))\n end", "def to_hex\n BTC.to_hex(self.data)\n end", "def to_hex8\n \"##{to_basic_hex8}\"\n end", "def bin_to_hex(s)\r\n s.each_byte.map { |b| b.to_s(16) }.join\r\n #puts s.bin_to_hex\r\nend", "def strhex(str)\n hex_chars = \"0123456789ABCDEF\"\n msg_size = str.size\n\n result = \"\"\n str.each_byte do |num|\n i1 = num >> 4\n i2 = num & 15\n result << hex_chars[i1]\n result << hex_chars[i2]\n end\n result\n end", "def bin_to_hex(s)\n s.each_byte.map { |b| b.to_s(16).rjust(2, '0') }.join\n end", "def hsl_to_hex(a_hsl_color); end", "def digest\n Digest::MD5.file(file).hexdigest\n end", "def random_hex(len=16)\n raise NotImplementedError\n SecureRandom.hex(len)\nend", "def digest\n Digest::SHA2.new\n end", "def c_hash\n sha256 = Digest::SHA256.new\n token = @code.token.token\n hashed_token = sha256.digest(token)\n first_half = hashed_token[0...hashed_token.length / 2]\n Base64.urlsafe_encode64(first_half).tr('=', '')\n end", "def sha_hash (arg)\r\n Digest::SHA2.hexdigest(arg)\r\n end", "def digest\n assert_file!\n Digest::SHA256.hexdigest(@name + Digest::SHA256.file(@path).to_s)\n end", "def hash(tx)\n Digest::SHA256.hexdigest(Digest::SHA256.hexdigest(tx))\nend", "def bin_to_hex(s)\n return s.unpack('H*').first\n end", "def get_hash(input)\n return $hasher.reset.update(input).to_s\nend", "def version_guid\n \"#{digest_type}:#{checksum}\"\n end", "def to_hex(string, opts = {})\n [ string ].pack('H*')\n end", "def digest_name(name)\n Digest::SHA2.hexdigest(short_name(name))[0..24]\n end", "def bytes_to_hex(bytes)\n bytes.map { |x| \"%02X\" % x }.join\n end", "def hex_val\n @hex_val\n end", "def strhex(str)\n hex_chars = \"0123456789ABCDEF\"\n msg_size = str.size\n\n result = \"\"\n str.each_byte do |num|\n i1 = num >> 4\n i2 = num & 15\n result << hex_chars[i1]\n result << hex_chars[i2]\n end\n result\n end" ]
[ "0.7024892", "0.69064796", "0.679805", "0.67686576", "0.67412823", "0.66941434", "0.6669235", "0.6544983", "0.6532558", "0.64899343", "0.6483101", "0.64821243", "0.6461859", "0.64482766", "0.6448199", "0.64390695", "0.64390695", "0.64012575", "0.633038", "0.62840676", "0.627383", "0.6241455", "0.62262356", "0.62029654", "0.6118343", "0.6114293", "0.6093222", "0.6085931", "0.6050486", "0.6019765", "0.60108745", "0.6007466", "0.59990525", "0.597319", "0.596037", "0.59600645", "0.5957799", "0.594954", "0.5937907", "0.59258574", "0.59154356", "0.59025085", "0.5884234", "0.58771217", "0.58764344", "0.58700097", "0.58691955", "0.5850559", "0.5835459", "0.5823664", "0.5821588", "0.5821588", "0.58048713", "0.5745961", "0.5738471", "0.57345265", "0.5677945", "0.564213", "0.5638912", "0.5618614", "0.5594883", "0.55705154", "0.55662644", "0.5559844", "0.5550681", "0.5540404", "0.5540404", "0.55373544", "0.5514218", "0.54897994", "0.54789877", "0.547162", "0.5460742", "0.54495233", "0.54483443", "0.5445608", "0.54106134", "0.5408613", "0.5408613", "0.54041725", "0.5395172", "0.5382021", "0.5379547", "0.53718644", "0.537142", "0.5369323", "0.5366911", "0.5362584", "0.53586894", "0.53567004", "0.5354244", "0.5349782", "0.533908", "0.5335132", "0.53319854", "0.5331741", "0.5324649", "0.53244066", "0.5322913", "0.53186494" ]
0.75798994
0
Pubic: ETag String of Asset.
def etag version = environment_version if version && version != "" DigestUtils.hexdigest(version + digest) else DigestUtils.pack_hexdigest(digest) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n quote @etag\n end", "def etag\n headers[Merb::Const::ETAG]\n end", "def etag\n headers[Merb::Const::ETAG]\n end", "def etag\n '\"' + Digest::SHA1.hexdigest(@contents) + '\"'\n end", "def etag\n [@updated_at.to_i, @stats[:inode], @stats[:size]].join('-').to_s\n end", "def etag\n stat = ::File.stat(@path)\n '\"' + Digest::SHA1.hexdigest(stat.ino.to_s + stat.size.to_s + stat.mtime.to_s) + '\"'\n end", "def etag\n headers['ETag']\n end", "def etag\n end", "def etag\n end", "def format_etag(etag)\n etag\n end", "def etag\n sprintf('%x-%x-%x', stat.ino, stat.size, stat.mtime.to_i)\n end", "def etag\n @gapi[\"etag\"]\n end", "def etag\n raise NotImplementedError\n end", "def etag\n [ call_search_result, last_fetched, pmr.etag ].flatten\n end", "def etag\n ensure_full_data!\n @gapi[\"etag\"]\n end", "def etag\n raise NotImplemented\n end", "def etag\n raise NotImplemented\n end", "def etag\n rebundle if needs_rebundle?\n @etag ||= Digest::MD5.hexdigest(content)\n end", "def strong_etag?; end", "def name\n asset_id\n end", "def etag\n# sprintf('%x-%x-%x', stat.ino, stat.size, stat.mtime.to_i)\n @bson['_id'].to_s\n end", "def etag(anything)\n data = if anything.respond_to?(:each)\n anything.map{|e| etag(e) }.join(\";\")\n elsif anything.respond_to?(:to_param) && OmnivorousEtag.is_versioned?(anything)\n etag([anything.class.to_s, anything.to_param, OmnivorousEtag.extract_version(anything)])\n elsif anything.is_a?(String) || anything.is_a?(Numeric) || anything.is_a?(Symbol)\n anything.to_s\n else\n Marshal.dump(anything)\n end\n \n if defined?(super)\n super(Base64.encode64(data))\n else\n Base64.encode64(data)\n end\n end", "def cl_asset\n self.asset.filename\n end", "def on_etag(name)\n \"v = #{compile!(name)}; ctx._eval_etag(@output_buffer, v); \"\n end", "def etag_for content\n Digest::MD5.hexdigest(content)\n end", "def filename\n File.basename(object.asset.path)\n end", "def get_asset_name()\n uri = @stock_page.canonical_uri()\n match = uri.to_s.match(/.*\\/(.*)-Aktie/)\n raise RuntimeError, \"Could not extract stock asset name\", caller if match.nil?\n Rails.logger.debug(\"#{self.class}: Stock asset name: #{match[1]}\")\n return match[1]\n end", "def etag_and_return(response)\n content_type 'application/json'\n etag Digest::MD5.hexdigest(response.inspect)\n JSON.dump(response)\n end", "def asset_file_name_formatted\n if self.asset_clone_id.present?\n x = self.asset_clone\n if x.present?\n case self.asset_type\n when TYPE[:section_audio], TYPE[:media_image], TYPE[:media_video], TYPE[:slideshow_image], TYPE[:infographic], TYPE[:infographic_dataset]\n \"#{x.id}__#{x.asset_file_name}\"\n else\n x.asset_file_name\n end\n end\n else\n case self.asset_type\n when TYPE[:section_audio], TYPE[:media_image], TYPE[:media_video], TYPE[:slideshow_image], TYPE[:infographic], TYPE[:infographic_dataset]\n \"#{self.id}__#{self.asset_file_name}\"\n else\n self.asset_file_name\n end\n end\n end", "def etag\n a = calls.map { |call| call.etag }\n a << last_fetched\n a.flatten\n end", "def inspect\n \"#<#{self.class.name}:0x#{object_id} bucket=\\\"#{@bucket}\\\" file=\\\"#{@file_path}\\\">\"\n end", "def asset_digest(source)\n asset_paths.digest_for(source)\n end", "def asset_key\n \"asset-uri:#{compressed_path}\"\n end", "def asset_details(asset)\n details = []\n\n if asset.content_type.present?\n details << ScihistDigicoll::Util.humanized_content_type(asset.content_type)\n end\n if asset.size.present?\n details << ScihistDigicoll::Util.simple_bytes_to_human_string(asset.size)\n end\n\n str = details.join(\" — \")\n\n if asset.original_filename != member_label\n str = safe_join([str, \"<br>\".html_safe, asset.original_filename])\n end\n\n str\n end", "def compute_asset_extname(source, options = T.unsafe(nil)); end", "def generate_strong_etag(validators)\n %(\"#{ActiveSupport::Digest.hexdigest(ActiveSupport::Cache.expand_cache_key([validators]))}\")\n end", "def generate_strong_etag(validators)\n %(\"#{ActiveSupport::Digest.hexdigest(ActiveSupport::Cache.expand_cache_key([validators]))}\")\n end", "def weak_etag?; end", "def vest_asset(chain)\n _chain_info = @@chain_infos[chain]\n\n return _chain_info.vest.symbol\n end", "def digest_key(digest)\n \"asset-uri-digest:#{compressed_path}:#{digest}\"\n end", "def set_asset_metadata\n headers = fog_connection.head_object(CarrierWave::Uploader::Base.fog_directory, upload_data[:path]).headers\n\n self.name = upload_data[:filename]\n self.size = headers['Content-Length']\n self.etag = headers['Etag']\n self.content_type = headers['Content-Type']\n end", "def inspect\n \"#<HG Versioned File: #{to_s}>\"\n end", "def asset_version path\n path = File.expand_path(File.join(public_dir, path))\n md5(path)\n end", "def asset_checksum(asset)\n filename = asset.original_file_location\n match = filename.match(/\\ASHA256E-s\\d*--(\\h{64})\\.[a-zA-Z]+\\Z/)\n match ? match[1] : nil\n end", "def etag(value, opts=OPTS)\n # Before touching this code, please double check RFC 2616 14.24 and 14.26.\n weak = opts[:weak]\n new_resource = opts.fetch(:new_resource){post?}\n\n res = response\n e = env\n res[RodaResponseHeaders::ETAG] = etag = \"#{'W/' if weak}\\\"#{value}\\\"\"\n status = res.status\n\n if (!status || (status >= 200 && status < 300) || status == 304)\n if etag_matches?(e['HTTP_IF_NONE_MATCH'], etag, new_resource)\n res.status = (request_method =~ /\\AGET|HEAD|OPTIONS|TRACE\\z/i ? 304 : 412)\n halt\n end\n\n if ifm = e['HTTP_IF_MATCH']\n unless etag_matches?(ifm, etag, new_resource)\n res.status = 412\n halt\n end\n end\n end\n end", "def local_artifact_name\n @resource[:path]\n end", "def latest_sha_from_ecs_metadata\n return nil if ECS_CONTAINER_METADATA_FILE.nil?\n return nil unless !ECS_CONTAINER_METADATA_FILE.strip.empty? && File.readable?(ECS_CONTAINER_METADATA_FILE)\n\n begin\n JSON.parse(File.read(ECS_CONTAINER_METADATA_FILE))[\"ImageName\"].split(\".\").last\n rescue JSON::ParserError\n nil\n end\n end", "def set_etag (t, weak=false)\n\n t = '\"%s\"' % t\n t = weak ? \"W/#{t}\" : t\n\n @response.header['ETag'] = t\n\n etags = @request.etags\n\n if etags.include?(t) or etags.include?('*')\n throw(:done, 304) if @request.get? or @request.head?\n throw(:done, 412) # precondition failed\n end\n end", "def etag_match?(asset, env)\n false\n end", "def image_filename\n S3_IMAGE_PREFIXES.each do |image_prefix|\n image_filename = \"#{image_prefix}#{filename}#{S3_IMAGE_EXTENSION}\"\n image_exists = Faraday.head(image_filename)\n return image_filename if image_exists.status == 200\n end\n return nil\n end", "def etag value, opts={}\n opts = {:kind => opts} unless Hash === opts\n kind = opts[:kind] || :strong\n new_resource = opts.fetch(:new_resource) { @request.post? }\n\n unless [:strong, :weak].include?(kind)\n raise ArgumentError, \":strong or :weak expected\"\n end\n\n value = '\"%s\"' % value\n value = 'W/' + value if kind == :weak\n @response[ETAG] = value\n\n if (200..299).include?(status) || status == 304\n if etag_matches? @env[IF_NONE_MATCH], new_resource\n halt(@request.safe? ? 304 : 412)\n end\n\n if @env[IF_MATCH]\n halt 412 unless etag_matches? @env[IF_MATCH], new_resource\n end\n end\n end", "def image_filename\n self['image'] || cached_remote_image_url.to_s.split('/').last\n end", "def head\n if(resource.exist?)\n response['Etag'] = resource.etag\n response['Content-Type'] = resource.content_type\n response['Last-Modified'] = resource.last_modified.httpdate\n OK\n else\n NotFound\n end\n end", "def file_file_name\n f = nil\n if self.asset_clone_id.present?\n x = self.asset_clone\n f = x.asset_file_name if x.present?\n else\n f = self.asset_file_name\n end\n return f\n end", "def version_for_cache\n \"download_url:#{source[:url]}|#{digest_type}:#{checksum}\"\n end", "def caching_headers( etag, last_modified )\n {\n \"Last-Modified\" => last_modified,\n \"Expires\" => Rack::Utils.rfc2109(Time.now + TEN_YEARS),\n \"Cache-Control\" => \"max-age=#{TEN_YEARS},public\",\n \"Etag\" => etag,\n 'Content-Type' =>'application/javascript; charset=utf-8'\n }\n end", "def asset_digest(path, options = {})\n return unless digest_assets\n\n if digest_path = asset_digest_path(path, options)\n digest_path[/-(.+)\\./, 1]\n end\n end", "def asset_model_location_name\n \"#{asset_id} : #{bmet_model.name} at #{location}\"\n end", "def checksum_of(url, etag, last_modified)\n #noinspection RubyArgCount\n Zlib::crc32(url + etag + last_modified).to_s\n end", "def digest_path\n if DigestUtils.already_digested?(@name)\n logical_path\n else\n logical_path.sub(/\\.(\\w+)$/) { |ext| \"-#{etag}#{ext}\" }\n end\n end", "def etag(value, options = {})\n # Before touching this code, please double check RFC 2616 14.24 and 14.26.\n options = {:kind => options} unless Hash === options\n kind = options[:kind] || :strong\n new_resource = options.fetch(:new_resource) { request.post? }\n\n unless [:strong, :weak].include?(kind)\n raise ArgumentError, \":strong or :weak expected\"\n end\n\n value = '\"%s\"' % value\n value = 'W/' + value if kind == :weak\n response['ETag'] = value\n\n if success? or status == 304\n if etag_matches? env['HTTP_IF_NONE_MATCH'], new_resource\n halt(request.safe? ? 304 : 412)\n end\n\n if env['HTTP_IF_MATCH']\n halt 412 unless etag_matches? env['HTTP_IF_MATCH'], new_resource\n end\n end\n end", "def asset_digest_path(path, options = T.unsafe(nil)); end", "def asset_digest_path(path, options = T.unsafe(nil)); end", "def to_s\n return \"%s %08x %s\" % [@sha512hash, @mtime.to_i, @archive_filename]\n end", "def timestamp_asset(path)\n return \"#{path}?t=#$app_build\"\n end", "def _eval_etag(buffer, value)\n value = value.call.to_s if value.is_a?(Proc)\n buffer.concat(value.to_s)\n end", "def asset_id(file)\n File.basename file, '.*'\n end", "def dependency_history_key\n \"asset-uri-cache-dependencies:#{compressed_path}:#{ @env.file_digest(filename) }\"\n end", "def meta_for_blob(blob)\n {\n \"name\" => blob.filename,\n \"size\" => blob.byte_size,\n \"mimeType\" => blob.content_type,\n \"url\" => blob.service_url(disposition: :inline, expires_in: 1.hour),\n }.as_json\n end", "def to_s\n \"s3 bucket: #{@bucket_name}\"\n end", "def local_artifact_name\n if File.directory?(@resource[:path])\n b, f = bucket_and_file(@resource[:source])\n artifact = File.join(@resource[:path], f)\n else\n artifact = @resource[:path]\n end\n end", "def asset_host; end", "def asset_host; end", "def name\n blob.name\n end", "def filename_for_export\n return \"No file attached to this asset\" if target_item.files.empty?\n target_item.original_file.file_name.first\n end", "def image_asset_id\n item_code_name_cd&.delete('IMG_').to_i\n end", "def image_name\n ovf.elements['//References/File'].attributes['ovf:href']\n end", "def json_from(asset)\n { asset_identifier: asset.asset_id,\n resource_identifier: asset.identifier,\n mime_type: asset.media_type,\n capture_device: asset.capture_device,\n file_created_date: asset.create_date('%Y-%m-%d %H:%M:%S.%6L'),\n date_imaged: asset.date_imaged,\n copyright_holder: asset.copyright,\n checksum: asset.md5sum }.to_json\n end", "def pet_image_tag\n return '' if pet.image_id.to_s.empty?\n\n html.div class: 'pet' do\n h2 'Actual image'\n img src: \"#{UrlAws}#{pet.image_id}\"\n end\n end", "def to_string\n @metadata[:contents]\n end", "def versioned_asset\r\n s=self.sop\r\n s=s.parent if s.class.name.end_with?(\"::Version\")\r\n if version.nil?\r\n s.latest_version\r\n else\r\n s.find_version(sop_version)\r\n end\r\n end", "def digest\n metadata[:digest]\n end", "def pick_template_for_etag(options); end", "def to_s\n\t\tresult = \"*** TagRetracker: renumber_start_at = #{@renumber_start_at}\"\n\t\tresult += \"\\ntotal tracks: #{@total_tracks}\"\n\t\tresult += \"\\n{@tag.to_s}\"\n\t\tresult += \"\\n@files hash: #{@files.to_s}\"\n\tend", "def to_s\n digest.to_s\n end", "def asset_url(asset_name)\n \"#{@server.base_uri}?sabreAction=asset&assetName=#{URI.escape(asset_name)}\"\n end", "def not_modified_response(env, etag)\n [ 304, cache_headers(env, etag), [] ]\n end", "def file_name\n File.basename(image_src) unless remote? || image_src.nil?\n end", "def inspect\n return \"#<EU:#{path.join(\"/\")}>:#{\"%#x\" % self.object_id}\"\n rescue\n super\n end", "def asset_digest_path(path, options = {})\n if manifest = assets_manifest\n if digest_path = manifest.assets[path]\n return digest_path\n end\n end\n\n if environment = assets_environment\n if asset = environment[path]\n return asset.digest_path\n end\n end\n end", "def to_s\n \"#{path} | #{native_revision_identifier}\"\n end", "def calculate_s3_key\n if photo && photo.filename && photo.source_id && name\n \"places/#{photo.place_id}/#{photo.source_id}/#{photo.file_parts[:root]}-#{name}.#{photo.file_parts[:extension]}\"\n else\n nil\n end\n end", "def to_s\n return @symbol if @entity.nil?\n\n return @entity.avatar\n end", "def image_src\n lambda do |text|\n hash = parse_text(text)\n image = find_image(hash)\n image.asset_digest_path\n end\n end", "def version_tag\n version_composition.join(\".\")\n end", "def parsed_version\n return \"~\\\"#{new_resource.version}\\\"\" if new_resource.version\n ''\n end", "def rails_asset_id_with_cloudfront(source)\n if @@cache_asset_timestamps && (asset_id = @@asset_timestamps_cache[source])\n asset_id\n else\n path = File.join(ASSETS_DIR, source)\n rewrite_path = File.exist?(path) && !CloudfrontAssetHost.disable_cdn_for_source?(source) && CloudfrontAssetHost::Uploader.current_paths.include?(path)\n asset_id = if rewrite_path \n CloudfrontAssetHost.key_for_path(path) \n\n elsif File.exists?(path)\n (\"?\" + File.mtime(path).to_i.to_s)\n else\n ''\n end\n\n if @@cache_asset_timestamps\n @@asset_timestamps_cache_guard.synchronize do\n @@asset_timestamps_cache[source] = asset_id\n end\n end\n\n asset_id\n end\n end", "def public_compute_asset_path(source, options = T.unsafe(nil)); end", "def core_asset(chain)\n _chain_info = @@chain_infos[chain]\n\n return _chain_info.core.symbol\n end", "def elastics_id\n Digest::MD5.hexdigest url\n end" ]
[ "0.7164701", "0.7039365", "0.7039365", "0.7032124", "0.6977466", "0.69328827", "0.6925472", "0.6884995", "0.68725806", "0.6861124", "0.6757784", "0.6729066", "0.66988105", "0.663658", "0.65987927", "0.6598492", "0.6598492", "0.658027", "0.6167847", "0.61301166", "0.6113725", "0.6035956", "0.597485", "0.59683365", "0.59285015", "0.5792731", "0.57254654", "0.5698309", "0.56761885", "0.56474626", "0.5608346", "0.55709934", "0.556795", "0.5564528", "0.55535424", "0.5549689", "0.5549689", "0.553253", "0.55162996", "0.54952985", "0.5458991", "0.54294866", "0.5416095", "0.53918713", "0.5384721", "0.5330289", "0.53249854", "0.529096", "0.52791613", "0.52647007", "0.52123076", "0.5195946", "0.5190533", "0.51896197", "0.5179883", "0.51668954", "0.51650697", "0.51573104", "0.5109452", "0.5103525", "0.50894034", "0.5088449", "0.5088449", "0.50461304", "0.5045201", "0.50376314", "0.5033758", "0.50207657", "0.50113887", "0.49841216", "0.49755943", "0.49741578", "0.49741578", "0.49727648", "0.49705988", "0.49679756", "0.4966259", "0.49613258", "0.4946537", "0.49417335", "0.49352324", "0.49344617", "0.49326745", "0.49323598", "0.49263847", "0.49184638", "0.48956275", "0.4884715", "0.48821422", "0.48809302", "0.48744214", "0.48731872", "0.4871007", "0.48672298", "0.48589018", "0.48566115", "0.48548743", "0.4854605", "0.48532495", "0.48481557" ]
0.6825404
10
Public: Returns String base64 digest of source.
def base64digest DigestUtils.pack_base64digest(digest) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n @str ||= Base64.encode64(get_digest).gsub(/\\s/, '')\n end", "def digest\n ''\n end", "def digest\n ''\n end", "def to_str\n digest.to_str\n end", "def asset_digest(source)\n asset_paths.digest_for(source)\n end", "def digest(string, algorithm)\n Base64.encode64 digester(algorithm).digest(string)\n end", "def to_s\n digest.to_s\n end", "def checksum\n source[digest_type]\n end", "def digest\n digest = ''\n @entries.each { |entry| digest << entry.digest << ' ' }\n digest\n end", "def base64\n binary = open { |io| io.read }\n result = Base64.encode64(binary).chomp\n binary.clear # deallocate string\n result\n end", "def base64\n binary = open { |io| io.read }\n result = Base64.strict_encode64(binary)\n binary.clear # deallocate string\n result\n end", "def digested_canonicalized_data\n \n @string = \"\"\n @string << CGI::unescapeHTML(self.canonicalized_data.gsub(/\\n/, ''))\n return Base64::encode64(Digest::SHA1.digest(@string))\n \n end", "def base64\n content = storage.read(id)\n base64 = Base64.encode64(content)\n base64.chomp\n end", "def sha\n Digest::SHA2.new.update(self.source).to_s\n end", "def digest\n Digest::SHA1.hexdigest(@pub.to_der)\n end", "def digest\n Digest::SHA1.hexdigest(self)\n end", "def digest_filename(filename)\n digest = Digest::SHA256.digest(filename.to_s)\n Base64.urlsafe_encode64(digest, padding: false)\n end", "def digest\n digest = ''\n @elements.each { |element| digest << element.digest << ' '}\n digest\n end", "def base64_encode\n [self].pack('m').chop\n end", "def digest(data); end", "def digest\n metadata[:digest]\n end", "def digest( str )\n Digest::SHA1.hexdigest( str )\n end", "def checksum64(io)\n Base64.encode64([checksum(io)].pack(\"H*\")).strip\n end", "def digest\n Digest::MD5.file(file).hexdigest\n end", "def digest\n decode[:digest]\n end", "def digest\n image.ident\n end", "def to_base64\n base64 = [to_s].pack('m').delete(\"\\n\")\n base64.gsub!('/', '~')\n base64.gsub!('+', '-')\n base64\n end", "def pack_base64digest(bin)\n [bin].pack('m0')\n end", "def pack_base64digest(bin)\n [bin].pack('m0')\n end", "def md5\n Base64.strict_encode64(@signature.md5)\n end", "def digest(string)\n @digest_class.new(string).digest\n end", "def digest\n Digest::MD5.digest(blob)\n end", "def hexdigest\n # Read bytes in chunks of the optimal digest size.\n while (chunk = @io.read(@digest.block_length))\n @digest.update(chunk)\n end\n @digest.hexdigest\n end", "def build(message)\n Base64.encode64(digest message).chomp\n end", "def digest\n @digest ||= DEFAULT_DIGEST_PROC\n end", "def hexdigest\n DigestUtils.pack_hexdigest(digest)\n end", "def digest_key(digest)\n \"asset-uri-digest:#{compressed_path}:#{digest}\"\n end", "def base64\n self[:data]\n end", "def calc_digest input\n Digest::SHA1.hexdigest(input.to_s).\n\n # XXX: surround all digits with alphabets so\n # Maruku doesn't change them into HTML\n gsub(/\\d/, 'z\\&z')\n end", "def digest(subject)\n Digest::MD5.hexdigest subject.downcase\n end", "def sha1\n Digest::SHA1.hexdigest(subject.identification + 0.chr + source)\n end", "def base64(value)\n {\"Fn::Base64\" => value}\n end", "def pack_urlsafe_base64digest(bin)\n str = pack_base64digest(bin)\n str.tr!('+/'.freeze, '-_'.freeze)\n str.tr!('='.freeze, ''.freeze)\n str\n end", "def pack_urlsafe_base64digest(bin)\n str = pack_base64digest(bin)\n str.tr!('+/'.freeze, '-_'.freeze)\n str.tr!('='.freeze, ''.freeze)\n str\n end", "def base64(stuff)\n Base64.encode64(stuff).delete(\"\\n\")\n end", "def raw_encode()\n return Base64.encode64(File.read @file_path).delete(\"\\n\") if RUBY_VERSION < \"1.9.0\"\n Base64.strict_encode64(File.read @file_path)\n end", "def to_s\n \"#{user}:#{digest}\"\n end", "def encode\n ::Base64.encode64(@string)\n end", "def base64(length: T.unsafe(nil), padding: T.unsafe(nil), urlsafe: T.unsafe(nil)); end", "def signature\n @signature ||= Base64.encode64(digest).gsub(\"\\n\", '')\n end", "def calc_digest(password)\n return nil unless password\n algorithm.encode(password)\n end", "def to_base64\n\t\treturn Base64.encode64(self)\n\tend", "def digest(string, options = {})\n salt = options[:salt] || SecureRandom.base64\n Digest::SHA1.hexdigest(\"#{salt}--#{string}\")\n end", "def digest\n assert_file!\n Digest::SHA256.hexdigest(@name + Digest::SHA256.file(@path).to_s)\n end", "def sha1_base64\n str = Base64.encode64(Digest::SHA1.digest(salted_name)).strip\n str.tr('+/', '-_').gsub(/=/,'')\n end", "def digest\n Digest::SHA2.new\n end", "def signature\n Base64.encode64(digest_with_key(string_to_sign)).strip\n end", "def to_base64\n [self].pack(\"m\")\n end", "def hex_to_base64(s)\n [[s].pack(\"H*\")].pack('m*')\nend", "def digest\n OpenSSL::Digest::SHA256.file(path).hexdigest\n end", "def md5\n return self.body_data.md5\n end", "def digest_password\n token = nonce + timestamp + password\n Base64.encode64(Digest::SHA1.hexdigest(token)).chomp!\n end", "def to_base64\n Base64.strict_encode64 to_escp\n end", "def base64_encode\n Base64.encode64(file_contents)\n end", "def computed_sha(string)\n provider.computed_sha(string)\n end", "def encode_base64\n [self].pack(\"m*\")\n end", "def digest_file( x)\n path = requested_file( x[:request] )\n if File.exist?(path) && !File.directory?(path)\n Digest::MD5.hexdigest(File.read(path))\n else\n nil\n end\n end", "def encode64\n Base64.strict_encode64(compress)\n end", "def c_hash\n sha256 = Digest::SHA256.new\n token = @code.token.token\n hashed_token = sha256.digest(token)\n first_half = hashed_token[0...hashed_token.length / 2]\n Base64.urlsafe_encode64(first_half).tr('=', '')\n end", "def integrity_uri(digest)\n case digest\n when Digest::Base\n digest_class = digest.class\n digest = digest.digest\n when String\n digest_class = DIGEST_SIZES[digest.bytesize]\n else\n raise TypeError, \"unknown digest: #{digest.inspect}\"\n end\n\n if hash_name = HASH_ALGORITHMS[digest_class]\n \"#{hash_name}-#{pack_base64digest(digest)}\"\n end\n end", "def integrity_uri(digest)\n case digest\n when Digest::Base\n digest_class = digest.class\n digest = digest.digest\n when String\n digest_class = DIGEST_SIZES[digest.bytesize]\n else\n raise TypeError, \"unknown digest: #{digest.inspect}\"\n end\n\n if hash_name = HASH_ALGORITHMS[digest_class]\n \"#{hash_name}-#{pack_base64digest(digest)}\"\n end\n end", "def digest(obj)\n build_digest(obj).digest\n end", "def id(source_file)\n Digest::SHA1.hexdigest(filename(source_file))\n end", "def encode_base64(text)\n Base64.strict_encode64(text).strip\n end", "def digest_str(password)\n raise ArgumentError, \"password must be a String\" unless password.is_a?(String)\n\n result = Util.zeros(STRBYTES)\n\n ok = self.class.pwhash_str(\n result,\n password, password.bytesize,\n @opslimit, @memlimit\n )\n raise CryptoError, \"unknown error in Argon2#digest_str\" unless ok\n\n result.delete(\"\\x00\")\n end", "def base64_encode(string)\n SSL.base64_encode(string)\n end", "def base64_encode(string)\n SSL.base64_encode(string)\n end", "def id(source_file)\n Digest::SHA1.hexdigest(source_file.filename)\n end", "def digest\n cost = ActiveModel::SecurePassword.min_cost ? BCrypt::Engine::MIN_COST : BCrypt::Engine.cost\n BCrypt::Password.create(SecureRandom.urlsafe_base64, cost: cost)\n end", "def digested_reference\n url\n end", "def digested_reference\n url\n end", "def digest\n @digest ||= Digest::MD5.hexdigest(self.attributes[self.class.config[:digest]])[0, 8]\n end", "def encode(string)\n Base64.encode64(string).gsub(/\\n/, \"\")\n end", "def b64d(input)\n if input\n return helpers.base64Decode(input)\n end\n return \"\".to_java_bytes\n end", "def get_base64_image(image)\n image_base64 = Base64.encode64(open(image) { |io| io.read })\n filter_image = image_base64.gsub(/\\r/,\"\").gsub(/\\n/,\"\")\n end", "def file_digest_key(stat)\n \"file_digest:#{compressed_path}:#{stat}\"\n end", "def digest_type\n DIGESTS.each do |digest|\n return digest if source.key? digest\n end\n raise ChecksumMissing.new(self)\n end", "def md5\n headers['Content-MD5']\n end", "def base64_encode value\n encoded_str = Base64.urlsafe_encode64 value, padding: false\nend", "def full_digest_path\n File.join(@load_path, digest_path)\n end", "def to_param\n digest\n end", "def digest_name(name)\n Digest::SHA2.hexdigest(short_name(name))[0..24]\n end", "def generate_digest(message)\n MD4_MAC.new(@key, message).digest\n end", "def hexdigest\n @digest.unpack('H*'.freeze).first\n end", "def digest_path\n if DigestUtils.already_digested?(@name)\n logical_path\n else\n logical_path.sub(/\\.(\\w+)$/) { |ext| \"-#{etag}#{ext}\" }\n end\n end", "def cert_digest\n Digest::SHA1.hexdigest(@cert.to_der)\n end", "def calculate_checksum\n last_checksum = previous_event&.checksum\n attrs = attributes.except(\"checksum\", \"id\", \"updated_at\").merge(last_checksum: last_checksum)\n cs = Digest::SHA256.hexdigest(attrs.to_s)\n puts \"#{id} calculate_checksum: #{cs} <- #{attrs} \" if Rails.env.development?\n Rails.logger.info(\"#{id} calculate_checksum: #{cs} <- #{attrs} \")\n return cs\n end", "def checksum\n digest = @digest_klass.new\n buf = ''\n\n File.open(@path, \"rb\") do |f|\n while !f.eof\n begin\n f.readpartial(BUFFER_SIZE, buf)\n digest.update(buf)\n rescue EOFError\n # Although we check for EOF earlier, this seems to happen\n # sometimes anyways [GH-2716].\n break\n end\n end\n end\n\n digest.hexdigest\n end", "def params_digest\n return Digest::SHA1.hexdigest(params.sort.flatten.join(\"_\"))\n end", "def generate_digest(data)\n OpenSSL::HMAC.hexdigest(DIGEST, @secret, data)\n end" ]
[ "0.69453037", "0.6894197", "0.6894197", "0.6651485", "0.6564605", "0.65619093", "0.63819534", "0.63583064", "0.6333095", "0.6247995", "0.61536855", "0.6151128", "0.60855085", "0.60849744", "0.59491485", "0.59455854", "0.5943745", "0.5929269", "0.5894392", "0.5887646", "0.5875598", "0.5872066", "0.58699095", "0.5868926", "0.58596015", "0.5845422", "0.5841137", "0.57782066", "0.57782066", "0.57759184", "0.5775317", "0.57747215", "0.5774525", "0.5768844", "0.57581353", "0.5701817", "0.56873554", "0.5685538", "0.5640909", "0.56388026", "0.56295395", "0.5629512", "0.5611898", "0.5611898", "0.5606444", "0.56038254", "0.55862075", "0.55840683", "0.5567695", "0.5558462", "0.5556627", "0.55449754", "0.55401707", "0.55381095", "0.5521033", "0.55174977", "0.5507616", "0.5506556", "0.55058813", "0.55053204", "0.55047786", "0.54898703", "0.5471877", "0.54703975", "0.54611295", "0.5458845", "0.54418176", "0.5439343", "0.5412063", "0.5406751", "0.5406751", "0.5399245", "0.5394077", "0.5388919", "0.53826976", "0.537958", "0.537958", "0.5379515", "0.53654987", "0.53583616", "0.53583616", "0.5356549", "0.5349385", "0.53449184", "0.5340749", "0.5334857", "0.5332124", "0.5321444", "0.53205407", "0.5316925", "0.53158873", "0.5306915", "0.5305336", "0.52697563", "0.5266132", "0.52577776", "0.5238719", "0.5231866", "0.5225165", "0.5221492" ]
0.7498065
0
Public: A "named information" URL for subresource integrity.
def integrity DigestUtils.integrity_uri(digest) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def detail_url(resource_id)\n \"#{@path}#{resource_id}/\"\n end", "def resource_info\n\n \"content_#{id}\"\n\n end", "def _info_uri\n InfoURI + _uri_path\n end", "def resource_uri\n \"#{resource_name}/#{uid}\"\n end", "def url(name)\n compliance_data.dig(:information_urls, name)\n end", "def main_info_url\n url(:main_info)\n end", "def url\n \"/#{self.class.rest_name}s/#{id}\"\n end", "def ar_resource_url resource= @resource\n meth= \"#{ardata.resource_method(@parent_resource, '')}_url\"\n \n if @parent_resource\n send meth, @parent_resource, resource\n else\n send meth, resource\n end\n end", "def partner_ref_url(resource)\n uri = URI.parse(root_url)\n uri.query = URI.encode_www_form(partner: resource.name)\n uri.to_s\n end", "def information_url\n return @information_url\n end", "def information_url\n return @information_url\n end", "def detail(resource_id)\n @do_resource_mixin.detail(resource_id)\n end", "def rest_url_document\n template = ::Addressable::Template.new(current_resource.class.rest_api_document)\n template.expand(property_map).to_s\n end", "def resource_name\n @resource_name\n end", "def resource identifier\n Resource.new(Conjur::Authz::API.host, credentials)[self.class.parse_resource_id(identifier).join('/')]\n end", "def identifier\n rdf_resource\n end", "def full_url_helper(resource)\n \"#{root_url}fhir/r4/#{resource.class.name.split('::').last}/#{resource.id}\"\n end", "def resource_url\n base_url + \"/dsi_\" + resource_name + \".aspx\"\n end", "def resource_path(*args)\n resource.path(*args)\n end", "def name\n record.resource_id\n end", "def internal_resource\n attributes[:internal_resource]\n end", "def resource_name\n resource_specification.name\n end", "def uri(uri_template = nil)\n if @uri.nil? && uri_template.nil?\n return FmRest::V1.record_path(layout) + \"(/:#{primary_key})\"\n end\n super\n end", "def sub_path\n \"#{\"%02x\" % (id.to_i % 256)}/#{id}\"\n end", "def resource\n @resource\n end", "def name\n \"#{id}: #{url}\"\n end", "def resource; end", "def show_for_resource(identifier)\n styled_header(\"Resource Info\")\n\n resource = resolve_addon!(identifier)\n\n styled_hash({\n 'Name' => resource['name'],\n 'Plan' => resource['plan']['name'],\n 'Billing App' => resource['app']['name'],\n 'Price' => format_price(resource['plan']['price'])\n }, ['Name', 'Plan', 'Billing App', 'Price'])\n\n display(\"\") # separate sections\n\n styled_header(\"Attachments\")\n display_attachments(get_attachments(:resource => resource['id']), ['App', 'Name'])\n end", "def instance_url\n \"#{parsed_resource_url}/#{self.id}\"\n end", "def xref_name\n self['remoteInfo']\n end", "def resource_url(*args)\n space_page_url @space, 'articles',\n hash_for_periodical_path(resource)\n end", "def details_key; end", "def resource_url(resource)\n connec_api_v2_resource_url(@group_id, entities_key,resource)\n end", "def resource\n \"#{quality}.#{format}\"\n end", "def resource_base_name\n 'JSON'\n end", "def resource_url options={}\n r=request.path\n id=params[:id]\n options = case params[:action]\n when 'create','update','delete','destroy'; \"\"\n else resource_options(options)\n end\n return \"%s%s\" % [r,options] if r.match \"#{resource.class.to_s.tableize}\\/#{id}$\"\n \"%s%s\" % [ r.split(\"/#{params[:action]}\")[0], options]\n rescue Exception => e\n scoop_from_error e\n end", "def json_url\n # \"#{REDDIT_URL_PREFIX}#{permalink}#{@self_id}.json\"\n end", "def resource_name\n :account\n end", "def path\n CGI::unescape @resource\n end", "def internal_resource\n attributes[:internal_resource]\n end", "def getter_url\n\t self.class.resource_url + @id.to_s + '?' + self.class.getter_include.to_s\n end", "def resource(namespaces, id)\n # resource can only exist for an API version\n link = api_root\n # combine namespace and entity ID\n link << namespace(namespaces)\n link << \"/#{id}\" unless id.nil? || id.empty?\n # return the created link\n link\n end", "def url\n self.name\n end", "def display_resource(section)\n section.name\n end", "def url\n { :controller => self.controller,\n :action => self.action,\n :mode => self.mode,\n :table_name => self.table_name,\n :table => self.table_name,\n :id => self.identifier }\n end", "def url\n [ @parent.url, @name ].join('/')\n end", "def test_pretty_resource_name\n schema = Heroics::Schema.new(SAMPLE_SCHEMA)\n link = schema.resource('another-resource').link('list')\n assert_equal('another-resource', link.pretty_resource_name)\n end", "def headsign\n url.to_s =~ /information\\/([a-z]+)\\//\n $1\n end", "def inspect\n sprintf(\"#<%s:%#0x URI:%s>\", URI.to_s, self.object_id, self.to_s)\n end", "def resource_path(*args)\n options = args.extract_options!\n super_path(with_chain(args.first || resource), options)\n end", "def resource\n\n end", "def serialize_resource(resource)\n link_id, link_type = link_id_and_type(resource)\n\n linkage = if link_id\n {\n inverse_id => link_id,\n :type => link_type\n }\n else\n nil\n end\n\n {\n linkage: linkage,\n related: url_for(resource)\n }\n end", "def display_resource(findingaid)\n \"#{findingaid.name}\"\n end", "def resource_url; nil end", "def url(path)\n \"#{self.api_root}/#{self.api_version}/#{self.tenancy_code}/#{path}\"\n end", "def name\n @resource.name\n end", "def test_pretty_name\n schema = Heroics::Schema.new(SAMPLE_SCHEMA)\n link = schema.resource('resource').link('identify_resource')\n assert_equal('identify-resource', link.pretty_name)\n end", "def display_resource(building)\n \"#{building.name}\"\n end", "def resource\n @resource\n end", "def resource\n @resource\n end", "def uri\n database.uri + '/' + ensure_id\n end", "def identifier(account)\n identity_url(:account => account, :protocol => scheme)\n end", "def display_resource(region)\n \"#{region.name}\"\n end", "def to_param\n \"#{id}-#{name.to_safe_uri}\"\n end", "def resource_name\n return @resource_name\n end", "def resource_name\n return @resource_name\n end", "def resource_name\n return @resource_name\n end", "def pretty_resource_name\n Heroics.pretty_name(resource_name)\n end", "def resource_url\n return super unless resource.is_a?(Decidim::Component)\n\n @resource_url ||= main_component_url(resource)\n end", "def identifier\n @record.uri.to_s\n end", "def path\n \"/content/#{id}\"\n end", "def endpoint\n \"http://api.urlvoid.com/#{identifier}/#{api_key}\"\n end", "def related_url\n return OrderedStringHelper.deserialize(super )\n end", "def related_url\n return OrderedStringHelper.deserialize(super )\n end", "def resource(title)\n @catalog.resource(title) || @aliases[title]\n end", "def secure_subresource_integrity_context?; end", "def secure_subresource_integrity_context?; end", "def name\n\t\t\traise \"Resource#name must be overriden!\"\n\t\tend", "def path\n name = @resource.value(:name)\n if (attrs = self.class.all[name])\n attrs[:path]\n end\n end", "def resource_name\n resource_class.resource_name\n end", "def info\n {\n :name => self.name,\n :signature => self.signature,\n }\n end", "def joss_resource_url\n \"#{ENV['JOURNAL_URL']}/papers/#{formatted_doi}\"\n end", "def info_url_for(image)\n path = url(image)\n signature = sign_path(path)\n\n File.join(Imgproxy.config.endpoint.to_s, \"info\", signature, path)\n end", "def url\n resource.url + '/methods'\n end", "def outer_url\r\n \"http://#{HOST_DOMAIN}/debates/#{self.id}\"\r\n end", "def display_resource(club)\n club.name\n end", "def display_resource(deal)\n \"Deal ##{deal.id} #{deal.item.name}/#{deal.profile.name} #{deal.profile.phone}\"\n end", "def show\n @resource_info = ResourceInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource_info }\n end\n end", "def dataset_endpoint(id)\n return uri(\"resource/\" + id)\n end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end" ]
[ "0.67207766", "0.6291825", "0.6152676", "0.60789734", "0.5912212", "0.57891583", "0.57761484", "0.5750071", "0.5731362", "0.57246226", "0.57246226", "0.5714385", "0.5600739", "0.55656147", "0.5557016", "0.55538565", "0.55530035", "0.55464685", "0.55451834", "0.55344087", "0.5496873", "0.5444197", "0.54259706", "0.542356", "0.5407374", "0.54023445", "0.5401293", "0.53906345", "0.5388833", "0.53678346", "0.5358019", "0.53549165", "0.5348692", "0.5348134", "0.53435844", "0.5343242", "0.53288925", "0.53268564", "0.53247476", "0.5319029", "0.5312225", "0.52902067", "0.5284851", "0.5281039", "0.5277828", "0.52650905", "0.5260691", "0.5253876", "0.52519995", "0.52483857", "0.52477366", "0.5242984", "0.5238498", "0.5236598", "0.5234521", "0.5212965", "0.52028537", "0.5202542", "0.52020586", "0.52020586", "0.5190442", "0.5185446", "0.51598436", "0.5153134", "0.51485497", "0.51485497", "0.51485497", "0.51387024", "0.5133584", "0.513331", "0.512908", "0.5128804", "0.51252955", "0.51252955", "0.51183933", "0.5117847", "0.51164865", "0.5109759", "0.510923", "0.5102146", "0.5101116", "0.51005083", "0.50992435", "0.50942886", "0.5093871", "0.50932467", "0.50923216", "0.50902766", "0.50899535", "0.5087534", "0.5087534", "0.5087534", "0.5087534", "0.5087534", "0.5087534", "0.5087534", "0.5087534", "0.5087534", "0.5087534", "0.5087534", "0.5087534" ]
0.0
-1
Public: Add enumerator to allow `Asset` instances to be used as Rack compatible body objects. block part String body chunk Returns nothing.
def each yield to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def each\n body_parts = self.body.respond_to?(:each) ? self.body : [self.body]\n return body_parts.to_enum unless block_given?\n body_parts.each { |part| yield(part) }\n end", "def add_multi_block(block)\n\t\t\t@encoded << block\n\tend", "def each_body\n return enum_for(__method__) unless block_given?\n\n unless @message.body.parts.empty?\n @message.body.parts.each do |part|\n yield part.content_type, part.body.decoded\n end\n else\n yield @message.content_type, @message.body.decoded\n end\n end", "def chunk(*chunks)\n @body.chunk(*chunks)\n end", "def add_to_asset_box(box, *items)\n box = (box.present? ? box.to_s : 'assets')\n boxes = box.pluralize\n items = [items].flatten.compact\n\n if items.present? && items.any? { |obj| !obj.kind_of?(Effective::Asset) }\n raise ArgumentError.new('add_to_asset_box expects one or more Effective::Assets, or an Array of Effective::Assets')\n end\n\n if box == boxes # If we're adding to a pluralized box, we want to add our attachment onto the end\n pos = attachments.select { |attachment| attachment.box == boxes }.last.try(:position).to_i + 1\n else # If we're adding to a singular box, we want our attachments to be on the front\n pos = attachments.to_a.find { |attachment| attachment.box == boxes }.try(:position).to_i\n\n # Push all the attachments forward\n attachments.each { |att| att.position = (att.position + items.length) if att.box == boxes }\n end\n\n # Build the attachments\n items.each_with_index do |item, x|\n attachment = self.attachments.build(:position => (pos+x), :box => boxes)\n\n attachment.attachable = self\n attachment.asset = item\n end\n\n attachments.to_a.sort_by! { |attachment| attachment.position }\n\n true\n end", "def each\n @body.each do |block|\n yield @resource.send(@encoder, @resource.send(@charsetter, block.to_s))\n end\n end", "def multipart_body(body, parts, boundary, mtype, filesize)\n lambda do |socket|\n begin\n begin\n first = parts.shift\n last = parts.shift\n socket.write(\n \"--#{boundary}#{CRLF}\" \\\n \"Content-Type: #{mtype}#{CRLF}\" \\\n \"Content-Range: bytes #{first}-#{last}/#{filesize}#{CRLF}\" \\\n \"#{CRLF}\"\n )\n\n begin\n IO.copy_stream(body, socket, last - first + 1, first)\n rescue NotImplementedError\n body.seek(first, IO::SEEK_SET)\n IO.copy_stream(body, socket, last - first + 1)\n end\n socket.write(CRLF)\n end while parts[0]\n socket.write(\"--#{boundary}--#{CRLF}\")\n ensure\n body.close\n end\n end\n end", "def each\n\t parts = body_parts.map { |p| \n\t\tp.multipart? ? p.body_parts : p }\n\t parts.flatten.compact.each { |p| yield(p) }\n\tend", "def get\n raise_method_not_available(__method__, 'is nested asset') if nested_asset?\n assets = client.get(asset_type)\n assets.map { |data| self.new_from_payload(data) }\n end", "def assign_body_parts(body)\n body.parts.each do |part|\n if part.multipart?\n assign_body_parts(part)\n else\n @body[part.header[\"content-type\"].sub_type] = part.body if \n part.header[\"content-type\"].main_type == \"text\"\n end #if\n end #do\n end", "def add_block block\n block.at self.length\n @blocks << block\n end", "def blocks\n object.blocks.map{ |x|\n ShallowBlockSerializer.new(x)\n }\n end", "def read_body(&block)\n while byte = @body.read(1)\n yield byte\n end\n end", "def <<(block)\n blocks << block\n end", "def each_attachment\n attachment_urls.each { |url| yield ActiveSP::File.new(self, url, true) }\n end", "def stream(&block)\n attributes[:streams] << API::Stream.build(&block)\n end", "def each(&block)\n return [] if total_items == 0\n @response['items'].each do |item|\n block.call(Item.new(item))\n end\n end", "def each(&block)\n response.read_body(&block)\n ensure\n session.end_request_hacked\n session.finish\n end", "def each_body &block\n b = @app.process(@position, env).last.body\n if block_given?\n b.each(&block)\n else\n b.to_enum\n end\n end", "def set_asset_class\n for pattern, klass in asset_class_lookup\n if pattern === mimetype\n new_klass = klass\n end\n end\n\n transmogrify_asset(new_klass || GenericAsset)\n end", "def each_chunk( &block )\n\t\t\tself.validate\n\n\t\t\titer = Enumerator.new do |yielder|\n\t\t\t\tself.bytes.each_slice( self.chunksize ) do |bytes|\n\t\t\t\t\tyielder.yield( bytes.pack('C*') )\n\t\t\t\tend\n\t\t\tend\n\n\t\t\treturn iter unless block\n\t\t\treturn iter.each( &block )\n\t\tend", "def each(&block)\n return @parts.each(&block)\n end", "def block(name, &block)\n klass = SuperbTextConstructor.block(name, &block)\n @blocks << klass\n klass\n end", "def body\n @chunk\n end", "def item_block(_item, &block)\n block.yield\n end", "def upload_chunk(resource, bytes, bytes_start, bytes_read)\n headers = {\n 'content-type' => content_type,\n 'content-length' => bytes.size,\n 'content-range' => \"bytes #{bytes_start}-#{bytes_read - 1}/#{@file_size}\"\n }\n response = TwitterAds::Request.new(\n @client, :put, resource, domain: DEFAULT_DOMAIN, headers: headers, body: bytes).perform\n\n yield(response)\n response\n end", "def add_body(chunk)\n if @on_body\n @on_body.call(chunk)\n else\n @body ||= \"\"\n @body << chunk\n end\n end", "def add_single_block(block)\n\n\t\tif @decoded[block.blocks[0]].nil? \n\t\t \t@decoded[block.blocks[0]] = block.data \n\t\t\t@num_valid += 1\n\t\tend\n\tend", "def body(&block)\n call_once\n @body ||= begin\n if entity = @response.get_entity\n EntityConverter.new.read_entity(entity, &block)\n end\n rescue Java::JavaIo::IOException, Java::JavaNet::SocketException, IOError => e\n raise StreamClosedException.new(\"Could not read from stream: #{e.message}\")\n # ensure\n # @request.release_connection\n end\n end", "def each\n return enum_for unless block_given?\n\n while (chunk = read)\n yield chunk\n end\n end", "def set_block\n @request = JSON.parse(request.body.read, {:symbolize_names => true})\n @block = Block.find_by(prev_block: @request[:prev_block])\n end", "def add(&block)\n @block_args << block\n end", "def chunk(obj)\n Fiber.yield(obj)\n end", "def read(block)\n @filemgr.read(block, @contents)\n end", "def process_blocks(blocks); end", "def contents(&block)\n if block_given?\n @base.lib.object_contents(@objectish, &block)\n else\n @contents ||= @base.lib.object_contents(@objectish)\n end\n end", "def asset_tag_for(asset, &block)\n block_to_partial(\"assets/tag\", {:asset => asset}, &block)\n end", "def each(&block)\n if block\n @block = block\n @parser.parse(@handle)\n else\n enum_for(:each)\n end\n end", "def add_block(article_block)\n self.blocks << article_block\n end", "def each &blk\n @body_callback = blk\n end", "def each(&block)\n if block\n @block = block\n parser_dispatch\n else\n enum_for(:each)\n end\n end", "def attachment(params, &block)\n ActiveSupport::Deprecation.warn \"attachment() is deprecated and will be removed in future versions. \" <<\n \"Please use the attachments[] API instead.\"\n params = { :content_type => params } if String === params\n\n params[:content] ||= params.delete(:data) || params.delete(:body)\n\n if params[:filename]\n params = normalize_file_hash(params)\n else\n params = normalize_nonfile_hash(params)\n end\n\n part(params, &block)\n end", "def each(&block)\n fake_stream = Zipline::FakeStream.new(&block)\n Zipline::OutputStream.open(fake_stream) do |zip|\n @package.parts.each do |name, part|\n begin\n if part.respond_to?(:stream) && part.respond_to?(:size)\n zip.put_next_entry name, part.size\n part.stream zip\n else\n data = @package.marshal_part(name)\n zip.put_next_entry name, data.size\n zip << data\n end\n rescue => e\n raise e unless @ignore_part_exceptions\n end\n end\n end\n end", "def each(&block)\n return to_enum(__method__) unless block\n\n @receivers << block\n block.call io.string.dup unless io.string.empty?\n sync\n\n self\n end", "def each_chunk_from\n if actual_content.is_a?(String)\n yield actual_content\n elsif content_is_really_a_checksum? && actual_content.nil?\n yield read_file_from_filebucket\n elsif actual_content.nil?\n yield ''\n end\n end", "def blocks\n @blocks ||= []\n end", "def each_part(parts, header = false) # :yields: uid, message\n parts.each do |uid, section|\n sequence = [\"BODY[#{section}]\"]\n sequence.unshift \"BODY[#{section}.MIME]\" unless section == 'TEXT'\n sequence.unshift 'BODY[HEADER]' if header\n\n body = imap.fetch(uid, sequence).first\n\n sequence = sequence.map { |item| body.attr[item] }\n\n unless section == 'TEXT' and header then\n sequence[0].sub!(/\\r\\n\\z/, '')\n end\n\n yield uid, sequence.join\n end\n end", "def each_registered_block(type, &block); end", "def use(item, &block)\n _item = define(item, &block)\n list << _item\n end", "def << bytes\n @body << bytes\n end", "def each(&block)\n if block_given?\n @fog_wrapper.each do |key|\n yield file(key)\n end\n else\n to_enum(:each)\n end\n end", "def blocks\n @blocks ||= []\n end", "def items(&block) \n if block_given?\n instance_eval(&block) \n else\n @items\n end \n end", "def get_object(resource, type, id, location = 0) #:yields: data_object\n header = {\n 'Accept' => mimemap.keys.join(',')\n }\n\n data = {\n 'Resource' => resource,\n 'Type' => type,\n 'ID' => id,\n 'Location' => location.to_s\n }\n\n response = request(@urls['GetObject'], data, header)\n results = block_given? ? 0 : []\n\n if response['content-type'] && response['content-type'].include?('text/xml')\n # This probably means that there was an error.\n # Response parser will likely raise an exception.\n rr = @response_parser.parse_object_response(response.body)\n return rr\n elsif response['content-type'] && response['content-type'].include?('multipart/parallel')\n content_type = process_content_type(response['content-type'])\n\n# TODO: log this\n# puts \"SPLIT ON #{content_type['boundary']}\"\n boundary = content_type['boundary']\n if boundary =~ /\\s*'([^']*)\\s*/\n boundary = $1\n end\n parts = response.body.split(\"\\r\\n--#{boundary}\")\n\n parts.shift # Get rid of the initial boundary\n\n# TODO: log this\n# puts \"GOT PARTS #{parts.length}\"\n\n parts.each do |part|\n (raw_header, raw_data) = part.split(\"\\r\\n\\r\\n\")\n\n# TODO: log this\n# puts raw_data.nil?\n next unless raw_data\n\n data_header = process_header(raw_header)\n data_object = RETS::DataObject.new(data_header, raw_data)\n\n if block_given?\n yield data_object\n results += 1\n else\n results << data_object\n end\n end\n else\n info = {\n 'content-type' => response['content-type'], # Compatibility shim. Deprecated.\n 'Content-Type' => response['content-type'],\n 'Object-ID' => response['Object-ID'],\n 'Content-ID' => response['Content-ID']\n }\n\n if response['Transfer-Encoding'].to_s.downcase == \"chunked\" || response['Content-Length'].to_i > 100 then\n data_object = RETS::DataObject.new(info, response.body)\n if block_given?\n yield data_object\n results += 1\n else\n results << data_object\n end\n end\n end\n\n results\n end", "def with_buffer(block)\n yield(_erb_buffer(block.binding))\n end", "def each\n while (part = readpartial)\n yield part\n end\n end", "def each_byte( &block )\n\t\t\tself.log.debug \"Making a bytes iterator for a %s payload\" %\n\t\t\t\t[ self.payload.external_encoding.name ]\n\n\t\t\tpayload_copy = self.payload.clone\n\t\t\tpayload_copy.set_encoding( 'binary' )\n\t\t\tpayload_copy.rewind\n\n\t\t\titer = self.make_header.each_byte + payload_copy.each_byte\n\n\t\t\treturn iter unless block\n\t\t\treturn iter.each( &block )\n\t\tend", "def body(&block)\n call_once\n if block_given?\n yield body\n else\n @body\n end\n end", "def read(&block)\n Dir.mktmpdir(File.join(\"Amylase-#{UUID.new.generate}\"), Dir.tmpdir) do |tmpdir|\n tmp_filename = File.join(tmpdir, @data_source.name)\n\n File.open(tmp_filename, 'wb') do |file|\n @s3_obj.read do |chunk|\n file.write(chunk)\n end\n end\n\n File.open(tmp_filename) do |file|\n file.each_line do |line|\n yield line\n end\n end\n end\n end", "def each &block\n @parts.each(&block)\n end", "def <<(asset)\n\t\t\tadd(asset)\n\t\tend", "def blocks\n @blocks ||= ArkEcosystem::Client::API::Blocks.new(@client)\n end", "def find_files(block)\n files = []\n block.scan(URL_PATTERN).each do |attribute, path|\n if !URI.parse(path).absolute?\n resource = create_resource_file(attribute, path)\n files << resource if resource\n end\n end\n files\n end", "def create(source, metadata = nil, &block)\n Asset.create(source, metadata) do |asset, error|\n if asset\n block.call(asset, error)\n self << asset\n else\n raise \"Asset creation failed. #{error}\"\n end\n end\n end", "def add_asset(asset)\n @al_asset_group.addAsset(asset.al_asset)\n end", "def add_multipart_body(parts)\n body = []\n body << \"--#{BOUNDARY}\\r\\n\"\n parts.each do |property, value|\n body << \"Content-Disposition: form-data; name=\\\"#{property}\\\"\\r\\n\\r\\n#{value}\"\n body << \"\\r\\n--#{BOUNDARY}\\r\\n\"\n end\n @body = body.join\n @headers[\"Content-Type\"] = \"multipart/form-data; boundary=#{BOUNDARY}\"\n end", "def blocks\n @blocks ||= Array(@grpc.blocks).map do |b|\n Block.from_grpc b\n end\n end", "def each(&block)\n @buffer.each(&block)\n end", "def each_item\n self.file.state.items.each_pair do |identifier, path|\n yield Item::new(self, identifier, path)\n end\n end", "def get_chunk(object)\n chunk_headers = get_block_data(object, /<</, />>/, 2)\n\n return { :header => chunk_headers[0], :data => get_stream_data(object) } unless(chunk_headers.empty?)\n end", "def push_block_with_to_json(host_item,block_hash,batch_arr)\r\n tmp_hash = { host_to: host_item['host'], port_to: host_item['port'], format_to: 'json' }.merge(block_hash[:filebot] || {})\r\n block_hash[:filebot] = tmp_hash\r\n batch_arr.push(block_hash.to_json) rescue nil\r\n end", "def each(&block)\n # Actual implementation is in PageableResponse::Extension\n end", "def assets\n @assets ||= []\n end", "def each(partition=nil, &block)\n if partition.nil?\n index.each do |id, info|\n yield find(id)\n end\n else\n S3Object.stream(File.join(basedir, p), bucket_name) do |f|\n until f.eof?\n yield Marshal.load(f)\n end\n end\n end\n end", "def render\n parts.map(&:content)\n end", "def process_esi(body, env)\n body.gsub!(/<esi:remove>.*?<\\/esi:remove>|<esi:comment[^>]*\\/>|\\s*xmlns:esi=(\"[^\"]+\"|'[^']+')/, '')\n body.gsub!(/<esi:include([^>]*)(\\/>|>\\s*<\\/esi:include>)/) do\n attr = attributes($1)\n raise ArgumentError, 'esi:include misses src attribute' if attr['src'].to_s.empty?\n fragment_status, fragment_header, fragment_body = get_fragment(env, attr['src'])\n if fragment_status != 200 && !attr['alt'].to_s.empty?\n fragment_status, fragment_header, fragment_body = get_fragment(env, attr['alt'])\n if fragment_status != 200\n raise RuntimeError, \"esi:include failed to include alt fragment #{attr['alt']} (Error #{fragment_status})\" if attr['onerror'] != 'continue'\n end\n end\n if fragment_status != 200\n raise RuntimeError, \"esi:include failed to include fragment #{attr['src']} (Error #{fragment_status})\" if attr['onerror'] != 'continue'\n else\n join_body(fragment_body)\n end\n end\n body\n end", "def each_asset\n assets.each do |(path, destination)|\n path = path.to_s\n if destination == :root\n yield path, File.join(output_directory.to_s, File.basename(path))\n else\n yield path, File.join(output_directory.to_s, destination.to_str)\n end\n end\n end", "def archive(name, &block)\n @archives << Archive.new(self, name, &block)\n end", "def block\n (@blocks ||= Array.new) << Block.new\n @in_block = @blocks.last\n yield\n @in_block = nil\n end", "def add_each(collection, &block)\n raise ArgumentError, \"Code block expected\" if not block\n\n collection.each do |v|\n self << yield(v)\n end\n\n # This is IMPORTANT.\n self\n end", "def blocks; end", "def blocks; end", "def blocks; end", "def write(block)\n @filemgr.write(block, @contents)\n end", "def each\r\n @content_type::find(@credentials, to_s).each do |item|\r\n yield item\r\n end\r\n end", "def assets=(_arg0); end", "def assets=(_arg0); end", "def assets=(_arg0); end", "def each\r\n\t\t\t@contents.each do |item|\r\n\t\t\t\tyield item\r\n\t\t\tend\r\n\t\tend", "def parse_bundle_collection(body)\n dom = parse_and_validate_response(body, :root_name => 'bundles')\n dom.root.elements.collect('bundle') { |xml| Bundle.from_rexml(xml) }\n end", "def each_object (&block)\n\n each_object_path do |path|\n block.call(load_object(path))\n end\n end", "def finish(*args, &block)\n self['Content-Type'] ||= 'text/html;charset=utf-8'\n @block = block if block\n if [204, 205, 304].include?(status.to_i)\n header.delete \"Content-Type\"\n header.delete \"Content-Length\"\n close\n [status.to_i, header, []]\n else\n [status.to_i, header, body]\n end\n end", "def parts\n body.parts\n end", "def each(*args, &block)\n @body.each(*args, &block)\n ensure\n unless @closed\n @closed = true\n @block.call\n end\n end", "def parse\n @chunks = parse_chunks extract_chunks decode_blob @blob\n end", "def register_block_for(type, &blk); end", "def add_assets\n num_files = params[:count].to_i\n \n @new_assets = []\n @new_assets_html = []\n num_files.times do |file_num|\n # recreate the file key from the current index\n file = params[\"file-\"+file_num.to_s]\n @asset = Asset.new(:name => file.original_filename)\n @asset.save\n @asset.save_file(file)\n \n @new_assets.push(@asset)\n # render the html to add to the page for the json response\n asset_html = render_to_string :partial => \"shared/asset.html.haml\", :locals => { :asset => @asset }\n @new_assets_html.push(asset_html)\n end\n\n respond_to do |format|\n format.html { redirect_to assets_url, notice: 'Asset was successfully created.' }\n format.json { render json: {:assets => @new_assets, :assets_html => @new_assets_html, status: :created} }\n end\n\n end", "def add_room_block_to_list(room_block)\n raise ArgumentError.new('Not a valid reservation.') if room_block.class != Hotel::RoomBlock\n @room_blocks << room_block\n end", "def each(&block)\n @data.each do |attrs|\n yield @resource_class.new(attrs)\n end\n end", "def body\n @body ||= begin\n body = \"\"\n while chunk = readpartial\n body << chunk\n end\n body\n end\n end", "def attachments=(atts)\n atts.each do |attachment|\n if attachment[:id].blank?\n assets.build(attachment)\n else\n asset = assets.detect { |a| a.id == attachment[:id].to_i }\n end\n end \n end" ]
[ "0.5990316", "0.5804937", "0.5588729", "0.5574627", "0.52904314", "0.52704626", "0.5260081", "0.52489793", "0.52157116", "0.52052265", "0.51670265", "0.5096708", "0.5043923", "0.50391364", "0.5013054", "0.5008791", "0.50025827", "0.49947733", "0.49847922", "0.49540085", "0.49138433", "0.49045232", "0.49005458", "0.4876918", "0.48715994", "0.48661345", "0.48634562", "0.48522973", "0.4834347", "0.48319232", "0.4814111", "0.48053646", "0.4788256", "0.47576845", "0.47540644", "0.4750415", "0.4746008", "0.47439054", "0.47419637", "0.47362405", "0.4728518", "0.47149616", "0.47143316", "0.47097552", "0.47029302", "0.4696973", "0.46949583", "0.46947616", "0.468637", "0.46788085", "0.46746647", "0.46740183", "0.4652834", "0.46350706", "0.46344012", "0.46238035", "0.45864272", "0.45860183", "0.45843363", "0.4583617", "0.4581001", "0.4580633", "0.4580488", "0.45776147", "0.45767617", "0.4572575", "0.45698708", "0.45585474", "0.45576766", "0.45492294", "0.45420545", "0.4540884", "0.45388716", "0.45274758", "0.45204458", "0.45156497", "0.4511331", "0.45073164", "0.45015854", "0.44963205", "0.4495715", "0.4495715", "0.4495715", "0.4492684", "0.44886526", "0.4482765", "0.4482765", "0.4482765", "0.4482518", "0.44709063", "0.44649878", "0.4462611", "0.4462004", "0.44613668", "0.44560963", "0.44525403", "0.44524744", "0.4452157", "0.44463223", "0.44461483", "0.4440775" ]
0.0
-1
Deprecated: Save asset to disk. filename String target Returns nothing.
def write_to(filename) FileUtils.mkdir_p File.dirname(filename) PathUtils.atomic_write(filename) do |f| f.write source end nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save! target=\"./Videos of me\"\n filename = File.join(target, \"#{@name}#{File.extname(@url)}\")\n\n data = Faceoff.download(@url)\n\n Faceoff.safe_save(filename) do |file|\n file.write data\n end\n end", "def save_as(filename = T.unsafe(nil)); end", "def save_as(filename = T.unsafe(nil)); end", "def save_as(filename = T.unsafe(nil)); end", "def save(filename = T.unsafe(nil)); end", "def save(filename = T.unsafe(nil)); end", "def save!(filename = T.unsafe(nil)); end", "def save!(filename = T.unsafe(nil)); end", "def save filename = nil\n filename = find_free_name filename\n save! filename\n end", "def write_to_target target, format_string, **opts\n raise Vips::Error, \"filename is nil\" if format_string.nil?\n filename = Vips.p2str(Vips.vips_filename_get_filename(format_string))\n option_string = Vips.p2str(Vips.vips_filename_get_options(format_string))\n saver = Vips.vips_foreign_find_save_target filename\n raise Vips::Error if saver.nil?\n\n Vips::Operation.call saver, [self, target], opts, option_string\n write_gc\n end", "def save! target=\"./Notes\"\n filename = File.join(target, \"#{@title}.txt\")\n\n Faceoff.safe_save(filename) do |file|\n file.write self.to_s\n end\n end", "def save_file\n if Rails.configuration.file_storage_method == \"fs\"\n FileSaver.save_to_fs annotation.uuid, path, content\n elsif Rails.configuration.file_storage_method == \"s3\"\n FileSaver.save_to_s3 annotation.uuid, path, content\n else\n raise \"Illegal file storage method #{Rails.configuration.file_storage_method}\"\n end\n end", "def save_to_disk url, target_name\n from_url = URI.parse url\n Net::HTTP.start(from_url.host) do |http|\n resp = http.get(from_url.path)\n open(target_name, \"wb\") do |file|\n begin\n file.write(resp.body)\n rescue => err # FIXME don't fail on failed write (OTOH it's better it have no image than crash the whole app)\n return nil\n end\n return target_name\n end\n end\n end", "def save_as!(filename)\n @new_filename = filename\n save!\n self\n end", "def save_to(path); end", "def save_to(directory, options = T.unsafe(nil)); end", "def save(filename)\n File.open(filename,'w') { |file| file << to_string }\n end", "def save_as( url, dest )\n\t\tself.out \"save_as\"\n\t\tto = @code + dest\n\t\tself.out \" :#{to}\"\n\t\t#if !@isTest\n\t\t\t# If file exists - for saving resource of HD\n\t\t\t# we delete it - we don't need copies \n\t\t\tif File.exist? to\n\t\t\t\tFile.delete to\n\t\t\tend\n\t\t\t# Save as - use HTTP.GET\n\t\t\t@agent.get( url ).save_as to\n\t\t#end\n\t\tself.out \" #{url} to #{dest}\"\n\tend", "def save(filename)\n File.write(filename, self.to_s)\n end", "def save_file(file, name = '')\n save_attachment(file, name)\n end", "def save(sourcepath, filename, host)\n saved_file_name = calculate_file_name(sourcepath, filename)\n destination_path = destination('host' => host)\n\n # The path is set dynamically based on host name and time\n # make sure it exists if not create it\n FileUtils.mkdir_p(destination_path) unless Dir.exists?(destination_path)\n\n FileUtils.mv(sourcepath, File.join(destination_path, saved_file_name))\n end", "def save_as(filename)\n dup.save_as!(filename)\n rescue FileNotSaved\n nil\n end", "def save(filename = nil, compact = false)\n\t\tend", "def url_to_asset(source, options = T.unsafe(nil)); end", "def save(overwrite=true)\n write_file(overwrite, @filename)\n end", "def save_to_disk(data, filename)\n return nil if data.nil?\n\n dest_file = File.join(tmp_dir, filename)\n FileUtils.rm_f(dest_file) # in case we wrote and aborted previously\n data.save_as(dest_file)\n SouvlakiRS.logger.info \" File saved: #{dest_file}\"\n dest_file\n end", "def save(flatten = false)\n tmp_file = SecureRandom.uuid\n save_as(tmp_file, flatten)\n File.rename tmp_file, @file\n end", "def save_as(filename)\n document.render_file(filename)\n end", "def save_file\n if self.file then\n self.file.save\n end\n end", "def save! target=\"./Albums\"\n dirname = File.join target, @name\n FileUtils.mkdir_p dirname\n\n self.photos{|p| p.save! dirname}\n end", "def save(name = nil)\n puts \"Downloading from #{@url}\"\n name = File.basename(@url) if name.nil?\n open(name, 'wb') do |file|\n file << open(@url).read\n end\n name\n end", "def save(filename=@filename)\n backup_filename = filename + '~'\n File.delete(backup_filename) if File.exist? backup_filename\n FileUtils.mv(filename, backup_filename)\n File.open(filename, 'w') do |f|\n f.puts @header\n f.puts @body\n f.puts @gem_dependencies\n f.puts @dev_dependencies\n f.puts @footer\n end\n end", "def save(filename)\n writeln(\"save '#{filename}'\")\n end", "def file(target, options={})\n target = relative_path(target)\n \n if block_given?\n io = StringIO.new\n yield(io)\n preview[target] = io.string\n end\n \n target\n end", "def write_to_file(target=nil, maintain_keys=false)\n save_to = target.nil? ? file_path : target\n keys_to_write = maintain_keys ? keys_from_file(save_to) : keys\n Translate::File.new(save_to).write(keys_to_write)\n end", "def to_actual_filename!\n filename = to_actual_filename\n replace(filename) if filename\n end", "def save!; File.write @path, @data end", "def save fname, options={}\n File.open(fname,\"wb\"){ |f| f << export(options) }\n end", "def save(src_file, dst_file)\n src_file.save_and_close\n dst_file.save_and_close\n end", "def save(options = {})\n save_to(@path, options)\n end", "def save_as(file)\n File.open(file, \"wb\") { |f| f.write to_s }\n end", "def save_as(file)\n File.open(file, \"wb\") { |f| f.write to_s }\n end", "def save_as(name)\n File.open(name, \"wb\") { |f| f.write self.render }\n end", "def write(filename = target)\n FileUtils.mkdir_p File.dirname(filename)\n PathUtils.atomic_write(filename) do |f|\n yield f\n end\n end", "def target_filename\n raise NotImplementedError, \"Must be overridden by a subclass\"\n end", "def save(flatten: false)\n tmp_file = SecureRandom.uuid\n save_as(tmp_file, flatten: flatten)\n File.rename tmp_file, @file_path\n end", "def write_file!\n file = File.new( path, \"w\")\n \n file.write(@source)\n file.close\n end", "def save_to_file(filename)\n File.open(filename, 'w'){|f| f.write(string)}\n end", "def save_to_storage\n if save_attachment?\n # TODO: This overwrites the file if it exists, maybe have an allow_overwrite option?\n FileUtils.mkdir_p(File.dirname(full_filename))\n File.cp(temp_path, full_filename)\n File.chmod(attachment_options[:chmod] || 0644, full_filename)\n end\n @old_filename = nil\n true\n end", "def touch(filename)\n File.open(filename, 'w') {}\n end", "def save_to_file(path = nil)\n content\n file = Store::File.find_by(id: store_file_id)\n if !file\n raise \"No such file #{store_file_id}!\"\n end\n\n if !path\n path = Rails.root.join('tmp', filename)\n end\n ::File.open(path, 'wb') do |handle|\n handle.write file.content\n end\n path\n end", "def save_to_file\n f = File.open(\"#{IMAGE_DATA_DIR}/#{self.id}\",\"w\")\n f.write(self.data)\n f.close\n end", "def save\n pathname.open('w') { |file| file.write(data) }\n end", "def save_to_file(data, destination)\n path = File.join(file_dir, destination)\n File.write(path, data)\nend", "def save_to_file(filename)\n File.open(filename, 'w') { |f| f.write(string) }\n end", "def make_file\n\t\t$filename = params.find(:disname)\n\t\t`rm #$filename`\n\tend", "def saveScreenshot(filename=nil, hidePatientDetails=false)\n if filename.nil?\n filename = @fileNameTextField.getText\n else\n # Enter the filename in the text field\n @fileNameTextField.enterText(filename)\n end\n\n \tLog.TestLog(\"Saving screenshot to '#{filename}.png'\")\n \tcheckHideDetails if hidePatientDetails\n \tclickSave\n end", "def write(string, filename)\n Util::FileMutation.write(string, filename)\n end", "def write_to_file name, **opts\n raise Vips::Error, \"filename is nil\" if name.nil?\n\n filename = Vips.p2str(Vips.vips_filename_get_filename(name))\n option_string = Vips.p2str(Vips.vips_filename_get_options(name))\n saver = Vips.vips_foreign_find_save filename\n raise Vips::Error if saver.nil?\n\n Vips::Operation.call saver, [self, filename], opts, option_string\n\n write_gc\n end", "def save(data)\n File.open(@local_file_path, \"wb\") {|file| file.write(data) }\n end", "def save_impl(format, file)\n ImageIO.write(@src, format, file)\n end", "def replace_file(file, target)\n LOGGER.info \"Replacing #{file}\".blue\n system %(rm -rf \"#{target}\")\n link_file(file, target)\nend", "def save_img(filename)\n @img.save(filename, :fast_rgb)\n end", "def save!(file=nil)\n file = file || dotruby_file\n dotruby.save!(file)\n return file\n end", "def write_to_file(filename)\n Audio.write_to_file(@audio, filename)\n end", "def save! path\n File.open(path, 'w') do |file|\n file.write(to_s)\n end\n end", "def save!\n delete_file\n save\n end", "def save_file\n FileUtils.mkdir_p(File.dirname(full_filename))\n FileUtils.cp(temp_path, full_filename)\n FileUtils.chmod(0644, full_filename)\n end", "def write_swap_file(filename, decoded_image)\n\n f = File.new \"./public/swap/#{filename}\", \"wb\"\n # f = File.new \"../public/swap/#{filename}\", \"wb\" # inline testing path\n f.write(decoded_image)\n f.close if f\n\nend", "def write_swap_file(filename, decoded_image)\n\n f = File.new \"./public/swap/#{filename}\", \"wb\"\n # f = File.new \"../public/swap/#{filename}\", \"wb\" # inline testing path\n f.write(decoded_image)\n f.close if f\n\nend", "def write_to_buffer format_string, **opts\n raise Vips::Error, \"filename is nil\" if format_string.nil?\n filename = Vips.p2str(Vips.vips_filename_get_filename(format_string))\n option_string = Vips.p2str(Vips.vips_filename_get_options(format_string))\n\n # try to save with the new target API first, only fall back to the old\n # buffer API if there's no target save for this filetype\n saver = nil\n if Vips.at_least_libvips?(8, 9)\n Vips.vips_error_freeze\n saver = Vips.vips_foreign_find_save_target filename\n Vips.vips_error_thaw\n end\n\n if !saver.nil?\n target = Vips::Target.new_to_memory\n Vips::Operation.call saver, [self, target], opts, option_string\n buffer = target.get(\"blob\")\n else\n saver = Vips.vips_foreign_find_save_buffer filename\n raise Vips::Error if saver.nil?\n\n buffer = Vips::Operation.call saver, [self], opts, option_string\n raise Vips::Error if buffer.nil?\n end\n\n write_gc\n\n buffer\n end", "def export(filename)\n @image.save(filename, interlace: true)\n end", "def saveDistantFile buffer, args, response\n unless buffer.serverSide\n response.status = Constant::ServerFile\n return Constant::Fail\n end\n begin\n f = File.new buffer.fileLocation \"w\"\n rescue\n response.status = PathError\n return Constant::Fail\n end\n f.write buffer.to_file\n f.close\n Constant::Success\n end", "def save(target_url:, slug: nil)\n slug = slug.blank? ? next_slug : slug.parameterize\n\n unless save_target_url(slug, target_url)\n fail(Errors::SlugAlreadyTaken, slug)\n end\n\n to_url(slug, target_url)\n end", "def set_name\n self.name = self.asset.original_filename\n end", "def save_file path, content\n\t\t\t\tif @fix\n\t\t\t\t\tcontent = content.gsub \"url('/\", \"url('\"\n\t\t\t\t\tcontent = content.gsub 'src=\"/', 'src=\"'\n\t\t\t\t\tcontent = content.gsub 'href=\"/', 'href=\"'\n\t\t\t\tend\n\t\t\t\tFile.open(path, 'w+') { |f| f.puts content }\n\t\t\tend", "def save(merge = T.unsafe(nil), file = T.unsafe(nil)); end", "def save(merge = T.unsafe(nil), file = T.unsafe(nil)); end", "def save_file\n raise ArgumentError, 'Need a Path to save the file' if @path.nil?\n File.open(@path, 'w') do |f|\n f.write to_s\n end\n end", "def write_swap_file(filename, decoded_image)\n\n f = File.new \"./public/swap/#{filename}\", \"wb\"\n f.write(decoded_image)\n f.close if f\n\n end", "def export\n ensure_exists(filename)\n puts 'Not implemented yet'\n end", "def export\n ensure_exists(filename)\n puts 'Not implemented yet'\n end", "def save!\n path = File.join(basedir, computed_filename)\n Rails.logger.info \"Saved GPX file as #{path}\"\n file = File.new(path, 'wb')\n file.write contents\n file.close\n file\n end", "def save! filename = nil\n filename ||= @filename\n dirname = File.dirname filename\n FileUtils.mkdir_p dirname\n\n ::File.open(filename, 'wb')do |io|\n until @body_io.eof? do\n io.write @body_io.read 16384\n end\n end\n\n filename\n end", "def savevid\n tmp = params[:vids][:video].tempfile\n #require 'ftools'\n file = File.join(\"app/assets/videos\", params[:vids][:video].original_filename) # use public if you want\n FileUtils.cp tmp.path, file\n\n redirect_to \"/admin\"\nend", "def save klass, filename\n fp = File.open(filename, 'w')\n Marshal.dump(klass, fp)\n fp.close\n end", "def save klass, filename\n fp = File.open(filename, 'w')\n Marshal.dump(klass, fp)\n fp.close\n end", "def save(filename = nil)\n filename ||= @file\n\n File.open(filename, \"w\") do |f|\n f << generate_xml\n end\n end", "def save_and_close( filename = clean_name )\n result.parent.export filename\n end", "def save_to(filepath)\n File.open(filepath, \"w\") do |fp|\n fp.write(self.to_s)\n end\n end", "def save_external_video_locally\n #self.save_file_locally\n end", "def save(output_path=nil)\n to_output_path(output_path)\n run_command(@command,*@args << @input)\n @info = FlashTool.flash_info(@output_path)\n end", "def set_file_for_remote_storage\n set_resource_mounter_file open(original_resource_mounter.url)\n end", "def to_file\n \"#{@name};#{@id}\"\n end", "def save\n if has_upload?\n @asset = Ingest::AssetFileAttacher.call(@asset, @upload)\n end\n\n @asset.save\n end", "def asset_url(source, options = T.unsafe(nil)); end", "def save!\n begin\n case filename\n when STDOUT_FLAG\n $stdout.write(contents)\n else\n ::File.open(@filename,\"w\") do |f|\n f.write(contents)\n end\n end\n @dirty = false\n rescue => e\n raise FileAccessError, \"Error saving file #{@filename} : #{e.message}\"\n end\n end", "def write\n io_or_file = filename || self.class.default_filename\n return io_or_file.write(fetch) if io_or_file.respond_to?(:write)\n open(io_or_file, \"wb+\") { |io| io.write(fetch) }\n end", "def save_to_filename(filename)\n File.open(filename, 'w+') do |f|\n self.data_stream do |chunk|\n f.write chunk\n end\n end\n true\n end", "def save(filename, data)\n\tf = File.open(filename, 'w')\n\tf.puts(data)\n\tf.close\nend" ]
[ "0.6649109", "0.6575976", "0.6575976", "0.6575976", "0.64619476", "0.64619476", "0.6323391", "0.6323391", "0.63100094", "0.6243263", "0.6023157", "0.59358555", "0.5926779", "0.5908261", "0.569015", "0.56778485", "0.5574059", "0.5555435", "0.5550762", "0.5545969", "0.5520001", "0.5513167", "0.55103433", "0.55040014", "0.54609805", "0.54209155", "0.5414483", "0.5398799", "0.53791547", "0.5369951", "0.5367564", "0.5364928", "0.5364417", "0.53608984", "0.53550774", "0.53498495", "0.5269724", "0.52666724", "0.5259224", "0.52068144", "0.52025634", "0.52025634", "0.5200333", "0.5198074", "0.5188562", "0.51866573", "0.5179876", "0.51526225", "0.51411486", "0.51402926", "0.51317924", "0.5120706", "0.5106115", "0.510074", "0.50989854", "0.5097061", "0.50867647", "0.5078242", "0.5070751", "0.50429904", "0.5034206", "0.5029439", "0.50292075", "0.5014833", "0.5012597", "0.5004249", "0.49771217", "0.49749905", "0.49655727", "0.49655727", "0.49648067", "0.49491552", "0.49427503", "0.49414065", "0.4940356", "0.49381715", "0.49229717", "0.4922648", "0.49215558", "0.49169895", "0.49135497", "0.49135497", "0.4907443", "0.4896686", "0.4887174", "0.4884653", "0.4884653", "0.48835188", "0.48808104", "0.48789465", "0.48751536", "0.48742813", "0.4868903", "0.48670784", "0.48651907", "0.48620823", "0.48602325", "0.48581845", "0.48567706", "0.48464283" ]
0.55236053
20
Public: Pretty inspect Returns String.
def inspect "#<#{self.class}:#{object_id.to_s(16)} #{uri.inspect}>" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s()\n prettify()\n end", "def to_s\r\n pretty_output\r\n end", "def to_pretty\n to_s(:prettyprint => true)\n end", "def pretty_inspect\n self.inspect\n end", "def to_s\n PrettyPrinter.new.process(to_sexp)\n end", "def inspect\n pretty.uncolor\n end", "def pretty\n regex = /\"[A-z]?\"$/\n self.pretty_inspect.lines.reject { |l| l =~ regex }.join\n end", "def pretty(indent = ' ')\n io = StringIO.new\n pretty_print(io, 0, indent)\n io.string\n end", "def inspect\n redacted_string(:inspect)\n end", "def inspect\n redacted_string(:inspect)\n end", "def to_s\n pretty.uncolor.gsub(/(\\s*\\n)+/, \" \").gsub(/\\s{2,}/, \" \")\n end", "def prettify(str); end", "def inspect; to_s; end", "def inspect; to_s; end", "def inspect; to_s; end", "def inspect; to_s; end", "def inspect; to_s; end", "def to_s\n JSON.pretty_generate(raw)\n end", "def inspect\n\t\tcontents = ''\n\t\tif self.parsed?\n\t\t\tcontents = %{\"%s\"/%d linkages/%d nulls} % [\n\t\t\t\tself.to_s,\n\t\t\t\tself.num_linkages_found,\n\t\t\t\tself.null_count,\n\t\t\t]\n\t\telse\n\t\t\tcontents = \"(unparsed)\"\n\t\tend\n\n\t\treturn \"#<%s:0x%x %s>\" % [\n\t\t\tself.class.name,\n\t\t\tself.object_id / 2,\n\t\t\tcontents,\n\t\t]\n\tend", "def inspect\n Thread.current[:formatador] ||= Formatador.new\n data = \"#{Thread.current[:formatador].indentation}<#{self.class.name}\"\n Thread.current[:formatador].indent do\n unless self.instance_variables.empty?\n vars = self.instance_variables.clone\n vars.delete(:@client)\n vars.delete(:@page)\n data << \" \"\n data << vars.map { |v| \"#{v}=#{instance_variable_get(v.to_s).inspect}\" }.join(\", \")\n end\n end\n data << \" >\"\n data\n end", "def pretty v\n if v.respond_to? :call\n \"<code>\"\n else\n v.inspect\n end\n end", "def debug(object)\n puts \"<pre>\"\n puts object.pretty_inspect.gsub('<', '&lt;').gsub('>', '&gt;')\n puts \"</pre>\"\nend", "def result_to_string(object)\n if object.is_a?(String) then\n return object\n else\n if defined?(awesome_inspect)\n return object.awesome_inspect({:plain=>true, :index=>false})\n elsif defined?(pretty_inspect)\n return object.pretty_inspect.chomp # Remove new line that PrettyInspect adds at the end https://www.ruby-forum.com/topic/113429\n else\n return object.inspect\n end\n end\n end", "def to_s\n inspect.to_s\n end", "def inspect\n \"\"\n end", "def pretty(object)\n PP.pp(object, out)\n end", "def inspect\n `return '\"' + self + '\"';`\n end", "def to_s\n inspect\n end", "def to_s\n inspect\n end", "def debug_str(inspect_method = :inspect)\n \"Current Date: #{self.input_date.readable}\\nCurrent Time: #{self.input_time.readable}\\n\\nQuery: #{self.query}\\nStandardized Query: #{self.nlp_query}\\nQuery changed in: #{self.nlp_query.changed_in.inspect}\\n\\nConstructs Found: #{s = \"\\n\"; self.construct_finder.constructs.each{|x| s << x.send(inspect_method) + \"\\n\"}; s}\\n\\n@construct_interpreter: #{self.construct_interpreter.send(inspect_method)}\"\n end", "def dumpAsString\n\t\tmarkup = \"\"\n\t\t@Value.each do |line|\n\t\t\tmarkup += \"#{line}<br />\\n\"\n\t\tend\n\t\treturn markup\n\tend", "def debug_out()\n return JSON.pretty_generate(self).gsub(\"\\\": \", \"\\\" => \").gsub(\" => null\", \" => nil\")\n end", "def pretty_print pp\n pp.pp eval(self.asPPString)\n end", "def pretty_print pp\n pp.pp eval(self.asPPString)\n end", "def to_s\n inspect\n end", "def inspect\n Thread.current[:formatador] ||= Formatador.new\n data = \"#{Thread.current[:formatador].indentation}<#{self.class.name}\"\n Thread.current[:formatador].indent do\n unless self.instance_variables.empty?\n vars = self.instance_variables.clone\n vars.delete(:@client)\n data << \" \"\n data << vars.map { |v| \"#{v}=#{instance_variable_get(v.to_s).inspect}\" }.join(\", \")\n end\n end\n data << \" >\"\n data\n end", "def prettify(obj)\n # Most look best with pretty_inspect\n str = obj.pretty_inspect\n # Mashes need to be first converted to Hashes then pretty_inspect\n if obj.kind_of? Mash\n str = obj.to_hash.pretty_inspect\n end\n # For Arrays, pretty_inspect displays one value per line which\n # uses up too much real estate\n if obj.kind_of? Array\n str = obj.inspect\n end\n # Manually format Hashes so keys and values each display in columns\n if obj.kind_of? Hash\n key_length = 0\n obj.keys.each do |key|\n key_length = key.length if key.length > key_length\n end\n buf = []\n obj.each do |key,value|\n buf << sprintf(\"%-#{key_length}.#{key_length}s => %s\", key, value)\n end\n str = buf.join(\"\\n\")\n end\n str\n end", "def inspect\n Thread.current[:formatador] ||= Formatador.new\n data = \"#{Thread.current[:formatador].indentation}<#{self.class.name}\"\n Thread.current[:formatador].indent do\n unless self.instance_variables.empty?\n vars = self.instance_variables.clone\n vars.delete(:@client)\n data << \"\\n\"\n data << vars.map { |v| \"#{v}=#{instance_variable_get(v.to_s).inspect}\" }.join(\",\\n#{Thread.current[:formatador].indentation}\")\n end\n end\n data << \"\\n#{Thread.current[:formatador].indentation}>\"\n data\n end", "def pretty_print_me\n sio = PP.pp(self, \"\")\n\n # aber bitte ohne die ids und ohne @\n sio.gsub(/0x[^\\s]*/,'').gsub(/@/,'')\n end", "def pretty \n @pretty = true \n end", "def pretty \n @pretty = true \n end", "def inspect\n to_s\n end", "def inspect\n to_s\n end", "def inspect\n to_s\n end", "def inspect\n to_s\n end", "def inspect\n to_s\n end", "def inspect\n to_s\n end", "def inspect\n to_s\n end", "def inspect\n ss = @stack.map {|step| \"#{step[0]} #{LS.stringify step[1]}\"}\n return \"#<#{ss.join \"\\n\\t\"}>\"\n end", "def pretty_output\n JSON.pretty_generate(output)\n end", "def inspect\n original_inspect = super\n original_inspect.split( ' ' ).first << '>'\n end", "def inspect\n original_inspect = super\n original_inspect.split( ' ' ).first << '>'\n end", "def inspect\n original_inspect = super\n original_inspect.split( ' ' ).first << '>'\n end", "def inspect\n\t\tparts = []\n\t\tparts += self.tags.map {|t| \"##{t}\" }\n\t\tparts += self.bookmarks.map {|b| \"@#{b}\" }\n\n\t\treturn \"#<%p:#%x %s {%s} %p%s>\" % [\n\t\t\tself.class,\n\t\t\tself.object_id * 2,\n\t\t\tself.changeset,\n\t\t\tself.date,\n\t\t\tself.summary,\n\t\t\tparts.empty? ? '' : \" \" + parts.join(' ')\n\t\t]\n\tend", "def to_pretty\r\n\t\t\ta = dup\r\n\t\t\ts = \"\"\r\n\t\t\ta.each_with_index {|i, ind|\r\n\t\t\t\ta[ind].each_with_index {|ii, iind|\r\n\t\t\t\t\ta[ind][iind].each_with_index {|iii, iiind|\r\n\t\t\t\t\t\ts << iii\r\n\t\t\t\t\t\ts << \" &\\n\" unless (iiind == (a[ind][iind].size - 1))\r\n\t\t\t\t\t}\r\n\t\t\t\t\ts << \"\\n| \" unless iind == (a[ind].size - 1)\r\n\t\t\t\t}\r\n\t\t\t\ts << \" ;\\n\\n\" unless ind == (a.size - 1)\r\n\t\t\t}\r\n\t\t\treturn s\r\n\t\tend", "def to_s\n render().join \"\\n\"\n end", "def inspect(indent=\"\")\n em = extension_modules\n interesting_methods = self.interesting_methods\n im = interesting_methods.size > 0 ? \" (#{interesting_methods.join(\",\")})\" : \"\"\n tv = text_value\n tv = \"...#{tv[-20..-1]}\" if tv.size > 20\n\n indent +\n self.class.to_s.sub(/.*:/,'') +\n em.map{|m| \"+\"+m.to_s.sub(/.*:/,'')}*\"\" +\n \" offset=#{interval.first}\" +\n \", #{tv.inspect}\" +\n im + \" [#{terminal?}]\" +\n (elements && elements.size > 0 ?\n \":\" +\n (@elements||[]).map{|e|\n begin\n \"\\n\"+e.inspect(indent+\" \")\n rescue # Defend against inspect not taking a parameter\n \"\\n\"+indent+\" \"+e.inspect\n end\n }.join(\"\") :\n \"\"\n )\n end", "def pretty\n s = \"\"\n self.fields.each do |f|\n unless (f.name == \"payload\")\n s += \"#{f.name}=#{self.send(f.name)} \"\n end\n end\n s.gsub(/ $/, '')\n end", "def to_s\n redacted_string(:to_s)\n end", "def to_s\n redacted_string(:to_s)\n end", "def prettify\n @code.gsub(/(.{4})/, '\\1 ').strip\n end", "def inspect\n to_s\n end", "def inspect\n to_s\n end", "def inspect\n to_s \n end", "def inspect\n to_s.inspect\n end", "def inspect\n str = self.to_s\n str << \"\\n-------------------------------------------------------\\n\"\n str << \"Algorithms:\\n\"\n @algorithms.each do |a|\n str << a.inspect()\n end\n\n return str\n end", "def pretty(arg)\n return puts arg if arg.instance_of?(String)\n puts JSON.pretty_generate(arg)\nend", "def inspect\n inspected = super\n\n # Only show last 4 of token, secret\n if @access_token\n inspected = inspected.gsub! @access_token, \"#{'*'*8}#{@access_token[8..-1]}\"\n end\n if @consumer_secret\n inspected = inspected.gsub! @consumer_secret, \"#{'*'*8}#{@consumer_secret[8..-1]}\"\n end\n\n inspected\n end", "def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end", "def pretty\n out = ''\n\n self.each do |line|\n out << line.line + ' : ' + line.commit + \"\\n\"\n out << ' ' + line.summary + \"\\n\"\n out << \" author:\\n\"\n out << ' ' + line.author + \"\\n\"\n out << ' ' + line.author_email + \"\\n\"\n out << ' @ ' + line.author_timestamp + \"\\n\"\n out << ' ' + line.author_timezone + \"\\n\"\n out << \"\\n\"\n out << \" committer:\\n\"\n out << ' ' + line.committer + \"\\n\"\n out << ' ' + line.committer_email + \"\\n\"\n out << ' @ ' + line.committer_timestamp + \"\\n\"\n out << ' ' + line.committer_timezone + \"\\n\"\n out << \"\\n\"\n end\n\n out\n end", "def pretty_format(value)\n case value\n when nil, Numeric\n value.inspect\n when Api::Record\n value.to_json(pretty: true)\n when ApiService::HtmlResultError\n value.response.body\n when Faraday::Error\n response =\n value.response.pretty_inspect\n .gsub(/\\n/, PF_NEWLINE)\n .sub(/\\A{/, PF_OPEN_BRACE)\n .sub(/}\\s*\\z/, PF_CLOSE_BRACE)\n [\n \"#<#{value.class}\",\n \"#{PF_INDENT}message = #{value.message.inspect}\",\n \"#{PF_INDENT}response = #{response}\",\n '>'\n ].join(\"\\n\")\n when Exception\n value.pretty_inspect.gsub(/@[^=]+=/, (PF_NEWLINE + '\\0'))\n else\n pretty_json(value)\n end\n end", "def to_s\n JSON.pretty_generate(@json)\n end", "def inspect\n s = ''\n @props.each do |key,val|\n s << sprintf(\"%-20.20s : %-40.40s\\n\", key.to_s, val.inspect)\n end\n s\n end", "def inspect\n to_s\n end", "def pretty\n \" Size: #{size} Blocks: #{blocks} IO Block: #{blksize} Type: #{rdev}\\n\"\\\n \"Device: #{dev} Inode: #{ino} Links: #{nlink}\\n\"\\\n \" Mode: #{prettymode}\\n\"\\\n \" Uid: #{uid} Gid: #{gid}\\n\"\\\n \"Access: #{atime}\\n\"\\\n \"Modify: #{mtime}\\n\"\\\n \"Change: #{ctime}\\n\"\n end", "def to_s\n self.inspect\n end", "def inspect\n return self.to_s\n end", "def to_s\n self.to_array.map{ |hsh| JSON.pretty_generate(hsh) }.join(\"\\n\")\n end", "def inspect\n \"(#{self})\"\n end", "def to_s\n raw\n end", "def inspect\n\t\tstr = self.to_s\n\t\tstr[-1,0] = if finished?\n\t\t\t\" finished\"\n\t\telse\n\t\t\tstats = []\n\t\t\tstats << \" status=#{ PG.constants.grep(/CONNECTION_/).find{|c| PG.const_get(c) == status} }\" if status != CONNECTION_OK\n\t\t\tstats << \" transaction_status=#{ PG.constants.grep(/PQTRANS_/).find{|c| PG.const_get(c) == transaction_status} }\" if transaction_status != PG::PQTRANS_IDLE\n\t\t\tstats << \" nonblocking=#{ isnonblocking }\" if isnonblocking\n\t\t\tstats << \" pipeline_status=#{ PG.constants.grep(/PQ_PIPELINE_/).find{|c| PG.const_get(c) == pipeline_status} }\" if respond_to?(:pipeline_status) && pipeline_status != PG::PQ_PIPELINE_OFF\n\t\t\tstats << \" client_encoding=#{ get_client_encoding }\" if get_client_encoding != \"UTF8\"\n\t\t\tstats << \" type_map_for_results=#{ type_map_for_results.to_s }\" unless type_map_for_results.is_a?(PG::TypeMapAllStrings)\n\t\t\tstats << \" type_map_for_queries=#{ type_map_for_queries.to_s }\" unless type_map_for_queries.is_a?(PG::TypeMapAllStrings)\n\t\t\tstats << \" encoder_for_put_copy_data=#{ encoder_for_put_copy_data.to_s }\" if encoder_for_put_copy_data\n\t\t\tstats << \" decoder_for_get_copy_data=#{ decoder_for_get_copy_data.to_s }\" if decoder_for_get_copy_data\n\t\t\t\" host=#{host} port=#{port} user=#{user}#{stats.join}\"\n\t\tend\n\t\treturn str\n\tend", "def inspect\n self.ast.to_s\n end", "def pretty_print_page\n pp @page\n end", "def to_s\r\n \"Tags=#{@tags.inspect} Code=#{@code.inspect}\"\r\n end", "def pretty_print\n puts `ruby -r pp -e 'pp(#{@template.inspect})'`\n end", "def short_inspect\n attrs = []\n attrs << [\"id\", id || \"new_record\"]\n\n string_attr = proc { |value| '\"' + TextHelpers.truncate(value, :length => 10) + '\"' }\n\n if respond_to?(:name) && name.present?\n attrs << [\"name\", string_attr[name]]\n elsif respond_to?(:title) && title.present?\n attrs << [\"title\", string_attr[title]]\n end\n\n \"#<#{ self.class } #{ attrs.map { |name, value| \"#{ name }: #{ value }\" }.join(\", \") }>\"\n end", "def inspect\n return \"#<#{self.class} (uninitialized)>\" if @string.nil?\n return \"#<#{self.class} fin>\" if eos?\n\n if @current.zero?\n return format(\"#<%{class} %<cur>d/%<len>d @ %{after}>\",\n class: self.class.to_s,\n cur: @current,\n len: @string.length,\n after: inspect_after.inspect)\n end\n\n format(\"#<%{class} %<cur>d/%<len>d %{before} @ %{after}>\",\n class: self.class.to_s,\n cur: @current,\n len: @string.length,\n before: inspect_before.inspect,\n after: inspect_after.inspect)\n end", "def pretty_format(text)\n begin\n textilize(text).html_safe\n rescue\n simple_format(text).html_safe\n end\n end", "def to_string\n render().join \"\\n\"\n end", "def to_s\n full\n end", "def to_s\n @string\n end", "def to_s\n @string\n end", "def to_s\n @string\n end", "def to_s\n @string\n end", "def inspect\n\t\treturn \"#<%p:%#016x %s>\" % [\n\t\t\tself.class,\n\t\t\tself.object_id * 2,\n\t\t\tself.inspect_details,\n\t\t]\n\tend", "def render\n inspect\n end", "def to_s\n @str\n end", "def to_s\n @str\n end", "def to_s\n @string\n end", "def to_s\n @string\n end", "def to_s\n @string\n end" ]
[ "0.77813023", "0.77532774", "0.75087094", "0.74502194", "0.73312813", "0.72572625", "0.72209173", "0.71229047", "0.7116847", "0.7116847", "0.7082408", "0.69985265", "0.68822056", "0.68822056", "0.68822056", "0.68822056", "0.68822056", "0.68254036", "0.6813857", "0.67518497", "0.67445606", "0.6742261", "0.6671758", "0.6632076", "0.66239727", "0.66111743", "0.66093224", "0.66013825", "0.66013825", "0.6597523", "0.6595619", "0.65722287", "0.6549628", "0.6549628", "0.6544515", "0.6535231", "0.6531339", "0.6512689", "0.6501487", "0.6476068", "0.6476068", "0.6470169", "0.6470169", "0.6470169", "0.6470169", "0.6470169", "0.6470169", "0.6470169", "0.64486724", "0.64468414", "0.642722", "0.642722", "0.642722", "0.64086056", "0.6397065", "0.63824517", "0.63815135", "0.63579184", "0.63554883", "0.63554883", "0.63519466", "0.6327425", "0.6327425", "0.6315763", "0.6300333", "0.6287266", "0.6281511", "0.62732774", "0.62605", "0.62483495", "0.6247338", "0.624107", "0.6235401", "0.62254506", "0.6216539", "0.619874", "0.619819", "0.619298", "0.61898535", "0.6178924", "0.6177637", "0.6175159", "0.6164513", "0.61448735", "0.61421734", "0.61399454", "0.61388874", "0.6136105", "0.61306864", "0.6119661", "0.61178035", "0.61178035", "0.61178035", "0.61178035", "0.609852", "0.60973686", "0.609703", "0.609703", "0.60921854", "0.60921854", "0.60921854" ]
0.0
-1
Public: Implements Objecthash so Assets can be used as a Hash key or in a Set. Returns Integer hash of the id.
def hash id.hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash #:nodoc:\n __getobj__.hash ^ self.class.hash\n end", "def hash\n type.hash ^ (id.hash >> 1)\n end", "def hash\n @id.hash\n end", "def hash\r\n id.hash\r\n end", "def hash\n object_id\n end", "def hash\n id.hash\n end", "def hash_code; end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash\n return @id.hash\n end", "def hash(*) end", "def hash\n\t\t[@id].hash\n\tend", "def hash\n @hash ||= begin\n result = 17\n result = 31 * result + self.class.hash\n result = 31 * result + ord\n result.is_a?(Fixnum) ? result : result.hash\n end\n end", "def hash\n @hash ||= begin\n result = 17\n result = 31 * result + self.class.hash\n result = 31 * result + ord\n result.is_a?(Fixnum) ? result : result.hash\n end\n end", "def hash\n id\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n [self.class, id].hash\n end", "def hash\n @id\n end", "def hash\n return @hash_code if defined? @hash_code\n @hash_code = usual_equal_object.hash\n end", "def hash\n @id\n end", "def hash(key); end", "def hash_id\n @hid\n end", "def hash\r\n a = 0\r\n @id.each_byte {|c| a += c.to_i}\r\n (a + @paired.to_i) * HASH_PRIME\r\n end", "def hash\n self.respond_to?(:id) && self.id ? self.id.to_i : self.to_hash.hash\n end", "def hash\n size.hash ^ rank.hash\n end", "def hash\n 0\n end", "def hash\n return super unless has_size?\n\n res = 0\n each do |el|\n res += el.hash\n end\n return res\n end", "def hash\n prime = 31\n result = 1\n result = result * prime + (@decision_target == nil ? 0 : @decision_target.hash)\n result = prime * result + (@string_id == nil ? 0 : @string_id.hash)\n result\n end", "def hash()\n #This is a stub, used for indexing\n end", "def hash # Hack for Ruby 1.8.6\n @node.id.hash ^ self.class.hash\n end", "def hash() source.hash ^ (target.hash+1); end", "def hash() source.hash ^ (target.hash+1); end", "def hash\n return @revision.hash if @revision\n return object_id\n end", "def hash # :nodoc:\n identifier.hash ^ requirement.hash\n end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash\n @hash || @hash = (value.hash * -1)\n end", "def hash\n self.begin.hash ^ self.end.hash\n end", "def hash\n h = @e.nil? ? 0 : @e\n h = (h << 1) ^ @r.hash\n h = (h << 1) ^ @v.hash\n end", "def _hash(obj)\n obj.transform_values { |v| _renc(v) }\n end", "def hash\n value_id.hash\n end", "def hash\n num = @high << 64\n num |= @low\n num.hash\n end", "def hash\n __record_id.hash\n end", "def hash\n guid.hash\n end", "def hash\n # Memoizing such a simple hash value seems silly, however the\n # profiler showed the Card#hash method as having 22% of the runtime. My\n # memoizing the hash value that was reduced to 12%.\n return @hash unless @hash.nil?\n @hash = @value.hash ^ @suit.hash\n end", "def hash\n @__set.to_a.hash\n end", "def hash\n shasum.hash\n end", "def hash\n shasum.hash\n end", "def hash\n shasum.hash\n end", "def hash\n id.hash + 32 * bs_request.hash\n end", "def hash\n @real.hash ^ @image.hash\n end", "def hash\n \tcustom_unique_id.hash\n end", "def hash\n Zlib.crc32(to_a.map(&:to_s).sort.to_s)\n end", "def calculate_hash!\n prefix = PREFIX_NAME_LOOKUP[self.type]\n # add special cases for refs\n self.hash_id = NodeId.sha1(\"#{prefix} #{self.size}\\0#{self.content}\")\n end", "def hash=(_arg0); end", "def hash\n raise NotImplementedError.new(\"hash() must be implemented by subclasses of AbstractVersionedFile.\")\n end", "def hash\n folder.hash ^ name.hash # eXclusive OR operator\n end", "def cache_key(id); end", "def hash\n excl = @excl ? 1 : 0\n hash = excl\n hash ^= @begin.hash << 1\n hash ^= @end.hash << 9\n hash ^= excl << 24;\n # Are we throwing away too much here for a good hash value distribution?\n return hash & Fixnum::MAX\n end", "def hash\n self.atoms.hash\n end", "def hash\n to_h.hash ^ self.class.hash\n end", "def hash\n [class_id, object_type, action, cache_state, cached_time, last_access_time, md5sum, original_sha512sum, path, registered_workflows, used_count, file, network_element].hash\n end", "def hash\n [_hash, name, owner].hash\n end", "def hash\n \"#{self.class.name}-#{self.id}-#{@__metadata__.cas}-#{@__attributes__.hash}\".hash\n end", "def hash\n source.hash ^ target.hash\n end", "def hash\n self.class.hash ^ left.hash ^ right.hash\n end", "def hash() #:nodoc:\n prime = 31;\n result = 1;\n result = prime * result + @amount.to_i\n result = prime * result + @new_balance.to_i\n result = prime * result + (@date.nil? ? 0 : Bankjob.date_time_to_ofx(@date).hash);\n result = prime * result + (@raw_description.nil? ? 0 : @raw_description.hash);\n result = prime * result + (@type.nil? ? 0 : @type.hash);\n # don't use value date\n return result;\n end", "def hash\n end", "def hash\n end", "def hash\n end", "def get_id(obj)\n\t\t@objects.invert[obj]\n\tend", "def hash\n self.class.name.hash ^ @key.hash\n end", "def hash\n @vbits.hash\n end", "def hash() source.hash ^ target.hash; end", "def sha\n id.sha\n end", "def hash\n return (path + file_id.to_s).hash\n end", "def hash()\n #This is a stub, used for indexing\nend" ]
[ "0.6906005", "0.677124", "0.6748651", "0.6680012", "0.66352403", "0.6562436", "0.6552862", "0.65384024", "0.65384024", "0.65384024", "0.65384024", "0.65384024", "0.65384024", "0.65384024", "0.65361553", "0.6532537", "0.65229267", "0.6515815", "0.6515815", "0.6473561", "0.6446048", "0.6446048", "0.64371717", "0.64021236", "0.6400682", "0.63959503", "0.63476133", "0.633626", "0.62898105", "0.6288607", "0.626555", "0.62391704", "0.62091875", "0.6199862", "0.61583775", "0.61494803", "0.61445814", "0.61445814", "0.6142283", "0.6111637", "0.6100963", "0.6100963", "0.6100963", "0.6100963", "0.6100963", "0.6100963", "0.6100963", "0.6100963", "0.6100963", "0.6100963", "0.6074782", "0.6071981", "0.6068751", "0.606395", "0.6058645", "0.6047727", "0.5985754", "0.5974641", "0.59734887", "0.5962698", "0.59562665", "0.59562665", "0.59562665", "0.5944953", "0.59267706", "0.5915438", "0.59087634", "0.58957446", "0.58891857", "0.58872145", "0.5832514", "0.5818301", "0.5804359", "0.57385", "0.57319593", "0.5712856", "0.5701433", "0.57006425", "0.5678213", "0.5675786", "0.5670958", "0.565304", "0.565304", "0.565304", "0.5632978", "0.56324965", "0.5630825", "0.56243324", "0.5607125", "0.56039095", "0.559038" ]
0.6594913
13
Public: Compare assets. Assets are equal if they share the same path and digest. Returns true or false.
def eql?(other) self.class == other.class && self.id == other.id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ==(asset)\n path == asset.path\n end", "def should_compile_assets?\n diff.has_asset_changes? || !File.exist?('public/assets')\n end", "def same_files?(*files)\n images = files.map { |fname| Digest::MD5.digest(File.binread(fname)) }\n images.all? { |img| img == images[0] }\nend", "def digest?\n !!asset_config[\"digest\"]\n end", "def compare_paths(src_path, dst_path)\n match = true\n # assume linux\n md5sum = \"md5sum\"\n md5sum = \"md5\" if node.platform == \"freebsd\"\n\n lib_files = `ls #{src_path}/`.split(/\\n/)\n lib_files.each do |file|\n src = `#{md5sum} #{src_path}/#{file}`.split(/\\s+/)\n dst = `#{md5sum} #{dst_path}/#{file}`.split(/\\s+/)\n match = false if (src[0] != dst[0])\n end\n return match\nend", "def identical?\n exists? && File.identical?(render, destination)\n end", "def is_equal?\n @is_equal ||= if prepared_expected.is_a? Pathname\n FileUtils.compare_file(prepared_expected, prepared_produced)\n else\n prepared_expected == prepared_produced\n end\n end", "def same_file?(a, b)\n File.expand_path(a) == File.expand_path(b)\n end", "def identical?(file1, file2)\n File.identical?(file1, file2)\n end", "def compare_content\n checksum(@current_resource.path) == new_resource_content_checksum\n end", "def files_match?\n @fixture.files == @local.files\n end", "def files_are_same(file1, file2)\n begin\n File.open(file1, 'rb').read == File.open(file1, 'rb').read\n rescue\n false\n end\nend", "def file_content_match?\n @fixture.full_files.zip(@local.full_files).all? do |fixture_file, local_file|\n if File.directory?(fixture_file)\n File.directory?(local_file)\n else\n !File.directory?(local_file) && IO.read(fixture_file) == IO.read(local_file)\n end\n end\n end", "def files_same?(file1, file2) \n if (File.size(file1) != File.size(file2)) then\n return false\n end\n f1 = IO.readlines(file1)\n f2 = IO.readlines(file2)\n if ((f1 - f2).size == 0) then\n return true\n else\n return false\n end\n end", "def cache_valid?\n return false unless File.exist?(cache_path)\n return true if checksum.nil?\n checksum == file_digest(cache_path)\n end", "def file_different?\n if @name && File.exist?( @name )\n Digest::MD5.hexdigest(\n @lines.join( \"\\n\" )\n ) != Digest::MD5.hexdigest(\n File.read( @name )\n )\n else\n true\n end\n end", "def remote_file_content_same_as?(full_path, content)\n Digest::MD5.hexdigest(content) == capture(\"md5sum #{full_path} | awk '{ print $1 }'\").strip\n end", "def files_same?(file1, file2) \n if (File.size(file1) != File.size(file2)) then\n return false\n end\n f1 = IO.readlines(file1)\n f2 = IO.readlines(file2)\n if ((f1 - f2).size == 0) then\n return true\n else\n return false\n end\n end", "def files_same?(file1, file2) \n if (File.size(file1) != File.size(file2)) then\n return false\n end\n f1 = IO.readlines(file1)\n f2 = IO.readlines(file2)\n if ((f1 - f2).size == 0) then\n return true\n else\n return false\n end\n end", "def digest\n serve_assets == \"local_dynamic\" ? false : true \n end", "def archive_differs_from_disk?(src, dest)\n modified = false\n archive = Archive::Reader.open_filename(src, nil, strip_components: new_resource.strip_components)\n Chef::Log.trace(\"Beginning the comparison of file mtime between contents of #{src} and #{dest}\")\n archive.each_entry do |e|\n pathname = ::File.expand_path(e.pathname, dest)\n if ::File.exist?(pathname)\n Chef::Log.trace(\"#{pathname} mtime is #{::File.mtime(pathname)} and archive is #{e.mtime}\")\n modified = true unless ::File.mtime(pathname) == e.mtime\n else\n Chef::Log.trace(\"#{pathname} doesn't exist on disk, but exists in the archive\")\n modified = true\n end\n end\n modified\n end", "def consistent?\n (manifest_files | tagmanifest_files).each do |mf|\n # get the algorithm implementation\n File.basename(mf) =~ /manifest-(.+).txt$/\n type = Regexp.last_match(1)\n algo = manifest_type(type)\n # Check every file in the manifest\n File.open(mf) do |io|\n io.each_line do |line|\n expected, path = line.chomp.split(/\\s+/, 2)\n file = File.join(bag_dir, decode_filename(path))\n\n next unless File.exist? file\n actual = algo.file(file).hexdigest\n errors.add :consistency, \"expected #{file} to have #{algo}: #{expected}, actual is #{actual}\" if expected.downcase != actual\n end\n end\n end\n\n errors.on(:consistency).nil?\n end", "def verify_tag_file(path)\n self.update_if_manifest(path)\n self.update_if_tag_manifest(path)\n self.verify_if_fetch(path)\n containing_tag_manifests = self.tag_manifests.select { |tag_manifest| tag_manifest.tag_manifest_files.first(path: path) }\n bad_checksum_tag_manifest = containing_tag_manifests.detect do |tag_manifest|\n tag_manifest.digest(path) != tag_manifest.tag_manifest_files.first(path: path).checksum\n end\n raise IncorrectChecksumException if bad_checksum_tag_manifest\n true\n end", "def etag_match?(asset, env)\n false\n end", "def consistent?\n\n manifest_files.each do |mf|\n\n # get the algorithm implementation\n File.basename(mf) =~ /^manifest-(.+).txt$/\n\n algo = case $1\n when /sha1/i\n Digest::SHA1\n when /md5/i\n Digest::MD5\n else\n :unknown\n end\n\n # Check every file in the manifest\n open(mf) do |io|\n\n io.each_line do |line|\n expected, path = line.chomp.split /\\s+/, 2\n file = File.join(bag_dir, path)\n\n if File.exist? file\n actual = algo.file(file).hexdigest\n\n if expected != actual\n errors.add :consistency, \"expected #{file} to have #{algo}: #{expected}, actual is #{actual}\"\n end\n\n end\n end\n\n end\n\n end\n\n errors.on(:consistency).nil?\n end", "def hashes_match?\n ar = @ar.clone\n\n digest_value = ar.at_css(\n 'xmlns|DigestValue',\n 'xmlns' => 'http://www.w3.org/2000/09/xmldsig#'\n ).content.strip\n\n ar.at_css(\n \"xmlns|Signature\",\n 'xmlns' => 'http://www.w3.org/2000/09/xmldsig#'\n ).remove\n\n actual_digest = calculate_digest(ar)\n\n if digest_value == actual_digest\n true\n else\n false\n end\n end", "def asset_requirable?(path)\n pathname = resolve(path)\n content_type = environment.content_type_of(pathname)\n stat = environment.stat(path)\n return false unless stat && stat.file?\n self.content_type.nil? || self.content_type == content_type\n end", "def for_asset_file?\n !!((get? || head?) && for_digested_asset? && asset_file.exists?)\n end", "def asset_version path\n path = File.expand_path(File.join(public_dir, path))\n md5(path)\n end", "def compare_file(a, b)\n return false unless File.size(a) == File.size(b)\n File.open(a, 'rb') {|fa|\n File.open(b, 'rb') {|fb|\n return compare_stream(fa, fb)\n }\n }\n end", "def asset_digest(path, options = {})\n return unless digest_assets\n\n if digest_path = asset_digest_path(path, options)\n digest_path[/-(.+)\\./, 1]\n end\n end", "def different?(a, b)\n !FileUtils.compare_file(a, b)\n end", "def compare_file(a, b)\r\n return false unless File.size(a) == File.size(b)\r\n File.open(a, 'rb') {|fa|\r\n File.open(b, 'rb') {|fb|\r\n return compare_stream(fa, fb)\r\n }\r\n }\r\n end", "def asset_precompiled?(logical_path); end", "def asset_precompiled?(logical_path); end", "def fresh?\n last_compilation_digest&.== watched_files_digest\n end", "def asset_exists?(path)\n if Rails.configuration.assets.compile\n Rails.application.precompiled_assets.include? path\n else\n Rails.application.assets_manifest.assets[path].present?\n end\n end", "def asset_exists?(path)\n if Rails.configuration.assets.compile\n Rails.application.precompiled_assets.include? path\n else\n Rails.application.assets_manifest.assets[path].present?\n end\n end", "def assets\n uniq = {}\n sets = manifests.map(&:assets)\n sets.each do |assets|\n assets.each do |rel_path, abs_path|\n uniq[rel_path] = abs_path unless uniq.key?(rel_path)\n end\n end\n uniq\n end", "def asset_digest(source)\n asset_paths.digest_for(source)\n end", "def object_filepaths_unique?\n filepaths.count == filepaths.uniq.count\n end", "def quick_equal?\n return nil unless old_file_exists?\n return true if new_file_size == old_file_size\n old_file, new_file = load_image_files(@old_file_name, @new_file_name)\n return true if old_file == new_file\n images = load_images(old_file, new_file)\n crop_images(images, @dimensions) if @dimensions\n\n old_img = images.first\n new_img = images.last\n\n return false if sizes_changed?(old_img, new_img)\n\n return true if old_img.pixels == new_img.pixels\n\n @left, @top, @right, @bottom = find_top(old_img, new_img)\n\n return true if @top.nil?\n\n if @area_size_limit\n @left, @top, @right, @bottom = find_diff_rectangle(old_img, new_img)\n return true if size <= @area_size_limit\n end\n\n false\n end", "def remote_file_differs?(full_path, content)\n !remote_file_exists?(full_path) || remote_file_exists?(full_path) && !remote_file_content_same_as?(full_path, content)\n end", "def sameFile( fileA, fileB )\n\n # If symlinks, make sure they link to the same thing.\n if File.symlink?( fileA ) || File.symlink?( fileB )\n return false unless File.symlink?( fileA ) and File.symlink?( fileB )\n linkA = File.readlink( fileA )\n linkB = File.readlink( fileB )\n return linkA == linkB\n end\n\n # Both exist.\n return false unless File.exists?( fileA ) and File.exists?( fileB )\n # Both are the same size.\n aBytes = File.stat( fileA ).size\n bBytes = File.stat( fileB ).size\n return false unless aBytes == bBytes\n\n # Random sample comparison.\n same = true\n $options[:samples].times do\n start = rand( aBytes )\n length = [aBytes, start + SampleSize].min - start + 1\n aSample = File.read( fileA, length, start )\n bSample = File.read( fileB, length, start )\n same = same && aSample == bSample\n end\n return same\nrescue\n STDOUT.puts \"ERROR: Can't read file [#{fileA}]\"\n $errorCount += 1\n return true # So we don't get two messages for the same file\nend", "def compare_list(attrs={})\n match = true\n # assume linux\n md5sum = \"md5sum\"\n md5sum = \"md5\" if node.platform == \"freebsd\"\n\n attrs['compare_list'].each do |src_file, dst_file|\n src = `#{md5sum} #{Chef::Config[:file_cache_path]}/#{attrs['src_dir']}/#{src_file}`.split(/\\s+/)\n dst = `#{md5sum} #{attrs['prefix']}/#{dst_file}`.split(/\\s+/)\n if (src[0] != dst[0]) || src[0].nil? || dst[0].nil?\n p \"#{src_file} #{attrs['prefix']}/#{dst_file}\"\n p \"#{src[0]} #{dst[0]}\"\n match = false\n end\n end\n return match\nend", "def should_copy?(source, target)\n return true\n return true if !File.exists?(target)\n\n source_sha = Digest::SHA1.hexdigest(File.read(source))\n target_sha = Digest::SHA1.hexdigest(File.read(target))\n \n debugger if source_sha != target_sha\n \n return true if source_sha == target_sha\n \n return false\n end", "def files_different?(path, local_path, content=nil)\n end", "def dependency_fresh?(environment, dep)\n path, mtime, hexdigest = dep.pathname.to_s, dep.mtime, dep.digest\n\n stat = environment.stat(path)\n\n # If path no longer exists, its definitely stale.\n if stat.nil?\n return false\n end\n\n # Compare dependency mime to the actual mtime. If the\n # dependency mtime is newer than the actual mtime, the file\n # hasn't changed since we created this `Asset` instance.\n #\n # However, if the mtime is newer it doesn't mean the asset is\n # stale. Many deployment environments may recopy or recheckout\n # assets on each deploy. In this case the mtime would be the\n # time of deploy rather than modified time.\n if mtime >= stat.mtime\n return true\n end\n\n digest = environment.file_digest(path)\n\n # If the mtime is newer, do a full digest comparsion. Return\n # fresh if the digests match.\n if hexdigest == digest.hexdigest\n return true\n end\n\n # Otherwise, its stale.\n false\n end", "def content_file_checksums_match?\n checksum_failures = \"\"\n described_datafiles.each do |datafile|\n info = datafile.checksum_info\n\n if File.exists?(datafile.datapath) == false\n checksum_failures << \"#{datafile['sip-path']} - missing; \"\n elsif info[0] != info[1]\n checksum_failures << \"#{datafile['sip-path']} - expected: #{info[0]} computed: #{info[1]}; \"\n else\n next\n end\n end\n\n if checksum_failures.length > 0\n metadata[\"checksum_failures\"] = checksum_failures\n return false\n else\n return true\n end\n end", "def has_assets?\n assets.none?\n end", "def asset_request?\n ::Watchman::asset_paths.any? { |r| env['PATH_INFO'].to_s.match(r) }\n end", "def eql?(other)\n other.class == self.class &&\n other.logical_path == self.logical_path &&\n other.mtime.to_i == self.mtime.to_i &&\n other.digest == self.digest\n end", "def fresh?\n watched_files_digest == last_compilation_digest\n end", "def identicalish_resources?(first, second)\n skipped_ivars = [ :@source_line, :@cookbook_name, :@recipe_name, :@params, :@elapsed_time, :@declared_type ]\n checked_ivars = ( first.instance_variables | second.instance_variables ) - skipped_ivars\n non_matching_ivars = checked_ivars.reject do |iv|\n if iv == :@action && ( [first.instance_variable_get(iv)].flatten == [:nothing] || [second.instance_variable_get(iv)].flatten == [:nothing] )\n # :nothing action on either side of the comparison always matches\n true\n else\n first.instance_variable_get(iv) == second.instance_variable_get(iv)\n end\n end\n Chef::Log.debug(\"ivars which did not match with the prior resource: #{non_matching_ivars}\")\n non_matching_ivars.empty?\n end", "def asset_present?(name)\n if Rails.application.assets.present?\n Rails.application.assets.find_asset(name)\n else\n Rails.application.assets_manifest.files.values.map { |v| v['logical_path'] }.include?(name)\n end\n end", "def checksum_valid?\n Digest::SHA256.file(path).hexdigest == sha256sum\n end", "def test_refute_png_equal_with_different_image\n refute_png_equal(comparison_png(0), comparison_png(1))\n end", "def asset_precompiled?(logical_path)\n if precompiled_assets.include?(logical_path)\n true\n elsif !config.cache_classes\n # Check to see if precompile list has been updated\n precompiled_assets(true).include?(logical_path)\n else\n false\n end\n end", "def identicalish_resources?(first, second)\n skipped_ivars = [ :@source_line, :@cookbook_name, :@recipe_name, :@params, :@elapsed_time, :@declared_type ]\n checked_ivars = ( first.instance_variables | second.instance_variables ) - skipped_ivars\n non_matching_ivars = checked_ivars.reject do |iv|\n if iv == :@action && ( [first.instance_variable_get(iv)].flatten == [:nothing] || [second.instance_variable_get(iv)].flatten == [:nothing] )\n # :nothing action on either side of the comparison always matches\n true\n else\n first.instance_variable_get(iv) == second.instance_variable_get(iv)\n end\n end\n Chef::Log.debug(\"ivars which did not match with the prior resource: #{non_matching_ivars}\")\n non_matching_ivars.empty?\n end", "def identical?( src, dst )\n source = IO.read(src)\n destination = IO.read(dst)\n source == destination\n end", "def quick_equal?\n return nil unless old_file_exists?\n\n old_image, new_image = preprocess_images vips_load_images(@old_file_name, @new_file_name)\n\n return false if dimension_changed?(old_image, new_image)\n\n diff_mask = VipsUtil.difference_mask(@color_distance_limit, old_image, new_image)\n self.difference_region = VipsUtil.difference_region_by(diff_mask)\n\n return true if difference_region_empty?(new_image)\n\n return true if @area_size_limit && size <= @area_size_limit\n\n return true if @tolerance && @tolerance >= difference_level(diff_mask, old_image)\n\n # TODO: Remove this or find similar solution for vips\n if @shift_distance_limit\n warn '[capybara-screenshot-diff] Instead of shift_distance_limit ' \\\n 'please use median_filter_window_size and color_distance_limit options'\n return true if chunky_png_driver.quick_equal?\n end\n\n false\n end", "def eql?(fe)\n @archive_filename.eql?(fe.archive_filename) and @sha512hash.eql?(fe.sha512hash) and @mtime.eql?(fe.mtime)\n end", "def verify_identical_file!(bucket_file)\n disk_contents = IO.binread(path_for(bucket_file.bucket_path, bucket_file.checksum_data, 'contents'))\n\n # If the contents don't match, then we've found a conflict.\n # Unlikely, but quite bad.\n if disk_contents != bucket_file.contents\n raise Puppet::FileBucket::BucketError, \"Got passed new contents for sum #{bucket_file.checksum}\"\n else\n Puppet.info \"FileBucket got a duplicate file #{bucket_file.checksum}\"\n end\n end", "def quick_verify\n cached_md5 == remote_md5 and remote_md5 == md5\n end", "def diff_conflicts(diff1, diff2)\n da1 = diff1.path.split(\"/\")\n da2 = diff2.path.split(\"/\")\n\n cmp_size = [da1, da2].map(&:size).min - 1\n return false if da2.size == cmp_size + 1\n da1[0..cmp_size] == da2[0..cmp_size]\n end", "def precompile_assets?\n !File.exist? \"public/assets/manifest.yml\"\n end", "def equal?( other )\n return false unless other.kind_of? ::Webby::Resources::Resource\n (self.destination == other.destination) && (self.path == other.path)\n end", "def quick_compare(another)\n self == another || (self.kind_of?(File) && another.kind_of?(File) && self.path == another.path)\n end", "def shared?\n !self.shared_assets.empty?\nend", "def verify\n all_assets.each do |asset|\n raise AssetNotFound.new(\"File #{asset} DOEST EXIST\") unless FileTest.exist?(asset.abs)\n end\n end", "def delete_cache_and_img\n # -- out with the old -- #\n\n finger = self.fingerprint_changed? ? self.fingerprint_was : self.fingerprint\n imgfinger = self.image_fingerprint_changed? ? self.image_fingerprint_was : self.image_fingerprint\n\n if finger && imgfinger\n # -- delete our old cache -- #\n Rails.cache.delete(\"img:\"+[self.asset.id,imgfinger,self.output.code].join(\":\"))\n\n # -- delete our AssetOutput -- #\n path = self.asset.image.path(self)\n\n if path\n # this path could have our current values in it. make sure we've\n # got old fingerprints\n path = path.gsub(self.asset.image_fingerprint,imgfinger).gsub(self.fingerprint,finger)\n\n self.asset.image.delete_path(path)\n end\n end\n\n true\n end", "def gems_changed?\n gemfile_md5.nil? || cached_gemfile_md5.nil? || gemfile_md5 != cached_gemfile_md5\n end", "def asset_checksum(asset)\n filename = asset.original_file_location\n match = filename.match(/\\ASHA256E-s\\d*--(\\h{64})\\.[a-zA-Z]+\\Z/)\n match ? match[1] : nil\n end", "def quick_compare(another)\n self == another || (\n (self.kind_of?(File) || self.kind_of?(Tempfile)) && \n (another.kind_of?(File) || another.kind_of?(Tempfile)) && \n self.path == another.path)\n end", "def files_match(actual, expected)\n FileCompareAssertion.new(actual, expected)\n end", "def ==(other)\n relative_path == other.relative_path\n end", "def webpack_asset_exists?(source, extname)\n manifest[\"#{source}.#{extname}\"].present?\n end", "def find_same_files\n # loop over find_similar_files groups\n # diff -b file1 file2\n end", "def hashes_match?\n are = doc.clone\n\n digest_value = are.at('xmlns|DigestValue', xmlns: DSIG).content.strip\n\n are.at('xmlns|Signature', xmlns: DSIG).remove\n\n actual_digest = calculate_digest(are)\n\n return true if digest_value == actual_digest\n\n false\n end", "def ==(other)\n return false unless @path && @file_id && other.path && other.file_id\n @path == other.path && @file_id == other.file_id\n end", "def fresh?(thing)\n if thing.is_a?(Sprite) and not thing.save_path.file?\n # If this is a data URI sprite a non-existent file is normal.\n if ! @project || ! @project.data_uri_sprites.include?(thing)\n return false\n end\n end\n\n return false if thing.is_a?(Pathname) and not thing.cleanpath.file?\n\n @cache[section(thing)][key(thing)] == digest(thing)\n end", "def has_assets?\n #FIXME: requires a unit test\n !all_related_data_files.empty? || !all_related_models.empty?\n end", "def verify_data_file(path)\n containing_manifests = self.manifests.select { |manifest| manifest.manifest_files.first(path: path) }\n raise FileNotInManifestException unless containing_manifests.size > 0\n bad_checksum_manifest = containing_manifests.detect do |manifest|\n manifest.digest(path) != manifest.manifest_files.first(path: path).checksum\n end\n raise IncorrectChecksumException if bad_checksum_manifest\n true\n end", "def route_assets?\n request.path_info.match %r{^/assets/}\n end", "def asset_digest_path(path, options = {})\n if manifest = assets_manifest\n if digest_path = manifest.assets[path]\n return digest_path\n end\n end\n\n if environment = assets_environment\n if asset = environment[path]\n return asset.digest_path\n end\n end\n end", "def file_outdated?(path, expected_md5sum)\n return true unless File.exist?(path)\n\n md5 = Digest::MD5.new\n File.open(path, \"r\") do |file|\n while (chunk = file.read(1024))\n md5.update chunk\n end\n end\n md5.to_s != expected_md5sum\n end", "def compute_asset_path(path, options = {})\n digested = options.delete(:digested)\n digested = true if digested.nil?\n\n if (digest_path = asset_digest_path(path, options))\n path = digest_path if digested && digest_assets\n path += \"?body=1\" if options[:debug]\n File.join(assets_prefix || \"/\", path)\n else\n super\n end\n end", "def changed?\n render unless result\n if exist?\n File.read(output) != result\n else\n true\n end\n end", "def shared?\n self[:filename].nil? or self[:filename].start_with? \"content/\"\n end", "def exact_deployment?\n artifact_hash = digest_of_artifact\n deployed_hash = digest_of_deployed\n if artifact_hash == deployed_hash\n Puppet.debug \"Same exact deployment found, compared by hash: #{artifact_hash}. Skipping deploy.\"\n true\n else\n Puppet.debug \"Deployment hash: #{deployed_hash} differs from expected artifact hash: #{artifact_hash}. Redeploying.\"\n false\n end\n end", "def has_local_match?(files)\n files.each do |file|\n return true if self.drive_path == file.sub_path\n end\n false\n end", "def image_compare(path1, path2, differencesInPercent=0)\n return $marathon.compareImages(path1,path2,differencesInPercent)\nend", "def == (other)\n @paths == other.paths\n end", "def sameFile( fileA, fileB )\n\n\n # Both exist.\n return false unless File.exists?( fileA ) and File.exists?( fileB )\n # Both are the same size.\n aBytes = File.stat( fileA ).size\n bBytes = File.stat( fileB ).size\n return false unless aBytes == bBytes\n\n # Random sample comparison.\n same = true\n $options[:samples].times do \n start = rand( aBytes ) \n length = [aBytes, start + SampleSize].min - start + 1\n aSample = File.read( fileA, length, start )\n bSample = File.read( fileB, length, start )\n same = same && aSample == bSample\n end\n return same\nrescue\n STDOUT.puts \"ERROR: Can't read file [#{fileA}]\"\n $errorCount += 1\n return true # So we don't get two messages for the same file\nend", "def check\n prefix = File.basename(@expected)\n if File.exist?(@expected)\n no_change = FileUtils.identical?(@expected, @actual)\n if no_change\n # Files are exact match.\n @message = \"#{prefix} : Actual and expected files are an exact match.\"\n return true\n end\n @message = \"#{prefix} : Actual file did not match expected file!\"\n else\n @message = \"#{prefix} : Expected file not found.\"\n end\n # Comparison failed.\n false\n end", "def known_assets\n assets = Rails.application.config.assets.digests.to_a.flatten.map do |asset|\n [asset, \"#{asset}.gz\"]\n end.flatten\n assets + %w(manifest.yml sources_manifest.yml)\n end", "def safe_equals? a, b\n check = a.bytesize ^ b.bytesize\n a.bytes.zip(b.bytes) { |x, y| check |= x ^ y.to_i }\n check.zero?\n end", "def completed?\n child_files = self.bundled_files\n child_file_types = child_files.map {|file| file['file_type']}\n if child_file_types.size < BUNDLE_REQUIREMENTS[self.bundle_type].size || ( (child_file_types.size == BUNDLE_REQUIREMENTS[self.bundle_type].size) &&\n (child_file_types & BUNDLE_REQUIREMENTS[self.bundle_type] != child_file_types))\n return false\n end\n if child_file_types.size > BUNDLE_REQUIREMENTS[self.bundle_type].size\n return false\n end\n # make sure all files have at least uploaded to the server\n self.study_files.each do |study_file|\n if !study_file.uploaded?\n return false\n end\n end\n true\n end", "def run_build?\n ENV['BUILD_ASSETS'].to_s == 'true' ||\n build_files.blank? ||\n src_files.select { |f| File.mtime(f) >= File.mtime(cache_file) }.any?\n end", "def image_compare(path1, path2, differencesInPercent=0)\n return $marathon.compareImages(path1,path2,differencesInPercent)\nend", "def ==(other)\n return false unless Path::Name === other\n if @absolute\n return false unless other.absolute?\n end\n @path == other.pathlist\n end" ]
[ "0.6918989", "0.6430001", "0.64132154", "0.6225739", "0.6220296", "0.6181067", "0.6047955", "0.602548", "0.5981091", "0.59768564", "0.59706473", "0.5966043", "0.59490156", "0.5935902", "0.5930805", "0.5929558", "0.5919885", "0.5903177", "0.5903177", "0.5898984", "0.5888315", "0.5885328", "0.58769244", "0.57964516", "0.57621676", "0.5730823", "0.5699522", "0.5647627", "0.5646405", "0.5631008", "0.5629587", "0.56261635", "0.56097376", "0.5597109", "0.5597109", "0.5589247", "0.55715054", "0.55715054", "0.55545044", "0.55387145", "0.55309623", "0.55258554", "0.5524579", "0.5520461", "0.5518353", "0.55009156", "0.5499522", "0.54991204", "0.549666", "0.54663736", "0.5435483", "0.5434263", "0.5433856", "0.54056835", "0.54021615", "0.5371934", "0.5363089", "0.53606683", "0.5358285", "0.5348065", "0.53404737", "0.5337704", "0.53349173", "0.5310355", "0.52980554", "0.52592003", "0.5259085", "0.5257849", "0.5254573", "0.5252875", "0.525049", "0.52405065", "0.52347934", "0.52319", "0.5230208", "0.52150774", "0.52036494", "0.5202641", "0.51975185", "0.51886874", "0.51794595", "0.5175884", "0.5169102", "0.51515114", "0.5137832", "0.51178265", "0.510727", "0.5104382", "0.5101719", "0.51014245", "0.509884", "0.50972056", "0.5079354", "0.50732046", "0.5067088", "0.5058201", "0.50577706", "0.50524783", "0.50505024", "0.50459605", "0.50413805" ]
0.0
-1
GET /administration/characters GET /administration/characters.xml
def index @characters = Character.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @characters } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @characters = @user.characters.find :all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @characters }\n end\n end", "def show\n @game_characters = GameCharacters.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @game_characters }\n end\n end", "def show\n @character = Character.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @character }\n end\n end", "def fetch_characters\n api = EVEAPI::API.new\n api.api_id = api_id\n api.v_code = v_code\n\n xml = api.get(\"account/APIKeyInfo\")\n characters = []\n xml.xpath(\"//row\").each do |row|\n characters << {\n :name => row['characterName'],\n :id => row['characterID'],\n :corporation_name => row['corporationName'],\n :corporation_id => row['corporationID'],\n :api_id => api_id,\n :v_code => v_code\n }\n end\n characters \n end", "def spells\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @character }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @character }\n end\n end", "def index\n @characters = current_user.characters.all\n end", "def index\n authorize! :manage, Character\n\n @characters = @characters.includes(:user).ordered\n\n respond_to do |format|\n format.html { @characters = @characters.page(params[:page]).per(50) }\n format.json { }\n end\n end", "def show\n @character_trait = CharacterTrait.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @character_trait }\n end\n end", "def feats\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @character }\n end\n end", "def index\n begin\n @list_title = \"Your characters\"\n if params[:user_id]\n @user = User.friendly.find(params[:user_id])\n if @user && @user != current_user\n @list_title = \"#{@user.username}'s characters\"\n end\n else\n @user = current_user\n end\n @characters = Character.where(:user_id => @user.id).includes(:race).includes(:career)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @characters.to_json(include: [:race, :career]) }\n format.xml { render xml: @characters.to_xml(include: [:race, :career, :weapons, :armors, :gears]) }\n end\n rescue ActiveRecord::RecordNotFound\n redirect_to :root\n return\n end\n end", "def index\r\n @characters = Character.all\r\n end", "def show\n @character = current_user.characters.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @character }\n end\n end", "def index\n if params[:user_id]\n @characters = User.find(params[:user_id]).characters\n else\n @characters = Character.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @characters }\n end\n end", "def index\n @characters = Character.all\n end", "def index\n @characters = Character.all\n end", "def index\n @characters = Character.all\n end", "def index\n @characters = Character.all\n end", "def index\n @characters = Character.all\n end", "def index\n @characters = Character.all\n end", "def index\n @characters = Character.all\n end", "def index\n @characters = Character.all\n end", "def list_characters\n puts \"\"\n puts \"-----------------------------------------------\"\n puts \"\"\n puts \"Please select a character number:\"\n puts \"\"\n Api.all_character_data_list_of_names\n list_characters_options\n end", "def combat\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @character }\n end\n end", "def skills\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @character }\n end\n end", "def show\n @character = Character.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :text => full_character_json(@character)}\n format.xml { render :xml => @character }\n end\n end", "def show\n @character = current_user.characters.find(params[:id])\n end", "def index\n @characters = Character.all.page(params[:page]).per(25)\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @character_service }\n end\n end", "def index\n\t@story = Story.find(params[:story_id])\n @characters = Character.all\n \tadd_breadcrumb \"Stories\", stories_path\n\tadd_breadcrumb @story.title, @story\n\tadd_breadcrumb \"Characters\", ''\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @characters }\n end\n end", "def inventory\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @character }\n end\n end", "def show\n @characteristic = Characteristic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @characteristic }\n end\n end", "def character\n fetch('books.the_kingkiller_chronicle.characters')\n end", "def get_character_names\n\t\t\tget_all_character_uris.map { |uri| get_character_name(json(uri)) }\n end", "def edit\n @characters = current_account.characters.all\n end", "def index\n @characters = Character.paginate(:page => params[:page], :per_page => 20)\n end", "def show\n @character = Character.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @character }\n end\n end", "def show\n @character = Character.find(params[:id])\n \tadd_breadcrumb \"Stories\", stories_path\n\tadd_breadcrumb @character.story.title, @character.story\n\tadd_breadcrumb \"Characters\", story_characters_path(@character.story)\n\tadd_breadcrumb @character.name, ''\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @character }\n end\n end", "def show\n @character = Character.find(params[:id])\n end", "def index\n @characters = Character.all\n\n render json: @characters\n end", "def get_all_characters(page=nil)\n\n if page\n response = RestClient.get(page)\n else\n response = RestClient.get(\"https://swapi.co/api/people\")\n end\n characters_array = JSON.parse(response.body)[\"results\"]\n\n characters_array.each do |character|\n StarWarsCliApi::Character.new(character)\n end\n\n # next_page = JSON.parse(response.body)[\"next\"]\n # if next_page\n # get_all_characters(next_page)\n # end\n end", "def get_characters\n character_hash = look_up('http://www.swapi.co/api/people/')\n character_hash[\"results\"].collect do |element|\n element[\"name\"]\n end\nend", "def index\n @relationships = @character.relationships.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @relationships }\n end\n end", "def show\n @bookcharacter = Bookcharacter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bookcharacter }\n end\n end", "def index\n @characters = current_user.characters\n @current_character = nil\n @character_classes = CharacterClass.all\n end", "def index\n authorize! :manage, @users\n\n @users = @users.includes(:character).ordered\n\n respond_to do |format|\n format.html { @users = @users.page(params[:page]).per(50) }\n format.json { }\n end\n end", "def show\n @character = Character.find(params[:id])\n if session[:userid] != nil and session[:userid] != ''\n @valid_staff = Staff.find(:first, :conditions => [\"userid = ? \", session[:userid]])\n end\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @character }\n end\n end", "def fetch_list_characters\n response_string = RestClient.get('http://www.swapi.co/api/people/')\n response_hash = JSON.parse(response_string)\n\n character = response_hash[\"results\"].map {|char| char[\"name\"]}\nend", "def get_all_character_apis\n\t\t\tjson(@@movie_api)[\"results\"].map { |movie| movie[\"characters\"]}.flatten\n end", "def show\n @administration = Administration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @administration }\n end\n end", "def index\n if params.has_key?(\"ids\")\n @characters = current_user.characters.where(id: params[\"ids\"].split(\",\"));\n else\n @characters = current_user.characters\n end\n\n @current_character = nil\n cookies.delete :character_id\n end", "def get_all_character_uris\n\t\t\tget_all_character_apis.map { |api| uri(api) }\n end", "def abilities\n get('/ability/')\n end", "def index\n @character_entries = CharacterEntry.all\n end", "def index\n characters = @project.characters.all\n render json: { characters: characters }\n end", "def character_races\r\n BnetApi::make_request('/wow/data/character/races')\r\n end", "def show\n @charade = Charade.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @charade }\n end\n end", "def character\n fetch('dumb_and_dumber.characters')\n end", "def show\r\n @game_id = params[:game_id]\r\n @characters = Character.all\r\n begin\r\n if @characters == nil\r\n redirect_to games_path\r\n else\r\n @character = Character.find(params[:id])\r\n end\r\n rescue ActiveRecord::RecordNotFound => e\r\n \r\n end\r\n end", "def fetch_all_characters\n if Character.count <= 126\n\n clients = Lol::Client.new ENV[\"RIOT_API_KEY\"], {region: \"euw\"}\n @lore = clients.static.champion.get(champData: 'lore')\n\n @client = Taric.client(region: :oce)\n characters = @client.static_champions[\"data\"]\n\n characters.each do |char|\n\t Character.create :name => \"#{char[1]['name']}\", :image => \"http://ddragon.leagueoflegends.com/cdn/5.13.1/img/champion/#{char[1]['key']}.png\"\n end\n\n @characters = Character.all\n @lore.each_with_index do |lore, i|\n @characters[i].update :lore => lore['lore']\n # Character.save :lore => \"#{lore['lore']}\"\n end\n end\n end", "def get_character_list account\n end", "def detail\n @characters = Character.all\n render json: @characters, each_serializer: CharacterDetailSerializer \n end", "def index\n @characters = Character.all.paginate page: params[:page]\n render json: {\n current_page: @characters.current_page,\n per_page: @characters.per_page,\n total: @characters.total_entries,\n results: @characters\n }\n end", "def call StarwarsChars::API.character_list\n\t\t#call the method we just made, that gets the data to the user immediately \n\t\tputs \"Welcome to Star Wars Character List Gem\"\n\t\tputs \"\"\n\t\tmenu\n\n\tend", "def get_character(name = @character_name, options = {})\n\t\t\toptions = character_options(name, options)\n\t\t\tcharacter_sheet = get_xml(@@character_sheet_url, options)\n\t\t\tcharacter_reputation = get_xml(@@character_reputation_url, options)\n\t\t\t\n\t\t\t# FIXME\n\t\t\tif true\n\t\t\t\treturn Wowr::Classes::FullCharacter.new(character_sheet,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcharacter_reputation,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tself)\n\t\t\telse\n\t\t\t\traise Wowr::Excceptions::CharacterNotFound.new(options[:character_name])\n\t\t\tend\n\t\tend", "def new\n @character = Character.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @character }\n end\n end", "def new\n @character = Character.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @character }\n end\n end", "def new\n @character = Character.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @character }\n end\n end", "def read_characters()\n readfile = File.read(\"characters.json\")\n return JSON.parse(readfile)\nend", "def show\n @collected_character = CollectedCharacter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @collected_character }\n end\n end", "def character\n fetch('ghostbusters.characters')\n end", "def character_classes\r\n BnetApi::make_request('/wow/data/character/classes')\r\n end", "def characters; end", "def character(params)\n characters(id: params[:id]).first\n end", "def index\n if current_project\n @characters = current_project.characters\n else\n @characters = current_user.characters\n end\n end", "def show\n # byebug\n render json: @character, each_serializer: SimpleCharacterSerializer\n end", "def search_for_chars\n results = []\n response = client.characters(:nameStartsWith => user_search)\n response[\"data\"][\"results\"].each do |result|\n options = {}\n options[\"name\"] = result[\"name\"]\n if result[\"description\"] == \"\"\n options[\"description\"] = \"No description found\"\n else\n options[\"description\"] = result[\"description\"]\n end\n options[\"popularity\"] = result[\"comics\"][\"available\"]\n options[\"image\"] = result[\"thumbnail\"][\"path\"] + \".\" + result[\"thumbnail\"][\"extension\"] if result[\"thumbnail\"] != nil\n options[\"user_id\"] = user_id\n options[\"team_id\"] = 0\n results << Character.new(options)\n end\n results \n end", "def new\n @character = @user.build_character\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @character }\n end\n end", "def fetch_character_page(page)\n uri = URI(BASE_URI + \"?page=#{page}\")\n characters = make_request(uri)\n character_instances = characters.map do |character_data|\n Character.new(character_data)\n end\n end", "def show\n @texte_accueil = TexteAccueil.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @texte_accueil }\n end\n end", "def index\n #@character_services = CharacterService.all\n @search = CharacterService.search(params[:search])\n @character_services = @search.page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erbb\n format.xml { render :xml => @character_services }\n end\n end", "def new\n @character_service = CharacterService.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @character_service }\n end\n end", "def show\n @administrator = Administrator.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @administrator }\n end\n end", "def show\n @administrator = Administrator.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @administrator }\n end\n end", "def show\n @charity = Charity.find_by_ident_name(params[:id]) || Charity.find(params[:id])\n #@charities = Charity.find_all_by_lang(@charity.lang)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @charity }\n end\n end", "def show\n render json: @character\n end", "def show\n @items = @character.items.paginate(:page => params[:page], :per_page => 8)\n end", "def index\n @charities = Charity.find(:all, :order => \"created_at DESC\")\n\n respond_to do |format|\n format.html { render :template => \"charities/list\" unless admin?}\n format.xml { render :xml => @charities }\n end\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 characters\n document.search(\"[@id='bookDataBox']/*/[@class='infoBoxRowItem']/a\").select {|elem| elem['href'] =~ /character/}.map {|elem| elem.innerHTML.strip} rescue []\n end", "def index\n if params.has_key?(:character_id)\n @character = Fundamental::Character.find(params[:character_id])\n raise ForbiddenError.new('Access Forbidden') unless admin? || staff? || current_character == @character\n raise NotFoundError.new('Page Not Found') if @character.nil?\n @shop_purchases = @character.purchases\n else\n raise ForbiddenError.new('Access Forbidden') unless admin? || staff?\n @shop_purchases = Shop::Purchase.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shop_purchases }\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @privat_spaces }\n end\n end", "def get_all_characters\n all_chars = []\n self.characters.each do |character|\n all_chars << character.id\n end\n\n all_chars\n end", "def me\n users(request(\"users/authenticate.xml\", :auth => true))\n end", "def show\n\t\t@material = @caracteristica.material\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @caracteristica }\n end\n end", "def new\n \t@story = Story.find(params[:story_id])\n @character = @story.characters.new\n \tadd_breadcrumb \"Stories\", stories_path\n\tadd_breadcrumb @story.title, @story\n\tadd_breadcrumb \"Characters\", story_characters_path(@story)\n\tadd_breadcrumb \"New character\", ''\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @character }\n end\n end", "def show\n @fundamental_character = Fundamental::Character.find_by_id_or_identifier(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fundamental_character }\n end\n end", "def current_account_characters\n current_account.characters\n end", "def show\n @command = Command.accessible_by(current_ability).find(params[:id])\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @command }\n end\n end", "def index\n @texte_accueils = TexteAccueil.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @texte_accueils }\n end\n end" ]
[ "0.7364486", "0.6606827", "0.6486396", "0.64427096", "0.6426193", "0.6344041", "0.63225186", "0.6296009", "0.61372197", "0.61120534", "0.6110572", "0.61103415", "0.6105569", "0.60874784", "0.6076488", "0.6076488", "0.6076488", "0.6076488", "0.6076488", "0.6076488", "0.6076488", "0.6076488", "0.6066637", "0.60370314", "0.6033199", "0.60143507", "0.5998982", "0.59492964", "0.5946017", "0.59333974", "0.59279954", "0.5915251", "0.5895188", "0.5858121", "0.5844812", "0.57941574", "0.5789243", "0.57769567", "0.5767809", "0.5764575", "0.5739277", "0.57192236", "0.5717773", "0.5703981", "0.5691118", "0.56885505", "0.568441", "0.5682311", "0.566573", "0.56436867", "0.5618915", "0.56121784", "0.55846775", "0.5578447", "0.55648136", "0.5530242", "0.5518205", "0.5514982", "0.5493404", "0.54915506", "0.5488704", "0.5474721", "0.54634005", "0.54508877", "0.54502416", "0.5442004", "0.5442004", "0.54350275", "0.542978", "0.5421628", "0.54137576", "0.540032", "0.53988945", "0.53975314", "0.5392446", "0.53706694", "0.5364748", "0.53639185", "0.5363767", "0.53494114", "0.5347009", "0.5341989", "0.5340258", "0.5340258", "0.5319855", "0.53128856", "0.5296673", "0.5286348", "0.5285993", "0.52738476", "0.5268581", "0.5257262", "0.52557546", "0.5226705", "0.5214744", "0.5211443", "0.5207896", "0.5202578", "0.5194126", "0.51849824" ]
0.6786612
1
GET /administration/characters/1 GET /administration/characters/1.xml
def show @character = Character.get(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @character } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @characters = @user.characters.find :all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @characters }\n end\n end", "def index\n @characters = Character.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @characters }\n end\n end", "def show\n @game_characters = GameCharacters.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @game_characters }\n end\n end", "def spells\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @character }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @character }\n end\n end", "def show\n @character_trait = CharacterTrait.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @character_trait }\n end\n end", "def fetch_characters\n api = EVEAPI::API.new\n api.api_id = api_id\n api.v_code = v_code\n\n xml = api.get(\"account/APIKeyInfo\")\n characters = []\n xml.xpath(\"//row\").each do |row|\n characters << {\n :name => row['characterName'],\n :id => row['characterID'],\n :corporation_name => row['corporationName'],\n :corporation_id => row['corporationID'],\n :api_id => api_id,\n :v_code => v_code\n }\n end\n characters \n end", "def show\n @characteristic = Characteristic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @characteristic }\n end\n end", "def feats\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @character }\n end\n end", "def combat\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @character }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @character_service }\n end\n end", "def show\n @character = current_user.characters.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @character }\n end\n end", "def skills\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @character }\n end\n end", "def inventory\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @character }\n end\n end", "def index\n begin\n @list_title = \"Your characters\"\n if params[:user_id]\n @user = User.friendly.find(params[:user_id])\n if @user && @user != current_user\n @list_title = \"#{@user.username}'s characters\"\n end\n else\n @user = current_user\n end\n @characters = Character.where(:user_id => @user.id).includes(:race).includes(:career)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @characters.to_json(include: [:race, :career]) }\n format.xml { render xml: @characters.to_xml(include: [:race, :career, :weapons, :armors, :gears]) }\n end\n rescue ActiveRecord::RecordNotFound\n redirect_to :root\n return\n end\n end", "def index\n authorize! :manage, Character\n\n @characters = @characters.includes(:user).ordered\n\n respond_to do |format|\n format.html { @characters = @characters.page(params[:page]).per(50) }\n format.json { }\n end\n end", "def show\n @character = Character.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :text => full_character_json(@character)}\n format.xml { render :xml => @character }\n end\n end", "def index\n if params[:user_id]\n @characters = User.find(params[:user_id]).characters\n else\n @characters = Character.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @characters }\n end\n end", "def index\n @characters = current_user.characters.all\n end", "def show\n @character = current_user.characters.find(params[:id])\n end", "def show\n @administration = Administration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @administration }\n end\n end", "def index\n\t@story = Story.find(params[:story_id])\n @characters = Character.all\n \tadd_breadcrumb \"Stories\", stories_path\n\tadd_breadcrumb @story.title, @story\n\tadd_breadcrumb \"Characters\", ''\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @characters }\n end\n end", "def show\n @bookcharacter = Bookcharacter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bookcharacter }\n end\n end", "def show\n @character = Character.find(params[:id])\n \tadd_breadcrumb \"Stories\", stories_path\n\tadd_breadcrumb @character.story.title, @character.story\n\tadd_breadcrumb \"Characters\", story_characters_path(@character.story)\n\tadd_breadcrumb @character.name, ''\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @character }\n end\n end", "def show\n @character = Character.find(params[:id])\n if session[:userid] != nil and session[:userid] != ''\n @valid_staff = Staff.find(:first, :conditions => [\"userid = ? \", session[:userid]])\n end\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @character }\n end\n end", "def index\r\n @characters = Character.all\r\n end", "def show\n @character = Character.find(params[:id])\n end", "def show\n @character = Character.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @character }\n end\n end", "def index\n @characters = Character.all\n end", "def index\n @characters = Character.all\n end", "def index\n @characters = Character.all\n end", "def index\n @characters = Character.all\n end", "def index\n @characters = Character.all\n end", "def index\n @characters = Character.all\n end", "def index\n @characters = Character.all\n end", "def index\n @characters = Character.all\n end", "def character\n fetch('books.the_kingkiller_chronicle.characters')\n end", "def index\n @relationships = @character.relationships.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @relationships }\n end\n end", "def list_characters\n puts \"\"\n puts \"-----------------------------------------------\"\n puts \"\"\n puts \"Please select a character number:\"\n puts \"\"\n Api.all_character_data_list_of_names\n list_characters_options\n end", "def new\n @character = Character.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @character }\n end\n end", "def new\n @character = Character.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @character }\n end\n end", "def index\n @characters = Character.all.page(params[:page]).per(25)\n end", "def new\n @character = Character.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @character }\n end\n end", "def show\n @charade = Charade.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @charade }\n end\n end", "def edit\n @characters = current_account.characters.all\n end", "def show\n @administrator = Administrator.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @administrator }\n end\n end", "def show\n @administrator = Administrator.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @administrator }\n end\n end", "def get_character(name = @character_name, options = {})\n\t\t\toptions = character_options(name, options)\n\t\t\tcharacter_sheet = get_xml(@@character_sheet_url, options)\n\t\t\tcharacter_reputation = get_xml(@@character_reputation_url, options)\n\t\t\t\n\t\t\t# FIXME\n\t\t\tif true\n\t\t\t\treturn Wowr::Classes::FullCharacter.new(character_sheet,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcharacter_reputation,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tself)\n\t\t\telse\n\t\t\t\traise Wowr::Excceptions::CharacterNotFound.new(options[:character_name])\n\t\t\tend\n\t\tend", "def show\n @texte_accueil = TexteAccueil.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @texte_accueil }\n end\n end", "def new\n @character = @user.build_character\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @character }\n end\n end", "def new\n @character_service = CharacterService.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @character_service }\n end\n end", "def get_characters\n character_hash = look_up('http://www.swapi.co/api/people/')\n character_hash[\"results\"].collect do |element|\n element[\"name\"]\n end\nend", "def index\n @characters = Character.paginate(:page => params[:page], :per_page => 20)\n end", "def character(params)\n characters(id: params[:id]).first\n end", "def index\n if params.has_key?(\"ids\")\n @characters = current_user.characters.where(id: params[\"ids\"].split(\",\"));\n else\n @characters = current_user.characters\n end\n\n @current_character = nil\n cookies.delete :character_id\n end", "def show\n @command = Command.accessible_by(current_ability).find(params[:id])\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @command }\n end\n end", "def get_character_names\n\t\t\tget_all_character_uris.map { |uri| get_character_name(json(uri)) }\n end", "def get_all_characters(page=nil)\n\n if page\n response = RestClient.get(page)\n else\n response = RestClient.get(\"https://swapi.co/api/people\")\n end\n characters_array = JSON.parse(response.body)[\"results\"]\n\n characters_array.each do |character|\n StarWarsCliApi::Character.new(character)\n end\n\n # next_page = JSON.parse(response.body)[\"next\"]\n # if next_page\n # get_all_characters(next_page)\n # end\n end", "def index\n @characters = Character.all\n\n render json: @characters\n end", "def index\n authorize! :manage, @users\n\n @users = @users.includes(:character).ordered\n\n respond_to do |format|\n format.html { @users = @users.page(params[:page]).per(50) }\n format.json { }\n end\n end", "def fetch_list_characters\n response_string = RestClient.get('http://www.swapi.co/api/people/')\n response_hash = JSON.parse(response_string)\n\n character = response_hash[\"results\"].map {|char| char[\"name\"]}\nend", "def show\r\n @game_id = params[:game_id]\r\n @characters = Character.all\r\n begin\r\n if @characters == nil\r\n redirect_to games_path\r\n else\r\n @character = Character.find(params[:id])\r\n end\r\n rescue ActiveRecord::RecordNotFound => e\r\n \r\n end\r\n end", "def show\n @characteristic_quantification = CharacteristicQuantification.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @characteristic_quantification }\n end\n end", "def show\n @charity = Charity.find_by_ident_name(params[:id]) || Charity.find(params[:id])\n #@charities = Charity.find_all_by_lang(@charity.lang)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @charity }\n end\n end", "def get_all_character_uris\n\t\t\tget_all_character_apis.map { |api| uri(api) }\n end", "def admin_xml(path,method=:get,options={})\n xml_message(amee_admin,\"/admin#{path}\",method,options)\n end", "def show\n\t\t@material = @caracteristica.material\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @caracteristica }\n end\n end", "def index\n @characters = current_user.characters\n @current_character = nil\n @character_classes = CharacterClass.all\n end", "def new\n \t@story = Story.find(params[:story_id])\n @character = @story.characters.new\n \tadd_breadcrumb \"Stories\", stories_path\n\tadd_breadcrumb @story.title, @story\n\tadd_breadcrumb \"Characters\", story_characters_path(@story)\n\tadd_breadcrumb \"New character\", ''\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @character }\n end\n end", "def character_races\r\n BnetApi::make_request('/wow/data/character/races')\r\n end", "def abilities\n get('/ability/')\n end", "def detail\n @characters = Character.all\n render json: @characters, each_serializer: CharacterDetailSerializer \n end", "def fetch_all_characters\n if Character.count <= 126\n\n clients = Lol::Client.new ENV[\"RIOT_API_KEY\"], {region: \"euw\"}\n @lore = clients.static.champion.get(champData: 'lore')\n\n @client = Taric.client(region: :oce)\n characters = @client.static_champions[\"data\"]\n\n characters.each do |char|\n\t Character.create :name => \"#{char[1]['name']}\", :image => \"http://ddragon.leagueoflegends.com/cdn/5.13.1/img/champion/#{char[1]['key']}.png\"\n end\n\n @characters = Character.all\n @lore.each_with_index do |lore, i|\n @characters[i].update :lore => lore['lore']\n # Character.save :lore => \"#{lore['lore']}\"\n end\n end\n end", "def show\n @categorie = Categorie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @categorie }\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 index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @privat_spaces }\n end\n end", "def fetch_character_by_name(name)\n uri = URI(BASE_URI + \"?name=#{name}\")\n characters = make_request(uri)\n if characters[0]\n Character.new(characters[0])\n else\n \"Couldn't find a character with that name...\"\n end\n end", "def show\n @cybercontrol = Cybercontrol.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cybercontrol }\n end\n end", "def show\n @cancerword = Cancerword.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cancerword }\n end\n end", "def destroy\n @character = Character.get(params[:id])\n @character.destroy\n\n respond_to do |format|\n format.html { redirect_to(administration_characters_url) }\n format.xml { head :ok }\n end\n end", "def show\n @lab = @course.labs.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @lab }\n end\n end", "def show\n @lookup_letterlabel = LookupLetterlabel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lookup_letterlabel }\n end\n end", "def index\n characters = @project.characters.all\n render json: { characters: characters }\n end", "def show\n @collected_character = CollectedCharacter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @collected_character }\n end\n end", "def show\n @university = University.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @university }\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 create\n @character = Character.new(params[:character])\n\n respond_to do |format|\n if @character.save\n format.html { redirect_to([:administration, @character], :notice => 'Character was successfully created.') }\n format.xml { render :xml => @character, :status => :created, :location => @character }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @character.errors, :status => :unprocessable_entity }\n end\n end\n end", "def show\n @catena = Catena.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @catena }\n end\n end", "def show\n @users_hacktag = UsersHacktag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @users_hacktag }\n end\n end", "def show\n @cattle_id = CattleId.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cattle_id }\n end\n end", "def index\n #@character_services = CharacterService.all\n @search = CharacterService.search(params[:search])\n @character_services = @search.page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erbb\n format.xml { render :xml => @character_services }\n end\n end", "def me\n users(request(\"users/authenticate.xml\", :auth => true))\n end", "def index\n #@feats = Feat.find(:all)\n @feats = @character.feats.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feats }\n end\n end", "def show\n @uitgelicht = Uitgelicht.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @uitgelicht }\n end\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 fetch_character_page(page)\n uri = URI(BASE_URI + \"?page=#{page}\")\n characters = make_request(uri)\n character_instances = characters.map do |character_data|\n Character.new(character_data)\n end\n end", "def show\n @fundamental_character = Fundamental::Character.find_by_id_or_identifier(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fundamental_character }\n end\n end", "def show\n @permission = Permission.find(params[:id])\n\n respond_to do |format|\n format.html { redirect_to(users_url)}\n format.xml { render :xml => @permission }\n end\n end", "def show\n @haiku = Haiku.find(params[:id])\n\n respond_to { |format|\n format.html # show.rhtml\n format.xml {\n\trender :xml => @haiku.to_xml\n }\n }\n end", "def show\n @certificate = Certificate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @certificate }\n end\n end" ]
[ "0.7117075", "0.6543967", "0.64519495", "0.6266482", "0.626439", "0.615174", "0.60918856", "0.6071936", "0.59976935", "0.59520817", "0.5935417", "0.59254724", "0.59215343", "0.5911083", "0.58731705", "0.58684367", "0.58682317", "0.5842294", "0.583959", "0.5829219", "0.5797338", "0.5780093", "0.5750934", "0.5750482", "0.57365245", "0.567118", "0.56671655", "0.5641081", "0.56377", "0.56377", "0.56377", "0.56377", "0.56377", "0.56377", "0.56377", "0.56377", "0.5623127", "0.5606509", "0.55285484", "0.55244213", "0.55244213", "0.551991", "0.5509586", "0.54873997", "0.5479478", "0.5479468", "0.5479468", "0.54435676", "0.5430507", "0.54256034", "0.5424851", "0.5410067", "0.5404181", "0.54013324", "0.5398167", "0.5392218", "0.538483", "0.5367454", "0.5347538", "0.53238165", "0.53216684", "0.531378", "0.52893203", "0.5286859", "0.5280503", "0.5277896", "0.5273346", "0.52725506", "0.5263276", "0.5259331", "0.5257938", "0.5247577", "0.5237111", "0.52276105", "0.5220977", "0.52185047", "0.5203611", "0.5202245", "0.5199921", "0.5197888", "0.5195471", "0.5194448", "0.519296", "0.5191635", "0.51617247", "0.51616126", "0.51564354", "0.51559204", "0.5151959", "0.5148034", "0.51457345", "0.5143868", "0.51432127", "0.51411206", "0.5140012", "0.51371604", "0.5135684", "0.5133695", "0.5130935", "0.51280254" ]
0.64888686
2
GET /administration/characters/new GET /administration/characters/new.xml
def new @character = Character.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @character } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @character = Character.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @character }\n end\n end", "def new\n @character = @user.build_character\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @character }\n end\n end", "def new\n @character = Character.new\n @title = \"New Character\"\n @page = 'new_character'\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def new\n @character_service = CharacterService.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @character_service }\n end\n end", "def new\n @characteristic = Characteristic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @characteristic }\n end\n end", "def new\n @administration = Administration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @administration }\n end\n end", "def new\n @character_trait = CharacterTrait.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @character_trait }\n end\n end", "def new\n \t@story = Story.find(params[:story_id])\n @character = @story.characters.new\n \tadd_breadcrumb \"Stories\", stories_path\n\tadd_breadcrumb @story.title, @story\n\tadd_breadcrumb \"Characters\", story_characters_path(@story)\n\tadd_breadcrumb \"New character\", ''\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @character }\n end\n end", "def new\n @patron = Patron.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @patron }\n end\n end", "def new\n @bookcharacter = Bookcharacter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bookcharacter }\n end\n end", "def create\n @character = Character.new(params[:character])\n\n respond_to do |format|\n if @character.save\n format.html { redirect_to([:administration, @character], :notice => 'Character was successfully created.') }\n format.xml { render :xml => @character, :status => :created, :location => @character }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @character.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @charade = Charade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @charade }\n end\n end", "def new\n @nom = Nom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nom }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ontology }\n end\n end", "def new\n @relationship = @character.relationships.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @relationship }\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 @nickname = Nickname.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nickname }\n end\n end", "def new\n @catena = Catena.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catena }\n end\n end", "def new\n @game_character = GameCharacter.new\n @games = Game.all\n respond_to do |format|\n format.html\n format.xml { render :xml => @game_character }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nomina }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instituto }\n end\n end", "def new\n @modulo = Modulo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @modulo }\n end\n end", "def new\n @patrimonio = Patrimonio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @patrimonio }\n end\n end", "def new\n @contacter = Contacter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contacter }\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 @cat = Cat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cat }\n end\n end", "def new\n @categorie = Categorie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @categorie }\n end\n end", "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @system }\n end\n end", "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 @administrator = Administrator.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @administrator }\n end\n end", "def new\n @administrator = Administrator.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @administrator }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ciclo }\n end\n end", "def new\n @vocab = Vocab.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vocab }\n end\n end", "def new\n @uitgelicht = Uitgelicht.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @uitgelicht }\n end\n end", "def new\n @wildlife = Wildlife.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wildlife }\n end\n end", "def new\n @user_addon = UserAddon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user_addon }\n end\n end", "def new\n @lesson = Lesson.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lesson }\n end\n end", "def new\n @word = Word.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @word }\n end\n end", "def new\n @monkey = Monkey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @monkey }\n end\n end", "def new\n @universe = Universe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @universe }\n end\n end", "def new\n\tputs \"\\n\\t\\t in new\\n\"\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @lien = Lien.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lien }\n end\n end", "def new\n @charity = Charity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @charity }\n end\n end", "def new\n @noun = Noun.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @noun }\n end\n end", "def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resource }\n end\n end", "def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resource }\n end\n end", "def new\n @hacker = Hacker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @hacker }\n end\n end", "def new\n @users_hacktag = UsersHacktag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @users_hacktag }\n end\n end", "def new\n @element = Element.new\n @root_category = Category.find(272)\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @element }\n end\n end", "def new\n @special = Special.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @special }\n end\n end", "def new\n @actattribute = Actattribute.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @actattribute }\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 @texte_accueil = TexteAccueil.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @texte_accueil }\n end\n end", "def new\n @permiso = Permiso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @permiso }\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 @resource = Resource.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resource }\n end\n end", "def new\n @txt = Txt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @txt }\n end\n end", "def new\n @wiki = Wiki.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wiki }\n end\n end", "def new\n @wiki = Wiki.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wiki }\n end\n end", "def new\n @cita = Cita.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cita }\n end\n end", "def new\n @cita = Cita.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cita }\n end\n end", "def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @register }\n end\n end", "def new\n @admin_coleccion = Admin::Coleccion.new\n @page_title = 'Nueva Colección'\n @action = 'Crear Colección'\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @admin_coleccion }\n end\n end", "def new\n @categoria = Categoria.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @categoria }\n end\n end", "def new\n @room = Room.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @room }\n end\n end", "def new\n @room = Room.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @room }\n end\n end", "def new\n @curnit = Curnit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @curnit }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @classroom }\n end\n end", "def new\n @annee = Annee.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @annee }\n end\n end", "def new\n @man = Man.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @man }\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 @registration = Registration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @registration }\n end\n end", "def new\n @registration = Registration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @registration }\n end\n end", "def new\n @registration = Registration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @registration }\n end\n end", "def new\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @category }\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 @estatu = Estatu.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estatu }\n end\n end", "def new\n @temp = Temp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @temp }\n end\n end", "def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recipe }\n end\n end", "def new\n @aplicacion = Aplicacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aplicacion }\n end\n end", "def new\n @typo = Typo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @typo }\n end\n end", "def new\n #@feat = Feat.new\n @feat = @character.feats.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @feat }\n end\n end", "def new\n @aktion = Aktion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aktion }\n end\n end", "def new\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @category }\n end\n end", "def new\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @category }\n end\n end", "def new\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @category }\n end\n end", "def new\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @category }\n end\n end", "def new\n @member = Member.new\n @title = \"New member\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @member }\n end\n end", "def new\n @thing = Thing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thing }\n end\n end", "def new\n @kudo = Kudo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @kudo }\n end\n end", "def new\n @title = t(\"h2.categories\")\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @category }\n end\n end", "def new\n @collected_character = CollectedCharacter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @collected_character }\n end\n end", "def new\n @registration = Registration.new()\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @registration }\n end\n end", "def new\n respond_to do |format|\n format.html\n format.xml\n end\n end", "def new\n @crew = Crew.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @crew }\n end\n end", "def new\n @usuario = Usuario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @usuario }\n end\n end", "def new\n @utilisateur = Utilisateur.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @utilisateur }\n end\n end", "def new\n respond_to do |format|\n format.html { render :layout => 'application' }\n format.xml { render :xml => @recommand }\n end\n end" ]
[ "0.7137016", "0.6925831", "0.6724865", "0.66399926", "0.65627956", "0.65136784", "0.64825016", "0.64626825", "0.6402074", "0.6339901", "0.6266646", "0.6252525", "0.6251108", "0.624846", "0.62344414", "0.622349", "0.6184354", "0.61517066", "0.6136809", "0.6133991", "0.6126514", "0.61140764", "0.6113584", "0.61089927", "0.61020845", "0.6101435", "0.61011463", "0.6099157", "0.60734165", "0.606504", "0.606504", "0.6063661", "0.60559434", "0.60448474", "0.60428673", "0.6041523", "0.60391617", "0.60366064", "0.60358423", "0.60304683", "0.6029064", "0.602367", "0.6015008", "0.60136396", "0.6013453", "0.6013453", "0.60099", "0.6004356", "0.60008204", "0.5997005", "0.5992064", "0.59893656", "0.59893656", "0.5984854", "0.5976458", "0.59686434", "0.59656996", "0.59628546", "0.5962828", "0.5962828", "0.5961389", "0.5961389", "0.59540844", "0.59449697", "0.5938453", "0.59300053", "0.59300053", "0.5924564", "0.5918408", "0.59175324", "0.591525", "0.59139526", "0.5911703", "0.5911703", "0.5911703", "0.5907149", "0.5906732", "0.59065455", "0.59002095", "0.5899586", "0.58988327", "0.5898421", "0.58976966", "0.5892674", "0.58885926", "0.58885926", "0.58885926", "0.58885926", "0.58806443", "0.58793724", "0.5878952", "0.58773756", "0.5877267", "0.58736163", "0.587085", "0.58698535", "0.5869025", "0.58690035", "0.58650887" ]
0.7145752
1
POST /administration/characters POST /administration/characters.xml
def create @character = Character.new(params[:character]) respond_to do |format| if @character.save format.html { redirect_to([:administration, @character], :notice => 'Character was successfully created.') } format.xml { render :xml => @character, :status => :created, :location => @character } else format.html { render :action => "new" } format.xml { render :xml => @character.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @character = @user.build_character(params[:character])\n\n respond_to do |format|\n if @character.save\n flash[:notice] = 'Character was successfully created.'\n format.html { redirect_to(@character) }\n format.xml { render :xml => @character, :status => :created, :location => @character }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @character.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @character = Character.new(params[:character])\n\n respond_to do |format|\n if @character.save\n flash[:notice] = 'Character was successfully created.'\n format.html { redirect_to(@character) }\n format.xml { render :xml => @character, :status => :created, :location => @character }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @character.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @character = Character.new(character_params)\n\n respond_to do |format|\n if @character.save\n Ability.all.each {|a|\n CharacterAbility.create(ability: a, character: @character, value: 10)\n }\n format.html { redirect_to @character, notice: 'Character was successfully created.' }\n format.json { render :show, status: :created, location: @character }\n else\n format.html { render :new }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @character = current_user.characters.new(character_params)\n\n respond_to do |format|\n if @character.save\n format.html { redirect_to @character, notice: I18n.translate(\"success\", scope: %i[characters new]) }\n format.json { render :show, status: :created, location: @character }\n else\n format.html { render :new }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end", "def character_params\n params.require(:character).permit(:name)\n end", "def create\n @character = Character.new(character_params)\n\n respond_to do |format|\n if @character.save\n format.html { redirect_to @character, notice: 'Character was successfully created.' }\n format.json { render action: 'show', status: :created, location: @character }\n else\n format.html { render action: 'new' }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n\n # save associated entries also.\n end\n end", "def character_params\n params.require(:character).permit(:name, :realm, :confirmed)\n end", "def index\n @characters = @user.characters.find :all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @characters }\n end\n end", "def new\n @character = @user.build_character\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @character }\n end\n end", "def create\n \t@story = Story.find(params[:story_id])\n @character = @story.characters.new(params[:character])\n \tadd_breadcrumb \"Stories\", stories_path\n\tadd_breadcrumb @story.title, @story\n\tadd_breadcrumb \"Characters\", story_characters_path(@story)\n\tadd_breadcrumb \"New character\", ''\n\n respond_to do |format|\n if @character.save\n format.html { redirect_to(@character, :notice => 'Character was successfully created.') }\n format.xml { render :xml => @character, :status => :created, :location => @character }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @character.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @character = Character.new(character_params)\n populate_character\n\n respond_to do |format|\n if @character.save\n format.html { redirect_to @character, notice: 'Character was successfully created.' }\n format.json { render :show, status: :created, location: @character }\n else\n format.html { render :new }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @character = Character.new(character_params)\n if @character.save\n render json: @character, status: 201\n else\n render json: @character.errors, status: :unprocessable_entity\n end\n end", "def create\n Character.create(\n name: params[:name],\n gender: params[:gender],\n quirk: params[:quirk],\n book_id: params[:book_id])\n redirect_to \"/books/#{params[:book_id]}/characters\"\n end", "def create\n @character = Character.new(character_params)\n\n respond_to do |format|\n if @character.save\n format.html { redirect_to @character, notice: 'Character was successfully created.' }\n format.json { render :show, status: :created, location: @character }\n else\n format.html { render :new }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @character = Character.new(character_params)\n\n respond_to do |format|\n if @character.save\n format.html { redirect_to @character, notice: 'Character was successfully created.' }\n format.json { render :show, status: :created, location: @character }\n else\n format.html { render :new }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end", "def character_params\n params.require(:character).permit(:name, \n :image, \n celebrity_ids: [],\n universe_ids: []\n )\n end", "def character_params\n params.require(:character).permit(:name, :exp, :hp, :hp_regen, :power, :power_regen, :speed, :size, :move_type, :element, :color_schema, :emblem, :functions, :sprite, :sprite_idle, :sprite_death, :sprite_hat, :sprite_jacket, :sprite_shoes, :sprite_scarf, :user_id, :prime_gun_id, :secondary_gun_id, :prime_ability_id, :secondary_ability_id)\n end", "def create\n @character = Character.new\n\n @character.name = params[:name]\n @character.atk = params[:attack]\n @character.def = params[:defense]\n @character.hp = 80\n @character.xp = 0\n @character.level = 1\n @character.unassigned = params[:unassigned]\n @character.user_id = @current_user.id\n\n\n respond_to do |format|\n if @character.save\n format.html { redirect_to user_path(@current_user), notice: 'Successfully Created New Character.'}\n else\n redirect_to \"/users/#{@current_user}\"\n end\n end\n end", "def create\n respond_to do |format|\n if @character.save\n format.html { redirect_to @character, notice: 'Character was successfully created.' }\n format.json { render action: 'show', status: :created, location: @character }\n else\n format.html { render action: 'new' }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n raise BadRequestError.new('no current character') if current_character.nil?\n raise BadRequestError.new('missing parameter(s)') if params[:character].nil? || params[:character][:name].blank?\n\n current_character.change_name_transaction(params[:character][:name].strip) \n \n respond_to do |format|\n format.json { render json: {}, status: :ok }\n end\n end", "def character_params\n params.require(:character).permit(:name, :description, :thumbnail, :urls, :comics, :events, :series, :user_id)\n end", "def character_params\n params.require(:character).permit(:first_name, :last_name, :nick_name, :title, :description, :traits, :skills, :history, :strength, :vitality, :agility, :dexterity, :intelligence, :mind)\n end", "def character_params\n params.require(:character).permit(:name, :life, :strength, :dexterity, :constitution, :intelligence, :wisdom, :charisma)\n end", "def character_params\n params.require(:character).permit(:immortal_id, :dead, :is_immortal, :name, :description)\n end", "def character_params\n params.require(:character).permit(:name, :position, :devilfruit, :haki, :society_id)\n end", "def character_params\n params.require(:character).permit(:name, :game_id, :major_attr, :minor_attr, \n :description, :inventory)\n end", "def new\n @character = Character.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @character }\n end\n end", "def index\n @characters = Character.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @characters }\n end\n end", "def create\n @character = Character.new(character_params)\n @character.user = current_user\n\n respond_to do |format|\n if @character.save\n format.html { redirect_to new_character_description_path(@character), notice: 'Character was successfully created.' }\n format.json { render action: 'show', status: :created, location: @character }\n else\n format.html { render action: 'new' }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end", "def character_params\n params.require(:character).permit(\n :id,\n :exp,\n :name,\n :strength,\n :intelligence,\n :wisdom,\n :dexterity,\n :constitution,\n :looks,\n :charisma,\n :building_points,\n :health,\n :item_ids,\n :character_class_id,\n :race_id,\n :user_id,\n :alignment,\n :sex,\n :age,\n :height,\n :weight,\n :hair,\n :eyes,\n :handedness,\n :trade_coins,\n :copper,\n :silver,\n :gold,\n :spell_points,\n :luck_points\n )\n end", "def character_params\n params[:character].permit(:name, :game_class, :game_role, :game_tag, :game_alt_role, :armory_addr)\n end", "def character_params\n params.require(:character).permit(:name, :summary, :campaign, :user_id, :race_id, :class_id)\n end", "def new\n @character = Character.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @character }\n end\n end", "def new\n @character = Character.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @character }\n end\n end", "def create\n @character_trait = CharacterTrait.new(params[:character_trait])\n\n respond_to do |format|\n if @character_trait.save\n flash[:notice] = 'CharacterTrait was successfully created.'\n format.html { redirect_to(@character_trait) }\n format.xml { render :xml => @character_trait, :status => :created, :location => @character_trait }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @character_trait.errors, :status => :unprocessable_entity }\n end\n end\n end", "def character_params\n params.require(:character).permit(:name, :wiki_link, :full_image_link, :thumb_image_link, :gameplay, :fighting_style, :archetype, :difficulty, :tier, :publish, :strengths, :weaknesses, :movement)\n end", "def character_params\n params.require(:character).permit(:name, :description, :thumbnail, :code)\n end", "def character_params\n params.require(:character).permit(:age, :ethnicity, :nationality, :mother_tongue, :occupation, :lastname, :firstname, :gender, :obsession, :order_alignment, :secret_language, :moral_alignment, :eye_colour, :skin_base_tone, :favourite_food, :favourite_drink, :ailment, :star_sign)\n end", "def create\n @character = current_user.characters.new(character_params)\n\n # This has issues with case, resulting in dupes of the same tag\n #@character.tag_list = params[:character][:property] + \", \" + params[:tag_list]\n @character.tag_list = params[:tag_list]\n\n respond_to do |format|\n if @character.save\n\n if params[:auto_register_game_id]\n @game = Game.find_by_id(params[:auto_register_game_id])\n playerRegistration = PlayerRegistration.find_by_game_id_and_user_id(params[:auto_register_game_id], current_user.id)\n\n if @game && playerRegistration\n characterRegistration = CharacterRegistration.new\n @game.character_registrations << characterRegistration\n @character.character_registrations << characterRegistration\n characterRegistration.status = playerRegistration.status\n playerRegistration.character_registrations << characterRegistration\n\n @character.associate_products_from_game(@game)\n\n if characterRegistration.status == 'active'\n UserNotifier.game_register_character_notice(@game, characterRegistration).deliver\n end\n\n redirect_to registration_desk_path(@game)\n return\n else\n flash[:error] = 'You can not create characters for a game you are not registered in.'\n redirect_to(@character)\n return\n end\n\n end\n\n flash[:notice] = 'Character was successfully created.'\n format.html { redirect_to(@character) }\n format.xml { render :xml => @character, :status => :created, :location => @character }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @character.errors, :status => :unprocessable_entity }\n end\n end\n end", "def character_params\n params.permit(:user_id, :name, :description)\n end", "def attribute_params\n params.permit(:character,\n :utf8, :_method, :authenticity_token, :book_id, :age, :year, :death_age, :button, :id, :story_id,\n array_character_attributes)\n end", "def character_params\n params.require(:character).permit(:name, :reason_for_name, :nickname, :reason_for_nickname, :ethnicity, :occupation_class,\n :social_class, :first_name, :middle_name, :last_name, :suffix, :birth_year, :death_year,\n :age_at_son, :father_id, :honorific, :grouping, :use_honorific_only, :background, :mother_id,\n :sex, :main, :thumbnail)\n end", "def create\n @character = Character.new(character_params)\n puts @character\n authorize! :create, @character\n\n respond_to do |format|\n if @character.save\n format.html { redirect_to @character, notice: 'Character was successfully created.' }\n format.json { render :show, status: :created, location: @character }\n else\n format.html { render :new }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n if @character = Character.create_with_char_data(character_params, current_user, game)\n format.json { render json: {redirect: character_path(@character).to_s} }\n else\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end", "def spells\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @character }\n end\n end", "def character_params\n params.require(:character).permit(:name, :campaign_id, :race, :char_class, :level, :alignment, :xp, :str, :dex, :con, :int, :wis, :cha, :prof_bonus, :hp, :ac, :hit_dice, :inventory, :feats)\n end", "def set_character\n # byebug\n @character = Character.find(params[:id])\n end", "def character_params\n params.require(:character).permit(:name, :life_points, :attack_points, :description, :avatar)\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def character_params\n params.require(:character).permit(:name, :char_name, :background, :faction_id, :profession_id, :alignment_id, :user_id, :adventure_id, :experience, :strength, :dexterity, :constitution, :intelligence, :wisdom, :charisma, :armor_class, :initiative, :hit_points)\n end", "def initiation_params\n params.require(:initiation).permit(:characters)\n end", "def character_params\n params.require(:character).permit(:name, :age, :voice_actor, :first_appearance, :job)\n end", "def character_params\n params.require(:character).permit(:fullname, :birthday, :age)\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def create\n @character = Character.new(character_params)\n @character.user_id = current_user.id\n @character.game_id = @game.id\n\n respond_to do |format|\n if @character.save\n format.html { redirect_to @game, notice: 'Ура! Персонаж создан!' }\n format.json { render action: 'show', status: :created, location: @character }\n else\n format.html { render action: 'new' }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end", "def character_params\n permit = policy(@character || Character).permitted_attributes\n params.require(:character).permit(*permit)\n end", "def create\n @fundamental_character = Fundamental::Character.new(params[:fundamental_character])\n\n respond_to do |format|\n if @fundamental_character.save\n format.html { redirect_to @fundamental_character, notice: 'Character was successfully created.' }\n format.json { render json: @fundamental_character, status: :created, location: @fundamental_character }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fundamental_character.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @character_entry = CharacterEntry.new(character_entry_params)\n\n respond_to do |format|\n if @character_entry.save\n format.html { redirect_to @character_entry, notice: 'Character entry was successfully created.' }\n format.json { render action: 'show', status: :created, location: @character_entry }\n else\n format.html { render action: 'new' }\n format.json { render json: @character_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def character_params\n params.require(:character).permit(:nym, :fullname, :birthyear, :details, :project_id)\n end", "def character_params\n params.require(:character).permit(:name, :age, :history, :weight, :id)\n end", "def create\n @character = Character.new(character_params)\n if @character.save\n render json: {\n status: :created,\n character: @character\n }\n else\n render json: {\n status: 500,\n errors: @character.errors.full_messages\n }\n end\n end", "def create\n @character = Character.get!(params[:character])\n @character ||= Character.new(params[:character])\n\n # If character save was successful, redirect to rebuild_items_path\n if @character.save\n redirect_to rebuild_items_path(:c => @character._id)\n else\n return new\n end\n end", "def character_params\n params.require(:character).permit(:name, :house_id, :abstract, :description, :background, :appears_in_season_1, :appears_in_season_2, :appears_in_season_3, :appears_in_season_4, :appears_in_season_5, :appears_in_season_6, :appears_in_season_7, :appears_in_season_8, :appears_in_season_9, :father, :mother, :spouse, :children, :siblings)\n end", "def create\n @character = Character.new(params[:character])\n if params[:story]\n if params[:story][:name] != nil and params[:story][:name].strip != ''\n story = Story.find_by_name(params[:story][:name].strip)\n if story\n\n @character.story_id = story.id\n end\n end\n end\n respond_to do |format|\n if @character.save\n if params[:avatar] then\n @character.save_avatar(params[:avatar])\n end\n format.html { redirect_to(@character, :notice => 'Character was successfully created.') }\n format.xml { render :xml => @character, :status => :created, :location => @character }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @character.errors, :status => :unprocessable_entity }\n end\n end\n end", "def character_params\n params.require(:character).permit(:character_name, :player_name, :age, :gender, :eyes, :height, :hair, :weight, :gear, :description, :history, :crossroads, :notes)\n end", "def character_params\r\n params.require(:character).permit(:name, :player, :concept, :maxHealth, :currentHealth, :brawn, :agility, :wit, :intelligence, :charm, :presence, :maxDodge, :currentDrive, :initiative, :maxDrive, :currentDrive, :game_id, :athletics, :biology, :computers, :empathy, :engineering, :explosives, :firearms, :law, :lying, :melee, :piloting, :persuasion, :perform, :sneaking, :spacewise, :survival, :telekinesis, :telepathy, :special, :user_id)\r\n end", "def write_character(character)\n characters = read_characters()\n characters << $character\n f = File.open(\"characters.json\", \"w\")\n f << characters.to_json\n f.close\nend", "def new\n @character_trait = CharacterTrait.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @character_trait }\n end\n end", "def commit_characters\n attributes.fetch(:commitCharacters)\n end", "def character_params\n params.require(:character).permit(:name, :race, :player_id, :campaign_id, :alignment, :current_xp, :max_hp, :current_hp, :speed, :notes, :has_inspiration, :adventuring_class_id, :character_abilities, :character_skills, :inventories)\n end", "def create\n @character = Character.new(character_params)\n\n #Match this character's user ID to the current user's ID.\n @character.user_id = current_user.id\n respond_to do |format|\n if @character.save\n format.html { redirect_to @character, notice: 'Character was successfully created.' }\n format.json { render :show, status: :created, location: @character }\n else\n format.html { render :new }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @character = Character.new(character_params)\n\n @character.details = Sanitize.fragment(@character.details, Sanitize::Config::RELAXED)\n\n respond_to do |format|\n if @character.save\n format.html { redirect_to @character, notice: 'Character was successfully created.' }\n format.json { render :show, status: :created, location: @character }\n else\n format.html { render :new }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end", "def on_characters(chars)\n end", "def character_category_params\n params.require(:character_category).permit(:name, :position)\n end", "def list_characters\n puts \"\"\n puts \"-----------------------------------------------\"\n puts \"\"\n puts \"Please select a character number:\"\n puts \"\"\n Api.all_character_data_list_of_names\n list_characters_options\n end", "def feats\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @character }\n end\n end", "def set_character\r\n @character = Character.find_by(params[:user_id])\r\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def index\n @characters = Character.all\n end" ]
[ "0.6119401", "0.60532725", "0.59966314", "0.59722495", "0.5949715", "0.5833275", "0.583012", "0.58243775", "0.5779657", "0.57792294", "0.57703334", "0.5741661", "0.57349503", "0.57203096", "0.57203096", "0.57126504", "0.5687078", "0.56835383", "0.56731176", "0.56637275", "0.5649007", "0.56489193", "0.56429446", "0.56340706", "0.5633934", "0.56328607", "0.5628726", "0.5623549", "0.5622144", "0.5618305", "0.56168544", "0.56148505", "0.5611922", "0.5611922", "0.5610763", "0.56091964", "0.5608262", "0.5591512", "0.557856", "0.55777735", "0.5577439", "0.556629", "0.556055", "0.5549213", "0.5530455", "0.55081445", "0.5498273", "0.5486278", "0.54778117", "0.54778117", "0.5459043", "0.5447729", "0.54423094", "0.54203725", "0.54195064", "0.54195064", "0.54195064", "0.54195064", "0.54195064", "0.54195064", "0.54195064", "0.54195064", "0.54195064", "0.54195064", "0.54195064", "0.54195064", "0.54195064", "0.54195064", "0.54195064", "0.54195064", "0.54195064", "0.54195064", "0.54195064", "0.5410174", "0.540894", "0.54056257", "0.53981346", "0.5373764", "0.53714895", "0.53679806", "0.53363794", "0.53358847", "0.5327825", "0.53199047", "0.531393", "0.5303862", "0.5296299", "0.52810615", "0.528021", "0.5274802", "0.52723783", "0.52673423", "0.5264464", "0.5255002", "0.5247814", "0.5241404", "0.5238803", "0.5226497", "0.5226497", "0.52128416" ]
0.65709054
0
PUT /administration/characters/1 PUT /administration/characters/1.xml
def update @character = Character.get(params[:id]) params[:character] = params[:character].map { |x,y| [x, y.empty? ? nil : y ] }.to_hash respond_to do |format| if @character.update(params[:character]) format.html { redirect_to([:administration, @character], :notice => 'Character was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @character.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @character = current_user.characters.find(params[:id])\n\n # This has issues with case, resulting in dupes of the same tag\n #@character.tag_list = params[:character][:property] + \", \" + params[:tag_list]\n @character.tag_list = params[:tag_list]\n\n respond_to do |format|\n if @character.update_attributes(character_params)\n\n flash[:notice] = 'Character was successfully updated.'\n format.html { redirect_to(@character) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @character.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @game_characters = GameCharacters.find(params[:id])\n\n respond_to do |format|\n if @game_characters.update_attributes(params[:game_characters])\n flash[:notice] = 'GameCharacters was successfully updated.'\n format.html { redirect_to(@game_characters) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @game_characters.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @character_trait = CharacterTrait.find(params[:id])\n\n respond_to do |format|\n if @character_trait.update_attributes(params[:character_trait])\n flash[:notice] = 'CharacterTrait was successfully updated.'\n format.html { redirect_to(@character_trait) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @character_trait.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @characteristic = Characteristic.find(params[:id])\n\n respond_to do |format|\n if @characteristic.update_attributes(params[:characteristic])\n format.html { redirect_to(@characteristic, :notice => 'Characteristic was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @characteristic.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @character_service.update_attributes(params[:character_service])\n format.html { redirect_to(@character_service, :notice => 'Character service was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @character_service.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @character = Character.find(params[:id])\n \tadd_breadcrumb \"Stories\", stories_path\n\tadd_breadcrumb @character.story.title, @character.story\n\tadd_breadcrumb \"Characters\", story_characters_path(@character.story)\n\tadd_breadcrumb @character.name, @character\n\tadd_breadcrumb \"Edit character\", ''\n\n respond_to do |format|\n if @character.update_attributes(params[:character])\n format.html { redirect_to(@character, :notice => 'Character was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @character.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 update\n respond_to do |format|\n if @character.update(character_params)\n format.html { redirect_to @character, notice: I18n.translate(\"success\", scope: %i[characters edit]) }\n format.json { render :show, status: :ok, location: @character }\n else\n format.html { render :edit }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @character = Character.find(params[:id])\n\n @character.send(\"#{params[:field]}=\", params[:value])\n \n\n respond_to do |format|\n if @character.save\n flash[:notice] = 'Character was successfully updated.'\n format.html { redirect_to(@character) }\n format.json {render :text => full_character_json(@character)}\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :text => full_character_json(@character)}\n format.xml { render :xml => @character.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @character.update(character_params)\n render json: @character, status: 201, location: @character\n else\n render json: @character.errors, status: :unprocessable_entity\n end\n end", "def update\n @character = current_user.characters.find(params[:id])\n @assets = Asset.where(:company_id => current_user.company_id)\n # respond_to do |format|\n if @character.update_attributes(params[:character])\n # solr.update(:character)\n redirect_to @character, notice: 'Character was successfully updated.'\n # format.json { head :no_content }\n else\n render action: \"edit\"\n # format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n # end\n end", "def update\n authorize! :update, @character\n respond_to do |format|\n if @character.update(character_params)\n format.html { redirect_to edit_character_path(@character), notice: 'Character was successfully updated.' }\n format.json { render :show, status: :ok, location: @character }\n else\n format.html { render :edit }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @character = Character.find(params[:id])\n if params[:story]\n if params[:story][:name] != nil and params[:story][:name].strip != ''\n story = Story.find_by_name(params[:story][:name].strip)\n if story\n\n @character.story_id = story.id\n end\n else\n @character.story_id = nil\n end\n end\n respond_to do |format|\n if @character.update_attributes(params[:character])\n if params[:avatar] then\n @character.save_avatar(params[:avatar])\n end\n format.html { redirect_to(@character, :notice => 'Character was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @character.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @character = Character.find_or_initialize_by_id(params[:id])\n @character.id = params[:id] # mass-assignment protection\n respond_to do |format|\n if @character.update_attributes(params[:character])\n format.html { redirect_to edit_character_url(@character), notice: 'Character was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bookcharacter = Bookcharacter.find(params[:id])\n\n respond_to do |format|\n if @bookcharacter.update_attributes(params[:bookcharacter])\n flash[:notice] = 'Bookcharacter was successfully updated.'\n format.html { redirect_to(@bookcharacter) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bookcharacter.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @caracteristica.update_attributes(params[:caracteristica])\n format.html { redirect_to(@caracteristica.material, :notice => 'La característica fue actualizada.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @caracteristica.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @character.update(character_params)\n format.html { redirect_to @character, notice: 'Character was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @command = Command.accessible_by(current_ability).find(params[:id])\n\n respond_to do |format|\n if @command.update_attributes(params[:command])\n format.xml { head :ok }\n else\n format.xml { render :xml => @command.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @character.update(character_params)\n format.html { redirect_to @character, notice: 'Character was successfully updated.' }\n format.json { render :show, status: :ok, location: @character }\n else\n format.html { render :edit }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @character.update(character_params)\n format.html { redirect_to @character, notice: 'Character was successfully updated.' }\n format.json { render :show, status: :ok, location: @character }\n else\n format.html { render :edit }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @character.update(character_params)\n format.html { redirect_to @character, notice: 'Character was successfully updated.' }\n format.json { render :show, status: :ok, location: @character }\n else\n format.html { render :edit }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @character.update(character_params)\n format.html { redirect_to @character, notice: 'Character was successfully updated.' }\n format.json { render :show, status: :ok, location: @character }\n else\n format.html { render :edit }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @character.update(character_params)\n format.html { redirect_to @character, notice: 'Character was successfully updated.' }\n format.json { render :show, status: :ok, location: @character }\n else\n format.html { render :edit }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @character.update(character_params)\n format.html { redirect_to @character, notice: 'Character was successfully updated.' }\n format.json { render :show, status: :ok, location: @character }\n else\n format.html { render :edit }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @character.update(character_params)\n format.html { redirect_to @character, notice: 'Character was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @character.update(character_params)\n format.html { redirect_to @game, notice: 'Ура! Персонаж обновлен!' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @users_hacktag = UsersHacktag.find(params[:id])\n\n respond_to do |format|\n if @users_hacktag.update_attributes(params[:users_hacktag])\n format.html { redirect_to(@users_hacktag, :notice => 'Users hacktag was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @users_hacktag.errors, :status => :unprocessable_entity }\n end\n end\n end", "def api_update_for(not_needed_params = {})\r\n api = set_api\r\n begin\r\n xml = api.get(\"char/CharacterSheet\")\r\n rescue Exception => e\r\n logger.error e.inspect\r\n else\r\n # Update date of birth manually because of discrepancy between DB and API name\r\n self.date_of_birth = xml.xpath('/eveapi/result/DoB').text\r\n # Set Array containing xml paths\r\n a = [\"race\", \"bloodLine\", \"ancestry\", \"gender\", \"corporationID\",\r\n \"cloneName\", \"cloneSkillPoints\", \"balance\",\r\n \"attributes/intelligence\", \"attributes/memory\",\r\n \"attributes/charisma\", \"attributes/perception\",\r\n \"attributes/willpower\"]\r\n # Update attributes using the XML paths\r\n a.each do |param|\r\n param_u = param.gsub(\"attributes/\", \"\").underscore\r\n if respond_to?(:\"#{param_u}=\")\r\n send(:\"#{param_u}=\", xml.xpath(\"/eveapi/result/\" + param).text)\r\n end\r\n end\r\n self.save\r\n\r\n # Update implants rowset\r\n implant.api_update\r\n EveRole.api_update(self, xml)\r\n end\r\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 respond_to do |format|\n if @accesot.update(accesot_params)\n format.html { redirect_to @accesot, notice: 'Accesot was successfully updated.' }\n format.json { render :show, status: :ok, location: @accesot }\n else\n format.html { render :edit }\n format.json { render json: @accesot.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @administration = Administration.find(params[:id])\n\n respond_to do |format|\n if @administration.update_attributes(params[:administration])\n format.html { redirect_to(@administration, :notice => 'Administration was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @administration.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @charade = Charade.find(params[:id])\n\n respond_to do |format|\n if @charade.update_attributes(params[:charade])\n flash[:notice] = 'Charade was successfully updated.'\n format.html { redirect_to(@charade) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @charade.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_should_update_link_via_API_XML\r\n get \"/logout\"\r\n put \"/links/1.xml\", :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response 401\r\n end", "def update\n @fundamental_character = Fundamental::Character.find(params[:id])\n\n respond_to do |format|\n if @fundamental_character.update_attributes(params[:fundamental_character])\n format.html { redirect_to @fundamental_character, notice: 'Character was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fundamental_character.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @contacter = Contacter.find(params[:id])\n\n respond_to do |format|\n if @contacter.update_attributes(params[:contacter])\n format.html { redirect_to @contacter, notice: 'Contacter was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contacter.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #@feat = Feat.find(params[:id])\n @feat = @character.feats.find(params[:id])\n\n respond_to do |format|\n if @feat.update_attributes(params[:feat])\n flash[:notice] = 'Feat was successfully updated.'\n format.html { redirect_to(edit_character_path(@character)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @feat.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @ontology = SYMPH::Ontology.find(params[:id])\n\n respond_to do |format|\n if @ontology.update_attributes(params[:ontology])\n flash[:notice] = 'Ontology was successfully updated.'\n format.html { redirect_to(ontologies_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ontology.errors, :status => :unprocessable_entity }\n end\n end\n\t\n end", "def update\n respond_to do |format|\n if @character_entry.update(character_entry_params)\n format.html { redirect_to @character_entry, notice: 'Character entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @character_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def update\n respond_to do |format|\n if @characteristic.update(characteristic_params)\n format.html { redirect_to @characteristic, notice: 'Characteristic was successfully updated.' }\n format.json { render :show, status: :ok, location: @characteristic }\n else\n format.html { render :edit }\n format.json { render json: @characteristic.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n fn = params[:id].gsub('DOTDOT','.').gsub('SLASHSLASH','/')\n File.open(fn,'w+') { |f| \n f.puts params[:content]\n }\n respond_to do |format|\n format.json { render json: { success: true} }\n end\n end", "def update\n @texte_accueil = TexteAccueil.find(params[:id])\n\n respond_to do |format|\n if @texte_accueil.update_attributes(params[:texte_accueil])\n flash[:notice] = 'TexteAccueil was successfully updated.'\n format.html { redirect_to(root_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @texte_accueil.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @universe = Universe.find(params[:id])\n\n respond_to do |format|\n if @universe.update_attributes(params[:universe])\n flash[:notice] = 'Universe was successfully updated.'\n format.html { redirect_to(@universe) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @universe.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @technicals_equipment = TechnicalsEquipment.find(params[:id])\n\n respond_to do |format|\n if @technicals_equipment.update_attributes(params[:technicals_equipment])\n format.html { redirect_to([:admin, @technicals_equipment], :notice => 'TechnicalsEquipment atualizado com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @technicals_equipment.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\n @character_sheet = CharacterSheet.find(params[:id])\n\n respond_to do |format|\n if @character_sheet.update_attributes(params[:character_sheet])\n format.html { redirect_to @character_sheet, notice: 'Character sheet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @character_sheet.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_character\n # byebug\n @character = Character.find(params[:id])\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def update\n @charity = Charity.find(params[:id])\n @charity.attributes = params[:charity]\n\n respond_to do |format|\n if @charity.save!\n flash[:notice] = 'Charity was successfully updated.'\n format.html { redirect_to lang_charity_path(@lang.to_s.split('-').first,@charity) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @charity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @solexame.update(solexame_params)\n flash[:notice] = 'Solicitação foi alterada com sucesso.'\n format.html { redirect_to(@solexame) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @solexame.errors, :status => :unprocessable_entity }\n end\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 @node = Node.scopied.find(params[:id])\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n format.html { redirect_to(@node, :notice => 'Node was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n query = {\n 'name' => params[:name]\n }\n response = HTTParty.put(url, :query => query, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n\n if response.code == 200\n redirect_to unit_path(params[:id]), notice: 'Unit was successfully updated.'\n else\n redirect_to unit_path(params[:id]), notice: 'Sheesh! Minor hiccup...run that again!'\n end\n end", "def update\r\n @uom = Uom.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @uom.update_attributes(params[:uom])\r\n format.html { redirect_to(@uom, :notice => 'Uom was successfully updated.') }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n \r\n end\r\n end\r\n end", "def update\n @cable = Cable.find(params[:id])\n respond_to do |format|\n if @cable.update_attributes(params[:cable])\n format.html { render(:json => {:success => true}) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cable.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @administration = Administration.find(params[:id])\n\n respond_to do |format|\n if @administration.update_attributes(params[:administration])\n format.html { redirect_to @administration, notice: 'Administration was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @administration.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @administration = Administration.find(params[:id])\n\n respond_to do |format|\n if @administration.update_attributes(params[:administration])\n format.html { redirect_to @administration, notice: 'Administration was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @administration.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_character\n @character = Character.find(params[:id])\n end", "def update\n # @character.update character_params\n if @character.update character_params\n render json: {\n status: :updated,\n character: @character\n }\n else\n render json: {\n status: 500,\n errors: @character.errors.full_messages\n }\n end\n end", "def update\n @cattle_id = CattleId.find(params[:id])\n\n respond_to do |format|\n if @cattle_id.update_attributes(params[:cattle_id])\n format.html { redirect_to(@cattle_id, :notice => 'Cattle was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cattle_id.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @ministerio = Ministerio.find(params[:id])\n\n respond_to do |format|\n if @ministerio.update_attributes(params[:ministerio])\n format.html { redirect_to(@ministerio, :notice => 'Ministerio was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ministerio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @character.update(character_params)\n if params[\"UpdateCharacter\"] == \"Update Race\"\n format.html { redirect_to set_class_character_path(@character)}\n elsif params[\"UpdateCharacter\"] == \"Update Class\"\n format.html { redirect_to new_character_feat_assignment_path(@character)}\n else\n format.html { redirect_to character_path, notice: 'Character was successfully updated.' }\n end\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n raise BadRequestError.new('no current character') if current_character.nil?\n raise BadRequestError.new('missing parameter(s)') if params[:character].nil? || params[:character][:name].blank?\n\n current_character.change_name_transaction(params[:character][:name].strip) \n \n respond_to do |format|\n format.json { render json: {}, status: :ok }\n end\n end", "def update\n @collected_character = CollectedCharacter.find(params[:id])\n\n respond_to do |format|\n if @collected_character.update_attributes(params[:collected_character])\n format.html { redirect_to @collected_character, notice: 'Collected character was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @collected_character.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @manufacturer_synonym = ManufacturerSynonym.find(params[:id])\n\n respond_to do |format|\n if @manufacturer_synonym.update_attributes(params[:manufacturer_synonym])\n format.html { redirect_to(manufacturer_manufacturer_synonym_path(@manufacturer_synonym.manufacturer_id, @manufacturer_synonym,{:page => params[:page], :letter => params[:letter]}), :notice => 'Manufacturer synonym was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @manufacturer_synonym.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit(request)\n render do |xml|\n xml.h2 \"Update rack session\"\n xml.p \"Put marshalized and encoded with base64 ruby hash into the form\"\n xml.form({\n :action => action_path(:update),\n :method => 'post',\n :enctype => 'application/x-www-form-urlencoded'\n }) do |form|\n form.input(:type => 'hidden', :name =>'_method', :value => 'put')\n form.textarea(:cols => 40, :rows => 10, :name => 'data') {}\n form.p do |p|\n p.input(:type => 'submit', :value => \"Update\")\n end\n end\n end\n end", "def update\n @actuator = Actuator.find(params[:id])\n\n respond_to do |format|\n if @actuator.update_attributes(params[:actuator].each_value(&:strip!))\n format.html { redirect_to(@actuator, :notice => 'Actuator was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @actuator.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @catena = Catena.find(params[:id])\n\n respond_to do |format|\n if @catena.update_attributes(params[:catena])\n format.html { redirect_to(@catena, :notice => 'Catena was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @catena.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @kontakty = Kontakty.find(params[:id])\n\n respond_to do |format|\n if @kontakty.update_attributes(params[:kontakty])\n flash[:notice] = 'Kontakty was successfully updated.'\n format.html { redirect_to(@kontakty) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @kontakty.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit\n @characters = current_account.characters.all\n end", "def post(buffer)\n connection.post(\"#{configuration.path}/update\", buffer, {'Content-type' => 'text/xml;charset=utf-8'})\n end", "def update\n if @character.update(character_params)\n render json: @character, status: :ok\n else\n render json: @character.errors, status: :unprocessable_entity\n end\n end", "def update\n @title = \"EDITAR WMI NAMESPACE\"\n @wmi_namespace = WmiNamespace.find(params[:id])\n\n respond_to do |format|\n if @wmi_namespace.update_attributes(params[:wmi_namespace])\n flash[:notice] = 'Wmi Namespace fué actualizado correctamente.'\n format.html { redirect_to(@wmi_namespace) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @wmi_namespace.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @character.update(character_params)\n @character.details = Sanitize.fragment(@character.details, Sanitize::Config::RELAXED)\n @character.save\n format.html { redirect_to @character, notice: 'Character was successfully updated.' }\n format.json { render :show, status: :ok, location: @character }\n else\n format.html { render :edit }\n format.json { render json: @character.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 @usuario = Usuario.find(params[:id])\n @usuario.senha = Digest::SHA1.to_s(@usuario.senha)\n\n respond_to do |format|\n if @usuario.update_attributes(params[:usuario])\n format.html { redirect_to(consultar_usuario_path(@usuario), :notice => 'O usuário foi editado com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"editar\" }\n format.xml { render :xml => @usuario.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\r\n @game_id = params[:game_id].to_i \r\n @character = Character.find(params[:id])\r\n respond_to do |format|\r\n if @character.update(character_params)\r\n format.html { redirect_to @character, notice: 'Your Character was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @character }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @character.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @eat = Eat.find(params[:id])\n\n respond_to do |format|\n if @eat.update_attributes(params[:eat])\n flash[:notice] = 'Eat was successfully updated.'\n format.html { redirect_to installation_eat_path(@installation, @eat) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @eat.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @ocat = Ocat.find(params[:id])\n\n respond_to do |format|\n if @ocat.update_attributes(params[:ocat])\n format.html { redirect_to @ocat, notice: 'Ocat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ocat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @enword = Enword.find(params[:id])\n\t@enword.encategory_id = (params[:encategory])\n respond_to do |format|\n if @enword.update_attributes(params[:enword])\n flash[:notice] = 'Enword was successfully updated.'\n format.html {redirect_to(@enword)}\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @enword.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @ficha_tematica = FichaTematica.find(params[:id])\n\n respond_to do |format|\n if @ficha_tematica.update_attributes(params[:ficha_tematica])\n flash[:notice] = 'FichaTematica se ha actualizado con exito.'\n format.html { redirect_to(admin_ficha_tematicas_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ficha_tematica.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.6163145", "0.61080426", "0.60253054", "0.58980256", "0.58952814", "0.5878409", "0.5767526", "0.5690664", "0.5677809", "0.56575507", "0.56550324", "0.5623743", "0.561075", "0.5587094", "0.55801", "0.55734795", "0.5563027", "0.55590004", "0.55161834", "0.54790753", "0.54790753", "0.54790753", "0.54790753", "0.54790753", "0.5466465", "0.546257", "0.54605305", "0.54567254", "0.54347825", "0.54312164", "0.5419219", "0.5410958", "0.5400631", "0.53970814", "0.53933746", "0.5353561", "0.5324646", "0.5321895", "0.528018", "0.528018", "0.5267049", "0.5261613", "0.5259659", "0.52506065", "0.5249149", "0.52454776", "0.52360725", "0.5224969", "0.5215762", "0.5215762", "0.5215762", "0.5215762", "0.5215762", "0.5215762", "0.5215762", "0.5215762", "0.5215762", "0.5215762", "0.5215762", "0.5215762", "0.5215762", "0.5215762", "0.5215762", "0.5215762", "0.5215762", "0.5215762", "0.5215762", "0.5211592", "0.52005243", "0.5200259", "0.5190584", "0.5186396", "0.51784194", "0.5178255", "0.51756126", "0.51756126", "0.5165776", "0.5159467", "0.5153116", "0.5152555", "0.514869", "0.5148406", "0.514667", "0.51425177", "0.5136697", "0.5135148", "0.51348686", "0.51293385", "0.5125849", "0.5125068", "0.51222384", "0.51174885", "0.51163226", "0.5115433", "0.5113371", "0.51124686", "0.5098103", "0.50948006", "0.5090402", "0.50879174" ]
0.6144497
1
DELETE /administration/characters/1 DELETE /administration/characters/1.xml
def destroy @character = Character.get(params[:id]) @character.destroy respond_to do |format| format.html { redirect_to(administration_characters_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @character.destroy\n\n respond_to do |format|\n format.html { redirect_to(characters_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @character = current_user.characters.find(params[:id])\n @character.destroy\n\n respond_to do |format|\n format.html { redirect_to(characters_url) }\n format.xml { head :ok }\n end\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 @game_characters = GameCharacters.find(params[:id])\n @game_characters.destroy\n\n respond_to do |format|\n format.html { redirect_to(game_characters_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @character = Character.find(params[:id])\n @character.destroy\n\n respond_to do |format|\n format.html { redirect_to(characters_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @character = Character.find(params[:id])\n @character.destroy\n\n respond_to do |format|\n format.html { redirect_to(characters_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @texte_accueil = TexteAccueil.find(params[:id])\n @texte_accueil.destroy\n\n respond_to do |format|\n format.html { redirect_to(texte_accueils_url) }\n format.xml { head :ok }\n end\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 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 @administration = Administration.find(params[:id])\n @administration.destroy\n\n respond_to do |format|\n format.html { redirect_to(administrations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @characteristic = Characteristic.find(params[:id])\n @characteristic.destroy\n\n respond_to do |format|\n format.html { redirect_to(characteristics_url) }\n format.xml { head :ok }\n end\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 destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @character_trait = CharacterTrait.find(params[:id])\n @character_trait.destroy\n\n respond_to do |format|\n format.html { redirect_to(character_traits_url) }\n format.xml { head :ok }\n end\n end", "def cmd_delete argv\n setup argv\n e = @hash['element']\n response = @api.delete(e)\n msg response\n return response\n end", "def destroy\n @contacter = Contacter.find(params[:id])\n @contacter.destroy\n\n respond_to do |format|\n format.html { redirect_to contacters_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bookcharacter = Bookcharacter.find(params[:id])\n @bookcharacter.destroy\n\n respond_to do |format|\n format.html { redirect_to(bookcharacters_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ficha_tematica = FichaTematica.find(params[:id])\n @ficha_tematica.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_ficha_tematicas_url) }\n format.xml { head :ok }\n end\n end", "def delete(options={})\n connection.delete(\"/\", @name)\n end", "def destroy\n @tree_node_ac_rights = TreeNodeAcRight.find(params[:id])\n @tree_node_ac_rights.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_tree_node_tree_node_permissions_path }\n format.xml { head :ok }\n end\n end", "def delete(name)\n\n end", "def delete_characters\n @db.execute(\"DROP TABLE Characters\")\n end", "def destroy\n @caracteristica.destroy\n\n respond_to do |format|\n format.html { redirect_to material_url(@caracteristica.material) }\n format.xml { head :ok }\n end\n end", "def destroy\n @admin_coleccion = Admin::Coleccion.find(params[:id])\n @admin_coleccion.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_coleccions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @nom = Nom.find(params[:id])\n @nom.destroy\n\n respond_to do |format|\n format.html { redirect_to(noms_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n #@feat = Feat.find(params[:id])\n @feat = @character.feats.find(params[:id])\n @feat.destroy\n\n respond_to do |format|\n format.html { redirect_to(edit_character_path(@character)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @catena = Catena.find(params[:id])\n @catena.destroy\n\n respond_to do |format|\n format.html { redirect_to(catenas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @administrator = Administrator.find(params[:id])\n @administrator.destroy\n\n respond_to do |format|\n format.html { redirect_to(administrators_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @administrator = Administrator.find(params[:id])\n @administrator.destroy\n\n respond_to do |format|\n format.html { redirect_to(administrators_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n\t\t@direccion = Direccion.find(params[:id])\n\t\t@direccion.destroy\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to(direccions_url) }\n\t\t\tformat.xml { head :ok }\n\t\tend\n\tend", "def delete(name); end", "def delete(name); end", "def delete(id)\r\n connection.delete(\"/#{@doctype}[@ino:id=#{id}]\")\r\n end", "def destroy\n @chef_att_deb.destroy\n respond_to do |format|\n format.html { redirect_to chef_att_debs_url, notice: 'Chef att deb was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @character = current_user.characters.find(params[:id])\n @character.destroy\n\n respond_to do |format|\n format.html { redirect_to characters_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @administrativo = Administrativo.find(params[:id])\n @administrativo.destroy\n\n respond_to do |format|\n format.html { redirect_to(administrativos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n Character.find(params[:id]).destroy\n redirect_to \"/books/#{params[:book_id]}/characters\"\n end", "def deleteCategorySynonym( category_id, synonym, language)\n params = Hash.new\n params['category_id'] = category_id\n params['synonym'] = synonym\n params['language'] = language\n return doCurl(\"delete\",\"/category/synonym\",params)\n end", "def destroy\n @charade = Charade.find(params[:id])\n @charade.destroy\n\n respond_to do |format|\n format.html { redirect_to(charades_url) }\n format.xml { head :ok }\n end\n end", "def delete\n request(:delete)\n end", "def destroy\n @uitgelicht = Uitgelicht.find(params[:id])\n @uitgelicht.destroy\n\n respond_to do |format|\n format.html { redirect_to(uitgelichts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @actattribute = Actattribute.find(params[:id])\n @actattribute.destroy\n\n respond_to do |format|\n format.html { redirect_to(actattributes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @acre = Acre.find(params[:id])\n @acre.destroy\n\n respond_to do |format|\n format.html { redirect_to(acres_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @device_attribute.destroy\n\n respond_to do |format|\n format.html { redirect_to(device_attributes_url) }\n format.xml { head :ok }\n end\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 @article = Article.find_by_sysname(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(articles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @orc_ficha = OrcFicha.find(params[:id])\n @orc_ficha.destroy\n\n respond_to do |format|\n format.html { redirect_to(orc_fichas_url) }\n format.xml { head :ok }\n end\n end", "def delete(attribute); end", "def delete_by_id id, opts = {}\n update opts.merge(:data => xml.delete_by_id(id))\n end", "def destroy\n @character.destroy\n respond_to do |format|\n format.html { redirect_to characters_url }\n format.json { head :no_content }\n end\n end", "def destroy\n delete ''\n end", "def delete\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 cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end", "def destroy\n @character.destroy\n respond_to do |format|\n format.html { redirect_to characters_url, notice: I18n.translate(\"success\", scope: %i[characters destroy]) }\n format.json { head :no_content }\n end\n end", "def destroy\n @patron = Patron.find(params[:id])\n @patron.destroy\n\n respond_to do |format|\n format.html { redirect_to(patrons_url) }\n format.xml { head :ok }\n end\n end", "def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end", "def destroy\n @certificado = Certificado.find(params[:id])\n @certificado.destroy\n\n respond_to do |format|\n format.html { redirect_to(certificados_url) }\n format.xml { head :ok }\n end\n end", "def destroy; delete end", "def destroy\n @characteristic_detail.destroy\n respond_to do |format|\n format.html { redirect_to admin_characteristic_path(session[:characteristic]), notice: 'Características Eliminada' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cattle_id = CattleId.find(params[:id])\n @cattle_id.destroy\n\n respond_to do |format|\n format.html { redirect_to(cattle_ids_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n official = Official.find(params[:id])\n official.destroy\n head 204\n end", "def destroy\n @administration = Administration.find(params[:id])\n @administration.destroy\n\n respond_to do |format|\n format.html { redirect_to administrations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @administration = Administration.find(params[:id])\n @administration.destroy\n\n respond_to do |format|\n format.html { redirect_to administrations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @character = Character.find(params[:id])\n @character.destroy\n\n respond_to do |format|\n format.html { redirect_to characters_url }\n format.json { head :ok }\n end\n end", "def destroy\n @colonoscopytest = Colonoscopytest.find(params[:id])\n @colonoscopytest.destroy\n\n respond_to do |format|\n format.html { redirect_to(colonoscopytests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @configattribmaster.destroy\n respond_to do |format|\n format.html { redirect_to configattribmasters_url, notice: 'Configattribmaster was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @unidad = Unidad.find(params[:id])\n @unidad.destroy\n\n respond_to do |format|\n format.html { redirect_to(unidades_url) }\n format.xml { head :ok }\n end\n end", "def delete!\n\t\t\tClient.delete @root\n\t\tend", "def test_set3_04c_delete_principal()\n user = \"test_user\"\n @test_acl.create_principal(user)\n id = @test_acl.create_ace(user, \"allow\", \"SELECT\", \"test\", \"/db/temporary/testsource\")\n \n @test_acl.delete_principal(user)\n query = \"doc(\\\"#{@col_path}acl.xml\\\")//node()[@id=\\\"#{id}\\\"]\"\n handle = @db.execute_query(query)\n hits = @db.get_hits(handle)\n assert_equal(0, hits)\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 @certidao = Certidao.find(params[:id])\n @certidao.destroy\n\n respond_to do |format|\n format.html { redirect_to(certidaos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @centru = Centru.find(params[:id])\n @centru.destroy\n\n respond_to do |format|\n format.html { redirect_to(centrus_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @domicile_type = DomicileType.find(params[:id])\n @domicile_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(domicile_types_url) }\n format.xml { head :ok }\n end\n end", "def delete\n ruta = \"/actions/#{action_id}\"\n client.delete(ruta)\n end", "def destroy \n Link.connection.execute(\"delete from links where id in (#{params[:id].join(',')})\") unless params[:id].blank?\n respond_to do |format|\n format.html { redirect_to(links_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n category = Formulario::REFERENCES_CATEGORY[@formulario.categoria]\n file = File.join(\"#{Formulario::ROUTE_PATH}\",category, @formulario.title)\n FileUtils.rm file\n @formulario.destroy\n respond_to do |format|\n puts \"----------> #{formularios_url}\"\n format.html { redirect_to formularios_url, notice: 'Formulario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @administration_category = Category.find(params[:id])\r\n @administration_category.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to administration_categories_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\r\n @cat1 = Cat1.find(params[:id])\r\n @cat1.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(cat1s_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def destroy\n chef_server_rest.delete(\"nodes/#{name}\")\n end", "def delete\n \n end", "def destroy\n @alfresco = Alfresco.find(params[:id])\n @alfresco.destroy\n\n respond_to do |format|\n format.html { redirect_to(alfrescos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @character = Character.find(params[:id])\n @character.disabled = true\n\n if @character.save\n respond_to do |format|\n format.html { redirect_to(characters_url) }\n format.xml { head :ok }\n end\n end\n end", "def delete\n\n end", "def delete\n \n end", "def delete(name)\n @ctx.delete(@path + name)\n end", "def destroy\n @resource = Resource.find(params[:id])\n\n # # ******************\n # # Check permissions!\n # main_tree_node = @resource.tree_nodes.select{ |e| e.is_main == true }.first\n # if not (main_tree_node && main_tree_node.can_administrate?)\n # flash[:notice] = \"Access denied. User can't delete tree node\"\n # redirect_to session[:referer]\n # end\n # # ******************\n\n @resource.destroy\n respond_to do |format|\n format.html { redirect_to session[:referer] }\n format.xml { head :ok }\n end\n end", "def delete(type, id)\n http_delete @target, \"#{type_info(type, :path)}/#{Addressable::URI.encode(id)}\", @auth_header, @zone\n end", "def destroy\n @accessory = Accessory.find(params[:id])\n @accessory.destroy\n\n respond_to do |format|\n format.html { redirect_to(accessories_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @exalumno = @alumno.exalumno\n @exalumno.destroy\n\n respond_to do |format|\n format.html { redirect_to(alumno_path(@alumno)) }\n format.xml { head :ok }\n end\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def destroy\n @character.destroy\n\n respond_to do |format|\n format.html { redirect_to user_characters_url(current_user), notice: 'Character was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @categoria_comida = CategoriaComida.find(params[:id])\n @categoria_comida.destroy\n\n respond_to do |format|\n format.html { redirect_to(categoria_comidas_url) }\n format.xml { head :ok }\n end\n end", "def delete\n\n\tend", "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 destroy\n @ezr_content_class_attribute = EzrContentClassAttribute.find(params[:id])\n @ezr_content_class_attribute.destroy\n\n respond_to do |format|\n format.html { redirect_to(ezr_content_class_attributes_url) }\n format.xml { head :ok }\n end\n end" ]
[ "0.6568869", "0.6527403", "0.64687365", "0.64465743", "0.64369845", "0.64369845", "0.6379042", "0.6340527", "0.62999654", "0.6275097", "0.6264484", "0.62528837", "0.62353474", "0.6120227", "0.61194664", "0.60967565", "0.60912496", "0.60853964", "0.608458", "0.60781497", "0.6023786", "0.60204774", "0.6009701", "0.60042816", "0.59772444", "0.5973174", "0.5960322", "0.595873", "0.595873", "0.5945592", "0.59424406", "0.59424406", "0.59201825", "0.5917811", "0.59103495", "0.5906605", "0.5904527", "0.58986086", "0.5890309", "0.58890283", "0.58803034", "0.5877367", "0.5867592", "0.5866312", "0.5864086", "0.5863844", "0.58581537", "0.5856878", "0.5850847", "0.58495224", "0.5849244", "0.5846144", "0.5842975", "0.5840248", "0.5838644", "0.58359945", "0.58325386", "0.5831548", "0.58246857", "0.58224577", "0.5819437", "0.5818886", "0.58164406", "0.5815683", "0.5815683", "0.5815545", "0.581057", "0.58075255", "0.5806963", "0.58018106", "0.5798524", "0.57947296", "0.57912976", "0.5788116", "0.57820463", "0.57798654", "0.5777553", "0.57723767", "0.5771704", "0.57710683", "0.5770722", "0.576635", "0.57649887", "0.5762843", "0.57623404", "0.57612514", "0.57608277", "0.575815", "0.5756827", "0.5753237", "0.57526237", "0.5748854", "0.5748854", "0.5748854", "0.5748854", "0.574819", "0.5747632", "0.57461965", "0.57435566", "0.574246" ]
0.67580277
0
GET /formatings GET /formatings.json
def index @formatings = Formating.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def formats\n format\n end", "def formatJSON\n # @formattedContents = .... whatever puts it into JSON\n end", "def show\n @format_lookup = FormatLookup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @format_lookup }\n end\n end", "def formats; end", "def formats; end", "def show\n @format = Format.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @format }\n end\n end", "def index\n @serving_formats = ServingFormat.all\n end", "def formats\n @@formats\n end", "def set_formating\n @formating = Formating.find(params[:id])\n end", "def format\n :json\n end", "def formats_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FormatsApi.formats_list ...'\n end\n # resource path\n local_var_path = '/formats'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?\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] || 'Array<Format>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic', 'Token']\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: FormatsApi#formats_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n response = ::Phrase::Response.new(data, headers)\n return response, status_code, headers\n end", "def styles\n respond_to do |format|\n format.json{ render :json => helpers.get_style(params[:style_id], :json) }\n end\n end", "def index\n @formatos = Formato.where(ativo: true)\n \t\n render json: @formatos\n end", "def index\n @individual_formats = IndividualFormat.all\n end", "def get_formatting_data\n format = @data[country][:format]\n prefix = @data[country][Core::NATIONAL_PREFIX]\n rule = (format[Core::NATIONAL_PREFIX_RULE] ||\n @data[country][Core::NATIONAL_PREFIX_RULE] || '$1')\n\n [format, prefix, rule]\n end", "def show\n @book_format = BookFormat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_format }\n end\n end", "def show\n @format_packing = FormatPacking.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @format_packing }\n end\n end", "def destroy\n @formating.destroy\n respond_to do |format|\n format.html { redirect_to formatings_url, notice: 'Formating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def bookmarks_formatter\n\t\t\t\tformatted_bookmarks = []\n\t\t\t\t@bookmarks.each do |bookmark|\n\t\t\t\t\tformatted_bookmarks << strip_bookmark_to_json(bookmark)\n\t\t\t\tend\n\t\t\t\trespond_with formatted_bookmarks\n\t\t\tend", "def show\n @format = Format.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @format }\n format.csv { render :csv => @format }\n format.json { render :json => @format }\n end\n end", "def show\n @format = Format.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @format }\n format.csv { render :csv => @format }\n format.json { render :json => @format }\n end\n end", "def index_formats(format)\n end", "def selected_format (search,optional)\n respond_to do |format|\n format.json { render json: search, status: optional }\n format.xml { render xml: search, status: optional }\n end\n end", "def update\n respond_to do |format|\n if @formating.update(formating_params)\n format.html { redirect_to @formating, notice: 'Formating was successfully updated.' }\n format.json { render :show, status: :ok, location: @formating }\n else\n format.html { render :edit }\n format.json { render json: @formating.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @user = User.find_by_id(params[:format])\n @bookings = Booking.where(user_id: params[:format])\n end", "def formats\n @formats ||= mapping.keys.sort\n end", "def index\n if params[:format].nil? or params[:format] == 'html'\n @iteration = params[:iteration][/\\d+/] rescue 1\n @formats = Format.sorted_order(\"#{sort_column} #{sort_direction}\").search(params[:search]).paginate :page => params[:page]\n else\n @format = Format.api_search(params)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.js\n format.xml { render :xml => @formats }\n format.csv { render :csv => @formats }\n format.json { render :json => @formats }\n end\n end", "def show\n @document_format = DocumentFormat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @document_format }\n end\n end", "def formats\n formats = online_resource?(record) ? online_format : physical_format\n any_found?(formats) ? Array(formats[0]) : nil\n end", "def format\n @format ||= {}\n end", "def index\n @poblamiento_file_formats = PoblamientoFileFormat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @poblamiento_file_formats }\n end\n end", "def format\n collect { |a| a.format }\n end", "def formating_params\n params.require(:formating).permit(:article_format_id, :article_id)\n end", "def json_data\n json_format = params[:json_format] or 'default'\n case json_format\n when 'basic'\n collection.map {|p| {'id' => p.id, 'name' => p.name}}.to_json\n else\n collection.to_json()\n end\n end", "def formatters; end", "def index\n @japan_styles = JapanStyle.order('created_at DESC').all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @japan_styles }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html\n format.json { render :json => @bookings }\n end\n end", "def index\n @listings = Listing.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @listings }\n end\n end", "def create\n @format = Format.new(params[:format])\n\n respond_to do |format|\n if @format.save\n format.html { redirect_to @format, notice: 'Format was successfully created.' }\n format.json { render json: @format, status: :created, location: @format }\n else\n format.html { render action: \"new\" }\n format.json { render json: @format.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @listings = Listing.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @listings }\n end\n end", "def show\n @teaching_format = TeachingFormat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @teaching_format }\n end\n end", "def show\n render json: @formato\n end", "def formats\n @screen = session.active_screen\n @report = Report.find(params[:id])\n\n respond_to do |format|\n format.html # formats.html.erb\n format.xml { render :xml => @report }\n end\n end", "def index\n @formatoventa = Formatoventum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @formatoventa }\n end\n end", "def create\n @formating = Formating.new(formating_params)\n\n respond_to do |format|\n if @formating.save\n format.html { redirect_to @formating, notice: 'Formating was successfully created.' }\n format.json { render :show, status: :created, location: @formating }\n else\n format.html { render :new }\n format.json { render json: @formating.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @listings = Listing.all\n render json: @listings\n end", "def format\n @format\n end", "def fetch_listings(format=nil)\n result = nil\n raw = fetch_raw(format)\n case self.format\n when 'xml'\n # parse xml raw\n result = XmlSimple.xml_in raw, { 'ForceArray' => false, 'AttrPrefix' => true }\n when 'json'\n result = JSON.parse(raw)\n end\n result = raw unless result\n result\n end", "def get_report_formats_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ReportApi.get_report_formats ...'\n end\n # resource path\n local_var_path = '/api/3/report_formats'\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;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\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 => 'ResourcesAvailableReportFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ReportApi#get_report_formats\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def set_default_format_json\n if params[:format] && params[:format] != 'json'\n head :bad_request\n else\n request.format = 'json' unless params[:format]\n end\n end", "def format_data(data)\n case format\n when :json\n JSON.pretty_generate(data)\n else # default to YAML\n data.to_yaml.sub(/\\A\\-\\-\\-\\n/, '')\n end\n end", "def to_format\n @format ||= lookup.last \n end", "def formats_list(opts = {})\n data, _status_code, _headers = formats_list_with_http_info(opts)\n data\n end", "def formats\n attributes.fetch(:formats)\n end", "def default_format_json\n if(request.headers['HTTP_ACCEPT'].nil? && params[:format].nil?) ||\n (request.headers['HTTP_ACCEPT'] != 'application/xml' && params[:format] != 'xml')\n request.format = 'json'\n end\n end", "def additional_response_formats(format)\n format.vtt { render_vtt }\n end", "def get_analytics_reporting_reportformats_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AnalyticsApi.get_analytics_reporting_reportformats ...\"\n end\n \n # resource path\n local_var_path = \"/api/v2/analytics/reporting/reportformats\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\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<String>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AnalyticsApi#get_analytics_reporting_reportformats\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @postings = Posting.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @postings }\n end\n end", "def index\n if params[:format].nil? or params[:format] == 'html'\n @iteration = params[:iteration][/\\d+/] rescue 1\n @formats = Format.sorted_order(\"#{sort_column} #{sort_direction}\").search(params[:search]).paginate(\n :page => params[:page], \n :per_page => params[:DataTables_Table_0_length]\n )\n else\n @format = Format.api_search(params)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.js\n format.xml { render :xml => @formats }\n format.csv { render :csv => @formats }\n format.json { render :json => @formats }\n end\n end", "def create\n @format_lookup = FormatLookup.new(params[:format_lookup])\n\n respond_to do |format|\n if @format_lookup.save\n format.html { redirect_to @format_lookup, :notice => 'Format lookup was successfully created.' }\n format.json { render :json => @format_lookup, :status => :created, :location => @format_lookup }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @format_lookup.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n respond_to do |format|\n format.html do\n @recent_objects = Source.created_this_week.order(updated_at: :desc).limit(10)\n render '/shared/data/all/index'\n end\n format.json {\n @sources = Queries::Source::Filter.new(params).all\n .order(:cached)\n .page(params[:page])\n .per(params[:per])\n }\n format.bib {\n # TODO - handle count and download\n @sources = Queries::Source::Filter.new(params).all\n .order(:cached)\n .page(params[:page])\n .per(params[:per] || 2000)\n }\n end\n end", "def format *formats\n format! *formats << true\n end", "def document_export_formats(format)\n format.any do\n format_name = params.fetch(:format, '').to_sym\n if @response.export_formats.include? format_name\n render_document_export_format format_name\n else\n raise ActionController::UnknownFormat\n end\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end", "def document_export_formats(format, response)\n format.any do\n format_name = params.fetch(:format, '').to_sym\n\n if response.export_formats.include? format_name\n render_document_export_format format_name, response\n else\n raise ActionController::UnknownFormat.new\n end\n end\n end", "def check_format\n redirect_to root_url unless params[:format] == 'json' || request.headers[\"Accept\"] =~ /json/\n end", "def formats\n self.class::FORMATS\n end", "def update\n if @formato.update(formato_params)\n render json: @formato\n else\n render json: @formato.errors, status: :unprocessable_entity \n end\n end", "def format\n \n # If &format= is present we let that win\n if params.size > 0 and params.key?(\"format\")\n format = params[\"format\"]\n else\n # No &format, let Accept header win for GET, DELETE and\n\n if [\"PUT\", \"POST\"].include? request_method\n # Use Content-Type for POST, PUT\n format = media_format\n else\n # GET and DELETE, use Accept header\n format = accept_format\n end\n end\n \n if format.empty?\n # Still no format, go for .format\n format = format_from_path\n end\n \n # Still empty, set to \"\"\n if format.empty?\n format = \"\"\n end\n format\n end", "def create_format_method\n case @style\n when :json; Parseable.create_json_format_method(self)\n when :yaml; Parseable.create_yaml_format_method(self)\n else raise ArgumentError, \"unknown format style '#@style'\" end\n end", "def format\n @gapi.source_format\n end", "def marshall_format_data( unsorted_formats )\n return [] unless unsorted_formats\n\n # filter out unspecified formats facets\n unsorted_formats = unsorted_formats.select {|value, count| value != '<unspecified>' }\n\n sorted_formats = unsorted_formats.sort {|a,b| a[0] <=> b[0]}\n sorted_formats.map { |pair|\n existing_constraints = session[:constraints].select { |constraint| constraint[:fieldx] == \"doc_type\" and constraint[:value] == pair[0] }\n { :value => pair[0], :count => pair[1], :exists => (existing_constraints.size>0) }\n }\n end", "def get_format_scheme(slide_number,storage_type='',storage_name='')\n begin\n if @filename == ''\n raise 'No file name specified'\n end\n str_uri = $product_uri + '/slides/' + @filename + '/slides/' + slide_number.to_s + '/theme/formatScheme'\n if !storage_name.empty?\n str_uri += '?storage=' + storage_name\n end\n signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n response = RestClient.get(signed_uri, :accept => 'application/json')\n json = JSON.parse(response)\n return json['FormatScheme']\n rescue Exception=>e\n print e\n end\n end", "def show\n @formatoventum = Formatoventum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @formatoventum }\n end\n end", "def catch_bad_format_param\n if ['json', 'rss'].include? params[:format]\n render plain: \"Invalid parameter: we do not provide search results in #{params[:format]} format.\", status: 406\n end\n end", "def create\n @formato = Formato.new(formato_params)\n if @formato.save\n render json: @formato\n else\n render json: @formato.errors, status: :unprocessable_entity\n end\n end", "def formats\n TEXT_FORMATS\n end", "def formatter; end", "def formatter; end", "def formatter; end", "def new\n @format_lookup = FormatLookup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @format_lookup }\n end\n end", "def index\n render json: { bookings: @site.bookings.order(datetime: :asc) }, status: 200\n end", "def index\n @selection_printing_sizes = SelectionPrintingSize.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @selection_printing_sizes }\n end\n end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def set_default_response_format\n request.format = :json unless params[:format]\n end", "def format_service\n\n end", "def index\n @format_types = FormatType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @format_types }\n end\n end", "def index\n @article_formats = ArticleFormat.all\n end", "def _process_format(format); end", "def _process_format(format); end", "def index\n @book_formats = BookFormat.all\n end" ]
[ "0.656752", "0.6453584", "0.6375833", "0.6352654", "0.6352654", "0.62484217", "0.6132412", "0.60642856", "0.603619", "0.6035052", "0.6019027", "0.60008866", "0.5933324", "0.5930376", "0.585235", "0.58520377", "0.58435005", "0.58376604", "0.5830927", "0.58206546", "0.58206546", "0.57937753", "0.57937497", "0.5790046", "0.57809484", "0.57648325", "0.5756089", "0.56718975", "0.5667963", "0.56452334", "0.5606658", "0.56063646", "0.56024617", "0.5593653", "0.55768406", "0.5566572", "0.55656284", "0.55652064", "0.5565153", "0.55650824", "0.5561016", "0.5551084", "0.5550218", "0.5542536", "0.5540271", "0.55391246", "0.55312085", "0.552525", "0.552053", "0.5509578", "0.5507405", "0.55001247", "0.54876155", "0.5484243", "0.5474639", "0.5472538", "0.5470306", "0.5465495", "0.5465411", "0.5440553", "0.5436597", "0.54292196", "0.5411006", "0.5396386", "0.5396386", "0.5396386", "0.53809536", "0.5371584", "0.5371003", "0.5365825", "0.5363877", "0.53574747", "0.53302556", "0.53291017", "0.5321906", "0.5320498", "0.5319662", "0.530891", "0.53028536", "0.52919", "0.52919", "0.52919", "0.52813464", "0.5277021", "0.52751076", "0.5269356", "0.5269356", "0.5269356", "0.5269356", "0.5269356", "0.5269356", "0.5269356", "0.5269356", "0.52677417", "0.52663445", "0.5265273", "0.5265122", "0.5263994", "0.5263994", "0.52592975" ]
0.67075765
0
GET /formatings/1 GET /formatings/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @format_lookup = FormatLookup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @format_lookup }\n end\n end", "def show\n @format = Format.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @format }\n end\n end", "def index\n @formatings = Formating.all\n end", "def formats\n format\n end", "def set_formating\n @formating = Formating.find(params[:id])\n end", "def formats; end", "def formats; end", "def show\n @format_packing = FormatPacking.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @format_packing }\n end\n end", "def show\n @format = Format.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @format }\n format.csv { render :csv => @format }\n format.json { render :json => @format }\n end\n end", "def show\n @format = Format.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @format }\n format.csv { render :csv => @format }\n format.json { render :json => @format }\n end\n end", "def show\n @book_format = BookFormat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_format }\n end\n end", "def index\n @individual_formats = IndividualFormat.all\n end", "def formatJSON\n # @formattedContents = .... whatever puts it into JSON\n end", "def show\n @document_format = DocumentFormat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @document_format }\n end\n end", "def index\n @serving_formats = ServingFormat.all\n end", "def to_format\n @format ||= lookup.last \n end", "def destroy\n @formating.destroy\n respond_to do |format|\n format.html { redirect_to formatings_url, notice: 'Formating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n @format = Format.new(params[:format])\n\n respond_to do |format|\n if @format.save\n format.html { redirect_to @format, notice: 'Format was successfully created.' }\n format.json { render json: @format, status: :created, location: @format }\n else\n format.html { render action: \"new\" }\n format.json { render json: @format.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @teaching_format = TeachingFormat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @teaching_format }\n end\n end", "def update\n respond_to do |format|\n if @formating.update(formating_params)\n format.html { redirect_to @formating, notice: 'Formating was successfully updated.' }\n format.json { render :show, status: :ok, location: @formating }\n else\n format.html { render :edit }\n format.json { render json: @formating.errors, status: :unprocessable_entity }\n end\n end\n end", "def formats\n @@formats\n end", "def format\n @format ||= {}\n end", "def index_formats(format)\n end", "def format\n :json\n end", "def index\n @formatos = Formato.where(ativo: true)\n \t\n render json: @formatos\n end", "def format\n @format\n end", "def new\n @format_lookup = FormatLookup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @format_lookup }\n end\n end", "def show\n @format = Format.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @format.to_xml }\n end\n end", "def selected_format (search,optional)\n respond_to do |format|\n format.json { render json: search, status: optional }\n format.xml { render xml: search, status: optional }\n end\n end", "def formats_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FormatsApi.formats_list ...'\n end\n # resource path\n local_var_path = '/formats'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?\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] || 'Array<Format>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic', 'Token']\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: FormatsApi#formats_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n response = ::Phrase::Response.new(data, headers)\n return response, status_code, headers\n end", "def create\n @format_lookup = FormatLookup.new(params[:format_lookup])\n\n respond_to do |format|\n if @format_lookup.save\n format.html { redirect_to @format_lookup, :notice => 'Format lookup was successfully created.' }\n format.json { render :json => @format_lookup, :status => :created, :location => @format_lookup }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @format_lookup.errors, :status => :unprocessable_entity }\n end\n end\n end", "def format\n lookup_val = Integer(@rf['format'])\n @_format ||= format_proxy.lookup_format_name(lookup_val)\n rescue\n @rf['format']\n end", "def show\n @formatoventum = Formatoventum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @formatoventum }\n end\n end", "def format\n @format ||= properties.format.new self\n end", "def styles\n respond_to do |format|\n format.json{ render :json => helpers.get_style(params[:style_id], :json) }\n end\n end", "def get_format_scheme(slide_number,storage_type='',storage_name='')\n begin\n if @filename == ''\n raise 'No file name specified'\n end\n str_uri = $product_uri + '/slides/' + @filename + '/slides/' + slide_number.to_s + '/theme/formatScheme'\n if !storage_name.empty?\n str_uri += '?storage=' + storage_name\n end\n signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n response = RestClient.get(signed_uri, :accept => 'application/json')\n json = JSON.parse(response)\n return json['FormatScheme']\n rescue Exception=>e\n print e\n end\n end", "def create\n @formating = Formating.new(formating_params)\n\n respond_to do |format|\n if @formating.save\n format.html { redirect_to @formating, notice: 'Formating was successfully created.' }\n format.json { render :show, status: :created, location: @formating }\n else\n format.html { render :new }\n format.json { render json: @formating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @format = Format.find(params[:id])\n\n respond_to do |format|\n if @format.update_attributes(params[:format])\n format.html { redirect_to @format, notice: 'Format was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @format.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @user = User.find_by_id(params[:format])\n @bookings = Booking.where(user_id: params[:format])\n end", "def show\n render json: @formato\n end", "def show\n @poblamiento_file_format = PoblamientoFileFormat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @poblamiento_file_format }\n end\n end", "def formating_params\n params.require(:formating).permit(:article_format_id, :article_id)\n end", "def formats\n formats = online_resource?(record) ? online_format : physical_format\n any_found?(formats) ? Array(formats[0]) : nil\n end", "def format\n @format ||= self._format_default\n end", "def show\n @movie_format = MovieFormat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @movie_format }\n end\n end", "def read_format(format)\n format ||= 'html'\n format.gsub('.', '').to_sym\n end", "def destroy\n @format = Format.find(params[:id])\n @format.destroy\n\n respond_to do |format|\n format.html { redirect_to formats_url }\n format.json { head :no_content }\n end\n end", "def formats\n @screen = session.active_screen\n @report = Report.find(params[:id])\n\n respond_to do |format|\n format.html # formats.html.erb\n format.xml { render :xml => @report }\n end\n end", "def _process_format(format); end", "def _process_format(format); end", "def get_formatting_data\n format = @data[country][:format]\n prefix = @data[country][Core::NATIONAL_PREFIX]\n rule = (format[Core::NATIONAL_PREFIX_RULE] ||\n @data[country][Core::NATIONAL_PREFIX_RULE] || '$1')\n\n [format, prefix, rule]\n end", "def get_fill_format(chart_index)\n begin\n if(@filename=='')\n raise \"Base file not specified\"\n end\n if(@worksheetname=='')\n raise \"Worksheet is not specified\"\n end\n str_uri = $productURI + \"/cells/\" + @filename + \"/worksheets/\" + @worksheetname + \"/charts/\" + chart_index.to_s + \"/chartArea/fillFormat\"\n signed_uri = Common::Utils.sign(str_uri) \n response = RestClient.get signed_uri, {:accept => 'application/json'}\n json = JSON.parse(response)\n return json[\"FillFormat\"]\n rescue Exception=>e\n print e\n end\n end", "def update\n if @formato.update(formato_params)\n render json: @formato\n else\n render json: @formato.errors, status: :unprocessable_entity \n end\n end", "def create\n @created_format = CreatedFormat.new(created_format_params)\n\n respond_to do |format|\n if @created_format.save\n format.html { redirect_to created_formats_path, notice: 'Created format was successfully created.' }\n format.json { render :show, status: :created, location: @created_format }\n else\n format.html { render :new }\n format.json { render json: @created_format.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @serving_format = ServingFormat.new(serving_format_params)\n\n respond_to do |format|\n if @serving_format.save\n format.html { redirect_to @serving_format, notice: \"Serving format was successfully created.\" }\n format.json { render :show, status: :created, location: @serving_format }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @serving_format.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n if params[:format].nil? or params[:format] == 'html'\n @iteration = params[:iteration][/\\d+/] rescue 1\n @formats = Format.sorted_order(\"#{sort_column} #{sort_direction}\").search(params[:search]).paginate :page => params[:page]\n else\n @format = Format.api_search(params)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.js\n format.xml { render :xml => @formats }\n format.csv { render :csv => @formats }\n format.json { render :json => @formats }\n end\n end", "def format\n @gapi.source_format\n end", "def format(_view_path = nil)\n formats.first || Mime::NullType.instance\n end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def show\n @format_type = FormatType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @format_type }\n end\n end", "def create\n @formato = Formato.new(formato_params)\n if @formato.save\n render json: @formato\n else\n render json: @formato.errors, status: :unprocessable_entity\n end\n end", "def format\n @_format\n end", "def format\n \n # If &format= is present we let that win\n if params.size > 0 and params.key?(\"format\")\n format = params[\"format\"]\n else\n # No &format, let Accept header win for GET, DELETE and\n\n if [\"PUT\", \"POST\"].include? request_method\n # Use Content-Type for POST, PUT\n format = media_format\n else\n # GET and DELETE, use Accept header\n format = accept_format\n end\n end\n \n if format.empty?\n # Still no format, go for .format\n format = format_from_path\n end\n \n # Still empty, set to \"\"\n if format.empty?\n format = \"\"\n end\n format\n end", "def format\n return @format\n end", "def format\n return @format\n end", "def format\n return @format\n end", "def formats\n self.class::FORMATS\n end", "def format\n @spec[:format]\n end", "def render_unknown_format\n format = sanitize(params[:format]) || ''\n errors = JsonApiServer.errors(\n status: 406,\n title: I18n.t('json_api_server.render_unknown_format.title'),\n detail: I18n.t('json_api_server.render_unknown_format.detail', name: format)\n )\n render json: errors.to_json, status: 406\n end", "def format\n raise NotImplementedError\n end", "def show\n @japan_style = JapanStyle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @japan_style }\n end\n end", "def update\n @format = Format.find(params[:id])\n\n respond_to do |format|\n if @format.update_attributes(params[:format])\n flash[:notice] = \"Format '#{@format}' was successfully updated.\"\n format.html { redirect_to format_url(@format) }\n format.xml { head :ok }\n format.js { render :template => 'music/formats/success' }\n else\n format.html { render :action => :edit }\n format.xml { render :xml => @format.errors.to_xml }\n format.js { render :template => 'music/formats/error' }\n end\n end\n end", "def show\n @response_format = ResponseFormat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @response_format }\n end\n end", "def create_format_method\n case @style\n when :json; Parseable.create_json_format_method(self)\n when :yaml; Parseable.create_yaml_format_method(self)\n else raise ArgumentError, \"unknown format style '#@style'\" end\n end", "def format\n collect { |a| a.format }\n end", "def get_report_formats_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ReportApi.get_report_formats ...'\n end\n # resource path\n local_var_path = '/api/3/report_formats'\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;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\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 => 'ResourcesAvailableReportFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ReportApi#get_report_formats\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def formatters; end", "def new\n @format = Format.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @format }\n end\n end", "def formats\n @formats ||= mapping.keys.sort\n end", "def index\n @poblamiento_file_formats = PoblamientoFileFormat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @poblamiento_file_formats }\n end\n end", "def load_format(format)\n case format.to_s\n when /(md|mkdn?|mdown|markdown)$/i\n :markdown\n when /(textile)$/i\n :textile\n when /(rdoc)$/i\n :rdoc\n when /(org)$/i\n :org\n when /(creole)$/i\n :creole\n when /(re?st(\\.txt)?)$/i\n :rest\n when /(asciidoc)$/i\n :asciidoc\n when /(pod)$/i\n :pod\n when /(\\d)$/i\n :roff\n when /(media)?wiki$/i\n :mediawiki\n else\n nil\n end\n end", "def index\n @formatoventa = Formatoventum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @formatoventa }\n end\n end", "def create_format_method\n end", "def show\n @ad_style = Format.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ad_style }\n end\n end", "def show\n @card_font_alignment = CardFontAlignment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card_font_alignment }\n end\n end", "def formats\n attributes.fetch(:formats)\n end", "def set_default_format_json\n if params[:format] && params[:format] != 'json'\n head :bad_request\n else\n request.format = 'json' unless params[:format]\n end\n end", "def show\n @budgeting_type = BudgetingType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @budgeting_type }\n end\n end", "def get_format_dropdown()\n collection_select(\"project\", \"format\", format_list(), :first, :last, {:prompt => \"Please select\"})\n end", "def format *formats\n format! *formats << true\n end", "def update\n respond_to do |format|\n if @created_format.update(created_format_params)\n format.html { redirect_to created_formats_path, notice: 'Created format was successfully updated.' }\n format.json { render :show, status: :ok, location: @created_format }\n else\n format.html { render :edit }\n format.json { render json: @created_format.errors, status: :unprocessable_entity }\n end\n end\n end", "def default_formatter\n Sapience::Formatters::Default.new\n end", "def document_export_formats(format)\n format.any do\n format_name = params.fetch(:format, '').to_sym\n if @response.export_formats.include? format_name\n render_document_export_format format_name\n else\n raise ActionController::UnknownFormat\n end\n end\n end", "def format\n params.fetch(:format, default_format)\n end" ]
[ "0.68791914", "0.6844439", "0.6668331", "0.65377665", "0.64687896", "0.64218235", "0.64218235", "0.63440186", "0.6338604", "0.6338604", "0.6293653", "0.6287987", "0.6249572", "0.62374616", "0.6180192", "0.60911155", "0.6088507", "0.60562027", "0.60402924", "0.5995865", "0.5977468", "0.5971146", "0.595195", "0.5934486", "0.590318", "0.58934766", "0.5886845", "0.58677775", "0.5866256", "0.58505607", "0.585037", "0.5837555", "0.58217776", "0.5802325", "0.57787335", "0.5773328", "0.5769934", "0.57545763", "0.5744528", "0.574001", "0.57366145", "0.57247674", "0.5722413", "0.5716305", "0.5703964", "0.5698848", "0.56928134", "0.56777096", "0.5658176", "0.5658176", "0.56483066", "0.5638538", "0.56309664", "0.5623431", "0.5610951", "0.56092906", "0.55912364", "0.5581783", "0.55817723", "0.55817723", "0.55817723", "0.55817723", "0.55817723", "0.55817723", "0.55817723", "0.55817723", "0.5576386", "0.55751365", "0.55702853", "0.55646145", "0.55627376", "0.55627376", "0.55627376", "0.55525357", "0.554719", "0.5542918", "0.5542422", "0.5534903", "0.55342066", "0.5532875", "0.55265415", "0.5523011", "0.551787", "0.5517727", "0.55161625", "0.5508085", "0.5507426", "0.55038357", "0.55030996", "0.55024576", "0.5492179", "0.5492124", "0.5483708", "0.5483534", "0.5470511", "0.5469057", "0.54604465", "0.5455358", "0.5454701", "0.54543656", "0.5442632" ]
0.0
-1
POST /formatings POST /formatings.json
def create @formating = Formating.new(formating_params) respond_to do |format| if @formating.save format.html { redirect_to @formating, notice: 'Formating was successfully created.' } format.json { render :show, status: :created, location: @formating } else format.html { render :new } format.json { render json: @formating.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @format = Format.new(params[:format])\n\n respond_to do |format|\n if @format.save\n format.html { redirect_to @format, notice: 'Format was successfully created.' }\n format.json { render json: @format, status: :created, location: @format }\n else\n format.html { render action: \"new\" }\n format.json { render json: @format.errors, status: :unprocessable_entity }\n end\n end\n end", "def formating_params\n params.require(:formating).permit(:article_format_id, :article_id)\n end", "def create\n @created_format = CreatedFormat.new(created_format_params)\n\n respond_to do |format|\n if @created_format.save\n format.html { redirect_to created_formats_path, notice: 'Created format was successfully created.' }\n format.json { render :show, status: :created, location: @created_format }\n else\n format.html { render :new }\n format.json { render json: @created_format.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @formato = Formato.new(formato_params)\n if @formato.save\n render json: @formato\n else\n render json: @formato.errors, status: :unprocessable_entity\n end\n end", "def create\n @serving_format = ServingFormat.new(serving_format_params)\n\n respond_to do |format|\n if @serving_format.save\n format.html { redirect_to @serving_format, notice: \"Serving format was successfully created.\" }\n format.json { render :show, status: :created, location: @serving_format }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @serving_format.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @format_lookup = FormatLookup.new(params[:format_lookup])\n\n respond_to do |format|\n if @format_lookup.save\n format.html { redirect_to @format_lookup, :notice => 'Format lookup was successfully created.' }\n format.json { render :json => @format_lookup, :status => :created, :location => @format_lookup }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @format_lookup.errors, :status => :unprocessable_entity }\n end\n end\n end", "def formatJSON\n # @formattedContents = .... whatever puts it into JSON\n end", "def create\n @individual_format = IndividualFormat.new(individual_format_params)\n\n respond_to do |format|\n if @individual_format.save\n format.html { redirect_to @individual_format, notice: 'Individual format was successfully created.' }\n format.json { render :show, status: :created, location: @individual_format }\n else\n format.html { render :new }\n format.json { render json: @individual_format.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_formating\n @formating = Formating.find(params[:id])\n end", "def update\n respond_to do |format|\n if @formating.update(formating_params)\n format.html { redirect_to @formating, notice: 'Formating was successfully updated.' }\n format.json { render :show, status: :ok, location: @formating }\n else\n format.html { render :edit }\n format.json { render json: @formating.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book_format = BookFormat.new(params[:book_format])\n\n respond_to do |format|\n if @book_format.save\n format.html { redirect_to @book_format, notice: 'Book format was successfully created.' }\n format.json { render json: @book_format, status: :created, location: @book_format }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book_format.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @formating.destroy\n respond_to do |format|\n format.html { redirect_to formatings_url, notice: 'Formating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n\n maybe_add_mimetype(params)\n\n @format = Format.new(params[\"form\"])\n\n respond_to do |format|\n if @format.save\n format.html { redirect_to(@format, :notice => 'Format was successfully created.') }\n format.xml { render :xml => @format, :status => :created, :location => @format }\n format.csv { render :csv => @format, :status => :created, :location => @format }\n format.json { render :json => @format, :status => :created, :location => @format }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @format.errors, :status => :unprocessable_entity }\n format.csv { render :csv => @format.errors, :status => :unprocessable_entity }\n format.json { render :json => @format.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @book_format = BookFormat.new(book_format_params)\n\n respond_to do |format|\n if @book_format.save\n format.html { redirect_to @book_format, notice: 'Book format was successfully created.' }\n format.json { render :show, status: :created, location: @book_format }\n else\n format.html { render :new }\n format.json { render json: @book_format.errors, status: :unprocessable_entity }\n end\n end\n end", "def created_format_params\n params.require(:created_format).permit(:name, :description, :user_id, :admin_user, :format)\n end", "def create\n @document_format = DocumentFormat.new(params[:document_format])\n\n respond_to do |format|\n if @document_format.save\n format.html { redirect_to root_path, notice: 'Document format was successfully created.' }\n format.json { render json: @document_format, status: :created, location: @document_format }\n else\n format.html { render action: \"new\" }\n format.json { render json: @document_format.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @formatings = Formating.all\n end", "def create\n @teaching_format = TeachingFormat.new(params[:teaching_format])\n\n respond_to do |format|\n if @teaching_format.save\n format.html { redirect_to @teaching_format, notice: 'Teaching format was successfully created.' }\n format.json { render json: @teaching_format, status: :created, location: @teaching_format }\n else\n format.html { render action: \"new\" }\n format.json { render json: @teaching_format.errors, status: :unprocessable_entity }\n end\n end\n end", "def formats; end", "def formats; end", "def update\n if @formato.update(formato_params)\n render json: @formato\n else\n render json: @formato.errors, status: :unprocessable_entity \n end\n end", "def update\n respond_to do |format|\n if @created_format.update(created_format_params)\n format.html { redirect_to created_formats_path, notice: 'Created format was successfully updated.' }\n format.json { render :show, status: :ok, location: @created_format }\n else\n format.html { render :edit }\n format.json { render json: @created_format.errors, status: :unprocessable_entity }\n end\n end\n end", "def _process_format(format); end", "def _process_format(format); end", "def create\n @format = Format.new(params[\"form\"])\n\n if !params[:mime_type_other].blank?\n @format.mime_type = params[:mime_type_other]\n end\n\n # Want to move recently used string to top, this will do this by adding them to end of\n # the table\n m = Mimetype.find_by_type_string(@format.mime_type)\n m.delete if !m.nil?\n Mimetype.new(:type_string => @format.mime_type).save\n\n\n respond_to do |format|\n if @format.save\n format.html { redirect_to(@format, :notice => 'Format was successfully created.') }\n format.xml { render :xml => @format, :status => :created, :location => @format }\n format.csv { render :csv => @format, :status => :created, :location => @format }\n format.json { render :json => @format, :status => :created, :location => @format }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @format.errors, :status => :unprocessable_entity }\n format.csv { render :csv => @format.errors, :status => :unprocessable_entity }\n format.json { render :json => @format.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @format = Format.new(params[:format])\n @format.save!\n\n respond_to do |format|\n flash[:notice] = 'Format was successfully created.'\n format.html { redirect_to format_url(@format) }\n format.xml { head :created, :location => format_url(@format) }\n format.js { render :template => 'music/formats/success' }\n end\n\n rescue ActiveRecord::RecordInvalid\n respond_to do |format|\n format.html { render :action => :new }\n format.xml { render :xml => @format.errors.to_xml }\n format.js { render :template => 'music/formats/error' }\n end\n end", "def create_format_method\n case @style\n when :json; Parseable.create_json_format_method(self)\n when :yaml; Parseable.create_yaml_format_method(self)\n else raise ArgumentError, \"unknown format style '#@style'\" end\n end", "def format\n :json\n end", "def create\n @formating_history = FormatingHistory.new(formating_history_params)\n\n respond_to do |format|\n if @formating_history.save\n format.html { redirect_to @formating_history, notice: 'Formating history was successfully created.' }\n format.json { render :show, status: :created, location: @formating_history }\n else\n format.html { render :new }\n format.json { render json: @formating_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article_format = ArticleFormat.new(article_format_params)\n @article_format.user_id = current_user.id\n respond_to do |format|\n if @article_format.save\n format.html { redirect_to @article_format, notice: 'Article format was successfully created.' }\n format.json { render :show, status: :created, location: @article_format }\n else\n format.html { render :new }\n format.json { render json: @article_format.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article_format = ArticleFormat.new(article_format_params)\n @article_format.user_id = current_user.id\n respond_to do |format|\n if @article_format.save\n format.html { redirect_to @article_format, notice: 'Article format was successfully created.' }\n format.json { render :show, status: :created, location: @article_format }\n else\n format.html { render :new }\n format.json { render json: @article_format.errors, status: :unprocessable_entity }\n end\n end\n end", "def individual_format_params\n params.require(:individual_format).permit(:name, :baseToFormat, :formatToBase)\n end", "def formats\n format\n end", "def serving_format_params\n params.require(:serving_format).permit(:name)\n end", "def reformat(data, format=params[:format])\n content_type CONTENT_TYPES[format], :charset => 'utf-8'\n case format\n when 'txt'\n data.to_s\n when 'yaml'\n YAML::dump(data)\n when 'xml'\n data.to_xml\n when 'json'\n data.to_json\n else\n raise 'Unknown format: ' + format\n end\n end", "def reformat(data, format=params[:format])\n content_type CONTENT_TYPES[format], :charset => 'utf-8'\n case format\n when 'txt'\n data.to_s\n when 'yaml'\n YAML::dump(data)\n when 'xml'\n data.to_xml\n when 'json'\n data.to_json\n else\n raise 'Unknown format: ' + format\n end\n end", "def formats_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FormatsApi.formats_list ...'\n end\n # resource path\n local_var_path = '/formats'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?\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] || 'Array<Format>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic', 'Token']\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: FormatsApi#formats_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n response = ::Phrase::Response.new(data, headers)\n return response, status_code, headers\n end", "def format_data(data)\n case format\n when :json\n JSON.pretty_generate(data)\n else # default to YAML\n data.to_yaml.sub(/\\A\\-\\-\\-\\n/, '')\n end\n end", "def create_format_method\n end", "def create\n @format_packing = FormatPacking.new(params[:format_packing])\n @format_packing.company_id = current_user.company_id\n respond_to do |format|\n if @format_packing.save\n format.html { redirect_to @format_packing, notice: 'El formato se ha creado correctamente.' }\n format.json { render json: @format_packing, status: :created, location: @format_packing }\n else\n format.html { render action: \"new\" }\n format.json { render json: @format_packing.errors, status: :unprocessable_entity }\n end\n end\n end", "def format *formats\n format! *formats << true\n end", "def set_default_format\n request.format = 'json'\n end", "def create\n @movie_format = MovieFormat.new(params[:movie_format])\n\n respond_to do |format|\n if @movie_format.save\n format.html { redirect_to @movie_format, notice: 'Movie format was successfully created.' }\n format.json { render json: @movie_format, status: :created, location: @movie_format }\n else\n format.html { render action: \"new\" }\n format.json { render json: @movie_format.errors, status: :unprocessable_entity }\n end\n end\n end", "def preformatting\n\n end", "def create\n @format_type = FormatType.new(params[:format_type])\n\n respond_to do |format|\n if @format_type.save\n flash[:notice] = 'Format type was successfully created.'\n format.html { redirect_to([:admin, @format_type]) }\n format.xml { render :xml => @format_type, :status => :created, :location => @format_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @format_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_default_format_json\n if params[:format] && params[:format] != 'json'\n head :bad_request\n else\n request.format = 'json' unless params[:format]\n end\n end", "def set_default_format\n request.format = 'json'\n end", "def formating_history_params\n params.require(:formating_history).permit(:article_format_id, :article_id, :user_id, :revision_number, :workflow_state_id, :formating_id)\n end", "def set_format\n request.format = :json if params[:api_token].present? && params[:format].blank?\n end", "def create\n @formato = Formato.new(params[:formato])\n\n respond_to do |format|\n if @formato.save\n format.html { redirect_to(@formato, :notice => 'Formato was successfully created.') }\n format.xml { render :xml => @formato, :status => :created, :location => @formato }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @formato.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @response_format = ResponseFormat.new(params[:response_format])\n\n respond_to do |format|\n if @response_format.save\n flash[:notice] = 'ResponseFormat was successfully created.'\n format.html { redirect_to(@response_format) }\n format.xml { render :xml => @response_format, :status => :created, :location => @response_format }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @response_format.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @format = Format.find(params[:id])\n\n respond_to do |format|\n if @format.update_attributes(params[:format])\n format.html { redirect_to @format, notice: 'Format was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @format.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_default_format\n request.format = :json\n end", "def _process_format(format) # :nodoc:\n end", "def update\n respond_to do |format|\n if @formating_history.update(formating_history_params)\n format.html { redirect_to @formating_history, notice: 'Formating history was successfully updated.' }\n format.json { render :show, status: :ok, location: @formating_history }\n else\n format.html { render :edit }\n format.json { render json: @formating_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def format_service\n\n end", "def default_format_json\n if(request.headers['HTTP_ACCEPT'].nil? && params[:format].nil?) ||\n (request.headers['HTTP_ACCEPT'] != 'application/xml' && params[:format] != 'xml')\n request.format = 'json'\n end\n end", "def document_export_formats(format, response)\n format.any do\n format_name = params.fetch(:format, '').to_sym\n\n if response.export_formats.include? format_name\n render_document_export_format format_name, response\n else\n raise ActionController::UnknownFormat.new\n end\n end\n end", "def marshall_format_data( unsorted_formats )\n return [] unless unsorted_formats\n\n # filter out unspecified formats facets\n unsorted_formats = unsorted_formats.select {|value, count| value != '<unspecified>' }\n\n sorted_formats = unsorted_formats.sort {|a,b| a[0] <=> b[0]}\n sorted_formats.map { |pair|\n existing_constraints = session[:constraints].select { |constraint| constraint[:fieldx] == \"doc_type\" and constraint[:value] == pair[0] }\n { :value => pair[0], :count => pair[1], :exists => (existing_constraints.size>0) }\n }\n end", "def update\n @format = Format.find(params[:id])\n\n respond_to do |format|\n if @format.update_attributes(params[:form])\n format.html { redirect_to(@format, :notice => 'Format was successfully updated.') }\n format.xml { head :ok }\n format.csv { head :ok }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @format.errors, :status => :unprocessable_entity }\n format.csv { render :csv => @format.errors, :status => :unprocessable_entity }\n format.json { render :json => @format.errors, :status => :unprocessable_entity }\n end\n end\n end", "def bookmarks_formatter\n\t\t\t\tformatted_bookmarks = []\n\t\t\t\t@bookmarks.each do |bookmark|\n\t\t\t\t\tformatted_bookmarks << strip_bookmark_to_json(bookmark)\n\t\t\t\tend\n\t\t\t\trespond_with formatted_bookmarks\n\t\t\tend", "def create\n @formatoventum = Formatoventum.new(params[:formatoventum])\n @mixboton = \"Crear \"\n respond_to do |format|\n if @formatoventum.save\n format.html { redirect_to @formatoventum, notice: 'Formatoventum was successfully created.' }\n format.json { render json: @formatoventum, status: :created, location: @formatoventum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @formatoventum.errors, status: :unprocessable_entity }\n end\n end\n end", "def check_format\n redirect_to root_url unless params[:format] == 'json' || request.headers[\"Accept\"] =~ /json/\n end", "def update\n @format = Format.find(params[:id])\n\n maybe_add_mimetype(params)\n\n respond_to do |format|\n if @format.update_attributes(params[:form])\n format.html { redirect_to(@format, :notice => 'Format was successfully updated.') }\n format.xml { head :ok }\n format.csv { head :ok }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @format.errors, :status => :unprocessable_entity }\n format.csv { render :csv => @format.errors, :status => :unprocessable_entity }\n format.json { render :json => @format.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @format_lookup = FormatLookup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @format_lookup }\n end\n end", "def create\n @poblamiento_file_format = PoblamientoFileFormat.new(params[:poblamiento_file_format])\n\n respond_to do |format|\n if @poblamiento_file_format.save\n format.html { redirect_to @poblamiento_file_format, notice: 'Poblamiento file format was successfully created.' }\n format.json { render json: @poblamiento_file_format, status: :created, location: @poblamiento_file_format }\n else\n format.html { render action: \"new\" }\n format.json { render json: @poblamiento_file_format.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @slashdot_posting = SlashdotPosting.new(slashdot_posting_params)\n\n respond_to do |format|\n if @slashdot_posting.save\n format.html { redirect_to @slashdot_posting, notice: 'Slashdot posting was successfully created.' }\n format.json { render action: 'show', status: :created, location: @slashdot_posting }\n else\n format.html { render action: 'new' }\n format.json { render json: @slashdot_posting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @serving_format.update(serving_format_params)\n format.html { redirect_to @serving_format, notice: \"Serving format was successfully updated.\" }\n format.json { render :show, status: :ok, location: @serving_format }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @serving_format.errors, status: :unprocessable_entity }\n end\n end\n end", "def document_export_formats(format)\n format.any do\n format_name = params.fetch(:format, '').to_sym\n if @response.export_formats.include? format_name\n render_document_export_format format_name\n else\n raise ActionController::UnknownFormat\n end\n end\n end", "def replace_text_formatting_with_http_info(name, old_value, new_value, portion_format = nil, with_masters = nil, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.replace_text_formatting ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.replace_text_formatting\"\n end\n # verify the required parameter 'old_value' is set\n if @api_client.config.client_side_validation && old_value.nil?\n fail ArgumentError, \"Missing the required parameter 'old_value' when calling SlidesApi.replace_text_formatting\"\n end\n # verify the required parameter 'new_value' is set\n if @api_client.config.client_side_validation && new_value.nil?\n fail ArgumentError, \"Missing the required parameter 'new_value' when calling SlidesApi.replace_text_formatting\"\n end\n # resource path\n local_var_path = '/slides/{name}/replaceTextFormatting'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n\n # query parameters\n query_params = {}\n query_params[:'oldValue'] = @api_client.prepare_for_query(old_value) unless old_value.nil?\n query_params[:'newValue'] = @api_client.prepare_for_query(new_value) unless new_value.nil?\n query_params[:'withMasters'] = @api_client.prepare_for_query(with_masters) unless with_masters.nil?\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = @api_client.object_to_http_body(portion_format)\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'Document')\n return data, status_code, headers\n end", "def create\n @bibliography_style = BibliographyStyle.new(bibliography_style_params)\n\n respond_to do |format|\n if @bibliography_style.save\n format.html { redirect_to @bibliography_style, notice: 'Bibliography style was successfully created.' }\n format.json { render :show, status: :created, location: @bibliography_style }\n else\n format.html { render :new }\n format.json { render json: @bibliography_style.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ad_style = Format.new(params[:ad_style])\n\n respond_to do |format|\n if @ad_style.save\n format.html { redirect_to(@ad_style, :notice => 'Ad style was successfully created.') }\n format.xml { render :xml => @ad_style, :status => :created, :location => @ad_style }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ad_style.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(params[:category])\n @category.format_name = params[:category][:name].gsub(/ /, \"_\").downcase\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to admin_scenic_spots_path, notice: 'Article was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def catch_bad_format_param\n if ['json', 'rss'].include? params[:format]\n render plain: \"Invalid parameter: we do not provide search results in #{params[:format]} format.\", status: 406\n end\n end", "def create\n # logger.debug \"date range: #{params[\"rentrange\"][\"from\"]} to #{params[\"rentrange\"][\"to\"]} \"\n @posting = Posting.new(posting_params)\n @posting.user = current_user\n\n respond_to do |format|\n if @posting.save\n format.html { redirect_to @posting, notice: 'Posting was successfully created.' }\n format.json { render :show, status: :created, location: @posting }\n else\n load_categories\n format.html { render :new }\n format.json { render json: @posting.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @listing = Listing.new(listing_params)\n\n @listing.save\n\n render json: @listing\n redirect_to listings_path # redirect to home page\n end", "def format_request(payload); end", "def format_request(payload); end", "def update\n respond_to do |format|\n if @individual_format.update(individual_format_params)\n format.html { redirect_to @individual_format, notice: 'Individual format was successfully updated.' }\n format.json { render :show, status: :ok, location: @individual_format }\n else\n format.html { render :edit }\n format.json { render json: @individual_format.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_formatting_data\n format = @data[country][:format]\n prefix = @data[country][Core::NATIONAL_PREFIX]\n rule = (format[Core::NATIONAL_PREFIX_RULE] ||\n @data[country][Core::NATIONAL_PREFIX_RULE] || '$1')\n\n [format, prefix, rule]\n end", "def destroy\n @format = Format.find(params[:id])\n @format.destroy\n\n respond_to do |format|\n format.html { redirect_to formats_url }\n format.json { head :no_content }\n end\n end", "def rewrite_format\n qs_format = request.query_parameters[:format]\n\n if qs_format.present?\n new_params = request.query_parameters.dup\n new_params.delete :format\n\n param_str = create_query_string(new_params)\n format_already_present = request.path.split('.').count == 2\n\n # make formats idempotent so /foo.json?format=json doesn't generate /foo.json.json\n if format_already_present\n redirect_to(\"#{request.path}#{param_str}\")\n else\n redirect_to(\"#{request.path}.#{qs_format}#{param_str}\")\n end\n end\n end", "def format_service_response\n formatted_response = @service_response\n\n if formatted_response.success?\n formatted_response.data = get_formatter_class.send(params['action'], formatted_response.data.dup)\n end\n\n # puts \"\\nFinal formatted response : #{formatted_response.inspect}\"\n render_api_response(formatted_response)\n end", "def create\n @fantasy_draft_style = FantasyDraftStyle.new(fantasy_draft_style_params)\n\n respond_to do |format|\n if @fantasy_draft_style.save\n format.html { redirect_to @fantasy_draft_style, notice: 'Fantasy draft style was successfully created.' }\n format.json { render :show, status: :created, location: @fantasy_draft_style }\n else\n format.html { render :new }\n format.json { render json: @fantasy_draft_style.errors, status: :unprocessable_entity }\n end\n end\n end", "def selected_format (search,optional)\n respond_to do |format|\n format.json { render json: search, status: optional }\n format.xml { render xml: search, status: optional }\n end\n end", "def replace_text_formatting_online_with_http_info(document, old_value, new_value, portion_format = nil, with_masters = nil, password = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.replace_text_formatting_online ...'\n end\n\n # verify the required parameter 'document' is set\n if @api_client.config.client_side_validation && document.nil?\n fail ArgumentError, \"Missing the required parameter 'document' when calling SlidesApi.replace_text_formatting_online\"\n end\n # verify the required parameter 'old_value' is set\n if @api_client.config.client_side_validation && old_value.nil?\n fail ArgumentError, \"Missing the required parameter 'old_value' when calling SlidesApi.replace_text_formatting_online\"\n end\n # verify the required parameter 'new_value' is set\n if @api_client.config.client_side_validation && new_value.nil?\n fail ArgumentError, \"Missing the required parameter 'new_value' when calling SlidesApi.replace_text_formatting_online\"\n end\n # resource path\n local_var_path = '/slides/replaceTextFormatting'\n\n # query parameters\n query_params = {}\n query_params[:'oldValue'] = @api_client.prepare_for_query(old_value) unless old_value.nil?\n query_params[:'newValue'] = @api_client.prepare_for_query(new_value) unless new_value.nil?\n query_params[:'withMasters'] = @api_client.prepare_for_query(with_masters) unless with_masters.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['multipart/form-data'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = @api_client.object_to_http_body(portion_format)\n\n # form parameters\n post_files = []\n if document\n post_files = post_files.push(document)\n end\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'File')\n return data, status_code, headers\n end", "def create\n @funding_status_option = FundingStatusOption.new(params[:funding_status_option])\n\n respond_to do |format|\n if @funding_status_option.save\n format.html { redirect_to snippets_path, notice: 'Funding status option was successfully created.' }\n format.json { render json: @funding_status_option, status: :created, location: @funding_status_option }\n else\n format.html { render action: \"new\" }\n format.json { render json: @funding_status_option.errors, status: :unprocessable_entity }\n end\n end\n end", "def formatters; end", "def create_format_types\n formats.each { |type, state| BookFormatType.create name: type, physical: state } \n create_message BookFormatType\nend", "def create\n @item_format = ItemFormat.new(params[:item_format])\n \n respond_to do |format|\n if @item_format.save\n flash[:notice] = 'ItemFormat was successfully created.'\n \n format.html { redirect_to [:admin, @item_format] }\n format.xml do\n headers[\"Location\"] = [:admin, @item_format]\n render :nothing => true, :status => \"201 Created\"\n end\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item_format.errors.to_xml }\n end\n end\n end", "def new\n @format_packing = FormatPacking.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @format_packing }\n end\n end", "def render_unknown_format\n format = sanitize(params[:format]) || ''\n errors = JsonApiServer.errors(\n status: 406,\n title: I18n.t('json_api_server.render_unknown_format.title'),\n detail: I18n.t('json_api_server.render_unknown_format.detail', name: format)\n )\n render json: errors.to_json, status: 406\n end", "def create\n @submission = Submission.find(params[:submission_id])\n @submission_detail = SubmissionDetail.new(submission_detail_params)\n @award_deadline = Deadline.order(\"created_at\").last\n\n respond_to do |format|\n if @submission_detail.save\n format.html { redirect_to submission_submission_detail_path(@submission, @submission_detail), notice: 'Document was successfully uploaded.' }\n format.json { render action: 'show', status: :created, location: @submission_detail }\n else\n format.html { render action: 'new' }\n format.json { render json: @submission_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @text_entry = TextEntry.new(params[:text_entry])\n\n respond_to do |format|\n if @text_entry.save\n format.html { redirect_to statute_type_url(@text_entry.statute_type_id), notice: 'Text entry was successfully created.' }\n format.json { render json: @text_entry, status: :created, location: @text_entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @text_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def format(value)\n return value if response['Content-Type']\n\n type = request.path[/\\.(\\w+)$/, 1]\n response['Content-Type'] = CONTENT_TYPES[type]\n\n case type\n when nil, 'txt'\n JSON.pretty_generate([true, value])\n when 'js', 'json'\n [true, value].to_json\n when 'xml'\n doc = LibXML::XML::Document.new\n value = value.to_xml\n if value.text?\n # Wrap text nodes in a root node.\n root = LibXML::XML::Node.new('message')\n root << value\n doc.root = root\n else\n doc.root = value\n end\n doc\n else\n error_404\n end\n end", "def call(source, format, **opts)\n return unless source\n return to_json(source) if format == :json\n return to_yaml(source) if format == :yaml\n return to_form(source) if format == :form\n return to_text(source) if format == :text\n\n to_multipart(source, **opts)\n end", "def create\n @printing = Printing.new(printing_params)\n\n respond_to do |format|\n if @printing.save\n format.html { redirect_to @printing, notice: 'Printing was successfully created.' }\n format.json { render action: 'show', status: :created, location: @printing }\n else\n format.html { render action: 'new' }\n format.json { render json: @printing.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @format = Format.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @format }\n end\n end", "def create\n @sighting = Sighting.new(sighting_params)\n\n if @sighting.save\n render json: @sighting, status: :created, location: @sighting\n else\n render json: @sighting.errors, status: :unprocessable_entity\n end\n end", "def create\n @writing = Writing.new(params[:writing])\n\n respond_to do |format|\n if @writing.save\n format.html { redirect_to @writing, notice: 'Writing was successfully created.' }\n format.json { render json: @writing, status: :created, location: @writing }\n else\n format.html { render action: \"new\" }\n format.json { render json: @writing.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6418125", "0.62965673", "0.62727493", "0.6196958", "0.61826956", "0.61495453", "0.60170305", "0.5974338", "0.59592396", "0.59141797", "0.5867909", "0.5843478", "0.58393484", "0.5827798", "0.5826603", "0.57820547", "0.57538116", "0.5731132", "0.57188994", "0.57188994", "0.56746095", "0.56095874", "0.5572629", "0.5572629", "0.5550797", "0.5531784", "0.5493154", "0.5471938", "0.54706424", "0.54602057", "0.54602057", "0.54577154", "0.5455995", "0.5434306", "0.5430984", "0.5430984", "0.5430798", "0.54258305", "0.53985846", "0.53729415", "0.53594726", "0.53561133", "0.53490937", "0.5320584", "0.53161865", "0.53070277", "0.5279152", "0.5274574", "0.52699775", "0.5249321", "0.5235998", "0.5221773", "0.5221379", "0.5216997", "0.5178734", "0.5152022", "0.5151521", "0.51474464", "0.51305526", "0.51277304", "0.5115244", "0.5113468", "0.5110707", "0.5110031", "0.51074725", "0.5103573", "0.509959", "0.50979644", "0.5094423", "0.5085762", "0.5078107", "0.5071771", "0.5069965", "0.5068496", "0.5060896", "0.50587994", "0.5055734", "0.5055734", "0.5041049", "0.5036131", "0.502908", "0.5026693", "0.5016964", "0.50149554", "0.50012857", "0.5000507", "0.49992466", "0.4997934", "0.49835938", "0.49822173", "0.49812207", "0.4971388", "0.4971115", "0.49709618", "0.49700293", "0.49657923", "0.49599397", "0.49572116", "0.4955048", "0.49538392" ]
0.6536987
0
PATCH/PUT /formatings/1 PATCH/PUT /formatings/1.json
def update respond_to do |format| if @formating.update(formating_params) format.html { redirect_to @formating, notice: 'Formating was successfully updated.' } format.json { render :show, status: :ok, location: @formating } else format.html { render :edit } format.json { render json: @formating.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @format = Format.find(params[:id])\n\n respond_to do |format|\n if @format.update_attributes(params[:format])\n format.html { redirect_to @format, notice: 'Format was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @format.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @formato.update(formato_params)\n render json: @formato\n else\n render json: @formato.errors, status: :unprocessable_entity \n end\n end", "def update\n respond_to do |format|\n if @serving_format.update(serving_format_params)\n format.html { redirect_to @serving_format, notice: \"Serving format was successfully updated.\" }\n format.json { render :show, status: :ok, location: @serving_format }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @serving_format.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @format = Format.find(params[:id])\n\n maybe_add_mimetype(params)\n\n respond_to do |format|\n if @format.update_attributes(params[:form])\n format.html { redirect_to(@format, :notice => 'Format was successfully updated.') }\n format.xml { head :ok }\n format.csv { head :ok }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @format.errors, :status => :unprocessable_entity }\n format.csv { render :csv => @format.errors, :status => :unprocessable_entity }\n format.json { render :json => @format.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @format_packing = FormatPacking.find(params[:id])\n\n respond_to do |format|\n if @format_packing.update_attributes(params[:format_packing])\n format.html { redirect_to @format_packing, notice: 'El formato ha sido editado correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @format_packing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @format_lookup = FormatLookup.find(params[:id])\n\n respond_to do |format|\n if @format_lookup.update_attributes(params[:format_lookup])\n format.html { redirect_to @format_lookup, :notice => 'Format lookup was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @format_lookup.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @format = Format.find(params[:id])\n\n respond_to do |format|\n if @format.update_attributes(params[:form])\n format.html { redirect_to(@format, :notice => 'Format was successfully updated.') }\n format.xml { head :ok }\n format.csv { head :ok }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @format.errors, :status => :unprocessable_entity }\n format.csv { render :csv => @format.errors, :status => :unprocessable_entity }\n format.json { render :json => @format.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @individual_format.update(individual_format_params)\n format.html { redirect_to @individual_format, notice: 'Individual format was successfully updated.' }\n format.json { render :show, status: :ok, location: @individual_format }\n else\n format.html { render :edit }\n format.json { render json: @individual_format.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @document_format = DocumentFormat.find(params[:id])\n\n respond_to do |format|\n if @document_format.update_attributes(params[:document_format])\n format.html { redirect_to document_formats_url, notice: 'Document format was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @document_format.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @created_format.update(created_format_params)\n format.html { redirect_to created_formats_path, notice: 'Created format was successfully updated.' }\n format.json { render :show, status: :ok, location: @created_format }\n else\n format.html { render :edit }\n format.json { render json: @created_format.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @format = Format.find(params[:id])\n\n respond_to do |format|\n if @format.update_attributes(params[:format])\n flash[:notice] = \"Format '#{@format}' was successfully updated.\"\n format.html { redirect_to format_url(@format) }\n format.xml { head :ok }\n format.js { render :template => 'music/formats/success' }\n else\n format.html { render :action => :edit }\n format.xml { render :xml => @format.errors.to_xml }\n format.js { render :template => 'music/formats/error' }\n end\n end\n end", "def update\n @book_format = BookFormat.find(params[:id])\n\n respond_to do |format|\n if @book_format.update_attributes(params[:book_format])\n format.html { redirect_to @book_format, notice: 'Book format was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book_format.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book_format.update(book_format_params)\n format.html { redirect_to @book_format, notice: 'Book format was successfully updated.' }\n format.json { render :show, status: :ok, location: @book_format }\n else\n format.html { render :edit }\n format.json { render json: @book_format.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @formating_history.update(formating_history_params)\n format.html { redirect_to @formating_history, notice: 'Formating history was successfully updated.' }\n format.json { render :show, status: :ok, location: @formating_history }\n else\n format.html { render :edit }\n format.json { render json: @formating_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_formating\n @formating = Formating.find(params[:id])\n end", "def update\n @teaching_format = TeachingFormat.find(params[:id])\n\n respond_to do |format|\n if @teaching_format.update_attributes(params[:teaching_format])\n format.html { redirect_to @teaching_format, notice: 'Teaching format was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @teaching_format.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @formato = Formato.find(params[:id])\n\n respond_to do |format|\n if @formato.update_attributes(params[:formato])\n format.html { redirect_to(@formato, :notice => 'Formato was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @formato.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @format_type = FormatType.find(params[:id])\n\n respond_to do |format|\n if @format_type.update_attributes(params[:format_type])\n flash[:notice] = 'Format type was successfully updated.'\n format.html { redirect_to([:admin, @format_type]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @format_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def replace_text_formatting_with_http_info(name, old_value, new_value, portion_format = nil, with_masters = nil, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.replace_text_formatting ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.replace_text_formatting\"\n end\n # verify the required parameter 'old_value' is set\n if @api_client.config.client_side_validation && old_value.nil?\n fail ArgumentError, \"Missing the required parameter 'old_value' when calling SlidesApi.replace_text_formatting\"\n end\n # verify the required parameter 'new_value' is set\n if @api_client.config.client_side_validation && new_value.nil?\n fail ArgumentError, \"Missing the required parameter 'new_value' when calling SlidesApi.replace_text_formatting\"\n end\n # resource path\n local_var_path = '/slides/{name}/replaceTextFormatting'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n\n # query parameters\n query_params = {}\n query_params[:'oldValue'] = @api_client.prepare_for_query(old_value) unless old_value.nil?\n query_params[:'newValue'] = @api_client.prepare_for_query(new_value) unless new_value.nil?\n query_params[:'withMasters'] = @api_client.prepare_for_query(with_masters) unless with_masters.nil?\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = @api_client.object_to_http_body(portion_format)\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'Document')\n return data, status_code, headers\n end", "def update!(**args)\n @format = args[:format] if args.key?(:format)\n @status = args[:status] if args.key?(:status)\n end", "def update\n @response_format = ResponseFormat.find(params[:id])\n\n respond_to do |format|\n if @response_format.update_attributes(params[:response_format])\n flash[:notice] = 'ResponseFormat was successfully updated.'\n format.html { redirect_to(@response_format) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @response_format.errors, :status => :unprocessable_entity }\n end\n end\n end", "def partial_update(klass, id, patchset, options = {}, format = nil)\n headers = {}\n headers[:accept] = \"#{format}\" if format\n format ||= @default_format\n options = { resource: klass, id: id, format: format}.merge options\n if [FHIR::Formats::ResourceFormat::RESOURCE_XML, FHIR::Formats::ResourceFormat::RESOURCE_XML_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_XML\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_XML}\"\n elsif [FHIR::Formats::ResourceFormat::RESOURCE_JSON, FHIR::Formats::ResourceFormat::RESOURCE_JSON_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_JSON\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_JSON}\"\n end\n headers[:prefer] = @return_preference if @use_return_preference\n reply = patch resource_url(options), patchset, fhir_headers(headers)\n reply.resource = parse_reply(klass, format, reply)\n reply.resource_class = klass\n reply\n end", "def update\n @poblamiento_file_format = PoblamientoFileFormat.find(params[:id])\n\n respond_to do |format|\n if @poblamiento_file_format.update_attributes(params[:poblamiento_file_format])\n format.html { redirect_to @poblamiento_file_format, notice: 'Poblamiento file format was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @poblamiento_file_format.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @movie_format = MovieFormat.find(params[:id])\n\n respond_to do |format|\n if @movie_format.update_attributes(params[:movie_format])\n format.html { redirect_to @movie_format, notice: 'Movie format was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @movie_format.errors, status: :unprocessable_entity }\n end\n end\n end", "def format *formats\n format! *formats << true\n end", "def format=(new_format)\n valid_formats = [:json, :xml]\n raise ArgumentError, \"Invalid format. Supported formats: #{valid_formats.join(', ')}.\" unless valid_formats.include?(new_format.to_sym)\n @format = new_format\n refresh_config_for_api_objects!\n @format\n end", "def update\n @article_format.user_id = current_user.id\n respond_to do |format|\n if @article_format.update(article_format_params)\n format.html { redirect_to @article_format, notice: 'Article format was successfully updated.' }\n format.json { render :show, status: :ok, location: @article_format }\n else\n format.html { render :edit }\n format.json { render json: @article_format.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @article_format.user_id = current_user.id\n respond_to do |format|\n if @article_format.update(article_format_params)\n format.html { redirect_to @article_format, notice: 'Article format was successfully updated.' }\n format.json { render :show, status: :ok, location: @article_format }\n else\n format.html { render :edit }\n format.json { render json: @article_format.errors, status: :unprocessable_entity }\n end\n end\n end", "def formating_params\n params.require(:formating).permit(:article_format_id, :article_id)\n end", "def set_default_format_json\n if params[:format] && params[:format] != 'json'\n head :bad_request\n else\n request.format = 'json' unless params[:format]\n end\n end", "def update\n @item_format = ItemFormat.find(params[:id])\n \n respond_to do |format|\n if @item_format.update_attributes(params[:item_format])\n format.html { redirect_to [:admin, @item_format] }\n format.xml { render :nothing => true }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item_format.errors.to_xml } \n end\n end\n end", "def update\n # respond_to do |format|\n # if @thing.update(thing_params)\n # format.html { redirect_to @thing, notice: 'Thing was successfully updated.' }\n # format.json { render :show, status: :ok, location: @thing }\n # else\n # format.html { render :edit }\n # format.json { render json: @thing.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @formatted = args[:formatted] if args.key?(:formatted)\n @unformatted = args[:unformatted] if args.key?(:unformatted)\n end", "def update\n respond_to do |format|\n if update_submission\n format.html { redirect_to @submission, notice: 'Submission was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @submission.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n @category.format_name = params[:category][:name].gsub(/ /, \"_\").downcase\n \n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to admin_scenic_spots_url, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_resource.update(api_v1_resource_params)\n format.html { redirect_to @api_v1_resource, notice: 'Resource was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_resource }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_format\n request.format = :json if params[:api_token].present? && params[:format].blank?\n end", "def replace_text_formatting_online_with_http_info(document, old_value, new_value, portion_format = nil, with_masters = nil, password = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.replace_text_formatting_online ...'\n end\n\n # verify the required parameter 'document' is set\n if @api_client.config.client_side_validation && document.nil?\n fail ArgumentError, \"Missing the required parameter 'document' when calling SlidesApi.replace_text_formatting_online\"\n end\n # verify the required parameter 'old_value' is set\n if @api_client.config.client_side_validation && old_value.nil?\n fail ArgumentError, \"Missing the required parameter 'old_value' when calling SlidesApi.replace_text_formatting_online\"\n end\n # verify the required parameter 'new_value' is set\n if @api_client.config.client_side_validation && new_value.nil?\n fail ArgumentError, \"Missing the required parameter 'new_value' when calling SlidesApi.replace_text_formatting_online\"\n end\n # resource path\n local_var_path = '/slides/replaceTextFormatting'\n\n # query parameters\n query_params = {}\n query_params[:'oldValue'] = @api_client.prepare_for_query(old_value) unless old_value.nil?\n query_params[:'newValue'] = @api_client.prepare_for_query(new_value) unless new_value.nil?\n query_params[:'withMasters'] = @api_client.prepare_for_query(with_masters) unless with_masters.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['multipart/form-data'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = @api_client.object_to_http_body(portion_format)\n\n # form parameters\n post_files = []\n if document\n post_files = post_files.push(document)\n end\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'File')\n return data, status_code, headers\n end", "def rewrite_format\n qs_format = request.query_parameters[:format]\n\n if qs_format.present?\n new_params = request.query_parameters.dup\n new_params.delete :format\n\n param_str = create_query_string(new_params)\n format_already_present = request.path.split('.').count == 2\n\n # make formats idempotent so /foo.json?format=json doesn't generate /foo.json.json\n if format_already_present\n redirect_to(\"#{request.path}#{param_str}\")\n else\n redirect_to(\"#{request.path}.#{qs_format}#{param_str}\")\n end\n end\n end", "def update\n @patch = Patch.find(params[:id])\n\n respond_to do |format|\n if @patch.update_attributes(params[:patch])\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def from_merge_patch_json\n if request.patch?\n from_json\n else\n 415\n end\n end", "def set_default_format\n request.format = 'json'\n end", "def update\n respond_to do |format|\n if @fantasy_draft_style.update(fantasy_draft_style_params)\n format.html { redirect_to @fantasy_draft_style, notice: 'Fantasy draft style was successfully updated.' }\n format.json { render :show, status: :ok, location: @fantasy_draft_style }\n else\n format.html { render :edit }\n format.json { render json: @fantasy_draft_style.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @feature_request.update(feature_request_params)\n format.html { redirect_to @feature_request, notice: 'Feature request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @feature_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_format\n @screen = session.active_screen\n @field_report = FieldsReport.find(params[:id]) \n\n @field_report.update_attributes(params[:field_report])\n \n respond_to do |format|\n format.html # update_format.html.erb\n format.xml { render :xml => @report }\n end\n end", "def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end", "def _process_format(format); end", "def _process_format(format); end", "def set_default_format\n request.format = 'json'\n end", "def update\n @formatoventum = Formatoventum.find(params[:id])\n@mixboton = \"Actualizar \"\n respond_to do |format|\n if @formatoventum.update_attributes(params[:formatoventum])\n format.html { redirect_to @formatoventum, notice: 'Formatoventum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @formatoventum.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @formating.destroy\n respond_to do |format|\n format.html { redirect_to formatings_url, notice: 'Formating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def update\n respond_to do |format|\n if @slashdot_posting.update(slashdot_posting_params)\n format.html { redirect_to @slashdot_posting, notice: 'Slashdot posting was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @slashdot_posting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #respond_to do |format|\n # if @request.update(request_params)\n # format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render action: 'edit' }\n # format.json { render json: @request.errors, status: :unprocessable_entity }\n # end\n #end\n end", "def update\n respond_to do |format|\n if @source.update(source_params)\n # We go through this dance to handle changing types from verbatim to other\n @source = @source.becomes!(@source.type.safe_constantize)\n @source.reload # necessary to reload the cached value.\n format.html { redirect_to url_for(@source.metamorphosize), notice: 'Source was successfully updated.' }\n format.json { render :show, status: :ok, location: @source.metamorphosize }\n else\n format.html { render action: 'edit' }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @batch_file.update(batch_file_params)\n format.html { redirect_to @batch_file, notice: \"Batch file was successfully updated.\" }\n format.json { render :show, status: :ok, location: @batch_file }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @batch_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def formatJSON\n # @formattedContents = .... whatever puts it into JSON\n end", "def update\n respond_to do |format|\n if @batch.update_attributes(params[:batch])\n format.html { redirect_to @batch, notice: 'Batch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @batch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @some_thing.update(some_thing_params)\n format.html { redirect_to @some_thing, notice: 'Some thing was successfully updated.' }\n format.json { render :show, status: :ok, location: @some_thing }\n else\n format.html { render :edit }\n format.json { render json: @some_thing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @format = args[:format] if args.key?(:format)\n @location = args[:location] if args.key?(:location)\n end", "def update\n respond_to do |format|\n if @entry.update(entry_params)\n format.html { redirect_to @entry, notice: 'Your entry was successfully updated sir.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n # format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @thing = Thing.find(params[:id])\n\n respond_to do |format|\n if @thing.update_attributes(params[:thing])\n format.html { redirect_to things_path, notice: 'Your thing was successfully updated!' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @thing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { render :show, status: :ok, location: @patch }\n else\n format.html { render :edit }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n logger.info('PUT Update:')\n logger.info(request_body)\n new_pub = hashed_request\n old_pub = Publication.find_by(id: params[:id])\n if old_pub.blank?\n head :not_found\n return\n elsif old_pub.deleted?\n head :gone\n return\n end\n if old_pub.harvested_pub? # only manually entered (i.e. non-harvested) publications may be updated with this method\n render json: {\n error: \"This record SulPubID #{old_pub.id} may not be modified. If you had originally entered details for the record, \" \\\n 'it has been superceded by a central record.'\n },\n status: :forbidden, format: 'json'\n return\n elsif !validate_or_create_authors(new_pub[:authorship])\n render json: { error: 'You have not supplied a valid authorship record.' }, status: :not_acceptable,\n format: 'json'\n return\n end\n logger.info(\"Update manual publication #{old_pub.inspect} with BibJSON:\")\n logger.info(request_body)\n old_pub.update_manual_pub_from_pub_hash(new_pub, request_body)\n old_pub.save!\n old_pub.reload\n logger.debug(\"resulting pub hash: #{old_pub.pub_hash}\")\n render json: old_pub.pub_hash, status: :accepted\n end", "def replace_text_formatting(name, old_value, new_value, portion_format = nil, with_masters = nil, password = nil, folder = nil, storage = nil)\n data, _status_code, _headers = replace_text_formatting_with_http_info(name, old_value, new_value, portion_format, with_masters, password, folder, storage)\n data\n end", "def update\n respond_to do |format|\n if @formation.update(formation_params)\n format.html { redirect_to @formation, notice: 'Formation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @formation.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_default_format\n request.format = :json\n end", "def update\n respond_to do |format|\n if @feature.update(feature_params)\n @feature.update(publicationState: 'Pendiente')\n format.html { redirect_to user_path(current_user) }\n format.json { render :show, status: :ok, location: @feature }\n else\n format.html { render :edit }\n format.json { render json: @feature.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bibliography_style.update(bibliography_style_params)\n format.html { redirect_to @bibliography_style, notice: 'Bibliography style was successfully updated.' }\n format.json { render :show, status: :ok, location: @bibliography_style }\n else\n format.html { render :edit }\n format.json { render json: @bibliography_style.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n \n end\n end", "def update\n respond_to do |format|\n if @tracing.update(tracing_params)\n format.html { redirect_to @tracing }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tracing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @batch.update(batch_params)\n format.html { redirect_to @batch, notice: 'Batch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @batch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @batch.update(batch_params)\n format.html { redirect_to @batch, notice: 'Batch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @batch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @guide_taxon.update(params[:guide_taxon])\n format.html { redirect_to @guide_taxon, notice: 'Guide taxon was successfully updated.' }\n format.json { render :json => @guide_taxon.as_json(:root => true, :methods => [:html]) }\n else\n format.html do\n load_data_for_edit\n render action: \"edit\"\n end\n format.json { render json: @guide_taxon.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @expected_format = args[:expected_format] if args.key?(:expected_format)\n @new_format = args[:new_format] if args.key?(:new_format)\n @sampled_data_locations = args[:sampled_data_locations] if args.key?(:sampled_data_locations)\n end", "def update\n respond_to do |format|\n format.json { render json: { status: :not_implemented } }\n end\n end", "def update\n respond_to do |format|\n if @submission.update(submission_params)\n format.html { redirect_to @submission, notice: 'Submission was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @submission.errors, status: :unprocessable_entity }\n end\n end\n end", "def individual_format_params\n params.require(:individual_format).permit(:name, :baseToFormat, :formatToBase)\n end", "def create\n @format = Format.new(params[:format])\n\n respond_to do |format|\n if @format.save\n format.html { redirect_to @format, notice: 'Format was successfully created.' }\n format.json { render json: @format, status: :created, location: @format }\n else\n format.html { render action: \"new\" }\n format.json { render json: @format.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @instrument_patch.update(instrument_patch_params)\n format.html { redirect_to @instrument_patch, notice: 'Instrument patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @instrument_patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @format = args[:format] if args.key?(:format)\n @key = args[:key] if args.key?(:key)\n end", "def update!(**args)\n @format = args[:format] if args.key?(:format)\n @key = args[:key] if args.key?(:key)\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 @entry.update(entry_params)\n format.html { redirect_to edit_entry_path(@entry), notice: 'Entry updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @thing = Thing.find(params[:id])\n\n respond_to do |format|\n if @thing.update_attributes(params[:thing])\n format.html { redirect_to @thing, notice: 'Thing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @thing.errors, status: :unprocessable_entity }\n end\n end\n end", "def reformat(data, format=params[:format])\n content_type CONTENT_TYPES[format], :charset => 'utf-8'\n case format\n when 'txt'\n data.to_s\n when 'yaml'\n YAML::dump(data)\n when 'xml'\n data.to_xml\n when 'json'\n data.to_json\n else\n raise 'Unknown format: ' + format\n end\n end", "def reformat(data, format=params[:format])\n content_type CONTENT_TYPES[format], :charset => 'utf-8'\n case format\n when 'txt'\n data.to_s\n when 'yaml'\n YAML::dump(data)\n when 'xml'\n data.to_xml\n when 'json'\n data.to_json\n else\n raise 'Unknown format: ' + format\n end\n end", "def update\n respond_to do |format|\n if @resource_breakdown_structure.update(resource_breakdown_structure_params)\n format.html { redirect_to @resource_breakdown_structure, notice: 'Resource Breakdown Structure wurde erfolgreich aktualisiert' }\n format.json { render :show, status: :ok, location: @resource_breakdown_structure }\n else\n format.html { render :edit }\n format.json { render json: @resource_breakdown_structure.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #updating the listings\n respond_to do |format|\n if @listing.update(listing_params)\n format.html { redirect_to @listing, notice: \"Listing was successfully updated.\" }\n format.json { render :show, status: :ok, location: @listing }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n save_relations\n if @ingredient.update(ingredient_params)\n format.html { redirect_to @ingredient.recipe, notice: 'Ingredient was successfully updated.' }\n format.json { render :show, status: :ok, location: @ingredient }\n else\n format.html { render :edit }\n format.json { render json: @ingredient.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @task_entry.update(task_entry_params)\n format.json { head :no_content }\n else\n format.json { render json: @task_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @callout.update(callout_params)\n format.html { redirect_to @callout, notice: 'Callout was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @callout.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @wing.update(wing_params)\n @wing.floors.each { |f| f.touch }\n format.html { redirect_to @wing, notice: t('.update_ok', item: @wing.name) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @wing.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_serving_format\n @serving_format = ServingFormat.find(params[:id])\n end", "def update\n respond_to do |format|\n if @interesting_thing.update(interesting_thing_params)\n format.html { redirect_to student_interesting_things_path(@student), notice: 'Interesting thing was successfully updated.' }\n format.json { render :show, status: :ok, location: @interesting_thing }\n else\n format.html { render :edit }\n format.json { render json: @interesting_thing.errors, status: :unprocessable_entity }\n end\n end\n end", "def _process_format(format) # :nodoc:\n end", "def update\n respond_to do |format|\n if @singlepart.update(singlepart_params)\n format.html { redirect_to @singlepart, notice: 'Singlepart was successfully updated.' }\n format.json { render :show, status: :ok, location: @singlepart }\n else\n format.html { render :edit }\n format.json { render json: @singlepart.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @featuring.update(featuring_params)\n format.html { redirect_to @featuring, notice: 'Featuring was successfully updated.' }\n format.json { render :show, status: :ok, location: @featuring }\n else\n format.html { render :edit }\n format.json { render json: @featuring.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @entry.update(entry_params)\n format.html { redirect_to @entry, notice: 'Entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7030892", "0.68600416", "0.66184556", "0.6616267", "0.66029674", "0.6584635", "0.65763205", "0.6568493", "0.65168923", "0.65038246", "0.64924484", "0.64761287", "0.6347763", "0.62703013", "0.6229367", "0.6106919", "0.60405225", "0.59873754", "0.59060967", "0.58870274", "0.58827037", "0.5862047", "0.58353615", "0.58128417", "0.578461", "0.5762475", "0.57531595", "0.57531595", "0.5744608", "0.56996185", "0.5694847", "0.5680711", "0.5642499", "0.5627438", "0.56243587", "0.5604185", "0.55916464", "0.5590637", "0.55837435", "0.5570354", "0.55465126", "0.55384344", "0.55363995", "0.55296546", "0.5501", "0.5496842", "0.54962265", "0.54962265", "0.5494982", "0.5494982", "0.54927254", "0.54891175", "0.5471738", "0.5471291", "0.54687583", "0.5465315", "0.5458392", "0.5455317", "0.5454174", "0.54494375", "0.54477316", "0.54313374", "0.542735", "0.542409", "0.54195255", "0.54144645", "0.5412973", "0.5411927", "0.54087245", "0.54085356", "0.540524", "0.540099", "0.5400359", "0.5400359", "0.5398544", "0.53971505", "0.5387481", "0.5386407", "0.5379983", "0.5375103", "0.5372555", "0.5371976", "0.5371976", "0.5371071", "0.5370858", "0.53706753", "0.53678596", "0.53678596", "0.53666514", "0.5365691", "0.535789", "0.5351259", "0.5350412", "0.5347227", "0.53451294", "0.53437686", "0.53423375", "0.53416806", "0.534054", "0.5337873" ]
0.6964785
1
DELETE /formatings/1 DELETE /formatings/1.json
def destroy @formating.destroy respond_to do |format| format.html { redirect_to formatings_url, notice: 'Formating was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @format = Format.find(params[:id])\n @format.destroy\n\n respond_to do |format|\n format.html { redirect_to formats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @format = Format.find(params[:id])\n @format.destroy\n\n respond_to do |format|\n format.html { redirect_to(formats_url) }\n format.xml { head :ok }\n format.csv { head :ok }\n format.json { head :ok }\n end\n end", "def destroy\n @format = Format.find(params[:id])\n @format.destroy\n\n respond_to do |format|\n format.html { redirect_to(formats_url) }\n format.xml { head :ok }\n format.csv { head :ok }\n format.json { head :ok }\n end\n end", "def destroy\n @format_lookup = FormatLookup.find(params[:id])\n @format_lookup.destroy\n\n respond_to do |format|\n format.html { redirect_to format_lookups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @individual_format.destroy\n respond_to do |format|\n format.html { redirect_to individual_formats_url, notice: 'Individual format was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @format_packing = FormatPacking.find(params[:id])\n @format_packing.destroy\n\n respond_to do |format|\n format.html { redirect_to format_packings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @format = Format.find(params[:id])\n @format.destroy\n\n respond_to do |format|\n flash[:notice] = \"Format '#{@format}' was destroyed.\"\n format.html { redirect_to formats_url }\n format.xml { head :ok }\n format.js # destroy.rjs\n end\n end", "def destroy\n @document_format = DocumentFormat.find(params[:id])\n @document_format.destroy\n\n respond_to do |format|\n format.html { redirect_to document_formats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @created_format.destroy\n respond_to do |format|\n format.html { redirect_to created_formats_url, notice: 'Created format was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @teaching_format = TeachingFormat.find(params[:id])\n @teaching_format.destroy\n\n respond_to do |format|\n format.html { redirect_to teaching_formats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book_format = BookFormat.find(params[:id])\n @book_format.destroy\n\n respond_to do |format|\n format.html { redirect_to book_formats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @formating_history.destroy\n respond_to do |format|\n format.html { redirect_to formating_histories_url, notice: 'Formating history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @formatoventum = Formatoventum.find(params[:id])\n @formatoventum.destroy\n\n respond_to do |format|\n format.html { redirect_to formatoventa_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @formato = Formato.find(params[:id])\n @formato.destroy\n\n respond_to do |format|\n format.html { redirect_to(formatos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @serving_format.destroy\n respond_to do |format|\n format.html { redirect_to serving_formats_url, notice: \"Serving format was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def delete_formats!\n @formats = {}\n end", "def destroy\n @article_format.destroy\n respond_to do |format|\n format.html { redirect_to article_formats_url, notice: 'Article format was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article_format.destroy\n respond_to do |format|\n format.html { redirect_to article_formats_url, notice: 'Article format was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @poblamiento_file_format = PoblamientoFileFormat.find(params[:id])\n @poblamiento_file_format.destroy\n\n respond_to do |format|\n format.html { redirect_to poblamiento_file_formats_url }\n format.json { head :ok }\n end\n end", "def destroy\n @book_format.destroy\n respond_to do |format|\n format.html { redirect_to book_formats_url, notice: 'Book format was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @format_type = FormatType.find(params[:id])\n\n if @format_type.destroy then\n respond_to do |format|\n format.html { redirect_to(admin_format_types_url) }\n format.xml { head :ok }\n end\n else\n flash[:error] = @format_type.errors.on_base\n redirect_to(admin_format_types_url)\n end\n end", "def destroy\n @response_format = ResponseFormat.find(params[:id])\n @response_format.destroy\n\n respond_to do |format|\n format.html { redirect_to(response_formats_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @movie_format = MovieFormat.find(params[:id])\n @movie_format.destroy\n\n respond_to do |format|\n format.html { redirect_to movie_formats_url }\n format.json { head :ok }\n end\n end", "def destroy\n @item_format = ItemFormat.find(params[:id])\n @item_format.destroy\n \n respond_to do |format|\n format.html { redirect_to admin_item_formats_url }\n format.xml { render :nothing => true }\n end\n end", "def destroy\n @ad_style = Format.find(params[:id])\n @ad_style.destroy\n\n respond_to do |format|\n format.html { redirect_to(ad_styles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @fantasy_draft_style.destroy\n respond_to do |format|\n format.html { redirect_to fantasy_draft_styles_url, notice: 'Fantasy draft style was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @writing = Writing.find(params[:id])\n @writing.destroy\n\n respond_to do |format|\n format.html { redirect_to writings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @japan_style = JapanStyle.find(params[:id])\n @japan_style.destroy\n\n respond_to do |format|\n format.html { redirect_to japan_styles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dish_style.destroy\n respond_to do |format|\n format.html { redirect_to dish_styles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @slashdot_posting.destroy\n respond_to do |format|\n format.html { redirect_to slashdot_postings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @resource_breakdown_structure.destroy\n respond_to do |format|\n format.html { redirect_to resource_breakdown_structures_url, notice: 'Resource Breakdown Structure wurde erfolgreich gelöscht' }\n format.json { head :no_content }\n end\n end", "def destroy\n @formato.update(ativo: false)\n render json: @formato\n end", "def destroy\n @flat.destroy\n\n respond_to do |format|\n format.html { redirect_to flats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bibliography_style.destroy\n respond_to do |format|\n format.html { redirect_to bibliography_styles_url, notice: 'Bibliography style was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @formation.destroy\n respond_to do |format|\n format.html { redirect_to formations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @text_entry = TextEntry.find(params[:id])\n @statute_type_id = @text_entry.statute_type_id\n @text_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to statute_type_url(@statute_type_id) }\n format.json { head :no_content }\n end\n end", "def destroy\n @t406.destroy\n respond_to do |format|\n format.html { redirect_to t406s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @specific_gravity.destroy\n respond_to do |format|\n format.html { redirect_to @batch, notice: 'Specific gravity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @section.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @writing.destroy\n respond_to do |format|\n format.html { redirect_to writings_url, notice: 'Writing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reading.destroy\n respond_to do |format|\n format.html { redirect_to readings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @budgeting_type = BudgetingType.find(params[:id])\n @budgeting_type.destroy\n\n respond_to do |format|\n format.html { redirect_to budgeting_types_url }\n format.json { head :no_content }\n end\n end", "def delete(preset, format)\n only_provides(*graphics_mime_types)\n raise NotFound unless content_type && preset_exists?(preset)\n if full_request_path.index(preset_request_path) == 0 && File.exists?(full_request_path)\n success = FileUtils.rm(full_request_path) rescue nil\n cleanup_empty_dirs!(preset_request_path) if success\n end\n raise NoContent\n end", "def destroy\n @construction_style = ConstructionStyle.find(params[:id])\n @construction_style.destroy\n\n respond_to do |format|\n format.html { redirect_to construction_styles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @gig_type.destroy\n respond_to do |format|\n format.html { redirect_to gig_types_url, notice: 'Gig type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @convention.destroy\n respond_to do |format|\n format.html { redirect_to conventions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @section_heading = SectionHeading.find(params[:id])\n @section_heading.destroy\n\n respond_to do |format|\n format.html { redirect_to section_headings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @structure_drawing.destroy\n respond_to do |format|\n format.html { redirect_to project_sub_project_structure_drawings_path(@project, @sub_project), notice: 'Structure drawing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @futbolada = Futbolada.find(params[:id])\n @futbolada.destroy\n\n respond_to do |format|\n format.html { redirect_to gestion_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @card_font_alignment = CardFontAlignment.find(params[:id])\n @card_font_alignment.destroy\n\n respond_to do |format|\n format.html { redirect_to card_font_alignments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @unstructured_datum.destroy\n respond_to do |format|\n format.html { redirect_to unstructured_data_url, notice: 'Unstructured datum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tracing.destroy\n respond_to do |format|\n format.html { redirect_to tracings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @congestion = Congestion.find(params[:id])\n @congestion.destroy\n\n respond_to do |format|\n format.html { redirect_to congestions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @definition = Definition.find(params[:id])\n @definition.destroy\n\n respond_to do |format|\n format.html { redirect_to definitions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @definition = Definition.find(params[:id])\n @definition.destroy\n\n respond_to do |format|\n format.html { redirect_to definitions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @segment_type = SegmentType.find(params[:id])\n @segment_type.destroy\n\n respond_to do |format|\n format.html { redirect_to segment_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @flat_type.destroy\n respond_to do |format|\n format.html { redirect_to flat_types_url, notice: 'Flat type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fashion_style.destroy\n respond_to do |format|\n format.html { redirect_to fashion_styles_url, notice: 'Fashion style was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @diet_type.destroy\n respond_to do |format|\n format.html { redirect_to diet_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @printing.destroy\n respond_to do |format|\n format.html { redirect_to printings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reading = Reading.find(params[:id])\n @reading.destroy\n\n respond_to do |format|\n format.html { redirect_to readings_url }\n format.json { head :ok }\n end\n end", "def destroy\n @o_single.destroy\n respond_to do |format|\n format.html { redirect_to contents_url, notice: t(\"general.successfully_destroyed\") }\n format.json { head :no_content }\n end\n end", "def destroy\n @bracket_golfer.destroy\n respond_to do |format|\n format.html { redirect_to bracket_golfers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @raw_datum = RawDatum.find(params[:id])\n @raw_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to raw_data_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @house_style.destroy\n respond_to do |format|\n format.html { redirect_to house_styles_url, notice: 'House style was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sectionalization.destroy\n respond_to do |format|\n format.html { redirect_to sectionalizations_url, notice: 'Sectionalization was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @flat = Flat.find(params[:id])\n @flat.destroy\n\n respond_to do |format|\n format.html { redirect_to flats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @flat = Flat.find(params[:id])\n @flat.destroy\n\n respond_to do |format|\n format.html { redirect_to flats_url }\n format.json { head :no_content }\n end\n end", "def delete\n Checklist.find(params[:format]).destroy\n flash[:notice] = \"Delete successful\"\n redirect_to '/'\n end", "def destroy\n @batch.destroy\n respond_to do |format|\n format.html { redirect_to batches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @batch.destroy\n respond_to do |format|\n format.html { redirect_to batches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @batch.destroy\n\n respond_to do |format|\n format.html { redirect_to batches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @daily_writing.destroy\n respond_to do |format|\n format.html { redirect_to daily_writings_url, notice: 'Daily writing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @batch_file.destroy\n respond_to do |format|\n format.html { redirect_to batch_files_url, notice: \"Batch file was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @draft = Draft.find(params[:id])\n @draft.destroy\n\n respond_to do |format|\n format.html { redirect_to drafts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cooking_style.destroy\n respond_to do |format|\n format.html { redirect_to cooking_styles_url, notice: 'Cooking style was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @quotation.destroy\n respond_to do |format|\n format.html { redirect_to quotations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @entry.destroy\n respond_to do |format|\n format.html { redirect_to entries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @draft.destroy\n respond_to do |format|\n format.html { redirect_to drafts_url }\n format.json { head :no_content }\n end\n end", "def delete\n id = params[:format]\n @choice = Choice.where(\"id = #{id}\").first\n if @choice.destroy\n logger.debug \"choice successfully destroyed\"\n else\n logger.debug \"Choice NOT successfully destroyed\"\n end\n redirect_to home_index_url\n end", "def destroy\n @export.destroy\n respond_to do |format|\n format.html { redirect_to exports_url }\n format.json { head :no_content }\n end\n end", "def destroy\n respond_to do |format|\n if @check_route.destroy\n format.html { redirect_to action: :index }\n format.json { render :nothing => true, :status => :ok}\n else\n #TODO: better message for deletion failure\n format.html { redirect_to action: :index}\n format.json { render json: {:message=> e.to_s}.to_json, status: :internal_server_error }\n end\n end\n\n\n end", "def destroy\n @raw_bibtex_entry.destroy\n respond_to do |format|\n format.html { redirect_to raw_bibtex_entries_url, notice: 'Raw bibtex entry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\n @definition = Definition.find(params[:id])\n @definition.destroy\n\n respond_to do |format|\n format.html { redirect_to(definitions_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def destroy\n @designation_type.destroy\n respond_to do |format|\n format.html { redirect_to designation_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @definition.destroy\n respond_to do |format|\n format.html { redirect_to definitions_url, notice: \"Definition was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @definition.destroy\n respond_to do |format|\n format.html { redirect_to definitions_url, notice: 'Definition was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @extractions_extraction_forms_projects_sections_type1.destroy\n respond_to do |format|\n format.html do\n redirect_to work_extraction_path(@extractions_extraction_forms_projects_sections_type1\n .extractions_extraction_forms_projects_section\n .extraction,\n 'panel-tab': @extractions_extraction_forms_projects_sections_type1\n .extractions_extraction_forms_projects_section\n .extraction_forms_projects_section\n .id),\n notice: t('removed')\n end\n format.json { head :no_content }\n end\n end", "def destroy\n @usage.destroy\n respond_to do |format|\n format.html { redirect_to usages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @writing = Writing.find(params[:id])\n @writing.destroy\n\n respond_to do |format|\n format.html { redirect_to(writings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @sample_line = SampleLine.find(params[:id])\n @sample_line.destroy\n\n respond_to do |format|\n format.html { redirect_to sample_lines_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @richtext = Richtext.find(params[:id])\n @richtext.destroy\n\n respond_to do |format|\n format.html { redirect_to richtexts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @section.destroy\n respond_to do |format|\n format.html { redirect_to sections_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @section.destroy\n respond_to do |format|\n format.html { redirect_to sections_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @flat.destroy\n respond_to do |format|\n format.html { redirect_to flats_url, notice: \"Flat was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @viewing.destroy\n respond_to do |format|\n format.html { redirect_to viewings_url, notice: 'Viewing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @event_import_file.destroy\n\n respond_to do |format|\n format.html { redirect_to(event_import_files_url) }\n format.json { head :no_content }\n end\n end", "def destroy\n @class_style.destroy\n respond_to do |format|\n format.html { redirect_to class_styles_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.7777993", "0.7578849", "0.7578849", "0.74083096", "0.7376506", "0.72876847", "0.72776294", "0.72439045", "0.7227275", "0.72269297", "0.7208472", "0.7171798", "0.7170333", "0.7134721", "0.7060468", "0.69911176", "0.6952951", "0.6952951", "0.6931997", "0.6925111", "0.6873674", "0.6868706", "0.6865783", "0.6797581", "0.6686164", "0.64047235", "0.6381316", "0.63335603", "0.63080436", "0.6295897", "0.62877893", "0.6275866", "0.62722623", "0.626173", "0.6222623", "0.62215304", "0.62190086", "0.6199295", "0.61963373", "0.6195449", "0.61804485", "0.6173632", "0.61632544", "0.6151638", "0.6144493", "0.61411774", "0.6128648", "0.6116466", "0.61067414", "0.6104857", "0.61029", "0.60995466", "0.60926396", "0.60899717", "0.60899717", "0.60891885", "0.6081043", "0.60764605", "0.6074159", "0.6071514", "0.6069922", "0.6068151", "0.6065658", "0.6065094", "0.605733", "0.60474247", "0.6044816", "0.6044816", "0.60410845", "0.60410845", "0.6039605", "0.60368085", "0.60368085", "0.6034889", "0.603038", "0.6025998", "0.6025615", "0.6019471", "0.60192704", "0.60171926", "0.601652", "0.60111004", "0.6011077", "0.60065705", "0.6006157", "0.6004102", "0.60040826", "0.60021794", "0.60008603", "0.599748", "0.59938335", "0.59937555", "0.5992009", "0.5990346", "0.5989347", "0.5989347", "0.5988761", "0.59878594", "0.598709", "0.5985375" ]
0.78304654
0
Use callbacks to share common setup or constraints between actions.
def set_formating @formating = Formating.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 formating_params params.require(:formating).permit(:article_format_id, :article_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def valid_params_request?; 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 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 active_code_params\n params[:active_code].permit\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 filter_parameters; end", "def filter_parameters; end", "def list_params\n params.permit(:name)\n 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 admin_social_network_params\n params.require(:social_network).permit!\n end", "def url_whitelist; end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def permit_request_params\n params.permit(:address)\n end", "def sensitive_params=(params)\n @sensitive_params = params\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 user_params\n params.permit(:name, :age, :username, :display_photo, :password)\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 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.69802505", "0.6781974", "0.67470175", "0.67430073", "0.67350477", "0.6593221", "0.6504263", "0.64988977", "0.6481794", "0.64800006", "0.64568025", "0.64411247", "0.6379476", "0.63765615", "0.6368045", "0.6320141", "0.6300363", "0.6300057", "0.62952244", "0.6294712", "0.6293856", "0.6290323", "0.62816143", "0.6241851", "0.6241208", "0.622036", "0.62128764", "0.62110275", "0.61966056", "0.61776453", "0.617547", "0.6174961", "0.61654735", "0.6153256", "0.61516005", "0.6149498", "0.6123234", "0.6118653", "0.61077267", "0.61061186", "0.6093616", "0.608318", "0.6074428", "0.60650206", "0.60244286", "0.6020295", "0.60155797", "0.6012826", "0.6010141", "0.6010141", "0.60037106", "0.600298", "0.59979576", "0.5994806", "0.5994283", "0.5993927", "0.5980616", "0.59667075", "0.59614897", "0.59610957", "0.596071", "0.5959614", "0.59554", "0.59542966", "0.5946781", "0.5940262", "0.5940262", "0.59401053", "0.5937168", "0.5932135", "0.59293395", "0.592659", "0.59202623", "0.59112674", "0.59088206", "0.590716", "0.59056735", "0.589997", "0.5899655", "0.5898926", "0.5896042", "0.589589", "0.5895867", "0.58894163", "0.5884936", "0.5879227", "0.58740723", "0.5871364", "0.5870148", "0.5869228", "0.5868196", "0.5867967", "0.5865532", "0.58653617", "0.58644646", "0.58631665", "0.5862611", "0.5857609", "0.58558804", "0.5853729", "0.5853025" ]
0.0
-1
helper method to fill the train full of passengers
def fill_train(train) 120.times { train.board(active_passenger, station) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(station)\r\n @station = station\r\n @train = nil\r\n @passengers = Array.new\r\n end", "def set_training\n @training = student.trainings.build\n end", "def set_train(train)\r\n @train = train\r\n end", "def train\n @badasspoints += 1\n end", "def initialize\n\t\t@training_list=Array.new\n\t\t@w = Array.new(FEATURE_SIZE,0)\n\tend", "def empty\n @passengers = []\n end", "def set_training\n @training = Training.find(1)\n end", "def index\n @trainings = @runner.trainings #.limit(16).order(date: :desc) #esto no funciona si son del mismo dia\n @training = Training.new\n end", "def passanger_params\n params.require(:passanger).permit(:name, :train_id)\n end", "def arrival(train)\n @trains << train\n end", "def game_trains\n trains = build_train_list({\n '2' => 0,\n '3' => 0,\n '4' => 0,\n '5' => 0,\n '6' => 0,\n '7' => 0,\n '3T' => 0,\n 'U3' => 0,\n '2+2' => 0,\n '4T' => 0,\n '4+4E' => 0,\n })\n\n case @units.keys.sort.map(&:to_s).join\n when '1'\n add_train_list(trains, { '2' => 6, '3' => 4, '4' => 3, '5' => 4 })\n when '2'\n add_train_list(trains, { '2' => 5, '3' => 3, '4' => 2, '5' => 3, '6' => 2 })\n when '3'\n # extra 5/3T/U3 for minors\n add_train_list(trains, { '2' => 5, '3' => 3, '4' => 1, '5' => 3, '7' => 2, '3T' => 1, 'U3' => 1 })\n when '12'\n add_train_list(trains, { '2' => 7, '3' => 6, '4' => 4, '5' => 5, '6' => 2, '7' => 0 })\n when '23'\n # extra 5/3T/U3 for minors\n add_train_list(trains, { '2' => 5, '3' => 5, '4' => 4, '5' => 6, '7' => 2, '3T' => 1, 'U3' => 1 })\n else # all units\n # extra 5/3T/U3 for minors\n add_train_list(trains, { '2' => 7, '3' => 6, '4' => 5, '5' => 6, '6' => 2, '7' => 2, '3T' => 1, 'U3' => 1 })\n end\n\n add_train_list(trains, { '3T' => 2, 'U3' => 2 }) if @optional_rules.include?(:u3p)\n add_train_list(trains, { 'U3' => 1, '4T' => 1 }) if @regionals[1]\n add_train_list(trains, { '5' => 1 }) if @regionals[2]\n add_train_list(trains, { '4T' => 1 }) if @regionals[3]\n add_train_list(trains, { '5' => -1, '6' => 3, '7' => 2 }) if @kits[3]\n add_train_list(trains, { '5' => 1, '3T' => 1 }) if @kits[5]\n add_train_list(trains, { '2+2' => 1 }) if @kits[7]\n\n # handle K2\n if @kits[2]\n case @units.keys.sort.map(&:to_s).join\n when '1', '2'\n add_train_list(trains, { '3T' => 3, 'U3' => 1, '2+2' => 3, '4T' => 2, '4+4E' => 2 })\n add_train_list(trains, { '3' => -1, '4' => -1 }) if @kits[3]\n when '12'\n add_train_list(trains, { '3T' => 4, 'U3' => 2, '2+2' => 3, '4T' => 2, '4+4E' => 2 })\n add_train_list(trains, { '3' => -1, '4' => -1, '5' => -1 }) if @kits[3]\n when '23'\n add_train_list(trains, { '3T' => 4, 'U3' => 2, '2+2' => 3, '4T' => 2, '4+4E' => 2 })\n add_train_list(trains, { '3' => -1, '5' => -1 }) if @kits[3]\n when '123'\n add_train_list(trains, { '3T' => 5, 'U3' => 3, '2+2' => 3, '4T' => 2, '4+4E' => 2 })\n add_train_list(trains, { '3' => -1, '4' => -1, '5' => -1 }) if @kits[3]\n end\n end\n\n fix_train_availables(trains)\n\n trains\n end", "def init_trains\n init_train_types\n @config.fetch('trains').flat_map do |train_type|\n Array.new(train_type.fetch('count')) do\n create_train(train_type)\n end\n end\n end", "def add_passengers(*passengers)\n\t\tpassengers.each do |p| \n\t\t\tif not p.get_floor_dest.nil?\n\t\t\t\t@passengers << p\n\t\t\t\t@make_new_request = true\n\t\t\tend\n\t\tend\n\tend", "def update\n\n # array needs to be cleared before the trainers in teh workshop is updated, otherwise\n # new trainers are appended to existing trainers\n @workshop.trainers.clear\n # trainers are passed from the form which is a parameter in the workshop controller\n puts \"99999999999999999999999999999999999999\"\n puts params['trainers']\n puts \"99999999999999999999999999999999999999\"\n trainers = params['trainers'].map do |id|\n Trainer.find(id)\n end\n\n @workshop.trainers << trainers\n\n puts \"--------------------------------------\"\n puts @workshop.trainers\n puts \"--------------------------------------\"\n\n\n respond_to do |format|\n if @workshop.update(workshop_params)\n format.html { redirect_to @workshop, notice: 'Workshop was successfully updated.' }\n format.json { render :show, status: :ok, location: @workshop }\n else\n format.html { render :edit }\n format.json { render json: @workshop.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_train(train)\n @trains << train\n end", "def add_train(train)\n trains << train\n end", "def train\n raise NotImplementedError\n end", "def set_training\r\n @training = Training.find(params[:training_id])\r\n end", "def initialize_learnt_words(student)\n words = Word.where(\"grade < ?\", student.grade)\n \n words.each do |w|\n student.student_learnt_words.create(\n current_strength: 0.0,\n strength_history: \"\",\n test_interval: 0,\n test_date_array: \"\",\n word_id: w.id\n )\n end\n \n student.student_learnt_words\n end", "def train\r\n return @train\r\n end", "def index\n @weight_trainings = WeightTraining.all\n end", "def load_seed\n s1 = Station.new('Moscow')\n s2 = Station.new('St.Petersburg')\n s3 = Station.new('Novosibirsk')\n s4 = Station.new('Chelyabinsk')\n s5 = Station.new('Khabarovsk')\n\n t1 = PassengerTrain.new('PAS-01')\n t3 = CargoTrain.new('CAR-01')\n\n r1 = Route.new(s1, s5)\n r2 = Route.new(s3, s1)\n\n r1.add_station(s4)\n r2.add_station(s2)\n\n t1.route = r1\n t3.route = r2\n\n w1 = PassengerWagon.new(random_wagon_number, 120)\n w2 = PassengerWagon.new(random_wagon_number, 110)\n w3 = PassengerWagon.new(random_wagon_number, 115)\n w4 = CargoWagon.new(random_wagon_number, 6000)\n w5 = CargoWagon.new(random_wagon_number, 7000)\n w6 = CargoWagon.new(random_wagon_number, 5000)\n\n t1.add_wagon(w1)\n t1.add_wagon(w2)\n t1.add_wagon(w3)\n\n t3.add_wagon(w4)\n t3.add_wagon(w5)\n t3.add_wagon(w6)\n\n 65.times { w1.take_seat }\n 43.times { w2.take_seat }\n 88.times { w3.take_seat }\n\n w4.occupy_volume(123.45)\n w5.occupy_volume(1234)\n w6.occupy_volume(432.1)\n\n menu_list[:main_menu][:menu].delete('9')\n print_nn 'Seed data successfully loaded.'\n end", "def training_params\n params.fetch(:training, {})\n end", "def training_params\n params.fetch(:training, {})\n end", "def initialize_stations\r\n @stations = Array.new\r\n i = 0\r\n\r\n @lines.each {|line, stations|\r\n stations.each_with_index {|item, index|\r\n @stations.push(Station.new(item))\r\n if index == 0\r\n @stations.at(-1).set_train(@trains.at(i))\r\n i += 1\r\n end\r\n }\r\n }\r\n\r\n @stations = @stations.uniq { |s| s.station.to_s}\r\n end", "def fill_station(station)\n\t\t20.times { station.dock(Bike.new) }\n\tend", "def travel_to!(floor)\n passengers.each {|passenger| passenger.current_floor = self.current_floor}\n\nend", "def index\n @trainings = Training.all\n end", "def index\n @trainings = Training.all\n end", "def index\n @trainings = Training.all\n end", "def update!(**args)\n @search_trials = args[:search_trials] if args.key?(:search_trials)\n @train_trials = args[:train_trials] if args.key?(:train_trials)\n end", "def fill_setup(gc)\n end", "def main\n @trainings = Training.limit(12).order(date: :desc)\n #En el root muestro los 12 últimos entrenamientos, de quien sean\n end", "def set_train\n @train = Train.find(params[:id])\n end", "def create\n @workshop = Workshop.new(workshop_params)\n puts \"====================================\"\n puts params['trainers']\n puts \"====================================\"\n trainers = params['trainers'].map do |id|\n Trainer.find(id)\n end\n @workshop.trainers << trainers\n\n\n respond_to do |format|\n if @workshop.save\n format.html { redirect_to @workshop, notice: 'Workshop was successfully created.' }\n format.json { render :show, status: :created, location: @workshop }\n else\n format.html { render :new }\n format.json { render json: @workshop.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_training\r\n @training = Training.find(params[:id])\r\n end", "def set_training\n @training = Training.find(params[:id])\n end", "def set_training\n @training = Training.find(params[:id])\n end", "def set_training\n @training = Training.find(params[:id])\n end", "def set_training\n @training = Training.find(params[:id])\n end", "def set_training\n @training = Training.find(params[:id])\n end", "def set_training\n @training = Training.find(params[:id])\n end", "def set_training\n @training = Training.find(params[:id])\n end", "def training_runs\n ensure_full_data!\n Array @gapi_json[:trainingRuns]\n end", "def initialize_hotels\n Hotel.all.each do |hotel|\n GameHotel.create(name: hotel.name, hotel_id: hotel.id, game_id: self.id, chain_size: 0, share_price: 0)\n end\n end", "def train_players\n self.players.each(&:train)\n end", "def train_params\n\t\t\t#params = {\n\t\t\t#train: {name: \"the name\", origin: \"ORI\", admin: true} if you have admin param - its important to protect that, security\n\t\t\t#id: 3\n\t\t\t# utf8: \"J\"\n\t\t#}\n\n\t\t#if u want to permit to access everything - u can write: (params)permit!\n\t\t\tparams.require(:train).permit(:name, :origin, :destination, :capacity, :time)\n\n\t\tend", "def generate_data\n\t\tgenerate_stations\n\t\tgenerate_demands\n\tend", "def set_weight_trainning\n @weight_trainning = WeightTrainning.find(params[:id])\n end", "def tunings_index\n @malone_tuning_builders = vehicle_tunings\n session[:malone_tuning_builders] = @malone_tuning_builders \n end", "def training_params\n params.require(:training).permit(:trainable_id, :trainable_type, :facility_id, :date, :description, :on_spikes)\n end", "def train_set\n data_input = data_output = @data_input\n data_input.delete_at(data_input.index(data_input.last))\n data_output.delete_at(data_output.index(data_output.first))\n RubyFann::TrainData.new(inputs: data_input,\n desired_outputs: data_output)\n end", "def prepare\r\n\t\t@machine \t||= @machineClass.new @trainTestStruct.trainingData, @target, @parameters\r\n\t\t@machine.train\r\n\tend", "def index\n @trainers = Trainer.all\n end", "def index\n @trainers = Trainer.all\n end", "def index\n @trainers = Trainer.all\n end", "def index\n @pt_trainers = Pt::Trainer.all\n end", "def set_training\n @training = Training.find(params[:id])\n end", "def show\n # @trainer_workshop = TrainerWorkshop.where(:workshop_id => params[:id])\n # @trainerworkshop = []\n # @workshop.trainers contains ids of all the trainers passed from the form and populated in the create method , these id's are used to find trainers from Trainer model and populated in trainername array\n @trainername = []\n @workshop.trainers.ids.map do |id|\n @trainername << Trainer.find(id)\n end\n end", "def initialize_trains\r\n @trains = Array.new\r\n\r\n @lines.each {|line, stations|\r\n @trains.push(Train.new(line))\r\n }\r\n \r\n return @trains\r\n end", "def passengers\r\n return @passengers\r\n end", "def attendee\n @training_records = @training.training_records\n end", "def create\n @company = Company.find( params[:company_id])\n @training = @company.trainings.find( params[:training_id])\n @course = @training.courses.build( params[:course])\n @course.state = 0\n if @course.save\n redirect_to training_courses_manage_path( @company,@training)\n else\n render 'new'\n end\n end", "def index\n @weight_trainnings = WeightTrainning.all\n end", "def assign_route_to_train\n return assign_route_to_train_template('create_train') if @trains.empty?\n return assign_route_to_train_template('create_route') if @routes.empty?\n\n assign_route_to_train_core\n end", "def next_train(station, destinations, opts = {})\n ldbws.next_departures_with_details(station, destinations, opts)\n end", "def training_params\n params.require(:training).permit(:team_id, :scheduled_at, :location)\n end", "def training_params\n params.require(:training).permit(:name, :number, :notice).tap do |whitelisted|\n whitelisted[:exercise_param] = params[:training][:exercise_param]\n whitelisted[:exercise_param_f] = params[:training][:exercise_param_f]\n whitelisted[:exercise_param_s] = params[:training][:exercise_param_s]\n whitelisted[:exercise_param_t] = params[:training][:exercise_param_t]\n whitelisted[:exercise_param_fr] = params[:training][:exercise_param_fr]\n whitelisted[:exercise_param_fv] = params[:training][:exercise_param_fv]\n whitelisted[:exercise_param_sx] = params[:training][:exercise_param_sx]\n whitelisted[:exercise_param_sv] = params[:training][:exercise_param_sv]\n whitelisted[:exercise_param_cardio] = params[:training][:exercise_param_cardio]\n \n end\n end", "def spe_training\n\tend", "def set_realised_training\n @realised_training = RealisedTraining.find(params[:id])\n end", "def train trainset, ngens=@ngens, report_interval: 1000, desired_error: 1e-10\n # it makes sense to temporarily disable the `report_interval` with `false` or `nil`\n report_interval ||= 0\n # special case: not implemented in FANN\n if algo == :rwg\n return train_rwg(trainset, ngens,\n report_interval: report_interval, desired_error: desired_error)\n end\n # TODO: optimize maybe?\n times, inputs, targets = trainset.values\n tset = RubyFann::TrainData.new inputs: inputs, desired_outputs: targets\n # fann.init_weights tset # test this weights initialization\n\n # params: train_data, max_epochs, report_interval, desired_error\n fann.train_on_data(tset, ngens, report_interval, desired_error)\n end", "def replicate_machines(train, count)\n t_array = [train]\n (count - 1).times do |_i|\n new_train = Train.new(name: train.name, distance: train.distance, price: train.price,\n index: @machine_index, reserved: true)\n @machine_index += 1\n t_array << new_train\n end\n t_array\n end", "def train_datum_params\n params.fetch(:train_datum, {})\n end", "def passengers \r\n return @passengers\r\n end", "def train(dataset)\n raise 'Override me!'\n end", "def step(kind, name)\r\n progress = false\r\n if kind == :train\r\n curr_station = locate_train(name)\r\n\r\n index = station_index(curr_station, name)\r\n #check if need to update rev\r\n if curr_station.station == lines[name].last\r\n curr_station.train.set_rev(true)\r\n end\r\n if curr_station.station == lines[name].first\r\n curr_station.train.set_rev(false)\r\n end\r\n \r\n if curr_station.train.rev? == false\r\n next_station = lines[name][index+1]\r\n else\r\n next_station = lines[name][index-1]\r\n end\r\n\r\n stations.each {|station|\r\n if (station.to_s == next_station) && station.train.nil?\r\n station.set_train(curr_station.train)\r\n curr_station.remove_train\r\n progress = true\r\n Log.train_moves(name, curr_station.station, next_station)\r\n break\r\n end\r\n }\r\n\r\n if progress == false \r\n conflincting_train = (stations.select {|e| e.station == next_station}).first.train.to_s\r\n puts \"Train \" + curr_station.train.get_train + \" cannot advance, \" + conflincting_train + \" train at \" + next_station \r\n end \r\n elsif kind == :passenger\r\n person = nil\r\n # Find passenger object\r\n passengers.each {|x|\r\n if x.passenger == name\r\n person = x\r\n end\r\n }\r\n\r\n stations.each {|x|\r\n if x.passengers.include? person\r\n if !(x.train.nil?)\r\n if x.train.get_train == person.plan[x.station]\r\n x.train.add_passenger(person)\r\n x.remove_passenger(person)\r\n person.delete_pair(x.station)\r\n progress = true\r\n Log.passenger_boards(person.passenger,x.train.get_train,x.station) \r\n end\r\n end\r\n elsif !(x.train.nil?) \r\n if (x.train.passengers.include? person) && (person.plan.has_key?(x.station))\r\n x.add_passenger(person)\r\n x.train.remove_passenger(person)\r\n if (person.plan)[x.station].nil?\r\n person.delete_pair(x.station)\r\n end\r\n progress = true\r\n Log.passenger_exits(person.passenger, x.train.get_train, x.station)\r\n end\r\n end\r\n }\r\n else\r\n puts \"Error, kind type not recognized.\"\r\n end\r\n\r\n return progress\r\n end", "def update_fill\n end", "def create\n# DEBUG\n logger.debug \"\\r\\n\\r\\n!! ------ #{self.class.name} -----\"\n logger.debug \"> #{params.inspect}\\r\\n\"\n if request.post?\n @user_training = UserTraining.new( user_training_params )\n @user_training.user_id = current_user.id # Set the owner for all the records\n\n if @user_training.save\n flash[:info] = I18n.t('trainings.training_created')\n redirect_to( user_training_path(@user_training) )\n else\n flash[:error] = I18n.t('activerecord.errors.messages.record_invalid')\n assign_all_options_array()\n render :edit\n end\n else\n flash[:error] = I18n.t(:invalid_action_request)\n redirect_to( user_trainings_path() ) and return\n end\n end", "def fill_setup(_gc)\n end", "def trainers\n trainer_locations = TrainerLocation.all.select {|trainer_location| trainer_location.location == self}\n trainer_locations.map {|trainer_location| trainer_location.trainer}\n end", "def training_params\n params.require(:training).permit(:kms, :time, :date, :runner_id, :shoe_id, :description, :comments, :hours, :minutes, :seconds)\n end", "def configure_training_request\n available_ledgers :training_request\n set_training_request\n end", "def fill_from_gemo\r\n end", "def initialize_attributes\n @training_model = Hash.new { |h, k| h[k] = Hash.new(0) }\n @classes = Set.new\n @total_words_counter = 0\n @negative_population = 0\n @neutral_population = 0\n @positive_population = 0\n @training_negatives = 0\n @training_neutrals = 0\n @training_positives = 0\n end", "def teach(trainers)\n trainers.each {|trainer|\n case trainers\n when Yoda\n trainer.meditate(padawans)\n when MaceWindu\n trainer.be_a_badass(padawans)\n when Anakin\n trainer.be_a_murder(padawans)\n trainer.join_sidious(sith_lord)\n end\n }\n end", "def new\n @company = Company.find( params[:company_id])\n @training = @company.trainings.find( params[:training_id])\n @course = @training.courses.build\n end", "def doTraining\n\t\t# Ruby fan uses its own special data structure. 2D Array for both X and Y data\n\t\ttrain\t\t= RubyFann::TrainData.new(inputs: @xData[:train], desired_outputs: @yData[:train])\n\t\t# Train\n\t\tmachine\t= RubyFann::Standard.new(num_inputs: @nInputs, hidden_neurons:[2], num_outputs: 1)\n\t\tmachine.train_on_data(train, @iterations, @reportSteps, @maxError) \n\t\t# Remember to send the machine back to the caller\n\t\tmachine\n\tend", "def set_weight_training\n @weight_training = WeightTraining.find(params[:id])\n end", "def index\n @trainings = Training.all.paginate(page: params[:page], per_page: 3)\n end", "def set_train_datum\n @train_datum = TrainDatum.find(params[:id])\n end", "def train_data\n ::RubyFann::TrainData.new(\n :inputs => inputs, \n :desired_outputs=> desired_outputs)\n end", "def _trainer=(trainer)\n # TODO: trainer cannot be replaced for sparse params\n @_trainer = trainer\n end", "def updateStation()\n uri=URI.parse(ViaggiatrenoURLs.STATION_INFO)\n response = Net::HTTP.post_form(uri,{\"stazione\" => @stationFrom, \"lang\" => \"IT\"})\n doc = Nokogiri::HTML(response.body)\n\n doc.xpath(XPathMatchInfo.XPATH_STATION).each do |x|\n \n StringUtils.remove_newlines_tabs_and_spaces(x)\n\n train_number_complete = x.xpath(XPathMatchInfo.XPATH_TRAIN_NUMBER()).to_s\n train_destination = x.xpath(XPathMatchInfo.XPATH_TRAIN_DESTINATION()).to_s\n train_schedule =x.xpath(XPathMatchInfo.XPATH_TRAIN_SCHEDULED()).to_s\n train_description = \"#{train_number_complete} #{train_destination} #{train_schedule}\"\n \n train_number=train_number_complete.match(\"[0-9]+\")[0]\n \n @trains[train_number]=train_description\n @destinations.push(train_destination)\n ### TODO #### #@trains[train_number][description]=train_description\n end\n end", "def training_params\n params.require(:training).permit(:title, student_attributes: [:name], exercises_attributes: [:name, :sets, :reps, :rest, :muscle_group, :training_id, :id, :_destroy])\n end", "def train\n run_thresholds\n run_values_to_ranges\n run_reverse\n\n @classifiers\n end", "def populate!()\n\n tile_factory = TileFactory.new()\n livingbeing_factory = LivingBeingFactory.new()\n\n @m.times do |y|\n @n.times do |x|\n\n # Water vs Ground\n location = Location.new(@n, @m, x, y)\n wg = tile_factory.create(Utils.generate_random_percentage(), location)\n\n if wg\n\n @tiles[x][y] = wg\n else\n\n raise StandardError.new(\"Incorrect Percentages less than 100\")\n end\n\n # If tile is Ground type...\n if @tiles[x][y].is_a?(Ground)\n \n lb = livingbeing_factory.create(Utils.generate_random_percentage())\n\n @tiles[x][y].livingbeing = lb if lb\n end\n end\n end\n\n self\n end", "def fillupMissingData\n #if particiants or place is given and it's not upcoming, set place or particiants to default value\n #set enrolled to false if it is upcoming\n logger.debug \"test if I can fill up any data\"\n if (self.incomplete?)\n logger.debug \"detected an upcoming tournament - #{self.to_s}\"\n self.upcoming?\n else\n logger.debug \"filling up missing data for #{self.to_s}\"\n self.participants ||= self.place\n self.place ||= self.participants\n logger.debug \"filled up as #{self.to_s}\"\n end\n self.setEnrollement\n self #for chaining\n end", "def make_training_set training_set_size\n sample = $ou.to_a.sample(training_set_size).shuffle\n data_to_csv 'train.csv', sample\nend", "def convert_all_trainers\n return @data.collect do |trainer|\n {\n id: trainer.id,\n db_symbol: trainer.db_symbol,\n base_money: trainer.base_money,\n internal_names: trainer.internal_names,\n vs_type: trainer.vs_type,\n team: team_symbol(trainer.team),\n battler: trainer.battler,\n special_group: trainer.special_group\n }\n end\n end", "def index\n @trainings = Training.with_attached_images.all\n @training = Training.new\n end" ]
[ "0.6616624", "0.63414437", "0.6041372", "0.5841471", "0.57378674", "0.56624705", "0.5657433", "0.55865383", "0.5515508", "0.54803216", "0.54798114", "0.54727316", "0.54563093", "0.5406053", "0.5376174", "0.5372072", "0.53648776", "0.5353674", "0.53228724", "0.5312346", "0.5308681", "0.5285568", "0.5282748", "0.5282748", "0.52799857", "0.52724516", "0.5271102", "0.52692795", "0.52692795", "0.52692795", "0.5268735", "0.5262272", "0.5258539", "0.5253752", "0.52328545", "0.5231419", "0.5223854", "0.5223854", "0.5223854", "0.5223854", "0.5223854", "0.5223854", "0.5223854", "0.5219813", "0.5214369", "0.52124023", "0.52009976", "0.519823", "0.51982087", "0.5191875", "0.518596", "0.51819396", "0.5178789", "0.51720357", "0.51720357", "0.51720357", "0.5170415", "0.5170327", "0.5167342", "0.5165326", "0.51597273", "0.51580155", "0.514758", "0.5145788", "0.51365715", "0.51349854", "0.51269585", "0.5124568", "0.5120166", "0.5113884", "0.5105198", "0.51043725", "0.50825363", "0.5079358", "0.50781786", "0.5075786", "0.5063712", "0.50529516", "0.50469935", "0.50405365", "0.5037883", "0.5036959", "0.50337124", "0.50308704", "0.5021318", "0.5019542", "0.5017678", "0.5013221", "0.50117177", "0.50034416", "0.49998185", "0.49946654", "0.4988697", "0.49811432", "0.4978203", "0.49642494", "0.4958923", "0.4956127", "0.49540544", "0.49429473" ]
0.7667284
0
GET /sms/1 GET /sms/1.json
def show @sm = Sm.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @sm } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sms\n send_sms(params)\n respond_to do |format|\n format.json {render :json => {:status => :success }}\n end\n end", "def retrieve_sms(message_id)\n Response.new self.class.get(\"/messages/#{message_id}\", :basic_auth => @auth, :headers => SMSIFIED_HTTP_HEADERS)\n end", "def show\n @sms_tmp = SmsTmp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sms_tmp }\n end\n end", "def search_sms(query_string)\n Response.new self.class.get(\"/messages?#{query_string}\", :basic_auth => @auth, :headers => SMSIFIED_HTTP_HEADERS)\n end", "def receive_sms\n @view = \"sms\"\n @body = params[\"Body\"]\n @phone_number = params[\"From\"]\n set_user_create_message_parse_and_point\n end", "def sms\n \t\n \t#flash[:notice] = params\n \t#redirect_to root_path\n\n TwilioTextMessenger.new( params[:phone], params[:message]).call\n \t\n end", "def sms\n # Give Twilio the TwiML payload instructions\n twiml_payload\n end", "def show\n @sms = Sms.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @sms }\n end\n end", "def index\n @client = Twilio::REST::Client.new ENV['TWILIO_KEY_SID'], ENV['TWILIO_AUTH_TOKEN']\n @message_body = @client.account.messages.list[0].body\n @from_number = @client.account.messages.list[0].from\n # SMSLogger.log_text_message @from_number, @message_body\n number = convert_number(@from_number)\n @student = Student.find_by(phone_number: number)\n puts @message_body\n send_text_message(response)\n end", "def send_sms phone, message\n message = URI.escape message\n response = RestClient.get \"#{sender_base_url}/?from=#{@from}&to=#{phone}&text=#{message}&pass=#{@application_pass}\"\n @response = Response.new response\n end", "def index\n @client_name = nil\n if session[:cos_session_id]\n if @application_session = Session.find_by_id(session[:cos_session_id])\n @client_name = Client.find_by_id(@application_session.client_id).name\n end\n end\n unless @client_name == nil\n http = get_http_connection()\n path = '/messages/in.json?name='+@pysmsd_config.app_name+'&password='+@pysmsd_config.app_password+'&keyword='+@client_name\n resp = http.get(path)\n json = JSON.parse(resp.body)\n json['messages'].each do | message |\n @person = Person.find_by_phone_number(message['number'])\n if @person\n message['user_id'] = @person.guid\n end\n end\n\n render_json :entry => json and return\n end\n render_json :status => :bad_request, :messages => \"No matching application ID was found, cannot proceed to fetch SMS from server.\" and return\n end", "def index\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sms }\n end\n end", "def smsmark\n http = get_http_connection() \n post_args = { 'ids' => params[:ids], 'name' => @pysmsd_config.app_name, 'password' => @pysmsd_config.app_password }\n request = Net::HTTP::Post.new('/messages/in.json')\n request.set_form_data(post_args)\n resp = http.request(request)\n json = JSON.parse(resp.body)\n render_json :entry => json\n end", "def index\n @sms_tmps = SmsTmp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sms_tmps }\n end\n end", "def receive_sms\n uninitialize_sms\n body = params[:Body]\n phone_number = normalize_phone params[:From].strip\n @problem_text = body.split\n action = sms_parsing(body).downcase\n if action == \"join\"\n sms_create_account\n return\n elsif Account.find_by_phone_number(phone_number) == nil\n sms_send(params[:From], \"Please first create an account by texting the word 'join'.\")\n return\n end\n if !@sms_error\n case action\n when /^add$/,/^insert$/\n sms_create\n when /^accept$/\n sms_accept_problem\n when /^get$/\n @offset = false\n sms_get(0)\n when /^edit$/\n sms_edit\n when /^delete$/, /^destroy$/\n sms_delete\n when /^next$/\n offset = session[\"offset\"]\n if offset == nil\n sms_error(\"Sorry, there is no saved session right now. Please first text \\\"GET\\\" with @location !skill %number of texts you want to allow.\")\n else\n @offset = true\n sms_get(offset)\n end\n when /^detail$/, /^details$/, /^describe$/\n sms_detail\n when /^account$/\n forgot_acc\n when /^change$/\n sms_change_password\n when /^password$/\n forgot_password\n# when /^skill$/, /^skills$/\n# sms_skill\n when /^keywords$/, /^key$/, /^keys$/, /^help$/\n sms_keywords\n when /^explain$/\n sms_explain\n else\n if is_num?(action)\n session[:received_confirmation] = action\n sms_confirm_acc\n else\n sms_wrong_keyword\n end\n end\n end\n render :nothing => true\n end", "def sms\n @response, @documents = get_solr_response_for_field_values(SolrDocument.unique_key,params[:id])\n if request.post?\n url_gen_params = {:host => request.host_with_port, :protocol => request.protocol}\n tinyPass = request.protocol + request.host_with_port + catalog_path(params['id'])\n tiny = tiny_url(tinyPass)\n if params[:to]\n phone_num = params[:to].gsub(/[^\\d]/, '')\n unless params[:carrier].blank?\n if phone_num.length != 10\n flash[:error] = I18n.t('blacklight.sms.errors.to.invalid', :to => params[:to])\n else\n email = RecordMailer.sms_record(@documents, {:to => phone_num, :carrier => params[:carrier], :callnumber => params[:callnumber], :location => params[:location], :tiny => tiny}, url_gen_params)\n end\n\n else\n flash[:error] = I18n.t('blacklight.sms.errors.carrier.blank')\n end\n else\n flash[:error] = I18n.t('blacklight.sms.errors.to.blank')\n end\n\n unless flash[:error]\n email.deliver\n flash[:success] = \"Text sent\"\n redirect_to catalog_path(params['id']) unless request.xhr?\n end\n end\n unless !request.xhr? && flash[:success]\n respond_to do |format|\n format.js { render :layout => false }\n format.html\n end\n end\n end", "def sms\n reply = TwilioService.new.process_inbound_sms(params)\n render_twiml_message(reply) if reply\n end", "def get_sms_number\n self.phone_numbers.where([\"type in(1, 3)\"]).first\n end", "def show\n @minimessage = Minimessage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @minimessage }\n end\n end", "def new\n @sms_tmp = SmsTmp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sms_tmp }\n end\n end", "def sms_email_sms_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: EmailToSmsApi.sms_email_sms_get ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling EmailToSmsApi.sms_email_sms_get, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling EmailToSmsApi.sms_email_sms_get, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/sms/email-sms'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EmailToSmsApi#sms_email_sms_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @v1_message = V1::Message.find(params[:id])\n\n render json: @v1_message\n end", "def sms\n @sms ||= TermuxRubyApi::SubSystems::Sms.new(self)\n end", "def smsStatus(sms_id)\n url = self.getResourceUrl(CGI.escape(sms_id.to_s))\n\n headers = {\n :Accept => \"application/json\",\n }\n \n begin\n response = self.get(url, headers)\n rescue RestClient::Exception => e\n raise(ServiceException, e.response || e.message, e.backtrace)\n end\n Model::SMSStatus.createFromJson(response)\n end", "def notifyViaSMS(number, message, api, user, password)\n result = nil\n message = CGI.escape message\n request = \"/http/sendmsg?api_id=#{api}&user=#{user}&password=#{password}&to=#{number}&text=#{message}&from=RIVR\" \n Net::HTTP.start( 'api.clickatell.com', 80 ) { |http| result = http.get(request).body } \n return result \n end", "def sent_messages\n get('/direct_messages/sent.json')\n end", "def index\n @sms_retrievals = SmsRetrieval.all\n end", "def get_account_sms_with_http_info(account_id, sms_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SmsApi.get_account_sms ...'\n end\n # verify the required parameter 'account_id' is set\n if @api_client.config.client_side_validation && account_id.nil?\n fail ArgumentError, \"Missing the required parameter 'account_id' when calling SmsApi.get_account_sms\"\n end\n # verify the required parameter 'sms_id' is set\n if @api_client.config.client_side_validation && sms_id.nil?\n fail ArgumentError, \"Missing the required parameter 'sms_id' when calling SmsApi.get_account_sms\"\n end\n # resource path\n local_var_path = '/accounts/{account_id}/sms/{sms_id}'.sub('{' + 'account_id' + '}', account_id.to_s).sub('{' + 'sms_id' + '}', sms_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['apiKey']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SmsFull')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SmsApi#get_account_sms\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def sms\n account_sid = params[:AccountSid]\n body = params[:Body]\n from = params[:From]\n from_zip = params[:FromZip]\n if from && body && # account_sid == TWILIO_ACCOUNT_SID \n sms = TwilioNet.new()\n sms.send_sms('2146680255', truncate(\"FROM:#{from} BODY:#{body}\", :length => 159) )\n render :layout => 'empty', :template => 'public/sms' \n else\n raise error \n end \n rescue\n render :text => \"Invalid Params #{params.inspect}\"\n end", "def sms_email_sms_get(opts = {})\n data, _status_code, _headers = sms_email_sms_get_with_http_info(opts)\n data\n end", "def index\n phone_number = params[:phone_number]\n\n response = Faraday.get \"#{BASE_URL}/api/v1/getMessages/#{phone_number}\", nil, {'Authorization': \"Bearer \"}\n\n @data = {\n phone_number: phone_number\n }\n\n if response.status === 200\n response_body = JSON.parse(response.body)\n @data[:messages] = response_body['messages']['items']\n end\n\n render json: @data\n end", "def show\n @message_phone_connection = MessagePhoneConnection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message_phone_connection }\n end\n end", "def send_by_sms\n\t\t# ActionMailer deliverya\n\t\trecipeintNumberRaw = params[:mobile_number].gsub!(/[^0-9]/,'')\n\t\trecipeintNumberFormatted = params[:mobile_number]\n\t\t@listing = Listing.find(params[:listing_id])\n\n\t\tsms_message = 'Click to view the listing on ' + @listing.address_1 + ' ' + @listing.address_2 + ' ' + @listing.city + ' ' + @listing.state + ' ' + listing_url(@listing)\n\n\t\tsms_fu = SMSFu::Client.configure(:delivery => :action_mailer)\n\t\tsms_fu.deliver(recipeintNumberRaw, params[:carrier][0] , sms_message, :from => 'alert@fsbolisting.com')\n\t\treturn_response = { \"status\" => \"ok\", \"number\" => recipeintNumberFormatted }\n\t\trender :json => return_response.to_json, :callback => params[:callback]\n\n\tend", "def new\n @sms = Sms.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sms }\n end\n end", "def get_an_sms_message_with_http_info(message_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.get_an_sms_message ...'\n end\n\n # verify the required parameter 'message_id' is set\n if @api_client.config.client_side_validation && message_id.nil?\n fail ArgumentError, \"Missing the required parameter 'message_id' when calling DefaultApi.get_an_sms_message\"\n end\n # resource path\n local_var_path = '/Accounts/{accountId}/Messages/{messageId}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'messageId' + '}', CGI.escape(message_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'MessageResult'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['fc']\n\n new_options = opts.merge(\n :operation => :\"DefaultApi.get_an_sms_message\",\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: DefaultApi#get_an_sms_message\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @sms_sends = SmsSend.order(\"created_at DESC\").page(params[:page]).per(10)\n end", "def sms\n account_sid = params[:AccountSid]\n body = params[:Body]\n from = params[:From]\n from_zip = params[:FromZip]\n if from && body && # account_sid == TWILIO_ACCOUNT_SID\n # sms = TwilioNet.new()\n # sms.send_sms('2146680255', truncate(\"FROM:#{from} BODY:#{body}\", :length => 159) )\n # render :layout => 'empty', :template => 'public/sms' \n creator = User.find_or_create_by_sms_number(from)\n creator.create_task(body)\n unless creator.valid?\n Rails.logger.error creator.message\n sms = TwilioNet.new()\n sms.send_sms(from, truncate(creator.message, :length => 159) )\n end\n render :text => \"Task created.\" \n else\n raise error \n end \n rescue\n render :text => \"Invalid Params #{params.inspect}\"\n end", "def index\n @sms_sends = SmsSend.all\n end", "def new_sms_updates(content, tonumber)\n\t@client.messages.list.each do |message|\n\tRails.logger.debug(message.body)\n\tend\n end", "def send_sms_with_http_info(sms_vo, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SMSApi.send_sms ...'\n end\n # verify the required parameter 'sms_vo' is set\n if @api_client.config.client_side_validation && sms_vo.nil?\n fail ArgumentError, \"Missing the required parameter 'sms_vo' when calling SMSApi.send_sms\"\n end\n # resource path\n local_var_path = '/sms'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(sms_vo)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SMSResponseVO')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SMSApi#send_sms\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @sms_logs = @phone_item.sms_logs\n end", "def message_type\n 'sms'\n end", "def sms\n account_sid = <your account sid>\n auth_token = <your auth token>\n client = Twilio::REST::Client.new(account_sid, auth_token)\n\n client.messages.create(\n from: <twilio number>,\n to: <your number>,\n body: @message\n )\nend", "def send_text(sms, phones)\n phones.each do |phone|\n post_response = Faraday.post do |request|\n request.url \"https://api.twilio.com/2010-04-01/Accounts/#{ACCOUNT_SID}/SMS/Messages.json\"\n request.headers['Authorization'] = \"Basic \" + Base64.strict_encode64(\"#{ACCOUNT_SID}:#{AUTH_TOKEN}\")\n request.body = URI.encode_www_form({'From' => PHONE_NUMBER, 'To' => phone.phone_number, 'Body' => sms.message})\n end\n end\n end", "def twilio\n @number = params[:phone_number]\n \n #Text message info\n t = {\n \n 'From' => CALLER_ID,\n 'To' => @number,\n 'Body' => (\"Visit uhpartments.com when you walk through an apartment\")\n }\n\n begin\n account = Twilio::RestAccount.new(ACCOUNT_SID, ACCOUNT_TOKEN)\n resp = account.request(\"/#{API_VERSION}/Accounts/#{ACCOUNT_SID}/SMS/Messages\",\n 'POST',\n t)\n resp.error! unless resp.kind_of? Net::HTTPSuccess\n rescue StandardError => bang\n #This area will be called if an error happens with the Twilio API\n flash[:alert] = \"Bad number.\"\n redirect_to({ :action => :home })\n \n return\n end\n\n redirect_to({ :action => :home, :alert => \"SMS sent.\" })\n end", "def get_sms_status_with_http_info(sms_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SMSApi.get_sms_status ...'\n end\n # verify the required parameter 'sms_id' is set\n if @api_client.config.client_side_validation && sms_id.nil?\n fail ArgumentError, \"Missing the required parameter 'sms_id' when calling SMSApi.get_sms_status\"\n end\n # resource path\n local_var_path = '/sms/status/{sms_id}'.sub('{' + 'sms_id' + '}', sms_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SMS')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SMSApi#get_sms_status\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def smssend\n http = get_http_connection() \n post_args = { 'number' => params[:number], 'text' => params[:text],'replyto' => params[:replyto], 'name' => @pysmsd_config.app_name, 'password' => @pysmsd_config.app_password }\n \n request = Net::HTTP::Post.new('/messages/out.json')\n request.set_form_data(post_args)\n resp = http.request(request)\n json = JSON.parse(resp.body)\n render_json :entry => json\n end", "def show\n @text_message = @profile.text_messages.find(params[:id])\n\n respond_to do |format|\n format.mobile\n format.html # show.html.erb\n format.xml { render :xml => @text_message }\n end\n end", "def send_sms (text, receiver, logger) \r\n sms = Skuby::Gateway.send_sms text, receiver\r\n\r\n if sms.success? \r\n response = { status: sms.status, \r\n text: text, \r\n receiver: receiver, \r\n remaining_sms: sms.remaining_sms\r\n }\r\n response.merge! sms_id: sms.sms_id if sms.sms_id?\r\n\r\n logger.debug \"SMS SENT: #{response.to_s}\"\r\n\r\n else\r\n response = { status: sms.status, \r\n error_code: sms.error_code, \r\n error_message: sms.error_message, \r\n text: text, \r\n receiver: receiver\r\n }\r\n response.merge! sms_id: sms.sms_id if sms.sms_id?\r\n\r\n logger.error \"SMS SENT: #{response.to_s}\" \r\n end\r\n\r\n sms.success?\r\nend", "def create\n @sms_retrieval = SmsRetrieval.new(sms_retrieval_params)\n\n respond_to do |format|\n if @sms_retrieval.save\n format.html { redirect_to @sms_retrieval, notice: 'Sms retrieval was successfully created.' }\n format.json { render :show, status: :created, location: @sms_retrieval }\n else\n format.html { render :new }\n format.json { render json: @sms_retrieval.errors, status: :unprocessable_entity }\n end\n end\n end", "def twilio_sms\n sms = {\n :sid => params[:SmsSid], \n :from => params[:From],\n :to => params[:To],\n :body => params[:Body],\n #:status => params[:SmsStatus], # this will be used later for confirmation with Twilio \n }\n @txt = Txt.new(sms) \n \n @status_report = TWILIO_CONFIG[\"base_url\"].to_s + '/home/twilio_status'\n\n #@txt.twilio_reply_sms\n\n respond_to do |format|\n if @txt.save and @txt.match_coupon?(sms)\n flash[:notice] = 'Message was successfully received.' \n format.xml { @txt }\n else\n flash[:notice] = 'Delivery failed.' \n format.xml { @txt }\n end\n end\n\n end", "def send_sms(message)\n api_response = \"\"\n if !self.mobile.blank?\n txtlocal = Txtlocal.find_by_sms_type(Txtlocal::GROUP_CHAT)\n if !txtlocal.nil?\n txtlocal.message_contents = message\n api_response = txtlocal.send_sms(self.mobile)\n end\n else\n api_response = \"You have not provided any mobile number. Please go to your 'Account' to set up a mobile number\"\n end\n return api_response\n end", "def send_sms(params)\n self.current_params = params\n response = send_request(params)\n smart_response(response.parsed_response)\n end", "def new; send_sms; end", "def index\n @smsnos = Smsno.all\n end", "def show\n @text_message = TextMessage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @text_message }\n end\n end", "def send_sms(fromNumber)\n begin\n bodyParams = {\n from: { phoneNumber: fromNumber },\n to: [{ phoneNumber: RECIPIENT }],\n # To send group messaging, add more (max 10 recipients) 'phoneNumber' object. E.g.\n #\n #to: [\n # { phoneNumber: RECIPIENT },\n # { phoneNumber: 'Recipient-Phone-Number' }\n # ],\n text: 'Hello World!'\n }\n endpoint = \"/restapi/v1.0/account/~/extension/~/sms\"\n resp = $platform.post(endpoint, payload: bodyParams)\n puts (\"SMS sent. Message id: \" + resp.body['id'].to_s)\n check_message_status(resp.body['id'])\n rescue StandardError => e\n puts (e)\n end\nend", "def show\n @reminder_phrase = ReminderPhrase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reminder_phrase }\n end\n end", "def show\n @message = Message.find(params[:id])\n render json: @message\n\n end", "def reply\n @options[:method] = 'getsmsreply'\n @options[:clientmessagereference] = clientmessagereference\n response = ta_response(status_params)\n return response\n end", "def set_smsno\n @smsno = Smsno.find(params[:id])\n end", "def messages\n @logger.log(\"Getting messages from phone.\")\n \n # Get a list of messages\n msg = nil\n msgs = ATPhone::SMS.new(self)\n\n # Turn on text mode\n send(\"AT+CMGF=1\")\n \n resp = send(\"AT+CMGL\")\n resp.each_line do |line|\n # If it is a message header\n if line[0..5] == '+CMGL:'\n # Add formed message to list\n msgs[msg.index] = msg unless msg.nil?\n \n # Create new message from phone data\n index, status, number = line[7..-1].split(',')\n msg = ATPhone::SMS::Message.new(\n \"\",\n number.strip.gsub('\"', ''),\n index.to_i,\n status.strip.gsub('\"', '')\n )\n # If it's not a command, then it's text\n elsif not msg.nil?\n msg.message += line\n end\n end\n\n # Add last message\n msgs[msg.index] = msg unless msg.nil?\n\n msgs\n end", "def create\n to = params[:to]\n\n unless to\n raise IOError, \"Incorrect params for sending text message\" \n end\n\n @client = Twilio::REST::Client.new(\n CONFIG[:twilio_account_sid],\n CONFIG[:twilio_auth_token])\n\n @account = @client.account\n @message = @account.sms.messages.create({\n :from => CONFIG[:twilio_phone_number],\n :to => to,\n :body => \"Happy Mining! #{CONFIG[:ios_app_link]}\"}) \n\n rescue => ex\n handle_exception(ex)\n ensure\n respond_to do |format|\n format.json\n end\n end", "def index\n @smsusers = Smsuser.all\n end", "def receive(sms)\n sms = connection.parse(sms)\n new.receive(sms)\n end", "def show\n @phone = Phone.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @phone }\n end\n end", "def show\n @phone = Phone.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @phone }\n end\n end", "def sms_receipts_by_message_id_get_with_http_info(message_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SMSApi.sms_receipts_by_message_id_get ...'\n end\n # verify the required parameter 'message_id' is set\n if @api_client.config.client_side_validation && message_id.nil?\n fail ArgumentError, \"Missing the required parameter 'message_id' when calling SMSApi.sms_receipts_by_message_id_get\"\n end\n # resource path\n local_var_path = '/sms/receipts/{message_id}'.sub('{' + 'message_id' + '}', message_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SMSApi#sms_receipts_by_message_id_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_messages\n \tuser = User.find(params[:user_id]);\n \tif user\n \t\tmessages = Message.where(message_type: user.user_type)\n \t\tconversation = Conversation.where(request_id: params[:request_id])\n texts = []\n conversation.each{ |msg| texts.push(Message.find_by(id: msg.message_id) ? Message.find(msg.message_id) : {})}\n \t\trender json: {messages: messages, conversation: conversation, texts: texts}\n \telse\n\t\trender json: {error: 'User not found.'}\n \tend\n end", "def smsStatus(sms_id)\n self.get(self.getResourceUrl(sms_id))\n end", "def sms_inbound_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SMSApi.sms_inbound_get ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling SMSApi.sms_inbound_get, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling SMSApi.sms_inbound_get, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/sms/inbound'\n\n # query parameters\n query_params = {}\n query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SMSApi#sms_inbound_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def sms number, message\n response = @connection.cmd \"String\" =>\"sms send #{number} #{message}\", \"Match\" => /OK|KO:(.*)/, \"Timeout\" => 5\n if response.chomp == \"OK\"\n true\n else\n raise response.chomp.sub \"KO:\",''\n end\n end", "def create\n @sm = Sm.new(params[:sm])\n\n respond_to do |format|\n if @sm.save\n SmsMailer.send_sms(@sm).deliver\n format.html { redirect_to @sm, notice: \"SMS Sent successfully to #{@sm.number}.\" }\n format.json { render json: @sm, status: :created, location: @sm }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sm.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n\t\tchannel_sid = params[:channel_sid]\n\t\t@client = Twilio::REST::Client.new(ENV['account_sid'], ENV['auth_token'])\n\t\t# Retrieve the member\n\t\tservice = @client.chat.v2.services(ENV['service_sid'])\n\t\tchannel = service.channels(channel_sid)\n\t\tmessage = channel.messages(params[:id]).fetch\n\t\tmessage_json = \"{\\n\\\"message_sid\\\": \\\"#{message.sid}\\\",\\n\\\"body\\\": \\\"#{message.body}\\\"\\n}\" \n\t\t# member_json = member_json+\" \\\"identity\\\": \\\"\"+member.identity+\"\\\",\\n\"\n\t\t# member_json = member_json+\" \\\"member_sid\\\": \\\"\"+member.sid+\"\\\"\\n\"\n\t\t# member_json = member_json+\"}\" \n\t\tputs \"#{message.sid} #{message.body}\"\n\t\tjson_response(message_json)\n\tend", "def consume_sms(message, text_message_options)\n object_name = text_message_options[message.body.strip] ? text_message_options[message.body.strip][0] : nil\n format = !object_name.nil? ? text_message_options[message.body.strip][1] : \"\"\n if message.body.strip == \"#0\" || object_name.nil?\n keys = text_message_options.keys\n info_message = \"\"\n keys.each do |x|\n info_message << \"#{x} for #{text_message_options[x][0]}\\n\"\n end\n \n return info_message\n end\n\n @account.object_instances_as_sms(object_name, format)\n end", "def sms(phone_number, **params)\n\n self.post(VERIFY_SMS_RESOURCE,\n phone_number: phone_number,\n **params)\n end", "def create\n @sms = Sms.new(params[:sms])\n\n respond_to do |format|\n if @sms.save\n flash[:notice] = 'Sms was successfully created.'\n format.html { redirect_to(@sms) }\n format.xml { render :xml => @sms, :status => :created, :location => @sms }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sms.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n # @phone = Phone.new\n\n @phone = Phone.new\n\n\n # uri = \"#{API_BASE_URL}.json?pages=10\" # specifying json format in the URl\n # rest_resource = RestClient::Resource.new(uri, USERNAME, PASSWORD)\n # users = rest_resource.get\n # @users = JSON.parse(users, :symbolize_names => true) # we will convert the return\n\n @user = User.new\n if @user.id?\n @user = User.last\n\n redirect_to \"/apps/texty/verify\"\n elsif !@user.id?\n\n @user.id = params[:user_id]\n session[:user] = params[:user_id]\n @phone.user_id = params[:user_id]\n @user.save\n uri2 = \"#{API_BASE_URL2}#{@user.id}.json\" # specifying json format in the URl\n rest_resource = RestClient::Resource.new(uri2, USERNAME, PASSWORD)\n user = rest_resource.get\n @user = JSON.parse(user, :symbolize_names => true) # we will convert the return\n\n end\n\n @phone.number = @user[:custom][:telephone]\n\n if !Phone.exists?(@phone.vercode)\n @phone.vercode = rand(10000..100000).to_s\n @phone.save\n @phone.send_sms(@phone.number,@phone.vercode)\n\n redirect_to \"/apps/texty/verify\"\n\n else\n redirect_to \"https://instantsignup.pixfizz.com/site\"\n\n end\n\n end", "def sms(phone_number)\n mp \"[BP Deprecated] use app.launch(sms: #{phone_number}) over app.sms\"\n launch(sms: phone_number)\n end", "def send_twilio_mms\n # Get your Account Sid and Auth Token from twilio.com/user/account\n\n account_sid = 'add your account sid'\n auth_token = 'add your auth token'\n\n # set up a client to talk to the Twilio REST API\n client = Twilio::REST::Client.new account_sid, auth_token\n\n\n mms_message_body = \"name:#{self.contact.name}\"\n mms_message_body += \"\" #quick way to create spacing inbetween txt lines\n mms_message_body += \"phone: #{self.contact.phone_number}\"\n mms_message_body += \"\" #quick way to create spacing inbetween txt lines\n mms_message_body += \"#{self.message}\"\n end", "def show\n @store_manager_messages_read = Store::Manager::Messages::Read.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store_manager_messages_read }\n end\n end", "def show\n @mobile = Mobile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mobile }\n end\n end", "def send_raw_sms_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: MessagingApi.send_raw_sms ...\"\n end\n # resource path\n local_var_path = \"/messaging/raw-sms\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'raw_sms_resource'])\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MessagingApi#send_raw_sms\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def send_sms(content, tonumber)\n tonumber = format(tonumber);\n \tbegin\n @client.messages.create({\n \t :from => @from_number,\n \t :to => tonumber,\n \t :body => content,\n })\n rescue Twilio::REST::RequestError => e\n message = I18n.t(\"errors.sms_not_sent\")\n rescue NoMethodError => e\n message = I18n.t(\"errors.sms_not_sent\")\n else\n message = I18n.t(\"notice.success\")\n end\n\n return message\n\n end", "def getToolsSendsms( from, to, message)\n params = Hash.new\n params['from'] = from\n params['to'] = to\n params['message'] = message\n return doCurl(\"get\",\"/tools/sendsms\",params)\n end", "def index\n @messages = Message.all\n render json: @messages\n end", "def index\n @messages = Message.all\n render json: @messages\n end", "def show\n @mailbox = Mailbox.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mailbox }\n end\n end", "def twiml\n sms = { from: params[:From],\n to: params[:To],\n body: params[:Body] }\n\n from_user = User.find_by_phone_number(params[:From])\n sms[:from_user_id] = from_user.id if from_user\n to_user = User.find_by_phone_number(params[:To])\n sms[:to_user_id] = to_user.id if to_user\n\n # save the message into the DB\n @sms = Sms.create(sms)\n from_user = @sms.from_user\n\n # response logic\n # if from_user && from_user.response.nil?\n # if sms[:body].downcase.include?(\"yes\")\n # twilio.respond_to_yes(sms[:from])\n # from_user.response = true\n # from_user.save\n # elsif sms[:body].downcase.include?(\"no\")\n # twilio.send_sms(sms[:from], \"Got it. Have a great day!\")\n # from_user.response = false\n # from_user.save\n # end\n # end\n\n # Empty response to Twilio (Do nothing more)\n render xml: Twilio::TwiML::Response.new.text\n end", "def index\n messages = Message.all\n render json: messages\n end", "def send_sms(cmatch, tstamp, number, expiration)\n\n # Primary provider\n #\n nexmo_reponse = begin\n nexmo = Nexmo::Client.new('371f3e5d', 'e3218b70')\n token_url = create_token_url(cmatch, tstamp)\n record_token(cmatch, tstamp, expiration)\n sms_primary_response = nexmo.send_message({\n from: '13059298586',\n to: number,\n text: cmatch\n })\n json :sms_status => \"sent\",\n :token => cmatch,\n :token_url => token_url,\n :phone_number => number,\n :token_generated => tstamp,\n :token_expires => tstamp + expiration\n rescue\n send_sms_twilio(cmatch, tstamp, number, expiration)\n end\nend", "def index\n @messages = Message.all\n\n render json: @messages\n end", "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end", "def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end" ]
[ "0.73304296", "0.69692653", "0.6927522", "0.6927392", "0.6884283", "0.67309207", "0.6712092", "0.66462827", "0.6631604", "0.65856844", "0.65630996", "0.6515046", "0.6481532", "0.646688", "0.6447078", "0.64457965", "0.6396502", "0.6386514", "0.63723654", "0.6368979", "0.6350875", "0.63267285", "0.6318747", "0.63016605", "0.62980235", "0.6278397", "0.6251887", "0.6216524", "0.6163489", "0.6162048", "0.6146152", "0.60927886", "0.6090539", "0.6059247", "0.60335964", "0.600952", "0.60077304", "0.6006409", "0.60005766", "0.5997949", "0.59958506", "0.59764296", "0.5966779", "0.59553516", "0.5953402", "0.59477305", "0.5938248", "0.5929922", "0.59225804", "0.59205663", "0.59004045", "0.58977836", "0.5896538", "0.5892822", "0.58852416", "0.5881194", "0.58810467", "0.58779556", "0.5871918", "0.58698726", "0.5859006", "0.58452755", "0.583341", "0.5831591", "0.58266586", "0.58182645", "0.58182645", "0.57896", "0.57882285", "0.5780155", "0.577687", "0.5775786", "0.57726103", "0.57704663", "0.57645917", "0.5757323", "0.57227314", "0.5722571", "0.57219326", "0.57165587", "0.5715553", "0.57150674", "0.5710802", "0.5710168", "0.5707212", "0.570576", "0.570576", "0.5704693", "0.57023084", "0.5691591", "0.569034", "0.5689396", "0.56512034", "0.56512034", "0.56512034", "0.56512034", "0.56512034", "0.56512034", "0.56512034", "0.56512034" ]
0.6144414
31
GET /sms/new GET /sms/new.json
def new @sm = Sm.new respond_to do |format| format.html # new.html.erb format.json { render json: @sm } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @sms_tmp = SmsTmp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sms_tmp }\n end\n end", "def new\n @sms = Sms.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sms }\n end\n end", "def new\n @minimessage = Minimessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @minimessage }\n end\n end", "def new\n @phone = Phone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @phone }\n end\n end", "def new\n @phone = Phone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @phone }\n end\n end", "def create\n @sms = Sms.new(params[:sms])\n\n respond_to do |format|\n if @sms.save\n flash[:notice] = 'Sms was successfully created.'\n format.html { redirect_to(@sms) }\n format.xml { render :xml => @sms, :status => :created, :location => @sms }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sms.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @mailbox = Mailbox.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mailbox }\n end\n end", "def new\n @message = Message.new\n #@message.build_message_to_phone_connection.build_phone\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n render json: @message\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @add_phone_to_nouveau_ticket = AddPhoneToNouveauTicket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @add_phone_to_nouveau_ticket }\n end\n end", "def create\n @sms_retrieval = SmsRetrieval.new(sms_retrieval_params)\n\n respond_to do |format|\n if @sms_retrieval.save\n format.html { redirect_to @sms_retrieval, notice: 'Sms retrieval was successfully created.' }\n format.json { render :show, status: :created, location: @sms_retrieval }\n else\n format.html { render :new }\n format.json { render json: @sms_retrieval.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @message_phone_connection = MessagePhoneConnection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message_phone_connection }\n end\n end", "def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @message }\n end\n end", "def create\n @sm = Sm.new(params[:sm])\n\n respond_to do |format|\n if @sm.save\n SmsMailer.send_sms(@sm).deliver\n format.html { redirect_to @sm, notice: \"SMS Sent successfully to #{@sm.number}.\" }\n format.json { render json: @sm, status: :created, location: @sm }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sm.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @reminder_phrase = ReminderPhrase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reminder_phrase }\n end\n end", "def new\n @mobile = Mobile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mobile }\n end\n end", "def new\n @text_message = TextMessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @text_message }\n end\n end", "def new\n @message = Message.new\n @message.signature = 1\n @message.send_date = Date.today\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def create\n @smsno = Smsno.new(smsno_params)\n\n respond_to do |format|\n if @smsno.save\n format.html { redirect_to @smsno, notice: 'Smsno was successfully created.' }\n format.json { render :show, status: :created, location: @smsno }\n else\n format.html { render :new }\n format.json { render json: @smsno.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n to = params[:to]\n\n unless to\n raise IOError, \"Incorrect params for sending text message\" \n end\n\n @client = Twilio::REST::Client.new(\n CONFIG[:twilio_account_sid],\n CONFIG[:twilio_auth_token])\n\n @account = @client.account\n @message = @account.sms.messages.create({\n :from => CONFIG[:twilio_phone_number],\n :to => to,\n :body => \"Happy Mining! #{CONFIG[:ios_app_link]}\"}) \n\n rescue => ex\n handle_exception(ex)\n ensure\n respond_to do |format|\n format.json\n end\n end", "def new\n @sms_outbox = SmsOutbox.new\n \n \n # Check if item ready and granted to be created\n return if reject_when_not_granted_to(:create, @sms_outbox)\n \n # Setup default non-editable value \n build_lookup_belongs\n \n if !params[:commit] then\n if !params[:recipients] then\n params[:recipients] = {}\n @sms_recipients.each { |contact| params[:recipients][contact.id.to_s] = true }\n end \n end\n # redirect_to :action => 'index' and return unless request.xhr?\n \n if request.xhr? then\n render :update do |page|\n page.hide 'add_new_button'\n page['message'].hide\n page.replace_html \"message\", ''\n page.insert_html :after, \"title\", :partial => 'new'\n end\n end\n end", "def new\n @messaging_inbox = Messaging::Inbox.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @messaging_inbox }\n end\n end", "def new\n @message = current_user.messages.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @new_comm = NewComm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_comm }\n end\n end", "def new\n @momsg = Momsg.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @momsg }\n end\n end", "def new\n @title = \"New Subject\"\n @subject = Subject.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @subject }\n end\n end", "def new\n @mib = Mib.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mib }\n end\n end", "def new\n @conversation = Conversation.new\n logger.debug \"In new!\"\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @conversation }\n end\n end", "def new\n @mtype = Mtype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mtype }\n end\n end", "def new\n @message_pattern = MessagePattern.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message_pattern }\n end\n end", "def new\n @contact_message = ContactMessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact_message }\n end\n end", "def new\n @sm = Sm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sm }\n end\n end", "def new\n @teleoperation = Teleoperation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @teleoperation }\n end\n end", "def new\n @outgoing = Outgoing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @outgoing }\n end\n end", "def new\n @message = Message.new\n @users = User.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @inbox = Inbox.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inbox }\n end\n end", "def new\n @sheduled_message = SheduledMessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sheduled_message }\n end\n end", "def new; send_sms; end", "def new\n @recipient = Recipient.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipient }\n end\n end", "def new\n @recipient = Recipient.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipient }\n end\n end", "def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @route }\n end\n end", "def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @route }\n end\n end", "def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @route }\n end\n end", "def new\n @slam = Slam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slam }\n end\n end", "def new\n @route = Route.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @route }\n end\n end", "def new\n @messagetold = Messagetold.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @messagetold }\n end\n end", "def new\n @mod_message = ModMessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mod_message }\n end\n end", "def new\n @sentence = Sentence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sentence }\n end\n end", "def new\n @message = Message.new(:relation_id => params[:relation_id], :user_id => params[:user_id], :sent => false)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @messaging_message = Messaging::Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @messaging_message }\n end\n end", "def new\n @call = Call.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @call }\n end\n end", "def new\n @call = Call.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @call }\n end\n end", "def new\n @tnumber = Tnumber.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @tnumber }\n end\n end", "def create\n @sms_based = SmsBased.new(sms_based_params)\n\n respond_to do |format|\n if @sms_based.save\n format.html { redirect_to admin_services_path, notice: 'successfully created.' }\n format.json { render action: 'show', status: :created, location: @sms_based }\n else\n format.html { redirect_to admin_services_path, notice: 'Failed.' }\n format.json { render json: @sms_based.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @get = Get.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @get }\n end\n end", "def new\n @text_message = @profile.text_messages.build\n\n respond_to do |format|\n format.mobile\n format.html # new.html.erb\n format.xml { render :xml => @text_message }\n end\n end", "def new\n @pmessage = Pmessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pmessage }\n end\n end", "def new\r\n @text_activity = TextActivity.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @text_activity }\r\n end\r\n end", "def new\n @number_call = NumberCall.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @number_call }\n end\n end", "def new\n @subscriber = Subscriber.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @subscriber }\n end\n end", "def new\n @subscriber = Subscriber.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @subscriber }\n end\n end", "def new\n @subscriber = Subscriber.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @subscriber }\n end\n end", "def new\n @srsa = Srsa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @srsa }\n end\n end", "def new\n @send_message = SendMessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @send_message }\n end\n end", "def new\n @phone = Phone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @phone }\n end\n end", "def new\r\n @reminder = Reminder.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @reminder }\r\n end\r\n end", "def new\n @class_mstr = ClassMstr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @class_mstr }\n end\n end", "def new\n @suc = Suc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @suc }\n end\n end", "def new\n @conversation = Conversation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @conversation }\n end\n end", "def new\n @conversation = Conversation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @conversation }\n end\n end", "def new\n @reminder = Reminder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reminder }\n end\n end", "def new\n @new_status = NewStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_status }\n end\n end", "def new\n @room_message = RoomMessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @room_message }\n end\n end", "def new\n @phone_number = @kontact_information.phone_numbers.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.mobile\n format.xml { render :xml => @phone_number }\n end\n end", "def create\n # create an incoming sms object\n sms = Sms::Message.create(:from => params[:sms_test][:from], :body => params[:sms_test][:body], :mission => current_mission)\n\n # submit it to the handle method over in the SmsController and get the reply\n reply = SmsController.handle_sms(sms)\n\n # save the reply and let the sent_at default to now\n reply.save if reply\n\n # render the body of the reply\n render :text => reply ? reply.body : \"<em>#{t('sms_console.no_reply')}</em>\".html_safe\n end", "def new\n @sprint = Sprint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sprint }\n end\n end", "def new\n @ram = Ram.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ram }\n end\n end", "def new\n @message_link = MessageLink.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message_link }\n end\n end", "def new\n @smurf = Smurf.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @smurf }\n end\n end", "def new\n @tweet = Tweet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tweet }\n end\n end", "def new\n @tweet = Tweet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tweet }\n end\n end" ]
[ "0.78628653", "0.7476829", "0.71100944", "0.7042367", "0.7042367", "0.70232785", "0.6992452", "0.69913846", "0.6988504", "0.6969969", "0.6969969", "0.6969969", "0.6969969", "0.6969969", "0.6969969", "0.6969969", "0.6969969", "0.6969969", "0.6969969", "0.6969969", "0.6969969", "0.6969969", "0.6969969", "0.6969969", "0.6969969", "0.6969969", "0.6965569", "0.6965569", "0.6958161", "0.69400746", "0.69244343", "0.6909566", "0.6902465", "0.690153", "0.68991303", "0.68924224", "0.6879665", "0.6871692", "0.6869142", "0.6834937", "0.67917204", "0.6771533", "0.6740888", "0.67378634", "0.6712368", "0.6688076", "0.66677386", "0.66570544", "0.6651897", "0.66504866", "0.66394556", "0.660254", "0.66021025", "0.6584372", "0.6571452", "0.6571101", "0.65668315", "0.65645635", "0.65645635", "0.65643334", "0.65643334", "0.65643334", "0.65632266", "0.65594345", "0.65548295", "0.6554307", "0.6551307", "0.6541831", "0.6535599", "0.653098", "0.653098", "0.65256023", "0.6525508", "0.6523027", "0.6508701", "0.6507117", "0.64975137", "0.6495471", "0.64937896", "0.64937896", "0.64937896", "0.64907074", "0.6481375", "0.6479325", "0.64782214", "0.6472498", "0.647179", "0.6470859", "0.6470859", "0.6464214", "0.6462437", "0.6455062", "0.6442292", "0.64386207", "0.6432261", "0.6428422", "0.6423527", "0.6419862", "0.64189994", "0.64189994" ]
0.7467154
2
POST /sms POST /sms.json
def create @sm = Sm.new(params[:sm]) respond_to do |format| if @sm.save SmsMailer.send_sms(@sm).deliver format.html { redirect_to @sm, notice: "SMS Sent successfully to #{@sm.number}." } format.json { render json: @sm, status: :created, location: @sm } else format.html { render action: "new" } format.json { render json: @sm.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sms\n send_sms(params)\n respond_to do |format|\n format.json {render :json => {:status => :success }}\n end\n end", "def sms\n account_sid = <your account sid>\n auth_token = <your auth token>\n client = Twilio::REST::Client.new(account_sid, auth_token)\n\n client.messages.create(\n from: <twilio number>,\n to: <your number>,\n body: @message\n )\nend", "def create\n to = params[:to]\n\n unless to\n raise IOError, \"Incorrect params for sending text message\" \n end\n\n @client = Twilio::REST::Client.new(\n CONFIG[:twilio_account_sid],\n CONFIG[:twilio_auth_token])\n\n @account = @client.account\n @message = @account.sms.messages.create({\n :from => CONFIG[:twilio_phone_number],\n :to => to,\n :body => \"Happy Mining! #{CONFIG[:ios_app_link]}\"}) \n\n rescue => ex\n handle_exception(ex)\n ensure\n respond_to do |format|\n format.json\n end\n end", "def sms\n # Give Twilio the TwiML payload instructions\n twiml_payload\n end", "def sms\n \t\n \t#flash[:notice] = params\n \t#redirect_to root_path\n\n TwilioTextMessenger.new( params[:phone], params[:message]).call\n \t\n end", "def create\n\n begin\n\n text = params[\"Content\"]\n\n if !text.downcase.start_with?(\"test\")\n mobile = params[\"MSISDN\"]\n if !mobile.start_with?(\"+\")\n mobile = \"+#{mobile}\"\n end\n\n service = SmsService.new\n\n @message = SmsService.handle_sms_sending(text, mobile)\n\n render text: 'success', status: 200\n else\n if Rails.env == \"production\"\n msg = text.split(\" \")[1]\n HTTParty.post(ENV['DEVELOPEMENT_SERVER_URL'], :query => { \"Content\" => msg, \"MSISDN\" => params[\"MSISDN\"] })\n end\n render text: 'success', status: 200\n end\n rescue => error\n respond_to do |format|\n format.all { render json: (@message.errors if !@message.nil?), status: :unprocessable_entity }\n end\n end\n end", "def send_sms(to_phone_number, message)\n # message = {to:, from:, body: \"Hello\\n\\nWorld\"}\n # binding.pry\n @@client.messages.create(\n from: @@from,\n to: to_phone_number,\n body: message\n )\n end", "def smssend\n http = get_http_connection() \n post_args = { 'number' => params[:number], 'text' => params[:text],'replyto' => params[:replyto], 'name' => @pysmsd_config.app_name, 'password' => @pysmsd_config.app_password }\n \n request = Net::HTTP::Post.new('/messages/out.json')\n request.set_form_data(post_args)\n resp = http.request(request)\n json = JSON.parse(resp.body)\n render_json :entry => json\n end", "def create\n @message = Message.new(message_params)\n\n if @message.save\n SharpenAPI.send_sms(@message.message, @message.recipient_numbers)\n redirect_to admin_bat_signal_path, notice: 'Message was successfully sent'\n else\n format.html { render :new }\n format.json do\n render json: @message.errors, status: :unprocessable_entity\n end\n end\n end", "def sms_send_post_with_http_info(sms_messages, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SMSApi.sms_send_post ...'\n end\n # verify the required parameter 'sms_messages' is set\n if @api_client.config.client_side_validation && sms_messages.nil?\n fail ArgumentError, \"Missing the required parameter 'sms_messages' when calling SMSApi.sms_send_post\"\n end\n # resource path\n local_var_path = '/sms/send'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(sms_messages)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SMSApi#sms_send_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def send_text(sms, phones)\n phones.each do |phone|\n post_response = Faraday.post do |request|\n request.url \"https://api.twilio.com/2010-04-01/Accounts/#{ACCOUNT_SID}/SMS/Messages.json\"\n request.headers['Authorization'] = \"Basic \" + Base64.strict_encode64(\"#{ACCOUNT_SID}:#{AUTH_TOKEN}\")\n request.body = URI.encode_www_form({'From' => PHONE_NUMBER, 'To' => phone.phone_number, 'Body' => sms.message})\n end\n end\n end", "def send_sms phone, message\n message = URI.escape message\n response = RestClient.get \"#{sender_base_url}/?from=#{@from}&to=#{phone}&text=#{message}&pass=#{@application_pass}\"\n @response = Response.new response\n end", "def sms_params\n params.permit(:message)\n end", "def receive_sms\n @view = \"sms\"\n @body = params[\"Body\"]\n @phone_number = params[\"From\"]\n set_user_create_message_parse_and_point\n end", "def create\n @sms_send = SmsSend.new(sms_send_params)\n\n respond_to do |format|\n if @sms_send.save\n format.html { redirect_to @sms_send, notice: 'Sms send was successfully created.' }\n format.json { render :show, status: :created, location: @sms_send }\n else\n format.html { render :new }\n format.json { render json: @sms_send.errors, status: :unprocessable_entity }\n end\n end\n end", "def huzzah\n # ===========================================================================\n # 6. Send an SMS Message to 415-555-1212\n # uses a HTTP POST, and a new variable t for the information (because it needs \"Body\")\n \n account = Twilio::RestAccount.new(ACCOUNT_SID, ACCOUNT_TOKEN)\n \n t = {\n 'From' => CALLER_ID,\n 'To' => phone,\n 'Body' => message\n }\n resp = account.request(\"/#{API_VERSION}/Accounts/#{ACCOUNT_SID}/SMS/Messages\",\n \"POST\", t)\n end", "def sms\n @response, @documents = get_solr_response_for_field_values(SolrDocument.unique_key,params[:id])\n if request.post?\n url_gen_params = {:host => request.host_with_port, :protocol => request.protocol}\n tinyPass = request.protocol + request.host_with_port + catalog_path(params['id'])\n tiny = tiny_url(tinyPass)\n if params[:to]\n phone_num = params[:to].gsub(/[^\\d]/, '')\n unless params[:carrier].blank?\n if phone_num.length != 10\n flash[:error] = I18n.t('blacklight.sms.errors.to.invalid', :to => params[:to])\n else\n email = RecordMailer.sms_record(@documents, {:to => phone_num, :carrier => params[:carrier], :callnumber => params[:callnumber], :location => params[:location], :tiny => tiny}, url_gen_params)\n end\n\n else\n flash[:error] = I18n.t('blacklight.sms.errors.carrier.blank')\n end\n else\n flash[:error] = I18n.t('blacklight.sms.errors.to.blank')\n end\n\n unless flash[:error]\n email.deliver\n flash[:success] = \"Text sent\"\n redirect_to catalog_path(params['id']) unless request.xhr?\n end\n end\n unless !request.xhr? && flash[:success]\n respond_to do |format|\n format.js { render :layout => false }\n format.html\n end\n end\n end", "def create\n @sms = Sms.new(params[:sms])\n\n respond_to do |format|\n if @sms.save\n flash[:notice] = 'Sms was successfully created.'\n format.html { redirect_to(@sms) }\n format.xml { render :xml => @sms, :status => :created, :location => @sms }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sms.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @smsno = Smsno.new(smsno_params)\n\n respond_to do |format|\n if @smsno.save\n format.html { redirect_to @smsno, notice: 'Smsno was successfully created.' }\n format.json { render :show, status: :created, location: @smsno }\n else\n format.html { render :new }\n format.json { render json: @smsno.errors, status: :unprocessable_entity }\n end\n end\n end", "def send_sms(fromNumber)\n begin\n bodyParams = {\n from: { phoneNumber: fromNumber },\n to: [{ phoneNumber: RECIPIENT }],\n # To send group messaging, add more (max 10 recipients) 'phoneNumber' object. E.g.\n #\n #to: [\n # { phoneNumber: RECIPIENT },\n # { phoneNumber: 'Recipient-Phone-Number' }\n # ],\n text: 'Hello World!'\n }\n endpoint = \"/restapi/v1.0/account/~/extension/~/sms\"\n resp = $platform.post(endpoint, payload: bodyParams)\n puts (\"SMS sent. Message id: \" + resp.body['id'].to_s)\n check_message_status(resp.body['id'])\n rescue StandardError => e\n puts (e)\n end\nend", "def smsmark\n http = get_http_connection() \n post_args = { 'ids' => params[:ids], 'name' => @pysmsd_config.app_name, 'password' => @pysmsd_config.app_password }\n request = Net::HTTP::Post.new('/messages/in.json')\n request.set_form_data(post_args)\n resp = http.request(request)\n json = JSON.parse(resp.body)\n render_json :entry => json\n end", "def sms\n account_sid = params[:AccountSid]\n body = params[:Body]\n from = params[:From]\n from_zip = params[:FromZip]\n if from && body && # account_sid == TWILIO_ACCOUNT_SID\n # sms = TwilioNet.new()\n # sms.send_sms('2146680255', truncate(\"FROM:#{from} BODY:#{body}\", :length => 159) )\n # render :layout => 'empty', :template => 'public/sms' \n creator = User.find_or_create_by_sms_number(from)\n creator.create_task(body)\n unless creator.valid?\n Rails.logger.error creator.message\n sms = TwilioNet.new()\n sms.send_sms(from, truncate(creator.message, :length => 159) )\n end\n render :text => \"Task created.\" \n else\n raise error \n end \n rescue\n render :text => \"Invalid Params #{params.inspect}\"\n end", "def new; send_sms; end", "def send_sms (text, receiver, logger) \r\n sms = Skuby::Gateway.send_sms text, receiver\r\n\r\n if sms.success? \r\n response = { status: sms.status, \r\n text: text, \r\n receiver: receiver, \r\n remaining_sms: sms.remaining_sms\r\n }\r\n response.merge! sms_id: sms.sms_id if sms.sms_id?\r\n\r\n logger.debug \"SMS SENT: #{response.to_s}\"\r\n\r\n else\r\n response = { status: sms.status, \r\n error_code: sms.error_code, \r\n error_message: sms.error_message, \r\n text: text, \r\n receiver: receiver\r\n }\r\n response.merge! sms_id: sms.sms_id if sms.sms_id?\r\n\r\n logger.error \"SMS SENT: #{response.to_s}\" \r\n end\r\n\r\n sms.success?\r\nend", "def sms_send_post(sms_messages, opts = {})\n data, _status_code, _headers = sms_send_post_with_http_info(sms_messages, opts)\n data\n end", "def create_sms(sms) \n s = SMS.new\n s.subscriber_id = @subscriber_id\n s.subscriber_password = @subscriber_password\n s.remote_host = @remote_host if @remote_host\n s.msg_pin = sms.recipients\n s.setSourceAddr(SMS::ADDR_TYPE_NETWORK, sms.from)\n s.msg_text = sms.body\n raise StandardError.new(\"SMS Body over 140 characters, body = \\n#{sms.body}\") if sms.body.size > 140\n s\n end", "def send_sms(content, tonumber)\n tonumber = format(tonumber);\n \tbegin\n @client.messages.create({\n \t :from => @from_number,\n \t :to => tonumber,\n \t :body => content,\n })\n rescue Twilio::REST::RequestError => e\n message = I18n.t(\"errors.sms_not_sent\")\n rescue NoMethodError => e\n message = I18n.t(\"errors.sms_not_sent\")\n else\n message = I18n.t(\"notice.success\")\n end\n\n return message\n\n end", "def twilio\n @number = params[:phone_number]\n \n #Text message info\n t = {\n \n 'From' => CALLER_ID,\n 'To' => @number,\n 'Body' => (\"Visit uhpartments.com when you walk through an apartment\")\n }\n\n begin\n account = Twilio::RestAccount.new(ACCOUNT_SID, ACCOUNT_TOKEN)\n resp = account.request(\"/#{API_VERSION}/Accounts/#{ACCOUNT_SID}/SMS/Messages\",\n 'POST',\n t)\n resp.error! unless resp.kind_of? Net::HTTPSuccess\n rescue StandardError => bang\n #This area will be called if an error happens with the Twilio API\n flash[:alert] = \"Bad number.\"\n redirect_to({ :action => :home })\n \n return\n end\n\n redirect_to({ :action => :home, :alert => \"SMS sent.\" })\n end", "def create\n @smsuser = Smsuser.new(smsuser_params)\n\n respond_to do |format|\n if @smsuser.save\n format.html { redirect_to @smsuser, notice: 'Smsuser was successfully created.' }\n format.json { render :show, status: :created, location: @smsuser }\n else\n format.html { render :new }\n format.json { render json: @smsuser.errors, status: :unprocessable_entity }\n end\n end\n end", "def reply # acts as endpoint\n \tmessage_body = params[\"Body\"] # grab params from Twilio's request\n \tfrom_number = params[\"From\"]\n \tboot_twilio\n \tsms = @client.messages.create( # send to inbound number made by end user\n from: Rails.application.secrets.twilio_from_number,\n to: from_number,\n body: \"Hello there, thanks for texting me. Your number is #{from_number}.\"\n \t)\n end", "def create\n # create an incoming sms object\n sms = Sms::Message.create(:from => params[:sms_test][:from], :body => params[:sms_test][:body], :mission => current_mission)\n\n # submit it to the handle method over in the SmsController and get the reply\n reply = SmsController.handle_sms(sms)\n\n # save the reply and let the sent_at default to now\n reply.save if reply\n\n # render the body of the reply\n render :text => reply ? reply.body : \"<em>#{t('sms_console.no_reply')}</em>\".html_safe\n end", "def send_text(text, phone)\n account_sid = ENV[\"ACCOUNT_SID\"]\n auth_token = ENV[\"AUTH_TOKEN\"]\n client = Twilio::REST::Client.new account_sid, auth_token\n\n account = client.account\n message = account.sms.messages.create({\n :from => ENV[\"PHONE\"],\n :to => phone,\n :body => text})\n puts message\n end", "def create\n @message = Message.new(message_params)\n if @message.save\n @message.action = 'SEND'\n @message.save\n\n # Send SMS text\n boot_twilio\n sms = @client.messages.create(\n body: @message.text,\n from: Rails.application.secrets.twilio_number,\n to: @message.number,\n )\n redirect_to @message, alert: \"SMS Text sent.\"\n else\n render 'new'\n end\n end", "def send_sms(params)\n self.current_params = params\n response = send_request(params)\n smart_response(response.parsed_response)\n end", "def twilio_send_text_message!(client,phone_num,msg)\n begin\n sms = client.account.sms.messages.create(\n :from => TWILIO_PHONE,\n :to => phone_num,\n :body => msg)\n rescue Exception => e\n puts \"Problems with twilio:\\n#{e}\"\n end\n end", "def sms\n account_sid = params[:AccountSid]\n body = params[:Body]\n from = params[:From]\n from_zip = params[:FromZip]\n if from && body && # account_sid == TWILIO_ACCOUNT_SID \n sms = TwilioNet.new()\n sms.send_sms('2146680255', truncate(\"FROM:#{from} BODY:#{body}\", :length => 159) )\n render :layout => 'empty', :template => 'public/sms' \n else\n raise error \n end \n rescue\n render :text => \"Invalid Params #{params.inspect}\"\n end", "def sms(phone_number, **params)\n\n self.post(VERIFY_SMS_RESOURCE,\n phone_number: phone_number,\n **params)\n end", "def send_twilio_mms\n # Get your Account Sid and Auth Token from twilio.com/user/account\n\n account_sid = 'add your account sid'\n auth_token = 'add your auth token'\n\n # set up a client to talk to the Twilio REST API\n client = Twilio::REST::Client.new account_sid, auth_token\n\n\n mms_message_body = \"name:#{self.contact.name}\"\n mms_message_body += \"\" #quick way to create spacing inbetween txt lines\n mms_message_body += \"phone: #{self.contact.phone_number}\"\n mms_message_body += \"\" #quick way to create spacing inbetween txt lines\n mms_message_body += \"#{self.message}\"\n end", "def send_message\n response = RestClient::Request.new(\n :method => :post,\n :url => \"https://api.twilio.com/2010-04-01/Accounts/#{ENV['TWILIO_ACCOUNT_SID']}/Messages.json\",\n :user => ENV['TWILIO_ACCOUNT_SID'],\n :password => ENV['TWILIO_AUTH_TOKEN'],\n :payload => { :Body => body,\n :To => Contact.find(self.contact_id).number,\n :From => ENV['USER_NUMBER'] }\n ).execute\n end", "def create\n @message = Message.new(params[:message])\n\n respond_to do |format|\n if @message.save\n recipient_phone = Phone.find_by_number(@message.number)\n \t recipient_phone ||= User.create!.phones.create!(:number => @message.number)\n @message.send_SMS(@message.raw_message, recipient_phone, \"\", @message.app.id)\n format.html { redirect_to messages_path, notice: 'Message was successfully sent.' }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # parse phone number and save it in the correct format\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n # render text: \"Thank you! You will receive an SMS shortly with verification instructions.\"\n\n\n # Instantiate a Twilio client\n @client = Twilio::REST::Client.new(TWILIO_CONFIG['sid'], TWILIO_CONFIG['token'])\n \n # Create and send an SMS message\n @client.account.sms.messages.create(\n from: TWILIO_CONFIG['from'],\n to: @user.phone,\n body: \"Thanks for signing up. To verify your account, please reply 'yes' to this message.\"\n # mediaurl: \"http://s3.amazonaws.com/simpleupc/images/full/3bdc2416fbb17d90.jpg\"\n )\n\n # format.html { redirect_to @user, notice: 'User was successfully created.' }\n # format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def send(p)\n options = {} \n\n p.each do |k,v|\n\n case k\n when :reply_path\n # Automatically request delivery receipt if reply path is set\n options[sym_to_param(:confirm_delivery)] = 'on'\n options[sym_to_param(k)] = v\n when :scheduled_for\n # Set timestamp correctly for :scheduled_for\n options[sym_to_param(k)] = v.strftime('%Y%m%d%H%M%S')\n else\n options[sym_to_param(k)] = v\n end\n\n end\n\n res = self.class.post('/submit_sm', :basic_auth => @auth, :body => JSON.dump(options))\n\n responses = []\n res['sms'].each do |r|\n responses << Dialogue::Toolkit::Sms::Response.new(r)\n end\n\n responses\n end", "def send_sms_with_http_info(sms_vo, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SMSApi.send_sms ...'\n end\n # verify the required parameter 'sms_vo' is set\n if @api_client.config.client_side_validation && sms_vo.nil?\n fail ArgumentError, \"Missing the required parameter 'sms_vo' when calling SMSApi.send_sms\"\n end\n # resource path\n local_var_path = '/sms'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(sms_vo)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SMSResponseVO')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SMSApi#send_sms\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def send_bulk_sms(message)\n client = IronWorkerNG::Client.new\n client.tasks.create('master_email', payload)\n payload = {}\n payload['message'] = message\n client.tasks.create('master_sms', payload)\nend", "def sms_price_post_with_http_info(sms_messages, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SMSApi.sms_price_post ...'\n end\n # verify the required parameter 'sms_messages' is set\n if @api_client.config.client_side_validation && sms_messages.nil?\n fail ArgumentError, \"Missing the required parameter 'sms_messages' when calling SMSApi.sms_price_post\"\n end\n # resource path\n local_var_path = '/sms/price'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(sms_messages)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SMSApi#sms_price_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create \n @message = Message.new({\n incoming: true,\n sid: params['SmsSid'],\n to: params['To'],\n from: params['From'],\n body: params['Body']\n })\n \n respond_to do |format|\n if @message.save\n \n reply = (@message.body.downcase.strip == 'b') ? 'Have a nice day, honey!' : 'Uh oh, we are calling mum...'\n \n response = Twilio::TwiML::Response.new do |r|\n r.Sms reply\n end\n \n Rails.logger.info response.text\n \n user = User.normalise_and_find(params['From'])\n \n if user\n alert = user.alerts.where(:sid => nil).order(\"start asc\").limit(1)\n \n if alert.length == 1\n alert = alert.first\n \n if @message.body.downcase.strip == 'b'\n alert.sid = \"CHECKED\"\n alert.save\n else\n alert.delay.call(alert_url(alert, :format => :xml))\n end\n end\n end\n \n format.xml { render :text => response.text }\n else\n raise \"Can't save!\"\n end\n end\n end", "def send_sms(message)\n api_response = \"\"\n if !self.mobile.blank?\n txtlocal = Txtlocal.find_by_sms_type(Txtlocal::GROUP_CHAT)\n if !txtlocal.nil?\n txtlocal.message_contents = message\n api_response = txtlocal.send_sms(self.mobile)\n end\n else\n api_response = \"You have not provided any mobile number. Please go to your 'Account' to set up a mobile number\"\n end\n return api_response\n end", "def create\n # {\"ToState\"=>\"IL\", \"FromState\"=>\"AZ\", \"AccountSid\"=>\"AC1afaeecf73a8e05e32c695eac213226c\", \"SmsMessageSid\"=>\"SM8a1e2f65484fa1bd45b6a37d72a145fe\", \"Body\"=>\"youre an idiot sometimes\", \"From\"=>\"+16234556356\", \"FromCity\"=>\"PHOENIX\", \"SmsStatus\"=>\"received\", \"FromZip\"=>\"85065\", \"FromCountry\"=>\"US\", \"To\"=>\"+18152165378\", \"ToCity\"=>\"KANKAKEE\", \"ToZip\"=>\"60914\", \"ToCountry\"=>\"US\", \"ApiVersion\"=>\"2010-04-01\", \"SmsSid\"=>\"SM8a1e2f65484fa1bd45b6a37d72a145fe\"}\n @incoming_text = IncomingText.new(params[:incoming_text])\n\n respond_to do |format|\n if @incoming_text.save\n format.html { redirect_to(@incoming_text, :notice => 'Incoming text was successfully created.') }\n format.xml { render :xml => @incoming_text, :status => :created, :location => @incoming_text }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @incoming_text.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @sms_based = SmsBased.new(sms_based_params)\n\n respond_to do |format|\n if @sms_based.save\n format.html { redirect_to admin_services_path, notice: 'successfully created.' }\n format.json { render action: 'show', status: :created, location: @sms_based }\n else\n format.html { redirect_to admin_services_path, notice: 'Failed.' }\n format.json { render json: @sms_based.errors, status: :unprocessable_entity }\n end\n end\n end", "def send_text_message(body)\n if self.mobile.present?\n begin\n TWILIO_CLIENT.messages.create(from: ENV['TWILIO_PHONE_NUMBER'], to: self.mobile, body: body)\n rescue Twilio::REST::RequestError => e\n puts \"Twilio Error: #{e.message}\"\n end\n end\n end", "def post(content)\n post_to(\"/api/v1/messages/\", {:body => content})\n end", "def create\n @sms_tmp = SmsTmp.new(params[:sms_tmp])\n\n respond_to do |format|\n if @sms_tmp.save\n format.html { redirect_to \"/home/sms\", notice: '短信模版创建成功.' }\n format.json { render json: @sms_tmp, status: :created, location: @sms_tmp }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sms_tmp.errors, status: :unprocessable_entity }\n end\n end\n end", "def sms_email_sms_post_with_http_info(email_sms_address, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: EmailToSmsApi.sms_email_sms_post ...'\n end\n # verify the required parameter 'email_sms_address' is set\n if @api_client.config.client_side_validation && email_sms_address.nil?\n fail ArgumentError, \"Missing the required parameter 'email_sms_address' when calling EmailToSmsApi.sms_email_sms_post\"\n end\n # resource path\n local_var_path = '/sms/email-sms'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(email_sms_address)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EmailToSmsApi#sms_email_sms_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n twilio_sid = \"AC87d4a655d1b7f6251393db346fd69d46\"\n twilio_token = \"3a1d3e17645ced5700606682a613485d\"\n twilio_phone_number = \"2678677556\"\n \n @twilio_client = Twilio::REST::Client.new twilio_sid, twilio_token\n \n @twilio_client.account.sms.messages.create(\n :from => \"+1#{twilio_phone_number}\",\n :to => '+919042755963',\n :body => \"This is sakthi local app\"\n )\n @employee = Employee.new(employee_params)\n \n p @employee\n p \"---------------------\"\n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: 'Employee was successfully created.' }\n format.json { render :show, status: :created, location: @employee }\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def twilio\n account_sid = ENV[\"TWILIO_SID\"]\n auth_token = ENV['TWILIO_TOKEN']\n client = Twilio::REST::Client.new account_sid, auth_token\n\n from = \"8452633595\"\n\n client.account.messages.create(\n :from => from,\n :to => self.phone,\n :body => \"#{self.title} - #{self.full_desc} ($#{self.price})\"\n )\n puts \"Sent message\"\n end", "def sendSMS(to, body = \"No body was send for this message.\", media = nil)\n\naccount_sid = $accountsid\nauth_token = $authtoken\n@client = Twilio::REST::Client.new(account_sid, auth_token)\n\nif media\n message = @client.messages.create(\n body: body,\n from: $phone,\n media_url: [media],\n to: to\n)\nelse\n message = @client.messages.create(\n body: body,\n from: $phone,\n to: to\n)\nend\nreturn message.sid\nend", "def twilio_sms\n sms = {\n :sid => params[:SmsSid], \n :from => params[:From],\n :to => params[:To],\n :body => params[:Body],\n #:status => params[:SmsStatus], # this will be used later for confirmation with Twilio \n }\n @txt = Txt.new(sms) \n \n @status_report = TWILIO_CONFIG[\"base_url\"].to_s + '/home/twilio_status'\n\n #@txt.twilio_reply_sms\n\n respond_to do |format|\n if @txt.save and @txt.match_coupon?(sms)\n flash[:notice] = 'Message was successfully received.' \n format.xml { @txt }\n else\n flash[:notice] = 'Delivery failed.' \n format.xml { @txt }\n end\n end\n\n end", "def create\n @sms_retrieval = SmsRetrieval.new(sms_retrieval_params)\n\n respond_to do |format|\n if @sms_retrieval.save\n format.html { redirect_to @sms_retrieval, notice: 'Sms retrieval was successfully created.' }\n format.json { render :show, status: :created, location: @sms_retrieval }\n else\n format.html { render :new }\n format.json { render json: @sms_retrieval.errors, status: :unprocessable_entity }\n end\n end\n end", "def send_sms(cmatch, tstamp, number, expiration)\n\n # Primary provider\n #\n nexmo_reponse = begin\n nexmo = Nexmo::Client.new('371f3e5d', 'e3218b70')\n token_url = create_token_url(cmatch, tstamp)\n record_token(cmatch, tstamp, expiration)\n sms_primary_response = nexmo.send_message({\n from: '13059298586',\n to: number,\n text: cmatch\n })\n json :sms_status => \"sent\",\n :token => cmatch,\n :token_url => token_url,\n :phone_number => number,\n :token_generated => tstamp,\n :token_expires => tstamp + expiration\n rescue\n send_sms_twilio(cmatch, tstamp, number, expiration)\n end\nend", "def create\n #ClickATell posts this\n #Parameters:\n #\"api_id\"=>\"3306957\"\n #\"from\"=>\"886975395038\"\n #\"to\"=>\"41798070085\"\n #\"timestamp\"=>\"2011-09-19 13:02:52\"\n #\"text\"=>\"Test of SMS 2\"\n #\"charset\"=>\"ISO-8859-1\"\n #\"udh\"=>\"\"\n #\"moMsgId\"=>\"3e644dd7c1df98671fe41d26dfd73672\"\n\n @momsg = Momsg.new(:from => params[:from], :text => params[:text])\n \n @momsg.save\n\n respond_to do |format|\n format.html { redirect_to @momsg }\n end\n end", "def twiml\n sms = { from: params[:From],\n to: params[:To],\n body: params[:Body] }\n\n from_user = User.find_by_phone_number(params[:From])\n sms[:from_user_id] = from_user.id if from_user\n to_user = User.find_by_phone_number(params[:To])\n sms[:to_user_id] = to_user.id if to_user\n\n # save the message into the DB\n @sms = Sms.create(sms)\n from_user = @sms.from_user\n\n # response logic\n # if from_user && from_user.response.nil?\n # if sms[:body].downcase.include?(\"yes\")\n # twilio.respond_to_yes(sms[:from])\n # from_user.response = true\n # from_user.save\n # elsif sms[:body].downcase.include?(\"no\")\n # twilio.send_sms(sms[:from], \"Got it. Have a great day!\")\n # from_user.response = false\n # from_user.save\n # end\n # end\n\n # Empty response to Twilio (Do nothing more)\n render xml: Twilio::TwiML::Response.new.text\n end", "def sms\n reply = TwilioService.new.process_inbound_sms(params)\n render_twiml_message(reply) if reply\n end", "def create\n @user = User.new(params[:user])\n\n # RestClient.post(\"http://sms.ru/sms/send\", :api_id => \"9d3359eb-9224-2384-5d06-1118975a2cd2\", :to => \"79051916188\", :text => \"Ваш ID на велопробег #{@user.id}\")\n\n respond_to do |format|\n if @user.save\n\n \n\n format.html { redirect_to edit_user_path(@user), notice: 'Участник успешно создан!' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { redirect_to root_path,\n notice: 'Поздравляем! Вы подали заявку на регистрацию. Для подтверждения регистрации \n необходимо внести взнос.' }\n end\n end\n end", "def sms(body, to: nil, from: nil, method: nil, action: nil, status_callback: nil, **keyword_args)\n append(Sms.new(\n body,\n to: to,\n from: from,\n method: method,\n action: action,\n status_callback: status_callback,\n **keyword_args\n ))\n end", "def sms_send_params\n params.require(:sms_send).permit(:recv_num, :send_content, :state, :sms_type, :user_id)\n end", "def sms_send_params\n params.require(:sms_send).permit(:recv_num, :send_content, :state, :sms_type, :user_id)\n end", "def create\n #If the POST contains either parameter we know we are dealing with multiple messages to sync\n if (params.has_key?(:total_in_messages) || params.has_key?(:total_out_messages))\n if (params.has_key?(:total_in_messages))\n i = 0\n while i < params[:total_in_messages] do\n message = Message.new()\n phoneNum = params[:in_messages][\"sms\" + i.to_s][:number].gsub(/[^0-9]/i, '')\n phoneNum.slice!(0) if (phoneNum.size != 10)\n message.origin = phoneNum\n message.destination = \"DEVICE\"\n message.timestamp = params[:in_messages][\"sms\" + i.to_s][:timestamp]\n message.message = params[:in_messages][\"sms\" + i.to_s][:message]\n message.user = User.find_by_username(params[:username])\n message.save\n i += 1\n end\n end\n if (params.has_key?(:total_out_messages))\n i = 0\n while i < params[:total_out_messages] do\n message = Message.new()\n phoneNum = params[:out_messages][\"sms\" + i.to_s][:number].gsub(/[^0-9]/i, '')\n phoneNum.slice!(0) if (phoneNum.size != 10)\n message.origin = \"DEVICE\"\n message.destination = phoneNum\n message.timestamp = params[:out_messages][\"sms\" + i.to_s][:timestamp]\n message.message = params[:out_messages][\"sms\" + i.to_s][:message]\n message.user = User.find_by_username(params[:username])\n message.save\n i += 1\n end\n end\n render :json => {:status => \"1\"}, :status => :created\n #Otherwise it's a single message we are syncing\n else\n @message = Message.new()\n phoneNum = params[:origin].gsub(/[^0-9]/i, '')\n phoneNum.slice!(0) if (phoneNum.size != 10)\n @message.origin = phoneNum\n @message.message = params[:message]\n @message.timestamp = params[:timestamp]\n @message.user = User.find_by_username(params[:username])\n @message.destination = params[:destination]\n\n if @message.save\n render :json => {:status => \"1\"}, :status => :created\n else\n render :json => {:status => \"0\"}, :status => :unprocessable_entity\n end\n end\n end", "def send_by_sms\n\t\t# ActionMailer deliverya\n\t\trecipeintNumberRaw = params[:mobile_number].gsub!(/[^0-9]/,'')\n\t\trecipeintNumberFormatted = params[:mobile_number]\n\t\t@listing = Listing.find(params[:listing_id])\n\n\t\tsms_message = 'Click to view the listing on ' + @listing.address_1 + ' ' + @listing.address_2 + ' ' + @listing.city + ' ' + @listing.state + ' ' + listing_url(@listing)\n\n\t\tsms_fu = SMSFu::Client.configure(:delivery => :action_mailer)\n\t\tsms_fu.deliver(recipeintNumberRaw, params[:carrier][0] , sms_message, :from => 'alert@fsbolisting.com')\n\t\treturn_response = { \"status\" => \"ok\", \"number\" => recipeintNumberFormatted }\n\t\trender :json => return_response.to_json, :callback => params[:callback]\n\n\tend", "def deliver(sms)\n create_sms(sms).submit()\n end", "def send_text_message(text_message)\n number_to_send_to = text_message.receiver\n message = text_message.content\n twilio_sid = \"AC50070372767bdf26a090b08007bba07f\"\n twilio_token = \"8ae1cdbb08d55b99cab34174c3cd8bbb\"\n twilio_phone_number = \"2245209581\"\n @twilio_client = Twilio::REST::Client.new twilio_sid, twilio_token\n @twilio_client.account.sms.messages.create(\n :from => \"+1#{twilio_phone_number}\",\n :to => number_to_send_to,\n :body => message\n )\n \n end", "def create\n @message = Message.new(params[:message])\n @message.sender = \"cmu3071\" #THIS NEEDS TO BE CHANGED WHEN OAF RECEIVES THEIR OWN SHORTCODE\n @message.time = Time.now\n \n body = @message.body\n phones = Message.split_numbers(@message.recipient)\n\n phones.each do |ph|\n phone = Message.reformat_phone(ph)\n puts \"PHONE: #{phone}\"\n url = Message.text_to(phone,body)\n puts \"URL: #{url}\"\n newUrl = URI.parse(URI.encode(url.strip))\n http = Net::HTTP.new(newUrl.host,443)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n @data = http.get(newUrl.request_uri)\n puts \"STATUS: #{@data.code}\"\n puts \"BODY: #{@data.body}\"\n puts \"RESPONSE: #{@data}\"\n end\n \n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def send_joke\r\n client = Twilio::REST::Client.new Rails.application.secrets.twilio_account_sid, Rails.application.secrets.twilio_auth_token\r\n message = client.messages.create from: '347-933-6917', to: params[:phone_number], body: Joke.pick_joke\r\n redirect_to :back\r\n end", "def receive_sms\n uninitialize_sms\n body = params[:Body]\n phone_number = normalize_phone params[:From].strip\n @problem_text = body.split\n action = sms_parsing(body).downcase\n if action == \"join\"\n sms_create_account\n return\n elsif Account.find_by_phone_number(phone_number) == nil\n sms_send(params[:From], \"Please first create an account by texting the word 'join'.\")\n return\n end\n if !@sms_error\n case action\n when /^add$/,/^insert$/\n sms_create\n when /^accept$/\n sms_accept_problem\n when /^get$/\n @offset = false\n sms_get(0)\n when /^edit$/\n sms_edit\n when /^delete$/, /^destroy$/\n sms_delete\n when /^next$/\n offset = session[\"offset\"]\n if offset == nil\n sms_error(\"Sorry, there is no saved session right now. Please first text \\\"GET\\\" with @location !skill %number of texts you want to allow.\")\n else\n @offset = true\n sms_get(offset)\n end\n when /^detail$/, /^details$/, /^describe$/\n sms_detail\n when /^account$/\n forgot_acc\n when /^change$/\n sms_change_password\n when /^password$/\n forgot_password\n# when /^skill$/, /^skills$/\n# sms_skill\n when /^keywords$/, /^key$/, /^keys$/, /^help$/\n sms_keywords\n when /^explain$/\n sms_explain\n else\n if is_num?(action)\n session[:received_confirmation] = action\n sms_confirm_acc\n else\n sms_wrong_keyword\n end\n end\n end\n render :nothing => true\n end", "def create\n account_sid = 'AC14aa346613c89fec467663aad46c05a2'\n auth_token = '0e43d0a04e110f7faa2692e388b0c7f5'\n \n client = Twilio::REST::Client.new(account_sid, auth_token)\n\n @city = params[:FromCity].capitalize\n @state = params[:FromState]\n\n render 'process_sms.xml.erb', :content_type => 'text/xml'\n end", "def create\n @sms_notification = SmsNotification.new(sms_notification_params)\n\n respond_to do |format|\n if @sms_notification.save\n format.html { redirect_to @sms_notification, notice: 'Sms notification was successfully created.' }\n format.json { render :show, status: :created, location: @sms_notification }\n else\n format.html { render :new }\n format.json { render json: @sms_notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def sms_based_params\n params.require(:sms_based).permit(:body)\n end", "def create\n \n @message = current_user.messages.build(params[:message])\n if @message.save\n \n \n @account_sid = 'ACdb43c99b5deb7d4ed12083140f41bab3'\n @auth_token = '11dbb8cbba9b004652469aa77e51183c'\n\n # set up a client to talk to the Twilio REST API\n @client = Twilio::REST::Client.new(@account_sid, @auth_token)\n ha = HashWithIndifferentAccess.new(params[:message])\n mssg = ha['content']\n\n friends = {\n \"+14159006499\" => \"Jered\",\n \"+11111111111\" => \"Chris\",\n \"+11111111111\" => \"Kathryn\"}\n\n @account = @client.account\n @message = @account.sms.messages.create({:to => '+14159006499', :from => '+18319204556', :body => mssg})\n puts @message\n flash[:success] = \"Message created!\"\n redirect_to 'http://www.bugl.co/acknowledge.html'\n\n else\n @feed_items = []\n render 'static_pages/home'\n end\n \n @message = Message.new(params[:message])\n\n respond_to do |format|\n if @message.save\n \n format.json { render json: @message, status: :created, location: @message }\n else\n \n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def send_sms(sms, options={})\n send_to_phone(sms.phone_number, sms.actual_message, options)\n end", "def smsFail1 \n response = HTTParty.post($uris, :body => {message: App.message})\nend", "def sms_inbound_post_with_http_info(url, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SMSApi.sms_inbound_post ...'\n end\n # verify the required parameter 'url' is set\n if @api_client.config.client_side_validation && url.nil?\n fail ArgumentError, \"Missing the required parameter 'url' when calling SMSApi.sms_inbound_post\"\n end\n # resource path\n local_var_path = '/sms/inbound'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(url)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SMSApi#sms_inbound_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def message_type\n 'sms'\n end", "def sms number, message\n response = @connection.cmd \"String\" =>\"sms send #{number} #{message}\", \"Match\" => /OK|KO:(.*)/, \"Timeout\" => 5\n if response.chomp == \"OK\"\n true\n else\n raise response.chomp.sub \"KO:\",''\n end\n end", "def create\n @short_message = ShortMessage.new(short_message_params)\n\n client = GlobeLabs.new\n target = @short_message.target\n if target.present?\n resp = client.send_sms(@short_message)\n Rails.logger.info(\"=== savon client resp: #{resp.inspect}\")\n end\n\n recepients = params[:recepients]\n Rails.logger.info(\"==== params:#{params.inspect}\")\n if recepients.present?\n Rails.logger.info(\"==== params:#{params[:recepients].inspect}\")\n recepients.each do |cell_no|\n @short_message = ShortMessage.new(short_message_params)\n @short_message.target = cell_no\n if @short_message.save\n resp = client.send_sms(@short_message)\n Rails.logger.info(\"=== savon client resp: #{resp.inspect}\")\n end\n end\n end\n\n respond_to do |format|\n if @short_message.save\n format.html { redirect_to short_messages_path, notice: 'Short message was successfully created.' }\n format.json { render action: 'show', status: :created, location: @short_message }\n else\n format.html { render action: 'new' }\n format.json { render json: @short_message.errors, status: :unprocessable_entity }\n end\n end\n end", "def send_message(arg1, arg2)\n account_sid = 'AC5XXXXXXXXXXXXXXXXXXX' # place twilio sid here\n auth_token = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXX' # place twilio auth token here\n client = Twilio::REST::Client.new(account_sid, auth_token)\n \n from = '' # Your Twilio number\n to = arg1 # Your mobile phone number\n \n client.messages.create(\n from: from,\n to: to,\n body: arg2\n )\n\n end", "def set_and_validate_sms\n sms_service.validate_params\n end", "def sms_inbound_post(url, opts = {})\n data, _status_code, _headers = sms_inbound_post_with_http_info(url, opts)\n data\n end", "def send_raw_sms_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: MessagingApi.send_raw_sms ...\"\n end\n # resource path\n local_var_path = \"/messaging/raw-sms\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'raw_sms_resource'])\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MessagingApi#send_raw_sms\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create # need the name 'create' to conform with REST defaults, or change routes\n #puts \"**** IncomingController create: params=#{params}\"\n @from = params[:From] # The phone number of the sender\n#debugger\n body = params[:Body] # This is the body of the incoming message\n AppLog.create(:code => \"SMS.incoming\", :description=>\"from=#{@from}; body=#{body[0..50]}\")\n params.delete 'SmsSid'\n params.delete 'AccountSid'\n params.delete 'SmsMessageSid'\n @possible_senders = from_members # all members from this database with matching phone number\n @sender = @possible_senders.first # choose one of them\n if @sender # We only accept SMS from registered phone numbers of members\n begin\n AppLog.create(:code => \"SMS.received\", :description=>\"from #{@from} (#{@sender.shorter_name}): #{body}\")\n resp = (process_sms(body) || '')[0..159] # generate response\n AppLog.create(:code => \"SMS.reply\", :description=>\"to #{@from}: #{resp}\")\n# default_sms_gateway.deliver(@from, resp) #default_gateway in messages_helper creates an instance of gateway specified \n# # in SiteSettings default_outgoing_sms_gateway\n render :text => resp, :status => 200, :content_type => Mime::TEXT.to_s # Confirm w incoming gateway that msg received\n# rescue\n# AppLog.create(:code => \"SMS.system_error\", :description=>\"on SMS#create: #{$!}, #{$!.backtrace[0..2]}\")\n# render :text => \"Internal\", :status => 500, :content_type => Mime::TEXT.to_s\n# ClickatellGateway.new.deliver(@from, \"Sorry, there is a bug in my system and I crashed :-(\" )\n end\n else \n AppLog.create(:code => \"SMS.rejected\", :description=>\"from #{@from}: #{body}\")\n render :text => \"Refused: sender's phone number is not recognized\", \n :status => 403, :content_type => Mime::TEXT.to_s\n end\n end", "def create\n @msg = \"短信发送失败\"\n\n sms = SmsSend.where(\"TIMESTAMPDIFF(MINUTE,created_at ,now())<#{Const::SMS_TIME_LIMIT} and sms_type='code' and recv_num =? and state='00A'\", sms_send_params[:recv_num]).first\n \n unless sms.blank?\n @msg = \"#{Const::SMS_TIME_LIMIT}分钟内不用重新发送\"\n return render json: {status: :created, msg: @msg, retcode: '101'}\n end \n\n #历史数据 变更状态位 \n SmsSend.where(\"recv_num =?\",sms_send_params[:recv_num]).update_all(state: \"00X\")\n\n @sms_send = SmsSend.new(sms_send_params)\n @sms_send.sms_type='code'\n\n send_content = rand(1001..9999) \n @sms_send.send_content = send_content \n\t\n\tinfo = ConfigInfo[\"smsconfiginfo\"]\n respond_to do |format|\n if @sms_send.save\n add = \"#{info[\"SMS_SEND_URL\"]}\"\n logger.debug \"48 #{add}\"\n uri = URI.parse(add)\n http = Net::HTTP.new(uri.host)\n request = Net::HTTP::Post.new(uri.request_uri)\n tpl_val = URI.encode(\"#code#\") + \"=\" + URI.encode(\"#{send_content}\");\n data = {apikey:info[\"SMS_SEND_API_KEY\"], \n mobile:sms_send_params[:recv_num],\n tpl_id:info[\"TPL_ID\"],\n tpl_value:tpl_val\n }\n request.set_form_data(data)\n #request['Content-Type'] = 'application/json;charset=utf-8'\n #request['User-Agent'] = 'Mozilla/5.0 (Windows NT 5.1; rv:29.0) Gecko/20100101 Firefox/29.0'\n #request.body = params.to_json\n response = http.start { |http| http.request(request) }\n # puts response.body.inspect\n # puts JSON.parse response.body\n\n\n @msg = \"短信发送成功\"\n return render json: {status: :created, msg: @msg, retcode: \"200\"} \n else\n return render json: {status: :created, msg: @msg, retcode: \"102\"}\n end\n end\n end", "def send_sms\n Sms.send_sms(session[:zeepusername], params[:sendmsg][:messagebody])\n \n @zeep_response = \"Message sent to #{session[:zeepusername]}!\"\n \n render :action => \"testloop\"\n \n end", "def new\n @sms_tmp = SmsTmp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sms_tmp }\n end\n end", "def create\n @tw_phone = TwPhone.new(tw_phone_params)\n\n respond_to do |format|\n if @tw_phone.save\n format.html { redirect_to @tw_phone, notice: 'Tw phone was successfully created.' }\n format.json { render :show, status: :created, location: @tw_phone }\n else\n format.html { render :new }\n format.json { render json: @tw_phone.errors, status: :unprocessable_entity }\n end\n end\n end", "def send_sms(sms_vo, opts = {})\n data, _status_code, _headers = send_sms_with_http_info(sms_vo, opts)\n data\n end", "def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n whatsapp = WhatsApp.new\n whatsapp.line = @message.sender\n whatsapp.url = @message.url\n whatsapp.appname = @message.appname\n whatsapp.token = @message.token\n whatsapp.messageSend(@message.id, @message.recipient, @message.text)\n #whatsapp.questionSend(@message.id, @message.recipient, @message.text, \"['Sim';'Não']\")\n\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def send_text(call_job)\n from = '+18015131966'\n\n req_params = {\n from: from,\n to: call_job.phone,\n status_callback: \"#{ENV['CALL_SERVICE_URL']}twilio/provider_text_status_callback.xml\",\n body: call_job.body\n }\n\n if Rails.env == \"development\"\n url = \"http://127.0.0.1:4567/send_text\"\n RestClient.post url, req_params\n else\n client = Twilio::REST::Client.new(ENV[\"TWILIO_SID\"], ENV[\"TWILIO_TOKEN\"])\n\n account = client.account\n message = account.sms.messages.create(req_params)\n end\n end", "def create_message(user_id, recipient_id, token , subject, message)\n response = self.class.post('/messages', body: { \"user_id\": user_id, \"recipient_id\": recipient_id,\"token\": token , \"subject\": subject, \"stripped-text\": message }, headers: { \"authorization\" => @auth_token })\n puts response\n\n end", "def send_text(number, message)\n @client.api.account.messages.create(\n to: number,\n from: 'add phone number',\n body: message\n )\n end", "def call\n account_sid = 'ACe330ba04d082392df4cb3511dcb72cec'\n auth_token = '2008ea097713e401a16c54029058da82'\n\n # set up a client to talk to the Twilio REST API\n @client = Twilio::REST::Client.new account_sid, auth_token\n\n @client.account.messages.create(\n :from => '+18152642023',\n :to => @number,\n :body => 'hahahayolo'\n )\n end", "def send_templated_sms_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: MessagingApi.send_templated_sms ...\"\n end\n # resource path\n local_var_path = \"/messaging/templated-sms\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'template_sms_resource'])\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MessagingApi#send_templated_sms\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def sms_request(participant_id, notification_id, sms_template_id, first_name, docket_number, status)\n request = {\n body: {\n reference: notification_id,\n template_id: sms_template_id,\n recipient_identifier: {\n id_type: \"PID\",\n id_value: participant_id\n },\n sms_sender_id: SENDER_ID || \"\",\n personalisation: {\n first_name: first_name, status: status, docket_number: docket_number\n }\n },\n headers: HEADERS,\n endpoint: SEND_SMS_NOTIFICATION_ENDPOINT, method: :post\n }\n if !status.empty?\n # If a status is given then it will be added to the request object\n request[:body][:personalisation][:appeal_status] = status\n end\n request\n end" ]
[ "0.7538926", "0.730763", "0.7238409", "0.71811897", "0.71362805", "0.7079376", "0.70778906", "0.70557135", "0.6993908", "0.6966665", "0.6960962", "0.6908357", "0.68156964", "0.6805102", "0.6770918", "0.6744358", "0.6731432", "0.6709422", "0.66859263", "0.6661228", "0.6644273", "0.66055995", "0.65945226", "0.65931773", "0.65768254", "0.65610635", "0.6541697", "0.65294766", "0.64843243", "0.647687", "0.6463186", "0.646071", "0.6435353", "0.6435002", "0.64326715", "0.64218795", "0.641719", "0.6406061", "0.6401187", "0.6400565", "0.6395475", "0.6394621", "0.63839287", "0.63623595", "0.63621175", "0.6345892", "0.6343749", "0.633708", "0.63279873", "0.63277984", "0.6318181", "0.6308885", "0.6296221", "0.6295203", "0.6288365", "0.6287383", "0.6286382", "0.6281038", "0.62792027", "0.6267814", "0.62668693", "0.6250786", "0.62171453", "0.62088186", "0.6206804", "0.6206804", "0.61953", "0.6187355", "0.6163493", "0.6163083", "0.6112483", "0.6108561", "0.61013734", "0.6091563", "0.6086402", "0.6080604", "0.60557294", "0.6049279", "0.60467976", "0.6018837", "0.601513", "0.60088664", "0.6003837", "0.60025066", "0.59938747", "0.59848964", "0.59832233", "0.5982175", "0.5976282", "0.5970527", "0.59597135", "0.59470415", "0.5945005", "0.5935819", "0.593349", "0.5925759", "0.59154123", "0.5909826", "0.59092444", "0.59059453" ]
0.6883064
12
DELETE /sms/1 DELETE /sms/1.json
def destroy @sm = Sm.find(params[:id]) @sm.destroy respond_to do |format| format.html { redirect_to sms_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @sms = Sms.find(params[:id])\n @sms.destroy\n\n respond_to do |format|\n format.html { redirect_to(sms_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @sms_based.destroy\n respond_to do |format|\n format.html { redirect_to sms_baseds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sms_send.destroy\n respond_to do |format|\n format.html { redirect_to phone_sms_sends_url, notice: 'Sms send was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sm = Sm.find(params[:id])\n @sm.destroy\n\n respond_to do |format|\n format.html { redirect_to(sms_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @smsno.destroy\n respond_to do |format|\n format.html { redirect_to smsnos_url, notice: 'Smsno was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sms_retrieval.destroy\n respond_to do |format|\n format.html { redirect_to sms_retrievals_url, notice: 'Sms retrieval was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sms_send.destroy\n respond_to do |format|\n format.html { redirect_to sms_sends_url, notice: 'Sms send was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sms_tmp = SmsTmp.find(params[:id])\n @sms_tmp.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/home/sms\", notice: '删除成功。' }\n format.json { head :no_content }\n end\n end", "def destroy\n @v1_message = V1::Message.find(params[:id])\n @v1_message.destroy\n\n head :no_content\n end", "def destroy\n @smsuser.destroy\n respond_to do |format|\n format.html { redirect_to smsusers_url, notice: 'Smsuser was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sms_notification.destroy\n respond_to do |format|\n format.html { redirect_to sms_notifications_url, notice: 'Sms notification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_message(sid)\n\t@client = Twilio::REST::Client.new ACCOUNT_SID, AUTH_TOKEN\n\t@client.recordings.get(sid).delete()\nend", "def delete\n @client.post('/api/del_msg', id: get_attribute(:name))\n end", "def delete_message(id)\n record \"/msg/delete/#{id}\"\n end", "def destroy\n #@phone.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @smsloan.destroy\n respond_to do |format|\n format.html { redirect_to smsloans_url, notice: 'Smsloan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n # delete a specific message\n end", "def destroy\n @minimessage = Minimessage.find(params[:id])\n @minimessage.destroy\n\n respond_to do |format|\n format.html { redirect_to minimessages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n render json: 'Message was successfully deleted', status: :ok\n end", "def destroy\n @phone = Phone.find(params[:id])\n @phone.destroy\n\n respond_to do |format|\n format.html { redirect_to phones_url }\n format.json { head :ok }\n end\n end", "def destroy\n @micromessage = Micromessage.find(params[:id])\n @micromessage.destroy\n\n respond_to do |format|\n format.html { redirect_to(micromessages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @phone = Phone.find(params[:id])\n @phone.destroy\n\n respond_to do |format|\n format.html { redirect_to phones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # delete a specific message\n end", "def delete_request(req)\n req[:sqs_msg].delete\n end", "def destroy\n @send_message = SendMessage.find(params[:id])\n @send_message.destroy\n\n respond_to do |format|\n format.html { redirect_to(send_messages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @phone.destroy\n respond_to do |format|\n format.html { redirect_to phones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @phone.destroy\n respond_to do |format|\n format.html { redirect_to phones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mobile = Mobile.find(params[:id])\n @mobile.destroy\n\n respond_to do |format|\n format.html { redirect_to mobiles_url }\n format.json { head :ok }\n end\n end", "def destroy\n @smslogrecord.destroy\n respond_to do |format|\n format.html { redirect_to smslogrecords_url, notice: 'Smslogrecord was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @phone_item.destroy\n respond_to do |format|\n format.html { redirect_to phone_items_url, notice: '删除成功.' }\n format.json { head :no_content }\n end\n end", "def destroy\n # delete a specific message\n end", "def destroy\n @tw_phone.destroy\n respond_to do |format|\n format.html { redirect_to tw_phones_url, notice: 'Tw phone was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end", "def destroy\n @reminder_phrase = ReminderPhrase.find(params[:id])\n @reminder_phrase.destroy\n\n respond_to do |format|\n format.html { redirect_to reminder_phrases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sys_msgs_timeline.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def message_destroy(id)\n post(\"/direct_messages/destroy/#{id}.json\")\n end", "def message_destroy(id)\n post(\"/direct_messages/destroy/#{id}.json\")\n end", "def destroy\n @message_phone_connection = MessagePhoneConnection.find(params[:id])\n @message_phone_connection.destroy\n\n respond_to do |format|\n format.html { redirect_to message_phone_connections_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @phone = Phone.find(params[:id])\n @phone.destroy\n\n respond_to do |format|\n format.html { redirect_to phones_url }\n format.xml { head :ok }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @system_message = SystemMessage.find(params[:id])\n @system_message.destroy\n\n respond_to do |format|\n format.html { redirect_to system_messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n #@phone = Phone.find(params[:id])\n #@phone.destroy\n end", "def destroy\n @mobile = Mobile.find(params[:id])\n @mobile.destroy\n\n respond_to do |format|\n format.html { redirect_to(mobiles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @mobile = Mobile.find(params[:id])\n #@mobile.destroy\n\n respond_to do |format|\n format.html { redirect_to(mobiles_url) }\n format.xml { head :ok }\n end\n end", "def message_delete(id)\n request(:delete, \"messages/#{id.to_s}\")\n end", "def delete_dm(settings, dmid)\n Net::HTTP.start('twitter.com') {|http|\n req = Net::HTTP::Post.new(\"/direct_messages/destroy/#{dmid}.json\")\n req.basic_auth settings[:user], settings[:pass]\n response = http.request(req)\n response.body\n }\nend", "def destroy\n @phone_call.destroy\n respond_to do |format|\n format.html { redirect_to phone_calls_url }\n format.json { head :no_content }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @store_manager_messages_read = Store::Manager::Messages::Read.find(params[:id])\n @store_manager_messages_read.destroy\n\n respond_to do |format|\n format.html { redirect_to store_manager_messages_reads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @momsg = Momsg.find(params[:id])\n @momsg.destroy\n\n respond_to do |format|\n format.html { redirect_to momsgs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @phone.destroy\n respond_to do |format|\n format.html { redirect_to phones_url, notice: 'Phone was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @phone.destroy\n respond_to do |format|\n format.html { redirect_to phones_url, notice: 'Phone was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @phone = Phone.find(params[:id])\n @phone.destroy\n\n respond_to do |format|\n format.html { redirect_to(contacts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @phone_detail = PhoneDetail.find(params[:id])\n @phone_detail.destroy\n respond_to do |format|\n format.html { redirect_to phone_details_path, notice: 'Phone detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @msg.destroy\n respond_to do |format|\n format.html { redirect_to msgs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @outgoing_message_log = OutgoingMessageLog.find(params[:id])\n @outgoing_message_log.destroy\n\n respond_to do |format|\n format.html { redirect_to outgoing_message_logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @phonecall = Phonecall.find(params[:id])\n @phonecall.destroy\n\n respond_to do |format|\n format.html { redirect_to(phonecalls_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n message = Message.find(params[:id])\n message.destroy\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n \n respond_to do |format|\n format.html { redirect_to(messages_url) }\n format.xml { head :ok }\n format.iphone { redirect_to :action => \"index\" }\n \n end\n end", "def delete_message(message_id)\n RestClient.delete(\"#{@url}/messages/#{message_id}\")\n end", "def destroy\n @messaging_inbox = Messaging::Inbox.find(params[:id])\n @messaging_inbox.destroy\n\n respond_to do |format|\n format.html { redirect_to messaging_inboxes_url }\n format.json { head :ok }\n end\n end", "def destroy\n @mailbox = Mailbox.find(params[:id])\n @mailbox.destroy\n\n respond_to do |format|\n format.html { redirect_to mailboxes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @phone.destroy\n respond_to do |format|\n format.html { redirect_to(contact_info_admin_phones_url) }\n format.xml { head :ok }\n end\n add_log(user: current_user, action: \"Deleted phone: #{@phone.phone}\")\n end", "def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to student_messages_url(@student) }\n format.json { head :no_content }\n end\n end", "def destroy\n @direct_message.destroy\n \n respond_to do |format|\n format.html { redirect_to DirectMessages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bless_message.destroy\n\n render json: {}\n end", "def destroy\n @draft = SmsOnRails::Draft.find(params[:id])\n @draft.destroy\n\n respond_to do |format|\n format.html { redirect_to(sms_drafts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n \t\n @message = Message.find(params[:id])\n @message.delete\n\n respond_to do |format|\n format.html { redirect_to(messages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n head :no_content\n end", "def destroy\n @message.destroy\n \n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n head :no_content\n end", "def destroy\n @store_manager_message = Store::Manager::Message.find(params[:id])\n @store_manager_message.destroy\n\n respond_to do |format|\n format.html { redirect_to store_manager_messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :ok }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :ok }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :ok }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :ok }\n end\n end", "def destroy\n @short_message.destroy\n respond_to do |format|\n format.html { redirect_to short_messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @text_message = TextMessage.find(params[:id])\n @text_message.destroy\n\n respond_to do |format|\n format.html { redirect_to text_messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'message.deleted' }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.763914", "0.753193", "0.7351058", "0.73134625", "0.73062015", "0.72668487", "0.72561693", "0.7167998", "0.7055462", "0.70198476", "0.6975877", "0.6897508", "0.6858554", "0.67807156", "0.673323", "0.6692594", "0.66611314", "0.6652349", "0.6615884", "0.6610818", "0.6606579", "0.6596034", "0.6593087", "0.65822625", "0.6577032", "0.657296", "0.657296", "0.65653485", "0.65614915", "0.6558178", "0.6553413", "0.65497524", "0.654677", "0.65442204", "0.6544061", "0.65404016", "0.65404016", "0.6532625", "0.6518118", "0.6506763", "0.64866894", "0.64751214", "0.6468209", "0.6466511", "0.6466358", "0.64575744", "0.64489704", "0.6439128", "0.6428901", "0.6425951", "0.642344", "0.6413661", "0.6413661", "0.6412804", "0.64116067", "0.6403365", "0.6402451", "0.6397815", "0.6395522", "0.6391723", "0.6385654", "0.6381296", "0.63784796", "0.6377309", "0.63729656", "0.6370208", "0.6368795", "0.63657534", "0.63638425", "0.63633686", "0.6363098", "0.6362601", "0.63615614", "0.6361345", "0.63511693", "0.63511693", "0.63511693", "0.63511693", "0.6349563", "0.6340676", "0.6338604", "0.6337099", "0.6337099", "0.6337099", "0.6337099", "0.6337099", "0.6337099", "0.6337099", "0.6337099", "0.6337099", "0.6337099", "0.6337099", "0.6337099", "0.6337099", "0.6337099", "0.6337099", "0.6337099", "0.6337099", "0.6337099", "0.6337099" ]
0.75781196
1
Define if there is a win on the board
def won?(board) WIN_COMBINATIONS.detect do |win| if (board[win[0]]) == "X" && (board[win[1]]) == "X" && (board[win[2]]) == "X" return win elsif (board[win[0]]) == "O" && (board[win[1]]) == "O" && (board[win[2]]) == "O" return win end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def win_check\r\n if $board == $boardwin\r\n true\r\n else\r\n false\r\n end\r\nend", "def win?\n true if @board.maker.code == @board.breaker.guess\n end", "def board_won?\n\t\twon = false\n\t\t\n\t\tWINNING_POSITIONS.each do |positions|\n\t\t\tn = 0\n\t\t\tfor i in 0..8\n\t\t\t n += 1 if (positions[i] == @gameplay_positions[i] && positions[i] != 0)\n\t\t\tend\n\t\t\tif n == 3\n\t\t\t\twon = true\n\t\t\tend\n\t\tend\n\n\t\twon ? true : false\n\tend", "def over?\n winner = @light_turn ? DARK : LIGHT\n if board.win?(winner)\n puts \"#{winner} Wins!\"\n return true\n elsif board.available_columns.empty?\n puts \"Tie game!\"\n return true\n end\n false\n end", "def is_win\n\t\tgame_win = false # on cree une variable Game_win qui vaux false par default\n\t\t# si une des 8 condition de victoire est bonne alor on la variable game_win devien egale a true\n\t\tif (@board_case[\"A1\"] == @board_case[\"A2\"] && @board_case[\"A2\"] == @board_case[\"A3\"] && @board_case[\"A1\"] != \" \") ||\n\t\t\t(@board_case[\"B1\"] == @board_case[\"B2\"] && @board_case[\"B2\"] == @board_case[\"B3\"] && @board_case[\"B1\"] != \" \") ||\n\t\t\t(@board_case[\"C1\"] == @board_case[\"C2\"] && @board_case[\"C2\"] == @board_case[\"C3\"] && @board_case[\"C1\"] != \" \") ||\n\t\t\t(@board_case[\"A1\"] == @board_case[\"B1\"] && @board_case[\"B1\"] == @board_case[\"C1\"] && @board_case[\"A1\"] != \" \") ||\n\t\t\t(@board_case[\"A2\"] == @board_case[\"B2\"] && @board_case[\"B2\"] == @board_case[\"C2\"] && @board_case[\"A2\"] != \" \") ||\n\t\t\t(@board_case[\"A3\"] == @board_case[\"B3\"] && @board_case[\"B3\"] == @board_case[\"C3\"] && @board_case[\"A3\"] != \" \") ||\n\t\t\t(@board_case[\"A1\"] == @board_case[\"B2\"] && @board_case[\"B2\"] == @board_case[\"C3\"] && @board_case[\"A1\"] != \" \") ||\n\t\t\t(@board_case[\"A3\"] == @board_case[\"B2\"] && @board_case[\"B2\"] == @board_case[\"C1\"] && @board_case[\"A3\"] != \" \")\n\t\t\tgame_win = true\n\t\tend\n\t\tgame_win # on renvoi la valeur de la variable qui indique si il y a un cas de victoire sur le plateau ou pas\n\tend", "def is_win?\n cell[0] == cell[1] && cell[1] == cell[2] ||\n cell[3] == cell[4] && cell[4] == cell[5] ||\n cell[6] == cell[7] && cell[7] == cell[8] ||\n cell[0] == cell[3] && cell[3] == cell[6] ||\n cell[1] == cell[4] && cell[4] == cell[7] ||\n cell[2] == cell[5] && cell[5] == cell[8] ||\n cell[0] == cell[4] && cell[4] == cell[8] ||\n cell[2] == cell[4] && cell[4] == cell[6]\n end", "def someone_win?(board)\n !!detect_winner(board)\nend", "def check_for_win_condition(turn)\n # binding.pry\n @board[turn - 1][0].all?('black')\n # binding.pry\n end", "def won?(board)\nempty_board = board.all? {|empty| empty == \" \"}\ndraw = board.all? {|token| token == \"X\" || token == \"O\"}\nWIN_COMBINATIONS.any? do |win_combo|\n if win_combo.all? {|index| board[index] ==\"X\" } || win_combo.all? {|index| board[index] ==\"O\"}\n return win_combo\n else empty_board || draw\n false\n end\n end\nend", "def won?(board)\nempty_board = board.all? {|empty| empty == \" \"}\ndraw = board.all? {|token| token == \"X\" || token == \"O\"}\nWIN_COMBINATIONS.any? do |win_combo|\n if win_combo.all? {|index| board[index] ==\"X\" } || win_combo.all? {|index| board[index] ==\"O\"}\n return win_combo\n else empty_board || draw\n false\n end\n end\nend", "def over?(board)\n if(draw?(board) || won?(board))\n true\n else\n false\n end\nend", "def over?(board)\n if(draw?(board) || won?(board))\n true\n else\n false\n end\nend", "def won?(board)\n WIN_COMBINATIONS.detect do |win1|\n win1.all? { |number| board[number] == \"X\"} || win1.all? { |number| board[number] == \"O\"}\n end\n end", "def board_win?(board)\n first_row_win?(board) ||\n second_row_win?(board) ||\n third_row_win?(board) ||\n first_column_win?(board) ||\n second_column_win?(board) ||\n third_column_win?(board) ||\n diag_right_win?(board) ||\n diag_left_win?(board) \nend", "def over?(board)\r\n if draw?(board) || won?(board)\r\n true\r\n else\r\n false\r\n end\r\nend", "def o_won?\r\n o = @game_board.each_index.select { |position| @game_board[position] == \"O\" }\r\n get_win(o)\r\n end", "def over?(board)\n won?(board) || full?(board)\n end", "def over?(board)\n if (draw?(board) || won?(board))\n return true\n else\n return false\n end\nend", "def over?(board)\n draw?(board) || won?(board)\nend", "def over?(board)\n draw?(board) || won?(board)\nend", "def win_game\n @win.each do |m|\n if @board[m[0]].strip == @board[m[1]] && @board[m[1]] == @board[m[2]]\n @winner = true\n end\n end\n @winner\n end", "def game_won?\n if diagonal_win?\n true\n elsif horizontal_win?\n true\n elsif vertical_win?\n true\n else\n false\n end\n end", "def over?(board)\n if draw?(board)\n return true\n end\n if won?(board)\n return true\n end\nend", "def over?(board)\n if full?(board) || won?(board)\n return true\n else\n return false\n end\nend", "def board_has_win?(positions)\n # x's\n if## Check for win ################################################\n # Check for horizontal wins\n (positions[:a] == positions[:b] and positions[:b] == positions[:c] and positions[:a] != \" \") or\n (positions[:d] == positions[:e] and positions[:e] == positions[:f] and positions[:d] != \" \") or\n (positions[:g] == positions[:h] and positions[:h] == positions[:i] and positions[:g] != \" \") or\n\n # Check for vertical wins\n (positions[:a] == positions[:d] and positions[:d] == positions[:g] and positions[:a] != \" \") or\n (positions[:b] == positions[:e] and positions[:e] == positions[:h] and positions[:b] != \" \") or\n (positions[:c] == positions[:f] and positions[:f] == positions[:i] and positions[:c] != \" \") or\n\n # Check for diagonal wins\n (positions[:a] == positions[:e] and positions[:e] == positions[:i] and positions[:a] != \" \") or\n (positions[:g] == positions[:e] and positions[:e] == positions[:c] and positions[:g] != \" \")\n # End conditional ########################################################\n\n # Determine who won -- if x won, he will have one more move than o. If o won, he will have the same amount of moves as x.\n num_of_x = 0\n num_of_o = 0\n\n positions.each do |k,v|\n if v == \"x\"\n num_of_x += 1\n elsif v == \"o\"\n num_of_o += 1\n end\n end\n\n if num_of_x > num_of_o\n # x won\n return true, :x\n else\n # o won\n return true, :o\n end\n else\n # No winner yet\n false\n end\nend", "def win?\n GameBoard::POSSIBLE_WIN_CELLS.each do |possible_win|\n if possible_win.all? {|cell| board[cell] == @current_player.tic_symbol}\n return true\n end\n end\n\n false\n end", "def over?(board)\n draw?(board) == true || won?(board) != false ? true : false\nend", "def won?(board)\n WIN_COMBINATIONS.detect do |win|\n board[win[0]] == board[win[1]] && board[win[0]] == board[win[2]] &&\n position_taken?(board, win[0])\n end\nend", "def won?(board)\n WIN_COMBINATIONS.detect do |win|\n board[win[0]] == board[win[1]] && board[win[0]] == board[win[2]] &&\n position_taken?(board, win[0])\n end\nend", "def over?(board)\n full?(board) || won?(board)\nend", "def over?(board)\n if won?(board) || draw?(board)\n true\n end\nend", "def over?\n won? || board.full? || draw?\n end", "def won?(board)\n WIN_COMBINATIONS.detect do |win_combination|\n board[win_combination[0]] == board[win_combination[1]] &&\n board[win_combination[1]] == board[win_combination[2]] &&\n position_taken?(board, win_combination[0])\n end\nend", "def won?(board)\n # cycle through WIN_COMBINATIONS\n WIN_COMBINATIONS.detect { |winning_combo|\n # print win_index\n # print '\\n'\n position_taken?(board,winning_combo[0]) &&\n position_taken?(board,winning_combo[1]) &&\n position_taken?(board,winning_combo[2]) &&\n board[winning_combo[0]] == board[winning_combo[1]] &&\n board[winning_combo[1]] == board[winning_combo[2]]\n }\nend", "def won?(board)\n WIN_COMBINATIONS.detect do |win_combo|\n board[win_combo[0]] == board[win_combo[1]] &&\n board[win_combo[0]] == board[win_combo[2]] &&\n position_taken?(board, win_combo[0])\n end\nend", "def over?(board)\n if won?(board) || draw?(board)\n true\n else\n false\n end\nend", "def over?(board)\n return won?(board) || draw?(board)\nend", "def won?(board)\n WIN_COMBINATIONS.each do|win|\n if (board[win[0]] == 'X' && board[win[1]] == 'X' && board[win[2]] == 'X') || (board[win[0]] == 'O' && board[win[1]] == 'O' && board[win[2]] == 'O')\n return win\n end\n end\n false\nend", "def winnable? board\n win_pos = nil\n WIN_COMBINATIONS.each do |win_combo|\n #creates array from board positions in win_combo\n mapped_cells = win_combo.map {|i| board.cells[i]}\n if mapped_cells.count(self.token) == 2 && mapped_cells.count(' ') == 1\n #finds the index of the winning position\n win_pos = win_combo[mapped_cells.index(' ')]\n end\n end\n win_pos\n end", "def has_won(board)\n # printf(\"Pre-Solved: %b \\n\", board)\n # puts \"Num: #{board}\"\n # check \\ diagonal\n w = board & (board >> 7)\n # check -- horizontal\n x = board & (board >> 8)\n # check / diagonal\n y = board & (board >> 9)\n # check | vertical\n z = board & (board >> 1)\n\n bitboard = ( (w & (w >> (2 * 7))) |\n (x & (x >> (2 * 8))) |\n (y & (y >> (2 * 9))) |\n (z & (z >> (2 * 1))) )\n # printf(\"Solved: %b \\n\", bitboard)\n # puts @game_state_model::state\n return bitboard > 0\n end", "def almost_win?(board)\n find_available_combinations(board, self.token).any? {|combo| (combo & find_moves_made(board, self.token)).count == 2 }\n end", "def winner?\n @board.winner?\n end", "def won?(board)\n WIN_COMBINATIONS.detect do |wc|\n board[wc[0]] == board[wc[1]] && board[wc[1]] == board [wc[2]] && position_taken?(board, wc[0])\n end \n end", "def someone_won?(brd)\n !!detect_winner(brd)\n end", "def over?(board)\n if draw?(board) || full?(board) || won?(board)\n return true\n else\n false\n end\nend", "def won?(board)\n WIN_COMBINATIONS.detect do |win_combination|\n if win_combination.all? do |win_position|\n board[win_position] == \"X\"\n end\n true\n elsif win_combination.all? do |win_position|\n board[win_position] == \"O\"\n end\n true\n else\n false\n end\n end\nend", "def won?\n WIN_COMBINATIONS.each {|win_combo|\n position_1 = @board.cells[win_combo[0]]\n position_2 = @board.cells[win_combo[1]]\n position_3 = @board.cells[win_combo[2]]\n return win_combo if ((position_1 == \"X\" && position_2 == \"X\" && position_3 == \"X\") ||\n (position_1 == \"O\" && position_2 == \"O\" && position_3 == \"O\"))\n }\n return false\n end", "def over?(board)\n (won?(board) || draw?(board)) ? true : false\nend", "def over?(board)\n if won?(board) || draw?(board)\n true\nelse\n false\n end\nend", "def over?(board)\n if (draw?(board) == true) || (won?(board) != nil)\n over = true\n else\n over = false\n end\nend", "def over?(board)\n if draw?(board) || won?(board)\n return true\n end\n if !won?(board)\n return false\n end\nend", "def over?(board)\n won?(board) || draw?(board)\n end", "def won?\n WIN_COMBINATIONS.any? do |win_array|\n board.cells[win_array[0]] == \"X\" && board.cells[win_array[1]] == \"X\" && board.cells[win_array[2]] == \"X\" ||\n board.cells[win_array[0]] == \"O\" && board.cells[win_array[1]] == \"O\" && board.cells[win_array[2]] == \"O\"\n end\n end", "def won?\n\n WIN_COMBINATIONS.find do |win_combination|\n # puts \"This is win combination #{win_combination}\"\n win_index_1 = win_combination[0]\n win_index_2 = win_combination[1]\n win_index_3 = win_combination[2]\n\n position_1 = @board[win_index_1]\n position_2 = @board[win_index_2]\n position_3 = @board[win_index_3]\n\n position_1 == position_2 && position_2 == position_3 && position_taken?(win_index_1)\n end\n end", "def over?(board)\n if won?(board)\n true\n elsif draw?(board)\n true\n else\n false\n end\nend", "def over?(board)\n draw?(board) || full?(board) || won?(board)\nend", "def over?(board)\n draw?(board) || full?(board) || won?(board)\nend", "def over?(board)\n if won?(board) || draw?(board)\n return true\n else \n return false\n end\n end", "def over?(board)\n won?(board) || draw?(board)\nend", "def win\n # horizontal win\n winner = horizontal_win?\n if winner\n victory(winner)\n return winner\n end\n\n # Vertical win (way harder to test for)\n winner = vertical_win?\n if winner\n victory(winner)\n return winner\n end\n\n # Diagonal win\n winner = diagonal_win?\n if winner\n victory(winner)\n return winner\n end\n\n # If the board is full and there are no declared winners\n\n if full?\n victory(\"Nobody\")\n return \"tie\"\n end\n return false\n end", "def over?(board)\n return won?(board) || draw?(board) ? true : false\nend", "def check_win\n if @game_board.return_count == 5 and @timer.return_time >= 0\n @win = true\n end\n if @game_board.return_count < 5 and @timer.return_time == 0\n @lose = true\n end\n end", "def over?(board)\n if draw?(board) == true || full?(board) == true || won?(board)\n return true\n else\n return false\n end\n end", "def won?\n the_win_combination = false\n WIN_COMBINATIONS.each do |win_combination|\n win_index_1 = win_combination[0]\n win_index_2 = win_combination[1]\n win_index_3 = win_combination[2]\n\n position_1 = @board[win_index_1]\n position_2 = @board[win_index_2]\n position_3 = @board[win_index_3]\n\n if (position_1 == \"X\" && position_2 == \"X\" && position_3 == \"X\") ||\n (position_1 == \"O\" && position_2 == \"O\" && position_3 == \"O\")\n the_win_combination = win_combination\n break\n end\n end\n the_win_combination\n end", "def won?(board)\n WIN_COMBINATIONS.detect do |win_index|\n board[win_index[0]] == board[win_index[1]] && \n board[win_index[0]] == board[win_index[2]] &&\n position_taken?(board, win_index[0])\n end\nend", "def over?(board)\n if full?(board) || won?(board) || draw?(board) then return true\n end\nend", "def won?(board)\n tanda=0\n WIN_COMBINATIONS.each do |ok|\n if board[ok[0]]== \"X\" && board[ok[1]]== \"X\" && board[ok[2]]==\"X\"\n tanda=2\n return ok\n elsif board[ok[0]]== \"O\" && board[ok[1]]== \"O\" && board[ok[2]]==\"O\"\n tanda=2\n return ok\n end\n end\n if tanda==0\n return false\n end\nend", "def over?(board)\n if won?(board) || full?(board) || draw?(board)\n true\n else\n false\n end\nend", "def over?(board)\n if won?(board) || full?(board) || draw?(board)\n true\n else\n false\n end\nend", "def over?(board)\n if won?(board) || draw?(board) || full?(board)\n true\n else\n false\n end\nend", "def won?(board)\n \n WIN_COMBINATIONS.each do |win_combo|\n p1 = board[win_combo[0]]\n p2 = board[win_combo[1]]\n p3 = board[win_combo[2]]\n \n if (p1 == \"X\" && p2 == \"X\" && p3 == \"X\") || (p1 == \"O\" && p2 == \"O\" && p3 == \"O\")\n return win_combo\n end\n \n end\n return false\n end", "def over?(board)\n if won?(board) || full?(board) || draw?(board)\n return true\n end\nend", "def won?\n board.all_non_mines_cells_revealed?\n end", "def over?(board)\n if won?(board) || full?(board) || draw?(board)\n true\n end\nend", "def over?(board)\n if(!!won?(board))\n return true\n end\n if(draw?(board))\n return true\n end\n return false\nend", "def over?(board)\n if won?(board) or draw?(board) or full?(board)\n return true\n else\n return false\n end\nend", "def over?(board)\n if won?(board) || draw?(board) || full?(board)\n return true\n end\nend", "def over?(board)\n if won?(board) || draw?(board) || full?(board)\n return true\n end\nend", "def game_over\n [:winner, :tie].include?(board.status)\n end", "def over?(board)\n if won?(board) || draw?(board) || full?(board)\n return true\n else\n return false\n end\nend", "def over?(board)\n if won?(board) || draw?(board) || full?(board)\n return true\n else\n return false\n end\nend", "def over?(board)\n if draw?(board) || won?(board) || full?(board)\n return true\n end\nend", "def over?(board)\n if won?(board)\n return true\n elsif draw?(board)\n return true\n else\n return false\n end\nend", "def over?(board)\n if won?(board) || full?(board)\n return true\n end\nend", "def over?(board)\n if won?(board) || full?(board)\n return true\n end\nend", "def over?(board)\n won?(board) || full?(board) || draw?(board)\n end", "def over?(board)\r\n if ( won?(board) || draw?(board) || full?(board))\r\n return true\r\n else\r\n return false\r\n end\r\nend", "def over?(board)\n if (won?(board) != false)\n true\n elsif (draw?(board) == true)\n true\n else\n false\n end\nend", "def over? (board)\n if draw? (board)\n return true\n elsif won? (board)\n return true\n end\nend", "def won?(board)\n res = false\n WIN_COMBINATIONS.each do |win_combination|\n board_entries = [board[win_combination[0]], board[win_combination[1]], board[win_combination[2]]]\n board_entries == [\"X\", \"X\", \"X\"] || board_entries == [\"O\", \"O\", \"O\"] ? res = win_combination : false\n end\n res\n\nend", "def over?(board)\n draw?(board) || won?(board) || full?(board)\nend", "def over?(board)\n if draw?(board) || won?(board) || full?(board)\n return true\n end\nend", "def over?(board)\n if draw?(board) || won?(board) || full?(board)\n return true\n end\nend", "def win?(piece)\n check_rows(piece, grid) || check_rows(piece, grid.transpose) || check_diagonals(piece)\n end", "def over?(board)\n draw?(board) ||\n won?(board)\nend", "def won?(board)\n\n WIN_COMBINATIONS.each do |win_combination|\n win_index_1 = win_combination[0]\n win_index_2 = win_combination[1]\n win_index_3 = win_combination[2]\n \n position_1 = board[win_index_1]\n position_2 = board[win_index_2]\n position_3 = board[win_index_3]\n \n if ((position_1 == \"X\" && position_2 == \"X\" && position_3 == \"X\") || (position_1 == \"O\" && position_2 == \"O\" && position_3 == \"O\"))\n return win_combination\n end\n end\n return FALSE\nend", "def over?(board)\n return won?(board) || draw?(board) || full?(board)\nend", "def over?(board) \nwon?(board) || full?(board) || draw?(board) ? true : false \nend", "def won?\n if @board.all? { |i| i == \"\" || i == \" \"} == true\n return false\n end\n WIN_COMBINATIONS.detect do |win_cond|\n @board[win_cond[0]] == @board[win_cond[1]]&&\n @board[win_cond[0]] == @board[win_cond[2]]&&\n position_taken?(win_cond[0])\n end\n end", "def over?(board)\nif won?(board) != nil || draw?(board) == true\n return true\nend\nend", "def over?(board)\n won = won?(board)\n draw = draw?(board)\n # Due to the won? method never explicitly returning a true value,\n # the program must instead check if it isn't false.\n if draw == true || won != false\n return true\n else\n return false\n end\nend" ]
[ "0.8551473", "0.8211384", "0.8101445", "0.8089133", "0.8060109", "0.80387443", "0.80187297", "0.80120677", "0.80064267", "0.80064267", "0.80026704", "0.80026704", "0.79959", "0.79939336", "0.7985142", "0.7984486", "0.7980891", "0.7980594", "0.79798687", "0.79798687", "0.7971759", "0.79698366", "0.79488355", "0.7937015", "0.7934158", "0.7932952", "0.7920982", "0.7918357", "0.7918357", "0.79118234", "0.79112995", "0.79103357", "0.79053235", "0.7903591", "0.7902943", "0.79020596", "0.79017687", "0.7899381", "0.7898796", "0.7898001", "0.7895207", "0.7894178", "0.7892921", "0.78902674", "0.7890229", "0.7887099", "0.7884706", "0.7882856", "0.787909", "0.7878206", "0.7876811", "0.7875892", "0.7871321", "0.7870816", "0.78667355", "0.7864963", "0.7864963", "0.7863043", "0.7859162", "0.7855327", "0.78546447", "0.7854046", "0.78532976", "0.78504807", "0.78479034", "0.7847579", "0.78472656", "0.7846146", "0.7846146", "0.7844757", "0.7840308", "0.7838656", "0.78378415", "0.78351533", "0.7834678", "0.7834464", "0.7831985", "0.7831985", "0.7829355", "0.7829072", "0.7829072", "0.7828921", "0.78281856", "0.78274345", "0.78274345", "0.78259516", "0.78259486", "0.78229624", "0.7819223", "0.7818393", "0.7817239", "0.78133565", "0.78133565", "0.78124034", "0.7811276", "0.7809945", "0.78080136", "0.78053737", "0.780476", "0.78022724", "0.78016007" ]
0.0
-1
Define if the board is full
def full?(board) board.none?{ |space| space == " "} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full?\n @board.all?{|occupied| occupied != \" \"}\n end", "def board_full?\r\n @game_board.count(\"\") == 0\r\n end", "def isBoardFull()\n #\n # TO DO: add your code below\n #\n for i in 0...@size\n for j in 0...@size\n if (@board[i][j]==EMPTY)\n return false\n end\n end\n end\n\n # DO NOT DELETE THE LINE BELOW\n\t\treturn true;\n\tend", "def isBoardFull()\n #\n # TO DO: add your code below\n\t\t#\n\t\tfor i in (0...@board.size)\n\t\t\tfor j in (0...@board.size)\n\t\t\t\tif @board[i][j] == EMPTY\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n # DO NOT DELETE THE LINE BELOW\n\t\treturn true;\n\tend", "def full? #if theres no winning combos and the board is full? check to see\n @board.all?{|square| square!= \" \" }\n end", "def board_full?(brd)\n empty_squares(brd).empty?\n end", "def full?\r\n @board.none? do | position |\r\n position == \" \"\r\n end\r\n end", "def board_full?\n @board.flatten.all?\n @turn == 9 \n end", "def board_full?\n @board.each do |row|\n row.each do |col|\n if col == @empty_square\n #stop at first empty space found\n return nil\n end\n end\n end\n return true\n end", "def check_full? \n \t\treturn true if @size==16 #size increase by 1 with every turn so when it reaches 16 we know that all cells are full\n\tend", "def full?\n @board.all?{|occupied| occupied != \" \"}\nend", "def full?\n @board.all?{|occupied| occupied != \" \"}\nend", "def isBoardFull()\n\n # TO DO: COMPLETE THIS PART OF THE METHOD\n\n counter = 0\n totalSpaces = @size * @size\n\n for i in 0..@size-1\n for j in 0..@size-1\n if @board[i][j] != \"-\"\n counter = counter + 1\n end\n end\n end\n\n if counter == totalSpaces\n return true\n end\n\n\t\treturn false\n end", "def full?\n is_full = @board.all? do |space|\n space ==\"X\" || space == \"O\"\n end\n if is_full\n true\n end\n end", "def full?\n # If no 'board_position'/s are empty, returns 'true'. If 'board_position'/s remain empty, returns 'false'.\n if @board.none? {|board_position| board_position == \" \"}\n true\n end\n end", "def board_full?(brd)\n empty_squares(brd).empty?\nend", "def board_full?(brd)\n empty_squares(brd).empty?\nend", "def full?\n @board.all? do |position|\n position != \" \"\n end\n end", "def full?\n @board.all? do |position|\n position != \" \"\n end\n end", "def full?\n @board.all? {|space| space == \"X\" || space == \"O\"}\n end", "def full?\n result = @board.none? {|mark| mark==\" \"}\n return result\n end", "def full?\n @board.all? {|position| position == \"X\" or position == \"O\"}\n end", "def full?\n return @board.all?{|pos| pos == \"X\" or pos == \"O\"}\n end", "def full?\n\t\t@board.all? { |e|\n\t\t\te == \"X\" || e == \"O\"\n\t\t}\n\tend", "def full?(board)\n filled_tiles = 0\n board.each { |tile| tile == \"X\" || tile == \"O\" ? (filled_tiles += 1) : ()}\n filled_tiles == 9 ? (return true) : (return false)\nend", "def full?\n @board.all? {|value| value == \"X\" || value ==\"O\"}\n end", "def full?\n @board.all? { |location| location != \" \"}\n end", "def full?\n !@board.detect{|i| i == \" \"}\n end", "def full?\n @board.all? {|i| i == \"X\" || i == \"O\"}\n end", "def full\n @moves.length >= 12\n end", "def full?\n answer= @board.each {|box| return false if taken?(box) == false }\n unless answer ==false \n true\n end\n end", "def full?\n @board.cells.include?(\"\") || @board.cells.include?(\" \") ? false : true\n end", "def is_full?\n\t @grid.all? { |col| col.length == @rows }\n\tend", "def board_full?(board)\n !board.include?(\"\")\n end", "def board_full?(board)\n false\n true unless board.include?(INITIAL_MARKER)\nend", "def full_board?\n @board.cells.each do |row|\n row.each do |cell|\n return false if cell.state == \" \"\n end\n end\n true\n end", "def board_full\n\n # Assume the board is full\n result = true\n\n # Outer loop through each row\n for row in 0..BOARD_MAXIMUM_INDEX\n\n # Inner loop through each column\n for column in 0..BOARD_MAXIMUM_INDEX\n\n # Is this cell occupied?\n if @board[row][column] == EMPTY_POSITION\n\n # No, the board is not full and the game must continue\n result = false\n\n end\n\n end\n\n end\n\n # Since we found no open positions, the board is full\n return result\n\n end", "def full? \n\t@board.any? {|a| a.include?(\" \")} ? false : true\n\tend", "def full?\n @board.all? do |location| \n location == \"X\" || location == \"O\"\n end\n end", "def is_full?\n\t\t@game_board.each do |x|\n\t\t\tx.each do |y|\n\t\t\t\tif y == \"\"\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\ttrue\n\tend", "def full?(board) #check if the board is full\n board.each_with_index do |position, index|\n if position_taken?(board, index) == false \n return false\n end\n end\n return true\nend", "def full?\r\n @board.each do |space|\r\n if space == \" \"\r\n return false\r\n end\r\n end\r\n true\r\n end", "def full?\n @board.none? do |value|\n value == \" \" || value.nil?\n end\n end", "def full?(board)\n if @board.any? {|index| index == nil || index == \" \"}\n return false\n else\n return true\n end\n end", "def full_board?\n (@turn_played > @turn_max) ? true : false\n end", "def full?\n @board.all?{|token| token == \"X\" || token == \"O\"}\n end", "def is_board_full(board)\n for i in 1..10\n if is_space_free(board, i)\n return false\n end\n end \n\n return true\nend", "def full?\n @board.all? { |token| token == \"X\" || token == \"O\" }\n end", "def full?\n if @board.detect{|i| i == \"\" || i == \" \"}\n return false\n else\n return true\n end\n end", "def full?(board)\n turn_count(board) == 9 ? true : false\nend", "def full?\n any_spaces = @board.any?{|element| element == \" \"}\n if any_spaces == true\n return false\n else\n return true\n end\n end", "def full?\n #if there is a blank space, returns false, otherwise true\n !(@board.detect {|posit| posit == \" \"})\n end", "def full?\n if @board.include?(\" \")\n false\n else\n true\n end\nend", "def full?\n !@board.any? { |value| value.nil? || value == \"\" || value == \" \" }\n end", "def full?\n @board.detect{|entry| entry==\" \"}==nil ? true : false\nend", "def full?(board)\n return board.none? {|xo| xo == \" \"}\nend", "def full?(board)\n board_is_full = board.all? do |space|\n space == \"X\" || space == \"O\"\n end\n return board_is_full\nend", "def full?\n @board.all? { |e| !(e.nil? || e == \" \") }\nend", "def full?\n available_squares.empty?\n end", "def full?\n return (@fill_count == size)\n end", "def full?(board)\n if won?(board) == false && board.all? {|element| element != \" \"}\n return true\n else\n false\n end\nend", "def full?(board)\n\n full_board = [0,1,2,3,4,5,6,7,8].all? {|index| position_taken?(board, index)}\n return full_board\n\nend", "def full?(board)\n\t\tboard.all?{|cell| cell == \"X\" || cell == \"O\"}\n\tend", "def full?()\n @board.each do |values|\n if values == \" \" || values == \"\"\n return false\n end\n end\n return true\n end", "def full?\n @board.all? { |x| x == \"X\" || x == \"O\" } \nend", "def full?(board)\n all_full = false\n board.all? do |space|\n if space == \"X\" || space == \"O\"\n all_full = true\n end\n end\nend", "def full?(board)\n\tboard.all? do |cell|\n\t\tcell == \"X\" || cell == \"O\"\n\tend\nend", "def full?(board)\n is_full = board.all? do |position|\n (position == \"X\" || position == \"O\")\n end\n return is_full\nend", "def full?\n #return true if every element in the board contains something\n if @board.detect {|i| i == \" \" || i == nil}\n return false\n else\n return true\n end\nend", "def full?(board)\n board.all? do |marker|\n marker == \"X\" || marker == \"O\"\n end\n end", "def full?(board)\n result = board.none? {|mark| mark==\" \"}\n return result\nend", "def full?(board)\n result = board.none? {|mark| mark==\" \"}\n return result\nend", "def full?(board)\n !board.include? (\" \")\n end", "def full?\n @top == (@size - 1)\n end", "def full?\n @top == (@size - 1)\n end", "def full?\n @top == (@size - 1)\n end", "def full?\n @top == (@size - 1)\n end", "def full?(board)\n board.all?{|filled| filled == \"X\" || filled == \"O\"}\nend", "def full?(board)\n return !(board & [\" \", \"\", nil]).any?\nend", "def full?\n if @board.include?(\" \" || \"\" || nil)\n false\n else\n true \n end \nend", "def on_board?(coords)\n\t\tcoords.any? {|coord| coord < 1 || coord > @size } ? false : true\n\tend", "def draw?\n board.full_board?\n end", "def full?(board_array)\n board_check = board_array.all? do |space|\n space != \" \"\n end\n \n if board_check\n return true #situation for a draw\n else\n return false #situation for an in-progress game\n end\nend", "def full?(board)\n if board.include?(\" \") == false #returns FALSE if the board is FULL.\n true\n end\nend", "def full?(board_array)\r\n board_check = board_array.all? do |space|\r\n space != \" \"\r\n end\r\n \r\n if board_check\r\n return true #situation for a draw\r\n else\r\n return false #situation for an in-progress game\r\n end\r\nend", "def full?(board)\n board_full = board.all? {|position| position == 'X' || position == 'O'}\n\n if (board_full)\n return true\n end\nend", "def full_board?\n blank_space = false\n @tablero.each do |n|\n if n == \" \"\n blank_space = true\n end\n end\n blank_space ? false : true\n end", "def full?(board)\n#Return true if all positions on board are filled by X and/or O\n board.all?{|token| token == \"X\" || token == \"O\"}\nend", "def full?(board)\n board.each do |i|\n if i == \" \"\n return false\n end\n end\n return true\n # checks whether each element on the board is empty if not return false (not empty) otherwise return true(full)\nend", "def full?\n @cells.all? { |space| space == \"X\" || space == \"O\" }\n end", "def draw?\n @board.full? && !won?\n end", "def full?(board)\n board.all? {|indexs| indexs != \" \"}\nend", "def draw?\n !won? && board.full?\n end", "def full?(board)\n !(board.include?(\" \"))\n end", "def full?(board)\n board.all? {|full| full != \" \"} ? true : false\nend", "def full?(board)\n board.all? { |space| space == \"X\" || space == \"O\"}\nend", "def full?(board)\n board.all? { |space| space == \"X\" || space == \"O\"}\nend", "def over?(board)\n won?(board) || full?(board)\n end", "def full?(board)\n # indices = [0, 1, 2, 3, 4, 5, 6, 7, 8]\n # if indices.all? {|position| position_taken?(board, position, \"X\") || position_taken?(board, position, \"O\")}\n # return true\n # elsif board.include?(\" \")\n # return false\n if board.include?(\" \" || \"\" || nil)\n return false\n else\n return true\n end\nend", "def full?\n !@cells.include? \" \"\n end", "def over?(board)\n\n\n # is board full\n board.all? {|i| i == \"O\" || i == \"X\"}\n\n\nend" ]
[ "0.8595504", "0.85309416", "0.8488368", "0.845583", "0.84209156", "0.8376601", "0.8312903", "0.8291548", "0.8272542", "0.8268285", "0.82621676", "0.82621676", "0.81839144", "0.8182286", "0.817136", "0.81712055", "0.81712055", "0.8168231", "0.8168231", "0.807645", "0.8050946", "0.8020779", "0.79823726", "0.7965972", "0.7950516", "0.7946016", "0.7928836", "0.7917201", "0.7913341", "0.7904309", "0.7901496", "0.7898164", "0.789785", "0.78513175", "0.7811973", "0.78047115", "0.77746725", "0.7771239", "0.775681", "0.77425575", "0.7738709", "0.77349925", "0.77349716", "0.77221465", "0.76997", "0.7684696", "0.7666771", "0.76656795", "0.7663214", "0.765894", "0.76439416", "0.7623241", "0.76166373", "0.7615648", "0.7589741", "0.7582966", "0.75665987", "0.753596", "0.7534453", "0.7520386", "0.7509823", "0.74972385", "0.74960434", "0.74827427", "0.74674743", "0.7462216", "0.7453048", "0.74380976", "0.7426287", "0.74227655", "0.74180657", "0.74180657", "0.7413961", "0.73816675", "0.73816675", "0.73816675", "0.73816675", "0.7380882", "0.73650384", "0.73620486", "0.7358497", "0.73505706", "0.73496777", "0.7344885", "0.73445773", "0.7340798", "0.7295753", "0.72874415", "0.72817886", "0.7281111", "0.72795695", "0.72735035", "0.7256416", "0.7243298", "0.72431153", "0.72369885", "0.72369885", "0.7232739", "0.7223157", "0.7217892", "0.72177213" ]
0.0
-1
Define if the game is over if the board has been won, is a draw, or is full
def over?(board) draw?(board) || full?(board) || won?(board) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def over?\n won? || board.full? || draw?\n end", "def over?(board)\n if draw?(board)\n true\n elsif won?(board) != nil && full?(board) == true\n true\n elsif won?(board) != nil && full?(board) == false\n true\n else\n false\n end\nend", "def over?(board)\n if draw?(board)\n true\n elsif won?(board) != nil && full?(board) == true\n true\n elsif won?(board) != nil && full?(board) == false\n true\n else\n false\n end\nend", "def game_is_over?\n (won? || draw? || full?) ? true : false\n end", "def over?(board)\n if won?(board)\n true\n elsif full?(board)\n true\n elsif !full?(board)\n false\n else draw?(board)\n true\n end\nend", "def over?\n won? || full? || draw?\n end", "def over?\n won? || full? || draw?\n end", "def over?\n won? || draw? || full?\n end", "def over?\n won? || draw? || full?\n end", "def over?\n won? || draw? || full?\n end", "def over?(board)\n if won?(board) || full?(board) || draw?(board)\n true\n else\n false\n end\nend", "def over?(board)\n if won?(board) || full?(board) || draw?(board)\n true\n else\n false\n end\nend", "def over?(board)\n if won?(board) || full?(board) || draw?(board)\n true\n end\nend", "def over?(board)\n if won?(board) || draw?(board) || full?(board)\n true\n else\n false\n end\nend", "def over?(board)\n won?(board) || full?(board) || draw?(board)\n end", "def over?(board)\n if draw?(board)\n return true\n \n elsif won?(board) && full?(board)\n return true\n \n elsif won?(board) && !full?(board)\n return true\n \n elsif !(won?(board) && full?(board))\n return false\n end \nend", "def over?(board)\n if (full?(board) == true || draw?(board) == true || won?(board) != false) then\n true\n end\nend", "def over?(board)\n#over? == true if won? is true OR draw is true. There is no need to\n#check for full, as a full board will happen if there is a draw..\n won?(board) || draw?(board)\nend", "def over?\n if won? || draw? || full?\n true\n end\n end", "def draw?\n @board.full? && !won?\n end", "def over?(board)\n if draw?(board) || full?(board)\n true\n elsif won?(board) != false && won?(board) != []\n true\n else\n false\n end\nend", "def over?\n won? || draw? || full?\n end", "def over?(board)\n draw?(board) || won?(board) || full?(board)\nend", "def draw?\n !won? && board.full?\n end", "def over?(board)\n won?(board) || full?(board) || draw?(board)\nend", "def over?(board)\n if (won?(board) != FALSE)\n return TRUE\n \n elsif (draw?(board) == TRUE)\n return TRUE\n \n elsif (full?(board) == TRUE)\n return TRUE\n \n else \n return FALSE\n end\nend", "def draw?\n @board.full? && !won?\n end", "def draw?\n @board.full? && !won?\n end", "def over?(board)\r\n if ( won?(board) || draw?(board) || full?(board))\r\n return true\r\n else\r\n return false\r\n end\r\nend", "def over?(board)\n if full?(board) || won?(board) || draw?(board) then return true\n end\nend", "def over?(board)\n if won?(board)\n true\n elsif draw?(board)\n true\n else\n false\n end\nend", "def over?(board)\n won?(board) || full?(board)\n end", "def over?(board)\n if draw?(board) == true || full?(board) == true || won?(board)\n return true\n else\n return false\n end\n end", "def over?(board)\n if won?(board) || full?(board) || draw?(board)\n return true\n end\nend", "def over?(board)\n if draw?(board) || won?(board) || full?(board)\n return true\n end\nend", "def over?(board)\n if draw?(board) || won?(board) || full?(board)\n return true\n end\nend", "def over?(board)\n if draw?(board) || won?(board) || full?(board)\n return true\n end\nend", "def over?(board)\n won?(board) || draw?(board) || full?(board)\nend", "def over?(board)\n won?(board) || draw?(board) || full?(board)\nend", "def over?(board)\n won?(board) || draw?(board) || full?(board)\nend", "def over?(board)\n won?(board) || draw?(board) || full?(board)\nend", "def over?(board)\n won?(board) || draw?(board) || full?(board)\nend", "def over?(board)\n won?(board) || draw?(board) || full?(board)\nend", "def over?(board)\n won?(board) || draw?(board) || full?(board)\nend", "def over?(board)\n won?(board) || draw?(board) || full?(board)\nend", "def over?(board)\n if won?(board) || draw?(board)\n true\n else\n false\n end\nend", "def over?(board)\n won?(board) || draw?(board)\n end", "def draw?\n @board.full? && !won?;\n end", "def over?(board)\n full = full?(board) == true\n won = won?(board) != false\n draw = draw?(board) == true\n\n if ( won )\n return true\n\n elsif ( won && full )\n return true\n\n elsif ( draw )\n return true\n end\nend", "def over?(board)\n if won?(board) || draw?(board) || full?(board)\n return true\n else\n return false\n end\nend", "def over?(board)\n if won?(board) || draw?(board) || full?(board)\n return true\n else\n return false\n end\nend", "def over?(board)\n return won?(board) || draw?(board) || full?(board)\nend", "def over?(board)\n if won?(board) || draw?(board) || full?(board)\n return true\n end\nend", "def over?(board)\n if won?(board) || draw?(board) || full?(board)\n return true\n end\nend", "def over?(board)\n if won?(board) or draw?(board) or full?(board)\n return true\n else\n return false\n end\nend", "def over?\n if won? or draw? or full?\n return true\n else\n return false\n end\n end", "def over?(board)\r\n if draw?(board) || won?(board)\r\n true\r\n else\r\n false\r\n end\r\nend", "def over?(board)\n if won?(board) || draw?(board)\n true\n end\nend", "def over?(board)\n full?(board) || won?(board) || draw?(board)\nend", "def over?(board)\n full?(board) || won?(board) || draw?(board)\nend", "def over?(board)\n if won?(board) != nil || draw?(board) == true || full?(board) == true\n return true\n end\nend", "def over?\n draw? || won? || full?\nend", "def over?(board)\n if draw?(board) || full?(board) || won?(board)\n return true\n else\n false\n end\nend", "def over?(board)\n if won?(board) != nil || draw?(board) == true || full?(board) == true\n return true\n end\nend", "def draw?(board)\n !won?(board) && full?(board)\n end", "def over?(board)\n if won?(board) || draw?(board)\n true\nelse\n false\n end\nend", "def over?\r\n won? || draw?\r\n end", "def draw?\n self.board.full? && !self.won?\n end", "def over?(board)\n draw?(board) || won?(board)\nend", "def over?(board)\n draw?(board) || won?(board)\nend", "def over?(board)\n draw?(board) == true || won?(board) != false ? true : false\nend", "def over?\n draw? || won?\n end", "def draw?\n board.full? && self.won? == false\n end", "def over?(board)\n won?(board) || draw?(board) || full?(board);\nend", "def over?\n if draw? == true || won? != false\n return true\n elsif full? == false\n return false\n end\n end", "def over?(board)\n #board that has been won and the board is NOT full --> true\n if won?(board) != false && full?(board) == false\n return true\n #board that has been won and the board is full --> true\n elsif won?(board) != false && full?(board) == true\n return true\n #board that is still in-progress --> false\n elsif won?(board) == false && full?(board) == false\n return false\n #board that's a draw --> true\n elsif draw?(board) == true\n return true\n end\nend", "def draw?(board)\n if won?(board)\n false\n elsif full?(board)\n true\n else\n false\n end\nend", "def draw?(board)\n if won?(board)\n false\n elsif full?(board)\n true\n else\n false\n end\nend", "def over?(board)\n return won?(board) || draw?(board)\nend", "def over?(board)\n won?(board) || draw?(board)\nend", "def over?\n draw? || won?\n end", "def over?(board)\n if won?(board) || draw?(board)\n return true\n else \n return false\n end\n end", "def over?(board)\n if (won?(board) || full?(board) || draw?(board)) || (won?(board) && !full?(board))\n return true\n else\n return false\n end\nend", "def over?\n if self.won? || self.draw?\n true\n elsif !self.board.full? && !self.won? && !self.draw?\n false\n end\n end", "def over?(board)\n\n if won?(board) != nil || draw?(board) == true || full?(board) == true\n return true\n else\n return false\n end\n\nend", "def over?(board)\n full?(board) || draw?(board) || won?(board)\nend", "def over?\n won? || draw?\n # if full? && won?\n # true\n # elsif won?\n # true\n # elsif !full? && !won?\n # false\n # elsif draw?\n # true\n # end\n end", "def draw? (board)\n if !won?(board) #returns true if no win\n if full?(board) #but board is full\n return true\n end\n end\n return false\nend", "def over?(board)\n if(draw?(board) || won?(board))\n true\n else\n false\n end\nend", "def over?(board)\n if(draw?(board) || won?(board))\n true\n else\n false\n end\nend", "def over?(board)\n if draw?(board)\n return true\n end\n if won?(board)\n return true\n end\nend", "def draw?\n # board is full, but not won\n if full? && !won?\n true\n # board is not full and not won\n elsif full? == false\n false\n # false for game won in first row or game won diagonally\n # elsif won?(board) == [0,1,2] || won?(board) == [0,4,8] || won?(board) == [2,4,6]\n # false\n end\n end", "def over?(board)\n return won?(board) || draw?(board) ? true : false\nend", "def over? (board)\n if draw? (board)\n return true\n elsif won? (board)\n return true\n end\nend", "def draw?(board)\n if won?(board) || !full?(board)\n false\n else\n true\n end\nend", "def over?(board)\n (won?(board) || draw?(board)) ? true : false\nend", "def draw? (board)\n isFull = full?(board)\n isWon = won?(board)\n (isFull && isWon == false)\nend", "def game_over?\n @board.game_over?\n end", "def over?(board) \nwon?(board) || full?(board) || draw?(board) ? true : false \nend" ]
[ "0.8975845", "0.86471444", "0.8646396", "0.86273646", "0.8588229", "0.85804623", "0.8498608", "0.8478309", "0.8478309", "0.8478309", "0.8467399", "0.8467399", "0.84590006", "0.84546274", "0.84486294", "0.8445636", "0.84451395", "0.8444978", "0.84447014", "0.8437174", "0.8421117", "0.8418363", "0.8414333", "0.83926576", "0.83712745", "0.8363133", "0.83602625", "0.83602625", "0.8355551", "0.8355194", "0.8351882", "0.83513814", "0.83485824", "0.8345434", "0.8345406", "0.8345406", "0.8342139", "0.8335788", "0.8335788", "0.8335788", "0.8335788", "0.8335788", "0.8335788", "0.8335788", "0.8335788", "0.83345366", "0.83340985", "0.8333973", "0.83316934", "0.833143", "0.833143", "0.83305687", "0.83286333", "0.83286333", "0.8324636", "0.8322486", "0.8320921", "0.83174527", "0.8316093", "0.8316093", "0.8312526", "0.83118594", "0.8311028", "0.83091974", "0.8304929", "0.82988685", "0.8292987", "0.8291585", "0.82853645", "0.82853645", "0.82849616", "0.82826024", "0.82791823", "0.8274159", "0.827126", "0.82701343", "0.8268265", "0.8268265", "0.82611597", "0.8259473", "0.82581055", "0.82580674", "0.8257131", "0.82538533", "0.8249846", "0.8248307", "0.8248052", "0.82471615", "0.8238587", "0.8238587", "0.8223554", "0.8223481", "0.82197183", "0.8218294", "0.8217667", "0.82145625", "0.82122314", "0.82099205", "0.8204509" ]
0.83821046
25
KairosDB message format: put
def metrics_line(name, value, timestamp) "put #{name} #{timestamp} #{value}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put_msg(action, options)\n\n msg = prepare_msg_doc(action, options)\n msg['put_at'] = Ruote.now_to_utc_s\n\n msg['_rev'] = 0\n # in case of msg replay\n\n collection(msg).insert(to_mongo(msg))\n end", "def put(data)\n end", "def put *args, &block\n handle @conn.put *args, &block\n end", "def put(*args)\n execute(:put, *args)\n end", "def database_put(family, key, value)\n response = AGIResponse.new\n command_str = \"DATABASE PUT #{family} #{key} #{value}\"\n begin\n response.native = execute(command_str)\n rescue AGITimeoutError, AGICommandError, AGIHangupError\n raise\n end\n if response.native == -1 then\n raise AGIChannelError.new(@last_response, \"Channel Failure in (#{command_str})\")\n elsif response.native == 1 then\n response.success = true\n end\n return response\n end", "def put(key, value)\n\n # FIXME: insert code that connects to the backend and affects the put\n # operation\n #\n # - This delete should be done atomically\n # - Convert any exceptions into a failed status result with a meaningful\n # error message.\n #\n\n { :result => false, :err_msg => 'FIXME: not implemented' }\n end", "def put(*args)\n request :put, *args\n end", "def put_update\n response = self.class.put(\"/service/#{$service_id}/version/#{$service_version}/logging/sftp/#{$name}\", \n headers: { \"Fastly-Key\" => $key }, \n body: $put_form_data )\n end", "def put(*args, &block)\n self.client.put *args\n end", "def put(key, value)\n # logger.debug \"put #{key} data\"\n db.put(key, value)\n end", "def put!\n request! :put\n end", "def put(*args)\n request(:put, *args)\n end", "def put(data = \"\")\n submit :Put, data\n end", "def put(obj)\n end", "def raw_put(path, body, options = {})\n # Allow format override\n format = options.delete(:format) || @format\n # Clear cache\n expire_matching \"#{parent_path(path)}.*\"\n # Create PUT request\n put = Typhoeus::Request.new(\"#{protocol}#{@server}#{path}\", \n :verbose => DEBUG,\n :method => \"put\",\n :body => body,\n :headers => { :'Content-type' => options[:content_type] || content_type(format) }\n )\n # Send request\n do_request(put, format)\n end", "def put(params)\n bucket = params[:bucket]\n object = params[:object]\n value = params[:value]\n content_type = params[:content_type]\n cb = params[:cb]\n date = generate_date\n sign_string = generate_signed_string('PUT', 'private', bucket, object, content_type)\n signature = generate_signature(sign_string)\n auth = generate_auth(signature)\n headers = generate_put_headers(date, auth, 'private', content_type, value.size)\n path = \"/\" << object\n\n @req_options = {:method => :put, :head => headers, :path => path, :body => value}\n @cb = cb if cb\n @bucket = bucket\n try_request\n self\n end", "def put(key, value)\n \n end", "def direct_put(uri,data, wait = true, opts = {})\n id = @utils.id_generate\n options = {\"Identifier\" => id, \"URI\" => uri ,\"UploadFrom\" => \"direct\", \"DataLength\" => data.bytesize }.merge(opts)\n send_packet @utils.packet_mangler(options,\"ClientPut\").sub! \"EndMessage\\n\", \"Data\\n#{data}\"\n if wait\n wait_for id,/PutFailed|PutSuccessful/\n else\n id\n end\n end", "def put(path, body = nil, ctype = 'application/json')\n make_call(mk_conn(path, 'Content-Type': ctype,\n 'Accept': 'application/json'),\n :put, nil, body.to_json)\n end", "def couchdb_put(urn, host = '127.0.0.1', options = @@default_options)\n query_couchdb(urn, 'PUT', host, options)\n end", "def put(action, **args); end", "def create_method\n :http_put\n end", "def create_method\n :http_put\n end", "def put payload, path = \"\"\n make_request(path, \"put\", payload)\n end", "def do_put(uri = \"\", body = \"\")\n @connection.put do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n req.body = body\n end\n rescue Faraday::Error::ConnectionFailed => e\n $lxca_log.error \"XClarityClient::XclarityBase do_put\", \"Error trying to send a PUT to #{uri}\"\n $lxca_log.error \"XClarityClient::XclarityBase do_put\", \"Request sent: #{body}\"\n Faraday::Response.new\n end", "def put(msg)\n abstract_method_error\n end", "def put\n raise NotImplementedError\n end", "def puts_to(path,params,opts={},&block) #:nodoc: \n crud_to(:put,path,params,opts,&block)\n end", "def put_request(options)\n raise ArgumentError, t('invalid_bucket') if options[:bucket].empty?\n raise ArgumentError, t('empty_content') if options[:content].nil?\n options[:w] ||= @write_quorum unless @write_quorum.nil?\n options[:dw] ||= @replica_commit unless @replica_commit.nil?\n options[:return_body] = @return_body unless options.has_key?(:return_body)\n\n request = Riakpb::RpbPutReq.new(options.slice :bucket, :key, :vclock, :content, :w, :dw, :return_body)\n response = rpc.request(\n Util::MessageCode::PUT_REQUEST,\n request\n )\n\n return(true) if response == \"\"\n return(response)\n end", "def put endpoint, data\n do_request :put, endpoint, data\n end", "def put(*args)\n prepare_request(:put, args)\n @@client.add(:put, @path, *args)\n end", "def put(path, body: {}, headers: nil)\n response = conn.put do |req|\n build_request(req, path: path, body: body, headers: headers)\n end\n puts response.body\n response.body unless response.blank?\n end", "def send_put(resource, data)\n\n url = URI.parse(primavera_path(resource))\n req = Net::HTTP::Put.new(url.to_s, initheader = {'Content-Type' => 'application/json'})\n req.body = data\n\n puts 'Sending PUT request to ' + url.to_s\n\n send_request(url, req)\n end", "def api_put(path, data = {})\n api_request(:put, path, :data => data)\n end", "def update_field(key,field,value)\n request :put, \"#{path_prefix}records/#{ue key}?field=#{ue field}\",\n :body => value,\n :content_type => \"application/octet-stream\"\n end", "def put(path, **args); end", "def handle_put_request\n @request.records.each do |record|\n file = DataFile.storing(@request.uuid, record.time)\n file << record\n file.close\n end\n\n send_data [@request.record_count].pack('L')\n end", "def put(key, value); end", "def put(resource_name, id, params, locale = nil)\n params_name = resource_name.to_s.split('/').last.singularize\n\n query = { query: { params_name => params } }\n\n query[:query][:locale] = locale if locale\n\n response = Locomotive::Mounter::EngineApi.put(\"/#{resource_name}/#{id}.json\", query)\n data = response.parsed_response\n\n if response.success?\n self.raw_data_to_object(data)\n else\n message = data\n\n message = data.map do |attribute, errors|\n \" #{attribute} => #{[*errors].join(', ')}\" #.colorize(color: :red)\n end.join(\"\\n\") if data.respond_to?(:keys)\n\n raise WriterException.new(message)\n\n # data.each do |attribute, errors|\n # self.log \"\\t\\t #{attribute} => #{[*errors].join(', ')}\".colorize(color: :red)\n # end if data.respond_to?(:keys)\n # nil\n end\n end", "def put(message)\n message.recipient ||= self.tube_name\n raise \"message invalid: #{message.errors}\" unless message.valid?\n @tube.put message.to_json\n end", "def put(msg)\n socket.write(msg + \"\\n\") if socket\n end", "def put(id, data)\n jss = self.get_structure() # For referencing purposes\n\n input = self.query_to_hash(data)\n bad_request = false\n resp = nil\n input.each do |key, value|\n # Check if we have it on the structure too\n unless jss.has_key? key\n resp = MIDB::Interface::Server.json_error(400, \"Bad Request - Wrong argument #{key}\")\n @engine.http_status = 400\n bad_request = true\n end\n end\n\n # Check if the ID exists\n db = MIDB::API::Dbengine.new(@engine.config, @db)\n dbc = db.connect()\n dbq = db.query(dbc, \"SELECT * FROM #{self.get_structure.values[0].split('/')[0]} WHERE id=#{id};\")\n unless db.length(dbq) > 0\n resp = MIDB::Interface::Server.json_error(404, \"ID not found\")\n @engine.http_status = 404\n bad_request = true\n end\n \n # Update the values if we have a good request\n unless bad_request\n fields = Hash.new\n inserts = Hash.new\n where_clause = Hash.new\n main_table = self.get_structure.values[0].split('/')[0]\n where_clause[main_table] = \"id=#{id}\"\n input.each do |key, value|\n struct = jss[key]\n table = struct.split(\"/\")[0]\n inserts[table] ||= []\n fields[table] ||= []\n inserts[table].push \"\\\"\" + value + \"\\\"\"\n fields[table].push struct.split(\"/\")[1]\n if struct.split(\"/\").length > 2\n match = struct.split(\"/\")[2]\n matching_field = match.split(\"->\")[0]\n row_field = match.split(\"->\")[1]\n where_clause[table] = \"#{matching_field}=(SELECT #{row_field} FROM #{main_table} WHERE #{where_clause[main_table]});\"\n end\n end\n queries = []\n updates = Hash.new\n # Turn it into a hash\n inserts.each do |table, values|\n updates[table] ||= Hash.new\n updates[table] = Hash[fields[table].zip(inserts[table])]\n query = \"UPDATE #{table} SET \"\n updates[table].each do |f, v|\n query = query + \"#{f}=#{v} \"\n end\n queries.push query + \"WHERE #{where_clause[table]};\"\n end\n # Run the queries\n results = []\n queries.each do |q|\n results.push db.query(dbc, q)\n end\n @engine.http_status = \"200 OK\"\n resp = {status: \"200 OK\"}\n end\n return resp\n end", "def put(value)\n $_api_queue.clear\n puts \"#{ApiSettings::API_PUT_PREFIX}#{value.to_s}#{ApiSettings::API_CMD_SUFFIX}\"\nend", "def put(path, params)\n parse_response @client[path].put(params)\n end", "def put(*params); raise('Stub or mock required.') end", "def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end", "def put(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_put(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end", "def create_method\n :put_json\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 put(path = nil, options = {})\n connection.put(path, options)\n end", "def put(*args, &block); end", "def put(data, opts={})\n self.fd.put(data, opts={})\n end", "def put(body, headers = { })\n body, headers = normalize_message(body, headers)\n SMQueue.dbg { [:smqueue, :put, body, headers].inspect }\n begin\n self.connect\n headers = {:persistent => true, :ack => \"auto\", :expires => SMQueue.calc_expiry_time(configuration.expires) }.merge(headers)\n destination = configuration.name\n SMQueue.dbg { [:smqueue, :send, body, headers].inspect }\n connection.send destination, body, headers\n rescue Exception => e\n SMQueue.dbg { [:smqueue, :exception, e].inspect }\n handle_error e, \"Exception in SMQueue#put - #{e.message}\", caller\n #connection.disconnect\n ensure\n connection.disconnect\n end\n end", "def put_request(path, params={}, options={})\n request(:put, path, params, options)\n end", "def set(key, value)\n response = db.put_item(@table_name, {'id' => {'S' => key}, 'value' => {'S' => value}})\n true\n end", "def put(path, **options)\n execute :put, path, options\n end", "def put(path, *data, &block)\n map(path, R3::PUT, *data, &block)\n end", "def do_put(uri = '', body = '')\n build_request(:put, uri, body)\n end", "def message(twitt)\n @client.update(twitt)\n end", "def put url, payload\n RestClient::Request.execute(:method => :put, :url => url, :payload => payload, :headers => lbaas_headers, :timeout => @timeout, :open_timeout => @open_timeout)\n end", "def put(namespace, key, entry); end", "def put(path, data={})\n request(:put, path, data)\n end", "def update!(**args)\n @format = args[:format] if args.key?(:format)\n @key = args[:key] if args.key?(:key)\n end", "def update!(**args)\n @format = args[:format] if args.key?(:format)\n @key = args[:key] if args.key?(:key)\n end", "def _http_put resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Put.new(path)\n _build_request resource, request\nend", "def _http_put resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Put.new(path)\n _build_request resource, request\nend", "def update_message(data); end", "def update_message(data); end", "def put(path, options={})\n send_request 'put', path, options\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update(*args)\n put(*args)\n end", "def update(*args)\n put(*args)\n end", "def put(path, data = {})\n # Allow format override\n format = data.delete(:format) || @format\n # Clear cache\n expire_matching \"#{parent_path(path)}.*\"\n # Extract return unit params\n query_params = {}\n query_params[:returnUnit] = data.delete(:returnUnit) if data[:returnUnit]\n query_params[:returnPerUnit] = data.delete(:returnPerUnit) if data[:returnPerUnit]\n # Create PUT request\n put_params = {\n :verbose => DEBUG,\n :method => \"put\",\n :body => form_encode(data)\n }\n put_params[:params] = query_params unless query_params.empty?\n put = Typhoeus::Request.new(\"#{protocol}#{@server}#{path}\", put_params)\n # Send request\n do_request(put, format)\n end", "def put(request, response)\n write(request.body)\n Created\n end", "def put(request, response)\n write(request.body)\n Created\n end", "def write(key, value)\n @dao.collection.save({ '_id' => key, 'v' => value })\n end", "def put_collection_key(args)\n\tapi_url = \"#{@base_url}/#{args[:collection]}/#{args[:key]}\"\n\tputs do_the_put_call( url: api_url, user: @user, json: args[:json] )\nend", "def write(key, value)\n perform_update(:write, key, value.to_s)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def orchio_put(jdoc)\n response = client.send_request :put, inst_args(json: jdoc)\n if cache.enabled?\n simple_cache.save(\n Document.new(\n response.body.to_hash,\n Metadata.new(\n :collection => ocollection,\n :key => @id,\n :ref => response.header.etag\n )))\n end\n set_ref_value response\n orchio_status response, 201\n end", "def write(key, content)\n bucket.objects[key].write(content)\n end", "def put(request)\n do_request(request) { |client| client.http_put request.body }\n end", "def test_put_delete_put\n skip \"https://issues.apache.org/jira/browse/HBASE-2847\"\n\n rowkey = next_rowkey\n data = { 'cf1:pdp' => { 1250000000000 => 'A1' } }\n @table.put rowkey => data\n assert_equal 'A1', @table.get(rowkey).string('cf1:pdp')\n @table.delete rowkey\n assert_nil @table.get(rowkey)\n @table.put rowkey => data\n assert_equal 'A1', @table.get(rowkey).string('cf1:pdp')\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def perform_put(path, options = {})\n perform_request(:put, path, options)\n end", "def put_object(bucket_name, key, data, content_md5, content_length, options, &block)\n if content_length > MAX_PUT_OBJECT_LENGTH\n raise BceClientException.new(\"Object length should be less than #{MAX_PUT_OBJECT_LENGTH}. Use multi-part upload instead.\")\n end\n\n headers = {\n CONTENT_MD5 => content_md5,\n CONTENT_LENGTH => content_length,\n }\n headers.merge! options\n headers[CONTENT_TYPE] = OCTET_STREAM_TYPE if headers[CONTENT_TYPE].nil?\n populate_headers_with_user_metadata(headers) unless headers['user-metadata'].nil?\n send_request(PUT, bucket_name, {}, key, headers, data, &block)\n end", "def put_record(stream, key, value)\n raise NotImplementedError\n end", "def put(path, data, params = {}, request_options = {})\n request(:put, path, data, params)\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def put path, payload\n response = connection.put path, payload\n return true if response.empty?\n return symbolize_keys(response.keys, response)\n end", "def put(uri, options = {})\n if options[:multipart]\n form_input = build_multipart_data(options)\n build_response(request.put(uri, build_request_options({\"CONTENT_TYPE\" => \"multipart/form-data, boundary=Mack-boundary\", \"CONTENT_LENGTH\" => form_input.size, :input => form_input})))\n else\n build_response(request.put(uri, build_request_options({:input => options.to_params})))\n end\n end", "def put(path, data = {})\n request 'PUT', path, body: data.to_json\n end", "def put(path, options={})\n request :put, path, options\n end", "def put(data = nil, options = nil)\n options ||= {}\n options[:method] = :put\n call data, options\n end" ]
[ "0.6647159", "0.6628743", "0.6471865", "0.6426028", "0.6417919", "0.63964677", "0.62966514", "0.62548083", "0.6231688", "0.62138885", "0.6212708", "0.61596", "0.6158979", "0.6150119", "0.6097271", "0.60462946", "0.6043436", "0.603539", "0.602856", "0.5995085", "0.5976601", "0.59764165", "0.59764165", "0.597434", "0.5967356", "0.595035", "0.594888", "0.59330374", "0.5909968", "0.5906086", "0.5898748", "0.58983165", "0.58916074", "0.58694834", "0.5864891", "0.5848146", "0.5844151", "0.58439106", "0.5813958", "0.5811263", "0.5771341", "0.5737102", "0.5735181", "0.5732214", "0.5729567", "0.57209325", "0.5718207", "0.571353", "0.56917596", "0.5688586", "0.5687872", "0.5678574", "0.5674218", "0.56684154", "0.5623432", "0.5621207", "0.56126183", "0.5589493", "0.5588025", "0.5587009", "0.5574091", "0.5571197", "0.5558478", "0.5558478", "0.5558176", "0.5557067", "0.5554809", "0.5554809", "0.55533165", "0.5549937", "0.554989", "0.554989", "0.5547873", "0.55427766", "0.55427766", "0.55411625", "0.55355453", "0.55331707", "0.5511455", "0.5511455", "0.5511455", "0.5511455", "0.5511455", "0.5511455", "0.5511455", "0.5511455", "0.55038047", "0.5496124", "0.54941416", "0.5492659", "0.5486319", "0.54842806", "0.54809844", "0.54733443", "0.5472756", "0.5470339", "0.5470034", "0.5469274", "0.5468309", "0.5467261", "0.54653037" ]
0.0
-1
returns the worker method name, given the routing string.
def method_name(queue) queue.split("__").last end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exchange_name\n \"#{worker_class_name}_#{job_method}\".downcase\n end", "def route_name; end", "def route_name; end", "def route_prefix_to_method_name(method)\n \"#{route_prefix + \"_\" if route_prefix}#{method}\"\n end", "def route_name\n @route_name || default_route_name\n end", "def method_name\n return @method_name if defined? @method_name\n\n @method_name = protocol_name.downcase.sub(/::/, '_')\n end", "def method_name\n m = @method_stack.first || @@no_method\n m = \"##{m}\" unless m =~ /::/\n m\n end", "def method_name\n m = @method_stack.first || @@no_method\n m = \"##{m}\" unless m =~ /::/\n m\n end", "def process_name\n # NOTE MEthod also in helper\n controller = Rails.application.routes.recognize_path(request.path)[:controller]\n process = controller.split(\"/\").first\n end", "def route_path(route_name)\n \"#{prefix}/#{public_send(:\"#{route_name}_route\")}\"\n end", "def action_name\n name = self.request.route_obj.instance_variable_get('@named').to_s\n name.gsub!(/^#{controller_name}_?/, '')\n name = 'index' if name == ''\n name\n end", "def route_for routename\n case routename\n when 'Start'\n \"index\"\n when 'Login'\n \"login\"\n when 'Mitarbeiterübersicht'\n \"employees\"\n when 'Neuer Mitarbeiter'\n \"employees.new\"\n when 'FAQ'\n \"faq\"\n else\n raise \"No route defined for route named '#{routename}'.\"\n end\nend", "def method_name\n self.fullname[/\\A(.*)([\\.\\#])([^\\.\\#]+)\\z/, 3]\n end", "def get_Method(initial)\n\tinitial.split(' ',3)[0]\nend", "def caller_method_name\n parse_caller(caller(2).first).last\n end", "def singularized_method_name method\n (method.predicate? ? method[0..-2] : method).singularize.to_sym\n end", "def lookup_method(recv, name)\n key = if recv\n [recv.class.name.to_sym, name]\n else\n [nil, name]\n end\n \n @methods[key]\n end", "def route(index_or_name)\n case index_or_name\n when Integer\n Rails.application.routes.routes[index_or_name]\n when Symbol # named route\n Rails.application.routes.named_routes.get index_or_name\n end\nend", "def method\n self.class.name.split('::').last || ''\n end", "def method_name\r\n method_info[:method_name]\r\n end", "def event_name_for(path)\n \"#{decider}_#{path}\".to_sym\n end", "def bus_route_name\n bus_route.try(:name)\n end", "def retrieve_command_name(args) #:nodoc:\n meth = args.first.to_s unless args.empty?\n args.shift if meth && (map[meth] || meth !~ /^\\-/)\n end", "def get_delivery_method\n if defined?(controller) && controller.present? && controller.params.present?\n controller_name = params[:controller]\n action_name = params[:action]\n \"#{controller_name}_#{action_name}\"\n else\n nil\n end\n end", "def specialize_method_name( name )\n return \"#{name}#{self.class.name.split(\"::\")[-1].gsub(/[A-Z]/){|s| \"_#{s.downcase}\"}}\".intern\n end", "def route_localize_route_name\n Rails.application.routes.router.recognize(request) do |route, *_|\n return route.name.to_s.sub(/_#{I18n.locale}$/, '')\n end\n end", "def ga_to_method_name(name)\n snakecase(name.gsub(/\\Aga:/, \"\")).to_sym\n end", "def routing_key_for(method, routing_key_name)\n @_routing_key_names ||= {}\n @_routing_key_names[method] = routing_key_name\n end", "def name\n name_priorities.each do |method|\n n = send(method)\n return n unless n.blank?\n end\n end", "def get_route( request )\n return nil unless defined?( RAILS_ENV ) \n ::ActionController::Routing::Routes.recognize_path( request.path, {:method => request.request_method.downcase.to_sym } )\n end", "def name\n parent_uri = self.parent.uri.to_s\n if not parent_uri.end_with?(\"/ROs/\")\n # Evil hack\n parent_uri += \"/ROs/\"\n end\n return URI.parse(parent_uri).route_to(self.uri.to_s).to_s\n end", "def get_requested_route(env)\n request = Rack::Request.new(env)\n \n http_method = request.request_method.downcase\n path = request.path_info\n\n [http_method, path]\n end", "def action_for route\n raise \"Argument must be an Endpoint\" unless Endpoint === route\n action = @prefix[-1]\n action = PARAM_ROUTES[route[:method]] if self.action_mode == :param\n action = RESOURCE_ROUTES[route[:method]] if self.route_mode == :resource && self.action_mode == :collection\n action\n end", "def caller_method_name\n parse_caller(caller(2).first).last\nend", "def name\n \"#{@method_name}(#{self.class.name})\"\n end", "def class_name method_name\n segments = method_name.split('::')\n return segments[0..-2].join('::') if segments.count > 1\n \"Object\"\nend", "def worker_name\n @client.worker_name\n end", "def get_action_name( txn, id=nil, *args )\n\t\thttp_method = txn.request_method\n\t\tself.log.debug \"Looking up service action for %s %s (%p)\" %\n\t\t\t[ http_method, txn.uri, args ]\n\n\t\ttuple = METHOD_MAPPING[ txn.request_method ] or return :not_allowed\n\t\tself.log.debug \"Method mapping for %s is %p\" % [ txn.request_method, tuple ]\n\n\t\tif args.empty?\n\t\t\tself.log.debug \" URI refers to top-level resource\"\n\t\t\tmsym = tuple[ id ? 1 : 0 ]\n\t\t\tself.log.debug \" picked the %p method (%s ID argument)\" %\n\t\t\t\t[ msym, id ? 'has an' : 'no' ]\n\n\t\telse\n\t\t\tself.log.debug \" URI refers to a sub-resource (args = %p)\" % [ args ]\n\t\t\tops = args.collect {|arg| arg[/^([a-z]\\w+)$/, 1].untaint }\n\n\t\t\tmname = \"%s_%s\" % [ tuple[1], ops.compact.join('_') ]\n\t\t\tmsym = mname.to_sym\n\t\t\tself.log.debug \" picked the %p method (args = %p)\" % [ msym, args ]\n\t\tend\n\n\t\treturn msym, id, *args\n\tend", "def intended_delivery_method(method)\n if method.to_s =~ /\\A(\\w+)_later\\Z/\n method = $1\n end\n method.to_sym\n end", "def routing_number; end", "def operator_method(string)\n known_operations[string]\n end", "def routes\n [@name.downcase]\n end", "def name()\n if bound?\n return bound_name\n end\n if label && label.match(/[a-zA-Z][a-zA-Z0-9_]*/) != nil\n return label\n end\n return uri.split(/(\\/|#)/).last\n end", "def get_destination(destination, routing_params = {})\n if destination.respond_to?(:call)\n return destination\n end\n\n #if destination is something like books#welcome\n if destination =~ /^([^#]+)#([^#]+)$/\n #name will be Books\n name = $1.capitalize\n #controller will be the Constant BooksController\n controller = Object.const_get(\"#{name}Controller\")\n #ah, now here we use the class.action from above. passing in\n #welcome as the action, and routing params as the response object\n return controller.action($2, routing_params)\n end\n #otherwise we messed up by coming here\n raise \"Destination no found: #{destination}\"\n end", "def protocol\n m = @properties['METHOD']\n m ? m.upcase : m\n end", "def endpoint_name\n self.name.split('::').last.downcase\n end", "def scout_sinatra_controller_name(request)\n name = 'unknown'\n verb = request.request_method if request && request.respond_to?(:request_method) \n Array(self.class.routes[verb]).each do |pattern, keys, conditions, block|\n if pattern = process_route(pattern, keys, conditions) { pattern.source }\n name = pattern\n end\n end\n name.gsub!(%r{^[/^]*(.*?)[/\\$\\?]*$}, '\\1')\n if verb\n name = [verb,name].join(' ')\n end\n name\n end", "def method_symbol\r\nHTTP_METHOD_LOOKUP[method]\r\nend", "def parse_method(method)\n method.downcase.to_sym\n end", "def request_method_symbol\r\nHTTP_METHOD_LOOKUP[request_method]\r\nend", "def route_name_for_padrino(request)\n request.route_obj.original_path\n rescue\n nil\n end", "def request_queue_name(name)\n \"fluffle.requests.#{name}\"\n end", "def controller_name\n path = segments[2..-2].join('/')\n path < 'a' ? path : camelize(path)+\"Controller\"\n end", "def run(type, args)\n worker = @routing[type]\n method = @routing.method_name(type)\n worker.dispatch_to_worker_method(method, args)\n end", "def name\n $0.split(\"/\").last\n end", "def route_name new_route_name=nil\n\n # getter\n if new_route_name.nil? || new_route_name.empty?\n if @route_name.nil? || @route_name.empty?\n\n (@route_name_prefix.to_s.empty? ? \"\" : \"#{@route_name_prefix}_\") +\n self.name.underscore\n else\n @route_name\n end\n\n # setter\n else\n @route_name = new_route_name\n end\n end", "def map_name(name)\n # HACK: get from zentest\n name = METHOD_MAP[name] if METHOD_MAP.has_key? name\n name.to_s.sub(/(.*)\\?$/, 'is_\\1').intern\n end", "def name\n \"#{self.class.name}::#{@method_name}()\"\n end", "def controller_name\n self.request.route_obj.instance_variable_get('@controller')\n end", "def model_route\n @model_name.to_s\n end", "def queue_key\n result = queue_name\n result = try(:arguments).presence && result.call if result.is_a?(Proc)\n result&.to_sym\n end", "def handler_for(rjr_method)\n # look for exact match first\n handler = @handlers.find { |k,v| k == rjr_method }\n\n # if not found try to match regex's\n handler ||= @handlers.find { |k,v| k.is_a?(Regexp) && (k =~ rjr_method) }\n\n handler.nil? ? nil : handler.last\n end", "def method\n return @method if defined? @method\n @method = headers[METHOD_KEY]\n @method = @method.downcase.to_sym if @method\n @method\n end", "def method_name(payload_object)\n if payload_object.respond_to?(:method_name)\n payload_object.method_name\n else\n # early versions of Delayed Job override Object#method with the method name\n payload_object.method\n end\n end", "def name\n self.class.to_s.gsub(/controller$/i, \"\")\n end", "def method_missing(method, *args)\n if method =~ /current_(.*)/\n return path_part( @parts[$1.to_sym] ) if @parts.has_key?($1.to_sym)\n end\n\n super\n end", "def worker_class_constantize(worker_class)\n return worker_class unless worker_class.is_a?(String)\n worker_class.constantize\n rescue NameError\n worker_class\n end", "def method\n env[:method].to_s.upcase\n end", "def method\n parse_request! if @method.nil?\n @method\n end", "def dispatch_method_names(command, type = 'bot')\n [type + '_' + command.join('_').downcase,\n type + '_' + command.first.downcase]\n end", "def name\n @name ||= path.split('/').last\n end", "def normalize_command_name(meth) #:nodoc:\n return default_command.to_s.tr(\"-\", \"_\") unless meth\n\n possibilities = find_command_possibilities(meth)\n raise AmbiguousTaskError, \"Ambiguous command #{meth} matches [#{possibilities.join(', ')}]\" if possibilities.size > 1\n\n if possibilities.empty?\n meth ||= default_command\n elsif map[meth]\n meth = map[meth]\n else\n meth = possibilities.first\n end\n\n meth.to_s.tr(\"-\", \"_\") # treat foo-bar as foo_bar\n end", "def funcname\n NAMES[@name][1]\n end", "def this_method_name\n caller[0] =~ /`([^']*)'/ and $1\n end", "def this_method_name\n caller[0] =~ /`([^']*)'/ and $1\n end", "def this_method_name\n caller[0] =~ /`([^']*)'/ and $1\n end", "def computed_name(context)\n @_name ||= case @name\n when String\n @name\n when Symbol\n context.public_send(@name) # todo\n when Proc\n context.instance_exec(&@name)\n when nil\n computed_path(context)\n else\n raise ArgumentError,\n \"Expected one of String, Symbol, or Proc, \" \\\n \"got #{@name.class}\"\n end\n end", "def route_for(name, *args); end", "def method\n link_schema['method'].downcase.to_sym\n end", "def scraping_task_method(task_name)\n \"scrape_#{task_name}\"\n end", "def get_method\n request_object.method\n end", "def name\n @queue_string\n end", "def method_missing(method_id, params = {})\n request(method_id.id2name.gsub(/_/, '.'), params)\n end", "def route() request.route end", "def queue_for(method, queue_name)\n @_queue_names ||= {}\n @_queue_names[method] = queue_name\n end", "def make_handler_method_name( pattern, block )\n\t\t\t_, line = block.source_location\n\t\t\tpattern = pattern.\n\t\t\t\tgsub( /#/, 'hash' ).\n\t\t\t\tgsub( /\\*/, 'star' ).\n\t\t\t\tgsub( /\\./, '_' )\n\n\t\t\treturn \"on_%s_%d\" % [ pattern, line ]\n\t\tend", "def method\n if !block_given?\n return @j_del.java_method(:method, []).call().name.intern\n end\n raise ArgumentError, \"Invalid arguments when calling method()\"\n end", "def resource_name\n name.to_s.chomp('Controller').demodulize.singularize\n end", "def this_method_name\n caller[0] =~ /`([^']*)'/ and $1\n end", "def worker_class_constantize(worker_class)\n if worker_class.is_a?(String)\n if worker_class.respond_to?(:constantize)\n worker_class.constantize\n else\n # duplicated logic from Rails 3.2.13 ActiveSupport::Inflector\n # https://github.com/rails/rails/blob/9e0b3fc7cfba43af55377488f991348e2de24515/activesupport/lib/active_support/inflector/methods.rb#L213\n names = worker_class.split('::')\n names.shift if names.empty? || names.first.empty?\n constant = Object\n names.each do |name|\n constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)\n end\n constant\n end\n else\n worker_class\n end\n rescue\n worker_class\n end", "def get_name(path)\n return path[/^.*\\/(.+?)\\/?$/, 1]\n end", "def method(name)\n component.method(name.to_sym)\n end", "def inspect\n route.to_s\n end", "def route\n @route ||= Role.available_routes.find {|r| r.conditions[:path_info].to_s == path_info && r.conditions[:request_method].to_s == request_method}\n end", "def Method\n NameMailer.Method\n end", "def add_method_name(current_string)\n adjusted_method_name = if @method_name.present? && (@method_name[0] == '/' || @method_name[0] == '.')\n log_hint(BuilderHints::METHOD_NAME_LEADING)\n \"#{@method_name} \"\n else\n \"/#{@method_name} \"\n end\n add_if_present(@method_name, current_string, adjusted_method_name)\n end", "def [](name)\n delivery_methods[name.to_sym]\n end", "def to_sym\n self.class.endpoint_name.to_sym\n end", "def resource_name\n @@resource_name ||= self.class.to_s.split('::').last.gsub('Controller', '').singularize.underscore\n end", "def plugin_name\n name.split('::').last.underscore.to_sym\n end" ]
[ "0.66431427", "0.6123058", "0.6123058", "0.60569453", "0.6002618", "0.5943787", "0.58222353", "0.58222353", "0.58106875", "0.5762752", "0.5702368", "0.5665815", "0.5648369", "0.56248045", "0.561237", "0.5606944", "0.56054085", "0.55966467", "0.55616003", "0.55559224", "0.5524905", "0.5523528", "0.551798", "0.54848313", "0.54769516", "0.547148", "0.54626787", "0.538784", "0.5378116", "0.53576666", "0.53478974", "0.5341045", "0.5331983", "0.5330916", "0.5329571", "0.53253424", "0.5316363", "0.5297214", "0.52805555", "0.5252614", "0.5234087", "0.5230355", "0.52298635", "0.51998794", "0.51990855", "0.5193267", "0.5192952", "0.5191859", "0.5191734", "0.51872456", "0.5175746", "0.5172498", "0.5171044", "0.51659703", "0.51638615", "0.5162026", "0.5157438", "0.51457167", "0.51275176", "0.51201963", "0.5114513", "0.51103574", "0.5101458", "0.50870305", "0.5085048", "0.508195", "0.5070239", "0.50701576", "0.50672966", "0.5065215", "0.5064302", "0.50600845", "0.5058683", "0.5047232", "0.5047232", "0.5047232", "0.504501", "0.50426614", "0.5040782", "0.5036632", "0.50284064", "0.50260466", "0.5024926", "0.5016652", "0.50137913", "0.5000723", "0.49943373", "0.4990967", "0.49866852", "0.4983521", "0.49773955", "0.4975919", "0.49741164", "0.49673334", "0.49652964", "0.4963781", "0.4957124", "0.495096", "0.4942522", "0.49382237" ]
0.6728938
0
returns the routing string, given a class and method. delegating.
def queue_for(clazz, method) ClassAndMethodRouting.queue_for(clazz, method) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inspect\n route.to_s\n end", "def route_prefix_to_method_name(method)\n \"#{route_prefix + \"_\" if route_prefix}#{method}\"\n end", "def route_name; end", "def route_name; end", "def short_route\n @short_route ||= begin\n sr = \"#{objet}\" # sinon, passage par référence avec '<<' ci-dessous\n method && sr << \"/#{method}\"\n sr\n end\n end", "def full_route\n @parent ? (ancestors.reverse + [self]).map(&:route).join('/').squeeze('/') : route\n end", "def method\n self.class.name.split('::').last || ''\n end", "def bonsai_method_path(m, klass)\n k = klass.class.to_s.underscore.pluralize.singularize\n case(m)\n when \"new\" then link_to \"nuevo\", send(\"new_#{k}_path\", klass)\n when \"show\" then link_to \"ver\", klass, :class => \"show_icon\", :title => \"Ver\"\n when \"edit\" then link_to \"editar\", send(\"edit_#{k}_path\", klass), :class => \"edit\", :title => \"Editar\"\n when \"destroy\" then link_to \"borrar\", klass, :method => :delete, :class => \"delete\", :title => \"Borrar\", :confirm => 'Esta seguro de borrar el item seleccionado', :remote => true\n else \"\"\n end\n end", "def routes_method\n @routes_method ||= Proc.new do\n base_application.routes.routes.map do |route|\n next unless route.defaults.has_key?(:controller) &&\n controller_const = \"#{route.defaults[:controller]}_controller\"\n .classify\n .constantize rescue nil\n\n http_methods = (\n route.verb.is_a?(Regexp) ?\n route.verb.inspect.gsub(/[\\/\\$\\^]/, '') :\n route.verb\n ).split(\"|\")\n\n {\n alias: route.name,\n path: route.path.spec.to_s,\n controller_name: route.defaults[:controller],\n controller: controller_const,\n action: route.defaults[:action],\n http_methods: http_methods\n }\n end.compact\n end\n end", "def define_routable_methods router_class\n define_method router_class.route_name_method_name do \n router_class.route_name self\n end\n \n define_method router_class.url_method_name do \n router_class.url self\n end\n \n define_method router_class.path_method_name do \n router_class.path self\n end\n end", "def route\n @route\n end", "def routeable(method, opts={})\n ctrlr_m = method.to_sym\n opts[:via] = Array.wrap(opts[:via] || :get).map{|hm|hm.to_sym}\n\n AutoRouter::Router.map_route(self, ctrlr_m, opts)\n end", "def route\n \"#{@http_verb.to_s.upcase} #{@url}\"\n end", "def route\n @route ||= Role.available_routes.find {|r| r.conditions[:path_info].to_s == path_info && r.conditions[:request_method].to_s == request_method}\n end", "def to_class_name\n self.to_method_name.gsub(/\\/(.?)/) { \"#{$1.upcase}\" }.gsub(/(?:^|_)(.)/) { $1.upcase }\n end", "def account_type_to_route(class_string)\n account_type_to_param(class_string).sub(/_account\\z/, \"\").pluralize\n end", "def inspect\n return \"#<GentleREST::Route:0x#{self.object_id.to_s(16)} \" +\n \"PATTERN:#{self.pattern.inspect} \" +\n \"CONTROLLER:#{self.controller.class.to_s}>\"\n end", "def route_path(route_name)\n \"#{prefix}/#{public_send(:\"#{route_name}_route\")}\"\n end", "def action_for route\n raise \"Argument must be an Endpoint\" unless Endpoint === route\n action = @prefix[-1]\n action = PARAM_ROUTES[route[:method]] if self.action_mode == :param\n action = RESOURCE_ROUTES[route[:method]] if self.route_mode == :resource && self.action_mode == :collection\n action\n end", "def class_name method_name\n segments = method_name.split('::')\n return segments[0..-2].join('::') if segments.count > 1\n \"Object\"\nend", "def url_for(controller, method_sym, params = {})\n Plezi::Base::Router.url_for controller, method_sym, params\n end", "def get_requested_route(env)\n request = Rack::Request.new(env)\n \n http_method = request.request_method.downcase\n path = request.path_info\n\n [http_method, path]\n end", "def route() request.route end", "def to_s\n\n output = \"\"\n\n path = \"/\" + @prefix.join('/')\n @endpoints.each do |route|\n output += \"#{route[:method].to_s.upcase} #{path}\\n\"\n end\n @subroutes.each do |k, subroute|\n output += subroute.to_s\n end\n\n output\n\n end", "def ri(method = nil)\n unless method && method =~ /^[A-Z]/ # if class isn't specified\n klass = self.kind_of?(Class) ? name : self.class.name\n method = [klass, method].compact.join('#')\n end\n puts `ri '#{method}'`\n end", "def ri(method = nil)\n unless method && method =~ /^[A-Z]/ # if class isn't specified\n klass = self.kind_of?(Class) ? name : self.class.name\n method = [klass, method].compact.join('#')\n end\n puts `ri '#{method}'`\n end", "def ri(method = nil)\n unless method && method =~ /^[A-Z]/ # if class isn't specified\n klass = self.kind_of?(Class) ? name : self.class.name\n method = [klass, method].compact.join('#')\n end\n puts `ri '#{method}'`\n end", "def ri(method = nil)\n unless method && method =~ /^[A-Z]/ # if class isn't specified\n klass = self.kind_of?(Class) ? name : self.class.name\n method = [klass, method].compact.join('#')\n end\n puts `ri '#{method}'`\n end", "def ri(method = nil)\n unless method && method =~ /^[A-Z]/ # if class isn't specified\n klass = self.kind_of?(Class) ? name : self.class.name\n method = [klass, method].compact.join('#')\n end\n puts `ri '#{method}'`\n end", "def ri(method = nil)\n unless method && method =~ /^[A-Z]/ # if class isn't specified\n klass = self.kind_of?(Class) ? name : self.class.name\n method = [klass, method].compact.join('#')\n end\n puts `ri '#{method}'`\n end", "def ri(method = nil)\n unless method && method =~ /^[A-Z]/ # if class isn't specified\n klass = self.kind_of?(Class) ? name : self.class.name\n method = [klass, method].compact.join('#')\n end\n puts `ri '#{method}'`\n end", "def ri(method = nil)\n unless method && method =~ /^[A-Z]/ # if class isn't specified\n klass = self.kind_of?(Class) ? name : self.class.name\n method = [klass, method].compact.join('#')\n end\n puts `ri '#{method}'`\n end", "def ri(method = nil)\n unless method && method =~ /^[A-Z]/ # if class isn't specified\n klass = self.kind_of?(Class) ? name : self.class.name\n method = [klass, method].compact.join('#')\n end\n puts `ri '#{method}'`\n end", "def ri(method = nil)\n unless method && method =~ /^[A-Z]/ # if class isn't specified\n klass = self.kind_of?(Class) ? name : self.class.name\n method = [klass, method].compact.join('#')\n end\n puts `ri '#{method}'`\n end", "def ri(method = nil)\n unless method && method =~ /^[A-Z]/ # if class isn't specified\n klass = self.kind_of?(Class) ? name : self.class.name\n method = [klass, method].compact.join('#')\n end\n puts `ri '#{method}'`\n end", "def route_and_method_from_resource_method_and_name_prefix(method, name_prefix)\n route_method = method.to_s.sub(/resource(s)?/) { $1 ? \"#{name_prefix}#{route_name.pluralize}\" : \"#{name_prefix}#{route_name}\" }\n return [ActionController::Routing::Routes.named_routes.get(route_method.sub(/_(path|url)$/,'').to_sym), route_method]\n end", "def method_name\n m = @method_stack.first || @@no_method\n m = \"##{m}\" unless m =~ /::/\n m\n end", "def method_name\n m = @method_stack.first || @@no_method\n m = \"##{m}\" unless m =~ /::/\n m\n end", "def ri(method = nil)\n unless method && method =~ /^[A-Z]/ # if class isn't specified\n klass = self.kind_of?(Class) ? name : self.class.name\n method = [klass, method].compact.join('#')\n end\n puts `ri '#{method}'`\n\n end", "def route_name\n @route_name || default_route_name\n end", "def full_name\n decorated_class_name = case self.klass_flags\n when 0x2\n \"<Class::#{klass_name}>\"\n when 0x4\n \"<Module::#{klass_name}>\"\n when 0x8\n \"<Object::#{klass_name}>\"\n else\n klass_name\n end\n\n \"#{decorated_class_name}##{method_name}\"\n end", "def get_route( request )\n return nil unless defined?( RAILS_ENV ) \n ::ActionController::Routing::Routes.recognize_path( request.path, {:method => request.request_method.downcase.to_sym } )\n end", "def parse_route(dn, method)\n route, action = @routes.match(\"#{dn},op=#{method.to_s}\")\n if not route or route.empty?\n @logger.warn \"No route defined for \\'#{route}\\'\"\n raise LDAP::ResultError::UnwillingToPerform\n end\n if action.nil?\n @logger.error \"No action defined for route \\'#{route}\\'\"\n raise LDAP::ResultError::UnwillingToPerform\n end\n\n class_name = action.split('#').first\n method_name = action.split('#').last\n\n params = LDAP::Server::DN.new(\"#{dn},op=#{method.to_s}\").parse(route)\n\n return class_name, method_name, params\n end", "def to_s\n \"#{http_methods.join(\" / \")} #{path}\"\n end", "def routes\n [@name.downcase]\n end", "def route_and_method_from_enclosing_resource_method_and_name_prefix(method, name_prefix)\n if enclosing_resource\n enclosing_route = name_prefix.sub(/_$/,'')\n route_method = method.to_s.sub(/enclosing_resource(s)?/) { $1 ? enclosing_route.pluralize : enclosing_route }\n return [ActionController::Routing::Routes.named_routes.get(route_method.sub(/_(path|url)$/,'').to_sym), route_method]\n else\n raise NoMethodError, \"Tried to map :#{method} but there is no enclosing_resource for this controller\"\n end\n end", "def method_missing(method_id, params = {})\n request(method_id.id2name.gsub(/_/, '.'), params)\n end", "def routing_number; end", "def url_for(options, route_name = T.unsafe(nil), url_strategy = T.unsafe(nil), method_name = T.unsafe(nil), reserved = T.unsafe(nil)); end", "def meth_to_s\n @meth_to_s ||=\n \"#{@mod}#{@kind == :instance ? INSTANCE_SEP : MODULE_SEP}#{@meth}\".freeze\n end", "def ri(method = nil)\n\t unless method && method =~ /^[A-Z]/ # if class isn't specified\n\t klass = self.kind_of?(Class) ? name : self.class.name\n\t method = [klass, method].compact.join('#')\n\t end\n\t puts `ri '#{method}'`\n\tend", "def route\n #TODO\n end", "def define_resource_named_route_helper_method(method)\n self.class.send :module_eval, <<-end_eval, __FILE__, __LINE__\n def #{method}(*args)\n send \"#{method}_for_\\#{name_prefix}\", *args\n end\n end_eval\n end", "def route_name_for_padrino(request)\n request.route_obj.original_path\n rescue\n nil\n end", "def to_s\n unless @to_s then\n target = @klass.kind_of?( Class ) ? \"#{@klass.name}#\" : \"#{@klass.name}.\"\n @to_s = \"#{target}#{@method} defined at #{@file}:#{@line_number}\"\n end\n return @to_s\n end", "def get_destination(destination, routing_params = {})\n if destination.respond_to?(:call)\n return destination\n end\n\n #if destination is something like books#welcome\n if destination =~ /^([^#]+)#([^#]+)$/\n #name will be Books\n name = $1.capitalize\n #controller will be the Constant BooksController\n controller = Object.const_get(\"#{name}Controller\")\n #ah, now here we use the class.action from above. passing in\n #welcome as the action, and routing params as the response object\n return controller.action($2, routing_params)\n end\n #otherwise we messed up by coming here\n raise \"Destination no found: #{destination}\"\n end", "def name\n \"#{@method_name}(#{self.class.name})\"\n end", "def get_routes\n raise \"Method not implemented\"\n end", "def routing_key_for(method, routing_key_name)\n @_routing_key_names ||= {}\n @_routing_key_names[method] = routing_key_name\n end", "def name\n parent_uri = self.parent.uri.to_s\n if not parent_uri.end_with?(\"/ROs/\")\n # Evil hack\n parent_uri += \"/ROs/\"\n end\n return URI.parse(parent_uri).route_to(self.uri.to_s).to_s\n end", "def inspect_route(formatter, route, base_path)\n formatter % Hash[\n name: route.name,\n methods: route.request_methods.to_a.join(HTTP_METHODS_SEPARATOR),\n path: base_path.join(route.path_for_generation),\n endpoint: route.dest.inspect\n ]\n end", "def path_to *args\n return \"#{args[0]}#{\"?\" << Gin.build_query(args[1]) if args[1]}\" if String === args[0]\n args.unshift(self.class) if Symbol === args[0] &&\n self.class.actions.include?(args[0])\n @app.router.path_to(*args)\n end", "def match(path, method)\n path = StringUtils.normalize_path(path)\n\n @routes[method.to_sym].each{|r| \n case r[0]\n when Regexp\n if data = r[0].match(path)\n return r, data\n end\n when String\n if r[0] == path\n return r, nil\n end\n end\n }\n\n nil\n end", "def method_file klass_name, method_name\n method_name = method_name.split('::').last\n method_name =~ /#(.*)/\n method_type = $1 ? 'i' : 'c'\n method_name = $1 if $1\n method_name = method_name.gsub(/\\W/) { \"%%%02x\" % $&[0].ord }\n\n File.join class_path(klass_name), \"#{method_name}-#{method_type}.ri\"\n end", "def route_helper(ctrlr, action = nil, base: false)\n ctr = ctrlr.to_s.underscore\n ctr = ctr.split('/').map(&:singularize).join('_') if ctr.include?('/')\n ctr = ctr.split('.').map(&:singularize).join('_') if ctr.include?('.')\n act = action&.to_sym\n act = base_action(act) if act && base\n if ctr.end_with?('_url', '_path')\n Log.warn(\"#{__method__}: #{ctrlr}: ignoring action #{act}\") if act\n ctr\n elsif ctr == 'home'\n act ? :\"#{act}_path\" : :main_path\n else\n case act\n when :index, nil then :\"#{ctr}_index_path\"\n when :show then :\"#{ctr}_path\"\n else :\"#{act}_#{ctr}_path\"\n end\n end\n end", "def came_from_route\n @came_from_route\n end", "def custom_routes; end", "def method\n link_schema['method'].downcase.to_sym\n end", "def routes\n routes_method.call\n end", "def discover_log_name(the_class, the_method)\n class_name = the_class.to_s.split(\" \").last.split('.').first\n class_size = File.size(the_class.source_location.first)\n \"#{class_name}_#{the_method}_#{class_size}\"\n end", "def create_route(method, params)\n fail \"No route defined for #{method} on #{name}\" unless routes[method]\n\n url_params = params.dup\n rest_path = routes[method].gsub(/:(\\w+)/) do |m|\n fail SurveyGizmo::URLError, \"Missing RESTful parameters in request: `#{m}`\" unless url_params[$1.to_sym]\n url_params.delete($1.to_sym)\n end\n\n SurveyGizmo.configuration.api_version + rest_path + filters_to_query_string(url_params)\n end", "def _routes; end", "def get_path(klass)\n result = klass.to_s.split('::').inject([Object]) do |acc,el|\n parent = acc[-1]\n raise NameError unless Module === parent\n acc << parent.const_get(el.to_sym) unless el.empty?\n acc\n end\n result.shift if result[0] == result[1] # If klass is 'Object' or '::Object'\n result\n end", "def inspect\n \"#<#{self.class.name}:##{self.path_name}>\"\n end", "def route_for routename\n case routename\n when 'Start'\n \"index\"\n when 'Login'\n \"login\"\n when 'Mitarbeiterübersicht'\n \"employees\"\n when 'Neuer Mitarbeiter'\n \"employees.new\"\n when 'FAQ'\n \"faq\"\n else\n raise \"No route defined for route named '#{routename}'.\"\n end\nend", "def method_missing(method, *params, &block)\n route_macro = self.class.macros[method]\n if route_macro.nil?\n super\n else\n pattern = params.shift || route_macro[:pattern]\n options = route_macro[:options].merge(params.shift || {})\n if !params.empty?\n raise ArgumentError,\n \"wrong number of arguments (#{params.size + 2} for 2)\"\n end\n route(pattern, options)\n end\n end", "def route_to(klass_or_name, action)\n RouteToMatcher.new(klass_or_name, action)\n end", "def url\n resource.url + '/methods'\n end", "def route14\n end", "def to_s\n \"#{file}:#{number}:in `#{method}'\"\n end", "def route_for(name, *args); end", "def name\n \"#{self.class.name}::#{@method_name}()\"\n end", "def method\n return @method if defined? @method\n @method = headers[METHOD_KEY]\n @method = @method.downcase.to_sym if @method\n @method\n end", "def singularized_method_name method\n (method.predicate? ? method[0..-2] : method).singularize.to_sym\n end", "def method_to_string(method)\n method = method.to_s\n array = method.split('_')\n string = array.join(\" \")\n string.capitalize!\n end", "def method_to_text(method)\n method.to_s.tr('_', ' ')\n end", "def signature\n \"#{klass_name}#{method_name}\"\n end", "def to_sym\n self.class.endpoint_name.to_sym\nend", "def method_symbol\r\nHTTP_METHOD_LOOKUP[method]\r\nend", "def method_name\n self.fullname[/\\A(.*)([\\.\\#])([^\\.\\#]+)\\z/, 3]\n end", "def route(index_or_name)\n case index_or_name\n when Integer\n Rails.application.routes.routes[index_or_name]\n when Symbol # named route\n Rails.application.routes.named_routes.get index_or_name\n end\nend", "def anchored_routes; end", "def routes\n raise NotImplementedError\n end", "def named_route; end", "def route\n @base_controller.route if @base_controller\n end", "def queue_names_routing_class(clazz)\n self.select { |x, y| y.is_a?(clazz) }.map { |x, y| x }\n end", "def method\n return @method\n end", "def create_link(thread_id, method)\r\n if self.total_percent(thread_id, method) < min_percent\r\n # Just return name\r\n h method.full_name\r\n else\r\n href = '#' + method_href(thread_id, method)\r\n \"<a href=\\\"#{href}\\\">#{h method.full_name}</a>\" \r\n end\r\n end", "def function2method(method)\n \"#{Indentation.get}this.#{method.to_s[4 + Indentation.size..-1]}\"\n end", "def method_name\n return @method_name if defined? @method_name\n\n @method_name = protocol_name.downcase.sub(/::/, '_')\n end" ]
[ "0.6633795", "0.65750563", "0.6348266", "0.6348266", "0.6283413", "0.6215157", "0.6192929", "0.61612934", "0.6132842", "0.61017174", "0.60935205", "0.60742", "0.6066628", "0.60005456", "0.5990586", "0.5969153", "0.5950429", "0.5949694", "0.5926372", "0.58785015", "0.58704543", "0.5839877", "0.5784258", "0.5750586", "0.5740153", "0.5740153", "0.5740153", "0.5740153", "0.5740153", "0.5740153", "0.5740153", "0.5740153", "0.5740153", "0.5740153", "0.5740153", "0.57370234", "0.5727136", "0.5727136", "0.5725686", "0.5669445", "0.56659925", "0.5665442", "0.56435466", "0.56362325", "0.56350905", "0.5630577", "0.56297785", "0.5621348", "0.5610122", "0.5606901", "0.56066334", "0.5541422", "0.55374897", "0.55235237", "0.5522876", "0.5504233", "0.5502267", "0.54920846", "0.54889184", "0.547903", "0.5476636", "0.5464944", "0.5463207", "0.54582024", "0.54433435", "0.54410833", "0.5436208", "0.54288894", "0.54262936", "0.5424613", "0.54215854", "0.54189885", "0.54142284", "0.54061466", "0.5404132", "0.53890675", "0.5386069", "0.53857106", "0.53835493", "0.5374692", "0.53528434", "0.53476167", "0.53461444", "0.5343327", "0.5341924", "0.5341315", "0.53370935", "0.5332503", "0.5331963", "0.5327947", "0.5327461", "0.5327273", "0.53139406", "0.53035814", "0.53030115", "0.5302146", "0.5301971", "0.5296479", "0.5296358", "0.5291255" ]
0.5569902
51
dare you to remove this! go on!
def queue_names_routing_class(clazz) self.select { |x, y| y.is_a?(clazz) }.map { |x, y| x } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove; end", "def remove; end", "def remove; end", "def remove; end", "def remove!; end", "def delelte\n\n end", "def celebration; end", "def remove_item\n\n end", "def suivre; end", "def deletedaysedit\n end", "def discard; end", "def discard; end", "def remove plataform\n end", "def cleanup; end", "def cleanup; end", "def cleanup; end", "def cleanup; end", "def delete_front()\n \n end", "def clean_up\n end", "def clean_up\n end", "def cleanup\n\tend", "def cleanup\n\tend", "def ti_delete_line\n\ttictl(\"dl\")\n end", "def remove(entry); end", "def delete_snat\n super\n end", "def remove\n __flag__ :remove\n end", "def private; end", "def cleanup!; end", "def cleanup!; end", "def schubert; end", "def remove_tower\n end", "def surge; end", "def after_soft_delete; end", "def cleanup\n super\n end", "def cleanup\n end", "def cleanup\n end", "def cleanup\n end", "def method_removed(*) end", "def del\n\t\t#methode ruft show auf ==> !?! ==> err aber funktioniert\n\tend", "def delete_last()\n \n end", "def undo\n\t\t\n\tend", "def undo\n\t\t\n\tend", "def undo\n\t\t\t\t\n\t\t\tend", "def destroy\n self.littles.each do | little|\n little.big_id = nil;\n end\n self.positions.each do | pos |\n pos.dke_info_id = nil;\n end\n return super\n end", "def reap; end", "def deco_pos; end", "def page_drop; end", "def retire\n\n end", "def placebo?; false end", "def clear; end", "def clear; end", "def clear; end", "def clear; end", "def clear; end", "def clear; end", "def clear; end", "def scrubbed\n end", "def cleanup\r\n end", "def cleanup\n super\n end", "def run_on_removal(paths)\n super\n end", "def ensure_deletion_fixes \n # TO DO\n end", "def hijacked; end", "def refutal()\n end", "def _clean; end", "def delete_variable\n super\n end", "def delete_local\n super\n end", "def cleanup\n end", "def cleanup\n end", "def cleanup\n end", "def cleanup\n end", "def deter\n \n end", "def undo_update\n # <%= class_name %>.where(:type_code => \"very_shiny\").first.delete\n end", "def remove(val)\n\nend", "def clear!; end", "def clear!; end", "def clear!; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def remove_item(grocery_list,item_name)\r\n\t \r\n\t grocery_list.delete(item_name)\r\n\r\nend", "def _after_update\n # SEQUEL5: Remove\n @this = nil\n end", "def unused\n end", "def _remove_method\n :\"_remove_#{singularize(self[:name])}\"\n end", "def delete_gossip\n\n end", "def cleanup\n true\n end", "def remove(value)\n #YOUR WORK HERE\n end" ]
[ "0.7453268", "0.7453268", "0.7453268", "0.7453268", "0.7099227", "0.68133885", "0.6527664", "0.6414961", "0.63682884", "0.6344492", "0.6326869", "0.6326869", "0.63231903", "0.6297889", "0.6297889", "0.6297889", "0.6297889", "0.6288105", "0.62163365", "0.62163365", "0.6189422", "0.6189422", "0.61872315", "0.6156104", "0.6104092", "0.60828805", "0.6071229", "0.6070138", "0.6070138", "0.6036601", "0.6021102", "0.60070056", "0.60050654", "0.5998669", "0.5989564", "0.5989564", "0.5989564", "0.59672296", "0.59665734", "0.596285", "0.5959263", "0.5959263", "0.59335375", "0.5920592", "0.59162474", "0.5912289", "0.5904002", "0.5900853", "0.58946496", "0.58908176", "0.58908176", "0.58908176", "0.58908176", "0.58908176", "0.58908176", "0.58908176", "0.5873348", "0.5872653", "0.5866176", "0.5861891", "0.5859219", "0.58539534", "0.5836241", "0.5816033", "0.57866186", "0.5777544", "0.57733744", "0.57733744", "0.57733744", "0.57733744", "0.5770957", "0.5768954", "0.57679784", "0.57674503", "0.57674503", "0.57674503", "0.5761413", "0.5761413", "0.5761413", "0.5761413", "0.5761413", "0.5761413", "0.5761413", "0.5761413", "0.5761413", "0.5761413", "0.5761413", "0.5761413", "0.5761413", "0.5761413", "0.5761413", "0.5761413", "0.5761413", "0.5761413", "0.5759818", "0.5758029", "0.57464975", "0.5738835", "0.5721184", "0.57166827", "0.57072645" ]
0.0
-1
Returns specific JSON based on occurrence
def as_json(options = {}) super(only: occurrence_fields) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filterKegg(json, datum)\n json.filter do |j|\n next if j[\"id\"][\"kegg\"].nil?\n j[\"id\"][\"kegg\"].any?(datum[\"KEGG\"])\n end\nend", "def search_monster_by_name_json(name)\n\tmonsters = Rails.cache.fetch(\"monster\")\n\tresult = Array.new\n\tmonsters.each do |m|\n\t\tif m[\"name\"].upcase.include? name\n\t\t\ttemp = Hash.new\n\t\t\ttemp[\"name\"] = m[\"name\"]\n\t\t\ttemp[\"id\"] = m[\"id\"]\n\t\t\ttemp[\"img_url\"] = m[\"image60_href\"]\n\t\t\tresult.push(temp)\n\t\tend\n\tend\n\treturn result\n end", "def main(json)\n files = JSON.parse(json).fetch('files')\n dupes = get_name_conflicts(files)\n dupes.each do |list|\n # resolve_conflict(list)\n list.each {|file| puts file['path']}\n puts\n end\nend", "def get_json_search_object(json_data, file_name)\n values_string = VALUES_SEPARATOR\n\n parse_nested_values(json_data.values).uniq.each do |value|\n next if !value || value.empty?\n\n values_string += \"#{value}#{VALUES_SEPARATOR}\"\n end\n\n JsonSearch.new(search_values: values_string, json_data: json_data, json_data_type: file_name)\n end", "def parse_character_movies(character)\n get_character_movies_from_api(character).collect do |film_name|\n film_resp_string = RestClient.get(film_name)\n JSON.parse(film_resp_string)\n end \n response_hash[\"results\"].each do |hash|\n if character == hash[\"name\"]\n desired_films = hash[\"films\"]\n end\nend\n desired_films\nend", "def json_fields\n\n mappings = {}\n\n json = self.record.json\n if !json\n return mappings\n end\n\n mappings['language'] = json['language']\n\n if json['notes']\n json['notes'].each do |note|\n if note['type'] == 'physloc' and !note['content'].blank?\n mappings['physical_location_note'] = note['content'].map { |cont| \"#{cont}\" }.join(\"; \")\n end\n end\n end\n\n if json['dates']\n json['dates']\n .select { |date| date['expression'].present? }\n .group_by { |date| date['label'] }\n .each { |label, dates|\n mappings[\"#{label}_date\"] = dates\n .map { |date| date['expression'] }\n .join(\"; \")\n }\n end\n\n mappings['restrictions_apply'] = json['restrictions_apply']\n mappings['display_string'] = json['display_string']\n\n instances = json.fetch('instances', false)\n if !instances\n return mappings\n end\n\n mappings['requests'] = instances\n .select{ |instance| !instance['digital_object'] }\n .each_with_index\n .map { |instance, i|\n request = {}\n\n instance_count = i + 1\n\n request['Request'] = \"#{instance_count}\"\n\n request[\"instance_is_representative_#{instance_count}\"] = instance['is_representative']\n request[\"instance_last_modified_by_#{instance_count}\"] = instance['last_modified_by']\n request[\"instance_instance_type_#{instance_count}\"] = instance['instance_type']\n request[\"instance_created_by_#{instance_count}\"] = instance['created_by']\n\n container = instance['sub_container']\n if container\n request[\"instance_container_grandchild_indicator_#{instance_count}\"] = container['indicator_3']\n request[\"instance_container_child_indicator_#{instance_count}\"] = container['indicator_2']\n request[\"instance_container_grandchild_type_#{instance_count}\"] = container['type_3']\n request[\"instance_container_child_type_#{instance_count}\"] = container['type_2']\n\n request[\"instance_container_last_modified_by_#{instance_count}\"] = container['last_modified_by']\n request[\"instance_container_created_by_#{instance_count}\"] = container['created_by']\n\n top_container = container['top_container']\n if top_container\n request[\"instance_top_container_ref_#{instance_count}\"] = top_container['ref']\n\n top_container_resolved = top_container['_resolved']\n if top_container_resolved\n request[\"instance_top_container_long_display_string_#{instance_count}\"] = top_container_resolved['long_display_string']\n request[\"instance_top_container_last_modified_by_#{instance_count}\"] = top_container_resolved['last_modified_by']\n request[\"instance_top_container_display_string_#{instance_count}\"] = top_container_resolved['display_string']\n request[\"instance_top_container_restricted_#{instance_count}\"] = top_container_resolved['restricted']\n request[\"instance_top_container_created_by_#{instance_count}\"] = top_container_resolved['created_by']\n request[\"instance_top_container_indicator_#{instance_count}\"] = top_container_resolved['indicator']\n request[\"instance_top_container_barcode_#{instance_count}\"] = top_container_resolved['barcode']\n request[\"instance_top_container_type_#{instance_count}\"] = top_container_resolved['type']\n request[\"instance_top_container_uri_#{instance_count}\"] = top_container_resolved['uri']\n\n collection = top_container_resolved['collection']\n if collection\n request[\"instance_top_container_collection_identifier_#{instance_count}\"] = collection\n .select { |c| c['identifier'].present? }\n .map { |c| c['identifier'] }\n .join(\"; \")\n\n request[\"instance_top_container_collection_display_string_#{instance_count}\"] = collection\n .select { |c| c['display_string'].present? }\n .map { |c| c['display_string'] }\n .join(\"; \")\n end\n\n series = top_container_resolved['series']\n if series\n request[\"instance_top_container_series_identifier_#{instance_count}\"] = series\n .select { |s| s['identifier'].present? }\n .map { |s| s['identifier'] }\n .join(\"; \")\n\n request[\"instance_top_container_series_display_string_#{instance_count}\"] = series\n .select { |s| s['display_string'].present? }\n .map { |s| s['display_string'] }\n .join(\"; \")\n end\n\n end\n end\n end\n\n request\n }\n\n return mappings\n end", "def json\n @obj.get_json_regex\n end", "def get_character_movies_from_api(character)\n #make the web request\n all_characters = RestClient.get('http://www.swapi.co/api/people/') # web request\n character_hash = JSON.parse(all_characters)\n\n arr = nil\n character_hash[\"results\"].each do |key|\n if key[\"name\"] == character\n arr = key[\"films\"]\n end\n end\narr\nend", "def find_first_json_in(text)\n find_all_json_in(text).first\n end", "def search_data\n {\n title: title,\n name: blocks.map { |b| b.specific.name if b.specific.respond_to?(:name) },\n body: blocks.map { |b| b.specific.body if b.specific.respond_to?(:body) },\n label: blocks.map { |b| b.specific.label if b.specific.respond_to?(:label) },\n category: subcategories.pluck(:category_id)\n }.as_json\n end", "def similar_to\n render json: Issue.include_hit_count.where(:signature =>\n @issue.signature).where.not(:id => @issue.id)\n end", "def search_for_job_in_full_job_list_json(json_summary, job_name, job_status_hash_table)\n json_summary[\"jobs\"].each do |job_entry|\n if (job_entry[\"name\"] == job_name)\n \n #push new entry into hash table\n job_status_entry = {job_entry[\"name\"] => job_entry[\"color\"]}\n job_status_hash_table.merge!(job_status_entry)\n else\n #print \"No match [#{job_entry}]\\n\"\n end\n end\nend", "def json_include()\n return [\n :events,\n :goals,\n :tracker_days,\n # :journal\n ]\n end", "def combine_json scents\n full_json = scents.inject(Hash.new) do |result, cur|\n result.update(cur) {|key, running, cur| running + cur }\n end\n \n full_json.to_json\n end", "def pluck_sir_trevor_type(json, type) \n hash = JSON.parse(json)\n if hash.has_key?(\"data\")\n item = hash[\"data\"].select { |item| item[\"type\"] == type }\n item.first\n end\n end", "def character_movies(character)\n output = []\n all_characters = RestClient.get('http://www.swapi.co/api/people/')\n character_hash = JSON.parse(all_characters)\n results = character_hash[\"results\"]\n results.each do |person|\n if person[\"name\"].downcase == character\n output = person[\"films\"]\n end\n end\n return output\nend", "def build_json(json)\n\t\t\t\tbegin; code = \"\"; \ttable = Hash.new; \tstr = \"\";\tvictims = find_all(XSSF_VICTIM_DB, XSSF_VICTIM_HASH); rescue; end\n\t\t\t\t\n\t\t\t\tcolours = %Q{ \t\"0x336699\", \"0x88AACC\", \"0x999933\", \"0x666699\", \"0xCC9933\", \"0x006666\", \"0x3399FF\", \"0x993300\", \"0xAAAA77\", \"0x666666\", \"0xFFCC66\", \"0x6699CC\",\n\t\t\t\t\t\t\"0x663366\", \"0x9999CC\", \"0xAAAAAA\", \"0x669999\", \"0xBBBB55\", \"0xCC6600\", \"0x9999FF\", \"0x0066CC\", \"0x99CCCC\", \"0x999999\", \"0xFFCC00\", \"0x009999\",\n\t\t\t\t\t\t\"0x99CC33\", \"0xFF9900\", \"0x999966\", \"0x66CCCC\", \"0x339966\", \"0xCCCC33\"\t}\n\t\t\t\tcase json\n\t\t\t\t\twhen /^gr1$/\t\t\t# Active / Non active victims\n\t\t\t\t\t\ttotal = 0;\t\tactive = 0;\n\t\t\t\t\t\t\n\t\t\t\t\t\tbegin\n\t\t\t\t\t\t\ttotal = count_all(XSSF_VICTIM_DB, XSSF_VICTIM_HASH);\tactive = count_all(XSSF_VICTIM_DB, XSSF_VICTIM_HASH, {\"ACTIVE\" => true})\n\t\t\t\t\t\trescue\n\t\t\t\t\t\t\ttotal = 0;\tactive = 0\n\t\t\t\t\t\tend\n\t\t\t\t\n\t\t\t\t\t\tcode = %Q{ { \t\"elements\": [ { \"type\": \"pie\", \"start-angle\": 50, \"animate\": [ { \"type\": \"fade\" },{ \"type\": \"bounce\", \"distance\": 20 } ],\n\t\t\t\t\t\t\t\t\"on-show\": false, \"gradient-fill\": true, \"colours\" : [\"#00FF00\", \"#FF0000\"], \"tip\": \"#label#\\n#val# of #total# (#percent#)\", \n\t\t\t\t\t\t\t\t\"no-labels\": true, \"values\": [ { \"value\": #{active}, \"label\": \"Connected\", \"label-colour\": \"#00FF00\" }, \n\t\t\t\t\t\t\t\t{ \"value\": #{total - active}, \"label\": \"Disconnected\", \"label-colour\": \"#FF0000\" }] } ], \"bg_colour\" : \"#000000\", \n\t\t\t\t\t\t\t\t\"title\": { \"text\": \"Active victims\", \"style\": \"color: #00EEEE; font-size: 20px\" } }\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\twhen /^gr2$/\t\t\t# Victims location\n\t\t\t\t\t\tvictims.each do |v|;\tbegin;\ttable[v[XSSF_VICTIM_HASH[\"LOCATION\"]]] ? table[v[XSSF_VICTIM_HASH[\"LOCATION\"]]] += 1 : table[v[XSSF_VICTIM_HASH[\"LOCATION\"]]] = 1;\trescue;\tnext;\tend;\tend\n\n\t\t\t\t\t\ttable.each do |key, value|;\tstr << %Q{ {\"value\" : #{value.to_i}, \"label\": \"#{key.to_s}\", \"on-click\": \"#{key.to_s}\" },};\tend\n\t\t\t\t\t\t\n\t\t\t\t\t\tcode = %Q{\t{ \t\"elements\": [ { \"type\": \"pie\", \"start-angle\": 50, \"on-show\": false, \"animate\": [ { \"type\": \"fade\" }, { \"type\": \"bounce\", \"distance\": 20 } ],\n\t\t\t\t\t\t\t\t\t\"colours\" : [#{colours}], \"gradient-fill\": true, \"tip\": \"#label#\\n#val# of #total# (#percent#)\", \"no-labels\": true, \n\t\t\t\t\t\t\t\t\t\"values\": [ #{str[0..-2].to_s} ]}], \"bg_colour\" : \"#000000\", \"title\": { \"text\": \"XSSed domains\", \"style\": \"color: #00EEEE; font-size: 20px\" } }\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\twhen /^gr3$/\t\t\t# Victim OS statistics\n\t\t\t\t\t\tvictims.each do |v|\n\t\t\t\t\t\t\tbegin\n\t\t\t\t\t\t\t\ttable[v[XSSF_VICTIM_HASH[\"OS_NAME\"]]] = Hash.new if not table[v[XSSF_VICTIM_HASH[\"OS_NAME\"]]]\n\t\t\t\t\t\t\t\ttable[v[XSSF_VICTIM_HASH[\"OS_NAME\"]]][v[XSSF_VICTIM_HASH[\"OS_VERSION\"]]] ? table[v[XSSF_VICTIM_HASH[\"OS_NAME\"]]][v[XSSF_VICTIM_HASH[\"OS_VERSION\"]]] += 1 : table[v[XSSF_VICTIM_HASH[\"OS_NAME\"]]][v[XSSF_VICTIM_HASH[\"OS_VERSION\"]]] = 1\n\t\t\t\t\t\t\trescue;\tnext; end\n\t\t\t\t\t\tend\n\n\n\t\t\t\t\t\ttable.each do |key, value|;\tvalue.each do |k, v|;\tstr << %Q{ {\"value\" : #{v.to_i}, \"label\": \"#{key.to_s} [#{k.to_s}]\" },};\tend;\tend\n\t\t\t\t\t\t\n\t\t\t\t\t\tcode = %Q{ { \t\"elements\": [ { \"type\": \"pie\", \"start-angle\": 50, \"on-show\": false, \"animate\": [ { \"type\": \"fade\" }, { \"type\": \"bounce\", \"distance\": 20 } ],\n\t\t\t\t\t\t\t\t\"colours\" : [#{colours}],\"gradient-fill\": true, \"tip\": \"#label#\\n#val# of #total# (#percent#)\", \"no-labels\": true, \n\t\t\t\t\t\t\t\t\"values\": [ #{str[0..-2].to_s} ]}], \"bg_colour\" : \"#000000\", \"title\": { \"text\": \"Operating Systems\", \"style\": \"color: #00EEEE; font-size: 20px\" } }\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\twhen /^gr4$/\t\t\t\t# Victim browsers statistics\n\t\t\t\t\t\tvictims.each do |v|\n\t\t\t\t\t\t\tbegin\n\t\t\t\t\t\t\t\ttable[v[XSSF_VICTIM_HASH[\"BROWSER_NAME\"]]] = Hash.new if not table[v[XSSF_VICTIM_HASH[\"BROWSER_NAME\"]]]\n\t\t\t\t\t\t\t\ttable[v[XSSF_VICTIM_HASH[\"BROWSER_NAME\"]]][v[XSSF_VICTIM_HASH[\"BROWSER_VERSION\"]]] ? table[v[XSSF_VICTIM_HASH[\"BROWSER_NAME\"]]][v[XSSF_VICTIM_HASH[\"BROWSER_VERSION\"]]] += 1 : table[v[XSSF_VICTIM_HASH[\"BROWSER_NAME\"]]][v[XSSF_VICTIM_HASH[\"BROWSER_VERSION\"]]] = 1\n\t\t\t\t\t\t\trescue;\tnext; end\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\ttable.each do |key, value|;\tvalue.each do |k, v|;\tstr << %Q{ {\"value\" : #{v.to_i}, \"label\": \"#{key.to_s} [#{k.to_s}]\" },};\tend;\tend\n\t\t\t\t\t\t\n\t\t\t\t\t\tcode = %Q{ { \t\"elements\": [ { \"type\": \"pie\", \"start-angle\": 50, \"on-show\": false,\t\"animate\": [ { \"type\": \"fade\" }, { \"type\": \"bounce\", \"distance\": 20 } ],\n\t\t\t\t\t\t\t\t\"colours\" : [#{colours}], \"gradient-fill\": true, \"tip\": \"#label#\\n#val# of #total# (#percent#)\", \"no-labels\": true, \n\t\t\t\t\t\t\t\t\"values\": [ #{str[0..-2].to_s} ]}], \"bg_colour\" : \"#000000\", \"title\": { \"text\": \"XSSed browsers\", \"style\": \"color: #00EEEE; font-size: 20px\" } }\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\telse\t\t\t\t\t\t# Victim number evolution for the last 10 days\n\t\t\t\t\t\tt = Time.now; \tmax = 0;\t\n\t\t\t\t\t\t9.downto(0) do |i|;\ttable[t - (i * 86400)] = 0;\tend\n\t\t\t\t\t\t\t\n\t\t\t\t\t\tvictims.each do |v|\n\t\t\t\t\t\t\ttable.each_key do |k|\n\t\t\t\t\t\t\t\ttime = Time.parse(v[XSSF_VICTIM_HASH[\"FIRST_REQUEST\"]])\n\t\t\t\t\t\t\t\ttable[k] += 1 if ((time.year == k.year) and (time.yday == k.yday))\n\t\t\t\t\t\t\t\tmax = table[k] if (table[k] > max)\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\ttable.each do |key, value|;\tstr << %Q{ {\"x\" : #{Time.parse(key.to_s).to_i}, \"y\": #{value} },};\tend\n\t\t\t\t\t\t\n\t\t\t\t\t\tcode = %Q{ { \"elements\": [ { \"type\": \"scatter_line\", \"colour\": \"#00FF00\", \"width\": 3, \"values\": [ #{str[0..-2].to_s} ], \n\t\t\t\t\t\t\t\"dot-style\": { \"type\": \"hollow-dot\", \"dot-size\": 3, \"halo-size\": 2 } } ], \n\t\t\t\t\t\t\t\"title\": { \"text\": \"Victims number evolution\", \"style\": \"color: #00EEEE; font-size: 20px\" }, \n\t\t\t\t\t\t\t\"x_axis\": {\"colour\": \"#00EEEE\",\"grid-colour\": \"#555555\",\"min\": #{(t - (9 * 86400)).to_i}, \"max\": #{t.to_i}, \"steps\": 86400, \"labels\": { \n\t\t\t\t\t\t\t\t\"text\": \"#date:jS, M Y#\", \"steps\": 86400, \"visible-steps\": 1, \"rotate\": 270, \"colour\" : \"#FFFFFF\" } }, \n\t\t\t\t\t\t\t\"y_axis\": {\"colour\": \"#00EEEE\", \"grid-colour\": \"#555555\",\"min\": 0, \"max\": #{max + 5}, \"steps\": 2, \"labels\": {\"colour\" : \"#FFFFFF\"} },\"bg_colour\":\"#000000\" }\n\t\t\t\t\t\t}\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\treturn code\n\t\t\tend", "def duplicates\n id_type = PatientIdentifierType.find(params.require(:type_id))\n render json: service.find_duplicates(id_type)\n end", "def get_character_movies_from_api(character)\n #make the web request\n all_characters = RestClient.get('http://www.swapi.co/api/people/')\n character_hash = JSON.parse(all_characters)\n\n person_hash = []\n character_hash.each do |key, value|\n if key == \"results\"\n value.each do |info|\n if info[\"name\"].downcase == character.downcase\n person_hash = info\n binding.pry\n end\n end\n end\n end\n\n film_info = []\n films.each do |film_url|\n film_info.push(JSON.parse(RestClient.get(film_url)))\n end\n new_character = Character.new(person_hash)\nend", "def search_list(name, config)\n file = File.read(config)\n data = JSON.parse(file)\n packages = data.each { |x|\n if x[1][\"name\"] == name\n puts x[1][\"name\"].green + \"\\n-- \" + x[1][\"desc\"].green\n else\n puts x[1][\"name\"] + \"\\n-- \" + x[1][\"desc\"]\n end\n }\nend", "def show\n @venue = Venue.find(params[:id])\n puts \"venue_id \"\n puts params[:id]\n @venue.clicks += 1\n @venue.save\n @jsonOccs = []\n @jsonRecs = []\n @occurrences = @venue.events.collect { |event| event.occurrences.select { |occ| occ.start >= DateTime.now } }.flatten.sort_by { |occ| occ.start }\n @occurrences.each do |occ|\n # check if occurrence is instance of a recurrence\n if occ.recurrence_id.nil?\n @jsonOccs << occ\n else\n if @jsonRecs.index(occ.recurrence).nil?\n @jsonRecs << occ.recurrence\n end\n end\n end\n puts \"jsonrecs:\"\n pp @jsonRecs\n\n respond_to do |format|\n format.json { render json: { :occurrences => @jsonOccs.to_json(:include => :event), :recurrences => @jsonRecs.to_json(:include => :event), :venue => @venue.to_json } } \n end\n end", "def get_json(result)\n #result.split(\"\\n\").select {|str| str.match(/^{version/) }.first\n result.split(\"\\n\").last\n end", "def get_character_movies_from_api(name)\n parsed_data = get_results_array\n films = []\n parsed_data.map do |result_instance|\n if result_instance[\"name\"] == name \n # puts result_instance[\"name\"]\n films = result_instance[\"films\"]\n end\n end\n film_array = []\n films.map do |film_instance|\n film_data = RestClient.get(film_instance)\n parsed_film = JSON.parse(film_data)\n film_array << parsed_film\n end \n puts film_array\n\nend", "def find_all_json_in(text)\n PDK::Util::JSONFinder.new(text).objects\n end", "def format_json(params, response)\n all_json = {}\n times = get_times(params)\n\n # Create A Hash that contains an empty list for each Fedora Type\n Fedora_Types.each do |key, value|\n all_json.store(value.pluralize.to_sym, [])\n end\n\n response[:response][:docs].each do |doc|\n # First determine type of this specific druid\n type = doc[Type_Field.to_sym][0]\n\n # Make the JSON for this druid\n\n title1 = doc[Title_Field.to_sym]\n title2 = doc[Title_Field_Alt.to_sym]\n title = title1.nil? ? title2.nil? ? '' : title2[0] : title1[0] # look in two different fields for a title and grab the other if the first is nil (setting title to blank if both are nil)\n\n j = {:druid => doc[ID_Field.to_sym], :latest_change => determine_latest_date(times, doc[Last_Changed_Field.to_sym]), :title => title}\n j[:catkey] = doc[CatKey_Field.to_sym][0] unless doc[CatKey_Field.to_sym].nil?\n\n # Append this little json stub to its proper parent array\n all_json[type.downcase.pluralize.to_sym] << j\n end\n\n # Now we need to delete any nil arrays and sum the ones that aren't nil\n total_count = 0\n a = {}\n all_json.each do |key, value|\n if value.size == 0\n all_json.delete(key)\n else\n a[key] = value.size\n total_count += value.size\n end\n end\n a[:total_count] = total_count\n all_json.store(:counts, a)\n all_json\n end", "def recupera_json(nome_arq)\n linha = ''\n File.open(nome_arq, 'r').each_line do |line|\n if line.include? 'trackinfo: '\n linha = line\n break\n end\n end\n linha.slice!(-2..-1)\n linha.slice!(' trackinfo: ')\n JSON.parse linha\nend", "def get_group_json( params, base )\n doc = Document.find(params[:document_id])\n includes = self.determine_child_includes(doc, params)\n\n if base\n grp = Group.includes(includes).base(doc, current_account.id, params[:de], params[:qc])\n else\n grp = Group.includes(includes).find(params[:id])\n end\n\n responseJSON = grp.as_json({\n include: includes,\n ancestry: true\n })\n\n if (doc.in_de? || doc.in_supp_de?) && grp.template_id\n responseJSON[:template_fields] = TemplateField.where({template_id: grp.template_id}).pluck(:field_name)\n end\n\n responseJSON[:annotations] = Annotation.by_doc_status(doc, params[:de]).flattened_by_group(grp.id, doc.in_supp_de?).as_json()\n responseJSON\n end", "def parse_doc_json(docs)\n jurisdiction_titles = JURISDICTION_MATCHERS.reduce({}){|acc, (url, hash)|\n acc[hash[:title]] = {url: url, id: hash[:id], title: hash[:title], type: hash[:type], abbreviation: hash[:abbreviation]}\n acc\n }\n find_id = lambda{ |title|\n jurisdiction = jurisdiction_titles[title]\n if jurisdiction == nil\n puts \"SKIPPING: Missing jurisdiction in jurisdiction_matches.rb: #{title}\"\n return nil\n end\n db_jurisdiction = $db[:jurisdictions].find({_id: jurisdiction[:id]}).to_a.first\n if db_jurisdiction.nil?\n $db[:jurisdictions].insert_one({\n _id: jurisdiction[:id],\n title: jurisdiction[:title],\n type: jurisdiction[:type],\n asnUrl: jurisdiction[:url],\n abbreviation: jurisdiction[:abbreviation]\n })\n else\n $db[:jurisdictions].find({_id: jurisdiction[:id]}).find_one_and_update({\"$set\" => {status: \"active\"}})\n end\n jurisdiction[:id]\n }\n docs[\"hits\"][\"hit\"].reject{|doc|\n jurisdiction = find_id.call(doc[\"data\"][\"jurisdiction\"][0])\n jurisdiction == nil\n }.map{|doc|\n if SOURCE_TO_SUBJECT_MAPPINGS_GROUPED[doc[\"data\"][\"jurisdiction\"][0]] == nil\n puts \"Add \" + doc[\"data\"][\"jurisdiction\"]\n end\n\n subject = SOURCE_TO_SUBJECT_MAPPINGS_GROUPED[doc[\"data\"][\"jurisdiction\"][0]][doc[\"id\"].upcase]\n {\n date_modified: doc[\"data\"][\"date_modified\"][0],\n date_valid: doc[\"data\"][\"date_valid\"][0],\n description: doc[\"data\"][\"description\"][0],\n id: doc[\"id\"].upcase,\n jurisdiction: doc[\"data\"][\"jurisdiction\"][0],\n jurisdiction_id: find_id.call(doc[\"data\"][\"jurisdiction\"][0]),\n subject: subject,\n title: doc[\"data\"][\"title\"][0],\n url: doc[\"data\"][\"identifier\"][0],\n }\n }\nend", "def partial_match?\n @json['results'][0]['partial_match'] == true\n end", "def content_by_exact(keyword)\n JSON.parse(self.class.get(\"#{\"keyword\"}\" + \"#{@token}\").body)\n end", "def get_json_result(json, index)\n return json[\"items\"][index][\"pagemap\"][\"cse_image\"][0][\"src\"]\nend", "def get_favorite(key, json)\n hash = JSON.parse(json)\n return hash[\"favorites\"][key]\n\nend", "def get_movies_by_film(title)\n all_movies = RestClient.get('http://www.swapi.co/api/films/')\n movies_hash = JSON.parse(all_movies)\n\n results = movies_hash[\"results\"].select {|movie| movie[\"title\"].downcase == title}\n # results is an array containing a hash\n\n if results[0].length > 0\n puts \"Title: #{results[0][\"title\"]}\"\n puts \"Director: #{results[0][\"director\"]}\"\n puts \"Release Date: #{results[0][\"release_date\"]}\"\n else\n puts \"Movie not found\"\n end\nend", "def find_media_sorted_arrays(json)\n\nend", "def user_flights_by_type\n #find key value pairs of aviation_type => flights.count\n result = @current_user.flights.group(:aviation_type).count\n render json: [{name: 'Number of Flights', data: result}]\n end", "def get_character_info(character,response_hash)\n #response_string = RestClient.get('http://www.swapi.co/api/people/')\n #response_hash = JSON.parse(response_string)\n response_hash[\"results\"].each do |value|\n #/iterate over each element and check if value of the name key is equal to user input\n #binding.pry\n if value[\"name\"].downcase == character\n return value[\"films\"]\n end\n end\nend", "def filtered_for_json\n self\n end", "def fetch_json\n res = open(\"http://www.cleanairmakemore.com/widget_json.cfm\").read\n\n # Documented in views/burn/phx/data.json.\n s = res.index(\"facts\")\n json = res[0, s-4] + \"}\"\n\n # json = File.read(\"views/burn/phx/data.json\")\n json\n end", "def pebble\n provider = Account.find(params[:provider_id])\n\n dates = EventDate.where(\"datetime>:now AND stage_id IN (:stage_id)\", {\n :now => (Time.now + 2.hours),\n :stage_id => provider.user.stages.map(&:id)\n }).order(:datetime).limit(2)\n \n output = {}\n dates.each do |date| \n output[output.count] = ActiveSupport::Inflector.transliterate(date.event.title.slice(0,20))\n output[output.count] = date.datetime.strftime(\"%H:%M\") + \" \" + ActiveSupport::Inflector.transliterate(date.event.stage.name.gsub(/[a-z]|\\s/,''))\n end\n \n render json: output\n \n rescue ActiveRecord::RecordNotFound\n render json: {}\n end", "def json_data\n json_format = params[:json_format] or 'default'\n case json_format\n when 'basic'\n collection.map { |v| { 'id' => v.product.id, 'name' => v.product.name }}.uniq { |i| i['id'] }.to_json\n when 'autocomplete'\n collection.map { |v| {\n :data => {\n :id => v.id,\n :product_id => v.product.id,\n :name => v.fullname,\n :sku => v.sku,\n :count_on_hand => v.count_on_hand,\n :image_url => (v.images.count > 0 ? v.images.first.attachment.url(:mini) : nil)\n },\n :value => v.fullname,\n :result => v.fullname\n }\n }.to_json\n else\n collection.to_json(:include => {:variants => {:include => {:option_values => {:include => :option_type},\n :images => {:only => [:id], :methods => :mini_url}}},\n :images => {:only => [:id], :methods => :mini_url}, :master => {}})\n end\n end", "def search(search_term)\n results = Content.where('status_id=2 and lower(sub_title) = lower(?)', search_term)\n to_ext_json(results)\n end", "def json_by_attribute(data, opts={})\n key = data.fields.first\n hash = { \"#{key}\" => [] }\n data.each do |d|\n hash[key] << d\n end\n hash[key]\n end", "def index\n @news = News.where(\"duplicate_of is null\")\n #.as_json(only: [:id, :title, :image, :author, :published, :category, :content])\n\n render json: @news\n end", "def include_meta(json)\n json\n end", "def get_json\n if @tnuid_details_dictionary.nil?\n setup_tnuid_dictionary\n end\n start_at = 0\n hol_count = 0\n #for hol_hash in HolDatum.order(:name).where(taxon_id: nil, is_valid: 'Valid')\n #for hol_hash in HolDatum.order(:tnuid).where(is_valid: 'Valid')\n for hol_hash in HolDatum.order(:tnuid)\n\n # if hol_count > 5\n # exit\n # end\n\n hol_count = hol_count +1\n if (hol_count < start_at)\n next\n end\n tnuid = hol_hash.tnuid\n if (@tnuid_details_dictionary.has_key?(tnuid))\n print_char '.'\n next\n end\n\n # puts hol_hash.name\n # puts tnuid\n # info = get_taxon_info_command hol_hash.tnuid\n populate_hol_details hol_hash.tnuid\n\n if hol_count % 10 == 0\n print_string hol_hash.tnuid.to_s\n end\n if hol_count % 15 == 0\n print_string @average.to_s\n end\n if hol_count % 100 == 0\n reset_average\n end\n end\n end", "def notice_json\n render json: {\n notice: {\n id: (@results.first[:hash] rescue nil)\n }\n }\n end", "def get_favorite(key, json)\n data =JSON.parse(json)\n return data['favorites'][key]\nend", "def processJSON(json)\n # Let's just print out titles, links and scores\n json['dc:collection'].collect { |dict|\n \"title: #{dict['dc:title']}\\n\" +\n \"link: #{dict['dc:relation']}\\n\" +\n \"score: #{dict['primal:contentScore']}\\n\\n\"\n }.each { |result|\n puts result\n }\nend", "def identify_json(entity_type)\n if (entity_type == \"user\")\n\t filename = \"users.json\"\n elsif (entity_type == \"project\")\n\t filename = \"projects.json\"\n else\n\t filename = nil\n end\n filename\n end", "def results_by_country\n \tresult = Country.all.map do |c|\n \t\tplaces = { }\n \t\t(1..6).each do |place|\n \t\t\tplaces[place] = c.sporters.joins(:competition_results).where(\"competition_results.place = #{place}\").count\n \t\tend\n \t\t{\n \t\t\tname: c.name,\n \t\t\tdata: places\n \t\t}\n \tend\n \trender json: result\n end", "def generate_json(title, freq)\n type = freq.attr('n').gsub(' ', '_') # like fool, aus.001.charactername, female\n display = _make_label(freq.attr('n'), freq.attr('display'), title)\n\n json = {\n \"id\" => freq.attr('n'),\n \"display\" => display,\n \"novel\" => titleize(title),\n \"unique_words\" => freq.attr('countOfUniqueWords'),\n \"speeches\" => freq.attr('speeches'),\n \"words\" => {}\n }\n frequencies = freq.css(\"w\")\n frequencies.length.times do |index|\n child = frequencies[index]\n if child\n word = child.text()\n num = child.attr('freq')\n json[\"words\"][word] = num if (word && num)\n end\n end # end of children looping\n write_to_file(\"public/frequencies/#{title}/#{type}.json\", JSON.pretty_generate(json))\nend", "def searchmultipletest\n puts \"============== \\n\"\n puts \"Results:\"\n\n File.open('assetlist.txt') do |searchlist|\n searchlist.each_line do |searchquery|\n\n puts \"Asset: \" + searchquery\n assetname = searchquery.downcase.chomp\n noresults = true\n\n obj = JSON.parse(File.read('multiple.json'))\n\n #iterate through json array\n obj.each do |element|\n\n description = element[\"_source\"][\"description\"]\n\n if description.downcase.include? assetname\n noresults = false\n puts element[\"_source\"][\"title\"]\n puts \"\\n\"\n\n end\n\n end\n\n if noresults == true\n puts \"No Results\"\n puts \"\\n\"\n end\n\n end\n\n end\n\n puts \"=============\"\n\n end", "def highlights_for(unique_id, field)\n raw_response['highlighting'] ||= {}\n raw_response['highlighting'][unique_id] ||= {}\n raw_response['highlighting'][unique_id][field]\n end", "def get_favorite(key, json)\n return JSON.parse(json)[\"favorites\"][key]\nend", "def combineJSON(exJSON, incJSON)\n\n\t# Make sure we don't get parsing errors with new users\n\tif(exJSON == \"\")\n\t\texJSON = \"[]\"\n\tend\n\n\texistingData = JSON.parse(exJSON)\n\tnewData = JSON.parse(incJSON)\n\n\tfor i in 0..newData.length - 1\n\t\tnewSite = newData[i]\n\t\tnewSitePages = newSite[\"pages\"] # For page comparison\n\t\tnewSiteName = newSite[\"title\"]\n\t\tnewSiteTime = TimeHelper.timeToMs(newSite[\"time\"])\n\n\t\tsiteFound = false\n\n\t\tfor j in 0..existingData.length - 1\n\t\t\texistingSite = existingData[j]\n\t\t\texistingSitePages = existingSite[\"pages\"] # For page comparison\n\t\t\texistingSiteName = existingSite[\"title\"]\n\t\t\texistingSiteTime = TimeHelper.timeToMs(existingSite[\"time\"])\n\n\t\t\tif newSiteName == existingSiteName\n\t\t\t\tsiteFound = true\n\n\t\t\t\t# add up the site level times together\n\t\t\t\tcombinedSiteTime = newSiteTime + existingSiteTime\n\t\t\t\tcombinedSiteTimeString = TimeHelper.msToTime(combinedSiteTime)\n\t\t\t\texistingSite[\"time\"] = combinedSiteTimeString\n\n\t\t\t\t# start comparing the pages\n\t\t\t\tfor k in 0..newSitePages.length - 1\n\t\t\t\t\tnewPage = newSitePages[k]\n\t\t\t\t\tnewPageName = newPage[\"title\"]\n\t\t\t\t\tnewPageDate = newPage[\"date\"]\n\t\t\t\t\tnewPageTime = TimeHelper.timeToMs(newPage[\"time\"])\n\n\t\t\t\t\tpageFound = false\n\n\t\t\t\t\tfor l in 0..existingSitePages.length - 1\n\t\t\t\t\t\texistingPage = existingSitePages[l]\n\t\t\t\t\t\texistingPageName = existingPage[\"title\"]\n\t\t\t\t\t\texistingPageDate = existingPage[\"date\"]\n\t\t\t\t\t\texistingPageTime = TimeHelper.timeToMs(existingPage[\"time\"])\n\n\t\t\t\t\t\t#if the two pages have the same name and date; add their values together\n\t\t\t\t\t\tif newPageName == existingPageName && newPageDate == existingPageDate\n\t\t\t\t\t\t\tpageFound = true\n\n\t\t\t\t\t\t\tcombinedPageTime = newPageTime + existingPageTime\n\t\t\t\t\t\t\tcombinedPageTimeString = TimeHelper.msToTime(combinedPageTime)\n\t\t\t\t\t\t\texistingPage[\"time\"] = combinedPageTimeString\n\t\t\t\t\t\t\texistingSitePages[l] = existingPage\n\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\n\t\t\t\t\t# if the page doesn't match anywhere, add it onto the site object\n\t\t\t\t\tif !pageFound\n\t\t\t\t\t\texistingSitePages << newPage\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\texistingSite[\"pages\"] = existingSitePages\n\t\t\texistingData[j] = existingSite\n\t\t\tend\n\t\tend\n\t\t\n\t\t# no match; add the new site right inot the existing data\n\t\tif !siteFound\n\t\t\texistingData << newSite\n\t\tend\n\tend\n\n\treturn existingData\nend", "def report_json_tags(json_data)\n puts \"component: \" + File.basename(json_data[\"url\"])\n puts \"ref: \" + json_data[\"ref\"].to_s\n if tagged?(json_data[\"url\"], json_data[\"ref\"].to_s)\n tagged = \"Tagged? [ Yes ]\"\n else\n tagged = \"Tagged? [ No ]\"\n end\n col_len = (ENV[\"COLUMNS\"] || 70).to_i\n puts format(\"\\n%#{col_len}s\\n\\n\", tagged)\n puts (\"*\" * col_len)\n end", "def index\n @names = []\n if @data.present?\n if params[:search].present?\n @data[\"prizes\"].group_by {|x| puts x[\"laureates\"].group_by {|v| @names << x if v[\"firstname\"] == params[:search]}}\n else\n @names = @data\n end\n end\n render :json => @names\n end", "def json_fields\n\n mappings = {}\n\n json = self.record.json\n return mappings unless json\n\n lang_materials = json['lang_materials']\n if lang_materials\n mappings['language'] = lang_materials\n .select { |lm| lm['language_and_script'].present? and lm['language_and_script']['language'].present?}\n .map{ |lm| lm['language_and_script']['language'] }\n .flatten\n .join(\";\")\n end\n\n language = json['language']\n if language\n mappings['language'] = language\n end\n\n\n notes = json['notes']\n if notes\n mappings['physical_location_note'] = notes\n .select { |note| note['type'] == 'physloc' and note['content'].present? and note['publish'] == true }\n .map { |note| note['content'] }\n .flatten\n .join(\"; \")\n\n mappings['accessrestrict'] = notes\n .select { |note| note['type'] == 'accessrestrict' and note['subnotes'] }\n .map { |note| note['subnotes'] }\n .flatten\n .select { |subnote| subnote['content'].present? and subnote['publish'] == true}\n .map { |subnote| subnote['content'] }\n .flatten\n .join(\"; \")\n end\n\n if json['dates']\n json['dates']\n .select { |date| date['expression'].present? }\n .group_by { |date| date['label'] }\n .each { |label, dates|\n mappings[\"#{label}_date\"] = dates\n .map { |date| date['expression'] }\n .join(\"; \")\n }\n end\n\n\n if json['linked_agents']\n mappings['creators'] = json['linked_agents']\n .select { |l| l['role'] == 'creator' and l['_resolved'] }\n .map { |l| l['_resolved']['names'] }.flatten\n .select { |n| n['is_display_name'] == true}\n .map { |n| n['sort_name']}\n .join(\"; \")\n end\n\n if json['rights_statements']\n mappings['rights_type'] = json['rights_statements'].map{ |r| r['rights_type']}.uniq.join(';')\n end\n\n digital_instances = json['instances'].select { |instance| instance['instance_type'] == 'digital_object'}\n if (digital_instances.any?)\n mappings[\"digital_objects\"] = digital_instances.map{|d| d['digital_object']['ref']}.join(';')\n end\n\n mappings['restrictions_apply'] = json['restrictions_apply']\n mappings['display_string'] = json['display_string']\n\n instances = self.container_instances\n return mappings unless instances\n\n mappings['requests'] = instances\n .each_with_index\n .map { |instance, i|\n request = {}\n \n instance_count = i + 1\n\n request['Request'] = \"#{instance_count}\"\n\n request[\"instance_is_representative_#{instance_count}\"] = instance['is_representative']\n request[\"instance_last_modified_by_#{instance_count}\"] = instance['last_modified_by']\n request[\"instance_instance_type_#{instance_count}\"] = instance['instance_type']\n request[\"instance_created_by_#{instance_count}\"] = instance['created_by']\n\n container = instance['sub_container']\n return request unless container\n\n request[\"instance_container_grandchild_indicator_#{instance_count}\"] = container['indicator_3']\n request[\"instance_container_child_indicator_#{instance_count}\"] = container['indicator_2']\n request[\"instance_container_grandchild_type_#{instance_count}\"] = container['type_3']\n request[\"instance_container_child_type_#{instance_count}\"] = container['type_2']\n request[\"instance_container_last_modified_by_#{instance_count}\"] = container['last_modified_by']\n request[\"instance_container_created_by_#{instance_count}\"] = container['created_by']\n\n top_container = container['top_container']\n return request unless top_container\n\n request[\"instance_top_container_ref_#{instance_count}\"] = top_container['ref']\n\n top_container_resolved = top_container['_resolved']\n return request unless top_container_resolved\n\n request[\"instance_top_container_long_display_string_#{instance_count}\"] = top_container_resolved['long_display_string']\n request[\"instance_top_container_last_modified_by_#{instance_count}\"] = top_container_resolved['last_modified_by']\n request[\"instance_top_container_display_string_#{instance_count}\"] = top_container_resolved['display_string']\n request[\"instance_top_container_restricted_#{instance_count}\"] = top_container_resolved['restricted']\n request[\"instance_top_container_created_by_#{instance_count}\"] = top_container_resolved['created_by']\n request[\"instance_top_container_indicator_#{instance_count}\"] = top_container_resolved['indicator']\n request[\"instance_top_container_barcode_#{instance_count}\"] = top_container_resolved['barcode']\n request[\"instance_top_container_type_#{instance_count}\"] = top_container_resolved['type']\n request[\"instance_top_container_uri_#{instance_count}\"] = top_container_resolved['uri']\n\n if (top_container_resolved['container_locations'])\n request[\"instance_top_container_location_note_#{instance_count}\"] = top_container_resolved['container_locations'].map{ |l| l['note']}.join{';'}\n end\n\n request[\"requestable_#{instance_count}\"] = (top_container_resolved['active_restrictions'] || [])\n .map{ |ar| ar['local_access_restriction_type'] }\n .flatten.uniq\n .select{ |ar| (self.repo_settings[:hide_button_for_access_restriction_types] || []).include?(ar)}\n .empty?\n\n locations = top_container_resolved[\"container_locations\"]\n if locations.any?\n location_id = locations.sort_by { |l| l[\"start_date\"]}.last()[\"ref\"]\n location = archivesspace.get_location(location_id)\n request[\"instance_top_container_location_#{instance_count}\"] = location['title']\n request[\"instance_top_container_location_id_#{instance_count}\"] = location_id\n request[\"instance_top_container_location_building_#{instance_count}\"] = location['building']\n end\n\n collection = top_container_resolved['collection']\n if collection\n request[\"instance_top_container_collection_identifier_#{instance_count}\"] = collection\n .select { |c| c['identifier'].present? }\n .map { |c| c['identifier'] }\n .join(\"; \")\n\n request[\"instance_top_container_collection_display_string_#{instance_count}\"] = collection\n .select { |c| c['display_string'].present? }\n .map { |c| c['display_string'] }\n .join(\"; \")\n end\n\n series = top_container_resolved['series']\n if series\n request[\"instance_top_container_series_identifier_#{instance_count}\"] = series\n .select { |s| s['identifier'].present? }\n .map { |s| s['identifier'] }\n .join(\"; \")\n\n request[\"instance_top_container_series_display_string_#{instance_count}\"] = series\n .select { |s| s['display_string'].present? }\n .map { |s| s['display_string'] }\n .join(\"; \")\n\n end\n\n request\n }\n\n mappings\n end", "def coverage(scraperjsonpath, results)\n # get the element names\n elements = JSON.load(File.open scraperjsonpath)['elements'].keys\n coverage = []\n # calculate coverage\n elements.each do |element|\n # calculate coverage for this line\n if results.detect { |result| result.is_a?(Hash) && result.key?(element) }\n coverage << 1\n else\n coverage << 0\n end\n end\n { :name => scraperjsonpath,\n :source => elements.join('\\n'),\n :coverage => coverage }\nend", "def json_index_bundles\n\n @bundles = Bundle.where(\"active = 'y'\").order(:id)\n respond_to do |format|\n format.json { render json: @bundles.as_json()\n\n }\n end\n\n end", "def select_json_searchers\n return @json_searchers if @file_selection.empty?\n\n @json_searchers.select{ |key,value| @file_selection.include?(key) }\n end", "def parse_results(json:)\n results = []\n return results unless json.present? && json.fetch('items', []).any?\n\n json['items'].each do |item|\n next unless item['id'].present? && item['name'].present?\n\n results << {\n ror: item['id'],\n name: item['name'],\n url: item.fetch('links', []).first,\n domain: org_website(item: item),\n country: org_country(item: item),\n abbreviation: item.fetch('acronyms', []).first,\n types: item.fetch('types', []),\n aliases: item.fetch('aliases', []),\n acronyms: item.fetch('acronyms', []),\n labels: item.fetch('labels', [{}]).map { |lbl| lbl[:label] }.compact\n }\n end\n results\n end", "def club_cache(page)\n information = Hash.new\n fields = [:name,:mission,:link,:location,:affiliations,:service]\n\n table_info = page.css('table[class=\"c-table\"]').children\n\n count = 0\n table_info.each do |club|\n inside = 0\n if count > 2\n club_info = fields.each_with_object(nil).to_h\n club.children.each do |value|\n if !value.text.strip.empty?\n if inside == 0\n name = value.css('a').text.strip\n club_info[:name] = name\n link = \"https://activities.osu.edu\" + value.css('a').attribute('href')\n club_info[:link] = link\n elsif inside == 1\n mission = value.text.strip\n club_info[:mission] = mission\n elsif inside == 2\n pre_split = value.text.strip\n post_split = pre_split.split(',')\n location, affiliations, *service = pre_split.split(',')\n club_info[:location] = location\n club_info[:affiliations] = affiliations\n club_info[:service] = service*\", \"\n end\n inside += 1\n end\n information[name] = club_info\n end\n end\n count+=1\n end\n \n #Saves as json \n json_file = File.write 'clubs.txt', information.to_s\nend", "def get_contestant_name(data, occupation)\ncontestant_name = data.each do |season,contestant|\n #binding.pry\ncontestant.each do |x|\n #binding.pry\n if x[\"occupation\"] == occupation\n name = x[\"name\"]\n return name\n end\nend\nend\nend", "def get_json(a)\n x = {}\n x.store(a,@a[a])\n JSON.generate(x)\n end", "def criteria_to_json criteria\n criteria.each.map{ |doc| (response ||= []) << doc }.flatten.to_json\n end", "def json\n h = Hash.new\n\n h[\"description\"] = overview # add \"...\" if over certain size\n h[\"sources\"] = [full_name]\n h[\"subtitle\"] = \"(#{year}) #{genre}\"\n h[\"thumb\"] = poster\n h[\"art\"] = art\n\n t = name[0..32]\n t = t + \"..\" if t.size > 32\n h[\"title\"] = t\n\n h[\"rating\"] = rating\n h[\"runtime\"] = runtime\n\n h\n end", "def issue_from_id(id)\n json_file('partystances').detect { |i| i['id'] == id } \n end", "def home\n @json_all_activities = Activity.all.to_json\n @json_featured_activities = Activity.find_all_by_featured(true).to_json\n @json_all_zones = Zone.find(:all, :order => \"name\").to_json\n @json_featured_zones = Zone.find_all_by_featured(true, :order => \"name\").to_json\n end", "def get_json\n html = Nokogiri::HTML(@page)\n text = open(\"https://theintercept.com/api/requestSIDDocuments/?orderBy=publishedTime&orderDirection=desc&perPage=2000\").read\n documents = JSON.parse(text)[\"documents\"][\"edges\"].map{|d| d[\"node\"]}\n \n documents.each do |doc|\n @output.push(parse_json(doc))\n end\n\n return JSON.pretty_generate(@output)\n end", "def example_result\n {\n \"data\": {\n \"id\": \"1\",\n \"type\": \"user\",\n \"attributes\": {\n \"first_name\": \"test\",\n \"last_name\": \"jones\"\n },\n \"relationships\": {\n \"blogs\": {\n \"data\": [\n {\n \"id\": \"1\",\n \"type\": \"blog\"\n },\n {\n \"id\": \"3\",\n \"type\": \"blog\"\n }\n ]\n }\n }\n },\n \"included\": [\n {\n \"id\": \"1\",\n \"type\": \"blog\",\n \"attributes\": {\n \"title\": \"Blog 1\"\n },\n \"relationships\": {\n \"images\": {\n \"data\": [\n {\n \"id\": \"4\",\n \"type\": \"image\"\n },\n {\n \"id\": \"3\",\n \"type\": \"image\"\n }\n ]\n }\n }\n },\n {\n \"id\": \"3\",\n \"type\": \"blog\",\n \"attributes\": {\n \"title\": \"another blog 1\"\n },\n \"relationships\": {\n \"images\": {\n \"data\": [\n {\n \"id\": \"5\",\n \"type\": \"image\"\n }\n ]\n }\n }\n },\n {\n \"id\": \"4\",\n \"type\": \"image\",\n \"attributes\": {\n \"filename\": \"ghg\"\n }\n },\n {\n \"id\": \"3\",\n \"type\": \"image\",\n \"attributes\": {\n \"filename\": \"ii\"\n }\n },\n {\n \"id\": \"5\",\n \"type\": \"image\",\n \"attributes\": {\n \"filename\": \"rty\"\n }\n }\n ]\n }\n end", "def json_index_items_designs_by_item_id\n\n respond_to do |format|\n if ItemsDesign.exists?(item_id:params[:item_id])\n @items_designs = ItemsDesign.where('item_id=?',params[:item_id]).order(\"id\")\n\n format.json { render json: @items_designs }\n else\n format.json { render json: 'not found item id' , status: :not_found }\n end\n end\n end", "def parse_results(json:)\n results = []\n return results unless json.present? && json.fetch('items', []).any?\n\n json['items'].each do |item|\n next unless item['id'].present? && item['name'].present?\n\n results << {\n ror: item['id'].gsub(/^#{landing_page_url}/, ''),\n name: org_name(item: item),\n sort_name: item['name'],\n url: item.fetch('links', []).first,\n language: org_language(item: item),\n fundref: fundref_id(item: item),\n abbreviation: item.fetch('acronyms', []).first\n }\n end\n results\n end", "def get_first_movies\n\t\t@movies = Movie.where(\"release_date > ?\", 3.years.ago).order('random()').joins(:critic_movies).group('movies.id').having(\"count(movie_id) > #{CUTOFF}\")\n\t\t.limit(1).to_a\n\t\t@movies.each do | movie | \n\t\t\tmovie.title = movie.title.split.map(&:capitalize).join(' ')\n\t\tend\n\t\t@movies = @movies.to_a.map(&:serializable_hash).to_json\n\t\trender :json => @movies\n\tend", "def filter(event)\n\tstring = event.get(\"[bluecheck][sectools]\")\n\tstring2 = string.gsub(\"ProcessID\",\"{ \\\"ProcessID\\\"\")\n\tstring3 = string2.gsub(\" Vendor\",\", \\\"Vendor\\\"\")\n\tstring4 = string3.gsub(\" Product\",\", \\\"Product\\\"\")\n\tstring5 = string4.gsub(\",{\",\"},{\")\n\tstring6 = string5.gsub(\": \",\": \\\"\")\n\tstring7 = string6.gsub(\", \",\"\\\", \")\n\tstring8 = string7.gsub(\"},\",\"\\\"},\")\n\tstring9 = \"[\"+string8+\"\\\" }]\"\n\tjson = JSON.parse(string9)\n\tevent.tag(\"_rubyparseok\")\n\tevent.set(\"[bluecheck][sectools]\", json)\n\treturn [event]\nend", "def parse_result_json_to_hash(results_json)\n by_kind = {}\n results_json.each do |record|\n record_severity = record['severity'].capitalize\n record_kind = record['kind'].capitalize\n\n by_kind[record_kind] ||= {}\n by_kind[record_kind][record_severity] ||= 0\n\n by_kind[record_kind][record_severity] += 1\n end\n\n by_kind\n end", "def json_at(url)\n JSON.parse(open(url).read, symbolize_names: true)[:objects]\nend", "def get_json(url)\n\t# Get the events from scraping \n\tevents = scrape(url)\n\tname = (((url.split \".\")[0]).split \"/\").pop\n\t# Modify the file of the department\n\tFile.open(\"API/#{name}.json\", \"w\") do |f|\n\tf.write(\"{\\n\")\n\tf.write(\"\\t\\\"events\\\": [\\n\")\n\t# Add an object for every event\n\twhile(!events.empty?)\n\t\tcurr = events.pop\n\t\tf.write(\"\\t\\t{\\n\")\n\t\tf.write(\"\\t\\t\\t \\\"title\\\":\\\"#{curr.title}\\\",\\n\")\n\t\tf.write(\"\\t\\t\\t \\\"timedate\\\":\\\"#{curr.timedate}\\\",\\n\")\n\t\tf.write(\"\\t\\t\\t \\\"desc\\\":\\\"#{curr.desc}\\\",\\n\")\n f.write(\"\\t\\t\\t \\\"dept\\\":\\\"#{curr.dept}\\\"\\n\")\n\t\tf.write(\"\\t\\t},\\n\") if !events.empty?\n\t\tf.write(\"\\t\\t}\\n\") if events.empty?\n\tend\n\tf.write(\"\\t]\\n\")\n\tf.write(\"}\")\n\tend\n\treturn name #10/6 Steven\nend", "def fetch_common_json(common_conf_name, folders)\n common_json = {}\n folders.each_with_index do |client_conf_folder, index|\n next_conf_folder = folders.to_a[index + 1].nil? ? 0 : folders.to_a[index + 1]\n puts \"for file : #{common_conf_name} : client : #{client_conf_folder}\"\n common_json = compare_and_intersect(client_conf_folder, next_conf_folder, common_conf_name, common_json)\n end\n\n return common_json\n end", "def get_movie_characters_from_api(movie)\nmovie_hash = make_search('http://www.swapi.co/api/films/')\ncharacters_array = []\n movie_hash[\"results\"].each do |item|\n if item[\"title\"].downcase == movie\n item[\"characters\"].each do |character| #urls \n character_info_hash = make_search(character)\n characters_array << character_info_hash\n end \n end\n end \n #characters_array #all the info on films an array of hashes\n parse_movie_character(characters_array)\nend", "def scrape_titles(json_file)\n new_titles = []\n json_file.each do |prop|\n current_buffer = []\n if prop[1].is_a? (Hash)\n current_buffer << prop[0]\n new_titles = parse_hash_titles(new_titles,current_buffer,prop[1])\n else\n unless prop[1].nil?\n new_titles << prop[0]\n end\n end\n end\n return new_titles\n end", "def get_character_movies_from_api(character)\n all_characters = RestClient.get('http://www.swapi.co/api/people/')\n character_hash = JSON.parse(all_characters)\n\n results = []\n still_searching = true\n\n while still_searching\n results << character_hash[\"results\"] # results pushed into results array on every loop iteration\n if character_hash[\"next\"]\n next_page = RestClient.get(character_hash[\"next\"])\n character_hash = JSON.parse(next_page)\n else\n still_searching = false\n end\n end\n\n results = results.flatten\n results = results.select {|chara| chara[\"name\"].downcase == character}\n # results is an array containing a hash\n\n if results.length > 0\n film_hash = results[0][\"films\"].map do |film_url|\n film = RestClient.get(film_url)\n film = JSON.parse(film)\n end\n end\nend", "def json_index_items_designs_of_bundle_by_bundle_id\n\n respond_to do |format|\n\n if Bundle.exists?(id:params[:bundle_id])\n\n @bundles_items_designs = ItemsDesign.\n select('items_designs.id ,\n items_designs.name,\n items_designs.item_id,\n items_designs.description,\n items_designs.category,\n items_designs.style,\n items_designs.brand,\n items_designs.color,\n items_designs.make,\n items_designs.special_name,\n items_designs.like,\n items_designs.image_name,\n items_designs.image_name_hover,\n items_designs.image_name_selection').\n joins(:bundles_items_designs).\n where('bundles_items_designs.bundle_id=?',params[:bundle_id]).\n order('items_designs.item_id')\n\n format.json { render json: @bundles_items_designs }\n else\n format.json { render json: 'not found bundle id' , status: :not_found }\n end\n\n\n end\n end", "def group_exists(element)\n name = element[\"group\"]\n auth = element[\"auth\"] \n body = {\n \"jsonrpc\" => \"2.0\",\n \"method\" => \"hostgroup.get\",\n \"params\" => {\n \"output\" => \"extend\",\n \"filter\" => {\n \"name\" => name\n }\n },\n \"auth\" => auth,\n \"id\" => rand(9999)\n }\n\n result = json_body(body)\n # puts result \n if result == []\n return result\n else\n result = result[0][\"groupid\"]\n return result \n end\nend", "def interesting(options = {})\n response = Typhoeus::Request.get(\"#{DARKSKY_API_URL}/interesting/#{@api_key}\", DEFAULT_OPTIONS.dup.merge(options))\n JSON.parse(response.body) if response.code == 200 \n end", "def extract_dependancy(component)\n bower_file = File.join(component, BOWERJSON)\n\n if(!File.exist?(bower_file))\n logger.warn \"no #{BOWERJSON} file found for #{component}\"\n return\n end\n\n bower_file = JSON.parse(File.read(bower_file))\n if(!bower_file.has_key?('main'))\n logger.warn \"No main section found for #{component}\"\n return\n end\n\n files_ = bower_file['main']\n files = files_.is_a?(Array) ? files_ : [files_]\n\n {\n :name => bower_file['name'],\n :files => files\n }\n end", "def to_json(platform)\n rv = []\n needs_sorting = false\n self.each do |item|\n jsonrec = {\n 'htid' => item.htid,\n 'ingest' => item.last_update_date,\n 'rights' => item.rights,\n 'heldby' => [], # not needed, TODO: remove print holdings\n 'collection_code' => item.collection_code,\n }\n\n if item.enum_chron\n jsonrec['enumcron'] = item.enum_chron\n needs_sorting = true\n end\n\n if item.enum_pubdate\n jsonrec['enum_pubdate'] = item.enum_pubdate\n jsonrec['enum_pubdate_range'] = HathiTrust::Traject::Macros::HTMacros.compute_date_range(item.enum_pubdate.to_i)\n end\n\n\n if platform == :ht\n jsonrec['dig_source'] = item.dig_source if item.dig_source\n end\n\n rv << jsonrec\n end\n\n\n if needs_sorting\n rv = sortHathiJSON(rv)\n end\n rv.to_json\n end", "def getjson\n sha = params[:data]\n history = History.find_or_initialize_by({:sha => sha})\n if !history.new_record?\n render :json => history.json.to_json\n else\n raise ActionController::RoutingError.new('Not Found')\n end\n end", "def render_json\n end", "def get_movies_of_specific_character(specific_character_data)\n specific_character_films = specific_character_data.first[\"films\"]\nend", "def get_json\n json = @doc.css('script')\n json.each do |script|\n body = script.content\n pos = body.index('var rgGames = ')\n if pos\n pos += 'var rgGames = '.length\n game_json, *others = body[pos, body.length].split(/;/)\n res = JSON.parse(game_json.strip)\n if res.kind_of?(Array) && res.first && res.first['appid'].to_i > 1\n return res\n end\n end\n end\n return nil\n end", "def fetch_stat_json(metric_flag, var_name)\n metric = MetricVariable.find_metric_flag_key_by_value(metric_flag)\n doc = @document[\"#{metric}.page_#{@page_id}_#{var_name}\"].find\n build_json(metric, doc).to_json\n end", "def to_json\n (@matches.map {|m| m.to_json}).to_json\n end", "def extract_raw_hotels_from_json(json)\n if json[:HotelList] && json[:HotelList][:Hotel]\n json[:HotelList][:Hotel]\n else\n []\n end\n end", "def recent_matches\n @matches = Match.where(status: nil);\n render json: { matches: @matches }, status: :ok\n end", "def find\n @veggies = params[:veggies].split(',')\n\n\n @fruits = [ ]\n @veggies.each do |veggie|\n @fruits += Fruit.where(\"companions like ?\", \"%#{veggie}%\")\n end\n\n @fruits.uniq!\n\n render json: @fruits\n # ***WHAT IF THERE ARE NO MATCHES?****\n\n\n end", "def extract_raw_flights_from_json(json)\n if json[:FlightList] && json[:FlightList][:Flight]\n json[:FlightList][:Flight]\n else\n []\n end\n end", "def getDuplicates\n\t\t\t\tbegin\n\t\t\t\t\t# [TODO] LOG [DEBUG MESSAGE]\n\t\t\t\t\t# Call getPeopleData method to retrieve data from SalesLoft API\n\t\t\t\t\tresponse_body = getPeopleData\n\t\t\t\t\t\n\t\t\t\t\t# Extract all emails without whitespace remove everything after @ and downcase\n\t response_body[\"data\"].map!{|k| k[\"email_address\"].downcase.gsub(/[[:space:]]/, '')}\n\n\t # Break email up into username and domain\n\t response_body[\"data\"].map! {|email|\n\t \tsymbol_index = email.index('@')\n\t \temail = {\n\t \t\t\temail_address: email,\n\t \t\t\tusername: username = email[0..symbol_index-1],\n\t \t\t\tdomain: email[symbol_index..email.length]\n\t \t\t}\n\t }\n\n\t # Call checkDupe Method\n\t return_hash = checkDupe(response_body[\"data\"])\n\n\t # Return Response\n\t render json: {\n\t \tresponse_data: return_hash, \n\t \ttimestamp:Time.now,\n\t \toperation: \"get_duplicate_data\", \n\t \tstatus: \"success\", \n\t \tuuid: SecureRandom.uuid,\n\t \tresponse_code: 200,\n\t \tmessage: \"Data Retrieved\"\n\t }\n \trescue StandardError => e\n \t\t# [TODO] LOG [ERROR MESSAGE]\n\t \trender json: {\n\t\t \tresponse_data: e.message,\n\t\t \tstatus: \"error\",\n\t\t \toperation: \"get_duplicate_data\", \n\t\t \ttimestamp:Time.now, \n\t\t \tuuid: SecureRandom.uuid, \n\t\t \tresponse_code: 500,\n\t\t \tmessage: \"Error Occured\"\n\t\t }\n\n \tend # End rescue block\n\t\t\tend", "def filter_suggestionsInvestingDotCom\r\n @suggestionsFromInvestingDotCom = @@SJA.select(\"stocks.isin, name, last_price, investing_dotcomrating\").where(\"investing_dotcomrating = ?\", true).order(:name)\r\n render json: @suggestionsFromInvestingDotCom\r\n end", "def scanJsonString(_jsonStr)\n _json = JSON.parse(_jsonStr, {:symbolize_names => true}) ;\n _json.each{|_entryJson|\n scanJsonEntry(_entryJson) ;\n }\n end" ]
[ "0.5774689", "0.56394416", "0.56175494", "0.54995936", "0.5499529", "0.5493445", "0.543209", "0.54216504", "0.5410042", "0.5398325", "0.53955185", "0.5324582", "0.5265653", "0.525732", "0.52540404", "0.5251907", "0.5248069", "0.5238134", "0.5233623", "0.5222793", "0.52203625", "0.5219744", "0.51930904", "0.51925176", "0.5179003", "0.51415104", "0.51406807", "0.5139369", "0.5129813", "0.5122859", "0.5106386", "0.5105914", "0.5094015", "0.5093471", "0.50902337", "0.5088754", "0.50856024", "0.50849384", "0.5081117", "0.5070031", "0.5067151", "0.50655717", "0.5022765", "0.5020117", "0.50134176", "0.50127286", "0.500972", "0.5002545", "0.4997554", "0.49863803", "0.49852902", "0.49791068", "0.49780104", "0.49590218", "0.49577034", "0.49538797", "0.49524167", "0.4951244", "0.49487558", "0.49468347", "0.49377957", "0.49345338", "0.49333712", "0.4924088", "0.49224693", "0.49153414", "0.4914221", "0.49066377", "0.49058163", "0.49046016", "0.48969913", "0.4894668", "0.48880583", "0.48816383", "0.4881144", "0.48805523", "0.4880269", "0.48778176", "0.48740584", "0.48710752", "0.48698914", "0.4868552", "0.48675954", "0.48628095", "0.48604605", "0.48604524", "0.48572338", "0.48524073", "0.48497918", "0.4847554", "0.48415574", "0.48413828", "0.48406366", "0.48346204", "0.4833014", "0.4830057", "0.48277897", "0.48234448", "0.48217878", "0.4821663" ]
0.5263997
13
TODO: add validation on create Update fields based on occurence
def update_attributes(params = {}) super validate_attributes(params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_on_create; end", "def validate_on_create #:doc:\n end", "def find_or_create_custom_fields\n @error_class_field = IssueCustomField.find_or_initialize_by_name('Error class')\n if @error_class_field.new_record?\n @error_class_field.attributes = {:field_format => 'string', :searchable => true, :is_filter => true}\n @error_class_field.save(:validate => false)\n end\n\n @occurences_field = IssueCustomField.find_or_initialize_by_name('# Occurences')\n if @occurences_field.new_record?\n @occurences_field.attributes = {:field_format => 'int', :default_value => '0', :is_filter => true}\n @occurences_field.save(:validate => false)\n end\n\n @environment_field = IssueCustomField.find_or_initialize_by_name('Environment')\n if @environment_field.new_record?\n @environment_field.attributes = {:field_format => 'string', :searchable => true, :is_filter => true}\n @environment_field.save(:validate => false)\n end\n\n @trace_filter_field = ProjectCustomField.find_or_initialize_by_name('Backtrace filter')\n if @trace_filter_field.new_record?\n @trace_filter_field.attributes = {:field_format => 'text'}\n @trace_filter_field.save(:validate => false)\n end\n\n @repository_root_field = ProjectCustomField.find_or_initialize_by_name('Repository root')\n if @repository_root_field.new_record?\n @repository_root_field.attributes = {:field_format => 'string'}\n @repository_root_field.save(:validate => false)\n end\n end", "def check_for_new_fields(hash)\n if new_value?('category', hash['category'])\n note(hash['uid'], \"You have created a new category '#{hash['category']}'. Did you mean to?\") \n elsif new_value?('parameter', hash['parameter'])\n note(hash['uid'], \"You have created a new property of '#{hash['category']}', '#{hash['parameter']}'. Did you mean to?\") \n end\n if new_value?('source', hash['source'])\n note(hash['uid'], \"You have created a new source '#{hash['source']}'. Did you mean to?\")\n end \nend", "def create\n params.each do |key,value|\n if value.present? && !(['unique_id','controller','action','label','label_other','label_color'].include?(key))\n # is this unnecessary ?\n if value.kind_of?(Array)\n value = value[0]\n end \n @found = Field.where(unique_id: params[:unique_id], field_name: key.to_s )\n if @found.blank?\n @field = Field.new()\n else\n @field = @found.first\n end\n @field.field_name = key.to_s\n @field.field_value = value.to_s\n @field.user_id = current_user.id\n @field.form_id = params[:form_id]\n @field.unique_id = params[:unique_id]\n if params[:label] == 'other'\n @field.label = params[:label_other]\n else \n @field.label = params[:label]\n end\n @field.labelcolor = params[:label_color] \n @field.save\n end\n end\n if @found.blank?\n NotificationMailer.saved_email(current_user.email).deliver_now\n end\n @form = Field.where(unique_id: '9fc89d9e-5bcd-4c66-9e60-3ffb93503a88').to_a\n @form_fields = Hash.new\n @form.each do |value|\n @form_fields[value.field_name] = value.field_value\n end\n redirect_to \"/dashboard\"\n end", "def validate_on_create=(_arg0); end", "def create_fields\n self.class.required_on_create.each{|key| @properties[key] ||= \"\"} # Add required fields\n self.class.never_on_create.each{|key| @properties.delete(key)} # Remove prohibited fields\n @properties\n end", "def validate_on_create(fields)\n check_required_fields(fields, self.class.required_on_create)\n validate_on_save(fields)\n end", "def validate_on_update # :doc:\n end", "def validate_on_save(fields)\n end", "def validate_on_update(fields)\n check_required_fields(fields, self.class.required_on_update)\n validate_on_save(fields)\n end", "def update_fields\n fieldlist = self.class.required_on_update + @newvalues.to_a - self.class.never_on_update\n @properties.select{|key, value| fieldlist.include?(key)}\n end", "def validate_required_fields\n user = new_record? ? author : current_journal.try(:user)\n\n required_attribute_names(user).each do |attribute|\n if /^\\d+$/.match?(attribute)\n attribute = attribute.to_i\n v = custom_field_values.detect {|v| v.custom_field_id == attribute}\n if v && Array(v.value).detect(&:present?).nil?\n errors.add(v.custom_field.name, l('activerecord.errors.messages.blank'))\n end\n else\n if respond_to?(attribute) && send(attribute).blank? && !disabled_core_fields.include?(attribute)\n next if attribute == 'category_id' && project.try(:issue_categories).blank?\n next if attribute == 'fixed_version_id' && assignable_versions.blank?\n\n #####\n # START PATCH\n next if attribute == 'typology_id' && !project.module_enabled?('typologies')\n next if attribute == 'typology_id' && project.typologies.blank?\n # END PATCH\n #####\n\n errors.add attribute, :blank\n end\n end\n end\n end", "def update_type_fields\n # Topic must be present\n errors.add :topic, :blank unless topic\n\n # Subject and pull request must be blank\n errors.add :subject, :present if subject\n errors.add :pull_request, :present if pull_request\n end", "def update\n respond_to do |format|\n if @resource_type.update_attributes(params[:resource_type])\n if params[:fields]\n params[:fields].each do |param|\n if param[:id]\n @field = Field.find(param[:id])\n @field.update_attributes(\n :name => param[:name], \n :field_type_id => param[:field_type_id],\n :resource_type_id => params[:id],\n :resource_type_reference_id => param[:resource_type_reference_id]\n )\n else\n @field = Field.create(\n :name => param[:name],\n :field_type_id => param[:field_type_id],\n :resource_type_id => params[:id],\n :resource_type_reference_id => param[:resource_type_reference_id]\n )\n end\n if @field.field_validations.any?\n @field.field_validations.each { |v| v.destroy }\n end\n if param[:validator_ids]\n param[:validator_ids].each do |index|\n next if index == \"multiselect-all\"\n @field.field_validations.build(validator_id: index.to_i)\n end\n end \n @field.save\n end\n end \n format.html { redirect_to @resource_type, notice: 'Resource type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @resource_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def before_validation_on_update\n before_validation_on_create\n end", "def validate_create_params!(params); end", "def fill_up_user_create\n # if self.class.column_names.include? 'updated_by_id'\n # if UserInfo.current_user_id\n # # if updated_by_id && updated_by_id != UserInfo.current_user_id\n # # logger.info \"NOTICE create - self.updated_by_id is different: #{updated_by_id}/#{UserInfo.current_user_id}\"\n # # end\n # # self.updated_by_id = UserInfo.current_user_id\n # end\n # end\n\n # return true if !self.class.column_names.include? 'created_by_id'\n\n return true if !UserInfo.current_user_id\n\n # if created_by_id && created_by_id != UserInfo.current_user_id\n # logger.info \"NOTICE create - self.created_by_id is different: #{created_by_id}/#{UserInfo.current_user_id}\"\n # end\n # self.created_by_id = UserInfo.current_user_id\n true\n end", "def save_fields\n @project = Project.find(params[:id])\n\n # Delete fields as necessary\n puts params[:hidden_deleted_fields]\n if params[:hidden_deleted_fields] != ''\n params[:hidden_deleted_fields].split(',').each do |x|\n if Field.find(x).destroy == -1 and return\n end\n end\n end\n\n # Update existing fields, create restrictions if any exist\n @project.fields.each do |field|\n restrictions = []\n\n if params.key?(\"#{field.id}_restrictions\")\n restrictions = params[\"#{field.id}_restrictions\"].split(',')\n if restrictions.count < 1\n restrictions = []\n end\n end\n\n unless field.update_attributes(name: params[\"#{field.id}_name\"],\n unit: params[\"#{field.id}_unit\"],\n index: params[\"#{field.id}_index\"],\n restrictions: restrictions)\n respond_to do |format|\n flash[:error] = 'Field names must be unique.'\n redirect_to \"/projects/#{@project.id}/edit_fields\" and return\n end\n end\n end\n\n # Add fields based on type\n if params[:hidden_location_count] == '1'\n if addField('Latitude', params[:latitude], 'deg', [], params['latitude_index']) == -1 and return\n end\n if addField('Longitude', params[:longitude], 'deg', [], params['longitude_index']) == -1 and return\n end\n end\n\n if params[:hidden_timestamp_count] == '1'\n if addField('Timestamp', params[:timestamp], '', [], params['timestamp_index']) == -1 and return\n end\n end\n\n (params[:hidden_num_count].to_i).times do |i|\n if addField('Number', params[('number_' + (i + 1).to_s).to_sym], params[('units_' + (i + 1).to_s).to_sym], [], params[('number_' + ((i + 1).to_s) + '_index').to_sym]) == -1 and return\n end\n end\n\n (params[:hidden_text_count].to_i).times do |i|\n # Need to explicitly check if restrictions are nil because empty restrictions should be []\n restrictions = params[('restrictions_' + (i + 1).to_s).to_sym].nil? ? [] : params[('restrictions_' + (i + 1).to_s).to_sym].split(',')\n\n if addField('Text', params[('text_' + (i + 1).to_s).to_sym], '', restrictions, params[('text_' + (i + 1).to_s + '_index').to_sym]) == -1 and return\n end\n end\n\n redirect_to \"/projects/#{@project.id}\", notice: 'Fields were successfully updated.' and return\n end", "def fields_not_to_clean\n ['deleted_record','record_before','record_after']\n end", "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:short_description => self.short_description}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_organization\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:target_market_name => self.target_market_name}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_target_market\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend", "def _process_on_create(entity)\n end", "def validate_on_create\n if View.find(:first, :conditions => [\"created_by = ? and resource_type = ? and resource_id = ?\", created_by, resource_type, resource_id])\n errors.add_to_base(\"View must be unique\")\n end\n end", "def check_fields\n columns= resource.model.column_names - AutoRest::AR_MAGIC_COLUMNS\n\n default_columns= columns.select { |attr| attr !~ /.*_count$/ }.map do |elem|\n [elem.intern, elem.titleize]\n end\n\n # For storing columns, I use an array and not a hash --i.e.: (:column => 'Title') -- \n # to ensure the order of the columns. I convert the params from linear array to \n # grouped array to alivianate user's data entry:\n # [[:col0, \"name0\"], [:col1, \"name1\"]] becomes [:col0, \"name0\", :col1, \"name1\"]\n \n # *TODO* This should be cleaned a little, because right now is a bit difficult\n # to remember the way the attributes for each view work.\n\n [:for_index, :for_new, :for_edit, :for_show].each do |key|\n arr= fields.send(key)\n exc= exclude_fields.send(key)\n\n if !arr # User has not supplied columns.\n arr= default_columns\n else\n # enum_for creates an enum from array, therefore protecting the original array contents.\n # each slice returns an array of specified elements: [1,2,3,4] => 1..4 => [[1,2],[3,4]]\n arr= arr.enum_for(:each_slice, 2).to_a\n end\n \n # Remove excluded fields.\n arr= arr.reject { |e| exc.map{|elem|elem.to_s}.include?(e[0].to_s) } if exc\n fields.send(\"#{key}=\", arr)\n end\n end", "def before_update_save(record); end", "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend", "def validate!\n if identifier.to_s.empty?\n raise ValidationError.new(\"identifier is required\")\n else\n [image_changes.created,\n image_changes.updated,\n unit_changes.created,\n unit_changes.updated].each do |collection|\n collection.each(&:validate!)\n end\n\n true\n end\n end", "def create_duplicates!(instance)\n\t\t\tset_duplicants_values!(instance,true) # true for creating duplicates\n\t\t\t@duplicated_fieldlets.each{|f| f.save}\n\t\tend", "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:mark_code => self.mark_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_mark\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:short_description => self.short_description}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_organization\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend", "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:contact_method_type_code => self.contact_method_type_code},{:contact_method_code => self.contact_method_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_contact_method\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:party_type_name => self.party_type_name},{:party_name => self.party_name}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_party\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend", "def update_eob_fields\n if self.manual && self.eob_details.blank?\n self.eob_details.new(:dos => self.dos, :charge_amount => self.charge_amount, :payment_amount => self.payment_amount, :created_user => self.created_user)\n end\n end", "def create fields\n\t\tfields.delete_if {|key, value| !@validFields.include? key}\n\t\tselection = \"\"\n\t\tvalues = \"\"\n\n\t\tfields.each do |key, value|\n\t\t\tselection += \"#{key}, \"\n\t\t\tvalues += \"'#{value}', \"\n\t\tend\n\n\t\tselection = selection[0..-3]\n\t\tvalues = values[0..-3]\n\n\t\tbegin\n\t\t\tquery = \"INSERT INTO #{@table}(#{selection}) VALUES(#{values})\"\n\n\t\t\t@dbh.query query\t\n\t\t\t@dbh.last_id\n\t\trescue => e\n\t\t\tputs \"Error: #{e.error}\"\n\t\t\tnil\n\t\tend\n\tend", "def validated_for_update?(c)\n valid = true\n if first_name.blank? && last_name.blank?\n c.errors.add_to_base(\"Must enter contact name\")\n valid = false\n end\n ex_email = Contact.find(:first, :include => [:emails], :conditions => [\"emails.email_text = ? AND contacts.user_id = ? AND contacts.id != ? AND merged_to_form_contact_id = 0\", email, user_id, c.id])\n if ex_email\n c.errors.add_to_base(\"Contact already in network\")\n valid = false\n end\n valid\n end", "def validate_on_save(fields)\n raise ActsAsIcontact::ValidationError, \"privateName cannot contain spaces, quotes, slashes or brackets\" if fields[\"privateName\"] =~ /[\\s\\\"\\'\\/\\\\\\[\\]]/\n raise ActsAsIcontact::ValidationError, \"fieldType must be 'text' or 'checkbox'\" unless fields[\"fieldType\"] =~ /^(text|checkbox)$/\n end", "def update_multi_fields(doc, changes)\n #Fields is expected to be in the form of [[field, content, append]]\n #Ex: [[:title, \"My New Title\"],[:people, \"Person I Forgot To List\", true]]\n changes.each do |change|\n content = change[1]\n content = join_content(doc, change[0], change[1]) if change[2]\n doc.send(change[0].to_s+get_args_for_send(change[0]),content)\n end\n return doc.save #Returns true if this all worked\n end", "def _update_schema\n singular_label, plural_label = self.class.get_flexi_label\n existing = self._flexi_collection\n\n # Check labels\n if existing.singular_label != singular_label\n existing.update_attribute :singular_label, singular_label\n end\n\n if existing.plural_label != plural_label\n existing.update_attribute :plural_label, plural_label\n end\n\n\n # Check fields\n fields = _build_fields\n if _fields_changed? fields, existing\n # TODO: Dangerous need to fix it up\n existing.fields.destroy_all\n existing.update_attribute :fields, fields\n end\n end", "def update_fields\n raise_if_no_document\n @doc.Fields.Update\n end", "def create\r\n\r\n\r\n end", "def update?\n create?\n end", "def update?\n create?\n end", "def update?\n create?\n end", "def update?\n create?\n end", "def update_fields(fields)\n attributes[:action_id] = fields['id'] || attributes[:action_id]\n attributes[:text] = fields['data']['text'] || attributes[:text]\n attributes[:date] = Time.iso8601(fields['date']) if fields.has_key?('date')\n attributes[:member_creator_id] = fields['idMemberCreator'] || attributes[:member_creator_id]\n self\n end", "def patched\n fields.each do |h|\n next if incoming[h].to_s.empty?\n\n # If we didn't have anything before, take the new version\n if existing[h].to_s.empty? || existing[h].to_s.casecmp('unknown').zero?\n existing[h] = incoming[h]\n next\n end\n\n # These are _expected_ to be different on a term-by-term basis\n next if %i[term group group_id area area_id].include? h\n\n # Can't do much yet with these ones\n next if %i[source given_name family_name].include? h\n\n # Accept multiple values for multi-lingual names\n if h.to_s.start_with? 'name__'\n existing[h] += ';' + incoming[h]\n next\n end\n\n # TODO: accept multiple values for :website, etc.\n next if %i[website].include? h\n\n # Accept values from multiple sources for given fields\n if %i[email twitter facebook image].include? h\n existing[h] = [existing[h], incoming[h]].join(';').split(';').map(&:strip).uniq(&:downcase).join(';')\n next\n end\n\n # If we have the same as before (case insensitively), that's OK\n # NB: the casecmp version on its own isn't sufficient in some cases (e.g. Turkey)\n next if (existing[h] == incoming[h]) || existing[h].casecmp(incoming[h].downcase).zero?\n\n # Accept more precise dates\n if h.to_s.include?('date')\n if incoming[h].include?(existing[h])\n existing[h] = incoming[h]\n next\n end\n # Ignore less precise dates\n next if existing[h].include?(incoming[h])\n end\n\n # Store alternate names for `other_names`\n if h == :name\n @new_headers << :alternate_names\n existing[:alternate_names] ||= nil\n existing[:alternate_names] = [existing[:alternate_names], incoming[:name]].compact.join(';')\n next\n end\n\n @warnings << \" ☁ Mismatch in #{h} for #{existing[:uuid]} (#{existing[h]}) vs #{incoming[h]} (for #{incoming[:id]})\"\n end\n\n existing\n end", "def create\n @resource_type = ResourceType.new(params[:resource_type])\n respond_to do |format|\n if @resource_type.save\n if params[:fields]\n params[:fields].each do |param|\n @field = Field.new(\n :name => param[:name], \n :field_type_id => param[:field_type_id],\n :resource_type_id => @resource_type.id, \n :resource_type_reference_id => param[:resource_type_reference_id]\n )\n param[:validator_ids].each do |index|\n @field.field_validations.build(validator_id: index)\n end\n @field.save\n end\n end\n format.html { redirect_to @resource_type, notice: 'Resource type was successfully created.' }\n format.json { render json: @resource_type, status: :created, location: @resource_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @resource_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_task_fields\n return unless is_prototype\n\n self.class.defined_task_fields.each do |task_field|\n new_task_field = task_field.dup\n new_task_field.task_id = self.id\n new_task_field.save\n end\n end", "def valid_create?\n param! :order_reference_id, String, required: true, blank: false\n param! :customer_name, String, blank: false\n param! :amount, Float, blank: false\n param! :discount, Float, blank: false\n param! :source, String, blank: false\n param! :barcode, String, blank: false\n param! :shipping_label_url, String, blank: false\n param! :sales_order_items, Array, blank: false, required: true do |array|\n array.param! :sku_id, Integer, required: true, blank: false\n array.param! :quantity, Integer, required: true, blank: false\n array.param! :price, Float, required: true, blank: false\n array.param! :discount, Float, required: true, blank: false\n end\n end", "def before_create_save(record); end", "def ensure_tracker_has_fields(tracker)\n tracker.custom_fields << @error_class_field unless tracker.custom_fields.include?(@error_class_field)\n tracker.custom_fields << @occurences_field unless tracker.custom_fields.include?(@occurences_field)\n tracker.custom_fields << @environment_field unless tracker.custom_fields.include?(@environment_field)\n end", "def before_save\n changed_fields?\n if(@changed_fields && @changed_fields.keys.include?('rmt_product_id') && ((bins = Bin.find_all_by_delivery_id(self.id)).length>0))\n raise \"sorry cannot change rmt_product of this delivery , #{bins.length} bin(s) have already been scanned for this delivery\"\n end\n puts\n end", "def before_update; end", "def record_data_in_form_fields_entries\n\t\tis_allowed=0\n\n\t\tif (!params.blank? && !params[:new].blank?)\n\t\t\tif params[:signup_form][:email].blank?\n\t\t\t\trender :text => \"<span class=\\\"response_status\\\">Email can't be blank.</span>\", :layout => \"fb_iframe_tab\"\n\t\t\t\treturn\n\t\t\tend\n\t\t\tis_allowed = email_check(params)\n\t\t\t\tlogger.debug \">>>>> is_allowed >>> #{is_allowed.inspect}\"\n\t\t\t\tdata = params[:signup_form][:model_name].constantize.find_by_id(params[:signup_form][:model_id])\n\n\t\t\t\tif !data.blank?\n\t\t\tif is_allowed == 0\n\n \t camp = data.mobile_campaign\n\t\t\t\tif !camp.blank?\n\t\t\t\t\tform_fields = FormField.find_by_model_name_and_model_id_and_campaign_id(params[:signup_form][:model_name],data.id,camp.id)\n\t\t\t\t\tif !form_fields.blank?\n\t\t\t\t\t\tentry = FormFieldEntry.find_by_form_field_id_and_email(form_fields.id,params[:signup_form][:email])\n\t\t\t\t\t\t\tentry_data = Hash.new\n\t\t\t\t\t\t\tparams[:new].each do |k,v|\n\t\t\t\t\t\t\t\tentry_data[k] = v if k != 'data'\n\t\t\t\t\t\t\tend\n#=begin\n\t\t\t\t\t\t\tif !params[:new][:from_id].blank?\n\t\t\t\t\t\t\t\tobj = FormFieldEntry.connection.execute(\"insert into form_field_entries(created_at, updated_at,form_field_id,model_name,model_id,campaign_id,email,entry_data,from_id) values(now(), now(), #{form_fields.id},'#{params[:signup_form][:model_name]}',#{params[:signup_form][:model_id]},#{camp.id},#{FormFieldEntry.sanitize(params[:signup_form][:email])},#{FormFieldEntry.sanitize(entry_data.to_json)},#{params[:new][:from_id]})\")\n\t\t\t\t\t\t\t\tMobileCampaign.connection.execute(\"update mobile_campaigns set leads = leads + 1 where model_name = '#{params[:signup_form][:model_name]}' and model_id = #{params[:signup_form][:model_id]}\")\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tobj = FormFieldEntry.connection.execute(\"insert into form_field_entries(created_at, updated_at,form_field_id,model_name,model_id,campaign_id,email,entry_data) values(now(), now(), #{form_fields.id},'#{params[:signup_form][:model_name]}',#{params[:signup_form][:model_id]},#{camp.id},#{FormFieldEntry.sanitize(params[:signup_form][:email])},#{FormFieldEntry.sanitize(entry_data.to_json)})\")\n\t\t\t\t\t\t\t\tMobileCampaign.connection.execute(\"update mobile_campaigns set leads = leads + 1 where model_name = '#{params[:signup_form][:model_name]}' and model_id = #{params[:signup_form][:model_id]}\")\n\t\t\t\t\t\t\tend\n#=end\n=begin\n\t\t\t\t\t\t\tobj = FormFieldEntry.new\n\t\t\t\t\t\t\tobj.created_at = Time.now\n\t\t\t\t\t\t\tobj.updated_at = Time.now\n\t\t\t\t\t\t\tobj.form_field_id = form_fields.id\n\t\t\t\t\t\t\tobj.model_name = params[:signup_form][:model_name]\n\t\t\t\t\t\t\tobj.model_id = params[:signup_form][:model_id]\n\t\t\t\t\t\t\tobj.campaign_id = camp.id\n\t\t\t\t\t\t\tobj.email = params[:signup_form][:email]\n\t\t\t\t\t\t\tobj.entry_data = FormFieldEntry.sanitize(entry_data.to_json)\n\t\t\t\t\t\t\tif !params[:new][:from_id].blank?\n\t\t\t\t\t\t\t\t\t  obj.from_id = params[:new][:from_id]\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tobj.save\n=end\n=begin\n\t\t\t\t\t\t\th= Hash.new\n\t\t\t\t\t\t\th['1'] = 'test'\n\t\t\t\t\t\t\ttest = FormFieldEntry.new(:form_field_id => 2, :model_name => 'MobileCoupon' , :model_id => 3, :campaign_id => 3, :entry_data => '\"#{h.to_json}\"', :email => 'abcc@gmail.com')\n\t\t\t\t\t\t\t\ttest.save\n=end\n\t\t\t\t\t\t\tif !params[:new][:data].blank?\n \t\t\tentry = FormFieldEntry.find_all_by_model_name_and_model_id(params[:signup_form][:model_name],params[:signup_form][:model_id])\n\t\t\t if !entry.blank?\n \t\t\t entry = entry.last\n\t \t\t entry.update_attribute(:data, params[:new][:data])\n \t\t\t end\n \t\t\t end\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tend\n\t\t\tif !params[:signup_form].blank? && !params[:signup_form][:model_name].blank? && params[:signup_form][:model_name] == \"MobileCoupon\"\n\t\t\t\trender :partial => \"/mobile/coupon/coupon\", :locals =>{:data => data, :message => is_allowed} , :layout => false\n\t\t\treturn\n\t\t\telse\n\t\t render :text => \"<span class=\\\"response_status\\\">Submission Successful!!</span>\", :layout => false\n\t \tend\n\t\tend\n return\n\tend", "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:postal_address_type_code => self.postal_address_type_code},{:city => self.city},{:address1 => self.address1}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_postal_address\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:party_type_name => self.party_type_name},{:party_name => self.party_name}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_party\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend", "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:artist_name => self.artist_name}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_artist\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend", "def initialize_fields\n publisher.build if publisher.empty?\n contributor.build if contributor.empty?\n creator.build if creator.empty?\n identifier.build if identifier.empty?\n description.build if description.empty?\n super\n end", "def validates_associated_post_records; end", "def validates_associated_post_records; end", "def generate_common_fields(request, valid_employee_type_ids, valid_request_type_codes)\n request.position_title = Faker::Name.title\n request.employee_type = EmployeeType.find_by_id(valid_employee_type_ids.sample)\n request.request_type = RequestType.find_by_code(valid_request_type_codes.sample)\n\n generate_department_fields(request)\n request.justification = Faker::Lorem.words(rand(50) + 1).join(' ')\n generate_request_status(request)\n end", "def before_validation_on_create\n self.OTNum ||= self.class.next_OTNum\n self.ticket_no ||= self.class.next_ticket_no\n end", "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:commodity_code => self.commodity_code},{:rmt_variety_code => self.rmt_variety_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_rmt_variety\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:season_code => self.season_code},{:id => self.id}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_season\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend", "def before_update_save(record)\n record.save if record && record.valid?\n end", "def validate_build\n end", "def update_fields(fields)\n\n # Also consider extracting this common code between vendor and item to basic_data\n # instead of going through each attribute on self, iterate through each item in field and update from there\n self.attributes.each do |k, v|\n attributes[k.to_sym] = fields[SYMBOL_TO_STRING[k.to_sym]] || fields[k.to_sym] || attributes[k.to_sym]\n end\n\n attributes[:id] = fields[SYMBOL_TO_STRING[:id]] || attributes[:id]\n self\n end", "def save!\n validate!\n create_or_update\n self\nend", "def update_params\n create_params\n end", "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:puc_type_code => self.puc_type_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_puc_type\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend", "def create\n update\n end", "def create\n create_or_update\n end", "def create\n create_or_update\n end", "def fill_mandatory_attributes(record, new_record)\n record[:usr_id] = $DB[\"SELECT nextval('users_usr_id_seq') as id\"].first[:id] if new_record\n record[:usr_screen_name] ||= \"userX#{$cntr+=1}\"\n\n if new_record\n [:usr_firstname, :usr_lastname].each do |col|\n record[col] = \"tmp_placeholder\"\n LOGGER.warn \"No #{col} for existing record: #{record[:usr_id]}\"\n end\n end\nend", "def fill_up_user_update\n # return true if !self.class.column_names.include? 'updated_by_id'\n return true if !UserInfo.current_user_id\n\n # self.updated_by_id = UserInfo.current_user_id\n true\n end", "def profession_specific_create\n field_name_arr = params[:field_name]\n field_value_arr = params[:field_value]\n attributes_json = {}\n if (field_name_arr != nil)\n field_name_arr.each_with_index do |field_name, index|\n attributes_json[field_name] = field_value_arr[index]\n end\n end\n attributes_json = attributes_json.to_json\n ginfo_last = GeneralInfo.last # this would be last entry in general_info i.e. the one created by previous (general_info/new) page\n ginfo_last.specific_profile = attributes_json\n ginfo_last.save\n if ginfo_last.save!\n redirect_to '/show_profile'\n else\n render :action=> 'new'\n end\n end", "def validations_on_update\n check_if_can_be_set_to_visible_against_price if Validations.on_update('product','not_visible_if_price_lower_than_zero')\n check_if_can_be_set_to_visible_against_images if Validations.on_update('product','not_visible_if_no_images')\n end", "def update_fields(fields)\n\n # instead of going through each attribute on self, iterate through each item in field and update from there\n self.attributes.each do |k, v|\n attributes[k.to_sym] = fields[SYMBOL_TO_STRING[k.to_sym]] || fields[k.to_sym] || attributes[k.to_sym]\n end\n\n attributes[:id] = fields[SYMBOL_TO_STRING[:id]] || attributes[:id]\n self\n end", "def update_fields(fields)\n\n # instead of going through each attribute on self, iterate through each item in field and update from there\n self.attributes.each do |k, v|\n attributes[k.to_sym] = fields[SYMBOL_TO_STRING[k.to_sym]] || fields[k.to_sym] || attributes[k.to_sym]\n end\n\n attributes[:id] = fields[SYMBOL_TO_STRING[:id]] || attributes[:id]\n self\n end", "def update_fields(fields)\n\n # instead of going through each attribute on self, iterate through each item in field and update from there\n self.attributes.each do |k, v|\n attributes[k.to_sym] = fields[SYMBOL_TO_STRING[k.to_sym]] || fields[k.to_sym] || attributes[k.to_sym]\n end\n\n attributes[:id] = fields[SYMBOL_TO_STRING[:id]] || attributes[:id]\n self\n end", "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:account_code => self.account_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_account\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:party_type_name => self.party_type_name},{:party_name => self.party_name},{:role_name => self.role_name}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_parties_role\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend", "def valid_attributes\n FactoryBot.attributes_for(:create_type)\n end", "def create; end", "def create; end", "def create; end", "def create; end", "def uniqify_fields\n begin\n self.uniq_title = self.title.to_uniq\n self.uniq_position = self.position.to_uniq\n self.uniq_playbacks_count = self.playbacks_count.to_uniq\n self.uniq_likes_count = self.likes_count.to_uniq\n self.uuid = UUIDTools::UUID.timestamp_create().to_s if self.uuid.nil?\n rescue\n end\n end", "def validate\n matched = {}\n duplicated_attributes = []\n attributes.each do |attribute|\n if matched.has_key?(attribute.name) && matched[attribute.name] == attribute.name_format\n duplicated_attributes << attribute.name unless duplicated_attributes.include?(attribute.name)\n else\n matched[attribute.name] = attribute.name_format\n end\n end\n if !duplicated_attributes.empty?\n raise ValidationError, \"An attribute with the same name and name format may only be specified once. The following attributes were specified multiple times: #{duplicated_attributes.join(',')}\"\n end\n end", "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:commodity_code => self.commodity_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_commodity\n\t end\n\t \n\tif is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:equivalent_count_from => self.equivalent_count_from}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_equivalent_count_from\n\t end\n\t \n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:equivalent_count_to => self.equivalent_count_to}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_equivalent_count_to\n\t end\n\t \n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend", "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\n\n\t puts \"VALID: \" + is_valid.to_s\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:system_name => self.system_name},{:subsystem_name => self.subsystem_name}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_subsystem\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:affected_object_type_name => self.affected_object_type_name}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_affected_object_type\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend", "def disambiguate_fields\n if name_changed? # New, Updated\n fields = self.class.specific.where(\"LOWER(name) = LOWER(?)\", self.name)\n fields.update_all(:disambiguate => fields.many?)\n end\n\n if name_was # Updated, Destroyed\n fields = self.class.specific.where(\"LOWER(name) = LOWER(?)\", self.name_was)\n fields.update_all(:disambiguate => fields.many?)\n end\n end", "def validation; end", "def validation; end", "def process_after_create\n # Note: Both contacts and addresses fields are same so when organization create then address info will store in Address table so commented the code for contact :- Vishal\n\n # contact = contacts.build(contact_address_1: organization_address_1, contact_address_2: organization_address_2,\n # contact_city: organization_city, contact_country: organization_country, contact_description: organization_description,\n # contact_email: organization_email, contact_fax: organization_fax, contact_notes: organization_notes,\n # contact_state: organization_state, contact_telephone: organization_telephone, contact_title: organization_name,\n # contact_website: organization_website, contact_zipcode: organization_zipcode, contact_type: 'address')\n # contact.save\n\n address = addresses.build(address_address_1: organization_address_1, address_address_2: organization_address_2,\n address_city: organization_city, address_country: organization_country, address_description: organization_description,\n address_email: organization_email, address_fax: organization_fax, address_notes: organization_notes,\n address_state: organization_state, address_telephone: organization_telephone, address_title: organization_name,\n address_website: organization_website, address_zipcode: organization_zipcode, address_type: 'address')\n address.save\n end", "def create\n \n @fields = Fieldgroup.all\n \n @person.city = City.find_or_create_by_name(params[:city]) if params[:city] != \"\"\n @person.province = Province.find_or_create_by_name(params[:province]) if params[:province] != \"\"\n \n params[:person].each do |index, par|\n if index == \"address_attributes\"\n params[:person][:address_attributes].each do |a_index, a_par|\n params[:person][:address_attributes].delete(a_index) if params[:person][:address_attributes][a_index] == \"\"\n end\n \n params[:person].delete(index) if params[:person][index].count == 0\n \n else\n params[:person].delete(index) if params[:person][index] == \"\"\n end\n end\n \n logger.debug params[:person][:address_attributes]\n \n #save avatar\n if !params[:person][:avatar].nil? && params[:person][:avatar] != \"\"\n uploaded_io = params[:person][:avatar]\n file = Time.now.to_i.to_s + uploaded_io.original_filename\n File.open(Rails.root.join('tmp', file), \"wb\") { |f| f.write(uploaded_io.read) }\n params[:person][:avatar] = file\n end\n \n @person = Person.new(params[:person])\n\n respond_to do |format|\n \t\n if @person.save\n \t\n \tif !params[:field].nil? \t\n \tparams[:field].each do |index, content|\n \t\t\t\t\t@value = Fieldvalue.find_or_create_by_person_id_and_field_id(@person.id, index.to_i)\n \t\t\t\t\t@value.value = content.to_s\n \t\t\t\t\t@value.save\n \t\t\t\tend\n\t end\n \t\n format.html { redirect_to(people_url, :notice => 'Person was successfully created.') }\n format.xml { render :xml => @person, :status => :created, :location => @person }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @person.errors, :status => :unprocessable_entity }\n end\n end\n end", "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:farm_group_code => self.farm_group_code},{:id => self.id}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_farm_group\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:party_type_name => self.party_type_name},{:party_name => self.party_name},{:role_name => self.role_name},{:id => self.id}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_parties_role\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend", "def create\n puts params\n success = true\n @form_for_update = false\n\n params[:update][:typ_id].each do |typ_id|\n if (!typ_id.empty?)\n update = Update.new(:level => params[:update][:level], :typ => params[:update][:typ], :typ_id => typ_id,:repository_id => params[:update][:repository_id], :comit_id => params[:update][:comit_id])\n if update.valid?\n update.save\n else\n success = false\n @errors += update.errors\n end\n end\n end\n\n respond_to do |format|\n if success\n format.html {\n flash[:notice] = 'Update was successfully created.'\n redirect_to :controller => 'updates'\n }\n format.json { render json: {}, status: :created }\n else\n format.html { render action: \"new\" }\n format.json { render json: @errors, status: :unprocessable_entity }\n end\n end\n end", "def creatable?(fields=false)\n modifiable? :create, fields\n end", "def before_update_save(record)\n if (record.usr_id != session[:usr_id])\n # Force the call of a validation method.\n record.name = \"record_usr_id_ne_session_usr_id\"\n end\n # I derive the name of the object to prevent user from naming it stupidly\n record.name = \"#{record.symbl.name}-#{record.rpttype.name}-#{record.enddate.to_s}\"\n end", "def update\n create\n end", "def update\n create\n end", "def creation_attributes\n { }\n end", "def validate_name_and_entity_id\n @patient.valid?\n #@patient.errors.add(:entity_id, I18n.t('patients.create.no_entity')) if @patient.new_record? && !@patient.entity_id.present?\n @patient.errors.add(:name, I18n.t('patients.create.no_name')) unless @patient.name.present?\n @patient.errors.empty?\n end", "def adjust_after_create\n # The record is in @record, do what you will, this precedes a save.\n end", "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:commodity_code => self.commodity_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_commodity\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend" ]
[ "0.6463926", "0.6358563", "0.63057", "0.6271207", "0.6264372", "0.61820704", "0.61815804", "0.6150351", "0.61167705", "0.6085915", "0.6068313", "0.6009253", "0.6007746", "0.59037304", "0.5902707", "0.5783897", "0.5768001", "0.574802", "0.5648668", "0.5648516", "0.5643096", "0.5624909", "0.56210244", "0.5620472", "0.5616994", "0.56036085", "0.5561584", "0.55520576", "0.55513805", "0.5548091", "0.5543943", "0.55337286", "0.5530516", "0.5527055", "0.55121446", "0.55036664", "0.5498816", "0.54959446", "0.5485657", "0.5485657", "0.5485657", "0.5485657", "0.5484974", "0.54818815", "0.5465519", "0.5462031", "0.54478383", "0.544472", "0.5444202", "0.54281336", "0.54275495", "0.54263854", "0.5425776", "0.5421072", "0.54198545", "0.5418067", "0.5418067", "0.5415134", "0.5413429", "0.5409386", "0.5403732", "0.5398537", "0.5379046", "0.53787327", "0.5368138", "0.5368048", "0.53660995", "0.5365893", "0.5365893", "0.53642386", "0.5362936", "0.5359715", "0.5357463", "0.53540015", "0.53540015", "0.53540015", "0.53536665", "0.53507733", "0.5342307", "0.5342307", "0.5342307", "0.5342307", "0.53367716", "0.53363454", "0.53337324", "0.53278387", "0.5326693", "0.5326662", "0.5326662", "0.53245103", "0.5322287", "0.53217876", "0.5321037", "0.53175116", "0.53107697", "0.5310354", "0.5310354", "0.5307141", "0.5305504", "0.5302836", "0.53025323" ]
0.0
-1
Connery, Sean becomes Sean Connery
def natural_name last, rest = name.split(', ') [rest, last].join(' ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transact; end", "def leeway; end", "def leeway; end", "def internship_passed; end", "def superweening_adorningly(counterstand_pyrenomycetales)\n end", "def schubert; end", "def anchored; end", "def tongue_twister; end", "def strain; end", "def villian; end", "def celebration; end", "def conversar(person_one, person_two)\n person_one.hablar\n person_two.hablar\nend", "def jack_handey; end", "def who_we_are\r\n end", "def suivre; end", "def witcher; end", "def starship; end", "def invention; end", "def masteries; end", "def establishment\n montreal_establishment\n end", "def community; end", "def mermithization_unstrictured_hersed()\n technonomy(wrangler)\n sock_reassociate_supratemporal(jacket_gloomingly, metrometer, urtica_siegecraft)\n end", "def lookup_new_swimmer\n \n end", "def coming_soon\n end", "def coming_soon\n end", "def facilitate_abandonment\n new_client = get_answer_to(\"Is the abandoner a new client? (Y/N)\").downcase\n if new_client == 'y'\n add_client\n abandoning_client = clients.last\n else\n puts \"Choose the adopting client by their number.\"\n display_all_clients\n abandoning_client_index = gets.chomp.to_i - 1\n abandoning_client = clients[abandoning_client_index]\n end\n add_animal\n puts \"Great. #{abandoning_client.name} has given #{animals.last.name} up for adoption.\"\n end", "def intern_state\n super\n end", "def leap\n\t @dancer_leaps = \"Dancer leaps in the air!\"\n\tend", "def borrower\n end", "def unusual_sport; end", "def announce; end", "def doors; end", "def join_cult(new_cult)\n # follows single source of truth: many ~*~connecting~*~ to many via the dongle class\n if @age > new_cult.minimum_age\n BloodOath.new(Date.today.to_s, new_cult, self)\n else \n p \"I'm sorry, you are too young to join our community. Please come visit us again in #{new_cult.minimum_age - @age} year(s)!\"\n end\n end", "def aon; end", "def romeo_and_juliet; end", "def refutal()\n end", "def spouse; end", "def singOneVerse!()\r\n\t\tputs sing(\"On the wall, \") + sing(\"\\n\") + takeOneDown! + sing(\" on the wall \\n\\n\")\r\n\tend", "def king_richard_iii; end", "def surge; end", "def robin; end", "def race; end", "def race; end", "def race; end", "def race; end", "def race; end", "def race; end", "def silly_adjective; end", "def singup (gym, cost)\n new_memebership = Membership.new(cost , self, gym)\n end", "def forkless(interspinous_interdevour, cladodontid_michel)\n end", "def change_son(son)\n\t\t@son = son\n\tend", "def isolated; end", "def isolated; end", "def carry_one() # Facing north on 1st Street. -- Carrier class\n turn_left()\n move() # Note: Error shutoff here if we try to carry\n # from 1st Street.\n put_beeper() \n turn_around()\n move()\n turn_left()\n clear_all()\n end", "def sharing \n end", "def connect_nearby_herds\n\n end", "def winter_paralympics_sport; end", "def schumann; end", "def current_clown; end", "def current_clown; end", "def exchange\n :rock\n end", "def promote_new_owner\n membership = self.network_memberships.find(\n :first, \n :conditions => [\"organization_id <> ?\", self.owner.id], \n :order => 'created_at')\n self.owner = membership.organization\n self.save\n end", "def same; end", "def soccer\n\t\t@bio = Bio.where(:user_id => current_user.id).last #existing user signing in\n\t\t@sport = \"FIFA:DraftKings\"\n\tend", "def scientist; end", "def soft_ace\n # softy method refactor for when an ace is played\nend", "def be_replacement_for_others\n unless self.connection_id.blank? or self.id.blank?\n cases_to_replace = self.class.where(replaced_by_id:0).where(connection_id:self.connection_id).all\n cases_to_replace.each{|kase| kase.update_attributes(replaced_by_id:self.id) }\n end\n end", "def treat_reserved_as_conflict; end", "def waiver\n end", "def singular_siegler; end", "def chain_state\n super\n end", "def rossini; end", "def translate_two_consonants( s )\n\n\t\t\t\t# store the letters in an array\n\t\t\t\tch_array = s.chars\n\n\t\t\t\t# then grab the first letter from the array\n\t\t\t\tfirst_letter = ch_array.shift\n\n\t\t\t\t# then grab the second letter from the array\n\t\t\t\tsecond_letter = ch_array.shift\n\n\t\t\t\t# put both letters at the back with push and add 'ay'\n\t\t\t\tch_array << first_letter + second_letter + \"ay\"\n\n\t\t\t\t# bring it back together\n\t\t\t ch_array.join\n\n\tend", "def release_nickname!\n self.nickname = \"shelby_#{self.nickname}\"\n self.save\n end", "def mirror_state\n super\n end", "def thorins_company; end", "def leeway=(_arg0); end", "def leeway=(_arg0); end", "def spice; end", "def retire\n\n end", "def preconnect(concurrent = nil)\n hold{}\n end", "def the_doctor; end", "def change!\n @alive = !@alive\n end", "def originating\n self.class.originating(2, id)\n end", "def connection_mirror_state\n super\n end", "def connection_mirror_state\n super\n end", "def translate_one_consonant( s )\n\n\t\t# store the letters in an array\n\t\tch_array = s.chars\n\n\t\t# then grab the first letter from the array\n\t\tfirst_letter = ch_array.shift\n\n\t\t# put that letter at the back with push and add 'ay'\n\t\tch_array << first_letter + \"ay\"\n\n\t\t# bring it back together\n\t\tch_array.join\n\n\tend", "def someone\n @someone ||= new_client\n end", "def switch_players\n temp = @current_player\n @current_player = @opposing_player\n @opposing_player = temp\n end", "def winter_olympics_sport; end", "def switch(name,aliases,desc,long_desc,negatable)\n abstract!\n end", "def test_change_twice\n\t\tm = Miner.new(0)\n\t\tm.change_city(1)\n\t\tm.change_city(2)\n\t\tassert_equal(2,m.current_city)\n\tend", "def multiplex\n\t\t\t\t\t1\n\t\t\t\tend", "def next_consonant(name)\n\tconsonants = %w( b c d f g h j k l m n p q r s t v x y z)\n\t\tname = name.downcase.split('')\n\t\tnew_name = name.map do |con|\n\t\tif consonants.include?(con)\n\t\t\tconsonants.rotate(1)[consonants.index(con)]\n\t\telsif consonants == 'z'\n\t\t\tconsonants.replace('b')\n\t\telse\n\t\t\tcon\n\t\tend\n\tend\n\tnew_name.join.capitalize\nend", "def secondary_school; end", "def quebecmandate\n\n end", "def remote_the\n\n end", "def new \n curation_concern.publisher = ['McGill University']\n super\n end", "def strategy; end", "def follow_steve\n return if username == \"steve\"\n steve = Hacker.first(:username => 'steve')\n return if steve.nil?\n\n follow! steve\n steve.follow! self\n end", "def become_rival_of(rival)\n \t unless self.is_rivals_with?(rival)\n \t ::Rivalry.create!(\n\t\t\t\t\t\t\t:rivaled_by_me => self,\n\t\t\t\t\t\t\t:rivaled_for_me => rival)\n \t else\n \t self.rivalry(rival)\n \t end\n \t end" ]
[ "0.5975429", "0.5778046", "0.5778046", "0.5770252", "0.57647854", "0.574683", "0.5723522", "0.5585905", "0.55423594", "0.5528035", "0.5520705", "0.54811794", "0.5461023", "0.54106325", "0.54020834", "0.5387564", "0.5382835", "0.53802276", "0.53576976", "0.535065", "0.53304875", "0.532852", "0.53246987", "0.5309869", "0.5309869", "0.5306282", "0.5300184", "0.52938545", "0.52844334", "0.5230613", "0.522894", "0.5206456", "0.5161143", "0.5159327", "0.5151953", "0.5151197", "0.5150946", "0.5136366", "0.5123821", "0.5121528", "0.5116659", "0.5116411", "0.5116411", "0.5116411", "0.5116411", "0.5116411", "0.5116411", "0.5112151", "0.51109564", "0.511054", "0.5106117", "0.50850016", "0.50850016", "0.50844586", "0.5082958", "0.508157", "0.5078614", "0.5071532", "0.50539345", "0.50539345", "0.50527143", "0.50460464", "0.50440055", "0.5042072", "0.50394213", "0.50282836", "0.5009099", "0.5003901", "0.5003829", "0.5003445", "0.4997685", "0.4990711", "0.4989431", "0.49873394", "0.49774918", "0.4974576", "0.4973245", "0.4973245", "0.49681717", "0.49655876", "0.49603304", "0.49562615", "0.49541113", "0.49510944", "0.4917354", "0.4917354", "0.49159077", "0.49124837", "0.49105573", "0.49096033", "0.49051237", "0.48857287", "0.48853037", "0.48811936", "0.48793748", "0.48692638", "0.4865111", "0.4859018", "0.4848647", "0.48483843", "0.48476776" ]
0.0
-1
casual a method that takes an array of integers, and returns a new array with every other element
def arr arr.gets.chomp arr.every other end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def every_other(arr)\n new_array = []\n arr.each_with_index do |int, index|\n new_array << int if index.even?\n end\n new_array\nend", "def oddities(array)\n new_array = []\n array.each_with_index { |val, idx| new_array << val if idx.even? }\n new_array\nend", "def oddities(array)\n new_array = []\n array.each_with_index { |num, idx| new_array << num if idx.even? }\n new_array\nend", "def arreglo_impares(array)\n new_array= []\n array.each do |element|\n if element % 2 != 0\n new_array << element\n end\n end\n return new_array\nend", "def oddities(array)\n new_array = []\n\n index = 0\n while index < array.size\n new_array << array[index] if index.even?\n index += 1\n end\n new_array\nend", "def oddities(array)\n return_array =[]\n array.each_with_index do |element, index|\n return_array << element if index.even?\n end\n return_array\nend", "def oddities(array)\n new_array = []\n i = 0\n while i < array.size\n new_array << array[i]\n i += 2\n end\n new_array\nend", "def every_other_array(array)\n result = []\n array.each_with_index { |item, index| result << item if (index + 1).odd?}\n p result\nend", "def array_times_two(array)\n new_array = array.map{ |el| el * 2}\n end", "def oddities(arr)\n counter = 0\n return_array = []\n loop do\n return_array << arr[counter]\n counter += 2\n break if counter >= arr.size\n end\n return_array.compact\nend", "def oddities(array)\n odd_array = []\n array.each_with_index { |e, idx| odd_array << e if idx.even? }\n odd_array\nend", "def oddities(array)\n odd_array = []\n array.each_with_index do |e, idx|\n odd_array << e if idx.even?\n end\n odd_array\nend", "def oddities(array)\n result = []\n index = 0\n\n while index < array.size\n result << array[index]\n index += 2\n end\n\n result\nend", "def oddities(arr)\n new_arr = []\n arr.each_with_index { |v, idx| new_arr << v if idx.even? }\n new_arr\nend", "def oddities(array)\n odd_values = []\n index = 0\n \n while index < array.size\n odd_values << array[index]\n index += 2\n end\n odd_values\nend", "def q7_other_arr(arry)\n arry_out = []\n arry.each_index { |i| arry_out << arry[i] if i.even? }\n arry_out\nend", "def oddities(arr)\n arr2 = []\n arr.each_with_index { |elem, ndx| arr2 << elem if ndx.even? }\n arr2\nend", "def oddities(array)\n ret_array = []\n array.each_with_index do |value, index|\n if index.even?\n ret_array << value\n end\n end\n ret_array\nend", "def evenities1(array)\n index = 1\n even_array = []\n while index < array.length\n even_array << array[index]\n index += 2\n end\n even_array\nend", "def oddities_method_1(arr)\n new_arr = []\n arr.each_with_index do |item, ind|\n new_arr << item if ind.even?\n end\n new_arr\nend", "def oddities(array)\n elements = []\n index = 0\n while index < array.size\n elements << array[index]\n index += 2\n end\n elements\nend", "def oddities(array)\n result = []\n count = 0\n array.each do |element|\n result << element if count.even?\n count += 1\n end\n result\nend", "def array_times_two!(array)\n array.map!{ |el| el *2}\n end", "def oddities(array)\n\n result = [] # empty array to push each item in the array to.\n index = 0 # creates a counter called index\n\n while index < array.size\n result << array[index] # array index is the number in the array.\n index += 2 # += 2 iterates over and returns even items.\n end\n result # again with loops put the result outside of the loop.\nend", "def oddities(array)\n new_array = []\n array.each_with_index do |num, index|\n new_array << num if index.odd?\n end\n new_array\nend", "def oddities(arr)\n new_arr = []\n arr.each_with_index do |val, index|\n new_arr << val if index.even?\n end\n new_arr\nend", "def oddities1(arr)\n (arr.map.with_index { |element,i| element if i.even? }).compact\nend", "def oddities(arr)\n arr.each_with_index.with_object([]) do |(el, i), new_arr|\n new_arr << el if i.even?\n end\nend", "def oddities(array)\n new_array = []\n index_range = (1..array.size-1)\n for n in index_range do \n new_array << array[n] if n.odd?\n end\n new_array\nend", "def oddities(array)\nresult = []\narray.each_with_index do |value, idx|\n result << value if (idx + 1).odd?\nend\nresult\nend", "def oddities(array)\n odd_element_array = []\n index = 0\n loop do\n break if index >= array.size\n odd_element_array << array[index] if index.even?\n index += 1\n end\n odd_element_array\nend", "def oddities(array)\n result = []\n index = 0\n\n loop do\n result << array[index]\n index += 2\n break if index >= array.size\n end\n\n result\nend", "def oddities(array)\n odd_elements = []\n index = 0\n while index < array.size\n odd_elements << array[index]\n index += 2\n end\n odd_elements\nend", "def oddities(array)\n odd_elements = []\n index = 0\n while index < array.size\n odd_elements << array[index]\n index += 2\n end\n odd_elements\nend", "def oddities(array)\n count = 0\n new_array = []\n loop do\n break if array.size == 0\n new_array << array[count]\n count += 2\n break if count >= array.size\n end\n new_array\nend", "def evenies(array)\n even_array = []\n array.each_with_index { |e, idx| even_array << e if idx.odd? }\n even_array\nend", "def oddities_1(array)\n array.select { |element| array.index(element) % 2 == 0 }\nend", "def oddities(array)\n new_array = []\n array.each_with_index do |item, index|\n new_array << item if index.even?\n end\n new_array\nend", "def odd_integers(array)\nend", "def odd_array(numbers)\n odd_value = []\n \n numbers.each_with_index do |value, idx|\n odd_value << value if idx.even?\n end\n odd_value\nend", "def oddities(array)\n new_array = []\n array.each_with_index do |element, index|\n new_array.push(element) if (index + 1).odd?\n end\n new_array\nend", "def oddities(ary)\n new_array = []\n counter = 0\n loop do\n break if counter == ary.size\n new_array << ary[counter] if counter.even?\n counter += 1\n end\n new_array\nend", "def evil_even_numbers(array_of_numbers)\n result = []\n for number in array_of_numbers\n result.push(number) if(number % 2 == 0)\n end\n \n return result \nend", "def oddities(arr)\n new_arr = []\n arr.each.with_index do |item, idx|\n new_arr << item if idx == 0 || idx.even?\n end\n new_arr\nend", "def oddities(init_array)\n odd_bods = []\n init_array.each_with_index do |element, index|\n odd_bods << element if index.odd?\n end\n odd_bods\nend", "def oddities(int_array)\n index = 0\n odds = []\n\n while index < int_array.size\n odds.push(int_array[index])\n index += 2\n end\n odds\nend", "def oddities(arr)\n every_other_value = []\n\n counter = 0\n while counter < arr.size\n every_other_value << arr[counter]\n counter += 2\n end\n every_other_value\nend", "def oddities2(arr)\n index = 0\n result = []\n loop do\n break if index >= arr.size\n result << arr[index]\n index += 2\n end\n result\nend", "def eveness(array)\n new_array = []\n index = 1\n while index < array.size\n new_array << array[index]\n index += 2\n end\n new_array\nend", "def oddities(array)\n odd_elements = []\n array.each do |element|\n odd_elements << element if array.index(element).even?\n end\n odd_elements\nend", "def odd_occurances_in_array(a)\n res = 0\n a.each { |el| res ^= el }\n res\nend", "def oddities(array)\n result = []\n array.select do |element|\n result << element if array.index(element).even?\n end\n result\nend", "def double_even_numbers(array)\n doubled_array = array.clone\n\n (array.length - 1).step(0, -2) do |i|\n doubled_array[i] += doubled_array[i]\n end\n\n doubled_array\n end", "def select_every_odd arr\n ans = []\n arr.each_with_index do |item, i|\n if i%2 == 1 \n ans.push item\n end\n end\n ans\nend", "def oddities(array)\r\n array.select.with_index { |_, i| i.even? }\r\n end", "def odd_indexed_integers(array)\n\nend", "def oddities(arr)\r\n arr2 = arr.select do |x|\r\n arr.index(x).even?\r\n end\r\n arr2\r\nend", "def odd_elements(array)\n res = []\n (1...array.length).step(2).each do |idx|\n elem = array[idx]\n elem = yield elem if block_given?\n res.push(elem)\n end\n\n res\nend", "def non_oddities(arr)\n arr_length = arr.size\n index = 0\n even_elements = []\n\n loop do\n even_elements << arr[index] if index.odd?\n\n index += 1\n break if index > arr_length\n end\n even_elements.compact\nend", "def select_every_even arr\n ans = []\n arr.each_with_index do |item, i|\n if i%2 == 0 \n ans.push item\n end\n end\n ans\nend", "def array_times_two(array)\nend", "def return_array(array1, array2)\nfor num in array2\n if num%2 == 0\n array1.push(num)\n end\nend\nreturn array1\nend", "def oddities(array)\n array.select.with_index { |e, idx| e if idx.even? }\nend", "def oddities(arr)\n\tarr.select.with_index { |num, index| num if index.even? }\nend", "def odd_elements(array)\n counter = 0\n newarray = []\n array.each do |x|\n if counter.odd?\n if block_given?\n newarray.push(yield x)\n else\n newarray.push(x)\n end\n end\n counter += 1\n end\n newarray\nend", "def alternate_order(array)\n array.select{ |a| a % 2 != 0 }\nend", "def double_array(array)\n output_array = []\n\n array.each do |thing|\n output_array << thing * 2\n end\n\n return output_array\nend", "def odd_product(arr)\n\tarr.filter! { |i| (i % 2 != 0) }\n\tx = arr.inject(:*)\n\treturn x\nend", "def double_all array\n array.map { |i| i*2 }\nend", "def array_times_two!(array)\nend", "def double_numbers(array)\n new_array = []\n\n array.each do |number|\n new_array << number *= 2\n end\n return new_array\nend", "def square_array_2(array)\n array.collect { |i| i**2 }\n array\nend", "def doubler(arr)\n new = []\n arr.each do |i|\n new << i*2\n end\n return new\nend", "def oddities3(arr)\n result = []\n index_array = (0..arr.size-1).select {|idx| idx.even?}\n index_array.each do |index|\n result << arr.fetch(index)\n end\n result\nend", "def odd_numb array\n new_arr= array.select! do |value|\n value.class == Integer\n end\n new_arr.select { |value| value % 2 != 0 }.sort\nend", "def odd_index_values_from_array(array)\n odd_elements = []\n array.each_with_index do |element, idx|\n odd_elements << element if idx.even?\n end\n odd_elements\nend", "def odds(arr)\n\tret = []\n\tarr.each_index { |i|\n\t\tif i % 2 == 1\n\t\t\tret << arr[i]\n\t\tend\n\t}\n\tret\nend", "def oddities(arry)\n arry.select { |n| n if arry.index(n).even? }\nend", "def array_times_two!(arr)\n\n i = 0\n while i < arr.length\n arr[i] = arr[i] * 2\n i += 1\n end\n\n arr\n\nend", "def even_index_nums(array)\n counter = 0\n even_index_array = []\n \n loop do\n break if counter == array.length\n \n current_element = array[counter]\n \n if counter % 2 == 0\n even_index_array << current_element\n end\n \n counter += 1\n end \n even_index_array\nend", "def multiply_2(array)\n # [1,2,3,4] -> [4,3,2,1] -> [4,6,2,2] -> [2,2,6,4]\n array.reverse.map.with_index { |n, i| i.even? ? n : n * 2 }.reverse\n end", "def magic_array(array)\narray.flatten.reverse.map! {|i| i = i*2}.delete_if {|i| i.modulo(3) == 0}.uniq.sort\nend", "def array_translate(array)\n new_arr = []\n \n array.each_with_index do |subArray, idx|\n if idx % 2 == 1\n subArray = ele\n else\n subArray = num\n \n #num.times { new_arr << ele }\n end\n end\n\n #return new_arr\nend", "def double_odd_index_numbers(numbers)\n result = []\n numbers.each_with_index do |number,i|\n result << number*2 if i.odd?\n result << number if i.even?\n end\n result\nend", "def odd_index_values_from_array(array)\n index = 0\n odd_elements = []\n while index < array.size\n odd_elements << array.fetch(index) if index.even?\n index += 1\n end\n odd_elements\nend", "def separate_array_into_even_and_odd_numbers(array)\n #Find out if each element even or odd\n # if even, put into one array\n # if odd, put into other array\n # combine arrays\n even_array = Array.new\n odd_array = Array.new\n final_array = Array.new\n array.each{|number|\n if number.odd?\n odd_array << number\n else\n even_array << number\n end\n }\n final_array = [even_array,odd_array]\nend", "def oddities(array)\n array.select { |element| array.index(element).even? }\nend", "def select_every_odd(arr)\n arr.each_index.select {|index| index%2!=0}.map{|index| index=arr[index]}\nend", "def get_evens(arr)\n even_array = []\n arr.each{|int| even_array.push(int) if int % 2 == 0}\n even_array\nend", "def even_numbers(num_array)\n\n\tnum_array.select! do |num|\n\t\tnum % 2 == 0\n\tend\n\n\tnum_array\n\nend", "def double_array(input_array)\n \n double_array = []\n \n input_array.each do |number|\n double_array << number *= 2\n end\n return double_array\n\nend", "def magic_array(arr)\n arr.flatten.sort.uniq.map{|x| x*2}\nend", "def remove_every_other(arr)\n arr.select.with_index { |_,idx| idx.even? }\nend", "def cross(array2)\n self.inject([]){ |array, first| array2.inject(array) {|array, second| array << [first, second]} } \n end", "def create_odd_array\n $y = (1..255).reject { |i| i % 2 == 0 }\nend", "def oddities(array)\n array.select.with_index { |e, i| (i + 1).odd? }\nend", "def evenies(array)\n array.select.with_index { |e, idx| e if idx.odd? }\nend", "def oddities(arr)\n arr.select.with_index do |_, idx|\n idx.even?\n end\nend", "def odd_duplicates(array)\n xor = array.reduce(0, :^)\nend", "def even_index_nums(array)\n even_index_array = []\n \n array.each_with_index do |element, index|\n if index.even?\n even_index_array << element\n end\n end\n even_index_array\nend", "def oddities(input_array)\n input_array.select.each_with_index { |_, i| i.even? } # => [2, 4, 6], [\"abc\"], [123], []\nend" ]
[ "0.7765063", "0.74925214", "0.74800783", "0.7372222", "0.7367108", "0.7341767", "0.732569", "0.7305429", "0.7295646", "0.7295107", "0.72870183", "0.7281987", "0.7279082", "0.7265809", "0.7237457", "0.72363925", "0.7225795", "0.72242457", "0.7209263", "0.7202445", "0.7191781", "0.71787935", "0.717739", "0.71629256", "0.7159939", "0.71565247", "0.71547997", "0.7154015", "0.71533126", "0.7145847", "0.7145176", "0.71420264", "0.71384686", "0.71378714", "0.7132699", "0.71316093", "0.7121193", "0.71157163", "0.70719856", "0.7070125", "0.7060379", "0.7058679", "0.70560145", "0.7047752", "0.7041107", "0.7028536", "0.6992205", "0.69919634", "0.69748706", "0.6961482", "0.6961294", "0.6949626", "0.69459605", "0.69458324", "0.6927315", "0.6904966", "0.69002503", "0.68947494", "0.68883896", "0.688261", "0.6880684", "0.68569565", "0.68497974", "0.68286467", "0.6818975", "0.6805091", "0.6801315", "0.6800246", "0.67751807", "0.67702866", "0.6766644", "0.67636603", "0.67572916", "0.6743061", "0.67306596", "0.67269146", "0.6724083", "0.67144483", "0.67054355", "0.67004585", "0.66814876", "0.66812944", "0.6671348", "0.6665769", "0.66578454", "0.6650393", "0.6647905", "0.6636467", "0.662859", "0.66192704", "0.6614579", "0.66108763", "0.6609633", "0.6608619", "0.6606462", "0.6605539", "0.66039085", "0.6600999", "0.6588303", "0.65831494", "0.65826875" ]
0.0
-1
GET /setup_images GET /setup_images.json
def index @setup_images = SetupImage.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_images_data\t\t\t\t\t\t\n\t\t{ payload: { 'makes' => makes_dropdown, 'images' => images_array('none').compact}, success: true}\n\tend", "def get_images\n {}\n end", "def images\n response = JSON.parse( self.class.get(\"#{BASE_URL}/contest/#{@api_key}/images\") )\n end", "def images\n IbmCloudRest.get \"#{@uri}/images\"\n end", "def images\n @images ||= ApiFactory.new 'Projects::Images'\n end", "def images\n images = []\n JSON.parse(resource['/offerings/image'].get)[\"images\"].each do |img|\n images << Image.new(img)\n end\n return images\n end", "def images() \n uri = URI.parse(\"http://\" + @location.host + \":9292/v2/images\")\n return get_request(uri, @token)\n end", "def images\n end", "def get_images\n @command = :get_images\n # set a flag indicating whether or not the user wants to see all images,\n # including the hidden ones\n show_hidden = (@prev_args.peek(0) == \"-i\" || @prev_args.peek(0) == \"--hidden\")\n # get the images from the RESTful API (as an array of objects)\n uri_str = ( show_hidden ? \"#{@uri_string}?hidden=true\" : @uri_string )\n uri = URI.parse uri_str\n result = hnl_http_get(uri)\n unless result.blank?\n # convert it to a sorted array of objects (from an array of hashes)\n sort_fieldname = 'filename'\n result = hash_array_to_obj_array(expand_response_with_uris(result), sort_fieldname)\n end\n # and print the result\n print_object_array(result, \"Images:\", :style => :table)\n end", "def list\n @api.get(\"#{@api.path}/Images\")\n end", "def show\n @image_set = ImageSet.find(params[:id])\n\n render json: @image_set\n end", "def index\n @images = Image.all\n\n render json: @images\n end", "def set_setup_image\n @setup_image = SetupImage.find(params[:id])\n end", "def image_list\n @images = Picture.where(album_id: params[:album_id])\n respond_to do |format|\n format.json { render json: @images.to_json(methods: [:path])}\n end\n end", "def images; end", "def images\n bugImages = BugImage.all\n render :json => bugImages.to_json\n end", "def images\n @picturesandmeta = Pictureandmeta.all\n @kind = Kind.find(params[:kind_id])\n Rails.logger.info(\"Kind: #{@kind.inspect}\")\n end", "def index\n @family_images = FamilyImage.all\n\n render json: @family_images\n end", "def imagga_images_info\n self.images.non_installation.collect do |image|\n image_options = { :image_url => image.filename.to_s }\n image_options.merge! pattern: image.pattern.name if image.pattern.present?\n image_options.merge! thumb_url: image.s3_path if image.s3_path.present?\n { :url => image.filename.to_s.gsub('https','http').gsub('-dev',''), :id => image.filename.path, :filepath => image.filename.path, :metadata => self.specifications_hash.merge(image_options) }\n end.flatten\n end", "def images\n []\n end", "def images\n @images ||= {}\n end", "def create\n @setup_image = SetupImage.new(setup_image_params)\n respond_to do |format|\n if @setup_image.save\n format.html { redirect_to setup_path(@setup_image.setup_id),\n notice: 'Setup was successfully updated.' }\n format.json { render :show, status: :created, location: @setup_image }\n else\n format.html { render :new }\n format.json { render json: @setup_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_all_images(env)\n images_json = get(env, \"#{@session.endpoints[:image]}/images\")\n images = JSON.parse(images_json)['images']\n\n return images if images.empty?\n\n is_v1 = false\n unless images[0].key? 'visibility'\n is_v1 = true\n images_json = get(env, \"#{@session.endpoints[:image]}/images/detail\")\n images = JSON.parse(images_json)['images']\n end\n\n images.map do |i|\n i['visibility'] = i['is_public'] ? 'public' : 'private' if is_v1\n Image.new(i['id'], i['name'], i['visibility'], i['size'], i['min_ram'], i['min_disk'])\n end\n end", "def index\n @images = Image.all\n\n respond_to do |format|\n format.html # index.html.slim\n format.json { render json: @images }\n end\n end", "def images(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Images\", params: params)\n end", "def index\n wishes = Wish.all.with_attached_image.where(is_secret: false)\n render json: { wishes: generate_image_url(wishes) }\n end", "def tineye_images_info\n self.images.non_installation.collect do |image|\n image_options = { :image_url => image.filename.to_s }\n image_options.merge! pattern: image.pattern.name if image.pattern.present?\n image_options.merge! thumb_url: image.s3_path if image.s3_path.present?\n { :url => image.filename.to_s, :filepath => image.filename.path, :metadatum => self.specifications_hash.merge(image_options) }\n end.flatten\n end", "def index\n @images = Image.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end", "def index\n @variant_images = VariantImage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @variant_images }\n end\n end", "def add_images\n @specification = Specification.where(florist_id: session[\"found_florist_id\"]).where(id: params[\"specification_id\"]).first \n render(:images) and return\n end", "def index\n @images = getmydata(\"Image\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end", "def images()\n @photos = all_photos() \n @headers['Content-Type'] = CONTENT_TYPE\n end", "def status_images\n response = JSON.parse(@client.get(\"/api/v1/status-images\").body)\n return response[\"images\"] || response\n end", "def setup_image_params\n params.require(:setup_image).permit(:setup_id, :image)\n end", "def images\n @images ||= Image.find_all_by_listing_id(listing_id, oauth)\n end", "def index\n @img_lists = ImgList.all\n render json: @img_lists\n end", "def index\n @recipe_images = RecipeImage.all\n end", "def images\n {\n thumbnail: object.thumbnail.url(:large),\n logo: object.logo.url(:medium),\n white_logo: object.white_logo.url(:medium)\n }\n end", "def getimagesinfo\n trek = Trek.find_by_id(params[:id])\n send_data(trek.get_images_info.to_json,\n {:type => \"application/json\", :disposition => \"inline\"})\n end", "def urls( options =nil )\n json = request 'images.getURLs', options, :ImageID => image_id, :ImageKey => key\n \n image = upper_hash_to_lower_hash( json['Image'] )\n image.merge!( :image_id => image[\"id\"] )\n \n OpenStruct.new( image ) \n end", "def init_systems\n response = @conn.get do |req|\n req.url \"/api/v1/systemimages\"\n req.headers = rest_headers\n end\n\n @systems = json(response.body)[:systemimages]\n end", "def configureImages()\n #Fetch the server configuration\n config = fetchServerConfig()\n #Used the gathered configuration information to build a URL for accessing images\n $imageBase = config['images']['base_url']+config['images']['poster_sizes'][5]\nend", "def images\n @images ||= Hash.new\n end", "def index\n @images = Image.all\n respond_with @images\n end", "def get_images\n images = get(\"cloud-instances/#{guid}/images\")[\"images\"] || []\n\n images.map do |image|\n get_image(image[\"imageID\"])\n end.compact\n end", "def images_with_urls images\n result_images = []\n\n images.each do |image|\n url = image.file_url\n result = image.as_json\n result[\"url\"] = url\n result_images << result\n end\n result_images\n end", "def setup_program_image\n image_path(image_name: params[:setup_program_image])\n end", "def show\n @image = Image.find(params[:id])\n\n render json: @image\n end", "def show\n @image = Image.find(params[:id])\n\n render json: @image\n end", "def index\n @web_display_car_images = WebDisplayCarImage.all\n\n render json:@web_display_car_images\n end", "def items\n @beverages = Beverage.available\n respond_to do |format|\n format.json { render :json => @beverages.to_json(methods: :image_url)}\n end\n end", "def images()\n\t\treturn Images.new(@credentials.client_key, @credentials.get_access_token)\n\tend", "def setup_images\n @default_image = NSImage.imageNamed(\"default.png\")\n @alternate_image = NSImage.imageNamed(\"alternate.png\")\n @highlight_image = NSImage.imageNamed(\"highlight.png\")\n end", "def image_option_response\n self.filtered_responses.map do |q|\n ENV['URL']+q.image_resp.url\n end\n end", "def images(credentials, opts={})\n hwps = hardware_profile_ids(credentials)\n unless opts[:id]\n filter = opts[:owner_id] ? { :filter => \"my_images\" } : {}\n img_arr = safely do\n new_client(credentials).get('images', filter)['images'].map do |i|\n convert_image(hwps, i)\n end\n end\n filter_on( img_arr, :architecture, opts )\n else\n safely do\n [convert_image(\n hwps,\n new_client(credentials).get('images/%s' % opts[:id])['image']\n )]\n end\n end\n end", "def add_images\n\t\tif @current_user.present?\n\t\t\t@property = Property.find(params[:property_id])\n\t\t\tif @property.present?\n\t\t\t\t# if @property.images.present?\n\t\t\t\t# \t@property.images.destroy_all\n\t\t\t\t# end\n\t\t\t\tparams[:images].each { |image|\n\t i = @property.images.create(image: image)\n\t if i.save\n\t else\n\t \trender_json({\"status\" => \"Fail\", \"message\" => i.errors.full_messages.first}.to_json)\n\t \treturn\n\t end\n\t }\n\t @property.images.first.update_attributes(is_starred: true)\n\t render :file => 'api/v1/property/add_image'\n\t else\n\t \trender_json({\"status\" => \"Fail\", \"message\" => \"No property found.\"}.to_json)\n\t end\n\t\tend\n\tend", "def api_url\n \"https://connect.gettyimages.com/v1\"\n end", "def images\n Vultr::Resource::OS.new(@faraday)\n end", "def images(artist, options={})\n get(:standard, {:method => \"artist.getImages\", :artist => artist}.merge(options))\n end", "def show\n render json: @family_image\n end", "def create\n @image = Image.new(image_params)\n respond_to do |format|\n if @image.save\n format.json { render :json => { url: @image.image.url} }\n else\n \n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def home\n @images = [\"random_people.jpg\", \"using_phones.jpg\", \"naeem.jpg\"]\n end", "def show\n render json:@web_display_car_image\n end", "def image(id, nsfw = false)\n img = get url: \"images/#{id}\", nsfw: nsfw\n img['image'] if img\n end", "def index\n @cap_image = fetch_cap_image(params['q'])\n\n if @cap_image.nil?\n @cap_image = CapImage.all.first\n flash.now[:alert] = 'Couldn\\'t fetch random image. Here\\'s one from the archives.'\n end\n\n respond_to do |format|\n format.html\n format.json { render json: @cap_image }\n end\n end", "def setup_workspace_image\n image_path(image_name: params[:setup_workspace_image])\n end", "def index\n @product_images = ProductImage.where(product_uuid: params[:product_id])\n render json: @product_images, status: 200\n end", "def images artist\n url = \"http://developer.echonest.com/api/v4/artist/images?api_key=#{ECHONEST_API_KEY}&name=#{artist}&format=json&results=#{RESULTS}&start=0&license=unknown\"\n result = parseURL url\n result[\"response\"][\"images\"]\nend", "def extra_images(options)\n {}\n end", "def create_images\n problem_image = self.images.build\n File.open('./public/projects/problem_default.jpg') do |f|\n problem_image.image = f\n end\n\n solution_image = self.images.build\n File.open('./public/projects/solution_default.jpg') do |f|\n solution_image.image = f\n end\n\n team_image = self.images.build\n File.open('./public/projects/team_default.png') do |f|\n team_image.image = f\n end\n end", "def index\n render json: Picture.all\n end", "def images (size_requested = 'all')\n returned_images = []\n images = @record.fetch('ImageInfo', {})\n if images.count > 0\n images.each do |image|\n if size_requested == image['Size'] || size_requested == 'all'\n returned_images.push({size: image['Size'], src: image['Target']})\n end\n end\n end\n returned_images\n end", "def restaurant_image\n if !check_step_info(@restaurant)\n return\n end\n\n render json: {:success => true, :attachmentPartial => render_to_string('restaurant_manage/restaurant_image', :layout => false ) }\n end", "def index\n @pictures = Picture.where(foodscape_id: params[:foodscape_id])\n render json: @pictures\n end", "def fetch_images(property_id)\n fetcher = Commands::ImageListFetcher.new(credentials)\n fetcher.call(property_id)\n end", "def show\n coach = Coach.find(params[:id])\n json = coach.to_json({:image_url => ActionController::Base.helpers.asset_path(coach.image_url)})\n\n respond_to do |format|\n format.json {render :json => json}\n end\n end", "def index\n @images = Image.all\n end", "def index\n @images = Image.all\n end", "def index\n @images = Image.all\n end", "def index\n @images = Image.all\n end", "def index\n @images = Image.all\n end", "def index\n @images = Image.all\n end", "def index\n @images = Image.all\n end", "def index\n @images = Image.all\n end", "def index\n @images = Image.all\n end", "def index\n @images = Image.all\n end", "def index\n @images = Image.all\n end", "def index\n @images = Image.all\n end", "def index\n @images = Image.all\n end", "def index\n @images = Image.all\n end", "def index\n @images = Image.all\n end", "def index\n @images = Image.all\n end", "def my_images(options = {})\n images options.merge(:owners => 'self')\n end", "def list_images # :nologin:\n query = create_query(:Image, :all, :by => :created_at)\n show_selected_images(query)\n end", "def index\n @images = Image.order('created_at DESC')\n @image = Image.new\n @uploader = ImageUploader.new\n # @uploader.key = \"uploads/#{@image.id}-#{request.ip}/${filename}\"\n # @uploader.success_action_status = \"201\"\n @uploader.success_action_redirect = new_image_url\n end", "def create_json\n respond_to do | wants |\n wants.json do\n _create do | image, image_placement |\n if image.save && image_placement.save\n render :layout => false, :json => { :status => 'UPLOADED', :image_url => url_for(:action=>'show', :id=>image_placement.id, :only_path => true)} \n # returning application/json, text/x-json, text/json cause Firefox 3 to try to open an app\n # returning text/html or application/xhtml+xml causes ampersands (&) in json \n # strings to get html_escape (&amp;)\n response.content_type = Mime::HTML\n else\n render :layout => false, :json => { :status => 'FAILED'}\n # otherwise Rails returns application/json and Firefox 3 tries to open an app\n response.content_type = Mime::HTML\n end\n end\n end\n end\n end", "def getImage\n image=AWS::S3::S3Object.url_for('testing.png','tradeDev')\n render :json => {:image=>image}\n end", "def images_path\n \tmain_app.send(Auth::OmniAuth::Path.create_or_index_path(Auth.configuration.image_class))\n end", "def images\n self.class.images\n end", "def search_for_images\n request = {\n :RequestHeader => { :Token => @authenticator.token},\n :SearchForImages2RequestBody => {\n :Query => { :SearchPhrase => @search_query},\n :ResultOptions => {\n :ItemCount => @max_num_images,\n :EditorialSortOrder => 'MostPopular'\n },\n :Filter => {\n :ImageFamilies => [\"editorial\"],\n :GraphicStyles => [\"Photography\"]\n }\n }\n }\n response = post_json(request)\n if response[\"ResponseHeader\"][\"Status\"]\n response[\"SearchForImagesResult\"][\"Images\"]\n else\n raise \"No images returned #{response['ResponseHeader']['Status']}\"\n end\n end" ]
[ "0.69578403", "0.68105143", "0.6670254", "0.66640836", "0.6536526", "0.64318055", "0.6386804", "0.63743997", "0.6367532", "0.6338391", "0.6328266", "0.6309938", "0.6290463", "0.6265324", "0.62472177", "0.6235345", "0.61736834", "0.6173317", "0.61668336", "0.61644685", "0.6147814", "0.6125869", "0.61142987", "0.6106562", "0.61020255", "0.6088995", "0.6062012", "0.6059062", "0.60551006", "0.6053893", "0.6049246", "0.60446304", "0.60050684", "0.6000049", "0.5994552", "0.59462684", "0.5942601", "0.5929672", "0.59226465", "0.59170747", "0.59111553", "0.5910415", "0.5885723", "0.5883099", "0.58668965", "0.5863041", "0.5855549", "0.58524126", "0.58524126", "0.58477014", "0.5845617", "0.5831055", "0.5815842", "0.58154285", "0.5810876", "0.5807809", "0.5789674", "0.5786556", "0.57856613", "0.57840526", "0.5782158", "0.5769738", "0.57637835", "0.5763664", "0.57595545", "0.5755573", "0.57522535", "0.5751921", "0.57488054", "0.5743932", "0.5742198", "0.57419753", "0.57322913", "0.5728352", "0.57190657", "0.56965995", "0.56853116", "0.56853116", "0.56853116", "0.56853116", "0.56853116", "0.56853116", "0.56853116", "0.56853116", "0.56853116", "0.56853116", "0.56853116", "0.56853116", "0.56853116", "0.56853116", "0.56853116", "0.5685135", "0.56829745", "0.56814694", "0.56763184", "0.5656212", "0.56551266", "0.565319", "0.565195", "0.5646068" ]
0.709687
0
GET /setup_images/1 GET /setup_images/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @setup_images = SetupImage.all\n end", "def show\n @image_set = ImageSet.find(params[:id])\n\n render json: @image_set\n end", "def get_images_data\t\t\t\t\t\t\n\t\t{ payload: { 'makes' => makes_dropdown, 'images' => images_array('none').compact}, success: true}\n\tend", "def images\n response = JSON.parse( self.class.get(\"#{BASE_URL}/contest/#{@api_key}/images\") )\n end", "def get_images\n {}\n end", "def show\n @image = Image.find(params[:id])\n\n render json: @image\n end", "def show\n @image = Image.find(params[:id])\n\n render json: @image\n end", "def images\n IbmCloudRest.get \"#{@uri}/images\"\n end", "def index\n @images = Image.all\n\n render json: @images\n end", "def get_images\n @command = :get_images\n # set a flag indicating whether or not the user wants to see all images,\n # including the hidden ones\n show_hidden = (@prev_args.peek(0) == \"-i\" || @prev_args.peek(0) == \"--hidden\")\n # get the images from the RESTful API (as an array of objects)\n uri_str = ( show_hidden ? \"#{@uri_string}?hidden=true\" : @uri_string )\n uri = URI.parse uri_str\n result = hnl_http_get(uri)\n unless result.blank?\n # convert it to a sorted array of objects (from an array of hashes)\n sort_fieldname = 'filename'\n result = hash_array_to_obj_array(expand_response_with_uris(result), sort_fieldname)\n end\n # and print the result\n print_object_array(result, \"Images:\", :style => :table)\n end", "def images\n @picturesandmeta = Pictureandmeta.all\n @kind = Kind.find(params[:kind_id])\n Rails.logger.info(\"Kind: #{@kind.inspect}\")\n end", "def set_setup_image\n @setup_image = SetupImage.find(params[:id])\n end", "def list\n @api.get(\"#{@api.path}/Images\")\n end", "def images\n @images ||= ApiFactory.new 'Projects::Images'\n end", "def image_list\n @images = Picture.where(album_id: params[:album_id])\n respond_to do |format|\n format.json { render json: @images.to_json(methods: [:path])}\n end\n end", "def images() \n uri = URI.parse(\"http://\" + @location.host + \":9292/v2/images\")\n return get_request(uri, @token)\n end", "def image(id, nsfw = false)\n img = get url: \"images/#{id}\", nsfw: nsfw\n img['image'] if img\n end", "def index\n @images = Image.all\n\n respond_to do |format|\n format.html # index.html.slim\n format.json { render json: @images }\n end\n end", "def index\n @variant_images = VariantImage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @variant_images }\n end\n end", "def add_images\n @specification = Specification.where(florist_id: session[\"found_florist_id\"]).where(id: params[\"specification_id\"]).first \n render(:images) and return\n end", "def get_image_by_uuid\n @command = :get_image_by_uuid\n # the UUID was the last \"previous argument\"\n image_uuid = @prev_args.peek(0)\n # setup the proper URI depending on the options passed in\n uri = URI.parse(@uri_string + '/' + image_uuid)\n # and get the results of the appropriate RESTful request using that URI\n result = hnl_http_get(uri)\n # finally, based on the options selected, print the results\n print_object_array(hash_array_to_obj_array([result]), \"Image:\")\n end", "def index\n @family_images = FamilyImage.all\n\n render json: @family_images\n end", "def show\n @image_url = ImageUrl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image_url }\n end\n end", "def images\n bugImages = BugImage.all\n render :json => bugImages.to_json\n end", "def index\n @images = Image.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end", "def index\n @cap_image = fetch_cap_image(params['q'])\n\n if @cap_image.nil?\n @cap_image = CapImage.all.first\n flash.now[:alert] = 'Couldn\\'t fetch random image. Here\\'s one from the archives.'\n end\n\n respond_to do |format|\n format.html\n format.json { render json: @cap_image }\n end\n end", "def images\n end", "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/photos/#{params[:id]}.json?token=#{ENV['API_KEY']}\"\n\t response = RestClient.get(url)\n\t @photo = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/photos.json?token=#{ENV['API_KEY']}\"\n response = RestClient.get(url)\n @photos = JSON.parse(response.body)\t\t \n\tend\n end", "def image\n images.first\n end", "def index\n @images = getmydata(\"Image\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end", "def getimagesinfo\n trek = Trek.find_by_id(params[:id])\n send_data(trek.get_images_info.to_json,\n {:type => \"application/json\", :disposition => \"inline\"})\n end", "def get_all_images(env)\n images_json = get(env, \"#{@session.endpoints[:image]}/images\")\n images = JSON.parse(images_json)['images']\n\n return images if images.empty?\n\n is_v1 = false\n unless images[0].key? 'visibility'\n is_v1 = true\n images_json = get(env, \"#{@session.endpoints[:image]}/images/detail\")\n images = JSON.parse(images_json)['images']\n end\n\n images.map do |i|\n i['visibility'] = i['is_public'] ? 'public' : 'private' if is_v1\n Image.new(i['id'], i['name'], i['visibility'], i['size'], i['min_ram'], i['min_disk'])\n end\n end", "def index\n wishes = Wish.all.with_attached_image.where(is_secret: false)\n render json: { wishes: generate_image_url(wishes) }\n end", "def images\n images = []\n JSON.parse(resource['/offerings/image'].get)[\"images\"].each do |img|\n images << Image.new(img)\n end\n return images\n end", "def index\n @product_images = ProductImage.where(product_uuid: params[:product_id])\n render json: @product_images, status: 200\n end", "def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end", "def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end", "def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end", "def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end", "def show\n @image = Image.find(params[:id])\n\t\t\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end", "def images(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Images\", params: params)\n end", "def create\n @setup_image = SetupImage.new(setup_image_params)\n respond_to do |format|\n if @setup_image.save\n format.html { redirect_to setup_path(@setup_image.setup_id),\n notice: 'Setup was successfully updated.' }\n format.json { render :show, status: :created, location: @setup_image }\n else\n format.html { render :new }\n format.json { render json: @setup_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_image(image_id)\n request(\n :expects => 200,\n :method => 'GET',\n :parser => Fog::Parsers::Compute::Slicehost::GetImage.new,\n :path => \"images/#{image_id}.xml\"\n )\n end", "def image\n @data['images']&.first\n end", "def show\n @property_image = PropertyImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @property_image }\n end\n end", "def index\n @recipe_images = RecipeImage.all\n end", "def index\n @pictures = Picture.where(foodscape_id: params[:foodscape_id])\n render json: @pictures\n end", "def index\n @img_lists = ImgList.all\n render json: @img_lists\n end", "def show\n @estate_agent_image = EstateAgentsImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estate_agent_image }\n end\n end", "def status_images\n response = JSON.parse(@client.get(\"/api/v1/status-images\").body)\n return response[\"images\"] || response\n end", "def show\n render json: @family_image\n end", "def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @image }\n end\n end", "def images; end", "def show\n render json:@web_display_car_image\n end", "def show\n @imagem = Imagem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @imagem }\n end\n end", "def getimage\n if @artist.images.empty?\n @image = \"image1.jpg\"\n else\n @image = @artist.images.first[\"url\"]\n end\n end", "def show\n @image = Image.find(params[:id])\n checkaccountobject(\"images\",@image)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end", "def find( options={} )\n set_session if( session_id.nil? )\n image = request( 'images.getInfo', options )['Image']\n from_json_one( image, session_id )\n end", "def images\n []\n end", "def show\n coach = Coach.find(params[:id])\n json = coach.to_json({:image_url => ActionController::Base.helpers.asset_path(coach.image_url)})\n\n respond_to do |format|\n format.json {render :json => json}\n end\n end", "def getImage\n image=AWS::S3::S3Object.url_for('testing.png','tradeDev')\n render :json => {:image=>image}\n end", "def show\n @web_image = WebImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @web_image }\n end\n end", "def index\n @web_display_car_images = WebDisplayCarImage.all\n\n render json:@web_display_car_images\n end", "def index\n @images = Image.order('created_at DESC')\n @image = Image.new\n @uploader = ImageUploader.new\n # @uploader.key = \"uploads/#{@image.id}-#{request.ip}/${filename}\"\n # @uploader.success_action_status = \"201\"\n @uploader.success_action_redirect = new_image_url\n end", "def image\n response[\"image\"]\n end", "def api_url\n \"https://connect.gettyimages.com/v1\"\n end", "def imagga_images_info\n self.images.non_installation.collect do |image|\n image_options = { :image_url => image.filename.to_s }\n image_options.merge! pattern: image.pattern.name if image.pattern.present?\n image_options.merge! thumb_url: image.s3_path if image.s3_path.present?\n { :url => image.filename.to_s.gsub('https','http').gsub('-dev',''), :id => image.filename.path, :filepath => image.filename.path, :metadata => self.specifications_hash.merge(image_options) }\n end.flatten\n end", "def index\n render json: Picture.all\n end", "def show\n @image_upload = ImageUpload.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image_upload }\n end\n end", "def show\n @motivational_image = MotivationalImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @motivational_image }\n end\n end", "def index\n # @images = Image.all\n # @images = Image.order(\"id\").page(params[:page])\n @images = Image.page(params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end", "def index\n @images = Image.all\n respond_with @images\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end", "def show\n render json: @picture, status: :ok\n end", "def images artist\n url = \"http://developer.echonest.com/api/v4/artist/images?api_key=#{ECHONEST_API_KEY}&name=#{artist}&format=json&results=#{RESULTS}&start=0&license=unknown\"\n result = parseURL url\n result[\"response\"][\"images\"]\nend", "def show\n @combined_image = CombinedImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @combined_image }\n end\n end", "def show\n authorize! :read, @project\n @step = @project.steps.find_by_position(params[:id])\n @images = @project.images.where(\"step_id=?\", @step.id).order(\"position\")\n\n respond_to do |format|\n format.html\n format.json \n format.xml\n end\n end", "def create\n @image = Image.new(image_params)\n respond_to do |format|\n if @image.save\n format.json { render :json => { url: @image.image.url} }\n else\n \n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def urls( options =nil )\n json = request 'images.getURLs', options, :ImageID => image_id, :ImageKey => key\n \n image = upper_hash_to_lower_hash( json['Image'] )\n image.merge!( :image_id => image[\"id\"] )\n \n OpenStruct.new( image ) \n end", "def index\n @images = Image.all\n end", "def index\n @images = Image.all\n end", "def index\n @images = Image.all\n end", "def index\n @images = Image.all\n end", "def index\n @images = Image.all\n end", "def index\n @images = Image.all\n end", "def index\n @images = Image.all\n end", "def index\n @images = Image.all\n end", "def index\n @images = Image.all\n end", "def index\n @images = Image.all\n end", "def index\n @images = Image.all\n end", "def index\n @images = Image.all\n end", "def index\n @images = Image.all\n end", "def index\n @images = Image.all\n end", "def index\n @images = Image.all\n end", "def index\n @images = Image.all\n end", "def show\n @image_gallery = ImageGallery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image_gallery }\n end\n end", "def show\n user_id, id, ref = params[:user_id], params[:id], params[:ref]\n img = nil\n if id == '0' && ref\n # do lookup by reference\n img = Image.find_user_image_by_ref(user_id, params[:ref])\n elsif id != '0'\n # do lookup by guid\n img = Image.find_user_image_by_guid(user_id, id)\n end\n return not_found if !img\n\n respond_to do |format|\n format.json { render :json => img.js_serialize, :callback => params[:callback] }\n end\n end", "def images()\n @photos = all_photos() \n @headers['Content-Type'] = CONTENT_TYPE\n end", "def items\n @beverages = Beverage.available\n respond_to do |format|\n format.json { render :json => @beverages.to_json(methods: :image_url)}\n end\n end", "def images\n @images ||= Image.find_all_by_listing_id(listing_id, oauth)\n end", "def images\n @images ||= {}\n end" ]
[ "0.71026933", "0.6834008", "0.6741748", "0.66412127", "0.66015875", "0.65720665", "0.65720665", "0.64957744", "0.6485875", "0.6459928", "0.6449575", "0.64161915", "0.63928956", "0.63881624", "0.6361356", "0.63168263", "0.6316786", "0.63126636", "0.63058704", "0.6297701", "0.6297473", "0.62938166", "0.62763953", "0.6273588", "0.62680554", "0.62540734", "0.6239981", "0.62393993", "0.62206143", "0.62090635", "0.6199499", "0.61886984", "0.6187476", "0.6168564", "0.6163097", "0.61628807", "0.61628807", "0.61628807", "0.61628807", "0.6156814", "0.61419284", "0.6139365", "0.61308026", "0.61285055", "0.6125703", "0.6122483", "0.61212724", "0.6112208", "0.61045265", "0.6104479", "0.6103176", "0.6099796", "0.60867107", "0.60859776", "0.60693854", "0.60643107", "0.6062691", "0.60545594", "0.6039814", "0.6033376", "0.6022538", "0.60192674", "0.60095143", "0.6007267", "0.6001462", "0.5998713", "0.59924847", "0.59879047", "0.59834164", "0.5970368", "0.59661996", "0.5959265", "0.59585047", "0.59459865", "0.5931677", "0.5913924", "0.5911676", "0.590346", "0.5901994", "0.58980006", "0.58980006", "0.58980006", "0.58980006", "0.58980006", "0.58980006", "0.58980006", "0.58980006", "0.58980006", "0.58980006", "0.58980006", "0.58980006", "0.58980006", "0.58980006", "0.58980006", "0.589796", "0.5893517", "0.5888665", "0.5886431", "0.5884414", "0.5879926", "0.5878873" ]
0.0
-1
POST /setup_images POST /setup_images.json
def create @setup_image = SetupImage.new(setup_image_params) respond_to do |format| if @setup_image.save format.html { redirect_to setup_path(@setup_image.setup_id), notice: 'Setup was successfully updated.' } format.json { render :show, status: :created, location: @setup_image } else format.html { render :new } format.json { render json: @setup_image.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_image_params\n params.require(:setup_image).permit(:setup_id, :image)\n end", "def get_images_data\t\t\t\t\t\t\n\t\t{ payload: { 'makes' => makes_dropdown, 'images' => images_array('none').compact}, success: true}\n\tend", "def create\n @apartment = current_user.apartments.new(apartment_params)\n\n respond_to do |format|\n if @apartment.save\n if params[:images]\n # The magic is here ;)\n params[:images].each { |image|\n @apartment.pictures.create(image: image)\n }\n end\n format.html { redirect_to @apartment, notice: 'Propiedad creada correctamente.' }\n format.json { render :show, status: :created, location: @apartment }\n else\n format.html { render :new }\n format.json { render json: @apartment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @image = Image.new(image_params)\n respond_to do |format|\n if @image.save\n format.json { render :json => { url: @image.image.url} }\n else\n \n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n # original code\n\n # @image_set = ImageSet.create(image_set_params)\n\n # render json: @image_set\n\n# code for imageMagick\n @image_set = current_user.image_sets.guild(image_set_params)\n authorize @image_set\n if @image_set.save\n # to handle multiple image upload on create\n if params[:images]\n params[:images].each {|image|\n @image_set.images.create(image: image)\n }\n end\n flash[:notice] = \"Your image set has been created.\"\n redirect_to @image_set\n else\n flash[:alert] = \"Something went wrong.\"\n render 'new'\n end\n\n end", "def upload_image\n @image = Image.create(image_path: params[:upload][:image])\n p @image\n render json: @image\n end", "def create\n @results = []\n\n unless params[:files].nil?\n params[:files].each do |data|\n img = Image.new\n img.filename = data.original_filename\n img.data = data.read\n img.upload_id = params[:uuid]\n img.visitation_form_id = params[:formId]\n img.image_type = params[:imageType]\n img.content_type = data.content_type\n #img.temp_index = params[:birdIndex]\n img.bird_id = params[:birdId]\n\n if !img.save\n render :json => { :errors => img.errors.full_messages }, :status => 400 and return\n else\n @results << { name: img.filename, imageType: img.image_type, id: img.id }\n end\n end\n end\n\n render json: { files: @results }\n end", "def create\n @image = Image.new(image_params)\n\n respond_to do |format|\n if @image.save\n format.json { render json: @image, status: :created, location: [:admin, @image] }\n else\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @smartphone = Smartphone.new(smartphone_params)\n\n respond_to do |format|\n if @smartphone.save\n if params[:images]\n params[:images].each do |val|\n @smartphone.pictures.create(image: val)\n end\n end\n\n format.html { redirect_to @smartphone, notice: 'Smartphone was successfully created.' }\n format.json { render :show, status: :created, location: @smartphone }\n else\n format.html { render :new }\n format.json { render json: @smartphone.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_image_features(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :POST, nil)\n nil\n end", "def create \n @image ||= Image.new(image_params)\n if @image.save\n render json: {\"url\" => @image.image_url(:resized), \"success\" => true}\n else\n render json: @image.errors, status: :unprocessable_entity\n end\n end", "def add_images\n\t\tif @current_user.present?\n\t\t\t@property = Property.find(params[:property_id])\n\t\t\tif @property.present?\n\t\t\t\t# if @property.images.present?\n\t\t\t\t# \t@property.images.destroy_all\n\t\t\t\t# end\n\t\t\t\tparams[:images].each { |image|\n\t i = @property.images.create(image: image)\n\t if i.save\n\t else\n\t \trender_json({\"status\" => \"Fail\", \"message\" => i.errors.full_messages.first}.to_json)\n\t \treturn\n\t end\n\t }\n\t @property.images.first.update_attributes(is_starred: true)\n\t render :file => 'api/v1/property/add_image'\n\t else\n\t \trender_json({\"status\" => \"Fail\", \"message\" => \"No property found.\"}.to_json)\n\t end\n\t\tend\n\tend", "def create\n image = Image.create(image_params)\n\n if image.new_record?\n render json: { errors: image.errors.messages }, status: 422\n else\n render json: image, status: 201\n end\n end", "def create\n @rent = Rent.new(rent_params)\n @rentpar = rent_params\n respond_to do |format|\n if @rent.save\n\n if params[:image]\n puts params[:image]\n params[:image].each { |image|\n @rent.rent_images.create(rent_id: @rent.id, image:image)\n }\n \n end\n\n format.html { redirect_to @rent, notice: 'Rent was successfully created.' }\n format.json { render :show, status: :created, location: @rent }\n else\n format.html { render :new }\n format.json { render json: @rent.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_setup_image\n @setup_image = SetupImage.find(params[:id])\n end", "def create_images\n problem_image = self.images.build\n File.open('./public/projects/problem_default.jpg') do |f|\n problem_image.image = f\n end\n\n solution_image = self.images.build\n File.open('./public/projects/solution_default.jpg') do |f|\n solution_image.image = f\n end\n\n team_image = self.images.build\n File.open('./public/projects/team_default.png') do |f|\n team_image.image = f\n end\n end", "def create_image(image)\n self.images.create(image: image) if image.present?\n end", "def create\n respond_to do |format|\n @pix.images.attach(params[:images]) if params[:images]\n if @pix.save\n format.html do\n redirect_to go_to_pix(@pix),\n flash: { success: 'Pix was successfully saved.' }\n end\n format.json { render :show, status: :created, location: @pix }\n else\n format.html { render :new }\n format.json { render json: @pix.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @image = Image.new(image_params)\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to aquarium_images_url, notice: 'Image was successfully created.' }\n format.json { render json: @image, status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@img = ReportImage.new(img_params)\n\n\t\tif @img.save\n\t\t\trender :json => @img\n\t\telse\n\t\t\trender :json => @img.errors\n\t\tend\n\tend", "def create\n @family_image = FamilyImage.new(family_image_params)\n\n if @family_image.save\n render json: @family_image, status: :created, location: @family_image\n else\n render json: @family_image.errors, status: :unprocessable_entity\n end\n end", "def add_image\n obtain_product_image_params\n pi = ProductImage.new(picture: @image_params)\n @product.product_images << pi\n render json: @product.simple_info, status: :ok\n rescue => e\n render json: { error: e }, status: :bad_request\n end", "def create_remote\n img = {}\n data = {}\n if params[:data].present?\n data = JSON.parse(params[:data]).symbolize_keys\n img = data[:image].symbolize_keys\n else\n img = params[:image]\n end\n model = @imageable.class\n former_image = @imageable.respond_to?(:images) ? nil : @imageable.image\n kind = img[:kind]\n kind = model::IMAGE_KINDS.keys.first if kind.blank? && model.const_defined?(:IMAGE_KINDS)\n image = Image.new(imageable: @imageable, kind: kind, legend: img[:legend].to_s, zoomable: (img[:zoomable].present? ? img[:zoomable] : true))\n if Figaro.env.s3_enabled.to_bool\n # Special field for carrierwave_direct's business\n image.img.key = data[:key]\n end\n if request.xhr?\n if image.save_and_process!\n former_image.try :destroy if former_image\n #image[:url] = image.img.url\n return render(json: image, status: :ok)\n end\n Rails.logger.error \"[Image Creation Error #{Time.zone.now.xmlschema}] #{image.errors.full_messages}\"\n errors = image.errors[:img]\n render json: [{ error: errors }], status: :error\n else\n if image.save_and_process!\n former_image.try :destroy if former_image\n #image[:url] = image.img.url\n if Figaro.env.s3_enabled.to_bool && Figaro.env.js_upload_enabled.to_bool && Figaro.env.js_s3_iframe_enabled.to_bool\n return render(nothing: true)\n end\n return redirect_to({ action: :assist, id: image })\n end\n Rails.logger.error \"[Image Creation Error #{Time.zone.now.xmlschema}] #{image.errors.full_messages}\"\n redirect_to parent_url, alert: \"L’image n’a pas pu être créée\"\n end\n end", "def create\n @imageable = find_imageable\n @image = @imageable.images.build(image_params)\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: t('.notice', image: @image) }\n format.json\n else\n format.html { render :new }\n format.json {\n render json: @image.errors[:attachment], status: :unprocessable_entity\n }\n end\n end\n end", "def create\n #debugger\n blog = blog_params[:name]\n @user = User.find(session[:user_id])\n\n params[:image][:attached_assets_attrs].each do |item|\n ImgGroup.post item[:asset], @user, blog\n end\n\n respond_to do |format|\n format.html { render action: 'done' }\n format.json { render text: 'All posted.', status: :created, location: @image }\n end\n end", "def create\n @image_collection = ImageCollection.new(image_collection_params)\n\n respond_to do |format|\n if @image_collection.save\n image_collection_params[:attached_images].reject(&:empty?).each do |id|\n @image_collection.images << Image.find(id)\n end\n\n @image_collection.save\n\n format.html { redirect_to @image_collection, notice: 'Image collection was successfully created.' }\n format.json { render :show, status: :created, location: @image_collection }\n else\n format.html { render :new }\n format.json { render json: @image_collection.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @image = Image.new(params[:image])\n\t\t\n\t\tif (params[:image][:filename])\n \t#function in manage_images.rb\n \tprocess_image(tmp = params[:image][:filename].tempfile)\n\t\tend\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render json: @image, status: :created, location: @image }\n else\n format.html { render action: \"new\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n\n if @post.save && params[:images]\n params[:images].each { |image|\n @post.images.create(image: image)\n }\n end\n\n redirect_to @post\n end", "def create\n @driver = Driver.new(driver_params)\n\n if @driver.images.count>0\n @driver.images.attach(params[:driver][:images])\n end\n\n respond_to do |format|\n if @driver.save\n format.html { redirect_to @driver, notice: 'Driver was successfully created.' }\n format.json { render :show, status: :created, location: @driver }\n else\n format.html { render :new }\n format.json { render json: @driver.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @image = Image.new(image_params)\n\n # fetch tags from google vision API\n helpers.fetch_tags(image_params)\n\n @image.image_file.attach(image_params[:image_file])\n\n respond_to do |format|\n if @image.save()\n format.html { redirect_to @image, notice: \"Image was successfully created.\" }\n format.json { render :show, status: :created, location: @image }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @truck = Truck.new(truck_params)\n\n if @truck.images.count>0\n @truck.images.attach(params[:truck][:images])\n end\n\n respond_to do |format|\n if @truck.save\n format.html { redirect_to @truck, notice: 'Truck was successfully created.' }\n format.json { render :show, status: :created, location: @truck }\n else\n format.html { render :new }\n format.json { render json: @truck.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n request_image = params[:image]\n url_hash = SecureRandom.urlsafe_base64(6)\n name = url_hash + \"-\" + request_image.original_filename.downcase\n\n File.open(\"#{Rails.root}/public/theta/#{name}\", 'wb') do |f|\n f.write(request_image.read)\n end\n\n theta = Theta.create!(url_hash: url_hash, image_url: name)\n render json: {url: \"http://www.rakugaki.tk/h/#{theta.url_hash}\"}, status: 201\n end", "def index\n @setup_images = SetupImage.all\n end", "def create\n @image_attrib = ImageAttrib.new(image_attrib_params)\n\n if @image_attrib.save\n render :show, status: :created, location: @image_attrib\n else\n render json: @image_attrib.errors, status: :unprocessable_entity\n end\n end", "def create_image_metadata\n {}\n end", "def create\n\n post = Post.new(post_params)\n post.location = Location.create(name: params[:post][:location][:name], lat: params[:post][:location][:lat], long: params[:post][:location][:long])\n if post.save\n params[:post][:images].each do |i|\n img = Image.find(i[:id])\n img.update(active: 1, post_id: post.id)\n end\n\n render json: {\n status: \"success\",\n data: post.as_json(\n include: [\n {\n user:\n {\n only: [:id, :name, :avatar]\n }\n },\n :location,\n {\n images: {\n only: [:id, :src]\n }\n },\n :rates\n ])}, status: :ok\n\n else\n render json: post.errors, status: 404\n end\n end", "def create\n add_more_images(image_params[:thing_images])\n flash[:error] = \"Failed uploading images\" unless @thing.save\n redirect_to :back\n end", "def create\n par = img_properties\n logger.info(\"parameters: #{par.inspect}\")\n valid = true\n\n begin\n url = par[:original_url] || par[:url]\n\n @image = Image.new do |i|\n #specify all properties to copy explicitly\n i.user = @user\n # set optional parameters\n i.name = par[:name] if !par[:name].blank?\n i.ref = par[:ref] if !par[:ref].blank?\n i.original_url = url if url\n i.page_url = par[:page_url] if !par[:page_url].blank?\n i.source = par[:source] if !par[:source].blank?\n i.image_type = Image::TYPE_LS\n end\n\n # this may fail\n @image.remote_upload_url = url\n\n # set calibration data if specified\n if !par[:calibrate_length].blank?\n @image.calibrate_length = par[:calibrate_length].to_f\n @image.calibrate_unit = par[:calibrate_unit].to_i if !par[:calibrate_unit].blank?\n @image.calibrate_coords = par[:calibrate_coords] if !par[:calibrate_coords].blank?\n @image.ppi = calculate_ppi(@image)\n end\n\n rescue CarrierWave::DownloadError\n @image.errors.add(:remote_upload_url, \"^This url doesn't appear to be valid\")\n valid = false\n rescue CarrierWave::IntegrityError\n @image.errors.add(:remote_upload_url, \"^This url does not appear to point to a valid image\")\n valid = false\n rescue StandardError\n @image.errors.add(:remote_upload_url, \"There does not appear to be an image at this url\")\n valid = false\n end\n\n if valid && @image.save\n # update product if set\n @image.user_product = par[:product] if par[:product]\n\n render :json => @image.js_serialize, :callback => params[:callback]\n else\n render :json => { :error => 403, :messages => prepare_errors(@image), :callback => params[:callback]}, :status => 200\n end\n end", "def create\n @estate_agent_image = EstateAgentsImage.new(params[:property_image])\n\n respond_to do |format|\n if @estate_agent_image.save\n format.html { redirect_to @estate_agent_image, notice: 'Property image was successfully created.' }\n format.json { render json: @estate_agent_image, status: :created, location: @estate_agent_image }\n else\n format.html { render action: \"new\" }\n format.json { render json: @estate_agent_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def upload_new_image_file(detection_flags, image = {})\n @client.post \"/service_json_ssl.svc/UploadNewImage_File\", {detection_flags:detection_flags,imagefile_data:image[:data],original_filename:image[:original_filename]}\n end", "def image_params\n params.require(:image).permit(:url, :image_set_id)\n end", "def setup_workspace_image\n image_path(image_name: params[:setup_workspace_image])\n end", "def create\n @listing = current_admin.listings.build(listing_params)\n\n respond_to do |format|\n if @listing.save\n\n if params[:pictures]\n #===== The magic is here ;)\n params[:pictures].each { |image|\n @listing.pictures.create(file: image)\n }\n end\n\n format.html { redirect_to admin_listings_url, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_image = Image.new(admin_image_params)\n \n respond_to do |format|\n if @admin_image.save\n format.html { redirect_to admin_images_url, notice: 'Image was successfully created.' }\n format.json { render :show, status: :created, location: @admin_image }\n else\n format.html { render :new }\n format.json { render json: @admin_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #@experience_image = ExperienceImage.new(experience_image_params)\n logger.debug \"The params coming in are:#{params.inspect}\"\n @experience_image = ExperienceImage.new(experience_image_params)\n logger.debug \"The file created is: #{@experience_image.inspect}\"\n\n\n respond_to do |format|\n if @experience_image.save\n format.json{ render :json => @experience_image }\n else\n format.json { render json: @experience_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = Album.new(params[:album])\n \n respond_to do |format|\n images = [params[:images]].flatten\n @album.images << Image.find(images) unless images[0].nil?\n \n if @album.save\n format.html { redirect_to(albums_path, :notice => 'Album was successfully created.') }\n format.xml { render :xml => albums_path, :status => :created, :location => @album }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @image = Spree::Image.new(params[:image])\n\n respond_to do |format|\n if @upload.save\n format.html {\n render :json => [@image.to_jq_upload].to_json,\n :content_type => 'text/html',\n :layout => false\n }\n format.json { render json: {files: [@image.to_jq_upload]}, status: :created, location: @image }\n else\n format.html { render action: \"new\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n @item.images.delete_all\n unless params.require(:item)[:images_id].nil?\n params.require(:item)[:images_id].each do |id|\n image = Image.find_by_id(id)\n (@item.images << image) unless image.nil?\n end\n end\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n image = PropertyImage.new()\n image.photo = params[:file]\n image.property_form = @property_form\n if image.save\n respond_to do |format|\n format.json do\n json = {id: image.id}\n render json: json\n end\n end\n end\n end", "def create\n @image = Image.create(image_params)\n @image.save\n\n end", "def create\n\n if current_user.nil?\n redirect_to '/'\n end\n\n if(params[\"labels\"].nil?)\n respond_to do |format|\n format.html { redirect_to image_label_sets_url, error: 'Labels not present.' }\n end\n return\n end\n\n @image_label_set = ImageLabelSet.new\n @image_label_set.name = params[\"name\"]\n @image_label_set.user_id = current_user.id\n save_success = @image_label_set.save\n\n params[\"labels\"].split(\",\").each do |l|\n lb = Label.new\n lb.text = l\n lb.image_label_set_id = @image_label_set.id\n lb.save\n end\n\n images_folder_path = Rails.root.join('public', \"images/#{@image_label_set.id}\")\n FileUtils::mkdir_p images_folder_path\n\n accepted_formats = [\".jpg\", \".png\", \".bmp\"]\n\n params[\"upload\"].each do |uf|\n #Check if zipfile, raw images or URL textfile\n if (File.extname(uf.tempfile.path)==\".txt\")\n Image.transaction do\n File.readlines(uf.tempfile.path).each do |line|\n i = Image.new\n i.url = line.strip\n i.image_label_set_id = @image_label_set.id\n i.save\n end\n end\n end\n uf.tempfile.close\n uf.tempfile.unlink\n end\n\n respond_to do |format|\n if save_success\n format.html { redirect_to @image_label_set, notice: 'Image label set was successfully created.' }\n format.json { render :show, status: :created, location: @image_label_set }\n else\n format.html { render :new }\n format.json { render json: @image_label_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def generated_image_params\n params.require(:generated_image).permit(:image, :content_image_id, :style_image_id, :iterations)\n end", "def test_fb_sign_up_and_upload_monkey_image\n # Step 1\n @user.email = @fb_user['email']\n login_fb_user!(@fb_user, @user)\n\n # Step 2\n assign_http(Config[\"panda\"][\"host\"])\n\n opts = { 'vrid' => @user.vrid }\n\n get_consumer_search_resp('ramen', 'glendale, ca', opts)\n assert_response(@response, :success)\n\n listing = @parsed_response['SearchResult']['BusinessListings'].first\n int_xxid = listing['Int_Xxid']\n\n # Step 3\n assign_http(Config[\"monkey\"][\"host\"])\n\n headers = { 'Content-Type' => 'image/jpg' }\n\n params = {\n 'api_key' => Config[\"monkey\"][\"api_key\"],\n 'oauth_token' => @user.oauth_token,\n 'metadata' => {\n 'user_type' => 'xx'\n }\n }\n\n put_file \"/b_image\", params, generate_random_image, headers\n assert_response(@response, :success)\n\n sha1 = @parsed_response['id']\n\n params = {\n 'ext_type' => 'int_xxid',\n 'ext_id' => int_xxid,\n 'oauth_token' => @user.oauth_token,\n 'api_key' => Config[\"monkey\"][\"api_key\"],\n 'metadata' => {\n 'user_type' => 'xx'\n }\n }\n\n post \"/b_image/#{sha1}\", params\n assert_response(@response, :success)\n\n # Step 4\n assert_image_in_consumer_business(sha1, listing)\n assert_image_in_profile(sha1, @user)\n\n # Step 5\n assign_http(Config[\"monkey\"][\"host\"])\n\n params = {\n 'ext_type' => 'int_xxid',\n 'ext_id' => int_xxid,\n 'oauth_token' => @user.oauth_token,\n 'api_key' => Config[\"monkey\"][\"api_key\"],\n 'reason' => 6\n }\n\n post \"/b_image/#{sha1}/int_xxid/#{int_xxid}/report\", params\n assert_response(@response, :success)\n\n params = { 'api_key' => Config[\"monkey\"][\"api_key\"] }\n\n get \"/business/images/#{int_xxid}\", params\n assert_response(@response, :success)\n refute_empty(@parsed_response[int_xxid],\n \"Expected response for int_xxid #{int_xxid} to not be empty: #{@parsed_response}\")\n refute(@parsed_response[int_xxid].map { |images| images['id'] }.include?(sha1),\n \"Expected image removed from list after delete: #{sha1}\")\n end", "def create\n @picture = Picture.create!(picture_params)\n render json: @picture, status: :created\n end", "def images\n @images ||= ApiFactory.new 'Projects::Images'\n end", "def create\n create_params = product_image_params || {product_uuid: @product.uuid}\n @product_image = ProductImage.new(product_image_params)\n if @product_image.save\n render json: @product_image, status: 201\n else\n render_error 400, @product_image.errors.full_messages\n end\n end", "def setup_program_image\n image_path(image_name: params[:setup_program_image])\n end", "def setup_images\n @default_image = NSImage.imageNamed(\"default.png\")\n @alternate_image = NSImage.imageNamed(\"alternate.png\")\n @highlight_image = NSImage.imageNamed(\"highlight.png\")\n end", "def container_images\n add_properties(\n # TODO: (bpaskinc) old save matches on [:image_ref, :container_image_registry_id]\n # TODO: (bpaskinc) should match on digest when available\n # TODO: (mslemr) provider-specific class exists (openshift), but specs fail with them (?)\n :model_class => ::ContainerImage,\n :manager_ref => %i[image_ref],\n :delete_method => :disconnect_inv\n )\n add_common_default_values\n end", "def create\n @image = Image.new(params[:image])\n type = @image.url_type\n #response.headers[\"Content-type\"] = \"text/plain\"\n if @image.save\n render :text => [ @image.to_jq_upload(type, \"image\") ].to_json.to_s\n else \n render :text => [ @image.to_jq_upload(type, \"image\").merge({ :error => \"custom_failure\" }) ].to_json.to_s\n end\n end", "def image_callback\n @image = Image.create(image_params)\n @lecture.update(image: @image)\n end", "def create\n @icesled = Icesled.new(icesled_params)\n @icesled.manufacturer_id ||= Manufacturer.where(name: 'не указан', category: 'icesled').first_or_create.id\n respond_to do |format|\n if @icesled.save\n if params[:images]\n @icesled.gallery ||= Gallery.new\n params[:images].each do |image|\n @icesled.gallery.images.create(image: image)\n end\n unless @icesled.image_file_size\n @icesled.update(image: @icesled.gallery.images.first.image)\n end\n end\n format.html { redirect_to @icesled, notice: 'Icesled was successfully created.' }\n format.json { render :show, status: :created, location: @icesled }\n else\n format.html { render :new }\n format.json { render json: @icesled.errors, status: :unprocessable_entity }\n end\n end\n end", "def images\n end", "def image_params\n params.require(:inspection).permit(:image => [])\n end", "def element\n image_name_list = get_image_name_list ORIGINALS_PATH\n image_name_list.each { |image_name| post(image_name) }\n end", "def create\n @image = Image.new(image_params)\n @image.name = params[:image][:picture].original_filename\n @image.picture = params[:image][:picture].read\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to images_path, success: 'Image was successfully created.' }\n format.json { render :show, status: :created, location: images_path }\n else\n format.html { render :new }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_images\n {}\n end", "def create\n @image = Image.new(image_params)\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: \"Image was successfully created.\" }\n format.json { render :show, status: :created, location: @image }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_images(product)\n self.image_labels.each_with_index do |label, position|\n\n self.image_file_extensions.each do |extension|\n file_name = self.image_path + value('image') + '_' + label + extension\n next unless File.exist?(file_name)\n\n types = []\n\n unless self.image_types[position].nil?\n types = product_attribute_set.asset_types.where(code: self.image_types[position].split(',').map(&:strip))\n end\n\n image = Asset.new\n image.product = product\n image.store = self.store\n image.position = position\n image.label = label\n image.set_file(File.open(file_name))\n\n types.each do |type|\n image.asset_types << type\n end\n\n # save without sync to format with paperclip\n image.sync_needed = false\n image.save\n\n # save with sync to push to magento\n image.sync_needed = true\n image.save\n end\n end\n end", "def update\n respond_to do |format|\n if @apartment.update(apartment_params)\n if params[:images]\n # The magic is here ;)\n params[:images].each { |image|\n if (image!=nil)\n @apartment.pictures.create(image: image)\n \n end\n }\n end\n format.html { redirect_to @apartment, notice: 'La propiedad se actualizo correctamente.' }\n format.json { render :show, status: :ok, location: @apartment }\n else\n format.html { render :edit }\n format.json { render json: @apartment.errors, status: :unprocessable_entity }\n end\n end\n end", "def images_attributes=(image_attributes)\n image_attributes.each do |attributes| \n post_images.build(attributes) \n end\n end", "def create\n @salon_image = @salon.salon_images.new(salon_image_params)\n\n respond_to do |format|\n if @salon_image.save\n format.html { redirect_to salon_salon_image_path(@salon, @salon_image), notice: 'Salon image was successfully created.' }\n format.json { render :show, status: :created, location: @salon_image }\n else\n format.html { render :new }\n format.json { render json: @salon_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @picture = Picture.new(picture_params)\n\n if @picture.save\n @picture.update(foodscape_id: params[:foodscape_id])\n render json: @picture, status: :created\n else\n render json: @picture.errors, status: :unprocessable_entity\n end\n end", "def create\n @imagedemo = Imagedemo.new(imagedemo_params)\n\n respond_to do |format|\n if @imagedemo.save\n format.html { redirect_to @imagedemo, notice: 'Imagedemo was successfully created.' }\n format.json { render action: 'show', status: :created, location: @imagedemo }\n else\n format.html { render action: 'new' }\n format.json { render json: @imagedemo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @image = Image.new(image_params)\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render :show, status: :created, location: @image }\n else\n format.html { render :new }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @image = Image.new(image_params)\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render :show, status: :created, location: @image }\n else\n format.html { render :new }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @image = Image.new(image_params)\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render :show, status: :created, location: @image }\n else\n format.html { render :new }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @image = Image.new(image_params)\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render :show, status: :created, location: @image }\n else\n format.html { render :new }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @image = Image.new(image_params)\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render :show, status: :created, location: @image }\n else\n format.html { render :new }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @image = current_user.images.build(image_params)\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to user_images_path(current_user), notice: 'Image was successfully created.' }\n format.json { render :show, status: :created, location: @image }\n else\n format.html { render :new }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @property_image = PropertyImage.new(params[:property_image])\n\n respond_to do |format|\n if @property_image.save\n format.html { redirect_to property_images_path, notice: 'Property image was successfully created.' }\n format.json { render json: @property_image, status: :created, location: @property_image }\n else\n format.html { render action: \"new\" }\n format.json { render json: @property_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @family = Family.new(family_params)\r\n @image = @family.images.new\r\n @image.generate_filename\r\n @uploaded_io = params[:family][:uploaded_file]\r\n\r\n File.open(Rails.root.join('public', 'images', @image.filename), 'wb') do |file|\r\n file.write(@uploaded_io.read)\r\n end\r\n\r\n respond_to do |format|\r\n if @family.save\r\n format.html { redirect_to @family, notice: 'Family was successfully created.' }\r\n format.json { render :show, status: :created, location: @family }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @family.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @gallery = Gallery.new(gallery_params)\n\n respond_to do |format|\n if @gallery.save\n if params[:images]\n params[:images].each { |image|\n pic = @gallery.pics.create(image: image)\n data = Cloudinary::Uploader.upload(image,@auth)\n pic.public_id = data['secure_url']\n pic.image_file_size = data['bytes']\n pic.save\n }\n end\n\n format.html { redirect_to @gallery, notice: 'Gallery was successfully created.' }\n format.json { render json: @gallery, status: :created, location: @gallery }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gallery.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_updated_image(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :POST, 'File')\n end", "def create_json\n respond_to do | wants |\n wants.json do\n _create do | image, image_placement |\n if image.save && image_placement.save\n render :layout => false, :json => { :status => 'UPLOADED', :image_url => url_for(:action=>'show', :id=>image_placement.id, :only_path => true)} \n # returning application/json, text/x-json, text/json cause Firefox 3 to try to open an app\n # returning text/html or application/xhtml+xml causes ampersands (&) in json \n # strings to get html_escape (&amp;)\n response.content_type = Mime::HTML\n else\n render :layout => false, :json => { :status => 'FAILED'}\n # otherwise Rails returns application/json and Firefox 3 tries to open an app\n response.content_type = Mime::HTML\n end\n end\n end\n end\n end", "def create\n @image = Image.new(image_params)\n respond_to do |format|\n if @image.save\n flash[:success] = 'Image was successfully created.'\n format.html { redirect_to new_admin_image_preview_url(image_id: @image.id) }\n format.json { render :show, status: :created, location: @image }\n else\n format.html { render :new }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @recipe_image_form = RecipeImageForm.new(recipe_image_params)\n\n respond_to do |format|\n if recipe_image = @recipe_image_form.save\n format.html { redirect_to @recipe_image_form.recipe, notice: 'Recipe image was successfully created.' }\n format.json { render :show, status: :created, location: recipe_image }\n else\n format.html { render :new }\n format.json { render json: @recipe_image_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @image = Image.new(image_params) do |t|\n t.data = Base64.encode64(params[:image][:data].read)\n t.filename = params[:image][:data].original_filename\n t.mime_type = params[:image][:data].content_type\n end\n # @image.name = image_params['name']\n # @image.price = image_params['price']\n # @image.city = image_params['city']\n # @image.description1 = image_params['description1']\n # @image.description2 = image_params['description2'] \n @image.active = true\n @image.admin_ok = false\n @image.user_id = current_user.id\n @image.e_mail = current_user.email\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render :show, status: :created, location: @image }\n else\n format.html { render :new }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @used_bike = UsedBike.new(used_bike_params)\n\n if @used_bike.save\n adding_images(params)\n render json: @used_bike, status: :created, serializer: Web::V1::UsedBikeSerializer\n else\n render json: @used_bike.errors, status: :unprocessable_entity\n end\n end", "def create\n\n @event = Event.new(event_params)\n\n if @event.images.count>0\n @event.images.attach(params[:event][:images])\n end\n\n respond_to do |format|\n if @event.save\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\n @image = Image.new(image_params)\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render action: 'show', status: :created, location: @image }\n else\n format.html { render action: 'new' }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params[:exercise_medium_image][:token] = params[:exercise_medium_id]\n @exercise_image = case @exercise.blank?\n when true\n ExerciseMediumImage.new(params[:exercise_medium_image])\n when false\n @exercise.exercise_images.new(params[:exercise_medium_image])\n end\n \n # Won't validate so we avoid carrierwave error checking\n if @exercise_image.save(:validate=>false)\n file_name = ActiveRecord::Base.sanitize(params[:exercise_medium_image][:image])\n\n # Manually update exercise so we avoid carrierwave\n ActiveRecord::Base.connection.execute(\"update exercise_images set image=\" + file_name+ \" where id=\" + @exercise_image.id.to_s)\n @exercise_image.reload\n # Maybe reprocess the image to get thumbnails?? Naaah\n\n render json: @exercise_image, status: :created\n else\n render json: @exercise_image.errors.full_messages, status: :unprocessable_entity\n end\n \n end", "def create\n @image_to_sample = ImageToSample.new(image_to_sample_params)\n\n respond_to do |format|\n if @image_to_sample.save\n format.html { redirect_to @image_to_sample, notice: 'Image to sample was successfully created.' }\n format.json { render action: 'show', status: :created, location: @image_to_sample }\n else\n format.html { render action: 'new' }\n format.json { render json: @image_to_sample.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @image = Image.new(image_params)\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render action: 'show', status: :created, location: @image }\n else\n format.html { render action: 'new' }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @image = Image.new(image_params)\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render action: 'show', status: :created, location: @image }\n else\n format.html { render action: 'new' }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n require 'RMagick'\n @images_added = []\n\n # params[:design_images] is set by a js library (Dropzone.js) and defined on dynamic_pages.js paramName\n params[:design_images].each do |array_file|\n\n # uploaded file example\n # {\"0\"=>#<ActionDispatch::Http::UploadedFile:0x007f88cf70b728 @tempfile=#<Tempfile:/var/folders/tx/fcpjq87x6b19sl3dvvm8fr040000gn/T/RackMultipart20150803-99318-18nmoiu.jpg>, @original_filename=\"10881656_10201963394846606_706439852029346946_n.jpg\", @content_type=\"image/jpeg\", @headers=\"Content-Disposition: form-data; name=\\\"singular_design[0]\\\"; filename=\\\"10881656_10201963394846606_706439852029346946_n.jpg\\\"\\r\\nContent-Type: image/jpeg\\r\\n\">, \"1\"=>#<ActionDispatch::Http::UploadedFile:0x007f88cf70b610 @tempfile=#<Tempfile:/var/folders/tx/fcpjq87x6b19sl3dvvm8fr040000gn/T/RackMultipart20150803-99318-1loctd5.jpg>, @original_filename=\"11062261_825163280904553_6934851262428256525_n.jpg\", @content_type=\"image/jpeg\", @headers=\"Content-Disposition: form-data; name=\\\"singular_design[1]\\\"; filename=\\\"11062261_825163280904553_6934851262428256525_n.jpg\\\"\\r\\nContent-Type: image/jpeg\\r\\n\">}\n\n uploaded_file = array_file.last\n\n # file checking (size and filetype)\n return false if !valid_img? uploaded_file\n\n # main image random filename\n random_filename = build_filename(uploaded_file)\n\n image = Magick::Image.from_blob(uploaded_file.read).first\n original_width = image.columns # columns are pixels\n original_height = image.rows # rows are pixels\n\n # just resize if image is larger in width\n image = image.resize_to_fit(2000, original_height) if original_width >= 2000\n image.write(Rails.root.join('public', 'assets', 'uploads','designs', random_filename))\n\n # thumbnail image random filename\n thumb_random_filename = build_filename(uploaded_file, true)\n thumbnail = image.resize_to_fill(250, 150)\n thumbnail.write(Rails.root.join('public', 'assets', 'uploads','designs', thumb_random_filename))\n\n # generating link for this new design\n random_link = SecureRandom.hex(4)\n\n while Design.exists?(link: random_link) == true do random_link = SecureRandom.hex(4) end\n\n @design = Design.new(user_id: current_user.id,\n link: random_link,\n image_path: random_filename,\n image_thumb_path: thumb_random_filename)\n\n @images_added << @design if @design.save\n end\n\n respond_to do |format|\n format.html { redirect_to :individuais }\n format.json { render json: @images_added }\n end\n end", "def container_images\n add_properties(\n # TODO: (bpaskinc) old save matches on [:image_ref, :container_image_registry_id]\n # TODO: (bpaskinc) should match on digest when available\n # TODO: (mslemr) provider-specific class exists (openshift), but specs fail with them (?)\n :model_class => ::ContainerImage,\n :manager_ref => %i[image_ref],\n :delete_method => :disconnect_inv,\n :custom_reconnect_block => custom_reconnect_block\n )\n add_common_default_values\n end", "def create\n @image = Image.new(params[:image])\n @image.description = Description.new(params[:description]) if @image.description == nil\n @image.image_shell = ImageShell.find(params[:image_shell][:image_shell_id]) if params[:image_shell]\n \n if params[:request]\n r = Request.find(params[:request][:request_id])\n r.action_was_taken!\n @image.owner_request = r\n end\n \n respond_to do |format|\n if @image.save\n flash[:notice] = (@image.owner_request) ? \"We'll review your modifications and get back to you.\" : 'Image was successfully created.'\n format.html { redirect_to(@image) }\n format.xml { render :xml => @image, :status => :created, :location => @image }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @image.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @image = Image.new(params[:image])\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render json: @image, status: :created, location: @image }\n else\n format.html { render action: \"new\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @image = Image.new(params[:image])\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render json: @image, status: :created, location: @image }\n else\n format.html { render action: \"new\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.681784", "0.65543956", "0.6303831", "0.62635", "0.62337154", "0.6214965", "0.61802816", "0.6173078", "0.6137321", "0.6121409", "0.6116104", "0.61096835", "0.61003244", "0.60777843", "0.60739785", "0.6028981", "0.6002002", "0.59794337", "0.59699404", "0.5964449", "0.593832", "0.5921857", "0.5915452", "0.5913686", "0.5910129", "0.5889198", "0.58863497", "0.58855194", "0.58768487", "0.58656013", "0.5819627", "0.5817346", "0.5816903", "0.5807792", "0.5807121", "0.5790794", "0.57783055", "0.57734686", "0.5765945", "0.57650566", "0.57624054", "0.57610387", "0.5760117", "0.575737", "0.5756876", "0.5739916", "0.57383674", "0.5735954", "0.57356775", "0.572427", "0.57231855", "0.5721802", "0.57079566", "0.5706524", "0.5701706", "0.5683241", "0.56806064", "0.5676729", "0.5673542", "0.56726974", "0.5668058", "0.5665255", "0.5660757", "0.5635998", "0.56273866", "0.5626242", "0.5624446", "0.5621826", "0.56160486", "0.56110704", "0.561088", "0.56095743", "0.56067306", "0.56021047", "0.5600215", "0.5600215", "0.5600215", "0.5600215", "0.5600215", "0.55963945", "0.5594646", "0.5593005", "0.5591427", "0.55875945", "0.55813575", "0.55797565", "0.5577533", "0.5577405", "0.5576819", "0.55757535", "0.55724984", "0.55696404", "0.5568989", "0.5568434", "0.5568434", "0.5552307", "0.5548674", "0.5544802", "0.5543618", "0.5543618" ]
0.69055104
0
PATCH/PUT /setup_images/1 PATCH/PUT /setup_images/1.json
def update respond_to do |format| if @setup_image.update(setup_image_params) format.html { redirect_to @setup_image.setup, notice: 'Setup image was successfully updated.' } format.json { render :show, status: :ok, location: @setup_image } else format.html { render :edit } format.json { render json: @setup_image.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @image = Image.find(params[:id])\n\n #we can allow updating an image name and description and unit, but not the image data. for that we need to create a new image\n update_params = image_params\n update_params.delete(\"image\")\n\n if @image.update(update_params)\n head :no_content\n else\n render json: @image.errors, status: :unprocessable_entity\n end\n end", "def update\n params[:image].delete :created_at\n params[:image].delete :updated_at\n params[:image].delete :id\n @image = Image.find(params[:id])\n if @image.update_attributes(params[:image])\n render json: @image\n else\n render json: @image.errors, status: :unprocessable_entity\n end\n end", "def update\n @image = Image.find(params[:id])\n checkaccountobject(\"images\",@image)\n respond_to do |format|\n if @image.update_attributes(params[:image])\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @images = args[:images] unless args[:images].nil?\n end", "def update_good_images(arg)\n # Get list of images first.\n images = (arg || \"\").split(\" \").map do |id|\n Image.safe_find(id.to_i)\n end.reject(&:nil?)\n\n # Now check for edits.\n images.each do |image|\n next unless check_permission(image)\n args = param_lookup([:good_image, image.id.to_s])\n next unless args\n image.attributes = args\n next unless image.when_changed? ||\n image.notes_changed? ||\n image.copyright_holder_changed? ||\n image.license_id_changed? ||\n image.original_name_changed?\n image.updated_at = Time.now\n args = { id: image }\n args[:set_date] = image.when if image.when_changed?\n args[:set_notes] = image.notes if image.notes_changed?\n if image.copyright_holder_changed?\n args[:set_copyright_holder] = image.copyright_holder\n end\n args[:set_license] = image.license if image.license_id_changed?\n if image.original_name_changed?\n args[:set_original_name] = image.original_name\n end\n if image.save\n Transaction.put_image(args)\n flash_notice(:runtime_image_updated_notes.t(id: image.id))\n else\n flash_object_errors(image)\n end\n end\n\n images\n end", "def update\n @food.build_image(params['image']) do |t|\n if params['food']['image']['data']\n t.data = Base64.encode64(params['food']['image']['data'].read)\n t.filename = params['food']['image']['data'].original_filename\n t.mime_type = params['food']['image']['data'].content_type\n end\n end \n @food.name = @food.name.capitalize\n respond_to do |format|\n if @food.update(food_params)\n format.html { redirect_to @food, notice: 'Food was successfully updated.' }\n format.json { render :show, status: :ok, location: @food }\n else\n format.html { render :edit }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @icesled.update(icesled_params)\n if params[:images]\n @icesled.gallery ||= Gallery.new\n params[:images].each do |image|\n @icesled.gallery.images.create(image: image)\n end\n unless @icesled.image_file_size\n @icesled.update(image: @icesled.gallery.images.first.image)\n end\n end\n format.html { redirect_to @icesled, notice: 'Icesled was successfully updated.' }\n format.json { render :show, status: :ok, location: @icesled }\n else\n format.html { render :edit }\n format.json { render json: @icesled.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @image = Image.find(params[:id])\n type = @image.url_type\n if @image.update_attributes!(params[:image])\n if request.xhr?\n render :text => [ @image.to_jq_upload(type, \"image\") ].to_json.to_s\n else\n redirect_to console_images_path\n end\n else \n if request.xhr?\n render :text => [ @image.to_jq_upload(type, \"image\").merge({ :error => \"custom_failure\" }) ].to_json.to_s\n else\n redirect_to edit_console_image_path(@image)\n end\n end\n end", "def update\n respond_to do |format|\n if @smartphone.update(smartphone_params)\n if params[:images]\n params[:images].each do |val|\n temp = @smartphone.pictures.find_by(image_file_name: val.original_filename)\n if temp\n temp.update_attributes(:image => val)\n else\n @smartphone.pictures.create(image: val)\n end\n end\n end\n format.html { redirect_to @smartphone, notice: 'Smartphone was successfully updated.' }\n format.json { render :show, status: :ok, location: @smartphone }\n else\n format.html { render :edit }\n format.json { render json: @smartphone.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @family_image = FamilyImage.find(params[:id])\n\n if @family_image.update(family_image_params)\n head :no_content\n else\n render json: @family_image.errors, status: :unprocessable_entity\n end\n end", "def update\n par = img_properties\n logger.info(\"parameters: #{par.inspect}\")\n valid = true\n\n # find by user associated to app key, not by user from request parameter!\n @image = Image.editable_by(@user).find_by_guid(params[:id])\n\n return not_found if !@image\n\n # set these variables back to nil if they were in the request but blank\n if par[:ref]\n @image.ref = par[:ref].blank? ? nil : par[:ref]\n end\n if par[:name]\n @image.name = par[:name].blank? ? nil : par[:name]\n end\n if par[:page_url]\n @image.page_url = par[:page_url].blank? ? nil : par[:page_url]\n end\n @image.private = par[:private] if par[:private]\n\n # update calibration data if specified\n if !par[:calibrate_length].blank?\n @image.calibrate_length = par[:calibrate_length].to_f\n @image.calibrate_unit = par[:calibrate_unit].to_i if !par[:calibrate_unit].blank?\n @image.calibrate_coords = par[:calibrate_coords] if !par[:calibrate_coords].blank?\n @image.ppi = calculate_ppi(@image)\n end\n\n orig_url = par[:original_url] || par[:url]\n begin\n # this may fail\n if !orig_url.blank? && orig_url != @image.original_url\n # url was updated\n @image.remote_upload_url = orig_url\n @image.original_url = orig_url\n end\n rescue CarrierWave::DownloadError\n @image.errors.add(:remote_upload_url, \"^This url doesn't appear to be valid\")\n valid = false\n rescue CarrierWave::IntegrityError\n @image.errors.add(:remote_upload_url, \"^This url does not appear to point to a valid image\")\n valid = false\n rescue StandardError\n @image.errors.add(:remote_upload_url, \"There does not appear to be an image at this url\")\n valid = false\n end\n\n if valid && @image.save\n # update product if set\n @image.user_product = par[:product] if par[:product]\n\n image_data = @image.js_serialize\n # if the user hit the 'save and next' button, include the guid of the next image in the response.\n # The client side will redirect to the edit page for that image. \n if params[:commit] == 'save and next'\n image = Image.find_most_recent_uncalibrated(current_user.id)\n image_data['nextImage'] = image.guid if image\n end\n render :json => image_data, :callback => params[:callback]\n else\n render :json => { :error => 403, :messages => prepare_errors(@image), :callback => params[:callback] }, :status => 200\n end\n end", "def update\n new_images = params[:images]||[]\n\n @intention = Intention.find_by_uuid(params[:id])\n @intention.image_urls = IntentionsHelper.strip_duplicate_images(new_images)\n @intention.save\n\n points = VISBD_INTENTION_IMAGE_POINTS*new_images.count\n track_event(current_action_item(Intention::COMPONENT_TYPE)||current_enrollment, Intention::VISUALIZED_EVENT, target:@intention, points:points)\n\n render nothing: true\n end", "def update\n respond_to do |format|\n if @apartment.update(apartment_params)\n if params[:images]\n # The magic is here ;)\n params[:images].each { |image|\n if (image!=nil)\n @apartment.pictures.create(image: image)\n \n end\n }\n end\n format.html { redirect_to @apartment, notice: 'La propiedad se actualizo correctamente.' }\n format.json { render :show, status: :ok, location: @apartment }\n else\n format.html { render :edit }\n format.json { render json: @apartment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @property_image = PropertyImage.find(params[:id])\n\n respond_to do |format|\n if @property_image.update_attributes(params[:property_image])\n format.html { redirect_to property_images_path, notice: 'Property image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @property_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @image = Image.find(params[:id])\n\n respond_to do |format|\n if @image.update_attributes(params[:image])\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @image = Image.find(params[:id])\n\n respond_to do |format|\n if @image.update_attributes(params[:image])\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @image = Image.find(params[:id])\n\n respond_to do |format|\n if @image.update_attributes(params[:image])\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @image = Image.find(params[:id])\n\n respond_to do |format|\n if @image.update_attributes(params[:image])\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @image = args[:image] if args.key?(:image)\n end", "def update\n if @product_image.update_attributes(product_image_params)\n render json: @product_image, status: 200\n else\n render_error 400, @product_image.errors.full_messages\n end\n end", "def update\n @image = Image.find(params[:id])\n\n respond_to do |format|\n if @image.update_attributes(params[:image])\n format.html { redirect_to @image, :notice => 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @image.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @inferred_image_id = args[:inferred_image_id] if args.key?(:inferred_image_id)\n @inferred_image_source = args[:inferred_image_source] if args.key?(:inferred_image_source)\n @inferred_image_type = args[:inferred_image_type] if args.key?(:inferred_image_type)\n @neardup_info = args[:neardup_info] if args.key?(:neardup_info)\n end", "def update\n @pictures = Picture.all.order(created_at: :desc)\n @picture.update(picture_params)\n render json: @pictures\n # head :no_content\n end", "def update\n respond_to do |format|\n if @image_to_sample.update(image_to_sample_params)\n format.html { redirect_to @image_to_sample, notice: 'Image to sample was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @image_to_sample.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_image(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :GET, 'File')\n end", "def update\n @album = Album.find(params[:id])\n \n respond_to do |format|\n if @album.update_attributes(params[:album])\n @album.images.clear\n @album.images << Image.find([params[:images]].flatten)\n @album.save!\n format.html { redirect_to(albums_path, :notice => 'Album was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n authorize @image_set\n if @image_set.update(params[:image_set].permit(:title, :description))\n # to handle multiple images upload on update when user add more pictures\n if params[:images]\n params[:images].each {|image|\n @image_set.images.create(image: image)\n }\n end\n\n flash[:notice] = \"Your image set has been updated!.\"\n redirect_to @image_set\n else\n flash[:alert] = \"Something went wrong.\"\n render 'edit'\n end\n end", "def update\n parms = ski_params\n parms[:color] = parms[:color].split(', ') if parms[:color]\n respond_to do |format|\n if @ski.update(parms)\n if params[:images]\n @ski.gallery ||= Gallery.new\n params[:images].each do |image|\n @ski.gallery.images.create(image: image)\n end\n unless @ski.image_file_size\n @ski.update(image: @ski.gallery.images.first.image)\n end\n end\n format.html { redirect_to @ski, notice: 'Ski was successfully updated.' }\n format.json { render :show, status: :ok, location: @ski }\n else\n format.html { render :edit }\n format.json { render json: @ski.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_image_features(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :PUT, nil)\n nil\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n @item.images.delete_all\n unless params.require(:item)[:images_id].nil?\n params.require(:item)[:images_id].each do |id|\n image = Image.find_by_id(id)\n (@item.images << image) unless image.nil?\n end\n end\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n params = image_params\n params[\"tags\"] = params[\"tags\"].delete_suffix(',')\n\n respond_to do |format|\n if @image.update(params)\n format.html { redirect_to @image, notice: \"Image was successfully updated.\" }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @recipe_image.update(recipe_image_params)\n format.html { redirect_to @recipe_image, notice: 'Recipe image was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe_image }\n else\n format.html { render :edit }\n format.json { render json: @recipe_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @estate_agent_image = EstateAgentsImage.find(params[:id])\n\n respond_to do |format|\n if @estate_agent_image.update_attributes(params[:property_image])\n format.html { redirect_to @estate_agent_image, notice: 'Property image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @estate_agent_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if params[:sequence][:image]\n create_image\n render json: @sequence, status: :ok and return\n end\n respond_to do |format|\n if @sequence.update(sequence_params)\n format.html { redirect_to @sequence, notice: 'Sequence was successfully updated.' }\n format.json { render :show, status: :ok, location: @sequence }\n else\n format.html { render :edit }\n format.json { render json: @sequence.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @request = Request.find(params[:id])\n\n if params[:images_attributes]\n if @request.update(request_params)\n if params[:images_attributes]\n params[:images_attributes]['image'].each do |a|\n @image_attachment = @request.images.create!(:picture => a, :name => 'RequestApp')\n end\n end\n\n redirect_to action: 'show'\n flash[:success] = \"Su solicitud ha sido editada con exito\"\n else\n render 'edit'\n flash.now[:danger] = \"Revise los siguentes errores\"\n end\n else\n flash.now[:danger] = \"La solicitud requiere de una imagen\"\n render 'edit'\n end\n end", "def update!(**args)\n @stable_image = args[:stable_image] if args.key?(:stable_image)\n @target_image = args[:target_image] if args.key?(:target_image)\n end", "def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @idea = Idea.find(params[:id])\n @idea.name = params[:name]\n @idea.description = params[:description]\n repo_path = \"#{Rails.root}/public/data/repository/#{current_user.id}/#{@idea.name}\"\n cover_img_path = \"/data/repository/#{current_user.id}/#{@idea.name}\"\n\n if params[:cover_img]\n @idea.cover_img = params[:cover_img]\n DataFile.save(params[:cover_img], cover_img_path)\n\t\t\t@git = GitHelper.init(repo_path, current_user.email, current_user.name)\n\t\t\tGitHelper.commitAll(@git, \"Changed cover image.\")\n end\n\n if @idea.save\n\t\t\trender json: @idea\n\t\telse\n\t\t\trender json: {error: \"Failed to update idea\"}, status: :unauthorized\n end\n end", "def update\n @variant_image = VariantImage.find(params[:id])\n\n respond_to do |format|\n if @variant_image.update_attributes(params[:variant_image])\n format.html { redirect_to @variant_image, notice: 'Variant image was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @variant_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n @pix.images.attach(params[:images]) if params[:images]\n if @pix.update(pix_params)\n format.html do\n redirect_to go_to_pix(@pix),\n flash: { success: 'Pix was successfully saved.' }\n end\n format.json { render :show, status: :ok, location: @pix }\n else\n format.html { render :edit }\n format.json { render json: @pix.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if image.update(image_params)\n format.html { redirect_to image, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: image }\n else\n format.html { render :edit }\n format.json { render json: image.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_setup_image\n @setup_image = SetupImage.find(params[:id])\n end", "def update_good_images(arg)\n # Get list of images first.\n images = (arg || \"\").split(\" \").map do |id|\n Image.safe_find(id.to_i)\n end.reject(&:nil?)\n\n # Now check for edits.\n images.each do |image|\n next unless check_permission(image)\n\n args = param_lookup([:good_image, image.id.to_s])\n next unless args\n\n image.attributes = args.permit(whitelisted_image_args)\n next unless image.when_changed? ||\n image.notes_changed? ||\n image.copyright_holder_changed? ||\n image.license_id_changed? ||\n image.original_name_changed?\n\n image.updated_at = Time.zone.now\n if image.save\n flash_notice(:runtime_image_updated_notes.t(id: image.id))\n else\n flash_object_errors(image)\n end\n end\n\n images\n end", "def update_attributes(attributes = {},user,images_directory)\n Rails.logger.debug \"Call to photo.update_attributes\"\n if self.valid? #Validate if the Photo object is valid\n Rails.logger.debug \"The photo is valid!\"\n file = attributes[:file]#Set the photo file object\n if !file.blank? #Validate if a file was supplied by the user\n images_directory =images_directory.blank? ? @@images_directory : images_directory #Validate if an image_directory was supplied, otherwise we use the default one\n file_s3_path = Util.upload_image(images_directory,file) #Upload the new image\n if !attributes[:previous_picture].blank? #Validate if there was a previous image file tied to the photo node\n Util.delete_image(attributes[:previous_picture]) #Delete the previous image file\n end\n else\n file_s3_path = self.file #If none was provided, keep the original file\n end\n #Create a raw photo object\n photo_req = { 'title'=>attributes[:title],\n 'description'=>attributes[:description],\n 'url'=>file_s3_path,\n 'date'=> Util.date_to_epoch(attributes[:date]), #Turn the date to epoch\n 'ownerId'=> self.owner_id \n } \n reqUrl = \"/api/photo/#{self.id}\" #Set the request url\n\n rest_response = MwHttpRequest.http_put_request(reqUrl,photo_req,user['email'],user['password']) #Make the PUT call to the server with the required parameters\n Rails.logger.debug \"Response from server: #{rest_response.code} #{rest_response.message}: #{rest_response.body}\"\n if rest_response.code == \"200\" #Validate if the response from the server is 200, which means OK\n photo = Photo.rest_to_photo(rest_response.body)\n return true, photo #Return success\n else\n return false, \"#{rest_response.code}\", \"#{rest_response.message}\" #Return error\n end\n else\n Rails.logger.debug self.errors.full_messages\n return false, self.errors.full_messages #Return invalid object error\n end\n end", "def update!(**args)\n @image = args[:image] unless args[:image].nil?\n end", "def update\n respond_to do |format|\n if @image_label_set.update(image_label_set_params)\n format.html { redirect_to @image_label_set, notice: 'Image label set was successfully updated.' }\n format.json { render :show, status: :ok, location: @image_label_set }\n else\n format.html { render :edit }\n format.json { render json: @image_label_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @image = Image.find(params[:id])\n\n respond_to do |format|\n if @image.update_attributes(params[:image])\n format.html { redirect_to mypictures_path}\n format.json { head :no_content }\n flash[:success] = \"Image updated\"\n\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @image.update(image_params)\n redirect_to '/images'\n end", "def update!(**args)\n @inferred_image_source = args[:inferred_image_source] if args.key?(:inferred_image_source)\n @inferred_image_type = args[:inferred_image_type] if args.key?(:inferred_image_type)\n end", "def update\n #Finds selected data file\n @image = Image.find(params[:id])\n\n #Components\n #Checks if the data file is attached to any components - if so clears them\n if(!@image.components.nil?)\n @image.components.clear\n end\n #Sets Data Files Components\n if(!params[:component_parent_ids].nil?)\n for id in params[:component_parent_ids]\n @image.components.push(Component.find(id))\n end\n end\n\n #Products\n #Checks if the data file is attached to any products - if so clears them\n if(!@image.products.nil?)\n @image.products.clear\n end\n #Sets Data Files Products\n if(!params[:product_ids].nil?)\n for id in params[:product_ids]\n @image.products.push(Product.find(id))\n end\n end\n\n #Valuefields\n #Checks if the data file is attached to any valuefields - if so clears them\n if(!@image.valuefields.nil?)\n @image.valuefields.clear\n end\n #Sets Data Files Valuefields\n if(!params[:valuefield_ids].nil?)\n for id in params[:valuefield_ids]\n @image.valuefields.push(Valuefield.find(id))\n end\n end\n #creates an array of products\n @all_products = Product.all\n #creates an array of components\n @all_components = Component.all\n #creates an array of valuefields\n @all_valuefields = Valuefield.all\n respond_to do |format|\n if @image.update_attributes(params[:image])\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @update_photo_requests = args[:update_photo_requests] if args.key?(:update_photo_requests)\n end", "def update\n respond_to do |format|\n if @image.update_attributes(image_params)\n flash[:notice] = 'Image was successfully updated.'\n format.html { redirect_to(@image) }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @image.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @imagedemo.update(imagedemo_params)\n format.html { redirect_to @imagedemo, notice: 'Imagedemo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @imagedemo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @head_machine_spec = args[:head_machine_spec] if args.key?(:head_machine_spec)\n @image_uri = args[:image_uri] if args.key?(:image_uri)\n end", "def create\n @setup_image = SetupImage.new(setup_image_params)\n respond_to do |format|\n if @setup_image.save\n format.html { redirect_to setup_path(@setup_image.setup_id),\n notice: 'Setup was successfully updated.' }\n format.json { render :show, status: :created, location: @setup_image }\n else\n format.html { render :new }\n format.json { render json: @setup_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @rent.update(rent_params)\n\n if params[:image]\n puts params[:image]\n params[:image].each { |image|\n @rent.rent_images.create(rent_id: @rent.id, image:image)\n }\n \n end\n \n format.html { redirect_to @rent, notice: 'Rent was successfully updated.' }\n format.json { render :show, status: :ok, location: @rent }\n else\n format.html { render :edit }\n format.json { render json: @rent.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_image\n # wish image can be updated only when then wish belongs to current user\n if @wish.user_id == current_user.id\n @wish.image.purge\n @wish.image.attach(wish_params[:image])\n render json: url_for(@wish.image)\n end\n end", "def update\n if @experience.update(experience_params)\n\n if params[:images] \n params[:images].each do |image|\n @experience.photos.create(image: image)\n end\n end\n\n redirect_to edit_trip_experience_path(@trip,@experience), notice: \"Updated...\"\n else\n render :edit\n end\n end", "def update!(**args)\n @image = args[:image] if args.key?(:image)\n @question = args[:question] if args.key?(:question)\n end", "def setup_image_params\n params.require(:setup_image).permit(:setup_id, :image)\n end", "def update\n respond_to do |format|\n if @experience_image.update(experience_image_params)\n format.html { redirect_to @experience_image, notice: 'Experience image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @experience_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @check_in_image.update(check_in_image_params)\n format.html { redirect_to @check_in_image, notice: 'Check in image was successfully updated.' }\n format.json { render :show, status: :ok, location: @check_in_image }\n else\n format.html { render :edit }\n format.json { render json: @check_in_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @img.update(img_params)\n format.html { redirect_to @img, notice: \"Img was successfully updated.\" }\n format.json { render :show, status: :ok, location: @img }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @img.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t@artwork = Artwork.find(params[:id])\n\n\trespond_to do |format|\n\t\tif @artwork.update_attributes(artwork_params)\n\t\t\tif params[:images]\n\t\t\t\tparams[:images].each { |image| \n\t\t\t\t\t@artwork.pictures.create(image: image)\n\t\t\t\t}\n\t\t\tend\n\n\t\t\tredirect_to @artwork, notice: \"Artwork submitted successfully\"\n\t\telse\n\t\t\trender 'edit'\n\t\tend\n\tend\nend", "def update\n respond_to do |format|\n if @admin_image.update(admin_image_params)\n format.html { redirect_to @admin_image, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_image }\n else\n format.html { render :edit }\n format.json { render json: @admin_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @inferred_image_types = args[:inferred_image_types] if args.key?(:inferred_image_types)\n @ips_offer_id = args[:ips_offer_id] if args.key?(:ips_offer_id)\n end", "def update\n images_arr = params[:images]\n params[:list_item].delete(:image)\n @list_item = ListItem.find(params[:id])\n @image = Image.new(images_arr)\n @list_item.images << @image\n\n respond_to do |format|\n if @list_item.update_attributes(params[:list_item])\n format.html { redirect_to user_url(current_user), notice: t('list_items.updated') }\n format.json { render :json => @list_item }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @list_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @image_upload = ImageUpload.find(params[:id])\n\n respond_to do |format|\n if @image_upload.update_attributes(params[:image_upload])\n format.html { redirect_to @image_upload, notice: 'Image upload was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image_upload.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if(@check)\n @evento.update(event_params.except(:token))\n if @evento.save\n #first we delete all the current images if there are\n if params[:event_image_data]\n @evento.event_images.each do |image|\n image.destroy\n end\n #then we will create new ones\n params[:event_image_data].each do |file|\n @evento.event_images.create!(:image => file)\n end\n end\n render json: @evento, status: :ok, location: @evento\n else\n render json: @evento.errors, status: :unprocessable_entity\n end\n end\n end", "def update\n respond_to do |format|\n if @image.update(image_params)\n format.html {redirect_to @image, notice: 'Image was successfully updated.'}\n format.json {render :show, status: :ok, location: @image}\n else\n format.html {render :edit}\n format.json {render json: @image.errors, status: :unprocessable_entity}\n end\n end\n end", "def update\n flash[:notice] = 'Image Successfully updated' if @image.update_attributes! params[:image]\n respond_with @owner, @image\n end", "def update!(**args)\n @image_url = args[:image_url] if args.key?(:image_url)\n @status = args[:status] if args.key?(:status)\n @type = args[:type] if args.key?(:type)\n end", "def update\n @memberimage = Memberimage.find(params[:id])\n\n respond_to do |format|\n if @memberimage.update_attributes(params[:memberimage])\n format.html { redirect_to ideas_path, notice: 'Memberimage was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @memberimage.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @image_reference.update_attributes image_reference_params\n format.html { redirect_to @image_reference, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image_reference.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @used_bike = UsedBike.find(params[:id])\n\n if @used_bike.update(used_bike_params)\n adding_images(params)\n head :no_content\n else\n render json: @used_bike.errors, status: :unprocessable_entity\n end\n end", "def update!(**args)\n @image = args[:image] if args.key?(:image)\n @java_jars = args[:java_jars] if args.key?(:java_jars)\n @properties = args[:properties] if args.key?(:properties)\n @python_packages = args[:python_packages] if args.key?(:python_packages)\n end", "def update!(**args)\n @image_docid = args[:image_docid] if args.key?(:image_docid)\n @product_image_type = args[:product_image_type] if args.key?(:product_image_type)\n end", "def update\n @image = Image.find(params[:id])\n unless params[:image][:tags].nil?\n @image.tag_with params[:image]['tags']\n params[:image].delete(\"tags\")\n end\n respond_to do |format|\n if @image.update_attributes(params[:image])\n flash[:notice] = 'Image was successfully updated.'\n format.html { redirect_to([:admin, @image]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @image.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\r\n respond_to do |format|\r\n if @image.update(image_params)\r\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @image }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @image.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @featureimg.update(featureimg_params)\n format.html { redirect_to current_user, notice: 'Feature Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @featureimg.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @image = ServiceImage.find(params[:id])\n respond_to do |format|\n if @image.update(car_image_params)\n flash[:success] = \"Car Image was successfully updated.\"\n format.html { redirect_to admin_car_car_images_path(@image.car) }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vehicle_type.update(vehicle_type_params)\n images\n\n format.html { redirect_to @vehicle_type, notice: 'Vehicle type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vehicle_type.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" ]
[ "0.6779511", "0.6640825", "0.63569057", "0.6243799", "0.6202941", "0.61961436", "0.6196014", "0.6186075", "0.6179634", "0.614356", "0.61386883", "0.6095758", "0.6090155", "0.60816914", "0.6075981", "0.6075981", "0.6075981", "0.6075981", "0.60644954", "0.6059828", "0.60595286", "0.603371", "0.60060394", "0.5999728", "0.59970796", "0.59969854", "0.59945375", "0.59906274", "0.59885985", "0.598804", "0.59876347", "0.5985802", "0.5982749", "0.59769285", "0.5961071", "0.59543353", "0.5952425", "0.5952425", "0.5952425", "0.5952425", "0.5952425", "0.5952425", "0.5952425", "0.5940053", "0.5922513", "0.592188", "0.5916717", "0.59129685", "0.58774567", "0.58642876", "0.5864186", "0.58625907", "0.5859783", "0.58581436", "0.5855356", "0.58515275", "0.5848824", "0.5848345", "0.58411664", "0.5838188", "0.5838188", "0.5838188", "0.5838188", "0.5838188", "0.5838188", "0.5838188", "0.5838188", "0.5838188", "0.5838188", "0.5838188", "0.58373296", "0.5835533", "0.5833173", "0.58310604", "0.58262056", "0.5814637", "0.58118534", "0.58114856", "0.5808987", "0.5806182", "0.5799642", "0.5798397", "0.57917315", "0.5789611", "0.5785199", "0.57848996", "0.5779683", "0.5778474", "0.5775961", "0.57690334", "0.57606995", "0.5756219", "0.5754391", "0.5752412", "0.57493716", "0.5748511", "0.57464486", "0.5746027", "0.5736171", "0.5723997" ]
0.6892546
0
DELETE /setup_images/1 DELETE /setup_images/1.json
def destroy @setup_image.destroy respond_to do |format| format.html { redirect_to :back } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n request(:delete, \"/computing/image/#{uuid}\")\n true\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n render json: {status: \"success\"}, status: :ok\n end", "def destroy\n @image.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @image = Image.find(params[:id])\n \n imagen = @image.filename\n \n #function in manage_images.rb\n remove_image_file(imagen)\n \n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :ok }\n end\n end", "def destroy\n #Finds selected image\n @image = Image.find(params[:id])\n #destroy image\n @image.destroy\n respond_to do |format|\n format.html { redirect_to '/admin' }\n format.json { head :ok }\n end\n end", "def deleteEntityImage( 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/image\",params)\n end", "def destroy\n @imagedemo.destroy\n respond_to do |format|\n format.html { redirect_to imagedemos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image_to_sample.destroy\n respond_to do |format|\n format.html { redirect_to image_to_samples_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(images_url) }\n format.json { head :ok }\n end\n end", "def destroy\n @estate_agent_image = EstateAgentsImage.find(params[:id])\n @estate_agent_image.destroy\n\n respond_to do |format|\n format.html { redirect_to estate_agent_image_images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n output = \"oneimage delete #{resource[:name]} \", self.class.login\n `#{output}`\n end", "def delete\n item = FormImage.last\n id = item[:id]\n item.destroy\n render json: {id: id}\n end", "def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image_upload = ImageUpload.find(params[:id])\n @image_upload.destroy\n\n respond_to do |format|\n format.html { redirect_to image_uploads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n ApiAction.new.destroy_image(@logo.uuid_image)\n @logo.destroy\n respond_to do |format|\n format.html { redirect_to campaign_path(@logo.campaign), notice: 'Logo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sample_photo.destroy\n render json: {message: 'Foto Excluida'} , status: :ok\n end", "def destroy\n @featureimg.destroy\n respond_to do |format|\n format.html { redirect_to featureimgs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n redirect_to console_images_path\n end", "def destroy\n Image.find(params[:id]).destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @structure_photo.destroy\n render json: {message: 'Foto Excluida'} , status: :ok\n end", "def destroy\n @story_image.destroy\n respond_to do |format|\n format.html { redirect_to story_images_url }\n format.json { head :no_content }\n end\n end", "def delete_image(image_id)\n delete(\"cloud-instances/#{guid}/images/#{image_id}\")\n end", "def destroy\n @image_url = ImageUrl.find(params[:id])\n @image_url.destroy\n\n respond_to do |format|\n format.html { redirect_to image_urls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @recipe_image.destroy\n respond_to do |format|\n format.html { redirect_to recipe_images_url, notice: 'Recipe image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bgimage = Bgimage.find(params[:id])\n @bgimage.destroy\n\n respond_to do |format|\n format.html { redirect_to bgimages_url }\n format.json { head :no_content }\n end\n end", "def remove_image( image_id )\n image_id = image_id.to_s.upcase\n upload_key = UPLOAD_PATH % image_id\n hires_key = HIRES_PATH % image_id\n lowres_key = LOWRES_PATH % image_id\n\n client.delete_objects(\n bucket: aws.bucket,\n delete: {\n objects: [\n {key: upload_key},\n {key: hires_key},\n {key: lowres_key}\n ]\n }\n )\n end", "def destroy\n @image = Gui::Image.find(params[:id])\n @image.destroy\n redirect_to gui_panels_path\n\n # respond_to do |format|\n # format.html { redirect_to gui_images_url }\n # format.json { head :no_content }\n # end\n end", "def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was deleted successfully.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @image_section = ImageSection.find(params[:id])\n @image_section.destroy\n\n respond_to do |format|\n format.html { redirect_to image_sections_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @property_image = PropertyImage.find(params[:id])\n @property_image.destroy\n\n respond_to do |format|\n format.html { redirect_to property_images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n File.delete(Rails.root.join(\"app\",'assets','images',@photo.path))\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @experience_image.destroy\n respond_to do |format|\n format.html { redirect_to experience_images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image_path = ImagePath.find(params[:id])\n @image_path.destroy\n\n respond_to do |format|\n format.html { redirect_to(image_paths_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @banner_img = BannerImg.find(params[:id])\n @banner_img.destroy\n\n respond_to do |format|\n format.html { redirect_to banner_imgs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n file_url = @image.url\n @image.destroy\n\n File.delete(\"public/uploads/#{file_url}\")\n\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_bg_image.destroy\n respond_to do |format|\n format.html { redirect_to admin_bg_images_url, notice: 'Bg image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n image = Image.find(params[:id])\n if image.user_id == current_user.id\n image.destroy\n render json:{}, status:201\n end\n end", "def destroy\n @admin_image.destroy\n respond_to do |format|\n format.html { redirect_to admin_images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @img.destroy\n respond_to do |format|\n format.html { redirect_to imgs_url, notice: \"Img was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @image = Image.find(params[:id])\n checkaccountobject(\"images\",@image)\n cloud = Oecloud.new(:zone => @image.zone, :image => @image)\n if cloud.deregisterimage\n @image.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :ok }\n end\n end", "def destroy\n @check_in_image.destroy\n respond_to do |format|\n format.html { redirect_to check_in_images_url, notice: 'Check in image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @imagem = Imagem.find(params[:id])\n @imagem.destroy\n\n respond_to do |format|\n format.html { redirect_to imagems_url }\n format.json { head :ok }\n end\n end", "def destroy\n @loc_image.destroy\n respond_to do |format|\n format.html { redirect_to loc_images_url }\n format.json { head :no_content }\n end\n end", "def delete_image(id)\n uri = URI.parse(\"http://\" + @location.host + \":\" + @location.port.to_s + \"/v2/images/\" + id)\n return delete_request(uri, @token)\n end", "def destroy\n @img = Img.find(params[:id])\n @img.destroy\n\n respond_to do |format|\n format.html { redirect_to(imgs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @image_set = ImageSet.find(params[:id])\n @image_set.destroy\n\n respond_to do |format|\n format.html { redirect_to(image_sets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n head :no_content\n end", "def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n ImagesIndex.delete params[:id]\n respond_to do |format|\n format.html { redirect_to(\"/images_indices\") }\n format.xml { head :ok }\n end\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_images_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n\n # Destroy s3 objects\n aws_s3_delete(@photo.key)\n Sebitmin::Application.config.thumbnail_sizes.each do |thumbnail_size|\n aws_s3_delete(@photo[\"thumbnail_key_#{thumbnail_size}\"])\n end\n\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @markdown_image.destroy\n respond_to do |format|\n format.html { redirect_to admin_markdown_images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image_reference.destroy\n respond_to do |format|\n format.html { redirect_to image_references_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image.destroy()\n respond_to do |format|\n format.html { redirect_to images_url, notice: \"Image was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @motivational_image = MotivationalImage.find(params[:id])\n @motivational_image.destroy\n\n respond_to do |format|\n format.html { redirect_to motivational_images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: \"Image was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @image.destroy\n respond_to do |format|\n format.html {redirect_to admin_path, notice: 'Image was successfully destroyed.'}\n format.json {head :no_content}\n end\n end", "def destroy\n @s3_image = S3Image.find(params[:id])\n @s3_image.destroy\n\n respond_to do |format|\n format.html { redirect_to s3_images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @memberimage = Memberimage.find(params[:id])\n @memberimage.destroy\n\n respond_to do |format|\n format.html { redirect_to memberimages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @illustration = Illustration.find(params[:id])\n @illustration.destroy\n\n respond_to do |format|\n format.html { redirect_to illustrations_url }\n format.json { head :ok }\n end\n end", "def destroy\n @objective_image.destroy\n respond_to do |format|\n format.html { redirect_to objective_images_url, notice: 'Objective image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @image_dataset = ImageDataset.find(params[:id])\n @image_dataset.destroy\n\n respond_to do |format|\n format.html { redirect_to(image_datasets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @unit_image.destroy\n respond_to do |format|\n format.html { redirect_to unit_images_url, notice: 'Unit image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bwimage = Bwimage.find(params[:id])\n @bwimage.destroy\n\n respond_to do |format|\n format.html { redirect_to bwimages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @column_image.destroy\n respond_to do |format|\n format.html { redirect_to column_images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.image.destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @illustration = Illustration.find(params[:id])\n @illustration.destroy\n\n respond_to do |format|\n format.html { redirect_to illustrations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @combined_image = CombinedImage.find(params[:id])\n @combined_image.destroy\n\n respond_to do |format|\n format.html { redirect_to combined_images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @entry = Entry.find(params[:id])\n img_choices = @entry.optional_images\n @entry.destroy\n @json_response = {\"response\" => \"success\", \"img_choices\" => img_choices}\n respond_to do |format|\n format.html { redirect_to entries_url }\n format.json { render json: @json_response }\n #format.js\n end\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(images_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(images_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(images_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @photo1 = Photo1.find(params[:id])\n @photo1.destroy\n\n respond_to do |format|\n format.html { redirect_to photo1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @imagecapturing.destroy\n respond_to do |format|\n format.html { redirect_to imagecapturings_url, notice: 'Imagecapturing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @salon_image.destroy\n respond_to do |format|\n format.html { redirect_to salon_salon_images_url(@salon), notice: 'Salon image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @pet_image_repo.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Image was successfully deleted.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.71614194", "0.7121775", "0.70840627", "0.7064575", "0.70218575", "0.7020135", "0.7004635", "0.69549704", "0.69496924", "0.6917747", "0.6913477", "0.69103336", "0.68787515", "0.68787515", "0.68787515", "0.68787515", "0.68787515", "0.68787515", "0.6859757", "0.6859757", "0.6859757", "0.6859757", "0.6859757", "0.6859757", "0.6859757", "0.6843969", "0.682101", "0.6819523", "0.6816817", "0.6793757", "0.6789961", "0.67884856", "0.6786034", "0.6777263", "0.6774684", "0.67704165", "0.6769297", "0.6767438", "0.67518693", "0.6732874", "0.6729036", "0.67227703", "0.67195624", "0.67084444", "0.67042065", "0.66842574", "0.6681618", "0.66781735", "0.6674483", "0.6667009", "0.66667056", "0.66600144", "0.66571164", "0.66564304", "0.6656295", "0.66529554", "0.66525495", "0.664104", "0.6640472", "0.6638267", "0.66366196", "0.6636075", "0.6635389", "0.6631137", "0.6631137", "0.6631137", "0.6631137", "0.6631137", "0.6631137", "0.6631137", "0.6631137", "0.6631137", "0.6631137", "0.6631137", "0.6631137", "0.66309875", "0.6628649", "0.6628621", "0.6627687", "0.6624583", "0.6624463", "0.66219276", "0.6609355", "0.66078955", "0.6606533", "0.660422", "0.6598932", "0.65966916", "0.65907395", "0.65855026", "0.65849054", "0.65837216", "0.65820867", "0.65765864", "0.65765864", "0.65765864", "0.6575954", "0.6569861", "0.6569302", "0.6569254" ]
0.7487771
0
Use callbacks to share common setup or constraints between actions.
def set_setup_image @setup_image = SetupImage.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 setup_image_params params.require(:setup_image).permit(:setup_id, :image) 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